Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from math import gcd
def f(x):
    return x%2==0 or x%3==0 or x%5==0

prd = list(filter(lambda x: f(x[0]) and f(x[1]), [(i, 30 - i) for i in range(1, 14)]))

pairs = []
for i in range(1, 1000):
    for j in prd:
        pairs += [i * 30 + j[0], i * 30 + j[1]]
for i in range(0, 500):
    pairs += [i * 30 + 15, (999 - i) * 30 + 15]
pairs += [4, 26, 6, 24, 8, 22, 9, 21, 10, 20, 12, 18, 14, 16]
N = int(input())
if N == 4:
    print(2, 3, 25, 30)
    exit(0)

a = [2, 3, 25]
aiv = [28, 27, 5]
if (N - len(a)) % 2 == 1: a += aiv

a += pairs
for i in range(1, 1001): a.append(i * 30)
print(" ".join(map(str, a[:N])))


Fixed submission:
def f(x):
    return x%2==0 or x%3==0 or x%5==0

prd = list(filter(lambda x: f(x[0]) and f(x[1]), [(i, 30 - i) for i in range(1, 14)]))

pairs = []
for i in range(1, 1000):
    for j in prd:
        pairs += [i * 30 + j[0], i * 30 + j[1]]
for i in range(0, 500):
    pairs += [i * 30 + 15, (999 - i) * 30 + 15]
pairs += [4, 26, 6, 24, 8, 22, 9, 21, 10, 20, 12, 18, 14, 16]
N = int(input())
if N == 4:
    print(2, 3, 25, 30)
    exit(0)

a = [2, 3, 25]
aiv = [28, 27, 5]
if (N - len(a)) % 2 == 1: a += aiv

a += pairs
for i in range(1, 1001): a.append(i * 30)
print(" ".join(map(str, a[:N])))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
Hs = input().split()
Hs = [int(ele) for ele in Hs]

import numpy as np

gra = np.zeros(shape=(n, n))

for i in range(m):
    con = input().split()
    con = [int(ele) for ele in con]
    con.sort()
    id1 = con[0] - 1
    id2 = con[1] - 1
    
    if Hs[id2] == Hs[id1]:
        gra[id1, id2] = 100
        gra[id2, id1] = 100
    else:    
        gra[id1, id2] = Hs[id2] - Hs[id1]
        gra[id2, id1] = Hs[id1] - Hs[id2]

res = np.all(gra <= 0, axis=1)

print(sum(res))

Fixed submission:
n, m = map(int, input().split())
Hs = input().split()
Hs = [int(ele) for ele in Hs]

res = [1 for i in range(n) ]
for i in range(m):
    con = input().split()
    con = [int(ele) for ele in con]
    
    id1 = con[0] - 1
    id2 = con[1] - 1
    
    if res[id1] == 1:
        res[id1] = int(Hs[id2] < Hs[id1])
    if res[id2] ==1:
        res[id2] = int(Hs[id1] < Hs[id2])

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

import collections

Ss_counted = collections.Counter(Ss)
max_val = max(Ss_counted.values())

# # https://note.nkmk.me/python-dict-value-max-min/

result = []
for k, v in Ss_counted.items():
    if v == max_val:
        result.append(k)

for i in range(len(result)):
    print(sorted(result)[i])
    


Fixed submission:
n = int(input())
Ss = []
for i in range(n):
    Ss.append(input())

import collections

Ss_counted = collections.Counter(Ss)
max_val = max(Ss_counted.values())

# # https://note.nkmk.me/python-dict-value-max-min/

result = []
for k, v in Ss_counted.items():
    if v == max_val:
        result.append(k)

result = sorted(result)
for i in range(len(result)):
    print(result[i])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
Ps = list(map(int, input().split()))

import numpy as np

Ps = np.array(Ps)

Exp_each_p = (Ps + 1) /2

sum_Exp = []
for id in range(n - k - 1):
    sum_Exp.append(sum(Exp_each_p[id:(id + k)]))

print(max(sum_Exp))

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

import numpy as np

Ps = np.array(Ps)

Exp_each_p = (Ps + 1) /2

sum_Exp = [sum(Exp_each_p[0:k])]
if n == 1:
    print(sum_Exp[0])
else:    
    for id in range(1, n - k + 1):
        sum_Exp.append(sum_Exp[id - 1] - Exp_each_p[id - 1] + Exp_each_p[id + k - 1])

    print(max(sum_Exp))
Buggy python submission (verdict: Runtime Error):
# !/usr/bin python3
# -*- coding: utf-8 -*-

rgb = int(input().strip(' '))

if rgb % 4 == 0:
    print('YES')

else:
    print('NO')

Fixed submission:
# !/usr/bin python3
# -*- coding: utf-8 -*-

rgb = int(input().replace(" ", ""))

if rgb % 4 == 0:
    print('YES')

else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# !/usr/bin python3
# -*- coding: utf-8 -*-

rgb = int(input().join())

if rgb % 4 == 0:
    print('YES')

else:
    print('NO')

Fixed submission:
# !/usr/bin python3
# -*- coding: utf-8 -*-

rgb = int(input().replace(" ", ""))

if rgb % 4 == 0:
    print('YES')

else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# !/usr/bin python3
# -*- coding: utf-8 -*-

rgb = int(input().join())

if rgb % 4:
    print('YES')

else:
    print('NO')

Fixed submission:
# !/usr/bin python3
# -*- coding: utf-8 -*-

rgb = int(input().replace(" ", ""))

if rgb % 4 == 0:
    print('YES')

else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

counter = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        for z in range(0, k + 1):
            if x + y + z == s:
                counter += 1

print(counter)

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

counter = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if 0 <= s - x - y <= k: 
                counter += 1

print(counter)

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

counter = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        for z in range(0, k + 1):
            if x + y + z == s:
                counter += 1

print(counter)

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

counter = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if 0 <= s - x - y <= k: 
                counter += 1

print(counter)
Buggy python submission (verdict: Runtime Error):
print(len([1 for i in range(1,int(input())+1) if str(i)%2 == 1]))

Fixed submission:
print(len([1 for i in range(1,int(input())+1) if len(str(i))%2 == 1]))
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
xy =[]
for i in range(n):
    x,y = map(int,input().split())
    xy.append((x,y))
xy2 = xy[:]
c = collections.Counter()
for x,y in xy:
    for w,z in xy2:
        c[(x-w,y-z)] +=1
print(n-c.most_common(2)[1][1])

Fixed submission:
import collections
n = int(input())
xy =[]
for i in range(n):
    x,y = map(int,input().split())
    xy.append((x,y))
xy2 = xy[:]
c = collections.Counter()
for x,y in xy:
    for w,z in xy2:
        c[(x-w,y-z)] +=1
if n==1:
    print(1)            
else:    
    print(n-c.most_common(2)[1][1])
Buggy python submission (verdict: Time Limit Exceeded):
def s(n):
    if n<10:
        return n
    else:
        return n%10+s(n//10)

k =int(input())
n=0
for _ in [0]*k:
    n +=1    
    minn = n
    d = 10
    while n>=d:
        m = (n//d+1)*d-1
        if minn*s(m)>m*s(minn):
            minn = m
    n = minn
    print(n)


Fixed submission:
def s(n):
    if n<10:
        return n
    else:
        return n%10+s(n//10)
n=0
for _ in [0]*int(input()):
    n +=1    
    minn = n
    d = 1
    while n>=d:
        d *= 10    
        m = (n//d+1)*d-1
        if minn*s(m)>m*s(minn):
            minn = m
    n = minn
    print(n)
Buggy python submission (verdict: Runtime Error):
import collections
h,w = map(int,input().split())
s=[list(input()) for _ in range(h)]
deq = collections.deque([[0,0,0]])

while deq:
    i,j,k = deq.popleft()
    if not((i in range(h)) and (j in range(w))):
        continue
    if s[i][j] != '.':
        continue
    s[i][j]=k
    if i==h-1 and j == w-1:
        break
    deq.append([i + 1, j, k + 1])
    deq.append([i - 1, j, k + 1])
    deq.append([i, j + 1, k + 1])
    deq.append([i, j - 1, k + 1])
if s[i][j] in '.#':
    print(-1)
else:
    black = sum([y.count('#') for y in s])
    print(h*w-black-s[h-1][w-1]-1)

Fixed submission:
import collections
h,w = map(int,input().split())
s=[list(input()) for _ in range(h)]
deq = collections.deque([[0,0,0]])

while deq:
    i,j,k = deq.popleft()
    if not((i in range(h)) and (j in range(w))):
        continue
    if s[i][j] != '.':
        continue
    s[i][j]=k
    if i==h-1 and j == w-1:
        break
    deq.append([i + 1, j, k + 1])
    deq.append([i - 1, j, k + 1])
    deq.append([i, j + 1, k + 1])
    deq.append([i, j - 1, k + 1])
if s[h-1][w-1] == '#'or s[h-1][w-1] =='.':
    print(-1)
else:
    black = sum([y.count('#') for y in s])
    print(h*w-black-s[h-1][w-1]-1)

Buggy python submission (verdict: Runtime Error):
import collections
h,w = map(int,input().split())
s=[list(input()) for _ in range(h)]
deq = collections.deque([[0,0,0]])

while deq:
    i,j,k = deq.popleft()
    if not((i in range(h)) and (j in range(w))):
        continue
    if s[i][j] != '.':
        continue
    s[i][j]=k
    if i==h-1 and j == w-1:
        break
    deq.append([i + 1, j, k + 1])
    deq.append([i - 1, j, k + 1])
    deq.append([i, j + 1, k + 1])
    deq.append([i, j - 1, k + 1])
if s[i][j] =='.':
    print(-1)
else:
    black = sum([y.count('#') for y in s])
    print(h*w-black-s[h-1][w-1]-1)

Fixed submission:
import collections
h,w = map(int,input().split())
s=[list(input()) for _ in range(h)]
deq = collections.deque([[0,0,0]])

while deq:
    i,j,k = deq.popleft()
    if not((i in range(h)) and (j in range(w))):
        continue
    if s[i][j] != '.':
        continue
    s[i][j]=k
    if i==h-1 and j == w-1:
        break
    deq.append([i + 1, j, k + 1])
    deq.append([i - 1, j, k + 1])
    deq.append([i, j + 1, k + 1])
    deq.append([i, j - 1, k + 1])
if s[h-1][w-1] == '#'or s[h-1][w-1] =='.':
    print(-1)
else:
    black = sum([y.count('#') for y in s])
    print(h*w-black-s[h-1][w-1]-1)
Buggy python submission (verdict: Runtime Error):
s = sorted(input())
t = sorted(input())
t.reverse()
if s<t:
	print("Yes")
else:
	print("No")

Fixed submission:
print((sum([int(i) for i in input().split()])+1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
def check(a, numlist):
	goal = a+sum(numlist)
	if goal %2 == 1:
		return False
	goal /=2
	oklist =[0]
	for x in numlist:
		addlist = [ok+x for ok in oklist]
		oklist += addlist
	return goal in oklist



s = [len(x) for x in input().split('T')]
x,y = [int(i) for i in input().split()]
x = x-s[0]
sx = s[2::2]
sy = s[1::2]
if check(x,sx) and check(y,sy):
	print("Yes")
else:
	print("No")

Fixed submission:
def check(a, numlist):
	goal = a+sum(numlist)
	if goal %2 == 1:
		return False
	goal /=2
	okset ={0}
	for x in numlist:
		addset = {ok+x for ok in okset}
		okset |= addset
	return goal in okset

s = [len(x) for x in input().split('T')]
x,y = [int(i) for i in input().split()]
x = x-s[0]
sx = s[2::2]
sy = s[1::2]
if check(x,sx) and check(y,sy):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
print(2**m*(18m+n)*100)

Fixed submission:
n,m=map(int,input().split())
print(2**m*(18*m+n)*100)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def altar(a,b):
    cnt = 0
    for k in range(len(b)):
        while a and a[0][0]<b[k][0]:
           cnt += a.pop(0)[1]
        b[k] = (b[k][0],b[k][1]*cnt)

input()
a,b,c = [sorted(dict(Counter(map(int,input().split()))).items(),key=lambda x:x[0])for _ in "abc"]
altar(a,b)
altar(b,c)
print(sum([x[1] for x in c]))

Fixed submission:
import bisect
n=int(input())
a,b,c = [sorted(map(int,input().split())) for _ in "abc"]
print(sum([bisect.bisect_left(a,x)*(n-bisect.bisect_right(c,x)) for x in b]))
Buggy python submission (verdict: Runtime Error):
k=int(input())
while k%2 == 0:
    k //=2
while k%5 == 0:
    k //=5

lst = [k+1]*k
queue = [1]
lst[1] = 1
while queue:
    a = queue.pop(0)
    if lst[a*10%k] > lst[a]:
        lst[a*10%k] = lst[a]
        queue.insert(0,a*10%k)
    if lst[(a+1)%k]>= lst[a]+1:
        lst[(a+1)%k] = lst[a]+1
        queue.append((a+1)%k)
print(lst[0])

Fixed submission:
import collections
k=int(input())
lst = [k+1]*k
q = collections.deque([1])
lst[1] = 1
while q:
    a = q.pop()
    if lst[a*10%k] > lst[a]:
        lst[a*10%k] = lst[a]
        q.append(a*10%k)
    if lst[(a+1)%k]>= lst[a]+1:
        lst[(a+1)%k] = lst[a]+1
        q.appendleft((a+1)%k)
print(lst[0])

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
lst = [k+1]*k
queue = [1]
lst[1] = 1
while queue:
    a = queue.pop(0)
    if lst[a*10%k] > lst[a]:
        lst[a*10%k] = lst[a]
        queue.insert(0,a*10%k)
    if lst[(a+1)%k]>= lst[a]+1:
        lst[(a+1)%k] = lst[a]+1
        queue.append((a+1)%k)
print(lst[0])

Fixed submission:
import collections
k=int(input())
lst = [k+1]*k
q = collections.deque([1])
lst[1] = 1
while q:
    a = q.pop()
    if lst[a*10%k] > lst[a]:
        lst[a*10%k] = lst[a]
        q.append(a*10%k)
    if lst[(a+1)%k]>= lst[a]+1:
        lst[(a+1)%k] = lst[a]+1
        q.appendleft((a+1)%k)
print(lst[0])
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(-a+b-c+d+2)

Fixed submission:
print(("Yes","No")[len(set(input()[::2]))-1])
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
vs = sorted([int(v) for v in input().split()],reverse=True)
print(sum(vs[:a])/a)
binom = [1]
for k in range(vs.count(vs[a-1])):
    binom = [x+y for (x, y) in zip(binom+[0],[0]+binom)]
if vs[a-1] == vs[0]:
    print(sum(binom[a:b+1]))
else:
    print(binom[vs.index(vs[a-1])])

Fixed submission:
n,a,b = map(int,input().split())
vs = sorted([int(v) for v in input().split()],reverse=True)
print(sum(vs[:a])/a)
binom = [1]
for k in range(vs.count(vs[a-1])):
    binom = [x+y for (x, y) in zip(binom+[0],[0]+binom)]
if vs[a-1] == vs[0]:
    print(sum(binom[a:b+1]))
else:
    print(binom[a-vs.index(vs[a-1])])
Buggy python submission (verdict: Runtime Error):
w=int(input().split()[1])
c=[input() for _ in [0]*w]
for _c in c:
    print(_c)
    print(_c)

Fixed submission:
h=int(input().split()[0])
c=[input() for _ in [0]*h]
for _c in c:
    print(_c)
    print(_c)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
x = [a[0]]
y = [a[1]]
a = []
b = []
c = 0
d = 0
while x[len(x)-1] < x[0] + 1:
    x.append(round(x[d] + 0.01,2))
    y.append(round(y[d] + 0.01,2))
    d += 1
for i in x:
    a.append(i/0.08)
for i in y:
    b.append(i/0.1)
a.extend(b)
c = round(min([z for z in set(a) if a.count(z) > 1]))
if c > 0:
    print(c)
else:
    print(-1)

Fixed submission:
a = list(map(int,input().split()))
A = a[0]
B = a[1]
c = True
for x in range(10001):
    a = x * 0.08
    b = x * 0.1
    if A == int(a) and B == int(b):
        print(x)
        c = False
        break
if c:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
x = [a[0]]
y = [a[1]]
a = []
b = []
c = []
d = 0
while x[len(x)-1] < x[0] + 1:
    x.append(round(x[d] + 0.0001,4))
    y.append(round(y[d] + 0.0001,4))
    d += 1
for i in x:
    a.append(i/0.08)
for i in y:
    b.append(i/0.1)
for i in a:
    for i2 in b:
        if i == i2:
            c.append(i)
if len(c) > 0:
    print(round(min(c)))
else:
    print(-1)


Fixed submission:
a = list(map(int,input().split()))
A = a[0]
B = a[1]
c = True
for x in range(10001):
    a = x * 0.08
    b = x * 0.1
    if A == int(a) and B == int(b):
        print(x)
        c = False
        break
if c:
    print(-1)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()

if (a + b[-1]) == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b = input().split()

if (a + b[-1]) == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b = input().split()

if (a + b[-1]) == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")

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

if (a + b[-1]) == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")

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

if a + b[-1] == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b map(input().spilit())

if a + b[-1] == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b map(input().spilit().)

if a + b[-1] == b :

   print("Yes")

else:
   print("No")

Fixed submission:
s = input()
t = input()

if (s + t[-1]) == t :
    print("Yes")

else :
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(map(int, input().split()))

if 0 in S:
    print(0)
elif 10 ** 18 in S:
    print(-1)
else:
    ans = 1
    for s in S:
        ans *= s
    if ans > 10 ** 18:
        print(-1)
    else:
        print(ans)

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

def f():
    if 0 in S:
        return 0
    elif 10 ** 18 in S:
        return -1
    else:
        ans = 1
        for s in S:
            ans *= s
            if ans > 10 ** 18:
                return -1
        return ans

print(f())

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(map(int, input().split()))
ans = 1

for s in S:
  ans *= s
  
if ans > 10 ** 18:
  print(-1)
else:
  print(ans)

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

def f():
    if 0 in S:
        return 0
    elif 10 ** 18 in S:
        return -1
    else:
        ans = 1
        for s in S:
            ans *= s
            if ans > 10 ** 18:
                return -1
        return ans

print(f())
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import bisect
N = int(input())
S = str(input())

char = [[] for _ in range(3)]

for i in range(N):
    s = S[i]
    if s == "R":
        char[0].append(i)
    elif s == "G":
        char[1].append(i)
    else:
        char[2].append(i)

ans = 0

for f, s, t in itertools.permutations(range(3), 3):
    for i in char[f]:
        # print(char[s])
        sec_start = bisect.bisect_left(char[s], i)
        for j in char[s][sec_start: ]:
            thi_start = bisect.bisect_left(char[t], j)
            for k in char[t][thi_start: ]:
                if j - i != k - j:
                    # print(i, j, k)
                    ans += 1

print(ans)

Fixed submission:
from collections import Counter

N = int(input())
S = str(input())

dic = Counter(S)
ans = dic["R"] * dic["G"] * dic["B"]

for cntr in range(N):
    i = 1
    while True:
        left = cntr - i
        right = cntr + i
        if not (0 <= left and right < N): break
        if S[left] != S[cntr] and S[cntr] != S[right] and S[right] != S[left]: ans -= 1
        i += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [0 for _ in range(N)]
if N == 1:
	ans[0] = 0
else:
	ans[0] = 1
f = 1
flg = [-1 for _ in range(M + 1)]

for _ in range(M):
	s, c = map(int, input().split())
	if s == 1 and c == 0 and N != 1: 
		f = 0
	if flg[s] != -1 and flg[s] != c:
		f = 0
	else:
		flg[s] = c
		ans[s - 1] = c

if f:
	for a in ans:
		print(a, end = "")
else:
	print(-1)

Fixed submission:
N, M = map(int, input().split())
ans = [0 for _ in range(N)]
if N == 1:
	ans[0] = 0
else:
	ans[0] = 1
f = 1
flg = [-1 for _ in range(M + 1000)]

for _ in range(M):
	s, c = map(int, input().split())
	if s == 1 and c == 0 and N != 1: 
		f = 0
	if flg[s] != -1 and flg[s] != c:
		f = 0
	else:
		flg[s] = c
		ans[s - 1] = c

if f:
	for a in ans:
		print(a, end = "")
else:
	print(-1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [0 for _ in range(N)]
ans[0] = 1
f = 1
flg = [-1 for _ in range(M + 1)]

for _ in range(M):
	s, c = map(int, input().split())
	if s == 1 and c == 0: 
		f = 0
	if flg[s] != -1 and flg[s] != c:
		f = 0
	else:
		flg[s] = c
		ans[s - 1] = c

if f:
	for a in ans:
		print(a, end = "")
else:
	print(-1)

Fixed submission:
N, M = map(int, input().split())
ans = [0 for _ in range(N)]
if N == 1:
	ans[0] = 0
else:
	ans[0] = 1
f = 1
flg = [-1 for _ in range(M + 1000)]

for _ in range(M):
	s, c = map(int, input().split())
	if s == 1 and c == 0 and N != 1: 
		f = 0
	if flg[s] != -1 and flg[s] != c:
		f = 0
	else:
		flg[s] = c
		ans[s - 1] = c

if f:
	for a in ans:
		print(a, end = "")
else:
	print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n, a, b = map(int, input().split())
MOD = 10 ** 9 + 7

# ans = 2 ** n - 1

def binary(n):
    return bin(n)[2:]

# バイナリ法
def pow_by_binary_exponentiation(a, x, n): # a^x mod n
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % n
        if x[i] == 1:
            y = (y * a) % n
    return y
	
ans = pow_by_binary_exponentiation(2, n, MOD)

ans -= 1

fac = [1]
inv = [1]

for i in range(1, n + 1) :
	fac.append(fac[-1] * i % MOD)
	inv.append(pow(fac[-1], MOD - 2, MOD))

ans -=  fac[n] * inv[a] * inv[n - a] % MOD
ans -=  fac[n] * inv[b] * inv[n - b] % MOD

print(ans % MOD)

Fixed submission:
n, a, b = map(int, input().split())
MOD = 10 ** 9 + 7

# でっかい数の n C a
def comb(n, a):
	ret = 1
	# 分子部分の計算
	for i in range(n - a + 1, n + 1):
		ret *= i
		ret %= MOD
	# 分母部分の計算
	for i in range(1, a + 1):
		ret *= pow(i, MOD - 2, MOD)
		ret %= MOD
	return ret
	
ans = pow(2, n, MOD) - 1
ans -= comb(n, a)
ans -= comb(n, b)
print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
seitou = [0 for _ in range(N)]
penalty = [0 for _ in range(M)]

for i in range(M):
	S = list(input().split())
	# print(S)
	num = int(S[0])
	res = S[1]
	if res == "AC":
		seitou[num - 1] = 1
	else:
		if seitou[num - 1] == 0:
			penalty[num - 1] += 1
			
# print(*seitou)
# print(*penalty)
print(sum(seitou), end=" ")
print(sum(penalty))

Fixed submission:
N, M = map(int, input().split())
seitou = [0 for _ in range(N)]
penalty = [0 for _ in range(N)]

for i in range(M):
	S = list(input().split())
	# print(S)
	num = int(S[0])
	res = S[1]
	if res == "AC":
		seitou[num - 1] = 1
	else:
		if seitou[num - 1] == 0:
			penalty[num - 1] += 1
			
# print(*seitou)
# print(*penalty)
print(sum(seitou), end=" ")

ans = 0

for i in range(N):
	if seitou[i] == 1:
		ans += penalty[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for _ in range(K):
	if A >= 1:
		A -= 1
	elif B >= 1:
		B-= 1

print(A, B)		

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

if A >= K:
	print(A - K, B)
else:
	print(0, max(0, B - (K - A)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))
T = list(map(str, input()))

for i in range(N):
  print(S[i], end = "")
  print(T[i], end = "")

Fixed submission:
N = int(input())
s, t = map(str, input().split())
S = list(map(str, s))
T = list(map(str, t))

for i in range(N):
	print(S[i], end = "")
	print(T[i], end = "")