ZhenlongDai/ACPR huggingface dataset:
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

def combination(n, a, mod):
    bunshi = 1
    bunbo = 1
    for i in range(a):
        bunshi *= n-i
        bunshi = bunshi%mod
        bunbo *= a-i
        bunbo = bunbo%mod
    return bunshi*pow(bunbo, mod-2, mod)%mod
mod = 100000007
answer = pow(2, n, mod)
answer -= 1
answer -= combination(n, a, mod)
answer -= combination(n, b, mod)
print(answer%mod)


Failing test case input:
1011110110 0011 41728

Expected output:
393820910


Actual output:
7839071


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

def combination(n, a, mod):
    bunbo = 1
    bunshi = 1
    for i in range(a):
        bunshi *= n-i
        bunshi = bunshi%mod
        bunbo *= a-i
        bunbo = bunbo%mod
        
    return bunshi*pow(bunbo, mod-2, mod)%mod
        
        
mod = 1000000007
answer = pow(2, n, mod)
answer -= 1
answer -= combination(n, a, mod)
answer -= combination(n, b, mod)
print(answer%mod)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
MOD = 10**9+7

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


def cmb(n, r, mod):
    x = 1
    y = 1
    for i in range(1, r + 1):
        x = (x * (n - i + 1)) % MOD
        y = (y * i) % MOD

    return (x * pow(y, MOD - 2, MOD)) % MOD


ans = pow(2, n, MOD) - 1 - cmb(n, a, MOD) - cmb(n, b, MOD)
print(ans) if ans >= 0 else print(ans + MOD)


Failing test case input:
0000110001 30356 38217

Expected output:
234388392


Actual output:
-765611615


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
MOD = 10**9+7

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


def cmb(n, r, mod):
    x = 1
    y = 1
    for i in range(1, r + 1):
        x = (x * (n - i + 1)) % MOD
        y = (y * i) % MOD

    return (x * pow(y, MOD - 2, MOD)) % MOD


ans = pow(2, n, MOD) - 1 - cmb(n, a, MOD) - cmb(n, b, MOD)
if ans < 0:
    while ans < 0:
        ans += MOD
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7

def C(n, r, mod):
    x=y=1
    for i in range(r):
        x *= n; y *= r
        x %= mod; y %= mod
        n -= 1; r -= 1
    return x * pow(y, mod - 2, mod) % mod


res = pow(2,n,mod) - 1


comb_a = C(n,a,mod)
comb_b = C(n,b,mod)

print(res-(comb_a+comb_b)%mod)


Failing test case input:
1001010000 32745 137059

Expected output:
968892946


Actual output:
-31107061


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7

def C(n, r, mod):
    x=y=1
    for i in range(r):
        x *= n; y *= r
        x %= mod; y %= mod
        n -= 1; r -= 1
    return x * pow(y, mod - 2, mod) % mod


res = pow(2,n,mod) - 1


comb_a = C(n,a,mod)
comb_b = C(n,b,mod)

print((res-(comb_a+comb_b))%mod)
Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from math import factorial

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

mod = 10**9 + 7

def pow(x, n):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = ans*x % mod
    x = x*x % mod
    n = n >> 1 
  return ans

def ncr(n, r):
    x = 1
    y = 1
    for i in range(r):
        x *= (n-i)
        y *= (i+1)
        x %= mod
        y %= mod
    return (x * pow(y, 10**9+5)) % mod

ans = pow(2,n) - ncr(n,a) - ncr(n,b) - 1

print(ans if ans >= 0 else ans + mod)


Failing test case input:
1001010000 32745 173205

Expected output:
733789298


Actual output:
-266210709


Fixed submission (verdict: Accepted):
from math import factorial

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

mod = 10**9 + 7

def pow(x, n):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = ans*x % mod
    x = x*x % mod
    n = n >> 1 
  return ans

def ncr(n, r):
    x = 1
    y = 1
    for i in range(r):
        x *= (n-i)
        y *= (i+1)
        x %= mod
        y %= mod
    return (x * pow(y, 10**9+5)) % mod

ans = (pow(2,n) - ncr(n,a) - ncr(n,b) - 1) % mod

print(ans if ans >= 0 else ans + mod)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
mod = 10**9 + 7
n, a, b = map(int, input().split())


ans = pow(2, n, mod) - 1

x = 1
for i in range(a):
  x *= n-i
  x %= mod
  x *= pow(i+1, mod-2, mod)
  x %= mod
  ans = (ans + mod-x)%mod


for i in range(b):
  x *= n-i
  x %= mod
  x *= pow(i+1, mod-2, mod)
  x %= mod
  ans = (ans + mod-x)%mod

print(ans)



Failing test case input:
0001000000 43642 116607

Expected output:
41981802


Actual output:
378660468


Fixed submission (verdict: Accepted):
mod = 10**9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, mod) - 1

for r in [a, b]:
    x = 1
    for i in range(r):
        x *= n-i
        x %= mod
        x *= pow(i+1, mod-2, mod)
        x %= mod
    ans = (ans + mod-x)%mod

print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = (pow(2, n, mod)-1 - comb(n, a)) % mod - comb(n, b) % mod
print(ans)


Failing test case input:
0001010111 1332 153397

Expected output:
108171764


Actual output:
-891828243


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
mod = 10**9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = pow(2, n, mod) - 1
ans = (ans - comb(n, a)) % mod
ans = (ans - comb(n, b)) % mod
print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7

def comb(N,x):
  numerator = 1
  for i in range(N-x+1,N+1):
    numerator = numerator *i%mod
  denominator = 1
  for j in range(1,x+1):
    denominator = denominator *i%mod
  d = pow(denominator,mod-2,mod)
  return (numerator*d)%mod
al = pow(2,n,mod)-1
ac =comb(n,a)
bc =comb(n,b)
print((al-ac-bc)%mod)

Failing test case input:
1101011001 1332 173205

Expected output:
336795496


Actual output:
883250568


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7

def comb(N,x):
  numerator = 1
  for i in range(N-x+1,N+1):
    numerator = numerator *i%mod
  denominator = 1
  for j in range(1,x+1):
    denominator = denominator *j%mod
  d = pow(denominator,mod-2,mod)
  return (numerator*d)%mod
al = pow(2,n,mod)-1
ac =comb(n,a)
bc =comb(n,b)
print((al-ac-bc)%mod)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = (pow(2, n, mod) - comb(n, a)) % mod - comb(n, b) % mod
print(ans)


Failing test case input:
1001011001 39255 173205

Expected output:
299874866


Actual output:
299874867


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
mod = 10**9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = pow(2, n, mod) - 1
ans = (ans - comb(n, a)) % mod
ans = (ans - comb(n, b)) % mod
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

mmod = 10**9 + 7


def comb_mod(n, r, mod=mmod):
    nume = 1
    deno = 1

    r = min(r, r - 1)

    for i in range(1, r + 1):
        nume = (nume * (n - i)) % mod
        deno = (deno * (i + 1)) % mod

    return (nume * pow(deno, mod - 2, mod)) % mod


if n == 2:
    print(0)
    exit

total = (pow(2, n, mmod) - comb_mod(n, a) - comb_mod(n, b) - 1) % mmod

print(total)


Failing test case input:
4 0 3

Expected output:
10


Actual output:
13


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

mmod = 10**9 + 7


def comb_mod(n, r, mod=mmod):
    nume = 1
    deno = 1

    r = min(r, n - r)

    for i in range(1, r + 1):
        nume = (nume * (n + 1 - i)) % mod
        deno = (deno * i) % mod

    return (nume * pow(deno, mod - 2, mod)) % mod


result_a = comb_mod(n, a)
result_b = comb_mod(n, b)
total = (pow(2, n, mmod) - result_a - result_b - 1) % mmod

print(total)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
mod=10**9+7
ans=pow(2,n,mod)-1
p=1
for i in range(a):
    p*=n-i
    p*=pow(i+1,mod-2,mod)
    p%=mod
for i in range(b):
    p*=n-i
    p*=pow(i+1,mod-2,mod)
    p%=mod
print((ans-p)%mod)

Failing test case input:
1001011000 32745 173205

Expected output:
13899730


Actual output:
847140993


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
mod=10**9+7
ans=pow(2,n,mod)-1
p=1
for i in range(a):
    p*=n-i
    p*=pow(i+1,mod-2,mod)
    p%=mod
p2=1
for i in range(b):
    p2*=n-i
    p2*=pow(i+1,mod-2,mod)
    p2%=mod
print((ans-p-p2)%mod)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k+1,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-1-ca-cb)%m

Failing test case input:
1001011000 39255 173205

Expected output:
341460605


Actual output:

Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k+1,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-1-ca-cb)%m
print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k+1,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-ca-cb)%m

Failing test case input:
1000000000 60937 173205

Expected output:
832968201


Actual output:

Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k+1,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-1-ca-cb)%m
print(ans)

Problem: p02768
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
MOD = 10**9 + 7
n, a, b = map(int, input().split())

def comb(n, k):
    x, y = 1, 1
    for i in range(n, n-k, -1):
        x = x * i % MOD
    for i in range(2, k+1):
        y = y * pow(i, MOD-2, MOD) % MOD
    return x*y % MOD

ans = pow(2, n, MOD)-1
ans -= comb(n,a) + comb(n,b)
if ans < 0:
    ans += MOD

print(ans)

Failing test case input:
1011010110 0011 51762

Expected output:
766349876


Actual output:
-233650131


Fixed submission (verdict: Accepted):
MOD = 10**9 + 7
n, a, b = map(int, input().split())

def comb(n, k):
    x, y = 1, 1
    for i in range(n, n-k, -1):
        x = x * i % MOD
    for i in range(2, k+1):
        y = y * pow(i, MOD-2, MOD) % MOD
    return x*y % MOD

ans = (pow(2, n, MOD)-1-comb(n,a)-comb(n,b)) % MOD

print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
l=10**9+7

n,a,b=map(int,input().split())
comb=[1]
for i in range(max(a,b)):
    den=i+1
    num=n-i
    ans=comb[i]*num*pow(den,l-2,l)%l
    comb.append(ans)


print(pow(2,n,l)-1-comb[a]-comb[b])

Failing test case input:
0011010101 32639 93677

Expected output:
756369261


Actual output:
-243630746


Fixed submission (verdict: Accepted):
import math
l=10**9+7

n,a,b=map(int,input().split())
comb=[1]

for i in range(max(a,b)):
    den=i+1
    num=n-i
    ans=comb[i]*num*pow(den,l-2,l)%l
    comb.append(ans)


print((pow(2,n,l)-1-comb[a]-comb[b])%l)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
mod = 10**9 + 7
def cmb(n,r,mod):
	a=1
	b=1
	r = min(r,n-r)
	for i in range(r):
		a = a*(n-i)%mod
		b = b*(i+1)%mod
	return a*pow(b,mod-2,mod)%mod

n,a,b = map(int,input().split())
count = 0
all = pow(2,n,mod) - 1
nCa = cmb(n,a,mod)
nCb = cmb(n,b,mod)
ans = all - (nCa + nCb) + mod
print(ans)

Failing test case input:
4 0 4

Expected output:
13


Actual output:
1000000020


Fixed submission (verdict: Accepted):
mod = 10**9 + 7
def cmb(n,r,mod):
	a=1
	b=1
	r = min(r,n-r)
	for i in range(r):
		a = a*(n-i)%mod
		b = b*(i+1)%mod
	return a*pow(b,mod-2,mod)%mod

n,a,b = map(int,input().split())
count = 0
all = pow(2,n,mod) - 1
nCa = cmb(n,a,mod)
nCb = cmb(n,b,mod)
ans = all - (nCa + nCb)
while (ans < 0):
  ans += mod
print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = (pow(2, n, mod)-1) - comb(n, a) % mod - comb(n, b) % mod
print(ans)


Failing test case input:
1001010000 55094 173205

Expected output:
748021449


Actual output:
-1251978565


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
mod = 10**9 + 7


def comb(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*(n-i+1) % mod
        res = res*pow(i, mod-2, mod) % mod
    return res


ans = pow(2, n, mod) - 1
ans = (ans - comb(n, a)) % mod
ans = (ans - comb(n, b)) % mod
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

p = 10**9 + 7

def cmb(n, r, p):
    x = 1
    y = 1
    for i in range(r):
        x = x*(n-i) % p
        y = y*(r-i) % p
    return x*pow(y, p-2, p) % p

ans = pow(2, n, p) - 1 - cmb(n, a, p) - cmb(n, b, p)

if ans < 0:
    print(int(ans)+p)
else:
    print(int(ans))

Failing test case input:
1011010100 5545 41728

Expected output:
965043468


Actual output:
-34956539


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

p = 10**9 + 7

def cmb(n, r, p):
    x = 1
    y = 1
    for i in range(r):
        x = x*(n-i) % p
        y = y*(r-i) % p
    return x*pow(y, p-2, p) % p

ans = pow(2, n, p) - 1 - cmb(n, a, p) - cmb(n, b, p)

print(ans%p)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
mod = 10**9 + 7


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


ans = pow(2, n, mod)-1-nCr(n, a, mod)-nCr(n, b, mod)
if ans < 0:
    print(ans + mod)
else:
    print(ans)


Failing test case input:
0001010111 1679 153397

Expected output:
595672404


Actual output:
-404327603


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
mod = 10**9 + 7


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


print((pow(2, n, mod)-1-nCr(n, a, mod)-nCr(n, b, mod)) % mod)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):



def comb(N, A):
    x = 1
    for i in range(A):
        x *= N
        N -= 1
        x %= MOD
    y = 1
    for i in range(A):
        y *= A
        A -= 1
        y %= MOD
    return x*pow(y, MOD-2, MOD) % MOD


N, A, B = map(int, input().split())
MOD = 10**9+7
print(pow(2, N, MOD)-1-comb(N, A)-comb(N, B))


Failing test case input:
0001000111 1332 153397

Expected output:
340238343


Actual output:
-659761664


Fixed submission (verdict: Accepted):



def comb(N, A):
    x = 1
    for i in range(A):
        x *= N
        N -= 1
        x %= MOD
    y = 1
    for i in range(A):
        y *= A
        A -= 1
        y %= MOD
    return x*pow(y, MOD-2, MOD) % MOD


N, A, B = map(int, input().split())
MOD = 10**9+7
print((pow(2, N, MOD)-1-comb(N, A)-comb(N, B)+MOD) % MOD)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
x = n-a
y = n-b
a = min(a,x)
b = min(b,y)
fa = 1
for i in range(n,n-a,-1):
  fa*=i
  fa%=mod
a_mi = fa
fa = 1
for i in range(n,n-b,-1):
  fa*=i
  fa%=mod
b_mi = fa
ans-=(((a_mi*pow(fact[a],mod-2,mod))%mod)+((b_mi*pow(fact[b],mod-2,mod))%mod))%mod
print(ans)

Failing test case input:
1101010001 55094 173205

Expected output:
243921221


Actual output:
-756078786


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
  
def comb(n,k):
  k = min(k,n-k)
  fa = 1
  for i in range(n,n-k,-1):
    fa*=i
    fa%=mod
  return fa*pow(fact[k],mod-2,mod)
mi = comb(n,a)+comb(n,b)
mi%=mod
ans-=mi
ans%=mod
print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = [int(i) for i in input().split()]
mod = 10**9+7

def func_156d(n, r):
    r =min(r, n-r)
    numerator = 1
    denominator = 1
    
    for i in range(n-r+1, n+1):
        numerator = numerator * i % mod
        
    for i in range(1, r+1):
        denominator = denominator * i % mod
        
    return numerator * pow(denominator, mod-2, mod) %mod

print(pow(2, n, mod) -1 - func_156d(n,a) - func_156d(n,b) %mod)

Failing test case input:
1000000000 32745 173205

Expected output:
57817401


Actual output:
-942182606


Fixed submission (verdict: Accepted):
n, a, b = [int(i) for i in input().split()]
mod = 10**9+7

def func_156d(n, r):
    r =min(r, n-r)
    numerator = 1
    denominator = 1
    
    for i in range(n-r+1, n+1):
        numerator = numerator * i % mod
        
    for i in range(1, r+1):
        denominator = denominator * i % mod
        
    return numerator * pow(denominator, mod-2, mod) %mod

print((pow(2, n, mod) -1 - func_156d(n,a) - func_156d(n,b) + 2*mod) %mod )

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
law = 10 ** 9 + 7

def fermat(n, r, law):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % law
        y = y * (i + 1) % law

    ans = x * pow(y, law - 2, law)
    return ans

print((pow(2,n,law)- fermat(n,a,law)-fermat(n,b,law))%law)

Failing test case input:
1011010110 0011 41728

Expected output:
410401507


Actual output:
410401508


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
law = 10 ** 9 + 7

def fermat(n, r, law):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % law
        y = y * (i + 1) % law

    ans = x * pow(y, law - 2, law) % law
    return ans

print((pow(2,n,law)- fermat(n,a,law)-fermat(n,b,law)-1)%law)

Problem: p02768
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def modpow(x, n, m):
    res = 1
    while n > 0:
        if n % 2 == 1:
            res = (res * x) % m
        x = (x * x) % m
        n >>= 1
    return res

def combination(n, r, m):
    res = 1

    for i in range(1, r + 1):
        res = (res * (n - r + i)) % m
        res = (res * pow(i, m - 2, m)) % m
    return res

mod = 10**9 + 7
n, a, b = map(int, input().split())
total = pow(2, n, mod) - 1

total -= (combination(n, a, mod) + combination(n, b, mod)) % mod

print(total)

Failing test case input:
0111100101 97316 165663

Expected output:
476639953


Actual output:
-523360054


Fixed submission (verdict: Accepted):
def combination(n, r, m):
    res = 1
    r = min(r, n - r)

    for i in range(r):
        res = res * (n - i) % m
        res = res * pow(i + 1, m - 2, m) % m
    return res

mod = 10**9 + 7
n, a, b = map(int, input().split())
total = pow(2, n, mod) - 1

total -= (combination(n, a, mod) + combination(n, b, mod)) % mod

print(total % mod)
Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-ca-cb)%m

Failing test case input:
1000000000 60937 173205

Expected output:
832968201


Actual output:

Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k+1,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-1-ca-cb)%m
print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = map(int,input().split())

mod = 10**9+7

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

sum = pow(2,n,mod)
case = combination(n,a,mod) + combination(n,b,mod) + 1
ans = sum-case
if ans < 0 :
    ans += mod

print(ans)

Failing test case input:
1101010001 46445 173205

Expected output:
689527178


Actual output:
-310472829


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

mod = 10**9+7

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

sum = pow(2,n,mod)
case = combination(n,a,mod) + combination(n,b,mod) + 1
ans = sum-case
while ans < 0 :
    ans += mod

print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def conbination(n,r):
    x=1
    y=1
    for i in range(r):
        x*=n-r+i+1
        y*=i+1
        x%=(10**9+7)
        y%=(10**9+7)
    z=(x*pow(y,(10**9+5),(10**9+7)))%(10**9+7)
    return z
N,a,b=map(int,input().split())
ans=pow(2,N,(10**9+7))-1
print(ans-conbination(N,a)-conbination(N,b))

Failing test case input:
0101000010 43642 153178

Expected output:
855473216


Actual output:
-1144526798


Fixed submission (verdict: Accepted):
mod=10**9+7
def conbination(n,r):
    x=1
    y=1
    mod=10**9+7
    for i in range(r):
        x*=n-r+i+1
        y*=i+1
        x%=mod
        y%=mod
    z=(x*pow(y,mod-2,mod))%mod
    return z

N,a,b=map(int,input().split())

ans=pow(2,N,mod)-1
ans=(ans-conbination(N,a)-conbination(N,b))%mod
print(ans)
Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, A, B = map(int, input().split())

MOD = 10 ** 9 + 7

def comb(n, k, mod):
    a = b = 1
    for i in range(1,k+1):
        b *= i
        b %= mod
        a *= n
        a %= mod
        n -= 1
    return a/b

ret = pow(2, N, MOD) - 1 - comb(N,A,MOD) - comb(N,B,MOD)
ret %= MOD
if ret < 0:
    ret += MOD
print(int(ret))


Failing test case input:
1000000000 32745 173205

Expected output:
57817401


Actual output:
140624995


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc_inv(n, k, mod):
    a = 1
    b = 1
    for i in range(1,k+1):
        a *= i
        a %= mod
        b *= n
        n -= 1
        b %= mod
    return b * pow(a, mod-2, mod) % mod

ret = pow(2, N, MOD) - 1 - calc_inv(N,A,MOD) - calc_inv(N,B,MOD)
ret %= MOD
if ret < 0:
    ret += MOD
print(int(ret))

Problem: p02768
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
mod = 10**9 + 7
n, a, b = map(int, input().split())
res = pow(2, n, mod)-1

c1 = 1
for i in range(n-a+1, n+1):
    c1 *= i
    c1 %= mod

for i in range(1, a+1):
    c1 *= pow(i, mod-2, mod)
    c1 %= mod
    
c2 = 1
for i in range(n-a+1, n+1):
    c2 *= i
    c2 %= mod

for i in range(1, a+1):
    c2 *= pow(i, mod-2, mod)
    c2 %= mod
    
res -= (c1+c2)
res %= mod
print(res)

Failing test case input:
0001010101 1248 108561

Expected output:
854938781


Actual output:
700664972


Fixed submission (verdict: Accepted):
mod = 10**9 + 7
n, a, b = map(int, input().split())
res = pow(2, n, mod)-1

c1 = 1
for i in range(n-a+1, n+1):
    c1 *= i
    c1 %= mod

for i in range(1, a+1):
    c1 *= pow(i, mod-2, mod)
    c1 %= mod
    
c2 = 1
for i in range(n-b+1, n+1):
    c2 *= i
    c2 %= mod

for i in range(1, b+1):
    c2 *= pow(i, mod-2, mod)
    c2 %= mod
    
res -= (c1+c2)
res %= mod
print(res)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
m = 10**9+7
def cmb(r):
    N = 1
    R = 1
    for i in range(r):
        N = N*(n - i) % m
        R = R*(i+1) % m
    return N*pow(R, m-2, m)%m

ans = pow(2, n, m) - ((cmb(a) + cmb(b) + 1)%m)
print(ans)

Failing test case input:
0111100101 97316 165663

Expected output:
476639953


Actual output:
-523360054


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
m = 10**9+7
def cmb(r):
    N = 1
    R = 1
    for i in range(r):
        N = N*(n - i) % m
        R = R*(i+1) % m
    return N*pow(R, m-2, m)%m

ans = (pow(2, n, m) - ((cmb(a) + cmb(b) + 1)%m))%m
print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
m = 10**9 + 7

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



ans = pow(2, n, m) - 1 - nCr(n, a, m) - nCr(n, b, m)

if ans < 0:
    print(ans + m)
else:
    print(ans)


Failing test case input:
1001010000 55094 173205

Expected output:
748021449


Actual output:
-251978558


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
m = 10**9 + 7

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

ans = pow(2, n, m) - 1 - nCr(n, a, m) - nCr(n, b, m)

while ans < 0:
    ans += m

print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from functools import reduce

n, a, b = map(int, input().split(" "))

MOD = 10**9 + 7


def comb(n, r, mod=float("inf")):
    c = 1
    m = 1
    r = min(n - r, r)
    for i in range(r):
        c = c * (n - i) % mod
        m = m * (i + 1) % mod
    return c * pow(m, mod - 2, mod) % mod


print(pow(2, n, MOD) - comb(n, a, MOD) - comb(n, b, MOD) - 1)


Failing test case input:
1011010101 30356 150014

Expected output:
190436500


Actual output:
-809563507


Fixed submission (verdict: Accepted):
from functools import reduce

n, a, b = map(int, input().split(" "))

MOD = 10**9 + 7


def comb(n, r, mod=float("inf")):
    c = 1
    m = 1
    r = min(n - r, r)
    for i in range(r):
        c = c * (n - i) % mod
        m = m * (i + 1) % mod
    return c * pow(m, mod - 2, mod) % mod


print((pow(2, n, MOD) - comb(n, a, MOD) - comb(n, b, MOD) - 1) % MOD)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def conbination(n,r):
    x=1
    y=1
    for i in range(r):
        x*=n-r+i+1
        y*=i+1
        x%=(10**9+7)
        y%=(10**9+7)
    z=(x*pow(y,(10**9+5),(10**9+7)))%(10**9+7)
    return z
N,a,b=map(int,input().split())
ans=pow(2,N,(10**9+7))-1
ans=ans-conbination(N,a)-conbination(N,b)
print(ans if ans>0 else ans+10**9+7)

Failing test case input:
1101010001 46445 173205

Expected output:
689527178


Actual output:
-310472829


Fixed submission (verdict: Accepted):
mod=10**9+7
def conbination(n,r):
    x=1
    y=1
    mod=10**9+7
    for i in range(r):
        x*=n-r+i+1
        y*=i+1
        x%=mod
        y%=mod
    z=(x*pow(y,mod-2,mod))%mod
    return z

N,a,b=map(int,input().split())

ans=pow(2,N,mod)-1
ans=(ans-conbination(N,a)-conbination(N,b))%mod
print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
MOD = 10**9+7
def pow(a, b):
    res = 1
    while b:
        if b & 1: res = res * a % MOD
        a = a**2 % MOD
        b >>= 1
    return res

n, a, b = list(map(int, input().split()))

ans = pow(2, n)-1

for X in [a, b]:
    x = 1
    y = 1
    for i in range(X):
        x = x * (n-i) % MOD
        y = y * (i+1) % MOD

    t = x * pow(y, MOD-2) % MOD
    ans -= t

if ans < 0: ans += MOD
print(ans)

Failing test case input:
1001010000 55094 173205

Expected output:
748021449


Actual output:
-251978558


Fixed submission (verdict: Accepted):
MOD = 10**9+7
def pow(a, b):
    res = 1
    while b:
        if b & 1: res = res * a % MOD
        a = a**2 % MOD
        b >>= 1
    return res

n, a, b = list(map(int, input().split()))

ans = pow(2, n)-1

for X in [a, b]:
    x = 1
    y = 1
    for i in range(X):
        x = x * (n-i) % MOD
        y = y * (i+1) % MOD

    t = x * pow(y, MOD-2) % MOD
    ans -= t

while ans < 0: ans += MOD
print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
  
def comb(n,k):
  k = min(k,n-k)
  fa = 1
  for i in range(n,n-k,-1):
    fa*=i
    fa%=mod
  return fa*pow(fact[k],mod-2,mod)
mi = comb(n,a)+comb(n,b)
mi%=mod
ans-=mi
print(ans)

Failing test case input:
1001010000 16238 116607

Expected output:
474688954


Actual output:
-525311053


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
  
def comb(n,k):
  k = min(k,n-k)
  fa = 1
  for i in range(n,n-k,-1):
    fa*=i
    fa%=mod
  return fa*pow(fact[k],mod-2,mod)
mi = comb(n,a)+comb(n,b)
mi%=mod
ans-=mi
ans%=mod
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

 
def combination(n, r, mod=10**9+7):
    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

mod=10**9+7

print((pow(2,n,mod) - combination(n,a,mod) - combination(n,b,mod))%mod)

Failing test case input:
1000000100 18544 173205

Expected output:
968380807


Actual output:
968380808


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

 
def combination(n, r, mod=10**9+7):
    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

mod=10**9+7

print((pow(2,n,mod)- 1 - combination(n,a,mod) - combination(n,b,mod))%mod)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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


def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c


mod = 10**9+7

ans = pow(2, n, mod)
ans -= 1
ans -= cmb(n, a, mod)
ans -= cmb(n, b, mod)

if ans < 0:
    print(ans+mod)
else:
    print(ans)

Failing test case input:
1000000000 60937 173205

Expected output:
832968201


Actual output:
-167031806


Fixed submission (verdict: Accepted):
import math

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


def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c


mod = 10**9+7

ans = pow(2, n, mod)
ans -= 1
ans -= cmb(n, a, mod)
ans -= cmb(n, b, mod)

while ans<0:
    ans+=mod
print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
mod = 10**9 + 7
n, a, b = map(int, input().split())


ans = pow(2, n, mod) - 1

x = 1
for i in range(a):
  x *= n-i
  x %= mod
  x *= pow(i+1, mod-2, mod)
  x %= mod
ans = (ans + mod-x)%mod


for i in range(b):
  x *= n-i
  x %= mod
  x *= pow(i+1, mod-2, mod)
  x %= mod
ans = (ans + mod-x)%mod

print(ans)



Failing test case input:
0001000000 28895 116607

Expected output:
54378908


Actual output:
249630271


Fixed submission (verdict: Accepted):
mod = 10**9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, mod) - 1

for r in [a, b]:
    x = 1
    for i in range(r):
        x *= n-i
        x %= mod
        x *= pow(i+1, mod-2, mod)
        x %= mod
    ans = (ans + mod-x)%mod

print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
x = n-a
y = n-b
a = min(a,x)
b = min(b,y)
fa = 1
for i in range(n,n-a,-1):
  fa*=i
  fa%=mod
a_mi = fa
fa = 1
for i in range(n,n-b,-1):
  fa*=i
  fa%=mod
b_mi = fa

ans-=((a_mi*pow(fact[a],mod-2,mod))%mod+(b_mi*pow(fact[b],mod-2,mod))%mod)%mod
print(ans)

Failing test case input:
1011110110 0001 41728

Expected output:
641244184


Actual output:
-358755823


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
  
def comb(n,k):
  k = min(k,n-k)
  fa = 1
  for i in range(n,n-k,-1):
    fa*=i
    fa%=mod
  return fa*pow(fact[k],mod-2,mod)
mi = comb(n,a)+comb(n,b)
mi%=mod
ans-=mi
ans%=mod
print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
mod = 10**9+7

def comb(n, r):
    x = 1
    y = 1
    if n-r<r:
        r = n-r
    for i in range(r):
        x *= n-i
        y *= (i*1)
        x %= mod
        y %= mod
    return x * pow(y, mod-2, mod) % mod

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

print((pow(2, n, mod)-comb(n, a)-comb(n, b)-1)%mod)

Failing test case input:
0011100101 52297 165663

Expected output:
309651484


Actual output:
888386781


Fixed submission (verdict: Accepted):
mod = 10**9+7

def comb(n, r):
    x = 1
    y = 1
    if n-r<r:
        r = n-r
    for i in range(r):
        x *= n-i
        y *= (i+1)
        x %= mod
        y %= mod
    return x * pow(y, mod-2, mod) % mod

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

print((pow(2, n, mod)-comb(n, a)-comb(n, b)-1)%mod)

Problem: p02768
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def cmb(n, r, p):
    r = min(r, n - r)
    upper = 1
    for i in range(n, n - r, -1):
        upper = (upper * i) % p

    lower = 1
    for i in range(1, r + 1):
        lower = (lower * i) % p

    
    return (upper * pow(lower, p - 2, p)) % p

mod = pow(10, 9) + 7
n, a, b = map(int, input().split())
ans = pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod)
print(ans)

Failing test case input:
1011010110 0010 41728

Expected output:
897170119


Actual output:
-1102829895


Fixed submission (verdict: Accepted):
def cmb(n, r, p):
    r = min(r, n - r)
    upper = 1
    for i in range(n, n - r, -1):
        upper = (upper * i) % p

    lower = 1
    for i in range(1, r + 1):
        lower = (lower * i) % p

    
    return (upper * pow(lower, p - 2, p)) % p

mod = pow(10, 9) + 7
n, a, b = map(int, input().split())
ans = (pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod))%mod
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
def cmb(n, r, mod):
    x = 1 
    y = 1
    for i in range(r):
        x = x*(n-i)%(mod)
    for i in range(1,r+1):
        y = y*i%(mod)
    return x * pow(y,mod-2,mod) %mod

v = int(pow(2,n,10**9+7)-1-cmb(n,a,10**9+7)-cmb(n,b,10**9+7))
if v >= 0:
    print(v)
else:
    print(v+10**9+7)

Failing test case input:
0000110001 30356 38217

Expected output:
234388392


Actual output:
-765611615


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
def cmb(n, r, mod):
    x = 1 
    y = 1
    for i in range(r):
        x = x*(n-i)%(mod)
    for i in range(1,r+1):
        y = y*i%(mod)
    return x * pow(y,mod-2,mod) %mod

v = int(pow(2,n,10**9+7)-1-cmb(n,a,10**9+7)-cmb(n,b,10**9+7))
if v >= 0:
    print(v)
else:
    if v+10**9+7 >= 0:
        print(v+10**9+7)
    else:
        print(v+2*(10**9+7))
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
MOD = 10**9+7

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


def cmb(n, r, mod):
    x = 1
    y = 1
    for i in range(1, r + 1):
        x = (x * (n - i + 1)) % MOD
        y = (y * i) % MOD

    return (x * pow(y, MOD - 2, MOD)) % MOD


ans = pow(2, n, MOD) - 1 - cmb(n, a, MOD) - cmb(n, b, MOD)
print(ans) if ans > 0 else print(ans + MOD)


Failing test case input:
1101010001 46445 173205

Expected output:
689527178


Actual output:
-310472829


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
MOD = 10**9+7

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


def cmb(n, r, mod):
    x = 1
    y = 1
    for i in range(1, r + 1):
        x = (x * (n - i + 1)) % MOD
        y = (y * i) % MOD

    return (x * pow(y, MOD - 2, MOD)) % MOD


ans = pow(2, n, MOD) - 1 - cmb(n, a, MOD) - cmb(n, b, MOD)
if ans < 0:
    while ans < 0:
        ans += MOD
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

mod = 10 ** 9 + 7
f = [1]
for i in range(1,2*(10 ** 5)+1):
    f.append((f[-1] * i) % mod)
def comb(n,r):
    z = 1
    for i in range(n-r+1, n+1):
        z *= i
        z %= mod
    return (z * pow(f[r], mod-2, mod)) % mod

ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)
if ans < 0:
    ans += mod

print(ans)

Failing test case input:
0000110001 30356 80077

Expected output:
886968365


Actual output:
-113031642


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

mod = 10 ** 9 + 7
f = [1]
for i in range(1,2*(10 ** 5)+1):
    f.append((f[-1] * i) % mod)
def comb(n,r):
    z = 1
    for i in range(n-r+1, n+1):
        z *= i
        z %= mod
    return (z * pow(f[r], mod-2, mod)) % mod

ans = (pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)) % mod

print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())


def choose(x, y, m):
    v = 1
    for i in range(0, y):

        v = (v * (x - i) * pow(i + 1, m - 2, m)) % m

    return v


m = 10**9 + 7
print((pow(2, n, m) - choose(n, a, m) - choose(n, b, m)) % m)


Failing test case input:
0001000111 1332 153397

Expected output:
340238343


Actual output:
340238344


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
m = 10**9 + 7


def choose(x, y):
    v = 1
    for i in range(0, y):
        v = (v * (x - i) * pow(i + 1, m - 2, m)) % m
    return v


print((pow(2, n, m) - 1 - choose(n, a) - choose(n, b)) % m)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def fermat_binom(n,k,p):
  if k > n:
    return 0
  num = 1
  for i in range(n,n-k,-1):
    num = (num*i)%p
  denom = 1
  for i in range(1,k+1):
    denom = (denom*i)%p
  return (num * pow(denom,p-2,p))%p

if __name__ == '__main__':
  n, a, b = map(int, input().split())
  mod = 1000000007 
  k = pow(2, n, mod)
  k1 = fermat_binom(n, a, mod)
  k2 = fermat_binom(n, b, mod)
  r = (k1+k2)%mod
  print(max(k-r-1, 0))

Failing test case input:
1011010110 0011 41728

Expected output:
410401507


Actual output:
0


Fixed submission (verdict: Accepted):
def fermat_binom(n,k,p):
  if k > n:
    return 0
  num = 1
  for i in range(n,n-k,-1):
    num = (num*i)%p
  denom = 1
  for i in range(1,k+1):
    denom = (denom*i)%p
  return (num * pow(denom,p-2,p))%p

if __name__ == '__main__':
  n, a, b = map(int, input().split())
  mod = 1000000007 
  k = pow(2, n, mod)
  r = k- 1- fermat_binom(n, a, mod) - fermat_binom(n, b, mod)
  r = (r%mod+mod)%mod
  print(max(r, 0))

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int, input().split()) 


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


mod = 10**9+7



def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

sou = pow(2,n,mod) -1
ans = (sou - combination(n, a)-combination(n, b))
if (ans<0):
        ans += mod
print(ans)


Failing test case input:
1001010000 55094 173205

Expected output:
748021449


Actual output:
-251978558


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


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


mod = 10**9+7



def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

sou = pow(2,n,mod) -1
ans = (sou - combination(n, a)-combination(n, b))
if (ans<0):
        ans += mod
if (ans<0):
        ans += mod
print(ans)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import copy
import random
import bisect 
import fractions 
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) 
d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

n, a, b = LI()

ans = pow(2, n, mod) - 1
ans -= pow(2, a, mod) - 1
ans -= pow(2, b, mod) - 1
print(ans % mod)

Failing test case input:
1001011000 32745 173205

Expected output:
13899730


Actual output:
232393359


Fixed submission (verdict: Accepted):

import copy
import random
import bisect 
import fractions 
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) 



d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

n, a, b = LI()


ans = pow(2, n, mod) - 1




def fur(n,r):
    p,q = 1,1
    for i in range(r):
        p = p*(n-i)%mod
        q = q*(i+1)%mod
    return p * pow(q,mod-2,mod) % mod

print((ans - fur(n, a) - fur(n, b)) % mod)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())

def comb(n,r,mod=10**9+7):
    a=1
    b=1
    r = min(r,n-r)
    for i in range(r):
        a = a*(n-i)%mod
        b = b*(i+1)%mod
    return a*pow(b,mod-2,mod)%mod

ans = pow(2,n,10**9+7)-1 - comb(n,a) - comb(n,b)
if ans < 0: ans += 10**9+7
print(ans)

Failing test case input:
0001010111 1679 153397

Expected output:
595672404


Actual output:
-404327603


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

def comb(n,r,mod=10**9+7):
    a=1
    b=1
    r = min(r,n-r)
    for i in range(r):
        a = a*(n-i)%mod
        b = b*(i+1)%mod
    return a*pow(b,mod-2,mod)%mod

ans = pow(2,n,10**9+7)-1 - comb(n,a) - comb(n,b)
ans %= 10**9+7
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod=7+10**9
ans = pow(2 , n , mod)
def comb(n,c,mod):
  s=1
  t=1
  for i in range(1,c+1):
    s=s*i%mod
  for j in range(n-c+1,n+1):
    t=t*j%mod
  return (t*pow(s,mod-2,mod))%mod

print(ans-1-comb(n,a,mod)-comb(n,b,mod))

Failing test case input:
1101011001 55094 173205

Expected output:
767702363


Actual output:
-1232297651


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod=7+10**9
ans = pow(2 , n , mod)

def comb(n,c,mod):
  s=1
  t=1
  for i in range(1,c+1):
    s=s*i%mod
  for j in range(n-c+1,n+1):
    t=t*j%mod
  return (t*pow(s,mod-2,mod))%mod

print((ans-1-comb(n,a,mod)-comb(n,b,mod))%mod)
Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
def cmb(n, r, mod):
    x = 1 
    y = 1
    for i in range(r):
        x = x*(n-i)%(mod)
    for i in range(1,r+1):
        y = y*i%(mod)
    return x * pow(y,mod-2,mod) %mod

v = int(pow(2,n,10**9+7)-1-cmb(n,a,10**9+7)-cmb(n,b,10**9+7))
print(v)

Failing test case input:
0001010101 1248 108561

Expected output:
854938781


Actual output:
-1145061233


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
def cmb(n, r, mod):
    x = 1 
    y = 1
    for i in range(r):
        x = x*(n-i)%(mod)
    for i in range(1,r+1):
        y = y*i%(mod)
    return x * pow(y,mod-2,mod) %mod

v = int(pow(2,n,10**9+7)-1-cmb(n,a,10**9+7)-cmb(n,b,10**9+7))
if v >= 0:
    print(v)
else:
    if v+10**9+7 >= 0:
        print(v+10**9+7)
    else:
        print(v+2*(10**9+7))

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
x = n-a
y = n-b
a = min(a,x)
b = min(b,y)
fa = 1
for i in range(n,n-a,-1):
  fa*=i
  fa%=mod
a_mi = fa
fa = 1
for i in range(n,n-b,-1):
  fa*=i
  fa%=mod
b_mi = fa
ans-=((a_mi*pow(fact[a],mod-2,mod))%mod+(b_mi*pow(fact[b],mod-2,mod))%mod)%mod
print(ans-1)

Failing test case input:
1000010000 32745 173205

Expected output:
92275184


Actual output:
92275183


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
  
def comb(n,k):
  k = min(k,n-k)
  fa = 1
  for i in range(n,n-k,-1):
    fa*=i
    fa%=mod
  return fa*pow(fact[k],mod-2,mod)
mi = comb(n,a)+comb(n,b)
mi%=mod
ans-=mi
ans%=mod
print(ans)

Problem: p02768
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
ans = pow(2 , n , 10**9+7)
mod=7+10**9
def comb(n,c,mod):
  s=1
  t=1
  for i in range(1,c+1):
    s=s*i%mod
  for j in range(n-c+1,n+1):
    t=t*j%mod
  return (t*pow(s,mod-2,mod))%mod

print(ans-1-comb(n,a,mod)-comb(n,b,mod))

Failing test case input:
0011010101 32639 93677

Expected output:
756369261


Actual output:
-243630746


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod=7+10**9
ans = pow(2 , n , mod)

def comb(n,c,mod):
  s=1
  t=1
  for i in range(1,c+1):
    s=s*i%mod
  for j in range(n-c+1,n+1):
    t=t*j%mod
  return (t*pow(s,mod-2,mod))%mod

print((ans-1-comb(n,a,mod)-comb(n,b,mod))%mod)
Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(1000000)

n, a, b = map(int, input().split())
mod = 10**9 + 7
nca = 1

for i in range(a):
    nca *= (n-i)
    nca *= pow(i+1, mod-2, mod)
    nca %= mod
ncb = 1
for i in range(b):
    ncb *= (n-i)
    ncb *= pow(i+1, mod-2, mod)
    ncb %= mod

nca %= mod
ncb %= mod


ans = pow(2, n, mod) - nca - ncb - 1
if ans >= 0:
    print(ans)
else:
    print(ans + mod)

Failing test case input:
1011010100 5545 41728

Expected output:
965043468


Actual output:
-34956539


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(1000000)

n, a, b = map(int, input().split())
mod = 10**9 + 7
nca = 1

for i in range(a):
    nca *= (n-i)
    nca *= pow(i+1, mod-2, mod)
    nca %= mod
ncb = 1
for i in range(b):
    ncb *= (n-i)
    ncb *= pow(i+1, mod-2, mod)
    ncb %= mod

nca %= mod
ncb %= mod


ans = pow(2, n, mod) - nca - ncb - 1

while ans < 0:
    ans += mod
print(ans)

Problem: p02768
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
x = n-a
y = n-b
a = min(a,x)
b = min(b,y)
fa = 1
for i in range(n,n-a,-1):
  fa*=i
  fa%=mod
a_mi = fa
fa = 1
for i in range(n,n-b,-1):
  fa*=i
  fa%=mod
b_mi = fa
ans-=((a_mi*pow(fact[a],mod-2,mod))%mod+(b_mi*pow(fact[b],mod-2,mod))%mod)%mod
print(ans+1)

Failing test case input:
0011010101 30356 80077

Expected output:
702491121


Actual output:
702491122


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)-1
fact = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  tmp = fact[i-1]*i
  tmp %= mod
  fact[i]=tmp
  
def comb(n,k):
  k = min(k,n-k)
  fa = 1
  for i in range(n,n-k,-1):
    fa*=i
    fa%=mod
  return fa*pow(fact[k],mod-2,mod)
mi = comb(n,a)+comb(n,b)
mi%=mod
ans-=mi
ans%=mod
print(ans)

Problem: p02768
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, a, b = map(int, input().split())

MOD = 10**9 + 7
N = pow(2,n,MOD)

def com(n,r):
    s = 1
    for i in range(n-r+1, n+1):
        s *= i
        s %= MOD

    t = 1
    for j in range(1,r+1):
        t *= j
        t %= MOD


    return s * pow(t,MOD-2, MOD) % MOD

print((N - com(n, a) - com(n, b)) % (MOD))

Failing test case input:
1001010000 32745 41728

Expected output:
186006536


Actual output:
186006537


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

MOD = 10**9 + 7
N = pow(2,n,MOD)

def com(n,r):
    s = 1
    for i in range(n-r+1, n+1):
        s *= i
        s %= MOD

    t = 1
    for j in range(1,r+1):
        t *= j
        t %= MOD


    return s * pow(t,MOD-2, MOD) % MOD

print((N - com(n, a) - com(n, b) - 1) % (MOD))