Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)
def lcm_list(l):
    return reduce(lcm, l, 1)

n = int(input())
a = list(map(int, input().split()))
f = 0
for j in range(n):
    f += (lcm_list(a) - 1) % a[j]
print(f)


Fixed submission:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
f = 0
ans = np.cumsum(a) - n
print(ans[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(10 ** 8 // n):
    f = 0
    for j in range(n):
        f += i % a[j]
    print(f)
    ans.append(f)
print(max(ans))


Fixed submission:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
f = 0
ans = np.cumsum(a) - n
print(ans[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(10 ** 9 // n):
    f = 0
    for j in range(n):
        f += i % a[j]
    print(f)
    ans.append(f)
print(max(ans))


Fixed submission:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
f = 0
ans = np.cumsum(a) - n
print(ans[-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
memo = [-1] * (n + 1)
def dp(n):
    if n == 0:
        return 0
    if memo[n] != -1:
        return memo[n]
    res = n
    for i in range(7):
        if n >= 6 ** i:
            res = min(res, dp(n - 6 ** i) + 1)
    for j in range(6):
        if n >= 9 ** j:
            res = min(res, dp(n - 9 ** j) + 1)
    memo[n] = res
    return memo[n]

print(dp(n))

Fixed submission:
n = int(input())
dp = [n] * (n + 1)
dp[0] = 0
a = [1, 6**1, 6**2, 6**3, 6**4, 6**5, 6**6, 9**1, 9**2, 9**3, 9**4, 9**5]
for i in range(1, n + 1):
    for j in a:
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + 1)
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
n = len(s)
dic = []
for i in range(1, n + 1):
    for j in range(0, n - i + 1):
        if s[j:j+i] not in dic:
            dic.append(s[j:j+i])
dic.sort()
print(dic[k-1])


Fixed submission:
s = input()
k = int(input())
n = len(s)
dic = []
for i in range(n):
    for j in range(1, k + 1):
        if i + j > n:
            break
        if s[i:i+j] not in dic:
            dic.append(s[i:i+j])
dic.sort()
print(dic[k-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a + c, a + s, b + c, b + d))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a + c, a + d, b + c, b + d))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
Count = 0
while(1):
    count = 0
    for i in range(n):
        if a[i] % 2 == 0:
            count += 1
    if count != n:
        break
    for i in range(n):
        a[i] /= 2
    Count += 1
print(Count)


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

comb = []
count = 0

for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
                comb.append([i, j, k])
for i in range(len(comb)):
    if (x == 500*comb[i][0] + 100*comb[i][1] + 50*comb[i][2]) and \
        (a >= comb[i][0]) and (b >= comb[i][1]) and (c >= comb[i][2]):
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input())
if a + b == c + d:
    print('Balanced')
elif a + b < c + d:
    print('Right')
else:
    print('Left')


Fixed submission:
a, b, c, d = map(int, input().split())
if a + b == c + d:
    print('Balanced')
elif a + b < c + d:
    print('Right')
else:
    print('Left')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
c = Counter(a)
if len(c.keys()) <= k:
    print(0)
    exit()
else:
    ans = 0
    lis = list(c.values())
    lis.sort()
    while(len(lis) > k):
        ans += lis.pop(0)
print(ans)


Fixed submission:
from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
c = Counter(a)
if len(c.keys()) <= k:
    print(0)
    exit()
else:
    ans = 0
    lis = list(c.values())
    lis.sort()
    l = len(lis) - k
    for i in range(l):
        ans += lis[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x == y:
    print('=')
elif x > y:
    print('>')
else:
    print('<')

Fixed submission:
x, y = map(str, input().split())
if x == y:
    print('=')
elif x > y:
    print('>')
else:
    print('<')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
def isOK(idx: int, key: int, lis: list) -> bool:
    if lis[idx] >= key:
        return True
    else:
        return False

def binary_search(key: int, lis: list) -> int:
    left = -1
    right = len(lis)
    while(right - left > 1):
        mid = left + (right - left) // 2
        if isOK(mid, key, lis):
            right = mid
        else:
            left = mid
    return left
ans = 0
for i in c:
    k = binary_search(i, b)
    for j in range(k + 1):
        l = binary_search(b[j], a)
        ans += l + 1
print(ans)


Fixed submission:
import bisect

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

ans = 0
for i in b:
    k = bisect.bisect_left(a, i)
    l = bisect.bisect_right(c, i)
    ans += k * (n - l)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
ans = []
for ai in range(31):
    bb = (f - (ai * a * 100)) // b
    for bi in range(bb):
        if ai == bi == 0:
        continue
        cc = (f - (ai * a * 100 + bi * b * 100)) // c
        for ci in range(cc):
            dd = (f - (ai * a * 100 + bi * b * 100 + ci * c)) // d
            for di in range(dd):
                if 100 * a * ai + 100 * b * bi + c * ci + d * di <= f:
                    if (c * ci + d * di)/(100 * a * ai + 100 * b * bi) <= e/100:
                        ans.append([(c * ci + d * di)/(100 * a * ai + 100 * b * bi + c * ci + d * di), 100 * a * ai + 100 * b * bi + c * ci + d * di, c * ci + d * di])
ans.sort(reverse=True)
print(ans[0][1], ans[0][2])

Fixed submission:
a, b, c, d, e, f = map(int, input().split())
ans = []
for ai in range(31):
    bb = (f - (ai * a * 100)) // b
    for bi in range(bb + 1):
        if ai == bi == 0:
            continue
        cc = (f - (ai * a * 100 + bi * b * 100)) // c
        for ci in range(cc + 1):
            dd = (f - (ai * a * 100 + bi * b * 100 + ci * c)) // d
            for di in range(dd + 1):
                if 100 * a * ai + 100 * b * bi + c * ci + d * di <= f:
                    if (c * ci + d * di)/(100 * a * ai + 100 * b * bi) <= e/100:
                        ans.append([(c * ci + d * di)/(100 * a * ai + 100 * b * bi + c * ci + d * di), 100 * a * ai + 100 * b * bi + c * ci + d * di, c * ci + d * di])
ans.sort(reverse=True)
print(ans[0][1], ans[0][2])

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d, e, f = map(int, input().split())
lisw = []
liss = []
ans = []
cc = f // c
dd = f // d
for ai in range(31):
    for bi in range(31):
        for ci in range(cc):
            for di in range(dd):
                if ai == bi == 0:
                        continue
                if 100 * a * ai + 100 * b * bi + c * ci + d * di <= f:
                    if (c * ci + d * di)/(100 * a * ai + 100 * b * bi) <= e/100:
                        ans.append([(c * ci + d * di)/(100 * a * ai + 100 * b * bi + c * ci + d * di), 100 * a * ai + 100 * b * bi + c * ci + d * di, c * ci + d * di])
ans.sort(reverse=True)
print(ans[0][1], ans[0][2])

Fixed submission:
a, b, c, d, e, f = map(int, input().split())
ans = []
for ai in range(31):
    bb = (f - (ai * a * 100)) // b
    for bi in range(bb + 1):
        if ai == bi == 0:
            continue
        cc = (f - (ai * a * 100 + bi * b * 100)) // c
        for ci in range(cc + 1):
            dd = (f - (ai * a * 100 + bi * b * 100 + ci * c)) // d
            for di in range(dd + 1):
                if 100 * a * ai + 100 * b * bi + c * ci + d * di <= f:
                    if (c * ci + d * di)/(100 * a * ai + 100 * b * bi) <= e/100:
                        ans.append([(c * ci + d * di)/(100 * a * ai + 100 * b * bi + c * ci + d * di), 100 * a * ai + 100 * b * bi + c * ci + d * di, c * ci + d * di])
ans.sort(reverse=True)
print(ans[0][1], ans[0][2])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()

a = []
for i in range(n):
    tmp = ni()
    if tmp in a:
        a.pop(a.index(tmp))
    else:
        a.append(tmp)
print(len(a))


Fixed submission:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()

a = [ni() for _ in range(n)]
c = collections.Counter(a).values()
ans = 0
for t in c:
    if t % 2 != 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = ni()
t = ni()
if n == 1:
    print(t)
else:
    for i in range(n - 1):
        tmp = ni()
        t = lcm(t, tmp)
    print(t)


Fixed submission:
import sys
import fractions
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n = ni()
t = ni()
if n == 1:
    print(t)
else:
    for i in range(n - 1):
        tmp = ni()
        t = lcm(t, tmp)
    print(t)
Buggy python submission (verdict: Runtime Error):
import sys
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()

a = [ni() for _ in range(n)]
count = 0
nexti = 0
for i in range(n):
    if nexti == 1:
        print(count)
        exit()
    else:
        nexti = a[a[nexti] - 1]
        count += 1
print(-1)

Fixed submission:
import sys
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()

a = [ni() for _ in range(n)]
count = 0
nexti = 0
for i in range(n):
    if nexti == 1:
        print(count)
        exit()
    else:
        nexti = a[nexti] - 1
        count += 1
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
sys.setrecursionlimit(100000)
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
memo = [-1 for i in range(max(n, m) + 1)]
mod = 10 ** 9 + 7

for i in range(1, max(n, m) + 1):
    if memo[i] != -1:
        continue
    elif i == 1:
        memo[i] = 1
    else:
        memo[i] = i * memo[i - 1]

if abs(n - m) >= 2:
    print(0)
else:
    nn = memo[n] % mod
    mm = memo[m] % mod
    if n == m:
        print(2 * nn * mm % mod)
    else:
        print(nn * mm % mod)


Fixed submission:
import sys
import collections
sys.setrecursionlimit(100000)
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
memo = [1 for _ in range(max(n, m) + 1)]
mod = 10 ** 9 + 7

for i in range(1, max(n, m) + 1):
    memo[i] = memo[i - 1] * i % mod

if abs(n - m) >= 2:
    print(0)
else:
    nn = memo[n] % mod
    mm = memo[m] % mod
    if n == m:
        print(2 * nn * mm % mod)
    else:
        print(nn * mm % mod)

Buggy python submission (verdict: Runtime Error):
import sys
import collections
sys.setrecursionlimit(100000)
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
memo = [-1 for i in range(max(n, m) + 1)]
mod = 10 ** 9 + 7

def fact(k):
    if memo[k] != -1:
        return memo[k]
    elif k == 1:
        memo[1] = 1
        return memo[1]
    else:
        memo[k] = k * fact(k - 1)
        return memo[k]

if abs(n - m) >= 2:
    print(0)
else:
    nn = fact(n) % mod
    mm = fact(m) % mod
    if n == m:
        print(2 * nn * mm % mod)
    else:
        print(nn * mm % mod)


Fixed submission:
import sys
import collections
sys.setrecursionlimit(100000)
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
memo = [1 for _ in range(max(n, m) + 1)]
mod = 10 ** 9 + 7

for i in range(1, max(n, m) + 1):
    memo[i] = memo[i - 1] * i % mod

if abs(n - m) >= 2:
    print(0)
else:
    nn = memo[n] % mod
    mm = memo[m] % mod
    if n == m:
        print(2 * nn * mm % mod)
    else:
        print(nn * mm % mod)
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if a == b:
  print('H')
else:
  print('D')

Fixed submission:
a, b = map(str, input().split())
if a == b:
  print('H')
else:
  print('D')
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
A = []
B = []
for i in range(n):
    A.append([input()])
for i in range(m):
    B.append([input()])
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 2):
    for i in range(n - m + 2):
        if A[j][i: i + m] == B[0][:]:
            for k in range(m):
                if A[j + k][i: i + m] == B[k][:]:
                    flag = 1
                    continue
                flag = 0
                break
            if flag == 1:
                print('Yes')
                exit(0)
print('No')


Fixed submission:
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 1):
    for i in range(n - m + 1):
        flag = 1
        for k in range(m):
            if A[j + k][i: i + m] != B[k]:
                flag = 0
                break
        if flag == 1:
            print('Yes')
            exit(0)
print('No')

Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
A = []
B = []
for i in range(n):
    A.append([input()])
for i in range(m):
    B.append([input()])
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 1):
    for i in range(n - m + 1):
        if A[j][i:] == B[j][:]:
            for k in range(m - 1):
                if A[j + k][i:] == B[j + k][:]:
                    flag = 1
                    continue
                flag = 0
                break
            if flag == 1:
                print('Yes')
                exit(0)
print('No')


Fixed submission:
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 1):
    for i in range(n - m + 1):
        flag = 1
        for k in range(m):
            if A[j + k][i: i + m] != B[k]:
                flag = 0
                break
        if flag == 1:
            print('Yes')
            exit(0)
print('No')
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
for i in range(len(s) - 1):
    for j in range(i + 1, len(s)):
        if s[i] == 'A' and s[j] == 'Z':
            ans = max(ans, j - i + 1)
print(ans)


Fixed submission:
s = input()
ansi = 0
ansj = 0
for i in range(len(s)):
    if s[i] == 'A':
        ansi = i
        break
for j in range(len(s)-1, -1, -1):
    if s[j] == 'Z':
        ansj = j
        break
print(j - i + 1)
Buggy python submission (verdict: Runtime Error):
s = input()$
s = s.replace(',', ' ')$
print(s)

Fixed submission:
s = input()
s = s.replace(',', ' ')
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i + 1):
        for l in range(j + 1):
            if i + j + l == s:
                if i == j == l:
                    ans += 1
                elif i == j or j == l or l == i:
                    ans += 3
                else:
                    ans += 6
print(ans)


Fixed submission:
k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i + 1):
        l = s - (i + j)
        if 0 <= l <= k and l <= j <= i:
            if i == j == l:
                ans += 1
            elif i == j or j == l or l == i:
                ans += 3
            else:
                ans += 6
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(k + 1):
        for l in range(k + 1):
            if i + j + l == s:
                ans += 1
print(ans)


Fixed submission:
k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i + 1):
        l = s - (i + j)
        if 0 <= l <= k and l <= j <= i:
            if i == j == l:
                ans += 1
            elif i == j or j == l or l == i:
                ans += 3
            else:
                ans += 6
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = 0
r = [0 for i in range(n)]
g = [0 for i in range(n)]
b = [0 for i in range(n)]
for i in range(n):
    if s[i] == "R":
        r[i] += 1
    elif s[i] == "G":
        g[i] += 1
    else:
        b[i] += 1
    if i > 0:
        r[i] += r[i-1]
        g[i] += g[i-1]
        b[i] += b[i-1]
ju = [0,0,0]
ju2 = ["R","G","B"]
for i in range(n-2):
    for j in range(3):
        if s[i] == ju2[j]:
            ju[j] += 1
    for j in range(i+1,n-1):
        #print(ans)
        for k in range(3):
            if s[j] == ju2[k]:
                ju[k] += 1
                key = k
        if ju[key] == 1:
            if ju[0] == 0:
                ans += r[n-1] - r[j]
                if j + (j-i) < n:
                    if r[j+(j-i)] > r[j+(j-i)-1]:
                        ans -= 1
            
            elif ju[1] == 0:
                ans += g[n-1] - g[j]
                if j + (j-i) < n:
                    if g[j+(j-i)] > g[j+(j-i)-1]:
                        ans -= 1
            else:
                ans += b[n-1] - b[j]
                if j + (j-i) < n:
                    if b[j+(j-i)] > b[j+(j-i)-1]:
                        ans -= 1
        ju[key] -= 1
    ju = [0,0,0]
print(ans)
            

Fixed submission:
n = int(input())
s = list(input())
ans = 0
r = [0 for i in range(n)]
g = [0 for i in range(n)]
b = [0 for i in range(n)]
for i in range(n):
    if s[i] == "R":
        r[i] += 1
    elif s[i] == "G":
        g[i] += 1
    else:
        b[i] += 1
    if i > 0:
        r[i] += r[i-1]
        g[i] += g[i-1]
        b[i] += b[i-1]
ju = [0,0,0]
ju2 = ["R","G","B"]
for i in range(n-2):
    for j in range(3):
        if s[i] == ju2[j]:
            ju[j] += 1
    for j in range(i+1,n-1):
        #print(ans)
        for k in range(3):
            if s[j] == ju2[k]:
                ju[k] += 1
                key = k
        if ju[key] == 1:
            if ju[0] == 0:
                ans += r[n-1] - r[j]
                if j + (j-i) < n:
                    if r[j+(j-i)] > r[j+(j-i)-1]:
                        ans -= 1
            
            elif ju[1] == 0:
                ans += g[n-1] - g[j]
                if j + (j-i) < n:
                    if g[j+(j-i)] > g[j+(j-i)-1]:
                        ans -= 1
            else:
                ans += b[n-1] - b[j]
                if j + (j-i) < n:
                    if b[j+(j-i)] > b[j+(j-i)-1]:
                        ans -= 1
        ju[key] -= 1
    ju = [0,0,0]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n,s = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
rui = []
now = 0
pl = []
for i in range(n):
    now += a[i]
    rui.append(now)
l = [[0 for i in range(s)] for i in range(n)]
ans = 0
for i in range(n):
    if a[i] < s:
        l[i][a[i]] += i+1
    elif a[i] == s:
        ans += i*(n-i-1)
        ans += n
        ans %= mod
    for j in range(s):
        if i > 0:
            if l[i-1][j] > 0:
                if j+a[i] < s:
                    l[i][j+a[i]] += l[i-1][j]
                elif j+a[i] == s:
                    ans += l[i-1][j]*(n-i)
                    ans %= mod
                l[i][j] += l[i-1][j]
print(ans)

Fixed submission:
n,s = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
rui = []
now = 0
pl = []
for i in range(n):
    now += a[i]
    rui.append(now)
l = [[0 for i in range(s)] for i in range(n)]
ans = 0
for i in range(n):
    if a[i] < s:
        l[i][a[i]] += i+1
        l[i][a[i]] %= mod
    elif a[i] == s:
        ans += i*(n-i-1)
        ans += n
        ans %= mod
    for j in range(s):
        if i > 0:
            if l[i-1][j] > 0:
                if j+a[i] < s:
                    l[i][j+a[i]] += l[i-1][j]
                    l[i][j+a[i]] %= mod
                elif j+a[i] == s:
                    ans += l[i-1][j]*(n-i)
                    ans %= mod
                l[i][j] += l[i-1][j]
                l[i][j] %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n,a,b = map(int,input().split())
mod = 10**9+7
p = comb(n,a,mod)
q = comb(n,b,mod)
c = 1
k = 2
ans = 1
while n > 0:
    if n % (c*2) == c:
        n -= c
        ans *= k
        ans %= mod
    c *= 2
    k = k*k
    k %= mod
print((ans-p-q-1)%mod)

Fixed submission:
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n,a,b = map(int,input().split())
mod = 10**9+7
p = comb(n,a,mod)
q = comb(n,b,mod)
c = 1
k = 2
ans = 1
while n > 0:
    if n % (c*2) == c:
        n -= c
        ans *= k
        ans %= mod
    c *= 2
    k = k*k
    k %= mod
print((ans-p-q-1)%mod)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
l = []
count = 0
for i in range(n):
    count += (p[i]+1)/2
    l.append(count)
ansl = []
for i in range(n-k):
    ansl.append(l[i+k]-l[i])
print(max(ansl))

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
l = []
count = 0
for i in range(n):
    count += (p[i]+1)/2
    l.append(count)
ansl = []
for i in range(n-k):
    ansl.append(l[i+k]-l[i])
if n == k:
    ansl.append(l[n-1])
print(max(ansl))