Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
if int(input()) < 1200:
    print("ABC")
elif int(input()) < 2800:
    print("ARC")
else:
    print("AGC")

Fixed submission:
R = int(input())

if R < 1200:
    print("ABC")
elif R < 2800:
    print("ARC")
elif R <= 4208:
    print("AGC")
else:
    print("")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

cnt=0
for a in A:
    f=factorization(a)[0]
    if f[0]==2:
        cnt+=f[1]

print(cnt)

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

def factorization(n):
    arr = []
    temp = n
    i=2
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

cnt=0
for a in A:
    f=factorization(a)[0]
    if f[0]==2:
        cnt+=f[1]

print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b=input().split();print(max(a+b,a-b,a*b))

Fixed submission:
a,b=map(int,input().split());print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

arr=[]
for i in range(N):
    cnt=0
    cnt+=S[0:i].count('W')
    cnt+=S[i+1:N].count('E')
    arr.append(cnt)
print(min(arr))

Fixed submission:
N=int(input())
S=input()
cnt_W=0
cnt_E=0
arr_W=[]
arr_E=[]
for s in S:
    if s=='W':
        cnt_W+=1
    arr_W.append(cnt_W)

for s in S[::-1]:
    if s=='E':
        cnt_E+=1
    arr_E.append(cnt_E)

import numpy as np

print((np.array(arr_W)+np.array(arr_E[::-1])).min()-1)
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[w][h]=='#':
            cnt=0
            if w!=0:
                cnt+=S[w-1][h]=='#'
            if w!=W-1:
                cnt+=S[w+1][h]=='#'
            if h!=0:
                cnt+=S[w][h-1]=='#'
            if h!=H-1:
                cnt+=S[w][h+1]=='#'
            arr.append(cnt>0)
print('Yes' if all(arr) else 'No')

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

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[h][w]=='#':
            cnt=0
            if w!=0:
                cnt+=S[h][w-1]=='#'
            if w!=W-1:
                cnt+=S[h][w+1]=='#'
            if h!=0:
                cnt+=S[h-1][w]=='#'
            if h!=H-1:
                cnt+=S[h+1][w]=='#'
            arr.append(cnt>0)
print('Yes' if all(arr) else 'No')

Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[w][h]=='#':
            cnt=0
            if w!=0:
                cnt+=S[w-1][h]=='#'
            if w!=W-1:
                cnt+=S[w+1][h]=='#'
            if h!=0:
                cnt+=S[w][h-1]=='#'
            if h!=H-1:
                cnt+=S[w][h+1]=='#'
            arr.append(cnt>0)
print(all(arr))

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

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[h][w]=='#':
            cnt=0
            if w!=0:
                cnt+=S[h][w-1]=='#'
            if w!=W-1:
                cnt+=S[h][w+1]=='#'
            if h!=0:
                cnt+=S[h-1][w]=='#'
            if h!=H-1:
                cnt+=S[h+1][w]=='#'
            arr.append(cnt>0)
print('Yes' if all(arr) else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
X=list(map(int,input().split()))
X_s=sorted(X)
for i,x in enumerate(X):
    t=X_s.index(x)
    X_s.pop(t)
    print(X_s[(N-1)//2])
    X_s.insert(t,x)

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
X_s=sorted(X)
ans1=X_s[N//2]
ans2=X_s[N//2-1]
for i in X:
    print(ans1*(i<=ans2) or ans2)

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

for i in range(N):
    t=X[i]
    X.pop(i)
    print(sorted(X)[(N-1)//2])
    X.insert(i,t)

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
X_s=sorted(X)
ans1=X_s[N//2]
ans2=X_s[N//2-1]
for i in X:
    print(ans1*(i<=ans2) or ans2)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
X=list(map(int,input().split()))
for i in range(N):
    print(sorted(X[0:i]+X[i+1:N])[(N-1)//2])

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
X_s=sorted(X)
ans1=X_s[N//2]
ans2=X_s[N//2-1]
for i in X:
    print(ans1*(i<=ans2) or ans2)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K=map(int,input().split())
for i in range(A,B+1):
    if i<A+K or i>B-K:
        print(i)

Fixed submission:
A,B,K=map(int,input().split())
r=range(A,B+1)
l=list(r[:K]);l.extend(list(r[-K:]))
for i in sorted(set(l)):
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K=map(int,input().split())
for i in range(A,B+1):
    if i<A+K or i>B-K:
        print(i)

Fixed submission:
A,B,K=map(int,input().split())
r=range(A,B+1)
l=list(r[:K]);l.extend(list(r[-K:]))
for i in sorted(set(l)):
    print(i)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())
print(['No','Yes'][a+b>=c])

Fixed submission:
a,b,c=map(int,input().split())
print(['No','Yes'][a+b>=c])
Buggy python submission (verdict: Runtime Error):
print(['Yes','No'][len(set(input())<3])

Fixed submission:
x=input()
print(['No','Yes'][len(set(x[1:]))==1 or len(set(x[:3]))==1])
Buggy python submission (verdict: Runtime Error):
x=input().split()
y=set(x)
print(y[x.count(y[0])-1])

Fixed submission:
x=input().split()
y=list(set(x))
print(y[x.count(y[0])-1])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in set(a):
    ans=max(ans,a.count(i-1)+a.count(i)+a.count(i+1))
print(ans)

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

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
    ans=max(ans,a.count(i-1)+a.count(i)+a.count(i+1))
print(ans)

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

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
    ans=max(ans,sa.count(i-1)+sa.count(i)+sa.count(i+1))
print(ans)

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

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))

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

sa=sorted(a)

ans=0
I=list(set(sa))
for i in I:
    ans=max(ans,sa.count(i-1)+sa.count(i)+sa.count(i+1))
print(ans)

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

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))

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

sa=sorted(a)

ans=0
I=list(set(sa))
for i in I:
    ans=max(ans,sa.count(i-1)+sa.count(i)+sa.count(i+1))
print(ans)

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

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))
Buggy python submission (verdict: Runtime Error):
N=int(input());A=input();v=[int(i)%4for i in A[::2]];print('Yes'if v.count(0)+v.count(2)//2>=N//2 else'No')

Fixed submission:
N=int(input());A=input().split();v=[int(i)%4 for i in A];print('Yes' if v.count(0)+v.count(2)//2>=N//2 else 'No')

Buggy python submission (verdict: Runtime Error):
N=int(input());A=input();v=[int(i)%4for i in A];print('Yes'if v.count(0)+v.count(2)//2>=N//2 else'No')

Fixed submission:
N=int(input());A=input().split();v=[int(i)%4 for i in A];print('Yes' if v.count(0)+v.count(2)//2>=N//2 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M=map(int,input().split())

sa=deque([])
en=deque([])
for _ in range(M):
    a,b=map(int,input().split())
    if a==1:
        sa.append(b)
    elif b==N:
        en.append(a)
print('POSSIBLE' if any([x in en for x in sa]) else 'IMPOSSIBLE')

Fixed submission:
N,M=map(int,input().split())
AB=[[int(x) for x in input().split()] for _ in range(M)]
sa=set()
en=set()
for a,b in AB:
    if a>b:
        a,b=b,a
    if a==1:
        sa.add(b)
    if b==N:
        en.add(a)
print('POSSIBLE' if sa&en else 'IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

sa=[]
en=[]
for _ in range(M):
    a,b=map(int,input().split())
    if a==1:
        sa.append(b)
    elif b==N:
        en.append(a)
print('POSSIBLE' if any([x in en for x in sa]) else 'IMPOSSIBLE')

Fixed submission:
N,M=map(int,input().split())
AB=[[int(x) for x in input().split()] for _ in range(M)]
sa=set()
en=set()
for a,b in AB:
    if a>b:
        a,b=b,a
    if a==1:
        sa.add(b)
    if b==N:
        en.add(a)
print('POSSIBLE' if sa&en else 'IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

sa=[]
en=[]
for _ in range(M):
    a,b=map(int,input().split())
    if a==1:
        sa.append(b)
    elif b==N:
        en.append(a)
print('POSSIBLE' if any([x in en for x in sa]) else 'IMPOSSIBLE')

Fixed submission:
N,M=map(int,input().split())
AB=[[int(x) for x in input().split()] for _ in range(M)]
sa=set()
en=set()
for a,b in AB:
    if a>b:
        a,b=b,a
    if a==1:
        sa.add(b)
    if b==N:
        en.add(a)
print('POSSIBLE' if sa&en else 'IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(['Impossible','Possible'][a%3==0 or b%3==0 or (a+b)%3==0])

Fixed submission:
a,b=map(int,input().split())
print(['Impossible','Possible'][a%3==0 or b%3==0 or (a+b)%3==0])

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(['Impossible','Possible'][a%3==0 or b%3==0 or (a+b)%3==0])

Fixed submission:
a,b=map(int,input().split())
print(['Impossible','Possible'][a%3==0 or b%3==0 or (a+b)%3==0])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(input().split())

arr=[]
for a in A:
    arr.append(a)
    arr=arr[::-1]

print(' '.join(arr))

Fixed submission:
N=int(input())
arr=input().split()
ans=arr[::2][::-1]+arr[1::2]
if not N&1:
    ans=ans[::-1]
print(*ans,sep=' ')
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print('delicious' if 0<b-a else 'dangerous' x>b-a else 'safe')

Fixed submission:
x,a,b=map(int,input().split())
print('delicious' if b-a<=0 else 'dangerous' if x<b-a else 'safe')
Buggy python submission (verdict: Runtime Error):
x=input().split().replace(' ','')
print('H' if x=='HH' or x=='DD' else 'D')

Fixed submission:
x=input().replace(' ','')
print('H' if x=='HH' or x=='DD' else 'D')
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)
N=int(input())
MOD=10**9+7
def seki(x):
	if x<2:
		return 1
	else:
		return x*seki(x-1)%MOD
print(seki(N)%MOD)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N=int(input())
MOD=10**9+7
def seki(x):
	if x<2:
		return 1
	else:
		return x*seki(x-1)%MOD
print(seki(N)%MOD)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split().replace(1,14)
print('Draw' if a==b else 'Alice' if a>b else 'Bob')

Fixed submission:
a,b=map(int,input().split())
if a>1:
    a=a
else:
    a=14
if b>1:
    b=b
else:
    b=14
print('Draw' if a==b else 'Alice' if a>b else 'Bob')
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
arr=[]
v=0
for s in S:
	if s=="I":
		v+=1
		arr.append(v)
	else:
		v-=1
		arr.append(v)
print(max(0,arr))

Fixed submission:
N=int(input())
S=input()
arr=[]
v=0
for s in S:
	if s=="I":
		v+=1
		arr.append(v)
	else:
		v-=1
		arr.append(v)
print(max(0,max(arr)))
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
arr=[]
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            arr.append(i+j+k==S)
print(sum(arr))

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        k=S-i-j
        if k>=0 and k<=K:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
ans=0
for X in range(K+1):
	for Y in range(K+1):
		for Z in range(K+1):
			if X+Y+Z==S:
				ans+=1
print(ans)

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(K+1):
    for j in range(K+1):
        k=S-i-j
        if k>=0 and k<=K:
            ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()[::-1]
T=""
L=["dream","dreamer","erase","eraser"] 
for s in S:
    T=T+s
    if T[::-1] in L:
        T=""
print("YES" if T=="" else "NO")

Fixed submission:
S=input()[::-1]
T=""
L=["dream","dreamer","erase","eraser"] 
for s in S:
    T=s+T
    if T in L:
        T=""
    elif len(T)>6:
        break
print("YES" if T=="" else "NO")

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=""
L=["dream","dreamer","erase","eraser"] 
for s in S[::-1]:
    T=T+s
    if T[::-1] in L:
        T=""
print("YES" if T=="" else "NO")

Fixed submission:
S=input()[::-1]
T=""
L=["dream","dreamer","erase","eraser"] 
for s in S:
    T=s+T
    if T in L:
        T=""
    elif len(T)>6:
        break
print("YES" if T=="" else "NO")
Buggy python submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print(b//x-a//a+1)

Fixed submission:
a,b,x=map(int,input().split())
print(b//x-(a-1)//x)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print('YES' if a=b+c or b=a+c or c=a+b else 'NO')

Fixed submission:
a,b,c=map(int,input().split())
print('Yes' if a==(b+c) or b==(a+c) or c==(a+b) else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(int(x*k+y*(n-k)*(n>k))

Fixed submission:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(x*k+y*(n-k) if n>k else x*n)
Buggy python submission (verdict: Runtime Error):
w=input()
arr=[]
for i in set(s):
    arr.append(s.count(i)%2==0)
print(all(arr))


Fixed submission:
w=input()
arr=[]
for i in set(w):
    arr.append(w.count(i)%2==0)
print("Yes" if all(arr) else "No")

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding=utf-8
w=input()
arr=[]
for i in set(s):
    arr.append(s.count(i)%2==0)
print(all(arr))


Fixed submission:
w=input()
arr=[]
for i in set(w):
    arr.append(w.count(i)%2==0)
print("Yes" if all(arr) else "No")
Buggy python submission (verdict: Runtime Error):
print(sum(range(1,int(input())+1))

Fixed submission:
print(sum(range(1,int(input())+1)))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N,L=map(int,input().split())
S=[input() for _ in range(N)]
print("".join(sorted(list(itertools.permutations(S)))[0]))

Fixed submission:
N,L=map(int,input().split())
print("".join(sorted([input() for _ in range(N)])))

Buggy python submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for _ in range(N)]
arr=[]
for i in range(N):
	for j in range(N):
		for k in range(N):
			if i!=j and j!=k and i!=k:
				arr.append(S[i]+S[j]+S[k])
print(sorted(arr)[0])

Fixed submission:
N,L=map(int,input().split())
print("".join(sorted([input() for _ in range(N)])))

Buggy python submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for _ in range(N)]
arr=[]
for i in range(N):
	for j in range(N):
		for k in range(N):
			if i!=j and j!=k:
				arr.append(S[i]+S[j]+S[k])
print(sorted(arr)[0])

Fixed submission:
N,L=map(int,input().split())
print("".join(sorted([input() for _ in range(N)])))
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n%10 in [2, 4, 5, 7, 9]:
  print("hon")
 elif n%10 in [0, 1, 6, 8]:
  print("pon")
 else:
  print("bon")

Fixed submission:
n = int(input())
if n%10 in [2, 4, 5, 7, 9]:
    print("hon")
elif n%10 in [0, 1, 6, 8]:
    print("pon")
else:
    print("bon")
Buggy python submission (verdict: Runtime Error):
a = input()
print(a + a**2 +a**3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
a = int(input())
  if 1<=a<=10: 
    b = a + a**2 + a**3
    print(b)
  
  

Fixed submission:
a = int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
ans = 0
for i in range(lne(s)):
  ans +=(s[i]!=t[i])
  
print(ans)

Fixed submission:
s = input()
t = input()

ans = 0
for i in range(len(s)):
    if s[i] != t[i]:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split())
p.sort()
print(sum(p[:K]))

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

print(sum(sorted(p)[:K]))

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

print(sum(sorted(p)[:K]


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

print(sum(sorted(p)[:K]))
Buggy python submission (verdict: Runtime Error):
s = input()
if s == "ABC": print("ARC")
else print("ABC")

Fixed submission:
s = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
n = int(input())
vals = [*map(int, input().split())]
dp = [0] * n

dp[0] = 0 
dp[1] = abs(vals[0] - vals[1])

for i in range(2,n):
    dp[i] = min( dp[i-1] + abs(vals[i] - vals[i-1]), \
            dp[i-2] + abs(vals[i] - vals[i-2]))

print(dp[n-1])


Fixed submission:
n = int(input())
vals = list(map(int, input().split()))
dp = [0] * n

dp[0] = 0 
dp[1] = abs(vals[0] - vals[1])

for i in range(2,n):
    dp[i] = min( dp[i-1] + abs(vals[i] - vals[i-1]), \
            dp[i-2] + abs(vals[i] - vals[i-2]))

print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())


d = {}
def gcd(a,b,c):
    st = tuple(sorted((a,b,c)))
    if st not in d:
        res = math.gcd(a, math.gcd(b,c))
        d[st] = res
    return d[st]

s=0
for i in range(1,K+1):
    for j in range(1, K+1):
        for l in range(1, K+1):
            s += gcd(i, j, l)
print(s)

Fixed submission:
from math import gcd
K = int(input())

s=0
for i in range(1,K+1):
    for j in range(1, K+1):
        for l in range(1, K+1):
            s += gcd(i, gcd(j,l))

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())

def gcd(a,b,c):
    return math.gcd(a, math.gcd(b,c))

s=0
for i in range(1,K+1):
    for j in range(1, K+1):
        for l in range(1, K+1):
            s += gcd(i, j, l)
print(s)

Fixed submission:
from math import gcd
K = int(input())

s=0
for i in range(1,K+1):
    for j in range(1, K+1):
        for l in range(1, K+1):
            s += gcd(i, gcd(j,l))

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int,input().split()))

res = 0
d = {}

d_res = {}

for i in range(N):
    if l[i] in d:
        d[l[i]] += 1
    else:
        d[l[i]] = 1



def get_n(d, x):
    res = 0
    for k,v in d.items():
        if k == x:
            res += ((v-1) * (v-2))/2
        else:
            res += (v * max(0,v-1))/2
    res = int(res)
    d_res[x] = res
    return res


for e in l:
    if e in d_res:
        print(d_res[e])
    else:
        print(get_n(d, e))


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

d = {}


for i in range(N):
    if l[i] in d:
        d[l[i]] += 1
    else:
        d[l[i]] = 1

max_comb = 0
for v in d.values():
    max_comb += v * max(0, (v-1)) /2

def get_n(x):

    return int(max_comb - d[x] +1)


for e in l:
    print(get_n(e))

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

res = 0
d = {}

for i in range(N):
    if l[i] in d:
        d[l[i]] += 1
    else:
        d[l[i]] = 1



def get_n(d, x):
    res = 0
    for k,v in d.items():
        if k == x:
            res += ((v-1) * (v-2))/2
        else:
            res += (v * max(0,v-1))/2
    return res


for e in l:
    print(int(get_n(d, e)) )
    #break


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

d = {}


for i in range(N):
    if l[i] in d:
        d[l[i]] += 1
    else:
        d[l[i]] = 1

max_comb = 0
for v in d.values():
    max_comb += v * max(0, (v-1)) /2

def get_n(x):

    return int(max_comb - d[x] +1)


for e in l:
    print(get_n(e))
Buggy python submission (verdict: Runtime Error):
l = input().split()
print( "Yes" (len(set(l)) == 2) else "No")

Fixed submission:
l = input().split()
print( "Yes" if (len(set(l)) == 2) else "No")
Buggy python submission (verdict: Runtime Error):
from math import seil

H, A = map(int, input().split())
print(ceil(H/A))

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

if (H % A):
    print((H//A)+1)
else:
    print(H//A)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print("Yes" if (a==b) else "No)

Fixed submission:
a, b = input().split()
print("Yes" if (a==b) else "No")
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

print(lcm(A,B))

Fixed submission:

A, B = map(int, input().split())

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))

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

def gcd(a,b):
    return math.gcd(a,b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))

Fixed submission:

A, B = map(int, input().split())

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))

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

def gcd(a,b):
    return m.gcd(a,b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))

Fixed submission:

A, B = map(int, input().split())

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

print(lcm(A,B))
Buggy python submission (verdict: Runtime Error):
S = input()
is_easy = False
for i in range(len(S)):
  if i % 2 == 0:
   	if S[i] == "R":
      print("No")
      is_easy = True
      break
  else:
   	if S[i] == "L":
      print("No")
      is_easy = True
      break
      
if not is_diff:
  print("Yes")

Fixed submission:
S = input()
s1 = S[1::2]
s2 = S[::2]


if "L" in s2 or "R" in s1:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int,input().split())
scores = [K] * N

def minus(ans_i):
    for i in range(N):
        scores[i] -= 1
    scores[ans_i-1] += 1

for i in range(Q):
    ans_i = int(input())
    minus(ans_i)    

for player in scores:
    if player <= 0:
        print("No")
    else:
        print("Yes")

Fixed submission:
N, K, Q = map(int,input().split())
scores = [0] * N

for i in range(Q):
    ans_i = int(input())
    scores[ans_i-1] += 1    

for i in range(N):
    final_res = K - (Q - scores[i])  
    if final_res <= 0:
        print("No")
    else:
        print("Yes")