output_description: Print an integer representing the minimum number of minutes needed to make N
  pieces of takoyaki.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N X T
attempt: import sys
  
  input = sys.stdin.readline
  h, w, m = map(int, input().rstrip().split())
  hw = [list(map(int, input().rstrip().split())) for _ in range(m)]
  
  tate = [0] * (h + 1)
  yoko = [0] * (w + 1)
  bombpoint = set()
  
  for x, y in hw:
      tate[x] += 1
      yoko[y] += 1
      bombpoint.add((x, y))
  
  ans_x = []
  ans_y = []
  x_max = max(tate)
  y_max = max(yoko)
  for i in range(len(tate)):
      if tate[i] == x_max:
          ans_x.append(i)
  for i in range(len(yoko)):
      if yoko[i] == y_max:
          ans_y.append(i)
  
  ans = x_max + y_max
  for x in ans_x:
      for y in ans_y:
          if (x, y) not in bombpoint:
              print(ans)
              exit()
  print(ans - 1)
  
problem_description: Statement
  
  Takahashi loves takoyaki - a ball-shaped snack.
  
  With a takoyaki machine, he can make at most X pieces of takoyaki at a time,
  taking T minutes regardless of the number of pieces to make.
  
  How long does it take to make N takoyaki?
samples: [{"input": "20 12 6", "output": "12\n    \n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the\nnext 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1\nminute.\n\n* * *"}, {"input": "1000 1 1000", "output": "1000000\n    \n\nIt seems to take a long time to make this kind of takoyaki."}]