Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  if i*(i+1)//2>n:
    print('No')
    exit()
  elif i*(i+1)//2==n:break
m=i
a=[[0]*m for _ in range(m)]
i=0
while n>0:
  for j in range(i+1):
    a[i][j]=n
    n-=1
  i+=1
a=a[::-1]
s=[[] for _ in range(m+1)]
for i in range(m):
  s[i]=a[i][:m-i]
  for j in range(i):
    s[i]+=[a[i-1-j][m-i-1]]
for i in range(m):
  s[-1]+=[a[i][m-i-1]]
print('Yes')
print(len(s))
for i in s:
  print(len(i),*i)

Fixed submission:
n=int(input())
for m in range(1,n+1):
  if m*(m+1)//2==n:break
else:
  print('No')
  exit()
a=[]
k=1
for i in range(m):
  b=[0]*m
  for j in range(i+1):
    b[j]=k
    k+=1
  a.append(b)
ans=[]
for i in range(m):
  b=[m]
  for j in range(i+1):
    b.append(a[i][j])
  for k in range(j+1,m):
    b.append(a[k][j])
  ans.append(b)
b=[m]
for i in range(m):
  b.append(a[i][i])
ans.append(b)
print('Yes')
print(len(ans))
for i in ans:
  print(*i)
Buggy python submission (verdict: Runtime Error):
t=Counter(list(input()))


Fixed submission:
from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s,t=list(s.values()),list(t.values())
print("Yes" if sorted(s)==sorted(t) else "No")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
s=list(input())
t=list(input())
n=len(s)
for i in range(n):
  if s.count(s[0])>1:
    if t[0]!=t[s[1:].index(s[0])+1]:
      print('No')
      sys.exit()
  if t.count(t[0])>=2:
    if s[0]!=s[t[1:].index(t[0])+1]:
      print('No')
      sys.exit()
  s.pop(0)
  t.pop(0)
print('Yes')
            

Fixed submission:
from collections import Counter
s=Counter(list(input()))
t=Counter(list(input()))
s,t=list(s.values()),list(t.values())
print("Yes" if sorted(s)==sorted(t) else "No")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
e=[]
flag=0
for i in range(h):
  if i%2:
    for j in range(w-1,-1,-1):
      if a[i][j]%2:
        flag=1
        break
  else:
    for j in range(w):
      if a[i][j]%2:
        flag=1
        break
  if flag:break
else:
  print(0)
  exit()
flag=0
y,x=i,j
while True:
  nx,ny=x,y
  if y%2:
    if x:nx=x-1
    else:ny=y+1
  else:
    if x<w-1:nx=x+1
    else:ny=y+1
  if a[y][x]%2:flag=1-flag
  if flag:e.append((y+1,x+1,ny+1,nx+1))
  if h%2:
    if (ny,nx)==(h-1,w-1):break
  else:
    if (ny,nx)==(h-1,0):break
  x,y=nx,ny
print(len(e))
for i in e:
  print(*i)

Fixed submission:
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
ans=[]
for i in range(h):
  for j in range(w-1):
    if a[i][j]%2:
      a[i][j]-=1
      a[i][j+1]+=1
      ans+=[(i+1,j+1,i+1,j+2)]
for i in range(h-1):
  if a[i][w-1]%2:
    a[i][w-1]-=1
    a[i+1][w-1]+=1
    ans+=[(i+1,w,i+2,w)]
print(len(ans))
for i in ans:
  print(*i)

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
e=[]
flag=0
for i in range(h):
  if i%2:
    for j in range(w-1,-1,-1):
      if a[i][j]%2:
        flag=1
        break
  else:
    for j in range(w):
      if a[i][j]%2:
        flag=1
        break
  if flag:break
else:
  exit()
flag=0
y,x=i,j
while True:
  nx,ny=x,y
  if y%2:
    if x:nx=x-1
    else:ny=y+1
  else:
    if x<w-1:nx=x+1
    else:ny=y+1
  if a[y][x]%2:flag=1-flag
  if flag:e.append((y+1,x+1,ny+1,nx+1))
  if h%2:
    if (ny,nx)==(h-1,w-1):break
  else:
    if (ny,nx)==(h-1,0):break
  x,y=nx,ny
print(len(e))
for i in e:
  print(*i)

Fixed submission:
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
ans=[]
for i in range(h):
  for j in range(w-1):
    if a[i][j]%2:
      a[i][j]-=1
      a[i][j+1]+=1
      ans+=[(i+1,j+1,i+1,j+2)]
for i in range(h-1):
  if a[i][w-1]%2:
    a[i][w-1]-=1
    a[i+1][w-1]+=1
    ans+=[(i+1,w,i+2,w)]
print(len(ans))
for i in ans:
  print(*i)

Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
e=[]
flag=0
for i in range(h):
  if i%2:
    for j in range(w-1,-1,-1):
      if a[i][j]%2:
        flag=1
        break
  else:
    for j in range(w):
      if a[i][j]%2:
        flag=1
        break
  if flag:break
else:
  exit()
flag=0
y,x=i,j
while True:
  nx,ny=x,y
  if y%2:
    if x:nx=x-1
    else:ny=y+1
  else:
    if x<w-1:nx=x+1
    else:ny=y+1
  if a[y][x]%2:flag=1-flag
  if flag:e.append((y,x,ny,nx))
  if h%2:
    if (ny,nx)==(h-1,w-1):break
  else:
    if (ny,nx)==(h-1,0):break
  x,y=nx,ny
print(len(e))
for i in e:
  print(*i)

Fixed submission:
h,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
ans=[]
for i in range(h):
  for j in range(w-1):
    if a[i][j]%2:
      a[i][j]-=1
      a[i][j+1]+=1
      ans+=[(i+1,j+1,i+1,j+2)]
for i in range(h-1):
  if a[i][w-1]%2:
    a[i][w-1]-=1
    a[i+1][w-1]+=1
    ans+=[(i+1,w,i+2,w)]
print(len(ans))
for i in ans:
  print(*i)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input() for i in range(h)]

ans=[]
for i in range(h):
  if s[i]!='.'*w:
    ans.append(s[i])

n=len(ans)
a=['' for i in range(n)]

for i in range(w):
  sm=''
  cnt=0
  for j in range(n):
    sm+=ans[j][i]
    if ans[j][i]!='.':
      cnt+=1
  if cnt!=0:
    for k in range(n):
      a[k]+=ans[k][i]
m=len(a[0])
for i in range(m):
  print(a[i])

Fixed submission:
h,w=map(int,input().split())
s=[input() for i in range(h)]

ans=[]
for i in range(h):
  if s[i]!='.'*w:
    ans.append(s[i])

n=len(ans)
a=['' for i in range(n)]

for i in range(w):
  sm=''
  cnt=0
  for j in range(n):
    sm+=ans[j][i]
    if ans[j][i]!='.':
      cnt+=1
  if cnt!=0:
    for k in range(n):
      a[k]+=ans[k][i]
m=len(a)
for i in range(m):
  print(a[i])
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
if s[:k]=='1'*k:
  print(1)
else:
  for i in s:
    if i!='1':
      print(i)
      break

Fixed submission:
import sys
s=input()
k=int(input())
if k<=100:
  if s[:k]=='1'*k:
    print(1)
    sys.exit()
for i in s:
  if i!='1':
    print(i)
    break
Buggy python submission (verdict: Runtime Error):
s=list(input())
if s[0]!='A':
  print("WA")
elseif s[2:len(s)-1].count("C")!=1:
  print('WA')
else:
  s.remove('A')
  s.remove('C')
  ns=str(s)
  if ns.islower():
    print("AC")
  else:
    print("WA")
  

Fixed submission:
s=list(input())
if s[0]!='A':
  print("WA")
elif s[2:len(s)-1].count("C")!=1:
  print('WA')
else:
  s.remove('A')
  s.remove('C')
  ns=str(s)
  if ns.islower():
    print("AC")
  else:
    print("WA")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

m=1
for i in a:
  m*=i
f=0
m-=1
for i in a:
  f+=m%i  
print(max(f))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
m=1
for i in a:
  m*=i
f=0
m-=1
for i in a:
  f+=m%i  
print(f)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=n
for i in range(n+1):
  t=i
  cnt=0
  while t:
    cnt+=t%6
    t//=6
  j=n-i
  while j:
    cnt+=t%9
    t//=9
  ans=min(ans,cnt)
print(ans)

Fixed submission:
n=int(input())
dp=list(range(n+1))
dp[0]=0
a=[]
b=[]
i=1
while True:
  if 6**i>n:break
  a.append(6**i)
  i+=1
i=1
while True:
  if 9**i>n:break
  b.append(9**i)
  i+=1
for i in a:
  for j in range(i,n+1):
    dp[j]=min(dp[j],dp[j-i]+1)
for i in b:
  for j in range(i,n+1):
    dp[j]=min(dp[j],dp[j-i]+1)
print(dp[n])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
r,l=0,0
s,x=0,0
while l<n:
  while r<n and s+a[r]==x^a[r]:
    s+=a[r]
    x^=a[r]
    r+=1
  ans+=r-l
  s-=a[l]
  x^=a[l]
  if r==l:r+=1
  l+=1
print(ans)

ans=0
for i in range(1,n+1):
  for j in range(i+1,n+2):
    p=0
    q=0
    for k in range(i,j):
      p+=c[k]
      q^=c[k]
    ans+=p==q
    if p==q:print(i-1,j-1)
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
r,l=0,0
s,x=0,0
while l<n:
  while r<n and s+a[r]==x^a[r]:
    s+=a[r]
    x^=a[r]
    r+=1
  ans+=r-l
  s-=a[l]
  x^=a[l]
  if r==l:r+=1
  l+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
r,l=0,0
s,x=0,0
while l<n:
  while s+a[r]==x^a[r]:
    s+=a[r]
    x^=a[r]
    r+=1
  ans+=r-l
  s-=a[l]
  x^=a[l]
  if r==l:r+=1
  l+=1
print(ans)

ans=0
for i in range(1,n+1):
  for j in range(i+1,n+2):
    p=0
    q=0
    for k in range(i,j):
      p+=c[k]
      q^=c[k]
    ans+=p==q
    if p==q:print(i-1,j-1)
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
r,l=0,0
s,x=0,0
while l<n:
  while r<n and s+a[r]==x^a[r]:
    s+=a[r]
    x^=a[r]
    r+=1
  ans+=r-l
  s-=a[l]
  x^=a[l]
  if r==l:r+=1
  l+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
n=len(s)
a=[]
for i in range(n):
  for j in range(1,k+1):
    a=set(a)|set([s[i:i+j]])
a=sorted(a)
print(a[k-1])

Fixed submission:
s=input()
k=int(input())
n=len(s)
a=set([])
for i in range(n):
  for j in range(1,k+1):
    a.add(s[i:i+j])
a=sorted(a)
print(a[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
n=len(s)
a=[]
for i in range(n):
  for j in range(i+1,n+1):
    a=set(a)|set([s[i:j]])
a=sorted(a)
print(a[k-1])

Fixed submission:
s=input()
k=int(input())
n=len(s)
a=set([])
for i in range(n):
  for j in range(1,k+1):
    a.add(s[i:i+j])
a=sorted(a)
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
n-int(input())
x=list(map(int,input().split()))
a=0
b=0
for i in range(n//2):
  a+=max(x)
  x.remove(max(x))
  b+=max(x)
  x.remove(max(x))

if n%2:
  a+=x[0]
dif=b-a
print(dif)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
a=0
b=0
for i in range(n//2):
  a+=max(x)
  x.remove(max(x))
  b+=max(x)
  x.remove(max(x))

if n%2:
  a+=x[0]
dif=a-b
print(dif)
Buggy python submission (verdict: Runtime Error):
n=int(input())
f=0
frag='No'
for i in 8:
  f+=n%(10**(i+1))//10**i
if n%f==0:
  frag='Yes'
print(frag)

Fixed submission:
n=int(input())
f=0
frag='No'
for i in range(8):
  f+=n%(10**(i+1))//10**i
if n%f==0:
  frag='Yes'
print(frag)
Buggy python submission (verdict: Runtime Error):
n=input()
for i in ('+','-'):
  for j in ('+','-'):
    for k in ('+','-'):
      sm=a[0]+i+a[1]+j+a[2]+k+a[3]
      if eval(sm)==7:
        print(sm+'=7')
        exit()

Fixed submission:
a=input()
for i in ('+','-'):
  for j in ('+','-'):
    for k in ('+','-'):
      sm=a[0]+i+a[1]+j+a[2]+k+a[3]
      if eval(sm)==7:
        print(sm+'=7')
        exit()
Buggy python submission (verdict: Runtime Error):
z,y,x=map(int,input())
z-=x
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)

Fixed submission:
z,y,x=map(int,input().split())
z-=x*2+y
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
x,y,z=map(int,input())
z-=x
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)

Fixed submission:
z,y,x=map(int,input().split())
z-=x*2+y
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  if i**2>n:
    ans=(i-1)**2
    break
print(ans)

Fixed submission:
n=int(input())
i=1
while True:
  if i**2>n:
    ans=(i-1)**2
    break
  i+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  if i**2>n:
    ans=(i-1)**2
    break
print(ans)

Fixed submission:
n=int(input())
i=1
while True:
  if i**2>n:
    ans=(i-1)**2
    break
  i+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
sm=0
for i in C:
  b=bisect.bisect_left(B,i)
  for j in B[:b]:
    sm+=bisect.bisect_left(A,j)
print(sm)
  

Fixed submission:
import bisect
n=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
sm=0
for j in B:
  sm+=bisect.bisect_left(A,j)*(n-bisect.bisect_right(C,j))
print(sm)
Buggy python submission (verdict: Runtime Error):
s=input()
t=s.replace('x','')
n=len(t)
if not(n==1 or t[:n//2]==t[(n+1)//2:][::-1]):
  print(-1)
  exit()
n=len(s)
r=n-1
l=0
ans=0
while r>l:
  nr,nl=r,l
  while s[r]=='x':r-=1
  while s[l]=='x':l+=1
  ans+=abs(nr-r-nl+l)
  while s[r]==s[l] and l<r:
    r-=1
    l+=1
print(ans)

Fixed submission:
s=input()
t=s.replace('x','')
n=len(t)
if not(n==1 or t[:n//2]==t[(n+1)//2:][::-1]):
  print(-1)
  exit()
n=len(s)
r=n-1
l=0
ans=0
while r>l:
  nr,nl=r,l
  while s[r]=='x' and r>0:r-=1
  while s[l]=='x' and l<n-1:l+=1
  ans+=abs(nr-r+nl-l)
  while s[r]==s[l] and l<r:
    r-=1
    l+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
f=[]
f.append("."*(w+2))
for i in range(h):
  f.append("."+input()+".")
a=[]*h[]*w
for i in range(1,h+1):
  for j in range(1,w+1):
    if f[i][j]=".":
      dumy=f[i-1][j-1]+f[i-1][j]+f[i-1][j+1]+f[i][j-1]+f[i][j]+f[i][j+1]+f[i+1][j-1]+f[i+1][j]+f[i+1][j+1]
      a[i-1][j-1]=count(dumy.index("#"))
    else:
      a[i-1][j-1]="#"
      
for i in range(h):
  print(a[i])
    
    

Fixed submission:
h,w=map(int,input().split())
f=[]
f.append("."*(w+2))
for i in range(h):
  f.append("."+input()+".")
f.append("."*(w+2))
a=[]
for i in range(1,h+1):
  dumy2=""
  for j in range(1,w+1):
    if f[i][j]==".":
      dumy=f[i-1][j-1]+f[i-1][j]+f[i-1][j+1]+f[i][j-1]+f[i][j]+f[i][j+1]+f[i+1][j-1]+f[i+1][j]+f[i+1][j+1]
      n=dumy.count("#")
      dumy2+=str(n)
    else:
      dumy2+="#"
  a.append(dumy2)
for i in range(h):
  print(a[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
ans=10**19
for i in range(n):
  for j in range(n):
    for k in range(n):
      for l in range(n):
        xl=min(x[i],x[j],x[k],x[l])
        xr=max(x[i],x[j],x[k],x[l])
        yl=min(y[i],y[j],y[k],y[l])
        yh=max(y[i],y[j],y[k],y[l])
        cnt=0
        for c in range(n):
          cnt+=xl<=x[c]<=xr and yl<=y[c]<=yh
        if cnt>=m:ans=min(ans,(xr-xl)*(yh-yl))
print(ans)

Fixed submission:
n,m=map(int,input().split())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
ans=10**19
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      for l in range(k,n):
        xl=min(x[i],x[j],x[k],x[l])
        xr=max(x[i],x[j],x[k],x[l])
        yl=min(y[i],y[j],y[k],y[l])
        yh=max(y[i],y[j],y[k],y[l])
        cnt=0
        for c in range(n):
          cnt+=xl<=x[c]<=xr and yl<=y[c]<=yh
        if cnt>=m:ans=min(ans,(xr-xl)*(yh-yl))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from copy import deepcopy
INF=10**18
n=int(input())
a=[list(map(int,input().split())) for _ in range(n)]
c=deepcopy(a)
for k in range(n):
  for i in range(n):
    for j in range(n):
      c[i][j]=min(c[i][j],c[i][k]+c[k][j])
for i in range(n):
  for j in range(n):
    if a[i][j]!=c[i][j]:
      print(-1)
      exit()
ans=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if k==j or k==i:continue
      if c[i][j]==c[i][k]+c[k][j]:break
    else:ans+=c[i][j]
print(ans//2)

Fixed submission:
n=int(input())
dis=[list(map(int,input().split())) for _ in range(n)]
c=[[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
  for j in range(n):
    c[i][j]=min(dis[i][k]+dis[k][j] for k in range(n))
for i in range(n):
  for j in range(n):
    if c[i][j]!=dis[i][j]:
      print(-1)
      exit()
for i in range(n):
  for j in range(n):
    for k in range(n):
      if i==k or j==k:continue
      if dis[i][j]==dis[i][k]+dis[k][j]:c[i][j]=0
print(sum(sum(c[i]) for i in range(n))//2)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
dp=[0]*(f+1)
w=[]
s=[]
for i in range(f+1):
  if i%(a*100)==0:dp[i]=i
  if i%(b*100)==0:dp[i]=i
  if i>a*100 and dp[i-a*100]:dp[i]=i
  if i>a*100 and dp[i-b*100]:dp[i]=i
for i in dp:
  if i:w.append(i)
m=w[-1]*e//100+1
dp=[0]*(m)
for i in range(m):
  if i%c==0:dp[i]=i
  if i%d==0:dp[i]=i
  if i>c and dp[i-c]:dp[i]=i
  if i>d and dp[i-d]:dp[i]=i
for i in dp:
  if i: s.append(i)
g=0
for i in w:
  for j in s:
    if i+j<=f and g<j/(i+j)<=e/(100+e):
      g=j/(i+j)
      ans=(i+j,j)
print(*ans)

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
dp=[0]*(f+1)
w=[]
s=[]
for i in range(f+1):
  if i%(a*100)==0:dp[i]=i
  if i%(b*100)==0:dp[i]=i
  if i>a*100 and dp[i-a*100]:dp[i]=i
  if i>a*100 and dp[i-b*100]:dp[i]=i
for i in dp:
  if i:w.append(i)
m=w[-1]*e//100+1
dp=[0]*(m)
for i in range(m):
  if i%c==0:dp[i]=i
  if i%d==0:dp[i]=i
  if i>c and dp[i-c]:dp[i]=i
  if i>d and dp[i-d]:dp[i]=i
for i in dp:
  if i: s.append(i)
g=0
ans=(w[0],0)
for i in w:
  for j in s:
    if i+j<=f and g<j/(i+j)<=e/(100+e):
      g=j/(i+j)
      ans=(i+j,j)
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=[]
b=0
for i in range(n):
  j=int(input())
  if j in a:
    a.remove(j)
    b-=1
  else:
    a.append(j)
    b+=1
print(b)

Fixed submission:
from collections import Counter 
n=int(input())
a=Counter([int(input()) for _ in range(n)])
ans=0
for i in a.values():
  ans+=i%2
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
b=[0]*10**9
for i in range(n):
  j=int(input())-1
  if b[j]:
    b[j]=0
  else:
    b[j]=1
print(sum(b))

Fixed submission:
from collections import Counter 
n=int(input())
a=Counter([int(input()) for _ in range(n)])
ans=0
for i in a.values():
  ans+=i%2
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
b=[0]*100000
for i in range(n):
  j=int(input())-1
  if b[j]:
    b[j]=0
  else:
    b[j]=1
print(sum(b))

Fixed submission:
from collections import Counter 
n=int(input())
a=Counter([int(input()) for _ in range(n)])
ans=0
for i in a.values():
  ans+=i%2
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
b=[0]*100000
for i in range(n):
  j=int(input())
  if b[j]:
    b[j]=0
  else:
    b[j]=1
print(sum(b))

Fixed submission:
from collections import Counter 
n=int(input())
a=Counter([int(input()) for _ in range(n)])
ans=0
for i in a.values():
  ans+=i%2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=[]
for i in range(n):
  j=int(input())
  if j in a:
    a.remove(j)
  else:
    a.append(j)
print(len(a))

Fixed submission:
from collections import Counter 
n=int(input())
a=Counter([int(input()) for _ in range(n)])
ans=0
for i in a.values():
  ans+=i%2
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if b<=c or a=>d:
  t=0
else:
  if a<=c:
    if b<d:
      t=b-c
    else:
      t=d-c
  else:
    if c<d:
      t=b-a
    else:
      t=d-a
print(t)
  

Fixed submission:
a,b,c,d=map(int,input().split())
if b<=c or a>=d:
  t=0
else:
  if a<=c:
    if b<d:
      t=b-c
    else:
      t=d-c
  else:
    if b<d:
      t=b-a
    else:
      t=d-a
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
t=[int(input()) for _ in range(n)]  

mt=t[0]
mx=t[0]
for i in t:
  for j in range(min(i,mx),0,-1):
    if i%j==0 and mx%j==0:
      mt=j
      break
  mx=i*mx//mt

print(mx)  

Fixed submission:
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
print(lcm_list([int(input()) for _ in range(n)]))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
t=[int(input()) for _ in range(n)]  
mt=max(t)
for i in range(mt,10**18+1):
  for j in t:
    if i%j:
      break
  else:
    print(i)
    break

  

Fixed submission:
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
print(lcm_list([int(input()) for _ in range(n)]))
Buggy python submission (verdict: Runtime Error):
s=input()
a=a[0]+str(len(s)-2)+a[len(s)-1]
print(a)

Fixed submission:
s=input()
a=s[0]+str(len(s)-2)+s[len(s)-1]
print(a)
Buggy python submission (verdict: Runtime Error):
k=int(input())
n=min(k,50)
a=list(range(n))
for i in range(n):
  a[i]+=(k+n-1)//n
for i in range(k%n):
  a[i]+=n
  for j in range(n):
    if i==j:continue
    a[j]-=1
print(n)
print(*a)

Fixed submission:
k=int(input())
n=min(k+2,50)
a=list(range(n))
for i in range(n):
  a[i]+=k//n
for i in range(k%n):
  a[i]+=n
  for j in range(n):
    if i==j:continue
    a[j]-=1
print(n)
print(*a)

Buggy python submission (verdict: Runtime Error):
k=int(input())
n=min(k,50)
a=list(range(n))
for i in range(n):
  a[i]+=(k+n-1)//n
for i in range(k%n):
  a[i]+=n
  for j in range(n):
    if i==j:continue
    a[i]-=1
print(n)
print(*a)

Fixed submission:
k=int(input())
n=min(k+2,50)
a=list(range(n))
for i in range(n):
  a[i]+=k//n
for i in range(k%n):
  a[i]+=n
  for j in range(n):
    if i==j:continue
    a[j]-=1
print(n)
print(*a)
Buggy python submission (verdict: Runtime Error):
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=s1[-1]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2))

Fixed submission:
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=[s1[-1]]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2))

Buggy python submission (verdict: Runtime Error):
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=s1[-1]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2)

Fixed submission:
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=[s1[-1]]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
while(1):
  if a[i]==1:
    frag=-1
    break
  elif a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)  

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
frag=-1
for j in range(n):
  if a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
while(1):
  if a[i]==1:
    frag=-1
    break
  elif a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)  

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
frag=-1
for j in range(n):
  if a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  a.appent(int(input()))
i=0
count=1
while(1):
  if a[i]==1:
    frag=-1
    break
  elif a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)  

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
frag=-1
for j in range(n):
  if a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  a.appent(int(input))
i=0
count=1
while(1):
  if a[i]==1:
    frag=-1
    break
  elif a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)  

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
frag=-1
for j in range(n):
  if a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)