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

Fixed submission:
N = int(input())
xylist = [[0, 0]]*N
for i in range(N):
  xy = list(map(int, input().split()))
  xylist[i] = xy

dl = {}
for i in range(N):
  for j in range(N):
    dx = str(xylist[j][0] - xylist[i][0])
    dy = str(xylist[j][1] - xylist[i][1])
    l = dx + "|" + dy
    if dx == "0" and dy == "0":
      continue
    if l in dl:
      dl[l] = dl[l] + 1
    else:
      dl[l] = 1

cnt = 0
if len(dl) != 0:
  cnt = N - max(dl.values())

print(cnt if cnt > 1 else "1")

Buggy submission (verdict: Runtime Error):
N = int(input())
xylist = [[0, 0]]*N
for i in range(N):
  xy = list(map(int, input().split()))
  xylist[i] = xy

dl = {}
for i in range(N):
  for j in range(N):
    dx = str(xylist[j][0] - xylist[i][0])
    dy = str(xylist[j][1] - xylist[i][1])
    l = dx + "|" + dy
    if dx == "0" and dy == "0":
      continue
    if l in dl:
      dl[l] = dl[l] + 1
    else:
      dl[l] = 1

cnt = N - max(dl.values())
print(cnt if cnt > 1 else "1")

Buggy submission (verdict: Runtime Error):
N = int(input())
xylist = [[0, 0]]*N
for i in range(N):
  xy = list(map(int, input().split()))
  xylist[i] = xy

dl = {}
for i in range(N):
  for j in range(i+1, N):
    dx = str(xylist[j][0] - xylist[i][0])
    dy = str(xylist[j][1] - xylist[i][1])
    l = dx + "|" + dy
    if dx == "0" and dy == "0":
      continue
    if l in dl:
      dl[l] = dl[l] + 1
    else:
      dl[l] = 1

cnt = N - max(dl.values())
print(cnt if cnt > 1 else "1")

Buggy submission (verdict: Runtime Error):
N = int(input())
xylist = [[0, 0]]*N
for i in range(N):
  xy = list(map(int, input().split()))
  xylist[i] = xy

dl = {}
for i in range(N):
  for j in range(i+1, N):
    dx = str(xylist[j][0] - xylist[i][0])
    dy = str(xylist[j][1] - xylist[i][1])
    l = dx + "|" + dy
    if dx == "0" and dy == "0":
      continue
    if l in dl:
      dl[l] = dl[l] + 1
    else:
      dl[l] = 1

print(N - max(dl.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xylist = [[0, 0]]*N
for i in range(N):
  xy = list(map(int, input().split()))
  xylist[i] = xy

dl = {}
for i in range(N):
  for j in range(i+1, N):
    dx = str(xylist[j][0] - xylist[i][0])
    dy = str(xylist[j][1] - xylist[i][1])
    l = dx + "|" + dy
    if l in dl:
      dl[l] = dl[l] + 1
    else:
      dl[l] = 1

print(N - max(dl.values()))
Problem p03085 (python)

Fixed submission:
b = input()
dic = {"A":"T", "C":"G", "G":"C", "T":"A"}
print(dic[b])

Buggy submission (verdict: Runtime Error):
b = input()
dic = {"A":"T", "C":"G"}
print(dic[b])
Problem p03495 (python)

Fixed submission:
n, k = map(int, input().split())
d = {}
for i in input().split():
  if i in d:
    d[i] = d[i] + 1 
  else:
    d[i] = 1

l = sorted(d.values())
print(sum(l[:len(l) - k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
  dic[i] = a.count(i)

dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
cnt = 0
for i in range(k):
  cnt = cnt + dic[i][1]

print(n - cnt)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
  dic[i] = a.count(i)

dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
print(dic)
cnt = 0
for i in range(k):
  cnt = cnt + dic[i][1]

print(n - cnt)
Problem p03597 (python)

Fixed submission:
n = int(input())
a = int(input())

print(n**2 - a)

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

maxStrength = 0
ansMass = 100*A
ansSugar = 0
for i in range(100*A, F+1, 100*A):
        for j in range(0, F-i+1, 100*B):
                for k in range(0, F-i-j+1, C):
                        for l in range(0, F-i-j-k+1, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a / 100)*E >= b and mass <= F and mass != 0:
                                        strength = (100*b) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSugar = b

print(ansMass, ansSugar)
Problem p03014 (python)

Fixed submission:
import numpy as np
h, w = map(int, input().split())
table = np.array([list(input())for _ in range(h)]) == '.'
 
d = np.zeros((h, w), dtype = int)
u = np.zeros((h, w), dtype = int)
r = np.zeros((h, w), dtype = int)
l = np.zeros((h, w), dtype = int)

for i in range(h):
    d[i] = (d[i-1]+1) * table[i]
    u[-i-1] = (u[-i]+1) * table[-i-1]

for i in range(w):
    r[:, i] = (r[:, i-1]+1) * table[:, i]
    l[:, -i-1] = (l[:, -i]+1) * table[:, -i-1]
print(np.max(d+u+r+l)-3)

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

Height, Width = map(int,input().split(" "))

lineBlocks = [(input()) for i in range(Height)]

twoDimMap = []
for Block in lineBlocks:
  twoDimMap.append(list(Block))
  
ansList = []
heightList = np.zeros((Height, Width), dtype=int)
widthList  = np.zeros((Height, Width), dtype=int)

for i in range(Height):
  for j in range(Width):
    
    if '#' == twoDimMap[i][j]:
      continue

    else:
        if heightList[i][j] == 0:

            k_up = i+1
            height_len = 0
            while( k_up < Height and twoDimMap[k_up][j] != "#"):
                height_len += 1
                k_up += 1
                
            
            k_down = i-1
            while( k_down >= 0 and twoDimMap[k_down][j] != "#"):
                height_len += 1
                k_down -= 1
            
            for k in range(k_down+1,k_up):
                heightList[k][i] = height_len


        if widthList[i][j] == 0:
            k_right = j+1
            width_len = 0
            while(k_right < Width and twoDimMap[i][k_right] != "#"):
                width_len += 1
                k_right += 1

            k_left = j-1
            while(k_left >= 0 and twoDimMap[i][k_left] != "#"):
                width_len += 1
                k_left -= 1
            
            for k in range(k_left+1,k_right):
                widthList[i][k] = width_len

print(np.array(heightList + widthList + 1).max())
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(int,input().split())

flag = 0
if(x == W/2 and y == H/2):
    flag = 1
    
print(W*H/2,flag)

Buggy submission (verdict: Runtime Error):
import numpy as np
W,H,x,y = map(int,input().split())
min_s = H*(W-2*x)
ts = H*x
flag = 0 
for d in range(0,360,0.5):
    if(d == 90 or d == 270):
        continue
    rad = np.deg2rad(d)
    a = np.tan(rad)
    h = a*W - 2*a*x + 2*y
    men = (a*x-y+h/2)*W
    s = round(abs(W*H - 2 * men),9)
    if min_s > s:
        min_s = s
        ts = men
    elif min_s == s:
        flag = 1
    
print(ts,flag)

Buggy submission (verdict: Runtime Error):

import numpy as np
W,H,x,y = map(int,input().split())

min_s = W*H
for i in range(W):
    s = abs(W*H - 2 * (i*H))
    if min_s > s:
        min_s = s
        ts = i*H

min_s2 = W*H
flag = 0 
for d in range(360):
    if(d == 90 or d == 270):
        continue
    rad = np.deg2rad(d)
    a = np.tan(rad)
    h = a*W - 2*a*x + 2*y
    men = (a*x-y+h/2)*W
    s = abs(W*H - 2 * men)
    if min_s2 > s:
        min_s2 = s
        ts2 = men
    elif min_s2 == s:
        flag = 1

flag2 = 0
if ts2 == ts: 
    flag2 = 1
    
if min_s2 > min_s:
    print(ts,flag2)
else:
    print(ts2,flag)
Problem p03457 (python)

Fixed submission:
import numpy as np
N = int(input())
S = []
for i in range(N):
    S.append(list(map(int,input().split())))
now = [0,0]
time = 0
flag = True
for i in range(N):
    dis = abs(S[i][1]-now[0])+abs(S[i][2]-now[1])
    if(dis > S[i][0] or (S[i][0]-time)%2 != dis%2):
        flag = False
        break
    now[0] = S[i][1]
    now[1] = S[i][2]
    time = S[i][0]
    
if flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = []
for i in range(N):
    S.append(list(map(int,input().split())))
now = [0,0]
flag = True
for i in range(N):
    dis = abs(S[i][1]-now[0])+abs(S[i][2]-now[1])
    if(dis > S[i][0] or (S[i][0]-time)%2 != dis%2):
        flag = False
        break
    now[0] = S[i][1]
    now[1] = S[i][2]
    time = S[i][0]
    
if flag:
    print("Yes")
else:
    print("No")
Problem p03477 (python)

Fixed submission:
A,B,C,D = map(int,input().split())
l = A+B
r = C+D
if(l>r):
    print("Left")
elif(l==r):
    print("Balanced")
elif(l<r):
    print("Right")

Buggy submission (verdict: Runtime Error):
rS = list(str(input()))
import numpy
S0 = numpy.array(rS).astype(numpy.int32)
S1 = numpy.array(rS).astype(numpy.int32)
lS = len(S0)
def hanten(slist):
    ans = numpy.logical_xor(slist,numpy.ones(len(slist))).astype(int)
    return ans

for i in range(2,lS+1)[::-1]:
    for j in range(lS - i + 1):
        if(S0[j] == 0):
            S0[j:j+i] = hanten(S0[j:j+i])
        if(S1[j] == 1):
            S1[j:j+i] = hanten(S1[j:j+i])
            
    if(sum(S0[:-1]) == len(S0) - 1):
        print(i)
        break;
    if(sum(S1[:-1]) == len(S1) - 1):
        print(i)
        break;
Problem p03495 (python)

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

from collections import Counter
import numpy as np
c = Counter(A)

no = len(c.most_common())
numlist = []
for label, num in c.most_common():
    numlist.append(num)

diff = no - K
ans = 0
if(diff > 0):
    ans = np.sum(numlist[-diff:])
    
print(ans)

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

from collections import Counter
import numpy as np
c = Counter(A)

no = len(c.most_common())
numlist = []
for label, num in c.most_common():
    numlist.append(num)

diff = no - K
if(diff > 0):
    ans = np.sum(numlist[-diff:])
    
print(ans)
Problem p03567 (python)

Fixed submission:
S = str(input())
Slist = list(S)
flag = False
for i in range(len(Slist)-1):
    st = Slist[i] + Slist[i+1]
    if(st == "AC" and flag == False):
        print('Yes')
        flag = True
if(flag == False):
    print('No')

Buggy submission (verdict: Runtime Error):
S = str(input())
Slist = list(S)
flag = False
for i in range(len(Slist)-1):
    st = Slist[i] + Slist[i+1]
    if(st == "AC" and flag == False):
        prinSSFGt('Yes')
        flag = True
if(flag == False):
    print('No')
Problem p03575 (python)

Fixed submission:
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for i in range(M)]

def dfs(Graph, Start, Visited=None):
    if (Visited==None):  Visited = []
    Visited.append(Start) 
    for Next in Graph[Start]: 
        if ( Next in Visited ):  
            continue 
        Visited = dfs(Graph, Next, Visited)
    return Visited
 
ans = 0
for it in range(M):
    hoge = list(ab)
    del hoge[it]
    l = [[] for i in range(N)]
    for pi in hoge:
        l[pi[0]-1].append(pi[1]-1)
        l[pi[1]-1].append(pi[0]-1)
    if(N != len(dfs(l, 0))):
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for i in range(M)]

ans = 0
for it in range(M):
    hoge = list(ab)
    del hoge[it]
    l = [[] for i in range(N)]
    for pi in hoge:
        l[pi[0]-1].append(pi[1]-1)
        l[pi[1]-1].append(pi[0]-1)
    if(N != len(dfs(l, 0))):
        ans += 1
        
print(ans)
Problem p03587 (python)

Fixed submission:
S = int(input())
ans = 0
for i in range(6):
    A = S%10
    B = int(S/10)
    S = B
    ans += A
print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
# h,n,w
temp = int((3*N)/4)
hlist = [i+1 for i in range(temp)]
flag = False
for i in hlist:
    temp = 4/N - 1/i
    if(temp > 0):
        nlist = [i+1 for i in range(int(2/temp))]
        for j in nlist:
            beta = 4/N - 1/i - 1/j
            if (beta > 0):
                if(1/beta == int(1/beta)):
                    w = int(1/beta)
                    n = j
                    h = i
                    flag = True
                    break

    if flag:
        break

print(str(h)+ " " + str(n)+ " " +str(w))
Problem p03589 (python)

Fixed submission:
N = int(input())
flag = False
for i in range(1,3500):
    for j in range(1,3500):
        if((4*i*j - N*i - N*j) > 0 and (N*i*j)%(4*i*j - N*i - N*j) == 0):
            w = int((N*i*j)/(4*i*j - N*i - N*j))
            h = i
            n = j
            flag = True
            break
    if flag:
        break

print(h,n,w)

Buggy submission (verdict: Runtime Error):
N = int(input())
flag = False
for i in range(1,3500):
    for j in range(1,3500):
        if((N*i*j)%(4*i*j - N*i - N*j) == 0 and (4*i*j - N*i - N*j) > 0):
            w = int((N*i*j)%(4*i*j - N*i - N*j))
            h = i
            n = j
            flag = True
            break
    if flag:
        break

print(h,n,w)

Buggy submission (verdict: Runtime Error):
N = int(input())
# h,n,w
flag = False
for i in range(1,3500):
    for j in range(1,3500):
        if((N*i*j)%(4*i*j - N*i - N*j) == 0 and (N*i*j)/(4*i*j - N*i - N*j) > 0):
            w = int((N*i*j)%(4*i*j - N*i - N*j))
            h = i
            n = j
            flag = True
            break
    if flag:
        break

print(h,n,w)

Buggy submission (verdict: Runtime Error):
N = int(input())
# h,n,w
temp = int((3*N)/4)
if (temp >= 3500):
    temp = 3500
hlist = [i for i in range(temp,0,-1)]
flag = False
for i in hlist:
    temp = 4/N - 1/i
    if(temp > 0):
        al = int(2 / temp)
        if (al >= 3500):
            al = 3500
        nlist = [ii for ii in range(al,0,-1)]
        for j in nlist:
            beta = 4/N - 1/i - 1/j
            if (beta > 0):
                if(1/beta == int(1/beta)):
                    w = int(1/beta)
                    n = j
                    h = i
                    flag = True
                    break

    if flag:
        break

print(str(h)+ " " + str(n)+ " " +str(w))

Buggy submission (verdict: Runtime Error):
N = int(input())
# h,n,w
temp = int((3*N)/4)
hlist = [i+1 for i in range(temp)]
flag = False
for i in hlist:
    temp = 4/N - 1/i
    nlist = [i+1 for i in range(int(2/temp))]
    for j in nlist:
        beta = 4/N - 1/i - 1/j
        if (beta > 0):
            if(1/beta == int(1/beta)):
                w = int(1/beta)
                n = j
                h = i
                flag = True
                break

    if flag:
        break

print(str(h)+ " " + str(n)+ " " +str(w))
Problem p03598 (python)

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

ans = 0
for i in range(N):
    if(abs(K-x[i]) >= x[i]):
        ans += x[i]
    else:
        ans += abs(K-x[i])

print(ans*2)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = []
for i in range(N):
    x.append([int(i) for i in input().split()])

ans = 0
for i in range(N):
    if(abs(K-x[i]) >= x[i]):
        ans += x[i]
    else:
        ans += abs(K-x[i])
        
print(ans)
Problem p02983 (python)

Fixed submission:
l,r = map(int,input().split())

if (r-l+1)>=2019:
    print(0)
else:
    ans = (l*(l+1))%2019
    for j in range(l,r+1):
        for i in range(l,j):
            if ((i*j)%2019)<ans:
                ans = (i*j)%2019
    print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())

m = [-1]*(r-l+1)

if (r-l+1)>=2019:
    print(0)
else:
    for i in range(r-l+1):
        m[i] = (l+i)%2019
    sm = sorted(m)
    print(sm[0]*sm[1])
Problem p02988 (python)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-2):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-3):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-1):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-1):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1

print(ans)
Problem p02995 (python)

Fixed submission:
from fractions import gcd

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

lcm = int(c * d / gcd(c, d))

bb = int((b // c) + (b // d) - (b // lcm))

aa = int(((a-1) // c) + ((a-1) // d) - ((a-1) // lcm))

print((b-a) - int(bb-aa) + 1)

Buggy submission (verdict: Runtime Error):
import math

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

lcm = int(c * d / math.gcd(c, d))

bb = int((b // c) + (b // d) - (b // lcm))

aa = int(((a-1) // c) + ((a-1) // d) - ((a-1) // lcm))

print(bb, aa)

print((b-a) - int(bb-aa) + 1)

Buggy submission (verdict: Runtime Error):
import math

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

lcm = c * d / math.gcd(c, d)

bb = ((b // c) + (b // d) - (b // lcm))

aa = ((a // c) + (a // d) - (a // lcm))

print((b-a) - int(bb-aa) + 1)
Problem p03067 (python)

Fixed submission:
#A - On the Way

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

if a < c < b:
	print("Yes")
elif b < c < a:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
#C - Stones
#黒い石のすぐ右に白い石があるような箇所がないようにしたいです。 

n = int(input())
state = input()
state_list = list(state)
prob_num = 0
state_list.append(" ")
for i in range(n):
	if state_list[i] == "#" and state_list[i+1] == ".":
		prob_num += 1

print(prob_num)
Problem p03069 (python)

Fixed submission:
#毎回関数を呼ぶとおそくなる
n = int(input())
stones = input()
score = stones.count(".")
r = score
for i in range(n):
	if stones[i] == ".":
		r -= 1
	else:
		r += 1
	score = min(r, score)
print(score)

Buggy submission (verdict: Runtime Error):
#C - Stones
#黒い石のすぐ右に白い石があるような箇所がないようにしたいです。 

n = int(input())
state = input()
state_list = list(state)
state_list.append(" ")

#specify the locate causing problem
prob_locate = []
prob_num = 0
for i in range(n):
	if state_list[i] == "#" and state_list[i+1] == ".":
		prob_locate.append(i)
		prob_num += 1
if prob_num == 0:
		print(0)
		exit()

#finding optimal position
import random
while prob_num > 0:
	for i in prob_locate:
		r_0 = random.randint(0,1)
		r_1 = random.randint(0,1)
		state_list[(i + r_0)] = ["#", "."][r_1]
	prob_locate = []
	prob_num = 0
	for i in range(n):
		if state_list[i] == "#" and state_list[i+1] == ".":
			prob_locate.append(i)
			prob_num += 1

#checking the difference
statelist.remove(" ")
diff = 0
for i, j in zip(state_list, list(state):
	if i != j: diff += 1

print(diff)

Buggy submission (verdict: Runtime Error):
#C - Stones
#黒い石のすぐ右に白い石があるような箇所がないようにしたいです。 

n = int(input())
state = input()
state_list = list(state)
prob_num = 0
state_list.append(" ")
for i in range(n):
	if state_list[i] == "#" and state_list[i+1] == ".":
		prob_num += 1

state_list.remove(" ")
black = state_list.count("#")
white = state_list.count(".")
min_stone = min(black, white)

if min_stone > prob_num:
	if state_list[-1] == "#":
		print(min_ - 1)
	else:
		print(min_)
else:
	print(prob_num)
Problem p03071 (python)

Fixed submission:
 # A - Buttons
a, b = list(map(int, input().split()))
first = max(a, b)
if a == first:
	a -= 1
else:
 	b -= 1
second = max(a, b)
print(first + second)

Buggy submission (verdict: Runtime Error):
buttons = {"A","B"}
buttons["A","B"]=(A,B)

def game():
  num = 0
  value = 0
  while num < 2:
    if buttons["A"] >= button["B"]:
      value += buttons["A"]
      buttons["A"] -= 1
    else:
      value += buttons["B"]
      buttons["B"] -= 1
    num += 1
  return(value)
print(game())
Problem p03139 (python)

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

max_ = min(a, b)

if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = 0

print(max_, min_)

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

max_ = min(a,b)
if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = n - (a + b)

print(max_, min_)

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

max_ = min(a,b)
if max(n, a+b) == a+b:
	min_ = a + b - n
else:
	min_ = n - (a + b)

print(max_, min_)
Problem p02993 (python)

Fixed submission:
s = str(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")

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

ab.sort(key=lambda x: x[1])
now = 0 #現在時刻
for i in range(n):
    now = now + ab[i][0]
    if now > ab[i][1]:
        print('No')
        sys.exit()

print('Yes')
Problem p02995 (python)

Fixed submission:
from fractions import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)
Problem p03071 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# Input
list = [int(a) for a in input().split()]

#ソート
list.sort()

num = 0
if list[1] > list[0] + 1:
    num = list[1] * 2 - 1
else:
    num = sum(list)

print(num)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# Input
list = [int(a) for a in input().split()]

#ソート
list.sort()
print

if list[0] > list[1] + 1:
    num = list[0] * 2 - 1
else:
    mum = sum(list)

print(num)
Problem p03448 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1
            else if list[3] < 500 * ii + 100 * jj + 50 * kk:
                break

print(count)
Problem p03478 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# Input
list = []
n, a, b = map(int, input().split())

total = 0
for ii in range(1, n + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= a and sum <= b:
        total += ii
print(total)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(3):
    list += [int(input())]

total = 0
for ii in range(1, list[0] + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= list[1] and sum <= list[2]:
        total += ii
print(total)
Problem p03493 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a = list(str(input()))
num = [int(s) for s in a]
print(sum(num))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 入力
a = list(str(input))
# String to Int
num = [int(s) for s in a]
# Output
print(sum(num))

Buggy submission (verdict: Runtime Error):
a = list(str(input))
num = [int(s) for s in a]
print(sum(num))