Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
TA = [list(map(int,input().split())) for _ in range(N)]

lcms = TA[0]

for t,a in TA[1:]:
    tmp = [t,a]
    
    while tmp[0] < lcms[0]:
        tmp[0] += t
        tmp[1] += a
    while tmp[1] < lcms[1]:
        tmp[0] += t
        tmp[1] += a
    lcms = tmp

print(sum(lcms))


Fixed submission:

N = int(input())
TA = [list(map(int,input().split())) for _ in range(N)]

lcms = TA[0]

for t,a in TA[1:]:
    tmp = [t,a]

    
    m1 = (lcms[0]+tmp[0]-1)//tmp[0]
    m2 = (lcms[1]+tmp[1]-1)//tmp[1]
    
    m = max(m1,m2)
    if m != 0:
        tmp[0] *= m
        tmp[1] *= m
    lcms = tmp

print(sum(lcms))
Buggy python submission (verdict: Time Limit Exceeded):

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

L = sum(X)

dp = [[[0]*(N+1) for _ in range(L+10)] for _ in range(N+1)]
dp[0][0][0] = 1

for i in range(N):
    for j in range(L+10):
        for k in range(N):
            dp[i+1][j][k] += dp[i][j][k]
            if j >= X[i]:
                dp[i+1][j][k+1] += dp[i][j-X[i]][k]
            
ans = 0
for k in range(1,N+1):
    if A*k > L:break
    ans += dp[N][A*k][k]
                
print(ans)
                
                

Fixed submission:

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

L = sum(X)

dp = [[[0]*(N+1) for _ in range(L+10)] for _ in range(N+1)]
dp[0][0][0] = 1

for i in range(N):
    for j in range(L+10):
        for k in range(N):
            dp[i+1][j][k] += dp[i][j][k]
            if j >= X[i]:
                dp[i+1][j][k+1] += dp[i][j-X[i]][k]
            
ans = 0
for k in range(1,N+1):
    if A*k > L:break
    ans += dp[N][A*k][k]
                
print(ans)
Buggy python submission (verdict: Runtime Error):
inputs = [input() for i in range(2)]

N = inputs[0].split()[0]
K = inputs[0].split()[1]
p = [int(pn) for pn in inputs[1].split()]

ans = sum(p.sort()[0:K])
print(ans)

Fixed submission:
inputs = [input() for i in range(2)]

N = int(inputs[0].split()[0])
K = int(inputs[0].split()[1])
p = [int(pn) for pn in inputs[1].split()]

ans = sum(sorted(p)[0:K])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split()
q = int(input())

for i in range(q):
    stdins = input().split()
    for j in range(n):
        a[j] = a[j].replace(stdins[0], stdins[1])
    ans = sum([int(an) for an in a])
    print(ans)


Fixed submission:
def int2char(i):
    return chr(ord("a") + i - 1)

N = int(input())

ans = ""
while (True):
    N_lsb_int = ((N - 1) % 26) + 1
    N_next = int((N - N_lsb_int)/26)
    ans = int2char(N_lsb_int) + ans
    if N_next == 0:
        break
    N = N_next

print(ans)
Buggy python submission (verdict: Runtime Error):
(a, b) = map(int, input().split())

bb = int(b * 100)
abb = a * bb
ans = abb // 100
print(ans)

Fixed submission:
words = input().split()
a = int(words[0])
b = float(words[1])
bb = round(b * 100)
abb = a * bb
ans = abb // 100
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

k = int(input())

gcd_dict = {}

ans = 0
for n in range(k, 0, -1):
   for a in range(n, k + 1, n):
        for b in range(n, k + 1, n):
            for c in range(n, k + 1, n):
                if (a, b, c) not in gcd_dict.keys():
                    gcd_dict[(a, b, c)] = n
                    ans += n

print(ans)


Fixed submission:

k = int(input())

gcd_cnt = {}

for n in range(k, 0, -1):
    div_all = (k // n) ** 3
    div_dup = 0
    for m in range(n * 2, k + 1, n):
        div_dup += gcd_cnt[m]
    gcd_cnt[n] = div_all - div_dup

ans = 0
for gcd in gcd_cnt.keys():
    ans += gcd * gcd_cnt[gcd]

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
p, s = zip(* [input().split() for _ in range(m)])

ac_dict = {str(i): False for i in range(1, n + 1)}
wa_dict = {str(i): 0 for i in range(1, n + 1)}
ac_num = 0
wa_num = 0
for p_i, s_i in zip(p, s):
    if ac_dict[p_i] == False:
        if s_i == 'AC':
            ac_num += 1
            wa_num += wa_dict[p_i]
            ac_dict[p_i] = True
        elif s_i == 'WA':
            wa_dict[p_i] += 1
print('{} {}'.format(ac_num, wa_num))


Fixed submission:
n, m = map(int, input().split())
if m > 0:
    p, s = zip(* [input().split() for _ in range(m)])
else:
    p = []
    s = []

ac_dict = {str(i): False for i in range(1, n + 1)}
wa_dict = {str(i): 0 for i in range(1, n + 1)}
ac_num = 0
wa_num = 0
for p_i, s_i in zip(p, s):
    if ac_dict[p_i] == False:
        if s_i == 'AC':
            ac_num += 1
            wa_num += wa_dict[p_i]
            ac_dict[p_i] = True
        elif s_i == 'WA':
            wa_dict[p_i] += 1
print('{} {}'.format(ac_num, wa_num))
Buggy python submission (verdict: Time Limit Exceeded):
import math

x = int(input())

prms = []
n = 2
while True:
    is_prm = True
    for prm in prms:
        if n % prm == 0:
            is_prm = False
            break
    if is_prm:
        prms.append(n)
        if n >= x:
            break
    n += 1

print(n)


Fixed submission:
import math

x = int(input())

prm_dict = {i: True for i in range(2, 100004)}
for n in range(2, 100004):
    if prm_dict[n]:
        if n >= x:
            break
        for nk in range(n * 2, 100004, n):
            prm_dict[nk] = False
print(n)
Buggy python submission (verdict: Runtime Error):
7
5 15
1 10 16 2 7 20 12

Fixed submission:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

cnt = [0, 0, 0]
for pi in p:
    if pi <= a:
        cnt[0] += 1
    elif pi <= b:
        cnt[1] += 1
    else:
        cnt[2] += 1
print(min(cnt))
Buggy python submission (verdict: Runtime Error):
s = input()
k = input()

ans = '1'
for i in range(k):
    if k[i] != '1':
        ans = k[i]
        break
print(ans)


Fixed submission:
s = input()
k = int(input())

ans = '1'
for i in range(k):
    if s[i] != '1':
        ans = s[i]
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
0 5

Fixed submission:
d, n = map(int, input().split())
if n < 100:
    print(n * (100 ** d))
else:
    print(101 * (100 ** d))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i < a + k or i > b - k:
        print(i)


Fixed submission:
a, b, k = map(int, input().split())

if b - a + 1 <= k * 2:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range((b - k + 1), (b + 1)):
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
def lucas(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        return lucas(i - 1) + lucas(i - 2)

n = int(input())
print(lucas(n))


Fixed submission:
n = int(input())

l = [2, 1]
for i in range(2, n + 1):
    l.append(l[(i - 1)] + l[(i - 2)])
print(l[n])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nxt_btn = {i: int(input()) for i in range(1, n + 1)}

num = 0
crr_btn = 1
while True:
    num += 1
    if nxt_btn[crr_btn] == 1:
        num = -1
        break
    if nxt_btn[crr_btn] == 2:
        break
    crr_btn = nxt_btn[crr_btn]
print(num)


Fixed submission:
n = int(input())
nxt_btn = {i: int(input()) for i in range(1, n + 1)}

num = -1
crr_btn = 1
for i in range(1, n + 1):
    if nxt_btn[crr_btn] == 2:
        num = i
        break
    crr_btn = nxt_btn[crr_btn]
print(num)
Buggy python submission (verdict: Runtime Error):
5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192

Fixed submission:
import random
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(d)]



for i in range(d):
    print(random.randrange(1,27))
Buggy python submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
a,b,c,d=map(int,input().split())
mod=998244353


dp=[[0]*3005 for _ in range(3005)]
for i in range(a+1):
    for j in range(b+1):
        dp[i][j]=1
#print(dp)

for i in range(3003-b):
    dp[a][b+i+1]=((dp[a][b+i])*a)%mod
for j in range(3003-a):
    dp[a+1+j][b]=((dp[a+j][b]*b))%mod

j=0
for i in range(a,3003-a):
    dp[a+j][b+i+1]=((dp[a+j][b+i])*(a+j)%mod)
    for j in range(b,3003-b):
        dp[a+1+j][b+i]=((dp[a+j][b+i]*(b+i))%mod)
        #dp[i+1][j+1]=(dp[i][j+1]*(j+1))%mod+(dp[i+1][j]*(i+1))%mod-(i*j)

#print(dp[1][1])
print(dp[c][d]%mod)


Fixed submission:
import sys
x=int(input())
x=min(x,360-x)

for i in range(1,361):
    if (i*x)%360==0:
        print(i)
        sys.exit()
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*(100005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(100000//a[i]+1):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)
            
        

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*(1000005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(1000000//a[i]+1):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*(100005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(100000//a[i]):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)
            
        

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*(1000005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(1000000//a[i]+1):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*100005
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(100005//a[i]):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)
            
        

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*(1000005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(1000000//a[i]+1):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(input())

l=list(map(int,input().split()))
a=1
for i in range(0,n):
	a=a*l[i]


if a>10**18:
		print(-1)


if a<10**18+1:
	print(a)	 

Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(input())

l=sorted(list(map(int,input().split())))

a=1
if l[0]==0:
	print("0")

else:
	for i in range(0,n):
		a=a*l[i]
		if a>10**18:
			print(-1)
			break
		
	if a<10**18+1:
		print(a)
Buggy python submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
    
a=factorization(n)
le=len(a)
cnt=0
b=0
for i in range(le):
	b=1
	while a[i][1]>=b: 
		a[i][1]-=b
		b+=1
		cnt+=1

if n=1:
	print(0)
else:
	print(cnt)

Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
    
a=factorization(n)
le=len(a)
cnt=0
b=0
for i in range(le):
	b=1
	while a[i][1]>=b: 
		a[i][1]-=b
		b+=1
		cnt+=1

if n==1:
	print(0)
else:
	print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())

cnt=0
if b>10**6:
	print(a*n//b-a*n//b)

else:
	for i in range(a):
	cnt=max(cnt,(a*(n-i)//b-a*((n-i)//b)))
	print(cnt)

Fixed submission:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())
cnt=0

if n//b>0:
	print(a*(b-1)//b-a*((b-1)//b))
else:
	print(a*(n)//b-a*((n)//b))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())

cnt=0

for i in range(n+1):
	cnt=max(cnt,(a*i)//b-a*(i//b))

print(cnt)

Fixed submission:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())
cnt=0

if n//b>0:
	print(a*(b-1)//b-a*((b-1)//b))
else:
	print(a*(n)//b-a*((n)//b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,k=map(int,readline().split())

if k==1:
	print("0")

else:
	while n>k//2:
		n=abs(n-k)
	
	print(n)



Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,k=map(int,readline().split())

if k==1:
	print("0")

else:
	n=n%k
	while n>k//2:
		n=abs(n-k)
	
	print(n)

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

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,k=map(int,readline().split())

if k==1:
	print("0")

else:
	while n>k//2:
		n=abs(n-k)
	
	print(n)



Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,k=map(int,readline().split())

if k==1:
	print("0")

else:
	n=n%k
	while n>k//2:
		n=abs(n-k)
	
	print(n)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,x,y=map(int,input().split())


l1=n-y-x
l2=y-x

l=[0]*(n-1)
k=0
a=0
b=0
c=0
for i in range(1,n):
	for j in range(i+1,n+1):
		a=j-i
		b=abs(i-x)+1+abs(j-y)
		c=abs(i-y)+1+abs(j-x)
		k=min(a,b,c)
		l[k-1]+=1
		k=0
		a=0
		b=0
		c=0

for j in range(n-1):
	print(l[j])	

		
	

Fixed submission:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,x,y=map(int,input().split())


l1=n-y-x
l2=y-x

l=[0]*(n-1)
k=0
for i in range(1,n):
	for j in range(i+1,n+1):
		k=min(j-i,abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x))
		l[k-1]+=1
		k=0

for j in range(n-1):
	print(l[j])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
A=list(map(int,input().split()))

l=[0]*(N+1)
cnt=0

for k in range(N):
	for i in A:
		l[i]+=1
	l[A[k]]-=1

	for j in l:
		cnt+=(j*(j-1))//2
	print(cnt)
	cnt=0
	l=[0]*(N+1)


Fixed submission:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
A=list(map(int,input().split()))

l=[0]*(N+1)
cnt=0

for i in A:
		l[i]+=1
		
for j in l:
		cnt+=(j*(j-1))//2

for k in range(N):
	print(cnt-l[A[k]]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
A=list(map(int,input().split()))

l=[0]*(N+1)
cnt=0

for k in range(N):
	for i in range(len(A)):
		if i==k:
			continue
		l[A[i]]+=1
	for j in l:
		cnt+=(j*(j-1))//2
	print(cnt)
	cnt=0
	l=[0]*(N+1)


Fixed submission:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
A=list(map(int,input().split()))

l=[0]*(N+1)
cnt=0

for i in A:
		l[i]+=1
		
for j in l:
		cnt+=(j*(j-1))//2

for k in range(N):
	print(cnt-l[A[k]]+1)
Buggy python submission (verdict: Runtime Error):
if input()=="AAA" or input()=="BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
a=input()

if a=="AAA" or a=="BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
l=[-1]*(n)
for i in range(m):
    s,c=map(int,input().split())
    if l[s-1]==-1 or l[s-1]==c:
        l[s-1]=c
    else:
        print(-1)
        sys.exit()
if l[0]==0 and len(l)!=1:
    print(-1)
    sys.exit()
for i in range(n):
    if l[i]==-1:
        l[i]=0
if l[0]==0:
    l[0]=0

if l[0]==0 and len[l]==1:
    print(0)
else:
    for i in range(n):
        print(l[i],end="")

Fixed submission:
import sys
n,m=map(int,input().split())
l=[-1]*(n)
for i in range(m):
    s,c=map(int,input().split())
    if l[s-1]==-1 or l[s-1]==c:
        l[s-1]=c
    else:
        print(-1)
        sys.exit()
if l[0]==0 and len(l)!=1:
    print(-1)
    sys.exit()
for i in range(n):
    if l[i]==-1:
        l[i]=0
if l[0]==0 and len(l)!=1:
    l[0]=1

if l[0]==0 and len(l)==1:
    print(0)
else:
    for i in range(n):
        print(l[i],end="")

Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
l=[-1]*(n)
for i in range(m):
    s,c=map(int,input().split())
    if l[s-1]==-1 or l[s-1]==c:
        l[s-1]=c
    else:
        print(-1)
        sys.exit()
if l[0]==0:
    print(-1)
    sys.exit()
for i in range(n):
    if l[i]==-1:
        l[i]=0
if l[0]==0 and len[l]==1:
    print(0)
elif l[0]==0:
    l[0]=1
else:
    for i in range(n):
        print(l[i],end="")

Fixed submission:
import sys
n,m=map(int,input().split())
l=[-1]*(n)
for i in range(m):
    s,c=map(int,input().split())
    if l[s-1]==-1 or l[s-1]==c:
        l[s-1]=c
    else:
        print(-1)
        sys.exit()
if l[0]==0 and len(l)!=1:
    print(-1)
    sys.exit()
for i in range(n):
    if l[i]==-1:
        l[i]=0
if l[0]==0 and len(l)!=1:
    l[0]=1

if l[0]==0 and len(l)==1:
    print(0)
else:
    for i in range(n):
        print(l[i],end="")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1

keys=sorted([k for k,v in dic.items() if v==max(dic.values()) ])
for i in keys:
    print(i)

Fixed submission:
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)
ma=dic2[0][1]

keys=sorted([k for k,v in dic.items() if v==ma])
for i in keys:
    print(i)

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

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1

keys=sorted([k for k,v in dic.items() if v==max(dic.values()) ])
for i in keys:
    print(i)

Fixed submission:
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)
ma=dic2[0][1]

keys=sorted([k for k,v in dic.items() if v==ma])
for i in keys:
    print(i)

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

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)

keys=sorted([k for k,v in dic.items() if v==max(dic.values()) ])
for i in keys:
    print(i)

Fixed submission:
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)
ma=dic2[0][1]

keys=sorted([k for k,v in dic.items() if v==ma])
for i in keys:
    print(i)

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

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)

keys=sorted([k for k,v in dic.items() if v==max(dic.values()) ])
for i in keys:
    print(i)

Fixed submission:
n=int(input())

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)
ma=dic2[0][1]

keys=sorted([k for k,v in dic.items() if v==ma])
for i in keys:
    print(i)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))

lst=[]
sum=0
for i in range(n):
    sum+=p[i]
    lst.append(sum)
    
ans=[]
for i in range(n-k):
    ans.append(lst[i+k]-lst[i])

print((max(ans)+k)/2)


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))

lst=[0]
sum=0
for i in range(n):
    sum+=p[i]
    lst.append(sum)
    
ans=[]
for i in range(n-k+1):
    ans.append(lst[i+k]-lst[i])

print((max(ans)+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
H,A=map(int,input().split())

l=list(map(int,input().split()))

li=sorted(l,reverse=True)

for _ in range(min(H,A)):
	li.pop(0)
	
print(sum(li))

Fixed submission:
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
H,A=map(int,input().split())

l=list(map(int,input().split()))

li=sorted(l)

for _ in range(min(H,A)):
	li.pop()
	
print(sum(li))
Buggy python submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
    
N,M=map(int,input().split())
a=0
b=0
AC=[0]*(M+1)
pen=0
l=[]
for i in range(M):
	j,r=input().split()
	if AC[int(j)]==0:
		if r=="WA":
			pen+=1
		else:
			AC[int(j)]+=1
print(sum(AC),pen)

Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
    
N,M=map(int,input().split())
a=0
b=0
AC=[0]*(N+1)
pen=[0]*(N+1)
p=0
l=[]
for i in range(M):
	j,r=input().split()
	if AC[int(j)]==0:
		if r=="WA":
			pen[int(j)]+=1
		else:
			AC[int(j)]+=1
for k in range(N+1):
	if AC[k]==1:
		p+=pen[k]

print(sum(AC),p)