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

Fixed submission:
# coding: utf-8
import string

n = list(map(int,input().split()))
print(n[0]*n[1])

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import string
 
n = int(input())
a = list(map(int,input().split()))
res = 1
for i in range(n):
    res *= a[i]
    if(res>pow(10,18)):
      	break
 
if(res>pow(10,18)):
    print(-1)
else:
    print(res)
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
x=[a+b,a-b,a*b]
print(max(a))
Problem p02765 (python)

Fixed submission:
input = input().split(" ")
if int(input[0]) < 10:
  c = 10 - int(input[0])
  r = 100 * int(c)
  res = int(input[1]) + int(r)
  print(res)
elif int(input[0]) >= 10:
  print(input[1])

Buggy submission (verdict: Runtime Error):
input = input().split(" ")
if int(input[0]) > 10:
  c = 10 - int(input[0])
  r = 100 * int(c)
  print(r)
else:
  print(input[1]
Problem p03068 (python)

Fixed submission:
import re
n = input()
s = input()
k = input()
chlist = list(s)
ked = int(k) - 1
nonreplace = chlist[int(ked)]
for num in range(int(n)):
  #numed = num - 1
  if chlist[num] == nonreplace:
    pass
  else:
    chlist[num] = "*"
stred = ''.join(chlist)
print(stred)

Buggy submission (verdict: Runtime Error):
import re
n = input()
s = input()
k = input()
chlist = list(s)
nonreplace = chlist[int(k)]
for num in range(int(n)):
  if chlist[num] == nonreplace:
    pass
  else:
    chlist[num] = "*"
stred = ''.join(chlist)
print(stred)
Problem p03080 (python)

Fixed submission:
import time
import sys
import time
fl,sl=[input() for i in range(2)]
red = "R"
blue = "B"
numred = sl.count(red)
numblue = sl.count(blue)
if int(numred) > int(numblue):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
input = input()
splited = input.splitlines()
fl = splited[0]
sl = splited[1]
red = "R"
blue = "B"
numred = sl.count(red)
numblue = sl.count(blue)
if int(numred) > numblue:
  print("Yes")
else:
  print("No")
Problem p03737 (python)

Fixed submission:
data = input()
list = data.split(" ")
final = ""
for word in list:
  result = word[:1]
  result = result.upper()
  final = final + result
print(final)

Buggy submission (verdict: Runtime Error):
data = input()
capitalized = data.upper()
list = capitalized.split(" ")
for word in list:
  br = str(word)
  result = br[0:1]
  final += result
print(final)
Problem p02640 (python)

Fixed submission:
from sys import stdin
X, Y = [int(x) for x in stdin.readline().rstrip().split()]
if Y % 2 == 0:
    Z = Y / X
    if 2 <= Z <= 4:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
X, Y = [int(x) for x in stdin.readline().rstrip().split()]
if Y % 2 == 0:
    Z = Y / X
    if 2 <= Z <= 4:
        print('Yes')
else:
    print('No')
Problem p02683 (python)

Fixed submission:
n,m,x=map(int,input().split())
cc=[list(map(int,input().split())) for _ in range(n)]
ans=float('inf')
for b in range(1<<n):
    a=[0]*(m+1)
    for i in range(n):
        if b&(1<<i)==0:
            continue
        for k,l in enumerate(cc[i]):
            a[k]+=l
        if min(a[1:])>=x:
            ans=min(ans,a[0])
    a=[0]*(m+1)
if ans==float('inf'):
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for _ in range(n)]
from itertools import combinations
s=list(range(n))
ans=10**10
array=[0]*n
res=0
for ii in range(1,n+1):
    for i in combinations(s,ii):
        for j in i:
            res+=ca[j][0]
            for k,l in enumerate(ca[j][1:]):
                array[k]+=l
        if min (array)>=x:
            ans=min(ans,res)
        res=0
        array=[0]*m

if ans==10**10:
    print(-1)
else:
    print(ans)
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
pp=[0]*n
res=0

qq=[True]*n
for i in range(m):
    i,j=input().split()
    i=int(i)
    i-=1
    if j=="AC":
        if qq[i]:
            qq[i]=False
            res+=pp[i]
    else:
        pp[i]+=1

print(qq.count(False),res)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
pp=[0]*n
qq=[True]*n
for i in range(m):
    i,j=input().split()
    i=int(i)
    i-=1
    if qq[i] and j=="AC":
        qq[i]=False
    if qq[i]:
        pp[i]+=1
ans=0
for i in qq:
    if qq[i]==False:
        ans+=1
print(qq.count(False),ans)
Problem p02882 (python)

Fixed submission:
import math

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

if x/(a**2)/b < 1/2:
    print(180*math.atan((a*b**2)/(2*x))/math.pi)

else:
    print(180*math.atan(2*(a*b-x/a)/(a**2))/math.pi)

Buggy submission (verdict: Runtime Error):

from math import atan,tan,pi
a,b,x = map(int,read().split())

def max_volume(theta):
    
    theta = theta/180*pi
    if theta<atan(b/a):
 
        area = a*b-a*a*tan(theta)/2
    else:
        area = b*(b/tan(theta))/2
    return area*a

left = 0 
right = 90 
while right - left > 1e-7:
    mid = (left+right)/2
    if max_volume(mid) <= x:
        right = mid
    else:
        left = mid

answer = (left+right)/2
print(answer)
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
N, K = map(int, input().split())

e = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    e[a].append(b)
    e[b].append(a)

col = [-1 for i in range(N)]
col[0] = 0
MOD = 10 ** 9 + 7


def dfs(i, ans, depth):
    if depth == 1:
        num = K - 1
    else:
        num = K - 2
    for v in e[i]:
        if col[v] == -1:
            col[v] = 0
            ans = (ans * num) % MOD
            num -= 1
            ans = dfs(v, ans, depth+1)

    return ans


print(dfs(0, K, 1))
Problem p03061 (python)

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
L=[0]
R=[0]
for i in range(n-1):
    L.append(gcd(L[i],a[i]))
    R.append(gcd(R[i],a[-1-i]))
MAX=0
for i in range(n):
    MAX=max(MAX,gcd(L[i],R[-1-i]))
print(MAX)

Buggy submission (verdict: Runtime Error):
from fractions import gcd 
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    ans=max(ans,gcd(a[:i]+a[i+1:]))
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd 
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    ans=max(ans,reduce(gcd,a[:i]+a[i+1:]))
print(ans)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,a+b,2*b-1))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
cnt=0
ans=0
j=0
for i in range(n):
    if s[i]=="0":
        if i==0 or s[i-1]=="1":
            cnt+=1
    if cnt>k:
        while s[j]=="1":
            j+=1
        while s[j]=="0":
            j+=1
        cnt-=1
    ans=max(ans,i-j+1)

print(ans)
Problem p03076 (python)

Fixed submission:
a=0
c=9
for i in range(5):
    b=int(input())
    a+=((b-1)//10+1)*10
    c=min((b-1)%10,c)
print(a-9+c)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for _ in range(5)]
b=0
c=[]
for i in range(5):
    if (b+a[i])%10==0:
        b+=a[i]
    else:
        b+=(a[i]//10+1)*10
for i in range(5):
    if a[i]%10!=0:
        c.append(a[i]%10)
print(b+min(c)-10)

Buggy submission (verdict: Runtime Error):
a=[int(input()) for _ in range(5)]
b=0
c=[]
for i in range(5):
    if (b+a[i])%10==0:
        b+=a[i]
    else:
        b+=(a[i]//10+1)*10
for i in range(5):
    if a[i]%10!=0:
        c.append(a[i]%10)
print(b+min(c)-10)
Problem p03128 (python)

Fixed submission:
n,m=map(int, input().split())
List=list(map(int, input().split()))
d=[0]*n*9+[-1]*n*9
#print(d)
for i in range(1, n+1):
    d[i]=max(d[i-int("0255456376"[a])]*10+a for a in List)
print(d[n])

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
List=list(map(int, input().split()))
#d=[0]*n*9+[-1]*n*9
print(d)
for i in range(1, n+1):
    d[i]=max(d[i-int("0255456376"[a])]*10+a for a in List)
print(d[n])
Problem p03210 (python)

Fixed submission:
x=int(input())
if x==3 or x==5 or x==7:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
def dfs(s):
    if int(s)>n:
        return 0 
    if all(s.count(i) for i in '753'):
        ans=1
    else:
        ans=0
    for i in '753':
        ans+=dfs(s+i)
    return ans
print(ans)
Problem p03238 (python)

Fixed submission:
if int(input()) == 1:
  print('Hello World')
else:
  print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
x=int(input())
y=int(input())
z=int(input())
if x==1:
    print('Hello World')
else:
    print(y+z)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

N, X = map(int,input().split()) 
nums=list(map(int,input().split()))
nums=list(map(lambda i: abs(i - X),nums))
 
D = reduce(gcd, nums)
print(D)

Buggy submission (verdict: Runtime Error):
import math
n,X=map(int,input().split())
z=list(map(int,input().split()))
x=[]
for j in range(n):
        x.append(abs(X-z[j]))
g=x[0]
for i in range(1,n):
        g=math.gcd(g,x[i])
print(g)

Buggy submission (verdict: Runtime Error):
import math
n,X=map(int,input().split())
z=list(map(int,input().split()))
x=[]
for j in range(n):
        x.append(abs(X-z[j]))
g=x[0]
for i in range(1,n):
        g=math.gcd(g,x[i])
print(g)
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print((a-1)*(b-1)
Problem p03359 (python)

Fixed submission:
a,b=map(int,input().split(' '))
if a>b:
    print(a-1)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
num = 55555
input_list = [False if i%2 == 0 or i%3 == 0 or i%5==0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)

for serial in range(3, num, 2):
    if serial >= sqrt:
        break
    for s in range(serial ** 2, num, serial):
        input_list[s] = False

ans = []
count = 0
for i in range(11111):
    if input_list[5*i-1]:
        ans.append(5*i-1)
    if len(ans) == N:
        break

ans2 = ""
for i in range(len(ans)):
    ans2 += str(ans[i])
    if i != len(ans)-1:
        ans2 += " "

print(ans2)
Problem p03372 (python)

Fixed submission:
n,c=map(int,input().split())
xv = list(list(map(int, input().split())) for i in range(n))
vx=xv[::-1]
sushi1, max1, sushi2, max2 = [0], [0], [0], [0]
import numpy as np

sum1,sum2=0,0
for x,v in xv:
        sum1+=v
        sushi1.append(max(sum1 - x, sushi1[-1]))
        max1.append(max(sum1 - 2*x, max1[-1]))
for x, v in vx:
    sum2 += v
    sushi2.append(max(sum2 - (c-x), sushi2[-1]))
    max2.append(max(sum2 - 2*(c-x), max2[-1]))
ans1 = max(np.array(sushi1) + np.array(max2[::-1]))
ans2 = max(np.array(sushi2) + np.array(max1[::-1]))
print(max(0, ans1, ans2))

Buggy submission (verdict: Runtime Error):
n,c=map(int,input().split())
xv = list(list(map(int, input().split())) for i in range(n))
vx=xy[::-1]
sushi1, max1, sushi2, max2 = [0], [0], [0], [0]
import numpy as np

sum1,sum2=0,0
for x,v in xv:
        sum1+=v
        sushi1.append(max(sum1 - x, sushi1[-1]))
        max1.append(max(sum1 - 2*x, max1[-1]))
for x, v in vx:
    sum2 += v
    sushi2.append(max(sum2 - (c-x), sushi2[-1]))
    max2.append(max(sum2 - 2*(c-x), max2[-1]))
ans1 = max(np.array(sushi1) + np.array(max2[::-1]))
ans2 = max(np.array(sushi2) + np.array(max1[::-1]))
print(max(0, ans1, ans2))
Problem p03434 (python)

Fixed submission:

n = input()
a = sorted(map(int, input().split()))
print(abs(sum(a[1::2]) - sum(a[::2])))

Buggy submission (verdict: Runtime Error):
N=int(input())
a = sorted(map(int, input().split()))
print(abs((sum(a[1::2]) - sum(a[::2])))
Problem p03480 (python)

Fixed submission:
S=list(input())
n=len(S)
ans=n
for _ in range(n-1):
	if S[_]!=S[_+1]:
		tmp=max(_+1,n-(_+1))
		ans=min(ans,tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
n=len(s)
ans=n
for i in range(n-1):
    if s[i]!=s[i+1]:
        t=max(i+1,n-(i+1))
        ans=min(asn,t)

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=n
for i in range(n-1):
    if s[i]!=s[i+1]:
        t=max(i+1,n-(i+1))
        ans=min(asn,t)

print(ans)
Problem p03729 (python)

Fixed submission:
x,y,z=map(str,input().split(' '))

if x[len(x)-1]==y[0] and y[len(y)-1]==z[0]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
from fractions import gcd
a,b,c=map(int,input().split())
print("NO"if c%gcd(a,b)!=0else"YES")
Problem p03730 (python)

Fixed submission:
a,b,c=map(int,input().split())
ans='NO'
for i in range(b):
    if (a*i-c)%b==0:
        ans='YES'
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
a,b,c=map(int,input().split())
print("NO"if c%gcd(a,b)!=0　else"YES")
Problem p03759 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("YES"if b-a==c-b else "NO")

Buggy submission (verdict: Runtime Error):
x,y,z=map(str,input().split(' '))
if y-x==z-y:
    print('YES')
else:
    print('NO')
Problem p03813 (python)

Fixed submission:
x=int(input())
if x<1200:
    print('ABC')
else:
    print('ARC')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
q = len(set(A))
if q % 2 == 0:
    print(q - 1)
else:
    print(q)
Problem p03846 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
mod = 10**9+7
if n % 2 == 0 and len(set(l)) == n//2:
  print(2**(n//2)%mod)
elif not n % 2 == 0 and l.count(0) == 1:
  print(2**((n-1)//2)%mod)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
mod = 10**9+7
if n % 2 == 0 and len(set(l)) == n/2:
  print(int(2**(n/2)%mod))
elif not n % 2 == 0 and l.count(0) == 1:
  print(int(2**((n-1)/2)%mod))
else:
  print(0)
Problem p03946 (python)

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

sa=0
ans=1

n=k[a-1]

for i in range(a-2,-1,-1):
    if k[i]>n:
        n=k[i]
    tmp=n-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

print(ans)

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
a=list(map(int,input().split()))
c=[]
d=[0]*(10**5)
if a[0]<a[1]:
    c.append([a[0],0])
else:
    d[0]=a[0]
for i in range(1,n-1):
    if a[i]>a[i+1] and a[i-1]<a[i]:
        d[i]=a[i]
    if a[i]<a[i+1] and a[i-1]>a[i]:
        c.append([a[i],i])
d[n-1]=a[n-1]
e=[0]*(10**5)
for i in c:
    E=max(d[i[1]:])-i[0]
    e[E]+=1
print(max(e))

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

a=list(map(int,input().split()))
c=[]
d=[0]*(10**5)
if a[0]<a[1]:
    c.append([a[0],0])
else:
    d[0]=a[0]
for i in range(1,n-1):
    if a[i]>a[i+1] and a[i-1]<a[i]:
        d[i]=a[i]
    if a[i]<a[i+1] and a[i-1]>a[i]:
        c.append([a[i],i])
d[n-1]=a[n-1]
e=[0]*(10**5)
for i in c:
    E=max(d[i[1]:])-i[0]
    e[E]+=1
print(max(e))

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

a=list(map(int,input().split()))
c=[]
d=[0]*(10**5)
if a[0]<a[1]:
    c.append([a[0],0])
else:
    d[0]=a[0]
for i in range(1,n-1):
    if a[i]>a[i+1] and a[i-1]<a[i]:
        d[i]=a[i]
    if a[i]<a[i+1] and a[i-1]>a[i]:
        c.append([a[i],i])
d[n-1]=a[n-1]
e=[0]*(10**5)
for i in c:
    E=max(d[i[1]:])-i[0]
    e[E]+=1
print(max(e))
Problem p03963 (python)

Fixed submission:
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
print(K*(K-1)**(N-1)
Problem p02641 (python)

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

ans = x
if ans in lst:
    pass
else:
    print(ans)
    exit()

left,right = ans-1,ans+1

while True:
    if left in lst and right in lst:
        left -=1
        right += 1

    elif left in lst:
        print(right)
        exit()

    else:
        print(left)
        exit()

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
lst = list(map(int,input().split()))
ans = lst[0]

for e in lst:
  if abs(e-n) < abs(e-ans):
    ans = e
   
  elif abs(e-n) == abs(e-ans):
    ans = min(e,ans)
    
  else:
    pass
  
print(ans)
Problem p02924 (python)

Fixed submission:
n = int(input())
ans = n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
def print_kaijou(k):
    print(str(int(k*(k+1)/2)))

n = int(input())


    
print_kaijou(n-1):
Problem p02945 (python)

Fixed submission:
a,b=list(map(int,input().split()))
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
def return_sorted_string(string):
    lst=list(map(ord,list(string)))
    lst.sort()
    lst=list(map(chr,lst))
    string="".join(lst)
    return string
    



n = int(input())
strings=[input() for i in range(n)]
dic={}
for i in range(n):
    string=return_sorted_string(strings[i])
    if string in dic:
        dic[string]+=1
    else:
        dic[string]=1

count=0        

for i in dic.values():
    count += i*(i-1)/2


print(int(count))
Problem p02952 (python)

Fixed submission:
n = int(input())

if 1 <= n <= 99:
    print(min(n,9))
elif 100<= n <= 9999:
    print(min(n-90,909))
else:
    print(min(90909,n-10000+910))

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

if 1 <= n <= 99:
    print(min(n,9))
elif 100<= n <= 9999:
    print(min(n-90,910))
elif:
    print(n-9080)
Problem p02953 (python)

Fixed submission:
import sys
n = int(input())
lst=list(map(int,input().split()))
lst.append(10**9+1)

count = 0
for i in range(n):
 
    if lst[i+1]-lst[i]==-1:#1さがったとき
        if count==0:
            count=-1
            continue
        else:#count=-1
            print("No")
            sys.exit()
    elif lst[i]==lst[i+1]:#おなじとき
        continue
        
    elif lst[i]<lst[i+1]:#上がったとき
        count = 0
        continue
    
    else:#2以上下がったとき
        print("No")
        sys.exit()
        


print("Yes")

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

differences=[]
for i in range(1,n):
    if lst[i]-lst[i-1]==0:#0はリストに加えず,-1の連続の有無のみを調べる
        continue
    elif lst[i]-lst[i-1]<=-2:#階差数列に-2以下が出てくればアウト
        print("No")
        sys.exit()
    else:differences.append(lst[i]-lst[i-1])

    
for i in range(len(differences)-1):#-1の連続があればアウト
    if differences[i]==-1 and differences[i+1]==-1:
        print("No")
        sys.exit()
 
 
print("Yes")
Problem p03000 (python)

Fixed submission:
#coding:utf-8
n,x= map(int,input().split())
L = list(map(int,input().split()))


coordinate=0
ans = 1
for e in L:
    if coordinate+e<=x:
        ans+=1
        coordinate+=e
    else:
        break

print(ans)

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


coordinate=0
for i in range(len(L)):
    coordinate+=L[i]
    if coordinate>x or i==len(L):
        ans = i+1
        break
    
print(ans)

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


coordinate=0
for i in range(len(L)):
    coordinate+=L[i]
    if coordinate>x:
        ans = i+1
        break
    
print(ans)

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


coordinate=0
i=0
while(coordinate<=x):
    coordinate+=L[i]
    i+=1

print(i)
Problem p03032 (python)

Fixed submission:
from collections import deque

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

for toridasukaisu in range(min(k,n)+1):#0~min(k,n)回取り出す
    for i in range(toridasukaisu+1):
        value = []#取り出したもののそれぞれの価値
        l = i#左からi回取り出し
        r = toridasukaisu - i#右から取り出す回数-i回取り出す
        for j in range(l):
            value.append(D[j])
        for j in range(r):
            value.append(D[-1-j])

        value.sort()
        suterukazu = 0
        suterukaisu = k - toridasukaisu
        for e in value:
            if suterukazu >= suterukaisu:
                break
            if e < 0:
                suterukazu += 1
            
        ans = max(sum(value[suterukazu:]),ans)
        
print(ans)

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

n,k = map(int,input().split())
D =map(int,input().split())
ans = 0

for toridasukaisu in range(min(k,n)+1):#0~min(k,n)回取り出す
    for i in range(toridasukaisu+1):
        value = []#取り出したもののそれぞれの価値
        l = i#左からi回取り出し
        r = toridasukaisu - i#右から取り出す回数-i回取り出す
        for j in range(l):
            value.append(D[j])
        for j in range(r):
            value.append(D[-1-j])

        value.sort()
        suterukazu = 0
        suterukaisu = k - toridasukaisu
        for e in value:
            if suterukazu >= suterukaisu:
                break
            if e < 0:
                suterukazu += 1
            
        ans = max(sum(value[suterukazu:]),ans)
        
print(ans)
Problem p03035 (python)

Fixed submission:
age,yen = map(int,input().split())
if age>=13:
    print(yen)
elif 6<=age<=12:
    print(yen//2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):

r,d,x2000 = map(int,input().split())


for i in range(10):
    if i == 0:
        ans = r*x2000-d
    else:
        ans = r*ans-d
    print(ans)
Problem p02727 (python)

Fixed submission:
x, y ,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

list.sort(p,reverse=True)
list.sort(q,reverse=True)
list.sort(r,reverse=True)

mazemaze =p[:x]+q[:y]+r
list.sort(mazemaze, reverse=True)
print(sum(mazemaze[:x+y]))

Buggy submission (verdict: Runtime Error):
x, y ,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

list.sort(p,reverse=True)
list.sort(q,reverse=True)
list.sort(r,reverse=True)
ans = 0
nokorix = x
nokoriy = y
pin =0
qin=0
rin=0
for i in range(x+y):
    c=0
    if nokorix !=0:
        if p[pin]>= max(q[qin],r[rin]):
            ans+=p[pin]
            nokorix -=1
            pin +=1
            c+=1
    if nokoriy != 0:
        if q[qin] >=max(p[pin], r[rin]):
            ans+=q[qin]
            nokoriy -=1
            qin +=1
            c+=1
    if c==0 and (nokorix!=0 or nokoriy!=0):
        if q[qin] >= p[pin] and p[pin]<=r[rin]:
            ans+=r[rin]
            nokorix -=1
            qin+=1
        elif p[pin] >=q[qin] and q[qin] <=r[rin] :
            ans+=r[rin]
            nokoriy-=1
            qin+=1      

print(ans)