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

Fixed submission:
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3
sys.setrecursionlimit(int(1e+7))  # スタック上限

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    XY = ii2nnn(N)
    M = int(1e+5) + 5

    # 二部グラフ
    to = [[] for _ in range(M*2)]
    cnt = [0] * (M*2)
    visited = [False] * (M*2)

    # 二部グラフを構築
    for x, y in XY:
        y += M
        to[x].append(y)
        to[y].append(x)

    cnt = [0, 0]
    def bfs(n):
        q = deque()
        q.append(n)
        while q:
            i = q.popleft()
            if visited[i]:
                continue
            visited[i] = True
            cnt[i // M] += 1
            for j in to[i]:
                q.append(j)

    # 二部グラフを走査
    ans = 0
    for i in range(M*2):
        if visited[i]:
            continue
        cnt[0] = 0
        cnt[1] = 0
        bfs(i)
        ans += cnt[0] * cnt[1]
    
    ans -= N  # 既にある点は操作数に含まれない
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3
#sys.setrecursionlimit(int(1e+7))  # スタック上限

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    XY = ii2nnn(N)
    M = int(1e+5) + 5

    # 二部グラフ
    to = [[] for _ in range(M*2)]
    cnt = [0] * (M*2)
    visited = [False] * (M*2)

    # 二部グラフを構築
    for x, y in XY:
        y += M
        to[x].append(y)
        to[y].append(x)

    cnt = [0, 0]
    def dfs(i):
        if visited[i]:
            return
        visited[i] = True
        cnt[i // M] += 1
        for j in to[i]:
            dfs(j)

    # 二部グラフを走査
    ans = 0
    for i in range(M*2):
        if visited[i]:
            continue
        cnt[0] = 0
        cnt[1] = 0
        dfs(i)
        ans += cnt[0] * cnt[1]
    
    ans -= N  # 既にある点は操作数に含まれない
    print(ans)

main()
Problem p03013 (python)

Fixed submission:
import sys

from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i = bisect.bisect_left([1,2,3,4], 1.5); i = bisect.bisect_right([4,3,2,1], 1.5)

#import numpy as np
#from scipy.misc import comb

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def fib_memo(n):
    memo = [0] * (n+1)
    memo[0] = 1
    if n < 1:
        return memo
    memo[1] = 1
    for i in range(2, n+1):
        memo[i] = memo[i-1] + memo[i-2]
    return memo

def main():
    N, M = i2nn()
    A = ii2nn(M)
    MOD = int(1e+9) + 7
    D = [0] * (M+1)
    if M == 0:
        D[0] = N
    else:
        D[0] = A[0] - 1
        for i in range(1, M):
            t = A[i] - A[i-1] - 2
            if t <= -1:
                print(0)
                return
            D[i] = t
        D[M] = N - A[M-1] - 1
    n = 1
    memo = fib_memo(max(D))
    for d in D:
        n = (n * memo[d]) % MOD
    print(n)

main()

Buggy submission (verdict: Runtime Error):
import sys

from collections import deque
# q = deque(); q.append(x); q.appendleft(x); q.pop() -> x; q.popleft() -> x
from collections import defaultdict
# d = defaultdict(lambda: []); d[key] -> []
import heapq
# hq = []; heapq.heappush(hq, x); heapq.heappop(hq) -> x; heapq.heappushpop(hq, x) -> x
import bisect
# i = bisect.bisect_left([1,2,3,4], 1.5); i = bisect.bisect_right([4,3,2,1], 1.5)

#import numpy as np
#from scipy.misc import comb

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def fib_memo(n):
    memo = [0] * (n+1)
    memo[0] = 1
    memo[1] = 1
    for i in range(2, n+1):
        memo[i] = memo[i-1] + memo[i-2]
    return memo

def main():
    N, M = i2nn()
    A = ii2nn(M)
    MOD = int(1e+9) + 7
    D = [0] * (M+1)
    if M == 0:
        D[0] = N
    else:
        D[0] = A[0] - 1
        for i in range(1, M):
            t = A[i] - A[i-1] - 2
            if t <= 1:
                print(0)
                return
            D[i] = t
        D[M] = N - A[M-1] - 1
    n = 1
    memo = fib_memo(max(D))
    for d in D:
        n = (n * memo[d]) % MOD
    print(n)

main()
Problem p03038 (python)

Fixed submission:
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    A = i2nn()
    BC = ii2nnn(M)
    A.sort()
    BC.sort(key=lambda x: x[1])
    BC.reverse()
    #print(A)
    #print(BC)
    i = 0
    for b, c in BC:
        for _ in range(b):
            if i >= len(A) or A[i] >= c:
                break
            A[i] = c
            i += 1
    #print(A)
    print(sum(A))

main()

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

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    A = i2nn()
    BC = ii2nnn(M)
    A.sort()
    BC.sort(key=lambda x: x[1])
    BC.reverse()
    #print(A)
    #print(BC)
    i = 0
    for b, c in BC:
        for _ in range(b):
            if A[i] >= c:
                break
            A[i] = c
            i += 1
    #print(A)
    print(sum(A))

main()
Problem p03221 (python)

Fixed submission:
import sys
 
s2nn = lambda s: [int(c) for c in s.split(' ')]
 
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
 
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
 
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
 
def main(N, M, PYm):
    # 県番号pと市誕生年yから認識番号を得られる辞書
    # dic[p][y] -> 認識番号
    dic = {}
    # 県ごとに、市誕生年を昇順ソートし、認識番号を1,2,...と対応づける
    # dic2[p] -> [(1, sorted_y1), (2, sorted_y2), ...]
    # dic2tmp[p] -> [y1, y2, ...]
    #dic2 = {}
    dic2tmp = {}
    for p in range(N+1):
        dic[p] = {}
        #dic2[p] = []
        dic2tmp[p] = []
    for p, y in PYm:
        dic2tmp[p].append(y)
    for p in range(N+1):
        dic2tmp[p].sort()
        nby = [(i+1, y) for i, y in enumerate(dic2tmp[p])]
        #dic2[p] = nby
        for nb, y in nby:
            dic[p][y] = nb
    # 表示
    for p, y in PYm:
        nb = dic[p][y]
        print('%06d%06d' % (p, nb))

N, M = i2nn()
PYs = ss2nnn(ii2ss(M))
main(N, M, PYs)

Buggy submission (verdict: Runtime Error):
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]

ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]

i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())

ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]

def main(N, M, PYm):
    # 県番号pと市誕生年yから認識番号を得られる辞書
    # dic[p][y] -> 認識番号
    dic = {}
    # 県ごとに、市誕生年を昇順ソートし、認識番号を1,2,...と対応づける
    # dic2[p] -> [(1, sorted_y1), (2, sorted_y2), ...]
    # dic2tmp[p] -> [y1, y2, ...]
    #dic2 = {}
    dic2tmp = {}
    for p in range(N+1):
        dic[p] = {}
        #dic2[p] = []
        dic2tmp[p] = []
    for p, y in PYm:
        dic2tmp[p].append(y)
    for p in range(N+1):
        dic2tmp[p].sort()
        nby = [(i+1, y) for i, y in enumerate(dic2tmp[p])]
        #dic2[p] = nby
        for nb, y in nby:
            dic[p][y] = nb
    # 表示
    for p, y in PYm:
        nb = dic[p][y]
        print('%06d%06d' % (p, nb))
N, M = i2nn()
PYs = ss2nnn(ii2ss())
main(N, M, PYs)
Problem p02759 (python)

Fixed submission:
n = int(input())
ans = 0
if n % 2 == 0:
  ans = int(n / 2)
else:
  ans = int(n / 2) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
def main():
  a = []
  ans = "No"
  hit_examples = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
  for i in range(3):
    a.extend(list(map(int, input().split())))
  n = int(input())
  b = []
  for i in range(n):
    b.append(int(input()))
  for b_value in b:
    for i in range(len(a)):
      if b_value == a[i]:
        a[i] = -1

  for hit_example in hit_examples:
    cnt = 0
    for i in range(len(a)):
      if a[i] == -1 and i in hit_example:
        cnt += 1
      if cnt == 3:
        ans = "Yes"
        print(ans)
        return
  print(ans)

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

Fixed submission:
n, k = map(int, input().split())
cnt = 1
while True:
  if n <= k**cnt - 1:
    break
  cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
cnt = 1
while True:
  if n <= k**cnt + 1:
    cnt++
print(cnt)
Problem p02779 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = None
for i in range(len(a) - 1):
  if a[i] == a[i + 1]:
    ans = 'NO'
    break
else:
  ans = 'YES'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = None
for i in a:
  if a.find(i) != -1:
    ans = 'NO'
    break
else:
  ans = 'YES'
print(ans)
Problem p02916 (python)

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

ans=0

for x,y in zip(a,a[1:]):
  if y == x+1:
    ans += c[x-1]
    
print(sum(b)+ans)

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

ans=0

for x,y in zip(a,a[1:]):
  if y == x+1:
    ans += c[x-1]
    
print(sum(y)+ans)
Problem p02970 (python)

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

print((N+2*D) // (2*D+1))

Buggy submission (verdict: Runtime Error):
N=int(input())
D=int(input())

print((N+D*2)//(D*2+1))

Buggy submission (verdict: Runtime Error):
N=int(input())
D=int(input())

print((N+D*2)/(D*2+1))
Problem p03011 (python)

Fixed submission:
a,b,c = map(int,input().split())
print(min(a+b,a+c,b+c))

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

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

Buggy submission (verdict: Runtime Error):
P,Q,R = list(map(int,input().split()))

a = P + Q
b = P + R
c = Q + R
d = Q + P
e = R + Q
f = R + P

mn_list = list[a,b,c,d,e,f]
mn = min(mn_list)

print(mn)

Buggy submission (verdict: Runtime Error):
P,Q,R = map(int,input().split())

a = P + Q
b = P + R
c = Q + R
d = Q + P
e = R + Q
f = R + P

mn_list = list[a,b,c,d,e,f]
mn = min(mn_list)

print(mn)

Buggy submission (verdict: Runtime Error):
P,Q,R = map(int,input().split())

a = P + Q
b = P + R
c = Q + R
d = Q + P
e = R + Q
f = R + P

list[a,b,c,d,e,f]
mn = min(list)

print(mn)

Buggy submission (verdict: Runtime Error):
P,Q,R = map(int,input().split())

a = P + Q
b = P + R
c = Q + R
d = Q + P
e = R + Q
f = R + P

list[a,b,c,d,e,f]

print(min(list))
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print("".join(s))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()
print("".join(s))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()
print(s)
Problem p03072 (python)

Fixed submission:
n=int(input())
m=list(map(int,input().split()))
ans=1

for i in range(1,n):
  if max(m[:i]) <= m[i]:
    ans += 1
print(ans)

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

for i in range(n+1):
  if m[0] <= m[i]:
    ans += 1
print(ans)
Problem p03075 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if e-a <= k:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

s=[a,b,c,d,e,k]

if s[5]-s[0] <= s[6]:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(6)]
if s[5]-s[0] < s[6]:
  print("Yay!")
else:
  print(":(")
Problem p03242 (python)

Fixed submission:
print(input().replace("1","*").replace("9","1").replace("*","9"))

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n.replace("1","9").replace("9","1").replace("1","1").replace("9","9"))

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n.replace("1","9").replace("9","1").replace("1","a").replace("9","a"))

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n.replace("1","9").replace("9","1"))

Buggy submission (verdict: Runtime Error):
n=int(input())
l = [int(x) for x in list(str(n))]
print(l.replace("1","9").replace("9","1"))

Buggy submission (verdict: Runtime Error):
n=input()
l = [int(x) for x in list(str(n))]
print(l.replace("1","9").replace("9","1"))

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n.replace("1","9").replace("9","1"))
Problem p03250 (python)

Fixed submission:
A,B,C=sorted(map(int,input().split()))
print(A+B+C*10)

Buggy submission (verdict: Runtime Error):
A,B,C=sorted(map(int,input.split()))
print(A+B+C*10)

Buggy submission (verdict: Runtime Error):
A,B,C=sorted(map(int.input.split()))
print(A+B+C*10)

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().split())
s.sort()
print(max(10*s[0]+s[1]+s[2],s[0]+s[1]*10+s[2],s[0]+s[1]+s[2]*10))
Problem p03272 (python)

Fixed submission:
N,i=map(int,input().split())
print(N+1-i)

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

Buggy submission (verdict: Runtime Error):
a,b=int(input.split())
print(a-b+1)

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

Buggy submission (verdict: Runtime Error):
N,i=map(int,input.split())
print((N-i)+1)
Problem p03307 (python)

Fixed submission:
N=int(input())
if N % 2 == 0:
  print(N)
else:
  print(N*2)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N % 2 = 0:
  print(N)
else:
  print(N*2)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N // 2 = 0:
  print(N)
else:
  print(2*N)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N // 2 = 0:
  print(N)
else:
  print(N*2)
Problem p03327 (python)

Fixed submission:
N=int(input())

if N < 1000:
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
N=int(input())

if N < 1000:
  print("ABC"+N)
else:
  print("ABD"+N)
Problem p02757 (python)

Fixed submission:
N, P = map(int, input().split())
S = input()
now = 0
hyou = [0] * P
hyou[0] = 1
cnt = 1
ans = 0

if P == 2 or P == 5:
    for i, t in enumerate(S[::-1]):
        temp = int(t)
        if temp % P == 0:

            ans += N - i
    print(ans)
    exit()

for i, t in enumerate(S[::-1]):
    now = (now + int(t) * pow(10, i, P)) % P
    ans += hyou[now]
    hyou[now] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# li = [[0] * 4 for i in range(3)]

# A = list.map(int, input().split())

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

S = input()


memo = {}


def dfs(n):
    # print(n)
    if n in memo:
        return memo[n]

    i = n + 1
    while i <= N:
        temp_int = int(S[n:i])
        # print(temp_int)
        if temp_int % P == 0:
            memo[n] = 1 + dfs(i)
            return memo[n]

        i += 1
    return 0


ans = 0
for i in range(N):
    temp = dfs(i)
    ans += temp

print(ans)
Problem p02627 (python)

Fixed submission:
a = input()
if a.isupper():
  print('A')
else:
  print('a')

Buggy submission (verdict: Runtime Error):
a = input()
if a.isUpper():
  print('A')
else:
  print('a')
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()

n = len(S)
if n <= K:
    print(S)
else:
    print(S[0:K] + '...')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()

n = len(s)
if n > K:
  print(S)
else:
  print(S[0:K+1]+'...')
Problem p02859 (python)

Fixed submission:
r = int(input())
print(int(r**2))

Buggy submission (verdict: Runtime Error):
import math
X,Y = map(int,input().split())
def comb(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
if (X+Y)%3 != 0:
    print(0)
else:
    n = int((2*Y-X)/3)
    m = int((2*X-Y)/3)
    if n < 0 or m < 0:
        print(0)
    else:
        print((comb(n+m,min([n,m])))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
X,Y = map(int,input().split())
def comb(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
if (X+Y)%3 != 0:
    print(0)
else:
    n = int((2*Y-X)/3)
    m = int((2*X-Y)/3)
    if n < 0 or m < 0:
        print(0)
    else:
        print((comb(n+m,min([n,m])))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
X,Y = map(int,input().split())
def comb(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
if (X+Y)%3 != 0:
    print(0)
else:
    n = int((2*Y-X)/3)
    m = int((2*X-Y)/3)
    print((comb(n+m,min([n,m])))%(10**9+7))
Problem p02954 (python)

Fixed submission:
S = input()
def runlength(str):
    res = []
    data,count = str[0],1
    for i in range(1,len(str)):
        if str[i] == data:
            count += 1
        else:
            res.append((data,count))
            data,count = str[i],1
    res.append((data,count))
    return res
ans = [0]*len(S)
ind = -1
for rl in runlength(S):
    if rl[0] == "R":
        ind += rl[1]
        ans[ind] += rl[1] - rl[1]//2
        ans[ind+1] += rl[1]//2
    else:
        ans[ind] += rl[1]//2
        ans[ind+1] += rl[1] - rl[1]//2
        ind += rl[1]
print(*ans)

Buggy submission (verdict: Runtime Error):
S = input()
c = 0
d = ""
runlength = []
for i in range(len(S)):
    if d == "":
        d = S[i]
        c += 1
    if d == S[i]:
        c += 1
    else:
        runlength.append([d,c])
        d = ""
        c = 0
ans = [0]*len(S)
ind = -1
for rl in runlength:
    if rl[0] == "R":
        ind += rl[1]
        ans[ind] += rl[1] - rl[1]//2
        ans[ind+1] += rl[1]//2
    else:
        ans[ind] += rl[1]//2
        ans[ind+1] += rl[1] - rl[1]//2
        ind += rl[1]
print(*ans)
Problem p03013 (python)

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
booli = [False]*(N+1)
for i in a:
    booli[i] = True
mod = 1000000007
INF = -1
dp = [INF]*(N+1)
dp[0] = 1
if booli[1]:
    dp[1] = 0
else:
    dp[1] = 1
def solve():
    for i in range(2,N+1):
        if booli[i]:
            dp[i] = 0
        else:
            dp[i] = dp[i-1]+dp[i-2]
    return dp[N]%mod
print(solve())

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
booli = [False]*(N)
for i in a:
    booli[i-1] = True
mod = 1000000007
INF = -1
dp = [INF]*(N+1)
dp[0] = 1
if booli[1]:
    dp[1] = 0
else:
    dp[1] = 1
def solve():
    for i in range(2,N+1):
        if booli[i-1]:
            dp[i] = 0
        else:
            dp[i] = dp[i-1]+dp[i-2]
    return dp[N]%mod
print(solve())
Problem p03207 (python)

Fixed submission:
p=[]
N=int(input())
for i in range(N):
  p.append(int(input()))
ans=sum(p)-(max(p)/2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
p=[]
N=int(input())
for i in range:
  p.append(int(input()))
ans=sum(p)-(max(p)2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
p=list(map(int,input().split("\n")))
ans=sum(p)-(max(p)2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
p=[int(input()) for i in range(N)]
ans=sum(p)-(max(p)2)
print(int(ans))
Problem p03327 (python)

Fixed submission:
N = int(input())
if N <= 999:
    print("ABC")
else:
    print("ABD")

Buggy submission (verdict: Runtime Error):
N = input()
if N >= 999:
    print("ABC")
else:
    print("ABD")
Problem p03803 (python)

Fixed submission:
A,B = map(int,input().split())
tmp = [A,B]
ans = ["Alice","Bob"]
if tmp[0] == tmp[1]:
    print("Draw")
elif tmp[0] == 1:
    print(ans[0])
elif tmp[1] == 1:
    print(ans[1])
elif tmp[0] > tmp[1]:
    print(ans[0])
else:
    print(ans[1])

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
tmp = list(A,B)
ans = ["Alice","Bob"]
if tmp[0] == tmp[1]:
    print("Draw")
elif tmp[0] == 1:
    print(ans[0])
elif tmp[1] == 1:
    print(ans[1])
elif tmp[0] > tmp[1]:
    print(ans[0])
else:
    print(ans[1])
Problem p03821 (python)

Fixed submission:
def main():
    N = int(input())
    A = [None]*N
    B = [None]*N
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    tmp = 0
    ans = 0
    for i in range(N-1,-1,-1):
        if (A[i]+tmp)%B[i] == 0:
            continue
        ans += (B[i] - (A[i]+tmp)%B[i])
        tmp += (B[i] - (A[i]+tmp)%B[i])
    print(ans)

if __name__ == '__main__':
    main()

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

def main():
    N = int(input())
    A = np.array([None]*N)
    B = np.array([None]*N)
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    ans = 0
    for i in range(N-1,-1,-1):
        if A[i]%B[i] == 0:
            continue
        ans += (B[i] - A[i]%B[i])
        A += (B[i] - A[i]%B[i])
    print(ans)


if __name__ == '__main__':
    main()