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

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
def ans1(x):
    return s.count(x)-t.count(x)
ans2=0
ans_1=0
for S in s:
    if ans1(S)>0 and ans1(S)>ans2:
            ans2=ans1(S)
if ans2>=0:
    print(ans2)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
l=list(set(n))

print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
l=list(set(n))
#s内の重複消去　リストに変更
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):

s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
l=list(set(n))
#s内の重複消去　リストに変更
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
s=[input() for _ in range(input())]
t=[input() for _ in range(input())]
l=list(set(n))
#s内の重複消去　リストに変更
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
ans=""
ans_1=0
for S in s:
    if s.count(S)-t.count(S)>0:
        ans=S
        if s.count(S)-t.count(S)>ans:
            ans_1=s.count(S)-t.count(S)
if ans_1>=0:
    print(ans)
else:
    print("0")

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

ans=input()
print(s.count(ans)-t.count(ans))

Buggy submission (verdict: Runtime Error):
N,M=int(input())
s=[input() for _ in range(N)]
t=[input() for _ in range(M)]
ans=input()
print(s.count(ans)-t.count(ans))
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(1))
b=int(input(2))

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")

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

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

Buggy submission (verdict: Runtime Error):
a=int(input("a=:"))
b=int(input("b=:"))
x=a*b
if x%2==0:
      print("Even")
else :
      print("Odd")

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

Buggy submission (verdict: Runtime Error):
a=int(input("a=:")
b=int(input("b=:")
if a*b%2==0:
      print("Even")
else :
      print("Odd")
Problem p03478 (python)

Fixed submission:
N,a,b=map(int,input().split())
Num=0
Num_sum=0

for number in range(1,N+1):
    for num in str(number):
        num=int(num)
        Num+=num

    if Num>=a and Num<=b:
        Num_sum+=number
    Num=0
print(Num_sum)

Buggy submission (verdict: Runtime Error):
N=int(input("N:"))
a,b=map(int,input().split())
Num=0
Num_sum=0

for number in range(1,N+1):
    for num in str(number):
        num=int(num)
        Num+=num

    if Num>=a and Num<=b:
        Num_sum+=number
    Num=0
print(Num_sum)

Buggy submission (verdict: Runtime Error):
N=int(input("N:"))
a,b=map(int,input().split())
Num=0
num_new=0
Num_sum=0

for number in range(1,N+1):
    for num in str(number):
        num=int(num)
        Num+=num

    if Num>=a and Num<=b:
        Num_sum+=number
    Num=0
print(Num_sum)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input().count(1))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if (a+b+c)=3:
  print("3")
elif (a+b+c)=2:
  print("2")
elif (a+b+c)=1:
  print("1")
else :
  print("0")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
index=0
if (a+b+c)=3:
  print("3")
elif (a+b+c)=2:
  print("2")
elif (a+b+c)=1:
  print("1")
else :
  print("0")
Problem p03607 (python)

Fixed submission:
import collections
n=int(input())
count=0
a=[int(input()) for _ in range(n)]
a=collections.Counter(a)

for key,value in a.items():
    if value%2==1:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N=int(input())
count=0
for _ in range(n):
    a=[int(input())]
for x in a:
    if a.count(x)%2==1:
        count+=1
print(count)
Problem p04044 (python)

Fixed submission:
N,L=map(int,input().split())
S=[input() for n in range(N)]
S=sorted(S)
"""for num in range(L):
    ans1=S[num]
    for num2 in range(L):

        ans2=S[num2]
        for i in range(L):
            if ans1[i]>ans2[i]:
                break
            elif ans1[i]==ans2[i]:
                continue
            else :
                S[num],S[num2]=S[num2],S[num]
                break
"""
print("".join(S))

Buggy submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for n in range(N)]
for num in range(L):
    ans1=S[num]
    for num2 in range(L):

        ans2=S[num2]
        for i in range(L):
            if ans1[i]>ans2[i]:
                break
            elif ans1[i]==ans2[i]:
                continue
            else :
                S[num],S[num2]=S[num2],S[num]
                break
print("".join(S))

Buggy submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for n in range(N)]
for num in range(L):
    ans1=S[num]
    for num2 in range(L):

        ans2=S[num2]
        for i in range(L):
            if ans1[i]>ans2[i]:
                break
            elif ans1[i]==ans2[i]:
                continue
            else :
                S[num],S[num2]=S[num2],S[num]
print("".join(S))

Buggy submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for n in range(N)]
for num in range(L):
    ans1=S[num]
    for num2 in range(L):

        ans2=S[num2]
        for i in range(L):
            if ans1[i]>ans2[i]:
                True
            else :
                S[num],S[num2]=S[num2],S[num]
print("".join(S))
Problem p02789 (python)

Fixed submission:
N, M = map(int, input().split())
if N == M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input())
if N == M:
    print('Yes')
else:
    print('No')
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()

count = 0 

for i in range (N - 2):
  if S[i:i + 3] == 'ABC':
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
  
numberABC = 0

for i in range(N):
  if S[i] == 'A':
    if S[i + 1] == 'B':
      if S[i + 2] == 'C':
          numberABC += 1
      
print(numberABC)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
  
numberABC = 0

for i in range(0, N):
  if S[i] == 'A':
    if S[i + 1] == 'B':
      if S[i + 2] == 'C':
          numberABC += 1
print(numberABC)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())

def main():
  numberABC = 0

  for i in range(0, N):
    if S[i] == 'A':
      if S[i + 1] == 'B':
        if S[i + 2] == 'C':
          numberABC += 1
  print(numberABC)
  return numberABC

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

Fixed submission:
def resolve():
    s = input()
    if not kaibun(s) :
        print('No')
        return
    n = len(s)
    n1 = (n - 1) // 2
    if not kaibun(s[:n1]) :
        print('No')
        return
    n2 = (n + 3) // 2 - 1
    if not kaibun(s[n2:]) :
        print('No')
        return
    print('Yes')

def kaibun(str):
    return True if str == str[::-1] else False

resolve()

Buggy submission (verdict: Runtime Error):
def kaibun(str):
    return True if str == str[::-1] else False

s = input()
if not kaibun(s) :
    print('No')
    return
n = len(s)
n1 = (n - 1) // 2
if not kaibun(s[:n1]) :
    print('No')
    return
n2 = (n + 3) // 2 - 1
if not kaibun(s[n2:]) :
    print('No')
    return
print('Yes')
Problem p02741 (python)

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input()) + -1])

Buggy submission (verdict: Runtime Error):
a = [int(x) for x in input().split(" ")]
if a[1] <= 0:
  print(0)
  exit()
kisu = a[0] // 2 if a[0] % 2 == 0 else a[0] // 2 + 1
gusu = a[0] // 2
yokokisu = a[1] // 2 if a[1] % 2 == 0 else a[1] // 2 + 1
yokogusu = a[1] // 2
ans = kisu * yokokisu + gusu * yokogusu
print(ans)
Problem p02801 (python)

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

Buggy submission (verdict: Runtime Error):
ch = input()
out = char(ord(ch)+1)
print(out)

Buggy submission (verdict: Runtime Error):
ch = input()
out = char(ord(ch)+1)
print(out)
Problem p03494 (python)

Fixed submission:
# https://atcoder.jp/contests/abc081/tasks/abc081_b

def div_list(list_num):
    _div_list = []
    can_iter = True
    for k in range(len(list_num)):
        if list_num[k] % 2 != 0:
                can_iter = False
        _div_list.append(list_num[k] / 2)
    return can_iter, _div_list


n_input = int(input())
list_number = input().split()
list_number = list(map(int, list_number))

n_iter = 0
can_iter = True

while can_iter == True:
    can_iter, list_number = div_list(list_number)
    if can_iter == True:
        n_iter += 1

print(n_iter)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc081/tasks/abc081_b
import math

def div_list(list_num):
    _div_list = []
    can_iter = True
    for k in range(len(list_num)):
        if math.isclose(list_num[k]%2, 0) == False:
            can_iter = False
        _div_list.append(list_num[k] / 2)
    return can_iter, _div_list


n_input = int(input())
list_number = input().split()
list_number = list(map(float, list_number))

n_iter = 0
can_iter = True

while can_iter == True:
    can_iter, list_number = div_list(list_number)
    if can_iter == True:
        n_iter += 1

print(n_iter)
Problem p02731 (python)

Fixed submission:
L = int(input())
ans = (L/3)**3
print(ans)

Buggy submission (verdict: Runtime Error):
L = map(int, input().split())
ans = (L/3)**3
print(ans)

Buggy submission (verdict: Runtime Error):
L = input()
ans = (L//3)**3
print(ans)
Problem p02732 (python)

Fixed submission:
import math

N=int(input())
A = list(map(int,input().split()))
cnt=[0]*(N+1)
for i in range(0,N):
	cnt[A[i]-1]+=1
ans=0
for i in range(0,N+1):
	if cnt[i]==0:
		ans+=0
	else:
		ans+=cnt[i]*(cnt[i]-1)//2

for i in range(0,N):
	point=A[i]
	deff=(cnt[point-1]*(cnt[point-1]-1))//2-((cnt[point-1]-1)*(cnt[point-1]-2))//2
	print(ans-deff)

Buggy submission (verdict: Runtime Error):
import math

N=int(input())
A = list(map(int,input().split()))
cnt=[]
B=[]
for i in range(1,N):
	cnt.append(A.count(i))
	
for i in range(1,N):
	B.append((cnt[i-1]*(cnt[i-1]-1))//2)
	if cnt[i-1]==0:
		B[i-1]=0
		
ans=0
for i in range(1,N):
	ans+=B[i-1]

for i in range(0,N):
	point=A[i]
	deff=(cnt[point-1]*(cnt[point-1]-1))//2-((cnt[point-1]-1)*(cnt[point-1]-2))//2
	print(ans-deff)
Problem p02784 (python)

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

if sum(A)>=H:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math

A = []
sum = 0
H,N = (int(x) for x in input().split())

for i in range(N):
    A.append(int(input()))
    sum += A[i]

if(sum >= H):
    print('Yes')
else:
    print('No')
Problem p02811 (python)

Fixed submission:
K,X = map(int, input().split())

if K*500>=X:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0

for i in range(N-2):
    if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0

for i in range(N-2):
    if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
count = 0

for i in range(N-2):
    if S[i]==("A") and S[i+1]==("B") and S[i+2]==("C"):
        count += 1

print(count)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
count = 0

while True:
    if 'ABC' in s:
        s = s.replace('ABC', '', 1)
        count += 1
    else:
        break

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
count = 0

for i in range(N):
    if S[i]==("A"):
        if S[i+1]==("B"):
            if S[i+2]==("C"):
                count += 1


print(count)
Problem p02813 (python)

Fixed submission:
import itertools

def AllPatern(n, all):
    numbers = []
    all = []
    for i in range(n):
        numbers.append(i+1)
    for i in itertools.permutations(numbers):
        all.append(list(i))

    return all


def WhichNumber(p, q, all):
    val_p = 0
    val_q = 0
    for i in range(len(all)):
        val_p += 1
        if p == all[i]:
            break
    for i in range(len(all)):
        val_q += 1
        if q == all[i]:
            break

    return val_p, val_q

def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    q = [int(i) for i in input().split()]
    all = []

    all = AllPatern(n, all)
    val_p, val_q = WhichNumber(p, q, all)
    print(abs(val_p - val_q))



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools

def AllPatern(n, all):
    numbers = []
    all = []
    for i in range(n):
        numbers.append(i+1)
    for i in itertools.permutations(numbers):
        all.append(list(i))

    return all


def WhichNumber(p, q, all):
    val_p = 0
    val_q = 0
    for i in range(len(all)):
        val_p += 1
        if p == all[i]:
            break
    for i in range(len(all)):
        val_q += 1
        if q == all[i]:
            break

    return val_p, val_q

def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    q = [int(i) for i in input().split()]
    all_numbers=[]

    all_numbers = AllPatern(n, all_numbers)
    val_p, val_q = WhichNumber(p, q, all)
    print(abs(val_p - val_q))



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

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

if A>=K:
    print(A-K, B)
elif B>=K-A:
    print(0, B-K+A)
else:
    print(0,0)

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

if A>=K:
    print(A-K, B)
elif B>=K-A:
    print(0, b-K+A)
else:
    print(0,0)
Problem p02765 (python)

Fixed submission:
n, r = input().split(" ")
n=int(n)
r=int(r)
if n<10:
    print((100*(10-n))+r)
else:
    print(r)

Buggy submission (verdict: Runtime Error):
import math
n, k = input().split(" ")
n= int(n)
k= int(k)
dig = (math.floor(math.log(n) / math.log(k)) + 1)
print(dig)
Problem p02811 (python)

Fixed submission:
[k, x] = [int(x) for x in input().split()]
print("Yes") if 500*k >= x else print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
s = s[:n]
count = s.count("ABC")
print(count)
Problem p02778 (python)

Fixed submission:
s=input()
l=len(s)
k="x"*l
print(k)

Buggy submission (verdict: Runtime Error):
d=input()
k=len(d)
printf("x"*k)
Problem p02789 (python)

Fixed submission:
r = input()
k=r.split()
if k[0] == k[1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#include <stdio.h>

int main()
{
  int n, m;
  
  scanf("%d", &n);
  scanf("%d", &m);
  
  if (n == m)
  	printf("Yes\n");
  else
    printf("No\n");
}

Buggy submission (verdict: Runtime Error):
r=input()
k=r.split()

t1=t2=0
for i in range(k[1]):
    t1 += k[0]
for i in range(k[0]):
    t2 += k[1]
    
jj=[t1,t2]
jj.sort(reverse=True)
print(jj[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
     
m=int(input())
     
     
if n==m:
    print('Yes')
else:
    print('No')

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

m=int(input())


if n==m:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())

if n == m:
    print('Yes')
elif n > m:
    print('No')

Buggy submission (verdict: Runtime Error):
n = input()
m=input()
if int(n) == int(m):
    print('Yes')
else:
    print('No')
Problem p03227 (python)

Fixed submission:
S = input()
if len(S) == 3:
    S = S[::-1]
print(S)

Buggy submission (verdict: Runtime Error):
# -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())

i = 0
while True:
    i += 1
    if A%2:
         A -= 1
    A /= 2
    B += A
    if i == K:
        break
    i += 1
    if B%2:
        B -= 1
    B /= 2
    A += B
    if i == K:
        break
print(A,B)

Buggy submission (verdict: Runtime Error):
# -*- coding-UTF-8 -*-
A, B, K = map(int, input().split())

i = 0
while True:
    i += 1
    if A%2:
         A -= 1
    A /= 2
    B += A
    if i == K:
        break
    i += 1
    if B%2:
        B -= 1
    B /= 2
    A += B
    if i == K:
        break
print(A,B)
Problem p02921 (python)

Fixed submission:
# coding:utf-8
def main():
    a = list(input())
    b = list(input())
    count = 0

    for i in range(3):
        if a[i] == b[i]:
            count = count + 1

    print(count)


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
# coding:utf-8
def main():
    n = int(input())
    h = list(map(int, input().split()))
    start_num = 0
    best_score = 1000
    best_sc = 0

    min_h = h.index(min(h))

    for i in range(n-1):
        score =  h[i] - h[i+1]
        if best_score >= score and score >= 0:
            if best_score == score:
                if h[i] > h[start_num]:
                    start_num = i
                    sc = 0
                    while  i != n - 1 and h[i] >= h[i+1] :
                        sc = sc + 1
                        i = i + 1
                    if best_sc <= sc:
                        best_sc = sc
                        best_score = score
            else:
                start_num = i
                sc = 0
                while  i != n - 1 and h[i] >= h[i+1] :
                    sc = sc + 1
                    i = i + 1
                    if best_sc <= sc:
                        best_sc = sc
                        best_score = score

    print(best_sc)





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

Fixed submission:
import sys

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def gcd_list(li):
	if len(li) > 2:
		x = gcd(li[-1], li[-2])
		li = li[:-2] + [x]
		return gcd_list(li)
	else:
		return gcd(li[0], li[1])


def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    if len(lists)==1:
        print(lists[0])
        sys.exit()

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


if __name__ == '__main__' :
    main()

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def gcd_list(li):
	if len(li) > 2:
		x = gcd(li[-1], li[-2])
		li = li[:-2] + [x]
		return gcd_list(li)
	else:
		return gcd(li[0], li[1])
def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


if __name__ == '__main__' :
    main()

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

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

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

def main():
    a = int(input())
    lists = list(map(int, input().split()))
    score = []

    bai = gcd_list(lists)

    for i in lists :
        num = bai / i
        score.append(num)

    bunbo = sum(score)

    ans = bai /bunbo
    print(ans)


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

Fixed submission:
from collections import Counter

n = int(input())
count = 0
lists =[]
count_dict = Counter()

for i in range(n):
    input_data = ''.join(sorted(input()))
    if input_data in count_dict:
        count += count_dict[input_data]
        count_dict[input_data] += 1
    else:
        count_dict[input_data] = 1

print(count)

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    count = 0
    lists =[]
    count_dict = {}

    for i in range(n):
        input_data = ''.join(sorted(input()))
        if input_data in lists:
            if input_data not in count_dict.keys():
                count_dict[input_data] = 1
        
            count_dict[input_data] += 1
        else:
            lists.append(input_data)

    count = sum(
        v for v in d.values()
    )

    print(count)


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

Fixed submission:
#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())

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

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())

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

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

gcd_num = lcm(c,d)

def calc_num(n, C, D):
    """
    0~Nまでで、C or Dで割り切れない数の個数
    """
    div_C = n//C
    div_D = n//D
    div_CD = n//(lcm(C, D))
    return n-div_C-div_D+div_CD


def solve():
    A, B, C, D = map(int, input().split())
    return calc_num(B, C, D)-calc_num(A-1, C, D)

print(solve())
Problem p03030 (python)

Fixed submission:
N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], -int(x[0][1])))
for i in range(N):
	print(X[i][1])

Buggy submission (verdict: Runtime Error):

#input
N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], int(-x[0][1])) )

for i in range(N):
    print(X[i][0])
Problem p03035 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
money = 0

if a >= 13:
    money = b
elif 6 <= a and a <= 12:
    money = b // 2
elif a <= 5:
    money = 0

print(money)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
l = [0] 
r = [0]
all_gate_clear = 0


#numcard
#gatenum
N, M = map(int, input().split())
card_count = range(N+1)

#idカードの生成
for i in range(1,M+1):
    l_temp,r_temp = map(int, input().split())
    l.append(l_temp)
    r.append(r_temp)
    
for gate_num in range(1,M+1):
    #1ゲートの処理
    for card in range(1,N+1):
        num = 0
        while r[gate_num] > l[gate_num] + num:
            if l[gate_num] + num == card:
                if card_count[card] == gate_num -1:
                    card_count[card] += 1
                    break
            num += 1

for card in range(1,N+1):
    if card_count[card] == M:
        all_gate_clear += 1

print(all_gate_clear)