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

Fixed submission:
n = int(input());
s = input();

ans = 0;

for i in range(n):
  three = s[i:i+3];
  ans += int(three == "ABC");

print(ans);

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

ans = 0;

for i in range(len(s)):
  3_str = s[i:i+2];
  ans += int(3_str == "ABC");

print(ans);
Problem p02885 (python)

Fixed submission:
a, b = map(int, input().split())
n = max([a - 2 * b, 0])
print(n)

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

print(max[a - 2 * b, 0])
Problem p02886 (python)

Fixed submission:
import itertools

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

list_ = list(itertools.combinations(range(n),2))
count = 0;

for i in range(len(list_)):
  count += D[list_[i][0]] * D[list_[i][1]];
  
print(count)

Buggy submission (verdict: Runtime Error):
import itertools

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

list_ = itertools.combinations(range(n),2))
count = 0;

for i in range(len(list_)):
  count += D[list_[i][0]] + D[list_[i][1]];
  
print(count)
Problem p02887 (python)

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

new = s[0]
count = 1

for i in s:
  if new == i:
    continue;
  else:
    count += 1
    new = i
  
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input().split("")

s = list(set(s))

print(len(s))
Problem p02582 (python)

Fixed submission:
s = input()
for i in ['RRR','RR','R']:
    if i in s:
        print(len(i));break
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x,k,d = map(int, input().split())
x = abs(x)
m = min(k,x//d)
x -= m*d
k -= m
if k%2: x = abs(x-d)
print(x)

Buggy submission (verdict: Runtime Error):
x,k,d = map(int, input().split())
x= abs(x)
m= min(k,x//d)
x -= m*d
k -= m
if k%2:
  x = abs(x-d)
print(x)
Problem p02607 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
print(sum([i % 2 == 1 for i in a[::2]]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(0, n+1, 2):
    if a[i]%2:
        count += 1
print(count)
Problem p02696 (python)

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

Buggy submission (verdict: Runtime Error):
result=[]; a,b,n = list(map(int,input().split()))
for x in range(n+1):
  result.append((math.floor(a*x/b))-(a*math.floor(x/b)))
else:
  print(max(result))
Problem p02730 (python)

Fixed submission:
s = list(input())
n = len(s); flag= 0
if s == s[::-1]:    flag += 1 ;
start, end = 0, ((n-1)//2)-1
while(end > start and flag == 1):
    if not(s[start] == s[end]):        break;
    start += 1 ; end -= 1
else:    flag += 1
start, end = (n+3)//2 -1, (n-1)
while(end > start and flag == 2):
    if not(s[start] == s[end]):        break;
    start += 1 ; end -= 1
else:    flag += 1
print('Yes' if flag == 3 else 'No')

Buggy submission (verdict: Runtime Error):
s=input().strip();	n=len(S)
print("Yes" if s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1] and s[(n+3)//2-1:]==s[(n+3)//2-1:][::-1] else "No")
Problem p02731 (python)

Fixed submission:
n = float(input())
value = pow(n,3)/27
print(value)

Buggy submission (verdict: Runtime Error):
print((int(input))**3/27)
Problem p02767 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
N = int(readline())
X = list(map(int, readline().split()))
X.sort()

INF = 10**9+7
ans = INF
for p in range(0, 102):
    res = 0
    for x in X:
        res += (p-x)**2
    ans = min(ans, res)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = sorted(list(map(int, readline().split())))
ans = 10**9+7
for p in range(0, 102):
    res = 0
    for x in X:
        res += (p-x)**2 
    ans = min(ans, res)
print(ans)
Problem p02934 (python)

Fixed submission:
input()
l = list(map(int,input().split()))
s = sum(1/i for i in l)
print(1/s)

Buggy submission (verdict: Runtime Error):
input()
l = list(map(int,input().split()))
s = 0
s += 1/i for i in l
print(round(1/s,3))
Problem p03000 (python)

Fixed submission:
n, x = map(int,input().split())
l = list(map(int, input().split()))
s = 0
count = 1
for i in l:
    s += i
    if s > x:
        break
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, x = map(int,input().split())
l = list(map(int, input().split()))
s = 0
count = 1
for i in L:
    s += i
    if s > x:
        break
    count += 1
print(count)
Problem p03103 (python)

Fixed submission:
n,m = map(int,input().split())
ab = sorted([list(map(int,input().split())) for i in range(n)])
shop,cost,rest=0,0,m
while True:
    if ab[shop][1]<rest:
        cost += ab[shop][1]*ab[shop][0]
        rest -= ab[shop][1]
        shop+=1
    else:
        cost+=ab[shop][0]*rest
        break
print(cost)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ab=sorted([list(map(int,input().split())) for i in range(n)])
shop,cost,rest=m,0,0
while True:
    if ab[shop][1]<rest:
        cost+=ab[shop][1]*ab[shop][0]
        rest-=ab[shop][1]
        shop+=1
    else:
        cost+=ab[shop][0]*rest
        break
print(cost)
Problem p03206 (python)

Fixed submission:
n = int(input())
print("Christmas" + " Eve" * (25-n))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = sorted([int(input()) for _ in range(n)])
print(min(h[j+k-1]-h[j] for j in range(n-k+1)))
Problem p03211 (python)

Fixed submission:
s = input()
l, ans = len(s), []
for i in range(0,l-2):
    n = s[i:i+3]
    ans.append(abs(753-int(n)))
print(min(ans))

Buggy submission (verdict: Runtime Error):
l, ans = len(s), []
for i in range(0,l-2):
    n = s[i:i+3]
    ans.append(abs(753-int(n)))
print(min(ans))
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())
print(':(' if a > 8 or b > 8 else 'Yay!')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(':(' if a > 8 or b > 8 'Yay!')
Problem p03371 (python)

Fixed submission:
a,b,c,x,y = map(int, input().split())
ans = 10**12
for i in range(0, (max(x,y)*2)+1, 2):
    xr = max(x-(i//2), 0)
    yr = max(0, y-(i//2))

    if ans > (i*c)+(xr*a)+(yr*b):
        ans = (i*c)+(xr*a)+(yr*b)

print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,x,y = map(int, input().split())
ans = 10**12
for i in range(0, max(x,y)*2+1, 2):
    xr = max(x-i//2, 0)
    yr = max(0, y-i//2)

    if ans > (i*c)+(xr*a)+(yr*b):
        ans = (i*c)+(xr*a)+(yr*B)

print(ans)

Buggy submission (verdict: Runtime Error):
ab,c,x,y=map(int,input().split())
ans=10**12
for i in range(0,(max(x,y)*2)+1,2):
    xr=max(x-i//2,0)
    yr=max(0,y-i//2)

    if ans>(i*c)+(xr*a)+(yr*b):
        ans=(i*c)+(xr*a)+(yr*B)

print(ans)
Problem p03495 (python)

Fixed submission:
n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*(n+1)
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*n+1
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*n
for i in l:
    freq[i]+=1
freq.sort()
print(sum(freq[:n-k+1]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*n
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = map(int, input().split())
def counter(l):
    count = {}
    for i in l:
        count[i] = l.count(i)
    return sorted(count.values())

freq = counter(l)
print(len(freq) - k if len(freq)> k else 0)
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
P = sum(X) // N
result1 = 0
result2 = 0

for x in X:
  result1 += (x - P)**2
  result2 += (x - P - 1)**2

if result1 <= result2:
  result = result1
elif result1 > result2:
  result = result2


print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
P = sum(X) // N
result1 = 0
result2 = 0

for x in X:
  result1 += (x - P)**2
  result2 += (x - P - 1)**2

if result1 < result2:
  result = result1
elif result1 > result2:
  result = result2


print(result)
Problem p03086 (python)

Fixed submission:
S = input()
i = 0
result = []
for a in S:
  if a == "A" or a == "C" or a == "G" or a == "T":
    i += 1
  else:
    result.append(i)
    i = 0

result.append(i)
result.sort()
print(result[-1])

Buggy submission (verdict: Runtime Error):
S = input()
i = 0
result = []
for a in S:
  if a == "A" or a == "C" or a == "G" or a == "T":
    i += 1
  else:
    result.append(i)
    i = 0


result.sort()
print(result[-1])
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18 + 1
total = 1
if A.index(0):
    print(0)
else:
    for i in A:
        total *= i
    if total > over_value:
        total = -1
    print(total)
Problem p02683 (python)

Fixed submission:
N, M, X = map(int,input().split())
skill_book = []
for i in range(N):
    skill_book.append(list(map(int, input().split())))
box = []
flag = 1
for i in range(1 << N):
    total = [0] * (M + 1)
    for j in range(N):
        if (i >> j) & 1:
            total = [x + y for (x, y) in zip(total, skill_book[j])]
    over = 1
    for j in range(1, len(total)):
        if not (total[j] >= X):
            over = 0
    if over == 1 and len(total) > 0:
        box.append(total[0])
if len(box) > 0:
    print(min(box))
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
N, M, X = map(int,input().split())
skill_book = []
for i in range(N):
    skill_book.append(list(map(int, input().split())))
box = []
flag = 1
for i in range(1 << M):
    total = [0] * (M + 1)
    for j in range(M):
        if (i >> j) & 1:
            total = [x + y for (x, y) in zip(total, skill_book[j])]
    over = 1
    for j in range(1, len(total)):
        if not (total[j] >= X):
            over = 0
    if over == 1 and len(total) > 0:
        box.append(total[0])

print(min(box))
Problem p02813 (python)

Fixed submission:
import itertools
N = int(input())
P  = list(map(int,input().split()))
Q  = list(map(int,input().split()))
per_list = [list(i) for i in itertools.permutations(range(1,N + 1))]

print(abs(per_list.index(P) - per_list.index(Q)))

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
P  = list(map(int,input().split()))
Q  = list(map(int,input().split()))
per_list = [list(i) for i in itertools.permutations(range(1,N + 1))]

print(abs(per_list.index(P) - per_list(Q)))
Problem p02844 (python)

Fixed submission:
n = int(input())
S = input()
count = 0
for i in range(10):
    a = S.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = S.find(str(j),a + 1)
        if b == -1:
            continue
        for k in range(10):
            if str(k) in S[b+1::]:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
cnt = 0
for i in range(10):
    a = s.find(i)
    if a == -1:
        continue
    for j in range(10):
        b = s.find(j,a+1)
        if b == -1:
            continue        
        for k in range(10):
            if str(k) in s[b+1::]:
                cnt += 1
print(cnt
Problem p03371 (python)

Fixed submission:
A, B, AB, X, Y = map(int,input().split())
min_sheet = min(X,Y)

if A + B >= AB * 2:
    min_price = min(AB * 2 * min_sheet + A * (X - min_sheet) + B * (Y - min_sheet), AB * 2 * max(X,Y))
else:
    min_price = A * X + B * Y
    
print(min_price)

Buggy submission (verdict: Runtime Error):
A, B, AB, X, Y = map(int,input().split())
min_sheet = min(X,Y)

if A + B >= AB * 2:
    min_price = min(AB * 2 * min_sheet + A(X - min_sheet) + B(Y - min_sheet), AB * 2 * max(X,Y))
else:
    min_price = A * X + B * Y
    
print(min_price)

Buggy submission (verdict: Runtime Error):
A, B, AB, X, Y = map(int, input().split())
max_price = A * X + B * Y
flag = 1
mid_price = min((A + B) // 2, AB)
if A > mid_price and B > mid_price:
    min_sheet = max(X, Y)
elif A > mid_price:
    min_sheet = X
elif B > mid_price:
    min_sheet = Y

price = max_price + 1

while flag:
    flag = 0
    if A >= mid_price and B >= mid_price:
        price = min_sheet * AB * 2
        X -= min_sheet
        Y -= min_sheet
    if X < 1 and Y < 1:
        break
    elif X > 0:
        price += X * A
        if Y > 0:
            price += Y * B
    elif Y > 0:
        price += Y * B
        if X > 0:
            price += X * A

print(min(max_price, price))
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
price = int(input())
d_price = int(input())
if K >= N:
    total = N * price
    print(total)
else:
    total = K * price
    N -= K
    total += N * d_price
    print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
price = int(input())
d_price = int(input())
if K >= N:
    total = N * prive
    print(total)
else:
    total = K * price
    N -= K
    total += N * d_price
    print(total)
Problem p04032 (python)

Fixed submission:
S = input()
N = len(S)
for i in range(N-1):
    if S[i] == S[i + 1]:
        print(i+1,i+2)
        exit()
for i in range(N-2):
    if S[i] == S[i + 2]:
        print(i + 1 ,i + 3)
        exit()
        
print(-1,-1)

Buggy submission (verdict: Runtime Error):
S = input()
search_dic = {i:0 for i in range(ord('a'),ord('z'))}
for ss in S:
    search_dic[ord(ss)] += 1
    
max_v = max([(y,x) for x,y in search_dic.items()])
max_v = [chr(max_v[1]),max_v[0]]
major = round(len(S) / 2)

if max_v[1] >= major:
    r = S[::-1]
    print(S.index(max_v[0]) + 1,len(r) - r.index(max_v[0]) + 1)
else:
    print(-1,-1)
Problem p03293 (python)

Fixed submission:
##### 解けた #####

import numpy as np

S=np.asarray(list(input()))
T=np.asarray(list(input()))
OKflag=False # 一致するかどうかを示すフラグ

for i in range(len(S)):
    Sr=np.roll(S,i) # ロールさせる
    
    if (Sr==T).all(): # 一致する場合、フラグを立てて終了
        OKflag=True
        break

if OKflag==True: # 回転させて一致するなら
    print("Yes")
else: # 一致しないなら
    print("No")

Buggy submission (verdict: Runtime Error):
##### 解けた #####

import numpy as np

S=np.asarray(list(input()))
T=np.asarray(list(input()))
OKflag=False # 一致するかどうかを示すフラグ

for i in range(len(S)):
    Sr=np.roll(S,i) # ロールさせる
    
    if Sr==T: # 一致する場合、フラグを立てて終了
        OKflag=True
        break

if OKflag==True: # 回転させて一致するなら
    print("Yes")
else: # 一致しないなら
    print("No")
Problem p03316 (python)

Fixed submission:
##### 解けた #####

N=input()
sn=sum(map(int,list(N)))

if int(N)%sn==0: # 割り切れる場合
    print("Yes")
else: # 割り切れない場合
    print("No")

Buggy submission (verdict: Runtime Error):
##### 解けた #####

N=input()
sn=sum(map(int,list(N))))

if int(N)%sn==0: # 割り切れる場合
    print("Yes")
else: # 割り切れない場合
    print("No")
Problem p03456 (python)

Fixed submission:
##### 解けた #####

from math import sqrt

ab=int("".join(input().split(" ")))

if sqrt(ab).is_integer(): # 平方数なら
    print("Yes")
else: # 平方数ではないなら
    print("No")

Buggy submission (verdict: Runtime Error):
##### 解けた #####

from math import sqrt

ab=int("".join(input().split(" "))))

if sqrt(ab).is_integer(): # 平方数なら
    print("Yes")
else: # 平方数ではないなら
    print("No")
Problem p03485 (python)

Fixed submission:
##### 解けた #####
from math import ceil

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

print(ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
##### 解けた #####

a,b=list(map(int,input()))

print((a+b)//2)
Problem p03943 (python)

Fixed submission:
##### 解けた #####

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

if (a+b)==c or (a+c)==b or (b+c)==a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
##### 解けた #####

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

if sum(a,b)==c or sum(a,c)==b or sum(b,c)==a:
    print("Yes")
else:
    print("No")
Problem p04030 (python)

Fixed submission:
##### 解けた #####

S=input()
A=[""]

for s in S: # 入力の文字列1文字ずつ見てゆく
    if s in ["0","1"]: # もし0か1の場合、それを追加
        A.append(s)
    elif s=="B": # もしバックスペースの場合、1文字削除
        if len(A)>=1: # 長さが1以上の場合のみ削除
            A.pop(-1)

print("".join(A))

Buggy submission (verdict: Runtime Error):
##### 解けた #####

S=input()
A=[""]

for s in S: # 入力の文字列1文字ずつ見てゆく
    if s in ["0","1"]: # もし0か1の場合、それを追加
        A.append(s)
    elif s=="B": # もしバックスペースの場合、1文字削除
        A.pop(-1)

print("".join(A))
Problem p04043 (python)

Fixed submission:
##### 解けた #####

A,B,C=list(map(int,input().split(" ")))

if (A==5 and B==7 and C==5) or (A==7 and B==5 and C==5) or (A==5 and B==5 and C==7):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
##### 解けた #####

A,B,C=list(map(int,input().split(" ")))

if (len(A)==5 and len(B)==7 and len(C)==5) or (len(A)==7 and len(B)==5 and len(C)==5) or (len(A)==5 and len(B)==5 and len(C)==7):
    print("YES")
else:
    print("NO")
Problem p02784 (python)

Fixed submission:
h,m = map(int, input().split())
atack = list(map(int, input().split()))

atack.sort(reverse=True) #降順に並び替え
atack_select = atack[:m]

if h - sum(atack_select) <= 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
h,m = map(int, input().split())
atack = list(map(int, input().split()))

atack_select=[] #候補を保存しておくリスト

for i in range(m):
    atack_select.append(max(atack))
    atack = list(set(atack) - set(atack_select)) #最大値を除いたリスト

if h - sum(atack_select) <= 0:
    print("Yes")
else:
    print("No")
Problem p02811 (python)

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

Buggy submission (verdict: Runtime Error):
k, x = map(int, input().split())
if 500*k >= x:
  print("Yes")
  else:
    print("No")
Problem p02981 (python)

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

def func(n, a, b):
  if (n*a > b):
    print(b)
  else:
    print(n*a)
    
func(A[0], A[1], A[2])

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

N, D = map(int, input().split())
X = [[int(i) for i in input().split()] for i in range(N)]

is_int = 0
for i in range(N-1):
  for j in range(i+1, N-i):
    l1 = np.array(X[i])
    l2 = np.array(X[j])
    d = math.sqrt(sum((l1-l2)**2))
    if isinstance(d, int):
      is_int += 1
      print(is_int)
Problem p02582 (python)

Fixed submission:
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
r.append(c)
if not len(r):
  print(c)
else:
  print(max(r))

Buggy submission (verdict: Runtime Error):
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
if not len(r):
  print(c)
else:
  print(max(c))

Buggy submission (verdict: Runtime Error):
r = []
c = 0
for i in input():
  if i == 'R':
    c+=1
  elif i=='S':
    r.append(c)
    c = 0
r.sort()
print(r[-1])

Buggy submission (verdict: Runtime Error):
c = 0
r = []
s = input()
s.upper()
for i in s:
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
print(max(r))

Buggy submission (verdict: Runtime Error):
r = []
c = 0
s = input()
s.upper()
for i in s:
  if i =='R':
    c+=1
  else:
    r.append(c)
r = list(set(r))
print(max(r))

Buggy submission (verdict: Runtime Error):
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
print(max(r))

Buggy submission (verdict: Runtime Error):
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
print(max(r))
Problem p02606 (python)

Fixed submission:
l,r,d=map(int,input().split())
aa=r//d
bb=(l-1)//d
print(aa-bb)

Buggy submission (verdict: Runtime Error):
l,r,d=map(int,input().split())
aa=//d
bb=(l-1)//d
print(aa-bb)
Problem p03860 (python)

Fixed submission:
l = list(map(str,input().split()))
v = ''
for i in range(len(l)):
    v = v + l[i][0]
print(v)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
a1 = a//c if a%c else a//c-1
a2 = b//c
print(a2-a1)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
a1 = a//c if a%x else a//c-1
a2 = b//c
print(a2-a1)

Buggy submission (verdict: Runtime Error):
a,b,x = list(map(int,input().split()))
a1 = a//x if a%x else a//x-1
a2 = b//x
print(a2-a1)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
a = a//c
b = b//c if b%x else b//c-1
print(a-b)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
b = a//c
b = b//c if b%c else b//c-1
print(a1-a2)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(str,input().split()))
a = a//c
b = b//c
print(b-a)
Problem p03861 (python)

Fixed submission:
a,b,c = list(map(int,input().split()))
x = a//c 
y = b//c
if a%c:
    print(y-x)
else:
    print((y-x)+1)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
a1 = a//c
a2 = b//c if b%x else b//c-1
print(a1-a2)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(str,input().split()))
a = a/c
b = b/c
print(b-a)
Problem p03455 (python)

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

multiplication = a * b
if multiplication % 2 == 0:
  print('Even')
  
else:
  print('Odd')

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

if a % 2 == 0 or b % 2 == 0:
  print('Even')
else:
  print('Odd)
Problem p02582 (python)

Fixed submission:
def main():
    S = input()
    answer = solve(S)
    print(answer)


def solve(S):
    patterns = {
        'SSS': 0,
        'SSR': 1,
        'SRS': 1,
        'SRR': 2,
        'RRR': 3,
        'RRS': 2,
        'RSR': 1,
        'RSS': 1
    }

    return patterns[S]


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    answer = solve(S)
    print(answer)


def solve(S):
    assert len(S) == 3
    assert all([x in ('S', 'R') for x in S])

    chain = []
    count = 0
    for i in range(len(S)):
        if S[i] == 'R':
            count += 1
        else:
            chain.append(count)

    return max(chain)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    answer = solve(S)
    print(answer)


def solve(S):
    chain = []
    count = 0
    for i in range(len(S)):
        if S[i] == 'R':
            count += 1
        else:
            chain.append(count)

    return max(chain)


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

Fixed submission:
nums = input().split(" ")
A = int(nums[0])
B = int(nums[1])
K = int(nums[2])

"""
ここで、まずはAとKの比較を行って、Aの方が大きければその場で試行は終了
し、Kの方が大きければ、A=0となり、その差|A-K|は残りのBから引くものになる。
"""
if A >= K:
  A -= K
  print(A, end=" ")
  print(B)
else:
  K -= A
  A = 0
  B -= K
  if B < 0:
    B = 0
  print(A, end=" ")
  print(B)

Buggy submission (verdict: Runtime Error):
nums = input().split(" ")
A = int(nums[0])
B = int(nums[1])
K = int(nums[2])

for i in tqdm(range(0,K)):
  if A >= 1:
    A -= 1
  elif B >= 1:
    B -= 1

print(A, end=" ")
print(B)
Problem p02642 (python)

Fixed submission:
n = int(input())
ls = sorted(list(map(int, input().split())))
dp = [0] * (ls[-1] + 1)
for i in ls:
    dp[i] += 1
    if dp[i] == 1:
        for j in range(i*2, ls[-1] + 1, i):
            dp[j] += 2

print(dp.count(1))

Buggy submission (verdict: Runtime Error):
n = int(input())
ls = sorted(list(map(int, input().split())))
primes = [0] * (max(ls) + 1)
primes[0] == 1
primes[1] == 1
for i in range(round(n ** 0.5) + 1):
    if primes[ls[i]] == 0:
        for j in range(ls[i] * 2, max(ls) + 1, ls[i]):
            primes[j] = 1

count = 0
for i in ls:
    if primes[i] == 0:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
ls = sorted(list(map(int, input().split())))
dead = []
for i in range(round(n ** 0.5) + 1):
    if ls[i] not in dead:
        for j in range(ls[i], ls[-1] + 1, ls[i]):
            if j in ls: 
                dead.append(j)

print(n - len(dead))