Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
A = list(map(int,input().split()))
q = int(input())

from collections import Counter
co = list(Counter(A).items())
co = [list(_) for _ in co]
#print(co)
num = len(co)

total = sum(A)
for i in range(q):
    b, c = map(int,input().split())
    for j in range(num):
        if co[j][0] == b:
            total -= (co[j][0] * co[j][1])
            co[j][0] = c
            total += (co[j][0] * co[j][1])
    print(total)


Fixed submission:

n = int(input())
A = list(map(int,input().split()))
q = int(input())
total = sum(A)

l = [[i, 0] for i in range(10**5+1)]
for _ in range(n):
    l[A[_]][1] += 1
#print(l)

for i in range(q):
    b, c = map(int,input().split())
    total -= (l[b][0] * l[b][1])
    tmp = (l[c][0] * (l[c][1] + l[b][1]))
    total -= (l[c][0] * l[c][1])
    total += tmp
    print(total)
    l[c][1] += l[b][1]
    l[b][1] = 0
#    print(l)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
A = list(map(int,input().split()))
q = int(input())

from collections import Counter
co = list(Counter(A).items())
co = [list(_) for _ in co]
#print(co)
num = len(co)

total = sum(A)
for i in range(q):
    b, c = map(int,input().split())
    for j in range(num):
        if co[j][0] == b:
            total -= (co[j][0] * co[j][1])
            co[j][0] = c
            total += (co[j][0] * co[j][1])
    print(total)


Fixed submission:

n = int(input())
A = list(map(int,input().split()))
q = int(input())
total = sum(A)

l = [[i, 0] for i in range(10**5+1)]
for _ in range(n):
    l[A[_]][1] += 1
#print(l)

for i in range(q):
    b, c = map(int,input().split())
    total -= (l[b][0] * l[b][1])
    tmp = (l[c][0] * (l[c][1] + l[b][1]))
    total -= (l[c][0] * l[c][1])
    total += tmp
    print(total)
    l[c][1] += l[b][1]
    l[b][1] = 0
#    print(l)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = sorted(list(map(int,input().split())))

num = max(l)+1
rcd = [0 for _ in range(num)]

for i in range(1, num):
    for j in l:
        if i % j == 0:
            rcd[i] += 1
            if rcd[i] >= 2:
                break
        else:
            continue

ans = 0
for k in l:
    if rcd[k] == 1:
        ans += 1

print(ans)

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

num = max(l)+1
rcd = [0 for _ in range(num)]

for v in l:
    rcd[v] += 1

unq = []
for w in range(num):
    if rcd[w] == 1:
        unq.append(w)
#print(unq)

rcd = [0 for _ in range(num)]
l = set(l)
for x in l:
    for y in range(2*x, num, x):
        rcd[y] = 1
#print(rcd)

ans = 0
for z in unq:
    if rcd[z] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
l = list(map(int,input().split()))
#print(n)
#print(l)

ans = 0
for i in range(n):
    for j in range(n):
        if i != j:
            if l[i] % l[j] == 0:
                break
    else:
        ans += 1

print(ans)


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

num = max(l)+1
rcd = [0 for _ in range(num)]

for v in l:
    rcd[v] += 1

unq = []
for w in range(num):
    if rcd[w] == 1:
        unq.append(w)
#print(unq)

rcd = [0 for _ in range(num)]
l = set(l)
for x in l:
    for y in range(2*x, num, x):
        rcd[y] = 1
#print(rcd)

ans = 0
for z in unq:
    if rcd[z] == 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
l = list(map(int,input().split()))

ans = 1
for i in l:
    ans *= i

if ans > 10**18:
    print(-1)
else:
    print(ans)


Fixed submission:

n = int(input())
l = list(map(int,input().split()))
l = sorted(l)

ans = 1
for i in l:
    ans *= i
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
#print(n)

import math

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

import collections
from collections import defaultdict

def prime_factorization_1(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = defaultdict(int)
        for prime in prime_list:
            while num % prime == 0:
                dict_counter[prime] += 1
                num //= prime
        if num != 1:
            dict_counter[num] += 1

        dict_counter = dict(dict_counter)

        return dict_counter

x = prime_factorization_1(n)
#print(x)
y = list(x.keys())
z = list(x.values())
#print(y)
#print(z)

l = []
for i in range(len(y)):
    l += [y[i]]*z[i]
#print(l)

ans = []
tmp = 1
for j in l:
    if j not in ans:
        ans.append(j)
    else:
        r = tmp * j
        if r != tmp:
            if r not in ans:
                ans.append(r)
                tmp = 1
            else:
                tmp = r
#print(ans)
print(len(ans))
            






Fixed submission:
n = int(input())

if n == 1:
    print(0)
    exit()

def factorization(n):
    seq = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            seq.append([i, cnt])

    if temp!=1:
        seq.append([temp, 1])

    if seq==[]:
        seq.append([n, 1])

    return seq

so = factorization(n)

ans = 0
for i in range(len(so)):
    j = 1
    mun = so[i][1]
    while mun >= j:
        if mun - j >= 0:
            ans += 1
            mun -= j
            j += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np 
from itertools import combinations

n,m,x = map(int, input().split())
n_num = [_ for _ in range(n)]

l = np.array([list(map(int, input().split())) for _ in range(n)])

ptns = []
for i in range(n):
    ptns += list(combinations(n_num, i+1))

ans = float('inf')
for j in range(len(ptns)):
    tmp = np.array([0]*(m+1))
    for k in range(len(ptns[j])):
        tmp += l[ptns[j][k]]
    if min(tmp[1:-1]) >= x:
        ans = min(ans, tmp[0])
    
print(-1 if ans == float('inf') else ans)

Fixed submission:
import numpy as np 
from itertools import combinations

n,m,x = map(int, input().split())
n_num = [_ for _ in range(n)]

l = np.array([list(map(int, input().split())) for _ in range(n)])

ptns = []
for i in range(n):
    ptns += list(combinations(n_num, i+1))

ans = float('inf')
for j in range(len(ptns)):
    tmp = np.array([0]*(m+1))
    for k in range(len(ptns[j])):
        tmp += l[ptns[j][k]]
    if min(tmp[1:]) >= x:
        ans = min(ans, tmp[0])
    
print(-1 if ans == float('inf') else ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
l = [0] + list(map(int,input().split()))
places = [0 for _ in range(n+1)]
to = 1
time_2 = 0

for i in range(10**5+1):
    if places[to] == 1:
        x = to
        y = time_2
        break
    else:
        places[to] = 1
        to = l[to]
        time_2 += 1

to = 1
time_1 = 0
for j in range(y):
    if to == x:
        z = time_1
        break
    else:
        to = l[to]
        time_1 += 1

to = l[1]
if k >= z:
    for p in range(z):
        to = l[p]
    else:
        print(l[to])
else:
    for q in range((k-z)%(y-z)):
        to = l[q]
    else:
        print(l[to])

Fixed submission:
n, k = map(int, input().split())
#print(n,k)
goto = [-1] + list(map(int, input().split()))
#print(goto)

l = [[_, 0] for _ in range(2*n)] # [順番, 町番号]
#print(l)
cnt = [0 for _ in range(n+1)] # カウンター

tmp = 1
for i in range(1, 2*n):
    l[i][1] = tmp
    cnt[l[i][1]] += 1
    tmp = goto[tmp]
    if cnt[l[i][1]] == 2:
        x = l[i]
        break
#print(l)
#print(x)

for j in range(n):
    if l[j][1] == x[1]:
        y = l[j]
        break
#print(y)

if y[0] > k:
    print(l[k+1][1])
else:
    z = (k-y[0]+1) % (x[0]-y[0]) + y[0]
    print(l[z][1])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
peaks = [0] + list(map(int, input().split())) # '0'が余計

ans =[_ for _ in range(n+1)] # '0'が余計

for i in range(m):
    x,y = map(int, input().split())
    if peaks[x] > peaks[y]:
        if y in ans:
            ans.remove(y)
    elif peaks[x] < peaks[y]:
        if x in ans:
            ans.remove(x)
    else:
        if x in ans:
            ans.remove(x)
        if y in ans:
            ans.remove(y)

print(len(ans) -1)


Fixed submission:
n, m = map(int,input().split())
h = list(map(int,input().split()))
l = [list(map(int, input().split())) for _ in range(m)]

x = [[] for _ in range(n)]

for i in range(m):
    if l[i][1] not in x[l[i][0]-1]:
        x[l[i][0]-1].append(l[i][1])

for j in range(m):
    if l[j][0] not in x[l[j][1]-1]:
        x[l[j][1]-1].append(l[j][0])

y = 0
for a in range(n):
    for c in range(len(x[a])):
        if h[a] <= h[x[a][c]-1]:
            break
    else:
        y += 1

print(y)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
peaks = [0] + list(map(int, input().split())) # '0'が余計

ans =[_ for _ in range(n+1)] # '0'が余計

for i in range(m):
    x,y = map(int, input().split())
    if peaks[x] > peaks[y]:
        if y in ans:
            ans.remove(y)
    elif peaks[x] < peaks[y]:
        if x in ans:
            ans.remove(x)
    else:
        if x in ans:
            ans.remove(x)
        if y in ans:
            ans.remove(y)

print(len(ans) -1)


Fixed submission:
n, m = map(int,input().split())
h = list(map(int,input().split()))
l = [list(map(int, input().split())) for _ in range(m)]

x = [[] for _ in range(n)]

for i in range(m):
    if l[i][1] not in x[l[i][0]-1]:
        x[l[i][0]-1].append(l[i][1])

for j in range(m):
    if l[j][0] not in x[l[j][1]-1]:
        x[l[j][1]-1].append(l[j][0])

y = 0
for a in range(n):
    for c in range(len(x[a])):
        if h[a] <= h[x[a][c]-1]:
            break
    else:
        y += 1

print(y)

Buggy python submission (verdict: Time Limit Exceeded):

n, m = map(int,input().split())
h = list(map(int,input().split()))
l = [list(map(int, input().split())) for _ in range(m)]

x = [[] for _ in range(n)]

for i in range(m):
    if l[i][1] not in x[l[i][0]-1]:
        x[l[i][0]-1].append(l[i][1])

for j in range(m):
    if l[j][0] not in x[l[j][1]-1]:
        x[l[j][1]-1].append(l[j][0])

y = 0
for a in range(n):
    for c in range(len(x[a])):
        if h[a] <= h[x[a][c]-1]:
            break
    else:
        y += 1

print(y)

Fixed submission:
n, m = map(int,input().split())
h = list(map(int,input().split()))
l = [list(map(int, input().split())) for _ in range(m)]

x = [[] for _ in range(n)]

for i in range(m):
    if l[i][1] not in x[l[i][0]-1]:
        x[l[i][0]-1].append(l[i][1])

for j in range(m):
    if l[j][0] not in x[l[j][1]-1]:
        x[l[j][1]-1].append(l[j][0])

y = 0
for a in range(n):
    for c in range(len(x[a])):
        if h[a] <= h[x[a][c]-1]:
            break
    else:
        y += 1

print(y)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())
x = [_ for _ in range(1, M+1)]
y = list(combinations_with_replacement(x, N))
l = [tuple(map(int, input().split())) for _ in range(Q)]

ans = 0
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans = max(ans, z)
    z = 0
print(ans)

Fixed submission:
from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())
x = [_ for _ in range(1, M+1)]
y = list(combinations_with_replacement(x, N))
l = [list(map(int, input().split())) for _ in range(Q)]

ans = []
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans.append(z)
    z = 0
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())
x = [_ for _ in range(1, M+1)]
y = list(combinations_with_replacement(x, N))
l = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans = max(ans, z)
    z = 0
print(ans)

Fixed submission:
from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())
x = [_ for _ in range(1, M+1)]
y = list(combinations_with_replacement(x, N))
l = [list(map(int, input().split())) for _ in range(Q)]

ans = []
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans.append(z)
    z = 0
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):

from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())

x = [_ for _ in range(1, M+1)]
#y = list(combinations(x, N))
y = list(combinations_with_replacement(x, N))

l = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans = max(ans, z)
    z = 0
print(ans)
    
            
    
    

Fixed submission:
from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())
x = [_ for _ in range(1, M+1)]
y = list(combinations_with_replacement(x, N))
l = [list(map(int, input().split())) for _ in range(Q)]

ans = []
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans.append(z)
    z = 0
print(max(ans))
Buggy python submission (verdict: Runtime Error):
a, b, n = map(int,input().split())

ans = 0
for i in range(1, n+1):
    ans = max(ans, a*i//b - a*(i//b))

print(max(ans))

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

if n >= b-1:
    x = b-1
else:
    x = n

print(a*x//b - a*(x//b))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int,input().split())

ans = []
for i in range(1, n+1):
    ans.append(a*i//b - a*(i//b))

print(max(ans))

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

if n >= b-1:
    x = b-1
else:
    x = n

print(a*x//b - a*(x//b))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int,input().split())

ans = []
for i in range(1, n+1):
    ans.append(a*i//b - a*(i//b))

print(max(ans))

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

if n >= b-1:
    x = b-1
else:
    x = n

print(a*x//b - a*(x//b))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
l = [_ for _ in range(n + 1)]

x = 0
for i in range(k, n+2):
    x += sum(l[-1:-i-1:-1]) - sum(l[0:i]) + 1

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


Fixed submission:
n, k = map(int, input().split())
l = [_ for _ in range(n + 1)]

tmp_min = sum(l[0:k])
tmp_max = sum(l[-1:-k-1:-1])
x = tmp_max - tmp_min + 1

for i in range(n-k+1):
    tmp_min += l[k+i]
    tmp_max += l[-k-i-1]
    x += tmp_max - tmp_min + 1

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

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
l = [_ for _ in range(n + 1)]

from itertools import combinations

x = []
y = []
z = 0
for i in range(k, n+2):
    x = list(combinations(l, i))
    for j in range(len(x)):
        y.append(sum(x[j]))
    z += len(set(y)) % (10**9+7)
    x,y = [],[]

print(z)


Fixed submission:
n, k = map(int, input().split())
l = [_ for _ in range(n + 1)]

tmp_min = sum(l[0:k])
tmp_max = sum(l[-1:-k-1:-1])
x = tmp_max - tmp_min + 1

for i in range(n-k+1):
    tmp_min += l[k+i]
    tmp_max += l[-k-i-1]
    x += tmp_max - tmp_min + 1

print(x % (10**9+7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [_ for _ in range(1,10)]

cnt = 9
d = [-1, 0, 1]
for i in range(10**5):
    if cnt >= n: break
    for j in d:
        if 0 <= int(str(l[i])[-1]) + j <= 9:
            l.append(l[i]*10 + l[i][-1] + j)
            cnt += 1

print(l[n-1])


Fixed submission:
n = int(input())
l = [_ for _ in range(1,10)]

for i in range(10**5):
    if str(l[i])[-1] == '0':
        l.append(l[i]*10 + int(str(l[i])[-1]))
        l.append(l[i]*10 + int(str(l[i])[-1]) + 1)

    elif str(l[i])[-1] == '9':
        l.append(l[i]*10 + int(str(l[i])[-1]) - 1)
        l.append(l[i]*10 + int(str(l[i])[-1]))

    else:
        l.append(l[i]*10 + int(str(l[i])[-1]) - 1)
        l.append(l[i]*10 + int(str(l[i])[-1]))
        l.append(l[i]*10 + int(str(l[i])[-1]) + 1)

print(l[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

from collections import Counter
c = Counter(l)

from math import factorial
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

num = []
tot = 0
for i,j in c.items():
    if j >= 2:
        tmp1 = combinations_count(j,2)
        tot += tmp1
    else:
        tmp1 = 0
    if j >= 3:
        tmp2 = combinations_count(j-1,2)
    else:
        tmp2 = 0
    num.append([i,tmp1,tmp2])

for x in range(n):
    for y in range(len(c)):
        if num[y][0] == l[x]:
            print(tot - num[y][1] + num[y][2])


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

from collections import Counter
c = Counter(l)
x = list(c.values())

from math import factorial
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

y = 0
for i in range(len(x)):
    if x[i] != 1:
        y += combinations_count(x[i], 2)

for j in range(n):
    print(y - (c[l[j]] - 1))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(x) for x in input().split()]

from collections import Counter

for k in range(n):
    m = l[:]
    m.pop(k)
    c = Counter(m)

    x = list(c.values())

    y = []
    for i in x:
        if i != 1:
            y.append(i)

    from math import factorial
    def combinations_count(n, r):
        return factorial(n) // (factorial(n - r) * factorial(r))
    
    z = []
    for j in y:
        z.append(combinations_count(j, 2))
    print(sum(z))

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

from collections import Counter
c = Counter(l)
x = list(c.values())

from math import factorial
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

y = 0
for i in range(len(x)):
    if x[i] != 1:
        y += combinations_count(x[i], 2)

for j in range(n):
    print(y - (c[l[j]] - 1))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(m)]

p = [[],[],[]]
for i in range(m):
    if l[i][0]== 1:
        p[0].append(l[i][1])
    elif l[i][0]== 2:
        p[1].append(l[i][1])
    else:
        p[2].append(l[i][1])

#print(p)

if len(p[0]) == 0:
        p[0].insert(0,1)
#print(p)

for j in range(len(p)):
    if len(p[j]) == 0:
        p[j].append(0)

#print(p)

if len(set(p[0])) > 1 or len(set(p[1])) > 1 or len(set(p[2])) > 1:
    print('-1')
    exit()

q = []
for k in range(len(p)):
    q.append(str(p[k][0]))
#print(q)
if n = 1 and q[0] == '0':
    print(0)
    exit()
    

if q[0] == '0':
    print('-1')
    exit()

if q[0] == '0' and q[1] == '0':
    print('-1')
    exit()

if q[0] == '0' and q[1] == '0' and q[2] == '0':
    print(0)
    exit()

print(''.join(q))



Fixed submission:
n, m = map(int, input().split())
ans = [-1 for _ in range(n)]
l = [list(map(int, input().split())) for _ in range(m)]

if m == 0:
    if n == 1:
        print(0)
        exit()
    elif n == 2:
        print(10)
        exit()
    elif n == 3:
        print(100)
        exit()

for q in range(m):
    if l[q][0] == 1:
        break
else:
     ans[0] = 1

for k in range(m):
    if l[k][1] != 0:
        break
    for p in range(m):
        if l[p][0] == 1:
            break
        else:
            if n ==2:
                print(10)
                exit()
            elif n == 3:
                print(100)
                exit()

else:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

for i in range(m):
    if l[i][0] == 1 and l[i][1] == 0:
        print(-1)
        break
    if ans[l[i][0]-1] != -1 and ans[l[i][0]-1] != l[i][1]:
        print(-1)
        break
    else:
        ans[l[i][0]-1] = l[i][1]

else:
    for j in range(n):
        if ans[j] == -1:
            ans[j] = 0

    print(''.join(list(map(str,ans))))
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int,input().split())
#print(n,a,b)

import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

l = [int(i) for i in range(1,n+1)]
#print(l)

x = 0
for j in range(n):
    x += combinations_count(n, l[j])

y = combinations_count(n, a) + combinations_count(n, b)

print((x-y)%(10**9+7))




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

mod = 10**9+7
total = pow(2,n,mod) - 1 # 制約なしの全パターン_n**2-1※'-1'は0本の花束

# n個からr個を選択した時のパターン総数
# n! / (r! * (n-r)!) → nが大き過ぎて出来ない →変形→ n*(n-1)*･･･(n-r+1) ↓関数化
def nCr(n, r, mod):
    numerator=1 #分子
    for i in range(n-r+1, n+1):
        numerator = (numerator*i) % mod

    denominator=1 #分母
    for j in range(1,r+1):
        denominator = (denominator*j) % mod
    # 割るとよくない → 逆元を掛ける
    # フェルマーの小定理_modが素数なら1/aの逆元は a**(mod-2)
    return (numerator * pow(denominator,mod-2,mod)) % mod
    
ans = (total - nCr(n,a,mod) - nCr(n,b,mod)) % mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
enemies = [int(input())]

def attack(N):
    return [N // 2] * 2

times = 0
while len(enemies) > 0:
    tmp = enemies.pop(-1)
    times += 1
    if tmp >= 2:
        enemies += attack(tmp)

print(times)

Fixed submission:
enemie = int(input())

times = 0
for i in range(enemie):
    times += 1
    if enemie >= 2:
        enemie //= 2
    else:
        break

ans = 0
for j in range(times):
    ans += 2**j
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))

x=0
y=[]
z=l[0]
for i in range(n):
    y=y+[l[i]]
    z=min(z,l[i])
    if l[i]<=z:
        x+=1
print(x)

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

x=0
y=[]
z=l[0]
for i in range(n):
    #y=y+[l[i]]
    z=min(z,l[i])
    if l[i]<=z:
        x+=1
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))

x=0
y=[]
for i in range(n):
    y=y+[l[i]]
    if l[i]<=min(y):
        x+=1
print(x)
    






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

x=0
y=[]
z=l[0]
for i in range(n):
    #y=y+[l[i]]
    z=min(z,l[i])
    if l[i]<=z:
        x+=1
print(x)
Buggy python submission (verdict: Runtime Error):
print(y+x)

Fixed submission:
x, y = input().split()
print(y+x)

Buggy python submission (verdict: Runtime Error):
x, y = map(int,input().split())
print(y+x)

Fixed submission:
x, y = input().split()
print(y+x)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

h = x//100

for a in range(0,h+1):
    for b in range(0,h+1):
        for c in range(0,h+1):
            for d in range(0,h+1):
                for e in range(0,h+1):
                    for f in range(0,h+1):
                        if 100*a+101*b+102*c+103*d+104*e+105*f==x:
                            print('1')
                            exit()
else:
    print('0')

Fixed submission:
x = int(input())

l = -(-x//105)
h = x//100
fix = l*100

for b in range(0,h+1):
    for c in range(0,h+1):
        for d in range(0,h+1):
            for e in range(0,h+1):
                for f in range(0,h+1):
                    if fix + 1*b+2*c+3*d+4*e+5*f==x:
                        print('1')
                        exit()
else:
    print('0')