Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import copy

n = int(input())
#res = []
table = ['a']

def dfs(s, time, table):
    tab = copy.deepcopy(table)
    l = len(tab)
    mi = ord(s[0])
    for i in range(time):
        if mi < ord(s[i]):
            mi = ord(s[i])
            if s[i] in tab:
                 pass
            else:
                tab.append(s[i])
    mi += 1
    
    if time == n:
        #print(tab)
        if s in res:
            pass
        else:
            #res.append(s)
            print(s)
    else:
        #dfs(s+chr(mi), time+1, tab)
        for i in range(l):
            dfs(s+tab[i], time+1, tab)
        dfs(s+chr(mi), time+1, tab)
            
dfs('a', 1, table)

#res.sort()
#for i in range(len(res)):
#    print(res[i])

Fixed submission:
n = int(input())
lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

for i in range(1, 33):
    if i == n:
        print(lis[i-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
l = []
i = 0
res = 0

while i < n:
    save = i
    i += a
    if i < n:
        res += a
        i += b
    elif i > n:
        res += n - save

print(res)

Fixed submission:
n, a, b = map(int, input().split())
k = a + b
i = 0
res = 0

y = n // k  
res += y * a

x = k * y

if x + a <= n:
    res += a
elif x + a > n:
    res += n - x
    
print(res)
Buggy python submission (verdict: Runtime Error):
List = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

ans = [[0,0,0] for i in range(3)]
ans1 = [[0,0,0] for i in range(3)]

res = False

for i in range(n):
    for a in range(3):
        for c in range(3):
            if b[n] == List[a][c]:
                ans[a][c] = 1
                ans1[c][a] = 1
                
if ans[1][1] == 1:
    if ans[0][0] > 0 and ans[2][2] > 0:
        res = True
    if ans[2][0] > 0 and ans[0][2] > 0:
        res = True
                
for i in range(3):
    if ans[i][0] > 0 and ans[i][1] > 0 and ans[i][2] > 0:
        res = True
    if ans1[i][0] > 0 and ans1[i][1] > 0 and ans1[i][2] > 0:
        res = True
   
            
if res:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())

ans = n // 2

if n % 2 == 0:
    print(ans)
else:
    print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
List = list(map(int, input().split()))
flag = True

for i in range(n):
    if flag:
        obj = List[i]
        for j in range(i+1, n - i):
            if obj == List[j]:
                flag = False
        
if flag:
    print('YES')
else:
    print('NO')

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

def ha(st):
    return len(st) != len(set(st))

if ha(List):
    print('NO')
else:
    print('YES')
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = list(map(int, input().split()))
list.sort()
list.reverse()

a = 0
b = 0

for i in list:
  if i % 2 == 0:
    a += list[i]
  else:
    b += list[i]

print(a - b)

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

a = 0
b = 0

for i in range(len(list)):
  if i % 2 == 0:
    a += list[i]
  else:
    b += list[i]

print(a - b)
Buggy python submission (verdict: Runtime Error):
def(a, b)
  c = a * b
  if(c % 2 == 0):
  	print("Even")
  else:
    print("Odd")
  

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
def(a, b)
  c = a * b
  if(c % 2 == 0)
  	print("Even")
  else
    print("Odd")
  

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
def(a, b)
  c = a * b
  if(c / 2 == 0)
  	print("Even")
  else
    print("Odd")
  

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int, input().split()))
res = 0

d.sort()
first = d[0]

for i in range(1, n):
  if first < d[i]:
    res += 1
  first = d[i]
  
print(res)

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
res = 1

d.sort()
first = d[0]

for i in range(1, n):
  if first < d[i]:
    res += 1
  first = d[i]
  
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(int, input().split())
res = 0

d.sort()
first = d[0]

for i in range(1, n):
  if first > d[i]:
    res += 1
  first = d[i]
  
print(res)

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
res = 1

d.sort()
first = d[0]

for i in range(1, n):
  if first < d[i]:
    res += 1
  first = d[i]
  
print(res)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(int, input().split())
res = 0

d.sort()
first = d[0]

for i in range(1, n):
  if first > range[i]:
    res += 1
  first = range[i]
  
print(res)

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
res = 1

d.sort()
first = d[0]

for i in range(1, n):
  if first < d[i]:
    res += 1
  first = d[i]
  
print(res)
Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())

a = -1
b = -1
c = -1

for i in range(n):
  for t in range(i, n):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      a = i
      b = t - i
      c = n - t
      
print(x, y, z)

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

a = -1
b = -1
c = -1

for i in range(n + 1):
  for t in range(i, n + 1):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      a = i
      b = t - i
      c = n - t
      
print(a, b, c)

Buggy python submission (verdict: Runtime Error):
n = int(input())
y = int(input())

x = -1
y = -1
z = -1

for i in range(n):
  for t in range(i, n):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      x = i
      y = t - i
      z = n - t
      
print(x, y, z)

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

a = -1
b = -1
c = -1

for i in range(n + 1):
  for t in range(i, n + 1):
    sum = 10000 * i + 5000 * (t - i)  + 1000 * (n - t)
    if sum == y:
      a = i
      b = t - i
      c = n - t
      
print(a, b, c)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
x = 0

for i in range(1:n+1):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += sum
    
print(x)

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

for i in range(1, n+1):
  q = i // 10000
  qi = i % 10000
  w = qi // 1000
  wi = qi % 1000
  e = wi // 100
  ei = wi % 100
  r = ei // 10
  ri = ei % 10
  t = ri
  sum = q + w + e + r + t
  if sum >= a and sum <= b:
    x += i
    
print(x)

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

for i in range(1:n+1):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += 1
    
print(x)

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

for i in range(1, n+1):
  q = i // 10000
  qi = i % 10000
  w = qi // 1000
  wi = qi % 1000
  e = wi // 100
  ei = wi % 100
  r = ei // 10
  ri = ei % 10
  t = ri
  sum = q + w + e + r + t
  if sum >= a and sum <= b:
    x += i
    
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
list = list(map(int, input().split()))
b = 0

while True:
  for i in range(n):
    if(list[i] % 2 == 0):
      list[i] = list[i] / 2
    else:
      break
  b += 1
     
print(b)
      

Fixed submission:
n = int(input())
list = list(map(int, input().split()))
b = -1
cont = True

while cont:
  b += 1
  for i in range(n):
    if(list[i] % 2 == 0):
      list[i] = list[i] / 2
    else:
      cont = False
     
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
res = 0

for x in range(k+1):
  if x <= s:
    for y in range(k+1):
      if (x + y) <= s:
        for z in range(k+1):
          if (x + y + z) == s:
            res += 1
        
print(res)

Fixed submission:
k, s = map(int, input().split())
res = 0

for x in range(k+1):
  for y in range(k+1):
    z = s - (x + y)
    if z >= 0 and z <= k:
      res += 1
        
print(res)

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

for x in range(k+1):
  if x <= s:
  	for y in range(k+1):
      if (x + y) <= s:
    	for z in range(k+1):
      		if (x + y + z) == s:
        		res += 1
        
print(res)

Fixed submission:
k, s = map(int, input().split())
res = 0

for x in range(k+1):
  for y in range(k+1):
    z = s - (x + y)
    if z >= 0 and z <= k:
      res += 1
        
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
res = 0

for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if (x + y + z) == s:
        res += 1
        
print(res)

Fixed submission:
k, s = map(int, input().split())
res = 0

for x in range(k+1):
  for y in range(k+1):
    z = s - (x + y)
    if z >= 0 and z <= k:
      res += 1
        
print(res)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)

res = 0

def part_sum(cur, i):
  if i != n:
    res += part_sum(cur+s[i], i+1)
    res += part_sum(cur+s[i]+"+", i+1)
  else:
    cur += s[i]
    return sum(list(map(int, cur.split("+")))) 
  
part_sum("", 0)
print(res)

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

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)

res = 0

def part_sum(cur, i):
  if i != n:
    part_sum(cur+s[i], i+1)
    part_sum(cur+s[i]+"+", i+1)
  else:
    cur += s[i]
    res += sum(list(map(int, cur.split("+")))) 
  
part_sum("", 0)
print(res)

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

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)

res = 0

def part_sum(cur, i):
  if i != n:
    part_sum(cur+s[i], i+1)
    part_sum(cur+s[i]+"+", i+1)
  else:
    cur += s[i]
    res += sum(list(map(int, cur.split("+")))) 
  
part_sum([], 0)
print(res)

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

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)

res = 0

def part_sum(cur, i):
  if i != n:
    part_sum(cur+s[i], i+1)
    part_sum(cur+"+"+s[i], i+1)
  else:
    cur += s[i]
    res += sum(list(map(int, res.split("+")))) 
  
part_sum([], 0)
print(res)

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

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

count=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            tmp_number=str(i) + str(j) + str(k)
            # print(tmp_number)
            itti_keta = 0
            for n in range(N):
                if S[n]==tmp_number[itti_keta]:
                    itti_keta+=1
                    if itti_keta==3:
                        break
            if itti_keta == 3:
                count+=1
print(count)


Fixed submission:
N=int(input())
S=input()

count=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            tmp_number=str(i) + str(j) + str(k)
            a = S.find(tmp_number[0])
            if a == -1:
                continue
            b = S[(a+1):].find(tmp_number[1])
            # print(S[a:])
            if b == -1:
                continue
            c = S[(a+b+2):].find(tmp_number[2])
            # print(S[(a+b):])
            if c == -1:
                continue
            count+=1
            # print(a,b,c)
            # print(tmp_number)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
Q = int(input())
point=[]
query=[]
for i in range(Q):
    l,r=[int(i) for i in input().split()]
    point.append(l)
    point.append(r)
    query.append([l,r])
# print(point)
point_uniq = list(set(point))
# print(point_uniq)
point_sorted = sorted(point_uniq)
# print(point_sorted)

#ふるい
SIZE=100001
is_prime=[True for i in range(SIZE)]
is_prime[0]=False
is_prime[1]=False
for i in range(2,SIZE):
    # print(i,is_prime)
    if is_prime[i]==False:
        continue
    else:
        tmp=i+i
        while(tmp<SIZE):
            is_prime[tmp]=False
            tmp+=i

MIN=point_sorted[0]
MAX=point_sorted[-1]
N_count=0
index=1
range_N=[]
for i in range(MIN,MAX+1):
    if i%2==0:
        continue
    if is_prime[i]==True and is_prime[int((i+1)/2)]==True:
        N_count+=1
    if i==point_sorted[index]:
        index+=1
        range_N.append([MIN,i,N_count])
# print(range_N)

for q in query:
    ans=0
    l_index=point_sorted.index(q[0])
    r_index=point_sorted.index(q[1])
    # print(q,l_index,r_index)
    if l_index==r_index:
        ans=1 if is_prime[q[0]] and is_prime[int((q[0]+1)/2)] else 0
    elif l_index==0:
        ans=range_N[r_index-1][2]
    else:
        ans=range_N[r_index-1][2]-range_N[l_index-1][2]
        if is_prime[q[0]] and is_prime[int((q[0]+1)/2)]:
            ans+=1
    print(ans)


Fixed submission:
Q = int(input())
point=[]
query=[]
for i in range(Q):
    l,r=[int(i) for i in input().split()]
    point.append(l)
    point.append(r)
    query.append([l,r])
# print(point)
point_uniq = list(set(point))
# print(point_uniq)
point_sorted = sorted(point_uniq)
# print(point_sorted)

def binary_search(list,target):

	result = -1
	left = 0
	right = len(list) - 1

	while left <= right:
		center = (left + right)//2
		if list[center] == target:
			result = center
			break
		elif list[center] < target:
			left = center + 1
		elif list[center] > target:
			right = center - 1

	return result


#ふるい
SIZE=100001
is_prime=[True for i in range(SIZE)]
is_prime[0]=False
is_prime[1]=False
for i in range(2,SIZE):
    # print(i,is_prime)
    if is_prime[i]==False:
        continue
    else:
        tmp=i+i
        while(tmp<SIZE):
            is_prime[tmp]=False
            tmp+=i

MIN=point_sorted[0]
MAX=point_sorted[-1]
N_count=0
index=1
range_N=[]
for i in range(MIN,MAX+1):
    if i%2==0:
        continue
    if is_prime[i]==True and is_prime[int((i+1)/2)]==True:
        N_count+=1
    if i==point_sorted[index]:
        index+=1
        range_N.append([MIN,i,N_count])
# print(range_N)

for q in query:
    ans=0
    l_index=binary_search(point_sorted,q[0])
    r_index=binary_search(point_sorted,q[1])

    # l_index=point_sorted.index(q[0])
    # r_index=point_sorted.index(q[1])
    # print(q,l_index,r_index)
    if l_index==r_index:
        ans=1 if is_prime[q[0]] and is_prime[int((q[0]+1)/2)] else 0
    elif l_index==0:
        ans=range_N[r_index-1][2]
    else:
        ans=range_N[r_index-1][2]-range_N[l_index-1][2]
        if is_prime[q[0]] and is_prime[int((q[0]+1)/2)]:
            ans+=1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)

# ans=0
# for i in range(N):
#     part1=A[i]
#     part2_pos=bisect.bisect_right(B,part1)
#     for j in range(part2_pos,N):
#         part2=B[j]
#         part3_pos=bisect.bisect_right(C,part2)
#         # print(i,j,part3_spos,": ",A[i],B[j],C[part3_pos])
#         ans+=(N-part3_pos)
# print(ans)

AtoB_Pos=[]
BtoC_Pos=[]
ans=0
for i in range(N):
    B_Pos=bisect.bisect_right(B,A[i])
    AtoB_Pos.append(B_Pos)

for i in range(N):
    C_Pos=bisect.bisect_right(C,B[i])
    BtoC_Pos.append(C_Pos)
# print(AtoB_Pos)
# print(BtoC_Pos)
for i in range(N):
    for j in range(AtoB_Pos[i],N):
        # print(i,j,": ",A[i],B[j])
        # print(N-AtoB_Pos[i],N-BtoC_Pos[j])
        ans+=(N-BtoC_Pos[j])
print(ans)


Fixed submission:
import bisect

N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)

ans=0
for j in range(N):
    a_num=bisect.bisect_left(A,B[j])
    c_num=bisect.bisect_right(C,B[j])
    # print(B[j],A[:a_num],C[c_num:])
    # print(a_num,c_num)
    ans+=a_num*(N-c_num)
print(ans)

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

N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)

ans=0
for i in range(N):
    part1=A[i]
    part2_pos=bisect.bisect_right(B,part1)
    for j in range(part2_pos,N):
        part2=B[j]
        part3_pos=bisect.bisect_right(C,part2)
        # print(i,j,part3_spos,": ",A[i],B[j],C[part3_pos])
        ans+=(N-part3_pos)
print(ans)


Fixed submission:
import bisect

N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)

ans=0
for j in range(N):
    a_num=bisect.bisect_left(A,B[j])
    c_num=bisect.bisect_right(C,B[j])
    # print(B[j],A[:a_num],C[c_num:])
    # print(a_num,c_num)
    ans+=a_num*(N-c_num)
print(ans)
Buggy python submission (verdict: Runtime Error):
import copy

def set(adjacent,edge):
    for x in edge:
        adjacent[x[0]].append(x[1])
        adjacent[x[1]].append(x[0])

    
def search(goal,path):
    n = path[len(path) - 1]
    if n == goal:
        print(path)
    else:
        for x in adjacent[n]:
            if x not in path:
                path.append(x)
                search(goal, path)
                path.pop()

def search_loop_node(adjacent,start,path,node_loops):
    n = path[len(path)-1]
    for x in adjacent[n]:
        if x == start and len(path) >=2 and path[-2] != start :
            path.append(x)
            node_loops.append(copy.deepcopy(path))
            path.pop()
        elif x not in path:
            path.append(x)
            search_loop_node(adjacent,start, path,node_loops)
            path.pop()

def main():
    #入力
    N, M = [int(i) for i in input().split()]
    edge = []
    for i in range(M):
        a,b = [int(i) for i in input().split()]
        edge.append([a,b])

    #辺の生成
    adjacent=[ [] for i in range(N+1)]
    loops=[]
    set(adjacent,edge)
    #ループの検索
    for i in range(N):
        search_loop_node(adjacent,i,[i],loops)
    #ループに属する辺(橋でない辺)の検索
    not_bridge = []
    for loop in loops:
        pre_node = loop[0]
        for node in loop:
            if pre_node < node and [pre_node, node] not in not_bridge:
                not_bridge.append([pre_node,node])
            pre_node = node
    #答えは全体の辺の数からループでないものを引いた数
    print(M-len(not_bridge))
    
if __name__ == '__main__':
    main()

Fixed submission:
A,B,C = [int(i) for i in input().split()]

if(A==B):
    print(C)
elif(A==C):
    print(B)
else :
    print(A)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
ans = 0
for i in range(n-2):
  if a[i]=='A' and a[i+1]=='B' and a[i+2]=='C':
    ans+=1
print(ans)

Fixed submission:
n = int(input())
a = list(input())
ans = 0
for i in range(n-2):
  if a[i]=='A' and a[i+1]=='B' and a[i+2]=='C':
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(input())
a[k-1] = chr(ord(a[k-1]) + ord(a)-ord('A'))
print(''.join(a))

Fixed submission:
n,k = map(int,input().split())
a = list(input())
a[k-1] = chr(ord(a[k-1]) + ord('a') - ord('A'))
print(''.join(a))
Buggy python submission (verdict: Runtime Error):
s = int(input())
if not s[0] == s[1] == s[2]:
    print('No')
else: print('Yes')

Fixed submission:
s = input()
if s[0] == s[1] == s[2]:
    print('No')
else: print('Yes')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().spilt())
y = 1
while n > 1:
    y += 1
    n = n // k
print(y)


Fixed submission:
n, k = map(int, input().split())
i = k
y = 1
while n >= i:
    y += 1
    i *= k
print(y)

Buggy python submission (verdict: Runtime Error):
n, k = map(input().spilt())
y = 1
while n > 1:
    y += 1
    n = n // k
print(y)

Fixed submission:
n, k = map(int, input().split())
i = k
y = 1
while n >= i:
    y += 1
    i *= k
print(y)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
s.sort()
p = [s[0]]
for i in range(1,len(s)):
    if s[i] != s[i-1]:
        p.append(s[i])
k = [] 
for i in p:
    k.append(s.count(i))
max_k = max(k)
for i in range(len(p)):
    if k[i] == max_k:
        print(p[i])

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
s.sort()
p = [s[0]]
k = [1]
for i in range(1,len(s)):
    if s[i] != s[i-1]:
        p.append(s[i])
        k.append(1)
    else: k[-1] += 1
max_k = max(k)
for i in range(len(p)):
    if k[i] == max_k:
        print(p[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
for i in range(1, n):
    if p[i] in p[:i]:
        print('NO')
        break
else: print('YES')

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
q = set(p)
if len(p) == len(q):
    print('YES')
else: print('NO')
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
def aez(n, k):
    s = str(n)
    ln = len(s)-1
    n1 = int(s[0])
    if k == 1:
        return 9 * ln + n1 
    elif k == 2:
        return (81 * ln * (ln-1) // 2) + aez(int('9'*ln), 1)*(n1-1) + aez(int(s[1:]), 1)
    else:
        return (729*ln*(ln-1)*(ln-2)//6) + aez(int('9'*ln), 2)*(n1-1) + aez(int(s[1:]), 2)
print(aez(a, b))

Fixed submission:
a = int(input())
b = int(input())
def aez(n, k):
    s = str(n)
    ln = len(s)-1
    n1 = int(s[0])
    if len(s) < k:
        return 0
    else:
        if k == 1:
            return 9 * ln + n1 
        elif k == 2:
            return (81 * ln * (ln-1) // 2) + aez(int('9'*ln), 1)*(n1-1) + aez(int(s[1:]), 1)
        else:
            return (729*ln*(ln-1)*(ln-2)//6) + aez(int('9'*ln), 2)*(n1-1) + aez(int(s[1:]), 2)
print(aez(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
for i in range(k):
  h[h.index(max(h))] = 0
print(sum(h))

Fixed submission:
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
if n <= k:
    print(0)
else:
    h.sort()
    print(sum(h[0:len(h)-k]))