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

Fixed submission:
import itertools

N = input()
P = input()
Q = input()
string1 = tuple(map(int, list(P.split(" "))))
string2 = tuple(map(int, list(Q.split(" "))))

num =list(itertools.permutations(list(range(1, int(N)+1))))
count = 1

for i in num:
    if i == string1:
        a = count
    if i == string2:
        b = count
    count += 1

print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
N = input()
P = input()
Q = input()
string1 = tuple(map(int,list(P.split(""))))
string2 = tuple(map(int,list(Q.split(""))))
num =list(itertools.permutations(list(range(1, int(N)+1))))
count = 1
for i in num:
  if i==string1:
    a=count
  if i==string2:
    b=count
  count+=1
print(abs(a-b))
Problem p02641 (python)

Fixed submission:
import sys
x, n = map(int, input().split())
if n == 0:
  print(x)
  sys.exit()
lst = list(map(int, input().split()))
for i in range(250):
  if x - i not in lst:
    print(x - i)
    sys.exit()
  if x + i not in lst:
    print(x + i)
    sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
if n == 0:
  print(x)
  sys.exit()
x, n = map(int, input().split())
lst = list(map(int, input().split()))
for i in range(250):
  if x - i not in lst:
    print(x + i)
    sys.exit()
  if x + i not in lst:
    print(x + i)
    sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
x, n = map(int, input().split())
lst = list(map(int, input().split()))
for i in range(250):
  if x - i not in lst:
    print(x + i)
      sys.exit()
  if x + i not in lst:
      print(x + i)
      sys.exit()
Problem p02658 (python)

Fixed submission:
n = int(input())
lst = list(map(int, input().split()))
mul = 1
thr = 10 ** 18
if 0 in lst:
  print('0')
  exit()
for i in range(n):
  mul = mul * lst[i]
  if mul > thr:
    print('-1')
    exit()
print(mul)

Buggy submission (verdict: Runtime Error):
n = int(input())
mul = 1
for i in range(n):
  ai = int(input())
  mul = mul * ai
  if mul > 10 ** 18:
    print('-1')
    exit()
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
if s == '1' * len(s):
  print(1)
  exit()
for i in range(len(s)):
  if s[i] != '1':
    idx = i
    num = s[i]
    break
if idx >= k:
  print(1)
else:
  print(num)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for i in range(len(s)):
  if s[i] != '1':
    idx = i
    num = s[i]
    break
if idx >= k:
  print(1)
else:
  print(num)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
c = int(a * b)
def f(n):
  if n % 2 == 0:
    return 'Even'
  else:
    return 'Odd'
print(f(c))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input(.split()))
c = a * b
def f(n):
  if n % 2 == 0:
    return 'Even'
  else:
    return 'Odd'
f(c)

Buggy submission (verdict: Runtime Error):
b = map(int, input().split())
a = b[0] * b[1]
	if a % 2 == 0:
	  print('Even')
	else:
	  print('Odd')
Problem p03493 (python)

Fixed submission:
lst = [int(i) for i in str(input())]
print(sum(lst))

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
lst = list(map(int, input().split()))
res = 0
for p in range(200):
  for i in range(n):
    if lst[i] % 2 == 1:
      print(res)
      sys.exit()
  lst = [int(j / 2) for j in lst]
  res += 1

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
lst = list(map(int, input().split()))
res = 0
while True:
  for i in range(n):
    if lst[i] % 2 == 1:
      print(res)
      sys.exit()
  lst = [int(j / 2) for j in lst]
  res += 1

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = map(str, input().split())
res = 0
def f(l):
  while True:
    for i in l:
      if int(i[-1]) % 2 == 1:
        return res
    l = [str(int(j) / 2) for j in l]
    res += 1
f(lst)
Problem p03494 (python)

Fixed submission:
import sys
n = int(input())
lst = list(map(int, input().split()))
res = 0
for p in range(200):
  for i in range(n):
    if lst[i] % 2 == 1:
      print(res)
      sys.exit()
  lst = [int(j / 2) for j in lst]
  res += 1

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = map(str, input().split())
res = 0
while True:
  for i in lst:
    if int(i[-1]) % 2 == 1:
      return res
  lst = [int(j) / 2 for j in lst]
  res += 1
Problem p02612 (python)

Fixed submission:
n = int(input())

if n >= 1000:
  siharai = n % 1000
  if siharai == 0:
    print(0)
  else:
    otsuri = 1000 - siharai
    print(otsuri)
  
else:
  otsuri = 1000 - n
  print(otsuri)

Buggy submission (verdict: Runtime Error):
N=int(input())
lst=[]
for i in range(N):
    lst.append(str(input()))

acn = 0
wan = 0
tlen = 0
ren = 0

for a in lst:
    if a == 'AC':
        acn += 1
    elif a == 'WA':
        wan += 1
    elif a == 'TLE':
        tlen += 1
    elif a == 'RE':
        ren += 1
    else:
        continue

print('AC x ' + str(acn))
print('WA x ' + str(wan))
print('TLE x ' + str(tlen))
print('RE x ' + str(ren))
Problem p02678 (python)

Fixed submission:
n,m=list(map(int, input().split()))
root = [[] for _ in range(n)]
answer=[-1]*n
answer[0]=1
for i in range(m):
    c=list(map(int, input().split()))
    root[c[1]-1].append(c[0]-1)
    root[c[0]-1].append(c[1]-1)
count=1#最初から1の部屋はOKにしとく
queue=[0]
#print(root)
newqueue=[]
while(count<n and len(queue)!=0):
    for j in queue:
        for rootnum in root[j]:
            if(answer[rootnum]==-1):
                answer[rootnum]=j
                newqueue.append(rootnum)
                count+=1
    queue=newqueue
    #print(newqueue)
    newqueue=[]
if(count<n):
    print('No')
else:
    print('Yes')
    for l in range(n-1):
        print(answer[l+1]+1)

Buggy submission (verdict: Runtime Error):
k=int(input())
s=input()
if(len(s)<=k):
    print(s)
else:
    print(s[0:k]+'...')
Problem p02722 (python)

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n=int(input())
nlist=make_divisors(n)
n1list=make_divisors(n-1)
# print(nlist)
# print(n1list)
answer=len(n1list)-1#1を除きます
for i in nlist[1:len(nlist)]:
    pra=n
    while (pra%i==0):
        pra=pra/i
    if pra%i==1:
        answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
n=int(input())
nlist=make_divisors(n)
n1list=make_divisors(n-1)
# print(nlist)
# print(n1list)
answer=len(n1list)-1#1を除きます
for i in nlist[1:len(nlist)]:
    pra=n
    while (pra%i==0):
        pra=pra/i
    if pra%i==1:
        answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
n=int(input())
nlist=make_divisors(n)
n1list=make_divisors(n-1)
# print(nlist)
# print(n1list)
answer=len(n1list)-1#1を除きます
for i in nlist[1:len(nlist)]:
    pra=n
    while (pra%i==0):
        pra=pra/i
    if pra%i==1:
        answer+=1
print(answer)
Problem p02813 (python)

Fixed submission:
import math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
arrayp=[1]
for iii in range(n-1):
    arrayp+=[1]
arrayq=[1]
for jjj in range(n-1):
    arrayq+=[1]
pnum=0
qnum=0
for i in range(n-1):
    prank=0
    for ii in range(p[i]):
        if arrayp[ii]==1:
            prank+=1
    pnum=pnum+(prank-1)*math.factorial(n-i-1)
    arrayp[p[i]-1]=0
for j in range(n-1):
    qrank=0
    for jj in range(q[j]):
        if arrayq[jj]==1:
            qrank+=1
    qnum=qnum+(qrank-1)*math.factorial(n-j-1)
    arrayq[q[j]-1]=0
print(abs(pnum-qnum))

Buggy submission (verdict: Runtime Error):

Python 3 
File
Edit
View
Insert
Cell
Kernel
Widgets
Help

import math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
arrayp=[1]
for iii in range(n-1):
    arrayp+=[1]
arrayq=[1]
for jjj in range(n-1):
    arrayq+=[1]
pnum=0
qnum=0
for i in range(n-1):
    prank=0
    for ii in range(p[i]):
        if arrayp[ii]==1:
            prank+=1
    pnum=pnum+(prank-1)*math.factorial(n-i-1)
    arrayp[p[i]-1]=0
for j in range(n-1):
    qrank=0
    for jj in range(q[j]):
        if arrayq[jj]==1:
            qrank+=1
    qnum=qnum+(qrank-1)*math.factorial(n-j-1)
    arrayq[q[j]-1]=0
print(abs(pnum-qnum))
8
Problem p02911 (python)

Fixed submission:
nkq=list(map(int,input().split()))
a = [int(input()) for _ in range(nkq[2])]
point=[nkq[1]-nkq[2]]*nkq[0]
for i in range(nkq[2]):
    point[a[0]-1]+=1
    del a[0]
for j in range(nkq[0]):
    if point[j]>0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
nkq=list(map(int,input().split()))
a = [int(input()) for _ in range(nkq[2])]
point=[0]*nkq[0]
for i in range(nkq[0]):
    point[a[0]-1]+=1
    del a[0]
for j in range(nkq[0]):
    if point[j]>0:
        print('Yes')
    else:
        print('No')
Problem p02917 (python)

Fixed submission:
n=int(input())
b=list(map(int,input().split()))
k=b[n-2]
if n>2:
    for i in range(0,n-2):
        if b[n-i-3]<b[n-i-2]:
            k+=b[n-i-3]
        else:
            k+=b[n-i-2]
k+=b[0]
print(k)

Buggy submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
k=b[n-2]
for i in range(1,n-2):
    if b[n-i-2]<b[n-i-1]:
        k+=b[n-i-2]
    else:
        k+=b[n-i-1]
if b[0]<b[1]:
    k+=b[0]
else:
    k+=b[1]
print(k)
Problem p02996 (python)

Fixed submission:
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    #print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    print([k,answer])
    if k>ab[t][1]:
        #answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
print(ab)
k=1
for t in range(n):
    k+=ab[t][0]
    print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
#print(b)
k=0
for t in range(n):
    k+=ab[n-1-t][0]
    #print([k,answer])
    if k>ab[n-1-t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')
Problem p02713 (python)

Fixed submission:
from math import gcd
K=int(input())
sum=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):           
            
            sum+=gcd(gcd(a,b),c)
print(sum)

Buggy submission (verdict: Runtime Error):
K=int(input())
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):            
            m=min(a,b,c)
            for i in range(1,m+1):
                if a%i==0 and b%i==0 and c%i==0:
                    gcd=i
            sum+=gcd

print(sum)
Problem p02724 (python)

Fixed submission:
X=int(input())
happy=(X//500)*1000
left=X%500
happy+=(left//5)*5
print(happy)

Buggy submission (verdict: Runtime Error):
s=list(input())
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")
Problem p02583 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if arr[i]<arr[j] and arr[j]<arr[k]:
        if arr[i]+arr[j]>arr[k]:
          ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(k+1,n):
      if arr[i]<arr[j] and arr[j]<arr[k]:
        if arr[i]+arr[j]>arr[k]:
          ans+=1
print(ans)
Problem p02584 (python)

Fixed submission:
x,k,d=map(int,input().split())
x=abs(x)
if x>0:
    temp=x//d
    if temp>=k:
        print(x-k*d)
    else:
        if (k-temp)%2==0:
            print(x%d)
        else:
            print(abs(x%d-d))
elif x==0:
    if k%2==0:
        print(0)
    else:
        print(d)

Buggy submission (verdict: Runtime Error):

x,k,d=map(int,input().split())
for i in range(k-1):
    if x>0:
        x-=d
        if x<=0:
            flag=-1
            break
    elif x<0:
        x+=d
        if x>=0:
            flag=1
            break
    else:
        flag=0
        break
if flag==0:
    print(0)
elif flag==-1:
    print(min(abs(x),x+d))
else:
    print(min(abs(x-d),x))
Problem p02812 (python)

Fixed submission:
n,s = [input() for _ in range(2)]
print(s.count("ABC"))

Buggy submission (verdict: Runtime Error):
n,s = [int(input()) for _ in range(2))
print(s.count("ABC"))
Problem p02621 (python)

Fixed submission:
a = int(input())
x = a*a 
y = a*a*a
z =a+x+y

print(z)

Buggy submission (verdict: Runtime Error):
a = input()
x = a + a*a + a*a*a
print(x)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

X =A*B
print(X)
Problem p02576 (python)

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

time = 0

while (i[0] > 0):
    i[0] -= i[1]
    time += i[2]

print(time)

Buggy submission (verdict: Runtime Error):
N = int (input())
X = int (input())
T = int (input())

time = 0

while (N > 0):
    N -= X
    time += T

print(time)
Problem p02765 (python)

Fixed submission:
N,R=input().split()
N=int(N)
R=int(R)
if N<10:
  R+=100*(10-N)
print(R)

Buggy submission (verdict: Runtime Error):
N=input()
R=input()
N=int(N)
R=int(R)
if N<10:
  R+=100*(10-N)
print(R)
Problem p02641 (python)

Fixed submission:
[x,n]=[int(i) for i in input().split()]

if n!=0:
    p_list=[int(i) for i in input().split()]
    
    if x not in p_list:
        print(x)
        
    else:
        i=1
        while True:
            if (x-i) not in p_list:
                print(x-i)
                break
            elif (x+i) not in p_list:
                print(x+i)
                break
            else:
                i+=1
                


else:
    print(x)

Buggy submission (verdict: Runtime Error):
[x,n]=[int(i) for i in input().split()]

if n!=0:
    p_list=[int(i) for i in input().split()]


    abs_list=[]
    a_list=list(range(min(p_list),max(p_list)+1))

    for i in p_list:
        a_list.remove(i)

   

    for i in a_list:
     abs_list.append(abs(x-i))
    
    num=abs_list.index(min(abs_list))
    print(a_list[num])

else:
    print(x)
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f=[int(i) for i in input().split()]

max_a=f//(100*a)
max_b=f//(100*b)
max_c=f//c
max_d=f//d

#水リスト
x_list=[]
for i in range(max_a+1):
   for j in range(max_b+1):
        #水
       x=100*a*i+100*b*j
       if 0<x<=f and x not in x_list:
           x_list.append(x)
#print(x_list)
       
#砂糖リスト
y_list=[]
for i in range(max_c+1):
   for j in range(max_d+1):
        #砂糖
       y=c*i+d*j
       if 0<=y<f and y not in y_list:
           y_list.append(y)
#print(y_list)

concentration_list=[]
sugar_water_list=[]
sugar_list=[]

for i in x_list:
   for j in y_list:
       if i+j<=f and j/i<=e/100:
           concentration=100*j/(i+j)
           concentration_list.append(concentration)
           sugar_water_list.append(i+j)
           sugar_list.append(j)
                   
sugar_index=concentration_list.index(max(concentration_list))
print(sugar_water_list[sugar_index],sugar_list[sugar_index])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int, input().split())
amax=f//(a*100)
bmax=f//(b*100)
c_list=[]
sw_list=[]
s_list=[]

for i in range(amax+1):
   for j in range(bmax+1):
       water=100*a*i+100*b*j
       if water>0:
           smax=f-water
           for k in range(smax+1):
               for l in range(smax+1):
                   sugar=c*k+d*l
                   if water*e/100>=sugar and sugar>0:
                       concentration=100*sugar/(water+sugar)
                       c_list.append(concentration)
                       sw_list.append(sugar+water)
                       s_list.append(sugar)
num=c_list.index(max(c_list))
print(sw_list[num],s_list[num])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=[int(i) for i in input().split()]


max_a=f//(100*a)
max_b=f//(100*b)
max_c=f//c
max_d=f//d



#水リスト
x_list=[]
for i in range(max_a+1):
    for j in range(max_b+1):
         #水
        x=100*a*i+100*b*j
        if 0<x<f and x not in x_list:
            x_list.append(x)
#print(x_list)
        
#砂糖リスト
y_list=[]
for i in range(max_c+1):
    for j in range(max_d+1):
         #砂糖
        y=c*i+d*j
        if 0<y<f and y not in y_list:
            y_list.append(y)
#print(y_list)

concentration_list=[]
sugar_water_list=[]
sugar_list=[]

for i in x_list:
    for j in y_list:
        if i+j<=f and j/i<=e/100:
            concentration=100*j/(i+j)
            concentration_list.append(concentration)
            sugar_water_list.append(i+j)
            sugar_list.append(j)
                    
sugar_index=concentration_list.index(max(concentration_list))
print(sugar_water_list[sugar_index],sugar_list[sugar_index])
Problem p03308 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = max(a)-min(b)
print(b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = max(a)-min(b)
print(b)
Problem p02683 (python)

Fixed submission:
import itertools

N, M, X = map(int, input().split())
List = [list(map(int, input().split())) for n in range(N)]
INF = 10**7
ans = INF
C_pro = list(itertools.product([0,1], repeat=N))

for c_pro in C_pro:
    count = 0
    cost = 0
    ans_list = [0 for i in range(M)]
    for c in c_pro:
        if c == 1:
            cost += List[count][0]
            ans_list = [answ+list for answ, list in zip(ans_list,List[count][1:])]
        count += 1
    ok = True
    for i in range(len(ans_list)):
        if ans_list[i] < X:
            ok = False
            break
    if ok:
        ans = min(ans, cost)
    

if ans == 10**7:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
List = [list(map(int, input().split())) for n in range(N)]
INF = 10**7
ans = INF
C_pro = list(itertools.product([0,1], repeat=N))

for c_pro in C_pro:
    count = 0
    cost = 0
    ans_list = [0 for i in range(M)]
    for c in c_pro:
        if c == 1:
            cost += List[count][0]
            ans_list = [ans+list for ans, list in zip(ans_list,List[count][1:])]
        count += 1
    if ans_list >= [X for i in range(M)]:
        ans = min(ans, cost)
    

if ans == INF:
    print(-1)
else:
    print(ans)
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))# 0index
visi = [-1 for i in range(N)]# 訪れたタイミングを記録(-1: 訪れてない)
L = [1] # 今いる町を追加(町番号:1index)
visi[0] = 0
way = A[0] #次に向かう町の番号を取得
#l = []
count = 1

while visi[way-1] == -1: #すでに訪れた町が出てくるまでループ
    visi[way-1] = count
    count += 1
    L.append(way)
    way = A[way-1]

l = count - visi[way-1]
l_pre = visi[way-1]
loop_L = L[l_pre:]



if K > l_pre:
    index = (K- l_pre)% l
    ans = loop_L[index]
else:
    ans = L[K]
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
way = A[0]
List = [0 for n in range(N)]
List[way-1] += 1
count = 0
string = f"{way}"
#print(f"string:{string}")
#print(f"way:{way}")

for i in range(10**7):
    way = A[way-1]
    List[way-1] += 1 
    count += 1
    #print(f"way:{way}")
    #print(f"count:{count}")
    #print(List)
    if max(List) == 3:
        break
    else:
        string += f"{way}"
        #print(f"string:{string}")
        #print()

#print(List)
#print()
new_list = [i for i in List if i == 1]
length = len(new_list)
n_list = [j for j in List if j >= 2]
#print(new_list)
#print(n_list)
amari = (K - length)% len(n_list)

print(int(n_list[amari+1]))
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
ans_list=[]
S=[]
C=[]
ans=0

for i in range(M):
  s,c = map(int, input().split())
  S.append(s)
  C.append(c)
#print(S,C)
for n in range(1000):
  flag=0
  if len(str(n)) != N:
    continue
  for i, s in enumerate(S):
    n = str(n)
    if int(n[s-1]) == C[i]:
      continue
    else:
      flag=1
      break
  if flag == 0:
    ans_list.append(int(n))
#print(ans_list)
if len(ans_list) == 0:
  ans = -1
if ans != -1:
  ans=min(ans_list)
  
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans_list=[]
S=[]
C=[]
ans=0
for i in range(M):
  s,c = map(int, input().split())
  S.append(s)
  C.append(c)
  
for n in range(1000):
  if n < N:
    break
  for i, s in enumerate(S):
    n = str(n)
    if n[s-1] == C[i]:
      continue
    else:
      ans = -1
      break
      
  ans_list.append(int(n))
  
if ans != -1:
  ans=min(ans_list)
  
print(ans)
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
print(t+s)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
print(t+s)
Problem p02818 (python)

Fixed submission:
a, b, k = map(int, input().split())
after_a = max(0, a - k)
after_b = b
if after_a == 0:
    k -= a
    after_b = max(0, b - k)

print(after_a, after_b)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
after_a = max(0, a - k)
if after_a == 0:
    k -= a
    after_b = max(0, b - k)

print(after_a, after_b)
Problem p03000 (python)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
 
count = 1
x = 0
 
for n in range(N):
  x += L[n]
  
  if x > X:
    break
  else:
    count += 1
    
print(count)

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

count = 0
x = 0

for n in range(N+1):
  if x > X:
    print(count)
    break
  else:
    x += L[n]
    count += 1
Problem p03043 (python)

Fixed submission:
import math
N,K = map(int,input().split())
ans = 0
 
for i in range(1,N+1):
    if i >= K:
        ans += (1/N)
        continue
    X = int(math.log((K/i), 2))
    if (K/i) % 2**X == 0:
        pass
    else:
        X += 1
    ans += (1/N) * (1/2) ** X
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())
#coin = [decimal.Decimal('0.5')**k for k in range(10**4)]
ans = 0

for i in range(1,N+1):
    tmp = math.log2(K/i)
    x = int(math.log2(K/i))
    if i >= K:
        ans += 1/N
    else:
        if tmp - x != 0:
            x += 1
        ans += 1/N * (0.5)**x

print(ans)

Buggy submission (verdict: Runtime Error):
import decimal
import math

N, K = map(int, input().split())
#coin = [decimal.Decimal('0.5')**k for k in range(10**4)]
ans = 0

for i in range(1,N+1):
    tmp = math.log2(K/i)
    x = int(math.log2(K/i))
    if i >= K:
        ans += 1/N
    else:
        if tmp - x != 0:
            x += 1
        ans += 1/N * (0.5)**x

print(ans)

Buggy submission (verdict: Runtime Error):
import decimal
import math

N, K = map(int, input().split())
coin = [decimal.Decimal('0.5')**k for k in range(10**4)]
ans = 0

for i in range(1,N+1):
    tmp = decimal.Decimal(str(math.log2(K/i)))
    x = int(math.log2(K/i))
    if i >= K:
        ans += decimal.Decimal(1/N)
    else:
        if tmp - x != 0:
            x += 1
        ans += decimal.Decimal(1/N) * coin[x]

print(ans)

Buggy submission (verdict: Runtime Error):
import decimal
import math

N, K = map(int, input().split())
coin = [decimal.Decimal('0.5')**k for k in range(10**3)]
ans = 0

for i in range(1,N+1):
    tmp = decimal.Decimal(str(math.log2(K/i)))
    x = int(math.log2(K/i))
    if i >= K:
        ans += decimal.Decimal(1/N)
    else:
        if tmp - x != 0:
            x += 1
        ans += decimal.Decimal(1/N) * coin[x]

print(ans)