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

Fixed submission:
from collections import deque
s = input()
n = int(input())
query = []
for i in range(n):
    query.append(input().split())
cond = 1
word = deque(s)
for i in range(n):
    if query[i] == ['1']:
        cond *= -1
    else:
        if cond == 1:
            if query[i][1] == '1':
                word.appendleft(query[i][2])
            else:
                word.append(query[i][2])
        else:
            if query[i][1] == '2':
                word.appendleft(query[i][2])
            else:
                word.append(query[i][2])

result = ''.join(word)
if cond == -1:
    result = result[::-1]
print(result)

Buggy submission (verdict: Runtime Error):
s = input()
n = int(input())
query = []
for i in range(n):
    query.append(input().split())
cond = 1
s = deque(s)
for i in range(n):
    if query[i] == ['1']:
        cond *= -1
    else:
        if cond == 1:
            if query[i][1] == '1':
                s.appendleft(query[i][2])
            else:
                s.append(query[i][2])
        else:
            if query[i][1] == '2':
                s.appendleft(query[i][2])
            else:
                s.append(query[i][2])

result = ''.join(s)
if cond == -1:
    result = result[::-1]
print(result)

Buggy submission (verdict: Runtime Error):
s = input()
n = int(input())
query = []
for i in range(n):
    query.append(input().split())
cond = 1
deque(s)
for i in range(n):
    if query[i] == ['1']:
        cond *= -1
    else:
        if cond == 1:
            if query[i][1] == '1':
                s.appendleft(query[i][2])
            else:
                s.append(query[i][2])
        else:
            if query[i][1] == '2':
                s.appendleft(query[i][2])
            else:
                s.append(query[i][2])

result = ''.join(s)
if cond == -1:
    result = result[::-1]
print(result)
Problem p03160 (python)

Fixed submission:
n = int(input())
steps = list(map(int,input().split()))
dp = []

def frog(list,n,max):
    global dp
    if n == 0:
        dp.append(0)
    else:
        temp1 = abs(list[n] - list[n-1]) + dp[n-1]

        if n == 1:
            dp.append(temp1)
        else:
            temp2 = abs(list[n] - list[n-2]) + dp[n-2]
            if temp1 >= temp2:
                dp.append(temp2)
            else:
                dp.append(temp1)
for i in range(n):
    frog(steps,i,n)
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n , k = map(int,input().split())
steps = list(map(int,input().split()))
dp = []

def frog(list,n,max):
    global dp

    if n == 0:
        dp.append(0)
    else:
        global k
        temp = 10000
        for i in range(k):
            if n == i:
                break
            jump = abs(list[n]-list[n-(i+1)])+dp[n-(i+1)]
            if jump <= temp:
                temp = jump
        dp.append(temp)
for i in range(n):
    frog(steps,i,n)
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
steps = list(map(int,input().split()))
dp = []

def frog(list,n,max):
    global dp
    if n == 0:
        dp.append(0)
        frog(list,1,max)
    else:
        temp1 = abs(list[n] - list[n-1]) + dp[n-1]

        if n == 1:
            dp.append(temp1)
            if n != max - 1:
                frog(list,2,max)
        else:
            temp2 = abs(list[n] - list[n-2]) + dp[n-2]
            if temp1 >= temp2:
                dp.append(temp2)
            else:
                dp.append(temp1)
            if n != max - 1:
                frog(list,n+1,max)

frog(steps,0,n)
print(dp[n-1])
Problem p02660 (python)

Fixed submission:
from math import sqrt
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([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

n = int(input())
fac = factorization(n)
s = 0
for i in fac:
    if i[0] != 1:
        s += (-1+sqrt(1+4*i[1]*2))//2
print(int(s))

Buggy submission (verdict: Runtime Error):
from numpy import sqrt
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([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

n = int(input())
fac = factorization(n)
s = 0
for i in fac:
    s += (-1+sqrt(1+4*i[1]*2))//2
print(int(s))

Buggy submission (verdict: Runtime Error):
rom numpy import sqrt
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([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

n = int(input())
fac = factorization(n)
s = 0
for i in fac:
    s += (-1+sqrt(1+4*i[1]*2))//2
print(int(s))

Buggy submission (verdict: Runtime Error):
from numpy import sqrt
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([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

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

    return arr

n = int(input())
fac = factorization(n)
s = 0
for i in fac:
    s += (-1+sqrt(1+4*i[1]*2))//2
print(int(s))
Problem p02756 (python)

Fixed submission:
from collections import deque

s = deque(input())
n = int(input())
q_list = [input().split() for i in range(n)]
count = 1
for i in q_list:
    if i[0] == '1':
        count *= -1
    else:
        if i[1] == '1':
            if count == 1:
                s.appendleft(i[2])
            else:
                s.append(i[2])
        else:
            if count == 1:
                s.append(i[2])
            else:
                s.appendleft(i[2])
if count != 1:
    s.reverse()
print(*s, sep='')

Buggy submission (verdict: Runtime Error):
s = input()
n = int(input())
for i in range(n):
    q = input().split()
    if q[0] == '1':
        if len(s) != 1:
            s_new = ''
            for i in range(len(s)):
                s_new += s[len(s)-1-i]
            s = s_new
        else:
            pass
    else:
        if q[1] == '1':
            s = q[2] + s
        else:
            s += q[2]
    print(s)
print(s)
Problem p02909 (python)

Fixed submission:
s = list(input())
if s[0] == "R":
  print("Sunny")
elif s[0] == "S":
  print("Cloudy")
else:
  print("Rainy")

Buggy submission (verdict: Runtime Error):
s = list(input())
if s[0] = "R":
  print("Sunny")
elif s[0] = "S":
  print("Cloudy")
else:
  print("Rainy")
Problem p02601 (python)

Fixed submission:
a,b,c=map(int,input().split())
K=int(input())
flag=0
if a>=b:
    while a>=b:
        if K>0:
            b=b*2
            K-=1
        else:
            flag=1
            break
if b>=c and flag==0:
    while b>=c:
        if K>0:
            c=c*2
            K-=1
        else:
            flag=1
            break
            
if flag==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
K=int(input())
if a<b:
    if b<c:
        flag=0
    else:
        if b<c*(2**K):
            flag=0
        else:
            flag=1
else:
    while a>=b:
        if K>0:
            b=b*2
            K-=1
        else:
            flag=1
            break
    if K>0:
        if b<c:
            flag=0
        else:
            if b<c*(2**K):
                flag=0
            else:
                flag=1
if flag==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
K=int(input())
if a<b:
    if b<c:
        flag=0
    else:
        if b<c*(2**K):
            flag=0
        else:
            flag=1
else:
    while a>=b:
        if K>0:
            b=b*2
            K-=1
        else:
            flag=1
            break
    if K>0:
        if b<c:
            flag=1
        else:
            if b<c*(2**K):
                flag=0
            else:
                flag=1
if flag==0:
    print("Yes")
else:
    print("No")
Problem p02641 (python)

Fixed submission:
x,N=map(int,input().split())
p=list(map(int,input().split()))
p_set=set(p)
flag=0
if x not in p_set:
    ans=x
else:
    count=0
    while flag==0:
        count+=1
        if x+count not in p_set:
            ans=x+count
            flag=1
        if x-count not in p_set:
            ans=x-count
            flag=1
print(ans)

Buggy submission (verdict: Runtime Error):
x,N=map(int,input().split())
p=list(map(int,input().split()))
ans=101
if x in p:
    for i in range(102):
        if i in p:
            continue
        ans=min(ans,abs(p[i]-x))
    if x+ans in p:
        ans*=-1
else:
    ans=0
print(x+ans)

Buggy submission (verdict: Runtime Error):
x,N=map(int,input().split())
p=list(map(int,input().split()))
p_set=set(p)
flag=0
if x not in p_set:
    ans=x
else:
    count=0
    while flag==0:
        count+=1
        if x+count not in p_set:
            ans=x+count
            flag=1
        if x-count not in p_set:
            ans=min(ans,x-count)
            flag=1
print(ans)

Buggy submission (verdict: Runtime Error):
x,N=map(int,input().split())
p=list(map(int,input().split()))
p_set=set(p)
flag=0
if x not in p_set:
    ans=x
else:
    count=1
    while flag==0:
        if x+count not in p_set:
            ans=x+count
            flag=1
        if x-count not in p_set:
            ans=min(ans,x-count)
            flag=1
        count+=1
print(ans)
Problem p02678 (python)

Fixed submission:
N,M=map(int,input().split())
box=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[None]*(N)
ans[0]=0
que=[0]
while len(que)>0:
    index=que.pop(0)
    for x in box[index]:
        if ans[x]==None:
            ans[x]=index+1
            que.append(x)
print("Yes")
for i in range(1,N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
box=[[] for i in range(M)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[0]*(N)
que=[]
ans[0]=1
for i in range(N):
    if ans[i]!=0:
        que.extend(box[i])
    while len(que)>0:
        c=que.pop()
        if ans[c]==0:
            ans[c]=i+1
for i in range(1,N):
    if ans[i]==0:
        flag=0
        break
    else:
        flag=1
if flag==0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(ans[i])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
box=[[] for i in range(M)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[0]*(N)
que=[]
ans[0]=1
for i in range(N):
    if ans[i]!=0:
        que+=box[i]
    while len(que)>0:
        c=que.pop()
        if ans[c]==0:
            ans[c]=i+1
for i in range(1,N):
    if ans[i]==0:
        flag=0
        break
    else:
        flag=1
if flag==0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(ans[i])
Problem p02823 (python)

Fixed submission:
N,A,B=map(int,input().split())
if (B-A)%2==0:
    ans =(B-A)//2
else:
    if A-1 > N-B:
        ans = N-B+1
        A+=ans
        ans+=(N-A)//2
    else:
        ans =A
        B-=ans
        ans+=(B-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main (){
  int n,a,b,ans;
  cin >> n >> a >> b;
  if ((b-a)% == 0){
    ans=(b-a)/2;
  }
  else{
    if(n-b > a-1){
      ans=a-1+1;
      b-=ans;
      a=1;
      ans+=(b-a)/2;
    }
    else{
      ans=n-b+1;
      a+=ans;
      b=n;
      ans+=(b-a)/2;
    }
  }
  cout << ans << endl;
}
Problem p02909 (python)

Fixed submission:
# -*- coding: utf-8 -*-
S=str(input())
if(S=="Sunny"):
    print('Cloudy')
elif(S=="Cloudy"):
    print('Rainy')
else: print('Sunny')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S=str(input())
if(S="Sunny"):
    print('Cloudy')
elif(S="Cloudy"):
    print('Rainy')
else: print('Sunny')
Problem p02911 (python)

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

N,K,Q=map(int,input().split())
a=[int(input()) for _ in range(Q)]
b=[0]*N
for i in a:
    b[i-1]+=1
for l in range(0,N,1):
    if(K+b[l]-Q>0):print("Yes")
    else:print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#入力
N,K,Q=map(int,input().split())
a=[int(input()) for i in range(Q)]

for i in range(0,N,1):
    j=re.findall(i,a)
    if(K+len(j)-Q>0):print("Yes")
    else:print("No")
Problem p03059 (python)

Fixed submission:
A,B,T=map(int,input().split())
print(int(B*((T+0.5)//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(N):
  if V[i]-C[i] >0:
    ans+=V[i]-C[i]
print(ans)
Problem p03060 (python)

Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(N):
  if V[i]-C[i] >0:
    ans+=V[i]-C[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
V=[int,input().split()]
C=[int,input().split()]
ans=0
for i in range(N):
  if V[i]-C[i] >0:
    ans+=V[i]-C[i]
print(ans)
Problem p02724 (python)

Fixed submission:
x = int(input())
u = 0
def a(x,u):
    if x>=500:
        u+=1000 * (x // 500)
        x = x % 500
        a(x,u)
    elif x>=5:
        u+=5 * (x // 5)
        x = x % 5
        a(x,u)
    else:
        print(u)
a(x,u)

Buggy submission (verdict: Runtime Error):
x = int(input())
u = 0

def b(x,u):
    if x>=5:
        x-=5
        u+=5
        b(x,u)
    else:
        print(u)

def a(x,u):
    if x>=500:
        x-=500
        u+=1000
        a(x,u)
    else:
        b(x,u)

a(x,u)

Buggy submission (verdict: Runtime Error):
x = int(input())
u = 0

def b(x,u):
    if x>5:
        x-=5
        u+=5
        b(x,u)
    else:
        print(u)

def a(x,u):
    if x>500:
        x-=500
        u+=1000
        a(x,u)
    else:
        b(x,u)

a(x,u)
Problem p02765 (python)

Fixed submission:
i = list(map(int, input().split()))
if i[0]>9:
    print(i[1])
else:
    print(i[1]+1000-100*i[0])

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
N=i[0]
K=i[1]
def abc(N,K,x):
    if N-(K**x)>=0:
      abc(N,K,x+1)
    else:
        print(x)
abc(N,K,1)
Problem p02767 (python)

Fixed submission:
N=int(input())
X=list(map(int, input().split()))
s=[]
for i in range(min(X),max(X)+1):
    a=0
    for i2 in range(N):
        a+=(i-X[i2])**2
    s.append(a)
print(min(s))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int, input().split()))
s=[]
for XP in range(min(X),max(X)):
    a=0
    for i in range(N):
        a+=(XP-X[i])**2
    s.append(a)
print(min(s))
Problem p02582 (python)

Fixed submission:
s = input().split('S')

ans = 0

for i in s:
  if len(i) > ans:
    ans = len(i)
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = int(input().split())
L2 = set(L) # 重複を削除

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(i+2, len(L2)):
      l = [i, j, k]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(i) * L.count(j) * L.count(k)

print(ans)
Problem p02583 (python)

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

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = int(input().split())

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = int(input().split(' '))

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = int(input().split(' '))
L2 = set(L) # 重複を削除

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = int(input().split())
L2 = set(L) # 重複を削除

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(i+2, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = int(input().split())
L2 = set(L) # 重複を削除

ans = 0

for i in len(L2):
  for j in range(i+1, len(L2)):
    for k in range(i+2, len(L2)):
      l = [i, j, k]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(i) * L.count(j) * L.count(k)

print(ans)
Problem p02613 (python)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]

AC = 0
WA = 0
TLE = 0
RE = 0

for i in S:
    if i == 'AC':
        AC += 1
    elif i == 'WA':
        WA += 1
    elif i == 'TLE':
        TLE += 1
    else:
        RE += 1
        
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]

AC = 0
WA = 0
TLE = 0
RE = 0

for i in S:
    if i == 'AC':
        AC += 1
    elif i == 'WA':
        WA += 1
    elif i == 'TLE':
        TLE += 1
    else:
        RE += 1
        
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]

AC = 0
WA = 0
TLE = 0
RE = 0

for i in S:
    if i == 'AC':
        AC += 1
    elif i == 'WA':
        WA += 1
    elif i == 'TLE':
        TLE += 1
    else:
        RE += 1
        
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [int(input()) for _ in range(N)]

AC = 0
WA = 0
TLE = 0
RE = 0

for i in S:
    if i == 'AC':
        AC += 1
    elif i == 'WA':
        WA += 1
    elif i == 'TLE':
        TLE += 1
    else:
        RE += 1
        
print('AC x', AC, '\n')
print('WA x', WA, '\n')
print('TLE x', TLE, '\n')
print('RE x', RE)
Problem p02641 (python)

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

for d in range(x + 1):
    for s in [-1, +1]:
        a = x + s * d
        if P.count(a) == 0:
            print(a)
            exit(0)

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

for d in range(x + 1):
    for s in [-1, +1]:
        a = x + s * d
        if p.count(a) == 0:
            print(a)
            exit(0)

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

P.sort()
P.append(101)

excluded = P.pop(0)

ans, absolute = None, 101

for i in range(102):
    if i == excluded:
        excluded = P.pop(0)
    else:
        if abs(i - x) < absolute:
            ans = i
            absolute = abs(i - x)
    
print(ans)

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

P.sort()
P.append(101)

excluded = P.pop(0)

ans, absolute = None, 101

for i in range(0, 102):
    if i == excluded:
        excluded = P.pop(0)
    else:
        if abs(i - x) < absolute:
            ans = i
            absolute = abs(i - x)
    
print(ans)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    P = list(map(int, input().split()))

P.sort()
P.append(101)

excluded = P.pop(0)

ans, absolute = None, 101

for i in range(1, 101):
    if i == excluded:
        excluded = P.pop(0)
    else:
        if abs(i - x) < absolute:
            ans = i
            absolute = abs(i - x)
    
print(ans)

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

P.sort()
P.append(101)

excluded = P.pop(0)

ans, absolute = None, 101

for i in range(1, 101):
    if i == excluded:
        excluded = P.pop(0)
    else:
        if abs(i - x) < absolute:
            ans = i
            absolute = abs(i - x)
    
print(ans)
Problem p02993 (python)

Fixed submission:
s = input()

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)

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

ans = "Good"

s_temp = 99

for num in s:
    if int(num) == s_temp:
        ans = "Bad"
        break
    else:
        s_temp = int(num)

print(ans)
Problem p02995 (python)

Fixed submission:
import fractions

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

a -= 1

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

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)

Buggy submission (verdict: Runtime Error):
import fraction

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

a -= 1

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

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)

Buggy submission (verdict: Runtime Error):
import math

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

a -= 1

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

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)

Buggy submission (verdict: Runtime Error):
import math

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

a -= 1

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

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)

Buggy submission (verdict: Runtime Error):
import math

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

a -= 1

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

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)
Problem p03029 (python)

Fixed submission:
import math

a, p = map(int, input().split())

apple = 3 * a + p

ans = (math.floor(apple / 2))

print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, p = map(int, input().sprit())

apple = 3 * a + p

ans = (math.floor(apple / 2))

print(ans)
Problem p03061 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
end = sorted(a)[1]

for i in range(end+1, 0, -1):
  x = 0
  for j in a:
    if j % i != 0:
      x += 1
    if x >= 2:
      break
  if x <= 1:
    print(i)
    break

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

import fraction
from functools import reduce

ans = 0
for i in range(n):
  x = a[:i] + a[i+1:]
  ans = max(ans, reduce(fraction.gcd, x))
  
print(ans)