Problem: Akari has n kinds of flowers, one of each kind.  She is going to choose one or more of these flowers to make a bouquet.  However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.  How many different bouquets are there that Akari can make?  Find the count modulo (10^9 + 7).  Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.

Submission attempts (in order):
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))


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)


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)


import math
n, a, b = map(int,input().split())
if n == 2:
  print(0)
else:
  total = 2 ** n -1
  total  = total - math.factorial(n)//(math.factorial(a)*math.factorial(n-a)) -math.factorial(n) //(math.factorial(b) * math.factorial(n-b))
  print(total // (10 ** 9 + 7))

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)


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)


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))


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))


import math
n, a, b = map(int,input().split())
score = 1
total = 0
for i in range(1,a):
  score = score * (n-i+1) // i
  total += score
score = score * (n-a+1)//a
for j in range(a,b):
  score =score * (n-j+1) // j
  total += score
score =score * (n-b+1) // b
for k in range(b,n//2 +1):
  score = score * (n-k+1) // k
  total += score
  if n % 2 == 1:
    total += score * (n-n//2) // (n//2 + 1)
print(total % (10**9 + 7))


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))


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)

import math
n, a, b = map(int,input().split())
score = 1
total = 0
for i in range(1,n//2+1):
  score = score * (n-i+1) // i
  total += 2 * score
  if n % 2 == 1:
    total += score * (n-n//2) // (n//2 + 1)
  total  = total - math.factorial(n)//(math.factorial(a)*math.factorial(n-a)) -math.factorial(n) //(math.factorial(b) * math.factorial(n-b))
print(total % (10**9 + 7))


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)


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)


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))


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)


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)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted