Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(sys.stdin.readline())
values = []
res = 1
values=(sys.stdin.readline().split())
for v in values:
    res *= int(v)
if res > 1000000000000000000:
  print(-1)
else:
  print(res)


Fixed submission:
import sys
N=int(sys.stdin.readline())
values = []
res = 1
values=sys.stdin.readline().split()
for v in values:
    if int(v) == 0:
        print(0)
        exit(0)

for v in values:
    res *= int(v)
    if res > 1000000000000000000:
        print(-1)
        exit(0)
print(res)

Buggy python submission (verdict: Runtime Error):
import sys
N=int(sys.stdin.readline()) 
values = []
res = 1
while N :
	values=(sys.stdin.readline().split())
	for v in values:
      res *= v
    if res > 10e18:
      print(-1)
    else
      print(res)
    
      

Fixed submission:
import sys
N=int(sys.stdin.readline())
values = []
res = 1
values=sys.stdin.readline().split()
for v in values:
    if int(v) == 0:
        print(0)
        exit(0)

for v in values:
    res *= int(v)
    if res > 1000000000000000000:
        print(-1)
        exit(0)
print(res)

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

ans = 1

if min(A) == 0:
  print(0)

else:
  for i in range(N):
    ans *= int(A[i])
  if ans > 10**18:
    print(-1)
  else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ans = 1

if min(A) == 0:
  print(0)

else:
  for i in range(N):
    ans *= int(A[i])
    if ans > 10**18:
      print(-1)
      break
    elif i == N-1:
      print(ans)
      break
Buggy python submission (verdict: Runtime Error):
A, B = map(float, input().split())

A = int(a)
B = round(100*B)

ans = int(int(A*B)//100)
print(ans)

Fixed submission:
A, B = map(float, input().split())

A = int(A)
B = round(100*B)

ans = int(int(A*B)//100)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

i = 0

while abs(X-i**5) > abs(X-(i+1)**5):
  i = i + 1
  
A = i
a = i**5
j = 0

while a - j**5 != X:
  if j == 0:
    j += 1
  elif j > 0:
    j = -j
  else:
    j = -j+1
    
print(A, j)

Fixed submission:
X = int(input())

for A in range(-200,200):
  for B in range(-200,200):
    if A**5-B**5 == X:
      print(A,B)
      exit()
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = list(map(int, input().split()))

c = 0
ans = 0

if N < 1000001:
  for i in range(1,N+1):
    c = int(A*i/B) - A*int(i/B)
    if ans < c:
      ans = c

elif N < B:
  ans = int(A*N/B) - A*int(N/B)
      
else:
  count = B-1
  while N > count:
    c = int(A*count/B) - A*int(count/B)
    if ans < c:
      ans = c
    count += B
    
print(int(ans))

Fixed submission:
A, B, N = list(map(int, input().split()))

c = 0
ans = 0

if N < 1000001:
  for i in range(1,N+1):
    c = int(A*i/B) - A*int(i/B)
    if ans < c:
      ans = c

elif N < B:
  ans = int(A*N/B) - A*int(N/B)
      
else:
  count = B-1
  for i in range(10000):
    c = int(A*count/B) - A*int(count/B)
    if ans < c:
      ans = c
    count += B
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = list(map(int, input().split()))

a = 0
ans = 0

for i in range(N//2,N+1):
  a = int(A*i/B) - A*int(i/B)
  if ans < a:
    ans = a
  
print(int(ans))

Fixed submission:
A, B, N = list(map(int, input().split()))

c = 0
ans = 0

if N < 1000001:
  for i in range(1,N+1):
    c = int(A*i/B) - A*int(i/B)
    if ans < c:
      ans = c

elif N < B:
  ans = int(A*N/B) - A*int(N/B)
      
else:
  count = B-1
  for i in range(10000):
    c = int(A*count/B) - A*int(count/B)
    if ans < c:
      ans = c
    count += B
    
print(int(ans))
Buggy python submission (verdict: Runtime Error):
R = int(input())

import math

print(2*R*math.py)

Fixed submission:
R = int(input())

import math

print(2*R*math.pi)
Buggy python submission (verdict: Runtime Error):
S = input()
l = len(S)

a = 0
count = 0

for i in range(l):
    a = int(S[l-i-1])
    for j in range(i+1,l):
        if int(S[l-j-1]) != 0:
            a += int(S[l-j-1])*10**(j-i)
            if j-i > 2:
                if a % 2019 == 0:
                    count += 1
            
print(count)

Fixed submission:
N, K = map(int, input().split())

a = 0

for i in range(K,N+2):
  a += i*(2*N-i+1)//2 - i*(i-1)//2 + 1
  
a = a % (10**9+7)
print(int(a))
Buggy python submission (verdict: Runtime Error):
N = input()
 
a = 0
for i in range(3):
  if N[i] == '7':
    a = 1
    
if a = 1:
  print('Yes')
else:
  print('No')

Fixed submission:
N = input()

a = 0
for i in range(3):
  if N[i] == '7':
    a = 1
    
if a == 1:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())

a = 0
for i in range(3):
  if N[i] == 7:
    a = 1
    
if a = 1:
  print('Yes')
else:
  print('No')

Fixed submission:
N = input()

a = 0
for i in range(3):
  if N[i] == '7':
    a = 1
    
if a == 1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
K = int(input())

if K == 1:
  print(1)
  
def f(K):
  s =  0
  count = 0
  for i in range(2,K+1):
    if K % i != 1:
      s += i
      count += 1
  return 3*K + s - count  
  
else:
  ans = 0
  for i in range(2,K+1):
    ans += f(K)
  print(ans)

Fixed submission:
K = int(input())
 
import math

ans = 0
a = 0

for i in range(1,K+1):
  for j in range(1,K+1):
    a = math.gcd(i,j)
    for k in range(1,K+1):
      ans += math.gcd(a,k)
      
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()

if N % 2 == 0:
  print(int(N//2))
  
else:
  print(int(N//2+1))

Fixed submission:
N = int(input())
if N % 2 == 0:
  print(N//2)
  
else:
  print(N//2+1)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = [0] * M
c = [0] * M
for i in range(M):
    s[i], c[i] = map(int, input().split())
    
A = []
x = 0

for i in range(M):
  if s[i] == 1 and c[i] == 0:
    x = 1
  for j in range(i+1,M):
    if s[i] == s[j] and c[i] != c[j]:
      x = 2
      
import numpy as np
import math
from functools import reduce
B = np.zeros(N)
B[0] = 1

if max(s) == 1 and max(c) == 0:
  print(0)

elif x == 1 or x == 2:
  print("-1")
  
else:
  for i in range(M):
    B[s[i]-1] = c[i]
  ans = reduce( lambda a,b:10*a+b, B)
  print(math.floor(ans))

Fixed submission:
N, M = map(int, input().split())
s = [0] * M
c = [0] * M
for i in range(M):
    s[i], c[i] = map(int, input().split())
    
A = []
x = 0

for i in range(M):
  if s[i] == 1 and c[i] == 0:
    x = 1
  for j in range(i+1,M):
    if s[i] == s[j] and c[i] != c[j]:
      x = 2
      
import numpy as np
import math
from functools import reduce
B = np.zeros(N)
B[0] = 1

if M == 0:
  if N == 1:
    print(0)
  else:
    ans = reduce( lambda a,b:10*a+b, B)
    print(math.floor(ans))

elif N == 1 and max(s) == 1 and max(c) == 0:
  print(0)

elif x == 1 or x == 2:
  print("-1")
  
else:
  for i in range(M):
    B[s[i]-1] = c[i]
  ans = reduce( lambda a,b:10*a+b, B)
  print(math.floor(ans))
Buggy python submission (verdict: Runtime Error):
N, K, Q = (int(i) for i in input().split())
A = [int(input()) for i in range(Q)]

import numpy as np
T = K - Q
S = np.ones(N)*T

for i in range(Q):
  S[A[i]] += 1

for i in range(N):
  if S[i] <= 0:
    print('No')
  else:
    print('Yes')

Fixed submission:
N, K, Q = (int(i) for i in input().split())
A = [int(input()) for i in range(Q)]

import numpy as np
S = np.ones(N)*(K - Q)

for i in range(Q):
  x = A[i]
  S[x-1] += 1

for i in range(N):
  if S[i] <= 0:
    print('No')
  else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
count = 0
for _ in range(N):
  s.append(sorted(input()))
for i in range(N):
  for j in range(i+1,N):
    if s[i] == s[j]:
      count += 1
print(count)

Fixed submission:
N = int(input())
s = list(list(input()) for i in range(N))
for i in range(N):
    s[i].sort()
s.sort()
ans = 0
same = 1
for i in range(1,N):
    if s[i] == s[i-1]:
        ans += same
        same += 1
    else:
        same = 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input()) 
A = [int(input()) for i in range(N)] 
for i in range(N):
  A[i] = A[i] - 200000
  print(max(A))
  A[i] = A[i] + 200000

Fixed submission:
import numpy as np
N = int(input()) 
A = [int(input()) for i in range(N)]
a = max(A)
b = np.argmax(A)
A[b] = 0
c = max(A)
for i in range(N):
  if i != b:
    print(a)
  else:
    print(c)
Buggy python submission (verdict: Runtime Error):
N,D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

count = 0
for a in A:
  print(a[0]**2 + a[1]**2)
  if a[0]**2 + a[1]**2 <= D**2
     count += 1

print(count)

Fixed submission:
N,D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

count = 0
for a in A:
  if a[0]**2 + a[1]**2 <= D**2:
     count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a = int(input())
ans = a + a**2 + a***3
print(ans)

Fixed submission:
a = int(input())
ans = a + a**2 + a**3
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def factorization(n):
    arr = []
    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
            arr.append([i, cnt])

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

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

    return arr

N = int(input())
g = 0
for n in range(N):
    A = factorization(n+1)
    f = 1
    for row in A:
        f *= row[1]+1
    g += (n+1) * f

print(g-1)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
  k = n//i
  ans += i*(k*(k+1))//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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]

def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

N = int(input())

g = 0
for i in range(N):
    g += (i+1) * search_divisor_num_1(i+1)
print(g)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
  k = n//i
  ans += i*(k*(k+1))//2
print(ans)

Buggy python submission (verdict: Runtime Error):
import sympy
N = int(input())

g = 0
for i in range(N):
    g += (i+1) * sympy.divisor_count(i+1)
print(g)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
  k = n//i
  ans += i*(k*(k+1))//2
print(ans)
Buggy python submission (verdict: Runtime Error):
val = input()
if val in 'abcdefghijklmnopqrstuvwxyz':
  ans = a
else
  ans = A
  
print(ans)

Fixed submission:
val = input()
if val in 'abcdefghijklmnopqrstuvwxyz':
  ans = 'a'
else:
  ans = 'A'
  
print(ans)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
p = list(map(int, input().split()))

N = a[0]
K = a[1]

p.sort()

g = 0
for k in range(K)
	g = g+p[k]
print(g)

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

N = a[0]
K = a[1]

p.sort()

g = 0
for k in range(K):
	g = g + p[k]
print(g)

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

N = a[0]
K = a[1]

p = p.sort

g = sum(p[0:K-1])
print(g)

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

N = a[0]
K = a[1]

p.sort()

g = 0
for k in range(K):
	g = g + p[k]
print(g)

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

N = a[0]
K = a[1]

p = p.sort

g = 0
for i in range(K):
    g = K+p(i)

print(g)

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

N = a[0]
K = a[1]

p.sort()

g = 0
for k in range(K):
	g = g + p[k]
print(g)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
X = a[1]
Y = a[2]

if (Y-2*X) % 2 == 0 and (Y-2*X) >= 0:
	print('Yes')
else:
    print('No')

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

X = a[0]
Y = a[1]
 
if (Y-2*X) % 2 == 0 and (Y-2*X) >= 0 and (4*X-Y) % 2 == 0 and (4*X-Y) >= 0:
	print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
C = [list(map(int, input().split())) for i in range(N)]

# C = [[60, 2, 2, 4], [70, 8, 7, 9], [50, 2, 3, 9]]

P = [row[0] for row in C]
A = [row[1:M+1] for row in C]

K = [0 for i in range(2**N)]
G = [[0,0,0] for i in range(2**N)]
for i in range(2**N):
    i2 = format(i, '012b')
    s = 0
    for k in range(N):
        K[i] += int(i2[11-k])*P[k]
        for j in range(M):
            G[i][j] += int(i2[11-k])*A[k][j]

J = [[K[i],G[i]] for i in range(2**N)]

t = 0
for i in range(2**N):
    for j in range(M):
        if (J[i][1])[j] < X:
            break
        if j == M-1:
            t = 1
            print(J[i][0])
    if t== 1:
        break

if t==0:
    print(-1)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 29 06:00:56 2020

@author: Aruto Hosaka
"""


N,M,X = map(int, input().split())
C = [list(map(int, input().split())) for i in range(N)]

# C =[[100, 3, 7, 5, 3, 1], [164, 4, 5, 2, 7, 8], [334, 7, 2, 7, 2, 9], [234, 4, 7, 2, 8, 2], [541, 5, 4, 3, 3, 6], [235, 4, 8, 6, 9, 7], [394, 3, 6, 1, 6, 2], [872, 8, 4, 3, 7, 2]]
# N = 8
# M = 5
# X = 10


P = [row[0] for row in C]
A = [row[1:M+1] for row in C]

K = [0 for i in range(2**N)]
G = [[0 for k in range(M)] for i in range(2**N)]
for i in range(2**N):
    i2 = format(i, '012b')
    s = 0
    for k in range(N):
        K[i] += int(i2[11-k])*P[k]
        for j in range(M):
            G[i][j] += int(i2[11-k])*A[k][j]

J = [[K[i],G[i]] for i in range(2**N)]
J = sorted(J)

t = 0
for i in range(2**N):
    for j in range(M):
        if (J[i][1])[j] < X:
            break
        if j == M-1:
            t = 1
            print(J[i][0])
    if t== 1:
        break

if t==0:
    print(-1)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 30 09:18:42 2020

@author: Aruto Hosaka
"""
from math import factorial

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p


A = list(map(int, input().split()))
mod = 998244353
N = A[0]
M = A[1]
K = A[2]

s = (M*(M-1)**(N-1))
D = (M*(M-1)**(N-1))%mod
for k in range(1,K+1):
    s = s*(N-k)//k//(M-1)
    D += s%mod

print(D%mod)

Fixed submission:
mod=998244353
fact=[1]
for i in range(1,2*10**5+1): #mod上での階乗を求める
 fact.append((fact[-1]*i)%mod)
revfact=[1]
for i in range(1,2*10**5+1): #mod上での階乗の逆元をフェルマーの小定理を用いて求める
 revfact.append(pow(fact[i],mod-2,mod))
n,m,k=map(int,input().split())
ans=0
for i in range(k,-1,-1): #各m(N-K<=m<=N)について場合の数を求める
 group=n-i
 tmp=fact[n-1]*revfact[group-1]*revfact[n-1-(group-1)]
 tmp%=mod
 tmp*=m
 tmp%=mod
 tmp*=pow(m-1,group-1,mod)
 ans+=tmp
 ans%=mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = list(map(int, input().split()))
H = list(map(int, input().split()))
B = [list(map(int, input().split())) for i in range(N[1])]

# N = [6, 5]
# H = [8, 6, 9, 1, 2, 1]
# B = [[1, 3], [4, 2], [4, 3], [4, 6], [4, 6]]

counter = N[0]
for i in range(N[0]):
    for b in B:
        if (b[0]-1 == i and H[b[1]-1] >= H[i]) or (b[1]-1 == i and H[b[0]-1] >= H[i]):
            counter += -1
            break

print(counter)

Fixed submission:
N = list(map(int, input().split()))
H = list(map(int, input().split()))
B = [list(map(int, input().split())) for i in range(N[1])]

# N = [6, 5]
# H = [8, 6, 9, 1, 2, 1]
# B = [[1, 3], [4, 2], [4, 3], [4, 6], [4, 6]]

# N = [4, 3]
# H = [1, 2, 3, 4]
# B = [[1, 3],[2, 3],[2, 4]]

counter = [1 for i in range(N[0])]

for b in B:
    if H[b[1]-1] > H[b[0]-1]:
        counter[b[0]-1] = 0
    elif H[b[0]-1] > H[b[1]-1]:
        counter[b[1]-1] = 0
    elif H[b[0]-1] == H[b[1]-1]:
        counter[b[0]-1] = 0
        counter[b[1]-1] = 0

print(sum(counter))
Buggy python submission (verdict: Runtime Error):
X = int(input())
M = 100
y = 0
while X > M:
  M = int(M*1.01)
  y += 1X = int(input())
M = 100
y = 0
while X > M:
  M = int(M*1.01)
  y += 1
print(y)

Fixed submission:
X = int(input())
M = 100
y = 0
while X > M:
  M += M//100
  y += 1
print(y)
Buggy python submission (verdict: Time Limit Exceeded):
As,Aa,Bs,Ba = map(int,input().split())
while Aa > 0 and Ba > 0:
  Bs += -Aa
  As += -Ba

if Bs <= 0:
  print('Yes')
else:
  print('No')

Fixed submission:
import math

As,Aa,Bs,Ba = map(int,input().split())
Na = math.ceil(Bs/Aa)
Nb = math.ceil(As/Ba)
 
if Na <= Nb:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,M = map(int(input().split()))
A = list(map(int(input().split())))
sumA = sum(A)
if N-sumA < 0:
  print(-1)
else:
  print(N-sumA)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
sumA = sum(A)
if N-sumA < 0:
  print(-1)
else:
  print(N-sumA)
Buggy python submission (verdict: Runtime Error):
A = input()
for a in range(3):
  if A[a] == '7':
    print(yes)
    break
  if a == 2:
    print('No')

Fixed submission:
A = input()
for a in range(3):
  if A[a] == '7':
    print('Yes')
    break
  if a == 2:
    print('No')
Buggy python submission (verdict: Runtime Error):
letter = str(input())
N = len(letter)

l_1 = letter[:int((N-1)/2)]
l_2 = letter[int((N+3)/2-1):]

if(l == l[::-1] and l_1 == l_1[::-1] and l_2 == l_2[::-1]):
    ans = "Yes"
else:
    ans = "No"
# print(l_1)
# print(l_2)

print(ans)


Fixed submission:
letter = str(input())
N = len(letter)

l_1 = letter[:int((N-1)/2)]
l_2 = letter[int((N+3)/2-1):]

if(letter == letter[::-1] and l_1 == l_1[::-1] and l_2 == l_2[::-1]):
    ans = "Yes"
else:
    ans = "No"
# print(l_1)
# print(l_2)

print(ans)
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split()) 
if(N >= 10):
  return R
else:
  return 100*(10-N) + R

Fixed submission:
N, R = map(int, input().split()) 
ans = 0
if(N >= 10):
  ans = R
else:
  ans = 100*(10-N) + R
print(ans)
Buggy python submission (verdict: Runtime Error):
def factorial_mod(a, M):
    ans = 1
    for i in range(a,1,-1):
        ans = (ans * i) % M
    return ans
def test(n, a, M):
    ans = 1
    for i in range(a):
        ans = (ans * (n-i)) % M
    return ans
def combination_mod(n,a,M):
    tmp = factorial_mod(a,M)
    tmp = pow(tmp, M-2, M)
    ans = test(n,a,M) * tmp % M
    return ans
def output(n,a,b):
    M = 10**9+7
    ans = (pow(2,n,M) - 1 - combination_mod(n,a,M) - combination_mod(n,b,M)) % M
    return ans
n, a, b = map(int, input().split())
print(output(a,b,c))

Fixed submission:
def factorial_mod(a, M):
    # return a!(mod M)
    ans = 1
    for i in range(a,1,-1):
        ans = (ans * i) % M
    return ans
def test(n, a, M):
    # return (nCaの分子) % M
    ans = 1
    for i in range(a):
        ans = (ans * (n-i)) % M
    return ans
def combination_mod(n,a,M):
    # return nCa % M
    tmp = factorial_mod(a,M)
    tmp = pow(tmp, M-2, M)
    ans = test(n,a,M) * tmp % M
    return ans
def output(n,a,b):
    M = 10**9+7
    ans = (pow(2,n,M) - 1 - combination_mod(n,a,M) - combination_mod(n,b,M)) % M
    return ans
n, a, b = map(int, input().split())
print(output(n,a,b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
list = [int(i) for i in input().split()]

forward = 0
backward = N-1

sum = list[forward]
sum2 = list[backward]
while (True):
    if sum < sum2:
        forward += 1
        sum += list[forward]
    else:
        backward -= 1
        sum2 += list[backward]
    if backward - forward == 1:
        break
print(abs(sum - sum2))

Fixed submission:
N = int(input())
list = [int(i) for i in input().split()]

forward = 0
backward = N-1

sum = list[forward]
sum2 = list[backward]
while (True):
    if backward - forward == 1:
        break
    if sum < sum2:
        forward += 1
        sum += list[forward]
    else:
        backward -= 1
        sum2 += list[backward]
print(abs(sum - sum2))
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
X = abs(X)

if X >= D * K:
  print(X - D * K)
else:
  K -= int(X / D)
  for i in range(0, int(X/D)):
    X -= D
  if K % 2:
    print(D - X)
  else:
    print(X)

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)

if X >= D * K:
  print(X - D * K)
else:
  K -= int(X / D)
  # for i in range(0, int(X/D)):
  #   X -= D
  X %= D
  if K % 2:
    print(D - X)
  else:
    print(X)

Buggy python submission (verdict: Time Limit Exceeded):
l = input().split()
x = int(l[0])
k = int(l[1])
d = int(l[2])

for i in range(0, k):
  if abs(x + d) > abs(x - d):
    x -= d
  else:
    x += d
print(abs(x))

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)

if X >= D * K:
  print(X - D * K)
else:
  K -= int(X / D)
  # for i in range(0, int(X/D)):
  #   X -= D
  X %= D
  if K % 2:
    print(D - X)
  else:
    print(X)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
anser = 1
for a in input().split(" "):
    anser = anser * int(a)

if anser > 1000000000000000000:
    print(-1)
else:
    print(anser)


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))

    if 0 in A:
        print(0)
        return

    anser = 1
    for a in A:
        anser *= a
        if anser > 1000000000000000000:
            print(-1)
            return

    print(anser)

main()
Buggy python submission (verdict: Runtime Error):
x,k,d=map(int,input().split())
if x==0:
	if k%2==0:
		print(0)
	else:
		print(d)
    exit(0)
t=abs(x//d)
if (k<=t):
	if (x>0):
		print(x-k*d)
	else:
		print(x+k*d)
	exit(0)
else:
	if (x>0):
		x=x-t*d
		k-=t
		if k%2==0:
			print(x)
		else:
			print(abs(x-d))
	else:
		x=x+t*d
		k-=t
		if k%2==0:
			print(abs(x))
		else:
			print(abs(x+d))

Fixed submission:
from math import floor
import decimal
x,k,d=map(int,input().split())
if x==0:
	if k%2==0:
		print(0)
	else:
		print(d)
	exit(0)	
with decimal.localcontext() as ctx:
    ctx.prec = 150
    t=floor(decimal.Decimal(abs(x))/decimal.Decimal(d))
    

if (k<=t):
	if (x>0):
		print(abs(x-k*d))
	else:
		print(abs(x+k*d))
else:
	if (x>0):
		x=x-t*d
		k-=t
		if k%2==0:
			print(abs(x))
		else:
			print(abs(x-d))
	else:
		x=x+t*d
		k-=t
		if k%2==0:
			print(abs(x))
		else:
			print(abs(x+d))
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if(e-a > k):
    print(':(')
else:
    print('Yay!')


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(':(')
else:
    print('Yay!')