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

Fixed submission:
n, k = map(int, input().split())
h = []
for i in range(n):
  h.append(int(input()))

h.sort()
  
ans = []
for i in range(n-k+1):
  ans.append(h[i+k-1]-h[i])
  
print(min(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = []
for i in range(n):
  h.append(int(input()))

h.sort()
  
ans = []
for i in range(n-k+1):
  ans.append(h[i+k]-h[i])
  
print(min(h))
Problem p03209 (python)

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

l = [0]*(n+1)
l[0] = 1
for i in range(1,n+1):
  l[i] = l[i-1]*2+3

p = [0]*(n+1)
p[0] = 1
for i in range(1,n+1):
  p[i] = p[i-1]*2+1
  
ans = 0  
def bts(a,b):
  global ans
  if b == 1:
    ans += 0
  elif 1 < b < l[a-1]+1:
    bts(a-1,b-1)
  elif b == l[a-1]+1:
    ans += p[a-1]
  elif b == l[a-1]+2:
    ans += p[a-1]+1
  elif l[a-1]+2 < b < l[a-1]*2+2:
    ans += p[a-1]+1
    bts(a-1,b-2-l[a-1])
  else:
    ans += p[a]

bts(n,x)
  
print(ans)

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

l = [0]*(n+1)
l[0] = 1
for i in range(1,n+1):
  l[i] = l[i-1]*2+3

p = [0]*(n+1)
p[0] = 1
for i in range(1,n+1):
  p[i] = p[i-1]*2+1
  
ans = 0  
def bts(a,b):
  global ans
  if b = 1:
    ans += 0
  elif 1 < b < l[a-1]+1:
    bts(a-1,b-1)
  elif b == l[a-1]+1:
    ans += p[a-1]
  elif b == l[a-1]+2:
    ans += p[a-1]+1
  elif l[a-1]+2 < b < l[a-1]*2+2:
    ans += p[a-1]+1
    bts(a-1,b-2-l[a-1])
  else:
    ans += p[a-1]+2

bts(n,x)
  
print(ans)

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

a = 'P'
for i in range(1,n+1):
  a = 'B'+a+'P'+a+'B'
  
print(a[:x].count('P'))

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

a = 'P'
for i in range(1,n):
  a = 'B'+a+'P'+a+'B'
  
print(a[:x].count('P'))
Problem p03221 (python)

Fixed submission:
n,m = map(int, input().split())
PY = [[] for i in range(m)]
for i in range(m):
  PY[i] = list(map(int, input().split()))
  PY[i].append(i)
  
PY.sort(key = lambda x:x[1])

l = [0]*(n)
for i in range(m):
  l[PY[i][0]-1]+=1
  PY[i].append(l[PY[i][0]-1])

  
PY.sort(key = lambda x:x[2])
for i in range(m):
  print('{:0=6}'.format(PY[i][0])+'{:0=6}'.format(PY[i][3]))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
PY = [[] for i in range(m)]
for i in range(m):
  PY[i] = list(i,map(int, input().split()))

PY.sort(key = lambda x:x[2])
PY.sort(key = lambda x:x[1])

l = [0]*(n)
for i in range(m):
  l[PY[i][1]-1]+=1

for i in range(n):
  j = 0
  while j < l[i]:
    list(filter(lambda x:x[1]==i+1,PY))[j].append(j+1)
    j += 1
  
PY.sort(key = lambda x:x[0])
for i in range(m):
  print('{:0=6}'.format(PY[i][1])+'{:0=6}'.format(PY[i][3]))
Problem p03253 (python)

Fixed submission:
n,m = map(int,input().split())
mod = 10**9+7

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

mf = factorize(m)
from collections import Counter

c = Counter(mf)
ans = 1
from scipy.misc import comb
for i in list(c.values()):
  ans*= comb((i+(n-1)),i,exact=True)

print(int(round(ans))%mod)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
mod = 10**9+7

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

mf = factorize(m)
from collections import Counter

c = Counter(mf)
ans = 1
from scipy.misc import comb
for i in list(c.values()):
  ans*= comb((i+(n-1)),i)

print(round(ans)%mod)
Problem p03835 (python)

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

count = 0
for i in range(K+1):
  for j in range(K+1):
    if 0<= S - i - j <= K:
        count += 1
      
print(count)

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

count = 0
for i in range(K+1):
  for j in range(K+1):
    if S - i - j <= K :
        count += 1
      else:
        pass
      
print(count)
Problem p02954 (python)

Fixed submission:
import numpy as np
s = input()
n = len(s)

pop = [0]*n

lastR = 0
for i in range(n):
    if s[i] == "L":
        if (lastR - i)%2 == 1:
            pop[lastR+1] += 1
        else:
            pop[lastR] += 1
    else:
        lastR = i
            
lastL = n
for i in range(n-1, -1, -1):  
    if s[i] == "R":
        if (lastL - i)%2 == 1:
            pop[lastL-1] += 1
        else:
            pop[lastL] += 1
    else:
        lastL = i
        
print(" ".join(map(str, pop)))

Buggy submission (verdict: Runtime Error):
import numpy as np
s = input()
# s = "RRLLLLRLRRLL"*10000

n = len(s)

pop = [0]*n

for i in range(n):
    if s[i] == "L":
        # iより左でもっとも右のRをみつける
        for dx in range(1, n-1):
            if s[i-dx] == "R":
                break
        idx = i-dx
        
        if (idx - i)%2 == 1:
            pop[idx+1] += 1
        else:
            pop[idx] += 1
    else:
        # iより右でもっとも左のLをみつける
        for dx in range(1, n-1):
            if s[i+dx] == "L":
                break
        idx = i+dx
        if (idx - i)%2 == 1:
            pop[idx-1] += 1
        else:
            pop[idx] += 1
print(" ".join(map(str, pop)))

Buggy submission (verdict: Runtime Error):
s = input()
# s = "R"+"RL"*10000+"L"
step = np.max(list(map(len, s.split("RL"))))

n = len(s)
pop = [1]*n

if step%2 == 1:
    step = step+1
else:
    step = step

for t in range(step):
    new_pop = [0]*n
    for i in range(n):
        if s[i] == "R":
            new_pop[i+1] += pop[i]
        else:
            new_pop[i-1] += pop[i]
    pop = new_pop
print(" ".join(map(str, pop)))
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
    
num = [-1] * (n + 1)
num[0] = 1
num[1] = 1


for i in broken:
    num[i] = 0

for i in range(2, n):
    if num[i] == -1:
        num[i] = (num[i-1] + num[i-2])%1000000007
        
if n <= 1:
    print(num[n])
else:
    print((num[n-1]+num[n-2])%1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
    
num = [0] * n
num[0] = int(0 not in broken)
num[1] = int(1 not in broken)

for i in range(2, n):
    if i in broken:
        num[i] = 0
    else:
        num[i] = (num[i-1] + num[i-2])%1000000007
        
if n <= 1:
    print(num[n])
else:
    print((num[n-1]+num[n-2])%1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
num = {0: int(0 not in broken), 1: int(1 not in broken)}

for i in range(2, n):
    if i in broken:
        num[i] = 0
    else:
        num[i] = (num[i-1] + num[i-2])%1000000007
        
        
print((num[n-1]+num[n-2])%1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
num = {0: int(0 not in broken), 1: int(1 not in broken)}

for i in range(2, n):
    if i in broken:
        num[i] = 0
    else:
        num[i] = num[i-1] + num[i-2]
        
print((num[n-1]+num[n-2])%(1000000007))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
broken = []
for i in range(m):
    broken.append(int(input()))
    
num = {0: int(0 not in broken), 1: int(1 not in broken)}

for i in range(2, n):
    if i in broken:
        num[i] = 0
    else:
        num[i] = num[i-1] + num[i-2]
        
print((num[n-1]+num[n-2])%(1000000007))
Problem p03209 (python)

Fixed submission:
class Burg:
    def __init__(self):
        self.lv = [2**(i+1) - 1 for i in range(51)]

    def make_burg(self, n, m):
        if n == 0:
            return 1, m - 1
        num = 4 * 2**n - 3
        if num <= m:
            return self.lv[n], m - num
        if m <= 1:
            return 0, 0
        a, b = self.make_burg(n - 1, m - 1)
        if b <= 1:
            return a + b, 0
        c, d = self.make_burg(n - 1, b - 1)
        return a + c + 1, max(0, d - 1)

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

gen = Burg()
print(gen.make_burg(n, x)[0])

Buggy submission (verdict: Runtime Error):
class Burg:
    def __init__(self):
        self.lv = [None] * 51
        self.lv[0] = 1
        # self.string = ''

    def make_burg(self, n):
        if n == 0:
            return 'P'
        else:
            if self.lv[n] is None:
                tmp = self.make_burg(n - 1)
                self.lv[n] = 'B' + tmp + 'P' + tmp + 'B'
            return self.lv[n]


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

gen = Burg()
string = gen.make_burg(n)
div = string[:x]
print(div.count('P'))
Problem p03013 (python)

Fixed submission:
from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict


class Solution:
    def main_old(self):
        N, M = map(int, input().split())
        self.memo = {}
        for _ in range(M):
            a = int(input())
            self.memo[a] = 0
        res = self.rec(N)
        print(res)

    def main(self):
        N, M = map(int, input().split())
        A = set()
        for _ in range(M):
            A.add(int(input()))
        dp = [0] * (N+1)
        dp[0] = 1
        for i in range(0, N+1):
            # print(dp)
            if i+1 <= N and i+1 not in A:
                dp[i+1] += dp[i]
                dp[i + 1] %= 1000000007
            if i+2 <= N and i+2 not in A:
                dp[i+2] += dp[i]
                dp[i + 2] %= 1000000007
        print(dp[N])

    def rec(self, n):
        if n < 0:
            return 0
        elif n == 0:
            return 1
        elif n in self.memo:
            return self.memo[n]
        else:
            val = (self.rec(n-1) + self.rec(n-2)) %1000000007
            self.memo[n] = val
            return val


if __name__ == '__main__':
    Solution().main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict


class Solution:
    def main(self):
        N, M =map(int, input().split())
        self.memo = {}
        for _ in range(M):
            a = int(input())
            self.memo[a] = 0
        res = self.rec(N)
        print(res)

    def rec(self, n):
        if n < 0:
            return 0
        elif n == 0:
            return 1
        elif n in self.memo:
            return self.memo[n]
        else:
            val = (self.rec(n-1) + self.rec(n-2)) %1000000007
            self.memo[n] = val
            return val


if __name__ == '__main__':
    Solution().main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop, heapify, heapreplace
from collections import defaultdict


class Solution:
    def main(self):
        N, M =map(int, input().split())
        self.A = set()
        for _ in range(M):
            self.A.add(int(input()))
        self.memo = {0: 1}
        res = self.rec(N)
        print(res%1000000007)

    def rec(self, n):
        if n in self.A or n < 0:
            return 0
        elif n in self.memo:
            return self.memo[n]
        else:
            val = self.rec(n-1) + self.rec(n-2)
            self.memo[n] = val
            return val


if __name__ == '__main__':
    Solution().main()
Problem p03072 (python)

Fixed submission:
n=int(input())
b=0
c=0
for h in map(int,input().split()):
  if b<=h:
    b=h
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
b=0
c=0
for h in map(int, input.split()):
  if b<=h:
    b=h
    c+=1
print(c)
Problem p03250 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = sorted (map(int,input().split())
print(10*c+b+a)
Problem p03804 (python)

Fixed submission:
n,m =map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range (n-m+1) for j in range(n-m+1))
print("Yes" if r else "No")

Buggy submission (verdict: Runtime Error):
m,n =map(int,input().split())
a=[input() for _ in range(m)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range (n-m+1) for j in range(n-m+1))
print("Yes" if r else "No")
Problem p03038 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from operator import itemgetter
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(m)]
l = sorted(l, key=itemgetter(1), reverse=True)
a = sorted(a)
idx = 0
cont_flag = 1
for b, c in l:
    cnt = 1
    while(cnt <= b and cont_flag):
        if a[idx] < c:
            a[idx] = c
            idx += 1
            cnt += 1
            if idx == n:
                cont_flag = 0
        else:
            break
    if not cont_flag:
        break
print(sum(a))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

from operator import itemgetter
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(m)]
l = sorted(l, key=itemgetter(1), reverse=True)
a = sorted(a)
idx = 0
for b, c in l:
    cnt = 1
    while(cnt <= b):
        if a[idx] < c:
            a[idx] = c
            idx += 1
            cnt += 1
        else:
            break
print(sum(a))
Problem p03127 (python)

Fixed submission:
import sys
from fractions import gcd
input = sys.stdin.readline

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

f = A[0]
for i in range(1, N):
    f = gcd(f, A[i])
print(f)

Buggy submission (verdict: Runtime Error):
import sys
from math import gcd
input = sys.stdin.readline

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

f = A[0]
for i in range(1, N):
    f = gcd(f, A[i])
print(f)
Problem p03252 (python)

Fixed submission:
from collections import defaultdict
import sys
input = sys.stdin.readline

s = input()
t = input()
ds = defaultdict(str)
dt = defaultdict(str)

ans = "Yes"
for c1, c2 in zip(s, t):
    if c1 not in ds:
        ds[c1] = c2
    else:
        if ds[c1] != c2:
            ans = "No"
    
    if c2 not in dt:
        dt[c2] = c1
    else:
        if dt[c2] != c1:
            ans = "No"
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
input = sys.stdin.readline

s = input()
t = input()
ds = defaultdict(int)
ss = ""
dt = defaultdict(int)
st = ""
a = "abcdefghijklmnopqrstuvwxyz"
s_res = ""
t_res = ""

for i in range(len(s)):
    ds[s[i]] += 1
    dt[t[i]] += 1
    if ds[s[i]] == 1:
        ss += s[i]
    if dt[t[i]] == 1:
        st += t[i]
    s_res += a[ss.find(s[i])]
    t_res += a[st.find(t[i])]
    

if s_res == t_res:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
input = sys.stdin.readline

s = input()
t = input()
ds = defaultdict(int)
dt = defaultdict(int)
a = "abcdefghijklmnopqrstuvwxyz"
s_res = ""
t_res = ""

for i in range(len(s)):
    ds[s[i]] += 1
    dt[t[i]] += 1
    s_res += a[len(ds)-1]
    t_res += a[len(dt)-1]

if s_res == t_res:
    print("Yes")
else:
    print("No")
Problem p03803 (python)

Fixed submission:
a, b = map(int,input().split())
v = ""
if a == b:
    v = "Draw"
elif a == 1:
    v = "Alice"
elif b == 1:
    v = "Bob"
elif a > b:
    v = "Alice"
else:
    v = "Bob"

print(v)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
v = ""
if a = b:
    v = "Draw"
elif a == 1 or a > b:
    v = "Alice"
elif b == 1 or a < b:
    v = "Bob"
print(v)

Buggy submission (verdict: Runtime Error):
import math

N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
    MA += a[i]
    MB += b[i]

dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0

for it_N in range(N):
    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
            if it_MA >= a[it_N] and it_MB >= b[it_N]:
                if dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] != math.inf:
                    dp[it_N+1][it_MA][it_MB] = min(dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] + c[it_N], dp[it_N][it_MA][it_MB])
            else:
                dp[it_N+1][it_MA][it_MB]=dp[it_N][it_MA][it_MB]

#    for it_MA in range(MA+1):
#        for it_MB in range(MB+1):
#print(it_N+1,it_MA,it_MB,dp[it_N+1][it_MA][it_MB])

#中身確認
ans = -1
for a in range(1, MA+1):
    for b in range(1, MB+1):
        print(a,b,dp[N][a][b])
        if a/b == rate and dp[N][a][b] != math.inf:
            if ans == -1:
                ans = dp[N][a][b]
            else:
                ans = min([dp[N][a][b], ans])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
    MA += a[i]
    MB += b[i]

dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0

for it_N in range(N):
    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
            if it_MA >= a[it_N] and it_MB >= b[it_N]:
                if dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] != math.inf:
                    dp[it_N+1][it_MA][it_MB] = min(dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] + c[it_N], dp[it_N][it_MA][it_MB])
            else:
                dp[it_N+1][it_MA][it_MB]=dp[it_N][it_MA][it_MB]

    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
#            print(it_N+1,it_MA,it_MB,dp[it_N+1][it_MA][it_MB])

#中身確認
ans = -1
for a in range(1, MA+1):
    for b in range(1, MB+1):
        print(a,b,dp[N][a][b])
        if a/b == rate and dp[N][a][b] != math.inf:
            if ans == -1:
                ans = dp[N][a][b]
            else:
                ans = min([dp[N][a][b], ans])
print(ans)
Problem p02897 (python)

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

i=0
L=[]

while 2*i+1 <= N:
    j = 2*i+1
    L.extend([j])
    i += 1
a = int(len(L))
pro = a/N
print(pro)

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

i=0
L=[]

while 2*i+1 < N:
    j = 2*i+1
    L.extend([j])
    i += 1
a = int(len(L))
pro = N/a
print(pro)
Problem p03038 (python)

Fixed submission:
import sys
import numpy as np

N, M = list(map(int, sys.stdin.readline().strip().split(" ")))
A = list(map(int, sys.stdin.readline().strip().split(" ")))
B = []
C = []

for _ in range(M):
    b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    B.append(b)
    C.append(c)

A = sorted(A)
arg_list = list(reversed(np.argsort(C)))
B = np.array(B)[arg_list]
C = np.array(C)[arg_list]

index = 0
count = 0
flag = False
for b, c in zip(B, C):
    for _ in range(b):
        if index == N:
            flag = True
            break
        if A[index] >= c:
            flag = True
            break
        A[index] = c
        index += 1
    if flag:
        break

print(sum(A))

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

N, M = list(map(int, sys.stdin.readline().strip().split(" ")))
A = list(map(int, sys.stdin.readline().strip().split(" ")))
B = []
C = []

for _ in range(M):
    b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    B.append(b)
    C.append(c)

A = sorted(A)
arg_list = list(reversed(np.argsort(C)))
B = np.array(B)[arg_list]
C = np.array(C)[arg_list]

index = 0
count = 0
flag = False
for b, c in zip(B, C):
    for _ in range(b):
        if A[index] >= c:
            flag = True
            break
        if index == N:
            flag = True
            break
        A[index] = c
        index += 1
    if flag:
        break

print(sum(A))

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

N, M = list(map(int, sys.stdin.readline().strip().split(" ")))
A = list(map(int, sys.stdin.readline().strip().split(" ")))
B = []
C = []

for _ in range(M):
    b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    B.append(b)
    C.append(c)

A = sorted(A)
arg_list = list(reversed(np.argsort(C)))
B = np.array(B)[arg_list]
C = np.array(C)[arg_list]

index = 0
count = 0
flag = False
for b, c in zip(B, C):
    for _ in range(b):
        if A[index] >= c:
            flag = True
            break
        A[index] = c
        index += 1
    if flag:
        break

print(sum(A))
Problem p03015 (python)

Fixed submission:
l = input()

dp = [[0, 0]] * len(l)

dp[0][0] = 1
dp[0][1] = 2

MOD = 1000000007

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1] % MOD
    else:
        dp[i][0] = (3*dp[i-1][0] + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD

print((dp[-1][0] + dp[-1][1]) % MOD)

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

dp = [[0, 0] * len(l)]

dp[0][0] = 1
dp[0][1] = 2

MOD = 1000000007

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1] % MOD
    else:
        dp[i][0] = (3*dp[i-1][0] + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD

print((dp[-1][0] + dp[-1][1]) % MOD)
Problem p03042 (python)

Fixed submission:
S = raw_input().strip()
a, b = S[0:2], S[2:]

ia = int(a)
ib = int(b)

if ib == 0:
    if ia >= 1 and ia <=12: 
        print('MMYY')
        exit()

if ia == 0:
    if ib >= 1 and ib <= 12:
        print('YYMM')
        exit()

if ia > 12:
    if ib > 12:
        print('NA')
    elif ib > 0:
        print('YYMM')
    else:
        print('NA')
elif ia >= 1:
    if ib >=1 and ib <= 12:
        print('AMBIGUOUS')
    elif ib > 12:
        print('MMYY')
    else:
        print('NA')
else:
    if ib == 0:
        print('NA')
    elif ib <= 12:
        print('YYMM')
    else:
        print('NA')

Buggy submission (verdict: Runtime Error):
S = raw_input().strip()
a, b = S[0:2], S[2:]

if a == '00' or b == '00':
    print('NA')
	exit()

ia = int(a)
ib = int(b)

if ia >= 1 and ia <= 12 and ib >=1 and ib <= 12:
    print('AMBIGUOUS')
	exit()

if ia >= 1 and ia <= 12 and ib > 12:
    print('MMYY')
    exit()
if ia > 12 and ib <= 12:
    print('YYMM')
	exit()
Problem p02897 (python)

Fixed submission:
import math
n = int(input())
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)

Buggy submission (verdict: Runtime Error):
N = int(input())
print((N//2 + N%2))/N

Buggy submission (verdict: Runtime Error):
import math
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)
Problem p02912 (python)

Fixed submission:
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum)

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum)
Problem p02916 (python)

Fixed submission:
n = int(input())
L = [int(i) for i in input().split()]
c = sum(int(i) for i in input().split())
C = [int(i) for i in input().split()]
for i in range(len(L)-1):
  if L[i]+1 == L[i+1]:
    c += C[L[i]-1]
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
L = [int(i) for i in input().split()]
c = sum(int(i) for i in input().split())
C = [int(i) for i in input().split()]
for i in range(len(L)):
  if L[i] == L[i+1]:
    c += C[i-1]
print(c)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
print(s if a>=3200 else 'red')

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heappush, heappop
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    s = (L[0]+L[1])/2
    L = L[2:] 
    heappush(L,s)
ans = heapq.heappop(L)
print(ans)