Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03688 (python)

Fixed submission:
#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(input())
    ai = list(map(int, input().split()))
    ma = max(ai)
    k = 0
    for a in ai:
        if a < ma - 1:
            return False
        if a == ma:
            k += 1

    if k == n:
        if ma + 1 == n:
            return True
        elif 1 <= ma <= n // 2:
            return True
        else:
            return False

    if k >= 2 and 1 <= ma - n + k <= k // 2:
        return True
    return False

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

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys, math, copy
import numba
# import fractions, itertools
import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

@numba.jit("b1(i8, i8[:])", nopython=True)
def main(n, ai):
    ma = np.max(ai)
    k = 0
    for a in ai:
        if a < ma - 1:
            return False
        if a == ma:
            k += 1

    if k == n:
        if ma + 1 == n:
            return True
        elif 1 <= ma <= n // 2:
            return True
        else:
            return False

    if k >= 2 and 1 <= ma - n + k <= k // 2:
        return True
    return False

n = int(input())
ai = np.array(list(map(int, input().split())))
print("Yes" if main(n, ai) else "No")
Problem p03800 (python)

Fixed submission:
#!/usr/bin/env python3

def main():
    n = int(input())
    s = input()
    s = list(s)
    s.append(s[0])
    for d0 in ["S", "W"]:
        for d1 in ["S", "W"]:
            pat = wrap(n, s, d0, d1)
            if pat[0] == pat[n] and pat[1] == pat[n + 1]:
                res = "".join(pat[:n])
                print(res)
                return
    print("-1")

def wrap(n, s, d0, d1):
    ds = [d0, d1]
    for i in range(2, n + 2):
        d = get_dnext(ds[i - 2], ds[i - 1], s[i - 1])
        ds.append(d)
    assert len(ds) == n + 2
    return ds

def get_dnext(dpre, di, si):
    if di == "S" and si == "o":
        dnext = dpre
    elif di == "S" and si == "x":
        dnext = inv(dpre)
    elif di == "W" and si == "o":
        dnext = inv(dpre)
    elif di == "W" and si == "x":
        dnext = dpre
    else:
        raise Exception
    return dnext

def inv(d):
    return "W" if d == "S" else "S"

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

def main():
    n = int(input())
    s = input()
    for d0 in ["S", "W"]:
        for d1 in ["S", "W"]:
            pat = wrap(n, s, d0, d1)
            if pat[0] == pat[n] and pat[1] == pat[n + 1]:
                res = "".join(pat[:n])
                print(res)
                return
    print("-1")

def wrap(n, s, d0, d1):
    ds = [d0, d1]
    for i in range(2, n + 2):
        d = get_dnext(ds[i - 2], ds[i - 1], s[i - 1])
        ds.append(d)
    assert len(ds) == n + 2
    return ds

def get_dnext(dpre, di, si):
    if di == "S" and si == "o":
        dnext = dpre
    elif di == "S" and si == "x":
        dnext = inv(dpre)
    elif di == "W" and si == "o":
        dnext = inv(dpre)
    elif di == "W" and si == "x":
        dnext = dpre
    else:
        raise Exception
    return dnext

def inv(d):
    return "W" if d == "S" else "S"

main()
Problem p03818 (python)

Fixed submission:
#!/usr/bin/env python3

def main():
    n = int(input())
    an = list(map(int, input().split()))
    k = len(set(an))
    res = k - 1 if k % 2 == 0 else k
    print(res)

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import heapq

def main():
    n = int(input())
    h = list(map(int, input().split()))
    heapq.heapify(h)
    accepted = [heapq.heappop(h)]
    while len(h) > 0:
        assert len(h) >= 2
        first = heapq.heappop(h)
        second = heapq.heappop(h)
        if accepted[-1] == first:
            del first
            del second
        elif first == second:
            if len(h) > 0:
                third = heapq.heappop(h)
                del first
                del third
                accepted.append(second)
            else:
                accepted.pop()
                accepted.append(first)
                del second
        else:
            accepted.append(first)
            accepted.append(second)

    print(len(accepted))

main()
Problem p03849 (python)

Fixed submission:
#!/usr/bin/env python3

from copy import deepcopy

MOD = 10 ** 9 + 7
IMAX = 200
JMAX = 2

def dp(n):
    dp = [0 for j in range(JMAX + 1)]
    dp[0] = 1
    for i in reversed(range(IMAX + 1)):
        pre = deepcopy(dp)
        dp[2] += pre[1]
        dp[2] += 2 * pre[2]
        d = ((1 << i) & n) >> i
        if d:
            dp[1] += pre[0]
            dp[2] += pre[1]
        else:
            dp[0] += pre[1]
        dp = take_mod(dp)
    return sum(dp) % MOD

def take_mod(dp):
    res = [x % MOD for x in dp]
    return res

def main():
    n = int(input())
    print(dp(n))

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

MOD = 10 ** 9 + 7
IMAX = 70
JMAX = 10 ** 5

def dp(n):
    assert n <= JMAX
    dp = [0 for j in range(JMAX + 1)]
    dp[0] = 1
    for i in reversed(range(IMAX + 1)):
        d = 2 ** i
        for j in reversed(range(JMAX + 1)):
            if j - d >= 0:
                dp[j] += dp[j - d]
            if j - 2 * d >= 0:
                dp[j] += dp[j - 2 * d]
    return sum(dp[:n + 1])

def main():
    n = int(input())
    print(dp(n))

main()
Problem p04039 (python)

Fixed submission:
#!/usr/bin/env python3

def main():
    n, k = map(int, input().split())
    dk = list(map(int, input().split()))
    assert len(dk) == k

    us = set(usable(dk))
    print(form(us, n))

def form(us, n):
    for res in range(n, 10 ** 5):
        fla = True
        for c in str(res):
            if int(c) not in us:
                fla = False
                break
        if fla:
            return res
    raise Exception

def usable(dk):
    res = []
    for i in range(10):
        if i not in dk:
            res.append(i)
    return res

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
 
import functools
 
MOD = 1000000007
fact = []
 
def main():
    h, w, a, b = map(int, input().split())
    init_fact(200000, MOD)
    mp = get_list_middle_points(h, w, a, b)
    res = 0
    for y, x in mp:
        res += count(1, 1, x, y) * count(x, y, w, h)
        res %= MOD
    print(res)
 
def count(x1, y1, x2, y2):
    dx = abs(x1 - x2)
    dy = abs(y1 - y2)
    count = combi(dx + dy, dx, MOD)
    return count
 
def get_list_middle_points(h, w, a, b):
    li = []
    y = h - a
    x = b + 1
    while (y >= 1 and x <= w):
        li.append((y, x))
        y -= 1
        x += 1
    return li
 
def combi(n, k, mod):
    numera = fact[n]
    denomi = (fact[n - k] * fact[k]) % mod
    return (numera * inv(denomi, mod)) % mod
 
def init_fact(maxn, mod):
    assert len(fact) == 0
    fact.append(1)
    for i in range(1, maxn + 1):
        fact.append((fact[i - 1] * i) % mod)
 
def inv(n, mod):
    return pow(n, mod - 2, mod)
 
def pow(n, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 0:
        x = pow(n, p // 2, mod)
        return (x * x) % mod
    else:
        x = pow(n, p - 1, mod)
        return (x * n) % mod
 
main()
Problem p02909 (python)

Fixed submission:
a = ["Sunny","Cloudy","Rainy"]

def f():
  S = input() 
  return a[(a.index(S) + 1) % 3]

print(f())

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int,input().split(" "))
a=[]
a2={}

for i in range(Q):
  a.append(input())
  
for i in range(N):
  a2[i+1] = a.count(str(i+1))

for i in range(N):
  if a2[i+1] >= Q-K+1:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int,input().split(" "))
a=[]
a2={}

for i in range(Q):
  a.append(input())
  
for i in range(N):
  a2[i+1] = a.count(str(i+1))

for i in range(N):
  if a2[i+1] >= Q-K+1:
    print("Yes")
  else:
    print("No")
Problem p02641 (python)

Fixed submission:
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(-200,201))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(1,101))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(1,101))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans >= temp:
        ans = temp
        res = i
print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(1,101))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]
#print(result)

ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)
Problem p02678 (python)

Fixed submission:
from networkx import Graph,predecessor

G = Graph() #無効グラフ生成
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
G.add_edges_from(ab) #辺リスト生成
preds = predecessor(G,source=1)  #sourceはstart node
print("Yes")
for i in range(2,n+1):
    print(preds[i][0])

#描画
#import matplotlib.pyplot as plt
#import networkx as nx
#nx.draw_networkx(G)
#plt.show()

Buggy submission (verdict: Runtime Error):
from networkx import Graph,predecessor
import matplotlib.pyplot as plt
#import networkx as nx

G = Graph() #無効グラフ生成
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
G.add_edges_from(ab) #辺リスト生成
preds = predecessor(G,source=1)  #sourceはstart node
print("Yes")
for i in range(2,n+1):
    print(preds[i][0])

#描画

Buggy submission (verdict: Runtime Error):
#https://docs.pyq.jp/python/math_opt/graph.html
from networkx import Graph,predecessor
import matplotlib.pyplot as plt
import networkx as nx

G = Graph() #無効グラフ生成
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
G.add_edges_from(ab) #辺リスト生成
preds = predecessor(G,source=1)  #sourceはstart node
print("Yes")
for i in range(2,n+1):
    print(preds[i][0])

#描画
#nx.draw_networkx(G)
#plt.show()

Buggy submission (verdict: Runtime Error):
from networkx import Graph,predecessor
import matplotlib.pyplot as plt
import networkx as nx

G = Graph() #無効グラフ生成
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
G.add_edges_from(ab) #辺リスト生成
preds = predecessor(G,source=1)  #sourceはstart node
print(preds)
print("Yes")
for i in range(2,n+1):
    print(preds[i][0])

#描画
#nx.draw_networkx(G)
#plt.show()
Problem p02690 (python)

Fixed submission:
x = int(input())


for i in range(-500,500):
    for j in range(-500,500):
        if x == i**5 - j ** 5:
            print(i,j)
            exit()

Buggy submission (verdict: Runtime Error):

x = int(input())

a = math.floor(x ** (1/5)) 

b = -1
while True:
    if a**5 -b**5 == x:
        break
    b = abs(b+1)

print(a,b)
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
print(r*2*math.pi)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split())) #上司の社員番号

for i in range(1,n+1):
    print(a.count(i))
Problem p02731 (python)

Fixed submission:
l = int(input())
result = ((l /3) ** 3)
print(round(result,7))

Buggy submission (verdict: Runtime Error):

l = int(input())
result = 0

if l % 3 == 0:
    result = (l /3) ** 3
else:
    


print(result)
Problem p02743 (python)

Fixed submission:
import math
a,b,c = map(int,(input().split()))

left = 4 * a * b
d = c -a -b
right =d * d

if d < 0:
    print("No")
elif left < right:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
h,w = map(int,(input().split()))
h = math.floor(h)
w = math.floor(w)
sum = h * w

if h == 1 and w ==1:
    print("1")
elif h % 2 == 0:
    result = math.floor(sum /2)
    print(result)
else:
    result = math.floor(sum /2 + 1)
    print(result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,(input().split()))



left = 4 * a * b
d = c -a -b
right =d * d

if d < 0:
    print("No")
elif left < right 
    print("Yes")
else:
    print("No")
Problem p02784 (python)

Fixed submission:
h,n = map(int,input().split())
a = list(map(int,input().split()))
goukei = sum(a)
result = h - goukei

if result <= 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
h,n = map(int,input().split())
a = input().split()
a.sort()
sum = int(a[-1]) + int(a[-2])
result = h - sum
if result <= 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
h,n = map(int,input().split())
a = input().split()
a.sort()

sum = int(a[-1]) + int(a[-2])

result = h - sum
if result <= 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#h:体力 n:必殺技の数
#a:必殺技の威力

h,n = map(int,input().split())
a = input().split()
a.sort()

sum = int(a[-1]) + int(a[-2])

result = h - sum
if result <= 0:
    print("Yes")
else:
    print("No")
Problem p02812 (python)

Fixed submission:
n = int(input())
s = str(input())
cnt = 0
for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
cnt = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        cnt += 1
print(cnt)
Problem p02923 (python)

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

count = 0
temp = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        temp += 1
    else:
        temp = 0
    count = max(count,temp)
print(count)

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

count = 1
while True:
    if count ==1:
        temp = a * count 
    else:
        temp = a + ((a-1) * (count -1))
    if temp >= b:
        print(count)
        exit()
    else:
        count += 1
Problem p03031 (python)

Fixed submission:
import itertools
n,m = map(int,(input().split()))
sw =[list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
result = 0

for i in itertools.product([0, 1], repeat=n):
    onof = True
    for j in range(m):
        counter = 0
        for k in sw[j][1:]:
            counter += i[k-1]
        if counter % 2 != p[j]:
            onof = False
            break
    if onof:
        result += 1
print(result)

Buggy submission (verdict: Runtime Error):
from itertools import product
n,m = map(int,(input().split()))
sw =[list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

ans = 0
for bit in product([0, 1], repeat=n):
    onoff = [1] * n # 1がon 0がoff
    ele = True
    for i, j in enumerate(bit):
        if j == 1:
            onoff[i] = 0
    #switchの状態を確認
    #print(bit,i,j)
    for k in range(m):
        cnt = 0
        #print(onoff)
        for l in range(sw[0][k]): #電球のループ
            if onoff[sw[k][l]-1]  == 1:
                cnt += 1
        if cnt % 2 != p[k]:
            ele = False
            break
    if ele :
        ans += 1

        
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import product
n,m = map(int,(input().split()))
sw =[list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

ans = 0
for bit in product([0, 1], repeat=n):
    onoff = [1] * n # 1がon 0がoff
    ele = True
    for i, j in enumerate(bit):
        if j == 1:
            onoff[i] = 0
    #switchの状態を確認
    #print(bit,i,j)
    for k in range(m):
        cnt = 0
        #print(onoff)
        for l in range(sw[0][k]): #電球のループ
            if onoff[sw[k][l]-1]  == 1:
                cnt += 1
        if cnt % 2 != p[m-1]:
            ele = False
            break
    if ele :
        #print(i,j,k,l)
        ans += 1

        
print(ans)
Problem p03262 (python)

Fixed submission:
import fractions

n, k = map(int, input().split())
x = list(map(int, input().split()))
x = [abs(x[i] - k) for i in range(n)]
ans = x[0]
for i in range(1, n):
    ans = fractions.gcd(ans, x[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
#import math
n,x = map(int,input().split())
x = list(map(int,input().split()))
x.sort()

if n == 1:
    print(x[0]-x)
    exit()
a = x[1] - x[0]
b = x[2] - x[1]

print(fractions.gcd(a,b))
#print(math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import fractions
#import math
n,x = map(int,input().split())
x = list(map(int,input().split()))
x.sort()

if n == 1:
    print(x[0]-1)
    exit()
a = x[1] - x[0]
b = x[2] - x[1]

print(fractions.gcd(a,b))
#print(math.gcd(a,b))
Problem p03294 (python)

Fixed submission:
import math
import fractions
from functools import reduce


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

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm(*a)

x = x - 1
result = 0
for i in a:
    result += x % i

print(result)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
a = list(map(int,(input().split())))

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm(*a)

x = x - 1
result = 0
for i in a:
    result += x % i

print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,(input().split())))
import math
from functools import reduce

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm(*a)

x = x - 1
result = 0
for i in a:
    result += x % i

print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,(input().split())))
import math
from functools import reduce

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm(*a)

x = x - 1
result = 0
for i in a:
    result += x % i

print(result)
Problem p03437 (python)

Fixed submission:
# 8 = 2 * 2 * 2
# 6 = 2 * 3
x,y= map(int,(input().split()))

result = 0

if x % y == 0:
    result = -1
else:
    result = x 


print(result)

Buggy submission (verdict: Runtime Error):
# 8 = 2 * 2 * 2
# 6 = 2 * 3
x = int(input())
y = int(input())
result = 0

if x % y == 0:
    result = -1
else:
    result = x * 2


print(result)

Buggy submission (verdict: Runtime Error):
# 8 = 2 * 2 * 2
# 6 = 2 * 3
x = int(input())
y = int(input())
result = 0

if x % y == 0:
    result = -1
else:
    result = x
print(result)
Problem p03777 (python)

Fixed submission:
a,b = map(str,(input().split()))

if a == "H" and b == "H":
    print("H")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")

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

if a == "H" and b == "H":
    print("H")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")
Problem p02628 (python)

Fixed submission:
N,K=input().split()
N=int(N)
K=int(K)
a=[]
a=[int(a) for a in input().split()]
a.sort()
print(sum(a[0:K]))

Buggy submission (verdict: Runtime Error):
N,K=input().split()
N=int(N)
K=int(K)
a=[]
a=[int(a) for a in input().split()]
a.sort()
print(sum(a[0:K-1])
Problem p02660 (python)

Fixed submission:
def solve(n):
    for i in range(n+2):
        if (i+1)*i//2 > n:
            return i-1

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])


    return arr



N = int(input())
li = factorization(N)
ans = 0
for [a,b] in li:
    ans += solve(b)
    
if ans == 0:
    if N != 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def solve(n):
    for i in range(n+1):
        if (i+1)*i//2 > n:
            return i-1

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr



N = int(input())
li = factorization(N)
ans = 0
for [a,b] in li:
    ans += solve(b)
print(ans)

Buggy submission (verdict: Runtime Error):
def solve(n):
    for i in range(n+1):
        if (i+1)*i//2 > n:
            return i-1

from math import sqrt

N = int(input())
P = []
li = []
num = int(sqrt(N))+1
for i in range(2, num):
    if N%i == 0:
        P.append(i)
        P.append(N//i)

for p in P:
    e = 0
    while N%(p**(e+1)) == 0:
        e += 1
    if e > 0:
        li.append((p, e))
    N //= p ** e

ans = 0     
for (a,b) in li:
    ans += solve(b)
    
if ans == 0:
    if N != 1:
        ans += 1
        


print(ans)
Problem p02768 (python)

Fixed submission:
n, a, b = map(int, input().split())
mod = 10**9+7
def Pow(a, n):
    fac = a
    res = 1
    for i in range(len(bin(n)[2:])):
        if n&1:
            res = res*fac%mod
        fac = fac*fac%mod
        n = n>>1
    return res
cnt = Pow(2, n) - 1
x = [0] * (b+1)
for i in range(1,b+1):
    x[i] = Pow(i, mod-2)
cmb = [0] * (b+1)
cmb[1] = n
for i in range(2, b+1):
    cmb[i] = cmb[i-1]*(n-i+1)%mod*x[i]%mod
cnt -= cmb[a]+cmb[b]
print(cnt%mod)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
mod = 10**9+7
def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod
cnt = Pow(2, n) - 1
x = [0] * (n+1)
for i in range(1,b+1):
    x[i] = Pow(i, mod-2)
cmb = [0] * (n+1)
cmb[1] = n
for i in range(2, b+1):
    cmb[i] = cmb[i-1]*(n-i+1)%mod*x[i]%mod
cnt -= cmb[a]+cmb[b]
print(cnt%mod)
Problem p02811 (python)

Fixed submission:
n, m = map(int, input().split())
if n*500 < m:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if n*500 < m:
  print("No")
else:
  pprint("Yes")