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

Fixed submission:
N = int(input())

amari = N % 1000

if amari > 0:
	answer = 1000 - amari
else:
  	answer = amari
        
print(answer)

Buggy submission (verdict: Runtime Error):
import sys

N = sys.args[1]

for i in range(10):
    if 1000 * i >= N:
        break

return 1000*i - N

Buggy submission (verdict: Runtime Error):
for i in range(10):
    if 1000 * i >= N:
        break

return 1000*i - N
Problem p02613 (python)

Fixed submission:
n = int(input())
list = []
c1,c2,c3,c4 = 0,0,0,0
for i in range(0,n):
  list.append(input())
for j in range(0,n):
  if list[j] == "AC":
    c1 = c1+1
  if list[j] == "WA":
    c2 = c2+1
  if list[j] == "TLE":
    c3 = c3+1
  if list[j] == "RE":
    c4 = c4+1
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(c1,c2,c3,c4))

Buggy submission (verdict: Runtime Error):
n = int(input())
list = []
c1,c2,c3,c4 = 0,0,0,0
for i in n:
  list.append(input())
for j in n:
  if list[j] == "AC":
    c1 = c1+1
  if list[j] == "WA":
    c2 = c2+1
  if list[j] == "TLE":
    c3 = c3+1
  if list[j] == "RE":
    c4 = c4+1
print(f"AC {c1}\nWA {c2}\nTLE {c3}\nRE {c4}")
Problem p02705 (python)

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

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
#include <math.h>
#define PI 3.14159265 
int main()
{
    int r; float ans;
    scanf("%d",&r);
    ans = 2*r*PI;
    printf("%f",ans);

    return 0;
}
Problem p02717 (python)

Fixed submission:
from sys import stdin, stdout
l = list(map(int, stdin.readline().rstrip().split(' ')))
f=[]
i=-1
n = 0
while(n<len(l)):
  f.append(l[i])
  i = i+1
  n= n+1
print(*f,sep=" ")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = []
ans = 1
if(n%m == 0):
  ans=0
else:
  for x in (0,1000000000000000000):
    n = abs(n%m)
    l.append(n)
  l.sort()
  ans = min(m-n,l[0])
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
l = list(map(int, stdin.readline().rstrip().split(' ')))
print(l)
f=[]
i=-1
for n in (0,(len(l)-1)):
    f[n] = l[i]
    i = i+1
print(l)

Buggy submission (verdict: Runtime Error):
import sys

l = []

for line in sys.stdin:
  new_list = [int(elem) for elem in line.split()]
  l.append(new_list)
f=[]
i=1
for x in range(0,len(l)):
  
  f[x] = l[-i]
  i++
print(f)
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = "Yes"
 
a.sort(reverse=True)
 
for i in range(m):
    if a[i] < sum(a)*(1/(4*m)):
        ans = "No"
        break
 
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
n,m = map(int, stdin.readline().rstrip().split())
l = list(map(int, stdin.readline().rstrip().split()))
sum = sum(l)
k = sum/(4*m)
ans = "Yes"
l.sort(reverse = True)
for i in (0,m):
  if l[i]<k:
      ans="No"
      break
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
n,m = map(int, stdin.readline().rstrip().split(' '))
l = list(map(int, stdin.readline().rstrip().split(' ')))
sum = sum(l)
k = sum/(4*m)
ans = "Yes"
l.sort(reverse = True)
for i in (0,m):
  if l[i]<k:
      ans="No"
      break
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
n,m = map(int, stdin.readline().rstrip().split(' '))
l = list(map(int, stdin.readline().rstrip().split(' ')))
sum = sum(l)
k = sum/(4*m)
ans = "Yes"
l.sort(reverse = True)
for i in (0,m):
  if l[i]<k:
      ans="No"
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
n,m = map(int, stdin.readline().rstrip().split(' '))
l = list(map(int, stdin.readline().rstrip().split(' ')))
sum = sum(l)
k = sum/(4*m)
ans = "Yes"
l.sort(reverse = True)
for i in (0,m):
  if l[i]<k:
      ans="No"
print(ans)
Problem p02719 (python)

Fixed submission:
n, m = map(int, input().split())
l = []
ans = 1
if(n%m == 0):
  ans=0
else:
  for x in (0,1000000000000000000):
    n = abs(n%m)
    l.append(n)
  l.sort()
  ans = min(m-n,l[0])
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = []
if(n%m = 0):
  ans=0
else:
  n = n-m
  l.append(n)
  
print(ans)
Problem p02724 (python)

Fixed submission:
n =int(input())
a= 500
b = 5
sum = 0
if(n%a==0):
  sum = n*2
else:
  sum = (1000*(n//a)) + 5*((n%a)//b)
  
print(sum)

Buggy submission (verdict: Runtime Error):
n =input()
a= 500
b = 5
sum = 0
if(n%a==0):
  sum = n*2
print(sum)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c = map(int, input().split())
p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))
p1.sort(reverse= True)
p2.sort(reverse= True)
ans =p1[:x]+p2[:y]+p3
ans.sort(reverse= True)
print(sum(ans[:x+y]))

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = map(int, input().split())
p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))
ans1 = 0
ans2 = 0
p1.sort(reverse = True)
p2.sort(reverse = True)
p3.sort(reverse = True)
for i in range(0,x):
  ans1= ans1 + max(p1[i],p3[0])
  if(p3[0]>p1[i]):
    del p3[0]
for i in range(0,y):
  ans2= ans2 + max(p2[i],p3[0])
  if(p3[0]>p2[i]):
    del p3[0]
print(ans1+ans2)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = map(int, input().split())
p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))
ans1 = 0
ans2 = 0
p1.sort(reverse = True)
p2.sort(reverse = True)
p3.sort(reverse = True)
for i in range(0, max(x,y)):
  p3.append(0)
for i in range(0,x):
  ans1= ans1 + max(p1[i],p3[i])
  if(p3[i]>p1[i]):
    del p[i]
for i in range(0,y):
  ans2= ans2 + max(p2[i],p3[i])
  if(p3[i]>p2[i]):
    del p3[i]
print(ans1+ans2)
Problem p02730 (python)

Fixed submission:
s= str(input())
if s != s[::-1]:
    print("No")
    exit()
else:
    s1 = s[:len(s)//2]
    s2 = s[len(s)//2+1:]
    if (s1!=s2):
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
s= input()
l = list(s)
ans= "Yes"
if(s != s[::1]):
    ans = "No"
    break
else:
    s1 = s[:len(s)//2]
    s2 = s[len(s)//2+1:]
    if s1!=s2:
        print("No")
    else:
        print("Yes")
print(ans)
Problem p02772 (python)

Fixed submission:
n = int(input());l = list(map(int, input().split()));ans = "APPROVED"
for i in (l):
  if(i%2 ==0 and (i%3 !=0 and i%5!=0)):
     ans = "DENIED"
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
for i in l:
  if(i%2 ==0 and (i%3 ==0 or i%5==0):
     print("APPROVED")
  else:
     print("DENIED")
Problem p02953 (python)

Fixed submission:
import sys
N = int(input())
H = input().split()
for i in range(N):
    H[i] = int(H[i])
H.reverse()

for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] = H[i+1]-1
    if H[i] < H[i+1]:
        print('No')
        sys.exit() 
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
H = input().split()
for i in range(N):
    H[i] = int(H[i])

H = reversed(H)  
for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] = H[i+1]-1
    if H[i] > H[i+1]:
        print('No')
        sys.exit() 
print('Yes')
Problem p03059 (python)

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

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

ans = 0
for i in range(1<<N):
    val = 0
    for j in range(N):
        if i >> j & 1:
            val+=V[j]
            val-=C[j]
    ans = max(ans, val)
print(ans)

Buggy submission (verdict: Runtime Error):
print(B*(T//A))

Buggy submission (verdict: Runtime Error):
print(B*((T+0.5)//A))
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  num=i
  sum=0
  while num!=0:
    sum+=num%10
    num//=10
  if a<=sum<=b:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  num=i
  while num!=0:
    sum+=num%10
    num/=10
  if a<=sum<=b:
    ans+=i
print(ans)
Problem p02983 (python)

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

    ans = 2020
    for i in range(l, min(r + 1, l + 2019)):
        for j in range(i + 1, min(r + 1, i + 2020)):
            mod = i * j % 2019
            if mod <= ans:
                ans = mod

    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools


def ij(m):
    return m[0] < m[1]


def mod(m):
    return (m[0] * m[1]) % 2019


def main():
    (l, r) = list(map(int, input().split()))

    print(min(map(mod, filter(ij, itertools.product(range(l, r + 1), range(l, r + 1))))))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools


def ij(m):
    return m[0] < m[1]


def mod(m):
    return m[0] * m[1] % 2019


def main():
    (l, r) = list(map(int, input().split()))

    print(min(map(mod, filter(ij, itertools.product(range(l, r + 1), range(l, r + 1))))))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools

def ij(m):
    return m[0] < m[1]

def main():
    (l, r) = list(map(int, input().split()))

    min = 2018
    for (i, j) in filter(ij, itertools.product(range(l, r + 1), range(l, r + 1))):
        mod = i * j % 2019
        if mod <= min:
            min = mod

    print(min)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools

def ij(m):
    return m[0] < m[1]

def main():
    (l, r) = list(map(int, input().split()))

    min = 2020
    for (i, j) in filter(ij, itertools.product(range(l, r + 1), range(l, r + 1))):
        mod = i * j % 2019
        if mod <= min:
            min = mod

    print(min)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools

def main():
    (l, r) = list(map(int, input().split()))

    min = 2020
    for (i, j) in itertools.product(range(l, r + 1), range(l, r + 1)):
        if i < j:
            mod = i * j % 2019
            if mod <= min:
                min = mod

    print(min)

if __name__ == "__main__":
    main()
Problem p02696 (python)

Fixed submission:
a, b ,n = map(int, input().split())
tmp = min(b-1, n)
print(str(int(a*tmp/b)-a*int(tmp/b)))

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

if a == b and b == c:
    print(a-1)
else:
    if a <= b:
        if a >= n:
            #n_tmp = n % a
            #print(n_tmp)
            #if n_tmp == 0:
            n_tmp = n
            ans = int(a*n_tmp/b) - a*int(n_tmp/b)
            #print(ans)
            #print('####')
    
            ##for x in range(n+1):
             #   ans = int(a*x/b) - a*int(x/b)
             #   print(ans)
    
        else:
            ans = a-1
            print(ans)
    
            ##for x in range(n + 1):
             #   ans = int(a*x/b) - a*int(x/b)
             #   print(ans)
    
    
    else:
        if a >= n:
            ans_max = 0
            n_tmp = n
            for x in range(n_tmp+1):
                ans = int(a*x/b) - a*int(x/b)
                #print(ans)
                if ans_max < ans:
                    ans_max = ans
    
            print(ans_max)
    
        else:
            ans_max = 0
            n_tmp = a
            for x in range(n_tmp + 1):
                ans = int(a * x / b) - a * int(x / b)
                #print(ans)
                if ans_max < ans:
                    ans_max = ans
    
            #print('max##########################')
            print(ans_max)
    
            #print('#########################')
            #for x in range(n + 1):
            #    ans = int(a * x / b) - a * int(x / b)
            #    print(ans)
                #if ans_max < ans:
                #    ans_max = ans
    
            #print(ans_max)
Problem p02702 (python)

Fixed submission:

s = input()[::-1]
from collections import defaultdict
amari = defaultdict(int)
keta_ = defaultdict(int)

cur = 0
keta = 1

for i in range(len(s)):
    cur += int(s[i]) * keta
    cur %= 2019

    keta *= 10
    keta %= 2019
    
    amari[cur] += 1
    keta_[keta] += 1

#print('%')
#print(2114%2019)
#print(181712114%2019)

#print(81712114%2019)
#print(1817181712114%2019)

#print('%')

#print(amari)
#print(keta_)
ans = 0
if 0 in amari:
    ans += amari[0]

for n in amari.values():
    ans += (n * (n-1)) // 2
  
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())[::-1]

tmp_amari = [0]*2019

#amari = 0
num = 0
order = 1
for i in s:
    num += int(i)*order
    num %= 2019
    #print(num)
    tmp_amari[num] += 1
    order *= 10

#tmp_print = [i for i in tmp_amari if i > 0]
#print(tmp_print)

ans = 0
ans += tmp_amari[0]

for i in tmp_print:
    ans += (i*(i-1))//2

print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())[::-1]

tmp_amari = [0]*2019

#amari = 0
num = 0
order = 1
for i in s:
    num += int(i)*order
    num %= 2019
    print(num)
    tmp_amari[num] += 1
    order *= 10

#tmp_print = [i for i in tmp_amari if i > 0]
#print(tmp_print)

ans = 0
ans += tmp_amari[0]

for i in tmp_print:
    ans += (i*(i-1))//2

print(ans)
Problem p02708 (python)

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

ans = 0
for i in range(k, n+2):
    ans += ((n*2-i+1)*i)/2 - i*(i-1)/2 + 1

#print(ans)
print(int(ans%(10**9+7)))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

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

ans = 0
for i in range(k, n+2):
    ans += ((n*2-i+1)*i)/2 - i*(i-1)/2 + 1

#print(ans)
print(int(ans%(10**9+7)))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

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

ans = 0
for i in range(k, n+2):
    ans += ((n*2-i+1)*i)/2 - i*(i-1)/2 + 1

#print(ans)
print(ans%(10**9+7))
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce


k = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k += 1
ans = 0

for i in range(1,k):
    for j in range(i,k):
        #print(i,j)
        if i == j:
            ans += gcd(i,j)
        else:
            ans += gcd(i,j)*6

for i in range(1,k):
    for j in range((i+1),k):
        for h in range((j+1),k):
            #print(i,j,h)
            ans += gcd(i,j,h)*6


print(ans)

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


k = int(input())

def gcd(*numbers):
    return reduce(gcd, numbers)

k += 1
ans = 0

#for i in range(1,k):
#    for j in range(i,k):
#        #print(i,j)
#        if i == j:
#            ans += gcd(i,j)
#        else:
#            ans += gcd(i,j)*6

for i in range(1,k):
    for j in range(1,k):
        for h in range(1,k):
            #print(i,j,h)
            ans += gcd(i,j,h)


print(ans)
Problem p02761 (python)

Fixed submission:
def main():
    n, m = map(int, input().split())
    
    ans = []
    check = []
    check_once = []
    false_flg = 0
    for i in range(n):
        ans.append('0')
        check.append(0)
        check_once.append(0)

    for j in range(m):
        s, c = input().split()

        if int(s) == 1 and int(c) == 0 and n != 1:
            false_flg = 1

        if check[int(s)-1] == 0:
            ans[int(s)-1] = c
            check[int(s)-1] = 1

        elif check[int(s)-1] == 1 and ans[int(s)-1] == c:
            ans[int(s)-1] = c

        else:
            false_flg = 1
    
    tmp = int("".join(ans))
    
    if tmp // 10**(n-1) > 0 and false_flg != 1:
        print(tmp)

    elif false_flg != 1:
        if tmp == 0 and n == 1:
            print(0)
        else:
            tmp_ = 10**(n-1) + int(tmp)
            print(tmp_)
    else:
        print(-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    
    ans = []
    check = []
    check_once = []
    false_flg = 0
    for i in range(n):
        ans.append('0')
        check.append(0)
        check_once.append(0)

    for j in range(m):
        s, c = input().split()

        if int(s) == 1 and int(c) == 0:
            false_flg = 1

        if check[int(s)-1] == 0:
            ans[int(s)-1] = c
            check[int(s)-1] = 1

        elif check[int(s)-1] == 1 and ans[int(s)-1] == c:
            ans[int(s)-1] == c:

        else:
            false_flg = 1
    
    tmp = int("".join(ans))
   
    if tmp // 10**(n-1) > 0 and false_flg != 1:
        print(tmp)
    elif false_flg != 1:
        tmp_ = 10**(n-1) + int(tmp)
        print(tmp_)
    else:
        print(-1)


if __name__ == '__main__':
    main()
Problem p02783 (python)

Fixed submission:

def main():
    
    h,a = map(int, input().split())

    if h <= a:
        print(1)

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


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    
    h,a = map(int, input().split())

    if h%a== 0:
        print(h//a)
    else:
        prinbt(h%a+1)


if __name__ == '__main__':
    main()
Problem p02866 (python)

Fixed submission:
from collections import Counter

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

count = Counter(d)

if d[0] != 0:
    print(0)
    


#print(count[0])
#print(len(count))
#print(count.keys())
#print(count.items())
elif count[0] != 1:
    print(0)
    
else:
    ans = 1
    tmp = 1
    max_d = max(d)
    for i in range(1, max_d+1):
        
        ans *= tmp**count[i]
        #print(ans)
        tmp = count[i]


    print(ans%998244353)

Buggy submission (verdict: Runtime Error):
vfrom collections import Counter

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

count = Counter(d)

if d[0] != 0:
    print(0)
    


#print(count[0])
#print(len(count))
#print(count.keys())
#print(count.items())
elif count[0] != 1:
    print(0)
    
else:
    ans = 1
    tmp = 1
    for i in range(1, len(d)+1):
        
        ans *= tmp**count[i]
        #print(ans)
        tmp = count[i]


    print(ans%998244353)

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

count = Counter(d)

if d[0] != 0:
    print(0)
    


#print(count[0])
#print(len(count))
#print(count.keys())
#print(count.items())
elif count[0] != 1:
    print(0)
    
else:
    ans = 1
    tmp = 1
    for i in range(1, len(d)+1):
        
        ans *= tmp**count[i]
        #print(ans)
        tmp = count[i]


print(ans%998244353)
Problem p02983 (python)

Fixed submission:
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    if r-l >= 2019:
        ans_tmp = 0
    else:
        for j in range(r-l):
            for k in range(j,r-l):
                ans = ((l+j)*(l+(k+1)))% 2019
                if ans == 0:
                    ans_tmp = 0
                    break
                elif ans < ans_tmp:
                    ans_tmp = ans
                
        
    print(ans_tmp)

if __name__ == '__main__':
    main()

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

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    if r-l >= 2019:
        ans_tmp = 0
    else:
        for j in range(r-l):
            for k in range(r-l-1):
                ans = ((l+j)*(l+(k+1)))% 2019
                if ans == 0:
                    ans_tmp = 0
                    break
                elif ans < ans_tmp:
                    ans_tmp = ans
                
        
    print(ans_tmp)

if __name__ == '__main__':
    main()
Problem p02995 (python)

Fixed submission:
import fractions

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

c_d = (c * d) // fractions.gcd(c, d)

a -= 1

tmp_b = b - (b//c + b//d - b//c_d)
tmp_a = a - (a//c + a//d - a//c_d)

print(tmp_b-tmp_a)

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

#
c_d = c * d / fractoins.gcd(c, d)

def check(cc):
    if a%cc == 0:
        tmp_a = a
    else:
        tmp_a = cc*(a//cc+1)
    if b%cc == 0:
        tmp_b = b
    else:
        tmp_b = cc*(b//cc)

    #print('a, b')
    #print(tmp_a, tmp_b)
    if tmp_a > b:
        return 0
    elif tmp_b < a:
        return 0
    tmp = tmp_b-tmp_a

    return (tmp // cc) + 1

# c
tmp_1 = check(c)
#d
tmp_2 = check(d)

tmp_3 = check(c_d)


#print(tmp_1, tmp_2, tmp_3)

print(int((b-a)-(tmp_1+tmp_2-tmp_3*2)))

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

#
c_d = c * d / math.gcd(c, d)

def check(cc):
    if a%cc == 0:
        tmp_a = a
    else:
        tmp_a = cc*(a//cc+1)
    if b%cc == 0:
        tmp_b = b
    else:
        tmp_b = cc*(b//cc)

    #print('a, b')
    #print(tmp_a, tmp_b)
    if tmp_a > b:
        return 0
    elif tmp_b < a:
        return 0
    tmp = tmp_b-tmp_a

    return (tmp // cc) + 1

# c
tmp_1 = check(c)
#d
tmp_2 = check(d)

tmp_3 = check(c_d)


#print(tmp_1, tmp_2, tmp_3)


print(int((b-a)-(tmp_1+tmp_2-tmp_3*2)))

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

# 最小公倍数
c_d = c * d / math.gcd(c, d)

def check(cc):
    if a%cc == 0:
        tmp_a = a
    else:
        tmp_a = cc*(a//cc+1)
    if b%cc == 0:
        tmp_b = b
    else:
        tmp_b = cc*(b//cc)

    #print('a, b')
    #print(tmp_a, tmp_b)
    if tmp_a > b:
        return 0
    elif tmp_b < a:
        return 0
    tmp = tmp_b-tmp_a

    return (tmp // cc) + 1

# c
tmp_1 = check(c)
#d
tmp_2 = check(d)

tmp_3 = check(c_d)


#print(tmp_1, tmp_2, tmp_3)


print(int((b-a)-(tmp_1+tmp_2-tmp_3*2)))

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

# 最小公倍数
c_d = c * d / math.gcd(c, d)

def check(cc):
    if a%cc == 0:
        tmp_a = a
    else:
        tmp_a = cc*(a//cc+1)
    if b%cc == 0:
        tmp_b = b
    else:
        tmp_b = cc*(b//cc)

    #print('a, b')
    #print(tmp_a, tmp_b)
    if tmp_a > b:
        return 0
    elif tmp_b < a:
        return 0
    tmp = tmp_b-tmp_a

    return (tmp // cc) + 1

# c
tmp_1 = check(c)
#d
tmp_2 = check(d)

tmp_3 = check(c_d)


#print(tmp_1, tmp_2, tmp_3)


print(int((b-a)-(tmp_1+tmp_2-tmp_3*2)))
Problem p03000 (python)

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

l_list = list(map(int, input().split()))

tmp = 0
for i in range(n):
    tmp += l_list[i]
    if tmp > x:
        break

if tmp <= x:
    print(101)
else:
    print(i+1)

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

l_list = list(map(int, input().split()))

tmp = 0
for i in range(100):
    tmp += l_list[i]
    if tmp > x:
        break

if tmp =< x:
    print(101)
else:
    print(i+1)

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

l_list = list(map(int, input().split()))

tmp = 0
for i in range(100000):
    tmp += l_list[i]
    if tmp > x:
        break

print(i+1)