Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = int(input())
- cnd = [0] * N
- c = [0] * N
- for i in range(N):
- s = input().split()
- M = int(s[1]) % int(s[0])
- for j in range(N):
- if M == cnd[j] and M != 0:
- c[j] += 1
- cnd[i] = M
- mMax = 0
- d = 0
- for i in range(N):
- if c[i] > mMax:
- mMax = c[i]
- d = i
- if c[i] == mMax:
- if cnd[i] > cnd[d]:
- d = i
- print(cnd[d])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement