Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n,k = i2()
h = intl()

dp = [0]*n
m = 10
for i in range(1,n):
    if i == 1:
        dp[i] = abs(h[i] - h[0])
    else:
        dp[i] = min([int(abs(h[i] - h[i-p]) + dp[i-p]) for p in range(1,k+1) if i-p >= 0])
print(dp[-1])

Fixed submission:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n,k = i2()
h = intl()

dp = [0]*n
m = 10
for i in range(1,n):
    if i == 1:
        dp[i] = abs(h[i] - h[0])
    else:
        dp[i] = min([int(abs(h[i] - h[i-p]) + dp[i-p]) for p in range(1,k+1) if i-p >= 0])
#print(dp)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

d = i()
if d == 25:
	print("Christmas")
elif d = 24:
	print("Christmas Eve")
elif d == 23:
	print("Christmas Eve Eve")
else:
	print("Christmas Eve Eve Eve")


Fixed submission:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

d = i()
if d == 25:
	print("Christmas")
elif d == 24:
	print("Christmas Eve")
elif d == 23:
	print("Christmas Eve Eve")
else:
	print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n<105:
	print(0)
elif 105<=n<135:
	print(1)
elif 135<=n<189:
	print(2)
"""
elif 189<=n:
"""
	print(3)

Fixed submission:
n=int(input())
if n<105:
	print(0)
elif 105<=n<135:
	print(1)
elif 135<=n<165:
	print(2)
elif 165<=n<189:
	print(3)
elif 189<=n<195:
	print(4)
elif 195<=n:
	print(5)
Buggy python submission (verdict: Runtime Error):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

if s[0] != "A":
	f1 = True  
cnt = 0
for i in range(2,len(s)-1):
	if s[i] == "C":
		cnt += 1
if cnt1 == 1:
	f2 =True
cnt2 = 0
for i in range(1,len(s)):
	if s[i].islower():
		cnt2 += 1
if cnt2 >= len(s) -2:
	f3 = True

if f1 and f2 and f3:
	print("AC")
else:
	prinet("WA")

Fixed submission:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

flag = 0
if s[0] == "A":
	flag += 1 
cnt1 = 0
for i in range(2,len(s)-1):
	if s[i] == "C":
		cnt1 += 1
if cnt1 == 1:
	flag += 1
cnt2 = 0
for i in range(1,len(s)):
	if s[i].islower():
		cnt2 += 1
if cnt2 >= len(s) -2:
	flag += 1

if flag == 3:
	print("AC")
else:
	print("WA")
Buggy python submission (verdict: Runtime Error):
n = str(input())
cnt = 0
for i in range(len(n)):
	cnt += n[i]
if int(n)%cnt == 0:
	print("Yes")
else:
	print("No")

Fixed submission:
n = str(input())
cnt = 0
for i in range(len(n)):
	cnt += int(n[i])
if int(n)%cnt == 0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
s = str(input())
for i in range(3):
	if s[i] == "o":
		cnt += 1
print(700+100*cnt)

Fixed submission:
s = str(input())
cnt = 0
for i in range(3):
	if s[i] == "o":
		cnt += 1
print(700+100*cnt)
Buggy python submission (verdict: Runtime Error):
s = str(input())
s[3]="8"
print(s)

Fixed submission:
s = list(input())
s[3] = '8'
s = "".join(s)
print(s)
Buggy python submission (verdict: Runtime Error):
s = list(input().split())
print(s[0] + s[1] + s[2])

Fixed submission:
s = list( input() )
print(int(s[0]) + int(s[1]) + int(s[2]))
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	if (n%1000 == 111 || n%1000 == 222 || n%1000 == 333 || n%1000 == 444 || n%1000 == 555 || n%1000 == 666 || n%1000 == 777 || n%1000 == 888 || n%1000 == 999){
		cout << "Yes" << endl;
    }
	else if (n/10 == 111 || n/10 == 222 || n/10 == 333 || n/10 == 444 || n/10 == 555 || n/10 == 666 ||n/10 == 777 || n/10 == 888 || n/10 == 999){
		cout << "Yes" << endl;
    }
	else{
		cout << "No" << endl;
    }
}

Fixed submission:
n = str(input())
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F = 10,11,12,13,14,15
x,y = map(int,input().split())
if x < y:
  print("<")
elif x > y:
  print(">")
else:
  print("=")

Fixed submission:
A,B,C,D,E,F = 10,11,12,13,14,15
x,y = map(str,input().split())
if x < y:
  print("<")
elif x > y:
  print(">")
else:
  print("=")
Buggy python submission (verdict: Runtime Error):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())


s = list(s())
s = list(set(s))
s.sort()
ans = [str (i) for i in "abcdefghijklmnopqrstuvwxyz"]
#print("s",s)
#print("ans",ans)
#print(len(s))
for i in range(len(s)):
	#print("s",i)
	#print("ans",s)
	#print(ans)
	print(s[i])
	if s[i] in ans: #s[i] in ans なら
		ans.pop(i-1)
		print(i,"ans",ans)
print(ans[0])



Fixed submission:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = l()
alf = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
	alf = alf.replace(s[i],'')
if alf == "":
	print("None")
else:
	print(alf[0])
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
ans = a[0] + b[0] + c[0]
print(ans.upper())

Fixed submission:
a,b,c = map(str,input().split())
ans = a[0] + b[0] + c[0]
print(ans.upper())
Buggy python submission (verdict: Runtime Error):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = i()
b = i()

if len(a) > len(b):
	print("GREATER")
elif a == b:
	print("EQUAL")
else:
	print("LESS")

Fixed submission:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = i()
b = i()

if a > b:
	print("GREATER")
elif a == b:
	print("EQUAL")
else:
	print("LESS")
Buggy python submission (verdict: Runtime Error):
a,b,c,b = map(int,input().split())
print( max(a*b, c*d) )


Fixed submission:
a,b,c,d = map(int,input().split())
print( max(a*b, c*d) )

Buggy python submission (verdict: Runtime Error):
a,b,c,b = map(int,input().split())
print( max(a*b, c*d)

Fixed submission:
a,b,c,d = map(int,input().split())
print( max(a*b, c*d) )
Buggy python submission (verdict: Runtime Error):
a,op,b = map(str,input(),split())
if op == "+":
	print(int(a) + int(b))
else:
	print(int(a) - int(b))


Fixed submission:
a,op,b = map(str,input().split())
if op == "+":
	print(int(a) + int(b))
else:
	print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
a,op,c = map(str,input(),split())
if op == "+":
	print(int(a) + int(b))
else:
	print(int(a) - int(b))

Fixed submission:
a,op,b = map(str,input().split())
if op == "+":
	print(int(a) + int(b))
else:
	print(int(a) - int(b))
Buggy python submission (verdict: Runtime Error):
n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
	if s[i]=='a' and cnt<a+b:
		print('Yes')
		cnt+=1
	elif s[i]=='b' and cnt<A+B and cnt_b<=B:
			print('Yes')
	else:
		print('No')

Fixed submission:
n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
	if s[i]=='a' and cnt<A+B:
		print('Yes')
		cnt+=1
	elif s[i]=='b' and cnt<A+B and cnt_b<B:
		print('Yes')
		cnt_b+=1
		cnt+=1
	else:
		print('No')

Buggy python submission (verdict: Runtime Error):
n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
	if s[i]=='a' and cnt<a+b:
		print('Yes')
		cnt+=1
	else:
		print('No')
	elif s[i]=='b' and cnt<A+B and cnt_b<=B:
			print('Yes')
		else:
			print('No')
	elif s[i]=='c':
		print('No')
		cnt_c+=1

Fixed submission:
n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
	if s[i]=='a' and cnt<A+B:
		print('Yes')
		cnt+=1
	elif s[i]=='b' and cnt<A+B and cnt_b<B:
		print('Yes')
		cnt_b+=1
		cnt+=1
	else:
		print('No')
Buggy python submission (verdict: Runtime Error):
a = int(input()
b = int(input())
h = int(input())
print( (a+b)*h//2 )

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print( (a+b)*h//2 )
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a == 5 and b == 7 and c == 7) or (a == 7 and b == 5 and c == 7) or (a == 7 and b == 7 c == 5):
	print("YES")
else:
	print("NO")

Fixed submission:
a = list(str(i) for i in input().split())
if a.count("5") == 2 and a.count("7") == 1:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input())
b=N%1000
if b=0:
  print(0)
else:
  print(1000-b)

Fixed submission:
N=int(input())
b=N%1000
if b==0:
  print(0)
else:
  print(1000-b)
Buggy python submission (verdict: Time Limit Exceeded):
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k!=0:
    for i in range(0,k):
        d.append(bunbo*(i+1)-1)
#dの中には候補となるxが入った
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
if len(d)>=2:
    print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))
if len(d)==1:
    print(floor(d[0]))

Fixed submission:
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k>=1:
    d.append(bunbo-1)
    d.append(bunbo*k-1)
#dの中には候補となるxが入った
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
if len(d)>=2:
    print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))
if len(d)==1:
    print(floor(d[0]))

Buggy python submission (verdict: Runtime Error):
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k!=0:
    for i in range(0,k):
        d.append(bunbo*(i+1)-1)
#dの中には候補となるxが入った
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))

Fixed submission:
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k>=1:
    d.append(bunbo-1)
    d.append(bunbo*k-1)
#dの中には候補となるxが入った
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
if len(d)>=2:
    print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))
if len(d)==1:
    print(floor(d[0]))

Buggy python submission (verdict: Time Limit Exceeded):
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k!=0:
    for i in range(0,k):
        d.append(bunbo*(i+1)-1)
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
temp= floor(d[0])
if len(d)>1:
    for i in range(1,len(d)):
        temp=max(temp,floor(d[i]))
    print(temp)
else:
    print(temp)

Fixed submission:
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k>=1:
    d.append(bunbo-1)
    d.append(bunbo*k-1)
#dの中には候補となるxが入った
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
if len(d)>=2:
    print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))
if len(d)==1:
    print(floor(d[0]))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=[str(input())]
s=1
#sは現時点で何個景品が手に入ったかを示す
for i in range (0,N-1):
    #残りn-1回の当選結果について確認
    temp=str(input())#tempはとりあえず入力を受け取る
    t=0
    for j in range(0,s):
      #今までのものに重複がないかチェック
      if temp == a[j]:
        t=t+1
    if t == 0:
        a.append(temp)
        s=s+1
print(s)

Fixed submission:
N=int(input())
a= [input() for i in range(N)]
b=set(a)
print(len(b))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
def wa(N,K):
    a=0
    for i in range(0,K):
        a=a+N-2*i
    return a+1
d=0
for i in range(K,N+1):
  d=d+wa(N,i)
print((d+1)%(10**9+7))


Fixed submission:
N,K=map(int,input().split())
def wa(N,K):
    return K*(N+1-K)+1
d=0
for i in range(K,N+2):
  d=d+wa(N,i)
print((d)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
def wa(N,K):
    a=0
    for i in range(0,K):
        a=a+N-i
    c=0
    for i in range (0,K):
        c=c+i
    return a-c+1
d=0
for i in range(K,N+1):
  d=d+wa(N,i)
print((d+1)%(10**9+7))

Fixed submission:
N,K=map(int,input().split())
def wa(N,K):
    return K*(N+1-K)+1
d=0
for i in range(K,N+2):
  d=d+wa(N,i)
print((d)%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
import math 
c=0
for i in range(1,K+1):
    for j in range (1,K+1):
        for k in range (1,K+1):
            a=math.gcd(i,j)
            b=math.gcd(a,k)
            c=c+b
print(c)

Fixed submission:
K=int(input())
from math import gcd 
c=0
for i in range(1,K+1):
    for j in range (1,K+1):
        for k in range (1,K+1):
            c=c+gcd(gcd(i,j),k)
print(c)
Buggy python submission (verdict: Runtime Error):
a=input()
if a==SUN:
  print(7)
elif a==MON:
  print(6)
elif a==TUE:
  print(5)
elif a==WED:
  print(4)
elif a==THU:
  print(3)
elif a==FRI:
  print(2)
elif a==SAT:
  print(1)

Fixed submission:
a=input()
if a=="SUN":
  print(7)
elif a=="MON":
  print(6)
elif a=="TUE":
  print(5)
elif a=="WED":
  print(4)
elif a=="THU":
  print(3)
elif a=="FRI":
  print(2)
elif a=="SAT":
  print(1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%2==1:
  print(No)
  #偶数なら不適
else:
  s=input()
  b=N//2
  s=0
  for i in range (0,b):
    if s[i]==s[i+b]:
      s=s
    else:
      s=s+1
  if s==0:
    print(Yes)
  else:
    print(No)

Fixed submission:
N=int(input())
if N%2==1:
  print("No")
  #偶数なら不適
else:
  s=input()
  b=N//2
  t=0
  for i in range (0,b):
    if s[i]==s[i+b]:
      t=t
    else:
      t=t+1
  if t==0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(a**(1/2))
m=a
for i in range (2,b+1):
  if a%i==0:
    m=i
c=a/m
print(int(m+c-2))

Fixed submission:
a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=0
for i in range (2,10):
  if N%i==0:
    if N/i<=9:
      a=a+1
if (a==0 and N>1):
  print("No")
else:
    print("Yes")

Fixed submission:
a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=0
for i in range (2,10):
  if N%i==0:
    if N/i<=9:
      a=a+1
if (a==0 and N>1):
  print("No")
else:
    print("Yes")


Fixed submission:
a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=0
for i in range (2,10):
  if N%i==0:
    if N/i<=9:
      a=a+1
if (a==0 and N>1):
  print("No")
else:
    print("Yes")

Fixed submission:
a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=0
for i in range (2,10):
  if N%i==0:
    if N/i<=9:
      a=a+1
if (a==0 and N>1):
  print("no")
else:
    print("yes")
print(a)
    

Fixed submission:
a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=0
for i in range (2,9):
  if N%i==0:
    if N/i<=9:
      a=a+1
if a==0 and N>1:
  print("no")
else:
    print("yes")

Fixed submission:
a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2b>=0:
   print(a-2b)
else:
  print(0)

Fixed submission:
a,b=map(int,input().split())
if a-2*b<0:
  print(0)
else:
  print(a-2*b)
Buggy python submission (verdict: Runtime Error):
S=input()
if S="Sunny":
  print("Cloudy")
elif S="Cloudy":
  print("Rainy")
else:
  print("Sunny")

Fixed submission:
S=input()
if S=="Sunny":
  print("Cloudy")
elif S=="Cloudy":
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = list(map(int, input().split()))
s = 0
mod = 10**9+7
for i in range(n-1):
    for j in range(i+1, n):
        s += arr[i]*arr[j]
print(s%mod)

Fixed submission:
n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
s = s*s
mod = 10**9 + 7
ind = 0
for i in range(n):
    ind += arr[i]*arr[i]
print(((s-ind)//2)%mod)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
arr = [[0 for _ in range(b)] for _ in range(a)]
for _ in range(c):
    x,y = map(int, input().split())
    arr[x-1][y-1] = '#'

ans = 0
for i in range(a):
    for j in range(b):
        if arr[i][j] == '#':
            ans = max(ans, (arr[i].count('#')+list(zip(*arr))[j].count('#'))-1)
        else:
            ans = max(ans, arr[i].count('#')+list(zip(*arr))[j].count('#'))
print(ans)


Fixed submission:
H, W, M = map(int, input().split())

HL, WL = [0]*H, [0]*W
B = []

for _ in range(M):
  h, w = map(lambda x:int(x)-1, input().split())
  B.append((h, w))
  HL[h] += 1
  WL[w] += 1

HM, WM = max(HL), max(WL)
K = HL.count(HM) * WL.count(WM)

cnt = 0
for h, w in B:
  if HL[h] == HM and WL[w] == WM:
    cnt += 1

if K > cnt:
  print(HM+WM)
else:
  print(HM+WM-1)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
arr = [[0 for _ in range(b)] for _ in range(a)]
for _ in range(c):
    x,y = map(int, input().split())
    arr[x-1][y-1] = '#'

counts = []
new_list = list(zip(*arr))
ans = 0
for k in range(b):
    counts.append(new_list[k].count('#'))
    
for i in range(a):
    temp = arr[i].count('#')
    for j in range(b):
        if arr[i][j] == '#':
            ans = max(ans, temp+counts[j]-1)
        else:
            ans = max(ans, temp+counts[j])
print(ans)

Fixed submission:
H, W, M = map(int, input().split())

HL, WL = [0]*H, [0]*W
B = []

for _ in range(M):
  h, w = map(lambda x:int(x)-1, input().split())
  B.append((h, w))
  HL[h] += 1
  WL[w] += 1

HM, WM = max(HL), max(WL)
K = HL.count(HM) * WL.count(WM)

cnt = 0
for h, w in B:
  if HL[h] == HM and WL[w] == WM:
    cnt += 1

if K > cnt:
  print(HM+WM)
else:
  print(HM+WM-1)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
arr = [[0 for _ in range(b)] for _ in range(a)]
for _ in range(c):
    x,y = map(int, input().split())
    arr[x-1][y-1] = '#'

ans = 0
for i in range(a):
    for j in range(b):
        if arr[i][j] == '#':
            ans = max(ans, (arr[i].count('#')+list(zip(*arr))[j].count('#'))-1)
        else:
            ans = max(ans, arr[i].count('#')+list(zip(*arr))[j].count('#'))
print(ans)

Fixed submission:
H, W, M = map(int, input().split())

HL, WL = [0]*H, [0]*W
B = []

for _ in range(M):
  h, w = map(lambda x:int(x)-1, input().split())
  B.append((h, w))
  HL[h] += 1
  WL[w] += 1

HM, WM = max(HL), max(WL)
K = HL.count(HM) * WL.count(WM)

cnt = 0
for h, w in B:
  if HL[h] == HM and WL[w] == WM:
    cnt += 1

if K > cnt:
  print(HM+WM)
else:
  print(HM+WM-1)
Buggy python submission (verdict: Runtime Error):
arr = []
n = int(input())
while n > 0:
  arr.append(input())
  n -= 1
print('AC x '+arr.count('AC'))
print('WA x '+arr.count('WA'))
print('TLE x '+arr.count('TLE'))
print('RE x '+arr.count('RE'))
      

Fixed submission:
arr = []
n = int(input())
while n > 0:
  arr.append(input())
  n -= 1
print('AC x', arr.count('AC'))
print('WA x', arr.count('WA'))
print('TLE x', arr.count('TLE'))
print('RE x', arr.count('RE'))
Buggy python submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
grid = [input() for _ in range(h)]
ans = 0
for i in range(1<<h):
  for j in range(1<<w):
    count = 0
    for x in range(h):
      if i >> n & i:
        continue
      for y in range(w):
        if j >> m & 1:
          continue
        if grid[x][y] == '#':
          count += 1 
    if count == k:
      ans += 1
print(ans)

Fixed submission:
def main():
  h, w, k = map(int, input().split())
  C = [list(input()) for _ in range(h)]

  result = 0
  for i in range(1 << h):
    for j in range(1 << w):
      cnt = 0
      for n in range(h):
        if i >> n & 1:
          continue

        for m in range(w):
          if j >> m & 1:
            continue

          if C[n][m] == '#':
            cnt += 1

      if cnt == k:
        result += 1

  print(result)


if __name__ == "__main__":
  main()

Buggy python submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
grid = [input() for _ in range(h)]
ans = 0
for i in range(1<<h):
  for j in range(1<<w):
    count = 0
    for x in range(h):
      if 1 << i & m:
        continue
      for y in range(w):
        if 1 << j & n:
          continue
        if grid[x][y] == '#':
          count += 1 
    if count == k:
      ans += 1
print(ans)

Fixed submission:
def main():
  h, w, k = map(int, input().split())
  C = [list(input()) for _ in range(h)]

  result = 0
  for i in range(1 << h):
    for j in range(1 << w):
      cnt = 0
      for n in range(h):
        if i >> n & 1:
          continue

        for m in range(w):
          if j >> m & 1:
            continue

          if C[n][m] == '#':
            cnt += 1

      if cnt == k:
        result += 1

  print(result)


if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int, input().split()))
for i in arr:
  total ^= i
for i in arr:
  print(total ^ i, end=' ')

Fixed submission:
n = int(input())
arr = list(map(int, input().split()))
total = 0
for i in arr:
  total ^= i
for i in arr:
  print(total ^ i, end=' ')
Buggy python submission (verdict: Runtime Error):
14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1

Fixed submission:
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = arr[n//2] - arr[n//2-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = []
for i in range(n):
    arr.append(int(input()))
visited = []
i = 0
c = 0
while i != 1 and i not in visited:
    visited.append(i)
    i = arr[i]-1
    c += 1
if i == 1:
    print(c)
else:
    print(-1)

Fixed submission:
n = int(input())
arr = []
for i in range(n):
    arr.append(int(input())-1)
now = 0
c = 0
while True:
    if now == 1:
        print(c)
        break
    if c >= n:
        print(-1)
        break
    c += 1
    now = arr[now]
Buggy python submission (verdict: Runtime Error):
num = int(input())
ar = list(map(int,input().split()))
mod = 10**9 + 7
somee = sum(arr)
ans = 0
for i in range(num):
    ans+=(somee-ar[i])*ar[i]
print((ans//2)%mod)

Fixed submission:
num = int(input())
ar = list(map(int,input().split()))
mod = 10**9 + 7
somee = sum(ar)
ans = 0
for i in range(num):
    ans+=(somee-ar[i])*ar[i]
print((ans//2)%mod)
Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

print(str(no_ac) + ' ' + str(no_wa))

Fixed submission:
print(chr(ord(input()) + 1))

Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

Fixed submission:
print(chr(ord(input()) + 1))

Buggy python submission (verdict: Runtime Error):
print(chr(ord(input() + 1)))

Fixed submission:
print(chr(ord(input()) + 1))