Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0]) for i in range(N-2):
        print('Yes')
    else:print('No')
else:print('No')

Fixed submission:
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0] for i in range(N-1)):
        print('Yes')
    else:print('No')
else:print('No')

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0]) for i in range(N-1):
        print('Yes')
    else:print('No')
else:print('No')

Fixed submission:
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0] for i in range(N-1)):
        print('Yes')
    else:print('No')
else:print('No')

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A):
    if all(A[i][-1]==A[i+1][0]) for i in range(N-1):
        print('Yes')
    else:print('No')
else:print('No')

Fixed submission:
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0] for i in range(N-1)):
        print('Yes')
    else:print('No')
else:print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c=sorted(map(int, input().split())
print(a+c)

Fixed submission:
a,b,c=sorted(map(int, input().split()))
print(c-a)

Buggy python submission (verdict: Runtime Error):
a,b,c=sorted(map(int, input().split())
print(a-2*b+c)

Fixed submission:
a,b,c=sorted(map(int, input().split()))
print(c-a)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
max(len(set(S[:i])&set(S[i:])) for i in range(1,len(S)-2))

Fixed submission:
N=int(input())
S=input()
print(max(len(set(S[:i])&set(S[i:])) for i in range(N)))

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
max(len((S[:i]&S[i:])) for i in range(1,len(S)-2))

Fixed submission:
N=int(input())
S=input()
print(max(len(set(S[:i])&set(S[i:])) for i in range(N)))

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
max(sum(S[:i]&S[i:]) for i in range(1,len(S)-2))

Fixed submission:
N=int(input())
S=input()
print(max(len(set(S[:i])&set(S[i:])) for i in range(N)))
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
B=B.sort()
print(B[-1])

Fixed submission:
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(max(B))

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(B.sort()[-1])

Fixed submission:
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(max(B))

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=[1]*8
for i in range(2:10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(B.sort()[-1])

Fixed submission:
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(max(B))

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=[1]*9
for i in range(1:10):
  for j in range(A+1):
    if j**i <= A:
      B[i]= j**i
    else:break
print(B.sort()[-1])
  

Fixed submission:
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(max(B))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(sum(a-1+(a<=b)))

Fixed submission:
a,b=map(int,input().split())
print(a-1+(a<=b))
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=[int(input()) for _ range(n)]
print(n+((x-sum(a))//min(a)))

Fixed submission:
n,x=map(int,input().split())
a=list(int(input()) for _ in range(n))
print(n+((x-sum(a))//min(a)))

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(int(input()) for _ range(n))
print(n+((x-sum(a))//min(a)))

Fixed submission:
n,x=map(int,input().split())
a=list(int(input()) for _ in range(n))
print(n+((x-sum(a))//min(a)))

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(int(input()) for _ range(n))
print(n+(x-sum(a))//min(a))

Fixed submission:
n,x=map(int,input().split())
a=list(int(input()) for _ in range(n))
print(n+((x-sum(a))//min(a)))

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split.())
a=list(int(input()) for _ range(n))
print(n+(x-sum(a))//min(a))

Fixed submission:
n,x=map(int,input().split())
a=list(int(input()) for _ in range(n))
print(n+((x-sum(a))//min(a)))

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().suplit.())
a=list(int(input()) for _ range(n))
print(n+(x-sum(a))//min(a))

Fixed submission:
n,x=map(int,input().split())
a=list(int(input()) for _ in range(n))
print(n+((x-sum(a))//min(a)))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d=list(map(int, input().split())
d.append(c)
d.sort()
print(min(d.index(c), len(d)-d.index(c)-1))

Fixed submission:
n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))
Buggy python submission (verdict: Runtime Error):
a,b,c,d=[int(input()) for_ in range(4)]
print(min(a,b)+min(c,d))


Fixed submission:
a,b,c,d=[int(input()) for _ in range(4)]
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len[1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i+100*m<=s])

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len[1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i+100*m<=s ])

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len[1 for i in range(a+1) for m in range(b+1) if 0<<x-500*i+100*m<<s ])

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len[1 if 0<<x-500*i+100*m<<s for i in range(a+1) for m in range(b+1)])

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))
Buggy python submission (verdict: Runtime Error):
s=list(list(i for i in input()).sort())
t=list(list(i for i in input()).sort()(reverse=True))
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')


Fixed submission:
s=sorted(input())
t=sorted(input())[::-1]
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
        break
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')

Buggy python submission (verdict: Runtime Error):
s=[i for i in input()].sort()
t=[i for i in input()].sort()(reverse=True)
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')

Fixed submission:
s=sorted(input())
t=sorted(input())[::-1]
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
        break
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')

Buggy python submission (verdict: Runtime Error):
s=list(input().split()).sort()
t=list(input().split()).sort()(reverse=True)
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')

Fixed submission:
s=sorted(input())
t=sorted(input())[::-1]
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
        break
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
cnt=0
while True:
    if [a%2 for a in A]==[0]*N:
        A=[a//2 for a in A]
        cnt+=1
print(cnt)

       
       

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
cnt=0
while True:
    if [a%2 for a in A]==[0]*N:
        A=[a//2 for a in A]
        cnt+=1
    else:break
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, input().split())
print((a-b-2*c)//(b+C)+1)

Fixed submission:
a,b,c=map(int, input().split())
print((a-b-2*c)//(b+c)+1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S={input()}
for i in range(N-1):
    S=S^{input()}
print(len(S))

Fixed submission:
N=int(input())
S=set()
for i in range(N):
    S^={input()}
print(len(S))

Buggy python submission (verdict: Runtime Error):
N=int(input())
S={}
for i in range(N):
    S=S^{input()}
print(len(S))

Fixed submission:
N=int(input())
S=set()
for i in range(N):
    S^={input()}
print(len(S))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
for i in range(1,b+1):
  if (i*a)%b==c:
    print('YES')
  break
print('NO')
a,b,c=map(int,input().split())
for i in range(b):
  if (i*a)%b==c:
    print('YES')
    break
print('NO')

Fixed submission:
a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
  if (i*a)%b==c:
    ans='YES'
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
for i in range(1,b+1):
  if (i*a)%b==c:
    print('YES')
    break
print('NO')
a,b,c=map(int,input().split())
for i in range(b):
  if (i*a)%b==c:
    print('YES')
    break
print('NO')
提出情報

Fixed submission:
a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
  if (i*a)%b==c:
    ans='YES'
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
for i in range(B):
  if (i*a)%b==c:
    print('YES')
    break
print('NO')

Fixed submission:
a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
  if (i*a)%b==c:
    ans='YES'
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
for i in range(0:B):
  if (i*a)%b==c:
    print('YES')
    break
print('NO')

Fixed submission:
a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
  if (i*a)%b==c:
    ans='YES'
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools
N,M=map(int,input().split())
edges={tuplec(sorted(map(int,input().split()))) for i in range(M)}
ans=0
for i in itertools.permutations(range(2,N+1),N-1):
    l=[1]+list(i)
    ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)

Fixed submission:
import itertools
N,M=map(int,input().split())
edges={tuple(sorted(map(int,input().split()))) for i in range(M)}
ans=0
for i in itertools.permutations(range(2,N+1),N-1):
    l=[1]+list(i)
    ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)

Buggy python submission (verdict: Runtime Error):
import itertools
N,M=map(int,input().split())
edges={tuplec(sorted(map(int,input().split()))) for i in range(M)}
ans=0
for i in itertools.permutations(range(2,N+1)):
    l=[1]+list(i)
    ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)

Fixed submission:
import itertools
N,M=map(int,input().split())
edges={tuple(sorted(map(int,input().split()))) for i in range(M)}
ans=0
for i in itertools.permutations(range(2,N+1),N-1):
    l=[1]+list(i)
    ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)
Buggy python submission (verdict: Runtime Error):
print(*input().split(,))


Fixed submission:
print(*input().split(","))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
print([x+y+z for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s))

Fixed submission:
k,s=map(int,input().split())
print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
print([x+y+z for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s))

Fixed submission:
k,s=map(int,input().split())
print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
cnt=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                cnt+=1
print(cnt)

Fixed submission:
k,s=map(int,input().split())
print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))
Buggy python submission (verdict: Runtime Error):
A = list(input().split)
B=''
for a in A:
  B += a[0].upper()
print(B)


Fixed submission:
A = list(input().split())
print(A[0][0]+A[1][0]+A[2][0])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        ans += a[i]*a[j]
        ans %= int(1e9+7)
        
print(ans)

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

ans = 0
latsum = sum(a)-a[0]
for i in range(n-1):
    ans += a[i]*latsum
    ans %= int(1e9+7)
    latsum -= a[i+1]
        
print(ans)

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

ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        ans += a[i]*a[j]
        ans %= int(1e9+7)
        
print(ans)

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

ans = 0
latsum = sum(a)-a[0]
for i in range(n-1):
    ans += a[i]*latsum
    ans %= int(1e9+7)
    latsum -= a[i+1]
        
print(ans)
Buggy python submission (verdict: Runtime Error):
K = int(input())

A = [0]*1000000
A[0] = 7%K
ans = 1
while 1==1:
    if A[ans-1]==0:
        break
        
    A[ans] = (A[ans-1]*10+A[0])%K
    ans += 1
    
    if A[ans-1] == A[0] and A[0] != 0:
        ans = -1
        break
        
print(ans)

Fixed submission:
K = int(input())

A = [0]*1000001
A[0] = 7%K
ans = -1

for i in range(1,1000001):
    A[i] = (A[i-1]*10+7)%K

for i in range(1000001):
    if A[i]==0:
        ans = i+1
        break
        
print(ans)

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

A = [0]
A[0] = 7%K
ans = 1
while 1==1:
    if A[ans-1]==0:
        break
        
    A.append((A[ans-1]*10+A[0])%K)
    ans += 1
    
    if A[ans-1] == A[0] and A[0] != 0:
        ans = -1
        break
        
print(ans)

Fixed submission:
K = int(input())

A = [0]*1000001
A[0] = 7%K
ans = -1

for i in range(1,1000001):
    A[i] = (A[i-1]*10+7)%K

for i in range(1000001):
    if A[i]==0:
        ans = i+1
        break
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,m,k = map(int,input().split())
a = list(map(int,('0 '+input()).split()))
b = list(map(int,('0 '+input()).split()))

asum = list(itertools.accumulate(a))
bsum = list(itertools.accumulate(b))

ans = 0
for i in range(n+1):
    for j in range(m,max(-1,ans-i),-1):
        if asum[i]+bsum[j]<=k:
            ans = max(ans,i+j)
            break

print(ans)

Fixed submission:
import itertools

n,m,k = map(int,input().split())
a = list(map(int,('0 '+input()).split()))
b = list(map(int,('0 '+input()).split()))

asum = list(itertools.accumulate(a))
bsum = list(itertools.accumulate(b))

ans = 0
j=m
for i in range(n+1):
    if asum[i]>k:
        break
    
    while asum[i]+bsum[j]>k:
        j-=1
        
    ans = max(ans,i+j)

print(ans)

Buggy python submission (verdict: Runtime Error):
import itertools

n,m,k = map(int,input().split())
a = list(map(int,('0 '+input()).split()))
b = list(map(int,('0 '+input()).split()))

asum = list(itertools.accumulate(a))
bsum = list(itertools.accumulate(b))

ans = 0
for i in range(n+1):
    for j in range(m,(ans-i)-1,-1):
        if asum[i]+bsum[j]<=k:
            ans = max(ans,i+j)
            break

print(ans)

Fixed submission:
import itertools

n,m,k = map(int,input().split())
a = list(map(int,('0 '+input()).split()))
b = list(map(int,('0 '+input()).split()))

asum = list(itertools.accumulate(a))
bsum = list(itertools.accumulate(b))

ans = 0
j=m
for i in range(n+1):
    if asum[i]>k:
        break
    
    while asum[i]+bsum[j]>k:
        j-=1
        
    ans = max(ans,i+j)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
LR = [list(map(int,input().split())) for i in range(M)]

passable = [1]*(N+1)

for l,r in LR:
    for i in range(l):
        passable[i]=0
    for i in range(r+1, N+1):
        passable[i]=0

print(passable.count(1))

Fixed submission:
N,M = map(int, input().split())
L = [0]*M
R = [0]*M

for i in range(M):
    L[i],R[i] = map(int, input().split())
    
l = max(L)
r = min(R)

print(max(r-l+1,0))
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())

ans=0
for r in range(N//R+1):
    for g in range(N//G+1):
        tmp = R*r+G*g
        if N>=tmp and (N-tmp)%B==0:
            ans+=1
            
print(ans)

Fixed submission:
R,G,B,N = map(int,input().split())

ans=0
for r in range(N//R+1):
    for g in range(N//G+1):
        tmp = R*r+G*g
        if N>=tmp and (N-tmp)%B==0:
            ans+=1
            
print(ans)
Buggy python submission (verdict: Runtime Error):
S = list(input())

ans = 753

for i in range(len(S)-2):
    sa = abs(753-(int(S[i])*100 + int(S[i+1])*10 + int(S[i+2])))
    ans = min(sa,ans)
             
print(ans

Fixed submission:
S = list(input())

ans = 753

for i in range(len(S)-2):
    sa = abs(753-(int(S[i])*100 + int(S[i+1])*10 + int(S[i+2])))
    ans = min(sa,ans)
             
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

if s[0]!='1':
    ans = int(s[0])
else:
    for i in range(min(k,len(s))):
        if s[i]!='1':
            ans = int(s[i])
            break
            
print(ans)

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

ans = 1
for i in range(min(k,len(s))):
    if s[i]!='1':
        ans = int(s[i])
        break
            
print(ans)
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 B-K<i:
        print(i)

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

for i in range(A,min(A+K,B+1)):
    print(i)
    
for i in range(max(A+K,B-K+1),B+1):
    print(i)
Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())

flag = 0
for x in range(N+1):
    if flag > 0:
        break
    for y in range(N-x+1):
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            z = N-x-y
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(N+1):
    if flag > 0:
        break
    for y in range(N-x+1):
        z = N-x-y
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(0,N+1):
    for y in range(0,N-x+1):
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            z = N-x-y
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(N+1):
    if flag > 0:
        break
    for y in range(N-x+1):
        z = N-x-y
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(0,N+1):
    if flag > 0:
        break
    for y in range(0,N-x+1):
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            z = N-x-y
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(N+1):
    if flag > 0:
        break
    for y in range(N-x+1):
        z = N-x-y
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(0,N+1):
    if flag > 0:
        break
    for y in range(0,N-x+1):
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            z = N-x-y
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')

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

flag = 0
for x in range(N+1):
    if flag > 0:
        break
    for y in range(N-x+1):
        z = N-x-y
        if 10000*x+5000*y+1000*z == Y and flag == 0:
            flag+=1
            print(x,y,z)
            break
            
if flag == 0:
    print('-1 -1 -1')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

ans = 0
numcnt = [0]*100001

for i in a:
    numcnt[i]+=1
    
for x in range(max(a)+1):
    dx = [-1,0,1]
    subans = 0
    for i in dx:
        if x+i<0 or x+i>max(a):
            continue
        subans += numcnt[x+i]
        
    ans = max(ans,subans)
    
print(ans)

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

ans = 0
numcnt = {i:0 for i in range(100001)}

for i in a:
    numcnt[i]+=1
    
for x in range(1,100000):
    subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]
        
    ans = max(ans,subans)
    
print(ans)

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

ans = 0
numcnt = [0]*100001

for i in range(max(a)+1):
    numcnt[i]=a.count(i)
    
for x in range(max(a)+1):
    dx = [-1,0,1]
    subans = 0
    for i in dx:
        if x+i<0 or x+i>max(a):
            continue
        subans += numcnt[x+i]
        
    ans = max(ans,subans)
    
print(ans)

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

ans = 0
numcnt = {i:0 for i in range(100001)}

for i in a:
    numcnt[i]+=1
    
for x in range(1,100000):
    subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]
        
    ans = max(ans,subans)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

bar = {}

for i in A:
    if A.count(i)>=2:
        bar[i] = A.count(i)

if len(bar)>=2:
    bar = sorted(bar.items(), reverse=True)
    print(bar[0][0]*bar[1][0])
else:
    print(0)

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

A.sort(reverse = True)
a=0
b=0
cnt = 1
for i in range(1,len(A)):
    if A[i]==A[i-1]:
        cnt+=1
    else:
        cnt=1
        
    if cnt==2:
        if a==0:
            a=A[i]
        elif b==0:
            b=A[i]
        cnt=0
        
        if a*b!=0:
            break

print(a*b)