Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
# https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

table = [0] * n
for i in range(2, n+1):
  p = prime_factorize(i)
  for pi in p:
    table[pi] += 1
ans = 1
for t in table:
  ans *= t+1
print(ans)
  



Fixed submission:
n = int(input())
mod = 10**9+7
# https://note.nkmk.me/python-prime-factorization/
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

table = [0] * (n+1)
for i in range(2, n+1):
  p = prime_factorize(i)
  for pi in p:
    table[pi] += 1
ans = 1
for t in table:
  ans = ans * (t+1) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
sx, sy, tx, ty = map(int, input().split())

ans = ""

ans += "U" * (ty - sy) + "R" * (tx - sx)
ans += "D" * (ty - sy) + "L" * (tx - sx)
ans += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
ans += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
print(ans)sx, sy, tx, ty = map(int, input().split())

ans = ""

ans += "U" * (ty - sy) + "R" * (tx - sx)
ans += "D" * (ty - sy) + "L" * (tx - sx)
ans += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
ans += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
print(ans)

Fixed submission:
sx, sy, tx, ty = map(int, input().split())

ans = ""

ans += "U" * (ty - sy) + "R" * (tx - sx)
ans += "D" * (ty - sy) + "L" * (tx - sx)
ans += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
ans += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
print(ans)
Buggy python submission (verdict: Runtime Error):
N, D = [int (x) for x in input().split()]
X = N / (2 * D + 1)
if (X.is_integer()) print(X)
else print(X + 1)

Fixed submission:
N, D = (int(x) for x in input().split())
X = N / (2 * D + 1)
#print(X)
if (X.is_integer()):
  print(int(X))
else:
  print(int(X) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=1
flag=0
for i in range(N):
  ans*=A[i]
  if ans>10**18:
    flag=1
  
if ans==0:
  flag=0
if flag==0:
  print(ans)
else:
  print("-1")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
  if A[i]==0:
    flag=1
sflag=0
ans=1
for i in range(N):
  ans*=A[i]
  if ans>10**18:
    sflag=1
    break
  if sflag==1:
    break
if sflag==0:
  print(ans)
elif sflag==1 and flag==1:
  print("0")
else:
  print("-1")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=1
flag=0
sum_=0
for i in range(N+1):
  sum_+=A[i]
node=2
if A[0]>0:
  flag=1
  
sum_-=A[1]
for i in range(1,N+1):
  if i!=N and node-A[i]<=0:
    flag=1
  elif i!=N:
    sum_-=A[i+1]
    ans+=node
    if 2*(node-A[i])-A[i+1]<=sum_:
      node=2*(node-A[i])
    else:
      node=sum_+A[i+1]   
  else:
    ans+=A[i]

if flag==1:
  print("-1")
elif flag==2:
  print("1")
else:
  print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=1
flag=0
sum_=0
for i in range(N+1):
  sum_+=A[i]
node=2
if A[0]>0:
  flag=1
  if A==[1] and N==0:
    flag=2
if N!=0:
  sum_-=A[1]
for i in range(1,N+1):
  if i!=N and node-A[i]<=0:
    flag=1
  elif i!=N:
    sum_-=A[i+1]
    ans+=node
    if 2*(node-A[i])-A[i+1]<=sum_:
      node=2*(node-A[i])
    else:
      node=sum_+A[i+1]   
  else:
    if node-A[i]<0:
      flag=1
    else:
      ans+=A[i]
if N==0 and A==[0]:
  flag=1

if flag==1:
  print("-1")
elif flag==2:
  print("1")
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=1
flag=0
sum_=0
for i in range(N+1):
  sum_+=A[i]
node=2
if A[0]>0:
  flag=1
  if A==[1] and N==0:
    flag==2
sum_-=A[1]
for i in range(1,N+1):
  if i!=N and node-A[i]<=0:
    flag=1
  elif i!=N:
    sum_-=A[i+1]
    ans+=node
    if 2*(node-A[i])-A[i+1]<=sum_:
      node=2*(node-A[i])
    else:
      node=sum_+A[i+1]   
  else:
    ans+=A[i]

if flag==1:
  print("-1")
elif flag==2:
  print("1")
else:
  print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=1
flag=0
sum_=0
for i in range(N+1):
  sum_+=A[i]
node=2
if A[0]>0:
  flag=1
  if A==[1] and N==0:
    flag=2
if N!=0:
  sum_-=A[1]
for i in range(1,N+1):
  if i!=N and node-A[i]<=0:
    flag=1
  elif i!=N:
    sum_-=A[i+1]
    ans+=node
    if 2*(node-A[i])-A[i+1]<=sum_:
      node=2*(node-A[i])
    else:
      node=sum_+A[i+1]   
  else:
    if node-A[i]<0:
      flag=1
    else:
      ans+=A[i]
if N==0 and A==[0]:
  flag=1

if flag==1:
  print("-1")
elif flag==2:
  print("1")
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
l=[]
for i in range (N):
  l.append(list(map(int,input().split())))
ans=10000000
for i in range(2**N):
  score=[0]*M
  coin=0
  for j in range(N):
    if i>=2**(N-1-j):
      for p in range(M):
        score[p]+=l[j][p+1]
      coin+=l[j][0]
      i-=2**(N-1-j)
  flag=0
  for q in range(M):
    if score[q]<X:
      flag=1
  if flag==0:
    if ans>coin:
      ans=coin
if ans=10000000:
  print("-1")
else:
  print(ans)

Fixed submission:
N,M,X=map(int,input().split())
l=[]
for i in range (N):
  l.append(list(map(int,input().split())))
ans=10000000
for i in range(2**N):
  score=[0]*M
  coin=0
  for j in range(N):
    if i>=2**(N-1-j):
      for p in range(M):
        score[p]+=l[j][p+1]
      coin+=l[j][0]
      i-=2**(N-1-j)
  flag=0
  for q in range(M):
    if score[q]<X:
      flag=1
  if flag==0:
    if ans>coin:
      ans=coin
if ans==10000000:
  print("-1")
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
l=[]
for i in range (N):
  l.append(list(map(int,input().split())))
ans=0
for i in range(2**N):
  score=[0]*M
  coin=0
  for j in range(N):
    if i>=2**(N-1-j):
      for p in range(M):
        score[p]+=l[j][p+1]
        coin+=l[j][0]
      i-=2**(N-1-j)
  flag=0
  for q in range(M):
    if score(q)<X:
      flag=1
  if flag==0:
    if ans<coin:
      ans=coin
print(coin)

Fixed submission:
N,M,X=map(int,input().split())
l=[]
for i in range (N):
  l.append(list(map(int,input().split())))
ans=10000000
for i in range(2**N):
  score=[0]*M
  coin=0
  for j in range(N):
    if i>=2**(N-1-j):
      for p in range(M):
        score[p]+=l[j][p+1]
      coin+=l[j][0]
      i-=2**(N-1-j)
  flag=0
  for q in range(M):
    if score[q]<X:
      flag=1
  if flag==0:
    if ans>coin:
      ans=coin
if ans==10000000:
  print("-1")
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
flag=0
now=0
i=0
count=0
c=[0]*N
r=[0]
c[0]=1
while flag==0:
  now=A[now]-1
  count+=1
  if count==K:
    flag=1
  elif c[now]==1:
    flag=2
  c[now]=1
  r.append(now)
if flag==1:
  print(now+1)
else:
  o=[i for i, x in enumerate(r) if x == now]
  print(A[r[K%(o[1]-o[0])]+o[0]-1])

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
flag=0
now=0
i=0
count=0
c=[0]*N
r=[0]
c[0]=1
while flag==0:
  now=A[now]-1
  count+=1
  if count==K:
    flag=1
  elif c[now]==1:
    flag=2
  c[now]=1
  r.append(now)
if flag==1:
  print(now+1)
else:
  o=[i for i, x in enumerate(r) if x == now]
  print(r[(K-o[0])%(o[1]-o[0])+o[0]]+1)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
flag=0
now=0
i=0
count=0
c=[0]*N
r=[0]
c[0]=1
while flag==0:
  now=A[now]-1
  count+=1
  if count==K:
    flag=1
  elif c[now]==1:
    flag=2
  c[now]=1
  r.append(now)
print(r)
if flag==1:
  print(now+1)
else:
  o=[i for i, x in enumerate(r) if x == now]
  print(A[r[K%(o[1]-o[0])]+o[0]-1])

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
flag=0
now=0
i=0
count=0
c=[0]*N
r=[0]
c[0]=1
while flag==0:
  now=A[now]-1
  count+=1
  if count==K:
    flag=1
  elif c[now]==1:
    flag=2
  c[now]=1
  r.append(now)
if flag==1:
  print(now+1)
else:
  o=[i for i, x in enumerate(r) if x == now]
  print(r[(K-o[0])%(o[1]-o[0])+o[0]]+1)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
flag=0
now=0
i=0
count=0
c=[0]*N
r=[0]
while flag==0:
  now=A[now]-1
  count+=1
  if count==K:
    flag=1
  elif c[now]==1:
    flag=2
  c[now]=1
  r.append(now)
print(r)
if flag==1:
  print(now+1)
else:
  o=[i for i, x in enumerate(r) if x == now]
  print(A[r[K%(o[1]-o[0])]+o[0]-1])

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
flag=0
now=0
i=0
count=0
c=[0]*N
r=[0]
c[0]=1
while flag==0:
  now=A[now]-1
  count+=1
  if count==K:
    flag=1
  elif c[now]==1:
    flag=2
  c[now]=1
  r.append(now)
if flag==1:
  print(now+1)
else:
  o=[i for i, x in enumerate(r) if x == now]
  print(r[(K-o[0])%(o[1]-o[0])+o[0]]+1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if D<N:
  for i in range(1,D+1):
    if (i%B)*A/B-(A*i)%B/B>maxi:
      maxi=(i%B)*A/B-(A*i)%B/B
      if maxi==A*(B-1)/B:
        break
else:
  for i in range(1,N+1):
    if (i%B)*A/B-(A*i)%B/B>maxi:
      maxi=(i%B)*A/B-(A*i)%B/B
      if maxi==A*(B-1)/B:
        break
print(int(maxi))

Fixed submission:
import math
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if B-1<=N:
  print(int((B-1)%B*A/B-(A*(B-1))%B/B))
else:
  print(int(N%B*A/B-(A*N)%B/B))

Buggy python submission (verdict: Time Limit Exceeded):
import math
from fractions import gcd
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if D<N:
  for i in range(1,D+1):
    if (i%B)*A/B-(A*i)%B/B>maxi:
      maxi=(i%B)*A/B-(A*i)%B/B
else:
  for i in range(1,N+1):
    if (i%B)*A/B-(A*i)%B/B>maxi:
      maxi=(i%B)*A/B-(A*i)%B/B
print(int(maxi))

Fixed submission:
import math
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if B-1<=N:
  print(int((B-1)%B*A/B-(A*(B-1))%B/B))
else:
  print(int(N%B*A/B-(A*N)%B/B))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=[]
s=0
for i in range(N):
  b=input()
  if b not in a:
    s+=1
    a.append(b)
print(s)

Fixed submission:
N=int(input())
a=[]
s=0
for i in range(N):
  a.append(input())

print(len(set(a)))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)
N=int(input())
s=0
for i in range(1,N+1):
  for j in range(1,N+1):
    for h in range(1,N+1):
      a=gcd(i,j)
      s+=gcd(a,h)
print(s)

Fixed submission:
def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)
N=int(input())
s=0
for i in range(1,N+1):
  for j in range(i+1,N+1):
    for h in range(j+1,N+1):
      a=gcd(i,j)
      s+=6*gcd(a,h)
for p in range(1,N+1):
  for q in range(1,N+1):
    if p==q:
      s+=p
    else:
      s+=3*gcd(p,q)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
s=len(make_divisors(N-1))
for i in range(1,len(make_divisors(N))):
  q=N
  p=make_divisors(N)[i]
  while True:
    if q%p==0:
      q/=p
    else:
      break
  if (q-1)%p==0:
    s+=1
print(s-1)

Fixed submission:
N=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
s=len(make_divisors(N-1))
p=make_divisors(N)
for i in range(1,len(p)):
  q=N
  while True:
    if q%p[i]==0:
      q/=p[i]
    else:
      break
  if (q-1)%p[i]==0:
    s+=1
print(s-1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
s=len(make_divisors(N-1))
for i in range(1,len(make_divisors(N))):
  q=N
  while True:
    if q%make_divisors(N)[i]==0:
      q/=make_divisors(N)[i]
    else:
      break
  if (q-1)%make_divisors(N)[i]==0:
    s+=1
print(s-1)

Fixed submission:
N=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
s=len(make_divisors(N-1))
p=make_divisors(N)
for i in range(1,len(p)):
  q=N
  while True:
    if q%p[i]==0:
      q/=p[i]
    else:
      break
  if (q-1)%p[i]==0:
    s+=1
print(s-1)
Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
x=0
y=0
R=0
z=0
s=0
while (x<X or y<Y) and z<X+Y:
  if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:
    s+=p[0]
    x+=1
    p[0]=p[x]
    z+=1
  elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:
    s+=q[0]
    y+=1
    q[0]=q[y]
    z+=1
  else:
    s+=r[0]
    R+=1
    r[0]=r[R]
    z+=1
print(s)

Fixed submission:
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
x=0
y=0
R=0
z=0
s=0
while (x<X or y<Y) and z<X+Y:
  if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:
    s+=p[0]
    x+=1
    if x<A:
      p[0]=p[x]
    else:
      p[0]=0
    z+=1
  elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:
    s+=q[0]
    y+=1
    if y<B:
      q[0]=q[y]
    else:
      q[0]=0
    z+=1
  else:
    s+=r[0]
    R+=1
    if R<C:
      r[0]=r[R]
    else:
      r[0]=0
    z+=1
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
x=0
y=0
z=0
s=0
while (x<X or y<Y) and z<X+Y:
  if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:
    s+=p[0]
    p.remove(p[0])
    p.append(0)
    x+=1
    z+=1
  elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:
    s+=q[0]
    q.remove(q[0])
    q.append(0)
    y+=1
    z+=1
  else:
    s+=r[0]
    r.remove(r[0])
    r.append(0)
    z+=1
print(s)

Fixed submission:
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
x=0
y=0
R=0
z=0
s=0
while (x<X or y<Y) and z<X+Y:
  if (max(p[0],q[0],r[0])==p[0] or (y==Y and r[0]<p[0])) and x<X:
    s+=p[0]
    x+=1
    if x<A:
      p[0]=p[x]
    else:
      p[0]=0
    z+=1
  elif (max(p[0],q[0],r[0])==q[0] or (x==X and r[0]<q[0])) and y<Y:
    s+=q[0]
    y+=1
    if y<B:
      q[0]=q[y]
    else:
      q[0]=0
    z+=1
  else:
    s+=r[0]
    R+=1
    if R<C:
      r[0]=r[R]
    else:
      r[0]=0
    z+=1
print(s)
Buggy python submission (verdict: Runtime Error):
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    printf("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
list=[]
for i in range 3:
  list.append(int(input()))
if list[0]==list[1]:
  if list[1]==list[2]:
    print("No")
  else:
    printf("Yes")
    
else:
  if list[0]==list[2] or list[1]==list[2]:
    print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

if a==b:
  if b==c:
    print("No")
  if b!=c:
    printf("Yes")
    
if a!=b:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

if a==b:
  if b==c:
    print("No")
  else:
    printf("Yes")
    
if a!=b:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

if a==b:
  if b==c:
    print("No")
  else:
    printf("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
s=[input() for i in range 3]

if s[0]==s[1]:
  if s[1]==s[2]:
    print("No")
  else:
    printf("Yes")
    
else:
  if s[0]==s[2] or s[1]==s[2]:
    print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[input() for i in range (N)]

for q in range N:
  for i in range N-1:
    if s[i]>s[i+1]:
      s0=s[i]
      s[i]=s[i+1]
      s[i+1]=s0

count=1
maximum=0

for j in range N-1:
  if s[j]=s[j+1]:
    count+=1
  else:
    if count>maximum:
      a=[]
      a.append(s[j])
      maximum=count
      number=1
    elif count=maximum:
      a.append(s[j])
      number+=1
    count=0
    
for p in range number:
  print(a[p])

Fixed submission:
N=int(input())
s=[input() for i in range (N)]

s.sort()
count=1
maximum=0

for j in range (N-1):
  if s[j]==s[j+1]:
    count+=1
    if j==N-2:
      if count>maximum:
        a=[]
        a.clear()
        a.append(s[j])
        maximum=count
        number=1
      elif count==maximum:
        a.append(s[j])
        number+=1
  else:
    if count>maximum:
      a=[]
      a.clear()
      a.append(s[j])
      maximum=count
      number=1
    elif count==maximum:
      a.append(s[j])
      number+=1
    count=1   
  if maximum==1 and j==N-2:
    a.append(s[N-1])
    number+=1
for p in range (number):
  print(a[p])

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

for q in range N:
  for i in range N-1:
    if s[i]>s[i+1]:
      s0=s[i]
      s[i]=s[i+1]
      s[i+1]=s0

count=1
maximum=0

for j in range N-1:
  if s[j]=s[j+1]:
    count+=1
  else:
    if count>maximum:
      a=[]
      a.append(s[j])
      maximum=count
      number=1
    elif count=maximum:
      a.append(s[j])
      number+=1
    count=0
    
for p in range number:
  print(a[p])

Fixed submission:
N=int(input())
s=[input() for i in range (N)]

s.sort()
count=1
maximum=0

for j in range (N-1):
  if s[j]==s[j+1]:
    count+=1
    if j==N-2:
      if count>maximum:
        a=[]
        a.clear()
        a.append(s[j])
        maximum=count
        number=1
      elif count==maximum:
        a.append(s[j])
        number+=1
  else:
    if count>maximum:
      a=[]
      a.clear()
      a.append(s[j])
      maximum=count
      number=1
    elif count==maximum:
      a.append(s[j])
      number+=1
    count=1   
  if maximum==1 and j==N-2:
    a.append(s[N-1])
    number+=1
for p in range (number):
  print(a[p])
Buggy python submission (verdict: Time Limit Exceeded):
r=input().strip().split()
N=int(r[0])
a=int(r[1])
z=input().strip().split()

maximum=0

for j in range (0,N-a+1):
  s=0
  for p in range (j,j+a):
    s+=(1+int(z[p]))/2
 
  if s>maximum:
    maximum=s

print(maximum)

Fixed submission:
r=input().strip().split()
N=int(r[0])
a=int(r[1])
z=input().strip().split()
s=0
for p in range (a):
    s+=(1+int(z[p]))/2
maximum=s

for j in range (0,N-a):
  s-=(1+int(z[j]))/2
  s+=(1+int(z[j+a]))/2
  if s>maximum:
    maximum=s

print(maximum)

Buggy python submission (verdict: Time Limit Exceeded):
r=input().strip().split()
N=int(r[0])
a=int(r[1])
z=input().strip().split()
w=[]
for i in range (N):
  w.append((1+int(z[i]))/2)

maximum=0

for j in range (0,N-a+1):
  s=0
  for p in range (j,j+a):
    s+=w[p]
 
  if s>maximum:
    maximum=s

print(maximum)

Fixed submission:
r=input().strip().split()
N=int(r[0])
a=int(r[1])
z=input().strip().split()
s=0
for p in range (a):
    s+=(1+int(z[p]))/2
maximum=s

for j in range (0,N-a):
  s-=(1+int(z[j]))/2
  s+=(1+int(z[j+a]))/2
  if s>maximum:
    maximum=s

print(maximum)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
x=list(map(int,input().split()))
from fractions import gcd
g=x[1]-x[0]
for i in range (N-1):
  g=gcd(g,x[i+1]-x[i])
print(g)

Fixed submission:
from fractions import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))
g=x[0]-X
for i in range (N-1):
  g=gcd(g,x[i+1]-x[i])
print(abs(g))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
a=input().split()

for i in range (N):
  for j in range (N-1):
    if a[j]>a[j+1]:
      g=a[j]
      a[j]=a[j+1]
      a[j+1]=g
    
count=1
size=0
b=[]
for p in range (N-1):
  if a[p]==a[p+1]:
    count+=1
  else:
    b.append(count)
    count=1
    size+=1

for q in range (size):
  for r in range (size-1):
    if b[r]<b[r+1]:
      g=b[r]
      b[r]=b[r+1]
      b[r+1]=g

s=0
for u in range (K):
  s+=b[u]

print(N-s)

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

list.sort(a)#小さい順に並び替える
    
count=1#各数字が何回出てくるか
size=0#何種類の数字が出てくるか
b=[]#各数字が何回出てきたかを入れる箱
for p in range (N-1):
  if a[p]==a[p+1]:
    count+=1
  else:
    b.append(count)
    count=1
    size+=1

b.append(count)
size+=1
  
list.sort(b,reverse=True)#大きい順に並び替える

s=0
if K<size:
  for u in range (K):
    s+=b[u]#大きい方からK個分の個数の合計
else:
  s=N#出てくる数の個数が少なければ変える必要はない
print(N-s)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  if a in p:
    p.remove(a)
    count-=1
  else:
    p.append(a)
    count+=1
print(count)

Fixed submission:
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  p.append(a)
list.sort(p)
flag=1
for j in range (N-1):
  if p[j]==p[j+1]:
    flag*=-1
  else:
    if flag>0:
      count+=1
    flag=1
if flag>0:
  count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  if a in p:
    p.remove(a)
    count-=1
    p.append(0)
  else:
    p.append(a)
    count+=1
print(count)

Fixed submission:
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  p.append(a)
list.sort(p)
flag=1
for j in range (N-1):
  if p[j]==p[j+1]:
    flag*=-1
  else:
    if flag>0:
      count+=1
    flag=1
if flag>0:
  count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
p=[0]
count=0
for i in range (N):
  a=int(input())
  flag=0
  for j in range (i+1):
    if a==p[j]:
      p[j]=0
      count-=1
      flag=1
      p.append(0)
  if flag==0:
    p.append(a)
    count+=1
print(count)

Fixed submission:
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  p.append(a)
list.sort(p)
flag=1
for j in range (N-1):
  if p[j]==p[j+1]:
    flag*=-1
  else:
    if flag>0:
      count+=1
    flag=1
if flag>0:
  count+=1
print(count)