Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

L = [N,0,0,0,0,0]

time = 0
while L != [0,0,0,0,0,N]:
  if L[4] != 0:
    if L[4] > e:
      L[5] = L[5] + e
      L[4] = L[4] - e
    else:
      L[5] = L[5] + L[4]
      L[4] = 0
  if L[3] != 0:
    if L[3] > d:
      L[4] = L[4] + d
      L[3] = L[3] - d
    else:
      L[4] = L[4] + L[3]
      L[3] = 0
  if L[2] != 0:
    if L[2] > c:
      L[3] = L[3] + c
      L[2] = L[2] - c
    else:
      L[3] = L[3] + L[2]
      L[2] = 0
  if L[1] != 0:
    if L[1] > b:
      L[2] = L[2] + b
      L[1] = L[1] - b
    else:
      L[2] = L[2] + L[1]
      L[1] = 0
  if L[0] != 0:
    if L[0] > a:
      L[1] = L[1] + a
      L[0] = L[0] - a
    else:
      L[1] = L[1] + L[0]
      L[0] = 0
  time = time + 1
  
print(time)

Fixed submission:
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if min(a,b,c,d,e) == a:
  if N % a == 0:
    print(N//a + 4)
  else:
    print(N//a + 5)
elif min(b,c,d,e) == b:
  if N % b == 0:
    print(N//b + 4)
  else:
    print(N//b + 5)
elif min(c,d,e) == c:
  if N % c == 0:
    print(N//c + 4)
  else:
    print(N//c + 5)
elif min(d,e) == d:
  if N % d == 0:
    print(N//d + 4)
  else:
    print(N//d + 5)
else:
  if N % e == 0:
    print(N//e + 4)
  else:
    print(N//e + 5)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

L = [N,0,0,0,0,0]

time = 0
while L != [0,0,0,0,0,N]:
  if L[4] > e:
    L[5] = L[5] + e
    L[4] = L[4] - e
  else:
    L[5] = L[5] + L[4]
    L[4] = 0
  if L[3] > d:
    L[4] = L[4] + d
    L[3] = L[3] - d
  else:
    L[4] = L[4] + L[3]
    L[3] = 0
  if L[2] > c:
    L[3] = L[3] + c
    L[2] = L[2] - c
  else:
    L[3] = L[3] + L[2]
    L[2] = 0
  if L[1] > b:
    L[2] = L[2] + b
    L[1] = L[1] - b
  else:
    L[2] = L[2] + L[1]
    L[1] = 0
  if L[0] > a:
    L[1] = L[1] + a
    L[0] = L[0] - a
  else:
    L[1] = L[1] + L[0]
    L[0] = 0
  time = time + 1
  
print(time)

Fixed submission:
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if min(a,b,c,d,e) == a:
  if N % a == 0:
    print(N//a + 4)
  else:
    print(N//a + 5)
elif min(b,c,d,e) == b:
  if N % b == 0:
    print(N//b + 4)
  else:
    print(N//b + 5)
elif min(c,d,e) == c:
  if N % c == 0:
    print(N//c + 4)
  else:
    print(N//c + 5)
elif min(d,e) == d:
  if N % d == 0:
    print(N//d + 4)
  else:
    print(N//d + 5)
else:
  if N % e == 0:
    print(N//e + 4)
  else:
    print(N//e + 5)
Buggy python submission (verdict: Runtime Error):
if b="A":
  return{"T"}
elif b="T":
  return{"A"}
elif b="G":
  return{"C"}
else:
  return{"G"}

Fixed submission:
def change(x):
  if x == "A":
    return("T")
  elif x == "T":
    return("A")
  elif x == "C":
    return("G")
  elif x == "G":
    return("C")
  
b = input()
print(change(b))
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
List = []
for i in range(N-1):
  if S[i] == "A":
    if S[i+1] == "C":
      List.append(1)
    else:
      List.append(0)
  else:
    List.append(0)

for i in range(Q):
  l, r = map(int, input().split())
  A = List[l - 1 : r -1]
  print(A.count(1))

Fixed submission:
N,Q = map(int, input().split())
S = input()
List = [0]
p = 0
for i in range(N-1):
  if S[i] == "A":
    if S[i+1] == "C":
      p = p + 1
      List.append(p)
    else:
      List.append(p)
  else:
    List.append(p)

List.append(0)   
for i in range(Q):
  l, r = map(int, input().split())
  if List[l-2] == List[l-1]:
    print(List[r-1] - List[l-2])
  else:
    print(List[r-1] - List[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
for i in range(Q):
  l_i, r_i = map(int, input().split())
  A_i = S[l_i - 1 : r_i]
  count_i = 0
  for j in range(len(A_i) - 1):
    if A_i[j] == "A":
      if A_i[j+1] == "C":
        count_i = count_i + 1
  print(count_i)

Fixed submission:
N,Q = map(int, input().split())
S = input()
List = [0]
p = 0
for i in range(N-1):
  if S[i] == "A":
    if S[i+1] == "C":
      p = p + 1
      List.append(p)
    else:
      List.append(p)
  else:
    List.append(p)

List.append(0)   
for i in range(Q):
  l, r = map(int, input().split())
  if List[l-2] == List[l-1]:
    print(List[r-1] - List[l-2])
  else:
    print(List[r-1] - List[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
for i in range(Q):
  l_i, r_i = map(int, input().split())
  A_i = S[l_i - 1 : r_i]
  count_i = 0
  for j in range(len(A_i) - 1):
    if A_i[j] == "A" and A_i[j+1] == "C":
      count_i = count_i + 1
  print(count_i)

Fixed submission:
N,Q = map(int, input().split())
S = input()
List = [0]
p = 0
for i in range(N-1):
  if S[i] == "A":
    if S[i+1] == "C":
      p = p + 1
      List.append(p)
    else:
      List.append(p)
  else:
    List.append(p)

List.append(0)   
for i in range(Q):
  l, r = map(int, input().split())
  if List[l-2] == List[l-1]:
    print(List[r-1] - List[l-2])
  else:
    print(List[r-1] - List[l-1])
Buggy python submission (verdict: Runtime Error):
S = input()

if S <= 2019/04/30:
  print("Heisei")
else:
  print("TBD")

Fixed submission:
S = input()
 
if S <= "2019/04/30":
  print("Heisei")
else:
  print("TBD")
Buggy python submission (verdict: Time Limit Exceeded):
n,m,q = map(int, input().split())
List1 = [[0 for i in range(n)] for j in range(n)]
List2 = [[0 for i in range(n)] for j in range(n)]

for i in range(m):
  l,r = map(int, input().split())
  List1[l - 1][r - 1] += 1

for i in range(n):
  for j in range(i, n):
    for k in range(i, j + 1):
      for l in range(k, j + 1):
        List2[i][j] += List1[k][l]


for i in range(q):
  a, b = map(int, input().split())
  print(List2[a - 1][b - 1])

Fixed submission:
n,m,q = map(int, input().split())
List1 = [[0 for i in range(n+1)] for j in range(n+1)]
List2 = [[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
  l,r = map(int, input().split())
  List1[l - 1][r - 1] += 1


for i in range(n):
  for j in range(n - i):
    List2[j][j + i] = List2[j + 1][j + i] + List2[j][j + i - 1] - List2[j + 1][j + i - 1] + List1[j][j + i]


for i in range(q):
  a, b = map(int, input().split())
  print(List2[a - 1][b - 1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m,q = map(int, input().split())
List = [[0 for i in range(n)] for j in range(n)]

for i in range(m):
  l,r = map(int, input().split())
  for j in range(l):
    for k in range(r - 1, n):
      List[j][k] += 1
for i in range(q):
  a, b = map(int, input().split())
  print(List[a - 1][b - 1])

Fixed submission:
n,m,q = map(int, input().split())
List1 = [[0 for i in range(n+1)] for j in range(n+1)]
List2 = [[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
  l,r = map(int, input().split())
  List1[l - 1][r - 1] += 1


for i in range(n):
  for j in range(n - i):
    List2[j][j + i] = List2[j + 1][j + i] + List2[j][j + i - 1] - List2[j + 1][j + i - 1] + List1[j][j + i]


for i in range(q):
  a, b = map(int, input().split())
  print(List2[a - 1][b - 1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
min = min(S[1:].count("E"), S[:N-1].count("W"))

for i in range(1,N-1):
  p = S[:i].count("W") + S[i + 1:].count("E")
  if p < min:
    min = p
print(min)

Fixed submission:
N = int(input())
S = input()
Lw = [0]*N
Le = [0]*N

cw = 0
ce = 0
for i in range(N):
  if S[i] == "W":
    cw += 1
  Lw[i] = cw
  if S[N - 1 - i] == "E":
    ce += 1
  Le[N-1-i] = ce

min = min(Le[1], Lw[N-2])
for i in range(1, N-1):
  p = Le[i + 1] + Lw[i - 1]
  if p < min:
    min = p

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
Lw = []
Le = []

cw = 0
ce = 0
for i in range(N):
  if S[i] == "W":
    cw += 1
  Lw.append(cw)
  if S[N - 1 - i] == "E":
    ce += 1
  Le.insert(0, ce)

min = min(Le[1], Lw[N-2])
for i in range(1, N-1):
  p = Le[i + 1] + Lw[i - 1]
  if p < min:
    min = p

print(min)

Fixed submission:
N = int(input())
S = input()
Lw = [0]*N
Le = [0]*N

cw = 0
ce = 0
for i in range(N):
  if S[i] == "W":
    cw += 1
  Lw[i] = cw
  if S[N - 1 - i] == "E":
    ce += 1
  Le[N-1-i] = ce

min = min(Le[1], Lw[N-2])
for i in range(1, N-1):
  p = Le[i + 1] + Lw[i - 1]
  if p < min:
    min = p

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

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append([b, e])
        b, e = b + 1, 0
    if n > 1:
        fct.append([n, 1])
    return fct

n = int(input())
mod = 10 ** 9 + 7

l = [0] * (n + 1)

for i in ranfge(1, n + 1):
  soi = factorize(i)
  for j in range(len(soi)):
    l[soi[j][0]] += soi[j][1]

ans = 1
for i in range(1, n + 1):
  ans = ans * (l[i] + 1) % mod

print(ans)


Fixed submission:
import math
 
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append([b, e])
        b, e = b + 1, 0
    if n > 1:
        fct.append([n, 1])
    return fct
 
n = int(input())
mod = 10 ** 9 + 7
 
l = [0] * (n + 1)
 
for i in range(1, n + 1):
  soi = factorize(i)
  for j in range(len(soi)):
    l[soi[j][0]] += soi[j][1]
 
ans = 1
for i in range(1, n + 1):
  ans = ans * (l[i] + 1) % mod
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
List = list(map(int, input().split()))
res=0
for i in range(N-1):
  a = List[i] % 1000000007
  for j in range(i+1,N):
    b =  List[j] % 1000000007
    res += a*b
print(res%1000000007)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
midList = [0]*(N-1)
mid = 0
for i in range(N-2,-1,-1):
  mid += List[i+1]
  midList[i] = mid
res=0
for i in range(N-1):
  a = List[i] % 1000000007
  b =  midList[i] % 1000000007
  res += a*b
print(res%1000000007)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(int, input().split())))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uni = UnionFind(N)
for i in range(M):
  uni.union(List[i][0],List[i][1])
res = 0
for i in range(N):
  res = max(res,uni.size(i))
print(res)

Fixed submission:
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(int, input().split())))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uni = UnionFind(N)
for i in range(M):
  uni.union(List[i][0]-1,List[i][1]-1)
res = 0
for i in range(N):
  res = max(res,uni.size(i))
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
List=list(S)
flag=True
mid = ""
res = 0
for i in range(N):
  if List[i] == "R":
    pass
  else:
    for j in range(N-1,-1,-1):
      if i == j:
        flag=False
        break
      if List[j] == "R":
        List[i]="R"
        List[j]="W"
        res += 1
        break
  if flag == False:
    break
for i in range(N-1):
  if List[i] == "W" and List[i+1] == "R":
    List[i+1] == "W"
    res +=1
    break
print(res)

Fixed submission:
N = int(input())
S = input()
List=list(S)
flag=True
mid = ""
res = 0
n = List.count("R")
k=0
for i in range(n):
  if List[i] == "W":
    res += 1
print(res)
Buggy python submission (verdict: Runtime Error):
N=int(input())
List = list(map(int, input().split()))
Row = int(input())
QList = []
for i in range (Row):
  QList.append(list(map(int, input().split())))
dictA ={}
res = 0
for i in range (N):
  dictA.setdefault(List[i],0) 
  dictA[List[i]] += 1
  res += List[i]
for i in range(Row):
  num = dictA[QList[i][0]] 
  res = res - dictA[QList[i][0]] * QList[i][0]
  dictA[QList[i][0]] = 0
  dictA[QList[i][1]] += num
  res += QList[i][1] * num
  print(res)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
Row = int(input())
QList = []
for i in range (Row):
  QList.append(list(map(int, input().split())))
dictA ={}
res = 0
for i in range (N):
  dictA.setdefault(List[i],0) 
  dictA[List[i]] += 1
  res += List[i]
num = 0
for i in range(Row):
  if QList[i][0] not in dictA:
    pass
  else:
    num = dictA[QList[i][0]] 
    res = res - dictA[QList[i][0]] * QList[i][0]
    dictA[QList[i][0]] = 0
    dictA.setdefault(QList[i][1],0) 
    dictA[QList[i][1]] += num
    res += QList[i][1] * num
  print(res)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
List = list(map(int, input().split()))
res =1
for i in range(a):
  res = res *List[i]
if res > 1000000000000000000:
  res = -1
print(res)

Fixed submission:
a=int(input())
List = list(map(int, input().split()))
res =1
List.sort()
for i in range(a):
  res = res *List[i]
  if res > 1000000000000000000:
    res = -1
    break
  elif res == 0:
    break
  else:
    pass
print(res)
Buggy python submission (verdict: Runtime Error):
,b=map(float,input().split())
res = a*b
res = int(res)
print(res)

Fixed submission:
import decimal
a,b=map(str,input().split())
RES = decimal.Decimal(a)*decimal.Decimal(b)
res = int(RES)
print(res)

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

Fixed submission:
import decimal
a,b=map(str,input().split())
RES = decimal.Decimal(a)*decimal.Decimal(b)
res = int(RES)
print(res)
Buggy python submission (verdict: Runtime Error):
N= int(input())
num = N % 10

if num == 3:
  print("bon")
elif num == 0 or num == 1 or num == 6 or num == 8:
  print("pon")
else
 print("hon")

Fixed submission:
N= int(input())
num = N % 10

if num == 3:
  print("bon")
elif num == 0 or num == 1 or num == 6 or num == 8:
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Time Limit Exceeded):
a1,b0,cn1,d=map(int,input().split())
Output = 0

for i in range(d):
  if i < a1:
    Output = Output + 1
  elif i < a1+b0:
    pass
  else:
    Output = Output - 1  
print(Output)

Fixed submission:
a1,b0,cn1,d=map(int,input().split())
Output = 0

if a1 < d:
    Output = a1
    if a1+b0 < d:
      c = d-a1-b0
      Output = Output - c
    elif a1 + b0 >= d:
      pass
elif a1 >= d:
    Output = d
else:
  print("weird")
print(Output)
Buggy python submission (verdict: Runtime Error):
s=input()
if s == ARC:
  print("ABC")
elif s == ABC:
  print("ARC")
else:
  print("input is wrong")

Fixed submission:
s=input()
if s == "ARC":
  print("ABC")
elif s == "ABC":
  print("ARC")
else:
  print("input is wrong")
Buggy python submission (verdict: Runtime Error):
x = int(input())
a = 0
b = 0
i = 0
flag = 0
while i < 100 :
  c = i**5
  d = (x-c)**0.2
  e = d.is_integer()
  if e == True:
    flag = 1
    b = int(d)
    a = int(i)
    break
  else:
    pass
  i = i + 1
if flag == 0:
  print("impossible")
elif flag == 1:
  print(a,b)

Fixed submission:
x = int(input())
resA = 0
resB = 0
for a in range(500):
  for b in range(-500,500):
    A = a**5
    B = b**5
    N= A-B
    if A-B==x:
      resA = a
      resB = b
      break
    else:
      pass
  if A-B==x:
    break
print(resA,resB)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
List = list(map(int, input().split()))
res = 0
A = [[0 for j in range(N)] for i in range(N)]
B = [[0 for j in range(N)] for i in range(N)]
for i in range(N):
  for j in range(i,N):
    if A[j][i] != 0:
      pass
    else:
      A[i][j] = List[i]+List[j]
      B[i][j] = A[i][j]-abs(j-i)
      if B[i][j] == 0:
        res = res + 1
print(res)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
m = {}
ans = 0
for i in range(n):
    x = A[i] + i   #i番目と当該数字の和
    if x not in m:
        m[x] = 0   #和の属性値を0とする
    m[x] += 1      #和の属性値に１を足す
    if i - A[i] in m: #i番目と当該数字の差
        ans += m[i - A[i]] #差の位置に当たる属性値を答えに足す
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
List = list(map(int, input().split()))
res = 0
A = [[0 for j in range(N)] for i in range(N)]
B = [[0 for j in range(N)] for i in range(N)]
for i in range(N):
  for j in range(N):
    if A[j][i] != 0:
      pass
    else:
      A[i][j] = List[i]+List[j]
      B[i][j] = A[i][j]-abs(j-i)
      if B[i][j] == 0:
        res = res + 1
print(res)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
m = {}
ans = 0
for i in range(n):
    x = A[i] + i   #i番目と当該数字の和
    if x not in m:
        m[x] = 0   #和の属性値を0とする
    m[x] += 1      #和の属性値に１を足す
    if i - A[i] in m: #i番目と当該数字の差
        ans += m[i - A[i]] #差の位置に当たる属性値を答えに足す
print(ans)
Buggy python submission (verdict: Runtime Error):
Row = int(input())
List = []
for i in range (Row):
  List.append(int(input()))
s_l = set(List)
print(len(s_l))

Fixed submission:
Row = int(input())
List = []
for i in range (Row):
  List.append(input())
s_l = set(List)
print(len(s_l))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())
List1 = []
for i in range(1,N+1):
  List1.append(i)
x = itertools.product(List1,List1,List1)
tryList= list(x)
res = 0

for i in tryList:
  res += gcd_list(i)
print(res)

Fixed submission:
import math

N = int(input())
n = 0
m = 0
res =0 
List1 = ["INF"]*(N+1)
for i in range(1,N+1):
  for j in range(1,N+1):
    n = math.gcd(i,j)
    if List1[n] == "INF":
      for k in range(1,N+1):
        m += math.gcd(n,k)
      res += m
      List1[n] = m
      m = 0
    else:
      res += List1[n]
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c=map(int,input().split())
n = a // (b+c)
m = a - (b+c)*n
res = n*b
for i in range(m):
  if i < b:
    res += 1
print(res)

Fixed submission:
a,b,c=map(int,input().split())
n = a // (b+c)
m = a - (b+c)*n
res = n*b
if m < b:
  res += m
else:
  res += b
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

Row = int(input())
List = []
for i in range (Row):
  List.append(input())
c = collections.Counter(List)
tryList = []
k=""
for i in range(len(c)):
  if c.most_common()[i][1] == c.most_common()[0][1]:
    tryList.append(c.most_common()[i][0])
  else:
    break
tryList.sort()
for element in tryList:
  print(element)

Fixed submission:
Row = int(input())
dictA= {}
a = ""
mid = 0
for i in range (Row):
  a = input()
  dictA.setdefault(a,0) 
  dictA[a] += 1
  mid = max(mid, dictA[a])
sDict = sorted(dictA.items())
for i in range(len(dictA)):
  if sDict[i][1]== mid:
    print(sDict[i][0])

Buggy python submission (verdict: Time Limit Exceeded):
import collections

Row = int(input())
List = []
for i in range (Row):
  List.append(input())
c = collections.Counter(List)
tryList = []
k=""
s_l = set(List)
n= len(s_l)
for i in range(n):
  k=s_l.pop()
  if List.count(k) == c.most_common()[0][1]:
    tryList.append(k)
tryList.sort()
for element in tryList:
  print(element)

Fixed submission:
Row = int(input())
dictA= {}
a = ""
mid = 0
for i in range (Row):
  a = input()
  dictA.setdefault(a,0) 
  dictA[a] += 1
  mid = max(mid, dictA[a])
sDict = sorted(dictA.items())
for i in range(len(dictA)):
  if sDict[i][1]== mid:
    print(sDict[i][0])

Buggy python submission (verdict: Time Limit Exceeded):
Row = int(input())
List = []
for i in range (Row):
  List.append(input())
mid = 0
s_l = set(List)
n = len(s_l)
for i in range(n):
  mid = max(mid,List.count(s_l.pop()))
s_l = set(List)
k=""
tryList = []
for i in range(n):
  k=s_l.pop()
  if List.count(k) == mid:
    tryList.append(k)
tryList.sort()
for element in tryList:
  print(element)

Fixed submission:
Row = int(input())
dictA= {}
a = ""
mid = 0
for i in range (Row):
  a = input()
  dictA.setdefault(a,0) 
  dictA[a] += 1
  mid = max(mid, dictA[a])
sDict = sorted(dictA.items())
for i in range(len(dictA)):
  if sDict[i][1]== mid:
    print(sDict[i][0])
Buggy python submission (verdict: Runtime Error):
a,b=map(str,input().split())
res = ""
if a < b:
  for i in range(b):
    res += a
else:
  for i in range(a):
  res += b
print(res)

Fixed submission:
a,b=map(str,input().split())
res = ""
if a < b:
  for i in range(int(b)):
    res += a
else:
  for i in range(int(a)):
    res += b
print(res)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ListN=[]*
List = []
keepOrder
for i in range(N):
  k = int(input())
  ListN.append(k)
  for j in range(k):
    List.append(list(map(int, input().split())))
for bits in range(2**N):
  keepOrder = list(bin(bits))
  flag= True
  print(bits,keepOrder)
  for j in range(N):
    if((bits>>j) & 1): 
      for k in range(ListN[j]):
        if keepOrder[List[k][0]-1]!=List[k][1]:
          flag = False
    else:
        if keepOrder[List[k][0]-1]==List[k][1]:
          flag = False
  if flag:
    res = max(res,keepOrder.count("1")
print(res)

Fixed submission:
N = int(input())
ListN=[0]
List = []
res =0
flag = True
mid =0
n =0
for i in range(N):
  k = int(input())
  n += k
  ListN.append(n)
  for j in range(k):
    List.append(list(map(int, input().split())))
#print(List)
for bits in range(2**N):
  mid=0
  flag= True
  for j in range(N):
    #print(bits,j,((bits>>j) & 1))
    if((bits>>j) & 1): 
      mid+= 1
      #print(ListN[j],ListN[j+1])
      for k in range(ListN[j],ListN[j+1]):
        mynum = bits
        #print(bits,List[k][0],(mynum>>List[k][0])&1, List[k][1])
        if ((mynum>>List[k][0]-1)&1) != List[k][1]:
          flag = False
          break
  #print(bits,flag,mid)
  if flag:
    res = max(res,mid)
print(res)
Buggy python submission (verdict: Runtime Error):
N=int(input())
List = list(map(int, input().split()))
wa = 0
k = 0
for i in range(N):
  if i + 1 == N:
    wa += List[0]*List[N-1]
  else:
    wa += List[i]*List[i+1]
print(res)

Fixed submission:
N=int(input())
List = list(map(int, input().split()))
wa = 0
for i in range(N):
  for j in range(N):
    if j == i:
      pass
    else:
      wa += List[i]*List[j]
wa = wa //2
print(wa)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 =1:
  n = int((N+1)/2)
else:
  n = int(N/2)
res = n/N
print(res)

Fixed submission:
N = int(input())
if N % 2 ==1:
  n = int((N+1)/2)
else:
  n = int(N/2)
res = n/N
print(res)