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

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

a1 = 0
b1 = 0
l = []
if a % 2 != 0:
   a1 = 1
if b % 2 == 0:
   b1 = 1
if a1 == 1:
   l.append(a)
one = b - a + 1 - a1 -b1
if one // 2 % 2 == 0:
   l.append(0)
if one // 2 % 2 == 1:
   l.append(1)
if b1 == 1:
   l.append(b)

if len(l) == 1:
   print(l[0])
if len(l) == 2:
   print(l[0]^l[1])
if len(l) == 3:
   print(l[0]^l[1]^l[2])

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

if a == b:
    print(a)
    exit()
ansl = []
if a % 2 == 1:
    ansl.append(a)
    a += 1
if b % 2 == 0:
    ansl.append(b)
    b -= 1

k = b - a + 1
k = k // 2
if k % 2 == 1:
    ansl.append(1)
if len(ansl) == 0:
    print(0)
if len(ansl) == 1:
    print(ansl[0])
elif len(ansl) == 2:
    print(ansl[0] ^ ansl[1])
else:
    print(ansl[0] ^ ansl[1] ^ ansl[2])

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

if a == b:
    print(a)
    exit()
ansl = []
if a % 2 == 1:
    ansl.append(a)
    a += 1
if b % 2 == 0:
    ansl.append(b)
    b -= 1

k = b - a + 1
k = k // 2
if k % 2 == 1:
    ansl.append(1)

if len(ansl) == 1:
    print(ansl[0])
elif len(ansl) == 2:
    print(ansl[0] ^ ansl[1])
else:
    print(ansl[0] ^ ansl[1] ^ ansl[2])

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

if a == b:
    print(a)
    exit()
ansl = []
if a % 2 == 1:
    ansl.append(a)
    a += 1
if b % 2 == 0:
    ansl.append(b)
    b -= 1

k = b - a
k = k // 2

if k % 2 == 1:
    ansl.append(1)

if len(ansl) == 1:
    print(ansl[0])
elif len(ansl) == 2:
    print(ansl[0] ^ ansl[1])
else:
    print(ansl[0] ^ ansl[1] ^ ansl[2])
Problem p03221 (python)

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

pyl = []
pyl2 = [[] for i in range(n)]    
for i in range(m):
    p,y = map(int,input().split())
    pyl.append((p,y))
    pyl2[p-1].append((y,i))
    
argsortpyl = []
for p in pyl2:
    argsortpyl.append(sorted(p))
    

ansl = ["" for i in range(m)]

for idx, py in enumerate(argsortpyl):
    for ud,(y,i) in enumerate(py):
        ansl[i] = (idx+1, ud+1)
        
for x,y in ansl:
    print(str(x).zfill(6) + str(y).zfill(6))

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

pyl = []
pyl2 = [[] for i in range(n)]    
for _ in range(m):
    p,y = map(int,input().split())
    pyl.append((p,y))
    pyl2[p-1].append(y)
    
argsortpyl = []
for p in pyl2:
    argsortpyl.append(list(np.argsort(np.array(p))))
    
for p,y in pyl:
    x = argsortpyl[p-1].pop(0)
    print(str(p).zfill(6) + str(x+1).zfill(6))
Problem p03774 (python)

Fixed submission:
n,m = map(int,input().split())
cdl = []
for _ in range(n):
    a,b = map(int,input().split())
    cdl.append((a,b))
abl = []
for _ in range(m):
    c,d = map(int,input().split())
    abl.append((c,d))

for c,d in cdl:
    ans = -1
    l = float("inf")
    for idx, (a,b) in enumerate(abl):
        dist = abs(a-c) + abs(b-d)
        if dist < l:
            ans = idx + 1
            l = dist
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
abl = []
for _ in range(n):
    a,b = map(int,input().split())
    abl.append((a,b))

cdl = []
for _ in range(n):
    c,d = map(int,input().split())
    cdl.append((c,d))

for a,b in abl:
    ans = float("inf")
    log = -1
    for idx, (c,d) in enumerate(cdl):
        tmp = abs(a-c) + abs(b-d)
        if ans > tmp:
            ans = tmp
            log = idx+1
    print(log)
Problem p02627 (python)

Fixed submission:
a = input()
if a.isupper()==True:
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
if a.isupper()==True:
    print("A")
else:
    print("a")
Problem p02627 (python)

Fixed submission:
a = input()

if a.isupper() == True:
  print('A')
elif a.islower() == True:
  print('a')

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

alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

first = n // len(alphabet)
mod = n % len(alphabet) 

if n < 26:
    print(alphabet[mod])
    
    
elif n >= 26 and n <702:
    print(alphabet[first-1]+alphabet[mod])
    
elif n >= 702 and n <18278:
    second = (first // len(alphabet)) -1
    second_1 = second % len(alphabet)
    print(alphabet[second_1-1]+alphabet[second-1]+alphabet[mod])
    
elif n >= 18278 and n <475254:
    second = (first // len(alphabet)) -1
    second_1 = second % len(alphabet)
    
    third = (second // len(alphabet)) -1 
    third_1 = third % len(alphabet)
    print(alphabet[second_1-1]+alphabet[second-1]+alphabet[mod]+alphabet[mod])
    
elif n >= 475254 and n <1000000000000001:
    print('')
Problem p03075 (python)

Fixed submission:

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
    
if e - a <= k:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
     
    if e - a <= k:
        print('Yay!')
    else:
        print(':(')

Buggy submission (verdict: Runtime Error):
n = []
for i in range(5):
    n.append(int(input()))

k = input()

if n[4] - n[0] <= k:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):

n = []
for i in range(5):
    n.append(input())

k = input()

if n[4] - n[0] <= k:
    print('Yay!')
else:
    print(':(')
Problem p03077 (python)

Fixed submission:
t = int(input())
n = [int(input()) for i in range(5)]


m = min(n)

if t < m:
    t = m

tmp = t//m

if t % m != 0:
    tmp += 1

print(tmp+4)

Buggy submission (verdict: Runtime Error):
n = [int(input()) for i in range(5)]
t=input()

m = min(n)

if t < m:
    t = m

tmp = t//m

if t % m != 0:
    tmp += 1

print(tmp+4)
Problem p02835 (python)

Fixed submission:
a1,a2,a3 = map(int,input().split())
if(a1+a2+a3<22):
 print("win")
else:
 print("bust")

Buggy submission (verdict: Runtime Error):
a1,a2,a3 = input().split()
if(a1+a2+a3<22):
 print("win")
else:
 print("bust")

Buggy submission (verdict: Runtime Error):
a1 = input()
a2 = input()
a3 = input()
if(a1+a2+a3<22):
 print("win")
else:
 print("bust")

Buggy submission (verdict: Runtime Error):
a1 = raw_input()
a2 = raw_input()
a3 = raw_input()
if(a1+a2+a3<22):
 print("win")
else:
 print("bust")
Problem p02627 (python)

Fixed submission:
if input() in 'qwertyuiopasdfghjklzxcvbnm':
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
K = int(raw_input())
S = len(raw_input())

M = 10**9 + 7

F = [1]
IF = [1]
for i in xrange(1, S + K + 1):
    F.append((F[-1] * i) % M)
    IF.append((IF[-1] * pow(i, M - 2, M)) % M)

def nCr(n, r):
    return (F[n] * IF[r] * IF[n-r]) % M

ans = 0
for i in xrange(K + 1):
    ans = (ans + nCr(i + S - 1, S - 1) * pow(25, i, M) * pow(26, K - i, M)) % M
print ans

Buggy submission (verdict: Runtime Error):
if input() in 'qwertyuiopasdfghjklzxcvbnm':
  print 'a'
else:
  print 'A'
Problem p03011 (python)

Fixed submission:
a, b, c = map(int, raw_input().split())
print min(a + b, a + c, b + c)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
A = map(int, raw_input().split())
ans = 10**18
for i in xrange(1, N):
  ans = min(ans, abs(sum(A[:i]) - sum(A[i:])))
print ans

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, raw_input().split())
print miN(a + b, a + c, b + c)
Problem p03012 (python)

Fixed submission:
N = int(raw_input())
A = map(int, raw_input().split())
ans = 10**18
for i in xrange(1, N):
  ans = min(ans, abs(sum(A[:i]) - sum(A[i:])))
print ans

Buggy submission (verdict: Runtime Error):
N = int(raw_input().split())
A = map(int, raw_input().split())
A.sort()
ans = 10**18
for i in xrange(1, N):
  ans = min(ans, abs(sum(A[:i]) - sum(A[i:])))
print ans
Problem p02627 (python)

Fixed submission:
A = input()

if A.isupper():
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
a = input()
if a.islower():
  print(a)
else:
  print(A)
Problem p02627 (python)

Fixed submission:
import sys
print("A") if str.isupper(input()) else print("a")

Buggy submission (verdict: Runtime Error):
import sys
print("A") if str.isupper(sys.argv[1]) else print("a")
Problem p02629 (python)

Fixed submission:
def main():
    N = int(input())
    ans = ''
 
    while N > 0:
        N -= 1
        ans += chr(ord('a') + N % 26).lower()
        N = N // 26
    print(ans[::-1])
 
 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = ''
 
while N > 0:
	N -= 1
	ans += chr(ord('a') + N % 26).lower()
	N = N // 26
    print(ans[::-1])
Problem p02766 (python)

Fixed submission:
import math
 
i = input().split()
N = int(i[0])
K = int(i[1])
result = 0
 
result = math.log(N, K)
result = 1 + int(result)

 
print(result)

Buggy submission (verdict: Runtime Error):
i = input().split()
N = int(i[0])
K = int(i[1])
log = 0

log = math.log(N,K)
if int(log) != log:
  log += 1

print(log)
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()

print(s if len(s)<=k else s[0:k] + "...")

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

print(s if len(s)<=k else s[0:k] + "...")a
Problem p02759 (python)

Fixed submission:
n = int(input())
ans = 0
a = 0
for i in range(1, n+1):
    if ans % 2 == 0:
        a += 1
    ans += 1

print(a)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
ans = [9283749384736]*n

if m == 0:
    print(-1)
    exit()


for i in l:
    if i[0] == 1 and i[1] == 0:
        continue
    if ans[i[0]-1] >= i[1]:
        ans[i[0]-1] = i[1]

for i in range(n):
    if ans[i] == 9283749384736:
        ans[i] = 0

s = int("".join(list(map(str, ans))))
if len(str(s)) == n:
    print(s)
else:
    print(-1)
Problem p02831 (python)

Fixed submission:
from fractions import gcd

a, b = map(int, input().split())
print((a*b) // gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
print((a*b) // math.gcd(a, b))
Problem p02935 (python)

Fixed submission:
n = int(input())
v = sorted(list(map(int, input().split())))
ans = v[0]

for i in range(n-1):
    ans = (ans + v[i+1]) / 2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = map(int, input().split())

sorted_list = sorted(a)
print(sorted_list)
num = 0
last_num = 0

for i in range(N):
    if len(sorted_list) == 1:
        if i == 0:
            last_num = sorted_list[num]
        last_num = (sorted_list[num] + last_num) / 2
        break
    x = sorted_list[num]
    y = sorted_list[num+1]
    z = (x + y) / 2
    last_num = z
    sorted_list.pop(num)
    sorted_list.pop(num)

print(last_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = map(int, input().split())

sorted_list = sorted(a)
print(sorted_list)
num = 0
last_num = 0

for i in range(N):
    if len(sorted_list) == 1:
        if i == 0:
            last_num = sorted_list[num]
        last_num = (sorted_list[num] + last_num) / 2
        break
    x = sorted_list[num]
    y = sorted_list[num+1]
    z = (x + y) / 2
    last_sum = z
    sorted_list.pop(num)
    sorted_list.pop(num)

print(last_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = map(int, input().split())

sorted_list = sorted(a)
print(sorted_list)
num = 0
last_sum = 0
for i in range(N):
    if len(sorted_list) == 1:
        last_sum = (sorted_list[num] + last_sum) / 2
        break
    x = sorted_list[num]
    y = sorted_list[num+1]
    z = (x + y) / 2
    last_sum = z
    sorted_list.pop(num)
    sorted_list.pop(num)

print(last_sum)
Problem p02951 (python)

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

ans = ((a-b)-c)*-1
if 0>ans:
    ans = 0
print(ans)

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

ans = ((a-b)-c)*-1
if 0>ans:
    ans = 0
print(ans)
Problem p03042 (python)

Fixed submission:
s = input()
l = s[:2]
r = s[2:]
yy = [str(i).zfill(2) for i in range(100)]
mm = [str(i).zfill(2) for i in range(1, 13)]

if l in mm and r in mm:
    print("AMBIGUOUS")
elif l in yy and r in mm:
    print("YYMM")
elif l in mm and r in yy:
    print("MMYY")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
 s = input()
l = s[:2]
r = s[2:]
yy = [str(i).zfill(2) for i in range(100)]
mm = [str(i).zfill(2) for i in range(1, 13)]

if l in mm and r in mm:
    print("AMBIGUOUS")
elif l in yy and r in mm:
    print("YYMM")
elif l in mm and r in yy:
    print("MMYY")
else:
    print("NA")
Problem p02627 (python)

Fixed submission:
x = input()

res = 'A' if x.isupper() else 'a'

print(res)

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

if 'a' <= x and x <= 'z':
    print('a')
elif
    print('A')
Problem p02629 (python)

Fixed submission:
from sys import stdin, setrecursionlimit


a_list = 'abcdefghijklmnopqrstuvwxyz'


def base_convert(nl, ibase, obase):
    o = []
    while any(nl):
        c = 0
        for i in range(len(nl)):
            c = c * ibase + nl[i]
            nl[i], c = divmod(c, obase)
        o.append(c)
    o.reverse()
    return o


def main():
    input = stdin.buffer.readline
    N = int(input())
    if N == 1:
        print('a')
    else:
        arr = [1]
        tmp = 1
        while arr[-1] <= 1000000000000001:
            tmp *= 26
            arr.append(tmp)
        k = 0
        while N >= arr[k]:
            N -= arr[k]
            k += 1
        n = [int(i) for i in list(str(N))]
        idx = base_convert(n, 10, 26)
        idx = [0] * (k - len(idx)) + idx
        print(*[a_list[i] for i in idx], sep='')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit


a_list = 'abcdefghijklmnopqrstuvwxyz'


def base_convert(nl, ibase, obase):
    o = []
    while any(nl):
        c = 0
        for i in range(len(nl)):
            c = c * ibase + nl[i]
            nl[i], c = divmod(c, obase)
        o.append(c)
    o.reverse()
    return o


def main():
    input = stdin.buffer.readline
    n = int(input())
    if n == 1:
        print('a')
    else:
        n = [int(i) for i in list(str(n - 1))]
        idx = base_convert(n, 10, 26)
        for i in range(len(idx)):
            if i < len(idx) - 1:
                idx[i] -= 1
        if len(idx) > 1:
            j = idx.index(-1)
            idx = idx[j + 1:]
            idx = [-1] * j + idx
        print(*[a_list[i] for i in idx], sep='')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem p02661 (python)

Fixed submission:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    ab = [list(map(int, input().split())) for _ in range(n)]
    min_arr = sorted(ab, key=lambda x: x[0])
    max_arr = sorted(ab, key=lambda x: x[1])
    if n % 2 != 0:
        a = min_arr[n // 2][0]
        b = max_arr[n // 2][1]
        print(b - a + 1)
    else:
        a1 = min_arr[(n - 1) // 2][0]
        b1 = max_arr[(n - 1) // 2][1]
        a2 = min_arr[(n + 1) // 2][0]
        b2 = max_arr[(n + 1) // 2][1]
        print(b1 + b2 - a1 - a2 + 1)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    ab = [list(map(int, input().split())) for _ in range(n)]
    if n % 2 != 0:
        a, b = ab[n // 2]
        print(b - a + 1)
    else:
        a1, b1 = ab[(n - 1) // 2]
        a2, b2 = ab[(n + 1) // 2]
        print(len(list(range(a1 + a2, b1 + b2 + 1))))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem p02679 (python)

Fixed submission:
from sys import stdin, setrecursionlimit


def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x % y)


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n = int(input())
    p = []
    m = []

    zz = 0

    for _ in range(n):
        a, b = map(int, input().split())
        if a != 0 and b != 0:
            g = gcd(a, b)
            f = b / a
            if b / a < 0:
                m.append(str(abs(a // g)) + ':' + str(abs(b // g)))
            elif f > 0:
                p.append(str(abs((b // g))) + ':' + str(abs((a // g))))
        elif a == 0 and b == 0:
            zz += 1
        elif a == 0:
            m.append(0)
        elif b == 0:
            p.append(0)

    g_p = {}
    for k in p:
        if k in g_p:
            g_p[k] += 1
        else:
            g_p[k] = 1
    g_m = {}
    for k in m:
        if k in g_m:
            g_m[k] += 1
        else:
            g_m[k] = 1

    ans = 1

    for k in g_p:
        if k in g_m:
            ans *= (2 ** g_p[k] + 2 ** g_m[k] - 1)
        else:
            ans *= 2 ** g_p[k]
        ans %= mod
    for k in g_m:
        if not (k in g_p):
            ans *= 2 ** g_m[k]
            ans %= mod
    print((ans + zz - 1) % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit
from collections import deque


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n = int(input())
    p = []
    m = []

    for _ in range(n):
        a, b = map(int, input().split())
        f = b / a
        if f < 0:
            m.append(-1 / f)
        elif f > 0:
            p.append(f)

    g_p = {}
    for k in p:
        if k in g_p:
            g_p[k] += 1
        else:
            g_p[k] = 1
    g_m = {}
    for k in m:
        if k in g_m:
            g_m[k] += 1
        else:
            g_m[k] = 1

    ans = 1

    for k in g_p:
        if k in g_m:
            ans *= (2 ** g_p[k] + 2 ** g_m[k] - 1)
        else:
            ans *= 2 ** g_p[k]
        ans %= mod
    for k in g_m:
        if not (k in g_p):
            ans *= 2 ** g_m[k]
            ans %= mod
    print((ans - 1) % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem p02820 (python)

Fixed submission:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = input()[:-1].decode()

    ans = 0
    result = [False] * n
    for i in range(n):
        if k <= i and t[i] == t[i - k] and result[i - k]:
            continue
        if t[i] == 'r':
            ans += p
        elif t[i] == 's':
            ans += r
        elif t[i] == 'p':
            ans += s
        result[i] = True

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Buggy submission (verdict: Runtime Error):
def main():
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = input()[:-1].decode()

    ans = 0
    result = [False] * n
    for i in range(n):
        if k <= i and t[i] == t[i - k] and result[i - k]:
            continue
        if t[i] == 'r':
            ans += p
        elif t[i] == 's':
            ans += r
        elif t[i] == 'p':
            ans += s
        result[i] = True

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem p02862 (python)

Fixed submission:
from sys import stdin, setrecursionlimit


def initialize_cmb(m, mod=10 ** 9 + 7):
    fac = [1]
    finv = [1]
    inv = [0] * (m + 1)
    if m >= 1:
        fac.append(1)
        finv.append(1)
        inv[1] = 1
        pre_fac = 1
        pre_finv = 1
        for i in range(2, m + 1):
            pre_fac = pre_fac * i % mod
            fac.append(pre_fac)
            inv[i] = mod - inv[mod % i] * (mod // i) % mod
            pre_finv = pre_finv * inv[i] % mod
            finv.append(pre_finv)
    return fac, finv


def cmb(n, k, fac, finv, mod=10 ** 9 + 7):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    x, y = map(int, input().split())

    if (x + y) % 3 != 0 or 2 * x < y or 2 * y < x:
        print(0)
    else:
        fac, finv = initialize_cmb((x + y) // 3, mod)

        x_min = (x + y) // 3

        print(cmb((x + y) // 3, x - x_min, fac, finv, mod))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit


def initialize_cmb(m, mod=10 ** 9 + 7):
    fac = [1]
    finv = [1]
    inv = [0] * (m + 1)
    if m > 1:
        fac.append(1)
        finv.append(1)
        inv[1] = 1
        pre_fac = 1
        pre_finv = 1
        for i in range(2, m + 1):
            pre_fac = pre_fac * i % mod
            fac.append(pre_fac)
            inv[i] = mod - inv[mod % i] * (mod // i) % mod
            pre_finv = pre_finv * inv[i] % mod
            finv.append(pre_finv)
    return fac, finv


def cmb(n, k, fac, finv, mod=10 ** 9 + 7):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    x, y = map(int, input().split())

    if (x + y) % 3 != 0 or 2 * x < y or 2 * y < x:
        print(0)
    else:
        fac, finv = initialize_cmb((x + y) // 3, mod)

        x_min = (x + y) // 3
        y_max = 2 * (x + y) // 3

        print(cmb((x + y) // 3, x - x_min, fac, finv, mod))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem p03775 (python)

Fixed submission:
import numpy as np

from sys import stdin


def main():
    n = int(stdin.readline())
    d = set()
    ans = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.add(i)
    for a in d:
        tmp = np.max([len(str(a)), len(str(int(n / a)))])
        if tmp < ans:
            ans = tmp
    print(ans)


if __name__ == "__main__":
    main()

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

from sys import stdin


def main():
    n = int(stdin.readline())
    d = set()
    ans = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.add(i)
    for a in d:
        tmp = np.max([len(str(a)), len(str(int(n / a)))])
        if tmp < ans:
            ans = tmp
    print(ans)


if __name__ == "__main__":
    main()
Problem p02627 (python)

Fixed submission:
x = input()
if x.isupper():
  print('A')
else:
  print('a')

Buggy submission (verdict: Runtime Error):
x = input()
if x.isUpper():
  print('A')
else:
  print('a')
Problem p02723 (python)

Fixed submission:
S=input()
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if S[3]==S[4]:
  if S[5]==S[6]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if S[3]==S[4] and S[5]==S[6]:
  print("Yes")
else:
  print("No")
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if a>=10 or b>=10:
  print(-1)
else:
  print(a*b)

Buggy submission (verdict: Runtime Error):

a,b,x=map(int,input().split())

import math
c=(a*a*b-x)*2

if c<a*a*b:
  d=c/(a*a)
  print(math.degrees(math.atan(d/a)))
else:
  f=(2*x)/a*b 
  print(math.degrees(math.atan(b/f)))