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

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a

    if b == 0:
        return a

    c = a % b
    return gcd(b, c)

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

b = a[0]
for i in range(n - 1):
    b = gcd(a[i + 1], b)

print(b)

Buggy submission (verdict: Runtime Error):
import math
 
n = int(input())
a = list(map(int, input().split()))
 
b = a[0]
for i in range(n - 1):
    b = math.gcd(a[i + 1], b)
 
print(b)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if a < b:
        a, b = b, a

    if b == 0:
        return a

    c = a % b
    return gcd(b, c)

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

b = a[0]
for i in range(n - 1):
    b = math.gcd(a[i + 1], b)

print(b)

Buggy submission (verdict: Runtime Error):
import math

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

b = a[0]
for i in range(n - 1):
    b = math.gcd(a[i + 1], b)

print(b)

Buggy submission (verdict: Runtime Error):
import math

"""
def gcd(a, b):
    if a < b:
        a, b = b, a

    if b == 0:
        return a

    c = a % b
    return gcd(b, c)
"""

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

b = a[0]
for i in range(n - 1):
    b = math.gcd(a[i + 1], b)

print(b)
Problem p03209 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)

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

num = [0] * (n + 1)
num_p = [0] * (n + 1)
num_h = [0] * (n + 1)
num[0] = 1
num_p[0] = 1

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

for i in range(n + 1):
    num_h[i] = num[i] // 2 + 1

# idx 番目までに含むPの数を返す
def func(idx, n):
    if idx == 1 and n == 0:
        return 1
    if idx == 1 and n == 1:
        return 0
    if idx <= n or n < 0:
        return 0

    if idx == num_h[n]:
        ret = num_p[n - 1] + 1

    elif idx > num_h[n]:
        ret = num_p[n] - func(num[n] - idx - 1, n - 1)

    elif idx < num_h[n]:
        ret = func(idx - 1, n - 1)

    return ret

print(func(x, n))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000000)

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

num = [0] * (n + 1)
num_p = [0] * (n + 1)
num_h = [0] * (n + 1)
num[0] = 1
num_p[0] = 1

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

for i in range(n + 1):
    num_h[i] = num[i] // 2 + 1

# idx 番目までに含むPの数を返す
def func(idx, n):
    if idx <= n:
        ret = 0

    if idx == num_h[n]:
        ret = num_p[n - 1] + 1

    if idx > num_h[n]:
        ret = num_p[n] - func(num[n] - idx, n)

    if idx < num_h[n - 1]:
        ret = func(x, n)

    return ret

print(func(x, n))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000000)

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

num = [0] * (n + 1)
num_p = [0] * (n + 1)
num_h = [0] * (n + 1)
num[0] = 1
num_p[0] = 1

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

for i in range(n + 1):
    num_h[i] = num[i] // 2 + 1

def memoize(f): #メモ化関数
    table = {}
    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func

# idx 番目までに含むPの数を返す
@memoize
def func(idx, n):
    if idx <= n:
        ret = 0

    if idx == num_h[n]:
        ret = num_p[n - 1] + 1

    if idx > num_h[n]:
        ret = num_p[n] - func(num[n] - idx, n)

    if idx < num_h[n - 1]:
        ret = func(x, n)

    return ret

print(func(x, n))
Problem p02711 (python)

Fixed submission:
N = input()

include_7 = False
for s in N:
  if s == '7':
    include_7 = True
print('Yes') if include_7 else print('No')

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

for s in N:
  if s == '7':
    return 'No'
return 'Yes'
Problem p03307 (python)

Fixed submission:
u = int(input())
if u % 2 == 1:
  print (u*2)
else:
  print (u)

Buggy submission (verdict: Runtime Error):
u = int(input())
if u % 2 == 1:
  print u*2
else:
  print u
Problem p02711 (python)

Fixed submission:
N = input()
list_N = list(N)
list_N = [int(s) for s in list_N]

if(list_N[0] != 7 and list_N[1] != 7 and list_N[2] != 7):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = 123
N_sp = N.split("")

if(N_sp == 7):
  print("Yes")
  else:
    print("No")
Problem p02711 (python)

Fixed submission:
def main():
  N=int(input())
  while N!=0:
    if N%10==7:
      print("Yes")
      return
    N=N//10
  print("No")
  return
main()

Buggy submission (verdict: Runtime Error):
N=input()
while N!=0:
  if N%10==7:
    print("Yes")
    return
  N=N//10
print("No")
return

Buggy submission (verdict: Runtime Error):
while N!=0:
  if N%10==7:
    print("Yes")
    return
  N=N//10
print("No")
return
Problem p02711 (python)

Fixed submission:
N = input()
length_N = len(N)
count = 0

for i in range(length_N):
    if N[i] == '7':
        print('Yes')
        count += 1
        break
    
if count == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
count = 0

for i in range(N):
    if N[i] == 7:
        print('yes')
        count += 1
        break
    
if count == 0:
    print('no')
Problem p02897 (python)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(0.50000000000)
else:
    odd_N = N//2 + 1
    print(odd_N / N)

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

if N % 2 == 0:
    print(1-(N/2)/2)
else:
    odd_N = N//2 + 1
    print(odd_N / N)

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

if N % 2 == 0:
    print(1-(N/2)/2)
elif:
    odd_N = N//2 + 1
    print(odd_N / N)
Problem p02729 (python)

Fixed submission:
N,M = map(int,input().split())
print(N*(N-1)//2 + M*(M-1)//2)

Buggy submission (verdict: Runtime Error):
N = int(input())
M = int(input())
a = N*(N-1)//2 + M*(M-1)//2
print(a)
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
N = input()
if N % 2 == 1:
  a = 1
else:
  a = 0
print(N//2+a)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
print(6-A-B)

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

Fixed submission:
a = input()
if "7" in a: 
   print("Yes")
else: 
   print("No")

Buggy submission (verdict: Runtime Error):
a = input()
if 7 in a: 
  print("Yes")
else: 
  print("No")
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())
ans = ((N * (N-1)) / 2) + ((M * (M-1)) / 2)
print(int(ans))

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

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

print(cmb(N, 2) + cmb(M, 2))
Problem p02711 (python)

Fixed submission:
N = input()
flag = 0
for i in N:
    if i == '7':
        flag = 1
        print('Yes')
        break
if flag == 0:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
for i in N:
  if i == '7':
    print('yes')
    return 0
print('no')
Problem p02711 (python)

Fixed submission:
n = int(input())
m = str(n)
l = list(m)
if l.count("7")>0:
    print("Yes")
else:
    print("No")

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

r = s.count("R")
g = s.count("G")
b = s.count("B")

a = r * g * b

for i in range(n):
    for j in range(i+1, n):
        k = 2 * j - i 
        if k > n-1:
            continue
        
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            a -= 1

print(a)

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

if m.count(7)>0:
    print("Yes")
else:
    print("No")
Problem p02951 (python)

Fixed submission:
a,b,c = map(int, input().split())
d = c-(a-b)
if d<0:
    print(0)
else:
    print(d)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n<10:
    print(n)
elif n<100:
    print(9)
elif n<1000:
    print(n-(99-9))
elif n<10000:
    print(999-(99-9))
elif n<100000:
    print(n-(9999-999)-(99-9))
elif n==100000:
    print(99999-(9999-999)-(99-9))
Problem p03013 (python)

Fixed submission:
n,m = map(int, input().split())
listA = [int(input()) for i in range(m)]
listB = [0]*(n+2)
for k in range(m):
    listB[listA[k]] = 1
if(n==1 and listB[1]==0):
    a,b = 1,1
elif(n==1 and listB[1]==1):
    a,b = 0,0
elif(listB[1]==1 and listB[2]==1):
    a,b = 0,0
elif(listB[1]==1):
    a,b = 0,1
elif(listB[2]==1):
    a,b = 1,0
else:
    a,b = 1,2

for j in range(1, n-1):
    if(listB[j+2]!=0):
        a,b = b,0
    if(listB[j+2]==0):
        a,b = b,a+b

print(b%1000000007)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
listA = [int(input()) for i in range(m)]
listB = [0]*(n+1)
for k in range(m):
    listB[listA[k]] = 1
if(listB[1]==1 and listB[2]==1):
    a,b = 0,0
elif(listB[1]==1):
    a,b = 0,1
elif(listB[2]==1):
    a,b = 1,0
else:
    a,b = 1,2

for j in range(1, n-1):
    if(listB[j+2]!=0):
        a,b = b,0
    if(listB[j+2]==0):
        a,b = b,a+b

print(b%1000000007)
Problem p03631 (python)

Fixed submission:
a = input()
if a[0]==a[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = input()
if a[0]==a[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a[0]==a[3]:
  print("Yes")
else:
  print("No")
Problem p03774 (python)

Fixed submission:
n,m = map(int,input().split())
listA = [list(map(int, input().split())) for i in range(n)]
listB = [list(map(int, input().split())) for j in range(m)]
listC=[]

for k in range(n):
  b=0
  c=0
  for l in range(m):
    a=abs(listA[k][0]-listB[l][0])+abs(listA[k][1]-listB[l][1])
    if a<b or l==0:
      b=a
      c=l
  print(c+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
listA = [list(map(int, list(input()))) for i in range(n)]
listB = [list(map(int, list(input()))) for j in range(m)]
listC=[]
for k in range(n):
  for l in range(m):
    listC.append(abs(listA[k][0]-listB[l][0])+abs(list[k][1]-listB[l][1]))
  listC.sort()
  print(listC[0])
Problem p03013 (python)

Fixed submission:
d = 1000000007
N, M = list(map(int, input().split()))
a = [int(input()) for i in range(M)]
safe = [True for i in range(N+1)]
for ai in a:
  safe[ai] = False
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1 if safe[1] else 0
for i in range(2, N+1):
  dp[i] = (dp[i-2]+dp[i-1]) % d if safe[i] else 0
print(dp[N])

Buggy submission (verdict: Runtime Error):
d = 1000000007
N, M = list(map(int, input().split()))
a = [int(input()) for i in range(M)]
safe = [True for i in range(N+1)]
for ai in a:
  safe[ai] = False
dp = [0 for i in range(N+1)]
dp[1] = 1 if safe[1] else 0
dp[2] = 1+dp[1] if safe[2] else 0
for i in range(3, N+1):
  dp[i] = (dp[i-2]+dp[i-1]) % d if safe[i] else 0
print(dp[N])
Problem p03011 (python)

Fixed submission:
x,y,z = (int(x) for x in input().split())

a = x + y
b = y + z
c = z + x

print(min([a, b, c]))

Buggy submission (verdict: Runtime Error):
def Fib(n):
    s, t = 0, 1
    if n == 1:
        return s
    elif n == 2:
        return t
    else:
        for i in range(n-2):
            s, t = t, s + t
        return t
def FIB(q):
    return Fib(q+1)

n,m = map(int,input().split())
A =[]
add = 1
ex = 0
y = 0
for _ in range(m):
    a = int(input())
    A.append(a)
for i in range(1,n+1):
    if A.count(i) == 1 and A.count(i+1) == 1 :
        ex += 1
    else:
        ex += 0
if ex >= 1:
    print(0)
else:
    if A[0] == 1:
        if m ==1:
            add *= FIB(n - 1)
        else:
            for j in range(0,m-1):
                y = A[j+1]-A[j] -1
                add *= FIB(y)
            add *= FIB(n-A[m-1])
    else:
        if m == 1:
            z =0
            for l in range(1,A[0]):
                z += FIB(l)
            add *= z*(FIB(n - A[0]))
        else:
            c = 0
            for u in range(1,A[0]):
                c += FIB(u)
                add *=c
            for k in range(0,m-1):
                y = A[k+1]-A[k] -1
                add *= FIB(y)
            add *= FIB(n - A[m-1])

    print(add % 1000000007)

Buggy submission (verdict: Runtime Error):
xyz = input().split()
x,y,z = int(xyz=[0]), int(xyz[1]),int(xyz[2])

a = x + y
b = y + z
c = z + x
print(min([a, b, c]))

Buggy submission (verdict: Runtime Error):
xyz = input().split()
x,y,z = int(xyz=[0]), int(xyz[1]),int(xyz[2])
print(x)

a = x + y
b = y + z
c = z + x
ptint(min([x,y,z])

Buggy submission (verdict: Runtime Error):
xyz = input().split()
x,y,z = int(xyz=[0]), int(xyz[1]),int(xyz[2])

a = x + y
b = y + z
c = z + x
ptint(min([a,b,c])

Buggy submission (verdict: Runtime Error):
P,Q,R = map(int,input().split())
a= P+Q
b = Q+R
c = R+P
ptint(min([a,b,c])
Problem p02711 (python)

Fixed submission:
x = input()
if "7" in x:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
if 7 in N:
  print("Yes")
else:
  print("No")
Problem p02711 (python)

Fixed submission:
N = input()
if N.count("7") >0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N.count(7) >0:
  print(Yes)
else:
  print(No)
Problem p02712 (python)

Fixed submission:
N = int(input())
m = 0
for i in range(N+1):
  if not (i % 3 == 0 or i % 5 == 0):
    m += i
 
print (m)

Buggy submission (verdict: Runtime Error):
N = int(input())
i = 1
for i in N+1:
  if not i % 3 == 0 or i % 5 == 0:
    m += i

print (m)

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in N:
  if (i+1) % 3 == 0 or (i+1) % 5 == 0:
    pass
  else:
    m = i + 2

print(int(m))
Problem p02723 (python)

Fixed submission:
S=input()
Sbara=list(S)
if Sbara[2]==Sbara[3] and Sbara[4]==Sbara[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
abcdef=input()
if c==d and e==f:
  print(yes)
  else:
    print(no)
Problem p02753 (python)

Fixed submission:
A=input()
if A == "AAA" or A == "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
A=input()
if A == AAA or A == BBB:
  print(No)
else:
  print(Yes)
Problem p02777 (python)

Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
 
if S == U:
  print (str(A-1)+" "+str(B))
else:
  print (str(A)+" "+str(B-1))

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

if S == U:
  print (str(A-1)+" "+str(B))
else:
  print (str(A)+" "+str(B-1))
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 p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [-1]*N
ans[0] = sum(A[::2])-sum(A[1::2])

for i in range(1, N):
    ans[i] = 2*A[i-1] - ans[i-1]

print(' '.join(map(str, ans)))

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

N = int(input())
A = np.array([int(_) for _ in input().split()], dtype=int)


A = 2*A
M = np.zeros((N, N), dtype=int)
for i in range(N):
    M[i, i] = 1
    if i < N-1:
        M[i, i+1] = 1
    else:
        M[i, 0] = 1

x = np.dot(np.linalg.inv(M), A)

ans = [0]*N
for i in range(N):
    ans[i] = str(int(x[i]))
    
print(' '.join(ans))
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0] * (N+1)
mod = 10**9 + 7

for i in range(M):
    dp[a[i]] = -1

if N == 1:
    print(1)
elif N == 2:
    if dp[1] == -1:
        print(1)
    else:
        print(2)
else:
    dp[0] = 1
    if dp[1] != -1 and dp[2] != -1:
        dp[1] = 1
        dp[2] = dp[0] + dp[1]
    elif dp[1] == -1 and dp[2] != -1:
        dp[2] = 1
    elif dp[1] != -1 and dp[2] == -1:
        dp[1] = 1
    else:
        print(0)
        exit()
    
    
    for i in range(3, N+1):
        if dp[i] == -1:
            continue
        elif dp[i-1] == -1 and dp[i-2] != -1:
            dp[i] = dp[i-2]
        elif dp[i-1] != -1 and dp[i-2] == -1:
            dp[i] = dp[i-1]
        elif dp[i-1] != -1 and dp[i-2] != -1:
            dp[i] = dp[i-1] + dp[i-2]
        else:
            print(0)
            exit()
    
    print(dp[N] % mod)

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

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0] * (N+1)
mod = 10**9 + 7

for i in range(M):
    dp[a[i]] = -1

dp[0] = 1
if dp[1] != -1 and dp[2] != -1:
    dp[1] = 1
    dp[2] = dp[0] + dp[1]
elif dp[1] == -1 and dp[2] != -1:
    dp[2] = 1
elif dp[1] != -1 and dp[2] == -1:
    dp[1] = 1
else:
    print(0)
    exit()

for i in range(3, N+1):
    if dp[i] == -1:
        continue
    elif dp[i-1] == -1 and dp[i-2] != -1:
        dp[i] = dp[i-2]
    elif dp[i-1] != -1 and dp[i-2] == -1:
        dp[i] = dp[i-1]
    elif dp[i-1] != -1 and dp[i-2] != -1:
        dp[i] = dp[i-1] + dp[i-2]
    else:
        print(0)
        exit()

print(dp[N] % mod)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
 
ans = S[:K-1] + S[K-1].lower() + S[K:]
print(ans)

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

ans = S[:K-1] + S[K-1].lower() + S[K:]
print(ans3 1)
Problem p03127 (python)

Fixed submission:
import sys
input = sys.stdin.readline


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


N = int(input())
A = [int(_) for _ in input().split()]
GCD = gcd(A[0], A[1])

for i in range(1, N-1):
    GCD = gcd(GCD, A[i+1])

print(GCD)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(_) for _ in input().split()]
GCD = math.gcd(A[0], A[1])

for i in range(1, N-1):
    GCD = math.gcd(GCD, A[i+1])

print(GCD)
Problem p03253 (python)

Fixed submission:
from math import factorial as fact
from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N, M = map(int, input().split())
num = []
p_flag = [True]*(int(M**0.5)+2)

for i in range(2, int(M**0.5)+2):
    if p_flag:
        for j in range(2*i, int(M**0.5)+2, i):
            p_flag[j] = False

        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        if cnt > 0:
            num.append(cnt)
        if M == 1:
            break
else:
    num.append(1)

ans = 1
for i in num:
    ans = (ans * cmb(N-1+i, i)) % (10**9+7)
print(ans)

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

N, M = map(int, input().split())
num = []
p_flag = [True]*(int(M**0.5)+1)

for i in range(2, int(M**0.5)+2):
    if p_flag:
        for j in range(2*i, int(M**0.5)+2, i):
            p_flag[j] = False

        cnt = 0
        while M % i == 0:
            cnt += 1
            M //= i
        if cnt > 0:
            num.append(cnt)
        if M == 1:
            break
else:
    num.append(1)

ans = 1
for i in num:
    ans = (ans * fact(N-1+i)//(fact(i)*fact(N-1))) % (10**9+7)
print(ans)
Problem p03329 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

def rec(n):
    if n == 0:
        memo[n] = 0
        return memo[n]
    if memo[n] != -1:
        return memo[n]
    res = n
    pow6 = []
    pow9 = []
    for i in range(n):
        if 6 ** i > n:
            break
        pow6.append(6 ** i)
    
    for j in range(1, n):
        if 9 ** j > n:
            break
        pow9.append(9 ** j)
    L = set(pow6 + pow9)
    
    for k in L:
        res = min(res, rec(n - k)+1)
        
    memo[n] = res
    return memo[n]
    

N = int(input())
memo = [-1] * (N+1)
print(rec(N))

Buggy submission (verdict: Runtime Error):
def rec(n):
    if n == 0:
        memo[n] = 0
        return memo[n]
    if memo[n] != -1:
        return memo[n]
    res = n
    pow6 = [1]
    pow9 = [1]
    for i in range(1, n):
        if 6 ** i > n:
            break
        pow6.append(6 ** i)
    
    for j in range(1, n):
        if 9 ** j > n:
            break
        pow9.append(9 ** j)
    L = set(pow6 + pow9)
    
    for k in L:
        res = min(res, rec(n - k)+1)
        
    memo[n] = res
    return memo[n]
    

N = int(input())
memo = [-1] * (N+1)
print(rec(N))
Problem p02729 (python)

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

count = 0
if n > 1:
  count += n * (n - 1) // 2
if m > 1:
  count += m * (m - 1) // 2
print(count)

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

sum = 0

if n > 1:
    sum += 2 ** (n // 2)
else:
    sum += 1

if m > 1:
    sum += 2 ** (m // 2)
else:
    sum += 1

print(sum)
Problem p02777 (python)

Fixed submission:
color = input().split()

num = input().split()
a = int(num[0])
b = int(num[1])


u = input()
if u == color[0]:
    a -= 1
elif u == color[1]:
    b -= 1
print(str(a) + ' ' + str(b))

Buggy submission (verdict: Runtime Error):

s = input()
t = input()

a = int(input())
b = int(input())

u = input()
if u == s:
    a -= 1
elif u == t:
    b -= 1
print(str(a) + ' ' + str(b))

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

a = int(input())
b = int(input())

u = input()
if u == s:
    a -= 1
elif u == t:
    b -= 1
print(a +" " + b)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
c = [1, 2, 3]

c.remove(a)
c.remove(b)

print(c[0])

Buggy submission (verdict: Runtime Error):
a = [1,2,3]

a.remove(int(input()))
a.remoce(int(input()))

print(a[0])
Problem p02987 (python)

Fixed submission:
a = input()

if a[0] == a[1] == a[2] == a[3]:
    print("No")
elif a[0] == a[1] and a[2] == a[3]:
    print("Yes")
elif a[0] == a[2] and a[1] == a[3]:
    print("Yes")
elif a[0] == a[3] and a[1] == a[2]:
    print("Yes")
else:
    print("No")

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

if a[0] == a[1] and a[2] == a[3]: //AABB
	print("Yes")
elif a[0] == a[2] and a[1] == a[3]: //ABAB
	print("Yes")
elif a[0] == a[3] and a[1] == a[2]: //ABBA
	print("Yes")
else:
  	print("No")
Problem p03011 (python)

Fixed submission:
a = list(map(int, input().split()))
 
print(min(a[0]+ a[1], a[1] + a[2], a[2]+ a[0]))

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

print(min(a[0]+ a[1], a[1] + a[2], a[2]+ a[0])
Problem p02954 (python)

Fixed submission:
s=input()
s="L"+s+"R"
N=len(s)
a=[1]*N
for i in range(1,N-1):
    if s[i]=="R" and s[i+1]=="R":
        a[i+2]+=a[i]
        a[i]=0
for i in range(N-1,1,-1):
    if s[i]=="L" and s[i-1]=="L":
        a[i-2]+=a[i]
        a[i]=0
print(*a[1:-1])

Buggy submission (verdict: Runtime Error):
S = input()
n = [1]*len(S)


for j in range(count):
    for i in range(len(S)):
        if S[i] == "R":
            if n[i] >0:
                
                n[i+1] += 1
                n[i] -=1
        if S[i] == "L":
            if n[i] >0:
                n[i-1] += 1
                n[i] -=1
print(n)
Problem p02970 (python)

Fixed submission:
a,b=(int(x) for x in input().split())

c = a//(2*b+1)


if a % (2*b+1) ==0:
  print(c)
  
else:
  print(c+1)

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

if n%(2d+1) == 0:
  print(n%(2d+1))
else:
  print(n%(2d+1)+1)

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

c = a//b

print(c+1)
Problem p02990 (python)

Fixed submission:
import math

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

c = 10**9+7

def cmb(n,r):
    return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))


for i in range(k):
    try:
        print(((cmb(k-1,i)*cmb(n - k+1,i+1))%c))
    except:
        print(0)

Buggy submission (verdict: Runtime Error):
import math

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

c = 10**9+7

def cmb(n,r):
    return math.factorial(n) / (math.factorial(n-r)*math.factorial(r))

d = n-k
for i in range(1,k+1):
    print(int((cmb(k-1,i-1)*cmb(d+1,i))%c))

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

d = n - k

c = 10**9+7
for i in range(1,k+1,1):
    s = int(((math.factorial(k-1))*(math.factorial(d+1)))/((math.factorial(k-i))*(math.factorial(i-1))*(math.factorial(d-i+1))*(math.factorial(i))))
    print(s % c)