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

Fixed submission:
x,y,z,k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
li = []
box = []
for i in a:
    for j in b:
        li.append(i + j) 
li.sort(reverse = True)
li = li[:min(k,x*y)]
for i in c:
    for j in li:
        box.append(i + j)
box.sort(reverse = True)
for i in range(k):
    print(box[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)

li = []

for i in a:
    for j in rangeb:
        li.append(i + j)
        
li.sort(reverse = True)
li = li[:min(k,x*y)]

box = []

for i in li:
    for j in c:
        box.append(i + j)

box.sort(reverse = True)

for i in range(k):
    print(box[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)
b = sorted(list(map(int, input().split())), reverse = True)
c = sorted(list(map(int, input().split())), reverse = True)
d = min(x*y*z, 3000)
dp = [0] * max(x*y*z, 3000)
count = 0
for i in range(x):
    for j in range(y):
        for t in range(z):
            dp[count] = a[i] + b[j] +  c[t]
            count += 1

dp = sorted(dp, reverse = True)

for i in range(k):
    print(dp[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)
b = sorted(list(map(int, input().split())), reverse = True)
c = sorted(list(map(int, input().split())), reverse = True)
d = min(x*y*z, 3000)
dp = [0] * max(x*y*z, 3000)
count = 0
for i in range(x):
    for j in range(y):
        for t in range(z):
            dp[count] = a[i] + b[j] +  c[t]
            count += 1

dp = sorted(dp, reverse = True)

for i in range(d):
    print(dp[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)
b = sorted(list(map(int, input().split())), reverse = True)
c = sorted(list(map(int, input().split())), reverse = True)
d = min(x*y*z, 3000)
dp = [0] * (x*y*z)
count = 0
for i in range(x):
    for j in range(y):
        for t in range(z):
            dp[count] = a[i] + b[j] +  c[t]
            count += 1

dp = sorted(dp, reverse = True)

for i in range(d):
    print(dp[i])
Problem p03089 (python)

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

ans = []
while True:
    num = 0
    for i in range(len(b)):
        if b[i] == i + 1:
            num = i + 1
    else:
        if num == 0:
            print("-1")
            quit()
        else:
            ans.append(b[num - 1])
            del b[num - 1]
    if b == []:
        break


for i in ans[::-1]:
    print(i)

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

def main():
    b.sort()
    for i in range(n):
        print(b[i])

for i in range(n):
    if b[i] < n-i:
        main()
        break
    elif b[i] == n-i:
        continue
    if i == n - 1 and b[i] <= n
        main()
        break
else:
    print("-1")
Problem p03129 (python)

Fixed submission:
n,k = list(map(int,input().split()))
if n % 2 == 0:
    if n//2 >= k :
        print("YES")
    else:
        print("NO")
else:
    if (n+1)//2 >= k:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
if n % 2 == 0:
    if n//2 >= k :
        print("YES")
    else:
        print("NO")
else:
    if (n+1)//2 >= k:
        print("YES")
    else:
        print("NO")
Problem p03141 (python)

Fixed submission:
n = int(input())
box = [list(map(int, input().split())) for i in range(n)]

li = list(sorted(box, key=lambda x: sum(x), reverse = True))

taka = []
aoki = []

for i in range(len(li)):
    taka.append(li[0][0])
    del li[0]
    if li == []:
        print(sum(taka) - sum(aoki))
        quit()
    aoki.append(li[0][1])
    del li[0]
    if li ==[]:
        print(sum(taka) - sum(aoki))
        quit()

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

li = sorted(box, key = lambda x: sum(x), reverse = True)

taka = []
aoki = []

for i in range(len(li)):
    taka.append(li[0][0])
    del li[0]
    if li == []:
        print(sum(taka) - sum(aoki))
        quit()
    aoki.append(li[0][1])
    del li[0]

print(sum(taka) - sum(aoki))
Problem p02883 (python)

Fixed submission:
n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
b = [a[i]*f[i] for i in range(n)]

def judgement(x):
    judge = -1
    cnt = 0
    for i in range(n):
        if b[i]>x:
            cnt += -((x-b[i])//f[i])
        if cnt > k:
            judge = False
            break
    if cnt <= k:
        judge = True
    return judge

low=0
high=max(b)
while low<high:
    mid = (low + high)//2
    if judgement(mid) == False:
        low=mid+1
    else:
        high=mid
print(low)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
b = [a[i]*f[i] for i in range(n)]

def judgement(x):
    judge = -1
    cnt = 0
    for i in range(n):
        if b[i]>x:
            cnt += -((x-b[i])//f[i])
        if cnt > k:
            judge = False
            break
    if cnt <= k:
        judge = True
    return judge

low=0
high=np.amax(b)
while low<high:
    mid = (low + high)//2
    if judgement(mid) == False:
        low=mid+1
    else:
        high=mid
print(low)
Problem p02903 (python)

Fixed submission:
h, w, a, b=list(map(int,input().split()))
for i in range(b):
    print("1"*a + "0"*(w-a))
for i in range(h-b):
    print("0"*a + "1"*(w-a))

Buggy submission (verdict: Runtime Error):
import numpy as np
a = list(map(int,input().split()))
bb = np.ones((a[2],a[3]))
bc = np.zeros((a[2],a[1]-a[3]))
cb = np.zeros((a[0]-a[2],a[3]))
cc = np.ones((a[0]-a[2],a[1]-a[3]))
ans = np.r_[np.c_[bb,bc],np.c_[cb,cc]]
print(ans)
Problem p02917 (python)

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

Buggy submission (verdict: Runtime Error):
    n = int(input())
    b = list(map(int,input().split()))
    a = [0] *n
    for i in range(0,n-2):
        a[i+1] = min([b[i],b[i+1]])
    a[0] =a[1]
    a[n-1] = b[n-2]
    print(sum(a))
Problem p02923 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
h= list(map(int,input().split()))
a = []
cnt = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt = cnt + 1
    else:
        cnt = 0
    a.append(cnt)
print(max(a))
Problem p02947 (python)

Fixed submission:
from collections import Counter
N = int(input())
dic = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,"o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":26}

ans = []
for i in range(N):
    si = input()
    a = [0]*26
    s = ""
    for j in range(10):
        a[dic[si[j]]-1] += 1
    for k in range(26):
        s = s + "a"
        s = s + str(a[k])
    ans.append(s)
c = Counter(ans)
b = 0
for v in c.values():
    if v > 1:
        b += v*(v-1)//2
    else:
        pass
print(b)

Buggy submission (verdict: Runtime Error):
import collections 
N = int(input())
dic = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,"o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":26}

ans = []
for i in range(N):
    si = input()
    a = [0]*26
    s = ""
    for j in range(10):
        a[dic[si[j]]] += 1
    for k in range(26):
        s = s + "a"
        s = s + str(a[k])
    ans.append(s)
c = collections.Counter(ans)
b = 0
for v in c.values():
    if v > 1:
        b += v*(v-1)//2
    else:
        pass
print(b)

Buggy submission (verdict: Runtime Error):
import collections 
N = int(input())
dic = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,"o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":26}

ans = []
for i in range(N):
    si = input()
    a = [0]*26
    s = ""
    for j in range(10):
        a[dic[si[j]]] += 1
    for k in range(26):
        s = s + "a"
        s = s + str(a[k])
    ans.append(s)
c = collections.Counter(ans)
b = 0
for v in c.values():
    if v > 1:
        b += v*(v-1)//2
    else:
        break
print(b)

Buggy submission (verdict: Runtime Error):
import collections 
N = int(input())
dic = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,"o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":26}

ans = []
for i in range(N):
    si = input()
    a = [0]*26
    s = ""
    for j in range(10):
        a[dic[si[j]]] += 1
    for k in range(26):
        s = s + "a"
        s = s + str(a[k])
    ans.append(s)
c = collections.Counter(ans)
b = 0
for v in c.values():
    if v > 1:
        b += v*(v-1)//2
    else:
        break
print(b)
Problem p02866 (python)

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
b = 1
ans = 1
max = 0
dd=[0]*10**5
for i in d:
    dd[i]+=1
    if(max<i):
        max=i
if d[0] == 0 and d.count(0) == 1:
    for i in range(1, max+1):
        if dd[i] == 0:
            print(0)
            exit()
        if dd[i] == 1:
            ans *= b
        else:
            if b != 1:
                ans *= pow(b, dd[i], 998244353)
        b = dd[i]
    print(ans % 998244353)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
d = list(map(int, input().split()))
b = 1
ans = 1
maxd = max(d)
if d[0] == 0 and d.count(0) == 1:
    for i in range(1, maxd+1):
        dc = d.count(i)
        if dc == 0:
            print(0)
            exit()
        ans *= math.pow(b, dc)
        b = dc
    print(ans % 998244353)
else:
    print(0)
Problem p02780 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out_ = 0
p = P[0:K]
base = sum(p)
if N == K:
  answer = (sum(p)+K)/2
else:
  for i in range(N-K):
    out_ += P[i+K]-P[i]
    if i == 0:
      ans = out_
    else:
      if out_ > ans:
        ans = out_
      else:
        continue
  answer = (base+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out_ = 0
p = P[0:K]
base = sum(p)
for i in range(N-K):
  out_ += P[i+K]-P[i]
  if i == 0:
    ans = out_
  else:
    if out_ > ans:
      ans = out_
    else:
      continue
answer = (base+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out_ = 0
p = P[0:K]
base = sum(p)
for i in range(N-K):
  out_ += P[i+K]-P[i]
  if i == 0:
    ans = out_
  else:
    if out_ > ans:
      ans = out_
    else:
      continue
answer = (base+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out_ = 0
p = P[0:K]
base = sum(p)
for i in range(N-K):
  out_ += P[i+K]-P[i]
  if i == 0:
    ans = out_
  else:
    if out > ans:
      ans = out_
    else:
      continue
answer = (base+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out = 0
p = P[0:K]
base_ = sum(p)
for i in range(N-K):
  out += P[i+K]-P[i]
  if i == 0:
    ans = out
  else:
    if out > ans:
      ans = out
    else:
      continue
answer = (base_+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out = 0
p = P[0:K]
base = sum(p)
for i in range(N-K):
  out += P[i+K]-P[i]
  if i == 0:
    ans = out
  else:
    if out > ans:
      ans = out
    else:
      continue
answer = (base+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out = 0
p = P[0:K]
base = sum(p)
for i in range(N-K):
  out += P[i+K]-P[i]
  if i == 0:
    ans = out
  else:
    if out > ans:
      ans = out
    else:
      continue
answer = (base+ans+K)/2
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
P = list(map(int,input().split()))
out = 0
p = P[0:K]
base = sum(p)
for i in range(N-K):
  out += P[i+K]-P[i]
  print(out)
  if i == 0:
    ans = out
  else:
    if out > ans:
      ans = out
    else:
      continue
answer = (base+ans+K)/2
print(base, ans)
print(answer)
Problem p02787 (python)

Fixed submission:
import numpy as np
H, N = map(int, input().split())
dp = np.zeros((N, H+1))
ab = [list(map(int, input().split())) for _ in range(N)]
max_a = max(a for a, _ in ab)
dp = [0]*(H+max_a)
for i in range(1,H+1):
  dp[i] = min(dp[i-a]+b for a,b in ab)
#print(ab)
print(dp[H])

Buggy submission (verdict: Runtime Error):
import numpy as np
H, N = map(int, input().split())
dp = np.zeros((N, H+1))
skills = []
for _ in range(N):
  a, b = map(int, input().split())
  skills.append([a,b])

for i in range(1,H+1):
  for j in range(N):
    if i - skills[j][0] >0:
      dp[j][i] = min(dp[0][i-skills[j][0]], dp[1][i-skills[j][0]], dp[2][i-skills[j][0]])+skills[j][1]
    else:
      dp[j][i] = skills[j][1]

print(int(min(dp.T[-1])))
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline #for input speed
sys.setrecursionlimit(10**6) #for deep recursion

N, Q = map(int, input().split())

v = [[] for i in range(N)]
score = [0]*N

def dfs(cur,par):
  for chi in v[cur]:
    if chi == par:
      continue
    score[chi] += score[cur]
    dfs(chi, cur)
      
for i in range(N-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  v[a].append(b)
  v[b].append(a)

for j in range(Q):
  p, x = map(int, input().split())
  score[p-1] += x

dfs(0,-1)
score_int=[str(a) for a in score]
output= ' '.join(score_int)
print(output)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
G = [[] for _ in range(N)]
score = [0]*N
visited = [False]*N

for i in range(N-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  G[a].append(b)
  G[b].append(a)
  
for j in range(Q):
  p, x = map(int, input().split())
  p -= 1
  score[p] += x

def dfs(pos):
  visited[pos] = True
  for next_pos in G[pos]:
    if visited[next_pos] == True:
      continue
    score[next_pos] += score[pos]
    dfs(next_pos)
dfs(0)
score = [str(s)  for s in score]
ans = ' '.join(score)
print(ans)

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

v = [[] for i in range(N)]
score = [0]*N

def dfs(cur,par):
  for chi in v[cur]:
    if chi == par:
      continue
    score[chi] += score[cur]
    dfs(chi, cur)
      
for i in range(N-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  v[a].append(b)
  v[b].append(a)

for j in range(Q):
  p, x = map(int, input().split())
  score[p-1] += x

dfs(0,-1)
score_int=[str(a) for a in score]
output= ' '.join(score_int)
print(output)

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

v = [[] for i in range(N)]
score = [0]*N

def dfs(p):
  for i in v[p-1]:
    if p < i:
      score[i-1] += score[p-1]
      dfs(i)
      
for i in range(N-1):
  a, b = map(int, input().split())
  v[a-1].append(b)
  v[b-1].append(a)

for j in range(Q):
  p, x = map(int, input().split())
  score[p-1] += x

dfs(1)
score_int=[str(a) for a in score]
output= ' '.join(score_int)
print(output)

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

v = [[] for i in range(N)]
score = [0]*N

def dfs(p, x):
  for i in v[p-1]:
    if p < i:
      score[i-1] += x
      dfs(i, x)
      
for i in range(N-1):
  a, b = map(int, input().split())
  v[a-1].append(b)
  v[b-1].append(a)

for j in range(Q):
  p, x = map(int, input().split())
  score[p-1] += x
  dfs(p, x)
score_int=[str(a) for a in score]
output= ' '.join(score_int)
print(output)

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

v = [[] for i in range(N)]
score = [0]*N

def dfs(p, x):
  for i in v[p-1]:
    if p < i:
      score[i-1] += x
      dfs(i, x)
      
for i in range(N-1):
  a, b = map(int, input().split())
  v[a-1].append(b)
  v[b-1].append(a)

for j in range(Q):
  p, x = map(int, input().split())
  score[p-1] += x
  dfs(p, x)
print(score)
Problem p03030 (python)

Fixed submission:
import numpy as np
N = int(input())
restaurants_list = []
for i in range(N):
  name,score = map(str,input().split())
  score = int(score)
  restaurants_list.append([name,score,i+1])
restaurants_list.sort(key = lambda x:x[1],reverse=True) 
restaurants_list.sort(key = lambda x:x[0]) 
for i in range(N):
  print(restaurants_list[i][2])

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
name_list = []
score_list = []
score_list_new = []
for i in range(N):
  name, score =  map(str,input().split())
  name_list.append(name)
  score_list.append(int(score))
index_name = np.argsort(name_list)
for i in range (len(score_list)):
  score_list_new.append(score_list[index_name[i]])
for i in range(len(index_name)):
  for j in range(i,len(index_name)):
  	if (name_list[i] == name_index[j]) and (score_list_new[i] < score_list_new[j]):
      index_name[i], index_name[j] = index_name[j], index_name[i]
    else:
      None  
for i in range(len(index_name)):
  print(index_name[i])
Problem p03032 (python)

Fixed submission:
N,K = map(int,input().split())
V_list = list(map(int,input().split()))
min_ = min(N,K)
total = [0]
#get
for a in range(min_+1):
  for b in range(min_-a+1):
    score_get = V_list[:a]+V_list[N-b:]
    score_get.sort()
    score = sum(score_get)
    for i in range(min(K-(a+b),len(score_get))):
      if score_get[i]<0:
        score -= score_get[i]
      else:
        break
    total.append(score)
print(max(total))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
V_list = list(map(int,input().split()))
min_ = min(N,K)
total = []
#get
for a in range(min_):
  for b in range(min_-a):
    score_get = V_list[:a]+V_list[N-b:]
    score_get.sort()
    if len(score_get) == 0:
      score_get.append(0)
    for i in range(min(K-(a+b)+1,len(score_get))):
      if score_get[i]<0:
        new_score = score_get[:i]+score_get[i+1:]
      else:
        break
      total_score = sum(new_score)
      total.append(total_score)
print(max(total))
Problem p03164 (python)

Fixed submission:
import numpy as np
n, w = map(int, input().split())
v_max = 1000
num_v = v_max*n
INF = 10**9+1
dp = np.full(num_v+1, INF, dtype=int)
dp[0] = 0
for i in range(1,n+1):
  wn, vn = map(int, input().split())
  dp[vn:] = np.minimum(dp[vn:], dp[:-vn]+wn)
for i in range(len(dp)-1, -1, -1):
  if dp[i] <= w:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
import numpy as np
n, w = map(int, input().split())
dp = np.zeros(w+1)

for i in range(1,n+1): #n個の荷物をそれぞれ持つか否か
  wn, vn = map(int, input().split())
  dp[wn:] = np.maximum(dp[wn:], dp[:-wn]+vn)#wnより小さい=>持てない=>価値変わらない
print(int(dp[-1]))
Problem p02812 (python)

Fixed submission:
n = int(input())
s = str(input())
cnt = 0
# s.count("ABC")
for i in range(n):
#   print(s[i:i+3].find("ABC"))
  if s[i:i+3].find("ABC") ==0:
    cnt = cnt+1
print(cnt)

Buggy submission (verdict: Runtime Error):
k,x = map(str, input().split())
x.count("ABC")
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
tmp = sum(p[:k])
ans = [tmp]
if n == k:
    ans_mae = ans[0]
    print((ans_mae+k)/2)
else:
    for i in range(1,n-k+1):
        tmp = tmp - p[i-1] + p[i+k-1]
        ans.append(tmp)
    print((max(ans)+k)/2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
tmp = sum(p[:k])
ans = [tmp]
if n == k:
    ans_mae = ans[0].sum()
    print((ans_mae+k)/2)
else:
    for i in range(1,n-k+1):
        tmp = tmp - p[i-1] + p[i+k-1]
        ans.append(tmp)
    print((max(ans)+k)/2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = []
for i in range(1, n-k+1,2):
    ans.append(sum(p[(i):(k+i)]))
ans2 = []
for i in range(0, n-k+1,2):
    ans2.append(sum(p[(i):(k+i)]))
ans1 = max(ans)
ans2 = max(ans2)
print((k+max([ans1, ans2]))/2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = []
for i in range(1, n-k+1):
    ans.append(sum(p[(i):(k+i)]))
print(print((k+max(ans))/2))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p3_before = (sum(p[:k])+k)/2
for i in range(1, n-k):
    p3 =  (sum(p[(i):(k+i)])+k)/2
    ans = max([p3_before, p3])
    p3_before = p3
print(p3)
Problem p02797 (python)

Fixed submission:
n,k,s = map(int, input().split())
if s<5:
    xx = 1 + s
else:
    for i in range(2,s):
        if s%i != 0:
            xx = i
            break
ans = [xx]* n
for i in range(k):
    ans[i] = s
print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n,k,s = map(int, input().split())
if s==1:
    xx = 2
else:
    for i in range(2,s//2):
        if s%i != 0:
            xx = i
            break
ans = [xx]* n
for i in range(k):
    ans[i] = s
print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n,k,s = map(int, input().split())
for i in range(2,s//2):
    if s%i != 0:
        xx = i
        break
ans = [xx]* n
for i in range(k):
    ans[i] = s
print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n,k,s = map(int, input().split())
for i in s//2:
    if s%i == 0:
        xx = i
        break
ans = [xx]* n
for i in range(k):
    ans[i] = s
print(' '.join(map(str, ans)))
Problem p02802 (python)

Fixed submission:
n,m = map(int, input().split())
wa = 0
ac_list = {'AC':{}, 'WA':{}}
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        ac_list[s][p] = ac_list[s].get(p, 0) + 1* int(not(p in ac_list['AC'].keys()))
    kyotu_key = list(set(ac_list['AC'].keys()) & set(ac_list['WA'].keys()))
    wa_list = [ac_list['WA'][p] for p in kyotu_key]
    print(len(ac_list['AC'].keys()), sum(wa_list))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
wa = 0
ac = 0
ac_list = []
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        if s=='WA' & ac_list.count(p) ==0:
            wa += 1
        elif ac_list.count(p) ==0:
            ac_list.append(p)
            ac += 1
        else:
            pass
    print(ac, wa)

Buggy submission (verdict: Runtime Error):
wa = 0
ac = 0
ac_list = []
if m==0:
    print(0,0)
else:
    for i in range(m-1:
        p,s = input().split()
        if s=='WA':
            wa += 1
        elif ac_list.count(p) ==0:
            ac_list.append(p)
            ac += 1
        else:
            pass
Problem p02886 (python)

Fixed submission:
n = int(input())
nums = list(map(int, input().split()))
ans = []
for i in range(n):
    for j in range(i+1,n):
        ans.append(nums[i] * nums[j])
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input()))
ans = []
for i in range(n):
    for j in range(i+1,n):
        ans.append(nums[i] * nums[j])
print(sum(ans))