Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03634 (python)

Fixed submission:
import sys
rline = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(rline())
graph = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b, c = map(int, rline().split())
    a -= 1
    b -= 1
    graph[a].append([b, c])
    graph[b].append([a, c])
to_k = [0] * N


def dfs(node, parent, dist):
    to_k[node] = dist
    
    for child, d in graph[node]:
        if child != parent:
            dfs(child, node, dist + d)


def solve():
    Q, K = map(int, rline().split())
    K -= 1
    dfs(K, -1, 0)
    for _ in range(Q):
        x, y = map(lambda z: int(z) - 1, rline().split())
        print(to_k[x] + to_k[y])


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
rline = sys.stdin.readline

N = int(rline())
graph = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b, c = map(int, rline().split())
    a -= 1
    b -= 1
    graph[a].append([b, c])
    graph[b].append([a, c])
to_k = [0] * N


def dfs(node, parent, dist):
    to_k[node] = dist
    
    for child, d in graph[node]:
        if child != parent:
            dfs(child, node, dist + d)


def solve():
    Q, K = map(int, rline().split())
    K -= 1
    dfs(K, -1, 0)
    for _ in range(Q):
        x, y = map(lambda z: int(z) - 1, rline().split())
        print(to_k[x] + to_k[y])


if __name__ == '__main__':
    solve()
Problem p02571 (python)

Fixed submission:
n = input()
m = input()
lst = []
if m in n:
    print(0)
else:
    for i in range(len(n) - len(m) + 1):
        count = 0
        for j in range(i, len(m) + i):
            if n[j] != m[j-i]:
                count += 1
        lst.append(count)
    print(min(lst))

Buggy submission (verdict: Runtime Error):
n = input()
m = input()
lst = []
if m in n:
    print(0)
else:
    for i in range(len(n) - len(m)):
        count = 0
        for j in range(i, len(m) + i):
            if n[j] != m[j-i]:
                count += 1
        lst.append(count)
    print(min(lst))
Problem p02578 (python)

Fixed submission:
n = input()
summ = 0
lst = list(map(int, input().split()))
for i in range(len(lst) - 1):
    if lst[i] > lst[i + 1]:
        k = lst[i] - lst[i + 1]
        lst[i + 1] = lst[i + 1] + k
        summ += k
print(summ)

Buggy submission (verdict: Runtime Error):
n = input()
summ = 0
lst = list(map(int, input().split()))
for i in range(len(lst) - 1):
    if lst[i] > lst[i + 1]:
        k = lst[i] - lst[i + 1]
        lst.replace(lst[i + 1], lst[i + 1] + k)
        summ += k
print(summ)
Problem p02570 (python)

Fixed submission:
d,t,s = map(int, input().split())
print('Yes' if d <= t*s else 'No')

Buggy submission (verdict: Runtime Error):

d,t,s = map(int, input().split())
print('Yes' if d <= t*s else 'No")
Problem p02571 (python)

Fixed submission:
S = input()
T = input()

def d(s,t):
  return sum([1 if i!=j else 0 for i,j in zip(s,t)])

print(min([d(S[i:], T) for i in range(len(S)-len(T) + 1)]))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

def d(s,t):
  return sum([1 if i!=j else 0 for i,j in zip(s,t)])

print(min([d(S[i:], T) for i in range(len(S)-len(T))]))
Problem p02547 (python)

Fixed submission:
N = int(input())
c = 0
for i in range(N):
  a, b = map(int, input().split())
  if a == b:
    c += 1
  else:
    c =0
  if c == 3:
    break
if c == 3:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N == int(input())
count = 0
for i in range(N-1):
  s = list(map(int, input().split()))
  if s[0] == s[1]:
    count += 1
if count >= 3:
  print("Yes")
else:
  print("No")
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
cnt = 0
for i in range(len(s)):
  if s[i] != t[i]:
    cnt += 1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
cnt = 0
for i in len(s):
  if s[i] != t[i]:
    cnt += 1
    
print(cnt)
Problem p02701 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
S = len(set(s))

print(S)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
l = []
 
for i in range(n):
  l.append(s[i])
 
 
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
l = []
 
for i in range(n):
  l.append(s[i])
 
 
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
l = []
 
for i in range(n):
  l.append(s[i])
 
 
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
S = len(s)
l = []

if n>=S:
  for i in range(n):
    l.append(s[i])
    print(len(set(l)))

elif n<S:
  for i in range(S):
    l.append(s[i])
    print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
l = []

for i in range(n):
  l.append(s[i])
 

print(len(list(set(l))))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
l = []

for i in range(N):
  l.append(s[i])
 

print(len(list(set(l))))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(str,input().split()))
l = []

for i in range(N):
  l.append(s[i])
 
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
l = []

for i in range(N):
  l.append(s[i])
 
print(len(set(l)))
Problem p02711 (python)

Fixed submission:
N = input()

if "7" in N:
    print("Yes")
else:
    print("No")

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

if N in 7:
    print(Yes)
else:
    print(No)
Problem p02712 (python)

Fixed submission:
n = int(input())
sum = 0
 
for i in range(n+1):
    if i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    elif i % 15 == 0:
        pass
    else:
     sum += i
 
print (sum)

Buggy submission (verdict: Runtime Error):
N = int,input()
sum = 0

#文字になるときpass
for i in range(N):
    if i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    elif i % 15 == 0 :
        pass
    else:
         sum +=  i

print(sum)

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

#文字になるときpass
for i in range(N):
    if i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    elif i % 15 == 0 :
        pass
    else:
         sum +=  i

print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 0
 
for i in range(n+1):
    if i % 3 == 0:
        print(Fizz)
    elif i % 5 == 0:
        print(Buzz)
    elif i % 15 == 0:
        print(FizzBuzz)
    else:
     sum += i
 
print (sum)

Buggy submission (verdict: Runtime Error):
n = input()
N = int(n)
sum = 0

for i in range(N+1):
    if N % 3 == 0:
        print(Fizz)
    elif N % 5 == 0:
        print(Buzz)
    elif N % 15 == 0:
        print(FizzBuzz)
    else:
     sum += N

print (sum)
Problem p02771 (python)

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

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

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

if a==b and b!=c:
  print("Yes")
elif c==b! and c==a:
  print("Yes")
elif a!=b and b==c:
  print("Yes")
else:
  print("No")

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

if a==b and b!=c:
  print("Yes")
elif c==b! and b=a:
  print("Yes")
elif a!=b and b==c:
  print("Yes")
else:
  print("No")

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

if a==b and b!=c:
  print("Yes")
elif c==b! and b=a:
  print("Yes")
elif a!=b and b==c:
  print("Yes"):
else:
  print("No")

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

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

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

if a==b!=c:
  print("Yes")
elif c==b!=a:
  print("Yes")
elif a!=b=c:
  print("Yes"):
else:
  print("No")
Problem p02785 (python)

Fixed submission:
n,k = map(int,input().split())
hn = sorted(list(map(int,input().split())))

attack = 0

if k>=n:
  print(attack)

elif k<n:
  print(sum(hn[0:n-k]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
hn = list(map(int,input().split()))
hn_s = hn.sort()
attack = 0

if k>=n:
  print("0")

elif k<n:
  for _ in range(n-k):
    hn_s.pop(-1)
  print(str(sum(hn_s)))
Problem p02819 (python)

Fixed submission:
import math
 
x = int(input())

if x == 2:
    print(2)
    exit()
 
while True:
    f = True
    g = math.ceil(math.sqrt(x))
    for i in range(2,g+1):
        if x%i == 0:
            f = False
            break
    if f == True:
        print(x)
        exit()
    x += 1

Buggy submission (verdict: Runtime Error):
import math
 
x = int(input())

if x == 2:
    print(2)
    exit()
 
while True:
    g = math.ceil(math.sqrt(x))
    for i in range(2,g+1):
        if x%i == 0:
            f = False
            break
    if f == True:
        print(x)
        exit()
    x += 1
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
print(6 - A - B)

Buggy submission (verdict: Runtime Error):
A, B = map(int,input().split())
print(6 - A - B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(6-A-B)
Problem p02836 (python)

Fixed submission:
S = input()
l = len(S)// 2
ans= 0 

for i in range(l):
    if  S[i] != S[-(i+1)]:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)// 2
ans= 0 

for i in range(l)
    if  S[i] != S[l-i]:
        ans += 1

print(ans)
Problem p02847 (python)

Fixed submission:
S = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

print(7-S.index(input()))

Buggy submission (verdict: Runtime Error):
S = [SUN,MON,TUE,WED,THU,FRI,SAT]

print(7-index(input()))

Buggy submission (verdict: Runtime Error):
if S == "SUN":
  print("0")
  
elif S == "MON":
  print("1")
elif S == "TUE":
  print("2")
elif S == "WED":
  print("3")
elif S == "THE":
  print("4")
elif S == "FRI":
  print("5")
elif S == "SAT"
  print("6")
Problem p02891 (python)

Fixed submission:
S = list(input())
K = int(input())
 
ans = 0
#２つ並べて一般性を確かめる
S2 = S*2

for i in range(1,len(S2)):
    if S2[i-1]== S2[i]:
        S2[i] = '@'
        #2回目以降はk-1回任意の@へ直す
        if i>=len(S2)//2:
            ans+= K-1
        else:
            ans+=1
            
if len(set(S)) ==1 and len(S)%2 !=0:
   ans = len(S)*(K//2)+(K%2==1)*(len(S)//2)
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
K = int(input())
 
ans = 0
#２つ並べて一般性を確かめる
S2 = S*2

for i in range(1,len(S2)):
    if S2[i-1]== S2[i]:
        s_d[i] = '@'
        #2回目以降はk-1回任意の@へ直す
        if i>=len(S2)//2:
            ans+= K-1
        else:
            ans+=1

print(ans)
Problem p02933 (python)

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

if a<3200:
  print("red")
else:
  print(s)

Buggy submission (verdict: Runtime Error):
a = int(input())
2 s = input()
3 print(s if a >= 3200 else 'red')
Problem p02935 (python)

Fixed submission:
n = int(input())
v = sorted(list(map(int,input().split())))
 
 
for i in range(n-1): # 後に範囲
  v[i+1] = (v[i]+v[i+1])/2
 
print(v[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = sotred(list(map(int,input().split())))


for i in range(n-1): # 後に範囲
  v[i+1] = (v[i]+v[i+1])/2

print(v[n-1])
Problem p02954 (python)

Fixed submission:
s = input()
l=len(s)
ans=[1]*l
for i in range(l-1):
    if s[i]==s[i+1]=="R":
        ans[i+2]+=ans[i]
        ans[i]=0
for i in range(l-1,1,-1):
    if s[i]==s[i-1]=="L":
        ans[i-2]+=ans[i]
        ans[i]=0
print(*ans)

Buggy submission (verdict: Runtime Error):
S = input()
l=len(S)
ans=[1]*l
for i in range(l-2):
    if s[i]==s[i+1]=="R":
        ans[i+2]+=ans[i]
        ans[i]=0
for i in range(l-1,1,-1):
    if s[i]==s[i-1]=="L":
        ans[i-2]+=ans[i]
        ans[i]=0
print(*ans)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0]*(n+1)
INF = 1000000007

dp[0] = 1
if 1 not in a:
  dp[1] = 1

for i in range(2,n+1):
    if i-1 not in a :
      dp[i] += dp[i-1] #n-1 段目が安全なら
    if i-2 not in a :
      dp[i] += dp[i-2] #n-2 段目が安全なら
    dp[i] %= INF

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0]*(n+1)
INF = 1000000007

#初期状態定義
dp[0] = 1
if 1 not in a:
  dp[1] = 1
else:
  dp[1] = 0

for i in range(2,n+1):
    if i-1 not in a :
      dp[i] += dp[i-1] #n-1 段目が安全なら
    if i-2 not in a :
      dp[i] += dp[i-2] #n-2 段目が安全なら
dp[i] %= INF

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0]*(n+1)
INF = 1000000007
 
dp[0] = 1
if 1 not in a:
  dp[1] = 1
else:
  dp[1] = 0
 
for i in range(2,n+1):
    if i in a :
      dp[i] += dp[i-1] +dp[i-2] 
dp[i] %= INF
 
print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0]*(n+1)
INF = 1000000007

dp[0] = 1
if 1 not in a:
  dp[1] = 1
else:
  dp[1] = 0

for i in range(2,n+1):
    if i not in a :
      dp[i] += dp[i-1] #n-1 段目が安全なら
      dp[i] += dp[i-2] #n-2 段目が安全なら
dp[i] %= INF

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0]*(n+1)
INF = 1000000007

dp[0] = 1
if 1 not in a:
  dp[1] = 1
  
else:
  dp[0]= [0]

for i in range(2,n+1):
    if i not in a :
      dp[i] += dp[i-1] #n-1 段目が安全なら
      dp[i] += dp[i-2] #n-2 段目が安全なら
dp[i] %= INF

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0]*(n+1)
INF = 1000000007

dp[0] = 1
if 1 not in a:
  dp[1] = 1

for i in range(2,n+1):
    if i not in a :
      dp[i] += dp[i-1] #n-1 段目が安全なら
      dp[i] += dp[i-2] #n-2 段目が安全なら
dp[i] %= INF

print(dp[n])
Problem p03036 (python)

Fixed submission:
r,D,x = map(int,input().split())
X = [x]*11

for i in range(0,10):
  X[i+1] = r*X[i] - D
  
  
print(X[1])
print(X[2])
print(X[3])
print(X[4])
print(X[5])
print(X[6])
print(X[7])
print(X[8])
print(X[9])
print(X[10])

Buggy submission (verdict: Runtime Error):
print(X[1])
print(X[2])
print(X[3])
print(X[4])
print(X[5])
print(X[6])
print(X[7])
print(X[8])
print(X[9])
print(X[10])
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
 
print(S[0:K-1] + S[K-1].lower() + S[K:N])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()

S = ord(s[k+1])
C =  chr(int(S)+26)

print(C)
Problem p03804 (python)

Fixed submission:
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
ans='No'
 
for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        if A[i][j:j+M] ==B[0]:
            for k in range(1,M):
                if A[i+k][j:j+M] == B[k]:
                    cnt+=1
            if cnt==M-1:
                ans='Yes'
                
print(ans)

Buggy submission (verdict: Runtime Error):
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
ans='No'
 
for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        if A[i][j:j+M] ==B[0]:
            for k in range(1,M):
                if A[i+k][j:j+M] == B[k]:
                    cnt+=1
            if cnt==M-1:
                ans='Yes'
                
print(ans)
Problem p02661 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10


N = INT()
AB = [LIST() for _ in range(N)]

A, B = zip(*AB)
A = list(A)
B = list(B)

A.sort()
B.sort()

if N%2:
	a = A[N//2]
	b = B[N//2]
	print(b-a+1)
else:
	a = (A[N//2-1]+A[N//2])/2
	b = (B[N//2-1]+B[N//2])/2
	print(int((b-a)*2+1))

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, floor
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(float, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

N = INT()
AB = [LIST() for _ in range(N)]

lim = 2*10**9

left = []
right = []

for l, r in AB:
	left.append(l)
	right.append(r)

right.sort()
left.sort()

#print(right)
#print(left)

if N%2:
	print(right[N//2] - left[N//2] +1)
else:
	M = set()
	m1 = list(range(left[N//2-1], right[N//2-1]+1))
	m2 = list(range(left[N//2], right[N//2]+1))
	for x in m1:
		for y in m2:
			M.add(x+y)

	print(len(M))
Problem p02759 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
if N%2 == 0:
  print(int(N/2))
else:
  print(int(N/2+1))

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N == int(N)

print(-(-N//2))

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

if N == 1 and M == 0:
  print(0)
  exit()

sc = [LIST() for _ in range(M)]

ans = [-1]*N
for s, c in sc:	
  if N >= 2 and s == 1 and c == 0:
    print(-1)
    exit()
  if ans[s-1] != -1 and ans[s-1] != c: #既に値が入ってる
    print(-1)
    exit()
  ans[s-1] = c
    
if ans[0] == -1:
  ans[0] = 1

for i in range(N):
  if ans[i] == -1:
    ans[i] = 0
    
for n in ans:
  print(n, end="")
Problem p02773 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = [input() for _ in range(N)]

cnt_s = Counter(S)
tmp = cnt_s.most_common()[0][1]
for key, val in sorted(cnt_s.most_common(), key=lambda x:x[0]):
		if val == tmp:
      			print(key)

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = [input() for _ in range(N)]

cnt_s = Counter(S)
tmp = cnt_s.most_common()[0][1]
for key, val in sorted(cnt_s.most_common(), lambda x:x[0]):
		if val == tmp:
      			print(key)