Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
p = list(map(int,input().split()))
cnt=0
x=[]
for i in range(N):
    if i==0:
        x+=[p[i]]
        cnt+=1
    else:
        mi = min(x)
        if p[i] <= mi:
            cnt+=1
            x += [p[i]]
        else:
            continue
print(cnt)

Fixed submission:
N=int(input())
p = list(map(int,input().split()))
cnt=0
x=[]
for i in range(N):
    if i==0:
        x=p[i]
        cnt+=1
    else:
        if p[i]<x:
            x=p[i]
        if p[i] <= x:
            cnt+=1
            x = p[i]
        else:
            continue
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
p = list(map(int,input().split()))
cnt=0
for i in range(N):
    a=0
    for j in range(0, i):
       if p[i] <= p[j]:
           continue
       else:
           a+=1
    if a>0:
        continue
    else:
        cnt+=1
print(cnt)

Fixed submission:
N=int(input())
p = list(map(int,input().split()))
cnt=0
x=[]
for i in range(N):
    if i==0:
        x=p[i]
        cnt+=1
    else:
        if p[i]<x:
            x=p[i]
        if p[i] <= x:
            cnt+=1
            x = p[i]
        else:
            continue
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A = list(map(int,input().split()))
l = len(A)
ans=0
for idx, val in enumerate(A):
    if idx == l - 1:
        print(ans%(10**9+7))
        exit()
    for x in range(idx+1, l):
        num = A[idx] ^ A[x]
        ans += num

Fixed submission:
import numpy as np
 
MOD = 10 ** 9 + 7
 
N = int(input())
A = np.array(list(map(int, input().split())),np.int64)
 
answer = 0
for n in range(63):
    B = (A >> n) & 1
    x = np.count_nonzero(B)
    y = N - x
    x *= y
    for _ in range(n):
        x *= 2
        x %= MOD
    answer += x
answer %= MOD
print(answer)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a = list(map(int, input().split()))
x=[]
for i in range(1,n+1):
    for t in range(n):
        if a[t]==i:
            num=t+1
            x.append(num)
for q in x:
    print(q,end=" ")

Fixed submission:
n=int(input())
if n%2==0:
    print((n//2)/n)
else:
    x=((n+1)//2)/n
    print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = list(map(int, input().split()))
x=[]
for i in range(1,n+1):
    for t in range(n):
        if a[t]==i:
            num=t+1
            print(num,end=' ')

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
x=[[] for _ in range(n)]
for i in range(n):
    x[a[i]-1] = i + 1
print(' '.join(map(str,x)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = list(map(int, input().split()))
x=[]
for i in range(1,n+1):
    for t in range(n):
        if a[t]==i:
            num=t+1
            x.append(num)
for q in x:
    print(q,end=" ")

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
x=[[] for _ in range(n)]
for i in range(n):
    x[a[i]-1] = i + 1
print(' '.join(map(str,x)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = list(map(int, input().split()))
x=[]
for i in range(1,n+1):
    for t in range(n):
        if a[t]==i:
            num=t+1
            x.append(num)
for q in x:
    print(q,end=" ")

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
x=[[] for _ in range(n)]
for i in range(n):
    x[a[i]-1] = i + 1
print(' '.join(map(str,x)))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
name=[]
for i in range(N):
    si = input()
    if si[0] in ['M', 'A', 'R', 'C', 'H']:
        name.append(si)
if name==[]:
    print(0)
    exit()

ans=0
for i, names in enumerate(list(combinations(name, 3))):
    x,y,z=names[0][0],names[1][0],names[2][0]
    if x==y or y==z or z==x:
        continue
    else:
        ans+=1
print(ans)

Fixed submission:
from itertools import combinations

N = int(input())
name=[]
m,a,r,c,h=0,0,0,0,0
for i in range(N):
    si = input()
    if si[0] in ['M', 'A', 'R', 'C', 'H']:
        name.append(si)
        if si[0]=='M':
            m+=1
        if si[0]=='A':
            a+=1
        if si[0]=='R':
            r+=1
        if si[0]=='C':
            c+=1
        if si[0]=='H':
            h+=1

if name==[]:
    print(0)
    exit()

names=dict({'m':m,'a':a,'r':r,'c':c,'h':h})
ans=0
for n in list(combinations(['m','a','r','c','h'],3)):
    ans += names[n[0]] * names[n[1]] * names[n[2]]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
F = [int("".join(input().split()), 1) for i in range(N)]
P = [list(map(int, (input().split()))) for i in range(N)]

ans = float('-inf')
for bit in range(1,1024):
    sum_p = 0
    for shop in range(N):
        time = bin(F[shop] & bit).count('1')
        sum_p += P[shop][time]

    ans = max(sum_p, ans)
print(ans)


Fixed submission:
N = int(input())
F = [int("".join(input().split()), 2) for i in range(N)]
P = [list(map(int, (input().split()))) for i in range(N)]

ans = float('-inf')
for bit in range(1,1024):
    sum_p = 0
    for shop in range(N):
        time = bin(F[shop] & bit).count('1')
        sum_p += P[shop][time]

    ans = max(sum_p, ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T))], T):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        exit()
print('UNRESTORABLE')
exit()
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True

Fixed submission:
def main():
	s = input()
	t = input()
 
	for i in reversed(range(len(s) - len(t) + 1)):
		if checker(s[i:(i + len(t))], t):
			s = s.replace("?", "a")
			print(s[:i] + t + s[i+len(t):])
			return
	print("UNRESTORABLE")
 
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True
 
if __name__ == '__main__':
	main()

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

for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T)), T]):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        exit()
print('UNRESTORABLE')
exit()
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True

Fixed submission:
def main():
	s = input()
	t = input()
 
	for i in reversed(range(len(s) - len(t) + 1)):
		if checker(s[i:(i + len(t))], t):
			s = s.replace("?", "a")
			print(s[:i] + t + s[i+len(t):])
			return
	print("UNRESTORABLE")
 
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True
 
if __name__ == '__main__':
	main()

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

for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T)), T]):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        return
    print('UNRESTORABLE')

def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True

Fixed submission:
def main():
	s = input()
	t = input()
 
	for i in reversed(range(len(s) - len(t) + 1)):
		if checker(s[i:(i + len(t))], t):
			s = s.replace("?", "a")
			print(s[:i] + t + s[i+len(t):])
			return
	print("UNRESTORABLE")
 
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True
 
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
ans = [100 * A, 0]
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range((F - 100 * A * i) // (100 * B) + 1):
        a = 100 * A * i + 100 * b * j
        if a < F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a - C * k) // D + 1):
                b = C * k + D * l
                conc = 100 * b / (a + b)
                if b <= (A * i + B * j) * E and a + b < F:
                    if conc > c:
                        c = conc
                        ans = [a + b, b]
                else:
                    break
print(' '.join(map(str, ans)))

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
ans = [100 * A, 0]
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range((F - 100 * A * i) // (100 * B) + 1):
        a = 100 * A * i + 100 * B * j
        if a > F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a - C * k) // D + 1):
                b = k * C + l * D
                concentration = 100 * b / (a + b)
                if (A * i + B * j) * E >= b and a + b <= F:
                    if concentration > c:
                        c = concentration
                        ans = [a + b, b]
                else:
                    break

print(' '.join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
content = [0]*(10**9+2)
for i in range(N):
    ai = int(input())
    if content[ai]==1:
        content[ai]=0
    else:
        content[ai]=1
print(sum(content))


Fixed submission:
from collections import Counter
N = int(input())
A = []
for i in range(N):
    ai = int(input())
    A.append(ai)
dic = Counter(A)
cnt=0
for idx, val in dic.items():
    if val%2 != 0:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N = int(input())
content = [0]*(10**9+2)
for i in range(N):
    ai = int(input())
    if content[ai]==1:
        content[ai]=0
    else:
        content[ai]=1
print(sum(content))


Fixed submission:
from collections import Counter
N = int(input())
A = []
for i in range(N):
    ai = int(input())
    A.append(ai)
dic = Counter(A)
cnt=0
for idx, val in dic.items():
    if val%2 != 0:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N = int(input())
content = [0]*(10**6+2)
for i in range(N):
    ai = int(input())
    if content[ai]==1:
        content[ai]=0
    else:
        content[ai]=1
print(sum(content))

Fixed submission:
from collections import Counter
N = int(input())
A = []
for i in range(N):
    ai = int(input())
    A.append(ai)
dic = Counter(A)
cnt=0
for idx, val in dic.items():
    if val%2 != 0:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
root1 = []
root2 = []
for i in range(M):
    ai,bi = map(int,input().split())
    if ai==1:
        tmp = [ai,bi]
        root1.append(tmp)
    else:
        tmp = [ai,bi]
        root2.append(tmp)
for i in range(len(root1)):
    for j in range(len(root2)):
        if root1[i][1]==root2[j][0]:
            if root2[j][1]==N:
                print('POSSIBLE')
                exit()
print('IMPOSSIBLE')

Fixed submission:
N,M = map(int,input().split())
root1 = set()
root2 = set()
for i in range(M):
    ai,bi = map(int,input().split())
    if ai==1:
        root1.add(bi)
    if bi==N:
        root2.add(ai)
if set(root1) & set(root2):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
l = []
for i in range(n):
    if n%2==0:
        if i%2==0:
            l.append(str(a[i]))
        else:
            l.insert(0,str(a[i]))
    if n%2!=0:
        if i%2!=0:
            l.append(str(a[i]))
        else:
            l.insert(0,str(a[i]))
print(' '.join(l))

Fixed submission:
n=int(input())
a=list(input().split())
b1=[]
b2=[]
if n%2==0:
    for i in range(n):
        if i%2!=0:
            b1.append(a[n-i])
        else:
            b2.append(a[i])
else:
    for i in range(n):
        if i%2==0:
            b1.append(a[n-1-i])
        else:
            b2.append(a[i])
 
b1.extend(b2)
 
print(" ".join(b1))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
ans=[0]*10**13
for i in range(N):
    a,b=map(int,input().split())
    ans[a]+=b
for i in range(len(ans)):
    cnt+=ans[i]
    if cnt<K:
        continue
    else:
        print(ans[i])
        exit()

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
 
N, K = map(int, input().split())
 
ans = [0] * (10**5+1)
for i in range(N):
    a, b = map(int, input().split())
    ans[a] += b
 
remain = K
for i in range(10**5+1):
    if ans[i] == 0:
        continue
 
    remain -= ans[i]
    if remain <= 0:
        print(i)
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
ans=[]
for i in range(N):
    a,b=map(int,input().split())
    tmp_ = [a]*b
    ans.extend(tmp_)
ans = sorted(ans)
print(ans[K-1])

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
 
N, K = map(int, input().split())
 
ans = [0] * (10**5+1)
for i in range(N):
    a, b = map(int, input().split())
    ans[a] += b
 
remain = K
for i in range(10**5+1):
    if ans[i] == 0:
        continue
 
    remain -= ans[i]
    if remain <= 0:
        print(i)
        exit()
Buggy python submission (verdict: Runtime Error):
W,a,b = map(int, input().split())
if (a<=b<=a+W):
    print(0)
elif (a=<b+W<=a+W):
    print(0)
elif a<=b:
    print(b-a-W)
else:
    print(a-b-W)


Fixed submission:
W,a,b = map(int, input().split())
if (a<=b<=a+W):
    print(0)
elif (a<=b+W<=a+W):
    print(0)
elif a<=b:
    print(b-a-W)
else:
    print(a-b-W)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans=1
for i in range(1,N+1):
    ans*=i
print(ans%(10**9+7))

Fixed submission:
def factorial(N):
    a = 1
    for n in range(2,N+1):
        a = a*n % (10**9 + 7)
    return a
 
if __name__ == '__main__':
    N = int(input())
    print(factorial(N))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans=1
for i in range(1,N+1):
    ans*=i
print(ans%(10**9+7))

Fixed submission:
def factorial(N):
    a = 1
    for n in range(2,N+1):
        a = a*n % (10**9 + 7)
    return a
 
if __name__ == '__main__':
    N = int(input())
    print(factorial(N))
Buggy python submission (verdict: Runtime Error):
import sys
N, M = map(int,input().split())
A,B=[],[]
for i in range(N):
    array = list(input().split())
    A.append(array)
for j in range(M):
    array = input().split()
    B.append(array)

for i in range(N-M+1):
    for j in range(N-M+1):
        new = [A[k][j:j+M] for k in range(i,i+M)]
        if new == b:
            print('Yes')
            sys.exit()
print('No')

Fixed submission:
import sys
N, M = map(int,input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        new = [A[k][j:j+M] for k in range(i,i+M)]
        if new == B:
            print('Yes')
            sys.exit()
print('No')
Buggy python submission (verdict: Runtime Error):
string = input()
ans=[]
for i in range(len(string)):
    if string[i] == 'A':
        ans.append(string[i])
        start=i
        break
for j in range(start+1,len(string)):
    if string[j]=='Z':
        ans.append(string[j])
        if string[j+1] not in 'Z':
            break
    else:
        ans.append(string[j])
print(len(ans))

Fixed submission:
string = input()
for i in range(len(string)):
    if string[i] == 'A':
        start=i
        break
for j in reversed(range(start+1, len(string))):
    if string[j]=='Z':
        end=j
        break
print(len(string[i:j+1]))
Buggy python submission (verdict: Runtime Error):
def make_prime(n):
    prime = []
    temp = n
    for i in range(2, n):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime


from collections import defaultdict
d=defaultdict(lambda :1)
num = int(input())
w=10**9+7
for i in range(2,num+1):
    prime_num_list = make_prime(i)
    for j in range(len(prime_num_list)):
        key = prime_num_list[j][0]
        d[key] += prime_num_list[j][1]
cnt=1
for val in d.values():
    cnt*=val
print(cnt)

Fixed submission:
sx, sy, tx, ty = map(int,input().split())
x,y=tx-sx,ty-sy
trail='U'*y + 'R'*x
trail+='D'*y + 'L'*x
trail+='L'+'U'*(y+1)+'R'*(x+1)+'D'
trail+='R'+'D'*(y+1)+'L'*(x+1)+'U'
print(trail)

Buggy python submission (verdict: Runtime Error):
def make_prime(n):
    prime = []
    temp = n
    for i in range(2, n):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime


from collections import defaultdict
d=defaultdict(lambda :1)
num = int(input())
w=10**9+7
for i in range(2,num+1):
    prime_num_list = make_prime(i)
    for j in range(len(prime_num_list)):
        key = prime_num_list[j][0]
        d[key] += prime_num_list[j][1]
cnt=1
for val in d.values():
    cnt*=val
print(cnt)

Fixed submission:
sx, sy, tx, ty = map(int,input().split())
x,y=tx-sx,ty-sy
trail='U'*y + 'R'*x
trail+='D'*y + 'L'*x
trail+='L'+'U'*(y+1)+'R'*(x+1)+'D'
trail+='R'+'D'*(y+1)+'L'*(x+1)+'U'
print(trail)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
cnt=0
for i in range(a,b+1):
    if i%x==0:
        cnt+=1
    else:
        continue
print(cnt)

Fixed submission:
a,b,x=map(int,input().split())
if a==0 : print((b//x)+1)
else : print((b//x)-(a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
N, A = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]

XX = sum(X) + 1

dp = [[[0 for i in range(XX * 2)] for i in range(N + 3)] for i in range(N + 3)]

dp[0][0][0] = 1

for i in range(N):
    for j in range(N + 1):
        for n in range(XX):
            dp[i + 1][j][n] += dp[i][j][n]
            dp[i + 1][j + 1][n + X[i]] += dp[i][j][n]

ans = 0
for i in range(1, N + 1):
    if i * A < XX:
        ans += dp[N][i][i * A]

print(ans)

Fixed submission:
N, A = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]

XX = sum(X) + 1

dp = [[[0 for i in range(XX * 2)] for i in range(N + 3)] for i in range(N + 3)]

dp[0][0][0] = 1

for i in range(N):
    for j in range(N + 1):
        for n in range(XX):
            dp[i + 1][j][n] += dp[i][j][n]
            dp[i + 1][j + 1][n + X[i]] += dp[i][j][n]

ans = 0
for i in range(1, N + 1):
    if i * A < XX:
        ans += dp[N][i][i * A]

print(ans)
Buggy python submission (verdict: Runtime Error):
K = input()
line = input().split(" ")
a = False
for i in range(int(line[0]), int(line[1])):
  if i%K==0:
    print("OK")
    a = True
  	break
if a == False:
  print("NG")    

Fixed submission:

K = input()
line = input().split(" ")
a = False
for i in range(int(line[0]), int(line[1]) + 1):
    if i%int(K)==0:
        print("OK")
        a = True
        break
if a == False:
    print("NG")
Buggy python submission (verdict: Runtime Error):
num = input()
a = 100
count = 0
while count>=0:
  a = a * 1.1
  count = count + 1
  if a>=num:
    break
print(count)

Fixed submission:
num = input()
a = 100
count = 0
while count>=0:
    a = int(a * 1.01)
    count = count + 1
    if a>=int(num):
        break
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
for x in reversed(range(N+1)):
    if int(x/B) != 0:
        continue
    else:
        max = int(A * x / B) - A * int(x / B)
        break
print(max)

Fixed submission:
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
if B<N:
    K = B
    for i in range(-1, 2):
       if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
           max = int(A * (K + i) / B) - A * int((K + i) / B)
else:
    K = N
    for i in range(-1, 1):
        if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
            max = int(A * (K + i) / B) - A * int((K + i) / B)
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
for x in reversed(range(N+1)):
    S = int(A * x / B) - A * int(x / B)
    
    if max<S:
        max = S
    if int(x/B) == 0:
        break
print(max)

Fixed submission:
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
if B<N:
    K = B
    for i in range(-1, 2):
       if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
           max = int(A * (K + i) / B) - A * int((K + i) / B)
else:
    K = N
    for i in range(-1, 1):
        if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
            max = int(A * (K + i) / B) - A * int((K + i) / B)
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
for x in range(int(N)+1):
    S = int(A * x / B) - A * int(x / B)
    
    if max<S:
        max = S
print(max)


Fixed submission:
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
if B<N:
    K = B
    for i in range(-1, 2):
       if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
           max = int(A * (K + i) / B) - A * int((K + i) / B)
else:
    K = N
    for i in range(-1, 1):
        if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
            max = int(A * (K + i) / B) - A * int((K + i) / B)
print(max)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input())
A=list(map(int,input().split()))

hako = [0 for i in range(N)]

for i in A:
    hako[i-1] += 1

for i in range(N):
    sum = 0
    tmp = A[i] - 1
    hako[tmp] -= 1

    for j in hako:
        if j > 1:
            sum += int(j * (j-1) / 2)
    
    print(sum)

    hako[tmp] += 1

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))

hako = [0 for i in range(N)]
sum = 0

c = collections.Counter(A)

for v in c.values():
    sum += int(v * (v-1) / 2)


for k in range(N):
    print(sum-(c[A[k]] - 1))

Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input())
A=list(map(int,input().split()))

hako = [0 for i in range(N)]

for i in A:
    hako[i-1] += 1

for i in range(N):
    sum = 0
    tmp = A[i] - 1
    hako[tmp] -= 1

    for j in hako:
        if j > 1:
            sum += math.factorial(j) // (math.factorial(j - 2) * math.factorial(2))
    
    print(sum)

    hako[tmp] += 1

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))

hako = [0 for i in range(N)]
sum = 0

c = collections.Counter(A)

for v in c.values():
    sum += int(v * (v-1) / 2)


for k in range(N):
    print(sum-(c[A[k]] - 1))
Buggy python submission (verdict: Runtime Error):
K=int(input())

lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(lis[K+1])

Fixed submission:
K=int(input())

lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(lis[K-1])