Problem p02768 (python)

Fixed submission:
N, a, b = map(int,input().split())
p = pow(10,9) + 7
def comb(n,r):
  bunshi = 1
  for i in range(n-r+1, n+1):
    bunshi =bunshi * i % p
  bunbo = 1
  for i in range(1, r+1):
    bunbo = bunbo * i % p
  return bunshi * pow(bunbo, p-2, p)
print((pow(2,N, p) - 1 - comb(N,a) - comb(N,b)) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = pow(10,9) + 7
a_c = 1
b_c = 1
a_m = 1
b_m = 1
for i in range(a):
  a_c = a_c * (N-i) % p
  a_m = a_m * (i+1) % p
m_a = a_c * pow(a_m, p-2, p) % p
for j in rnage(b):
  b_c = b_c * (N-j) % p
  b_m = b_m * (j+1) % p
m_b = b_c * pow(b_m,p-2,p) % p
print((pow(2,N, p) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
a_c = 1
b_c = 1
a_m = 1
b_m = 1
for i in range(a):
  a_c = a_c * (N-i) % p
  a_m = a_m * (i+1) % p
  m_a = a_c * pow(a_m, p-2, p) % p
for j in rnage(b):
  b_c = b_c * (N-j) % p
  b_m = b_m * (j+1) % p
  m_b = b_c * pow(b_m,p-2,p) % p
print((pow(2,N, p) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
A = math.factorial(a)
B = math.factorial(b)
a_c = 1
b_c = 1
a_m = 1
b_m = 1
for i in range(a):
  a_c = a_c * (N-i) % p
  a_m = a_m * (i+1) % p
  m_a = a_c * pow(a_m, p-2, p) % p
for j in rnage(b):
  b_c = b_c * (N-j) % p
  b_m = b_m * (j+1) % p
  m_b = b_c * pow(b_m,p-2,p) % p
print((pow(2,N, p) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
A = math.factorial(a)
B = math.factorial(b)
n_c_a = 1
n_c_b = 1
for i in range(a):
  n_c_a *= N-i
for j in rnage(b):
  n_c_b *= N-j
m_a = (n_c_a*pow(A,p-2))% p
m_b = (n_c_b*pow(B,p-2))% p
print((pow(2,N) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
def fc(t):
  if t == 0:
    return 1
  elif t % 2 == 1:
    return ((fc(t//2)) **2 )* 2
  else:
    return (fc(t//2)) ** 2
A = math.factorial(a)
B = math.factorial(b)
n_c_a = 1
n_c_b = 1
for i in range(a):
  n_c_a *= n-i
for j in rnage(b):
  n_c_b *= n-j
m_a = (n_c_a*pow(A,p-2))% p
m_b = (n_c_b*pow(B,p-2))% p
print((pow(2,N) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
def fc(t):
  if t == 0:
    return 1
  elif t % 2 == 1:
    return ((fc(t//2)) **2 )* 2
  else:
    return (fc(t//2)) ** 2
A = math.factorial(a)
B = math.factorial(b)
n_c_a = 1
n_c_b = 1
for i in range(a):
  n_c_a *= n-i
for j in rnage(b):
  n_c_b *= n-j
m_a = (n_c_a // A)% p
m_b = (n_c_b // A) % p
print((fc(N) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
def fc(t,k):
  if t == 0:
    return 1
  elif t % 2 == 1:
    return (fc(t//2,k)) **2 * k
  else:
    return (fc(t//2,k)) ** 2
A = math.factorial(a)
B = math.factorial(b)
n_c_a = 1
n_c_b = 1
for i in range(a):
  n_c_a *= n-i
for j in rnage(b):
  n_c_b *= n-j
m_a = n_c_a // A % p
m_b = n_c_b // A % p
print((fc(N,2) - 1 - m_a - m_b) % p)

Buggy submission (verdict: Runtime Error):
import math
N, a, b = map(int,input().split())
p = 10 ** 9 +7
def fc(t,k):
  if t == 0:
    return 1
  elif t % 2 == 1:
    return (fc(t//2,k)) **2 * k
  else:
    return (fc(t//2,k)) ** 2
A = math.factorial(a)
B = math.factorial(b)
n_c_a = 1
n_c_b = 1
for i in range(a):
  n_c_a *= n-i
for j in rnage(b):
  n_c_b *= n-j
m_a = fc(p-2,A) * n_c_a % p
m_b = fc(p-2,B) * n_c_b % p
print((fc(N,2) - 1 - m_a - m_b)%2)

Buggy submission (verdict: Runtime Error):
import math
rom scipy.special import comb
t = comb(n, a, exact=True)
k = comb(n, b, exact=True)
n, a, b = map(int,input().split())
if n == 2:
  print(0)
else:
  total = 2 ** n -1
  total  = total - t - k
  print(total % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import math
n, a, b = map(int,input().split())
score = 1
total = 0
if n % 2 == 1:
  for i in range(1,n//2+1):
    score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
else:
  for i in range(1,n//2):
    score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
  k = n//2 
  if k != a and k != b and k != n-a and K != n-b:
    total += score * (n-k+1) // k
print(total % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math
n, a, b = map(int,input().split())
score = 1
total = 0
if n % 2 == 1:
  for i in range(1,n//2+1):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
else:
  for i in range(1,n//2):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
  k = n//2 
  if k != a and k != b and k != n-a and K != n-b:
    total + score * (n-k+1) // k
print(total % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math
n, a, b = map(int,input().split())
score = 1
total = 0
if n % 2 = 1:
  for i in range(1,n//2+1):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
else:
  for i in range(1,n//2):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
  k = n//2 
  if k != a and k != b and k != n-a and K != n-b:
    total + score * (n-k+1) // k
print(total % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math
n, a, b = map(int,input().split())
score = 1
total = 0
if n % = 1:
  for i in range(1,n//2+1):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
else:
  for i in range(1,n//2):
  score = score * (n-i+1) // i
  if i != a and i != b and i != n-a and i != n-b:
    total += 2 * score
  else:
    total += score
  k = n//2 
  if k != a and k != b and k != n-a and K != n-b:
    total + score * (n-k+1) // k
print(total % (10**9 + 7))