Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B, C, D = [int(i) for i in list(input())]

ans = 0
ans = f"{A}+{B}+{C}+{D}=7" if A+B+C+D==7 else ans
ans = f"{A}+{B}+{C}-{D}=7" if A+B+C-D==7 else ans
ans = f"{A}+{B}-{C}+{D}=7" if A+B-C+D==7 else ans
ans = f"{A}+{B}-{C}-{D}=7" if A+B-C-D==7 else ans
ans = f"{A}-{B}+{C}+{D}=7" if A-B+C+D==7 else ans
ans = f"{A}-{B}+{C}-{D}=7" if A-B+C-D==7 else ans
ans = f"{A}-{B}-{C}+{D}=7" if A-B-C+D==7 else ans
ans = f"{A}-{B}-{C}-{D}=7" if A-B-C-D==7 else ans

print(ans)

Fixed submission:
A, B, C, D = [int(i) for i in list(input())]

ans = 0
ans = "{0}+{1}+{2}+{3}=7".format(A, B, C, D) if A+B+C+D==7 else ans
ans = "{0}+{1}+{2}-{3}=7".format(A, B, C, D) if A+B+C-D==7 else ans
ans = "{0}+{1}-{2}+{3}=7".format(A, B, C, D) if A+B-C+D==7 else ans
ans = "{0}+{1}-{2}-{3}=7".format(A, B, C, D) if A+B-C-D==7 else ans
ans = "{0}-{1}+{2}+{3}=7".format(A, B, C, D) if A-B+C+D==7 else ans
ans = "{0}-{1}+{2}-{3}=7".format(A, B, C, D) if A-B+C-D==7 else ans
ans = "{0}-{1}-{2}+{3}=7".format(A, B, C, D) if A-B-C+D==7 else ans
ans = "{0}-{1}-{2}-{3}=7".format(A, B, C, D) if A-B-C-D==7 else ans

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()], reverse=True)

for v in A:
    if K==v:
        print("POSSIBLE")
        quit()
if K > A[0]:
    print("IMPOSSIBLE")
    quit()

d = []
for i in range(N-1):
    d.append(A[i]-A[i+1])

for v in d:
    K %= v

if K:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Fixed submission:
N, K = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()], reverse=True)

for v in A:
    if K==v:
        print("POSSIBLE")
        quit()
if K > A[0]:
    print("IMPOSSIBLE")
    quit()

d = []
for i in range(N-1):
    d.append(A[i]-A[i+1])

for v in d:
    if v:
        K %= v

if K:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]

c = 0
for i in A: c += 1 if i<3200 else 0
Am = set()
for i in A:
    if i<3200:
        Am.add(i//400)

minc = len(Am if c>0 else Am+1)

AM = set([int(v)//400 if v<3200 else i+50 for i, v in enumerate(A)])
maxc = len(AM)

print(minc, maxc)

Fixed submission:
n = int(input())
A = [int(i) for i in input().split()]

c = 0
for i in A: c += 1 if i<3200 else 0
Am = set()
for i in A:
    if i<3200:
        Am.add(i//400)

minc = len(Am) if c>0 else len(Am)+1

AM = set([int(v)//400 if v<3200 else i+50 for i, v in enumerate(A)])
maxc = len(AM)

print(minc, maxc)
Buggy python submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split()]
m = sorted([[int(i) for i in input().split()] for _ in range(n)]

s=0
i=0
while s<k:
    s += m[i][1]
    i += 1
print(m[i-1][0])

Fixed submission:
n, k = [int(i) for i in input().split()]
m = sorted([[int(i) for i in input().split()] for _ in range(n)])

s=0
i=0
while s<k:
    s += m[i][1]
    i += 1
print(m[i-1][0])
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
if l.sort() =[5,5,7]:
  print("YES")
else:
  print("NO")


Fixed submission:
l=list(map(int,input().split()))
print("YES" if sorted(l) == [5,5,7] else "NO")
Buggy python submission (verdict: Runtime Error):
s = input().strip()
t = input().strip()

if t in s:
    print(0)
else:
    ans = 1000
    for i in range(len(s) - len(t) - 1):
        count = len(t) - 1
        for j in range(len(t) - 1):
            if s[i + j] == t[i]:
                count -= 1
        ans = min(count, ans)
    print(ans)


Fixed submission:
s = input().strip()
t = input().strip()

if t in s:
    print(0)
else:
    ans = 10001
    for i in range(len(s) - len(t) + 1):
        count = 0
        cnt = i
        for j in range(len(t)):
            if s[cnt] != t[j]:
                count += 1
            cnt += 1
        ans = min(count, ans)
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
verdict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for _ in range(n):
    S = input()
    verdict[S.upper()] += 1
for i, j in verdict:
    print(f'{i} x {j}')


Fixed submission:
n = int(input())
verdict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for _ in range(n):
    S = input()
    verdict[S.upper()] += 1
for i, j in verdict.items():
    print(f'{i} x {j}')
Buggy python submission (verdict: Runtime Error):
s = input().strip()
s_new = input().strip()
if s == s_new[0:len(s)]:
  if len(s) + 1 = len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")

Fixed submission:
s = input().strip()
s_new = input().strip()
if s == s_new[0:len(s)]:
  if len(s) + 1 == len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
s = input().split()
s_new = input().split()
if s == s_new[0:len(s)]:
  if len(s) + 1 = len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")


Fixed submission:
s = input().strip()
s_new = input().strip()
if s == s_new[0:len(s)]:
  if len(s) + 1 == len(s_new):
    print("Yes")
  else:
    print('No')
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = []
for i in range(n):
  a.append(int(input()))

dp = [False]*(k+1)
dp[0] = 0

for i in range(1,k+1):
  for j in range(n):
    if i-a[j] >= 0 and dp[i-a[j]] == 0:
      dp[i] = 1
      break
    #dp[i] = 0

if dp[k] == 1:
  print("First")
else:
  print("Second")

Fixed submission:
n,k = map(int,input().split())
a = [int(i) for i in input().split()]

dp = [0]*(k+1)
dp[0] = 0

for i in range(1,k+1):
  for j in range(n):
    if i-a[j] >= 0 and dp[i-a[j]] == 0:
      dp[i] = 1
      break
    #dp[i] = 0

if dp[k] == 1:
  print("First")
else:
  print("Second")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    cnt = 0
    for c in range(1, n):
        for i in range(1, c+1):
            if c % i == 0:
                cnt += 1
    print(cnt)
    
    
if __name__ == "__main__":
    main()

Fixed submission:
from math import floor, ceil

def main():
    n = int(input())
    cnt = 0
    for a in range(1, n):
        cnt += floor((n-1)/a) - ceil(1/a) +1
    print(cnt)
    
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    l, r = map(int, input().split())
    ans = 2020
    for i in range(l, r):
        for j in range(i+1, r+1):
            tmp = (i % 2019) * (j % 2019) % 2019
            if tmp < ans:
                ans = tmp
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    l, r = map(int, input().split())
    q, ll = l // 2019, l % 2019
    rr = r % 2019
    rng = [*range(ll, rr+1)] if r - l < (2019 * q - ll) % 2019 else [*range(ll, 2019)] + [*range(rr+1)]
    lenrng = len(rng)
    ans = 2020
    for i in range(lenrng-1):
        for j in range(i+1, lenrng):
            tmp = rng[i] * rng[j] % 2019
            if tmp < ans:
                ans = tmp
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

diff = [V[i] - C[i] for i in range(N)]
diff.sort(reverse=True)

i, ans = 0,0
while diff[i] > 0:
    ans += diff[i]
    i += 1
print(ans)

Fixed submission:
input()
print(sum((v-c for v,c in zip(map(int,input().split()),map(int,input().split())) if v-c>0)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xy = [list(map(int,input().split()))for _ in range(n)]

xsort = sorted(xy,key=lambda x:x[0])
ysort = sorted(xy,key=lambda x:x[1])

ans = 0
for i in range(min(n,10**4)):
    for j in range(min(n,10**4)):
        ans = max(ans,abs(xsort[i][0]-xsort[-j][0])+abs(xsort[i][1]-xsort[-j][1]))
        ans = max(ans,abs(ysort[i][0]-ysort[-j][0])+abs(ysort[i][1]-ysort[-j][1]))
print(ans)

Fixed submission:
n = int(input())
xy = [list(map(int,input().split()))for _ in range(n)]

iti = -float("inf")
ni = -float("inf")
san = -float("inf")
yon = -float("inf")
for x,y in xy:
    iti = max(iti,x+y)
    ni = max(ni,x-y)
    san = max(san,-x+y)
    yon = max(yon,-x-y)

print(max(iti+yon,ni+san))
Buggy python submission (verdict: Runtime Error):
n,m,K = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])
    
#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if a[i] > k:
        break
    while b[m] > k - a[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)

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

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])

#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if sa[i] > k:
        break
    while sb[m] > k - sa[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)

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

#累積和
sa = [0]*len(a)
sa[0] = a[0]
for i,k in enumerate(a):
    if i == 0:continue
    sa[i] = sa[i-1] + a[i]
sb = [0]*len(b)
sb[0] = b[0]
for i,k in enumerate(b):
    if i == 0:continue
    sb[i] = sb[i-1] + b[i]

ai = len(a)-1
bi = len(b)-1

minu = sa[ai] + sb[bi]
while(minu > K):
    if (sa[ai] - sa[ai-1]) > (sb[bi] - sb[bi-1]):
        ai -= 1
        minu = sa[ai] + sb[bi]
    else:
        bi -= 1
        minu = sa[ai] + sb[bi]

print(ai + bi + 2)


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

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])

#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if sa[i] > k:
        break
    while sb[m] > k - sa[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)

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

#累積和
sa = [0]*len(a)
sa[0] = a[0]
for i,k in enumerate(a):
    if i == 0:continue
    sa[i] = sa[i-1] + a[i]
sb = [0]*len(b)
sb[0] = b[0]
for i,k in enumerate(b):
    if i == 0:continue
    sb[i] = sb[i-1] + b[i]

ai = len(a)-1
bi = len(b)-1

minu = sa[ai] + sb[bi]
while(minu > K):
    if (sa[ai] - sa[ai-1]) > (sb[bi] - sb[bi-1]):
        ai -= 1
        minu = sa[ai] + sb[bi]
    else:
        bi -= 1
        minu = sa[ai] + sb[bi]

print(sa)
print(sb)
print(ai + bi + 2)


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

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])

#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if sa[i] > k:
        break
    while sb[m] > k - sa[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
u = 10**18
ans = 1
for i in a:
    ans *= i
if ans <= u:
    print(ans)
else:
    print(-1)

Fixed submission:
n = int(input())
a = sorted(list(map(int,input().split())))
u = 10**18
ans = 1
for i in a:
    ans *= i
    if i == 0:
        print(0)
        exit()
    if ans > u:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m,q=map(int,input().split())
li=[list(map(int,input().split()))for _ in range(q)]

ans = 0
def dfs(i,A):
    #print(A)
    global ans 
    tmp = 0
    for a,b,c,d in li:
        if (A[b-1] - A[a-1]) == c:
            tmp += d
    ans = max(ans,tmp)
    if i == m:
        return
    for j in range(n):
        A_tmp = A[:]
        for k in range(1,j+2):
            A_tmp[-k] += 1
        dfs(i+1,A_tmp)
dfs(1,[1]*n)
print(ans)

Fixed submission:
import itertools
n,m,q=map(int,input().split())
li=[list(map(int,input().split()))for _ in range(q)]

ans = 0
for A in itertools.combinations_with_replacement(range(1,m+1),n):
    tmp = 0
    for a,b,c,d in li:
        if A[b-1] - A[a-1] == c:
            tmp += d 
    ans = max(ans,tmp)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
s = input()

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[-i]) * 10**(i-1) % 2019
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for b in c.values():#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)


Fixed submission:
from collections import Counter
s = str(input())

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[len(s)-i])%2019 * pow(10,i-1,2019)
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for b in list(c.values()):#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
s = input()

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[-i]) * 10**(i-1) % 2019
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for a,b in c.items():#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)


Fixed submission:
from collections import Counter
s = str(input())

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[len(s)-i])%2019 * pow(10,i-1,2019)
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for b in list(c.values()):#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
ans = 0
dp = [[0 for i in range(len(s)+3)]for j in range(len(s)+3)]
def rec(i,j,num):#j:numの左から何個けずった？ i:sの左から何番目までいった？
    global ans
    if dp[i][j] == 1:
        return
    dp[i][j] = 1
    if int(num) % 2019 == 0:
        ans += 1
    else:
        if j < len(s):
            rec(i,j+1,num+s[j])
        if len(num) >= 2:
            rec(i+1,j,num[1::])

rec(0,1,s[0])
print(ans)


Fixed submission:
from collections import Counter
s = str(input())

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[len(s)-i])%2019 * pow(10,i-1,2019)
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for b in list(c.values()):#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
ans = 0
dp = [[0 for i in range(len(s)+3)]for j in range(len(s)+3)]
def rec(i,j,num):#j:numの左から何個けずった？ i:sの左から何番目までいった？
    global ans
    if dp[i][j] == 1:
        return
    dp[i][j] = 1
    if int(num) % 2019 == 0:
        ans += 1
    else:
        if j < len(s):
            rec(i,j+1,num+s[j])
        if len(num) >= 2:
            rec(i+1,j,num[1::])

rec(0,1,s[0])
print(ans)


Fixed submission:
from collections import Counter
s = str(input())

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[len(s)-i])%2019 * pow(10,i-1,2019)
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for b in list(c.values()):#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += math.gcd(c,math.gcd(a, b)) 
print(ans)


Fixed submission:
import math
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += math.gcd(c,math.gcd(a, b)) 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())

def min_dis(i,j):
    return min(abs(j-i),min(abs(j-x)+abs(y-i)+1,abs(x-i)+abs(j-y)+1))
discount = [0]*n 

for i in range(1,n+1):
    for j in range(1,n+1):
        if i<j:
            discount[min_dis(i,j)]+=1

for i in range(1,n):
    print(discount[i])

Fixed submission:
n,x,y=map(int,input().split())

def min_dis(i,j):
    return min(abs(j-i),min(abs(j-x)+abs(y-i)+1,abs(x-i)+abs(j-y)+1))
discount = [0]*n 

for i in range(1,n+1):
    for j in range(1,n+1):
        if i<j:
            discount[min_dis(i,j)]+=1

for i in range(1,n):
    print(discount[i])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
a=list(map(int,input().split()))
c=Counter(a)
for i in range(n):
    ans = 0
    tmp = a[i]
    for b,j in c.items():
        if b == tmp:
            ans += ((j-1)*(j-2))//2
        else:
            ans += (j*(j-1))//2
    print(ans)
    

Fixed submission:
from collections import Counter
n = int(input())
a=list(map(int,input().split()))
c=Counter(a)
sum = 0
for i in c.values():
    sum += i*(i-1)//2

for i in a:
    if c[i] > 0:
        print(sum-(c[i]-1))
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import *
getcontext().prec = 40000
a,b,c=map(int,input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print("Yes")
else:
    print("No")


Fixed submission:
from decimal import *
getcontext().prec = 39851
a,b,c=map(int,input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=[]
def rec(i,s):
    if i == n:
        print(s)
        return
    else:
        for j in range(len(set(s)) + 1):
            rec(i+1,s+chr(old("a")+j))
rec(1,"a")

Fixed submission:
n=int(input())
ans=[]
def rec(i,s):
    if i == n:
        ans.append(s)
        return True
    else:
        if len(set(s)) == 1:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
        if len(set(s)) == 2:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
        if len(set(s)) == 3:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
        if len(set(s)) == 4:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
        if len(set(s)) == 5:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
        if len(set(s)) == 6:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
        if len(set(s)) == 7:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
        if len(set(s)) == 8:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
        if len(set(s)) == 9:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
            rec(i+1,s+"j")
rec(1,"a")
print("\n".join(ans))
Buggy python submission (verdict: Runtime Error):
def main():
    from collections import Counter
    import sys
    input = sys.stdin.readline
    n=int(input())
    s=[]
    for _ in []*n:
        s.append(input().rstrip())
    c = Counter(s)
    ans=[]
    max_vote = max(c.values())
    for i,j in c.items():
        if j == max_vote:
            ans.append(i)
    print("\n".join(sorted(ans)))
main()

Fixed submission:
from collections import Counter
n=int(input())
s=[]
for _ in range(n):
    s.append(input())
c = Counter(s)
ans=[]
max_vote = max(c.values())
for i,j in c.items():
    if j == max_vote:
        ans.append(i)
print("\n".join(sorted(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
s=[]
for _ in range(n):
    s.append(input())
c = Counter(s)
ans=[]
for i,j in c.items():
    if j == max(c.values()):
        ans.append(i)
print("\n".join(sorted(ans)))

Fixed submission:
from collections import Counter
n=int(input())
s=[]
for _ in range(n):
    s.append(input())
c = Counter(s)
ans=[]
max_vote = max(c.values())
for i,j in c.items():
    if j == max_vote:
        ans.append(i)
print("\n".join(sorted(ans)))
Buggy python submission (verdict: Time Limit Exceeded):
#pdf解説をそのまま
n = int(input())

c = [[0]*10 for _ in range(10)]

for i in range(10):
    for j in range(10):
        for k in range(1,n+1):
            if str(k)[0] == str(i) and str(k)[-1] == str(j):
                c[i][j] += 1
                
ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]

print(ans)
    

Fixed submission:
#pdf解説をそのまま
n = int(input())

c = [[0]*10 for _ in range(10)]

for i in range(10):
    for j in range(10):
        for k in range(1,n+1):
            if str(k)[0] == str(i) and str(k)[-1] == str(j):
                c[i][j] += 1
                
ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]

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

ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
    if(l[i][0] in ac) == False:
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in ac) == False:
      wa += 1
    

    
print(len(ac),wa)

Fixed submission:
c=input()
l="abcdefghrjklmnopqrstuvwxyz"

for i in range(27):
  if c == l[i]:
    print(l[i+1])
    exit()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]
 
p=[0]*m
wa=0

for i in range(m):
  if l[i][1]=="AC":
    wa += p[int(l[i][0])]
    p[int(l[i][0])]= -1
  elif l[i][1]=="WA":
    if p[int(l[i][0])] != -1:
      p[int(l[i][0])] += 1
      
print(p.count(-1),wa)

Fixed submission:
n,m=map(int,input().split())
probs = [False]*n
wrongs = [0]*n
for i in range(m):
    p,s=map(str,input().split())
    if probs[int(p)-1] == False:
        if s == "AC":
            probs[int(p)-1] = True
        elif s == "WA":
            wrongs[int(p)-1] += 1

ac=0
wa=0
for i,a in enumerate(probs):
    if a == True:
        ac+=1
        wa+=wrongs[i]
print(ac,wa)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" * 2
ans = ""
for i in s:
    ans[i] = a.index(a.index(s[i]) + n)
print(ans)


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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in s:
    ans += a[(int(a.index(i)) + n)%26]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ab = [list(map(int,input().split()))for _ in range(n-1)]

graph = [[] for _ in range(n+1)]
ans = [0]*(n-1)
for i in range(n-1):
    graph[ab[i][0]].append((ab[i][1],i))
    graph[ab[i][1]].append((ab[i][0],i))

visit = [False]*(n+1)
def dfs(p,c):
    color = 1
    visit[p] = True
    for n,i in graph[p]:
        if visit[n] == False:
            if color == c:
                color += 1
            ans[i] = color
            dfs(n,color)
            color += 1

dfs(1,0)
print(max(ans))
for t in ans:
    print(t)

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
n = int(input())
ab = [list(map(int,input().split()))for _ in range(n-1)]

graph = [[] for _ in range(n+1)]
ans = [0]*(n-1)
for i in range(n-1):
    graph[ab[i][0]].append((ab[i][1],i))
    graph[ab[i][1]].append((ab[i][0],i))

visit = [False]*(n+1)
def dfs(p,c):
    color = 1
    visit[p] = True
    for n,i in graph[p]:
        if visit[n] == False:
            if color == c:
                color += 1
            ans[i] = color
            dfs(n,color)
            color += 1

dfs(1,0)
print(max(ans))
for t in ans:
    print(t)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

if n % 2 == 0:
    t = s[0:n/2]
    if s == t + t:
        print("Yes")
        exit()
print("No")
    

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

if n % 2 == 0:
    t = s[0:int(n/2)]
    if s == t + t:
        print("Yes")
        exit()
print("No")