Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
s1 = list(map(int,input().split()))
#print(type(s1))
val1 = 0
for i in range(n):
	val1 = val1 + s1[i] * math.factorial(10-i-1) // math.factorial(10-n)
#	print(math.factorial(10-i-1) // math.factorial(10-n))
print(val1)

Fixed submission:
import math

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

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

ord1 = 0
flag = [0] * (n+1)
for i in range(n-1):
	ln = 0
#	print(type(p[i]), p[i])
	for c in range(1,p[i]):
		if flag[c] == 0:
			ln = ln + 1 
	flag[p[i]] = 1
	ord1 = ord1 + ln * math.factorial(n-1-i)
#	print(ln,  math.factorial(ln))
ord1 = ord1+1 
#print(ord1)
  
ord2 = 0
flag = [0] * (n+1)
for i in range(n-1):
	ln = 0
#	print(type(q[i]), q[i])
	for c in range(1,q[i]):
		if flag[c] == 0:
			ln = ln + 1 
	flag[q[i]] = 1
	ord2 = ord2 + ln * math.factorial(n-1-i)
#	print(ln,  math.factorial(ln))
ord2 = ord2+1 
#print(ord2)

print(abs(ord2 - ord1))

Buggy python submission (verdict: Runtime Error):
n = input()
s1 = map(int,input().split())
print(type(sl))

Fixed submission:
import math

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

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

ord1 = 0
flag = [0] * (n+1)
for i in range(n-1):
	ln = 0
#	print(type(p[i]), p[i])
	for c in range(1,p[i]):
		if flag[c] == 0:
			ln = ln + 1 
	flag[p[i]] = 1
	ord1 = ord1 + ln * math.factorial(n-1-i)
#	print(ln,  math.factorial(ln))
ord1 = ord1+1 
#print(ord1)
  
ord2 = 0
flag = [0] * (n+1)
for i in range(n-1):
	ln = 0
#	print(type(q[i]), q[i])
	for c in range(1,q[i]):
		if flag[c] == 0:
			ln = ln + 1 
	flag[q[i]] = 1
	ord2 = ord2 + ln * math.factorial(n-1-i)
#	print(ln,  math.factorial(ln))
ord2 = ord2+1 
#print(ord2)

print(abs(ord2 - ord1))
Buggy python submission (verdict: Runtime Error):
n = int(input())

flag = 0

while flag==0:
#check if n is prime or not
	tst = 2
	while n % tst != 0:
    	tst = tst + 1
    if tst==n: 
		flag=1
	else:
		n=n+1
print(n)
    	

Fixed submission:
n = int(input())
 
flag = 0
 
while flag==0:
#check if n is prime or not
	tst = 2
	while n % tst != 0:
		tst = tst + 1
	if tst==n: 
		flag=1
	else:
		n=n+1
print(n)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())

ans = a * b
for i in range(a)
if ans % i**2:
	ans = ans // i
print(ans)

Fixed submission:
a,b = map(int, input().split())
 
com = 1
for i in reversed(range(2,a+1)):
	if a % i ==0 and b % i == 0:
		a = a//i
		b = b//i
		com = com*i
#		print(i)
print(a*b*com)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

for i in range(len(s)):
	print(chr(ord( (s[i]+n)% 26)  )   , end="")


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

for i in range(len(s)): 
	if ord(s[i]) +n >= 65 + 26 :
		print(chr(ord(s[i])+n-26),end="")
	else:
		print(chr(ord(s[i])+n),end="")
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))

#print(n)
#print(b)

score = b[0]+b[n-2]
#print(b[0],b[n-2])

for i in range(0,n-1):
	score = score + min(b[i],b[i+1])
#	print(min(b[i],b[i+1]))
print(score)

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

#print(n)
#print(b)

score = b[0]+b[n-2]
#print(b[0],b[n-2])

for i in range(0,n-2):
	score = score + min(b[i],b[i+1])
#	print(min(b[i],b[i+1]))
print(score)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

n = 1
c = 0

while n < B:
	n = n + A -1
	c = c+1
    
print(c)

Fixed submission:
S=input()
T=input()

score=0

if S[0] == T[0]:
  	score=score+1
if S[1] == T[1]:
  	score=score+1
if S[2] == T[2]:
	score=score+1
 
print(score)

Buggy python submission (verdict: Runtime Error):
S = input()
T = intpu()

score = 0
if S[0]==T[0]:
	score = score +1
  
if S[1]==T[1]:
    score=score+1
    
if S[2]==T[2]:
	score=score*1

print(score)
    

Fixed submission:
S=input()
T=input()

score=0

if S[0] == T[0]:
  	score=score+1
if S[1] == T[1]:
  	score=score+1
if S[2] == T[2]:
	score=score+1
 
print(score)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

n = 1
c = 0

while n < B:
	n = n + A -1
    print(n)
	c = c+1

print(c)

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

n = 1
c = 0

while n < B:
	n = n + A -1
#	print(n)
	c = c+1

print(c)

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

n = 1
c = 0

if B==1 :
  print("0")
else :
	while n < B:
		n = n + A -1
		c = c+1
    print(c)

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

n = 1
c = 0

while n < B:
	n = n + A -1
#	print(n)
	c = c+1

print(c)

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

n = 1
c = 0

while n < B:
	n = n + A -1
	c = c+1
 
if B != 1:
	print(c)
else
	print("0")
  

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

n = 1
c = 0

while n < B:
	n = n + A -1
#	print(n)
	c = c+1

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
slist = [""]*n
for i in range(n):
	slist[i] =sorted(input())
sslist=sorted(slist)
count=0
for i in range(n-1):
	for j in range(i+1,n):
		if sslist[i][0]==sslist[j][0]:
			if sslist[i]==sslist[j]:
				count = count +1
#	print(sslist[i])
print(count)

Fixed submission:
n = int(input())
slist = [""]*n
for i in range(n):
	slist[i] =sorted(input())
sslist=sorted(slist)
count=0
i = 0
while i < n-1:
	j=1
	if sslist[i]==sslist[i+1]:
		j=2
		while i+j<=n-1 and sslist[i]==sslist[i+j]:
			j=j+1
		count=count + j*(j-1)//2
#		print(j)
	i=i+j
#	print(sslist[i])
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
slist = [""]*n
for i in range(n):
	slist[i] =sorted(input())
sslist=sorted(slist)
count=0
for i in range(n-1):
	for j in range(i+1,n):
		if sslist[i]==sslist[j]:
			count = count +1
#	print(sslist[i])
print(count)

Fixed submission:
n = int(input())
slist = [""]*n
for i in range(n):
	slist[i] =sorted(input())
sslist=sorted(slist)
count=0
i = 0
while i < n-1:
	j=1
	if sslist[i]==sslist[i+1]:
		j=2
		while i+j<=n-1 and sslist[i]==sslist[i+j]:
			j=j+1
		count=count + j*(j-1)//2
#		print(j)
	i=i+j
#	print(sslist[i])
print(count)
Buggy python submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))
B = list(map(int, input().split()))

score = 0
for i in range(n):
	if B[i] >= A[i] + A[i+1]:
		score = score + A[i] + A[i+1]
        A[i+1] = 0
	elif B[i] <= A[i]:
		score = score + B[i]
	else:
		score = score + B[i]
		A[i+1] = A[i+1] + A[i] - B[i]
print(score)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
score = 0
for i in range(n):
	if B[i] >= A[i] + A[i+1]:
		score = score + A[i] + A[i+1]
		A[i+1] = 0
	elif B[i] <= A[i]:
		score = score + B[i]
	else:
		score = score + B[i]
		A[i+1] = A[i+1] + A[i] - B[i]
print(score)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
%print(l,r)

best = 2019
for i in range(l, r):
	for j in range(l+1,r+1):
		if i*j % 2019 < best:
			best = i*j % 2019

print(best)

Fixed submission:
l, r = map(int, input().split())
#print(l,r)

best = 2019
for i in range(l, min(r,l+2019)):
	for j in range(l+1,min(r+1,l+2019+1)):
		if i*j % 2019 < best:
			best = i*j % 2019

print(best)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())

S = input()

SL = list(S)
SL[K] = SL[K].lower()
ans = "".join(SL)

print(ans)

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

S = input()

SL = list(S)
SL[K-1] = SL[K-1].lower()
ans = "".join(SL)

print(ans)

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

S = input()

SL = list(S)
SL[K] = SL[K].lower()
ans = "".join(SL)

print(ans)



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

S = input()

SL = list(S)
SL[K-1] = SL[K-1].lower()
ans = "".join(SL)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
max = 0
sum = 0

#print ("START")
for i in range(n):
	data = (input()
#	print("aaa")
	data = int(data)
#	print(data)
	if max < data:
		max = data
	sum = sum + data
print(sum - max//2)

Fixed submission:
n = int(input())
max = 0
sum = 0

#print ("START")
for i in range(n):
	data = input()
#	print("aaa")
	data = int(data)
#	print(data)
	if max < data:
		max = data
	sum = sum + data
print(sum - max//2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
 
max = 0
sum = 0
for i in range(n):
	data = int(input())
 	if max < data:
    	max = data
    sum = sum + data
   
print(sum - max//2)

Fixed submission:
n = int(input())
max = 0
sum = 0

#print ("START")
for i in range(n):
	data = input()
#	print("aaa")
	data = int(data)
#	print(data)
	if max < data:
		max = data
	sum = sum + data
print(sum - max//2)

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

max = 0
sum = 0
for i in range(n)
	data = int(input())
 	if max < data:
    	max = data
    sum = sum + data
   
print(sum - max//2)
  

Fixed submission:
n = int(input())
max = 0
sum = 0

#print ("START")
for i in range(n):
	data = input()
#	print("aaa")
	data = int(data)
#	print(data)
	if max < data:
		max = data
	sum = sum + data
print(sum - max//2)
Buggy python submission (verdict: Runtime Error):
d, n = map(int, input().split())
 
if d==0:
	print(n)
elif d==1:
	if n<100:
		print(n*100)
    else:
        print(10100)
elif d==2:
  	if n<100:
		print(n*10000)
    else:
        print(n*10000+10000)

Fixed submission:
d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)

Buggy python submission (verdict: Runtime Error):
d, n = map(i, input().split())
 
if d==0:
	print(n)
elif d==1:
	print(n*100)
elif d==2:
	print(n*10000)

Fixed submission:
d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)

Buggy python submission (verdict: Runtime Error):
d, n = map(i, input().split())
 
if d==0:
	print(n)
if d==1:
	print(n*100)
if d==2:
	print(n*10000)

Fixed submission:
d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)

Buggy python submission (verdict: Runtime Error):
d, n = map(i, input().split())
 
if d==0:
  print(n)
if d==1:
  print(n*100)
if d==2:
  print(n*10000)
  

Fixed submission:
d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)

Buggy python submission (verdict: Runtime Error):
d, n = map(i, input().split())

if d==0:
  print(d)
if d==1:
  print(d*100)
if d==2:
  print(d*10000)
  

Fixed submission:
d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)
Buggy python submission (verdict: Runtime Error):
n = input()
low = list(map(int, input().split()))
for i in range(n)
	count = 0
	tmp = low[i]
	while tmp % 2 == 0:
		tmp = tmp % 2 
		count = count + 1
        
print(count)

Fixed submission:
n=int(input())
#print(n)
low = list(map(int,input().split()))
#print("INPUT = ")
#print(low)
count = 0
for i in range(n):
	tmp = int(low[i])
	while tmp % 2 == 0 and tmp !=0:
		tmp = tmp// 2
		count = count + 1
#		print("COUNT=", count, "TMP=",tmp)
#print("ANS = ")
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = ""

while N > 0:
	N -= 1
	ans += chr(ord('a') + N % 26)
	N //= 26

print(ans[::-1])

Fixed submission:
c = input()

if c.isupper():
	print("A")
else:
	print("a")

Buggy python submission (verdict: Runtime Error):
num = int(input())
res = ""

while num != 0:
	num -= 1
	rem = num % 26
	res += chr(ord('a') + rem)
	num //= 26

print(res)

Fixed submission:
c = input()

if c.isupper():
	print("A")
else:
	print("a")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
fruits = map(int, input().split())

return sorted(fruit)[:K]

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

print(sum(sorted(fruits)[:K]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = ""

while num > 0:
	N -= 1
	ans += chr(ord('a') + N % 26)
	N //= 26

print(ans)

Fixed submission:
N = int(input())
ans = ""

while N > 0:
	N -= 1
	ans += chr(ord('a') + N % 26)
	N //= 26

print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
res = ""

while num != 0:
	num -= 1
	rem = num % 26
	res += chr(ord('a') + int(rem))
	num /= 26

print(res)

Fixed submission:
N = int(input())
ans = ""

while N > 0:
	N -= 1
	ans += chr(ord('a') + N % 26)
	N //= 26

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int main() {
	int a;
	cin>>a;
	string res;

	while (a != 0) {
		int rem=a%26;
		a/=26;
		char asciiChar=rem+97-1;
		res+=asciiChar;
	}

	reverse(res.begin(),res.end());
	cout<<res;
}

Fixed submission:
N = int(input())
ans = ""

while N > 0:
	N -= 1
	ans += chr(ord('a') + N % 26)
	N //= 26

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

// ios::sync_with_stdio(0);
// cin.tie(0);

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

int main() {
	int a;
	cin>>a;
	string res;

	while (a != 0) {
		int rem=a%26;
		a/=26;
		char asciiChar=rem+97-1;
		res+=asciiChar;
	}

	reverse(res.begin(),res.end());
	cout<<res;
}

Fixed submission:
N = int(input())
ans = ""

while N > 0:
	N -= 1
	ans += chr(ord('a') + N % 26)
	N //= 26

print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
N, M = input().split(" ")

idxw = {}
idxa = {}

for i in range(int(M)):
  p, s = input().split(" ")
  if not ('{}{}'.format(p,s) in idxa):
    if s == 'AC':
      idxa['{}{}'.format(p, s)] = True
  if not ('{}{}'.format(p,s) in idxw):
    if not ('{}{}'.format(p,'AC') in idxa):
      if s == 'WA':
        idxw['{}{}'.format(p, s)] = True
#print(idxw)
#print(idxa)

print('{} {}'.format(len(idxa), len(idxw)))
  

Fixed submission:
C = input()

a = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,v,x,y,z'

arr = a.split(",")

idx = 0
count = 0

for i in arr:
  if i == C:
    idx = count
  count += 1
  
print(arr[idx+1])
Buggy python submission (verdict: Runtime Error):
import sys

n = input()
lengths = list(map(int,input().split(" ")))

lengths = sorted(lengths)
max = length.pop(-1)
if max < sum(length) :
    print("Yes")
else :
    print("No")

Fixed submission:
import sys

n = input()
lengths = list(map(int,input().split(" ")))

lengths = sorted(lengths)
max = lengths.pop(-1)
if max < sum(lengths) :
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
MOD = 10**9 + 7
kai = []
kai.append(1)
for idx in range(1, MOD+5):
	kai.append((kai[idx-1] * idx) % MOD)

#Mod pow
def modpow(ori, po, mod):
	res = 1;
	while(po > 0):
		if(po&1):
			res *= ori;
			res %= mod;
		ori *= ori;
		ori %= mod;
		po >>= 1;
	return res;

def comb(n, k):
	return (kai[n] * modpow(kai[k], MOD-2, MOD) * modpow(kai[n-k], MOD-2, MOD))%MOD


for i in range(K):
	blue=comb(K-1, i)%MOD
	red=comb(N-K+1, i+1)%MOD
	print((blue*red)%MOD)

Fixed submission:
N, K = map(int, input().split())
MOD = 10**9 + 7
kai = []
kai.append(1)
for idx in range(1, N+5):
	kai.append((kai[idx-1] * idx) % MOD)

#Mod pow
#def modpow(ori, po, mod):
#	res = 1;
#	while(po > 0):
#		if(po&1):
#			res *= ori;
#			res %= mod;
#		ori *= ori;
#		ori %= mod;
#		po >>= 1;
#	return res;



comb = [[0] * 2005 for i in range(2005)]

def combination():
	for i in range(2000):
		comb[i][0] = 1;
		for j in range(1, i+1):
			comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
			comb[i][j] %= MOD





#def comb(n, k):
#	return (kai[n] * modpow(kai[k], MOD-2, MOD) * modpow(kai[n-k], MOD-2, MOD))%MOD

combination()

for i in range(K):
	blue=comb[K-1][i]%MOD
	red=comb[N-K+1][i+1]%MOD
	print((blue*red)%MOD)
Buggy python submission (verdict: Runtime Error):
W,H,x,y = map(int, input().split())
if(x == 0 or x == W or y == 0 or Y == H):
	print(0, 0)
	exit(0)

if (W*y < H*x):
	if(W == y * 2):
		print(W*y, 1)
	else:
		print(W*y, 0)
elif (W*y > H*x):
	if(H == x * 2):
		print(H*x, 1)
	else:
		print(H*x, 0)
else:
	print(W*y, 1)

Fixed submission:
W,H,x,y = map(int, input().split())
if(2*x == W and 2*y == H):
	print(W*H/2, 1)
else:
	print(W*H/2, 0)
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
grid = [input() for _ in range(H)]

left   = [[0] * 2005 for i in range(2005)]
right  = [[0] * 2005 for i in range(2005)]
top    = [[0] * 2005 for i in range(2005)]
bottom = [[0] * 2005 for i in range(2005)]

for h in range(H):
	cur = 0
	for w in range(W):
		if grid[h][w] == '#':
			left[h][w] = -1
			cur = 0
		else:
			left[h][w] = cur
			cur += 1
	cur = 0
	for w in range(W-1, -1, -1):
		if grid[h][w] == '#':
			right[h][w] = -1
			cur = 0
		else:
			right[h][w] = cur
			cur += 1

for w in range(W):
	cur = 0
	for h in range(H):
		if grid[h][w] == '#':
			top[h][w] = -1
			cur = 0
		else:
			top[h][w] = cur
			cur += 1

	cur = 0
	for h in range(H-1, -1, -1):
		if grid[h][w] == '#':
			bottom[h][w] = -1
			cur = 0
		else:
			bottom[h][w] = cur
			cur += 1

ans = 0
for h in range(H):
	for w in range(W):
		if grid[h][w] == '.':
			ans = max(ans, left[h][w] + right[h][w] + top[h][w] + bottom[h][w] + 1)
print(ans)

Fixed submission:
H, W = map(int, input().split())
grid = [input() for _ in range(H)]

left   = [[0] * 2005 for i in range(2005)]
right  = [[0] * 2005 for i in range(2005)]
top    = [[0] * 2005 for i in range(2005)]
bottom = [[0] * 2005 for i in range(2005)]

for h in range(H):
	cur = 0
	for w in range(W):
		if grid[h][w] == '#':
			left[h][w] = -1
			cur = 0
		else:
			left[h][w] = cur
			cur += 1
	cur = 0
	for w in range(W-1, -1, -1):
		if grid[h][w] == '#':
			right[h][w] = -1
			cur = 0
		else:
			right[h][w] = cur
			cur += 1

for w in range(W):
	cur = 0
	for h in range(H):
		if grid[h][w] == '#':
			top[h][w] = -1
			cur = 0
		else:
			top[h][w] = cur
			cur += 1

	cur = 0
	for h in range(H-1, -1, -1):
		if grid[h][w] == '#':
			bottom[h][w] = -1
			cur = 0
		else:
			bottom[h][w] = cur
			cur += 1

ans = 0
for h in range(H):
	for w in range(W):
		if grid[h][w] == '.':
			ans = max(ans, left[h][w] + right[h][w] + top[h][w] + bottom[h][w] + 1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def formula(x):
    return math.floor(A*x/B)-(A*math.floor(x/B))
A,B,n=[int(x) for x in input().split()]
maxi=formula(1)
for i in range(2,n+1):
    maxi=max(formula(i),maxi)
print(maxi)

Fixed submission:
import math
def formula(x):
    return math.floor(A*x/B)-(A*math.floor(x/B))
A,B,n=[int(x) for x in input().split()]
if(n<=B-1):
    x=n
else:
    x=B-1
maxi = formula(x)
print(maxi)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[x for x in input().split()]
for i in range(1,n+1):
    print(x.count(str(i)))

Fixed submission:
n=int(input())
x=input().split()
l=[0 for i in range(n)]
for i in range(n-1):
    l[int(x[i])-1]=l[int(x[i])-1]+1
for i in range(n):
    print(l[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[int(x) for x in input().split()]
for i in range(1,n+1):
    print(x.count(i))

Fixed submission:
n=int(input())
x=input().split()
l=[0 for i in range(n)]
for i in range(n-1):
    l[int(x[i])-1]=l[int(x[i])-1]+1
for i in range(n):
    print(l[i])
Buggy python submission (verdict: Runtime Error):
x=[x for x in input()]
if(x[3]==x[4] and x[5]==x[6]):
    print('Yes')
else:
    print('No')

Fixed submission:
x=input()
if(x[2]==x[3] and x[4]==x[5]):print('Yes')
else:print('No')

Buggy python submission (verdict: Runtime Error):
x=input()
if(x[3]==x[4] and x[5]==x[6]):
    print('Yes')
else:
    print('No')

Fixed submission:
x=input()
if(x[2]==x[3] and x[4]==x[5]):print('Yes')
else:print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = list(map(int,input().split()))
for i in range(int(input())):
    b,c = map(int,input().split())
    for i in range(len(arr)):
        if arr[i] == b:
            arr[i] = c
    print(sum(arr))

Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
count = Counter(A)
S = sum(A)

for _ in range(int(input())):
    b, c = map(int, input().split())
    k = count[b]
    count[b] = 0
    count[c] += k
    S += (c - b) * k
    print(S)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7
K = int(input())
M = len(input())
N = M + K

pow25 = [1] * (N + 1)
fac = [1] * (N + 1)
inv = [1] * (N + 1)
for x in range(1, N + 1):
    fac[x] = fac[x - 1] * x % MOD
    pow25[x] = pow25[x - 1] * 25 % MOD
inv[N] = pow(fac[N], MOD-2, MOD)
for x in range(N - 1, -1, -1):
    inv[x] = inv[x + 1] * (x + 1) % MOD

def binom(n, k):
    return fac[n] * inv[n - k] % MOD * inv[k] % MOD

ans = 0
for k in range(M, N + 1):
    ans += binom(N, k) * pow25[N - k] % MOD
    ans %= MOD
print(ans)

Fixed submission:
K = int(input())
S = input()
N = len(S)
mod = int(1e9+7)


wk = pow(26,K,mod)
inv26 = pow(26,-1,mod)

ans = wk
for i in range(1,K+1):
  wk = (wk * 25 * inv26) % mod
  wk = (wk * (N-1+i) * pow(i,-1,mod) % mod)
  ans = (ans + wk)%mod
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7
K = int(input())
M = len(input())
N = M + K

pow25 = [1] * (N + 1)
fac = [1] * (N + 1)
inv = [1] * (N + 1)
for x in range(1, N + 1):
    fac[x] = fac[x - 1] * x % MOD
    pow25[x] = pow25[x - 1] * 25 % MOD
inv[N] = pow(fac[N], MOD-2, MOD)
for x in range(N - 1, -1, -1):
    inv[x] = inv[x + 1] * (x + 1) % MOD

def binom(n, k):
    return fac[n] * inv[n - k] % MOD * inv[k] % MOD

ans = 0
for k in range(M, N + 1):
    ans += binom(N, k) * pow25[N - k] % MOD
    ans %= MOD
print(ans)

Fixed submission:
K = int(input())
S = input()
N = len(S)
mod = int(1e9+7)


wk = pow(26,K,mod)
inv26 = pow(26,-1,mod)

ans = wk
for i in range(1,K+1):
  wk = (wk * 25 * inv26) % mod
  wk = (wk * (N-1+i) * pow(i,-1,mod) % mod)
  ans = (ans + wk)%mod
    
print(ans)
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())

print('Yes' if X/500<=k else'NO')

Fixed submission:
K, X = map(int, input().split())
 
print('Yes' if X/500<=K else'No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
print(S.count())

Fixed submission:
N = int(input())
S = input()
print(S.count('ABC'))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
def fun(A, B, n=1):
  if n%B == 0: return n
  return fun(A, B, n+1)
print(fun(A, B))

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())
print((A*B)//gcd(A, B))

Buggy python submission (verdict: Runtime Error):
def fun(A, B, n=1):
  if n%B == 0: return n
  return fun(A, B, n+1)
print(fun(*map(int, input().split())))

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())
print((A*B)//gcd(A, B))

Buggy python submission (verdict: Runtime Error):
import numpy as np
A, B = map(int, input().split())
print(np.lcm(A, B))

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())
print((A*B)//gcd(A, B))

Buggy python submission (verdict: Runtime Error):
import numpy as np
A, B = map(int, input().split())
print(np.gcd(A, B))

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())
print((A*B)//gcd(A, B))
Buggy python submission (verdict: Runtime Error):
print('Yes' if any([n/i in range(1, 10) and (n/i).is_integer() for i in range(1, 10)]) else 'No')

Fixed submission:
n = float(input())
print('Yes' if any([n/i in range(1, 10) and (n/i).is_integer() for i in range(1, 10)]) else 'No')