Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))


n = int(input())
cnt = 0
for c in range(1, n):
    tar = n-c
    for a in range(1, int(tar**0.5)+1):
        if tar % a == 0:
            b = tar // a
            if b > 0 and a != b:
                cnt += 2
            elif b > 0:
                cnt += 1

print(cnt)




Fixed submission:
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))


n = int(input())
cnt = 0
for a in range(1, n):
    u = (n-1) // a
    cnt += u
print(cnt)

# for c in range(1, n):
#     tar = n-c
#     for a in range(1, int(tar**0.5)+1):
#         if tar % a == 0:
#             b = tar // a
#             if b > 0 and a != b:
#                 cnt += 2
#             elif b > 0:
#                 cnt += 1
#
# print(cnt)
Buggy python submission (verdict: Runtime Error):
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

n = int(input())
a =[chr(ord('a') + i) for i in range(26)]
a.insert(0,0)
u = []
while n!=0:
    k = n % 26
    u.append(k)
    n //= 26
ans = []
for i in range(len(u)):
    ans.append(a[u[i]])
ans.reverse()
print("".join(ans))





Fixed submission:
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

n = int(input())
a =[chr(ord('a') + i) for i in range(26)]
u = []
while n!=0:
    k = (n+25) % 26
    u.append(k)
    n = (n-1)//26
ans = []
for i in range(len(u)):
    ans.append(a[u[i]])
ans.reverse()
print("".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))

n,m,k = mp()

def combination(n, r, mod):
    np1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (np1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod


mod = 998244353
now_comb = 1
now_pow = pow(m-1, n-1, mod)
ans = now_pow*m
for i in range(1, k+1):
    # u1 = (now_comb * (n-i) * pow(i, mod-2, mod)) % mod
    u1 = combination(n-1, i, mod)
    u2 = (now_pow * pow(m-1, mod-2, mod)) % mod
    now_comb = u1
    now_pow = u2
    ans += u1*u2*m
    ans %= mod
print(ans%mod)


Fixed submission:
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
n,m,k = mp()
mod = 998244353
conb = [1]
pows = [pow(m-1, n-1-k, mod)]
for i in range(1,k+1):
    conb.append(conb[i-1]*(n-i)*pow(i,mod-2,mod) % mod)
    pows.append(pows[i-1]*(m-1) % mod)
pows.reverse()
# print(conb, pows)
ans = 0
for i in range(k+1):
    ans += m * conb[i] * pows[i]
    ans %= mod
print(ans)

# print(conb)
# print(pows)
# exit()
# now_comb = 1
# now_pow = pow(m-1, n-1, mod)
# ans = now_pow*m
# for i in range(1, k+1):
#     u1 = (now_comb * (n-i) * pow(i, mod-2, mod)) % mod
#     u2 = (now_pow * pow(m-1, mod-2, mod)) % mod
#     now_comb = u1
#     now_pow = u2
#     ans += u1*u2*m
#     ans %= mod
# print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))

n,m,k = mp()

def combination(n, r, mod):
    np1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (np1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

mod = 998244353
ans = 0
for i in range(k+1):
    ans += combination(n-1, i, mod) * pow(m-1, n-1-i, mod)
    ans %= mod
print((ans*m)%mod)


Fixed submission:
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
n,m,k = mp()
mod = 998244353
conb = [1]
pows = [pow(m-1, n-1-k, mod)]
for i in range(1,k+1):
    conb.append(conb[i-1]*(n-i)*pow(i,mod-2,mod) % mod)
    pows.append(pows[i-1]*(m-1) % mod)
pows.reverse()
# print(conb, pows)
ans = 0
for i in range(k+1):
    ans += m * conb[i] * pows[i]
    ans %= mod
print(ans)

# print(conb)
# print(pows)
# exit()
# now_comb = 1
# now_pow = pow(m-1, n-1, mod)
# ans = now_pow*m
# for i in range(1, k+1):
#     u1 = (now_comb * (n-i) * pow(i, mod-2, mod)) % mod
#     u2 = (now_pow * pow(m-1, mod-2, mod)) % mod
#     now_comb = u1
#     now_pow = u2
#     ans += u1*u2*m
#     ans %= mod
# print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
ans = -int(1e18)
for i in range(min(b, n+1)):
    ans = max(ans,(a*i//b)-a*(i//b))
print(ans)


Fixed submission:
a,b,n = map(int,input().split())
# ans = -int(1e18)
# for i in range(min(b, n+1)):
#     ans = max(ans,(a*i//b)-a*(i//b))
ans = a*min(b-1, n)//b
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
mods = []
crt = int(s[-1])
if len(s) <= 4:
    print(0)
    exit()
# for i in range(len(s)):
#     crt = crt*10+int(s[i])
#     crt %= 2019
#     mods.append(crt)
# print(mods)
for i in range(len(s)-2,-1,-1):
    crt = crt+int(s[i])*10**(len(s)-i-1)
    crt %= 2019
    mods.append(crt)
ans = 0
ans += mods.count(0)
modst = set(mods)
ans += len(mods) - len(modst)
print(ans)



Fixed submission:
import collections
s = input()
mods = [0]
crt = 0
ans = 0
if len(s) <= 4:
    print(0)
    exit()
# for i in range(len(s)):
#     crt = crt*10+int(s[i])
#     crt %= 2019
#     mods.append(crt)
# print(mods)
for i in range(len(s)-1,-1,-1):
    crt = crt+int(s[i])*pow(10, (len(s)-i-1), 2019)
    crt %= 2019
    mods.append(crt)
#print(mods)
mods_count = collections.Counter(mods)
mods_count = list(mods_count.values())
for i in range(len(mods_count)):
    tar = mods_count[i]
    ans += tar*(tar-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
print(n%abs(n-k))

Fixed submission:
n,k = map(int,input().split())
n %= k
print(min(n,abs(n-k)))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def breadth_first_search(start):
    work_q = deque([])
    visited = set()
    work_q.append(start)
    visited.add(start)
    cnt_array = [0] * (n+1)
    while work_q:
        here = work_q.popleft()
        for i in edge[here]:
            if i not in visited:
                work_q.append(i)
                visited.add(i)
                cnt_array[i] = cnt_array[here] + 1
    return cnt_array

n,x,y = map(int,input().split())
edge = []
for i in range(n+1):
    edge.append([])
for i in range(1,n+1):
    if i != n:
        edge[i].append(i+1)
    if i != 1:
        edge[i].append(i-1)
edge[x].append(y)
edge[y].append(x)

ans = [0] * n
for i in range(1, n+1):
    a = breadth_first_search(i)
    for j in range(len(a)):
        ans[a[j]] += 1
for i in range(1,n):
    print(ans[i]//2)

Fixed submission:
from collections import deque

def breadth_first_search(start):
    work_q = deque([])
    visited = set()
    work_q.append(start)
    visited.add(start)
    cnt_array = [0] * (n+1)
    while work_q:
        here = work_q.popleft()
        for i in edge[here]:
            if i not in visited:
                work_q.append(i)
                visited.add(i)
                cnt_array[i] = cnt_array[here] + 1
    return cnt_array

n,x,y = map(int,input().split())
edge = []
for i in range(n+1):
    edge.append([])
for i in range(1,n+1):
    if i != n:
        edge[i].append(i+1)
    if i != 1:
        edge[i].append(i-1)
edge[x].append(y)
edge[y].append(x)

ans = [0] * n
for i in range(1, n+1):
    a = breadth_first_search(i)
    for j in range(len(a)):
        ans[a[j]] += 1
for i in range(1,n):
    print(ans[i]//2)
Buggy python submission (verdict: Runtime Error):
ans = [-1] * n
for i in range(m):
    if ans[sc[i][0]-1] == -1 or ans[sc[i][0]-1] == sc[i][1]:
        ans[sc[i][0]-1] = sc[i][1]
    else:
        print(-1)
        exit()
if n == 1 and ans[0] != -1:
    print(ans[0])
    exit()
if ans[0] == 0:
    print(-1)
    exit()
if n == 2 and ans[0] != -1 and ans[1] != -1:
    map_ans = map(str, ans)
    print("".join(map_ans))
elif n == 2 and ans == [-1, -1]:
    print(-1)
elif n == 2:
    ans[0] = 1
    map_ans = map(str, ans)
    print("".join(map_ans))
elif n == 3 and ans == [-1, -1, -1]:
    print(-1)
elif n == 3:
    for i in range(3):
        if i == 0 and ans[i] == -1:
            ans[i] = 1
        if ans[i] == -1:
            ans[i] = 0
    map_ans = map(str, ans)
    print("".join(map_ans))



Fixed submission:
n, m = map(int,input().split())
sc = []
for i in range(m):
    s,c = map(int,input().split())
    sc.append([s,c])
for i in range(1000):
    if len(str(i)) == n:
        flag = True
        for j in range(m):
            if int(str(i)[sc[j][0] - 1]) != sc[j][1]:
                flag = False
        if flag:
            print(i)
            exit()
        else:
            continue
print(-1)
Buggy python submission (verdict: Runtime Error):
import math
n,k = map(int,input().split())
p = list(map(int,input().split()))
max_array = sum(p[0:k])
a = math.inf
u = max_array
for i in range(k, n):
    u = u + p[i]-p[i-k]
    max_array = max(max_array, u)
print((max_array+k) / 2)
print("test")


Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
max_array = sum(p[0:k])
u = max_array
for i in range(k, n):
    u = u + p[i]-p[i-k]
    max_array = max(max_array, u)
print((max_array+k) / 2)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
p = list(map(int,input().split()))
max_array = sum(p[0:k])
a = np.ceil(k)
u = max_array
for i in range(k, n):
    u = u + p[i]-p[i-k]
    max_array = max(max_array, u)
print((max_array+k) / 2)
print("test")


Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
max_array = sum(p[0:k])
u = max_array
for i in range(k, n):
    u = u + p[i]-p[i-k]
    max_array = max(max_array, u)
print((max_array+k) / 2)
Buggy python submission (verdict: Time Limit Exceeded):
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])


Fixed submission:
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])

Buggy python submission (verdict: Runtime Error):
import math
h,n = map(int,input().split())
dp = [math.inf] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])


Fixed submission:
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])

Buggy python submission (verdict: Runtime Error):
import numpy as np
h,n = map(int,input().split())
dp = [np.inf] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])


Fixed submission:
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
h,n = map(int,input().split())
dp = [np.inf] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])


Fixed submission:
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
h,n = map(int,input().split())
magic = np.zeros([n+1,2],int)
for i in range(n):
    a,b = map(int,input().split())
    magic[i][0] = a
    magic[i][1] = b
magic[n] = [0,0]
max_hit = max(magic[:,0])
dp = [[1e18,1e18]] * (h+max_hit)
dp[0] = [0,0]
for i in range(1,len(dp)):
    if dp[i - 1][0] >= i:
        dp[i] = dp[i - 1]
    else:
        for j in range(i):
            for k in range(n+1):
                if dp[i-j-1][1] + magic[k][1] < dp[i][1] and i <= dp[i-j-1][0] + magic[k][0]:
                    dp[i] = [dp[i-j-1][0] + magic[k][0], dp[i-j-1][1] + magic[k][1]]
dp_ans = dp[h::]
ans = 1e18
for i in range(len(dp_ans)):
    ans = min(ans,dp_ans[i][1])
print(ans)


Fixed submission:
h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
ans = 0
mod = int(1e9+7)
import fractions
# def gcd(a,b):
#   while b != 0:
#     a, b = b, a % b
#   return a
# 最小公倍数
def lcm(a,b):
    return (a*b) // fractions.gcd(a,b)

g = 1
for i in range(n):
    g = lcm(g, s[i])
for i in range(n):
    ans += g // s[i] % mod
print(ans%mod)



Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 0
mod = int(1e9+7)
def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a
def lcm(a,b):
    return a // gcd(a,b) * b

g = 1
for i in range(n):
    g = lcm(g, s[i])
for i in range(n):
    ans += g // s[i]
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
ans = 0
mod = int(1e9+7)
def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a
# 最小公倍数
def lcm(a,b):
    return (a*b) // gcd(a,b)

g = 1
for i in range(n):
    g = lcm(g, s[i])
for i in range(n):
    ans += g // s[i] % mod
print(ans%mod)


Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 0
mod = int(1e9+7)
def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a
def lcm(a,b):
    return a // gcd(a,b) * b

g = 1
for i in range(n):
    g = lcm(g, s[i])
for i in range(n):
    ans += g // s[i]
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())


def lcm(x,y):
    return (x*y) // math.gcd(x,y)


print(lcm(a,b))


Fixed submission:
def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a


def lcm(a,b):
    return (a*b) // gcd(a,b)


a,b = map(int,input().split())
print(lcm(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [(bin(i)[2:]).zfill(n) for i in range(2**n)]
num_list = []
A_list = []
xy_list = []
for i in range(n):
    a = int(input())
    A_list.append(a)
    for j in range(a):
        x,y = map(int,input().split())
        xy_list.append([x,y])
for i in range(len(lst)):
    choose = lst[i]
    one_count = choose.count("1")
    a_count = 0
    flag = True
    for num, j in enumerate(A_list):
        a_count += j
        for k in range(a_count-j, a_count):
            x,y = xy_list[k][0],xy_list[k][1]
            if choose[num] == "1" and choose[x-1] != str(y):
                flag = False
    if flag:
        num_list.append(one_count)
    else:
        num_list.append(0)
print(max(num_list))


Fixed submission:
n = int(input())
lst = [(bin(i)[2:]).zfill(n) for i in range(2**n)]
num_list = []
A_list = []
xy_list = []
for i in range(n):
    a = int(input())
    A_list.append(a)
    for j in range(a):
        x,y = map(int,input().split())
        xy_list.append([x,y])
for i in range(len(lst)):
    choose = lst[i]
    one_count = choose.count("1")
    a_count = 0
    flag = True
    for num, j in enumerate(A_list):
        a_count += j
        for k in range(a_count-j, a_count):
            x,y = xy_list[k][0],xy_list[k][1]
            if choose[num] == "1" and choose[x-1] != str(y):
                flag = False
                break
    if flag:
        num_list.append(one_count)
    else:
        num_list.append(0)
print(max(num_list))
Buggy python submission (verdict: Runtime Error):
n = input()
num = int(n[0:-2])
yen = int(n[-2::])
if num * 5 >= yen:
    print(1)
else:
    print(0)


Fixed submission:
n = input()
if len(n) >= 3:
    num = int(n[0:-2])
    yen = int(n[-2::])
    if num * 5 >= yen:
        print(1)
    else:
        print(0)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
count = 0
num_list = [str(i).zfill(3) for i in range(1000)]
for i in range(len(num_list)):
    a = b = -1
    i100 = num_list[i][0]
    i10 = num_list[i][1]
    i1 = num_list[i][2]
    for j in range(len(s)-2):
        if s[j] == i100:
            a = j
            break
    if a != -1:
        for j in range(a+1,len(s)-1):
            if s[j] == i10:
                b = j
                break
    if b != -1:
        for j in range(b+1,len(s)):
            if s[j] == i1:
                count += 1
                break
print(count)


Fixed submission:
import bisect
n = int(input())
s = input()
count = 0
num_ind_list = []
for i in range(10):
    num_ind_list.append([0])
for i in range(n):
    num_ind_list[int(s[i])].append(i)
for i in range(10):
    num_ind_list[i].append(30000)
for i in range(10):
    if len(num_ind_list[i]) != 2:
        for j in range(10):
            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1])
            if num_ind_list[j][b] != 30000:
                for k in range(10):
                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b])
                    if num_ind_list[k][c] != 30000: count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
count = 0
num_list = [str(i).zfill(3) for i in range(1000)]
for i in range(len(num_list)):
    a = b = -1
    for j in range(len(s)):
        if s[j] == num_list[i][0]:
            a = j
            break
    if a != -1:
        for j in range(a+1,len(s)):
            if s[j] == num_list[i][1]:
                b = j
                break
    if b != -1:
        for j in range(b+1,len(s)):
            if s[j] == num_list[i][2]:
                count += 1
                break
print(count)


Fixed submission:
import bisect
n = int(input())
s = input()
count = 0
num_ind_list = []
for i in range(10):
    num_ind_list.append([0])
for i in range(n):
    num_ind_list[int(s[i])].append(i)
for i in range(10):
    num_ind_list[i].append(30000)
for i in range(10):
    if len(num_ind_list[i]) != 2:
        for j in range(10):
            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1])
            if num_ind_list[j][b] != 30000:
                for k in range(10):
                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b])
                    if num_ind_list[k][c] != 30000: count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
diff = abs(x-y)
mod = 10**9 + 7
if (x+y) % 3 != 0:
    print("0")
    exit()
else:
    cir = (min(x,y) - diff) // 3
    if cir < 0:
        print("0")
        exit()
    all_step = (x+y) // 3
    print(combination(all_step, cir, mod))


Fixed submission:
def combination(n, r, mod):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod


x,y = map(int,input().split())
diff = abs(x-y)
mod = 10**9 + 7
if (x+y) % 3 != 0:
    print("0")
    exit()
else:
    cir = (min(x,y) - diff) // 3
    if cir < 0:
        print("0")
        exit()
    all_step = (x+y) // 3
    print(combination(all_step, cir, mod))

Buggy python submission (verdict: Runtime Error):
import math

x,y = map(int,input().split())
diff = abs(x-y)
mod = 10**9 + 7
n = 1
if min(x,y) * 2 == max(x,y):
    print("1")
elif (min(x,y) - diff) % 3 != 0:
    print("0")
else:
    cir = (min(x,y) - diff) // 3
    all_step = cir * 2 + diff
    a_buf = all_step
    for i in range(min(all_step-cir, cir)):
        n *= a_buf
        a_buf -= 1
    k = math.factorial(min(all_step-cir, cir))
    print((n // k) % mod)


Fixed submission:
def combination(n, r, mod):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod


x,y = map(int,input().split())
diff = abs(x-y)
mod = 10**9 + 7
if (x+y) % 3 != 0:
    print("0")
    exit()
else:
    cir = (min(x,y) - diff) // 3
    if cir < 0:
        print("0")
        exit()
    all_step = (x+y) // 3
    print(combination(all_step, cir, mod))

Buggy python submission (verdict: Runtime Error):
import math

x,y = map(int,input().split())
diff = abs(x-y)
mod = 10**9 + 7
n = 1
if min(x,y) * 2 == max(x,y):
    print("1")
elif (min(x,y) - diff) % 3 != 0:
    print("0")
else:
    cir = (min(x,y) - diff) // 3
    all_step = cir * 2 + diff
    a_buf = all_step
    for i in range(min(all_step-cir, cir)):
        n *= a_buf
        a_buf -= 1
    k = math.factorial(min(all_step-cir, cir))
    print((n // k) % mod)


Fixed submission:
def combination(n, r, mod):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod


x,y = map(int,input().split())
diff = abs(x-y)
mod = 10**9 + 7
if (x+y) % 3 != 0:
    print("0")
    exit()
else:
    cir = (min(x,y) - diff) // 3
    if cir < 0:
        print("0")
        exit()
    all_step = (x+y) // 3
    print(combination(all_step, cir, mod))
Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().split())
if a < b:
    buf = a
    a = b
    b = buf
while b != 0:
    a, b = b, a % b
gcd = a
count = 1
if gcd % 2 == 0:
    count += 1
if gcd % 3 == 0:
    count += 1


def hantei(num):
    flag = True
    for i in range(2, int(num**0.5+1)):
        if num % i == 0:
            flag = False
    return flag


for i in range(5, gcd + 1):
    if gcd % i == 0 and hantei(i) == True:
        count += 1
print(count)



Fixed submission:
n = int(input())
if n % 2 == 0:
    print(n//2 / n)
else:
    print((n // 2 + 1) / n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = list(map(int,input().split()))
for i in range(1,n+1):
    print(num.index(i) + 1, end=" ")


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = list(map(int,input().split()))
for i in range(n):
    for j in range(n):
        if (i+1) == num[j]:
            print(j+1, end=" ")
            break



Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = list(map(int,input().split()))
for i in range(n):
    for j in range(n):
        if (i+1) == num[j]:
            print(j+1, end=" ")


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = list(map(int,input().split()))
jyun = []
for i in range(n):
    for j in range(n):
        if (i+1) == num[j]:
            jyun.append(j+1)
for i in range(n):
    print(jyun[i], end=" ")


Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
num_array = [0]*n
for i in range(n):
    num_array[num_list[i]-1] = i+1
for i in range(n):
    print(num_array[i])