IDENTIFICATION  DIVISION.
PROGRAM-ID.     HELLO.
 
DATA DIVISION.
    WORKING-STORAGE SECTION.
        01 INP PIC X(20).
        01 N PIC 9(6).
        01 D PIC 9(6).
        
        01 X PIC 9(6).
        01 Y PIC 9(6).
        
        01 XYSQ PIC 9(6)V9999.
        
        01 CNT PIC 9(6).
        
        01 OUT PIC Z(5)9.
        
      
PROCEDURE       DIVISION.
*> 受け取り
    ACCEPT INP.
    UNSTRING INP DELIMITED ' '
        INTO N D.
        
    PERFORM N TIMES
        ACCEPT INP
        UNSTRING INP DELIMITED ' '
            INTO X Y
        COMPUTE XYSQ = (X * X + Y * Y) ** 0.5
    
        IF XYSQ <= D THEN
            COMPUTE CNT = CNT + 1
        END-IF
        
        
    END-PERFORM.

    MOVE CNT TO OUT.
    
    DISPLAY FUNCTION TRIM (OUT).
    STOP   RUN.