Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
tmp=0
for i in range(N):
  tmp+=a[i]
  if i%2==0:
    if tmp<=0:
      ans+=abs(tmp)+1
      tmp=1
  else:
    if tmp>=0:
      ans+=abs(tmp)+1
      tmp=-1

tmp=0
tmp2=0
for i in range(N):
  tmp+=a[i]
  if i %2==0:
    if tmp>=0:
      tmp2+=abs(tmp)+1
      tmp=-1
  else:
    if tmp<=0:
      tmp2+=abs(tmp)+1
      tmp=1
print(min(ans,tmp))
    

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
tmp=0
for i in range(n):
  tmp+=a[i]
  if i%2==0:
    if tmp<=0:
      ans+=abs(tmp)+1
      tmp=1
  else:
    if tmp>=0:
      ans+=abs(tmp)+1
      tmp=-1

tmp=0
tmp2=0
for i in range(n):
  tmp+=a[i]
  if i %2==0:
    if tmp>=0:
      tmp2+=abs(tmp)+1
      tmp=-1
  else:
    if tmp<=0:
      tmp2+=abs(tmp)+1
      tmp=1
print(min(ans,tmp2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))


diff = [A[i+1] - A[i] for i in range(N-1) if A[i+1]-A[i] != 0]
ans = 1
prev = diff[0]
id = 0
while(id < len(diff)-2):
    if (diff[id]*diff[id+1]) < 0:
        ans += 1
        id += 2
    else:
        id += 1

if diff[-1]*diff[-2] < 0 and diff[-2]*diff[-3]:
    ans += 1
print(ans)


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
flag=0
ans=1
for i in range(1,N):
  if flag== 0:
    if a[i]>a[i-1]:
      flag=1
      continue
    elif a[i]<a[i-1]:
      flag=-1
      continue
    else:
      continue
  elif flag>0:
    if a[i]<a[i-1]:
      ans+=1
      flag=0
  else:
    if a[i]>a[i-1]:
      ans+=1
      flag=0
print(ans)

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


diff = [A[i+1] - A[i] for i in range(N-1) if A[i+1]-A[i] != 0]
ans = 1
prev = diff[0]
id = 0
while(id < len(diff)-2):
    if (diff[id]*diff[id+1]) < 0:
        ans += 1
        id += 2
    else:
        id += 1

if diff[-1]*diff[-2] < 0:
    ans += 1
print(ans)


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
flag=0
ans=1
for i in range(1,N):
  if flag== 0:
    if a[i]>a[i-1]:
      flag=1
      continue
    elif a[i]<a[i-1]:
      flag=-1
      continue
    else:
      continue
  elif flag>0:
    if a[i]<a[i-1]:
      ans+=1
      flag=0
  else:
    if a[i]>a[i-1]:
      ans+=1
      flag=0
print(ans)

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


diff = [A[i+1] - A[i] for i in range(N-1) if A[i+1]-A[i] != 0]
ans = 1
prev = diff[0]
id = 0
while(id < len(diff)-1):
    if (diff[id]*diff[id+1]) < 0:
        ans += 1
        id += 2
    else:
        id += 1
print(ans)


Fixed submission:
N=int(input())
a=list(map(int,input().split()))
flag=0
ans=1
for i in range(1,N):
  if flag== 0:
    if a[i]>a[i-1]:
      flag=1
      continue
    elif a[i]<a[i-1]:
      flag=-1
      continue
    else:
      continue
  elif flag>0:
    if a[i]<a[i-1]:
      ans+=1
      flag=0
  else:
    if a[i]>a[i-1]:
      ans+=1
      flag=0
print(ans)
Buggy python submission (verdict: Runtime Error):
W,a,b=map(int,input().split())
print(min(max(W+a - b,0),max(a-W-b)))


Fixed submission:
W,a,b=map(int,input().split())
print(max(max(0,b-W-a),max(0,a-W-b)))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ans=1
for i in range(1,N+1):
  ans*=i
print(ans%(10**9 +7))

Fixed submission:
import math
N=int(input())
ans=math.factorial(N)
print(ans%(10**9 +7))
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input.split())
A=[""]*N
B=[""]*M
for i in range(N):
  A[i]=input()
for i in range(M):
  B[i]=input()
  
for i in range(N-M):
    if B[0] in A[i]:
      for j in range(1,M):
        if B[j] in A[i+j]:
          if j = M - 1:
            print("Yes")
            exit(0)
          else:
            continue
        else:
          break
          
print("No")

Fixed submission:
N,M=map(int,input().split())
A=[""]*N
B=[""]*M
for i in range(N):
  A[i]=input()
for i in range(M):
  B[i]=input()
  
A_tmp=[""]*M
for i in range(N-M+1):
  for j in range(N-M+1):
    for k in range(M):
      A_tmp[k]=A[j+k][i:i+M]
    if A_tmp==B:
      print("Yes")
      exit(0)

print("No")

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input.split())
A=[""]*N
B=[""]*M
for i in range(N):
  A[i]=input()
for i in range(M):
  B[i]=input()
flag=False
for i in range(N-M)
    if B[0] in A[i]:
      for j in range(1,M):
        if B[j] in A[i+j]:
          if j = M - 1:
            print("Yes")
            exit(0)
          else:
            continue
        else:
          break
          
print("No")

Fixed submission:
N,M=map(int,input().split())
A=[""]*N
B=[""]*M
for i in range(N):
  A[i]=input()
for i in range(M):
  B[i]=input()
  
A_tmp=[""]*M
for i in range(N-M+1):
  for j in range(N-M+1):
    for k in range(M):
      A_tmp[k]=A[j+k][i:i+M]
    if A_tmp==B:
      print("Yes")
      exit(0)

print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(),int.input().split())
count=0
for i in range(N):
  if A[i]%2==1:
    count+=1

ans=["YES","NO"]

print(ans[count%2])
    
    
    
    

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
count=0
for i in range(N):
  if A[i]%2==1:
    count+=1

ans=["YES","NO"]

print(ans[count%2])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

count = 0
A.sort()
for i in range(N):
    if A.count(A[i]) > 1:
        if A.index(A[i]) != i:
            count += 1

if count % 2 == 0:
    print(N - count)
else:
    print(N - (count + 1))


Fixed submission:
import collections
counter = collections.defaultdict(int)
N = int(input())
A = input().split()

count = 0
for x in A:
    counter[x] += 1

for x in counter:
    if counter[x] != 1:
        count += counter[x] - 1

if count % 2 == 0:
    print(N - count)
else:
    print(N - (count + 1))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
a=list(map(int,input().split()))
ans=0
tmp=0
for i in range(N):
  if i < K:
    tmp+=a[i]
  else:
    if a[i]>0:
      ans+=a[i]
ans+=max(0,tmp)

ans2=0
tmp=0
for i in range(N-1,-1,-1):
  if ans < N-K:
    if a[i]>0:
      ans2+=a[i]
  else:
    tmp+=a[i]
ans2+=max(0,tmp)
print(max(ams2,ans))

Fixed submission:
N,K=map(int,input().split())
a=list(map(int,input().split()))
ans=0
tmp=0
sa=[0]*(N+1)
A=[0]*(N+1)
for i in range(N):
  sa[i+1]=sa[i]+a[i]
  if a[i]>0:
    A[i+1]=A[i]+a[i]
  else:
    A[i+1]=A[i]
for i in range(N-K+1):
  tmp=sa[i+K]-sa[i]
  tmp2=A[i]+(A[-1]-A[i+K])
  #print(max(0,tmp),tmp2)
  if max(0,tmp)+tmp2>ans:
    ans=max(0,tmp)+tmp2
print(ans)
Buggy python submission (verdict: Runtime Error):
class unionFind:
    parent = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            return
N,M=map(int,input().split())
G=unionFind(M)
s=set()
for i in range(N):
  tmp=tuple(map(int,input().split()))
  s|=set(tmp[1:])
  for x in tmp[2:]:
    G.unite(tmp[1],x)

parent=set()
for i in s:
  parent.add(G.root(i-1))

if len(parent)==1:
  print("YES")
else:
  print("NO")
      

Fixed submission:
class unionFind:
    parent = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            return
N,M=map(int,input().split())
G=unionFind(M)
s=set()
for i in range(N):
  tmp=tuple(map(int,input().split()))
  s.add(tmp[1]-1)
  for x in tmp[2:]:
    G.unite(tmp[1],x)

parent=set()
for i in s:
  parent.add(G.root(i))

if len(parent)==1:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
prev=0
for i in range(H):
  s=input()
  id = s.index("#")
  if id >= prev:
    flag=False
    prev = id
    for j in range(prev,W):
      if flag ans s[j]=="#":
        print("Impossible")
        exit(0)
      if s[j]==".":
        flag=True
print("Possible")
  

Fixed submission:
H,W=map(int,input().split())
prev=0
for i in range(H):
  s=input()
  id = s.index("#")
  if id >= prev:
    flag=False
    prev = W-1 - s[::-1].index("#")
    for j in range(id,W):
      if flag and s[j]=="#":
        print("Impossible")
        exit(0)
      if s[j]==".":
        flag=True
  else:
    print("Impossible")
    exit(0)
print("Possible")

Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
prev=0
for i in range(H):
  s=input()
  id = s.index("#")
  if id >= prev:
    flag=False
    for j in range(id,W):
      if flag ans s[j]=="#":
        print("Impossible")
        exit(0)
      if s[j]==".":
        flag=True
print("Possible")
  

Fixed submission:
H,W=map(int,input().split())
prev=0
for i in range(H):
  s=input()
  id = s.index("#")
  if id >= prev:
    flag=False
    prev = W-1 - s[::-1].index("#")
    for j in range(id,W):
      if flag and s[j]=="#":
        print("Impossible")
        exit(0)
      if s[j]==".":
        flag=True
  else:
    print("Impossible")
    exit(0)
print("Possible")
Buggy python submission (verdict: Time Limit Exceeded):
N,T=map(int,input().split())
A=list(map(int,input().split()))


import collections
table=collections.defaultdict(set)
table2=collections.defaultdict(set)
tmp=0
for i in range(N-1):
  for j in range(i+1,N):
    table[A[j]-A[i]].add(i)
    table2[A[j]-A[i]].add(j)
    tmp=max(tmp,A[j]-A[i])
print(min(len(table[tmp]),len(table2[tmp])))


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


import heapq
import collections
hq=[]
heapq.heapify(hq)
heapq.heappush(hq,A[0])
tmp=0
table=collections.defaultdict(int)
for i in range(1,N):
  j=heapq.heappop(hq)
  table[A[i]-j]+=1
  tmp=max(tmp,A[i]-j)
  heapq.heappush(hq,j)
  heapq.heappush(hq,A[i])
print(table[tmp])
Buggy python submission (verdict: Runtime Error):
K,T = map(int,input().split())
a = list(map(int,input().split()))

a = sorted(a,reverse = True)
ans = a.pop(0) - sum(a) - 1
if a >= 0:
    print(ans)
else:
    print(0)

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

a = sorted(a,reverse = True)
ans = a.pop(0) - sum(a) - 1
if ans >= 0:
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]

x = 0
y = 0
for t, a in TA:
    if x <= t and y <= a:
        x = t
        y = a
    else:
        if t >= a:
            while(1):
                if (x*a) % t == 0 and (x*a) // t >= y:
                    y = (x*a) // t
                    break
                else:
                    x += 1
        else:
            while(1):
                if (y*t) % a == 0 and (y*t) // a >= x:
                    x = (y*t) // a
                    break
                else:
                    y += 1

print(x+y)


Fixed submission:
import math
N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]

x = 1
y = 1
for t, a in TA:
    if x <= t and y <= a:
        x = t
        y = a
    else:
        v = max(-(-x//t), -(-y//a))
        x = v * t
        y = v * a


print(x+y)

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

x = 0
y = 0
for t, a in TA:
    if x <= t and y <= a:
        x = t
        y = a
    else:
        if t >= a:
            while(1):
                if (x*a) % t == 0 and (x*a) // t >= y:
                    y = (x*a) // t
                    break
                else:
                    x += 1
        else:
            while(1):
                if (y*t) % a == 0 and (y*t) // a >= x:
                    x = (y*t) // a
                    break
                else:
                    y += 1

print(x+y)


Fixed submission:
import math
N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]

x = 1
y = 1
for t, a in TA:
    if x <= t and y <= a:
        x = t
        y = a
    else:
        v = max(-(-x//t), -(-y//a))
        x = v * t
        y = v * a


print(x+y)
Buggy python submission (verdict: Runtime Error):
s=[reversed(list(input())) for i in range(3)]
flag=True
next=0
ans=0
ans_s=["a","b","c"]
while(flag):
  if len(s[next]) >0:
    tmp=s[next].pop()
    next=ans_s.index(tmp)
  else:
    ans=next
    flag=False
print(ans_s[ans])

Fixed submission:
s=[list(input()) for i in range(3)]
for i in range(3):
  s[i]=list(reversed(s[i]))
flag=True
next=0
ans=0
mem_s=["a","b","c"]
ans_s=["A","B","C"]
while(flag):
  if len(s[next]) >0:
    tmp=s[next].pop()
    next=mem_s.index(tmp)
  else:
    ans=next
    flag=False
print(ans_s[ans])

Buggy python submission (verdict: Runtime Error):
s=[reversed(list(input())) for i in range(3)]
flag=True
next=0
ans=0
ans_s=["a","b","c"]
while(flag):
  if len(s[next]) >0:
    next=s[next].pop()
  else:
    ans=next
    flag=False
print(ans_s[ans])

Fixed submission:
s=[list(input()) for i in range(3)]
for i in range(3):
  s[i]=list(reversed(s[i]))
flag=True
next=0
ans=0
mem_s=["a","b","c"]
ans_s=["A","B","C"]
while(flag):
  if len(s[next]) >0:
    tmp=s[next].pop()
    next=mem_s.index(tmp)
  else:
    ans=next
    flag=False
print(ans_s[ans])
Buggy python submission (verdict: Runtime Error):
N = int(input().strip())

keta = len(str(N))

count = 0
  
for i in range(1, keta, 2):
  count += (10 ** i)
  
if (keta  % 2) != 0:
  count += (N - 10 ** (keta - 1) + 1)
  
if N >= 10:
  count -= 1
  
print(count)

Fixed submission:
A, B, C = list(map(int, input().strip().split(' ')))
 
print(max(C - (A - B), 0))

Buggy python submission (verdict: Runtime Error):
N = int(input().strip())

keta = len(str(N))

count = 0
  
for i in range(1, keta, 2):
  count += (10 ** i)
  
if (keta  % 2) != 0:
  count += (N - 10 ** (keta - 1) + 1)
  
if N >= 10:
  count -= 1
  
print(count)

Fixed submission:
A, B, C = list(map(int, input().strip().split(' ')))
 
print(max(C - (A - B), 0))
Buggy python submission (verdict: Runtime Error):
import math
 
N, D = list(map(int, input().strip().split(" ")))

if D == 0:
    print(N)
elif N == 0:
    print("0")
else:
	print( int(math.ceil(N / (2 * D))))

Fixed submission:
r = int(input())

print( 3 * r * r)

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

N, D = list(map(int, input().strip().split(" ")))

print( int(math.ceil(N // (2 * D)))

Fixed submission:
r = int(input())

print( 3 * r * r)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
p=1
s=0
t=0
if 0 in a:
    t=1
else:
    t=0
for i in range(0,n):
    if s==0 or t==1:
        p=p*a[i]
        if p >10**18:
            s=1
            p=-1
        else:
            continue
    else:
        break
print(p)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
p=1
s=0
t=0
if 0 in a:
    t=1
    p=0
else:
    t=0
for i in range(0,n):
    if s==0 and t==0:
        p=p*a[i]
        if p >10**18:
            s=1
            p=-1
        else:
            continue
    else:
        break
print(p)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=int(N/100)
b=int((N-a*100)/10)
c=int(N-100*a-10*b)
l=int()
if a*b*c==7l:
    print('yes')
else:
    print('no')

Fixed submission:
N=input()
if '7' in N:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
x,y,z=map(input().split())
print(z,y,x)

Fixed submission:
x,y,z=input().split()
print(z,x,y)
Buggy python submission (verdict: Runtime Error):
N,M=input().split()
print((N*N-1+M*M-1)/2)

Fixed submission:
n,m=map(int,input().split())
print(int((n*(n-1)+m*(m-1))/2))
Buggy python submission (verdict: Runtime Error):
A_1=int(input())
A_2=int(input())
A_3=int(input())
if A_1+A_2+A_3>=22:
    print("bust")
if A_1+A_2+A_3<=21:
    print("win")

Fixed submission:
A_1,A_2,A_3=map(int,input().split())
if A_1+A_2+A_3>=22:
    print("bust")
if A_1+A_2+A_3<=21:
    print("win")

Buggy python submission (verdict: Runtime Error):
A_1=int(input())
A_2=int(input())
A_3=int(input())
if A_1+A_2+A_3>=22:
    print("bust")
if A_1+A_2+A_3<=21:
    print("bust")

Fixed submission:
A_1,A_2,A_3=map(int,input().split())
if A_1+A_2+A_3>=22:
    print("bust")
if A_1+A_2+A_3<=21:
    print("win")
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
if type(n/2)=='int':
    if s[0:n/2]=s[n/2:n]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Fixed submission:
n=int(input())
s=input()
a=(s[0:int(n/2)])
b=(s[int(n/2):n])
if n%2==0:
    if a==b:
        print('Yes') 
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)
ans = 0

point = []
point.append(A.pop(0))
for i in A:
    ans += point.pop(0)
    point.append(i)
    point.append(i)

print(ans)

Fixed submission:
from collections import deque

n = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)
ans = 0

point = deque()
point.append(A.pop(0))
for i in A:
    ans += point.popleft()
    point.append(i)
    point.append(i)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in A:
        ans *= i

    if ans > 10**18:
        print(-1)
    else:
        print(ans)

Fixed submission:
n = int(input())

A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    f = 0
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            f = 1
            break
    if f == 0:
        print(ans)

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

A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in A:
        ans *= i

    if ans > 10**18:
        print(-1)
    else:
        print(ans)

Fixed submission:
n = int(input())

A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    f = 0
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            f = 1
            break
    if f == 0:
        print(ans)

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

A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())

A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    f = 0
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            f = 1
            break
    if f == 0:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ans = 0
for i in range(n+1):
    temp = (a*i)//b - a * (i // b)
    if temp > ans:
        ans = temp
print(ans)

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

c = min(b-1,n)
print((a*c)//b - a*(c//b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = []
for _ in range(n):
    s = input()
    if s  not in ans:
        ans.append(s)
print(len(ans))

Fixed submission:
n = int(input())
ans = []
for _ in range(n):
    ans.append(input())
ans = set(ans)
print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

A = list(map(int,input().split()))

for i in range(1,n+1):
    print(A.count(i))

Fixed submission:
n = int(input())

A = list(map(int,input().split()))
ans = [0] * n
for a in A:
    ans[a-1] += 1

for a in ans:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

k = int(input())

ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans += reduce(math.gcd,[i,j,l])

print(ans)

Fixed submission:
import math
from functools import reduce

k = int(input())

ans = 0
for i in range(1,k+1):
    for j in range(i,k+1):
        for l in range(j,k+1):
            temp = reduce(math.gcd,[i,j,l])
            if len(set([i,j,l])) == 1:
                ans += temp
            elif len(set([i,j,l])) == 2:
                ans += temp * 3
            elif len(set([i,j,l])) == 3:
                ans += temp * 6
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
C = [0] * N
for i in range(N):
  s = str(input())
  if s in A:
    C[A.index(s)] += 1
  else:
    A.append(s)
  
m = max(C)
ans = [A[n] for n, v in enumerate(C) if v == m]
ans.sort()
for i in ans:
  print(i)

Fixed submission:
N = int(input())
A = {}
for i in range(N):
  s = str(input())
  if s in A:
    A[s] += 1
  else:
    A[s] = 1

max_val = max(A.values())
keys = [key for key in A if A[key] == max_val]
keys.sort()
for s in keys:
  print(s)

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

A = [''] * N
for i in range(N):
  A[i] = str(input())
  
B = list(set(A))
B.sort()

C = [0] * len(B)

for i in range(len(B)):
  C[i] = A.count(B[i])
  
m = max(C)
ans = [n for n, v in enumerate(C) if v == m]

for i in ans:
  print(B[i])

Fixed submission:
N = int(input())
A = {}
for i in range(N):
  s = str(input())
  if s in A:
    A[s] += 1
  else:
    A[s] = 1

max_val = max(A.values())
keys = [key for key in A if A[key] == max_val]
keys.sort()
for s in keys:
  print(s)

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

A = [''] * N
for i in range(N):
  A[i] = str(input())
  
B = list(set(A))

C = [0] * len(B)

for i in range(len(B)):
  C[i] = A.count(B[i])
  
m = max(C)
ans_i = [n for n, v in enumerate(C) if v == m]

ans = []
for i in ans_i:
  ans.append(B[i])
  
ans.sort()
for s in ans:
  print(s)

Fixed submission:
N = int(input())
A = {}
for i in range(N):
  s = str(input())
  if s in A:
    A[s] += 1
  else:
    A[s] = 1

max_val = max(A.values())
keys = [key for key in A if A[key] == max_val]
keys.sort()
for s in keys:
  print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [(p+1)/2 for p in P]
S = 0
for i in range(N-K+1):
  temp = sum(E[i:i+K])
  if S < temp:
    S = temp
  
print(S)


Fixed submission:
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [(p+1)/2 for p in P]
temp = sum(E[0:K])
S =  temp
for i in range(N-K):
  temp -= E[i]
  temp += E[i+K]
  if S < temp:
    S = temp  
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [0] * N
S = 0
ind = 0
for i in range(N-K+1):
  temp = sum(P[i:i+K])
  if S < temp:
    S = temp
    ind = i
ans = 0
for i in range(ind,ind+K):
  ans += (P[i]+1)/2
  
print(ans)


Fixed submission:
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [(p+1)/2 for p in P]
temp = sum(E[0:K])
S =  temp
for i in range(N-K):
  temp -= E[i]
  temp += E[i+K]
  if S < temp:
    S = temp  
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [0] * N
S = [0] * (N - K + 1)

for p in range(N):
  E[p] = (P[p] + 1) / 2

for i in range(N-K+1):
  S[i] = sum(E[i:i+K])
print(max(S))

Fixed submission:
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [(p+1)/2 for p in P]
temp = sum(E[0:K])
S =  temp
for i in range(N-K):
  temp -= E[i]
  temp += E[i+K]
  if S < temp:
    S = temp  
print(S)