Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
ABC151 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
from collections import defaultdict
n,m=map(int, input().split())
ac=set()
ac_cnt=0
wa_cnt=0
d_ac=defaultdict(int)
d_wa=defaultdict(int)
for i in range(m):
    p,s=nm()
    if s=='AC':
        if int(p) in ac:
            continue
        ac.add(int(p))
        ac_cnt+=1
    elif s=='WA':
        if int(p) in ac:
            continue
        d_wa[p]+=1
 
for a in ac:
    wa_cnt+=d_wa[str(a)]
 
print(ac_cnt,wa_cnt)

Fixed submission:
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
from collections import defaultdict
n,m=map(int, input().split())
ac=set()
ac_cnt=0
wa_cnt=0
d_ac=defaultdict(int)
d_wa=defaultdict(int)
for i in range(m):
    p,s=nm()
    if s=='AC':
        if int(p) in ac:
            continue
        ac.add(int(p))
        ac_cnt+=1
    elif s=='WA':
        if int(p) in ac:
            continue
        d_wa[p]+=1
 
for a in ac:
    wa_cnt+=d_wa[str(a)]
 
print(ac_cnt,wa_cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[]
t=[]
for i range(N):
    s_tmp,t_tmp=map(str,input().split())
    s.append(s_tmp)
    t.append(int(t_tmp))
X=input() 

# N=3
# s=["dwango","sixth","prelims"]
# t=[ 2, 5,25]
# X="prelims"

print(sum(t[s.index(X)+1:]))





Fixed submission:
N=int(input())
s=[]
t=[]
for i in range(N):
    s_tmp,t_tmp=map(str,input().split())
    s.append(s_tmp)
    t.append(int(t_tmp))
X=input() 

# N=3
# s=["dwango","sixth","prelims"]
# t=[ 2, 5,25]
# X="prelims"

print(sum(t[s.index(X)+1:]))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
R,S,P=map(int, input().split())
T=input()

# N,K=7 ,1
# R,S,P=100 ,10, 1
# T="ssssppr"

# N,K=5, 2
# R,S,P=8, 7, 6
# T="rsrpr"

# N,K=30, 5
# R,S,P=325, 234, 123
# T="rspsspspsrpspsppprpsprpssprpsr"


max_ans=T.count("s")*R+T.count("p")*S+T.count("r")*P
for i in range(K):
    tmp_ans=T[i::K]
    for i in range(len((tmp_ans))-1):
        if tmp_ans[i]==tmp_ans[i+1]:
            if tmp_ans[i]=="s":
                max_ans-=R
            if tmp_ans[i]=="p":
                max_ans-=S
            if tmp_ans[i]=="r":
                max_ans-=P
            tmp_ans = tmp_ans[:i+1] + 'X' +tmp_ans[i+2:]

print(max_ans)
    
    


Fixed submission:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
A=[]
for x in T:
    if x == 's':
        A.append('r')
    if x == 'p':
        A.append('s')
    if x == 'r':
        A.append('p')
 
for i in range(K,N):
    if A[i-K] == A[i]:
        A[i] = 'x'
 
ans = 0
for x in A:
    if x == 's':
        ans += S
    if x == 'p':
        ans += P
    if x == 'r':
        ans += R
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
R,S,P=map(int, input().split())
T=input()
# N,K=7 ,1
# R,S,P=100 ,10, 1
# T="ssssppr"

# N,K=5, 2
# R,S,P=8, 7, 6
# T="rsrpr"


max_ans=T.count("s")*R+T.count("p")*S+T.count("r")*P
for i in range(K):
    tmp_ans=T[i::K]
    for i in range(len((tmp_ans))-1):
        if tmp_ans[i]==tmp_ans[i+1]:
            if tmp_ans[i]=="s":
                max_ans-=R
            if tmp_ans[i]=="p":
                max_ans-=S
            if tmp_ans[i]=="r":
                max_ans-=P
            s=tmp_ans[:]
            tmp_ans = s[:i+1] + 'X' + s[i+2:]

print(max_ans)
    
    


Fixed submission:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
A=[]
for x in T:
    if x == 's':
        A.append('r')
    if x == 'p':
        A.append('s')
    if x == 'r':
        A.append('p')
 
for i in range(K,N):
    if A[i-K] == A[i]:
        A[i] = 'x'
 
ans = 0
for x in A:
    if x == 's':
        ans += S
    if x == 'p':
        ans += P
    if x == 'r':
        ans += R
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m,v,p = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
def binary_search(left, right):
    if right - left <= 1:
        return left
    middle = (left + right) // 2
    if check(middle):
        return binary_search(middle, right)
    else:
        return binary_search(left, middle)
 
def check(target):
    used_vote = (p + n - target - 1) * m
    sum_vote = 0
    for i in range(target-1, p-2, -1):
        if a[target] + m < a[i]:
            return False
        sum_vote += (a[target] + m) - a[i]
    if sum_vote >= (m * v - used_vote): 
        return True
    else:
        return False
print(binary_search(0,n) + 1)

Fixed submission:
N, A, B = map(int, input().split())
 
if (B - A) % 2 == 0:
    print((B-A) // 2)
else:
    print(min(A - 1, N - B) + 1 + (B-A) // 2)
Buggy python submission (verdict: Runtime Error):
N-int(input())
s=list(map(int, input().split()))
s.sort()
ans=0
for i in range(N-1):
    if i==0:
        ans=+s[0]
    else:
        ans=((ans+s[i])/2)
print(ans)

Fixed submission:
N=int(input())
s=list(map(int, input().split()))
s.sort()
ans=s[0]
for i in range(N-1):
    ans=((ans+s[i+1])/2)
print(ans)

Buggy python submission (verdict: Runtime Error):
N-int(input())
s=list(map(int, input().split()))
s.sort()
ans=0
for i in range(N-1):
    if i==0:
        ans=s[0]
    else:
        ans=((ans+s[i])/2)
print(ans)

Fixed submission:
N=int(input())
s=list(map(int, input().split()))
s.sort()
ans=s[0]
for i in range(N-1):
    ans=((ans+s[i+1])/2)
print(ans)

Buggy python submission (verdict: Runtime Error):
N-int(input())
s=list(map(int, input().split()))
ans=0
for i in range(N-1):
    if i==0:
        ans=s[0]
    else:
        ans=((ans+s[i])/2)
print(ans)

Fixed submission:
N=int(input())
s=list(map(int, input().split()))
s.sort()
ans=s[0]
for i in range(N-1):
    ans=((ans+s[i+1])/2)
print(ans)

Buggy python submission (verdict: Runtime Error):
N-int(input())
s=list(map(int, input().split()))
ans=0
for i in range(N-1):
    if i==0:
        ans=s[0]
    else:
        ans=((ans+s[i])/2)
print(ans)

Fixed submission:
N=int(input())
s=list(map(int, input().split()))
s.sort()
ans=s[0]
for i in range(N-1):
    ans=((ans+s[i+1])/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
 int(input())
l = list(map(int, input().split()))
 
l[0] -= 0
 
ans = 'Yes'
for i in range(1,N):
    if l[i-1] < l[i]:
        l[i] -= 1
    elif l[i-1] == l[i]:
        pass
    else:
        ans = 'No'
        break
print(ans)

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




for i in range(len(s)-2,-1,-1):    
    if s[i]>s[i+1]:
        s[i]=s[i]-1


        
if s==sorted(s):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
b=[int(i) for i in input().split()]
sum=np.sum(b)
for i in reversed(range(n)):
  k = a[i+1]
  l = a[i]
  m = b[i]
 
  a[i+1] = max(k-m, 0)
  b[i] = max(m-k, 0)
 
  a[i] = max(l-b[i], 0)
  b[i] = max(b[i]-l, 0)
postsum=np.sum(b)
print(sum-postsum)
 

Fixed submission:
import numpy as np
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
sum=np.sum(b)
for i in reversed(range(n)):
  k = a[i+1]
  l = a[i]
  m = b[i]
 
  a[i+1] = max(k-m, 0)
  b[i] = max(m-k, 0)
 
  a[i] = max(l-b[i], 0)
  b[i] = max(b[i]-l, 0)
postsum=np.sum(b)
print(sum-postsum)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=0
for i in range(1,N+1):
  if i>=k:
    ans+=1/n
  else:
    cnt=1/n
    while i<k:
      cnt*=(1/2)
      i=2*i
    ans+=cnt
print(ans)

Fixed submission:
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    if i>=k:
        ans+=1/n
    else:
        cnt=1/n
        while i<k:
            cnt*=(1/2)
            i=2*i
        ans+=cnt
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
N=len(s)
ans=0
while True:
    if s!=s.replace("10","").replace("01",""):
        s=s.replace("10","").replace("01","")
    else:
        break;
    
    

    
print(N-len(s))

Fixed submission:
s = input()
zero = 0
one = 0
 
for i in range(len(s)):
    if s[i]=="0":
        zero += 1
    else:
        one += 1
else:
    ans = min(zero,one)*2
 
print(ans)
Buggy python submission (verdict: Runtime Error):
n,s=map(int, input().split())
N=[]
for _ in range(n):
    N.append(int(input()))
N=sorted(N)
for i in range(s-1,len(N)):
    diff_list.append(N[i]-N[i-s+1])
print(min(diff_list))

Fixed submission:
n,s=map(int, input().split())
N=[]
for _ in range(n):
    N.append(int(input()))
N=sorted(N)
diff_list=[]
for i in range(s-1,len(N)):
    diff_list.append(N[i]-N[i-s+1])
print(min(diff_list))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, input())

A=10*a+b+c
B=a+10*b+c
print(max(A,B))

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

A=10*a+b+c
B=a+10*b+c
C=a+b+10*c
print(max(A,B,C))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=[int(i) for i in input().split()]
A=[A[i]-i for i in range(N)]
#print(A)
b=np.median(A)
K=[abs(A[i]-b) for i in range(N)]
print(int(sum(K)))

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
t=[]
for i in range(n):
    t.append(al[i]-(i+1))
t=sorted(t)
if n%2==0:
    v=(t[n//2-1]+t[n//2])//2
else:
    v=t[n//2]
ans=0
for i in t:
    ans+=abs(i-v)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s= list(map(int,input().split()))
s.insert(0,0)
s.append(0)
for i in range(len(s)-2):
    tmp=s[:]
    del tmp[i+1]
    tmp_sum=0
    for i in range(len(tmp)-1):
        tmp_sum+=abs(tmp[i]-tmp[i+1])
    if i ==(len(tmp)-2):
        print(tmp_sum)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
d = []
for i in range(n - 1):
  d.append(abs(a[i + 1] - a[i]))
s = sum(d)
print(s - d[0] + abs(a[1]) + abs(a[-1]))
for i in range(n - 2):
  print(s - d[i] - d[i + 1] + abs(a[i + 2] - a[i]) + abs(a[0]) + abs(a[-1]))
print(s - d[-1] + abs(a[0]) + abs(a[-2]))
Buggy python submission (verdict: Runtime Error):
n=map(int,input().split())
t= list(map(int,input().split()))

import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
    print(0)
    sys.exit()
else:
    for i in range(delete_count):
        if len(c)>k:
            ans+=c[i]
            
print(ans)
sys.exit()
        



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

import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
    print(0)
    sys.exit()
else:
    for i in range(delete_count):
        if len(c)>k:
            ans+=c[i]
            
print(ans)
sys.exit()

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

import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
    print(0)
else:
    for i in range(delete_count):
        if len(c)>k:
            ans+=c[i]
            
print(ans)
sys.exit()
        



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

import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
    print(0)
    sys.exit()
else:
    for i in range(delete_count):
        if len(c)>k:
            ans+=c[i]
            
print(ans)
sys.exit()
Buggy python submission (verdict: Runtime Error):
a,b=str(int,input().split())
print((a-1)*(b-1))

Fixed submission:
a,b=map(int,input().split())
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
word=str(iinput)
print(woed[0]+str(len(word)-2)+word[-1])

Fixed submission:
word=str(input())
print(word[0]+str(len(word)-2)+word[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math

n,m=map(int,input().split())
n_comb=math.factorial(n)
m_comb=math.factorial(m)

if abs(n-m)>=2:
  print(0)
  sys.exit()
elif n==m:
  print(n_comb*m_comb*2)
  sys.exit()
else:
  print(n_comb*m_comb)
  

Fixed submission:
n, m = map(int, input().split())
MOD = 1000000007
 
def fac(n):
    ans = 1
    for i in range(1, n + 1):
        ans = (ans * i) % MOD
    return ans
 
if abs(m - n) > 1:
    print(0)
elif m == n:
    print((2 * fac(m) * fac(n)) % MOD)
else:
    print((fac(m) * fac(n)) % MOD)
Buggy python submission (verdict: Runtime Error):
N,T=map(int,input().split())
s=list(map(int, input().split()))

t=[0,3,5,7,100,110,200,300,311]
ans=0
t_diff=[t[i+1]-t[i] for i in range(N-1)]
print(t_diff)
for i in t_diff:
    if i>T:
        ans+=T
    else:
        ans+=i
# 差分で足し合わせたので最後は計算に入ってない、最後は必ず被らないのでTを加える
print(ans+T)




Fixed submission:
N,T=map(int,input().split())
t= list(map(int,input().split()))
ans=0
t_diff=[t[i+1]-t[i] for i in range(N-1)]
for i in t_diff:
    if i>T:
        ans+=T
    else:
        ans+=i
# 差分で足し合わせたので最後は計算に入ってない、最後は必ず被らないのでTを加える
print(ans+T)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:
    print("GREATER")
if a<b:
    print("LESS")
if a==b:
    print("EQUAL")

Fixed submission:
a=int(input())
b=int(input())
if a>b:
    print("GREATER")
if a<b:
    print("LESS")
if a==b:
    print("EQUAL")
Buggy python submission (verdict: Runtime Error):
w,a,b=map(int, input().split())
print(min(abs(a+w-b)),abs(a-b-w))

Fixed submission:
w,a,b=map(int, input().split())
if a<=b:
    print(max(0,(b-a-w)))
if b<a:
    print(max(0,(a-b-w)))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
count=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if (x+y+z)==s:
                count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0
z=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if(0<=z)&(z<=k):
            count+=1
            
print(count)

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

count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(k+1):
        	if x+y+z=s:
            count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0
z=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if(0<=z)&(z<=k):
            count+=1
            
print(count)

Buggy python submission (verdict: Runtime Error):
k,s=map(int, input().split())
x+y+z=s
count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(k+1):
        	if x+y+z=s:
            count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0
z=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if(0<=z)&(z<=k):
            count+=1
            
print(count)

Buggy python submission (verdict: Runtime Error):
k,s=map(int, input().split())
x+y+z=s
count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(z+1):
        	if x+y+z=s:
            count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0
z=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if(0<=z)&(z<=k):
            count+=1
            
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int, input().split())
count_n=0
for i in range(a,b+1):
    if i%x==0:
        count_n+=1
print(count_n)

Fixed submission:
a,b,x=map(int, input().split())
if (a%x==0):
    print((b//x-a//x)+1)
else:
    print((b//x-a//x))

Buggy python submission (verdict: Runtime Error):
a,b,x=map(int, input().split())
count_n=0
for i in range(a,b+1):
	if i%2==0:
    count_n+=1
print(count_n)

Fixed submission:
a,b,x=map(int, input().split())
if (a%x==0):
    print((b//x-a//x)+1)
else:
    print((b//x-a//x))
Buggy python submission (verdict: Runtime Error):
word=inpput()
# word="WBWBWBWBWB"
ans=0
for i in range(len(word)-1):
    if word[i]!=word[i+1]:
        ans+=1
        
print(ans)

Fixed submission:
word=input()
# word="WBWBWBWBWB"
ans=0
for i in range(len(word)-1):
    if word[i]!=word[i+1]:
        ans+=1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
word=inpput()
# word="WBWBWBWBWB"
ans=0
for i in range(len(word)-1):
    if word[i]!=word[i+1]:
        ans+=1
        
print(ans)

Fixed submission:
word=input()
# word="WBWBWBWBWB"
ans=0
for i in range(len(word)-1):
    if word[i]!=word[i+1]:
        ans+=1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
cnt=0
for i range(1,len(s)):
  if s[i]!=s[i-1]:
    cnt+=1
print(cnt)

Fixed submission:
s=input()
cnt=0
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().spllt())
n=b+(a-1)*(b-1)
print(n)

Fixed submission:
a,b=map(int,input().split())
n=b*(b-1)**(a-1)
print(n)
Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int, input().split("¥n"))
tmp=0
if n>=k:
    print(x*k+y*(n-k))
else:
    print(x*n)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(min(n,k)*x+max(n-k,0)*y)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int, input().split())
tmp=0
if n>=k:
    print(x*k+y*(n-k))
else:
    print(x*n)

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(min(n,k)*x+max(n-k,0)*y)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int, input().split())
tmp=0
if n>=k:
    print(x*k+y*(n-k))
else:
    print(x*n)
        

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(min(n,k)*x+max(n-k,0)*y)

Buggy python submission (verdict: Runtime Error):
n,k,x,y=map(int, input().split())
sum_n=x*k+y*(n-k)
print(sum_n)


Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(min(n,k)*x+max(n-k,0)*y)
Buggy python submission (verdict: Runtime Error):
n=int(input())
sun_m=0
for i in range(n+1):
  sum_m+=i
print(sum_n)

Fixed submission:
n=int(input())
sum_n=0
for i in range(n+1):
  sum_n+=i
print(sum_n)

Buggy python submission (verdict: Runtime Error):
n=map(int,input())
sun_m=0
for i in range(n+1):
  sum_n+=i
print(sum_n)

Fixed submission:
n=int(input())
sum_n=0
for i in range(n+1):
  sum_n+=i
print(sum_n)

Buggy python submission (verdict: Runtime Error):
n=map(int,input())
sun_n=0
for i in range(n+1):
  sun_n+=i
 print(sun_n)

Fixed submission:
n=int(input())
sum_n=0
for i in range(n+1):
  sum_n+=i
print(sum_n)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if sorted(list[a,b,c])==[5,5,7]:
  print("YES")
else:
  print("NO")

Fixed submission:
a,b,c=map(int, input().split())
if sorted(list((a,b,c)))==[5,5,7]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input())
s=[]
for i in range(n):
	s.append(input())
print("",join(sorted(s)))

Fixed submission:
n, l = map(int, input().split())
s = []
for i in range(n):
    s.append(input())
print(''.join(sorted(s)))

Buggy python submission (verdict: Runtime Error):
n,l=map(int,input())
s=[]
for i in range(n):
	s.append(i)
print("",join(sorted(s)))

Fixed submission:
n, l = map(int, input().split())
s = []
for i in range(n):
    s.append(input())
print(''.join(sorted(s)))
Buggy python submission (verdict: Runtime Error):
S, T = input().split()
A, B = input().split()
U = input()

print(f"{int(A) - 1 if S == U else 0} {int(B) - 1 if T == U else 0}")


Fixed submission:
S, T = input().split()
A, B = input().split()
U = input()

print("{} {}".format(int(A) - (1 if S == U else 0), int(B) - (1 if T == U else 0)))
Buggy python submission (verdict: Runtime Error):
K , X = map(int,input().split())

if K * 500 >= X:
  print("Yes")
else print("No")

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

if K * 500 >= X:
  print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in range(N):
	a.append(input())
d={}
sor={}
for i in range(N):
    if a[i] in d.keys():
        d[a[i]]+=1
    else:
        d.setdefault(a[i],1)
sod = sorted(d.keys())
#max=sod["a[0]"]
maxval=0
for i in range(N):
    if maxval<=d[a[i]]:
        maxval=d[a[i]]
for i in range(N):
    if maxval==d[sod[i]]:
        print(sod[i])

Fixed submission:
N=int(input())
a=[]
b=0
for i in range(N):
	a.append(input())
d={}
sor={}
for i in range(N):
    if a[i] in d.keys():
        d[a[i]]+=1
    else:
        d.setdefault(a[i],1)
        b+=1
sod = sorted(d.keys())
#max=sod["a[0]"]
maxval=0
for i in range(N):
    if maxval<=d[a[i]]:
        maxval=d[a[i]]
for i in range(b):
    if maxval==d[sod[i]]:
        print(sod[i])
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=int(input())
sum=0
for i in range(n):
  h=int(input())
  if h>=k:
    sum=sum+1
print(sum)

Fixed submission:
n=input().split()
N=int(n[0])
K=int(n[1])
h=list(map(int,input().split()))
sum=0
for i in range(N):
    if h[i]>=K:
        sum=sum+1
print(sum)
Buggy python submission (verdict: Runtime Error):
import math
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=list(map(int, input().split()))
a=math.gcd(n[0], n[1])
c = collections.Counter(prime_factorize(a))
b=list(c.keys())
d=len(b)
print(d+1)

Fixed submission:
import fractions
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=list(map(int, input().split()))
a=fractions.gcd(n[0], n[1])
c = collections.Counter(prime_factorize(a))
b=list(c.keys())
d=len(b)+1
print(d)
Buggy python submission (verdict: Runtime Error):
s=input()
if s=='Sunny':
    print('Cloudy')
else if s=='Cloudy':
    print('Rainy')
else:
    print('Sunny')



Fixed submission:
s=input()
if s=='Sunny':
    print('Cloudy')
elif s=='Cloudy':
    print('Rainy')
else:
    print('Sunny')