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

Fixed submission:
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

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

if a[-1] == b[1] and b[-1] == c[1]:
    print("YES")
else:
    print("NO")
Problem p03737 (python)

Fixed submission:
a, b, c = input().split()

A = a.upper()
B = b.upper()
C = c.upper()

print(A[0]+B[0]+C[0])

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if abs(x-y) <= 1:
    print("Alice")
else:
    print("Brown")
Problem p04034 (python)

Fixed submission:
n, m = map(int, input().split())
stack = [1]*n
p = [False]*n
p[0] = True

for i in range(m):
    x, y = map(int, input().split())
    stack[x-1] -= 1
    stack[y-1] += 1
    p[y-1] = p[x-1] or p[y-1]
    if stack[x-1] == 0:
        p[x-1] = False

ans = 0
for i in p:
    if i:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
stack = [1]*n
p = [False]*n
p[0] = True

for i in range(m):
    x, y = map(int, input().split())
    stack[x-1] -= 1
    stack[y-1] += 1
    p[y-1] = p[x-1] or p[y-1]
    if stack[0] == 0:
        p[0] = False

for i in p:
    if i:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
stack = [1]*n
p = [1]

for i in range(m):
    x, y = map(int, input().split())
    stack[x-1] -= 1
    stack[y-1] += 1
    if x in p:
        p.append(y)
    if p[0] == 1:
        p.remove(1)

ps = list(set(p))
ans = 0
for i in ps:
    if stack[i-1] != 0:
        ans += 1
print(ans)
Problem p03161 (python)

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

inf = 10**5
dp = [inf for i in range(n)]
dp[0] = 0

for i in range(1, n):
    tmp = []
    for j in range(i-k, i):
        if j >= 0:
            tmp.append(dp[j] + abs(h[j] - h[i]))
    dp[i] = min(tmp)

print(dp[-1])

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

inf = 10**5
dp = [inf for i in range(n)]
dp[0] = 0

for i in range(1, n):
    tmp = []
    for j in range(i-k, i):
        tmp.append(dp[j] + abs(h[j] - h[i]))
    dp[i] = min(tmp)
    
print(dp[-1])
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
print(min(n%k, k-n%k))

Buggy submission (verdict: Runtime Error):
from math import ceil
n, k = map(int,input().split())
array = [n]
p = ceil(max(n/k,k/n))+1
n_r = 10**18
if k == 1:
    array.append(0)
else:
    for i in range(p):
        n_r = n
        n = abs(n-k)
        array.append(n)
        if n > n_r:
            break
min_n = min(array)
print(min_n)

Buggy submission (verdict: Runtime Error):
from math import ceil
n, k = map(int,input().split())
array = []
p = ceil(max(n/k,k/n))+2
n_r = 0
if k == 1:
    array.append(0)
else:
    for i in range(p):
        n_r = n
        n = abs(n-k)
        array.append(n)
        if n > n_r:
            break
min_n = min(array)
print(min_n)

Buggy submission (verdict: Runtime Error):
from math import ceil
n, k = map(int,input().split())
array = []
p = ceil(max(n/k,k/n))+2
if k == 1:
    array.append(0)
else:
    for i in range(p):
        n = abs(n-k)
        array.append(n)
min_n = min(array)
print(min_n)
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
print(r*math.pi*2)

Buggy submission (verdict: Runtime Error):
r = int(input())
pi = 3.141592653589793
print(math.pi*r*2)
Problem p02817 (python)

Fixed submission:
c=list(map(str, input().split()))
print(c[1]+c[0])

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
print(b+a)
Problem p02830 (python)

Fixed submission:
N = int(input())
Ar =list(map(str,input().split()))

S = list(Ar[0])
T = list(Ar[1])

Ans_Ar = []

for i in range(N):
  Ans_Ar.append(S[i])
  Ans_Ar.append(T[i])

result = ''.join(Ans_Ar)
print(result)

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

S = list(Ar[0])
T = list(Ar[1])

Ans_Ar = []

for i in range(N):
  Ans_Ar.append(S[i])
  Ans_Ar.append(T[i])

result = ''.join(Ans_Ar)
print(result)
Problem p02733 (python)

Fixed submission:
import sys
from copy import copy
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353


def two(x):
    return "0" * (h - 1 - len(bin(x)[2:])) + bin(x)[2:]


h, w, k = map(int, input().split())
S = []
ans = inf
for i in range(h):
    S.append(input().strip())
for way_cut in range(1 << (h - 1)):
    way_cut = two(way_cut)
    number_cut_horizontal = way_cut.count("1")
    number_cut_vertical = 0
    CUT = [-1]
    for i in range(len(way_cut)):
        if way_cut[i] == '1':
            CUT.append(i)
    CUT.append(len(way_cut))
    SUM = [0] * (w)
    PRE = [0] * (w)
    for col in range(w):
        for i in range(1, len(CUT)):
            for between in range(CUT[i - 1] + 1, CUT[i] + 1):
                SUM[i] += 1 if S[between][col] == "1" else 0
        isok = True
        for i in range(1, len(CUT)):
            if PRE[i] + SUM[i] > k:
                isok = False
        if not isok:
            number_cut_vertical += 1
            PRE = copy(SUM)
            SUM = [0]*(w)  # leave out
            # recheck
            for i in range(1, len(CUT)):
                if PRE[i] > k:
                    number_cut_vertical = inf
                    break
        else:
            for i in range(1, len(CUT)):
                PRE[i] += SUM[i]
                SUM[i] = 0
    ans = min(ans, number_cut_vertical + number_cut_horizontal)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from copy import copy
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353


def two(x):
    return "0" * (h - 1 - len(bin(x)[2:])) + bin(x)[2:]


h, w, k = map(int, input().split())
S = []
ans = inf
for i in range(h):
    S.append(input().strip())
# for way_cut in range(1 << (h - 1)):
for way_cut in range(2,3):
    way_cut = two(way_cut)
    number_cut_horizontal = way_cut.count("1")
    number_cut_vertical = 0
    CUT = [-1]
    for i in range(len(way_cut)):
        if way_cut[i] == '1':
            CUT.append(i)
    CUT.append(len(way_cut))
    SUM = [0] * (w)
    PRE = [0] * (w)
    for col in range(w):
        for i in range(1, len(CUT)):
            for between in range(CUT[i - 1] + 1, CUT[i] + 1):
                SUM[i] += 1 if S[between][col] == "1" else 0
        isok = True
        for i in range(1, len(CUT)):
            if PRE[i] + SUM[i] > k:
                isok = False
        if not isok:
            number_cut_vertical += 1
            PRE = copy(SUM)
            SUM = [0]*(w)
            # recheck
            for i in range(1, len(CUT)):
                if PRE[i] > k:
                    number_cut_vertical = inf
                    break
        else:
            for i in range(1, len(CUT)):
                PRE[i] += SUM[i]
                SUM[i] = 0
    ans = min(ans, number_cut_vertical + number_cut_horizontal)
print(ans)
Problem p02787 (python)

Fixed submission:
H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b =map(int,input().split())
    A.append(a)
    B.append(b)

G = [0]*(H+1)

for i in range(1,N+1):
    for j in range(1,H+1):
        if i == 1:
            if j-A[i-1]<0:
                G[j] = B[i-1]
            else:
                G[j] = G[j-A[i-1]]+B[i-1]
        elif j-A[i-1]<0:
            G[j] = min(G[j], B[i-1])
        else:
            G[j] = min(G[j], G[j-A[i-1]]+B[i-1])
        
print(G[H])

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b =map(int,input().split())
    A.append(a)
    B.append(b)

G = [0]*(H+1)

@jit
def func()
    for i in range(1,N+1):
        for j in range(1,H+1):
            if i == 1:
                if j-A[i-1]<0:
                    G[j] = B[i-1]
                else:
                    G[j] = G[j-A[i-1]]+B[i-1]
            elif j-A[i-1]<0:
                G[j] = min(G[j], B[i-1])
            else:
                G[j] = min(G[j], G[j-A[i-1]]+B[i-1])
        return G[H]
        
print(func())

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b =map(int,input().split())
    A.append(a)
    B.append(b)

G = [0]*(H+1)

@jit
def func()
    for i in range(1,N+1):
        for j in range(1,H+1):
            if i == 1:
                if j-A[i-1]<0:
                    G[j] = B[i-1]
                else:
                    G[j] = G[j-A[i-1]]+B[i-1]
            elif j-A[i-1]<0:
                G[j] = min(G[j], B[i-1])
            else:
                G[j] = min(G[j], G[j-A[i-1]]+B[i-1])
        return G[H]
        
print(func())
Problem p02791 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
#n = 5
#p = [4,2,5,1,3]

count = 0
temp_min = p[0]
for i in range(n):
  if temp_min >= p[i]:
        count+=1
        temp_min = p[i]
print(count)

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


count = 0
for i in range(n):
  for j in range(i):
    if p[i] > p[j]:
      break
  else:
    count+=1
    continue
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(n):
  for j in range(i):
    if p[i] > p[j]:
      break
  else:
    count+
    continue
print(count)
Problem p02772 (python)

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
even=[el for el in a if el % 2==0]
try:
  for a in even:
    if a % 3 == 0 or a % 5 == 0:
      flg = 1
    else:
      raise
except:
  print('DENIED')
else:
  print('APPROVED')

Buggy submission (verdict: Runtime Error):
    n=int(input())
    a = list(map(int,input().split()))
    even=[el for el in a if el % 2==0]
    try:
      for a in even:
        if a % 3 == 0 or a % 5 == 0:
          flg = 1
        else:
          raise
    except:
      print('DENIED')
    else:
      print('APPROVED')
Problem p03473 (python)

Fixed submission:
a=int(input())
print(int(24+(24-a)))

Buggy submission (verdict: Runtime Error):
a=input()
print(24+a)
Problem p03030 (python)

Fixed submission:
N = int(input())
DF = []
for i in range(N):
    S1, SP = input().split()
    DF = DF + [[i+1, S1, int(SP)]]
DF1 = sorted(DF, key=lambda x:x[2], reverse=True)
DF2 = sorted(DF1, key=lambda x:x[1], reverse=False)
for i in range(N):
    print(DF2[i][0])

Buggy submission (verdict: Runtime Error):
import pandas as pd
N = int(input())
DF = []
for i in range(N):
    S1, SP = input().split()
    DF = DF + [[i+1, S1, int(SP)]]
DF1 = sorted(DF, key=lambda x:x[2], reverse=True)
DF2 = sorted(DF1, key=lambda x:x[1], reverse=False)
for i in range(N):
    print(DF2[i][0])

Buggy submission (verdict: Runtime Error):
import pandas as pd
N = int(input())
S = []
P = []
for i in range(N):
    S1, SP = input().split()
    S = S + [S1]
    P = P + [int(SP)]
df = pd.DataFrame({'city': S, 'point': P})
df = df.sort_values(by=['point'], ascending=False)
df = df.sort_values(by=['city'], ascending=True)
for x in df.index:
    print(x+1)
Problem p03231 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd (a, b)
n, m = map(int, input().split())
S = input()
T = input()
jn = 0
jm = 0
l = lcm(n,m)
ln = l // n
lm = l // m
d = lcm(ln, lm)
for i in range(0, l, d):
    if S[i // ln] != T[i // lm]:
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
n = int(input())
wt = list(map(int, input().split()))
PN = 1
s = 0
rev = [1 / (i + 1) for i in range(n)]
for i in range(n):
    PN = (PN * (i+1)) % (10 ** 9 + 7)
    pij = 0
    pij = sum(rev[0:n-i]) + sum(rev[1:i+1])
    s += pij * wt[i]
    #print(pij)
print(round(PN*s) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
n = int(input())
wt = list(map(int, input().split()))
PN = 1
s = 0
rev = [1 / (i + 1) for i in range(n)]
for i in range(n):
    PN = (PN * (i+1)) % (10 ** 9 + 7)
    pij = 0
    pij = sum(rev[0:n-i]) + sum(rev[1:i+1])
    s += pij * wt[i]
    #print(pij)
print(round(PN*s) % (10 ** 9 + 7))
Problem p03244 (python)

Fixed submission:
n = int(input())
lst = list(map(int, input().split()))
ma = {}
mb = {}
for i in range(0, n, 2):
    lst[i] in ma
    if lst[i] in ma:
        ma[lst[i]] += 1
    else:
        ma[lst[i]] = 1
    lst[i+1] in mb
    if lst[i+1] in mb:
        mb[lst[i+1]] += 1
    else:
        mb[lst[i+1]] = 1
if max(ma, key=ma.get) != max(mb, key=mb.get):
    d = n - max(ma.values()) - max(mb.values())
else:
    ma2 = max(ma.values())
    mb2 = max(mb.values())
    ma[max(ma, key=ma.get)] = 0
    mb[max(mb, key=mb.get)] = 0
    d1 = n - ma2 - max(mb.values())
    d2 = n - max(ma.values()) - mb2
    d = min(d1, d2)
print(d)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int, input().split()))
m = 0
for i in range(0,n-2):
	if lst[i] != lst[i+2]:
    	lst[i+2] = lst[i]
    	m += 1
    elif lst[i] == lst[i+1]:
		m += 1
print(m)
Problem p03261 (python)

Fixed submission:
import sys
n = int(input())
words=[]
for i in range(n):
    words += [input()]
for i in range(n-1):
    for j in range(i+1, n):
        if words[i] == words[j]:
                print('No')
                sys.exit()
    if words[i][-1] != words[i+1][0]:
        print('No')
        sys.exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
words = input().split()
for i in range(n-1)
    for j in range(1, i):
        if words[i] == words[j]:
                print('No')
                sys.exit()
    if words[i][-1] != words[i+1][1]:
        print('No')
        sys.exit()
print('Yes')
Problem p03262 (python)

Fixed submission:
import fractions

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = abs(num[0]-x)
for nn in num:
	d=fractions.gcd(d, abs(nn-x))
print(d)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = num[0]-x
for nn in num:
    d=gcd(t,n-x)
print(d)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = abs(num[0]-x)
for nn in num:
    d=gcd(t,abs(n-x))
print(d)

Buggy submission (verdict: Runtime Error):
# math.gcd()を使う
import math
N, X = map(int, input().split())
# 一行の入力をリストxに入れる
x = list(map(int, input().split()))
# すべての(x[i]-X)の最大公約数が答え
# 最初の最大公約数
t = abs(x[0] - X)
for a in x:
    # 最大公約数を更新
    t = math.gcd(t, abs(a - X))
print(t)

Buggy submission (verdict: Runtime Error):
import math

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = abs(num[0]-x)
for nn in num:
    d=math.gcd(t,abs(n-x))
print(d)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

n, x = map(int, input().split())
num = list(map(int,input().split()))
nxx = np.array([x] * n)
nnum = np.array(num)
diff = nnum-nxx
d = reduce(math.gcd, diff)
print(d)
Problem p02705 (python)

Fixed submission:
import math as ma
n=int(input())
print(2*n*ma.pi)

Buggy submission (verdict: Runtime Error):
import math as ma
n=int(input())
print(2*n*ma.pi)
return 0
Problem p02885 (python)

Fixed submission:
a,b=map(int,input().split(" "))
print(max(0,a-2*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(" "))
print(max(0a-*b))
Problem p03470 (python)

Fixed submission:
print(len(set(input() for i in range(int(input())))))

Buggy submission (verdict: Runtime Error):
print(len(set(input() for i in range(int(input()))))
Problem p03474 (python)

Fixed submission:
# Your code here!
A,B= map(int, input().split(" "))
S=input()
n=S.count("-")
if S[A]=="-" and len(S)==A+B+1 and n==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A,B= map(int, input().split(" "))
S=input()
if S[3]=="-" and len(S)==A+B+1:
    print("Yes")
else:
    print("No")
Problem p03591 (python)

Fixed submission:
if input().startswith("YAKI"):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if input().startwith("YAKI"):
  print("Yes")
else:
  print("No")
Problem p03623 (python)

Fixed submission:
x,a,b = map(int,input().split(' '))
c = a-x
d = b-x

if c<0:
	e = -c
else:
	e = c

if d<0:
	f = -d
else:
	f = d


if e<f:
	print('A')
else:
	print('B')

Buggy submission (verdict: Runtime Error):
import math
x,a,b = map(int,input().split(' '))
c = a-x
d = b-x

e = abs(c)
d = abs(d)

if e<f:
	print('A')
else:
	print('B')
Problem p03624 (python)

Fixed submission:
S = str(input())
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

n = 0

for i in range(26):

	if alpha[n] not in S:
		print(alpha[n])
		break
	if n == 25:
		print("None")
		break
		
	n += 1

Buggy submission (verdict: Runtime Error):
S = str(input)
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

S.sort()
n = 0
m = 0

for i in range(len(S)):
	if S[n] not in alpha:
		print(S[n])
		break
	n += 1

	if n = len(S) - 1:
		m = 1

if m == 1:
	print('None')

Buggy submission (verdict: Runtime Error):
S = str(input)
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

al = []

n = len(S)
n2 = 0

for i in range(n):
	if S[n2] in alpha:
		al.append(S[n2])
	n2 += 1

m = len(al)
n2 = 0

for j in range(m):
	numi = alpha.index(al[n2])
	del alpha[numi]
	n2 += 1

if len(alpha) == 0:
	print('None')
else:
	print(alpha[0])

Buggy submission (verdict: Runtime Error):
S = str(input)
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

al = []

n = len(S)
n2 = 0

for i in range(n):
	if S[n2] in alpha:
		al.append(S[n2])
	n2 += 1

m = len(al)
n2 = 0

for i in range(m):
	numi = alpha.index(al[n2])
	del alpha[numi]
	n2 += 1

print(alpha[0])
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())
if N%500 <= A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
if N%500 =< A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N, A = map(int, input().split('\n'))
a = N % 500
if a%A==0:
  print('Yes')
else:
  print('No')
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
c = a*b
if c % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
c = a*b
if c % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
c = a*b
if c // 2 == 0:
  print('Even')
else:
  print('Odd')
Problem p03485 (python)

Fixed submission:
a,b = map(int, input().split())
if (a+b) % 2 == 0:
  print(int((a+b)/2))
else:
  print(int((a+b)/2)+1)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if (a+b) % 2 = 0:
  print(int((a+b)/2))
else:
  print(int((a+b)/2)+1)
Problem p03693 (python)

Fixed submission:
l = list(map(int,input().split()))
if (10*l[1]+l[2])%4==0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
l = list[map(int,input().split())]
if (10*l[1]+l[2])%4==0:
  print('YES')
else:
  print('NO')
Problem p02910 (python)

Fixed submission:
import sys

s = input()

for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "L":
            print("No")
            sys.exit()
            
    else:
        if s[i] == "R":
            print("No")
            sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys

s=input()

for i in range(len(s)):
  if i%2==0:
    if s[i]==="L":
      print("No")
      sys.exit()
      
  else:
    if s[i]=="R":
      print("No")
      sys.exit()
      
print("Yes")

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

for i in range(len(s)):
  if i%2==0:
    if s[i]==="L":
      print("No")
      sys.exit()
      
  else:
    if s[i]=="R":
      print("No")
      sys.exit()
      
print("Yes")
Problem p02995 (python)

Fixed submission:
def gcd(m,n):
    x= max(m,n)
    y= min(m,n)
    if x%y == 0:
        return y
    else:
        while not x%y==0:
            z=x%y
            x= y
            y=z
        else:
            return z
def lcm(x, y):
    return (x * y) // gcd(x, y)


a,b,c,d = map(int,input().split())
lcm = lcm(c,d)
c_i=a//c
d_i=a//d
cd_i=a//lcm
if not a%c==0:
    c_i+=1
if not a%d==0:
    d_i+=1
if not a%lcm==0:
    cd_i+=1

c_f=b//c
d_f=b//d
cd_f=b//lcm

print(b-a-(c_f+d_f-cd_f-c_i-d_i+cd_i+1)+1)

Buggy submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


a,b,c,d = map(int,input().split())
c_i=a//c
d_i=a//d
cd_i=a//(lcm(c,d))
if not a%c==0:
    c_i+=1
if not a%d==0:
    d_i+=1
if not a%(lcm(c,d))==0:
    cd_i+=1

c_f=b//c
d_f=b//d
cd_f=b//(lcm(c,d))

print(b-a-(c_f+d_f-cd_f-c_i-d_i+cd_i+1)+1)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


a,b,c,d = map(int,input().split())
c_i=a//c
d_i=a//d
cd_i=a//(lcm(c,d))
if not a%c==0:
    c_i+=1
if not a%d==0:
    d_i+=1
if not a%(lcm(c,d))==0:
    cd_i+=1

c_f=b//c
d_f=b//d
cd_f=b//(lcm(c,d))

print(b-a-(c_f+d_f-cd_f-c_i-d_i+cd_i+1)+1)
Problem p02854 (python)

Fixed submission:
N = int(input())
length_list = [int(x) for x in input().split()]

all_length = sum(length_list)

half_length = all_length / 2
before_sum = 0
after_sum = 0
for ax in length_list:
    if before_sum+ax < half_length:
        before_sum += ax
        continue
    else:
        after_sum = before_sum + ax
        break
before_diff = all_length - before_sum 
after_diff = all_length - after_sum

if before_diff - before_sum < after_sum - after_diff:
    print(before_diff - before_sum)
else:
    print(after_sum - after_diff)

Buggy submission (verdict: Runtime Error):
half_length = all_length / 2
before_sum = 0
after_sum = 0
for ax in length_list:
    if before_sum+ax < half_length:
        before_sum += ax
        continue
    else:
        after_sum = before_sum + ax
        break
before_diff = all_length - before_sum 
after_diff = all_length - after_sum

if before_diff < after_diff:
    print(before_diff - before_sum)
else:
    print(after_sum - after_diff)
Problem p02999 (python)

Fixed submission:
x, a = map(int, input().split())
if x>=a:
  print(10)
else :
  print(0)

Buggy submission (verdict: Runtime Error):
x, a = map(int, input())
if x>=a:
  print(10)
else :
  print(0)
Problem p03062 (python)

Fixed submission:
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
a = np.array(a, dtype='int64')
k = np.sum(a < 0)
a = np.absolute(a)
a.dtype ='uint64'
a.sort()

if k % 2 == 0:
    print(int(np.sum(a)))
else :
    print(int(np.sum(a)- a[0]*2))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
a = np.array(a, dtype='int64')
a.sort()
for i in range(n):
    if a[i] > 0:
        k = i
        break
a = np.absolute(a)
a.sort()

if k % 2 == 0:
    print(np.sum(a))
else :
    print(np.sum(a)- a[0]*2)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
a = np.array(a, dtype='int64')
a.sort()
print(a)
for i in range(n):
    if a[i] > 0:
        k = i
        print(i)
        break
a = np.absolute(a)
a.sort()

if k % 2 == 0:
    print(np.sum(a))
else :
    print(np.sum(a)- a[0]*2)