Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict as d

def bfs(adj, start, n):
	visited = [False] * (n + 1)
	tab = [0] * n
	queue = []
	queue.append(start)
	visited[start] = True
	while queue:
		s = queue.pop(0)
		for i in adj[s]:
			if visited[i] == False:
				queue.append(i)
				visited[i] = True
				tab[i - 1] = tab[s - 1] + 1
	return tab

n, u, v = map(int, input().split())
adj = d(list)
for i in range(n - 1):
	a, b = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)

takahashi = bfs(adj, u, n)
aoki = bfs(adj, v, n)
res = -1
for i in range(n):
	if takahashi[i] <= aoki[i]:
		res = max(res, aoki[i] - 1)

print(res)


Fixed submission:
from collections import defaultdict as d
from collections import deque

def bfs(adj, start, n):
	visited = [0] * (n + 1)
	tab = [0] * n
	q = deque([start])
	visited[start] = 1
	while q:
		s = q.popleft()
		for i in adj[s]:
			if visited[i] == 0:
				q.append(i)
				visited[i] = 1
				tab[i - 1] = tab[s - 1] + 1
	return tab

n, u, v = map(int, input().split())
adj = d(list)
for i in range(n - 1):
	a, b = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)

takahashi = bfs(adj, u, n)
aoki = bfs(adj, v, n)
res = -1
for i in range(n):
	if takahashi[i] <= aoki[i]:
		res = max(res, aoki[i] - 1)

print(res)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict as d

def dfs(adj, visited, count, tab, start):
	visited[start-1] = 1
	for v in adj[start]:
		if not visited[v-1]:
			tab[v-1] += count
			dfs(adj, visited, count+1, tab, v)
	return tab		

n, u, v = map(int, input().split())
adj = d(list)
for i in range(n-1):
	a, b = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)
	
takahashi = dfs(adj, [0] * n, 1, [0] * n, u)
aoki = dfs(adj, [0] * n, 1, [0] * n, v)

res = -1
for i in range(n):
	if takahashi[i] <= aoki[i]:
		res = max(res, aoki[i] - 1)

print(res)


Fixed submission:
from collections import defaultdict as d
from collections import deque

def bfs(adj, start, n):
	visited = [0] * (n + 1)
	tab = [0] * n
	q = deque([start])
	visited[start] = 1
	while q:
		s = q.popleft()
		for i in adj[s]:
			if visited[i] == 0:
				q.append(i)
				visited[i] = 1
				tab[i - 1] = tab[s - 1] + 1
	return tab

n, u, v = map(int, input().split())
adj = d(list)
for i in range(n - 1):
	a, b = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)

takahashi = bfs(adj, u, n)
aoki = bfs(adj, v, n)
res = -1
for i in range(n):
	if takahashi[i] <= aoki[i]:
		res = max(res, aoki[i] - 1)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))

# pref = list(accumilate(a))

tab = [0] * n
for i in range(n):
	tab[i] = abs(sum(a[:i+1]) - sum(a[i+1:])) 
print(min(tab))

Fixed submission:
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))

pref = list(accumulate(a))

tab = [0] * n
for i in range(n):
	tab[i] = abs(pref[i] - (pref[-1] - pref[i])) 
print(min(tab))
Buggy python submission (verdict: Runtime Error):
def powmod(a, n, p):
    if(n==0):
        return 1
    elif(n==1):
        return a%p
    elif(n%2==1):
        return ((a%p)*(powmod(a,n//2,p)**2%p))%p
    elif(n%2==0):
        return powmod(a,n//2,p)**2%p
N=int(input())
if(N==1):
  print(0)
else:
  print(powmod(10,N-2))

Fixed submission:
def powmod(a, n, p):
    if(n==0):
        return 2
    elif(n==1):
        return a%p
    elif(n%2==1):
        return ((a%p)*(powmod(a,n//2,p)**2%p))%p
    elif(n%2==0):
        return powmod(a,n//2,p)**2%p
N=int(input())
p=10**9+7
if(N==1):
    print(0)
else:
    print((powmod(10,N,p)-2*powmod(9,N,p)+powmod(8,N,p))%p)
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(N*(N-1)//2-(3*(N//3)*(N//3-1)+5*(N//5)*(N//5-python
                                              p1))//2+15*(N//15)*(N//15-1)//2)


Fixed submission:
print("Yes" if("7"in input())else"No")

Buggy python submission (verdict: Runtime Error):
N = input()
print(N*(N-1)//2-(3*(N//3)+5*(N//5))+15*(N//15))

Fixed submission:
print("Yes" if("7"in input())else"No")
Buggy python submission (verdict: Runtime Error):
length, num = map(int, input().split())
dist=[int(i) for i in input().split()]

Max=0
for i in range(num):
    Max = max([abs(dist[(i+1)%num]-dist[i]),Max])

print(length-Max)
input()


Fixed submission:
length, num = map(int, input().split())
dist=[int(i) for i in input().split()]

Max=0
for i in range(num-1):
    Max = max([dist[i+1]-dist[i],Max])

Max=max(Max,length-dist[-1]+dist[0])
print(length-Max)
Buggy python submission (verdict: Runtime Error):
H,W=map(int, input().split())
3 7
if(H%2==1 and W%2==1):
    print(int((W*H-1)/2))
else:
    print(int(W*H/2))

Fixed submission:
H,W=map(int, input().split())
print(int((H*W-(H%2)*(W%2))/2+(H%2)*(W%2)) if(H!=1 and W!=1) else 1)

Buggy python submission (verdict: Runtime Error):
H,W=map(int, input().split())
3 7
if(H%2==1 and W%2==1):
    print((W*H-1)/2)
else:
    print(W*H/2)

Fixed submission:
H,W=map(int, input().split())
print(int((H*W-(H%2)*(W%2))/2+(H%2)*(W%2)) if(H!=1 and W!=1) else 1)

Buggy python submission (verdict: Runtime Error):
H,W=map(int, input().split())
if(H%2==1 and W%2==1):
    print(W*H-1)
else(H%2==0 or H%2==0):
    print(W*H)

Fixed submission:
H,W=map(int, input().split())
print(int((H*W-(H%2)*(W%2))/2+(H%2)*(W%2)) if(H!=1 and W!=1) else 1)
Buggy python submission (verdict: Runtime Error):
a,b,m=map(int, input().split())
list_a=[ int(i)  for i in input().split()]
list_b=[ int(i)  for i in input().split()]
x,y,c=([],[],[])
for i in range(m):
    s=list(map(int, input().split()))
    x+=[s[0]]
    y+=[s[1]]
    c+=[s[2]]
print(min([ list_a[x[i]-1] + list_b[y[i]-1] - c[i]   for i in range(len(c))]+[min(list_a)+min(list_b)]))

Fixed submission:
S=input()
if(len(S)%2==0):
  for i in range(len(S)//2):
    if(S[2*i]!="h" or S[2*i+1]!="i"):
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
hihihihi
if(len(S)%2==0):
  for i in range(len(S)//2):
    if(S[2*i]!="h" or S[2*i+1]!="i"):
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")

Fixed submission:
S=input()
if(len(S)%2==0):
  for i in range(len(S)//2):
    if(S[2*i]!="h" or S[2*i+1]!="i"):
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
if(len(S)%2==0):
  for in in range(S//2):
    if(S[2*i]!="h" or S[2*i+1]!="i"):
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")

Fixed submission:
S=input()
if(len(S)%2==0):
  for i in range(len(S)//2):
    if(S[2*i]!="h" or S[2*i+1]!="i"):
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*b;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(min_a,min_b)+0.4999999,0)))

Fixed submission:
S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*B;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))


Fixed submission:
S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
S,A,B=map(int,input().split())
print((S//(A+B))*A+min(A,S%(A+B)))

Fixed submission:
S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
S=input()
if(("A"in S and "B"in S):
  print("Yes")
else:
  print("No")


Fixed submission:
S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A
max_a=(100*A+1)/8
min_b=10*B
max_b=min_B+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))

Fixed submission:
A, B =map(int, input().split())
max_A=(A+1)*25/2
max_B=10*(B+1)
p=int(round(max([A*12.5,B*10])+0.4999999999,0))
print(p if(p<min([(A+1)*25/2, 10*(B+1)]) and not(4<5*A-4*B) and not(5*A-4*B<-5)) else -1)

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100*a+1)/8
min_b=10*b;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))

Fixed submission:
A, B =map(int, input().split())
max_A=(A+1)*25/2
max_B=10*(B+1)
p=int(round(max([A*12.5,B*10])+0.4999999999,0))
print(p if(p<min([(A+1)*25/2, 10*(B+1)]) and not(4<5*A-4*B) and not(5*A-4*B<-5)) else -1)

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*B;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))

Fixed submission:
A, B =map(int, input().split())
max_A=(A+1)*25/2
max_B=10*(B+1)
p=int(round(max([A*12.5,B*10])+0.4999999999,0))
print(p if(p<min([(A+1)*25/2, 10*(B+1)]) and not(4<5*A-4*B) and not(5*A-4*B<-5)) else -1)

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*b;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))

Fixed submission:
A, B =map(int, input().split())
max_A=(A+1)*25/2
max_B=10*(B+1)
p=int(round(max([A*12.5,B*10])+0.4999999999,0))
print(p if(p<min([(A+1)*25/2, 10*(B+1)]) and not(4<5*A-4*B) and not(5*A-4*B<-5)) else -1)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
for i in range(Q):
    query=input()
    if(query=="1"):
        S=S[::-1]
    else:
        query, F, C =query.split()
        S=C+S if(F=="1") else S+C
print(S)

Fixed submission:
S=input()
Q=int(input())
fb=True
forward=""
back=""

for i in range(Q):
    query=input()
    if(query=="1"):
        fb=False if(fb) else True
    else:
        query, F, C =query.split()
        if((F=="1")==fb):
            forward=C+forward
        else:
            back=back+C
print((forward+S+back)[::1 if(fb) else -1])
Buggy python submission (verdict: Time Limit Exceeded):
N,R=map(int, input().split())
i=0
while True:
 if(0<N-R**(i+1)<=R**i):
  print(i+2)
  break
 i+=1

Fixed submission:
N,R=map(int, input().split())
i=0
while True:
 if(R**i<=N<R**(i+1)):
  print(i+1)
  break
 i+=1
Buggy python submission (verdict: Runtime Error):
N=int(input())
List=[int(i) for i in input().split()]
P=int(round(sum(List)/N,0))
def length(x):
 return sum([(i-P-x)**2 for i in List])
i=0
data=length(0)
while True:
 if(length(i-1)<length(i)<length(i+1)):
  i-=1
 elif(length(i-1)>length(i)>length(i+1)):
  i+=1
 else:
  print((length(i))
  break

Fixed submission:
N=int(input())
List=[int(i) for i in input().split()]
P=int(round(sum(List)/N,0))
def length(x):
 return sum([(i-P-x)**2 for i in List])

i=0
data=length(0)
while True:
 if(length(i-1)<length(i)<length(i+1)):
  i-=1
 elif(length(i-1)>length(i)>length(i+1)):
  i+=1
 else:
  print(length(i))
  break
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(input())
count=0
if(a%2==1):
  print('No')
else:
  for i in range(a/2):
    if(b[i]==b[i+a/2]):
      count+=1
  if(count==a/2):
    print('Yes')
  else:
    print('No')

Fixed submission:
a=int(input())
b=list(input())
count=0
if(a%2==0):
    a=int(a/2)
    for i in range(a):
        if(b[i]==b[i+a]):
          count+=1
    if(count==a):
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
N = input()
A = np.array([int(x) for x in input().split(" ")])

if len(np.where(A>0)[0])%2 == 0:
  print(np.abs(A).sum())
else:
  print(np.abs(A).sum() - np.abs(A).min()*2)

Fixed submission:
a, b, t = [int(x) for x in input().split(" ")]

mul = (t + 0.5) // a

print(int(b * mul))
Buggy python submission (verdict: Runtime Error):
if(1<=a<=100 || 1<=b<=100)
	a = int(input())
	b = int(input())
	print(a*b)
else
	print("invail")

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

Buggy python submission (verdict: Runtime Error):
if(1<=a<=100 || 1<=b<=100)
	int(a) = input()
	int(b) = input()
	print(a*b)
else
	print("invail")

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

Buggy python submission (verdict: Runtime Error):
a = input()
b= input()
print(a*b)

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

Buggy python submission (verdict: Runtime Error):
a = input()
 = input()
print(a* )

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

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
print(a*b)

Fixed submission:
A,B =map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
inp = input()
if inp.contains('7'):
  print("Yes")
 else:
  print("No")

Fixed submission:
N = input()

print('Yes' if '7' in str(N) else 'No')

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

print('Yes' if '7' in str(N) else 'No'

Fixed submission:
N = input()

print('Yes' if '7' in str(N) else 'No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, N+1):
  if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
	continue
  S+=i
print(S) 

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
		continue
  S+=i
print(S) 

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S+=i
print(S) 

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1,N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S +=i
print(S) 

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = 0
for in in range(1,N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S +=i
print(S) 

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Buggy python submission (verdict: Runtime Error):
N = int(input())
out = 0
for in in range(1,N+1):
  if i%3==0 and i%5==0 or i%3==0 or i%5==0
	continue
  out +=i
print(out) 

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)
Buggy python submission (verdict: Runtime Error):
x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    tmp = a
    a = b
    b = tmp
    return (a,b)
 
x,y = swap(x,y)
x, z = swap(x, z)
print(x,y,z)

Fixed submission:
x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    tmp = a
    a = b
    b = tmp
    return (a,b)
 
x,y = swap(x,y)
x, z = swap(x, z)
print(x,y,z)
Buggy python submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]
 
if (b < a):
    temp = b
    b = a
    a = temp
 
 
x = 1
while True:
    if (int(x*0.08) == a and int(x*0.1) == b):
        print(x)
        break
    else:
        if (x > 1500):
            print(-1)
            break
        else:
            x += 1

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)
Buggy python submission (verdict: Runtime Error):
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)
#
if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")

Fixed submission:
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)
#
if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = input("Enter number of a:")
b = input("Enter number of b:")
c = input("Enter number of c:")
if(int(a+b+c)>=int(22)):
    print("bust")
else:
    print("win")


Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a)>=22 else print("win")
Buggy python submission (verdict: Runtime Error):
N = str(input())

a = []
for n in range(N):
  a.append(int(N[n]))
  
if sum(a) % 9 == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N = str(input())
 
a = []
for n in range(len(N)):
  a.append(int(N[n]))
  
if sum(a) % 9 == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  # 計算桁を減らすために(mod K)で7, 77, 777,,,を計算する
  sevens = sevens * (10 % K) + (7 % K)
  count += 1
  if count > K:
    count = -1
    break
    
print(count)

Fixed submission:
K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  count += 1
  if count > K:
    count = -1
    break
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
 
sevens = 7
count = 1
 
while(sevens % K !=0):
  sevens = sevens * 10 + 7
  count += 1
  if count > K:
    count = -1
    break
    
print(count)

Fixed submission:
K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  count += 1
  if count > K:
    count = -1
    break
    
print(count)

Buggy python submission (verdict: Runtime Error):
K = int(input())

sevens = 7
count = 0

while(sevens % K !=0):
  count += 1
  sevens = sevens * 10 + 7
  if count > K:
    print(-1)
	break
    
print(count)

Fixed submission:
K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  count += 1
  if count > K:
    count = -1
    break
    
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = []*N
AC = 0
WA = 0
TLE = 0
RE = 0

for n in range(N):
  S[n] = input()
  if S[n] == "AC":
    AC += AC
  elif S[n] == "WA":
    WA += WA
  elif S[n] == "TLE":
    TLE += TLE
  elif S[n] == "RE":
    RE += RE
    
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(AC,WA,TLE,RE))

Fixed submission:
N = int(input())
S = [0]*N
AC = 0
WA = 0
TLE = 0
RE = 0

for n in range(N):
  S[n] = str(input())
  if S[n] == "AC":
    AC = AC + 1
  elif S[n] == "WA":
    WA = WA + 1
  elif S[n] == "TLE":
    TLE = TLE + 1
  elif S[n] == "RE":
    RE = RE + 1
    
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(AC,WA,TLE,RE))
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))

def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)

power = []
for p in range(min(X), max(X)):
  power.append(calc_power(p))
  
print(min(power))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
 
def calc_power(p):
  P = list(map(lambda x: (x-p)**2, X))
  return sum(P)
 
power = []
_min = min(X)
_max = max(X)

if _min != _max:
  for p in range(_min, _max):
    power.append(calc_power(p))
  print(min(power))
  
else:
  power = calc_power(_min)
  print(power)
Buggy python submission (verdict: Runtime Error):
N = int(input())
 
ans = ":("
 
for X in range(N-1):
  if int(X * 1.08) = N:
    ans = X
    break
    
print(ans)

Fixed submission:
N = int(input())
 
ans = ":("
 
for X in range(N+1):
  if int(X * 1.08) == N:
    ans = X
    break
    
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
x = N // 1.08
 
if x*1.08 < N or x*1.08 > N+1:
  print(":(")
else:
  for y in range(x-1, x+1):
    if N+!> y*1.08 > N:
      print(y)
      break
    else:
      print(":(")

Fixed submission:
N = int(input())
 
ans = ":("
 
for X in range(N+1):
  if int(X * 1.08) == N:
    ans = X
    break
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [0]*N
count = 0

for n in range(N):
  A[n] = list(map(int, input().split()))
  
  for i in range(M):
    _sum += A[n][i] * B[i]
    
  if _sum + C > 0:
    count += 1
  else:
    continue
    
print(count)

Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [0]*N
count = 0

def a_x_b(ab):
  a, b = ab
  return a*b

for n in range(N):
  A[n] = list(map(int, input().split()))
  AB = [(A[n][i], B[i]) for i in range(M)]
  if sum(list(map(a_x_b, AB)))+C > 0:
    count += 1
  else:
    continue
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())

_sum = 0

for i in range(1, len(S)):
  if S[i] == "W":
    _sum += S.count("B", 0,i)
    
print(_sum)

Fixed submission:
S = str(input())

_sum = 0
ans = 0

for s in S:
  
  if s == "B":
    _sum += 1
    
  elif s == "W":
    ans += _sum
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
color = set()
rainbow = 0

for n in range(N):
  if 1 <= a[n] < 400:
    color.add("gray")
  elif 400 <= a[n] < 800:
    color.add("brown")
  elif 800 <= a[n] < 1200:
    color.add("green")
  elif 1200<= a[n] < 1600:
    color.add("water")
  elif 1600 <= a[n] < 2000:
    color.add("blue")
  elif 2000 <= a[n] < 2400:
    color.add('yellow')
  elif 2400 <= a[n] < 2800:
    color.add('orange')
  elif 2800 <= a[n] < 3200:
    color.add('red')
  else:
    rainbow += 1

if color_min > rainbow:
  color_min = len(color)
else:
  color_min = rainbow
  
color_max = color_min + rainbow

    
print(f'{color_min} {color_max}')


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
color = set()
rainbow = 0

for n in range(N):
  if 1 <= a[n] < 400:
    color.add("gray")
  elif 400 <= a[n] < 800:
    color.add("brown")
  elif 800 <= a[n] < 1200:
    color.add("green")
  elif 1200<= a[n] < 1600:
    color.add("water")
  elif 1600 <= a[n] < 2000:
    color.add("blue")
  elif 2000 <= a[n] < 2400:
    color.add('yellow')
  elif 2400 <= a[n] < 2800:
    color.add('orange')
  elif 2800 <= a[n] < 3200:
    color.add('red')
  else:
    rainbow += 1

if len(color) == 0:
	color_min = 1 
	color_max = rainbow
else:
  color_min = len(color)
  color_max = color_min + rainbow

    
print(f'{color_min} {color_max}')