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

Fixed submission:
import math
a,b,x = map(int,input().split())
if x/(a*a) == b:
    print(0)
elif(x/(a*a)>=b/2):
    print(90 - (math.atan(a/(2*(b -(x/(a*a)))))*180/math.pi))    
else:
     print(90 - ((math.atan(2*x/(a*b*b))*180/math.pi)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if(x/(a*a)>b/2):
    print(90 - (math.atan(a/(2*(b -(x/(a*a)))))*180/math.pi))
elif x/(a*a) == b/2:
    print(0)
    
else:
     print(90 - ((math.atan(x/(a*b)/b)*180/math.pi)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if(x/(a*a)>=b/2):
    print(90 - (math.atan(a/(2*(b -(x/(a*a)))))*180/math.pi))
else:
     print(90 - ((math.atan(x/(a*b)/b)*180/math.pi)))
Problem p02755 (python)

Fixed submission:
import numpy as np
import math

def main():
    a, b = map(int, input().split())

    # print(a/0.08)

    a_ans = np.array([i for i in range(math.ceil(a/0.08), int((a+1)/0.08))])
    b_ans = np.array([j for j in range(math.ceil(b/0.1), int((b+1)/0.1))])

    # print(a_ans)
    # print(b_ans)
    #
    # print(a_ans * 0.08)
    # print(b_ans * 0.1)

    ans = set(a_ans) & set(b_ans)

    # print(ans)

    if ans == set():
        print(-1)
    else:
        print(min(ans))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    q = int(input())

    for _ in range(q):
        tmp = input()
        if len(tmp) == 1:
            s = s[::-1]
        else:
            if tmp[2] == '1':
                s = tmp[4] + s
            else:
                s = s + tmp[4]
    print(s)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import math

def main():
    a, b = map(int, input().split())

    # print(a/0.08)

    a_ans = np.array([i for i in range(math.ceil(a/0.08), int((a+1)/0.08))])
    b_ans = np.array([j for j in range(math.ceil(b/0.1), int((b+1)/0.1))])

    # print(a_ans)
    # print(b_ans)
    #
    # print(a_ans * 0.08)
    # print(b_ans * 0.1)

    ans = set(a_ans) & set(b_ans)

    # print(ans)

    if ans == set():
        print(-1)
    else:
        print(min(ans))

if __name__ == '__main__':
    main()
Problem p02780 (python)

Fixed submission:
# numpy使うときは、PyPyは不可
import numpy as np

N, K = map(int, input().split())
P = (np.array(list((map(int, input().split())))) + 1)

"""
ans = 0

for num in range(len(p)):
    tmp = p[num:num+K].sum()
    if ans < tmp:
        ans = tmp

print(float(ans))

"""

# 回答
Pcum = np.zeros(N + 1, np.int32)
Pcum[1:] = P.cumsum()

length_K_sums = Pcum[K:] - Pcum[0:-K]
print(length_K_sums.max() / 2)

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
p = (np.array(list((map(int, input().split())))) + 1) / 2

ans = 0

for num in range(len(p)):
    tmp = p[num:num+K].sum()
    if ans < tmp:
        ans = tmp

print(ans)
Problem p02784 (python)

Fixed submission:


H, N = map(int, input().split())
total_A = sum(list(map(int, input().split())))

if H <= total_A:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):


H, N = map(int, input().split())
total_A = sum(list(map(int, input.split())))

if H <= total_A:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
total_A = sum(map(int, input.split()))

if H <= total_A:
    print('Yes')
else:
    print('No')
Problem p02789 (python)

Fixed submission:
N,M = map(int, input().split())

if N == M:
    print('Yes')
else:
    print(('No'))

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().split())

if (H % A) == 0:
    print(H // A)
else:
    print(H // A + 1)
Problem p02796 (python)

Fixed submission:
def solve(N, XL):
    XL_re = [[xl[0] - xl[1], xl[0] + xl[1]] for xl in XL]
    XL_re = sorted(XL_re, key=lambda x: x[1])

    cnt = 0
    for i, xl in enumerate(XL_re):
        if i == 0:
            tmp = xl[1]
            cnt += 1
        else:
            if tmp <= xl[0]:
                tmp = xl[1]
                cnt += 1
    return cnt

def test():
    assert solve(4, [[2, 4], [4, 3], [9, 3], [100, 5]]) == 3

def main():
    N = int(input())
    XL = [list(map(int, input().split())) for _ in range(N)]
    ans = solve(N, XL)
    print(ans)

if __name__ == "__main__":
    # test()
    main()

Buggy submission (verdict: Runtime Error):
def solve(N, XL):
    XL_re = [[xl[0] - xl[1], xl[0] + xl[1]] for xl in XL]
    XL_re = sorted(XL_re, key=lambda x: x[1])

    cnt = 0
    for i, xl in enumerate(XL_re):
        if i == 0:
            tmp = xl[1]
            cnt += 1
        else:
            if tmp <= xl[0]:
                tmp = xl[1]
                cnt += 1
    return cnt

def test():
    assert solve(4, [[2, 4], [4, 3], [9, 3], [100, 5]]) == 3

def main():
    N = int(input())
    XL = [list(map(int, input().split())) for _ in range(N)]
    ans = main(N, XL)
    print(ans)

if __name__ == "__main__":
    # test()
    main()
Problem p02801 (python)

Fixed submission:
C = input()

alpha = [chr(ord('a') + i) for i in range(26)]

print(alpha[alpha.index(C)+1])

Buggy submission (verdict: Runtime Error):
C = input()

alpha = [chr(ord('a') + i) for i in range(25)]

print(alpha[alpha.index(C)+1])
Problem p02811 (python)

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

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

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())

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

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())

if (500 * x) >= K:
    print('Yes')
else:
    print(('No')
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
# N = 10
# S = 'ZABCDBABCQ'

ans = 0

for i in range(N - 2):
    if S[i:i+3] == 'ABC':
       ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
S = input()
# N = 10
# S = 'ZABCDBABCQ'

ans = 0

for i in range(N - 2):
    if S[i:i+3] == 'ABC':
       ans += 1
print(ans)
Problem p02888 (python)

Fixed submission:
import bisect

N = int(input())
Ls = list(map(int, input().split()))
Ls.sort()

# O(N^2 * logN)の全探索で解く
ans = 0
for a_i in range(N):
    for b_i in range(a_i+1, N):
        c_i = bisect.bisect_left(Ls, Ls[a_i]+Ls[b_i])
        if c_i > b_i:
            ans += c_i - b_i - 1
        else:
            pass

print(ans)

# from itertools import combinations
# import numpy as np
#
# n = int(input())
# hoge = list(map(int, input().split()))
# hoge.sort()
#
# # hoge = np.sort(l)
# ll = []
# ans = 0
#
# def triangle(target, v1, v2):
#     return target < v1 + v2
#
# for i in range(len(hoge)):
#     for j in range(i + 1, len(hoge)):
#         left = hoge[j]
#         right = hoge[-1] + 1
#         while left + 1 < right:
#             mid = (left + right) / 2
#             if triangle(mid, hoge[i], hoge[j]):
#                 ans += len(hoge[hoge >= mid])
#                 break
#             else:
#                 left = mid
#
# print(ans)

"""3回目
# 事前の各要素xより大きい要素個数を求める
for v in hoge:
    ll.append([v, len(hoge[v <= hoge])])

# 事前にコンビネーションを確保する。ループはしない！
combi = np.array([[sum(v), v[1]] for v in combinations(hoge, 2)])

print(combi)
print(combi[:, 0])
print(ll)

# 要素のループをもう一度回し、各
for v, cnt in ll:
    print(v, cnt, len(combi[(v < combi[:, 0]) & (combi[] < v)]), sep=',')
    ans += cnt * len(combi[v < combi])

print(ans)

"""


"""2回目 comnbinationループがだめ
for v in combinations(hoge, 2):
    s = sum(v)
    ans += len(hoge[(v[1] < hoge) & (hoge < s)])

"""



"""1
これだとTLEが出る
combinationの全パターンを数え上げると遅すぎる
ソート済み配列 × なにかで組み合わせを数え上げる必要

from itertools import combinations

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

ans = 0

for v in combinations(l, 3): # combination を使ってループした時点ででn^2
    if v[0] < v[1] + v[2] and v[1] < v[0] + v[2] and v[2] < v[0] + v[1]:
        ans += 1

print(ans)
"""

Buggy submission (verdict: Runtime Error):
from itertools import combinations
import numpy as np

n = int(input())
l = set(map(int, input().split()))

hoge = np.sort(l)
ans = 0

for v in combinations(hoge, 3):
    if v[2] < v[0] + v[1]:
        ans += 1

print(ans)
Problem p02924 (python)

Fixed submission:
import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())

    ans = n * (n - 1) // 2
    print(int(ans))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13"""
        output = """78"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Buggy submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())

    print(sum(list(range(n + 1))) - n)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13"""
        output = """78"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()
Problem p02953 (python)

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

# if max(h) - h[n - 1] > 1:
#     print('No')
#     exit(0)
# if n == 1:
#     print('Yes')
#     exit(0)
# else:
#     cap = max(h[0:n-1])
#     for i in range(n - 1, 0, -1):
#         if max(h[i - 1] - 1, 1) > h[i]:
#             print('No')
#             exit(0)
#         else:
#             if cap > h[i]:
#                 pass
#             else:
#                 h[i - 1] = max(h[i - 1] - 1, 1)

for i in range(n - 1, 0, -1):
    if h[i - 1] - h[i] > 1:
        print('No')
        exit(0)
    elif h[i - 1] - h[i] == 1:
        h[i - 1] = max(h[i - 1] - 1, 1)
    else:
        pass


print('Yes')

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

if max(h) - h[n - 1] > 1:
    print('No')
    exit(0)
if n == 1:
    print('Yes')
    exit(0)
else:
    cap = max[0:n-2]
    for i in range(n - 1, 0, -1):
        if max(h[i - 1] - 1, 1) > h[i]:
            print('No')
            exit(0)
        else:
            if cap >= h[i]:
                pass
            else:
                h[i - 1] = max(h[i - 1] - 1, 1)

print('Yes')

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

if max(h) - h[n - 1] > 1:
    print('No')
    exit(0)
if n == 1:
    print('Yes')
    exit(0)
else:
    for i in range(n - 1 , 0):
        if max(h[i - 1] - 1, 1) > h[i]:
            print('No')
            exit(0)
        else:
            if max(h[0:i]) == h[i]:
                pass
            elif:
                h[i - 1] = max(h[i - 1] - 1, 1)

print('Yes')
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = input()

# lr = [list(map(int, input().split())) for _ in range(q)]

# 愚直な計算時間
# ループn回
# リスト切り取りO(n)
# O(n^2)
# 計算リミットが2000msで、n<=10^5
# 0(n)でn=10^6くらいが限度
# O8n^2)だと、n=3000くらい

# 先に回数を数える。累積和的に
# ここで結構時間かかる
# hoge = [s[0:(i + 1)].count('AC') for i in range(n)]

# 修正ver
hoge = [0]
cnt = 0
for i in range(1, n):
    if s[i - 1] + s[i] == 'AC':
        cnt += 1
    hoge.append(cnt)

for _ in range(q):
    l, r = map(int, input().split())
    print(hoge[r - 1] - hoge[l - 1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()

# 先に回数を数える。累積和的に
hoge = [s[0:(i + 1)].count('AC') for i in range(n)]

for _ in range(q + 1):
    l, r = map(int, input().split())
    print(hoge[r - 1] - hoge[l - 1])
Problem p03328 (python)

Fixed submission:
def factorial(n):
    if n == 1:
        return 1
    else:
        return n + factorial(n - 1)


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

diff = b - a

print(factorial(diff - 1) - a)

Buggy submission (verdict: Runtime Error):
def factorial(n):
    if n == 1:
        return 1
    else:
        return n + factorial(n - 1)


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

diff = b - a

print(factorial(diff) - b)
Problem p02609 (python)

Fixed submission:
N = int(input())
X = input()
times = {}
times[0] = 0

for i in range(1,200000):
  bi = format(i, 'b')
  arr = list(map(int, bi))
  sbi = sum(arr)
  if i%sbi == 0:
    times[i] = 1
  else:
    times[i] = 1+times[i%sbi]
    
arr = list(map(int, X))
sbX = sum(arr)
X10 = int(X,2)
mo = [1,-1]
if sbX-1 == 0:
  mo2 = [X10%(sbX+1),X10]
else:
  mo2 = [X10%(sbX+1),X10%(sbX-1)]

for i in range(N):
  waru = sbX+mo[int(X[i])]
  if waru == 0:
    print(0)
  else:
    print(times[(mo[int(X[i])]*pow(2,(N-i-1),waru)+mo2[int(X[i])])%waru]+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()
times = {}
times[0] = 0

for i in range(1,200000):
  bi = format(i, 'b')
  arr = list(map(int, bi))
  sbi = sum(arr)
  if i%sbi == 0:
    times[i] = 1
  else:
    times[i] = 1+times[i%sbi]
    
arr = list(map(int, X))
sbX = sum(arr)
X10 = int(X,2)
mo = [1,-1]
mo2 = [X10%(sbX+1),X10%(sbX-1)]

for i in range(N):
  waru = sbX+mo[int(X[i])]
  if waru == 0:
    print(0)
  else:
    print(times[(pow(2,(N-i-1),waru)+mo2[int(X[i])])%waru]+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()
times = [0]*200000

for i in range(1,200000):
  bi = format(i, 'b')
  arr = list(map(int, bi))
  sbi = sum(arr)
  if i%sbi == 0:
    times[i] = 1
  else:
    times[i] = 1+times[i%sbi]
    
arr = list(map(int, X))
sbX = sum(arr)
mo = [1,-1]
for i in range(N):
  X10 = int(X,2)^(2**(N-i-1))
  waru = sbX+mo[int(X[i])]
  print(times[X10%waru]+1)
Problem p02665 (python)

Fixed submission:
N = int(input())+1
ali = list(map(int,input().split()))
nli = [0]*N

maxn = 2**(N-1)
nli[-1] = ali[-1]

for i in range(1,N+1):
  nli[-i] = min(maxn,nli[-i+1] + ali[-i])
  maxn //= 2
  

ulim = 1
for i in range(N):
  nli[i] = min(nli[i],ulim)
  ulim = (ulim - ali[i])*2
  if ulim < 0:
    print(-1)
    exit()
  
print(sum(nli))

Buggy submission (verdict: Runtime Error):
N = int(input())+1
ali = list(map(int,input().split()))
nli = [0]*N

maxn = 2**(N-1)
nli[-1] = ali[-1]

for i in range(1,N+1):
  nli[-i] = min(maxn,nli[-i+1] + ali[-i])
  maxn //= 2
  

ulim = 1
for i in range(N):
  nli[i] = min(nli[i],ulim)
  ulim = (ulim - ali[i])*2
  if i != N-1 and ulim <= 0:
    print(-1)
    print(nli[N+1])
    exit()
  
print(sum(nli))
Problem p02845 (python)

Fixed submission:
import itertools

N = int(input())
Ali = list(map(int,input().split()))
C = [0,0,0]

for i in range(N):
  n = 0
  for j in range(3):
    if C[j] == Ali[i]:
      C[j] += 1
      break
  
Ali = Ali[::-1]
if C[0] == C[1] == C[2]:
  r = 1
elif C[0] == C[1] or C[1] == C[2] or C[2] == C[0]:
  r = 3
else:
  r = 6

  
for i in range(N):
  n = 0
  ta = 0 
  for j in range(3):
    if C[j]-1 == Ali[i]:
      n += 1
      ta = j
  r *= n
  C[ta] = Ali[i]
  
print(r%1000000007)

Buggy submission (verdict: Runtime Error):
N = int(input())
Ali = list(map(int,input().split()))
Ali = Ali[::-1]
Bli = sorted(Ali)
C = [-1,-1,-1]

for i in range(Ali.count(0)):
  C[i] = Bli[-i-1]+1
  
if Ali.count(0) <= 2:
  r = 3
else:
  r = 1

for i in range(N):
  n = 0
  ta = 0 
  for j in range(3):
    if C[j]-1 == Ali[i]:
      n += 1
      ta = j
  r *= n
  C[ta] = Ali[i]
  
print(r%1000000007)
Problem p03031 (python)

Fixed submission:
N,M = map(int,input().split())
ks = []
for i in range(M):
  ks.append(list(map(int,input().split())))
p = list(map(int, input().split()))
c = 0

for i in range(2 ** N):
  sw = [0]*N
  for j in range(N):
    if ((i >> j) & 1):
      sw[j] = 1
  frg = True
  for j in range(M):
    a = ks[j][0]
    aa = 0
    for k in range(1,a+1):
      aa += sw[ks[j][k]-1]
    if aa%2 != p[j]:
      frg = False
  if frg:
    c += 1
    
print(c)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
ks = []
for i in range(M):
  ks.append(list(map(int,input().split())))
p = list(map(int, input().split()))
c = 0

for i in range(2 ** N):
  sw = [0]*N
  for j in range(N):
    if ((i >> j) & 1):
      sw[j] = 1
  frg = True
  for j in range(M):
    a = ks[j][0]
    aa = 0
    for k in range(a):
      aa += sw[k+1]
    if aa%2 != p[j]:
      frg = False
  if frg:
    c += 1
    
print(c)
Problem p03106 (python)

Fixed submission:
from fractions import gcd
A,B,K = map(int,input().split())
r = []

g = gcd(A,B)
for i in range(1,g+1):
  if g%i == 0:
    r.append(i)
    
print(r[-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K = map(int,input().split())
r = []

g = math.gcd(A,B)
for i in range(1,g+1):
  if g%i == 0:
    r.append(i)
    
print(r[K-1])
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N,M = map(int,input().split())
p = [list(map(int,input().split())) for _ in range(M)]
dp = [-1]*N
ip = [[] for _ in range(N)]
for i in range(M):
  ip[p[i][1]-1].append(p[i][0]-1)

#閉路がないため同じ頂点は通らない
#i番目の頂点に到達するまでの最長手数をメモ化再帰で求める

def maxpath(i):
  if dp[i] != -1:
    return dp[i]
  a = 0
  for el in ip[i]:
    a = max(a,maxpath(el)+1)
  dp[i] = a
  return a
  
for i in range(N):
  maxpath(i)

print(max(dp))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
p = [list(map(int,input().split())) for _ in range(M)]
dp = [-1]*N
ip = [[] for _ in range(N)]
for i in range(M):
  ip[p[i][1]-1].append(p[i][0]-1)

#閉路がないため同じ頂点は通らない
#i番目の頂点に到達するまでの最長手数をメモ化再帰で求める

def maxpath(i):
  if dp[i] != -1:
    return dp[i]
  a = 0
  for el in ip[i]:
    a = max(a,maxpath(el)+1)
  dp[i] = a
  return a
  
for i in range(N):
  maxpath(i)

print(max(dp))
Problem p02632 (python)

Fixed submission:
K = int(input())
S = input()
MOD = 10**9 + 7


def cmb(n, r, MOD):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD


N = 3*10**6
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

ans = 0
for i in range(len(S), len(S)+K+1):
    ans += cmb(i-1, len(S)-1, MOD)*pow(25, i-len(S), MOD) * \
        pow(26, len(S)+K-i, MOD)
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
MOD = 10**9 + 7


def cmb(n, r, MOD):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD


N = 10**6+1
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

ans = 0
for i in range(len(S), len(S)+K+1):
    ans += cmb(i-1, len(S)-1, MOD)*pow(25, i-len(S), MOD) * \
        pow(26, len(S)+K-i, MOD)
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
MOD = 10**9 + 7


def cmb(n, r, MOD):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD


N = 10**6+1
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

ans = 0
for i in range(len(S), len(S)+K+1):
    ans += cmb(i-1, len(S)-1, MOD)*pow(25, i-len(S), MOD) * \
        pow(26, len(S)+K-i, MOD)
    ans %= MOD
print(ans)
Problem p02683 (python)

Fixed submission:
import numpy as np

N, M, X = map(int, input().split())
C = []
A = np.ndarray((N, M), dtype=int)
for j in range(N):
    c, *a = [int(i) for i in input().split()]
    C.append(c)
    A[j] = a

ans = 10**20
for i in range(2 ** N):
    cost = 0
    sk = np.zeros(M, dtype=int)
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            cost += C[j]
            sk += A[j, :]
    if all(s >= X for s in sk):
        ans = min(ans, cost)

if ans == 10**20:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

N, M, X = map(int, input().split())
C = []
A = np.ndarray((N, M), dtype=int)
for j in range(N):
    c, *a = [int(i) for i in input().split()]
    C.append(c)
    A[j] = a

ans = 10**20
for i in range(2 ** N):
    cost = 0
    sk = np.zeros(M, dtype=int)
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            cost += C[j]
            sk += A[j, :]
    if all(s >= X for s in sk):
        ans = min(ans, cost)

if ans == 10**20:
    print(-1)
else:
    print(ans)
Problem p02705 (python)

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

Buggy submission (verdict: Runtime Error):
import math
print(int(input()*2*math.pi))
Problem p02706 (python)

Fixed submission:
N, M = map(int, input().split())
A = [int(i) for i in input().split()]


if sum(A) > N:
    print(-1)
else:
    print(N-sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]


if sum(M) > N:
    print(-1)
else:
    print(N-sum(A))