IDENTIFICATION DIVISION.
PROGRAM-ID. 174B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(20).
01 N          PIC 9(06).
01 D          PIC 9(06).
01 I          PIC 9(06)      COMP.
01 X          PIC S9(06).
01 Y          PIC S9(06).
01 K          PIC 9(11)V9(7) COMP.
01 CNT        PIC 9(06) COMP.
01 OUT        PIC Z(5)9.
*>
PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ' '
      INTO N D.
*>
  MOVE ZERO TO CNT.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    ACCEPT INP
    UNSTRING INP DELIMITED BY ' '
        INTO X Y
*>
    COMPUTE K = (X * X + Y * Y) ** 0.5
    IF (K <= D)
      ADD 1 TO CNT
    END-IF
  END-PERFORM.
*>
  MOVE CNT TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.
