Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = input()
if s == "SSS":
    print(0)
elif s == "SSR":
    print(1)
elif s == "SRS":
    print(1)
elif s == "SRR":
    print(2)
elif s == "RSS":
    print(1)
elif s == "RSR":
    print(1)
elif s == "RRS":
    print(2)
elif s == "RRR":
    print(3)

        

Fixed submission:
s = input()
if s == "SSS":
    print(0)
elif s == "SSR":
    print(1)
elif s == "SRS":
    print(1)
elif s == "SRR":
    print(2)
elif s == "RSS":
    print(1)
elif s == "RSR":
    print(1)
elif s == "RRS":
    print(2)
elif s == "RRR":
    print(3)

Buggy python submission (verdict: Runtime Error):
a = input()
b = 0
if s == "SSS":
    print(0)
elif s == "SSR":
    print(1)
elif s == "SRS":
    print(1)
elif s == "SRR":
    print(2)
elif s == "RSS":
    print(1)
elif s == "RSR":
    print(1)
elif s == "RRS":
    print(2)
elif s == "RRR":
    print(3)

        

Fixed submission:
s = input()
if s == "SSS":
    print(0)
elif s == "SSR":
    print(1)
elif s == "SRS":
    print(1)
elif s == "SRR":
    print(2)
elif s == "RSS":
    print(1)
elif s == "RSR":
    print(1)
elif s == "RRS":
    print(2)
elif s == "RRR":
    print(3)
Buggy python submission (verdict: Runtime Error):
import sympy
n = int(input())
a = 0
for j in range(1,n+1):
    a += j * len(sympy.divisors(j))
print(a)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
  ans+=(i+i*(n//i))*(n//i)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = 0
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return len(lower_divisors + upper_divisors[::-1])
for j in range(1,n+1):
    a += j * make_divisors(j)
print(a)


Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
  ans+=(i+i*(n//i))*(n//i)//2
print(ans)

Buggy python submission (verdict: Runtime Error):
import sympy
n = int(input())
a = 0
for i in range(1,n+1):
    a += i*sympy.divisor_count(i)
print(a)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
  ans+=(i+i*(n//i))*(n//i)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 1
for i in a:
    b = i * b
if b > 10 ** 18:
    print("-1")
else:
    print(b)


Fixed submission:
def main():
	N = int(input())
	A = list(map(int, input().split()))
 
	if 0 in A:
		print(0)
		return
 
	prod = 1
	for a in A:
		prod *= a
		if prod > int(10**18):
			print(-1)
			return
 
	print(prod)
 
main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = str(input())
l = m.split()
if max(l) >= sum(l) - max(l):
    print("No")
else:
    print("Yes")

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
if max(l) < sum(l) - max(l):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
ans = min(b,　d) - max(a,　c)
if ans < 0:
    print(0)
else:
    print(ans)

Fixed submission:
a,b,c,d = map(int,input().split())
ans = min(b,d) - max(a,c)
if ans < 0:
    print(0)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = 1
for i in range(1,n+1):
    a = a*i
print(a%(10**9+7))

Fixed submission:
import math
n = int(input())
a = math.factorial(n)
print(a%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
a = 0
for i in range(K):
    a += 7*(10**i)
    a = a % K
    if a == 0:
        print(i+1)
        exit()
print(-1)


Fixed submission:
K = int(input())
a = 0
t = 1
for i in range(K):
    a += 7*t
    a = a % K
    t = t*10
    t = t%K
    if a == 0:
        print(i+1)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li=[]
num=0
for i in range(n):
    x=input()
    if x not in li:
        li.append(x)
        num+=1
print(num)

Fixed submission:
n=int(input())
li=[]
num=0
for i in range(n):
    li.append(input())
se=set(li)
lis=list(se)
print(len(lis))
Buggy python submission (verdict: Runtime Error):
n=int(input())
li=list(map(int,input().split()))
li.sort()
li2=[]
for i in range(len(li)+1):
    li2.append(li.count(i+1))
for s in li2:
    print(s)

Fixed submission:
r=int(input())
x=2*r*3.14159265358979323846
print(x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
li=list(map(int,input().split()))
for i in range(n):
    x=0
    for s in range(len(li)):
        if i+1==li[s]:
            x+=1
    print(x)

Fixed submission:
r=int(input())
x=2*r*3.14159265358979323846
print(x)
Buggy python submission (verdict: Runtime Error):
a


Fixed submission:
li=list(str(input()))
if '7' in li:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
x,k=map(int,input().split())
while x>=0:
    x-=k
if x<0:
    x*=-1
y=x-k
if y <0:
    y*=-1
if x<y:
    print(x)
if x>y:
    print(y)
if x==y:
    print(x)

Fixed submission:
n,k=map(int,input().split())
x=n%k
while x>=0:
    x-=k
if x<0:
    x*=-1
y=x-k
if y <0:
    y*=-1
if x<y:
    print(x)
if x>y:
    print(y)
if x==y:
    print(x)

Buggy python submission (verdict: Time Limit Exceeded):
x,k=map(int,input().split())
while x>=0:
    x-=k
if x<0:
    x*=-1
y=x-k
if y <0:
    y*=-1
if x<y:
    print(x)
if x>y:
    print(y)
if x==y:
    print(x)

Fixed submission:
n,k=map(int,input().split())
x=n%k
while x>=0:
    x-=k
if x<0:
    x*=-1
y=x-k
if y <0:
    y*=-1
if x<y:
    print(x)
if x>y:
    print(y)
if x==y:
    print(x)
Buggy python submission (verdict: Runtime Error):
li=list(input())
a=li[2]
b=li[3]
c=li[4]
d=li[5]
if a=b:
    if c=d:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Fixed submission:
li=list(input())
a=li[2]
b=li[3]
c=li[4]
d=li[5]
if a==b:
    if c==d:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
li=list(inoput())
a=li[2]
b=li[3]
c=li[4]
d=li[5]
if a=b:
    if c=d:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Fixed submission:
li=list(input())
a=li[2]
b=li[3]
c=li[4]
d=li[5]
if a==b:
    if c==d:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
li=list(input())
n=len(li)
x=1
y=int((n-1)/2-x+1)
X='a'
Y='a'
while X==Y:
    X=li[x]
    Y=li[y]
    x+=1
    if x == (n+1)/4:
        print('Yes')
        break
    else:
        continue
if x != (n+1)/4: 
    print('No')

Fixed submission:
li=list(input())
li_rev=list(reversed(li))
n=len(li)
li_slice=li[0:int((n-1)/2)]
li_slrev=list(reversed(li_slice))
n=len(li)
if li==li_rev:
    if li_slice==li_slrev:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import *
n, k = map(int, input().split())
mod = 998244353
strides = []
for i in range(k):
  l, r = map(int, input().split())
  for t in range(l, r + 1):
    strides.append(t)
strides.sort()

d = [0] * (n + 1)  # マスに対応
d[0] = 1
for i in range(1, n):
  for stride in strides:
    if i >= stride:
      d[i] += d[i - stride]
  d[i] %= mod
print(d[n-1])

Fixed submission:
n, k = map(int, input().split())
mod = 998244353
d = [0] * (n + 1)
d[1] = 1
LR =[list(map(int, input().split())) for _ in range(k)]

for i in range(2, n+1):
  d[i] = d[i - 1]
  for l, r in LR:
    if i - l <= 0:
      continue
    d[i] = (d[i] + (d[i-l] - d[max(0,i-r-1)])) % mod
print((d[-1] - d[-2])%mod)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import *

n = int(input())
As = list(map(int, input().split()))
D = 10 ** 9 + 7
ans = 0

for pair in combinations(As, 2):
  ans = (ans + pair[0] * pair[1]) % D
  
print(ans)

Fixed submission:
n = int(input())
As = list(map(int, input().split()))
D = 10 ** 9 + 7
ans = 0
s = sum(As)

for a in As:
  ans += (s-a) * a
  
print(ans // 2 % D)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
Ps = list(map(int, input().split()))
Ps.insert(0,0)
Cs = list(map(int, input().split()))
Cs.insert(0,0)
Ls = [0] * (n + 1)  # 周期
As = [] # 回答候補

# 周期を見つける
for i in range(1,n + 1):
  count = 1
  temp = Ps[i]
  while temp != i:
    temp = Ps[temp]
    count += 1
  Ls[i] = count

# それぞれの最大値を見つける
for i in range(1, n + 1):
  ans = 0
  p = []  #途中経過集
  tempIndex = i
  tempSum = 0
  for j in range(Ls[i]):
    tempIndex = Ps[tempIndex]
    tempSum += Cs[tempIndex]
    p.append(tempSum)
  # print(f'p:{p}')
  # ansを求める
  if p[-1] <= 0:
    ans = max(p[:min(k,Ls[i])])
  else:
    q, r = divmod(k, Ls[i])
    # print(f'q,r,k,Ls[i]:{q}{r}{k}{Ls[i]}')
    start = q * p[-1]
    anss = [start]
    tempIndex = i
    tempSum = start
    for z in range(r):
      tempIndex = Ps[tempIndex]
      tempSum += Cs[tempIndex]
      anss.append(tempSum)
    ans = max(anss)
  As.append(ans)
print(max(As))

Fixed submission:
n, k = map(int, input().split())
Ps = list(map(int, input().split()))
Ps.insert(0,0)
Cs = list(map(int, input().split()))
Cs.insert(0,0)
Ls = [0] * (n + 1)  # 周期
As = [0] * (n) # 回答候補

# 周期を見つける
for i in range(1,n + 1):
  count = 1
  temp = Ps[i]
  while temp != i:
    temp = Ps[temp]
    count += 1
  Ls[i] = count

# それぞれの最大値を見つける
for i in range(1, n + 1):
  ans = 0
  p = [0] * Ls[i]  #途中経過集
  tempIndex = i
  tempSum = 0
  for j in range(Ls[i]):
    tempIndex = Ps[tempIndex]
    tempSum += Cs[tempIndex]
    p[j] = tempSum
  # print(f'p:{p}')
  # ansを求める
  if p[-1] <= 0:
    ans = max(p[:min(k,Ls[i])])
  else:
    q, r = divmod(k, Ls[i])
    # print(f'q,r,k,Ls[i]:{q}{r}{k}{Ls[i]}')
    start = (q - 1) * p[-1]
    anss = [0] * (r + Ls[i])
    anss.insert(0, start)
    tempIndex = i
    tempSum = start
    for z in range(r + Ls[i]): #rは高々Ls[i]、つまりn、つまり5 * (10**3)
      tempIndex = Ps[tempIndex]
      tempSum += Cs[tempIndex]
      anss[z + 1] = tempSum
    ans = max(anss)
  As[i-1] = ans
print(max(As))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = input()
ans = min(c.count('W'),c.count('R'))
for i in range(1, n - 1):
  l = c[:i].count('W')
  r = c[i:].count('R')
  ans = min(ans,max(l,r))
print(ans)

Fixed submission:
n = int(input())
c = input()
_w = c.count('W')
_r = c.count('R')
ans = min(_w, _r)
d = [0] * n # i番目までのwの個数
d[0] = 1 if c[0] == 'W' else 0
for i in range(n-1):
  d[i] = d[i-1] + 1 if c[i] == 'W' else d[i-1]
for i in range(1, n - 1):
  l = d[i-1] #c[:i].count('W')
  r = _r - (i-d[i-1])
  ans = min(ans,max(l,r))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
_A = list(map(int, input().split()))
ans = 1000
A = [_A[0]]
B = []

for i in range(n-1):
  if (_A[i] != _A[i + 1]):
    A.append(_A[i+1])

flag = 0
for i in range(len(A)-1):
  if (flag == 0 and A[i] < A[i + 1]):
    flag = 1
    B.append(A[i])
  elif (flag == 1 and A[i] > A[i + 1]):
    flag = 0
    B.append(A[i])
if((A[-1] > A[-2] and flag == 1) or (A[-1] < A[-2] and flag == 0)):
  B.append(A[-1])
if(len(B) < 2):
  print(ans)
  exit()
if(B[-1] < B[-2]):
  B.pop(-1)

stock = 0
for i,b in enumerate(B):
  if(i % 2 == 0):
    stock = ans // b
    ans = ans % b
  else:
    ans = ans + stock * b
    stock = 0

print(ans)

Fixed submission:
n = int(input())
_A = list(map(int, input().split()))
ans = 1000
A = [_A[0]]
B = []

for i in range(n-1):
  if (_A[i] != _A[i + 1]):
    A.append(_A[i+1])

flag = 0
if(len(A) < 2):
  print(ans)
  exit()
for i in range(len(A)-1):
  if (flag == 0 and A[i] < A[i + 1]):
    flag = 1
    B.append(A[i])
  elif (flag == 1 and A[i] > A[i + 1]):
    flag = 0
    B.append(A[i])
if((A[-1] > A[-2] and flag == 1) or (A[-1] < A[-2] and flag == 0)):
  B.append(A[-1])
if(len(B) < 2):
  print(ans)
  exit()
if(B[-1] < B[-2]):
  B.pop(-1)

stock = 0
for i,b in enumerate(B):
  if(i % 2 == 0):
    stock = ans // b
    ans = ans % b
  else:
    ans = ans + stock * b
    stock = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
ans = 0
a, b = [0], [0]

for i in range(N):
  a.append(a[i] + As[i])
for i in range(M):
  b.append(b[i] + Bs[i])    

for i in range(N + 1):
  if (a[i] > K):
    break
  k_ = K - a[i]
  for j in range(M + 1):
    if (b[j] > k_):
      ans = max(ans, i + (j - 1))
      break
    elif (j == M):
      ans = max(ans, i + j)
  
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
ans = 0
j = M
a, b = [0], [0]

for i in range(N):
  a.append(a[i] + As[i])
for i in range(M):
  b.append(b[i] + Bs[i])    

for i in range(N + 1):
  if (a[i] > K):
    break
  k_ = K - a[i]
  while (b[j] > k_):
    j -= 1
  ans = max(ans, i + j)  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

sys.setrecursionlimit(10 ** 9)
n = int(input())


def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0  # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]


prime_list = make_prime_list(math.floor(math.sqrt(10 ** 7 + 1)))


def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count
        if num != 1:
            divisor_num *= 2
    return divisor_num


# def solve(n, acc):
#   if (n == 1):
#     return acc
#   else:
#     return solve(n - 1, search_divisor_num_1(n) * n + acc)

ans = 1
while n > 1:
  ans += search_divisor_num_1(n) * n
  n = n - 1

print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
  tail = (n // i) * i
  ans += (i + tail) * (tail // i) // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'


def calc(x, i):
  target = x - 26 ** i
  if (target <= 0):
    return (x, i)
  else:
    return calc(target, i + 1)


target, index = calc(n, 1)
base26 = [0] * index
for i in range(index):
  tmp, target = divmod(target, 26 ** (index - i - 1))
  if (i == index - 1):
    base26[i] = tmp - 1
  else:
    base26[i] = tmp
ans = ''
for i in base26:
  ans += s[i]
print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'


def calc(x, i):
  target = x - 26 ** i
  if (target <= 0):
    return (x, i)
  else:
    return calc(target, i + 1)


target, index = calc(n, 1)
target -= 1
base26 = [0] * index
for i in range(index):
  tmp, target = divmod(target, 26 ** (index - i - 1))
  base26[i] = tmp
ans = ''
for i in base26:
  ans += s[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'


def calc(x, i):
  target = x - 26 ** i
  if (target < 0):
    return (x, i)
  else:
    return calc(target, i + 1)


def base10to(n, b):
  if(int(n/b)):
    return base10to(int(n/b), b) + str(n % b)
  return str(n % b)


target, index = calc(n, 1)
base26 = str(int(base10to(target, 26)) - 1)
ans = ''
head = index - len(base26)
for a in range(head):
  ans += 'a'
for c in base26:
    ans += s[int(c)]
print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'


def calc(x, i):
  target = x - 26 ** i
  if (target <= 0):
    return (x, i)
  else:
    return calc(target, i + 1)


target, index = calc(n, 1)
target -= 1
base26 = [0] * index
for i in range(index):
  tmp, target = divmod(target, 26 ** (index - i - 1))
  base26[i] = tmp
ans = ''
for i in base26:
  ans += s[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
As = list(map(int, input().split()))
q = int(input())
Ds = [0] * (10 ** 5 + 1)
for a in As:
  Ds[a] += 1
for i in range(q):
  b, c = map(int, input().split())
  Ds[c] += Ds[b]
  Ds[b] = 0
  ans = 0
  for x, i in enumerate(Ds):
    ans += x * i
  print(ans)

Fixed submission:
n = int(input())
As = list(map(int, input().split()))
q = int(input())
Ds = [0] * (10 ** 5 + 1)
Es = [i for i in range(10 ** 5 + 1)]
for a in As:
  Ds[a] += 1
ans = sum(As)
for i in range(q):
  b, c = map(int, input().split())
  ans += Ds[b] * (c-b)
  Ds[c] += Ds[b]
  Ds[b] = 0
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()[::-1]
length = len(s)
a = [0] * length
d = [0] * length
ans = [0] * 2019

a[0] = int(s[0])
d[0] = a[0]
ans[0] = 1 # dif
ans[d[0]] += 1

for i in range(1, length):
    a[i] = int(s[i]) * 10**i % 2019
    d[i] = (d[i-1] + a[i]) % 2019
    ans[d[i]] += 1

# print(int(sum([ans[i] * (ans[i]-1) for i in range(2019)]) / 2) + ans[0])
print(int(sum([ans[i] * (ans[i]-1) for i in range(2019)]) / 2))

Fixed submission:
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

S = input()
size = len(S)
L = [0] * 2019

tmp = int(S[size - 1])  # 最後の文字
L[0] = 1
L[tmp] += 1
tmp_r = 1  # 10のn乗を2019で割った余り(n初期値: 1)

for i in reversed(range(size - 1)):  # 最後の文字の一つ手前からループを回す
    n = int(S[i])  # 対象の文字
    tmp_r = (tmp_r*10) % 2019
    r = (n * tmp_r) % 2019
    tmp = (tmp + r) % 2019
    # print(f"{i}桁目:{tmp}")
    L[tmp] += 1

ans = 0
for i in range(2019):
    tmp = L[i]
    if (tmp > 1):
        ans += tmp * (tmp - 1) // 2


def calc(i):
    if (i == 0):
        return


print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

S = input()
size = len(S)
L = [0] * 2019

tmp = int(S[size-1])  # 最後の文字
L[0] = 1
L[tmp] += 1

for i in reversed(range(size - 1)):  # 最後の文字の一つ手前からループを回す
    d = size - i  # 今の桁数(10の何乗になるのか)
    n = int(S[i])  # 対象の文字
    r = (n * (10 ** (d - 1))) % 2019  # 2019で割った余り
    tmp = (tmp + r) % 2019
    # print(f"{i}桁目:{tmp}")
    L[tmp] += 1

ans = 0
for i in range(2019):
    tmp = L[i]
    if (tmp > 1):
        ans += tmp * (tmp - 1) // 2

print(ans)


Fixed submission:
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

S = input()
size = len(S)
L = [0] * 2019

tmp = int(S[size - 1])  # 最後の文字
L[0] = 1
L[tmp] += 1
tmp_r = 1  # 10のn乗を2019で割った余り(n初期値: 1)

for i in reversed(range(size - 1)):  # 最後の文字の一つ手前からループを回す
    n = int(S[i])  # 対象の文字
    tmp_r = (tmp_r*10) % 2019
    r = (n * tmp_r) % 2019
    tmp = (tmp + r) % 2019
    # print(f"{i}桁目:{tmp}")
    L[tmp] += 1

ans = 0
for i in range(2019):
    tmp = L[i]
    if (tmp > 1):
        ans += tmp * (tmp - 1) // 2


def calc(i):
    if (i == 0):
        return


print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
for a in A:
  if a % 2 == 0 and A % 3 != 0 and A % 5 != 0:
    print('DENIED')
    exit()
print('APPROVED')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    if(A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0):
        print('DENIED')
        exit()
print('APPROVED')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = {}
for n in range(N):
    w = input()
    if w not in D:
        D[w] = 0
    else:
        D[w] += 1
d = sorted(D.items())
d = sorted(D.items(),key=lambda x:-x[1])
m = d[0][1]
l = []
for (key, value) in d:
    if value == m:
        l.append(key)
    else:
        break
for s in sorted(l):
	print(s)

Fixed submission:
N = int(input())
D = {}
for n in range(N):
    w = input()
    if w not in D:
        D[w] = 1
    else:
        D[w] += 1
m = max(D.values())
l = []
for (key, value) in D.items():
    if value == m:
        l.append(key)
for s in sorted(l):
	print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
m = 0
for i in range(N - K + 1):
    tmp = 0
    for j in range(K):
        tmp += (P[i + j] + 1) / 2
    m = max(tmp, m)
print(m)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
A = [0] * (N-K+1)
A[0] = sum(P[:K])
for i in range(N-K):
    A[i+1] = A[i] + P[K+i] - P[i]
m = 0
for i in range(N - K + 1):
    m = max(m, ((A[i] + K) / 2))
print(m)
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B // math.gcd(A, B))

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
A, B = map(int, input().split())
print(A * B // gcd(A, B))
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
i = 0
ans = 0
while i < N:
    if (A[i] == ans+1):
        ans += 1
    i += 1
if ans == 0:
    ans = N + 1
print(N - ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
i = 0
ans = 0
while i < N:
    if (A[i] == ans+1):
        ans += 1
    i += 1
if ans == 0:
    ans = N + 1
print(N - ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
if n % 2 != 0:
    print(ans)
    exit
else:
    n = n // 2
    temp = 1
    while n != 1:
        n = n // 5
        ans += n
    print(ans)

Fixed submission:
n = int(input())
ans = 0
if n % 2 != 0:
    print(ans)
    exit
else:
    n = n // 2
    while (n != 1 and n != 0):
        n = n // 5
        ans += n
    print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)
 
def isEaten(x):
    temp = 0
    for i in range(N):
        t = x // F[i]
        if t < A[i]:
            temp += (A[i] - t)
    return temp <= K:
 
 
def bitSearch(r, l):
    m = (r+l) // 2
    if m == l:
        if isEaten(l):
            print(l)
        else:
            print(r)
        exit()
    elif isEaten(m):
        bitSearch(m, l)
    else:
        bitSearch(r, m)
 
 
target = max([A[i]*F[i] for i in range(N)])
bitSearch(target, 0)

Fixed submission:
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)
 
def isEaten(x):
    temp = 0
    for i in range(N):
        t = x // F[i]
        if t < A[i]:
            temp += (A[i] - t)
    return temp <= K
 
 
def bitSearch(r, l):
    m = (r+l) // 2
    if m == l:
        if isEaten(l):
            print(l)
        else:
            print(r)
        exit()
    elif isEaten(m):
        bitSearch(m, l)
    else:
        bitSearch(r, m)
 
 
target = max([A[i]*F[i] for i in range(N)])
bitSearch(target, 0)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)

def isEaten(x):
    temp = 0
    for i in range(N):
        t = x // F[i]
        if t < A[i]:
            temp += (A[i] - t)
    if temp > K:
        return False
    else:
        return True


def bitSearch(r, l):
    m = (r+l) // 2
    if m == l:
        if isEaten(l):
            print(l)
        else:
            print(r)
        exit()
    elif isEaten(m):
        bitSearch(m, l)
    else:
        bitSearch(r, m)


target = max([A[i]*F[i] for i in range(N)])
bitSearch(target, 0)


Fixed submission:
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)
 
def isEaten(x):
    temp = 0
    for i in range(N):
        t = x // F[i]
        if t < A[i]:
            temp += (A[i] - t)
    return temp <= K
 
 
def bitSearch(r, l):
    m = (r+l) // 2
    if m == l:
        if isEaten(l):
            print(l)
        else:
            print(r)
        exit()
    elif isEaten(m):
        bitSearch(m, l)
    else:
        bitSearch(r, m)
 
 
target = max([A[i]*F[i] for i in range(N)])
bitSearch(target, 0)
Buggy python submission (verdict: Runtime Error):
print(str(int(input())^^3))

Fixed submission:
N = int(input())
print(str(N ** 3))