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

Fixed submission:
# coding: utf-8
# Your code here!

N, M, Q = map(int, input().rstrip().split(' '))

count = [[0] * (N + 1) for _ in range(N+1)]
memo = [[0] * (N + 1) for _ in range(N+1)]

for _ in range(M):
    p, q = map(int, input().rstrip().split(' '))
    count[p][q] += 1

for i in range(1,N+1):
    for j in range(1,N+1):
        memo[i][j] = count[i][j] + memo[i-1][j] + memo[i][j-1] - memo[i-1][j-1]

for i in range(Q):
    p, q = map(int, input().rstrip().split(' '))
    print(memo[q][q] - memo[p-1][q] - memo[q][p-1] + memo[p-1][p-1])

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import numpy as np
 
N, M, Q = map(int, input().rstrip().split(' '))
 
memo = np.zeros((N, N)).astype(int)
 
for _ in range(M):
    p, q = map(int, input().rstrip().split(' '))
    memo[:p, q-1:] += 1
 
for i in range(Q):
    p, q = map(int, input().rstrip().split(' '))
    print(memo[p-1][q-1])
Problem p03309 (python)

Fixed submission:
# coding: utf-8
# Your code here!
 
import statistics
 
N = int(input())
A = list(map(int, input().rstrip().split(' ')))
 
A_dash = sorted([x - i - 1 for i, x in enumerate(A)])
med = int(statistics.median(A_dash))

print(sum([abs(x - med) for x in A_dash]))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
 
import sys
sys.setrecursionlimit(1000000)
 
N = int(input())
A = list(map(int, input().rstrip().split(' ')))
 
A_dash = [x - i - 1 for i, x in enumerate(A)]
 
def recursive(X):
    if len(X) == 1:
        return sum([abs(x - X[0]) for x in A_dash])
    elif len(X) == 2:
        if sum([abs(x - X[1]) for x in A_dash]) - sum([abs(x - X[0]) for x in A_dash]) > 0:
            return sum([abs(x - X[0]) for x in A_dash])
        else:
            return sum([abs(x - X[1]) for x in A_dash])
        
    if sum([abs(x - X[len(X)//2]) for x in A_dash]) - sum([abs(x - X[len(X)//2 - 1]) for x in A_dash]) < 0:
        return recursive(X[len(X)//2:])
    else:
        return recursive(X[:len(X)//2 + 1])
 
print(recursive(list(range(min(A_dash), max(A_dash) + 1))))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

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

A_dash = [x - i - 1 for i, x in enumerate(A)]

def recursive(X):
    if len(X) == 1:
        return sum([abs(x - X[0]) for x in A_dash])
    elif len(X) == 2:
        if sum([abs(x - X[1]) for x in A_dash]) - sum([abs(x - X[0]) for x in A_dash]) > 0:
            return sum([abs(x - X[0]) for x in A_dash])
        else:
            return sum([abs(x - X[1]) for x in A_dash])
        
    if sum([abs(x - X[len(X)//2]) for x in A_dash]) - sum([abs(x - X[len(X)//2 - 1]) for x in A_dash]) < 0:
        return recursive(X[len(X)//2:])
    else:
        return recursive(X[:len(X)//2 + 1])

print(recursive(list(range(min(A_dash), max(A_dash) + 1))))
Problem p03408 (python)

Fixed submission:
# coding: utf-8
# Your code here!

from collections import defaultdict

n = int(input())
x = [str(input()) for _ in range(n)]
m = int(input())
y = [str(input()) for _ in range(m)]

dx = defaultdict(int)
dy = defaultdict(int)

for temp_x in x:
    dx[temp_x] += 1
for temp_y in y:
    dy[temp_y] += 1
    
max_count = 0
for k in dx.keys():
    max_count = max(max_count, dx[k] - dy[k])
    
print(max_count)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

from collections import defaultdict

n = int(input())
x = [input() for _ in range(n)]
m = int(input())
y = [input() for _ in range(n)]

dx = defaultdict(int)
dy = defaultdict(int)

for temp_x in x:
    dx[temp_x] += 1
for temp_y in y:
    dy[temp_y] += 1
    
max_count = 0
for k in dx.keys():
    max_count = max(max_count, dx[k] - dy[k])
    
print(max_count)
Problem p02678 (python)

Fixed submission:
from collections import deque

n, m = map(int, input().split())
l = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    l[a].append(b)
    l[b].append(a)
ans = [0] * (n + 1)
f = [0] * (n + 1)
d = deque()
d.append(1)
while len(d) > 0:
    k = d.popleft()
    f[k] = 1
    for i in l[k]:
        if f[i] == 1:
            continue
        ans[i] = k
        d.append(i)
        f[i] = 1
for i in range(2, n + 1):
    if ans[i] == 0:
        print("No")
        exit()
print("Yes")
for i in range(2, n + 1):
    print(ans[i])

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

n, m = map(int, input().split())
l = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    l[a].append(b)
    l[b].append(a)
ans = [0] * (n + 1)
f = [0] * (n + 1)
d = deque()
d.append(1)
print(len(d))
while len(d) > 0:
    print(d)
    k = d.popleft()
    f[k] = 1
    for i in l[k]:
        if f[i] == 1:
            continue
        ans[i] = k
        d.append(i)
        f[i] = 1
for i in range(2, n + 1):
    if ans[i] == 0:
        print("No")
        exit()
print("Yes")
for i in range(2, n + 1):
    print(ans[i])
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = [-1] * n
f[0] = 0
s1, s2, g1, g2 = 0, 0, 0, 0
j = a[0] - 1
jpre = 0
c = 1
i = 0
while True:
    if i >= k:
        s1, s2 = f[jpre], jpre
        g1, g2 = 0, 0
        break
    if f[j] != -1:
        s1, s2 = f[jpre], jpre
        g1, g2 = f[j], j
        break
    else:
        f[j] = c
        c += 1
        jpre = j
        j = a[j] - 1
    i += 1
ans = (k - g1) % (s1 - g1 + 1) + f[g2]
for i in range(n):
    if f[i] == ans:
        print(i + 1)
        break

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = [0] * n
f[0] = 1
s, g = 0, 0
j = a[0] - 1
jpre = 0
c = 1
i = 0
while True:
    if i >= n:
        break
    if f[j] != 0:
        s = jpre
        g = j
        break
    else:
        f[j] = c
        c += 1
        jpre = j
        j = a[j] - 1
    i += 1
f[0] = 0
ans = (k - g) % (s - g) + f[g]
for i in range(n):
    if f[i] == ans:
        print(i + 1)
        break
Problem p02696 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input())
print(a * (b - 1) // b)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input())
print(b - 1)
Problem p02783 (python)

Fixed submission:
h, a = map(int, input().split())
count = 0
while h > 0:
    h -= a
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
l = list(map(int, input().split()))
if h > sum(l):
    print("No")
else:
    print("Yes")
Problem p02801 (python)

Fixed submission:
s = input()
print(chr(ord(s) + 1))

Buggy submission (verdict: Runtime Error):
s = input()
print(chr(ord(s + 1)))
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
l = [0] * n
ac, wa = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if l[p - 1] != -1 and s == "AC":
        ac += 1
        wa += l[p - 1]
        l[p - 1] = -1
    if l[p - 1] != -1 and s == "WA":
        l[p - 1] += 1
print(ac, wa)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = list("")
ac, wa = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if l[p - 1] != -1 and s == "AC":
        ac += 1
        wa += l[p - 1]
        l[p - 1] = -1
    if l[p - 1] != -1 and s == "WA":
        l[p - 1] += 1
print(ac, wa)
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = input()
ac = [0] * n
c = 0
for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        c += 1
    ac[i] = c
for i in range(q):
    l, r = map(int, input().split())
    print(ac[r - 1] - ac[l - 1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
ac = [0] * n
c = 0
for i in range(1, n):
    if s[i - 1] == 'A' and s[i] == 'C':
        c += 1
    ac[i] = c
for i in range(q):
    l, r = map(int, input().split())
    print(ac[r - 1] - ac[l + 1] + 1)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
    print("Hello World")
elif n == 2:
    a = int(input())
    b = int(input())
    print(a + b)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
    print("Hello World")
elif n == 2:
    a, b = map(int, input().split())
    print(a + b)
Problem p03447 (python)

Fixed submission:
x, a, b = map(int, [input() for i in range(3)])
print((x - a) % b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)
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):
a = int(input())
b = int(input())

if (a * b) % 2 == 0:
    print("Even")
else:
    print("Odd")
Problem p02660 (python)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

def main():
    N = int(input())
    #xxx = list(map(int, input().split()))

    if N == 1:
        print(0)
        return

    e_num = []
    for i in range(0, 40):
        for k in range(0, i+1):
            e_num.append(i)
    #print(e_num)

    e_list = factorization(N)

    ans = 0
    for e in e_list:
        ans += e_num[e]
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

def main():
    N = int(input())
    #xxx = list(map(int, input().split()))

    if N == 1:
        print(0)
        return

    e_num = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4]
    e_list = factorization(N)

    ans = 0
    for e in e_list:
        ans += e_num[e]
    print(ans)

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

Fixed submission:

def main():
    pass
    N = int(input())
    A = list(map(int, input().split()))

    H = [0]*N
    for i in range(0,N):
        if i >= A[i]:
            H[i-A[i]] += 1

    ans = 0
    for k in range(0,N):
        Bk = k+A[k]
        if Bk < N:
            ans += H[Bk]

    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    pass
    N = int(input())
    A = list(map(int, input().split()))

    H = [0]*2*10**5
    for i in range(0,N):
        if i >= A[i]:
            H[i-A[i]] += 1

    ans = 0
    for k in range(0,N):
        Bk = k+A[k]
        if Bk <= 2*10**5:
            ans += H[Bk]

    print(ans)

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

Fixed submission:
def main():
    S = input()
    S = S.replace('2017','2018')
    print(S)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    num, yen_sum = map(int, input().split())
    yen_sum /=1000
    res = [-1, -1, -1]
    for bill_10000 in range(num+1):
        if bill_10000*10 + (num-bill_10000+1)*5 <= yen_sum:
            continue
        for bill_5000 in range(num-bill_10000+1):
            bill_1000 = num - bill_10000 - bill_5000
            if bill_10000*10 + bill_5000*5 + bill_1000*1 == yen_sum:
                res = [bill_10000, bill_5000, bill_1000]
                break
    print(*res)
    
if __name__ == '__main__':
    main()
Problem p02658 (python)

Fixed submission:
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Buggy submission (verdict: Runtime Error):
inputs = input().split(" ")
decimal = int(float(inputs[1])*100)
product = int(inputs[0])*(decimal)
print(product//100)
Problem p02756 (python)

Fixed submission:
from collections import deque

s=list(input())
s=deque(s)
q=int(input())

re=False
for i in range(1,q+1):
    q_i=input().split()
    if q_i[0]=="1":
        re= not re
    else:
        if q_i[1]=="1" and re==False:
            s.appendleft(q_i[2])
        elif q_i[1]=="2" and re==True:
            s.appendleft(q_i[2])
        else:
            s.append(q_i[2])

s=list(s)

if re==True:
    s=s[::-1]

s="".join(s)
print(s)

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

s=list(input())
s=deque(s)
q=int(input())

re=False
for i in range(1,q+1):
    q_i=input().split()
    if q_i[0]=="1":
        re= not re
    else:
        if q_i[1]=="1" and re==False:
            s.appendleft(q_i[2])
        elif q_i[1]=="2" and re==True:
            s.appendleft(q_i[2])
        else:
            s.append(q_i[2])

if re==True:
    s=s[::-1]

s="".join(s)
print(s)

Buggy submission (verdict: Runtime Error):
import sys

s=list(input())
q=int(input())

for i in range(1,q+1):
    q_i=stdin.readline().rstrip().split()
    if q_i[0]=="1":
        s=s[::-1]
    else:
        if q_i[1]=="1":
            s=[q_i[2]]+s
        else:
            s=s+[q_i[2]]

s="".join(s)
print(s)

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

for i in range(1,q+1):
    q_i=input().split()
    if q_i==["1"]:
        s=s[::-1]
    else:
        if q_i[1]=="1":
            s=list(q_i[2])+s
        else:
            s=s.append(q_i[2])

s="".join(s)
print(s)
Problem p03371 (python)

Fixed submission:

A,B,C,X,Y = list(map(int,input().split()))
max_pizza=max(X,Y)#AピザとBピザのうち、必要な枚数の多い方のピザの枚数
ans=10E+10  

for i in range(0,max_pizza*2+2,2):#ABピザをi枚買う(iは偶数)
    
    if (X-i/2)<=0 and (Y-i/2)>0:
        ans_kouho = B*(Y-i/2)+C*(i)
    elif (X-i/2)>0 and(Y-i/2)<=0:
        ans_kouho = A*(X-i/2)+C*(i)
    elif (X-i/2)<=0 and(Y-i/2)<=0:
         ans_kouho = C*(i)
    else:
        ans_kouho = A*(X-i/2)+B*(Y-i/2)+C*(i)

    
    if(ans_kouho<ans):
        ans = ans_kouho

print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,X,Y = list(map(int,input().split()))
max_pizza=max(X,Y)#AピザとBピザのうち、必要な枚数の多い方のピザの枚数
ans=math.inf    

for i in range(0,max_pizza*2,2):#ABピザをi枚買う(iは偶数)
    
    if (X-i/2)<=0 and (Y-i/2)>0:
        ans_kouho = B*(Y-i/2)+C*(i)
    elif (X-i/2)>0 and(Y-i/2)<=0:
        ans_kouho = A*(X-i/2)+C*(i)
    elif (X-i/2)<=0 and(Y-i/2)<=0:
         ans_kouho = C*(i)
    else:
        ans_kouho = A*(X-i/2)+B*(Y-i/2)+C*(i)

    
    if(ans_kouho<ans):
        ans = ans_kouho

print(int(ans))
Problem p03557 (python)

Fixed submission:
import bisect

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

A.sort()
B.sort()
C.sort()


#A<B<Cの組み合わせの数が答え
for i in range(N):
    #Bを1つ決めた時、AがB未満の場合の総数
    B_miman = bisect.bisect_left(A,B[i])
    #Bを1つ決めた時、CがB以上の場合の総数
    B_ijou = N - bisect.bisect_right(C, B[i])

    ans+= B_miman*B_ijou

print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

def quicksort(x):
    if x==[]: return []

    smallerSorted = quicksort([a for a in x[1:] if a <= x[0]])
    biggerSorted = quicksort([a for a in x[1:] if a > x[0]])

    return(smallerSorted+[x[0]]+biggerSorted)


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

A = quicksort(A)
B = quicksort(B)
C = quicksort(C)

length = len(A)
#A<B<Cの組み合わせの数が答え
for i in range(length):
    #Aを1つ決めた時、BがA以下の値
    A_miman = bisect.bisect_right(B,A[i])
    for j in range(A_miman,N):
        #Bを1つ決めた時、CがBより大きい値の数をansに足す
        ans += N - bisect.bisect_right(C, B[j])
        


print(ans)
Problem p02658 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
l.sort()
if l[0]==0:
  print(0)
elif l[0]==1 and l[-1]==1:
  print(1)
else:
  l = l[::-1]
  for i in l:
      s *= i
      if s>x:
          print(-1)
          f = 0
          break
  if f==1:
    print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
for i in l:
	s *= i
	if s>x:
      print(-1)
      f = 0
      break
if f==1:
  print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
for i in l:
	s *= i
	if s>x:
      	f = 0
  		print(-1)
        break
if f==1:
  print(s)
Problem p02761 (python)

Fixed submission:
N,M = map(int,input().split())
 
m = []
for i in range(M):
    m.append(list(map(int,input().split())))
for i in range(10**N):
    a = str(i)
    
    if i >= 10**(N-1):
            
        for j in range(M):
            try:
                
                if a[m[j][0]-1] == str(m[j][1]):
                    True
                
                else:
                    break
            except:
                break
                
            if j == M-1:
                print(i)
                exit()
                
if M==0:
    if N == 1:
        print(0)
        
    else:
        print(10**(N-1))
        
    exit()

elif M==1:
    if N == 1:
        m == [[1,0]]
        print(0)
        exit()


print(-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
 
m = []
for i in range(M):
    m.append(list(map(int,input().split())))
for i in range(10**N):
    a = str(i)
    
    if i >= 10**(N-1):
            
        for j in range(M):
            try:
                
                if a[m[j][0]-1] == str(m[j][1]):
                    True
                
                else:
                    break
            except:
                break
                
            if j == M-1:
                print(i)
                exit() 
if M==0:
    if N == 1:
        print(0)
    else:
        print(10**(N-1))
        
if M==1:
    if N == 1:
        if m == [[1,0]]
            print(0)
            exit()
        
else :
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
 
m = []
for i in range(M):
    m.append(list(map(int,input().split())))
for i in range(10**N):
    a = str(i)
    
    if i >= 10**(N-1):
            
        for j in range(M):
            try:
                
                if a[m[j][0]-1] == str(m[j][1]):
                    True
                
                else:
                    break
            except:
                break
                
            if j == M-1:
                print(i)
                exit()
                
if M==0:
    if N == 1:
        print(0)
    else:
        print(10**(N-1))
        
if M==1:
    if N == 1:
        if m == [[1,0]]
            print(0)
            exit()
        
else :
    print(-1)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
 
A, B, C, D = map(int, input().split())
t = C * D // gcd(C, D)
print((B - (A - 1)) - (B//C + B//D - B//t) + ((A-1)//C + (A-1)//D - (A-1)//t))

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


t = math.gcd(C, D)

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / t)
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / t)

print(B-A+1-m+n)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int, input().split())
d = math.gcd(C, D)
t = C * D / d

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / t)
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / t)

print(B-A+1-m+n)

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

t = (C * D) / math.gcd(C, D)

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / t)
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / t)

print(B-A+1-m+n)

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

t = (C * D) / math.gcd(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A - 1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

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


def lcm(x, y):
    return (x * y) / math.gcd(x, y)

t = lcm(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A - 1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

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


def lcm(x, y):
    return (x * y) // math.gcd(x, y)

t = lcm(C, D)


# C = 2
# D = 2

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A-1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)

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


def lcm(x, y):
    return (x * y) // math.gcd(x, y)

t = lcm(C, D)

m = B - (math.floor(B / C) + math.floor(B / D) - math.floor(B / (t)))
 
n = A-1 - (math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (t)))

print(m-n)
Problem p03471 (python)

Fixed submission:
N , Y= map(int,input().split())

for a in range(N + 1):
    be = N - a 
    for b in range(be + 1):
        c = N - b - a
        kingaku = 1000 * c + 5000 * b + 10000 * a

        if kingaku == Y:
            print(a,b,c)
          
            break
    else:
        continue
    break
                   

else:
    print(-1,-1,-1)

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

for i in range(N + 1):
    a = N + 1
    b = a - i
    for j in range(b):
        c = b - j
        kingaku += 1000 * c + 5000 * b + 10000 * a
        if kingaku == Y:
            print(a,b,c)
          
            break
    else:
        continue
    break
                   
                
    kingaku = 0

else:
    print(-1,-1,-1)
Problem p02696 (python)

Fixed submission:
A, B, N = map(int, input().split())
Ymax=0
if A*N < B:
  print(0)
elif N<B:
  Ymax = A*N // B
  print(Ymax)
else:
  x = B-1
  Ymax = A*x//B - A*(x//B)
  print(Ymax)

Buggy submission (verdict: Runtime Error):
A, B, N = map(int, input().split())
Y = A*x//B - A*(x//B)
print(Y)

Buggy submission (verdict: Runtime Error):
A, B, N = map(int, input().split())
print(A*x//B - A*(x//B))
Problem p02988 (python)

Fixed submission:
n = input()
nums = input().split(' ')

nums = [int(num) for num in nums]
cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] < nums[i] and nums[i] < nums[i+1]:
    cnt += 1
  if nums[i+1] < nums[i] and nums[i] < nums[i-1]:
    cnt += 1
      
print(cnt)

Buggy submission (verdict: Runtime Error):
n = input()
nums = input().split()

cnt=0

for i in range(1,len(nums)-1):
  if nums[i-1] == nums[i] and nums[i+1] < nums[i]:
    cnt += 1
  elif nums[i+1] == nums[i] and nums[i-1] < nums[i]:
    cnt += 1  
  elif nums[i-1] < nums[i] and nums[i] < nums[i+1]
    cnt += 1  
  elif nums[i+1] < nums[i] and nums[i] < nums[i-1]:
    cnt += 1
      
print(cnt)
Problem p02705 (python)

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

###
# main
if(__name__ == '__main__'):
    # input
    r = int(input())

    pi = 3.141592
    ans = pi * r * 2.0
    print(ans)

# else:
    # do nothing

Buggy submission (verdict: Runtime Error):
    # -*- coding: utf-8 -*-
    import math
     
    ###
    # main
    if(__name__ == '__main__'):
        # input
        r = int(input())
     
        pi = 3.141592
        ans = pi * r * 2.0
        print(ans)
     
    # else:
        # do nothing