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

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
N,M=map(int,input().split())
l=[[] for i in range(10**5)]
for i in range(N):
    a,b=map(int,input().split())
    l[a-1].append(b)
h=[]
import heapq
a=0
for i in range(M):
    for j in l[i]:
        heapq.heappush(h,-j)
    if h:
        a-=heapq.heappop(h)
print(a)

Buggy submission (verdict: Runtime Error):
N, M= map(int, input().split())
B=[]
for i in range(N):
    B.append([None]*2)
    l=input().split()
    B[i][0]=int(l[1])
    B[i][1]=int(l[0])
B.sort(reverse=True)
h=[0]*(M+1)
a=0
d=M+1
for i in range(N):
    for j in range(B[i][1],d):
        if h[j]==0:
            h[j]=1
            a+=B[i][0]
            break
    else:
        d=B[i][1]
print(a)
Problem p02984 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
A=list(map(int,input().split()))
y=0
for i in range(N-1):
    y=2*(A[i]-y//2)
l=[None]*N
l[0]=(2*A[-1]-y)//2
for i in range(1,N):
    l[i]=2*(A[i-1]-l[i-1]//2)
print(*l)

Buggy submission (verdict: Runtime Error):
import numpy
N=int(input())
A=input().split()
for i in range(N):
    A[i]=2*int(A[i])
x=[None]*N
for i in range(N-1):
    x[i]=[0]*N
    x[i][i],x[i][i+1]=1,1
x[N-1]=[0]*N
x[N-1][0],x[N-1][N-1]=1,1
y=numpy.linalg.solve(x,A)
for i in range(N):
    print(int(y[i]),end=' ')

Buggy submission (verdict: Runtime Error):
from numpy.linalg import solve
N=int(input())
A=input().split()
for i in range(N):
    A[i]=2*int(A[i])
x=[None]*N
for i in range(N-1):
    x[i]=[0]*N
    x[i][i],x[i][i+1]=1,1
x[N-1]=[0]*N
x[N-1][0],x[N-1][N-1]=1,1
y=solve(x,A)
for i in range(N):
    print(int(y[i]),end=' ')
Problem p03127 (python)

Fixed submission:
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
g=gcd(A[0],A[1])
for i in range(2,N):
        g=gcd(g,A[i])
print(g)

Buggy submission (verdict: Runtime Error):
from math import gcd
N=int(input())
A=list(map(int,input().split()))
g=gcd(A[0],A[1])
for i in range(2,N):
        g=gcd(g,A[i])
print(g)
Problem p03222 (python)

Fixed submission:
from itertools import product
H,W,K=map(int, input().split())
pr=10**9+7
b=[0]*W
b[0]=1
z=[0]*W
rl=tuple(product([0,1], repeat=(W-1)))
l=[]
for i in rl:
    for j in range(W-2):
        if i[j] and i[j+1]:
            break
    else:
        l.append([0]+list(i)+[0])
for i in range(H):
    a=z.copy()
    for j in l:
        for k in range(W):
            if j[k]:
                a[k]=(b[k-1]+a[k])%pr
            elif j[k+1]:
                a[k]=(b[k+1]+a[k])%pr
            else:
                a[k]=(b[k]+a[k])%pr
    b=a
print(b[K-1])

Buggy submission (verdict: Runtime Error):
from itertools import product
H,W,K=map(int, input().split())
pr=10**9+7
b=[0]*W
b[0]=1
z=[0]*W
rl=tuple(product([0,1], repeat=(W-1)))
l=[]
for i in rl:
    for j in range(W-2):
        if i[j] and i[j+1]:
            break
    else:
        l.append([0]+list(i)+[0])
for i in range(H):
    a=z.copy()
    for j in l:
        for k in range(W):
            if j[k]:
                a[k]=(b[k-1]+a[k])%pr
            elif j[k+1]:
                a[k]=(b[k+1]+a[k])%pr
            else:
                a[k]=(b[k]+a[k])%pr
    b=a
print(b[K-1])
Problem p03242 (python)

Fixed submission:
n=input()
l=""
for i in range(3):
    if n[i]=="1":
        l+="9"
    elif n[i]=="9":
        l+="1"
    else:
        l+=n[i]
print(l)

Buggy submission (verdict: Runtime Error):
n=int(input())
a,b=[None]*100000,[None]*100000
for i in range(100000):
    a[i]=[None]*2
    a[i][0]=0
    a[i][1]=i
    b[i]=[None]*2
    b[i][0]=0
    b[i][1]=i
l=list(map(int,input().split()))
for i in range(n//2):
    a[l[2*i]-1][0]+=1
    b[l[2*i+1]-1][0]+=1
a.sort(reverse=True)
b.sort(reverse=True)
if a[0][1]==b[0][1]:
    print(n-max(a[0][0]+b[1][0],a[1][0]+b[0][0]))
else:
    print(n-a[0][0]-b[0][0])
Problem p03464 (python)

Fixed submission:
K=int(input())
A=list(map(int,input().split()))
mb=Mb=2
t=1
for i in A[::-1]:
    if Mb//i*i>=mb:
        Ma=(Mb//i+1)*i-1
    else:
        t=0
        break
    if mb%i==0:
        ma=mb
    elif (mb//i+1)*i<=Mb:
        ma=(mb//i+1)*i
    else:
        t=0
        break
    mb=ma
    Mb=Ma
if t:
    print(ma,Ma)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
K=int(input())
A=list(map(int,input().split()))
mb=Mb=2
t=1
for i in A[::-1]:
    if Mb//i*i>=mb:
        Ma=(Mb//i+1)*i-1
    else:
        t=0
    if mb%i==0:
        ma=mb
    elif (mb//i+1)*i<=Mb:
        ma=(mb//i+1)*i
    else:
        t=0
    mb=ma
    Mb=Ma
if t:
    print(ma,Ma)
else:
    print(-1)
Problem p02627 (python)

Fixed submission:
s=input()
if s.islower():
    print('a')
else:
    print("A")

Buggy submission (verdict: Runtime Error):
s=raw_input()
if s.islower():
    print('a')
else:
    print("A")
Problem p02699 (python)

Fixed submission:
s,w=map(int,input().split())
if s>w:
    print ("safe")
else:
    print ("unsafe")

Buggy submission (verdict: Runtime Error):
s,w=input().split()
if s>w:
    print "safe"
else:
    print "unsafe"

Buggy submission (verdict: Runtime Error):
s,w=map(int,raw_input().split())
if s>w:
    print "safe"
else:
    print "unsafe"

Buggy submission (verdict: Runtime Error):
s,w=map(int,input().split())
if(s>w):
    print "safe"
else:
    print "unsafe"
Problem p02549 (python)

Fixed submission:
import numpy as np
from numba import njit
from numba.types import i8
ni8 = np.int64
MOD = 998244353


@njit((i8[:,::-1], i8[:], i8, i8), cache=True)
def solve(lr, dp, n, k):
    acc_dp = np.ones_like(dp)
    for i in range(1, n):
        val = 0
        for j in range(k):
            a = i - lr[j, 0]
            if a < 0:
                continue
            b = i - lr[j, 1] - 1
            val += acc_dp[a] - (acc_dp[b] if b >= 0 else 0)
        dp[i] = val % MOD
        acc_dp[i] = (acc_dp[i - 1] + dp[i]) % MOD
    return dp[n - 1]


def main():
    f = open(0)
    n, k = [int(x) for x in f.readline().split()]
    lr = np.fromstring(f.read(), ni8, sep=' ').reshape((-1, 2))
    dp = np.zeros(n, ni8)
    dp[0] = 1
    ans = solve(lr, dp, n, k)
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os
    import re
    with open(__file__) as f:
        source = f.read().split('###''nbacl')
    for s in source[1:]:
        s = re.sub("'''.*", '', s)
        sp = s.split(maxsplit=1)
        if os.path.dirname(sp[0]):
            os.makedirs(os.path.dirname(sp[0]), exist_ok=True)
        with open(sp[0], 'w') as f:
            f.write(sp[1])

    import nbmodule
    nbmodule.cc.compile()
    exit(0)

from nbmodule import solve
import numpy as np
i8 = np.int64
i4 = np.int32


def main():
    f = open('d4.txt')
    N, K = [int(x) for x in f.readline().split()]
    LR = np.fromstring(f.read(), i8, sep=' ').reshape((-1, 2)).T.copy()
    L = LR[0]
    R = LR[1]
    arg = np.argsort(L)
    left = L[arg]
    right = R[arg]
    w = right - left + 1
    ans = solve(N, left, w)
    print(ans)


if __name__ == '__main__':
    main()

'''
###nbacl nbmodule.py
import numpy as np
from numba import njit
from numba.types import i8, i4
from numba.pycc import CC
ni4 = np.int32
ni8 = np.int64
cc = CC('nbmodule')

MOD = 998244353


@cc.export('solve', (i8, i8[:], i8[:]))
def solve(N, left, w):
    l0 = w.max()
    dp_len = N + l0
    dp_prev = np.zeros(dp_len, ni8)
    dp_prev[l0] = 1
    dp = np.zeros(dp_len, ni8)
    left_min = left[0]
    ret = 0
    while l0 + left_min < dp_len:
        for k in range(left.shape[0]):
            pre = 0
            for i in range(l0 + left[k], dp_len):
                cur = pre + dp_prev[i - left[k]] - dp_prev[i - left[k] - w[k]]
                dp[i] += cur
                pre = cur
        ret += dp[-1]
        dp_prev, dp = dp, dp_prev
        dp_prev %= MOD
        dp.fill(0)
        l0 += left_min

    return ret % MOD

if __name__ == '__main__':
    cc.compile()
'''
Problem p03201 (python)

Fixed submission:
import collections

N = int(input())
A = collections.deque(sorted(map(int,input().split())))


def func1(a, r, rnext):
    p = a.popleft()
    q = a.pop()
    ans = 0
    a1 = collections.deque()
    while True:
        if p + q == r:
            ans += 1
            try:
                p = a.popleft()
            except:
                break
            try:
                q = a.pop()
            except:
                if p < rnext:
                    a1.append(p)
                break
        elif p + q > r:
            try:
                q = a.pop()
            except:
                if p < rnext:
                    a1.append(p)
                break
        else:
            a1.append(p)
            try:
                p = a.popleft()
            except:
                if q < rnext:
                    a1.append(q)
                break
    return ans, a1


if N == 1:
    print(0)
    exit(0)
t = int.bit_length(A[-1] + A[-2])
r = 2 ** t
rnext = 2 ** (t - 1)
anser = 0
a = A

while True:
    ans, a1 = func1(a, r, rnext)
    anser += ans
    if len(a1) < 2:
        break
    a = a1
    t -= 1
    r = rnext
    rnext = 2 ** (t - 1)

print(anser)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
A = collections.deque(sorted(map(int,input().split())))


def func1(a, r, rnext):
    p = A.popleft()
    q = A.pop()
    ans = 0
    a1 = collections.deque()
    while True:
        if p + q == r:
            ans += 1
            try:
                p = a.popleft()
            except:
                break
            try:
                q = a.pop()
            except:
                if p < rnext:
                    a1.append(p)
                break
        elif p + q > r:
            try:
                q = a.pop()
            except:
                if p < rnext:
                    a1.append(p)
                break
        else:
            a1.append(p)
            try:
                p = a.popleft()
            except:
                if q < rnext:
                    a1.append(q)
                break
    return ans, a1

t = int.bit_length(A[-1])
r = 2 ** t
rnext = 2 ** (t - 1)
anser = 0
a = A

while True:
    ans, a1 = func1(a, r, rnext)
    anser += ans
    if len(a1) < 2:
        break
    a = a1
    t -= 1
    r = rnext
    rnext = 2 ** (t - 1)

print(anser)
Problem p02570 (python)

Fixed submission:
import sys; input = sys.stdin.readline
from math import ceil
d, t, s = map(int, input().split())
u, l = ceil(d/t), d//t
if u == l:
    if u <= s: print("Yes")
    else: print("No")
else:
    if d/t <= s: print("Yes")
    else:print("No")

Buggy submission (verdict: Runtime Error):
from math import ceil
d, t, s = map(int, input().split())
u, l = ceil(d/t), d//t
if u == l:
	if u <= s: print("Yes")
    else: print("No")
else:
    if d/t <= s: print("Yes")
    else:print("No")
Problem p02829 (python)

Fixed submission:
print(6-int(input())-int(input()))

Buggy submission (verdict: Runtime Error):
A,B=list(map(int,input().split()))
print(6-A-B)
Problem p02835 (python)

Fixed submission:
A,B,C=list(map(int,input().split()))
if A+B+C<22:
    print("win")
else:
    print("bust")

Buggy submission (verdict: Runtime Error):
A,B,C=list(map(int,input().split())
if A+B+C<22:
    print("win")
else:
    print("bust")
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

Buggy submission (verdict: Runtime Error):
print(int(input()))**3
Problem p03104 (python)

Fixed submission:
def F(n):
	if n%2==1:
		ans=0 if (n+1)%4==0 else 1
	else:
		ans=n^0 if n%4==0 else n^1
	return ans
def resolve():
	A,B=map(int,input().split())
	print(F(A-1)^F(B))
resolve()

Buggy submission (verdict: Runtime Error):
from functools import reduce

def resolve():
	A,B=map(int,input().split())
	l=list(range(A,B+1))
	print(reduce(lambda a,b:a^b,l))
resolve()
Problem p02629 (python)

Fixed submission:
n = int(input())
kugiri = [0,26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286]
ans = ""

for i in range(len(kugiri)):
    if n <= kugiri[i]:
        keta = i
        break
        
n -= kugiri[i-1]

for i in range(keta):
    moji = -(-n // 26**(keta-1))
    ans += chr(moji+96)
    n -= (moji-1) * 26**(keta-1)
    keta -= 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
kugiri = [0,26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134]
ans = ""

for i in range(len(kugiri)):
    if n <= kugiri[i]:
        keta = i
        break
        
n -= kugiri[i-1]

for i in range(keta):
    moji = -(-n // 26**(keta-1))
    ans += chr(moji+96)
    n -= (moji-1) * 26**(keta-1)
    keta -= 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
kugiri = [0,26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134]
ans = ""

for i in range(len(kugiri)):
    if n <= kugiri[i]:
        keta = i
        break
        
n -= kugiri[i-1]

for i in range(keta):
    moji = n // 26**(keta-1)
    
    if keta == 1:
        moji -= 1
    
    ans += chr(moji+97)
    n -= moji * 26**(keta-1)
    keta -= 1
    
print(ans)
Problem p02771 (python)

Fixed submission:
a = input()
b = eval(a.replace(" ","^"))
print((a.count(str(b))==1)*"Yes" or "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = {}
for i in range(len(s)):
    if s[i] not in dic:
        dic[s[i]]=s.count(s[i])
    
ans = sorted([k for k, v in dic.items() if v == max(dic.values())])

for i in range(len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = {}
for i in range(len(s)):
    if s[i] not in dic:
        dic[s[i]]=s.count(s[i])
    
ans = sorted([k for k, v in dic.items() if v == max(dic.values())])

for i in range(len(ans)):
    print(ans[i])
Problem p02773 (python)

Fixed submission:
import collections
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = collections.Counter(s)
dic = dic.most_common()

ans = [dic[0][0]]

for i in range(len(dic)-1):
    if dic[i][1] == dic[i+1][1]:
        ans.append(dic[i+1][0])
    else:
        break
        
ans = sorted(ans)

for i in range(len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = collections.Counter(s)
dic = dic.most_common()

ans = [dic[0][0]]

for i in range(n):
    if dic[i][1] == dic[i+1][1]:
        ans.append(dic[i+1][0])
    else:
        break
        
ans = sorted(ans)

for i in range(len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(open(0))
    
dic = {}
for i in range(len(s)):
    if s[i] not in dic:
        dic[s[i]]=s.count(s[i])
    
ans = sorted([k for k, v in dic.items() if v == max(dic.values())])

for i in range(len(ans)):
    print(ans[i])
Problem p02820 (python)

Fixed submission:
N , K = map(int , input().split())
R , S , P = map(int , input().split())
T = input()

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

for i in range(K , N):
    if ans[i] == ans[i-K]:
        ans = ans[:i] + "X" + ans[i+1:]
        
point = ans.count("r")*R + ans.count("s")*S + ans.count("p")*P

print(point)

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

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

VANISH = []
    
for i in range(N-K):
    if ans[i] == ans[i+K]:
        VANISH.append(ans[i])
        
if N - (2*K) > 0:
    for i in range(N - (2*K)):
        if ans[i] == ans[i+(2*K)]:
            VANISH.remove(ans[i])
            
vanish = "".join(VANISH)
        
point = ((ans.count("r")-vanish.count("r"))*R + (ans.count("s")-vanish.count("s"))*S + (ans.count("p")-vanish.count("p"))*P)

print(point)

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

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

VANISH = []
    
for i in range(N-K):
    if ans[i] == ans[i+K]:
        VANISH.append(ans[i])

print(VANISH)
        
if N - (2*K) > 0:
    for i in range(N - (2*K)):
        if ans[i] == ans[i+(2*K)]:
            VANISH.remove(ans[i])
            
print(VANISH)
            
vanish = "".join(VANISH)
        
point = ((ans.count("r")-vanish.count("r"))*R + (ans.count("s")-vanish.count("s"))*S + (ans.count("p")-vanish.count("p"))*P)

print(point)
Problem p02831 (python)

Fixed submission:
import fractions
A , B = map(int , input().split())
print(A * B // fractions.gcd(A , B))

Buggy submission (verdict: Runtime Error):
import math
A , B = map(int , input().split())
print(A * B // math.gcd(A , B))
Problem p02835 (python)

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

if sum(card) >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
a1 , a2 , a3 = map(int , input.split())
  
A = a1+a2+a3
 
if A >= 22:
  print("bust")
  
else:
Problem p02847 (python)

Fixed submission:
S = input()

youbi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

day = 7

for i in range(7):
    if youbi[i] == S:
        break
        
    day += -1
    
print(day)

Buggy submission (verdict: Runtime Error):
A = ["SUN","MON","TUE","WED","THU","ERI","SAT"]
print(7-A.index(input()))
Problem p02859 (python)

Fixed submission:
r = int(input())

print(r**2)

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

if X > Y:
    ma = X
    mi = Y
else:
    ma = Y
    mi = X

for i in range(mi):
    a = X - 3*i
    b = Y - 3*i
    if a == 2 * b or b == 2 * a:
        import math
        pattern = math.factorial(2*i + ((ma - 3*i)//2)) // (i * (i + ((ma - 3*i)//2)))
        print(pattern % (10**9 + 7))
        break
        
if a != 2 * b and b != 2 * a:
    print(0)
Problem p02879 (python)

Fixed submission:
A , B = map ( int , input ( )  . split( ) )
 
if ( A<= 9 and B <= 9) :
    print ( A * B )
else:
    print ( -1 )

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

result = 0
for i in range(0,3):
    if S[i] == T[i]:
        result += 1

print (result)

Buggy submission (verdict: Runtime Error):
A , B = map ( int , input ( )  . split( ) )
 
if (A  <= 9 and B <= 9 ):
print ( A * B )
 
else:
print ( -1 )

Buggy submission (verdict: Runtime Error):
A , B = map ( int , input ( )  . split( ) )
 
if (A , B) <= 9 :
print ( A * B )
 
else:
print ( -1 )

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

if A , B <= 9 :
print ( A * B )

else:
print ( -1 )

Buggy submission (verdict: Runtime Error):
if ( ( 1 <= A <= 9 ) and( ( A % 1 == 0 ) or ( A % 2 == 0 ) or ( A % 3 == 0 ) or ( A % 5 == 0 ) or ( A % 7 == 0 ) ) ) and ( ( 1 <= B <= 9 ) and( ( B % 1 == 0 ) or ( B % 2 == 0 ) or ( B % 3 == 0 ) or ( B % 5 == 0 ) or ( B % 7 == 0 ) ) ):
    print(A*B)
else:
    print ( -1 )
Problem p02897 (python)

Fixed submission:
a = int(input())

if a == 1:
    print(1/a)
elif a % 2 == 0:
    print(1/2)
else:
    print(((a+1)/2)/a)

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

if n == 1:
    print(1/a)
elif n % 2 == 0:
    print(1/2)
else:
    print(((n+1)/2)/n)

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

if n == 1:
    print(1/a)
elif n % 2 == 0:
    print(1/2)
else:
    print(((a+1)/2)/a)
Problem p02912 (python)

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

import heapq
a = list(map(lambda x:x*(-1),a))
heapq.heapify(a)

for i in range(m):
    b = heapq.heappop(a)
    heapq.heappush(a,-(-b//2))
    
print(sum(a)*(-1))

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

for i in range(m):
    a[-1] //= 2
    
    if a[-2] > a[-1]:
        a = sorted(a)
    
print(sum(a))
Problem p03011 (python)

Fixed submission:
P , Q , R = map(int, input().split())

if P >= Q and P >= R:
    print(Q + R)
elif Q >= P and Q >= R:
    print(P + R)
else:
    print(P + Q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []

for i in range(m):
    a.append(int(input()))

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
        
print(dp[n])
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])

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

dp = [0] * (n+1)
dp[0] = 1

if a[0] != 1:
    dp[1] = 1
    
for i in range(2,n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
        
print(dp[n])
Problem p03041 (python)

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

print(S[0:K-1] + S[K-1].lower() + S[K:N])

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

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

if 0 < S // 100 <= 12 and 0 < S % 100<= 12:
    print("AMBIGUOUS")
elif 0 < S // 100 <= 12:
    print("MMYY")
elif 0 < S % 100 <= 12:
    print("YYMM")
else :
    print("NA")
Problem p03834 (python)

Fixed submission:
print(input().replace(","," "))

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())
ans = 0

for x in range(min(k,s)+1):
    for y in range(min(k,s)+1):
        if 0 <= s - x - y <= min(k,s):
            ans += 1
    
print(ans)
Problem p03036 (python)

Fixed submission:
rdx = list(map(lambda x: int(x), input().split()))
r = rdx[0]
d = rdx[1]
x = rdx[2]

memo = [0 for i in range(11)]

memo[0] = x
for i in range(10):
  memo[i+1] = memo[i] * r - d
  print(memo[i+1])

Buggy submission (verdict: Runtime Error):
rdx = list(map(lambda x: int(x), input().split()))
r = rdx[0]
d = rdx[1]
x = rdx[2]

memo = [0 for i in range(d+1)]

memo[0] = x
for i in range(10):
  memo[i+1] = memo[i] * r - d
  print(memo[i+1])
Problem p03041 (python)

Fixed submission:
nk = list(map(lambda x: int(x), input().split()))
n = nk[0]
k = nk[1]
s = input()

front = s[:k-1]
back = s[k:]
target = s[k-1].lower()

answer = front + target + back
print(answer)

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

# -1 -> Black, 1 -> white, 0 -> not yet
memo = [0 for i in range(n)]
memo[0] = 1

# print("memo", memo)

def paint(index, node_num):
  for edge in edges:
    if (edge[0]==node_num):
      if (edge[2] % 2 == 0):
        # print("edge", edge)
        memo[edge[1]-1] = memo[i]
        edges.remove(edge)
        paint(edge[1]-1, edge[1])
      else:
        # print("edge", edge)
        memo[edge[1]-1] = -memo[i]
        edges.remove(edge)
        paint(edge[1]-1, edge[1])
    if (edge[1]==node_num):
      if (edge[2] % 2 == 0):
        # print("edge", edge)
        memo[edge[0]-1] = memo[i]
        edges.remove(edge)
        paint(edge[0]-1, edge[1])
      else:
        # print("edge", edge)
        memo[edge[0]-1] = -memo[i]
        edges.remove(edge)
        paint(edge[0]-1, edge[1])


for i in range(n):
  if (memo[i] != 0):
    continue
  memo[i] = 1
  node_num = i + 1
  # print("node_num", node_num)
  # print("=======================")
  paint(i, node_num)
  # print("memo", memo)
  # print("=======================")

# print("memo", memo)

for item in memo:
  if (item == 1):
    print("1")
  else:
    print("0")
Problem p02676 (python)

Fixed submission:
K=int(input())
S=input()
list1=[]
if len(S)<=K:
  print(S)
else:
  for i in range(K):
    list1.append(S[i])
  list1.append("...")
  S2="".join(list1)
  print(S2)

Buggy submission (verdict: Runtime Error):
import math
list1=(input()).split()
A=int(list1[0])
B=int(list1[1])
H=int(list1[2])
M=int(list1[3])
p=math.pi
HM=(A**2+B**2-2*A*B*(math.cos(abs(p*H/6-p*M/30))))**0.5
print(HM)