Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7


def main():
  N, K = map(int, input().strip().split())
  dp = {}

  keys = []
  i = 1
  while i <= N:
    v = N // i
    j = N // v
    keys.append((v, j - i + 1))
    i += j - i + 1

  total = 0
  for nj, w in keys:
    total += w
    dp[nj] = total

  for i in range(2, K + 1):
    tmp = {}
    total = 0
    for nj, w in keys:
      j = N // nj
      v = dp[j] * w
      total += v
      total %= MOD
      tmp[nj] = total

    dp = tmp

  return dp[1]


if __name__ == '__main__':
  print(main())

Fixed submission:
MOD = 10 ** 9 + 7


def main(N, K):
  W = []
  i = 1
  while i <= N:
    v = N // i
    j = N // v
    # keys.append((v, j - i + 1))
    W.append(j - i + 1)
    i += j - i + 1

  l = len(W)
  dp = [0] * l

  total = 0
  for i, w in enumerate(W):
    total += w
    dp[l - i - 1] = total

  for i in range(2, K + 1):
    tmp = [0] * l
    total = 0
    for j, w in enumerate(W):
      v = dp[j] * w
      total += v
      total %= MOD
      tmp[l - j - 1] = total

    dp = tmp

  return dp[0]


if __name__ == '__main__':
  N, K = map(int, input().strip().split())
  # import time
  # t = time.time()
  print(main(N, K))
  # print(time.time() - t)

Buggy python submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7


def main():
  N, K = map(int, input().strip().split())
  dp1 = {}
  dp2 = {}

  counter = {}
  i = 1
  while i < N:
    v = N // i
    j = N // v
    counter[v] = j - i + 1
    i += j - i + 1

  keys = sorted(counter.items(), reverse=True)

  total = 0
  for nj, v in keys:
    total += v
    dp1[nj] = total

  for i in range(2, K + 1):
    dp2 = {}
    # dp[i] = {}
    total = 0
    for nj, w in keys:
      j = N // nj
      v = dp1[j] * w
      total += v
      total %= MOD
      dp2[nj] = total

    dp1 = dp2

  return dp2[1]
  # for k, v in dp.items():
  #   print(k, sorted(v.items(), reverse=True))

  # return dp[K][1]


if __name__ == '__main__':
  print(main())

Fixed submission:
MOD = 10 ** 9 + 7


def main(N, K):
  W = []
  i = 1
  while i <= N:
    v = N // i
    j = N // v
    # keys.append((v, j - i + 1))
    W.append(j - i + 1)
    i += j - i + 1

  l = len(W)
  dp = [0] * l

  total = 0
  for i, w in enumerate(W):
    total += w
    dp[l - i - 1] = total

  for i in range(2, K + 1):
    tmp = [0] * l
    total = 0
    for j, w in enumerate(W):
      v = dp[j] * w
      total += v
      total %= MOD
      tmp[l - j - 1] = total

    dp = tmp

  return dp[0]


if __name__ == '__main__':
  N, K = map(int, input().strip().split())
  # import time
  # t = time.time()
  print(main(N, K))
  # print(time.time() - t)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B, C, D = [int(i) - 1 for i in input().strip().split(' ')]
N += 1
S = [c for c in input().strip()]


def get(a, b):
  s = S[:]
  s[a] = 'A'
  s[b] = 'B'

  return s


def is_reachable(s, a, b):
  i = a
  while i < C:
    if i + 1 <= C and s[i + 1] == '.':
      i = i + 1
    elif i + 2 <= C and s[i + 2] == '.':
      i = i + 2
    else:
      break
  is_a = i == C

  i = b
  while i < D:
    if i + 1 <= D and s[i + 1] == '.':
      i = i + 1
    elif i + 2 <= D and s[i + 2] == '.':
      i = i + 2
    else:
      break
  is_b = i == D

  return is_a, is_b


def move(s, i):
  if i + 1 < N and s[i + 1] == '.':
    return i + 1
  if i + 2 < N and s[i + 2] == '.':
    return i + 2

  return -1


def main():
  a = A
  b = B

  for _ in range(1000):
    s = get(a, b)
    is_a, is_b = is_reachable(s, a, b)
    #print(_, (is_a, is_b), s)
    if is_a and is_b:
      return True
    elif not is_a:
      b = move(s, b)
      if b < 0:
        return False
    elif not is_b:
      a = move(s, a)
      if a < 0:
        return False
    else:
      return False


print('Yes' if main() else 'No')

Fixed submission:
N, A, B, C, D = [int(i) - 1 for i in input().strip().split(' ')]
N += 1
S = [c for c in input().strip()]
S += '#'


def check(current, dest):
  i = current + 1
  while True:
    if i >= dest:
      return True
    elif S[i] == '.':
      i = i + 1
    elif S[i + 1] == '.':
      i = i + 2
    else:
      return False


def passable():
  i = B
  while True:
    if i > D:
      return False
    elif S[i - 1] == '.' and S[i] == '.' and S[i + 1] == '.':
      return True
    else:
      i = i + 1


def main():
  if D > C:
    return check(B, D) and check(A, C)
  else:
    return passable() and check(A, C)


print('Yes' if main() else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().strip().split(' ')]
A = [int(i) for i in input().strip().split(' ')]
for _ in range(M):
  b, c = [int(i) for i in input().strip().split(' ')]
  A.extend([c] * b)

A.sort()

print(sum(A[-N:]))

Fixed submission:
from operator import itemgetter

N, M = [int(i) for i in input().strip().split(' ')]
A = [int(i) for i in input().strip().split(' ')]
A = sorted(A, reverse=True)

X = []
for _ in range(M):
  (b, c) = [int(i) for i in input().strip().split(' ')]
  X.append((b, c))

X = sorted(X, reverse=True, key=itemgetter(1))
if M < N:
  for _ in range(N - M):
    X.append((0, 0))

v = 0
ai = 0
xi = 0

while N > 0:
  a = A[ai]
  n, x = X[xi]
  if a > x:
    N -= 1
    ai += 1
    v += a
  else:
    if n > N:
      n = N
    N -= n
    xi += 1
    v += x * n

print(v)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().strip().split(' ')]
A = [int(i) for i in input().strip().split(' ')]

for _ in range(M):
  b, c = [int(i) for i in input().strip().split(' ')]
  A.extend([c] * b)

A = sorted(A, reverse=True)

print(sum(A[:N]))

Fixed submission:
from operator import itemgetter

N, M = [int(i) for i in input().strip().split(' ')]
A = [int(i) for i in input().strip().split(' ')]
A = sorted(A, reverse=True)

X = []
for _ in range(M):
  (b, c) = [int(i) for i in input().strip().split(' ')]
  X.append((b, c))

X = sorted(X, reverse=True, key=itemgetter(1))
if M < N:
  for _ in range(N - M):
    X.append((0, 0))

v = 0
ai = 0
xi = 0

while N > 0:
  a = A[ai]
  n, x = X[xi]
  if a > x:
    N -= 1
    ai += 1
    v += a
  else:
    if n > N:
      n = N
    N -= n
    xi += 1
    v += x * n

print(v)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().strip().split(' ')]
A = [int(i) for i in input().strip().split(' ')]
A = sorted(A)
for _ in range(M):
  b, c = [int(i) for i in input().strip().split(' ')]
  for i in range(b):
    if A[i] > c:
      break
    A[i] = c
  A = sorted(A)

print(sum(A))

Fixed submission:
from operator import itemgetter

N, M = [int(i) for i in input().strip().split(' ')]
A = [int(i) for i in input().strip().split(' ')]
A = sorted(A, reverse=True)

X = []
for _ in range(M):
  (b, c) = [int(i) for i in input().strip().split(' ')]
  X.append((b, c))

X = sorted(X, reverse=True, key=itemgetter(1))
if M < N:
  for _ in range(N - M):
    X.append((0, 0))

v = 0
ai = 0
xi = 0

while N > 0:
  a = A[ai]
  n, x = X[xi]
  if a > x:
    N -= 1
    ai += 1
    v += a
  else:
    if n > N:
      n = N
    N -= n
    xi += 1
    v += x * n

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

A = {}
COLOR = [1] * N

for _ in range(N - 1):
  u, v, w = map(int, input().strip().split(' '))
  if u not in A: A[u] = {}
  if v not in A: A[v] = {}
  A[u][v] = w
  A[v][u] = w


def test(key, total_w=0):
  if key not in A:
    return

  COLOR[key - 1] = 0 if total_w % 2 == 0 else 1

  v = A.pop(key)
  for k, w in v.items():
    test(k, w + total_w)


test(1)

for c in COLOR:
  print(c)


Fixed submission:
from collections import deque

N = int(input())

A = {}
COLOR = [1] * N

for _ in range(N - 1):
  u, v, w = map(int, input().strip().split(' '))
  if u not in A: A[u] = {}
  if v not in A: A[v] = {}
  A[u][v] = w
  A[v][u] = w


def test(key, total_w=0):
  if key not in A:
    return

  COLOR[key - 1] = 0 if total_w % 2 == 0 else 1

  v = A.pop(key)
  for k, w in v.items():
    test(k, w + total_w)


queue = deque()
queue.append((1, 0))
current_key = 1

while len(queue) > 0:
  key, w = queue.popleft()
  if key not in A:
    continue

  COLOR[key - 1] = 0 if w % 2 == 0 else 1

  for child in A.pop(key).items():
    if child[0] in A:
      queue.append((child[0], w + child[1]))

for c in COLOR:
  print(c)

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

A = {}
B = []
C = [-1] * (N)

for _ in range(N - 1):
  u, v, w = map(int, input().strip().split(' '))
  if u not in A: A[u] = {}
  if v not in A: A[v] = {}

  for key, val in A[u].items():
    s = val + w
    A[v][key] = s
    A[key][v] = s
    if s % 2 == 1:
      B.append((v, key))

  for key, val in A[v].items():
    s = val + w
    A[u][key] = s
    A[key][u] = s
    if s % 2 == 1:
      B.append((u, key))

  A[u][v] = w
  A[v][u] = w
  if w % 2 == 1:
    B.append((u, v))

for k0, k1 in B:
  del A[k0][k1]
  del A[k1][k0]

k, v = A.popitem()
C[k - 1] = 0
for i in v.keys():
  C[i - 1] = 0
  del A[i]

for i in A.keys():
  C[i - 1] = 1

for i in C:
  print(i)

Fixed submission:
from collections import deque

N = int(input())

A = {}
COLOR = [1] * N

for _ in range(N - 1):
  u, v, w = map(int, input().strip().split(' '))
  if u not in A: A[u] = {}
  if v not in A: A[v] = {}
  A[u][v] = w
  A[v][u] = w


def test(key, total_w=0):
  if key not in A:
    return

  COLOR[key - 1] = 0 if total_w % 2 == 0 else 1

  v = A.pop(key)
  for k, w in v.items():
    test(k, w + total_w)


queue = deque()
queue.append((1, 0))
current_key = 1

while len(queue) > 0:
  key, w = queue.popleft()
  if key not in A:
    continue

  COLOR[key - 1] = 0 if w % 2 == 0 else 1

  for child in A.pop(key).items():
    if child[0] in A:
      queue.append((child[0], w + child[1]))

for c in COLOR:
  print(c)
Buggy python submission (verdict: Runtime Error):
 N= input()

flg= False#7が見つかっていない初期状態
for i in N:#Nの１文字目から判定
    if i == '7':
        flg=True#7が見つかった時点で終了
        break
if flg:
    print('Yes')
else:
    print('No')

Fixed submission:
N=input()

if N[0]=='7' or  N[1]=='7' or N[2]=='7':
    print('Yes')
else:
    print('No')

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

seven_count=0 #初期化
for i in N:#Nの１文字目から判定
    if i == '7':
        seven_count=seven_count + 1
        
if seven_count>=1:
    print("Yes")
else:
    print("No")

Fixed submission:
N=input()

if N[0]=='7' or  N[1]=='7' or N[2]=='7':
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
h,n = map(int,input().split())
i = list(map(int,input().split()))
ans = 0
for j in range(n):
    ans+=i[j]
    if ans >= h:
        print("Yes")
        exit()
print("No")

Fixed submission:
h,a = map(int,input().split())
ans = h//a
if h % a == 0:
    print(ans)
else:
    print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
for i in range(n):
    while tmp > abs(s-sum(a[:i+1])*2):
        tmp = abs(s-sum(a[:i+1])*2)
print(tmp)

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
t = 0
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
t = 0
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
for i in range(n+1):
    if tmp > abs(sum(a[:i])-sum(a[i:])):
        tmp = abs(sum(a[:i])-sum(a[i:]))
    else:
        print(tmp)
        exit()

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
t = 0
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
#TLE
import sys
n = int(input())
a = list(map(int, input().split()))
postCenter=dif=0
tmp = 2020202020
for i in range(n):
    if tmp > abs(sum(a[:i])-sum(a[i:])):
        tmp = abs(sum(a[:i])-sum(a[i:]))
        if tmp == 0:
            print(tmp)
            exit()
print(tmp)

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
t = 0
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = list(map(int, input().split()))
postCenter=dif=0
tmp = sys.maxsize
for i in range(n):
    if tmp > abs(sum(a[:i])-sum(a[i:])):
        tmp = abs(sum(a[:i])-sum(a[i:]))
        if tmp == 0:
            print(tmp)
            exit()
print(tmp)

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
t = 0
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = list(map(int, input().split()))
postCenter=dif=0
tmp = sys.maxsize
for i in range(n):
    if tmp > abs(sum(a[:i])-sum(a[i:])):
        tmp = abs(sum(a[:i])-sum(a[i:]))
print(int(tmp))

Fixed submission:
import sys
n = int(input())
a = list(map(int, input().split()))
tmp=sys.maxsize
s = sum(a)
t = 0
for i in range(n):
    t += a[i]
    tmp = min(tmp,abs(s-t*2))
print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())#nは品物の数　mは割引券の数
a = sorted(list(map(int,input().split())),reverse = True)#値段一覧
for i in range(m):
    if len(a) == 1:
        a[0] = a[0]//2
        if a[0] == 0:
            print(a[0])
            exit()
    elif a[0] >= a[1]:
        a[0] = a[0]//2
        a.sort(reverse = True)
print(sum(a))

Fixed submission:
import heapq
n,m = map(int,input().split())#nは品物の数　mは割引券の数
a = sorted(list(map(int,input().split())),reverse = True)#値段一覧
a = list(map(lambda x: x*(-1), a))  
heapq.heapify(a)#リストを優先度付きキューへ入れる
highest = 0
ans = []
for i in range(m):
    highest = heapq.heappop(a)*(-1)#heappopでとりだし　heappop(リスト名)*(リストのインデックス)本来最小値を取り出すものである
    heapq.heappush(a,highest//2*(-1))#引数(挿入先リスト名,挿入する数値)
print(sum(a)*-1)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())#nは品物の数　mは割引券の数
a = sorted(list(map(int,input().split())),reverse = True)#値段一覧
for i in range(m):
    if a[0] >= a[1]:
        a[0] = a[0]//2
        a.sort(reverse = True)
print(sum(a))

Fixed submission:
import heapq
n,m = map(int,input().split())#nは品物の数　mは割引券の数
a = sorted(list(map(int,input().split())),reverse = True)#値段一覧
a = list(map(lambda x: x*(-1), a))  
heapq.heapify(a)#リストを優先度付きキューへ入れる
highest = 0
ans = []
for i in range(m):
    highest = heapq.heappop(a)*(-1)#heappopでとりだし　heappop(リスト名)*(リストのインデックス)本来最小値を取り出すものである
    heapq.heappush(a,highest//2*(-1))#引数(挿入先リスト名,挿入する数値)
print(sum(a)*-1)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(input().split())
print(n*a if n*a<b else b)

Fixed submission:
n,a,b = map(int,input().split())
print(n*a if n*a<b else b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dic ={0:n,1:0,2:0,3:0,4:0,5:0}
time =0
if n == 10000000007:
    print(5000000008)
    exit()
while sum(dic)>0:
    if dic[5] == n:
        print(time)
        exit()
    if dic[4] > e:
        dic[4] -= e
        dic[5] += e
    else:
        dic[5] += dic[4]
        dic[4] = 0
    
    if dic[3] > d:
        dic[3] -= d
        dic[4] += d
    else:
        dic[4] += dic[3]
        dic[3] = 0
    
    if dic[2] > c:
        dic[2] -= c
        dic[3] += c
    else:
        dic[3] += dic[2]
        dic[2] = 0
    
    if dic[1] > b:
        dic[1] -= b
        dic[2] += b
    else:
        dic[2] += dic[1]
        dic[1] = 0
    
    if dic[0] > a:
        dic[0] -= a
        dic[1] += a
    else:
        dic[1] += dic[0]
        dic[0] = 0
    time += 1

Fixed submission:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time =0
amin = min(a,b,c,d,e)
time=(n//amin+1 if n%amin != 0 else n/amin)+4
print(int(time))
Buggy python submission (verdict: Runtime Error):
x = input

for i in range(3)
	if x[i] == '7'
  		print("Yes")
    else
    	print("No")



Fixed submission:
s = input()

for c in s:
	if '7' in s:
		print("Yes")
		break
	else:
		print("No")
		break
Buggy python submission (verdict: Runtime Error):
n,x,y=map(int, input().split())

ans=[0]*n-1

for i in range(n):
    for j in range(n):
        ans[min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))]+=1

for a in ans:
    print(a)

Fixed submission:
n,x,y=map(int, input().split())

ans=[0]*(n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        d=min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        #print(i,j,d)
        ans[d-1]+=1

for a in ans:
    print(a)

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

ans=[0]*(n-1)

def func2(np, nd, state):
    #print(np, nd, state)
    nxp=[]
    for p in np:
        if p > 0 and not state[p-1]:
            nxp.append(p-1)
            ans[nd]+=1
        if p < n-1 and not state[p+1]:
            nxp.append(p+1)
            ans[nd]+=1
        if p == x-1 and not state[y-1]:
            nxp.append(y-1)
            ans[nd]+=1
        if p == y-1 and not state[x-1]:
            nxp.append(x-1)
            ans[nd]+=1
#    if nd == 1:
#        print(nd, nxp)

    nxp=list(set(nxp))
    for i in nxp:
        state[i]=True
    if len(nxp) == 0:
        return
    else:
        func2(nxp, nd+1, state)

for i in range(n):
    st=[False]*n
    st[i]=True
    func2([i], 0, st)

for i in ans:
    print(i//2)


Fixed submission:
n,x,y=map(int, input().split())

ans=[0]*(n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        d=min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        #print(i,j,d)
        ans[d-1]+=1

for a in ans:
    print(a)

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

ans=[0]*n

def func2(np, nd, state):
    #print(np, nd, state)
    nxp=[]
    for p in np:
        if p > 0 and not state[p-1]:
            nxp.append(p-1)
            ans[nd]+=1
        if p < n-1 and not state[p+1]:
            nxp.append(p+1)
            ans[nd]+=1
        if p == x-1 and not state[y-1]:
            nxp.append(y-1)
            ans[nd]+=1
        if p == y-1 and not state[x-1]:
            nxp.append(x-1)
            ans[nd]+=1
#    if nd == 1:
#        print(nd, nxp)

    nxp=list(set(nxp))
    for i in nxp:
        state[i]=True
    if len(nxp) == 0:
        return
    else:
        func2(nxp, nd+1, state)

for i in range(n):
    st=[False]*n
    st[i]=True
    func2([i], 0, st)

for i in ans:
    print(i//2)


Fixed submission:
n,x,y=map(int, input().split())

ans=[0]*(n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        d=min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        #print(i,j,d)
        ans[d-1]+=1

for a in ans:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod



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

fn=2*10**5
fac=[0]*fn
fac[1]=n
for i in range(2,fn):
    fac[i]=fac[i-1]*(n-i+1)*power(i, mo-2, mo) % mo

print((power(2, n, mo)-1-fac[a]-fac[b])%mo)

Fixed submission:
import time
from math import factorial

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

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

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

fn=2*10**5
fac=[0]*fn
fac[1]=n

print((power(2, n, mo)-1-comb(n,a,mo)-comb(n,b,mo))%mo)
Buggy python submission (verdict: Runtime Error):
import bisect
s=input()
t=input()
dic={}
for v in s:
    dic[v]=True

for u in s:
    if not dic[u]:
        print(-1)
        exit()

nex={}
for i, v in enumerate(s+s):
    if not v in nex:
        nex[v]=[i]
    else:
        nex[v].append(i)
#print(s)
#print(t)
#print(nex)
sl=len(s)
tl=len(t)
def func(st, tn, su):
    #print(st, tn, su)
    if tn == tl:
        return su 
    ind=bisect.bisect_left(nex[t[tn]] ,st)
    nm=(nex[t[tn]][ind]-st)
    return func((st+nm)%sl, tn+1, su+nm)


res=func(-1, 0, 0)

print(res)

Fixed submission:
import bisect
import sys

sys.setrecursionlimit(1000000)

s=input()
t=input()
dic={}
for v in s:
    dic[v]=True

for u in t:
    if not u in dic:
        print(-1)
        exit()

nex={}
for i, v in enumerate(s+s):
    if not v in nex:
        nex[v]=[i]
    else:
        nex[v].append(i)
#print(s)
#print(t)
#print(nex)
sl=len(s)
tl=len(t)
def func(st, tn, su):
    if tn == tl:
        return su
    #print(st, tn, su, t[tn])
    ind=bisect.bisect_left(nex[t[tn]] ,st+1)
    nm=(nex[t[tn]][ind]-st)
    return func((st+nm)%sl, tn+1, su+nm)


res=func(-1, 0, 0)

print(res)
Buggy python submission (verdict: Runtime Error):
import math

l,r=map(int, input().split())

if r-l > 2019:
    s=list(range(0, 2019))
else:
    s=set()
    for i in range(l, r+1):
        s.add(i%2019)
    s=list(s)

ans=math.inf
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)


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

if r-l > 2019:
    s=list(range(0, 2019))
else:
    s=set()
    for i in range(l, r+1):
        s.add(i%2019)
    s=list(s)

ans=float('inf')
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

l,r=map(int, input().split())
s=set()
for i in range(l+1, r):
    s.add(i%2019)
s=list(s)

ans=math.inf
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)


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

if r-l > 2019:
    s=list(range(0, 2019))
else:
    s=set()
    for i in range(l, r+1):
        s.add(i%2019)
    s=list(s)

ans=float('inf')
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
r=[0]*n

# 平滑化
for i in range(n):
    a1,a2,a3=a[i-1], a[i], a[(i+1)%n]
    if a2 > a1:
        r[i+1]+=(a2-a1)*2
        a[i]-=(a2-a1)
        a[i+1]-=(a2-a1)
    if a2 > a3:
        r[i]+=(a2-a3)*2
        a[i]-=(a2-a3)
        a[i-1]-=(a2-a3)

b=max(a)
print(" ".join(list(map(lambda x: str(x+b), r))))

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
r=[0]*n

while max(a) != min(a):
    for i in range(n):
        a1,a2,a3=a[i-1], a[i], a[(i+1)%n]
        if a2 > a1:
            val=min(a3, a2-a1)
            r[(i+1)%n]+=val*2
            a[i]-=val
            a[(i+1)%n]-=val
        if a2 > a3:
            val=min(a1, a2-a3)
            r[i]+=val*2
            a[i]-=val
            a[i-1]-=val

    for i in range(n)[::-1]:
        a1,a2,a3=a[i-1], a[i], a[(i+1)%n]
        if a2 > a1:
            val=min(a3, a2-a1)
            r[(i+1)%n]+=val*2
            a[i]-=val
            a[(i+1)%n]-=val
        if a2 > a3:
            val=min(a1, a2-a3)
            r[i]+=val*2
            a[i]-=val
            a[i-1]-=val

b=max(a)
print(" ".join(list(map(lambda x: str(x+b), r))))