Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
h,w,m=map(int,input().split())
bomb=[list(map(int,input().split())) for i in range(m)]

num_h = [0] * (h+1)
num_w = [0] * (w+1)
bomb_set = set()
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
  
max_hs = [k for k,v in enumerate(num_h) if v == max(num_h)]
max_ws = [k for k,v in enumerate(num_w) if v == max(num_w)]

result = max(num_h) + max(num_w)
for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0)
print(result-1)


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

num_h = [0] * (h+1)
num_w = [0] * (w+1)
bomb_set = set()
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
  
max_h = max(num_h)
max_w = max(num_w)
max_hs = [k for k,v in enumerate(num_h) if v == max_h]
max_ws = [k for k,v in enumerate(num_w) if v == max_w]

result = max_h + max_w
for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0)
print(result-1)

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

num_h = [0] * (h+1)
num_w = [0] * (w+1)
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  
max_hs = [k for k,v in enumerate(num_h) if v == max(num_h)]
max_ws = [k for k,v in enumerate(num_w) if v == max(num_w)]

result = max(num_h) + max(num_w)
for i in max_hs:
  for j in max_ws:
    if [i,j] not in bomb:
      print(result)
      exit(0)
print(result-1)


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

num_h = [0] * (h+1)
num_w = [0] * (w+1)
bomb_set = set()
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
  
max_h = max(num_h)
max_w = max(num_w)
max_hs = [k for k,v in enumerate(num_h) if v == max_h]
max_ws = [k for k,v in enumerate(num_w) if v == max_w]

result = max_h + max_w
for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0)
print(result-1)

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

num_h = [0] * (h+1)
num_w = [0] * (w+1)
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  
max_hs = [k for k,v in enumerate(num_h) if v == max(num_h)]
max_ws = [k for k,v in enumerate(num_w) if v == max(num_w)]

flg = 0
for i in max_hs:
  for j in max_ws:
    if [i,j] not in bomb:
      flg = 1

result = max(num_h) + max(num_w)
if flg == 1:
  print(result)
else:
  print(result-1)

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

num_h = [0] * (h+1)
num_w = [0] * (w+1)
bomb_set = set()
for hi,wi in bomb:
  num_h[hi] += 1
  num_w[wi] += 1
  bomb_set.add((hi,wi))
  
max_h = max(num_h)
max_w = max(num_w)
max_hs = [k for k,v in enumerate(num_h) if v == max_h]
max_ws = [k for k,v in enumerate(num_w) if v == max_w]

result = max_h + max_w
for i in max_hs:
  for j in max_ws:
    if (i,j) not in bomb_set:
      print(result)
      exit(0)
print(result-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = input()

w = []
r = []
for i in range(n):
  if c[i] == 'W':
    w.append(i+1)
  else:
    r.append(i+1)

w_len = len(w)
r_len = len(r)
if w_len == 0 or r_len == 0:
  print(0)
  exit(0)

w_min = w[0]
r_max = r[r_len-1]
count = 0
for i in range(n):
  tmp = w[i]
  w[i] = r[r_len-i-1]
  r[r_len-i-1] = tmp
  count += 1
  
  w_min = w[count]
  r_max = r[r_len - count - 1]
  
  if r_max < w_min:
    print(count)
    exit(0)
print(count)

Fixed submission:
n = int(input())
c = input()

w = []
r = []
for i in range(n):
  if c[i] == 'W':
    w.append(i+1)
  else:
    r.append(i+1)

w_len = len(w)
r_len = len(r)
if w_len == 0 or r_len == 0:
  print(0)
  exit(0)

if w_len < r_len:
  search = w_len
else:
  search = r_len

w_min = w[0]
r_max = r[r_len-1]

if r_max < w_min:
  print(0)
  exit(0)

count = 0
for i in range(search):
  tmp = w[i]
  w[i] = r[r_len-i-1]
  r[r_len-i-1] = tmp
  count += 1
  
  if w_len > count and (r_len-count-1) >= 0:
    w_min = w[count]
    r_max = r[r_len - count - 1]
  else:
    w_min = w[w_len-1]
    r_max = r[0]
    
  if r_max < w_min:
    print(count)
    exit(0)
print(count)

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

w = []
r = []
for i in range(n):
  if c[i] == 'W':
    w.append(i+1)
  else:
    r.append(i+1)

w_len = len(w)
r_len = len(r)
if w_len == 0 or r_len == 0:
  print(0)
  exit(0)

count = 0
for i in range(n):
  tmp = w[i]
  w[i] = r[r_len-i-1]
  r[r_len-i-1] = tmp
  count += 1
  
  if max(r) < min(w):
    print(count)
    exit(0)
print(count)

Fixed submission:
n = int(input())
c = input()

w = []
r = []
for i in range(n):
  if c[i] == 'W':
    w.append(i+1)
  else:
    r.append(i+1)

w_len = len(w)
r_len = len(r)
if w_len == 0 or r_len == 0:
  print(0)
  exit(0)

if w_len < r_len:
  search = w_len
else:
  search = r_len

w_min = w[0]
r_max = r[r_len-1]

if r_max < w_min:
  print(0)
  exit(0)

count = 0
for i in range(search):
  tmp = w[i]
  w[i] = r[r_len-i-1]
  r[r_len-i-1] = tmp
  count += 1
  
  if w_len > count and (r_len-count-1) >= 0:
    w_min = w[count]
    r_max = r[r_len - count - 1]
  else:
    w_min = w[w_len-1]
    r_max = r[0]
    
  if r_max < w_min:
    print(count)
    exit(0)
print(count)
Buggy python submission (verdict: Runtime Error):
x=int(input())

if 400 <= x <= 599:
  print('8');
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  rint('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')

Fixed submission:
x=int(input())

if 400 <= x <= 599:
  print('8');
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  print('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

for i in range(1,n+1):
  count = 0
  for x in range(1,99):
    for y in range(1,99):
      for z in range(1,99):
        fn = (x+y)**2 + (y+z)**2 + (z+x)**2
        if fn > 2*i:
          break
        if fn == 2*i:
          count += 1
  print(count)


Fixed submission:
n=int(input())

result = [0] * (n+1)
for x in range(1,99):
  for y in range(1,99):
    for z in range(1,99):
      fn = x*x + y*y + z*z + x*y + y*z + z*x
      if fn > n:
        break
      result[fn] += 1

for i in range(1,n+1):
  print(result[i])

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

for i in range(1,n+1):
  count = 0
  for x in range(1,101):
    for y in range(1,101):
      if (x+y)**2 > 2*i:
        break
      for z in range(1,101):
        fn = (x+y)**2 + (y+z)**2 + (z+x)**2
        if fn > 2*i:
          break
        if fn == 2*i:
          count += 1
  print(count)

Fixed submission:
n=int(input())

result = [0] * (n+1)
for x in range(1,99):
  for y in range(1,99):
    for z in range(1,99):
      fn = x*x + y*y + z*z + x*y + y*z + z*x
      if fn > n:
        break
      result[fn] += 1

for i in range(1,n+1):
  print(result[i])

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

for i in range(1,n+1):
  count = 0
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        fn = (x+y)**2 + (y+z)**2 + (z+x)**2
        if fn > 2*i:
          break
        if fn == 2*i:
          count += 1
  print(count)

Fixed submission:
n=int(input())

result = [0] * (n+1)
for x in range(1,99):
  for y in range(1,99):
    for z in range(1,99):
      fn = x*x + y*y + z*z + x*y + y*z + z*x
      if fn > n:
        break
      result[fn] += 1

for i in range(1,n+1):
  print(result[i])
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

count = 0
spend = 0
ia = 0
ib = 0
while spend < k:
  if ia < n and A[ia] < B[ib]:
    spend += A[ia]
    ia += 1
    if ia == n:
      ia = n-1
  elif ib < m and A[ia] >= B[ib]:
    spend += B[ib]
    ib += 1
    if ib < m:
      ib = m-1
  elif ia == n-1:
    spend += B[ib]
    ib += 1
    if ib < m:
      ib = m-1
  elif ib == m-1:
    spend += A[ia]
    ia += 1
    if ia == n:
      ia = n-1
    
  count += 1
print(count-1)

Fixed submission:
n,m,k=map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

b = [0] * (m+1)
for i in range(m):
  b[i+1] = b[i] + B[i]

from bisect import bisect_right

result = 0
a = k
for i in range(n+1):
  index = bisect_right(b, a)
  hon = (index - 1) + (i)
  result = max(result, hon)
  if i < n:
    a -= A[i]
  if a < 0:
    break
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

def fac(n):
    f = []
    c = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            #f.append(i)
            c += 1
            if i != n // i:
                #f.append(n//i)
                c += 1
    return c*n

result = 0
for i in range(1,n+1):
  result += fac(i)
print(result)

Fixed submission:
n=int(input())

a=[0]*(n+1)
for i in range(1,n+1):
  for j in range(i,n+1,i):
    a[j] += 1

result = 0
for i in range(n+1):
  result += i*a[i]
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

A=[0]*(10**5+1)
for i in range(10**5+1):
  A[i] = a.count(i)

sum_tmp = sum(a)
for i in range(q):
  b = bc[i][0]
  c = bc[i][1]
  A[c] += A[b]
  sum_tmp += (c-b) * A[b]
  A[b] = 0
  
  print(sum_tmp)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

A=[0]*(10**5+1)
for i in range(n):
  A[a[i]] += 1

sum_tmp = sum(a)
for i in range(q):
  b = bc[i][0]
  c = bc[i][1]
  A[c] += A[b]
  sum_tmp += (c-b) * A[b]
  A[b] = 0
  
  print(sum_tmp)

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

for i in range(q):
  sum = 0
  for j in range(n):
    if bc[i][0] == a[j]:
      sum += bc[i][1]
      a[j] = bc[i][1]
    else:
      sum += a[j]
  print(sum)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

A=[0]*(10**5+1)
for i in range(n):
  A[a[i]] += 1

sum_tmp = sum(a)
for i in range(q):
  b = bc[i][0]
  c = bc[i][1]
  A[c] += A[b]
  sum_tmp += (c-b) * A[b]
  A[b] = 0
  
  print(sum_tmp)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))

total=0
for i in range(n):
  total=total^a[i]
  
result=[]
for i in range(n):
  result.append(total^a[i])
L=' '.join(result)
print(L)

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

total = 0
for i in range(n):
  total = total ^ a[i]

for i in range(n):
  print(total^a[i])
Buggy python submission (verdict: Runtime Error):
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(1,101))
s_p=set(p)

min_dis=100
for i in all-s_p:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_i)

Fixed submission:
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(-100,102))
s_p=set(p)
kouho=sorted(all-s_p)

min_dis=201
for i in kouho:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_i)

Buggy python submission (verdict: Runtime Error):
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(1,101))
s_p=set(p)

min_dis=100
for i in all-s_p:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_dis, min_i)

Fixed submission:
x,n=map(int, input().split())
if n == 0:
  print(x)
  exit()
p=list(map(int, input().split()))
all=set(range(-100,102))
s_p=set(p)
kouho=sorted(all-s_p)

min_dis=201
for i in kouho:
  dis=abs(i-x)
  if min_dis > dis:
    min_i=i
    min_dis=dis
print(min_i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
a_set=set(a)
a_uni=list(a_set)

kazu=[0]*(10*6+1)
for i in a_uni:
  for j in range(1,len(a_uni), i):
    kazu[j] += 1

count = 0
for i in a_uni:
  if kazu[i] == 1:
    count += 1
print(count)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
kazu=[0]*(10**6+1)
for i in a:
  for j in range(i,10**6+1, i):
    if j > 10**6+1:
      break
    if kazu[i] >= 2:
      break
    kazu[j] += 1

count = 0
for i in a:
  if kazu[i] == 1:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
a_set=set(a)
a_uni=list(a_set)

kazu=[0]*(10**6)
for i in a_uni:
  for j in range(10**6):
    if i*j >= 10 ** 6:
      break
    kazu[i*j] += 1

count = 0
for i in a_uni:
  if kazu[i] == 1:
    count += 1
print(count)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
kazu=[0]*(10**6+1)
for i in a:
  for j in range(i,10**6+1, i):
    if j > 10**6+1:
      break
    if kazu[i] >= 2:
      break
    kazu[j] += 1

count = 0
for i in a:
  if kazu[i] == 1:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split)
print(a*b)

Fixed submission:
a,b=map(int, input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A = list(map(int, input().split()))
result=1
limit=10**18
flg0=0
for i in range(n):
  if A[i] == 0:
    flg0=1
    print('0')
for i in range(n):
  if flg0 == 1:
    break
  result *= A[i]
  if result > limit:
    print('-1')
    flg=1
    break
if flg != 1 and flg0 != 1:
  print(result)

Fixed submission:
n=int(input())
A = list(map(int, input().split()))
result=1
limit=10**18
flg0=0
flg=0
for i in range(n):
  if A[i] == 0:
    flg0=1
    print('0')
for i in range(n):
  if flg0 == 1:
    break
  result *= A[i]
  if result > limit:
    print('-1')
    flg=1
    break
if flg != 1 and flg0 != 1:
  print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A = list(map(int, input().split()))
result=1
limit=10**18
for i in range(n):
  result *= A[i]
if result > limit:
  print('-1')
else:
  print(result)

Fixed submission:
n=int(input())
A = list(map(int, input().split()))
result=1
limit=10**18
flg0=0
flg=0
for i in range(n):
  if A[i] == 0:
    flg0=1
    print('0')
for i in range(n):
  if flg0 == 1:
    break
  result *= A[i]
  if result > limit:
    print('-1')
    flg=1
    break
if flg != 1 and flg0 != 1:
  print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int, input().split()))

logk = k.bit_length()
doubling = []
for _ in range(logk):
  tmp = [0] * n
  doubling.append(tmp)

for i in range(n):
  doubling[0][i] = a[i] - 1

for i in range(1,logk):
  for j in range(n):
    doubling[i][j] = doubling[i-1][doubling[i-1][j]]

now = 0
pos = 0
while k:
  if k & 1:
    now = doubling[pos][now]
  k = k >> 1
  pos += 1

print(now+1)


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

visited = [-1]*(n+1)
pos = 1
visited[pos] = 0
loop = 0
root=[1]
for i in range(1,n+1):
  pos = a[pos-1]
  if visited[pos] == -1:
    visited[pos] = i
    root.append(pos)
  else:
    loop = i - visited[pos]
    mae = visited[pos]
    break
if k < mae:
  print(root[k])
else:
  index=(k-mae)%loop
  print(root[index+mae])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
Aall = set(range(1, N))
Ak = []
for i in range(N*2):
  #d = input()
  A = list(map(int, input().split()))
  if i % 2 == 1:
    Ak.extend((A))
print(len(Aall - set(Ak)))

Fixed submission:
N, K = map(int, input().split())
Aall = set(list(range(1, N+1)))
A = []
for i in range(N*2):
  try: 
    if i % 2 != 0:
      a = list(map(int, input().split()))
      A.extend(a)
    else:
      d = list(map(int, input().split()))
  except EOFError:
    d = 1
print(len(Aall-set(A)))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
Aall = set(range(1, N))
Ak = []
for i in range(N):
  d = input().split()
  A = list(map(int, input().split()))
  Ak.extend((A))
print(len(Aall - set(Ak)))

Fixed submission:
N, K = map(int, input().split())
Aall = set(list(range(1, N+1)))
A = []
for i in range(N*2):
  try: 
    if i % 2 != 0:
      a = list(map(int, input().split()))
      A.extend(a)
    else:
      d = list(map(int, input().split()))
  except EOFError:
    d = 1
print(len(Aall-set(A)))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()[::-1]
counts = [0] * 2019
counts[0] = 1
digit = 1
sum = 0
for c in s:
  sum += int(c) * digit
  digit = digit * 10 
  amari = sum % 2019
  counts[amari] += 1

result = 0
for c in counts:
  result += c * (c - 1) // 2

print(result)

Fixed submission:
s = input()[::-1]
counts = [0] * 2019
counts[0] = 1
digit = 1
sum = 0
for c in s:
  sum = (sum + int(c) * digit) % 2019
  digit = digit * 10 % 2019
  counts[sum] += 1

result = 0
for c in counts:
  result += c * (c - 1) // 2

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()[::-1]
counts = [0] * 2019
counts[0] = 1
digit = 1
sum = 0
for c in s:
  sum += int(c) * digit
  digit = digit * 10 
  amari = sum % 2019
  counts[amari] += 1

result = 0
for c in counts:
  result += c * (c - 1) // 2

print(result)

Fixed submission:
s = input()[::-1]
counts = [0] * 2019
counts[0] = 1
digit = 1
sum = 0
for c in s:
  sum = (sum + int(c) * digit) % 2019
  digit = digit * 10 % 2019
  counts[sum] += 1

result = 0
for c in counts:
  result += c * (c - 1) // 2

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

from itertools import combinations as comb
count = 0
for a in comb(range(1,n+1),3):
  i = a[0] - 1
  j = a[1] - 1
  k = a[2] - 1
  if j-i == k-j:
    continue
  if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
    count += 1
print(count)

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

r = 0
g = 0
b = 0
for i in s:
  if i == 'R':
    r += 1
  elif i == 'G':
    g += 1
  else:
    b += 1

all = r*g*b
ho = 0
for i in range(0,n):
  for j in range(i+1,n):
    if s[i] == s[j]:
      continue
    k = 2*j-i
    if k >= n:
      continue
    if s[i] == s[k] or s[j] == s[k]:
      continue
    ho += 1
print(all-ho)
Buggy python submission (verdict: Runtime Error):
l=int(input())

import numpy as np
result = 0
for x in np.arange(l/3-0.1, l/3+0.1, 0.1):
  for y in np.arange(x, l/3+0.1, 0.1):
    z = l - (x+y)
    if z <= 0:
      break
    v = x*y*z
    result = max(v, result)
print(result)

Fixed submission:
n,m=map(int,input().split())
print( int((n+m)*(n+m-1)/2 - n*m) )
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

inp = [0]*(n+1)
for i in range(n):
  inp[a[i]] += 1

count = [0] * (n)
for i in range(n):
  if count[a[i]] != 0:
    continue
  
  inp[a[i]] -= 1
  for j in range(1,n):
    if inp[j] <= 0:
      continue
    count[a[i]] += inp[j]*(inp[j]-1) // 2
  inp[a[i]] += 1

for i in range(n):
  print(count[a[i]])

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

def choose2(n):
  if n <= 1:
    return 0
  return n*(n-1)//2

inp = [0]*(n+1)
for i in range(n):
  inp[a[i]] += 1

total = 0
for i in range(n+1):
  total += choose2(inp[i])

for i in range(n):
  count = total - choose2(inp[a[i]]) + choose2(inp[a[i]]-1)
  print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[str(input()) for _ in range(n)]

from collections import Counter
results = Counter(s)

max_key_list = [kv[0] for kv in results.items() if kv[1] == max(results.values())]
for i in sorted(max_key_list):
  print(i)


Fixed submission:
n=int(input())
s=[str(input()) for _ in range(n)]

from collections import Counter
results = Counter(s)

max_num = results.most_common()[0][1]
max_key_list = [kv[0] for kv in results.items() if kv[1] == max_num]
for i in sorted(max_key_list):
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
for i in range(n):
  s.append(input())

from collections import Counter
results = Counter(s)

max_key_list = [kv[0] for kv in results.items() if kv[1] == max(results.values())]
for i in sorted(max_key_list):
  print(i)


Fixed submission:
n=int(input())
s=[str(input()) for _ in range(n)]

from collections import Counter
results = Counter(s)

max_num = results.most_common()[0][1]
max_key_list = [kv[0] for kv in results.items() if kv[1] == max_num]
for i in sorted(max_key_list):
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))

def kitai(n):
  result = 0
  for i in range(1,n+1):
    result += i
  return result/n

s=[0]*(n+1)
for i in range(n):
  s[i+1] = s[i] + p[i]

resi = 0
tmp = 0
for i in range(n-k+1):
  if s[i+k]-s[i] > tmp:
    resi = i
    tmp = s[i+k]-s[i]

result = 0
for i in range(resi,k+resi):
  result += kitai(p[i])
print(result)

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

def kitai(n):
  result = 0
  for i in range(1,n+1):
    result += i
  return result/n

s=[0]*(n+1)
for i in range(n):
  s[i+1] = s[i] + p[i]

resi = 0
tmp = 0
for i in range(n-k+1):
  if s[i+k]-s[i] > tmp:
    resi = i
    tmp = s[i+k]-s[i]

result = 0
for i in range(resi,k+resi):
  result += kitai(p[i])
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
h,n=map(int,input().split())
magics=[list(map(int,input().split())) for i in range(n)]

import numpy as np

dp = np.full((n+1, h+1), 10**10)
dp[0][0]=0
for i in range(0,n):
  damage = magics[i][0]
  cost = magics[i][1]
  for j in range(0,h+1):
    dp[i+1][j] = min( dp[i+1][j], dp[i][j] )

    to = min( j+damage, h )
    dp[i+1][to] = min( dp[i+1][j]+cost, dp[i+1][to] )
                                                 
print(dp[n][h])

Fixed submission:
h,n=map(int,input().split())
magics=[list(map(int,input().split())) for i in range(n)]

#import numpy as np

#dp = np.full((n+1, h+1), 10**10)
dp=[[10**10 for _ in range(h+1)]for _ in range(n+1)]
dp[0][0]=0
for i in range(0,n):
  damage = magics[i][0]
  cost = magics[i][1]
  for j in range(0,h+1):
    dp[i+1][j] = min( dp[i+1][j], dp[i][j] )

    to = min( j+damage, h )
    dp[i+1][to] = min( dp[i+1][j]+cost, dp[i+1][to] )
                                                 
print(dp[n][h])
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int, input().split())

left = 0
right = 10**9 + 1

while (right - left > 1):
  mid = (left + right ) // 2
  if (a*mid+b*len(str(mid))) > x:
    right = mid
  else:
    left = mid
print(left)


Fixed submission:
s = input()
youbi = ['SUN','MON','TUE','WED','THU','FRI','SAT']
index = youbi.index(s)

day = 7 - index
if day == 0:
  print('7')
else:
  print(day)