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

Fixed submission:
def main():
    a,b,k = map(int,input().split())
    if a >= k:
        a-=k
    else:
        b -= (k - a)
        a = 0
        if b < 0:
            b = 0
    print(str(a)+" "+str(b))
main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b,k = map(int,input().split())
    if a >= k:
        a-=k
    else:
        b -= (k - a)
        a = 0
        if b < 0:
            b = 0
    print(str(A)+" "+str(B))
main()
Problem p03854 (python)

Fixed submission:
import sys
msg = str(input())

# 逆から、大きい文字数から、見ていけば重複は生じない
len_l1 = 0
while len(msg) != len_l1:
    len_l1 = len(msg)
    
    # dreamer
    if msg[-7:] == "dreamer":
        msg = msg[:-7]
    # eraser
    if msg[-6:] == "eraser":
        msg = msg[:-6]
        
    # dreame
    if msg[-5:] == "dream":
        msg = msg[:-5]
    # erase
    if msg[-5:] == "erase":
        msg = msg[:-5]
        
    if len(msg) == 0:
        print('YES')
        sys.exit()    
    
print('NO')

Buggy submission (verdict: Runtime Error):
import sys
msg = str(input())

# 逆から、大きい文字数から、見ていけば重複は生じない
len_l1 = 0
while len(msg) != len_l1:
    len_l1 = len(msg)
    print(msg)
    
    # dreamer
    if msg[-7:] == "dreamer":
        msg = msg[:-7]
    # eraser
    if msg[-6:] == "eraser":
        msg = msg[:-6]
        
    # dreame
    if msg[-5:] == "dream":
        msg = msg[:-5]
    # erase
    if msg[-5:] == "erase":
        msg = msg[:-5]
        
    if len(msg) == 0:
        print('YES')
        sys.exit()    
    
print('NO')
Problem p02675 (python)

Fixed submission:
N = int(input())

if N % 10 in [2,4,5,7,9]:
    print('hon')
elif N % 10 in [0,1,6,8]:
    print('pon')
elif N % 10 in [3]:
    print('bon')

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

if K >= len(S):
    print(S)
elif K < len(S):
    print(S[0:K]+'...')
Problem p02789 (python)

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

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

if N = M:
    print('Yes')
else:
    print('No')
Problem p02801 (python)

Fixed submission:
C = input()
abc = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(str(abc))):
    if abc[i] == C:
        print(abc[i+1])

Buggy submission (verdict: Runtime Error):
c = input()
abc = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(str(abc))):
    if abc[i] = c:
        print(abc[i+1])
Problem p02811 (python)

Fixed submission:
a = list(map(int, input().split()))
K = a[0]
X = a[1]

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

Buggy submission (verdict: Runtime Error):
input()
print(input().count('ABC'))
Problem p02602 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
    print("Yes")if a[i]<a[k+i] else print("No")

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
A = list(map(int, input().split()))
num = 1
num_b = None
data = []
for j in range(K):
    for t in range(j, j+3):
        num = num*A[t]
    data.append(num)
    num_b = num
    num = 1
for i in range(N - K):
    if data[i+1] > data[i]:
        print("Yes")
    elif data[i+1] <= data[i]:
        print("No")
Problem p02988 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    if a[i-1]<a[i] and a[i]<a[i+1]:
        cnt+=1
    elif a[i-1]>a[i] and a[i]>a[i+1]:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    if a[i-1]<a[i] and a[i]<a[i+1]:
        cnt+=1
    elif a[i-1]>a[i] and a[i]>a[i+1]:
        cnt+=1py
print(cnt)
Problem p02993 (python)

Fixed submission:
a=input()
cnt=0
for i in range(3):
    if a[i]==a[i+1]:
        cnt+=1
print("Good" if cnt==0 else "Bad")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
import fractions
nc=math.floor((b-a)/c)
nd=math.floor((b-a)/d)
lcd=c*d//fractions.gcd(c,d)
ncd=math.floor((b-a)/lcd)
sum=nc+nd-ncd
print(b-a-sum)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import fractions
import math
nc=math.floor(b/c)-math.ceil(a/c)+1
nd=math.floor(b/d)-math.ceil(a/d)+1
min=c*d/fractions.gcd(c,d)
ncd=math.floor(b/min)-math.ceil(a/min)+1
print(b-a+1-(nc+nd-ncd))
Problem p02995 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
import fractions
import math
nc=b//c-(a-1)//c
nd=b//d-(a-1)//d
min=c*d//fractions.gcd(c,d)
ncd=b//min-(a-1)//min
print(b-a+1-(nc+nd-ncd))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
import fractions
nc=math.floor((b-a)/c)
nd=math.floor((b-a)/d)
lcd=c*d//math.gcd(c,d)
ncd=math.floor((b-a)/lcd)
sum=nc+nd-ncd
print(b-a-sum)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
nc=math.floor(b/c)-math.ceil(a/c)+1
nd=math.floor(b/d)-math.ceil(a/d)+1
min=c*d/math.gcd(c,d)
ncd=math.floor(b/min)-math.ceil(a/min)+1
print(b-a+1-(nc+nd-ncd))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
nc=math.floor(b/c)-math.ceil(a/c)+1
nd=math.floor(b/d)-math.ceil(a/d)+1
min=c*d//math.gcd(c,d)
ncd=math.floor(b/min)-math.ceil(a/min)+1
print(b-a+1-(nc+nd-ncd))
Problem p03062 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
sum=0
c=0
for i in range(n):
  if a[i]<0:
    a[i]=a[i]*-1
    c=c+1
  sum=sum+a[i]
if c%2==0:
  print(sum)
else:
  print(sum-min(a)*2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(int,input())
sum=0
c=0
for i in range(n):
  if a[i]<0:
    a[i]=a[i]*-1:
      c=c+1
  sum=sum+a[i]
  if c%2==0:
    print(sum)
  else:
    print(sum-min(a)*2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(int,input())
sum=0
c=0
for i in range(n):
  if a[i]<0:
    a[i]=a[i]*-1:
      c=c+1
  sum=sum+a[i]
  if c%2==0:
    print(sum)
  else:
    print(sum-min(a*2))
Problem p03067 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<b:
  if a<c and b>c:
    print("Yes")
  else:
    print("No")
else:
  if a>c and b<c:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int.input().split())
if a<=c and b>=c:
  print("Yes")
else:
  print("No")
Problem p03069 (python)

Fixed submission:
from collections import deque
n=int(input())
s=input()
black=0
write=s.count(".")
koho=deque([write,s.count("#")])
for i in s:
    if i==".":
        write-=1
    else:
        black+=1
    koho.append(write+black)
print(min(koho))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if s[0]==".":
  k[0]="."
  k[1]="#"
else:
  k[0]="#"
  k[1]="."
  
for i in range(n):
  if s[i]!=k[i%2]:
    s[i]=k[i%2]
print(s)
Problem p03079 (python)

Fixed submission:
A,B,C=map(int,input().split())
if A==B and A==C:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if A==B&&A==C:
  print("Yes")
else:
  print("No")
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
l, r = map(int, input().split())
print(t[r-1] - t[l-1])
Problem p03105 (python)

Fixed submission:
import math
A,B,C=map(int,input().split())
can=math.floor(B/A)
if can>=C:
  print(C)
else:
  print(can)

Buggy submission (verdict: Runtime Error):
a=[0,0]
s=[]
a[0],a[1],k=map(int,input().split())
for i in range(1,min(a)+1):
  if a[0]%i==0 and a[1]%i==0:
    s.append(i)
print(s[len(s)-k])
Problem p03106 (python)

Fixed submission:
a=[0,0]
s=[]
a[0],a[1],k=map(int,input().split())
for i in range(1,min(a)+1):
  if a[0]%i==0 and a[1]%i==0:
    s.append(i)
print(s[len(s)-k])

Buggy submission (verdict: Runtime Error):
a=[0,0]
s=[]
a[0],a[1],k=map(int,input().split())
for i in range(1,max(a)):
  if a[0]%i==0 and a[1]%i==0:
    s.append(i)
print(s[k-1])

Buggy submission (verdict: Runtime Error):
a=[]
s=[]
a[0],a[1],k=map(int(input().split()))
for i in range(max(a)):
  if a[0]%i==0 and a[1]%i==0:
    s.append(i)
print(s[k])
Problem p03110 (python)

Fixed submission:
n=int(input())
a=[]
sum=0
for i in range(n):
  a.append(list(input().split()))
  if a[i][1]=="BTC":
    sum+=float(a[i][0])*380000.0
  else:
    sum+=int(a[i][0])
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
sum=0
for i in range(n):
  a.append(list(map(int,input().split())))
  if a[i][1]=="BTC":
    sum+=a[i][0]*380000.0
  else:
    sum+=a[i][0]
print(sum)
Problem p03219 (python)

Fixed submission:
a,b=map(int,input().split())
print(int(a+(b/2)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
printint((a+(b/2)))
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=[int(i) for i in input().split()]
h=[t-int(i)*0.006 for i in input().split()]
ans=0
for i in range(n):
  if abs(a-h[i])<abs(a-h[ans]):
    ans=i
print(ans+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=[int(i) for i in input().split()]
h=[t-int(i)*0.006 for i in input().split()]
ans=0
for i in range(n):
  if abs(A-h[i])<abs(A-h[ans]):
    ans=i
print(ans+1)
Problem p03239 (python)

Fixed submission:
n,T=[int(i) for i in input().split()]
ans=[]
for i in range(n):
  c,t=[int(i) for i in input().split()]
  if t<=T:
    ans.append(c)
print(min(ans) if len(ans)!=0 else "TLE")

Buggy submission (verdict: Runtime Error):
n,T=[int(i) for i in input().split()]
ans=[]
for i in range(n):
  c,t=[int(i) for i in input().split()]
  if t<=T:
    ans.append(c)
print(min(ans) if len(c)!=0 else "TLE")
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
print("Yes" if (abs(b-a)<=d and abs(c-b)<=d) or abs(c-a)<=d else "No" )

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
ans=[]
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        ans.append(s[i:j])
ans.sort()
a=[ans[0]]
for i in range(1,len(ans)):
    if ans[i-1]!=ans[i]:
        a.append(ans[i])
print(a[k-1])

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print("Yes" (b-a<=d and c-b<=d) or c-a<=d else "No" )

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print("Yes" b-a<=d and c-b<=d or c-a<=d else "No" )

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print("Yes" b-a<=d and c-b<=d else "No" )
Problem p03385 (python)

Fixed submission:
a=list(input())
print("Yes" if a[0]!=a[1] and a[0]!=a[2] and a[1]!=a[2] else "No")

Buggy submission (verdict: Runtime Error):
a=list(input().split())
print("Yes" if a[0]!=a[1] and a[0]!=a[2] and a[1]!=a[2] else "No")
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a+b>=c else "No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if("Yes" if a+b>=c else "No")
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
print("Yes" if (n%500)<=a else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print("Yes" if (N%500)<=a else "No")
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
print("Even" if (a*b)%2==0 else "Odd")

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

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

Fixed submission:
s=input()
c=""
for i in range(len(s)):
  if i==3:
    c+="8"
  else:
    c+=s[i]
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
s[3]="8"
Problem p03543 (python)

Fixed submission:
a=input()
if a[0]==a[1] and a[1]==a[2] or a[1]==a[2] and a[2]==a[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
if a[0]==a[1] and a[1]==a[2] || a[1]==a[2] and a[2]==a[3]:
  print("Yes")
else:
  print("No")
Problem p03555 (python)

Fixed submission:
a=input()
b=input()
print("YES" if a[0]==b[2] and a[1]==b[1] and a[2]==b[0] else "NO")

Buggy submission (verdict: Runtime Error):
a=input().split()
b=input().split()
print("YES" if a[0]==b[2] and a[1]==b[1] and a[2]==b[0] else "NO")
Problem p03643 (python)

Fixed submission:
print("ABC"+input())

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for j in range(m)]
a.sort(key=lambda x:x[1])
a.sort(key=lambda x:x[0])
cc=0
for i in range(m):
    if a[i][0]==1:
        for j in range(i,m):
            if a[i][1]==a[j][0] and a[j][1]==n:
                cc=1
                break
    if cc==1:
        break
print("POSSIBLE" if cc==1 else "IMPOSSIBLE")
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%3==0 or b%3==0 (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a//3==0 or b//3==0 (a+b)//3==0:
  print("Possible")
else:
  print("Impossible")
Problem p03711 (python)

Fixed submission:
d=[0,0,1,0,2,0,2,0,0,2,0,2,0]
a,b=map(int,input().split())
if d[a]==d[b]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d=[0,1,0,2,0,2,0,0,2,0,2,0]
a,b=map(int,input().split())
if d[a]==d[b]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d=[0,1,0,2,0,2,0,0,2,0,2,0]
a,b=map(int,input().split())
if d[a]==d[b]:
  print("Yes")
else:
  print("No")
Problem p03729 (python)

Fixed submission:
a=input().split()
print("YES" if a[0][len(a[0])-1]==a[1][0] and a[1][len(a[1])-1]==a[2][0] else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
if("YES" if a[len(a)-1]==b[0] and b[len(b)-1]==c[0] else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split())
if("YES" if a[len(a)-1]==b[0] and b[len(b)-1]==c[0] else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if("YES" if a[len(a)-1]==b[0] and b[len(b)-1]==c[0] else "NO")

Buggy submission (verdict: Runtime Error):
a=input().split()
if("YES" if a[0][len(a[0])-1]==a[1][0] and a[1][len(a[1])-1]==a[2][0] else "NO")
Problem p03943 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print("Yes" if a[0]+a[1]==a[2] else "No")

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
a.sort()
print("Yes" if a[0]+a[1]==a[2] else "No")
Problem p03962 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print(1 if a[0]==a[2] else 2 if a[0]==a[1] or a[1]==a[2] else 3)

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
a.sort()
print(1 if a[0]==a[2] else 2 if a[0]==a[1] or a[1]==a[2] else 3)
Problem p02600 (python)

Fixed submission:
X = int(input())
rate_sec = [i*200+600 for i in range(8)]

for key, value in enumerate(rate_sec):
    if X < value:
        print(8-key)
        break

Buggy submission (verdict: Runtime Error):
X = int(input())
for key, value in enumerate(rate_sec):
    if X < value:
        print(8-key)
        break
Problem p02608 (python)

Fixed submission:
import numpy as np
 
N = int(input())
 
output = np.zeros(N)
 
for x in range(1,int(np.sqrt(N))+1):
    for y in range(1,x+1):
        if x**2 + y**2 + x*y > N:
            break
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))

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

N = int(input())

output = np.zeros(N)

for x in range(1,int(np.sqrt(N-2))+1):
    for y in range(1,x+1):
        if x**2 + y**2 + x*y > N:
            break
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))

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

N = int(input())

output = np.zeros(N)

for x in range(1,int(np.sqrt(N-2))+1):
    for y in range(1,x+1):
        for z in range(1,y+1):
            index = x**2 + y**2 + z**2 + x*y + y*z + z*x
            
            if index > N:
                break
            
            dup = len(set([x,y,z]))
            
            if dup == 3:
                output[index-1] += 6
            elif dup == 2:
                output[index-1] += 3
            elif dup == 1:
                output[index-1] += 1
                
for i in range(N):
    print(int(output[i]))
Problem p02630 (python)

Fixed submission:
#%%
N = int(input())
L = [int(i) for i in input().split()]
Q = int(input())
order = [[] for _ in range(Q)]

for i in range(Q):
    order[i] = [int(i) for i in input().split()]
#%%
cnt = {}
for i in L:
    if i in cnt:
        cnt[i] += 1
        
    else:
        cnt[i] = 1

ans = [sum(L)]
for i in order:
    if i[0] not in cnt:
        print(ans[-1])
        continue
    temp = cnt[i[0]] * (i[1] - i[0])
    ans.append(temp + ans[-1])
    print(ans[-1])
    
    if i[1] in cnt:
        cnt[i[1]] += cnt[i[0]]
    else:
        cnt[i[1]] = cnt[i[0]]

    del cnt[i[0]]

Buggy submission (verdict: Runtime Error):
#%%
N = int(input())
L = [int(i) for i in input().split()]
Q = int(input())
order = [[] for _ in range(Q)]
for i in range(Q):
    order[i] = [int(i) for i in input().split()]
#%%
cnt = {}
for i in L:
    if i in cnt:
        cnt[i] += 1
        
    else:
        cnt[i] = 1

ans = [sum(L)]
for i in order:
    temp = cnt[i[0]] * (i[1] - i[0])
    ans.append(temp + ans[-1])
    print(ans[-1])
    
    if i[1] in cnt:
        cnt[i[1]] += cnt[i[0]]
    else:
        cnt[i[1]] = cnt[i[0]]

    del cnt[i[0]]
Problem p02683 (python)

Fixed submission:
import numpy as np

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(N):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(M + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, M + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)

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

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(N):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(N + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, N + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)

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

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(M):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(N + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, N + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)
Problem p02767 (python)

Fixed submission:
import numpy as np
N = int(input())
X = np.array([int(i) for i in input().split()])

ans = []
for i in range(0, max(X)+1):
    ans.append(sum((X - i)**2))
    
print(min(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
X = np.array([int(i) for i in input().split()])

ans = []
for i in range(1, max(X)):
    ans.append(sum((X - i)**2))
    
print(min(ans))
Problem p02780 (python)

Fixed submission:
def func(x):
    return (x+1)/2
N, K = [int(i) for i in input().split()]
P = [func(int(i)) for i in input().split()]

# 累積和
A = [0]
for i in P:
    A.append(A[-1]+i)

ans = []
for i in range(K, N+1):
    ans.append(A[i] - A[i-K])
    
print(max(ans))

Buggy submission (verdict: Runtime Error):
def func_d(n):
    if n == 1:
        return 1
    else:
        return n + func_d(n-1)

N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]

hp = []
for i in P:
    hp.append(func_d(i)/i)
    
A= [0]
for i in hp:
    A.append(A[-1]+i)
 
ans = []
for i in range(K, N+1):
    ans.append(A[i] - A[i-K])
    
print(max(ans))

Buggy submission (verdict: Runtime Error):
# 期待値
def func_d(n):
    if n == 1:
        return 1
    else:
        return n + func_d(n-1)

N, K = [int(i) for i in input().split()]
P = [func_d(int(i))/int(i) for i in input().split()]

# 累積和
A = [0]
for i in P:
    A.append(A[-1]+i)
    
ans = []
for i in range(N-K+1):
    ans.append(A[i+K]-A[i])
print(max(ans))

Buggy submission (verdict: Runtime Error):
# 期待値
def func_d(n):
    if n == 1:
        return 1
    else:
        return n + func_d(n-1)

N, K = [int(i) for i in input().split()]
P = [func_d(int(i))/int(i) for i in input().split()]

# 累積和
A = [0]
for i in P:
    A.append(A[-1]+i)

ans = []
for i in range(K, N+1):
    ans.append(A[i] - A[i-K])
    
print(max(ans))

Buggy submission (verdict: Runtime Error):
# 期待値
def func_d(n):
    if n == 1:
        return 1
    else:
        return n + func_d(n-1)

N, K = [int(i) for i in input().split()]
P = [func_d(int(i))/int(i) for i in input().split()]

# 累積和
A = [0]
for i in range(0, N):
    A.append(P[i]+A[i])

ans = []
for i in range(K, N):
    ans.append(A[i] - A[i-K])
    
print(max(ans))

Buggy submission (verdict: Runtime Error):
# 期待値
def func_d(n):
    if n == 1:
        return 1
    else:
        return n + func_d(n-1)

N, K = [int(i) for i in input().split()]
P = [func_d(int(i))/int(i) for i in input().split()]

# 累積和
A = [0]
for i in range(0, N):
    A.append(P[i]+A[i])

ans = []
for i in range(K, N+1):
    ans.append(A[i] - A[i-K])
    
print(max(ans))

Buggy submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
P = [int(i) for i in input().split()]

# 期待値
def func_d(n):
    if n == 1:
        return 1
    else:
        return n + func_d(n-1)

AA = []
for i in P:
    AA.append(func_d(i)/i)

# 累積和
A = [0]
for i in range(0, N):
    A.append(AA[i]+A[i])

ans = []
for i in range(K, N+1):
    ans.append(A[i] - A[i-K])
    
print(max(ans))