Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03126 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    a = a[1:]
    A[i, 0:len(a)] = a

for i in range(N):
    a = A[i]
    a = a[(a != 0) & (a <= M)]
    if i == 0:
        s = set(list(a))
    else:
        _s = set(list(a))
        s &= _s

print(len(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    a = a[1:]
    A[i, 0:len(a)] = a

for i in range(N):
    a = A[i]
    a = a[(a != 0) & (a < M)]
    if i == 0:
        s = set(list(a))
    else:
        _s = set(list(a))
    s &= _s

print(len(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    a = a[1:]
    A[i, 0:len(a)] = a

for i in range(N):
    a = A[i]
    a = a[(a != 0) & (a < M)]
    if i == 1:
        s = set(list(a))
    else:
        _s = set(list(a))
    s &= _s

print(len(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    a = a[1:]
    A[i, 0:len(a)] = a

for i in range(N):
    a = A[i]
    a = a[(a != 0) & (a < M)]
    print(a)
    if i == 1:
        s = set(list(a))
    else:
        _s = set(list(a))
    s &= _s

print(len(s))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    A[i, 0:len(a)] = a

A = A[(A != 0) & (A < M)]
len(np.unique(A))
Problem p03160 (python)

Fixed submission:
import numpy as np

N = int(input())
hs = np.array(list(map(int, input().split())))

i = 0
total_cost = 0

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])
for i in range(2, N):
    a[i] = min(a[max(i-2,0)] + abs(hs[i] - hs[max(i-2,0)]),
               a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)]))
print(a[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
hs = np.array(list(map(int, input().split())))

i = 0
total_cost = 0

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])
for i in range(2, N):
    a[i] = min(a[max(i-2,0)] + abs(hs[i] - hs[max(i-2,0)]),
               a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)]))
print(a[-1])
Problem p03161 (python)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
hs = np.array(list(map(int, input().split())))

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])

if N == 2:
    print(a[-1])
else:
    for i in range(2, N):
        b = a[max(i-K,0):i] + np.abs(hs[i] - hs[max(i-K,0):i])
        a[i] = np.min(b)
    print(a[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
hs = np.array(list(map(int, input().split())))

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])

b = np.zeros(K, int)
for j in range(K):
    b[j] = a[max(2-(j+1),0)] + abs(hs[2] - hs[max(2-(j+1),0)])
    
for i in range(2, N):
    b = np.hstack((b[1:], np.array([a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)])])))
    a[i] = np.min(b)
print(a[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
hs = np.array(list(map(int, input().split())))

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])

b = np.zeros(K, int)
for j in range(K):
    b[j] = a[max(2-(j+1),0)] + abs(hs[2] - hs[max(2-(j+1),0)])
    
for i in range(2, N):
    b = np.hstack((b[1:], np.array([a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)])])))
    a[i] = np.min(b)
print(a[-1])
a

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
hs = np.array(list(map(int, input().split())))

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])

b = np.zeros(K, int)
for j in range(K):
    b[j] = a[max(2-(j+1),0)] + abs(hs[2] - hs[max(2-(j+1),0)])
    
for i in range(2, N):
    b = np.hstack((b[1:], np.array([a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)])])))
    a[i] = np.min(b)
print(a[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
hs = np.array(list(map(int, input().split())))

a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])

b = np.zeros(K, int)
for j in range(K):
    b[j] = a[max(i-(j+1),0)] + abs(hs[i] - hs[max(i-(j+1),0)])
    
for i in range(2, N):
    
    b = np.hstack((b[1:], np.array([a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)])])))
    a[i] = np.min(b)
print(a[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
hs = np.array(list(map(int, input().split())))

i = 0
total_cost = 0
 
a = np.zeros(N, int)
a[0] = 0
a[1] = abs(hs[1] - hs[0])

for i in range(2, N):
    #a[i] = min(a[max(i-2,0)] + abs(hs[i] - hs[max(i-2,0)]),
    #           a[max(i-1,0)] + abs(hs[i] - hs[max(i-1,0)]))
    
    b = np.zeros(K, int)
    for j in range(K):
        b[j] = a[max(i-(j+1),0)] + abs(hs[i] - hs[max(i-(j+1),0)])
    a[i] = np.min(b)    
print(a[-1])
Problem p03861 (python)

Fixed submission:
import numpy as np
a, b, x = map(int, input().split())
print(b // x - (a-1) // x)

Buggy submission (verdict: Runtime Error):
import numpy as np
a, b, x = map(int, input().split())
A = np.arange(a,b+1)
print(np.sum(A % x == 0))
Problem p03061 (python)

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

# abc125_c
import fractions, functools, itertools

# input
n = int(input())
A = [int(s) for s in input().split()]
# get ans
gcd = fractions.gcd
L = list(itertools.accumulate(A, gcd))
R = list(itertools.accumulate(A[::-1], gcd))
R = R[::-1]
L.append(0)
R.append(0)
gs = [gcd(L[i-1], R[i+1]) for i in range(n)]
ans = max(gs)
# output
print(ans)

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

# abc125_c
import fractions, functools, itertools

# input
n = int(input())
A = [int(s) for s in input().split()]
# get ans
x = A[0]
y = A[1]
def divisors(n):
     for i in range(2, n):
        if n%i == 0:
            yield i
ds = set(divisors(x)) + set(divisors(y))
def condition(d):
    not_div = (a%d != 0 for a in A)
    not_div = (1 if b else 0 for b in not_div)
    return sum(not_div) <= 1
ans = max(filter(condition, ds))
# output
print(ans)

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

# abc125_a
import fractions, functools, itertools

# input
n = int(input())
A = [int(s) for s in input().split()]
# get ans
def search_booby(B):
    b0 = [fractions.gcd(B[0], a) for a in B[1:]]
    b0.sort()
    return b0[1]
def gcd_list(l):
    return functools.reduce(fractions.gcd, l)
B = itertools.cycle(A)
Bs = itertools.tee(B, 2)
Bs = (list(itertools.islice(B, i, i+n)) for i, B in enumerate(Bs))
Bs = map(search_booby, Bs)
ans = max(Bs)
# output
print(ans)
Problem p03240 (python)

Fixed submission:
n = int(input())

info = [[int(x) for x in input().split()] for _ in range(n)]

def height(point, info):
    cx, cy = point[0], point[1]
    ch = None
    theo_max = float('inf')
    for i,p in enumerate(info):
        x, y, h= p[0], p[1], p[2]
        tmp = abs(cx-x) + abs(cy-y) + h
        if h == 0:
            theo_max = min(theo_max, tmp)
            if ch:
                if theo_max < ch:
                    return None
                    break
        else:
            if not ch:
                ch = tmp
                if theo_max < ch:
                    return None
                    break
            else:
                if ch != tmp:
                    return None
                    break
                if theo_max < ch:
                    return None
                    break
    return ch

t = None
ans = None
for x in range(101):
    if t:
        break
    for y in range(101):
        if t:
            break
        point = (x,y)
        t = height(point, info)
        if t :
            ans = [x,y,t]

print(' '.join(map(str, ans)))

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

info = [[int(x) for x in input().split()] for _ in range(n)]

def height(point, info):
    cx, cy = point[0], point[1]
    ch = None
    for i,p in enumerate(info):
        x, y, h= p[0], p[1], p[2]
        tmp = abs(cx-x) + abs(cy-y) + h
        if ch == None:
            ch = tmp
        else:
            if ch != tmp:
                return None
                break
    return ch

flag = False
ans = None
for x in range(101):
    if flag:
        break
    for y in range(101):
        if flag:
            break
        point = (x,y)
        t = height(point, info)
        if t != None:
            flag = True
            ans = [x,y,t]

print(' '.join(map(str, ans)))
Problem p03427 (python)

Fixed submission:
n = input()

a = n[0]

if len(n) > 1:
    b = n[1:]
    if (int(b)+1) % (10 ** len(b)) == 0:
        flag = True
    else:
        flag = False
else:
    b = ''
    flag = True

if flag:
    ans = int(a) + 9 * len(b)
else:
    ans = int(a) - 1 + 9 * len(b)

print(ans)

Buggy submission (verdict: Runtime Error):
n = input()

a = n[0]
b = n[1:]

if (int(b)+1) % (10 ** len(b)) == 0:
    flag = True
else:
    flag = False

if flag:
    ans = int(a) + 9 * len(b)
else:
    ans = int(a) - 1 + 9 * len(b)

print(ans)
Problem p03435 (python)

Fixed submission:
l = []

for _ in range(3):
    l.append([int(x) for x in input().split()])

flag = True

v,h = [],[]

for i in range(3):
    a = l[i]
    b,c = a[0] - a[1], a[1] - a[2]
    v.append([b,c])

if v[0] != v[1] or v[1] != v[2]:
    flag = False

for i in range(3):
    a = [l[0][i], l[1][i], l[2][i]]
    b,c = a[0] - a[1], a[1] - a[2]
    h.append([b,c])

if h[0] != h[1] or h[1] != h[2]:
    flag = False

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

Buggy submission (verdict: Runtime Error):
import numpy as np

l = []

for _ in range(3):
    a = [int(x) for x in input().split()]
    l.append(a)

l = np.array(l)

def check(m):
    a = []
    for i in range(3):
        b,c = m[i,0] - m[i,1], m[i,1] - m[i,2]
        m.append((b,c))
    if a[0] != a[1] or a[1] != a[2]:
        return False
    else:
        return True

if check(l) and check(np.transpose(l)):
    print('Yes')
else:
    print('No')
Problem p03481 (python)

Fixed submission:
x,y = [int(x) for x in input().split()]

flag = True
count = 1

while flag:
    if x * 2 <= y:
        x = x * 2
        count += 1
        continue
    else:
        flag = False

print(count)

Buggy submission (verdict: Runtime Error):
x,y = [int(x) for x in input().split()]

count = 1

while True:
    if x * 2 <= y:
        x = x * 2
        count += 1
    else:
	break

print(count)
Problem p03482 (python)

Fixed submission:
s = input()

l = len(s)

t = l

for i,x in enumerate(s):
    if i == 0:
        pass
    else:
        if x != s[i-1]:
            a = max(i,l-i)
            t = min(t,a)

print(t)

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

l = len(s)

for i,x in enumerate(s):
    if i == 0:
        pass
    else:
        if x != s[i-1]:
            count += 1
        else:
            if count % 2 == 0:
                a = count -1
                if a <= l:
                    l = a
            else:
                a = count
                if a <= l:
                    l = a
            count = 0

print((count+1)//2)
Problem p03565 (python)

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

def is_restorable(a,b):
    ans = True
    for x,y in zip(a,b):
        if ans:
            if x == y or x == '?':
                pass
            else:
                ans = False
    return ans

s = s[::-1]
t = t[::-1]
s_ = list(s)

can_restore = False

for i,x in enumerate(s):
    if i+len(t) <= len(s):
        if not can_restore:
            if is_restorable(s[i:i+len(t)],t):
                can_restore = True
                s_[i:i+len(t)] = t

s_ = s_[::-1]
s_ = ''.join(s_)

ans = s_.replace('?','a')

if can_restore:
    print(ans)
else:
    print('UNRESTORABLE')

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

def is_restorable(a,b):
    ans = True
    for x,y in zip(a,b):
        if x == y or x == '?':
            pass
        else:
            ans = False
            break
    return ans

s = s[::-1]
t = t[::-1]
s_ = list(s)

can_restore = False
anchor = [0,0]

for i,x in enumerate(s):
    if not can_restore:
        if is_restorable(s[i:i+len(t)],t):
            can_restore = True
            s_[i:i+len(t)] = t
            s_ = s_[::-1]
            s_ = ''.join(s_)

ans = s_.replace('?','a')

print(ans)
Problem p03647 (python)

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

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
		if d[b] == 1:
			print('POSSIBLE')
			break
	elif b == n:
		d[a] = 1
		if s[a] == 1:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split()]

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
	elif b == n:
		d[a] = 1

for i in range(1,m+1):
	if s[i] == 1 and d[i] == 1:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')
Problem p03697 (python)

Fixed submission:
import sys

a,b = [int(x) for x in sys.stdin.readline().split()]

if a+b <= 9:
	print(a+b)
else:
	print('error')

Buggy submission (verdict: Runtime Error):
a,b = [int(x) for x in sys.stdin.readline().split()]

if a+b <= 9:
	print(a+b)
else:
	print('error')
Problem p03719 (python)

Fixed submission:
import sys

a, b, c = [int(x) for x in sys.stdin.readline().split()]

if a <= c and b >= c:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
r = [0] * n
for i in range m:
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range n:
	print(r[i])
Problem p03720 (python)

Fixed submission:
import sys
import numpy as np
n,m = [int(x) for x in sys.stdin.readline().split()]
r = np.zeros(n)
for i in range(m):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range(n):
	print(int(r[i]))

Buggy submission (verdict: Runtime Error):
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
r = [0] * n
for i in range m:
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range n:
	print(r[i])
Problem p03721 (python)

Fixed submission:
import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = collections.defaultdict(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
d = sorted(r.items())
c = 0
for i,j in enumerate(d):
	c += j[1]
	if c >= k:
		print(int(j[0]))
		break

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import collections
r = [0]*100000
n,k = [int(x) for x in sys.stdin.readline().split()]
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
c = 0
for i,j in enumerate(r):
	c += j
	if c >= k:
		print(i)
		break

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = np.zeros(10**5)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
c = 0
for i,j in enumerate(r):
	c += j
	if c >= k:
		print(i)
		break

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = collections.defaultdict(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
d = sorted(r.items())
c = 0
for i,j in enumerate(d):
	c += j
	if c >= k:
		print(int(i))
		break

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from collections import defaultdict as dd
n,k = [int(x) for x in sys.stdin.readline().split()]
r = dd(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
r.sort()
c = 0
for i,j in r.items():
	c += j
	if c >= k:
		print(i)
		break

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
n,k = [int(x) for x in sys.stdin.readline().split()]
r = np.array()
for i in range(n):
	r[i] = [int(x) for x in sys.stdin.readline().split()]
r.sort(key=lambda x:x[0])
c = 0
for i,j in enumerate(r):
	c += j[0]
	if c >= k:
		print(j[1])
		break
Problem p03730 (python)

Fixed submission:
import sys

n, m, r = [int(x) for x in sys.stdin.readline().split()]
b = 0
for i in range(m):
	a = (n * (i + 1)) % m
	if a == r:
		b = 1
		break
if b == 1:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
import sys

n, m, r = [str(x) for x in sys.stdin.readline().split()]

for i in range(m):
	a = (n * (i + 1)) % m
	if a == r:
		print('YES')
		break
	print('NO')
Problem p03035 (python)

Fixed submission:
argA,argB = list(map(int,input().split()))

if argA >= 13:
  ans = argB
elif argA >= 6:
  ans = argB / 2
else:
  ans = 0

print(int(ans))

Buggy submission (verdict: Runtime Error):
argN, argA, argB, argC, argD = list(map(int,input().split()))
argS = input()

if argA < argB and argC < argD:
  flgOIKOSI = False
elif argB < argA and argD < argC:
  flgOIKOSI = False
else:
  flgOIKOSI = True
#print(flgOIKOSI)
  
if "##" in argS[argA - 1:argC]:
  #print(argS[argA - 1:argC])
  print("No")
elif "##" in argS[argB - 1:argD]:
  #print(argS[argB - 1:argD])
  print("No")
elif flgOIKOSI == False:
  print("Yes")
else:
  aryS = list(argS.split("#"))
  #print(aryS)
  #print(len(max(aryS)))
  if len(max(aryS)) > 2:
    print("Yes")
  else:
    print("No")
Problem p03029 (python)

Fixed submission:
a, p = map(int, input().split())
print((a * 3 + p) // 2)

Buggy submission (verdict: Runtime Error):
a, p = mao(int, input().split())
print((a * 3 + p) // 2)
Problem p03037 (python)

Fixed submission:
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1, 0))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1),0)
Problem p03078 (python)

Fixed submission:
x,y,z,K = (int(i) for i in input().split(" "))

a_ = sorted([int(i) for i in input().split(" ")])[::-1]
b_ = sorted([int(i) for i in input().split(" ")])[::-1]
c_ = sorted([int(i) for i in input().split(" ")])[::-1]

res = []
for i in range(x):
    for j in range(y):
        for k in range(z):
            if (i+1)*(j+1)*(k+1) <= K:
                res.append(a_[i]+b_[j]+c_[k])
            else:
                break

res = sorted(res)[::-1]

for i in range(K):
    print(res[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
k = int(input().split(" ")[-1])

a_ = np.array([int(i) for i in input().split(" ")])
b_ = np.array([int(i) for i in input().split(" ")])
c_ = np.array([int(i) for i in input().split(" ")])

res = np.array([], dtype="int32")
for a in a_:
    for b in b_:
        for c in c_:
            if len(res) == k:
                i = np.argmin(res)
                res[i] = np.max(res[i], a+b+c)
            else:
                res = np.append(res,a+b+c)

res = np.sort(res)[::-1]

for i in range(k):
    print(res[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
k = int(input().split(" ")[-1])

a = np.array([int(i) for i in input().split(" ")])
b = np.array([int(i) for i in input().split(" ")])
c = np.array([int(i) for i in input().split(" ")])

res = a.reshape(1,len(a)) + b.reshape(len(b),1)
res = c.reshape(1,1,len(c)) + res.reshape(len(b),len(a),1)
res = res.reshape(len(a)*len(b)*len(c),1,1)[:,0,0]
res = np.sort(res)[::-1]

for i in range(k):
    print(res[i])
Problem p03126 (python)

Fixed submission:
n, m = [int(i) for i in input().split(" ")]

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i)-1 for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[i] == n:
        res += 1

print(res)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i-1) for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[s] == n:
        res += 1

print(res)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m = [int(i) for i in input().split(" ")]

pre_res = np.array([0 for i in range(m)])

for i in range(n):
    sel = [int(i-1) for i in input(().split(" "))][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[s] == n:
        res += 1

print(res)
Problem p03139 (python)

Fixed submission:
n,a,b = (int(i) for i in input().split())
x=min(a,b)
y=a+b-n
if y < 0:
    y=0
print(x,y)

Buggy submission (verdict: Runtime Error):
n = int(input())
res_tak = [0 for i in range(n)]
res_she = [0 for i in range(n)]
for j in range(n):
    a, b = (int(i) for i in input().split())
    res_tak[j] = a
    res_she[j] = b
tak = 0
she = 0
for i in range(n):
    if i & 1 == 1:
        she += max(res_she)
        j=0
        while res_she[j]==max(res_she):
            j+=1
        res_she[j] = 0
        res_tak[j] = 0
    else:
        tak += max(res_tak)
        j=0
        while res_tak[j]==max(res_tak):
            j+=1
        res_she[j] = 0
        res_tak[j] = 0


print(abs(she-tak))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input()
b=input()
c=input()
tim = 0
for i in range(n):
    if a[i] == b[i] and b[i] != c[i]:
        tim+=1
    elif b[i] == c[i] and c[i] != a[i]:
        tim+=1
    elif c[i] == a[i] and a[i] != b[i]:
        tim+=1
    elif c[i] == a[i] and a[i] == b[i]:
        tim+=0
    else:
        tim+=2
print(tim)

Buggy submission (verdict: Runtime Error):
n=input()
a=input()
b=input()
c=input()
tim = 0
for i in range(int(n)):
    if a[i] == b[i] and b[i] != c[i]:
        tim+=1
    elif b[i] == c[i] and c[i] != a[i]:
        tim+=1
    elif c[i] == a[i] and a[i] != b[i]:
        tim+=1
    elif c[i] == a[i] and a[i] == b[i]:
        tim+=0
    else:
        tim+=2
print(tim)

Buggy submission (verdict: Runtime Error):
n,a,b,c = (i for i in input().split())
tim = 0
for i in range(n):
    if a[i] == b[i] and b[i] != c[i]:
        tim+=1
    elif b[i] == c[i] and c[i] != a[i]:
        tim+=1
    elif c[i] == a[i] and a[i] != b[i]:
        tim+=1
    elif c[i] == a[i] and a[i] == b[i]:
        tim+=0
    else:
        tim+=2
print(tim)

Buggy submission (verdict: Runtime Error):
n=input()
a=input()
b=input()
c=input()
tim = 0
for i in range(n):
    if a[i] == b[i] and b[i] != c[i]:
        tim+=1
    elif b[i] == c[i] and c[i] != a[i]:
        tim+=1
    elif c[i] == a[i] and a[i] != b[i]:
        tim+=1
    elif c[i] == a[i] and a[i] == b[i]:
        tim+=0
    else:
        tim+=2
print(tim)

Buggy submission (verdict: Runtime Error):
import sys

n = int(sys.argv[1])
a = int(sys.argv[2])
b = int(sys.argv[3])
x = max(a, b)
y = a+b-n
if y < 0:
    y = 0
print(x, y)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
x = max(a, b)
y = a+b-n
if y < 0:
    y = 0
print(x, y)
Problem p03463 (python)

Fixed submission:
n, a, b = [int(i) for i in input().split(' ')]
print('Alice' if abs(a-b) % 2 == 0 else 'Borys')

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().splti(' ')]
print('Alice' if abs(a-b) % 2 == 0 else 'Borys')
Problem p03796 (python)

Fixed submission:
n = int(input())
res = 1
for i in range(1, n+1):
    res *= i
    if res >= 10**9+7:
        res %= 10 ** 9+7

print(res)

Buggy submission (verdict: Runtime Error):
res = 1
for i in range(1, n+1):
    res *= i
    if res > 10**9+7:
        res %= 10 ** 9+7

print(res%(10**9+7))