Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np


def mo(v):
    return v % 1000000007


n = int(input())
a = mo(np.array(list(map(int, input().split()))))
s = 0
for i in range(0, n - 1, 1):
    for j in range(i + 1, n, 1):
        s += mo(a[i] * a[j])
print(mo(s))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]
ans = 0
MOD = 1000000007
for i in range(0, n, 1):
    s.append((s[i] + a[i]) % MOD)

for i in range(0, n, 1):
    ans += ((s[n] - s[i + 1]) * a[i]) % MOD

print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def mo(v):
    return v % 1000000007


n = int(input())
a = mo(np.array(list(map(int, input().split()))))
s = 0
for i in range(0, n - 1, 1):
    for j in range(i + 1, n, 1):
        s += mo(a[i] * a[j])
print(mo(s))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]
ans = 0
MOD = 1000000007
for i in range(0, n, 1):
    s.append((s[i] + a[i]) % MOD)

for i in range(0, n, 1):
    ans += ((s[n] - s[i + 1]) * a[i]) % MOD

print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def mo(v):
    return v % 1000000007


n = int(input())
a = np.array(list(map(int, input().split())))
s = 0
for i in range(0, n - 1, 1):
    for j in range(i + 1, n, 1):
        s += mo(a[i] * a[j])
print(mo(s))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]
ans = 0
MOD = 1000000007
for i in range(0, n, 1):
    s.append((s[i] + a[i]) % MOD)

for i in range(0, n, 1):
    ans += ((s[n] - s[i + 1]) * a[i]) % MOD

print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def mo(v):
    return v % 1000000007


n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
s = 0
for i in range(1, n, 1):
    for j in range(i + 1, n + 1, 1):
        s += mo(a[i] * a[j])
print(mo(s))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]
ans = 0
MOD = 1000000007
for i in range(0, n, 1):
    s.append((s[i] + a[i]) % MOD)

for i in range(0, n, 1):
    ans += ((s[n] - s[i + 1]) * a[i]) % MOD

print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
n, _ = map(int, input().split())
d = list(input().split())


def validate(strNum):
    for i in strNum:
        if i in d:
            return
    print(strNum)
    exit()


for i in range(0, 1000000):
    validate(str(n))
    n += 1


Fixed submission:
li = list(map(int, input().split()))
count5 = count7 = 0
for l in li:
    if l == 5:
        count5 += 1
    elif l == 7:
        count7 += 1
    else:
        print("NO")
        exit()
if count5 == 2 and count7 == 1:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):


n, k = map(int, input().split())
d = list(input().split())


def validate(strNum):
    for i in strNum:
        if i in d:
            return False
    print(strNum)
    exit()


for i in range(0, 10001):
    _ = validate(str(n))
    n += 1


Fixed submission:
li = list(map(int, input().split()))
count5 = count7 = 0
for l in li:
    if l == 5:
        count5 += 1
    elif l == 7:
        count7 += 1
    else:
        print("NO")
        exit()
if count5 == 2 and count7 == 1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
mport sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'yes'
else:
    print 'no'


Fixed submission:
import sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'Yes'
else:
    print 'No'

Buggy python submission (verdict: Runtime Error):

import sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'yes'
else:
    print 'no'



Fixed submission:
import sys

a, b, c = (int (i) for i in raw_input().split())

if c >= a and c <= b:
    print 'Yes'
else:
    print 'No'
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N, K = (int(i) for i in raw_input().split())
ab_list = [[int(i) for i in raw_input().split()] for i in range(N)]

a = [0]*N
b = [0]*N
for i, ab in zip(range(N), ab_list):
    _a, _b = ab
    a[i] = _a
    b[i] = _b

idx = 0
cnt = 0
while N > cnt:
    min = 1e6
    for i in range(cnt, N):
        if min > a[i]:
            min = a[i]
            idx = i
    a_tmp = a[cnt]
    b_tmp = b[cnt]
    a[cnt] = a[idx]
    b[cnt] = b[idx]
    a[idx] = a_tmp
    b[idx] = b_tmp
    cnt += 1

#print a, b                                                                                                                                                                                                                                   

num = 0
for i in range(N):
    num += b[i]
    if num >= K:
        print a[i]
        break


Fixed submission:
import sys

N, K = (int(i) for i in raw_input().split())
ab_list = [[int(i) for i in raw_input().split()] for i in range(N)]
ab_list = sorted(ab_list, key=lambda ab: ab[0])

num = 0
for i in range(N):
    num += ab_list[i][1]
    if num >= K:
        print ab_list[i][0]
        break
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
mod, ans=7+10**9, 0
mylist=list(map(int, input().split()))
mylist.insert(0,0)
for l in range(1,n):
    for k in range(1,n-l+1):
        ans+=mylist[l]*mylist[l+k]%mod
        ans=ans%mod
print(ans)

Fixed submission:
n=int(input())
mod, ans=7+10**9, 0
a=list(map(int, input().split()))
b=[0]
for l in range(n):
    b.append(b[l]+a[l])
for k in range(n-1):
    s=(b[n]-b[k+1])%mod
    ans+=a[k]*s
    ans%=mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int, input().split())
e = 0
for l in range(a,b+1):
    if l%c == 0 or l%d == 0:
        e += 1
print(b-a-e+1)

Fixed submission:
def gcd(a,b):
    while b:a,b=b,a%b
    return a
def lcm(c,d):return c*d//gcd(c,d)
def div(x):
    num=x
    num-=x//C
    num-=x//D
    num+=x//lcm(C,D)
    return num
A,B,C,D=map(int,input().split())
print(div(B)-div(A-1))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int, input().split())
e = 0
for l in range(a,b+1):
    if l%c != 0 and l%d != 0:
        e += 1
print(e)

Fixed submission:
def gcd(a,b):
    while b:a,b=b,a%b
    return a
def lcm(c,d):return c*d//gcd(c,d)
def div(x):
    num=x
    num-=x//C
    num-=x//D
    num+=x//lcm(C,D)
    return num
A,B,C,D=map(int,input().split())
print(div(B)-div(A-1))
Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0,0]
for l in range(1,n):
    if s[l-1]=='A' and s[l]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y]-a[x])

Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        for j in range(1,3):
            a.append(a[l]+1)
        l+=1
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0,0]
for l in range(1,n):
    if s[l-1]=='A' and s[l]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y]-a[x])

Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        for j in range(1,2):
            a.append(a[l]+1)
        l+=1
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])
print(a)

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0,0]
for l in range(1,n):
    if s[l-1]=='A' and s[l]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y]-a[x])
Buggy python submission (verdict: Runtime Error):
x = int(input())

if x = 1:
    print("0")
else:
    print("1")

Fixed submission:
x = int(input())

if x == 1:
    print('0')
else:
    print('1')
Buggy python submission (verdict: Runtime Error):
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
    else:
        print(-1)

Fixed submission:
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)

Fixed submission:
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math

N = int(input())

for i in range(N):
    count = 0
    a = list(range(1, int(math.sqrt(i) + 1)))
    b = list(itertools.combinations_with_replacement(a, 3))
    for k in range(len(b)):
        f = b[k][0] ** 2 + b[k][1] ** 2 + b[k][2] ** 2 + b[k][0] * b[k][1] + b[k][1] * b[k][2] + b[k][2] * b[k][0]
        if f == i + 1:
            count += len(sorted(set(itertools.permutations(b[k]))))
    print(count)


Fixed submission:
import math

N = int(input())

ans = [0] * (N + 1)

for i in range(1, int(math.sqrt(N)) + 1):
    for j in range(1, int(math.sqrt(N)) + 1):
        for k in range(1, int(math.sqrt(N)) + 1):
            v = i * i + j * j + k * k + i * j + j * k + k * i
            if v <= N:
                ans[v] += 1

for i in range(1, N + 1):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())

a = list(range(N))[1:]
b = list(itertools.combinations_with_replacement(a, 3))
c = [0] * (N + 1)

count = 0

for i in range(len(b)):
    f = b[i][0] ** 2 + b[i][1] ** 2 + b[i][2] ** 2 + b[i][0] * b[i][1] + b[i][1] * b[i][2] + b[i][2] * b[i][0]
    if f <= N:
        c[f] += len(sorted(set(itertools.permutations(b[i]))))

for i in range(1, N + 1):
    print(c[i])


Fixed submission:
import math

N = int(input())

ans = [0] * (N + 1)

for i in range(1, int(math.sqrt(N)) + 1):
    for j in range(1, int(math.sqrt(N)) + 1):
        for k in range(1, int(math.sqrt(N)) + 1):
            v = i * i + j * j + k * k + i * j + j * k + k * i
            if v <= N:
                ans[v] += 1

for i in range(1, N + 1):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())

a = list(range(N))[1:]
b = list(itertools.combinations_with_replacement(a, 3))
c = [0] * 1001

count = 0

for i in range(len(b)):
    f = b[i][0] ** 2 + b[i][1] ** 2 + b[i][2] ** 2 + b[i][0] * b[i][1] + b[i][1] * b[i][2] + b[i][2] * b[i][0]
    if f <= 1000:
        c[f] += len(sorted(set(itertools.permutations(b[i]))))

for i in range(1, N + 1):
    print(c[i])


Fixed submission:
import math

N = int(input())

ans = [0] * (N + 1)

for i in range(1, int(math.sqrt(N)) + 1):
    for j in range(1, int(math.sqrt(N)) + 1):
        for k in range(1, int(math.sqrt(N)) + 1):
            v = i * i + j * j + k * k + i * j + j * k + k * i
            if v <= N:
                ans[v] += 1

for i in range(1, N + 1):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(str, input().split()))
Q = int(input())
L = [list(map(str, input().split())) for i in range(Q)]

for j in range(Q):
    A = [k.replace(L[j][0], L[j][1]) for k in A]
    B = sum(map(int, A))
    print(B)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

a = [0] * (10 ** 5 + 1)
ans = sum(A)

for i in range(N):
    a[A[i]] += 1

for i in range(Q):
    B, C = map(int, input().split())
    ans += a[B] * (C - B)
    a[C] += a[B]
    a[B] = 0
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
A = list(map(int, input().split()))

ans = 1

if 0 in A:
    print(0)
    sys.exit()

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1

print(ans)


Fixed submission:
import sys

N = int(input())
A = list(map(int, input().split()))

ans = 1

if 0 in A:
    print(0)
    sys.exit()

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)

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

ans = 1

for i in range(N):
    ans *= A[i]

if ans > 10 ** 18:
    ans = -1

print(ans)


Fixed submission:
import sys

N = int(input())
A = list(map(int, input().split()))

ans = 1

if 0 in A:
    print(0)
    sys.exit()

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())

ans = 0

for i in range(1, N + 1):
    tmp = (A * i) // B - A * (i // B)
    ans = max(ans, tmp)

print(ans)


Fixed submission:
A, B, N = map(int, input().split())

x = min(B - 1, N)
ans = (A * x) // B - A * (x // B)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

dp = np.zeros((N+1, 2), dtype=int)
dp[0, 1] = -10**9

for i in range(N):
    dp[i+1, 0] = max(dp[i, 0] + A[i], dp[i, 1] - A[i])
    dp[i+1, 1] = max(dp[i, 0] - A[i], dp[i, 1] + A[i])
print(dp[N, 0])

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))

dp = np.zeros((N+1, 2), dtype=int)
dp[0, 1] = -10**9

for i in range(N):
    dp[i+1, 0] = max(dp[i, 0] + A[i], dp[i, 1] - A[i])
    dp[i+1, 1] = max(dp[i, 0] - A[i], dp[i, 1] + A[i])
print(dp[N, 0])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [0] * N
for i in range(1, N):
    dp[i] = min([dp[j] + abs(H[i] - H[j]) for j in range(max(i-K, 0), i)])
print(dp[-1])

Fixed submission:
import numpy as np
N, K = map(int, input().split())
H = np.array(list(map(int, input().split())), dtype=int)

dp = np.zeros(N, dtype=int)
for i in range(1, N):
    s = max(i-K, 0)
    dp[i] = (np.abs(H[i] - H[s:i]) + dp[s:i]).min()
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0]*(W+1) for i in range(N+1)]

for i in range(1, N+1):
    for j in range(1, W+1):
        if j - w[i-1] >= 0:
            dp[i][j] = max(dp[i-1][j - w[i-1]] + v[i-1], dp[i-1][j])
        else:
            dp[i][j] = dp[i-1][j]
print(max(dp[-1]))

Fixed submission:
import numpy as np
N, W = map(int, input().split())

dp = np.zeros((N+1, W+1), dtype=int)

for i in range(1, N+1):
    w, v = map(int, input().split())
    dp[i, :w] = dp[i-1, :w]
    dp[i, w:] = np.maximum(dp[i-1, :W-w+1] + v, dp[i-1, w:])

print(dp[-1][-1])
Buggy python submission (verdict: Runtime Error):
N,R=input().split()
N=int(N)
R=int(R)
if N>=10:
	print(R)
else :
	prinAt((100*(10-N))+R)

Fixed submission:
N,R=input().split()
N=int(N)
R=int(R)
if N>=10:
	print(R)
else :
	print((100*(10-N))+R)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
sum=a+b+c
if a+b==c or a+c=b or b+c==a :
    print("Yes")
else :
    print("No")

Fixed submission:
a,b,c=map(int,input().split())
if a+b==c or a+c==b or b+c==a  :
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Runtime Error):
N,L = input().split()
L=int(L)
S=[]
for i in range (L):
    S.append(input())
S.sort()
for j in S :
	print(j ,end="")

Fixed submission:
#NとLを入力
N, L = map(int, input().split())


# 空のリストを生成
S = []

#入力
for i in  range(N):
    array = input()
    S.append(array)

#辞書順に並べ替え
S.sort()

#pythonのリストの出力では[と,が出力されるので取る
S=''.join(S)

#出力
print(S)

Buggy python submission (verdict: Runtime Error):
N,L = input().split()
L=int(L)
S=[]
for i in range (L):
    S.append(input())
S.sort()
for j in S :
	print(j ,end="")

Fixed submission:
#NとLを入力
N, L = map(int, input().split())


# 空のリストを生成
S = []

#入力
for i in  range(N):
    array = input()
    S.append(array)

#辞書順に並べ替え
S.sort()

#pythonのリストの出力では[と,が出力されるので取る
S=''.join(S)

#出力
print(S)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main() {
    //入力を受け取る
    int D, T, S;
    cin >> D >> T >> S;

    //高橋君の移動時間を計算する
    double time = (double)D / S;

    //Tとtimeの大小関係に応じて出力をする
    if (T >= time) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Fixed submission:
D, T, S = map(int, input().split())

time = D/S

if time > T:
    print("No")
else: print("Yes")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))


Sum = 0
mod_n = 10.0E8 +7

for i in range(N-1):
    for j in range(i+1,N):
        if j == len(A):
            break
        else:
            Sum +=  A[i]*A[j]
        


# for i in A:
#     Sum -= i**2

# Sum = int(Sum/2)
print(Sum)


print(int(Sum % mod_n))

Fixed submission:
D, T, S = map(int, input().split())

time = D/S

if time > T:
    print("No")
else: print("Yes")
Buggy python submission (verdict: Runtime Error):
def func():
  A,B= map(int,input().split())
  if A >= B*2:
  	print(A-2B)
  else:
  	print(0)
  
if __name__=="__main__":
  print("Input two Integers with space")
  func()


Fixed submission:
def func():
    A,B=map(int,input().split())
    
    if A>=B*2:
        C=A-2*B
        print(C)
    else:
        print(0)
        
if __name__=="__main__":
    func()

Buggy python submission (verdict: Runtime Error):
A,B= map(int,input().split())

if A >= B*2:
  print(A-2B)
else:
  print(0)

Fixed submission:
def func():
    A,B=map(int,input().split())
    
    if A>=B*2:
        C=A-2*B
        print(C)
    else:
        print(0)
        
if __name__=="__main__":
    func()
Buggy python submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
P = 0
S = 0
while S==0:
    P += A
    K -= A
    if K < 0:
        P = K
        break
    elif K == 0:
        break

    K -= B
    if K <= 0:
        break

    P -= C
    K -= C
    if K <= 0:
        P += abs(K)
        break
    S=1
if P >= 0:
    print(P)
else:
    print("0")





Fixed submission:
S = input()
T = input()
if S[:]==T[:-1]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
P = 0
S = 0
while S==0:
    P += A
    K -= A
    if K < 0:
        P = K
        break
    elif K == 0:
        break

    K -= B
    if K <= 0:
        break

    P -= C
    K -= C
    if K <= 0:
        P += abs(K)
        break
    S=1
if P >= 0:
    print(P)
else:
    print(0)





Fixed submission:
S = input()
T = input()
if S[:]==T[:-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
a,b,n=(int(x) for x in input().split())
k =0
for x in range(0,n+1):
    c = math.floor((a*x)/b)-a*math.floor(x/b)
    if c  > k:
        k = c
print(k)

Fixed submission:
k = int(input().strip())
a, b = input().strip().split()
a = int(a)
b = int(b)
c = 0
for i in range(1,1001):
    if i*k <= b and i*k >= a:
        print("OK")
        c = 1
        break
if c == 0:
    print("NG")
Buggy python submission (verdict: Runtime Error):
a = input()
b = []
for z in a:
  b.apppend(z)
if b[2]==b[3]:
  if b[4]==b[5]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
  

Fixed submission:
a = input()
b = []
for z in a:
  b.append(z)
if b[2]==b[3]:
  if b[4]==b[5]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
for z in a:
  if a[3]==a[4] & a[5]==a[6] :
    print("Yes")
  else :
    print("No")

Fixed submission:
a = input()
b = []
for z in a:
  b.append(z)
if b[2]==b[3]:
  if b[4]==b[5]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = {}
for i in range(0,n):
  c = input()
  if c in d:
    d[c] +=1
  else:
    d[c] = 1
max_k_list = sorted([kv[0] for kv in d.items() if kv[1] == max(d.values())])
for i in max_k_list:
  print(i)
  

Fixed submission:
q=int(input())
dic={}
for i in range(q):
    s=input()
    if not s in dic:
        dic[s]=1
    else:
        dic[s]+=1
max_val=max(dic.values())
a=sorted([i for i, k in dic.items() if k == max_val])
for i in a:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = {}
for i in range(0,n):
  c = input()
  if c in d:
    d[c] +=1
  else:
    d[c] = 1
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
max_k_list.sort()
for i in range(0,len(max_k_list)):
  print(max_k_list[i])

Fixed submission:
q=int(input())
dic={}
for i in range(q):
    s=input()
    if not s in dic:
        dic[s]=1
    else:
        dic[s]+=1
max_val=max(dic.values())
a=sorted([i for i, k in dic.items() if k == max_val])
for i in a:
    print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
H = list(S)
P = len(H)
oo = []
ll = []
if P%2 == 0:
  for a in range (0,N/2):
    oo.append(H(a))
    ll.append(H(a+N/2))
    if oo == ll :
      print("Yes")
else :
  print("No")
    
 
    

  


Fixed submission:
N = int(input())
S = input()
H = list(S)
P = len(H)
oo = []
ll = []
if P%2 == 0:
  for a in range (0,int(N/2)):
    oo.append(H[int(a)])
    ll.append(H[int(a+N/2)])
  if oo == ll :
    print("Yes")
  else :
    print("No")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
H = list(S)
P = len(H)
oo = []
ll = []
if P%2 == 0:
  for a in range (0,N/2):
    oo.append(a)
    ll.append(a+N/2)
    if oo == ll :
      print("Yes")
else :
  print("No")
    
 
    

  


Fixed submission:
N = int(input())
S = input()
H = list(S)
P = len(H)
oo = []
ll = []
if P%2 == 0:
  for a in range (0,int(N/2)):
    oo.append(H[int(a)])
    ll.append(H[int(a+N/2)])
  if oo == ll :
    print("Yes")
  else :
    print("No")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int ,input().split()))
MOD = 10**9+7

sum = 0
for i in range (N):
    sum += A[i]

ans = 0
for i in range(N):
    sum -= A[i]
    ans += (A[i] * sum) % MOD

ans = ans % MOD
print(ans)

Fixed submission:
D, T, S = map(int, input().split())

TS = T * S

if D <= TS:
    ans = "Yes"
else:
    ans = "No"

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

l = len(T)
for i in range (l):
    if T[:l-i] in S:
        ans = i
        break
    if T[i:] in S:
        ans = i
        break

print(ans)

Fixed submission:
S = input()
T = input()

ans = len(T)
l = len(T)
for m in range (len(S)-l+1):
    diff = 0
    for i in range (l):
        if S[m+i] != T[i]:
            diff+=1
    ans = min(ans, diff)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

hantei = 0

while N != 0 or N > 1:
    hantei += N % 10
    N = N // 10

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)


Fixed submission:
N, X, T = map(int ,input().split())

ans = (N // X) * T
if N % X != 0:
    ans += T

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

hantei = 0

while N != 0 or N < 1:
    hantei += N % 10
    N = N // 10

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)


Fixed submission:
N = input()

hantei = 0

for i in range(len(N)):
    hantei += int(N[i])

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

hantei = 0

while N != 0:
    hantei += N % 10
    N = N // 10

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)


Fixed submission:
N = input()

hantei = 0

for i in range(len(N)):
    hantei += int(N[i])

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)