• Source
    1. import sys
    2.  
    3.  
    4. def scored(bowl_x, bowl_y, radius, throw_cords):
    5. if (bowl_x - throw_cords[0])**2 + (bowl_y - throw_cords[1])**2 <= radius**2:
    6. return 1
    7. else:
    8. return 0
    9.  
    10.  
    11. x, y, r, attempts = map(float, input().split())
    12. n = int(input())
    13. try:
    14.  
    15. scores = {}
    16. for _ in range(n):
    17. name = str(input())
    18. scores[name] = 0
    19. for throws in range(int(attempts)):
    20. cords = list(map(float, input().split()))
    21. scores[name] += scored(bowl_x=x, bowl_y=y, radius=r, throw_cords=cords)
    22. winner = max(scores, key=scores.get)
    23. print(winner, scores[winner])
    24. except n > 1000:
    25. sys.exit(0)
    26.