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

Fixed submission:
nums = input().split()
N = int(nums[0])
K = int(nums[1])
S = input()
s1 = S[:K - 1]
s2 = S[K:]

if S[K - 1] == 'A':
    s = s1 + 'a' + s2

elif S[K - 1] == 'B':
    s = s1 + 'b' + s2

else:
    s = s1 + 'c' + s2

print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
S = input()
s1 = S[:K - 1]
s2 = S[K:]

if S[K - 1] == 'A':
    s = s1 + 'a' + s2

elif S[K - 1] == 'B':
    s = s1 + 'b' + s2

else:
    s = s1 + 'c' + s2

print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
S = input()
s1 = S[:K - 1]
s2 = S[K + 1:]

if S[K - 1] == 'A':
    s = s1 + 'a' + s2

elif S[K - 1] == 'B':
    s = s1 + 'b' + s2

else:
    s = s1 + 'c' + s2

print(s)

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

if S[K - 1] == 'A':
  s = S.replace('A', 'a')

elif S[K - 1] == 'B':
  s = S.replace('B', 'b')

else:
  s = S.replace('C', 'c')

print(s)

Buggy submission (verdict: Runtime Error):
import fileinput

if __name__ == '__main__':
  for line in fileinput.input():
    tokens = list(map(int, line.strip().split()))
    N, K, S = tokens[0], tokens[1], tokens[2]


if S[K - 1] == 'A':
  s = S.replace('A', 'a')

elif S[K - 1] == 'B':
  s = S.replace('B', 'b')

else:
  s = S.replace('C', 'c')

print(s)

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

if S[K - 1] == 'A':
  s = S.replace('A', 'a')

elif S[K - 1] == 'B':
  s = S.replace('B', 'b')

else:
  s = S.replace('C', 'c')

print(s)
Problem p03042 (python)

Fixed submission:
def month(num):
    if 0 < num <= 12:
        return 1
    else:
        return 0


S = input()
first = int(S[:2])
second = int(S[2:])

if month(first) == 1 and month(second) == 1:
    print('AMBIGUOUS')

elif month(first) == 1 and month(second) == 0:
    print('MMYY')

elif month(first) == 0 and month(second) == 1:
    print('YYMM')

else:
    print('NA')

Buggy submission (verdict: Runtime Error):
def month(num):
    if 0 < num <= 12:
        return True
    else:
        return False


S = input()
first = int(S[:2])
second = int(S[2:])

if month(first)
    if month(second):
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif not month(first) and month(second):
    print('YYMM')

else:
    print('NA')
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())
a = list(map(int,input().split()))
x = []
b = 0
ans = 0

for i in range(n):
    x.append(a[i] - i-1)
x = sorted(x)


if n%2 == 0:
    b = (x[n//2]-x[(n-1)//2])/2
else:
    b = (x[(n//2)])

for i in range(n):
    ans += abs(a[i]-b-i-1)

print(ans)
Problem p03315 (python)

Fixed submission:
s = str(input())
ans = s.count("+") - s.count("-")

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(n)
x = 0

for i in s:
    x += int(i)
print(x)
if n % x == 0:
    print("Yes")
else:
    print("No")
Problem p02959 (python)

Fixed submission:
def solv():
    n = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    ans = 0

    for i in range(n):
        x = A[i] + A[i+1]
        ans += min(x,B[i])
        A[i+1] = min(A[i+1],max(x-B[i],0))
    return print(ans)

solv()

Buggy submission (verdict: Runtime Error):
def solv():
    n = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    ans = 0

    for i in range(n):
        x = A[i] + A[i+1]
        ans += min(x,B[i])
        A[i+1] = min(A[i+1],max(x-B[i+1],0))
    return print(ans)

solv()

Buggy submission (verdict: Runtime Error):
def solv():
    n = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    ans = 0

    for i in range(n+1):
        x = A[i] + A[i+1]
        ans += min(x,B[i])
        A[i+1] = min(A[i+1],max(x-B[i+1],0))
    return print(ans)

solv()

Buggy submission (verdict: Runtime Error):

def solv():
    n = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    ans = 0

    for i in range(n+1):
        x = A[i] + A[i+1]
        ans += min(x,B[i])
        A[i+1] = min(A[i+1],max(x-B[i+1],0))
    return print(ans)

solve()

Buggy submission (verdict: Runtime Error):
def solv():
    n = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    ans = 0

    for i in range(n+1):
        x = A[i] + A[i+1]
        ans += min(x,B[i])
        A[i+1] = min(A[i+1],max(x-B[i+1],0))
    print(ans)

solve()
Problem p03805 (python)

Fixed submission:
N,M = [int(a) for a in input().split()]
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
  a,b = [int(a) for a in input().split()]
  edges[a].append(b)
  edges[b].append(a)

def search(lst):
  if len(lst) == N:
    return 1
  else:
    a = lst[-1]
    next = [n for n in edges[a] if n not in lst]
    if len(next) == 0:
      return 0

    tot = 0
    for n in next:
      tot += search(lst + [n])
    
    return tot


ans = search([1])

print(ans)

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


#iから進める場所をリストにして保管
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
  a,b = [int(a) for a in input().split()]
  edges[a].append(b)
  edges[b].append(a)


#深さ優先探索
def dfs(list):
    #lst(通過点)の数がN(頂点数)と等しくなったら探索終了（成功）
  if len(list) == N:
    return 1
  else:
    a = list[-1]
    #lstの最後尾（現在地）が次に進める場所をnextとしてリスト化
    #nextに以前通った場所が入っていないか確認
    next = [n for n in edges[a] if n not in list]
    #次に進める場所がなくなったら探索終了（失敗）
    if len(next) == 0:
      return 0

    total = 0
    #再帰でさらに探索
    for n in next:
      total += dfs(list + [n])

    return total


ans = dfs([1])

print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
edges = {i:[] for i in range(1,M+1)}
for i in range(M):
    a,b = map(int,input().split())
    edges[a].append(b)
    edges[b].append(a)

#深さ優先探索
def dfs(list):
    #lst(通過点)の数がN(頂点数)と等しくなったら探索終了（成功）
    if len(list) == N:
        return 1
    else:
        x = list[-1]
        #lstの最後尾（現在地）が次に進める場所をnextとしてリスト化
        #nextに以前通った場所が入っていないか確認
        next = [n for n in edges[x] if n not in list]
        #次に進める場所がなくなったら探索終了（失敗）
        if len(next) == 0:
          return 0

        total = 0
        #再帰でさらに探索
        for n in next:
          total += dfs(list + [n])

        return total
Problem p02959 (python)

Fixed submission:
n=int(raw_input())
g=raw_input().split()
a=[int(x) for x in g]
g=raw_input().split()
b=[int(x) for x in g]
#n=len()
acc=0
for i in range(n):
	inc=min(a[i],b[i])
	a[i]-=inc
	b[i]-=inc
	acc+=inc
	inc=min(a[i+1],b[i])
	a[i+1]-=inc
	b[i]-=inc
	acc+=inc
print(acc)

Buggy submission (verdict: Runtime Error):
n=int(raw_input())
g=raw_input().split()
a=[int(x) for x in g]
g=raw_input().split()
b=[int(x) for x in g]
#n=len()
acc=0
for i in range(n):
	inc=min(a[i],b[i])
	a[i]-=inc
	b[i]-=inc
	acc+=inc
	print(a,b,inc)
	inc=min(a[i+1],b[i])
	a[i+1]-=inc
	b[i]-=inc
	acc+=inc
	print(a,b,inc)
print(acc)
Problem p03075 (python)

Fixed submission:
antenna = []
for i in range(5):
  antenna.append(int(input()))
k = int(input())
if k >= max(antenna) - min(antenna):
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
antenna = []
for i in range(5):
  antenna[i] = int(input())
k = int(input())
if k < max(antenna) - min(antenna):
  print("Yay!")
else:
  print(":(")
Problem p03107 (python)

Fixed submission:
s = input()

num_0 = s.count("0")
num_1 = s.count("1")
if num_0 < num_1:
    print(num_0*2)
else:
    print(num_1*2)

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

i = 0
while(True):
    if ("01" in s ) :
        s = s.replace("01","",1) 
        i += 1
    elif "10" in s:
        s = s.replace("10","",1)
        i += 1
    else:
        break
    print(s)
print(i*2)
Problem p03127 (python)

Fixed submission:
import fractions
n = int(input())
a_list = sorted(list(map(int,input().split())))

a = a_list[0]
for i in range(1,n):
    a = fractions.gcd(a,a_list[i])

print(a)

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

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

print(a)
Problem p02959 (python)

Fixed submission:
N = int(input())
monstors = [int(i) for i in input().split()]
heros = [int(i) for i in input().split()]
init_monstor = sum(monstors)

for i in range(N):
    if monstors[i] >= heros[i]:
        monstors[i] -= heros[i]
        heros[i] = 0
    else:
        heros[i] -= monstors[i]
        monstors[i] = 0
    if monstors[i+1] >= heros[i]:
        monstors[i+1] -= heros[i]
        heros[i] = 0
    else:
        heros[i] -= monstors[i+1]
        monstors[i+1] = 0
print("{}".format(init_monstor - sum(monstors)))

Buggy submission (verdict: Runtime Error):
 N = int(input())
 monstors = [int(i) for i in input().split()]
 heros = [int(i) for i in  input().split()]
 init_monstor = sum(monstors)

 for i in range(N):
     if monstors[i] >= heros[i]:
         monstors[i] -= heros[i]
         heros[i] = 0
     else:
         heros[i] -= monstors[i]
         monstors[i] = 0
     if monstors[i+1] >= heros[i]:
         monstors[i+1] -= heros[i]
         heros[i] = 0
     else:
         heros[i] -= monstors[i+1]
         monstors[i+1] = 0
 print(init_monstor - sum(monstors))
Problem p03127 (python)

Fixed submission:
def gcd(a, b):
    while b != a:
        if a < b:
            b = b % a
            if b == 0:
                return a
        elif b < a:
            a = a % b
            if a == 0:
                return b
    return a

def m(a):
    a.sort()
    l = len(a)
    b = []
    for i in range(l // 2):
        b.append(gcd(a[i], a[l - i - 1]))
    if l % 2 == 1:
        b.append(a[l // 2])
    return list(set(b))

    
n = int(input())
a = [int(x) for x in input().split(" ")]

while len(a) > 1:
    a = m(a)

print(a[0])

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while a != b:
        if a < b:
            b = b - a
        else:
            a = a - b
    return a

def m(a):
    a.sort()
    b = []
    for i in range(len(a) // 2):
        b.append(gcd(a[i], a[i + 1]))
    return b

    
n = int(input())
a = [int(x) for x in input().split(" ")]

while len(a) > 1:
    a = m(a)

print(g)

Buggy submission (verdict: Runtime Error):
import math


n = int(input())
a = [int(x) for x in input().split(" ")]
a.sort()
g = a[n - 1]

for i in range(1, n):
    g = math.gcd(g, a[i])


print(g)

Buggy submission (verdict: Runtime Error):
import math


n = int(input())
a = [int(x) for x in input().split(" ")]
g = a.sort()[n - 1]


for i in range(1, n):
    g = math.gcd(g, a[i])


print(g)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(x) for x in input().split(" ")]
g = a.sort()[n - 1]

for i in range(1, n):
    g = math.gcd(g, a[i])

print(g)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(x) for x in input().split(" ")]
a.sort()
g = a[n - 1]

for i in range(1, n):
    g = math.gcd(g, a[i])

print(g)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(x) for x in input().split(" ")]
a.sort()
g = a[n - 1]

for i in range(1, n):
    g = math.gcd(g, a[i])
    
print(g)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(x) for x in input().split(" ")]
g = a.sort()[n - 1]

for i in range(1, n):
    g = math.gcd(g, a[i])
    
print(g)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(x) for x in input().split(" ")]

for i in range(1, n):
    g = math.gcd(g, a[i])
    
    
print(g)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(x) for x in input().split(" ")]

g = a[0]
for i in range(1, n):
    g = math.gcd(g, a[i])
    
    
print(g)
Problem p03127 (python)

Fixed submission:
from functools import reduce
import fractions
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def mon():
    input()
    a=[int(i) for i in input().split()]
    return gcd_list(a)
print(mon())

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def mon():
    input()
    a=[int(i) for i in input().split()]
    return gcd_list(a)
print(mon())

Buggy submission (verdict: Runtime Error):
import math
def mon():
    n=int(input())
    a=[int(i) for i in input().split()]
    a.sort()
    za=a[0]

    b=[i for i in a[1:] if i%za!=0]
    if b==[]:
        print(za)
        exit()

    c=[za]
    for i in b:
        c+=[i%za]

    while not len(c)==1:
        c[0]=c[0]%c[1]
        c.sort(reverse=True)
        c[0]=c[0]-c[1]
        if c[0]<=0:
            c.pop(0)

    return(c[0])


print(mon())
Problem p03805 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

ans=0


def dfs(v,n,visi):
    allv=True

    for i in visi:
        if not i:
            allv=False

    if allv:
        return 1

    ret=0

    for i in range(n):
        if G[v][i]==False:
            continue
        if visi[i]:
            continue
        visi[i]=True
        ret+=dfs(i,n,visi)
        visi[i]=False

    return ret

n,m=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(m)]
G=[[False for i in range(8)]for i in range(8)]

for a,b in ab:
    G[a-1][b-1]=G[b-1][a-1]=True

visi=[False for i in range(n)]

visi[0]=True

print(dfs(0,n,visi))

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

ans=0


def dfs(v,n,visi):
    allv=True

    for i in visi:
        if not i:
            allv=False

    if allv:
        return 1

    ret=0

    for i in range(n):
        if G[v][i]==False:
            continue
        if visi[i]:
            continue
        visi[i]=True
        ret+=dfs(i,n,visi)
        visi[i]=False

    return ret

n,m=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(m)]
G=[[False for i in range(n)]for i in range(m)]

for a,b in ab:
    G[a-1][b-1]=G[b-1][a-1]=True

visi=[False for i in range(n)]

visi[0]=True

print(dfs(0,n,visi))
Problem p02959 (python)

Fixed submission:
#coding: UTF-8

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

Ans = 0

for num in range(N):
    Ans += min(A[num], B[num])
    if A[num] >= B[num]:
        pass
    else: # A[num] < B[num]
        B[num] -= A[num]
        Ans += min(A[num+1], B[num])
        if A[num+1] >= B[num]:
            A[num+1] -= B[num]
        else:
            A[num+1] = 0
print(Ans)

Buggy submission (verdict: Runtime Error):
#coding: UTF-8

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

Ans = 0

for num in range(N):
    Ans += min(A[num], B[num])
    if A[num] => B[num]:
        pass
    else: # A[num] < B[num]
        B[num] -= A[num]
        Ans += min(A[num+1], B[num])
        if A[num+1] => B[num]:
            A[num+1] -= B[num]
        else:
            A[num+1] = 0
print(Ans)
Problem p02959 (python)

Fixed submission:

n=int(input())
mns=list(map(int,input().split()))
hrs=list(map(int,input().split()))
mk=0
for i in range(n):
  if(hrs[i]>=mns[i]+mns[i+1]):
    mk+=mns[i]+mns[i+1]
    mns[i]=0
    mns[i+1]=0
  else:
    if(hrs[i]<=mns[i]):
      mk+=hrs[i]
    else:
      mk+=hrs[i]
      mns[i+1]-=(hrs[i]-mns[i])
print(mk)

Buggy submission (verdict: Runtime Error):
while(True):
  n=int(input())
  mns=list(map(int,input().split()))
  hrs=list(map(int,input().split()))
  mk=0
  for i in range(n):
    if(hrs[i]>=mns[i]+mns[i+1]):
      mk+=mns[i]+mns[i+1]
      mns[i]=0
      mns[i+1]=0
    else:
      if(hrs[i]<=mns[i]):
        mk+=hrs[i]
      else:
        mk+=hrs[i]
        mns[i+1]-=(hrs[i]-mns[i])
  print(mk)
Problem p02984 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
s = sum(A)
r = [s - 2 * sum(A[1::2])]

for i in range(N-1):
    r.append(2 * A[i] - r[i])

r = map(str, r)
print(" ".join(r))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            tmp.append((i * j) % 2019)
    print(min(tmp))
Problem p02990 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from math import factorial

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

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) 

for i in range(1, K+1):
    if i <= N-K+1:
        print(ncr(K-1, i-1) * ncr(N-K+1, i) % (10**9 + 7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial

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

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) 

for i in range(1, K+1):
    print(ncr(K-1, i-1) * ncr(N-K+1, i) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial

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

def ncr(n, r):
    return factorial(n) // (factorial(r) * factorial(n - r)) % (10**9 + 7)

for i in range(1, K+1):
    print(ncr(K-1, i-1) * ncr(N-K+1, i))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial

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

def ncr(n, r):
    return int(factorial(n) / (factorial(r) * factorial(n - r)) % (10**9 + 7))

for i in range(1, K+1):
    print(ncr(K-1, i-1) * ncr(N-K+1, i))
Problem p03038 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])
cards = input().split(' ')
cards = [int(x) for x in cards]
cards.sort()

BC = []
for _ in range(M):
    inputs = input().split(' ')
    inputs = [int(x) for x in inputs]
    BC.append({'B': inputs[0], 'C': inputs[1]})

idx = 0
BC.sort(key=lambda x: x['C'], reverse=True)
for bc in BC:
    if idx >= N:
        break
    for _ in range(bc['B']):
        c = bc['C']
        if cards[idx] >= c:
            break
        else:
            cards[idx] = c
            idx += 1
            if idx >= N:
                break

print(sum(cards))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])
cards = input().split(' ')
cards = [int(x) for x in cards]
cards.sort()

BC = []
for _ in range(M):
    inputs = input().split(' ')
    inputs = [int(x) for x in inputs]
    BC.append(inputs)

idx = 0
BC = np.sort(BC, axis=0)[::-1]
for bc in BC:
    print(cards)
    if idx >= N:
        break
    for _ in range(bc[0]):
        c = bc[1]
        if cards[idx] >= c:
            break
        else:
            cards[idx] = c
            idx += 1
            if idx >= N:
                break

print(sum(cards))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])
cards = input().split(' ')
cards = [int(x) for x in cards]
cards.sort()

BC = []
for _ in range(M):
    inputs = input().split(' ')
    inputs = [int(x) for x in inputs]
    BC.append(inputs)

BC = np.sort(BC, axis=1)[::-1]
idx = 0
for bc in BC:
    for _ in range(bc[0]):
        c = bc[1]
        if cards[idx] >= c:
            break
        else:
            cards[idx] = c
            idx += 1

print(sum(cards))
Problem p03017 (python)

Fixed submission:
n, a, b, c ,d = map(int, input().split())
s = input()[:max(c,d)]

def main():
    if "##" in s[b:d-2]:
        return "No"
    if "##" in s[a:c-2]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d+1]:
            return "Yes"
                
        return "No"

print(main())

Buggy submission (verdict: Runtime Error):
n, a, b, c ,d = map(int, input().split())
# s = input()[:max(c,d)]

def main():
    if "##" in s[b:d-2]:
        return "No"
    if "##" in s[c:c-2]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d-1]:
            return "Yes"
                
        return "No"

print(main())

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

flag = 1

def main():
    for i in range(len(s[b:d-2])):
        if s[i:i+2] == "##":
            return "No"
    for i in range(len(s[a:c-2])):
        if s[i:i+2] == "##":
            return "No"

    if c < d:
        return "Yes"
    
    else:

        if s[b-2] == "." and s[b] == ".":
            return "Yes"
        else:
            for i in range(len(s[b:d-3])):
                if s[i:i+3] == "...":
                    return "Yes"
                    
            return "No"

print(main())
Problem p03186 (python)

Fixed submission:
#!/usr/bin/python
# coding: UTF-8

a, b, c = map(int,input().split())

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

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# coding: UTF-8

a, b, c = map(int,input().split("/"))

if a * b == 0:
  print(0)
elif a + b >= c:
  print(b + c)
else:
  print(a + b * 2 + 1)
Problem p02984 (python)

Fixed submission:
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
X[0] = total 

n =int((N-1)/2 )
for i in range(1,n+1):
    X[0] = X[0] - 2*A[2*i-1]
for j in range(1,N):
    X[j] = 2*A[j-1] - X[j-1]
for i in range(N):
    print("{}".format(int(X[i])),end=" ")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
B = np.array(A)

X = np.identity(N)
for i in range(N-1):
    X[i,i+1] = 1
X[N-1,0] = 1

ans = np.linalg.solve(X,B)
for i in range(N):
    print("{}".format(2*int(ans[i])),end=" ")
Problem p02987 (python)

Fixed submission:
s = input()
a = [i for i in s]
a.sort()
if a[0]==a[1] and a[2]==a[3] and a[0]!=a[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input()
s_list = list(s)
counter = Counter(s_list)
values = list(counter.values())
if values[0]==values[1]:
    print("Yes")
else:
    print("No")
Problem p03315 (python)

Fixed submission:
import sys
 
n = 0
 
S = input()

for i in range(0,4):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)

Buggy submission (verdict: Runtime Error):
import sys
 
n = 0

S = input()

for i in range(1,5):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)

Buggy submission (verdict: Runtime Error):
import sys

n = 0

S = sys.argv[1]

for i in range(len(S)):
    if S[i]=="+": n+=1
    else: n-=1

print(n)
Problem p03013 (python)

Fixed submission:
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input()) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[NM[0]-1] % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[N-1] % (10**9 + 7))
Problem p02970 (python)

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

Buggy submission (verdict: Runtime Error):
n, d = map(int, input())
print(-(-n // (1 + d * 2)))
Problem p02987 (python)

Fixed submission:
s = input()
s = sorted(s)
if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
s = input()
s=sorted(s)
if s[0]==S[1] and s[2]==s[3]:	print("Yes")
else:							print("No")