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

#a.append(list(map(int, input().split())))
#b.append(list(map(int, input().split())))
#c.append(list(map(int, input().split())))
a= list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))


count = int(input())

for num in range(count):
    x = int(input())
    for y in range(3):
        if a[y] == x:
            a[y] = 0
    for y in range(3):
        if b[y] == x:
            b[y] = 0
    for y in range(3):
        if c[y] == x:
            c[y] = 0

#ans = 0
#ans = a[0] * a[1] * a[2]
#ans += b[0] * b[1] * b[2]
#ans += c[0] * c[1] * c[2]
#ans += a[0] * b[0] * c[0]
#ans += a[1] * b[1] * c[1]
#ans += a[2] * b[2] * c[2]

#if ans == 0:
#    print("Yes")
if a[0]+a[1]+a[2] == 0:
    print("Yes")
elif b[0]+b[1]+b[2] == 0:
    print("Yes")
elif c[0]+c[1]+c[2] == 0:
    print("Yes")
elif a[0] + b[0] + c[0] ==0:
    print("Yes")
elif a[1] + b[1] + c[1] ==0:
    print("Yes")
elif a[2] + b[2] + c[2] ==0:
    print("Yes")
elif a[0] + b[1] + c[2] == 0:
    print("Yes")
elif a[2] + b[1] + c[0] ==0:
    pritn("Yes")
else:
    print("No")


Fixed submission:

#a.append(list(map(int, input().split())))
#b.append(list(map(int, input().split())))
#c.append(list(map(int, input().split())))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))


count = int(input())

for num in range(count):
    x = int(input())
    for y in range(3):
        if a[y] == x:
            a[y] = 0
    for y in range(3):
        if b[y] == x:
            b[y] = 0
    for y in range(3):
        if c[y] == x:
            c[y] = 0

#ans = 0
#ans = a[0] * a[1] * a[2]
#ans += b[0] * b[1] * b[2]
#ans += c[0] * c[1] * c[2]
#ans += a[0] * b[0] * c[0]
#ans += a[1] * b[1] * c[1]
#ans += a[2] * b[2] * c[2]

#if ans == 0:
#    print("Yes")
if a[0]+a[1]+a[2] == 0:
    print("Yes")
elif b[0]+b[1]+b[2] == 0:
    print("Yes")
elif c[0]+c[1]+c[2] == 0:
    print("Yes")
elif a[0] + b[0] + c[0] ==0:
    print("Yes")
elif a[1] + b[1] + c[1] ==0:
    print("Yes")
elif a[2] + b[2] + c[2] ==0:
    print("Yes")
elif a[0] + b[1] + c[2] == 0:
    print("Yes")
elif a[2] + b[1] + c[0] ==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
s = list(map(int , input().split()))
v = defaultdict(int)
sumi = 0
for i in s:
    v[i]+=1
for i in v:
    if v[i]>=2:
        sumi+=v[i]*(v[i]-1)/2
for i in s:
    if v[i]>=2:

        if v[i]==2:
            print(int(sumi-1))
        else:
            print(int(sumi-v[i]*(v[i]-1)/2+(v[i]-2)*(v[i]-1)/2))
    else:
        print(int(sum))
    


Fixed submission:
n = int(input())
l =  input()
s= l.split(" ")
for i in range(len(s)):
    s[i] = int(s[i])
v = dict()
sumi = 0
for i in s:
    if not i in v:
        v[i] = 1
    else:
        v[i]+=1
for i in v:
    if v[i]>=2:
        sumi+=v[i]*(v[i]-1)/2
for i in s:
    if v[i]>=2:

        if v[i]==2:
            print(int(sumi-1))
        else:
            print(int(sumi-v[i]*(v[i]-1)/2+(v[i]-2)*(v[i]-1)/2))
    else:
        print(int(sumi))
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d,e=[int(input()) for i in range(5)]
x=[]
y=[]
def ceil(src, range):
  return ((int)(src / range) + 1 ) * range
for s in [a,b,c,d,e]:
  if s%10 != 0:
    x.append(s%10)
  y.append(ceil(s,10))
t=min(x)
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
  print(a+b+c+d+e)
else:
  ans = sum(y)
  ans= ans-10+t
  print(ans)

Fixed submission:
import math
a,b,c,d,e=[int(input()) for i in range(5)]
x=[]
y=[]
def ceil(src, range):
  return ((int)(src / range) + 1 ) * range
for s in [a,b,c,d,e]:
  if s%10 != 0:
    x.append(s%10)
    t=min(x)
  if s<10:
    y.append(10)
  elif s%10==0:
    y.append(s)
  else:
    y.append(ceil(s,10))
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
  print(a+b+c+d+e)
else:
  ans = sum(y)
  ans= ans-10+t
  print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e=[int(input()) for i in range(5)]
x=[]
y=[]
for s in [a,b,c,d,e]:
  if s%10 != 0:
    x.append(s%10)
  y.append(round(s,-1))
t=min(x)
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
  print(a+b+c+d+e)
else:
  ans = sum(y)
  ans= ans-10+t
  print(ans)

Fixed submission:
import math
a,b,c,d,e=[int(input()) for i in range(5)]
x=[]
y=[]
def ceil(src, range):
  return ((int)(src / range) + 1 ) * range
for s in [a,b,c,d,e]:
  if s%10 != 0:
    x.append(s%10)
    t=min(x)
  if s<10:
    y.append(10)
  elif s%10==0:
    y.append(s)
  else:
    y.append(ceil(s,10))
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
  print(a+b+c+d+e)
else:
  ans = sum(y)
  ans= ans-10+t
  print(ans)
Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N%500>A:
  print('No')
else:
  print('Yes')

Fixed submission:
N=int(input())
A=int(input())
if N%500>A:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b%2=0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Runtime Error):
import decimal
getcontext().prec = 20
S = decimal.Decimal(input()) 
s = S/3
print(decimal.Decimal(s**3))

Fixed submission:
import decimal
decimal.getcontext().prec = 20
S = decimal.Decimal(input()) 
s = S/3
print(decimal.Decimal(s**3))
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
an = N // (A+B) * A
rem = N % (A+B)
an += min(rem,A)
print(ans)

Fixed submission:
N, A, B = map(int, input().split())
an = N // (A+B) * A
rem = N % (A+B)
an += min(rem,A)
print(an)

Buggy python submission (verdict: Time Limit Exceeded):
S = input().split(" ")

n = int(S[0])
blue = int(S[1])
countB = 0
red = int(S[2])
countR = 0
shuki = blue + red
sh = 0
for i in range(1,n+1):
  amari = i % shuki
  if amari >=1 and amari <= blue:
    countB = countB +1
  else:
    countR = countR + 1
print(countB)

Fixed submission:
N, A, B = map(int, input().split())
an = N // (A+B) * A
rem = N % (A+B)
an += min(rem,A)
print(an)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
d={}
d1={}
ans=0
for i in l:
    if i not in d:
        d[i]=1
        d1[i]=1
    else:
        d[i]+=1
        d1[i]*=d[i]
for i in d1.keys():
    x=d1[i]//(d[i]*(d[i]-1))
    d1[i]=d1[i]//(2*x)
    ans+=d1[i]
for i in l:
    if d[i]>2:
        print(ans-d1[i]+(d1[i]*(abs(d[i]-2))//d[i]))
    elif d[i]==2:
        print(ans-1)
    else:
        print(ans)
    


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d={}
ans=0
for i in l:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d.keys():
    x=d[i]*(d[i]-1)//2
    ans+=x
for i in l:
    if d[i]>2:
        print(ans-(d[i]*(d[i]-1)//2)+((d[i]-1)*(d[i]-2)//2))
    elif d[i]==2:
        print(ans-1)
    else:
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def fac(x):
    a=1
    for i in range(2,x+1):
        a*=i
    return(a)
def npr(x,x1):
    return fac(x)//(fac(x-x1)*fac(x1))
n=int(input())
l=list(map(int,input().split()))
d={}
d1={}
ans=0
for i in l:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d.keys():
    x=npr(d[i],2)
    d1[i]=x
    ans+=x
for i in l:
    if d[i]>1:
        print(ans-d1[i]+npr(d[i]-1,2))
    else:
        print(ans)
    


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d={}
ans=0
for i in l:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d.keys():
    x=d[i]*(d[i]-1)//2
    ans+=x
for i in l:
    if d[i]>2:
        print(ans-(d[i]*(d[i]-1)//2)+((d[i]-1)*(d[i]-2)//2))
    elif d[i]==2:
        print(ans-1)
    else:
        print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()

ans = True

if len(s) == 1:
    print('No')
    exit(0)

while len(s) > 0:
    if s[0] == 'h' and s[1] == 'i':
        s = s[2:]
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
s = input()

ans = True

while len(s) > 0:
    if len(s) == 1:
        print('No')
        exit(0)
    if s[0] == 'h' and s[1] == 'i':
        s = s[2:]
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')

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

ans = True

while len(s) > 0:
    if s[0] == 'h' and s[1] == 'i':
        s = s[2:]
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
s = input()

ans = True

while len(s) > 0:
    if len(s) == 1:
        print('No')
        exit(0)
    if s[0] == 'h' and s[1] == 'i':
        s = s[2:]
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

x = -1

xa = 0
xb = 0

a_arr = []
b_arr = []

for temp_a in range(10001):
    xa = temp_a * 0.08
    if xa // 1 == a:
        a_arr.append(temp_a)

for temp_b in range(10001):
    xb = temp_b * 0.1
    if xb // 1 == b:
        b_arr.append(temp_b)

for aa in a_arr:
    if aa in b_arr:
        print(aa)
        exit(0)

print('-1')


Fixed submission:
s = input()

ss = set(s)

if len(ss) == 1:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

aa = a
bb = b

blue_ball = a
red_ball = b

n_bai = n // (a + b)
n_amari = n % (a + b)
balls = ''


while len(balls) < n_amari:
    while aa > 0:
        balls += 'b'
        aa -= 1
    while bb > 0:
        balls += 'r'
        bb -= 1
    aa = a
    bb = b


amari_balls = balls[:n_amari]

ans = (n_bai) * blue_ball + amari_balls.count('b')

print(ans)

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

blue_ball = a
red_ball = b

n_bai = n // (a + b)
n_amari = n % (a + b)

balls = []
ans = 0

balls_sum = 0

while balls_sum < n_amari:
    balls.append(a)
    balls.append(b)
    balls_sum = sum(balls)

while n_amari > 0:
    if n_amari > blue_ball:
        ans += blue_ball
    else:
        ans += n_amari
    n_amari = n_amari - blue_ball - red_ball

ans += n_bai * blue_ball

print(ans)

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

aa = a
bb = b

blue_ball = a
red_ball = b

n_bai = n // (a + b)
n_amari = n % (a + b)
balls = ''


while len(balls) < (a + b):
    while aa > 0:
        balls += 'b'
        aa -= 1
    while bb > 0:
        balls += 'r'
        bb -= 1
    aa = a
    bb = b


amari_balls = balls[:n_amari]

ans = (n_bai) * blue_ball + amari_balls.count('b')

print(ans)

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

blue_ball = a
red_ball = b

n_bai = n // (a + b)
n_amari = n % (a + b)

balls = []
ans = 0

balls_sum = 0

while balls_sum < n_amari:
    balls.append(a)
    balls.append(b)
    balls_sum = sum(balls)

while n_amari > 0:
    if n_amari > blue_ball:
        ans += blue_ball
    else:
        ans += n_amari
    n_amari = n_amari - blue_ball - red_ball

ans += n_bai * blue_ball

print(ans)

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

aa = a
bb = b
nn = n

balls = ''

while n > 0:
    while aa > 0:
        balls += 'b'
        aa -= 1
    while bb > 0:
        balls += 'r'
        bb -= 1
    n -= 1
    aa = a
    bb = b

ans_balls = balls[:nn]

ans = ans_balls.count('b')

print(ans)

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

blue_ball = a
red_ball = b

n_bai = n // (a + b)
n_amari = n % (a + b)

balls = []
ans = 0

balls_sum = 0

while balls_sum < n_amari:
    balls.append(a)
    balls.append(b)
    balls_sum = sum(balls)

while n_amari > 0:
    if n_amari > blue_ball:
        ans += blue_ball
    else:
        ans += n_amari
    n_amari = n_amari - blue_ball - red_ball

ans += n_bai * blue_ball

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
b = list(map(int, input().split()))

b.sort(reverse=True)
ans = 0

while k > 0:
    if n == 0:
        break
    else:
        b.pop(0)
        k -= 1
        n -= 1

if n == 0:
    print('0')
else:
    print(sum(b))

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

b.sort(reverse=True)
ans = 0

del b[:k]
n -= k

if n < 0:
    print('0')
else:
    print(sum(b))
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
min_steps=a
if a==2:
    print(1)
elif a==3:
    print(2)
else:
    for i in range(2, int(a/2)+1):
            if a%i==0:
                b=i+int(a/i)-2
                if b<min_steps:
                    min_steps=b
    if (min_steps==a):
        min_steps-=1
    print(min_steps)


Fixed submission:
a = int(input())
min_steps=a
if a==2:
    print(1)
elif a==3:
    print(2)
else:
    j=2
    while(1):
        if j*j>=a:
            break
        else:
            j+=1

    for i in range(2, j+1):
            if a%i==0:
                b=i+int(a/i)-2
                if b<min_steps:
                    min_steps=b
    if (min_steps==a):
        min_steps-=1
    print(min_steps)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
min_steps=a
if a==2:
    print(1)
elif a==3:
    print(2)
else:
    for i in range(2, int(a/2)+1):
            if a%i==0:
                b=i+int(a/i)-2
                if b<min_steps:
                    min_steps=b
    print(min_steps)


Fixed submission:
a = int(input())
min_steps=a
if a==2:
    print(1)
elif a==3:
    print(2)
else:
    j=2
    while(1):
        if j*j>=a:
            break
        else:
            j+=1

    for i in range(2, j+1):
            if a%i==0:
                b=i+int(a/i)-2
                if b<min_steps:
                    min_steps=b
    if (min_steps==a):
        min_steps-=1
    print(min_steps)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
a=int(a)
b=int(b)
temp=a-2b
if temp<=0:
  temp=0
print(temp)

Fixed submission:
a,b = input().split()
a=int(a)
b=int(b)
temp=a-2*b
if temp<=0:
  temp=0
print(temp)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /((N-1)/2)
return answer
 

Fixed submission:
N=int(input())
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /N
print(answer)

Buggy python submission (verdict: Runtime Error):
N=input()
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /((N-1)/2)
return answer
 

Fixed submission:
N=int(input())
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /N
print(answer)

Buggy python submission (verdict: Runtime Error):
N=input()
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /(N-1)/2
print(answer) 
 

Fixed submission:
N=int(input())
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /N
print(answer)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=input()
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /(N-1)/2
print(answer) 
 

Fixed submission:
N=int(input())
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /N
print(answer)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n==1:
    print("Hello Wrold ")
elif n==2
    a=int(input())
    b=int(input())
    print(a+b)

Fixed submission:
n=int(input())
if n==1:
    print("Hello World")
elif n==2:
    a=int(input())
    b=int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
y,m,d=input().split('/')

y=int(y)
y+=1
y=str(y)\
print(y+'/'+m+'/'+d)

Fixed submission:
y,m,d=input().split('/')

y=int(y)
y+=1
y=str(y)
print(y+'/'+m+'/'+d)
Buggy python submission (verdict: Runtime Error):
s1=input()
s2=input()
s3=input()
s_list=[s1, s2, s3]
next=0
while(len(s_list[0])>=1 and len(s_list[1])>=1 and len(s_list[2])>=1):
    temp=s_list[next][0]
    s_list[next]=s_list[next][1:]
    next=temp
if len(s_list[0])==0:
    print("A")
elif len(s_list[1])==0:
    print("B")
else:
    print("C")

Fixed submission:
s1=input()
s2=input()
s3=input()
s_list=[s1, s2, s3]
next_item=0
while(1):
    if len(s_list[0])==0 and next_item==0:
        print("A")
        break
    elif len(s_list[1])==0 and next_item==1:
        print("B")
        break
    elif len(s_list[2])==0 and next_item==2:
        print("C")
        break
    temp=s_list[next_item][0]
    s_list[next_item]=s_list[next_item][1:]
    if(temp=='a'):
        next_item=0
    elif(temp=='b'):
        next_item=1
    else:
        next_item=2
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
As = list(map(int, input().split()))

num_count = {}
count_comb = {}
num_ans = {}

def comb2(n):
    if n not in count_comb:
        count_comb[n] = (n * (n - 1)) // 2
    return count_comb[n]

def ans(ex_num):
    if ex_num in num_ans:
        return num_ans[ex_num]

    result = 0
    for n, c in num_count.items():
        if n == ex_num:
            result += comb2(c - 1)
        else:
            result += comb2(c)
    num_ans[ex_num] = result
    return result


for a in As:
    if a not in num_count:
        num_count[a] = 0
    num_count[a] += 1

for a in As:
    print(ans(a))


Fixed submission:
N = int(input())
As = list(map(int, input().split()))

num_count = {}
count_comb = {}
num_ans = {}
sum_combs = 0

def comb2(n):
    if n not in count_comb:
        count_comb[n] = (n * (n - 1)) // 2
    return count_comb[n]

def ans(ex_num):
    ex_count = num_count[ex_num]
    return sum_combs + comb2(ex_count - 1) - comb2(ex_count)
    # if ex_num in num_ans:
    #     return num_ans[ex_num]

    # result = 0
    # for n, c in num_count.items():
    #     if n == ex_num:
    #         result += comb2(c - 1)
    #     else:
    #         result += comb2(c)
    # num_ans[ex_num] = result
    # return result


for a in As:
    if a not in num_count:
        num_count[a] = 0
    num_count[a] += 1

for _, c in num_count.items():
    sum_combs += comb2(c)

for a in As:
    print(ans(a))
Buggy python submission (verdict: Runtime Error):
import sys,math
sys.setrecursionlimit(10**9)
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())
sum=100
for i in range(1:100):
  sum=sum+1
n=int(input())
print("{:.12f}".format(pow(n,3)/27.0))

Fixed submission:
import sys, math

sys.setrecursionlimit(10 ** 9)
from collections import defaultdict

IA = lambda: map(int, input().split())
IAS = lambda: map(str, input().split())

sum=0
for i in range(10):
    sum+=1
n = int(input())
print("{:.12f}".format(pow(n, 3) / 27.0))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n = int(input())
k = list(map(int,input().split()))

#print(n)
#print(k)

c = Counter(k)

li = c.most_common()

a_li = [x for x in li if x[1] != 1]

#print(a_li)

max = 0

for i in a_li:
    num = i[1]
    max = max + cmb(num,2)
    
#print(max)

for i in k:
    num = 0
    for a in a_li:
        if a[0] == i:
            num = a[1]
    if num == 0:
        ans = max
    elif num == 2:
        ans = max - 1
    else:
      pre = cmb(num,2)
      cur = cmb(num-1,2)
      ans = max - pre + cur
    print(ans)


Fixed submission:
from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n = int(input())
k = list(map(int,input().split()))

c = Counter(k)

li = c.most_common()

a_li = [x for x in li if x[1] != 1]

max = 0

for i in a_li:
    num = i[1]
    max = max + cmb(num,2)
    
#print(max)

for i in k:
    num = c[i]
    if num == 1:
        ans = max
    elif num == 2:
        ans = max - 1
    else:
      pre = cmb(num,2)
      cur = cmb(num-1,2)
      ans = max - pre + cur
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())


li_num = [ list(map(int,input().split())) for i in range(m)]

invalid = False

#print(n)
#print(m)
#print(li_num)

if n == 1:
  li_ans[0] = 0
else:
  li_ans = [0] * n
  li_ans[0] = 1

arr = list(map(list, set(map(tuple, li_num))))
arr.sort(key=lambda x: x[0])

if n != 1 and [1,0] in arr:
  invalid = True

#print(arr)

if not invalid:
    arr_keta = [x[0] for x in arr]
    if len(arr_keta) != len(set(arr_keta)):
        invalid = True

if invalid:
  print(-1)
else:
  for i in arr:
    s = i[0] - 1
    li_ans[s] = i[1]
  ans_num = int("".join(map(str, li_ans)))
  print(ans_num)


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


li_num = [ list(map(int,input().split())) for i in range(m)]

invalid = False

#print(n)
#print(m)
#print(li_num)

if n == 1:
  li_ans = [0]
else:
  li_ans = [0] * n
  li_ans[0] = 1

arr = list(map(list, set(map(tuple, li_num))))
arr.sort(key=lambda x: x[0])

if n != 1 and [1,0] in arr:
  invalid = True

#print(arr)

if not invalid:
    arr_keta = [x[0] for x in arr]
    if len(arr_keta) != len(set(arr_keta)):
        invalid = True

if invalid:
  print(-1)
else:
  for i in arr:
    s = i[0] - 1
    li_ans[s] = i[1]
  ans_num = int("".join(map(str, li_ans)))
  print(ans_num)
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = [int(x) for x in stdin.readline().rstrip().split()]

k.sort()

ave = round(sum(k) / len(k) )

#print(ave)

def calc_pow(n):
    i = pow(n - ave, 2) 
    return i
  
j = map(calc_pow, k)

print(sum(j))

Fixed submission:
from sys import stdin
 
n = int(input())
k = [int(x) for x in stdin.readline().rstrip().split()]

k.sort()

ave = round(sum(k) / len(k) )

#print(ave)

def calc_pow(n):
    i = pow(n - ave, 2) 
    return i
  
j = map(calc_pow, k)

print(sum(j))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
string_list=[input() for i in range(n)]

li = sorted(string_list)
uniq_li = list(set(li))
n_li = []

for s in uniq_li:
  num = li.count(s)
  n_li.append([num, s])

n_li.sort(reverse=True)

max = n_li[0][0]

out_list = []

for i in n_li:
    if i[0] == max:
        out_list.append(i[1])
    else:
      break;

out_list.sort()

for i in out_list:
  print(i)


Fixed submission:
from collections import Counter

n=int(input())
string_list=[input() for i in range(n)]
 
counter = Counter(string_list)

m = max(counter.values())

out_li = []

for k,v in counter.items():
  if v == m:
    out_li.append(k)

out_li.sort()
    
print('\n'.join(out_li))
Buggy python submission (verdict: Runtime Error):



color = input.split()

num = input.split()

stock[color[0]] = num[0]
stock[color[1]] = num[1]

u = input.split()

stock[u] = stock[u] - 1

print({col1} {col2}).format(col1=stock[color[0]],col2=stock[color[1]])

Fixed submission:
color = input().split()
 
num = input().split()

stock = {}
stock[color[0]] = num[0]
stock[color[1]] = num[1]
 
u = input().split()
 
stock[u[0]] = int(stock[u[0]]) - 1
 
print('{col1} {col2}'.format(col1=stock[color[0]],col2=stock[color[1]]))