Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8

import fractions

def check(l):
	l = list(map(int, l.split()))
	print(len(l), len([x for x in l if x % 2 == 0]), len([x for x in l if x % 2 == 1]))
	if max(l) >= 30001:
		print("max >= 30001")
		return False

	if len(set(l)) != len(l):
		print("not unique")
		return False

	tmp = l[0]


	for i in range(len(l) - 1):
		tmp = fractions.gcd(tmp, l[i+1])
	if tmp != 1:
		print("gcd is 1")
		return False 

	for i in range(len(l)):
		if fractions.gcd(l[i], sum(l) - l[i]) == 1:
			print("not special")
			return False

	return True


def main(n):
	if n == 3:
		return "2 5 63"

	sub1 = [str(i * 3) for i in range(1, 10001) if i % 2 == 1]
	sub2 = [str(i) for i in range(1, 30000) if i % 2 == 0 and i % 3 != 0]
	sub3 = [str(i) for i in range(1, 30001) if i % 6 == 0]
	if n <= 5003:
		if n % 2 == 0:
			s = "2 4 " + " ".join([str(x) for x in sub[0:(n-2)]])
			return(s)
		else:
			s = "2 4 6 " + " ".join([str(x) for x in sub[0:(n-3)]])
			return(s)
	elif n <= 15000:
		sub = [i * 3 for i in range(1, 10001) if i % 2 == 1]
		if n % 2 == 0:
			s = " ".join(sub2[0:(n-5000)]) + " " +  " ".join(sub1)
			return(s)
		else:
			s = " ".join(sub2[0:(n-5001)]) + " 6 " +  " ".join(sub1)
			return(s)
	else:
		s = " ".join(sub2) + " " +  " ".join(sub1) + " " + " ".join(sub3[0:(n-15000)]) 
		return(s)

if __name__ == '__main__':
	n = int(input())
	#print(check(main(n)))
	#print(main(20000))
	print(check(main(20000)))
	#print(check("2 4 3 20001"))
	#for i in range(5001, 5006):
	#	ans = main(i)
	#	print(i, check(ans))
	

Fixed submission:
# encoding:utf-8

import fractions

def check(l):
	l = list(map(int, l.split()))
	print(len(l), len([x for x in l if x % 2 == 0]), len([x for x in l if x % 2 == 1]))
	if max(l) >= 30001:
		print("max >= 30001")
		return False

	if len(set(l)) != len(l):
		print("not unique")
		return False

	tmp = l[0]


	for i in range(len(l) - 1):
		tmp = fractions.gcd(tmp, l[i+1])
	if tmp != 1:
		print("gcd is 1")
		return False 

	for i in range(len(l)):
		if fractions.gcd(l[i], sum(l) - l[i]) == 1:
			print("not special")
			return False

	return True


def main(n):
	if n == 3:
		return "2 5 63"

	sub1 = [str(i * 3) for i in range(1, 10001) if i % 2 == 1]
	sub2 = [str(i) for i in range(1, 30000) if i % 2 == 0 and i % 3 != 0]
	sub3 = [str(i) for i in range(1, 30001) if i % 6 == 0]
	if n <= 5003:
		if n % 2 == 0:
			s = "2 4 " + " ".join([str(x) for x in sub1[0:(n-2)]])
			return(s)
		else:
			s = "2 4 6 " + " ".join([str(x) for x in sub1[0:(n-3)]])
			return(s)
	elif n <= 15000:
		if n % 2 == 0:
			s = " ".join(sub2[0:(n-5000)]) + " " +  " ".join(sub1)
			return(s)
		else:
			s = " ".join(sub2[0:(n-5001)]) + " 6 " +  " ".join(sub1)
			return(s)
	else:
		s = " ".join(sub2) + " " +  " ".join(sub1) + " " + " ".join(sub3[0:(n-15000)]) 
		return(s)

if __name__ == '__main__':
	n = int(input())
	#print(check(main(n)))
	#print(check(main(15)))
	#print(check(main(17)))
	#print(check(main(5002)))
	#print(check(main(5003)))
	#print(check(main(15002)))
	#print(check(main(15003)))
	print(main(n))
	#print(check("2 4 3 20001"))
	#for i in range(5001, 5006):
	#	ans = main(i)
	#	print(i, check(ans))
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
def main():
	n = int(input())
	nums = list(map(int, input().split()))

	counter = 0
	for i in range(n):
		if nums[i] == i + 1:
			nums[i], nums[i + 1] = nums[i + 1], nums[i]
			counter += 1

	print(counter)

if __name__ == '__main__':
	main()

Fixed submission:
# encoding:utf-8
def main():
	n = int(input())
	nums = list(map(int, input().split()))

	counter = 0
	for i in range(n - 1):
		if nums[i] == i + 1:
			nums[i], nums[i + 1] = nums[i + 1], nums[i]
			counter += 1

	if nums[n - 1] == n:
		counter += 1

	print(counter)

if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import sys
 
def main():
	n = int(input())
	vers = [list(map(int, input().split())) for _ in range(n - 1)]
	q, k = list(map(int, input().split()))
	queries = [list(map(int, input().split())) for _ in range(q)]
 
	#n = 10 ** 5
	#vers = [[i + 1, i + 2, 10 ** 9] for i in range(n - 1)]
 
	new_vers = mapping(n, vers)
	dist = calcMinDist(n, new_vers, k, queries)
	calcQueries(dist, queries, k)
	
def mapping(n, vers):
	new_vers = {i :[] for i in range(n)}
	for ver in vers:
		new_vers[ver[0] - 1].append((ver[1], ver[2]))
		new_vers[ver[1] - 1].append((ver[0], ver[2]))
	return new_vers
 
def calcMinDist(n, new_vers, k, queries):
	dist = [- 1 for _ in range(n)]
	flag = [False for _ in range(n)]
	dist[k - 1] = 0
	flag[k - 1] = True
	dfs(new_vers, dist, flag, k)
	return dist
 
def dfs(new_vers, dist, flag, frm):
	flag[frm - 1] = True
	vs = new_vers[frm - 1]
	for v in vs:
		if flag[v[0] - 1] == False:
			dist[v[0] - 1] = dist[frm - 1] + v[1]
			new_ver, dist, flag, _ = dfs(new_vers, dist, flag, v[0])
 
	return [new_vers, dist, flag, frm]
 
def calcQuery(dist, query, k):
	print(dist[query[0] - 1] + dist[query[1] - 1])
 
def calcQueries(dist, queries, k):
	for query in queries:
		calcQuery(dist, query, k)
 
if __name__ == '__main__':
	sys.setrecursionlimit(1000000)
	main()

Fixed submission:
def main():
	n = int(input())
	a = n // 100
	b = n - (n // 10) * 10
	if a == b:
		print("Yes")
	else:
		print("No")
 
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8

def main():
	N = int(input())
	cards = list(map(int, input().split()))
	sum_cards = sum(cards)
	if N == 2:
		print(abs(cards[0] - cards[1]))
	else:
		out = min([abs(sum_cards - 2 * sum(cards[0:i])) for i in range(1, N-1)])
		print(out)

if __name__ == '__main__':
	main()

Fixed submission:
# encoding:utf-8

def main():
	N = int(input())
	cards = list(map(int, input().split()))

	x = cards[0]
	y = sum(cards[1:])
	i = 1
	val = abs(x - y)

	while i < len(cards) - 1:
		x += cards[i]
		y += -cards[i]
		temp = abs(x - y)
		
		if temp == 0:
			val = 0
			break
		if temp < val:
			val = temp

		i += 1

	print(val)

if __name__ == '__main__':
	main()

Buggy python submission (verdict: Time Limit Exceeded):
# encoding:utf-8

def main():
	N = int(input())
	cards = list(map(int, input().split()))

	if N == 2:
		print(abs(cards[0] - cards[1]))
	else:
		print(min([abs(calcDif(cards, x)) for x in range(1, N - 1)]))


def calcDif(cards, k):
	# k >= 1
	#print(k)
	x = cards[:k]
	y = cards[k:len(cards)]
	return(sum(x) - sum(y))

if __name__ == '__main__':
	main()

Fixed submission:
# encoding:utf-8

def main():
	N = int(input())
	cards = list(map(int, input().split()))

	x = cards[0]
	y = sum(cards[1:])
	i = 1
	val = abs(x - y)

	while i < len(cards) - 1:
		x += cards[i]
		y += -cards[i]
		temp = abs(x - y)
		
		if temp == 0:
			val = 0
			break
		if temp < val:
			val = temp

		i += 1

	print(val)

if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
import math

def main():
	N, A, B, C, D = list(map(int, input().split()))
	cur_list = [(A, A)]

	for i in range(N - 1):
		cur_list = calcNextList(cur_list, C, D)
		cur_list =[x for x in cur_list if x[0] >= 0 and x[1] <= 10 ** 9]
		cur_list = merge(cur_list)

	print(cur_list)
	for x in cur_list:
		if x[0] <= B <= x[1]:
			print("YES")
			break
	else:
		print("NO")


# def Enlarge(input_taple, D):
# 	return((input_taple[0] - D, input_taple[1] + D))

def Duplicate(input_taple, C, D):
	first_tuple = (input_taple[0] + C, input_taple[1] + D)
	second_tuple = (input_taple[0] - D, input_taple[1] - C)
	return([first_tuple, second_tuple])

def calcNextList(cur_list, C, D):
	next_list = []
	for x in cur_list:
		next_list.extend(Duplicate(x, C, D))
	return(next_list)

def merge(cur_list):
	cur_list.sort()

	next_list = [cur_list[0]]

	for i in range(len(cur_list) - 1):
		if next_list[-1][1] >= cur_list[i+1][0]:
			merged = (next_list[-1][0], max(next_list[-1][1], cur_list[i+1][1]))
			next_list.pop()
			next_list.append(merged)
		else:
			next_list.append(cur_list[i+1])

	return(next_list)

if __name__ == '__main__':
	main()

Fixed submission:
# encoding:utf-8
import math

def main():
	N, A, B, C, D = list(map(int, input().split()))

	for i in range(N):
		plus_band = calcBand(i, C, D)
		minus_band = calcBand(N - i - 1, C, D)
		total_band = (plus_band[0] - minus_band[1], plus_band[1] - minus_band[0])

		if total_band[0] <= B - A <= total_band[1]:
			print("YES")
			break
	else:
		print("NO")

def calcBand(n_band, C, D):
	return((C * n_band, D * n_band))

if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
n = int(input())
ary = list(map(int, input().split()))

if n % 2 == 0:
	out = [i for i in range(2, n, 2)]
	out.reverse()
	out.extend([i for i in range(1, n, 2)])
	out = list(map(str, out))
else:
	out = [i for i in range(1, n, 2)]
	out.reverse()
	out.extend([i for i in range(2, n, 2)])
	out = list(map(str, out))

print(" ".join(out))

Fixed submission:
# encoding:utf-8
a, b, c = list(map(int, input().split()))
print(min(a + b, b+ c, c + a))
Buggy python submission (verdict: Runtime Error):
# encoding:utf-8
def main():
	N = int(input())
	scores = list(map(int, input().split()))
	ranges_colored = set([x // 400 for x in scores if x <= 3199])
	n_colored = len(ranges_colored)
	n_free = len([x for x in scores if x > 3200])
	print(max(n_colored, 1), min(n_free + n_colored, 8))
	
if __name__ == '__main__':
	main()

Fixed submission:
# encoding:utf-8
def main():
	r, g, b = list(map(int, input().split()))
	if (r * 100 + g * 10 + b) % 4 == 0:
		print("YES")
	else:
		print("NO")
	
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
def main():
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    for m in range(0, M):
        tmp = [int(x) for x in input().split()]
        A.extend([tmp[1]] * tmp[0])

    A = A.sort(A, reverse = True)
    sum_a = 0
    for i in range(0, N):
        sum_a += A[i]

    print(sum_a)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    age, cost = map(int, input().split())

    if age <= 5:
        print(0)
    elif age >= 6 and age <= 12:
        print(cost // 2)
    else:
        print(cost)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    a, b, c = map(int, input().split())

    b // a >= c ? print(c) : print(b // a)

if __name__ == "__main__":
    main()


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

    if b // a >= c:
        print(c)
    else:
        print(b // a)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    h = [int(x) for x in input().split()]

    dp = [10000] * n
    dp[0] = 0

    for i in range(1, n):
        tmp = dp[i-1] + abs(h[i] - h[i - 1])
        if dp[i] > tmp:
            dp[i] = tmp
        if i > 1:
            tmp = dp[i - 2] + abs(h[i] - h[i - 2])
            if dp[i] > tmp:
                dp[i] = tmp

        print(dp)

    print(dp[n-1])

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    h = [int(x) for x in input().split()]

    dp = [float('inf')] * (2 * N)

    dp[0] = 0

    for i in range(1, N):
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
        if i > 1:
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

    print(dp[N-1])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    h, w = map(int, input().split())
    grid = []
    for height in range(0, h):
        grid.append(list(input()))

    replaced = []
    for height in range(0, h):
        replaced.append([0] * w)

    dx = [0, 0, 1, 1, 1, -1, -1, -1]
    dy = [1, -1, 1, -1, 0, 1, -1, 0]

    for height in range(0, h):
        for width in range(0, w):
            if grid[height][width] == '#':
                replaced[height][width] = '#'
            for i in range(0, 8):
                if (height + dy[i] < 0) or (height + dy[i] >= h) or (width + dx[i] < 0) or (width + dx[i] >= w):
                    continue
                if (grid[height + dy[i]][width + dx[i]]) == '#':
                    replaced[height][width] += 1

    for height in range(0, h):
        for width in range(0, w):
            print(replaced[height][width], end='')
        print()


if __name__ == "__main__":
  main()


Fixed submission:
def main():
    h, w = map(int, input().split())
    grid = []
    for height in range(0, h):
        grid.append(list(input()))

    replaced = []
    for height in range(0, h):
        replaced.append([0] * w)

    dx = [0, 0, 1, 1, 1, -1, -1, -1]
    dy = [1, -1, 1, -1, 0, 1, -1, 0]

    for height in range(0, h):
        for width in range(0, w):
            if grid[height][width] == '#':
                replaced[height][width] = '#'
                continue
            for i in range(0, 8):
                if (height + dy[i] < 0) or (height + dy[i] >= h) or (width + dx[i] < 0) or (width + dx[i] >= w):
                    continue
                if (grid[height + dy[i]][width + dx[i]]) == '#':
                    replaced[height][width] += 1

    for height in range(0, h):
        for width in range(0, w):
            print(replaced[height][width], end='')
        print()


if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;

int main(){
    string input_str;

    cin >> input_str;

    input_str[5] = ' ', input_str[13] = '';

    cout << input_str << endl;

    return 0;
}


Fixed submission:
def main():
    s = input()
    print(s.replace(",", " "))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;

int main(){
    string input_str;

    cin >> input_str;

    for (int i=0; i < input_str.size(); i++){
        if (input_str[i] == ',') input_str[i] = ' ';
    }

    cout << input_str << endl;

    return 0;
}


Fixed submission:
def main():
    s = input()
    print(s.replace(",", " "))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    list = [int(x) for x in input().split()]

    sum = x[0] + x[1] + x[2]
    max = x[0]
    if max <= x[1]:
        max = x[1]
    if max <= x[2]:
        max = x[2]

    if max * 2 == sum:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


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

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

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n, i = map(int, input())
print(n - i + 1)


Fixed submission:
n, i = map(int, input().split())
print(n - i + 1)
Buggy python submission (verdict: Runtime Error):
s = input().rstrip()

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


Fixed submission:
s = input().rstrip()

if s[0] != s[1] and s[1] != s[2] and s[2] != s[0]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

l = []
for i in range(a, b + 1):
    if i - a < k or b - i < k:
        l.append(i)

ans = '\n'.join(map(str, l))
print(ans)



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

l = []
for i in range(a, min(a + k, b + 1)):
    if i not in l:
        l.append(i)
for i in range(max(a, b - k + 1), b + 1):
    if i not in l:
        l.append(i)

ans = '\n'.join(map(str, l))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i - a < k or b - i < k:
        print(i)



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

l = []
for i in range(a, min(a + k, b + 1)):
    if i not in l:
        l.append(i)
for i in range(max(a, b - k + 1), b + 1):
    if i not in l:
        l.append(i)

ans = '\n'.join(map(str, l))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i - a < k or b - i < k:
        print(i)



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

l = []
for i in range(a, min(a + k, b + 1)):
    if i not in l:
        l.append(i)
for i in range(max(a, b - k + 1), b + 1):
    if i not in l:
        l.append(i)

ans = '\n'.join(map(str, l))
print(ans)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())

ans = 0

for i in range(1, n + 1):
    num = i
    total = 0
    while num != 0:
        total += num % 10
        num //= 10

    if a <= total <= b:
        ans += i

print(ans)


Fixed submission:
a, b, c, d = map(int, input().split())
l = a + b
r = c + d

if l == r:
    answer = 'Balanced'
elif l > r:
    answer = 'Left'
else:
    answer = 'Right'

print(answer)
Buggy python submission (verdict: Runtime Error):
s = input().rstrip()
t = input().rstrip()
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
    print('Yes')
else:
    print('No')


Fixed submission:
import math

a, b = map(int, input().split())
mean = (a + b) / 2
mean = math.ceil(mean)
print(mean)
Buggy python submission (verdict: Runtime Error):
_ = int(input())
l = list(map(int, input().split()))

ans = 10 ** 9

for n in l:
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    ans = min(ans, count)

print(ans)


Fixed submission:
s = input()
print(s.count('1'))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()

ans=0
for i in range(k):
  ans+=l[k]

print(ans)

Fixed submission:
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()
 
ans=0
for i in range(k):
  ans+=l[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()
sum=0
for i in range(k):
  sum+=l[k]
print(sum)

Fixed submission:
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()
 
ans=0
for i in range(k):
  ans+=l[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C,K= map(int,input().split())

if A >= K:
  print(K)
elif (A+B) >= K
  print(A)
else:
  nok =K-(A+B)
  print(A-nok)

Fixed submission:
A,B,C,K= map(int,input().split())

if A >= K:
  print(K)
elif (A+B) >= K:
  print(A)
else:
  nok =K-(A+B)
  print(A-nok)
Buggy python submission (verdict: Time Limit Exceeded):
import math 
n=[int(_) for _ in input().split()]
step = math.ceil(n[1]/n[0])
ans=0
for i in range(1,n[2]+1,step):
  tmp=math.floor(n[0]*i/n[1])-(n[0]*math.floor(i/n[1]))
  if tmp>ans:
    ans=tmp
print(ans)


Fixed submission:
import math
a,b,n=map(int,input().split())
c=min(b-1,n)
f=math.floor(a*c/b)
print(f)

Buggy python submission (verdict: Time Limit Exceeded):
import math 
A,B,n=map(int,input().split())
step = math.ceil(B/A)
ans=0
for i in range(1,n+1,step):
  tmp=math.floor(A*i/B)-(A*math.floor(i/B))
  if tmp>ans:
    ans=tmp
print(ans)


Fixed submission:
import math
a,b,n=map(int,input().split())
c=min(b-1,n)
f=math.floor(a*c/b)
print(f)

Buggy python submission (verdict: Time Limit Exceeded):
import math 
A,B,n=map(int,input().split())
step = math.ceil(B/A)
ans=0
for i in range(1,n+1,step):
  tmp=math.floor(A*i/B)-(A*math.floor(i/B))
  if tmp>ans:
    ans=tmp
print(ans)

Fixed submission:
import math
a,b,n=map(int,input().split())
c=min(b-1,n)
f=math.floor(a*c/b)
print(f)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input.split())
if a<=b:
  print('unsafe')
else:
  print('safe')

Fixed submission:
a,b=map(int,input().split())
if a<=b:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
N=int(input()):
cnt=0
for i in range(1,N+1):
  if i%3==0:
    continue
  if i%5==0:
    continue
  if i%15==0:
    continue
  else:
    cnt+=i
print(cnt)

Fixed submission:
N=int(input())
cnt=0
for i in range(1,N+1):
  if i%3==0:
    continue
  if i%5==0:
    continue
  if i%15==0:
    continue
  else:
    cnt+=i
print(cnt)
Buggy python submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=[int(_) for _ input().split()]
a=0
for i in range(N-1):
  tmp=A[i+1]-A[i]
  if a<tmp:
    a=tmp
print(K-a)

Fixed submission:
K,N=map(int,input().split())
A=[int(_) for _ in input().split()]
a=K-A[N-1]+A[0]
for i in range(N-1):
  tmp=A[i+1]-A[i]
  if a<tmp:
    a=tmp

print(K-a)
Buggy python submission (verdict: Runtime Error):
import statistics
n=int(input())
x=[int(_) for _ in input().split()]
mid=int(statistics.mean(x))
mmid=mid-1
cnt=0
cntm=0
for i in range(len(x)):
  cnt+= (x[i]-mid)**2
  cntm+=(x[i]-mmid)**2
print(min(cnt,cntm,cntp))
  

Fixed submission:
import statistics
n=int(input())
x=[int(_) for _ in input().split()]
mid=int(statistics.mean(x))
mmid=mid-1
pmid=mid+1
cnt=0
cntm=0
cntp=0
for i in range(len(x)):
  cnt+= (x[i]-mid)**2
  cntm+=(x[i]-mmid)**2
  cntp+=(x[i]-pmid)**2
print(min(cnt,cntm,cntp))
Buggy python submission (verdict: Runtime Error):
import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
most=c.most_common()[0][1]
if len(c)==1:
  print(c.most_common()[0][0])
else:
  for i in range(len(c)):
    print(c.most_common()[i][0])
    if c.most_common()[i+1][1] !=most:
      break


Fixed submission:
import collections
N = int(input())
s = [input() for i in range(N)]
 
counter = collections.Counter(s)
count = counter.most_common()
 
most = count[0][1]
 
c =[]
for i in range(len(count)):
    if count[i][1] == most:
        c.append(count[i][0])
 
c.sort()
 
for i in range(len(c)):
    print(c[i])

Buggy python submission (verdict: Runtime Error):
import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
most=c.most_comon()[0][1]
if len(c)==1:
  print(c.most_common()[0][0])
else:
  for i in range(len(c)):
    print(c.most_common()[i][0])
    if c.most_common()[i+1][1] !=most:
      break


Fixed submission:
import collections
N = int(input())
s = [input() for i in range(N)]
 
counter = collections.Counter(s)
count = counter.most_common()
 
most = count[0][1]
 
c =[]
for i in range(len(count)):
    if count[i][1] == most:
        c.append(count[i][0])
 
c.sort()
 
for i in range(len(c)):
    print(c[i])

Buggy python submission (verdict: Runtime Error):
import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
if len(c.most_common())==1:
  print(c.most_common()[0][0])
else:
  for i in range(len(c.most_common())):
    print(c.most_common()[i][0])
    if c.most_common()[i][1] !=c.most_common()[i+1][1]:
      break

Fixed submission:
import collections
N = int(input())
s = [input() for i in range(N)]
 
counter = collections.Counter(s)
count = counter.most_common()
 
most = count[0][1]
 
c =[]
for i in range(len(count)):
    if count[i][1] == most:
        c.append(count[i][0])
 
c.sort()
 
for i in range(len(c)):
    print(c[i])

Buggy python submission (verdict: Runtime Error):
import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
for i in range(len(c.most_common())):
  print(c.most_common()[i][0])
  if c.most_common()[i][1] !=c.most_common()[i+1][1]:
    break

Fixed submission:
import collections
N = int(input())
s = [input() for i in range(N)]
 
counter = collections.Counter(s)
count = counter.most_common()
 
most = count[0][1]
 
c =[]
for i in range(len(count)):
    if count[i][1] == most:
        c.append(count[i][0])
 
c.sort()
 
for i in range(len(c)):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
v=A.sum()
if v>=N:
  print('Yes')
else:
  print('No')

Fixed submission:
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
v=0
for i in range(K):
  v+=A[i]
if v>=N:
  print('Yes')
else:
  print('No')