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

Fixed submission:
import sys

#from scipy.misc import comb #scipy.special

#import numpy as np

def choose(n):
    return n*(n-1)/2

n = int(input())

a = [int(i) for i in input().split()]

bunpu = [0]*(n+1)

for i in range(len(a)):
    bunpu[a[i]]+=1


sum = 0
for i in bunpu:
    sum+=choose(i)
i = 0
for i in a:
    print(int(sum-choose(bunpu[i])+choose(bunpu[i]-1)))

Buggy submission (verdict: Runtime Error):
import sys

from scipy.misc import comb #scipy.special

#import numpy as np

n = int(input())

a = [int(i) for i in input().split()]

dict = {}

asort = sorted(a)

#print(asort)

sum = 0
i = 0
while i < n-1:
    counter = 1
    index = asort[i]
    while  i < n-1 and asort[i] == asort[i+1]:
        #print("yes")
        counter +=1
        i+=1
    #print("no")
    i+=1
    dict[(index)] = [counter,comb(counter,2),comb(counter-1,2)]
    sum+=dict[(index)][1]




for i in a:
    print(int(sum-dict[(i)][1]+dict[(i)][2]))

Buggy submission (verdict: Runtime Error):
import sys

from scipy.special import comb #scipy.special

#import numpy as np

n = int(input())

a = [int(i) for i in input().split()]

dict = {}

asort = sorted(a)

#print(asort)

sum = 0
i = 0
while i < n-1:
    counter = 1
    index = asort[i]
    while  i < n-1 and asort[i] == asort[i+1]:
        #print("yes")
        counter +=1
        i+=1
    #print("no")
    i+=1
    dict[(index)] = [counter,comb(counter,2),comb(counter-1,2)]
    sum+=dict[(index)][1]




for i in a:
    print(int(sum-dict[(i)][1]+dict[(i)][2]))

Buggy submission (verdict: Runtime Error):
import sys

from scipy.special import comb

#import numpy as np

n = int(input())

a = [int(i) for i in input().split()]

num = [[-1,0,0]]*(200000)

asort = sorted(a)

#print(asort)

sum = 0
i = 0
while i < n-1:
    counter = 1
    index = asort[i]
    while  i < n-1 and asort[i] == asort[i+1]:
        #print("yes")
        counter +=1
        i+=1
    #print("no")
    i+=1
    num[index] = [counter,comb(counter,2),comb(counter-1,2)]
    sum+=num[index][1]




for i in a:
    print(int(sum-num[i][1]+num[i][2]))

Buggy submission (verdict: Runtime Error):
import sys

from scipy.special import comb

#import numpy as np

n = int(input())

a = [int(i) for i in input().split()]

num = [[-1,0,0]]*(200000)

asort = sorted(a)

#print(asort)

i = 0
while i < n-1:
    counter = 1
    index = asort[i]
    while  i < n-1 and asort[i] == asort[i+1]:
        #print("yes")
        counter +=1
        i+=1
    #print("no")
    i+=1
    num[index] = [counter,comb(counter,2),comb(counter-1,2)]

sum=0
for i in range(200000):
    sum +=num[i][1]

for i in a:
    print(int(sum-num[i][1]+num[i][2]))
Problem p03035 (python)

Fixed submission:
a,b=(int(i) for i in input().split())
#外側はタプルを表してるんだね。
#a,b = int(input()),int(input())

if 6<=a<=12 :
    ans = b/2

elif 6 > a :
    ans = 0

else :
    ans = b

print(int(ans))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
#a,b = int(input()),int(input())

if 6<=a<=12 :
    ans = b/2

elif 6 > a :
    ans = 0

else :
    ans = b

print(ans)

Buggy submission (verdict: Runtime Error):
"""a=int(input())
b=int(input())"""
a,b = int(input()),int(input())

if 6<=a<=12 :
    ans = b/2

elif 6 > a :
    ans = 0

else :
    ans = b

print(ans)
Problem p03436 (python)

Fixed submission:
H, W = map(int, input().split())
graph = []
for _ in range(H):
    graph.append(input())

dist = [[0 for _ in range(W)] for _ in range(H)]

que = [[0, 0]]
distance = 0
while len(que) > 0:
    h, w = que.pop(0)
    if h == H - 1 and w == W - 1:
        distance = dist[h][w]
        break
    for a, b in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
        ht, wt = h + a, w + b
        if 0 <= ht < H and 0 <= wt < W and graph[ht][wt] == "." and dist[ht][wt] == 0:
            dist[ht][wt] = dist[h][w] + 1
            que.append([ht, wt])

if distance == 0:
    print(-1)
    exit()

total = W * H - 1
for g in graph:
    total -= g.count("#")
print(total - distance)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
graph = []
for _ in range(H):
    graph.append(input())

dist = [[0 for _ in range(W)] for _ in range(H)]

que = [[0, 0]]
distance = 0
while True:
    h, w = que.pop(0)
    if h == H - 1 and w == W - 1:
        distance = dist[h][w]
        break
    for a, b in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
        ht, wt = h + a, w + b
        if 0 <= ht < H and 0 <= wt < W and graph[ht][wt] == "." and dist[ht][wt] == 0:
            dist[ht][wt] = dist[h][w] + 1
            que.append([ht, wt])

total = W * H - 1
for g in graph:
    total -= g.count("#")
print(total - distance)
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
char_list=list(s)
k=int(input())
for i in range(n):
	if(char_list[k-1]!=char_list[i]):
  		char_list[i] = "*"
str = ''.join(char_list)
print(str)

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  int n,k;
  string s;
  cin >> n >> s >> k;
  
  for(int i=0;i<n;i++){
    if(s[k-1]!=s[i]){
      s[i] = '*';
  }
  }
  cout << s << endl;
  return 0;
}
Problem p03166 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10**9)

def dfs(n,arr,visited):
    for i in graph[n]:
        if visited[i]==False:
            arr[n]=max(arr[n],dfs(i,arr,visited)+1)
            visited[i]=True
        else:
            arr[n]=max(arr[n],arr[i]+1)
    return arr[n]

n,m=map(int,input().split())

graph=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    if a!=b:
        graph[a-1].append(b-1)

visited=[False for i in range(n)]

arr=[0 for i in range(n)]

for i in range(n):
    if visited[i]==False:
        dfs(i,arr,visited)
print(max(arr))

Buggy submission (verdict: Runtime Error):
def dfs(n,arr,visited):
    for i in graph[n]:
        if visited[i]==False:
            arr[n]=max(arr[n],dfs(i,arr,visited)+1)
            visited[i]=True
        else:
            arr[n]=max(arr[n],arr[i]+1)
    return arr[n]

n,m=map(int,input().split())

graph=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    if a!=b:
        graph[a-1].append(b-1)

visited=[False for i in range(n)]

arr=[0 for i in range(n)]

for i in range(n):
    if visited[i]==False:
        dfs(i,arr,visited)
print(max(arr))

Buggy submission (verdict: Runtime Error):
def dfs(n,arr,visited):
    for i in graph[n]:
        if visited[i]==False:
            arr[n]=max(arr[n],dfs(i,arr,visited)+1)
            visited[i]=True
        else:
            arr[n]=max(arr[n],arr[i]+1)
    return arr[n]

n,m=map(int,input().split())

graph=[[] for i in range(n)]

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

visited=[False for i in range(n)]

arr=[0 for i in range(n)]

for i in range(n):
    if visited[i]==False:
        dfs(i,arr,visited)
print(max(arr))
Problem p03170 (python)

Fixed submission:
n,k=map(int,input().split())
arr=[int(i) for i in input().split()]
dp=[0 for i in range(k+1)]
for i in range(1,k+1):
    for j in range(n):
        if arr[j]<=i and dp[i-arr[j]]==0:
            dp[i]=1
if dp[k]==1:
    print("First")
else:
    print("Second")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
arr=[int(i) for i in input().split()]
dp=[[0 for i in range(k+1)] for j in range(n+1)]
for i in range(1,n+1):
    for j in range(1,k+1):
        if arr[i-1]<=j:
            temp=0
            if dp[i][j-arr[i-1]]==0:
                temp=1
            dp[i][j]=temp
            else:
                dp[i][j]=dp[i-1][j]
if dp[n][k]==1:
    print("First")
else:
    print("Second")
Problem p02743 (python)

Fixed submission:
#パナソニックプロ2020
a,b,c=map(int,input().split())
if c-a-b<=0:
    print('No')
elif 4*a*b< (c-a-b)**2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#パナソニックプロ2020
a,b,c=map(int,input().split())
if 4*a*b< (c-a-b)**2:
    print('Yes')
else:
    print('No'

Buggy submission (verdict: Runtime Error):
#パナソニックプロ2020
abc=map(int,input().split())
if a**0.5 +b**0.5 < c**0.5:
    print('Yes')
else:
    print('No')
Problem p02818 (python)

Fixed submission:
#ABC149.B
A,B,K = map(int,input().split())
if K<=A:
    print(A-K)
    print(B)
elif A < K and B-(K-A) >=0:
    print(0)
    print(B-(K-A))
elif A <K and B-K-A<0:
    print(0)
    print(0)

Buggy submission (verdict: Runtime Error):
#ABC149.B
A,B,K = map(int,input().split())
if K<=A:
    print(A-K)
    print(B)
elif A < K and B-K-A =>0:
    print(0)
    print(B-K-A)
else:
    print(0)
    print(0)
Problem p03658 (python)

Fixed submission:
#ABC067.B
N,K = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
L = l[(N-K):]
ans = sum(L)
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC067.B
N,K = map(int,input().split())
l = [map(int,input().split())]
l.sort()
L = l[(N-K):]
ans = sum(L)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
l = [int(input())for i in range(N)]
l.sort()
L = l[(N-K):]
ans = sum(L)
print(ans)
Problem p03680 (python)

Fixed submission:
#ABC065.B
N = int(input())
a = [int(input()) for i in range(N)]
x = 1
for i in range(N):
    x = a[x-1]
    if x == 2:
        print(i+1)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#ABC065.B
N = int(input())
a = [int(input()) for i in range(N)]
x = 0
for i in range(N):
    x = a[x]
    if x == 2:
        print(i+1)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#ABC065.B
N = int(input())
a = [int(input()) for i in range(N)]
x = 0
for i in range(N):
    x = a[x]
    if a[x] == 2:
        print(i+1)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#ABC065.B
N = int(input())
a = [int(input() for i in range(N))]
x = 0
for i in range(N):
    x = a[x]
    if a[x] == 2:
        print(i+1)
        break
else:
    print(-1)
Problem p03712 (python)

Fixed submission:
#ABC062.B
H,W = map(int, input().split())
print('#'*(W+2))
for i in range(H):
    a = input()
    print('#'+a+'#')
print('#'*(W+2))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
print('#'*(W+2)
for i in range(H):
    a = input()
    print('#'+a+'#')
print('#'*(W+2))
Problem p03738 (python)

Fixed submission:
#ABC059.B
A = int(input())
B = int(input())

if A > B:
    print('GREATER')
elif A == B:
    print('EQUAL')
else:
    print('LESS')

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

if A > B:
    print('GREATER')
elif A == B
    print('EQUAL')
else:
    print('LESS')
Problem p03773 (python)

Fixed submission:
#ABC057.A
A,B = map(int,input().split())
if A+B <24:
    print(A+B)
else:
    print(A+B-24)

Buggy submission (verdict: Runtime Error):
#ABC057.B
N,M = map(int,input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)

Buggy submission (verdict: Runtime Error):
#ABC057.B
N,M = map(int(input().split()))
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3)+1)
Problem p03777 (python)

Fixed submission:
#ABC056.A
a,b = input().split()
if a == b:
    print('H')
else:
    print('D')

Buggy submission (verdict: Runtime Error):
#ABC056.A
a,b = input().split()
if a == b:
    print('H')
else:
    prind('D')
Problem p03778 (python)

Fixed submission:
#ABC056.B
W,a,b = map(int,input().split())
if a<= b <= a+W or a <= b+W <= a+W:
    print(0)
elif a + W <b:
    print(b-(a+W))
elif b+W <a:
    print(a-(b+W))

Buggy submission (verdict: Runtime Error):
W,a,b = map(int,input())
if a <= b <= a+W or a<= b+W <= a+W:
    print(0)
elif a+W < b:
    print(b-(a+W))
elif b+W <a:
    print(a-(b+W))
Problem p03844 (python)

Fixed submission:
#ABC050.A
A,op,B = input().split()
if op =='+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))

Buggy submission (verdict: Runtime Error):
#ABC050.A
A,B = map(int,input().split())
op = input()
if op == '+':
    print(A+B)
else:
    print(A-B)
Problem p03845 (python)

Fixed submission:
#ABC050.B
N =int(input())
T = list(map(int,input().split()))
S = sum(T)
M = int(input())

for _ in range(M):
    a = S
    p,x = map(int,input().split())
    a -= T[p-1]
    a += x
    print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = list(int(input().split()))
S = sum(T)
M = int(input())

for _ in range(M):
    p,x = map(int,input().split())
    ans = S - T[p-1] + x
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = list(int(input().split()))
S = sum(T)
M = int(input())

for _ in range(M):
    p,x = map(int,input().split())
    ans = S - T[] + x
    print(ans)

Buggy submission (verdict: Runtime Error):
#ABC050.B
N = int(input())
T = int(input().split())
S = sum(T)
M = int(input())

for _ in range(M):
    p,x = map(int,input().split())
    ans = S - T[] + x[]
    print(ans)

Buggy submission (verdict: Runtime Error):
#ABC050.B
N =int(input())
T = list(map(int,input().split()for _ in range(N)))
S = sum(T)
M = int(input())

for _ in range(M):
    a = S
    p,x = map(int,input().split())
    a -= T[p-1]
    a += x
    print(a)

Buggy submission (verdict: Runtime Error):
#ABC050.B
N =int(input())
T = list(map(int,input().split()for _ in range(N)))
S = sum(T)
M = int(input())

for _ in range(M):
    p,x = map(int,input().split())
    S -= T[p-1]
    S += x
    print(S)
Problem p03860 (python)

Fixed submission:
#ABC048.A
A,B,C= input().split()
print(A[0]+B[0]+C[0])

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

print(b//x - (a-1)//x)
Problem p03944 (python)

Fixed submission:
#ABC047.B

w,h,n = map(int,input().split())
#座標を作る
right = w
left = 0
upper = h
under = 0

for _ in range(n):
    x,y,a = map(int,input().split())

    if a ==1:
        left = max(x,left)
    elif a ==2:
        right = min(x,right)
    elif a ==3:
        under = max(y,under)
    else:
        upper = min(y,upper)

if(upper-under)>0 and (right-left)>0:
    c = (upper-under)*(right-left)
    print(c)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
#ABC047.B
w,h,n = map(int,input().split())

#座標を作る
right = w
left = 0
upper = h
under = 0

for _ in range(n):
    x,y,a = map(int,input().split())

    if a ==1:
        left = max(x,left)
    elif a ==2:
        right = min (x,right)
    elif a ==3:
        under = max(y,under)
    elif a ==4:
        upper = min(y,upper)

if　(upper-under)>0 and (right-left)>0:
    c = (upper-under)*(right-left)
    print(c)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
#ABC047.B
w,h,n = map(int,input().split())

#座標を作る
right = w
left = 0
upper = h
under = 0

for _ in range(n):
    x,y,a = map(int,input().split())

if a ==1:
    left = max(x,left)
elif a ==2:
    right = min (x,right)
elif a ==3:
    under = max(y,under)
elif a ==4:
    upper = min(y,upper)

if　(upper-under)>0 and (right-left)>0:
    c = (upper-under)*(right-left)
    print(c)
else:
    print(0)
Problem p03962 (python)

Fixed submission:
#ABC046.A
a,b,c=map(int,input().split())

if a == b==c:
    print(1)
elif a == b !=c:
    print(2)
elif a ==c !=b:
    print(2)
elif b ==c!=a:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
#ABC046.A
a = int(input())
b = int(input())
c = int(input())

if a == b==c:
    print(1)
elif a == b !=c:
    print(2)
elif a ==c !=b:
    print(2)
elif b ==c!=a:
    print(2)
else:
    print(3)
Problem p04011 (python)

Fixed submission:
n = int(input())
k=int(input())
x = int(input())
y = int(input())

if n>k:
  total = k*x +(n-k)*y
  print(total)
else:
  total=n*x
  print(total)

Buggy submission (verdict: Runtime Error):
#ABC044.A
N,K,X,Y = map(int,input().split())
#N<=Kの時
if N <= K:
    total_1 = N*X
    print(total_1)
#N>Kの時
else:
    total_2 = K*X + (N-K)*Y
    print(total_2)
Problem p04043 (python)

Fixed submission:
#ABC.042A
a,b,c = map(int,input().split())
if a ==b==5 and c ==7:
    print('YES')
elif a ==c==5 and b ==7:
    print('YES')
elif b==c==5 and a ==7:
    print('YES')
else:
    print('NO')

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

#575を作れるか判定
if A == B ==5 and C ==7:
    print('YES')
elif A ==C ==5 and B==7:
    print('YES')
elif A ==7 and B ==C ==5:
    print('YES')
    
else:
    print('NO')
Problem p04044 (python)

Fixed submission:
#ABC042.B
N,L = map(int,input().split())
s = [input()for _ in range(N)]
s.sort()
ans=''
for i in range(N):
    ans =ans +s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC042.B
N,L = map(int,input().split())
s = [input()for_in range(N)]
s.sort()
ans=''
for i in range(N):
    ans += s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC042.B
N,L = map(int,input().split())
s = [input() for_in range(n)]
s.sort()
ans=''
for i in range(N):
    ans =ans+ s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC042.B
N,L = map(int,input().split())
s = [input()for_in range(n)]
s.sort()
ans=''
for i in range(N):
    ans += s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC042.B
N,L = map(int,input().split())
s = [input()for_in range(n)]
s.sort()
ans=''
for i in range(s):
    ans += s[i]
print(ans)
Problem p02694 (python)

Fixed submission:
X = int(input())
y = 100
ans = 0
while(True):
  ans+=1
  y += y//100
  if(X<=y):
    break
print(ans)

Buggy submission (verdict: Runtime Error):
X = int(input())
y = 100
ans = 0
while(True):
  ans++
  y += y//100
  if(X<=y):
    break
print(ans)
Problem p02705 (python)

Fixed submission:
import math
K = int(input())

print(2*math.pi*K)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
ans = 0
minN = 0
maxN = N-1
flag = [1]*N
    
for i in range(N):
    maxpr = 0
    maxj = 0
    flagj = 0
    for j in range(N):
        if flag[j]:
            if maxN - j >= j - minN and A[j]*(maxN - j) > maxpr:
                maxpr = A[j]*(maxN - i)
                maxj = j
                flagj = 1
            elif  maxN - j <= j - minN and A[j]*(j - minN) > maxpr:
                maxpr = A[j]*(j - minN)
                maxj = j
                flagj = 0
    
    flag[maxj] = 0
    if flagj:
        maxN -= 1
    else:
        minN += 1
    ans += maxpr
    
print(ans)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
Nm = N % K
ans = Nm
A = [Nm]
while 1:
    if ans == 0:
        break
    elif abs(Nm-K) in A:
        break
    else:
        if abs(Nm-K) < ans:
            ans = abs(Nm-K)
        A.append(abs(Nm-K))
        Nm = abs(Nm-K)
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
Nm = N % K
ans = Nm
A = [0]*(K+1)
A[Nm] = 1
while 1:
    if ans == 0:
        break
    elif A[abs(Nm-K)] != 1:
        if abs(Nm-K) < ans:
            ans = abs(Nm-K)
        A[abs(Nm-K)] = 1
        Nm = abs(Nm-K)
    else:
        break
    
print(ans)
Problem p02761 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())

frag = True
A = np.zeros(N)
for i in range(N):
    A[i] = -1
for i in range(M):
    si,ci = map(int, input().split())
    if A[si-1] != -1 and A[si-1] != ci:
        frag = False
    elif si == 1 and ci == 0 and N != 1:
        frag = False
    else:
        A[si-1] = ci

ans = 0
for i in range(N):
    if A[N-i-1] == -1:
        A[N-i-1] = 0
    ans += A[N-i-1]*(10**i)
    
if ans == 0 and N == 1:
    pass
elif ans < 10**(N-1):
    ans += 10**(N-1)
    
if frag:
    print(int(ans))
else:
    print(-1)

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

frag = True
for i in range(N):
    A[i] = -1
for i in range(M):
    si = int(input())
    ci = int(input())
    if A[si] != -1 and A[si] != ci:
        frag = False
        break
    else if si == 1 and ci == 0:
        frag = False
        break
    else:
        A[si] = ci

ans = 0
for i in range(N):
    if A[N-i-1] == -1:
        A[N-i-1] = 0
    ans += A[N-i-1]*(10**i)
    
if frag:
    print(ans)
else:
    print(-1)
Problem p02780 (python)

Fixed submission:
N,K = map(int, input().split())
p = list(map(int, input().split()))

st = 0
i = 0
sa = 0
while i+K < N:
    sa += p[i+K]-p[i]
    if sa > 0:
        st = i+1
        sa = 0
    i += 1

psum = p[st:st+K]
for i in range(K):
    psum[i] = (psum[i]+1)/2
print(sum(psum))

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

st = 0
i = 0
sa = 0
while i+K < N:
    sa += p[i+K]-p[i]
    if sa > 0:
        st = i+1
        sa = 0
    i += 1

psum = p[st:st+K]
for i in range(K):
    psum[i] = (psum[i]+1)/2
print(sum(psum)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)

Buggy submission (verdict: Runtime Error):
# あなたは、500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。 これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。
A,B,C,X=(int(z) for z in input().split())
# A,B,C,X=map(int,'30 30 30 12000'.split())
N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)

Buggy submission (verdict: Runtime Error):
# あなたは、500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。 これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。
A,B,C,X=(int(z) for z in input().split())
# A,B,C,X=map(int,'30 30 30 12000'.split())
N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)

Buggy submission (verdict: Runtime Error):
# あなたは、500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。 これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。
A,B,C,X=map(int,input().split())
# A,B,C,X=map(int,'30 30 30 12000'.split())
N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)

Buggy submission (verdict: Runtime Error):
# あなたは、500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。 これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。
A,B,C=map(int,input().split())
# A,B,C,X=map(int,'30 30 30 12000'.split())
N=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50==X:
                N+=1

print(N)
Problem p03493 (python)

Fixed submission:
# s1,s2,s3=map(str,input().split())
s1s2s3=str(input())
# a=s1+s2+s3
b=0

for i in s1s2s3:
    b=b+int(i)

print(b)

Buggy submission (verdict: Runtime Error):
s1,s2,s3=map(str,input().split())
# c=str(input())
a=s1+s2+s3
b=0

for i in a:
    b=b+int(i)

print(b)
Problem p02687 (python)

Fixed submission:
s=input()
if s=="ABC":
	print("ARC")
else:
	print("ABC")

Buggy submission (verdict: Runtime Error):
from sys import exit

x=int(input())
for i in range(0,201):
	for j in range(-200,i):
		if i**5-j**5==x:
			print(i,j)
			exit()
Problem p02691 (python)

Fixed submission:
from collections import defaultdict

n=int(input())
A=list(map(int,input().split()))
B=defaultdict(int)
res=0

for i in range(n):
	B[A[i]+i]+=1
	if i-A[i] in B:
		res+=B[i-A[i]]

print(res)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
B=[0]*(10**10)
res=0

for i in range(n):
	B[A[i]+i]+=1
for i in range(n):
	if i-A[i]>0:
		res+=B[i-A[i]]

print(res)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
B=[0]*(n+max(A)+1)
res=0

for i in range(n):
	if 0<=(i+1)+A[i]:
		B[i+A[i]+1]+=1
		if 0<=i-A[i]+1:
			res+=B[i-A[i]+1]

print(res)