Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

number = [i for i in range(1, K+1)]
comb = list(product(number, repeat=3))

amount = 0
for a, b, c in comb:
    if a <= b <= c:
        if a == b and b == c:
            amount += a
        elif a == b or b == c:
            count = gcd(a, c)
            amount += count * 3
        else:
            a_k, b_k, c_k = a, b, c
            count = gcd(a, b, c)
            amount += count * 6

print(amount)

Fixed submission:
from itertools import combinations, product
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

amount = 0
for a in range(1, K+1):
    for b in range(a, K+1):
        for c in range(b, K+1):
            count = gcd(a, b, c)
            if a == b and b == c:
                amount += count
            elif a == b or b == c:
                amount += count * 3
            else:
                amount += count * 6
print(amount)
Buggy python submission (verdict: Runtime Error):
S = input()
Q = int(input())
Q_list = list()
for i in range(Q):
    Q_list.append(input().split())

from collections import deque
def operate(i):
    global count, str_list
    if Q_list[i][0] == '1':
        count += 1
    else:
        if count % 2 == 0:
            if Q_list[i][1] == '1':
                str_list.appendleft(Q_list[i][2])
            else:
                str_list.append(Q_list[i][2])
        else:
            if Q_list[i][1] == '1':
                str_list.append(Q_list[i][2])
            else:
                str_list.appendleft(Q_list[i][2])

check = 0
for i in range(Q):
    if Q_list[i][0] == '1':
        check += 1

if check % 2 == 1:
    S_list = list(reversed(S_list))

str_list = deque()
str_list.append(S)
count = check%2
for i in range(Q):
    operate(i)
print(''.join(str_list))


Fixed submission:
S = list(i for i in input())

if 'A' in S and 'B' in S:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
X = list(map(int, input().split()))

def sutamina(P, X):
    return (X-P)**2
  
sutamina_min = math.inf
for i in range(100):
    sutamina_souwa = 0
    for k in X:
        sutamina_souwa += sutamina(i, k)
    if sutamina_souwa < sutamina_min:
        sutamina_min = sutamina_souwa

print(sutamina_min)

Fixed submission:
import math
N = int(input())
X = list(map(int, input().split()))
 
def sutamina(P, X):
    return (X-P)**2
  
sutamina_min = float('inf')
for i in range(100):
    sutamina_souwa = 0
    for k in X:
        sutamina_souwa += sutamina(i, k)
    if sutamina_souwa < sutamina_min:
        sutamina_min = sutamina_souwa

print(sutamina_min)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
pi = list(map(int, input().split()))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
EX_max = 0
for i in range(max_index, max_index+K):
  EX_max += 1+(pi[i]-1)*0.5
print(EX_max)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A) +' '+ str(B))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
pi = list(map(int, input().split()))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
EX_max = 0
for i in range(max_index, max_index+K):
  EX_max += 1+(pi[i]-1)*0.5
print(EX_max)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A) +' '+ str(B))

Buggy python submission (verdict: Runtime Error):
import numpy as np
def Expected_Value(x):
    EV = 0
    for i in range(1,x+1):
        EV += i/x
    return EV
N, K = map(int, input().split())
pi = np.array(list(map(int, input().split())))
ma = 0
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    if x > ma:
        ma = x
        max_index = i
array_max = (np.array(pi[max_index:max_index+K])-1) *0.5 + 1
print(array_max.sum())

Fixed submission:
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A) +' '+ str(B))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
pi = list(map(int, input().split()))
K_sum = []
for i in range(N-K+1):
    K_sum.append(sum(pi[i:i+K])) 
index = K_sum.index(max(K_sum))
array_max = (np.array(pi[index:index+K])-1) *0.5 + 1
print(array_max.sum())

Fixed submission:
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A) +' '+ str(B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ai = list(map(int, input().split()))
Distinct = 0
for x in range(N-1):
    if Ai[x] in Ai[x+1:]:
        Distinct += 1

if Distinct == 0:
    print('YES')

else:
    print('NO')

Fixed submission:
N = int(input())
Ai = list(map(int, input().split()))
Ai_set = set(Ai)
if len(Ai) - len(Ai_set) == 0:
    print('YES')

else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
magic = list()
for _ in range(N):
    magic.append(list(map(int, input().split())))
 
magic_min = [0 for _ in range(H+1)]
for i in range(H+1):
    if i != 0 and magic_min[i] == 0:
        continue
    for A, B in magic:
        Index = i + A
        value = magic_min[i] + B
        try:
            if magic_min[Index] == 0:
                magic_min[Index] = value
            elif value < magic_min[Index]:
                magic_min[Index] = value
        
        except:
            if magic_min[-1] == 0:
                magic_min[-1] = value
            elif value < magic_min[-1]:
                magic_min[-1] = value
                
print(magic_min[-1])

Fixed submission:
H,A = map(int,input().split())
if H%A == 0:
    count = H//A
else:
    count = H//A + 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())
magic = list()
for _ in range(N):
    magic.append(list(map(int, input().split())))

magic_min = [0 for _ in range(H+1)]
for i in range(H+1):
    if i != 0 and magic_min[i] == 0:
        continue
    for A, B in magic:
        Index = i + A
        value = magic_min[i] + B
        try:
            if magic_min[Index] == 0:
                magic_min[Index] = value
            elif value < magic_min[Index]:
                magic_min[Index] = value
        
        except:
            if magic_min[-1] == 0:
                magic_min[-1] = value
            elif value < magic_min[-1]:
                magic_min[-1] = value
                
print(magic_min[-1])

Fixed submission:
H, N = map(int, input().split())
magic = list()
for _ in range(N):
    magic.append(list(map(int, input().split())))
 
magic_min = [0 for _ in range(H+1)]
for i in range(H+1):
    if i != 0 and magic_min[i] == 0:
        continue
    for A, B in magic:
        Index = i + A
        value = magic_min[i] + B
        try:
            if magic_min[Index] == 0:
                magic_min[Index] = value
            elif value < magic_min[Index]:
                magic_min[Index] = value
        
        except:
            if magic_min[-1] == 0:
                magic_min[-1] = value
            elif value < magic_min[-1]:
                magic_min[-1] = value
                
print(magic_min[-1])
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

S = []
for e in sys.stdin:
    S.append(e.rstrip())

H, M = map(int, S[0].split())

meiro = []
for i in range(H):
    meiro.append([])
    for k in S[i + 1]:
        if k == '.':
            meiro[i].append(1)
        else:
            meiro[i].append(0)
meiro_array = np.array(meiro)
susumikata = [[1, 0], [-1, 0], [0, 1], [0, -1]]


def BFS(y, x):
    global max_distance
    if meiro_array[x, y] == 1:
        max_distance = 0
        reached = {(x, y): 0}
        for i in range(H * M):
            zahyous = [k for k, v in reached.items() if v == i]
            for zahyou in zahyous:
                for susumi in susumikata:
                    new_zahyou = tuple([zahyou[0] + susumi[0], zahyou[1] + susumi[1]])
                    if not(0 <= new_zahyou[0] < H and 0 <= new_zahyou[1] < M):
                        a = 0
                    elif new_zahyou not in reached.keys() and meiro_array[new_zahyou] == 1:
                        reached[new_zahyou] = i + 1
                        max_distance = i + 1

    return max_distance


keiro_max = []
for x in range(H):
    for y in range(M):
        keiro_max.append(BFS(x, y))

print(max(keiro_max))


Fixed submission:
C = input()

Alphabet = 'abcdefghijklmnopqrstuvwxyz'
Alphabet_list = [i for i in Alphabet]
print(Alphabet_list[Alphabet_list.index(C)+1])
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input())

if 500 * X >= X:
    print('Yes')
else:
    print('No')


Fixed submission:
K, X = map(int, input().split())

if 500 * K >= X:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N_list = [i for i in range(1,N)]
conbination = list(itertools.permutations(N_list, N))

a = conbination.index(tuple(P))
b = conbination.index(tuple(Q))

print(abs(a-b))


Fixed submission:
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N_list = [i for i in range(1,N+1)]
conbination = list(itertools.permutations(N_list, N))

a = conbination.index(tuple(P))
b = conbination.index(tuple(Q))

print(abs(a-b))

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

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N_list = [i for i in range(1,N)]
conbination = list(itertools.permutations(N_list, 8))

a = conbination.index(tuple(P))
b = conbination.index(tuple(Q))

print(abs(a-b))


Fixed submission:
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N_list = [i for i in range(1,N+1)]
conbination = list(itertools.permutations(N_list, N))

a = conbination.index(tuple(P))
b = conbination.index(tuple(Q))

print(abs(a-b))

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

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N_list = [1, 2, 3, 4, 5, 6, 7, 8]
conbination = list(itertools.permutations(N_list, 8))

a = conbination.index(tuple(P))
b = conbination.index(tuple(Q))

print(abs(a-b))


Fixed submission:
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N_list = [i for i in range(1,N+1)]
conbination = list(itertools.permutations(N_list, N))

a = conbination.index(tuple(P))
b = conbination.index(tuple(Q))

print(abs(a-b))
Buggy python submission (verdict: Runtime Error):
import math

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

sakaime = a * a * b / 2

if x > sakaime:
    tan = a / (2 * (b - (x / (a ** 2))))
else:
    tan = 2 * x / (a * (b**2))

ans = math.degrees(math.atan(tan))

if ans >= 0:
    print(90-ans)

Fixed submission:
import math

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

sakaime = a * a * b / 2

if x > sakaime:
    try:
        tan = a / (2 * (b - (x / (a ** 2))))
    except:
        tan = float('inf')
else:
    tan = 2 * x / (a * (b**2))

ans = math.degrees(math.atan(tan))

if ans >= 0:
    print(90-ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
 
N, M = map(int, input().split())
Ai = list(map(int, input().split()))
 
Ai.sort()
for _ in range(M):
    value = int(Ai.pop() / 2)
    bisect.insort(Ai, value)
 
print(sum(Ai))

Fixed submission:
from collections import deque

N, M = map(int, input().split())
Ai = list(map(int, input().split()))

Ai.sort(reverse=True)
Ai_deque = deque(Ai)
kari = deque()
for _ in range(M):
    try:
        if Ai_deque[0] > kari[0]:
            value = Ai_deque.popleft() // 2
        else:
            value = kari.popleft() // 2
    
    except:
        if not kari:
            value = Ai_deque.popleft() // 2
        else:
            value = kari.popleft() // 2
    
    kari.append(value)
    
print(sum(Ai_deque) + sum(kari))
Buggy python submission (verdict: Runtime Error):
a = int(input)
s = input()

if a >= 3200:
  print('red')
else:
  print(s)

Fixed submission:
a = int(input())
s = input()

if a < 3200:
    print('red')
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if v<=w:
    print("NO")
else:
    if abs(b-a)<=(v-w):
    if abs(b-a)%(v-w)==0 and abs(b-a)//(v-w)<=t:
        print("YES")
    else:
        print("NO")

Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if v<=w:
    print("NO")
else:
    if abs(b-a)<=t*(v-w):
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if v<=w:
    print("NO")
else:
    if abs(b-a)<=(v-w)
    if abs(b-a)%(v-w)==0 and abs(b-a)//(v-w)<=t:
        print("YES")
    else:
        print("NO")

Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if v<=w:
    print("NO")
else:
    if abs(b-a)<=t*(v-w):
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input())%10

if n ==3:
  print("bon")
  

Fixed submission:
N=int(input())%10
hon = [2,4,5,7,9]
pon = [0,1,6,8]
if N==3:
    print("bon")
elif N in hon:
    print("hon")
else:
    print("pon")
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
L=list(map(int,input().split()))
cnt=0
i=0
SET=set()
S=[]
while not(L[i] in SET):
    S.append(i+1)
    SET.add(i+1)
    i=L[i]-1

    
S.append(i+1)
SS=S


S=S[S.index(L[i]):]

cnt=len(S)



print(SS[K%(cnt)])

Fixed submission:
N=input()
NN=input()

if len(NN)==len(N)+1:
    if NN[:len(N)]==N:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
L=list(map(int,input().split()))
cnt=0
i=0
SET=set()
S=[]
while not(L[i] in SET):
    S.append(i+1)
    SET=set(S)
    i=L[i]-1

    
S.append(i+1)
SS=S


S=S[S.index(L[i]):]

cnt=len(S)



print(SS[K%(cnt)])

Fixed submission:
N=input()
NN=input()

if len(NN)==len(N)+1:
    if NN[:len(N)]==N:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if A+B+C==5*5*7 :
  print("YES")
  else:
    print("NO")

Fixed submission:
A,B,C=map(int,input().split())
if A*B*C==(5*5*7) :
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().strip().split()))

m = len(bin(max(a))[2:])
t = [0] * (m)

for i in range(n):
    bin_str_i = [int(s) for s in list(bin(a[i])[2:])]
    l = len(bin_str_i)
    for j in range(l):
        t[m - j - 1] += bin_str_i[l - j - 1]
x = ''
for j in range(m):
    if t[j] % 2 == 0:
        x += '0'
    else:
        x += '1'

x = int(x, 2)
for i in range(n):
    ans = a[i] ^ x
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)



Fixed submission:
n = int(input())
a = list(map(int, input().strip().split()))

x = 0
for i in range(n):
    x = x ^ a[i]
#print(bin(c))


#x = int(x, 2)
for i in range(n):
    ans = a[i] ^ x
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int, input().strip().split()))

m = len(bin(max(a))[2:])

p = np.zeros((n,m),dtype=int)

for i in range(n):
    bin_str = bin(a[i])[2:]
    p[i,m-len(bin_str):] = [int(s) for s in list(bin_str)]

#for i in range(n):
#    print(p[i,:])

q = np.zeros((n,m),dtype=int)

for j in range(m):
    if sum(p[:,j]) % 2 == 0:
        q[:,j] = p[:,j]
    else:
        for k in range(n):
            q[k,j] = not p[k,j]
#print()
#for i in range(n):
#    print(q[i,:])


for i in range(n):
    ans = int((str(q[i,:]).replace('[','').replace(']','').replace(' ','')),2)
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)



Fixed submission:
n = int(input())
a = list(map(int, input().strip().split()))

x = 0
for i in range(n):
    x = x ^ a[i]
#print(bin(c))


#x = int(x, 2)
for i in range(n):
    ans = a[i] ^ x
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m = map(int, input().split())
h = list(map(int, input().strip().split()))

g = np.zeros((n+1,n+1),dtype='uint64')
for i in range(1,n+1):
    g[i][i] = i


for i in range(m):
    a, b = map(int, input().split())
    g[a][b] = h[b-1]
    g[b][a] = h[a-1]

#for i in range(1,n+1):
#    print(g[i,:])


ans = 0
for i in range(1,n+1):
    if np.argmax(g[i,:]) == i:
        #print(i)
        ans += 1

print(ans)

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().strip().split()))

f = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] == h[b-1]:
        f[a-1] = 1
        f[b-1] = 1
    elif h[a-1] > h[b-1]:
        f[b-1] = 1
    elif h[a-1] < h[b-1]:
        f[a-1] = 1

#print(h0)
#print(h)


ans = 0
for i in range(n):
    if f[i] <= 0:
        #print(i)
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import queue

class Queue:
    def __init__(self,data = []):
        self.data = data
    def enqueue(self,x):
        self.data.append(x)
        return self.data
    def dequeue(self):
        if len(self.data) <= 0:
            print('Queue is Empty')
            return -1
        else:
            out = self.data[0]
            del self.data[0]
            return out
    def show(self):
        print(self.data)

    def list(self):
        return self.data


k = int(input())

# FIFOキューの作成
#q = queue.Queue()
q = Queue()

for i in range(1,10):
    q.enqueue(i)

#q.show()

for i in range(k):
    x = q.dequeue()

    if not x % 10 == 0:
        q.enqueue(10 * x + x % 10- 1)

    q.enqueue(10 * x + x % 10)

    if not x % 10 == 9:
        q.enqueue(10 * x + x % 10 + 1)
    
print(x)
    #print(i+1,x,q.list())
    #q.show()

Fixed submission:
import queue

k = int(input())

q = queue.Queue()
for i in range(1,10):
    q.put(i)

for i in range(k):
    x = q.get()

    p = 10 * x  
    m = x % 10
    if not m == 0:
        q.put(p + m - 1)

    q.put(p + m)

    if not m == 9:
        q.put(p + m + 1)
    
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
A = list(map(int, input().strip().split()))
l = max(A) + 1
c = np.zeros(max(A) + 1,dtype=np.int64)
for a in A:
    c[a] += 1
#print('c',c)
q = np.zeros(c.max() + 1,dtype=np.int64)
s = 0
for ci in c:
    if ci > 0:
        if q[ci] <= 0:
            q[ci] = ci * (ci - 1) // 2
        s += q[ci]
        if q[ci-1] <= 0:
            q[ci-1] = (ci - 1) * (ci - 2) // 2
    #print(ci,q)
#print(q)
        
#print(s)
for i in range(n):
    #print(A[i],q[max(0,c[A[i]]-1)],q[max(0,c[A[i]]-2)])
    print(s - q[max(0,c[A[i]])] + q[max(0,c[A[i]]-1)])

Fixed submission:
import numpy as np
import collections

n = int(input())
A = list(map(int, input().strip().split()))
C = collections.Counter(A)
#print(C)
s = 0
for v in C.values():
    s += v * (v-1) // 2
#print(s)
#print()
for i in range(n):
    print(s - C[A[i]] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
A = list(map(int, input().strip().split()))
U = max(A) + 3
c = np.zeros((U),dtype=np.int64)
for a in A:
    c[a] += 1
#print(c)
x = np.array(range(1,c.max() + 3))
y = np.array(range(0,c.max() + 2))
q = x * y / 2
q = q.astype(np.int64)
#print(q)

s = 0
dex = np.where(c>0)
for i in dex[0]:
    s += q[c[i]-1]
#print(s)
for i in range(n):
    #print(A[i],q[max(0,c[A[i]]-1)],q[max(0,c[A[i]]-2)])
    print(s - q[max(0,c[A[i]]-1)] + q[max(0,c[A[i]]-2)])

Fixed submission:
import numpy as np
import collections

n = int(input())
A = list(map(int, input().strip().split()))
C = collections.Counter(A)
#print(C)
s = 0
for v in C.values():
    s += v * (v-1) // 2
#print(s)
#print()
for i in range(n):
    print(s - C[A[i]] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
A = list(map(int, input().strip().split()))
U = max(A) + 3
c = np.zeros((U),dtype=np.int64)
for a in A:
    c[a] += 1
#print(c)


q = np.zeros((c.max() + 3),dtype=np.int64)
q[2] = 1
#q[3] = 3
#q[4] = 6
for i in range(3,len(q)):
    q[i] = int(q[i-1] * i / (i-2))
#print(q)

s = 0
dex = np.where(c>0)
for i in dex[0]:
    s += q[c[i]]
#print(s)
for i in range(n):
    #print(A[i],q[c[A[i]]],q[c[A[i]]-1])
    print(s - q[c[A[i]]] + q[c[A[i]]-1])

Fixed submission:
import numpy as np
import collections

n = int(input())
A = list(map(int, input().strip().split()))
C = collections.Counter(A)
#print(C)
s = 0
for v in C.values():
    s += v * (v-1) // 2
#print(s)
#print()
for i in range(n):
    print(s - C[A[i]] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
MAX_NUM = 10**9+1
MOD = 10**9+7

fac  = [0 for _ in range(MAX_NUM)]
finv = [0 for _ in range(MAX_NUM)]
inv  = [0 for _ in range(MAX_NUM)]

fac[0]  = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1

for i in range(2,MAX_NUM):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def combinations(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD


def power_func(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

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

X = combinations(n,a)
Y = combinations(n,b)
Z = power_func(2,n,MOD) - 1
print(Z - X - Y)


Fixed submission:
def binary(n):
    return bin(n)[2:]

def pow_by_binary_exponentiation(a, x, n):  # a^x mod n
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % n
        if x[i] == 1:
            y = (y * a) % n
    return y

 # mを法とするaの乗法的逆元
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y


# nCr mod m
# modinvが必要
# rがn/2に近いと非常に重くなる
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
n, a, b = map(int, input().split())


mod = 10**9 + 7
X = combination(n,a)
Y = combination(n,b)
Z = pow_by_binary_exponentiation(2,n,mod) - 1
W = (Z - X - Y) % mod
if W < 0:
    W += mod
print(W % mod)
Buggy python submission (verdict: Runtime Error):
#C
import numpy as np
n = int(input())
a = list(map(int, input().strip().split()))
b = np.zeros((10**9+9))
for i in range(n):
    if b[a[i]] == 0:
        b[a[i]] += 1
    else:
        print('NO')
        exit()
print('YES')

Fixed submission:
#C
n = int(input())
a = list(map(int, input().strip().split()))
a_l = set(a)

if len(a_l) == n:
    print('YES')
else:
    print('NO')