Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
seq = list(set(list(s)))
genkai_list = []
for i in range(0,1000):
    if 0 <= i <= 9:
        ap = "00" + str(i)
        genkai_list.append(ap)
    elif 10 <= i <= 99:
        ap = "0" + str(i)
        genkai_list.append(ap)
    else:
        genkai_list.append(str(i))
ans = []
for a in range(len(genkai_list)):
    for i in range(len(s)):
        if s[i] == genkai_list[a][0]:
            for j in range(i + 1, len(s)):
                if s[j] == genkai_list[a][1]:
                    for k in range(j + 1, len(s)):
                        if s[k] == genkai_list[a][2]:
                            ans.append(a)
                            break # break1
                    else:  # break1されなかった場合
                        continue
            else:
                continue # jのループが全部回った（2文字目で一致しなかった）ら、iを次の文字に
    else:
        continue # iのループが全部回った（1文字目で一致しなかった）ら、aを次の文字に
                
print(len(set(ans)))

Fixed submission:
from math import ceil,floor
x = int(input())

lower_sum = ceil(x/105)
upper_sum = floor(x/100)
num_list = list(range(lower_sum, upper_sum+1))

for i in num_list:
    for a in range(i+1):
        for b in range(i+1-a):
            for c in range(i+1-a-b):
                for d in range(i+1-a-b-c):
                    for e in range(i+1-a-b-c-d):
                        for f in range(i+1-a-b-c-d-e):
                            if 100*a + 101*b + 102*c + 103*d + 104*e + 105*f == x:
                                print("1")
                                exit()

print("0")
Buggy python submission (verdict: Runtime Error):
# ABC 146 C
import math
input_list = list(map(int, input().split()))
a = input_list[0]
b = input_list[1]
x = input_list[2]

a_check = math.floor(x / a)
try:
    b_check = math.floor(10 ** (x/b))
except:
    b_check = 1000000000

if (a_check < 1) | (b_check < 1):
    print(0)
    exit()
elif a_check <= b_check:
    n = a_check
elif b_check <= a_check:
    n = b_check

if n > 1000000000:
    n = 1000000000
    print(n)
    exit()
    
def n_check(n_):
    if a * n_ + b * len(str(n_)) <= x:
        return True

while n_check(n) != True:
    n -= 1
    n_check(n)
print(n)


Fixed submission:
# ABC 146 A
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Buggy python submission (verdict: Runtime Error):
import math
input_list = list(map(int, input().split()))
a = input_list[0]
b = input_list[1]
x = input_list[2]

a_check = math.floor(x / a)
b_check = math.floor(pow(x / b, 10))

if (a_check < 1) | (b_check < 1):
    print(0)
    exit()
elif a_check <= b_check:
    n = a_check
elif b_check <= a_check:
    n = b_check

if n > 1000000000:
    n = 1000000000

def n_check(n_):
    if a * n_ + b * len(str(n_)) <= x:
        return True

while n_check(n) != True:
    n -= 1
    n_check(n)
print(n)


Fixed submission:
# ABC 146 A
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
chars = input()
if n%2 ==0:
    k = n/2
    if chars[:k] == chars[k:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Fixed submission:
n = int(input())
chars = input()
if n%2 == 0:
    k = n//2
    if chars[:k] == chars[k:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# abc144 C
# 素因数分解してみる（これは後でちゃんと理解しておく！！！）
import numpy as np
import itertools

n = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


# リストを2分割する
n_insu_list = prime_factorize(n)
bunkai_list = []
# for i in range(1, len(n_insu_list)):
#     bunkai_list.append((np.prod(n_insu_list[:i]), np.prod(n_insu_list[i:])))  # ここが間違っている。
# あらゆる並べ方に対して、この部屋分け的発想を試す必要がある
# n_insu_listを並べ替えたやつ
n_insu_list_list = list(itertools.permutations(n_insu_list))
for nlist in n_insu_list_list:
    for i in range(1, len(nlist)):
        bunkai_list.append((np.prod(nlist[:i]), np.prod(nlist[i:])))
bunkai_list.append((1, n))

# bunkai_listのうち、tupleの和が最小であるものを選び、そのindexを取得する。そのindexのtupleを取得し、そこまでの移動回数を調べる
bunkai_list_sum = [sum(x) for x in bunkai_list]

min_tuple = bunkai_list[bunkai_list_sum.index(min(bunkai_list_sum))]

print(sum(min_tuple) - 2)


Fixed submission:
n = int(input())
import math
sqrt_n = math.floor(math.sqrt(n))

seisu_tuple = []
for a in range(1,sqrt_n+1):
    if n/a == math.floor(n/a):  # 整数判定
        seisu_tuple.append((a,n/a))
bunkai_list_sum = [sum(x) for x in seisu_tuple]
min_tuple = seisu_tuple[bunkai_list_sum.index(min(bunkai_list_sum))]
print(int(sum(min_tuple) - 2))

Buggy python submission (verdict: Time Limit Exceeded):
# abc144 C
# 素因数分解してみる（これは後でちゃんと理解しておく！！！）
import numpy as np
import itertools

n = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


# リストを2分割する
n_insu_list = prime_factorize(n)
bunkai_list = []
# for i in range(1, len(n_insu_list)):
#     bunkai_list.append((np.prod(n_insu_list[:i]), np.prod(n_insu_list[i:])))  # ここが間違っている。
# あらゆる並べ方に対して、この部屋分け的発想を試す必要がある
# n_insu_listを並べ替えたやつ
n_insu_list_list = list(itertools.permutations(n_insu_list))
for nlist in n_insu_list_list:
    for i in range(1, len(nlist)):
        bunkai_list.append((np.prod(nlist[:i]), np.prod(nlist[i:])))
bunkai_list = list(set(bunkai_list))
bunkai_list.append((1, n))

# bunkai_listのうち、tupleの和が最小であるものを選び、そのindexを取得する。そのindexのtupleを取得し、そこまでの移動回数を調べる
bunkai_list_sum = [sum(x) for x in bunkai_list]

min_tuple = bunkai_list[bunkai_list_sum.index(min(bunkai_list_sum))]

print(sum(min_tuple) - 2)


Fixed submission:
n = int(input())
import math
sqrt_n = math.floor(math.sqrt(n))

seisu_tuple = []
for a in range(1,sqrt_n+1):
    if n/a == math.floor(n/a):  # 整数判定
        seisu_tuple.append((a,n/a))
bunkai_list_sum = [sum(x) for x in seisu_tuple]
min_tuple = seisu_tuple[bunkai_list_sum.index(min(bunkai_list_sum))]
print(int(sum(min_tuple) - 2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
charar = input()
charlist = []
while not all([x==charar[0] for x in charar]):
    for i in range(len(charar)-1):
        if charar[i] != charar[i+1]:
            charlist.append(charar[:i+1])
            charar = charar[i+1:]
            break
print(len(charlist)+1)

Fixed submission:
n = int(input())
charar = input()
sum = 0
for i in range(len(charar) - 1):
    if charar[i] != charar[i + 1]:
        sum +=1
print(sum+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
charar = input()
charlist = []
while len(list(set(list(charar)))) >1:
    for i in range(len(charar)-1):
        if charar[i] != charar[i+1]:
            charlist.append(charar[:i+1])
            charar = charar[i+1:]
            break
print(len(charlist)+1)

Fixed submission:
n = int(input())
charar = input()
sum = 0
for i in range(len(charar) - 1):
    if charar[i] != charar[i + 1]:
        sum +=1
print(sum+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
ans = [s.index(i)+1 for i in range(1,n+1)]
print(*ans)

Fixed submission:
# ABC 142 C go to school
n = int(input())
s = list(map(int,input().split()))

# ソートされたリストのインデックスを返す
s = sorted(range(len(s)), key=lambda k:s[k])
ans = [x+1 for x in s]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC 142 C go to school
n = int(input())
s = list(map(int,input().split()))

# ソートされたリストのインデックスを返す
for i in range(len(s)):
    print(sorted(range(len(s)), key=lambda k:s[k])[i] + 1, end=" ")

Fixed submission:
# ABC 142 C go to school
n = int(input())
s = list(map(int,input().split()))

# ソートされたリストのインデックスを返す
s = sorted(range(len(s)), key=lambda k:s[k])
ans = [x+1 for x in s]
print(*ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int,input().split()))
print_list = []


# ソートされたリストのインデックスを返す
for i in range(len(s)):
    print(sorted(range(len(s)), key=lambda k:s[k])[i] + 1, end=" ")

Fixed submission:
# ABC 142 C go to school
n = int(input())
s = list(map(int,input().split()))

# ソートされたリストのインデックスを返す
s = sorted(range(len(s)), key=lambda k:s[k])
ans = [x+1 for x in s]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC 142 C go to school
n = int(input())
a_list = list(map(int,input().split()))
print_list = []
for i in range(1,n+1):
    print(a_list.index(i)+1, end = " ")

Fixed submission:
# ABC 142 C go to school
n = int(input())
s = list(map(int,input().split()))

# ソートされたリストのインデックスを返す
s = sorted(range(len(s)), key=lambda k:s[k])
ans = [x+1 for x in s]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int,input().split()))
print_list = []
for i in range(1,n+1):
    print_list.append(a_list.index(i)+1)
for s in print_list:
  print(s, end =" ")

Fixed submission:
# ABC 142 C go to school
n = int(input())
s = list(map(int,input().split()))

# ソートされたリストのインデックスを返す
s = sorted(range(len(s)), key=lambda k:s[k])
ans = [x+1 for x in s]
print(*ans)
Buggy python submission (verdict: Runtime Error):
input_list = list(map(int, input().split()))
a = input_list[0]
b = input_list[1]
taps = 0
count = 0
taps += a
count += 1

while taps < b:
    taps += a-1
    count += 1
print(count)

Fixed submission:
# abc139 a
s = input()
t = input()
count = 0
for i in range(len(s)):
    if s[i] == t[i]:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
largest = 0
second_largest = 0
for i in range(n):
    temp = int(input())
    if temp > largest:
        largest = temp
    elif largest >= temp > second_largest:
        second_largest = temp
    else:
        continue
    a.append(temp)

for i in range(n):
    if a[i] == largest:
        print(second_largest)
    else:
        print(largest)

Fixed submission:
n = int(input())
a = []
largest = 0
second_largest = 0
for i in range(n):
    temp = int(input())
    if temp > largest:
        largest = temp
    elif largest >= temp > second_largest:
        second_largest = temp
    a.append(temp)

for i in range(n):
    if a[i] == largest:
        print(second_largest)
    else:
        print(largest)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input()))
count = 0
for i in range(n-2):
    if (p[i] > p[i+1]) & (p[i+2] > p[i+1]):
        count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n-2):
    if (p[i] > p[i+1] > p[i+2]) | (p[i+2] > p[i+1] > p[i]):
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = input()
input_list = list(map(int, input().split()))
input_list.sort(reverse=True)
# aliceは奇数番目のものを、bobは偶数番目のものをとる
alice = 0
bob = 0
for i in range(n):
    if (i+1) % 2 == 1:
        alice += input_list[i]
    else:
        bob += input_list[i]
print(alice - bob)

Fixed submission:
n = int(input())
input_list = list(map(int, input().split()))
input_list.sort(reverse=True)
# aliceは奇数番目のものを、bobは偶数番目のものをとる
a = 0
b = 0
for i in range(n):
    if (i+1) % 2 == 1:
        a += input_list[i]
    else:
        b += input_list[i]
print(a - b)
Buggy python submission (verdict: Runtime Error):
input_list = input().split()
test = input_list[0]*input_list[1]%2
if test == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
#入力がs_1 s_2
#input_list = input().split() str型ならこれでもいいかも
input_list = list(map(int, input().split()))
test = input_list[0]*input_list[1]%2
if test == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
a = input()
input_list = []
for k in a:
    input_list.append(int(k))
ans = []
fomul_list = []
for i in range(2 ** n):
    sum = input_list[0]
    fomul = str(input_list[0])
    for j in range(3):
        if (i >> j)&1:
            sum += input_list[j+1]
            fomul = fomul + "+" + str(input_list[j+1])
        else:
            sum -= input_list[j+1]
            fomul = fomul + "-" + str(input_list[j+1])
    bag.append(sum)
    fomul_list.append(fomul)
print(fomul_list[bag.index(7)])

Fixed submission:
a = input()
input_list = []
for k in a:
    input_list.append(int(k))
n=3
bag = []
fomul_list = []
for i in range(2 ** n):
    sum = input_list[0]
    fomul = str(input_list[0])
    for j in range(3):
        if (i >> j)&1:
            sum += input_list[j+1]
            fomul = fomul + "+" + str(input_list[j+1])
        else:
            sum -= input_list[j+1]
            fomul = fomul + "-" + str(input_list[j+1])
    bag.append(sum)
    fomul_list.append(fomul)
print(fomul_list[bag.index(7)] + "=7")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
class UnionFind:
    def __init__(self, n=0):
        self.d = [-1 for _ in range(n)]
    
    def find(self, x):
        if self.d[x] < 0: return x
        self.d[x] = self.find(self.d[x])
        return self.d[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return False
        if -self.d[x] < -self.d[y]: # swap
            t = self.d[x]
            self.d[x] = self.d[y]
            self.d[y] = t
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.d[self.find(x)]
    

def main():
    N, M, K = map(int, input().split())
    uf = UnionFind(N)

    deg = [0 for _ in range(N)]
    for _ in range(M): # friends
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        deg[a] += 1
        deg[b] += 1
        uf.unite(a, b)

    to = [[] for _ in range(N)]
    for _ in range(K): # block
        c, d = map(int, input().split())
        c -= 1
        d -= 1
        to[c].append(c)
        to[d].append(d)


    ret = []
    for i in range(N):
        ans = uf.size(i) - 1 - deg[i]
        for u in to[i]:
            if uf.same(i, u): ans -= 1
        ret.append(str(ans))

    print(' '.join(ret))


main()

Fixed submission:
from collections import defaultdict
class UnionFind:
    def __init__(self, n=0):
        self.d = [-1 for _ in range(n)]
    
    def find(self, x): # find root
        if self.d[x] < 0: return x
        self.d[x] = self.find(self.d[x])
        return self.d[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return False
        if -self.d[x] < -self.d[y]: # swap
            t = x
            x = y
            y = t
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.d[self.find(x)]
    

def main():
    N, M, K = map(int, input().split())
    uf = UnionFind(N)

    deg = [0 for _ in range(N)]
    for _ in range(M): # friends
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        deg[a] += 1
        deg[b] += 1
        uf.unite(a, b)
    # print(uf.d)

    to = [[] for _ in range(N)]
    for _ in range(K): # block
        c, d = map(int, input().split())
        c -= 1
        d -= 1
        to[c].append(d)
        to[d].append(c)

    ret = []
    for i in range(N):
        ans = uf.size(i) - 1 - deg[i]
        for u in to[i]:
            if uf.same(i, u): ans -= 1
        ret.append(str(ans))

    print(' '.join(ret))


main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    res = 0
    maxI = 0
    maxV = 0
    for i in range(N-K+1):
        v = sum(P[i:i+K])
        if v > maxV:
            maxV = v
            maxI = i
    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()

Fixed submission:
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    maxI = 0
    maxV = sum(P[:K])
    curV = maxV
    for i in range(1, N-K+1):
        curV = curV + P[i+K-1] - P[i-1]
        if curV > maxV:
            maxV = curV
            maxI = i

    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    res = 0
    maxI = 0
    maxV = 0
    for i in range(N-K+1):
        v = sum(P[i:i+K])
        if v > maxV:
            maxV = v
            maxI = i
    for p in P[maxI:maxI+K]:
        res += (p+1.0) / 2.0
    print(res)

main()

Fixed submission:
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    maxI = 0
    maxV = sum(P[:K])
    curV = maxV
    for i in range(1, N-K+1):
        curV = curV + P[i+K-1] - P[i-1]
        if curV > maxV:
            maxV = curV
            maxI = i

    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    res = 0
    maxI = 0
    maxV = 0
    for i in range(N-K+1):
        v = sum(P[i:i+K])
        if v > maxV:
            maxV = v
            maxI = i
    # print(maxI)
    for p in P[maxI:maxI+K]:
        res += (1.0/p) * (p*(p+1.0)/2.0)
    print(res)

main()

Fixed submission:
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    maxI = 0
    maxV = sum(P[:K])
    curV = maxV
    for i in range(1, N-K+1):
        curV = curV + P[i+K-1] - P[i-1]
        if curV > maxV:
            maxV = curV
            maxI = i

    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    res = 0
    maxI = 0
    maxV = 0
    for i in range(N-K+1):
        v = sum(P[i:i+K])
        if v > maxV:
            maxV = v
            maxI = i
    # print(maxI)
    for p in P[maxI:maxI+K]:
        res += (1.0/p) * sum(list(range(p+1)))
    print(res)



    

main()

Fixed submission:
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    maxI = 0
    maxV = sum(P[:K])
    curV = maxV
    for i in range(1, N-K+1):
        curV = curV + P[i+K-1] - P[i-1]
        if curV > maxV:
            maxV = curV
            maxI = i

    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()
Buggy python submission (verdict: Runtime Error):
G = None
ans = None

def dfs(v, parent_c=-1, parent_id=-1):
    global G, ans
    k = 1
    for i in range(len(G[v])):
        edge_id, to = G[v][i]['edge_id'], G[v][i]['to']
        if to == parent_id: continue
        if k == parent_c: k+=1
        ans[edge_id] = k
        k += 1
        dfs(to, parent_c=ans[edge_id], parent_id=v)

def main():
    global G, ans
    N = int(input())
    G = [[] for _ in range(N)]
    ans = [0 for _ in range(N-1)]
    for edge_id in range(N-1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append({'to': b, 'edge_id': edge_id})
        G[b].append({'to': a, 'edge_id': edge_id})
    
    dfs(0)
    print(max(ans))
    for a in ans:
        print(a)

main()

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
G = None
ans = None

def dfs(v, parent_c=-1, parent_id=-1):
    global G, ans
    k = 1
    for i in range(len(G[v])):
        edge_id, to = G[v][i]['edge_id'], G[v][i]['to']
        if to == parent_id: continue
        if k == parent_c: k+=1
        ans[edge_id] = k
        k += 1
        dfs(to, parent_c=ans[edge_id], parent_id=v)

def main():
    global G, ans
    N = int(input())
    G = [[] for _ in range(N)]
    ans = [0 for _ in range(N-1)]
    for edge_id in range(N-1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append({'to': b, 'edge_id': edge_id})
        G[b].append({'to': a, 'edge_id': edge_id})
    
    dfs(0)
    print(max(ans))
    for a in ans:
        print(a)

main()
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
# from math import factorial as f
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac

MOD = 10**9 + 7
def main():
    X, Y = map(int, input().split())
    a = 2 * X - Y
    if a % 3 != 0:
        print(0)
        return
    a = a // 3

    b = 2 * Y - X
    if b % 3 != 0:
        print(0)
        return
    b = b // 3

    total = a + b
    fac, ifac = make_tables(MOD, total)
    ans = cmb(a+b, min(a, b), MOD, fac, ifac)
    print(ans)


main()

Fixed submission:
from itertools import combinations
# from math import factorial as f
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac

MOD = 10**9 + 7
def main():
    X, Y = map(int, input().split())
    a = 2 * X - Y
    if a % 3 != 0 or a < 0:
        print(0)
        return
    a = a // 3

    b = 2 * Y - X
    if b % 3 != 0 or b < 0:
        print(0)
        return
    b = b // 3

    total = a + b
    fac, ifac = make_tables(MOD, total)
    ans = cmb(a+b, min(a, b), MOD, fac, ifac)
    print(ans)


main()
Buggy python submission (verdict: Runtime Error):
import math
def main():
    a, b, x = map(float, input().split())
    thX = a * a * b / 2.0
    if x <= thX:
        h = 2.0 * x / (a * b)
        deg = math.degrees(math.atan(h / b))
        print(90.0 - deg)
    else:
        c = 2.0 * x / (a*a) - b
        deg = math.degrees(math.atan(a / (b-c)))
        print(90 - deg)

main()

Fixed submission:
import math
def main():
    a, b, x = map(float, input().split())
    thX = a * a * b / 2.0
    if x == (a*a*b):
        print(0)
    elif x <= thX:
        h = 2.0 * x / (a * b)
        deg = math.degrees(math.atan(h / b))
        print(90.0 - deg)
    else:
        c = 2.0 * x / (a*a) - b
        deg = math.degrees(math.atan(a / (b-c)))
        print(90.0 - deg)

main()