Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
tmp=[]
ans=""
for i in range(n-1,-1,-1):
  num = i+1
  total=0
  for j in range(i,n):
    if (j+1)%(i+1)==0:
      total+=b[j]
  if total%2==a[i]:
    b[i]=0
  else:
    b[i]=1
    tmp.append(i+1)

print(sum(b))
tmp = sorted(tmp)

for i in range(len(tmp)):
  ans += str(tmp[i]) + " "
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
tmp=[]
ans=""
for i in range(n-1,-1,-1):
  num = i+1
  total=0
  j=1
  while (i+1)*j <= n:
    total+=b[((i+1)*j)-1]
    j+=1  
  if total%2==a[i]:
    b[i]=0
  else:
    b[i]=1
    tmp.append(i+1)

print(sum(b))
print(str(sorted(tmp)).replace(',','').replace('[','').replace(']',''))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
tmp=[]
ans=""
for i in range(n-1,-1,-1):
  num = i+1
  total=0
  for j in range(i,n):
    if (j+1)%(i+1)==0:
      total+=b[j]
  if total%2==a[i]:
    b[i]=0
  else:
    b[i]=1
    tmp.append(i+1)

print(sum(b))
tmp = sorted(tmp)

for i in range(len(tmp)):
  ans += str(tmp[i]) + " "
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
tmp=[]
ans=""
for i in range(n-1,-1,-1):
  num = i+1
  total=0
  j=1
  while (i+1)*j <= n:
    total+=b[((i+1)*j)-1]
    j+=1  
  if total%2==a[i]:
    b[i]=0
  else:
    b[i]=1
    tmp.append(i+1)

print(sum(b))
print(str(sorted(tmp)).replace(',','').replace('[','').replace(']',''))

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

def f(n,m):
  tmp=[]
  for i in range(n,m+1):
    if i%n==0:
      tmp.append(i)
  return tmp
def ff(arr_1):
  tmp=0
  for i in arr_1:
    tmp+=b[i-1]
  tmp = tmp%2
  return tmp
b = [0]*n
for i in range(n-1,-1,-1):
  num = f(i+1,n)
  if len(num)==1:
    b[i] = a[i]
  else:
    if ff(num[1:])==a[i]:
      b[i]=0
    else:
      b[i]=1
print(sum(b))
ans=""
for i in range(n):
  if b[i]==1:
    ans+=str(i+1)+" "
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
tmp=[]
ans=""
for i in range(n-1,-1,-1):
  num = i+1
  total=0
  j=1
  while (i+1)*j <= n:
    total+=b[((i+1)*j)-1]
    j+=1  
  if total%2==a[i]:
    b[i]=0
  else:
    b[i]=1
    tmp.append(i+1)

print(sum(b))
print(str(sorted(tmp)).replace(',','').replace('[','').replace(']',''))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
nm = input().split()
n = int(nm[0])
m = int(nm[1])
lr = [input().split() for i in range(m)]
l = [int(lr[i][0]) for i in range(m)]
r = [int(lr[i][1]) for i in range(m)]

card = [i for i in range(n + 1)]
if m == 1:
  print(len(card[l[0]:r[0]]) + 1)
  sys.exit()
card2 = []
card_duplicate = []
for i in range(m):
  #card2 = card_duplicate
  card2.extend(card[l[i]-1:r[i]])

card_duplicate = [x for x in set(card2) if card2.count(x) == m]

print(len(card_duplicate))

Fixed submission:
nm = input().split()
n = int(nm[0])
m = int(nm[1])
lr = [input().split() for i in range(m)]
l = [int(lr[i][0]) for i in range(m)]
r = [int(lr[i][1]) for i in range(m)]
a = min(r) -max(l) + 1
if a >= 0:
  print(a)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
b = input()
print('A') if b == 'T'
print('T') if b == 'A'
print('C') if b == 'G'
print('G') if b == 'C'


Fixed submission:
b = input()
tmp = ['A','T','A','C','G','C']
for i in range(6):
  if b == tmp[i]:
    print(tmp[i+1])
    break

Buggy python submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = input()
lr = [list(map(int,input().split())) for i in range(q)]
for i in range(q):
  print(len(s[lr[i][0]-1:lr[i][1]].replace('AC',':').split(':'))-1)

Fixed submission:
b = input()
tmp = ['A','T','A','C','G','C']
for i in range(6):
  if b == tmp[i]:
    print(tmp[i+1])
    break
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
old_length=-1
for i in range(n):
  if old_length==len(s):
    break
  old_length=len(s)
  s=s.replace('01','').replace('10','').replace('01','').replace('10','')
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
old_length=-1
for i in range(n):
  if old_length==len(s):
    break
  old_length=len(s)
  s=s.replace('0101','').replace('1010','').replace('01','').replace('10','')
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
old_length=-1
for i in range(n):
  if old_length==len(s):
    break
  old_length=len(s)
  s=s.replace('01','').replace('10','')
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
old_length=-1
for i in range(n):
  if old_length==len(s):
    break
  old_length=len(s)
  s=s.replace('01','').replace('10','')
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
flg=1
ans=0
while flg>0:
  flg=0
  for i in range(len(s)-1):
    if s[i]!=s[i+1]:
      s = s[:i]+s[i+2:]
      flg=1
      ans+=2
      break
print(ans)

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
flg=1
while flg>0:
  flg=0
  for i in range(len(s)-1):
    if s[i]!=s[i+1]:
      s = s[:i]+s[i+2:]
      flg=1
      break
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
for i in range(n):
  if '01' not in s and '10' not in s:
    break
  s=s.replace('01','')
  s=s.replace('10','')
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
for i in range(n):
  s=s.replace('01','')
  s=s.replace('10','')
print(n-len(s))

Fixed submission:
s = input()
c1,c2=s.count('0'),s.count('1'),
print(min(c1,c2)*2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
flg=1
while flg>0:
  flg=0
  for i in range(n):
    j = a.index(max(a))
    if a[j] % a[i] > 0:
      a[j] = a[j] % a[i]
      flg=1
print(min(a))

Fixed submission:
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
n = input()
a = list(map(int,input().split()))
print(gcd_list(a))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**9]*n
dp[0]=0

for i in range(n):
  a=max(0,i-k)
  for j in range(a,i):
    dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp=[100000000000000000]*n
dp[0]=0
for i in range(1,n):
  for j in range(k):
    if i > j:
      dp[i] = min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[np.inf]*n
dp[0]=0

for i in range(n):
  a=max(0,i-k)
  for j in range(a,i):
    dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp=[100000000000000000]*n
dp[0]=0
for i in range(1,n):
  for j in range(k):
    if i > j:
      dp[i] = min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp=[1000000000]*n
dp[0]=0
for i in range(1,n):
  for j in range(k):
    if i > j:
      dp[i] = min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp=[100000000000000000]*n
dp[0]=0
for i in range(1,n):
  for j in range(k):
    if i > j:
      dp[i] = min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp=[np.inf]*n
dp[0]=0
for i in range(1,n):
  for j in range(k):
    if i > j:
      dp[i] = min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp=[100000000000000000]*n
dp[0]=0
for i in range(1,n):
  for j in range(k):
    if i > j:
      dp[i] = min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
#a%kを決めればb%kとc%kが決まる
cnt=0
for a_mod in range(k):
  if a_mod==0:
    b_mod,c_mod=0,0
  else:
    b_mod=k-a_mod
    c_mod=k-b_mod
    if c_mod!=k-a_mod:
      continue
  for a in range(a_mod,n+1,k):
    for b in range(b_mod,n+1,k):
      for c in range(c_mod,n+1,k):
        if a!=0 and b!=0 and c!=0:
          cnt+=1
print(cnt)


Fixed submission:
n,k=map(int,input().split())
#a%kを決めればb%kとc%kが決まる
cnt=0
ans=0

for a_mod in range(k):
  if a_mod==0:
    b_mod,c_mod=0,0
  else:
    b_mod=k-a_mod
    c_mod=k-b_mod
    if c_mod!=k-a_mod:
      continue

  cnt_a=0
  for a in range(a_mod,n+1,k):
    if a!=0:
      cnt_a+=1
  ans+=cnt_a**3
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
#a%kを決めればb%kとc%kが決まる
cnt=0
for a_mod in range(k):
  if a_mod==0:
    b_mod,c_mod=0,0
  else:
    b_mod=k-a_mod
    c_mod=k-b_mod
    if c_mod!=k-a_mod:
      continue
  for a in range(a_mod,n+1,k):
    for b in range(b_mod,n+1,k):
      for c in range(c_mod,n+1,k):
        if a!=0 and b!=0 and c!=0:
          cnt+=1
print(cnt)

Fixed submission:
n,k=map(int,input().split())
#a%kを決めればb%kとc%kが決まる
cnt=0
ans=0

for a_mod in range(k):
  if a_mod==0:
    b_mod,c_mod=0,0
  else:
    b_mod=k-a_mod
    c_mod=k-b_mod
    if c_mod!=k-a_mod:
      continue

  cnt_a=0
  for a in range(a_mod,n+1,k):
    if a!=0:
      cnt_a+=1
  ans+=cnt_a**3
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
aa = [int(a[i]) for i in range(n)]
b = 1
for i in range(n):
  s = list(str(aa[i]))
  ss = int(s[-1])
  if ss == 0 or ss == 2 or ss == 4 or ss == 6 or ss == 8:
  	b = b * aa[i]

c = 0
cnt = 0
while c < 1:
  if b % 2 == 0:
    b = b // 2
    cnt = cnt + 1
  else:
    c = 1
print(cnt)



Fixed submission:
n = int(input())
a = input().split()
aa = [int(a[i]) for i in range(n)]
b = 1
for i in range(n):
  s = list(str(aa[i]))
  ss = int(s[-1])
  if ss == 0 or ss == 2 or ss == 4 or ss == 6 or ss == 8:
  	b = b * aa[i]

c = 0
cnt = 0
while c < 1:
  if b % 2 == 0:
    b = b // 2
    cnt = cnt + 1
  else:
    c = 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
aa = [int(a[i]) for i in range(n)]
b = 1
for i in range(n):
  b = b * aa[i]
c = 0
cnt = 0
while c < 1:
  if b % 2 == 0:
    b = b // 2
    cnt = cnt + 1
  else:
    c = 1
print(cnt)

Fixed submission:
n = int(input())
a = input().split()
aa = [int(a[i]) for i in range(n)]
b = 1
for i in range(n):
  s = list(str(aa[i]))
  ss = int(s[-1])
  if ss == 0 or ss == 2 or ss == 4 or ss == 6 or ss == 8:
  	b = b * aa[i]

c = 0
cnt = 0
while c < 1:
  if b % 2 == 0:
    b = b // 2
    cnt = cnt + 1
  else:
    c = 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
w=list(map(int,list(s.replace('W','1').replace('E','0'))))
e=list(map(int,list(s.replace('E','1').replace('W','0'))))
ans=10**6
for i in range(n):
  mukihenko=sum(w[:i])+sum(e[i+1:])
  ans=min(mukihenko,ans)
print(ans)

Fixed submission:
import collections
n=int(input())
s=list(input())
ans=10**6
tmp=collections.Counter(s[1:])['E']
ans=min(tmp,ans)
i=1
while i<n:
  if s[i-1]=='W':
    tmp+=1
  if s[i]=='E':
    tmp-=1
  ans=min(tmp,ans)
  i+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=list(map(int,input().split()))
m=n//2 - 1
for i in range(n):
  a=sorted(x[:i]+x[i+1:])
  print(a[m])

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
arr=sorted(x)[n//2-1:n//2+1]
for i in range(n):
  if x[i]<=arr[0]:
    print(arr[1])
  elif x[i]>=arr[1]:
    print(arr[0])

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

def c(arr):
  arr.sort(reverse=True)
  l=len(arr)
  num=(l+1)//2 - 1
  return arr[num]

for i in range(n):
  a=x[:i]+x[i+1:]
  print(c(a))

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
arr=sorted(x)[n//2-1:n//2+1]
for i in range(n):
  if x[i]<=arr[0]:
    print(arr[1])
  elif x[i]>=arr[1]:
    print(arr[0])
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())
tmp=[]

if a+k<b+1:
  e = a+k
else:
  e = b+1
for i in range(a,e):
  tmp.append(i)

if a<b-k+1:
  f = b-k+1
else:
  f = a
for i in range(f,b+1):
  tmp.append(i)

ans = sorted(set(tmp))
for i in ans:
  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())
tmp=[]

if a+k<b+1:
  e = a+k
else:
  e = b+1
for i in range(a,e):
  tmp.append(i)

if a<b-k+1:
  f = b-k+1
else:
  f = a
for i in range(f,b+1):
  tmp.append(i)

ans = sorted(set(tmp))
for i in ans:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n,goukei = map(int, input().split())
flg = 0
xmax = goukei // 10000
for x in range(0,xmax+1):
  if flg == 1:
    break
  ymax = (goukei-x*10000) // 5000
  for y in range(0, ymax+1):
    ztmp = goukei - (x*10000)- (y*5000)
    if ztmp % 1000 == 0:
      z = ztmp // 1000
      sumxyz = x+y+z
      if sumxyz == n:
        flg = 1
        xx = x
        yy = y
        zz = z
        break
if flg == 0:
  print(-1,-1,-1)
else:
  print(xx,yy,zz)

Fixed submission:
n,goukei = map(int, input().split())
flg = 0
xmax = goukei // 10000
for x in range(0,xmax+1):
  if flg == 1:
    break
  ymax = (goukei-x*10000) // 5000
  for y in range(0, ymax+1):
    ztmp = goukei - (x*10000)- (y*5000)
    if ztmp % 1000 == 0:
      z = ztmp // 1000
      sumxyz = x+y+z
      if sumxyz == n:
        flg = 1
        xx = x
        yy = y
        zz = z
        break
if flg == 0:
  print(-1,-1,-1)
else:
  print(xx,yy,zz)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
b=list(set(a))

arr=[]
for i in b:
  arr+=[[a.count(i),i]]

arr=sorted(arr)

d=len(b)-k
cnt=0
for i in range(d):
  cnt+=arr[i][0]
print(cnt)

Fixed submission:
import collections

n,k=map(int,input().split())
a=list(map(int,input().split()))
now_k=len(set(a))
d=now_k-k
arr=collections.Counter(a).most_common()
#print(arr)
b=sorted([arr[i][1] for i in range(now_k)])
#print(b)
cnt=now_k
cnt2=0
flg=0
for i in b:
  cnt-=1
  cnt2+=i
  if cnt==k:
    print(cnt2)
    flg=1
    break
if flg==0:
  print(0)

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

arr=[]
for i in b:
  arr+=[[a.count(i),i]]

arr=sorted(arr)

d=len(b)-k
cnt=0
for i in range(d):
  cnt+=arr[i][0]
print(cnt)

Fixed submission:
import collections

n,k=map(int,input().split())
a=list(map(int,input().split()))
now_k=len(set(a))
d=now_k-k
arr=collections.Counter(a).most_common()
#print(arr)
b=sorted([arr[i][1] for i in range(now_k)])
#print(b)
cnt=now_k
cnt2=0
flg=0
for i in b:
  cnt-=1
  cnt2+=i
  if cnt==k:
    print(cnt2)
    flg=1
    break
if flg==0:
  print(0)

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

arr=[]
for i in b:
  arr+=[[i,a.count(i)]]

arr.sort(key=lambda x: x[1])

d=len(b)-k
cnt=0
for i in range(d):
  cnt+=arr[i][1]
print(cnt)

Fixed submission:
import collections

n,k=map(int,input().split())
a=list(map(int,input().split()))
now_k=len(set(a))
d=now_k-k
arr=collections.Counter(a).most_common()
#print(arr)
b=sorted([arr[i][1] for i in range(now_k)])
#print(b)
cnt=now_k
cnt2=0
flg=0
for i in b:
  cnt-=1
  cnt2+=i
  if cnt==k:
    print(cnt2)
    flg=1
    break
if flg==0:
  print(0)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
f=0
e=5
flg=0
while e<=len(s):
  tmp=s[f:e]
  for i in range(len(t)):
    if tmp[i]!=t[i] and tmp[i]!='?':
      break
    if i==len(t)-1:
      ans=s[:f]+t+s[e:]
      flg=1
  f+=1
  e+=1
if flg==0:
  print('UNRESTORABLE')
else:
  print(ans.replace('?','a'))

Fixed submission:
s=input()
t=input()
f=0
e=len(t)
flg=0
while e<=len(s):
  tmp=s[f:e]
  for i in range(len(t)):
    if tmp[i]!=t[i] and tmp[i]!='?':
      break
    if i==len(t)-1:
      ans=s[:f]+t+s[e:]
      flg=1
  f+=1
  e+=1
if flg==0:
  print('UNRESTORABLE')
else:
  print(ans.replace('?','a'))

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
f=0
e=5
flg=0
while e<=len(s):
  tmp=s[f:e]
  for i in range(len(t)):
    if tmp[i]!=t[i] and tmp[i]!='?':
      break
    if i==len(t)-1:
      s=s[:f]+t+s[e:]
      flg=1
      print(s.replace('?','a'))
  f+=1
  e+=1
if flg==0:
  print('UNRESTORABLE')

Fixed submission:
s=input()
t=input()
f=0
e=len(t)
flg=0
while e<=len(s):
  tmp=s[f:e]
  for i in range(len(t)):
    if tmp[i]!=t[i] and tmp[i]!='?':
      break
    if i==len(t)-1:
      ans=s[:f]+t+s[e:]
      flg=1
  f+=1
  e+=1
if flg==0:
  print('UNRESTORABLE')
else:
  print(ans.replace('?','a'))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
s = list(set(a))

cnt=0
for i in s:
  if a.count(i)%2==1:
    cnt+=1
print(cnt)

Fixed submission:
import collections
n=int(input())
a=[int(input()) for i in range(n)]
s=list(collections.Counter(a).values())
cnt=0
for i in s:
  if i%2!=0:
    cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
s = list(set(a))

cnt=0
for i in s:
  if a.count(i)%2==1:
    cnt+=1
print(cnt)

Fixed submission:
import collections
n=int(input())
a=[int(input()) for i in range(n)]
s=list(collections.Counter(a).values())
cnt=0
for i in s:
  if i%2!=0:
    cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]

s = list(set(a))
m=len(s)
cnt=0
for i in range(m):
  if a.count(s[i])%2==1:
    cnt+=1
print(cnt)

Fixed submission:
import collections
n=int(input())
a=[int(input()) for i in range(n)]
s=list(collections.Counter(a).values())
cnt=0
for i in s:
  if i%2!=0:
    cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]

s = list(set(a))
b=[0]*len(s)
for i in range(len(s)):
  b[i]=a.count(s[i])

cnt=0
for i in range(len(s)):
  if b[i]%2==1:
    cnt+=1
print(cnt)

Fixed submission:
import collections
n=int(input())
a=[int(input()) for i in range(n)]
s=list(collections.Counter(a).values())
cnt=0
for i in s:
  if i%2!=0:
    cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]

s = list(set(a))
b=[0]*len(s)
for i in range(len(s)):
  b[i]=a.count(s[i])

cnt=0
for i in range(len(s)):
  if b[i]%2==1:
    cnt+=1
print(cnt)

Fixed submission:
import collections
n=int(input())
a=[int(input()) for i in range(n)]
s=list(collections.Counter(a).values())
cnt=0
for i in s:
  if i%2!=0:
    cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=10**100
for i in range(1,n):
  x=a[:i]
  y=a[i:]
  ans=min(ans,abs(sum(x)-sum(y)))
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
x=a[0]
y=sum(a[1:])
ans=abs(x-y)
for i in range(1,n-1):
  x+=a[i]
  y-=a[i]
  ans=min(ans,abs(x-y))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(input().split())
b=''
if n%2==0:
  for i in range(n):
    if i%2==0:
      b+=a[i]+' '
    else:
      b=a[i]+' '+b
else:
  for i in range(n):
    if i%2!=0:
      b+=a[i]+' '
    else:
      b=a[i]+' '+b
      
print(b[:-1])

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=''
if n%2==0:
  for i in range(n):
    if i%2==0:
      b+=str(a[i])+' '
    else:
      b=str(a[i])+' '+b
else:
  for i in range(n):
    if i%2!=0:
      b+=str(a[i])+' '
    else:
      b=str(a[i])+' '+b
      
print(b[:-1])

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=''
if n%2==0:
  for i in range(n):
    if i%2==0:
      b+=str(a[i])+' '
    else:
      b=str(a[i])+' '+b
else:
  for i in range(n):
    if i%2!=0:
      b+=str(a[i])+' '
    else:
      b=str(a[i])+' '+b
      
print(b[:-1])

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[]
if n%2==0:
  for i in range(n):
    if i%2==0:
      b+=[a[i]]
    else:
      b=[a[i]]+b
else:
  for i in range(n):
    if i%2!=0:
      b+=[a[i]]
    else:
      b=[a[i]]+b

ans=''
for i in range(n):
  if i==n-1:
    ans+=str(b[i])
  else:
    ans+=str(b[i])+' '
print(ans)

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  b+=[a[i]]
  b=b[::-1]
ans=""
for i in range(n):
  if i<n-1:
    ans+=str(b[i])+' '
  else:
    ans+=str(b[i])
print(ans)

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:
  b=a[-1::-2]+a[0::2]
else:
  b=a[-1::-2]+a[1::2]
ans=''
for i in range(n):
  ans+=b[i]+' '
print(ans[:-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
tmp=[]
i=1
while i>0:
  i=a[i-1]
  if i in tmp:
    print(-1)
    break
  tmp+=[i]
  if i==2:
    print(len(tmp))
    break

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
tmp=[]
i=1
cnt=0
while cnt<=n:
  i=a[i-1]
  cnt+=1
  if i==2:
    print(cnt)
    break
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
l = []
for i in range(n):
  l+=[ab[i][0]]*(ab[i][1])
l.sort()
print(l[k-1])

Fixed submission:
n,k = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
ab.sort()
tmp=0
i=0

while tmp<k:
  tmp+=ab[i][1]
  hoge=ab[i][0]
  i+=1

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

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9 + 7))

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

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9 + 7))