Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
TXY = [list(map(int,input().split())) for _ in range(N)]

t0,x0,y0 = 0,0,0

for i in range(N):
    print(t0,x0,y0," ",t,x,y)
    if t-t0 >= abs(x-x0)+abs(y-y0) and (t-t0)%2 == abs(x-x0+y-y0)%2:
        t0,x0,y0 = t,x,y
        continue
    else:
        print("No")
        sys.exit()

print("Yes")

Fixed submission:
N = int(input())
S = "Yes"
A = [(0,0,0)]
for i in range(N):
    t,x,y = map(int,input().split())
    A.append((t,x,y))
A = sorted(A)
for i in range(N):
    t1,x1,y1 = A[i]
    t2,x2,y2 = A[i+1]
    if abs(x2-x1)+abs(y2-y1) > t2-t1  or   (abs(x2-x1)+abs(y2-y1))%2 != (t2-t1)%2:
        S = "No"
        break
print(S)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

maxA,minA = max(A),min(A)
maxAi,minAi = -1,-1
sign = ""
M = []

for i in range(N):
    if A[i] == maxA:
        maxAi = i
        break
for i in range(N):
    if A[i] == minA:
        minAi = i
        break

if abs(maxA) >= abs(minA):
    A = list(map(lambda x: x+maxA, A))
    sign = "+"
else:
    A = list(map(lambda x: x+minA, A))
    sign = "-"

if sign == "+":
    for i in range(N):
        if i != maxAi:
            M.append((maxAi,i))
    M.append((maxAi,maxAi))
    for i in range(N-1):
        M.append((i,i+1))
elif sign == "-":
    for i in range(N):
        if i != minAi:
            M.append((minAi,i))
    M.append(minAi,minAi)
    for i in range(N-1):
        M.append((N-i,N-i-1))

L = len(M)
print(L)
for i in range(L):
    x,y = M[i]
    print(x,y)


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

maxA,minA = max(A),min(A)
maxAi,minAi = -1,-1
sign = ""
M = []

for i in range(N):
    if A[i] == maxA:
        maxAi = i
        break
for i in range(N):
    if A[i] == minA:
        minAi = i
        break

if abs(maxA) >= abs(minA):
    A = list(map(lambda x: x+maxA, A))
    sign = "+"
else:
    A = list(map(lambda x: x+minA, A))
    sign = "-"

if sign == "+":
    for i in range(N):
        if i != maxAi:
            M.append((maxAi,i))
    M.append((maxAi,maxAi))
    for i in range(N-1):
        M.append((i,i+1))
elif sign == "-":
    for i in range(N):
        if i != minAi:
            M.append((minAi,i))
    M.append((minAi,minAi))
    for i in range(N-1):
        M.append((N-i-1,N-i-2))

L = len(M)
print(L)
for i in range(L):
    x,y = M[i]
    print(x+1,y+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,C = map(int,input().split())
STC = [[] for _ in range(C)]
for i in range(N):
    s,t,c = map(int,input().split())
    STC[c-1].append((s,t))

lenA = 200001
A = [[0]*lenA for _ in range(C)]
for i in range(N):
    a = 1

for i in range(C):
    for (s,t) in STC[i]:
        A[i][s*2-1] += 1
        A[i][t*2] -= 1

for i in range(C):
    for j in range(lenA-1):
        A[i][j+1] += A[i][j]

Ans = [0]*lenA
for i in range(C):
    for j in range(lenA):
        if A[i][j] > 0:
            Ans[j] += 1

print(max(Ans))


Fixed submission:
N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(100001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s-1,t):
        A[j][c-1] = 1
R = 0
for i in range(100001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)

Buggy python submission (verdict: Time Limit Exceeded):
N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(200001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s*2-1,t*2):
        A[j][c-1] = 1
R = 0
for i in range(200001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)


Fixed submission:
N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(100001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s-1,t):
        A[j][c-1] = 1
R = 0
for i in range(100001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)

Buggy python submission (verdict: Time Limit Exceeded):
N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(200001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s*2-1,t*2):
        A[j][c-1] = 1
R = 0
for i in range(200001):
    if R < sum(A[i]):
        R = sum(A[i])
print(R)


Fixed submission:
N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(100001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s-1,t):
        A[j][c-1] = 1
R = 0
for i in range(100001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)

Buggy python submission (verdict: Time Limit Exceeded):
N,C = map(int,input().split())
S = []
U = [0]*200001
for i in range(N):
    S.append(list(map(int,input().split())))
for i in range(1,C+1):
    T = [0]*200001
    for j in range(N):
        s,t,r = S[j]
        if r == i:
            T[s*2-1] += 1
            T[t*2] -= 1
    for j in range(1,200001):
        T[j] += T[j-1]
    for j in range(200001):
        if T[j] > 0:
            U[j] += 1
print(max(U))



Fixed submission:
N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(100001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s-1,t):
        A[j][c-1] = 1
R = 0
for i in range(100001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
C = [0]*10
for i in range(10):
    C[i] = list(map(int,input().split()))
A = [0]*10
for i in range(H):
    A[i] = list(map(int,input().split()))
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j],C[i][k]+C[k][j])
Ans = 0
for i in range(H):
    B = A[i]
    for b in B:
        if b > 1:
            Ans += C[b][1]
print(Ans)

Fixed submission:
H,W = map(int,input().split())
c,A,s = [],[],0
for i in range(10):
    c.append(list(map(int,input().split())))
for i in range(H):
    A.append(list(map(int,input().split())))
for i in range(10):
    for j in range(10):
        for k in range(10):
            c[j][k] = min(c[j][k], c[j][i]+c[i][k])
for i in range(10):
    for j in range(H):
        s = s + A[j].count(i) * c[i][1]
print(s)
Buggy python submission (verdict: Runtime Error):
X,Y = input().split()
if X==Y:
    print("=")
elif(X>Y:
    print(">"))
else:
    print("<")

Fixed submission:
X,Y = input().split()
if X==Y:
    print("=")
elif(X>Y):
    print(">")
else:
    print("<")
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
A,B,C,D,E,F = map(int,input().split())

W,S = [],[0]
limW,limS = 3000,3000

for ai in range(ceil(limW/A)):
    for bi in range(ceil(limW/B+1)):
        w = 100*A*ai+100*B*bi
        if w <= limW and 0 < w and w not in W:
            W.append(w)
for ci in range(ceil(limS/C)):
    for di in range(ceil(limS/D)):
        s = C*ci+D*di
        if s <= limS and 0 < s and s not in S:
            S.append(s)

AnsWS,AnsS,r = 0,0,-1
for wi in W:
    for si in S:
        if r < si/wi and si <= E*(wi//100) and (wi+si) <= F:
            AnsWS,AnsS,r = wi+si,si,si/wi

print(AnsWS,AnsS)

Fixed submission:
from math import ceil
A,B,C,D,E,F = map(int,input().split())

W,S = [],[0]

for ai in range(ceil(F/A)):
    for bi in range(ceil(F/B)):
        w = 100*A*ai+100*B*bi
        if w <= F and 0 < w and w not in W:
            W.append(w)
for ci in range(ceil(F/C)):
    for di in range(ceil(F/D)):
        s = C*ci+D*di
        if s <= F and 0 < s and s not in S:
            S.append(s)

AnsWS,AnsS,r = 0,0,-1
for wi in W:
    for si in S:
        if r < si/wi and si <= E*(wi//100) and (wi+si) <= F:
            AnsWS,AnsS,r = wi+si,si,si/wi

print(AnsWS,AnsS)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A,B,Ans = [],[],0
for i in range(N):
    x = list(map(int,input().split()))
    A.append(x.copy())
    B.append(x.copy())

for k in range(N):
    for i in range(N):
        for j in range(N):
            B[i][j] = min(B[i][j],B[i][k]+ B[k][j])

if A!=B:
    print(-1)
else:
    for i in range(N):
        for j in range(i+1,N):
            exists = True
            for k in range(N):
                if k not in (i,j) and B[i][j]==B[i][k]+B[k][j]:
                    exists = False                    
            if exists:
                Ans += B[i][j]
    print(Ans)



Fixed submission:
N = int(input())
A,B,Ans = [],[],0
for i in range(N):
    x = list(map(int,input().split()))
    A.append(x[:])
    B.append(x[:])

for k in range(N):
    for i in range(N):
        for j in range(N):
            B[i][j] = min(B[i][j],B[i][k]+ B[k][j])

if A!=B:
    print(-1)
else:
    for i in range(N):
        for j in range(i+1,N):
            exists = True
            for k in range(N):
                if k not in (i,j) and B[i][j]==B[i][k]+B[k][j]:
                    exists = False                    
            if exists:
                Ans += B[i][j]
    print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A,B,Ans = [],[],0
for i in range(N):
    x = list(map(int,input().split()))
    A.append(x.copy())
    B.append(x.copy())

for k in range(N):
    for i in range(N):
        for j in range(N):
            B[i][j] = min(B[i][j],B[i][k]+ B[k][j])

if A!=B:
    print(-1)
else:
    for i in range(N):
        for j in range(i+1,N):
            exists = True
            for k in range(N):
                if k not in (i,j) and B[i][j]==B[i][k]+B[k][j]:
                    exists = False                    
            if exists:
                Ans += B[i][j]
    print(Ans)



Fixed submission:
N = int(input())
A,B,Ans = [],[],0
for i in range(N):
    x = list(map(int,input().split()))
    A.append(x[:])
    B.append(x[:])

for k in range(N):
    for i in range(N):
        for j in range(N):
            B[i][j] = min(B[i][j],B[i][k]+ B[k][j])

if A!=B:
    print(-1)
else:
    for i in range(N):
        for j in range(i+1,N):
            exists = True
            for k in range(N):
                if k not in (i,j) and B[i][j]==B[i][k]+B[k][j]:
                    exists = False                    
            if exists:
                Ans += B[i][j]
    print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
    x = int(input())
    if x in A:
        A.remove(x)
    else:
        A.append(x)
print(len(A))

Fixed submission:
from collections import Counter
N = int(input())
A,Ans = [],0
for i in range(N):
    A.append(int(input()))
cA = Counter(A).most_common()
for k,v in cA:
    if v%2 != 0:
        Ans += 1
print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
Ans = 10**10
A = [[10**10 for _ in range(N)] for _ in range(N)]
for _ in range(M):
    a,b,c = map(int,input().split())
    A[a-1][b-1] = c
    A[b-1][a-1] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            A[i][j] = min(A[i][j], A[i][k]+A[k][j])
P = list(permutations(r))
for p in P:
    d = 0
    for i in range(R-1):
        d += A[p[i]-1][p[i+1]-1]
    Ans = min(Ans,d)
print(Ans)

Fixed submission:
from itertools import permutations
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
Ans = 10**10
A = [[10**10 for _ in range(N)] for _ in range(N)]
for _ in range(M):
    a,b,c = map(int,input().split())
    A[a-1][b-1] = c
    A[b-1][a-1] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            A[i][j] = min(A[i][j], A[i][k]+A[k][j])
P = list(permutations(r))
for p in P:
    d = 0
    for i in range(R-1):
        d += A[p[i]-1][p[i+1]-1]
    Ans = min(Ans,d)
print(Ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))
Ans = 0
B = A.most_common()
for n,c in B:
    Ans = max(Ans,B[n]+B[n-1]+B[n+1])
print(Ans)

Fixed submission:
from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))
Ans = 0
for n,c in A.most_common():
    Ans = max(Ans,A[n]+A[n-1]+A[n+1])
print(Ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C = sorted(Counter(A).most_common(),reverse=True)
D = []
F = []
for i in range(len(C)):
    x,y = C[i][0],C[i][1]
    if y >= 2:
        D.append(x)
    if y >= 4:
        F.append(x)
E = sorted(D,reverse=True)
G = sorted(F,reverse=True)
if len(E)>=2:
    if G[0]==E[0]:
        print(G[0]*G[0])
    else:
        print(E[0]*E[1])
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split()))).most_common()
fA = filter(lambda x: x[1] >= 2, A)
sA = sorted(fA,reverse=True)
if len(sA) < 2:
    print(0)
else:
    print(sA[0][0]**2 if sA[0][1]>=4 else sA[0][0]*sA[1][0])
Buggy python submission (verdict: Runtime Error):
from math import gcd

N = int(input())
T = []

for i in range(N):
    T.append(int(input()))

Ans = T[0]
for i in range(1,N):
    Ans = Ans*T[i]//gcd(Ans,T[i])

print(Ans)

Fixed submission:
from fractions import gcd

N = int(input())
T = []

for i in range(N):
    T.append(int(input()))

Ans = T[0]
for i in range(1,N):
    Ans = Ans*T[i]//gcd(Ans,T[i])

print(Ans)
Buggy python submission (verdict: Runtime Error):
def dfs(n,p,d):
    visited[n] = True
    dist[n] = d
    for (i,c) in A[n]:
        if i != p and not visited[i]:
            dfs(i,n,d+c)

N = int(input())
A = [[] for _ in range(N)]
for _ in range(N-1):
    a,b,c = map(int,input().split())
    A[a-1].append((b-1,c))
    A[b-1].append((a-1,c))
Q,K = map(int,input().split())
B = []
for _ in range(Q):
    x,y = map(int,input().split())
    B.append((x,y))

dist = [-1]*N
visited = [False]*N
dfs(K-1,N,0)

for (x,y) in B:
    print(dist[x-1]+dist[y-1])


Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())
X = [[] for _ in range(N)]

for i in range(N-1):
    a,b,c = map(int,input().split())
    X[a-1].append((b-1,c))
    X[b-1].append((a-1,c))

cost = [-1]*N
def calc(i,c):
    # 指定の頂点までのコストを代入
    cost[i] = c
    # 頂点から移動できる頂点があれば
    for ni,nc in X[i]:
        # 初期状態のままなら計算
        if cost[ni] == -1:
            calc(ni,c+nc)

Q,K = map(int,input().split())
# 事前計算
calc(K-1,0)

for i in range(Q):
    x,y = map(int,input().split())
    print(cost[x-1]+cost[y-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = [[] for _ in range(N)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    X[a-1].append((b-1,c))
    X[b-1].append((a-1,c))

cost = [-1]*(N+2)
def calc(i,c):
    # 指定の頂点までのコストを代入
    cost[i] = c
    # 頂点から移動できる頂点があれば
    for ni,nc in X[i]:
        # 初期状態のままなら計算
        if cost[ni] == -1:
            calc(ni,c+nc)

Q,K = map(int,input().split())
# 事前計算
calc(K-1,0)

for i in range(Q):
    x,y = map(int,input().split())
    print(cost[x-1]+cost[y-1])



Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())
X = [[] for _ in range(N)]

for i in range(N-1):
    a,b,c = map(int,input().split())
    X[a-1].append((b-1,c))
    X[b-1].append((a-1,c))

cost = [-1]*N
def calc(i,c):
    # 指定の頂点までのコストを代入
    cost[i] = c
    # 頂点から移動できる頂点があれば
    for ni,nc in X[i]:
        # 初期状態のままなら計算
        if cost[ni] == -1:
            calc(ni,c+nc)

Q,K = map(int,input().split())
# 事前計算
calc(K-1,0)

for i in range(Q):
    x,y = map(int,input().split())
    print(cost[x-1]+cost[y-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A,B,C = [],[],[]
Ans = "IMPOSSIBLE"
for i in range(M):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(M):
    if A[i] == 1:
        C.append(B[i])
for c in C:
    for i in range(M):
        if A[i] == c and B[i] == N:
            Ans = "POSSIBLE"
            break
print(Ans)

Fixed submission:
N,M = map(int,input().split())
A,B,C,D = [],[],[],[]
for i in range(M):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(M):
    if A[i] == 1:
        C.append(B[i])
    if B[i] == N:
        D.append(A[i])
print("POSSIBLE" if len(set(C) & set(D)) > 0 else "IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
def init_fact(n,mod):
    fact,finv,inv = [1]*n,[1]*n,[1]*n
    for i in range(2,n):
        fact[i] = (fact[i-1]*i) % mod
        inv[i]  = mod - inv[mod%i] * (mod//i)%mod
        finv[i] = finv[i-1] * inv[i] % mod
    return (fact,finv,inv)

def nCr(n,r,mod,fact,finv):
    if n<r:
        return 0
    else:
        return fact[n] * (finv[r] * finv[n-r] % mod) % mod

modulo = 10**9+7
fact,finv,inv = init_fact(200000,modulo)


from collections import Counter
N = int(input())
A = list(map(int,input().split()))

# 重複している数を調べる
C = Counter(A).most_common()
x = C[0][0]

# 重複している数のindexを調べる
xi = []
for i in range(N):
    if A[i]==x:
        xi.append(i)
h = xi[1]-xi[0]+1

for i in range(1,N+2):
    print(nCr(N+1,i,modulo,fact,finv) - nCr(N+1-h,i-1,modulo,fact,finv))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A).most_common(1)[0][0]
B = []
mod = 10**9+7

for i in range(N+1):
    if A[i]==c:
        B.append(i)

F,I = [1],[1]
for i in range(1,N+2):
    F.append(F[i-1]*i%mod)
    I.append(pow(F[i],mod-2,mod))

def C(n,r):
    if n<r or n==0 or r==0:
        return 0
    else:
        return F[n]*I[r]*I[n-r]%mod

r0 = B[0]+N-B[1]

for i in range(1,N+2):
    Ans = (C(N+1,i) - C(r0,i-1))%mod
    print(Ans if i>1 else Ans-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]

r = []
ans = 0
for i in range(N):
    ans += S[i]
    if S[i]%10!=0:
        r.append(S[i])

r.sort()
if ans%10==0:
    if len(rr)>0:
        ans -= r[0]
    else:
        ans = 0

print(ans)



Fixed submission:
N = int(input())
S = [int(input()) for _ in range(N)]
sumS = sum(S)
T = list(filter(lambda x : x%10!=0, S))
T.sort()
if len(T)==0:
    print(0)
else:
    for t in T:
        if sumS%10!=0:
            break
        else:
            sumS -= t
    print(sumS)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]

rr = []
ans = 0
for i in range(N):
    ans += S[i]
    if S[i]%10!=0:
        rr.append(S[i])

rr.sort()
if ans%10==0:
    if len(rr)>0:
        ans -= r[0]
    else:
        ans = 0

print(ans)



Fixed submission:
N = int(input())
S = [int(input()) for _ in range(N)]
sumS = sum(S)
T = list(filter(lambda x : x%10!=0, S))
T.sort()
if len(T)==0:
    print(0)
else:
    for t in T:
        if sumS%10!=0:
            break
        else:
            sumS -= t
    print(sumS)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A==B:
    print("EQUAL")
elif A>B:
    print("GREATER")
else:
    print("LESS")

Fixed submission:
A = int(input())
B = int(input())
if A==B:
    print("EQUAL")
elif A>B:
    print("GREATER")
else:
    print("LESS")
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
modulo = 10**9+7

x,y = 0,0
for i in range(N):
    for j in range(i+1,N):
        x += X[j]-X[i]
        x %= modulo
for i in range(M):
    for j in range(i+1,M):
        y += Y[j]-Y[i]
        y %= modulo

print(x*y%modulo)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
modulo = 10**9+7

x,y = 0,0
for i in range(N):
    x += X[i]*i - X[i]*(N-i-1)
for i in range(M):
    y += Y[i]*i - Y[i]*(M-i-1)

print(x*y%modulo)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
modulo = 10**9+7

x,y = 0,0
for i in range(N):
    for j in range(i+1,N):
        x += X[j]-X[i]
for i in range(M):
    for j in range(i+1,M):
        y += Y[j]-Y[i]

print(x*y%modulo)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
modulo = 10**9+7

x,y = 0,0
for i in range(N):
    x += X[i]*i - X[i]*(N-i-1)
for i in range(M):
    y += Y[i]*i - Y[i]*(M-i-1)

print(x*y%modulo)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = list(map(int,input().split()))
T = []
for i in range(N):
    T.append((i,S[i]))
U = sorted(T,key=lambda x:x[1], reverse=True)

Ans = [0]*N
c,v = 0,10**10

for i in range(N-1):
    c+=1
    v = min(v,U[i][0])
    if U[i][1]==U[i+1][1]:
        continue
    else:
        Ans[v] += (U[i][1] - U[i+1][1])*c
else:
    Ans[0] += U[i+1][1]

for i in range(N):
    print(Ans[i])

Fixed submission:
from collections import Counter
N = int(input())
S = list(map(int,input().split()))
T = []
for i in range(N):
    T.append((i,S[i]))
U = sorted(T,key=lambda x:x[1], reverse=True)

Ans = [0]*N
c,v = 0,10**10

for i in range(N-1):
    c+=1
    v = min(v,U[i][0])
    if U[i][1]==U[i+1][1]:
        continue
    else:
        Ans[v] += (U[i][1] - U[i+1][1])*c
else:
    Ans[0] = 0
    Ans[0] = sum(S) - sum(Ans)

for i in range(N):
    print(Ans[i])
Buggy python submission (verdict: Runtime Error):
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

C = dict(Counter(A))

ans = 1
if N%2==0:
    for i in range(N//2):
        if C[i*2+1] == 2:
            ans *= 2
            ans %= mod
        else:
            ans = 0
            break
else:
    if C[0] == 1:
        for i in range(N//2):
            if C[i*2+2] == 2:
                ans *= 2
                ans %= mod
            else:
                ans = 0
                break
    else:
        ans = 0

print(ans)

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

C = Counter(A).most_common()
p = 0
for k,v in C:
    if v==1 and k==0 and N%2==1:
        continue
    elif v==2:
        p += 1
        continue
    else:
        p = 0
        break
if N==1:
    print(1)
else:
    print(p if p==0 else (2**p)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
ABC = list(map(int,input().split()))

ABC.sort()

print("Yes" if A[0]+A[1]==A[2] else "No")

Fixed submission:
A = sorted(map(int,input().split()))
print("Yes" if A[0]+A[1]==A[2] else "No")
Buggy python submission (verdict: Runtime Error):
from math import ceil
N = int(input())
T,A = 1,1
for i in range(N):
    Ti,Ai = map(int,input().split())
    r = max(ceil(T/Ti),ceil(A/Ai))
    T,A = Ti*r,Ai*r
print(T+A)


Fixed submission:
from collections import Counter
A,B,C = map(int,input().split())
print(len(Counter([A,B,C]).most_common()))