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

Fixed submission:
N, K = map(int, input().split())
V = list(map(int, input().split()))
M = min(N, K)
ans = 0
for p in range(M+1):
  for q in range(M-p+1):
    left = []
    right = []
    if p > 0:
      left = V[:p]
    if q > 0:
      right = V[-q:]
    have = sorted((left+right).copy())
    if len(have) > 0:
      for i in range(min(len(have),K-p-q+1)):
        if have[i] > 0:
          break
      ans = max(sum(have[i:]),ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

dp = {}

def dfs(N, K, k, have, q):
  if k == K:
    return sum(have)
  else:
    if not ((k, tuple(q)) in dp):
      a = [sum(have)]
      if len(q) > 0:
        tmp_q = q.copy()
        tmp_have = have.copy()
        v = tmp_q.popleft()
        tmp_have.append(v)
        a.append(dfs(N, K, k+1, tmp_have, tmp_q))
        tmp_q = q.copy()
        tmp_have = have.copy()
        v = tmp_q.pop()
        tmp_have.append(v)
        a.append(dfs(N, K, k+1, tmp_have, tmp_q))
      if len(have) > 0:
        tmp_q = q.copy()
        tmp_have = sorted(have.copy())
        v = tmp_have.pop(0)
        tmp_q.appendleft(v)
        a.append(dfs(N, K, k+1, tmp_have, tmp_q))
        tmp_q = q.copy()
        tmp_have = sorted(have.copy())
        v = tmp_have.pop(0)
        tmp_q.append(v)
        a.append(dfs(N, K, k+1, tmp_have, tmp_q))
      dp[(k, tuple(q))] = max(a)
    return dp[(k, tuple(q))]


N, K = map(int, input().split())
V = deque(list(map(int, input().split())))
print(dfs(N, K, 0, [], V))
Problem p03062 (python)

Fixed submission:
from collections import deque

N = int(input())
A = list(map(int, input().split()))
minAbs = 10**10
countMinus = 0
S = 0
for a in A:
  countMinus += (1 if a < 0 else 0)
  S += abs(a)
  minAbs = min(minAbs, abs(a))
print(S-2*(0 if countMinus % 2 == 0 else minAbs))

Buggy submission (verdict: Runtime Error):
import copy

N = int(input())
A = list(map(int, input().split()))
X = copy.deepcopy(A)

ansA = 0
for i in range(N-2):
  if A[i] < 0:
    A[i+1] *= -1
  ansA += abs(A[i])
if A[-3] == 0:
  ansA += abs(A[-1])+abs(A[-2])
else:
  ansA += abs(A[-1]+A[-2])
ansB = 0
for i in reversed(range(2, N)):
  if X[i] < 0:
    X[i-1] *= -1
  ansB += abs(X[i])
if X[2] == 0:
  ansB += abs(X[0])+abs(X[1])
else:
  ansB += abs(X[0]+X[1])
print(max(ansA, ansB))
Problem p03095 (python)

Fixed submission:
from itertools import combinations
N = int(input())
S = list(input().strip())
d = {}
for c in S:
  if c in d.keys():
    d[c] += 1
  else:
    d[c] = 1
ans = 0
for n in d.values():
  ans = (ans+n+ans*n)%(10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from  collections import deque
sys.setrecursionlimit(10^7)
def dfs(base, n, s, cur):
  if cur == n:
    return 1
  else:
    return (dfs(base, n, s, cur+1)+(0 if base[cur] in s else dfs(base, n, s+base[cur], cur+1)))%(10^9+7)

N = int(input())
S = list(input().strip())
print(dfs(S,N,"",0)-1)

Buggy submission (verdict: Runtime Error):
import sys
from  collections import deque
sys.setrecursionlimit(10^6)
def dfs(base, n, s, cur):
  if cur == n:
    return 1
  else:
    return (dfs(base, n, s, cur+1)+(0 if base[cur] in s else dfs(base, n, s+base[cur], cur+1)))%(10^9+7)

N = int(input())
S = list(input().strip())
print(dfs(S,N,"",0)-1)

Buggy submission (verdict: Runtime Error):
import sys
from  collections import deque
sys.setrecursionlimit(10^5)
memo = deque()
def dfs(base, n, s, cur):
  if cur == n:
    if not s in memo:
      memo.append(s)
      return 1
    else:
      return 0
  else:
    return (dfs(base, n, s, cur+1)+(0 if base[cur] in s else dfs(base, n, s+base[cur], cur+1)))%(10^9+7)

N = int(input())
S = list(input().strip())
print(dfs(S,N,"",0)-1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
def dfs(base, n, s, cur):
  if cur == n:
    return 1
  else:
    return (dfs(base, n, s, cur+1)+(0 if base[cur] in s else dfs(base, n, s+base[cur], cur+1)))%(10^9+7)

N = int(input())
S = list(input().strip())
print(dfs(S,N,"",0)-1)
Problem p03160 (python)

Fixed submission:
import sys

sys.setrecursionlimit(100000)

N = int(raw_input())
H = map(int, raw_input().split())
cost = [-1]*N

def sumOfCost(i):
  if cost[i] >= 0:
    return cost[i]
  if i == 0:
    soc=0
  elif i == 1:
    soc= sumOfCost(0)+abs(H[i]-H[0])
  else:
    c1 = sumOfCost(i-1)+abs(H[i]-H[i-1])
    c2 = sumOfCost(i-2)+abs(H[i]-H[i-2])
    soc=min(c1,c2)
  cost[i] = soc
  return soc

print sumOfCost(N-1)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
act = [map(int, raw_input().split()) for _ in range(N)]
memo = [[-1]*3 for _ in range(N)]

def happy(n, i):
  if memo[n][i] >= 0:
    return memo[n][i]
  if n == 0:
    h = act[n][i]
  else:
    h = -1
    for j in range(3):
      if j == i:
        continue
      c = happy(n-1,j)+act[n][i]
      h = h if h > c else c
  memo[n][i] = h
  return h
print max(happy(N-1,0),happy(N-1,1),happy(N-1,2))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(100000)

N = int(raw_input())
H = map(int, raw_input().split())

def sumOfCost(i):
  if i == 0:
    return 0
  elif i == 1:
    return sumOfCost(0)+abs(H[i]-H[0])
  else:
    c1 = sumOfCost(i-1)+abs(H[i]-H[i-1])
    c2 = sumOfCost(i-2)+abs(H[i]-H[i-2])
    return min(c1,c2)
print sumOfCost(N-1)

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

def sumOfCost(i):
  if i == 0:
    return 0
  elif i == 1:
    return sumOfCost(0)+abs(H[i]-H[0])
  else:
    c1 = sumOfCost(i-1)+abs(H[i]-H[i-1])
    c2 = sumOfCost(i-2)+abs(H[i]-H[i-2])
    return min(c1,c2)
print sumOfCost(N-1)
Problem p03162 (python)

Fixed submission:

import sys

sys.setrecursionlimit(100000)
N = int(raw_input())
act = [map(int, raw_input().split()) for _ in range(N)]
memo = [[-1]*3 for _ in range(N)]

def happy(n, i):
  if memo[n][i] >= 0:
    return memo[n][i]
  if n == 0:
    h = act[n][i]
  else:
    h = -1
    for j in range(3):
      if j == i:
        continue
      c = happy(n-1,j)+act[n][i]
      h = h if h > c else c
  memo[n][i] = h
  return h
print max(happy(N-1,0),happy(N-1,1),happy(N-1,2))

Buggy submission (verdict: Runtime Error):

import sys

sys.setrecursionlimit(100000)
N = int(raw_input())
act = [map(int, raw_input().split()) for _ in range(N)]
memo = [[-1]*3 for _ in range(N)]

def happy(n, i):
  if memo[n][i] >= 0:
    return memo[n][i]
  if n == 0:
    h = act[n][i]
  else:
    h = -1
    for j in range(3):
      if j == i:
        continue
      c = happy(n-1,j)+act[n][i]
      h = h if h > c else c
  memo[n][i] = h
  return h
print max(happy(N-1,0),happy(N-1,1),happy(N-1,2))

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
act = [map(int, raw_input().split()) for _ in range(N)]
memo = [[-1]*3 for _ in range(N)]

def happy(n, i):
  if memo[n][i] >= 0:
    return memo[n][i]
  if n == 0:
    h = act[n][i]
  else:
    h = -1
    for j in range(3):
      if j == i:
        continue
      c = happy(n-1,j)+act[n][i]
      h = h if h > c else c
  memo[n][i] = h
  return h
print max(happy(N-1,0),happy(N-1,1),happy(N-1,2))
Problem p03229 (python)

Fixed submission:
N = int(input())
signs = [1, -1]
coefs = [[-1],[1]]
i = 0
while i < N-2:
  j = 0
  while j < 2:
    coefs[j].append(2*signs[j])
    signs[j] *= -1
    j += 1
  i += 1
coefs[0].append(signs[0])
coefs[1].append(signs[1])
coefs[0].sort()
coefs[1].sort()
A = sorted([int(input()) for _ in range(N)])
print(max([sum([A[i]*coef[i]  for i in range(N)]) for coef in coefs]))

Buggy submission (verdict: Runtime Error):
from collections import deque
import copy

def solve(idx, arr, lcur, rcur, isL):
  if len(idx) == len(arr):
    return sum([abs(arr[idx[i]]-arr[idx[i-1]]) for i in range(1, len(idx))])
  else:
    fL = copy.copy(idx)
    fR = copy.copy(idx)
    if isL:
      if lcur <= rcur:
        fL.appendleft(lcur)
        fR.append(lcur)
        lcur += 1
        if lcur <= rcur:
          fL.append(lcur)
          fR.appendleft(lcur)
          lcur += 1
    else:
      if lcur <= rcur:
        fL.appendleft(rcur)
        fR.append(rcur)
        rcur -= 1
        if lcur <= rcur:
          fL.append(rcur)
          fR.appendleft(rcur)
          rcur -= 1
    return max(solve(fL, arr, lcur, rcur, not isL), solve(fR, arr, lcur, rcur, not isL))

N = int(input())
A = sorted([int(input()) for _ in range(N)])
print(solve(deque([0]), A, 1, N-1, False))
Problem p03288 (python)

Fixed submission:
r = int(raw_input())
if r < 1200:
  print "ABC"
elif r < 2800:
  print "ARC"
else:
  print "AGC"

Buggy submission (verdict: Runtime Error):
r = int(raw_input())
if r < 1200:
  print "ABC"
elif r < 2800:
  print "ARC":
else:
  print "AGC"
Problem p03296 (python)

Fixed submission:
N = int(raw_input())
a = map(int, raw_input().split())
ans = 0
i = 0
while i < N-1:
  if a[i] == a[i+1]:
    if i+2 < N and a[i] == a[i+2]:
      a[i+1] = 101+ans
    else:
      a[i] = 101+ans
    ans += 1
    i += 2
  else:
    i += 1
print ans

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
a = map(int, raw_input().split())
ans = 0
i = 0
while i < N-1:
  if a[i] == a[i+1]:
    if i+1 < N and a[i] == a[i+2]:
      a[i+1] = 101+ans
      i += 3
    else:
      a[i] = 101+ans
      i += 2
    ans += 1
  else:
    i += 1
print ans
Problem p03297 (python)

Fixed submission:
def gcd(X,Y):
  if X < Y:
    tmp = X
    X = Y
    Y = tmp
  if Y == 0:
    return 0
  while X % Y != 0:
    r = X % Y
    X = Y
    Y = r
  return Y
T = int(raw_input())
Q = [map(int, raw_input().split()) for _ in range(T)]
for q in Q:
  A,B,C,D = q
  if B > A:
    print 'No'
  elif B > D:
    print 'No'
  elif B <= C:
    print 'Yes'
  else:
    A = A%B
    D = D%B
    g = gcd(B,D)
    maximum = A if g == 0 else B-g+A%g
    if maximum > C:
      print 'No'
    else:
      print 'Yes'

Buggy submission (verdict: Runtime Error):
def gcd(X,Y):
  if X < Y:
    tmp = X
    X = Y
    Y = tmp
  if Y == 0:
    return 0
  while X % Y != 0:
    r = X % Y
    X = Y
    Y = r
  return Y
T = int(raw_input())
Q = [map(int, raw_input().split()) for _ in range(T)]
for q in Q:
  A,B,C,D = q
  if B > A:
    print 'No'
  elif B > D:
    print 'No'
  elif B <= C:
    print 'Yes'
  else:
    A = A%B
    D = D%B
    g = gcd(B,D)
    maximum = B-g+A%g
    if maximum > C:
      print 'No'
    else:
      print 'Yes'
Problem p03331 (python)

Fixed submission:
N = int(raw_input())
ans = 1000000
for A in range(1, 1+N/2):
  B = N - A
  a = 0
  b = 0
  tA = A
  tB = B
  for i in range(6)[::-1]:
    ta = tA/10**i
    tb = tB/10**i
    a += ta
    b += tb
    tA -= ta*(10**i)
    tB -= tb*(10**i)
  ans = min(ans, a+b)
print ans

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
ans = 1000000
for A in range(1, 1+N/2):
  B = N - A
  a = 0
  b = 0
  for i in range(6)[::-1]:
    ta = tA/10**i
    tb = tB/10**i
    a += ta
    b += tb
    A -= ta*(10**i)
    B -= tb*(10**i)
  ans = min(ans, a+b)
print ans
Problem p03338 (python)

Fixed submission:
N = int(raw_input())
S = list(raw_input())
ans = 0
for n in range(N):
 B = set(S[:n])
 E = set(S[n:])
 c = 0
 for b in B:
  if b in E:
   c += 1
 if c > ans:
  ans = c
print ans

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
S = list(raw_input())
ans = 0
for n in range(N):
 B = set(S[:n])
 E = set(S[n:])
 c = 0
 for b in B:
  if b in E:
   c += 1
 if c > ans:
  ans = c
print and
Problem p03339 (python)

Fixed submission:
N = int(raw_input())
S = list(raw_input())
S = ['X']+S+['X']
D = [[0, 0]]
W = [0] * (N+2)
E = [0] * (N+2)
for i in range(1,N+2):
 W[i] = W[i-1]+(1 if S[i-1]== 'W' else 0)
for i in range(N+1)[::-1]:
 E[i] = E[i+1]+(1 if S[i+1]== 'E' else 0)
ans = N
for i in range(N):
  if W[i+1]+E[i+1] < ans:
   ans = W[i+1]+E[i+1]
print ans

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
S = list(raw_input())
D = [[0, 0]]
W = [0] * (N+2)
E = [0] * (N+2)
for i in range(N):
 if S[i] == 'W':
  W[i+1] = W[i]+1
for i in range(N)[::-1]:
 if S[i] == 'E':
  E[i] = E[i+1]+1
ans = N+1
for w, e in zip(W, E):
  if w+e < ans:
  ans = w+e
print ans
Problem p03364 (python)

Fixed submission:
N = int(raw_input())
S = [list(raw_input()) for t in range(N)]
ans = 0
for n in range(N):
  t = S[n:]+S[:n]
  t_t = list(map(list, zip(*t)))
  if t == t_t:
    ans += 1
#for n in range(N):
#  isSym = True
#  for i in range(N):
#    for j in range(i,N):
#      if S[i][j] != S[j][i]:
#        isSym = False
#        break
#    if not isSym:
#      break
#  ans += 1 if isSym else 0
#  s = S.pop()
#  S.insert(0, s)
print ans*N

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
S = [list(raw_input()) for t in range(N)]
ans = 0
for n in range(N):
  t = s[a:]+s[:a]
  t_t = list(map(list, zip(*t)))
  if t == t_t:
    ans += 1
#for n in range(N):
#  isSym = True
#  for i in range(N):
#    for j in range(i,N):
#      if S[i][j] != S[j][i]:
#        isSym = False
#        break
#    if not isSym:
#      break
#  ans += 1 if isSym else 0
#  s = S.pop()
#  S.insert(0, s)
print ans*N
Problem p03425 (python)

Fixed submission:
import itertools
N = int(raw_input())
S = [raw_input() for _ in range(N)]
march = list("MARCH")
I = {"M":0,"A":0,"R":0,"C":0,"H":0}
for s in S:
  if s[0] in I.keys():
    I[s[0]] += 1
for i in march:
  if I[i] < 1:
    I.pop(i)
K = list(I.keys())
ans = long(0)
for c in list(itertools.combinations(K, 3)):
    ans += I[c[0]]*I[c[1]]*I[c[2]]
print ans

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
nums = {}
for _ in range(N):
  s = input()[0]
  if s in nums.keys():
    nums[s] += 1
  else:
    nums[s] = 1
ans = 0
for C in itertools.combinations(list("MARCH"),3):
  tmp = 1
  for c in C:
    if c in nums.keys():
      tmp *= nums[c]
    else:
      tmp = 0
  ans += tmp
print(ans)
Problem p02678 (python)

Fixed submission:
import collections

if __name__ == '__main__':
    n, m = map(int, input().split())
    l = [list(map(int, input().split())) for i in range(m)]

    ways = [[] for i in range(n+1)]

    for i in l:
        ways[i[0]].append(i[1])
        ways[i[1]].append(i[0])

    #print(ways)

    q = collections.deque()

    ans = [-1] * n # 道案内
    ans[0] = 0

    q.append(1)

    while(len(q) != 0):
        item = q.popleft()
        for i in ways[item]:
            if ans[i-1] == -1:
                ans[i-1] = item
                q.append(i)
                #print(ans , i , item)

    if -1 in ans:
        print("No")
    else:
        print("Yes")
        for i in range(1,n):
            print(ans[i])

Buggy submission (verdict: Runtime Error):
import collections

if __name__ == '__main__':
    n, m = map(int, input().split())
    l = [list(map(int, input().split())) for i in range(m)]

    ways = [[] for i in range(n+1)]

    for i in l:
        ways[i[0]].append(i[1])
        ways[i[1]].append(i[0])

    #print(ways)

    q = collections.deque()

    ans = [-1] * n # 道案内
    ans[0] = 0

    q.append(1)

    while(len(q) != 0):
        item = q.popleft()
        for i in ways[item]:
            if ans[i-1] == -1:
                ans[i-1] = item
                q.append(i)
                #print(ans , i , item)

    if -1 in ans:
        print("No")

    else:
        for i in range(1,n):
        print("Yes")
        print(ans[i])
Problem p02684 (python)

Fixed submission:
if __name__ == '__main__':

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

    root = [] # 訪れた頂点をメモ
    already = [-1] * (n+1) # rootのindexのメモ　と　すでに訪れたか

    c = 1# 周期
    l = 0# 例外部分のながさ

    v = 1#頂点は1 ここから遷移
    while(already[v] == -1): # すでに書いてあれば訪れている。かつ周期の起点となる場所
        already[v] = len(root) #訪れたら何回目かを記述
        root.append(v)
        v = a[v-1]

    c = len(root) - already[v]
    l = already[v]

    if k < l:#例外部分のながさ
        ans = root[k]
    else:# 周期にいるなら
        k -= l
        ans = root[k%c+l]

    print(ans)

Buggy submission (verdict: Runtime Error):

def looptime(n, a):
    for i in range(n):
        loop = 0
        start = i
        now = i

        time = 0

        while(loop < n):
            now = a[now]
            loop += 1
            now -= 1

            if now == start:
                return i+1, loop

def start_loop(goal, a):
    loop = 0
    now = 0

    time = 0

    while(loop < n):
        now = a[now]
        loop += 1
        now -= 1

        if now == goal-1:
            return loop

if __name__ == '__main__':

    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    start, loop = looptime(n, a)
    how = start_loop(start, a)
    point = k%loop

    #print(start, loop, point, how)

    if how == loop:
        # startからループ開始
        time = 0
        now = 0
        while(time < point):
            now = a[now]
            now -= 1
            time += 1
        print(now+1)

    else:
        # 途中からループ開始
        if how > k:
            time = 0
            now = 0
            while(time < k):
                now = a[now]
                now -= 1
                time += 1
            print(now+1)

        else:
            time = 0
            now = start-1
            point = (point+how)%loop
            while(time < point-1):
                now = a[now]
                now -= 1
                time += 1
            print(now+1)
Problem p02687 (python)

Fixed submission:
s = input()

if s == "ARC":
    print("ABC")
elif s == "ABC":
    print("ARC")

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

if s = "ARC":
    print("ABC")
elif s = "ABC":
    print("ARC")

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

if s = "ARC":
    print("ABC")
elif s = "ABC"
    print("ARC")
Problem p02696 (python)

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

if b <= n:
    x = b-1

new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)

Buggy submission (verdict: Runtime Error):
import math
a, b, n = map(int, input().split())
if n < b:
    x = n
else b < n:
    x = b-1
new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)

Buggy submission (verdict: Runtime Error):
import math
a, b, n = map(int, input().split())
if n < b:
    x = n
elif b < n:
    x = b-1
new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)

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

max = -1

if n < b:
    x = n
elif b < n:
    x = b-1

new = math.floor(a*x/b) - a * math.floor(x/b)

print(new)
Problem p02767 (python)

Fixed submission:

n = int(input())
x = list(map(int, input().split()))
cost = 10**9
for i in range(1,100):
    now = 0
    for j in x:
        now += (i-j)**2
    if cost > now:
        cost = now
print(cost)

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

p0 = math.floor(sum(x)/len(x))
# 123
cost = 10**9
for i in range(0,100):
    now = 0
    for i in x:
        now += abs(p0-i)**2
    if cost > now:
        cost = now

print(now)
Problem p02768 (python)

Fixed submission:
def solve():

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

    # 繰り返し二乗法
    def modPow(a, n, mod):
        if n == 1:
            return a
        elif n%2 == 1:
            return a * modPow(a, n-1, mod) % mod
        else:
            t = modPow(a, n/2, mod)
            return (t * t) % mod

    def combination(n, a, mod):
        x = 1
        y = 1
        for i in range(a):
            x = x * (n-i)%mod
            y = y * (a-i)%mod

            #x *= (n-i)
            #x %=mod
            #y *= (a-i)
            #y %=mod
        return x * pow(y, mod-2, mod)%mod

    #全ての選び方
    sigma_nCi = pow(2, n, mod)
    # nCa, nCb
    nCa = combination(n, a, mod)
    nCb = combination(n, b, mod)

    ans = sigma_nCi - 1 - nCa - nCb

    #print(Sigma_nCi, nCa, nCb)
    print(ans%mod)

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
    def solve():
     
        n, a, b = map(int, input().split())
        mod = 10**9 + 7
     
        # 繰り返し二乗法 使ってない
        def modPow(a, n, mod):
            if n == 1:
                return a
            elif n%2 == 1:
                return a * modPow(a, n-1, mod) % mod
            else:
                t = modPow(a, n/2, mod)
                return (t * t) % mod
     
        def combination(n, a, mod):
            x = 1
            y = 1
            for i in range(a):
                x = x * (n-i)%mod
                y = y * (a-i)%mod
                #遅い
                #x *= (n-i)%mod
                #y *= (a-i)%mod
            return x * pow(y, mod-2, mod)%mod
     
        #全ての選び方
        sigma_nCi = pow(2, n, mod)
        # nCa, nCb
        nCa = combination(n, a, mod)
        nCb = combination(n, b, mod)
     
        ans = sigma_nCi - 1 - nCa - nCb
     
        #print(Sigma_nCi, nCa, nCb)
        print(ans%mod)
     
    if __name__ == '__main__':
        solve()
Problem p02795 (python)

Fixed submission:
import math
H = int(input())
W = int(input())
N = int(input())

long = W

if H > W:
    long = H

ans = math.ceil(N/long)

print(ans)

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

if K == 0:
    anslist = []
    for i in range(N):
        ramdam = S+1 // (10**9)
        anslist.append(str(ramdam))
    print(" ".join(anslist))


elif N == K:
    anslist = [str(S) for i in range(N)]
    ansString = " ".join(anslist)
    print(ansString)
    exit()

else:
    if S%2 == 0:
        anslist = [str(S//2) for i in range(K+1)]
        for i in range(N - len(anslist)):
            ramdam = S+1 // 10**9
            anslist.append(str(ramdam))
        print(" ".join(anslist))

    elif S == 1:
        anslist = []
        for i in range(K):
            item = [str(1)]
            anslist.extend(item)
        for i in range(N - len(anslist)):
            ramdam = S+1 // 10**9
            anslist.append(str(ramdam))
        print(" ".join(anslist))


    else:
        anslist = []
        t = 1
        for i in range(K-1):
            item = [str(t),str(S-t)]
            anslist.extend(item)
            t += 1
        anslist.append(str(S))
        for i in range(N - len(anslist)):
            ramdam = S+1 // 10**9
            anslist.append(str(ramdam))
        print(" ".join(anslist))