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

Fixed submission:
import math

N ,K = (int(i) for i in input().split())
ans = 0
for i in range(int(N)):
  if i < K:
    x = math.log2(K/(i+1))
    x_ceil = math.ceil(x)
    ans += pow(0.5,x_ceil)/N
  else:
    ans += 1/N

print(ans)

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

before = S % 100
after = S //100

if after == 0 or before == 0:
  print("NA")
elif after >31 and before > 31:
  print("NA")
elif before <= 12 and after <= 12:
  print("AMBIGUOUS")
elif before <= 12 and after > 12 :
  print("YYMM")
elif before > 12 and after <= 12:
  print("MMYY")
else:
  print("NA")
Problem p03062 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

count = 0
for i in range(N):
  if A[i] <0:
    count = count + 1
    A[i] = A[i] * -1

if 0 in A:
  ans = sum(A)
else:
  if count%2 == 0:
    ans = sum(A)
  else:
    ans = sum(A) - 2*min(A)

print(ans)

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

ans = sum(A)
for i in range(N):
  if A[i] < 0:
    if i != N-1:
      A[i] = A[i] * -1
      A[i+1] = A[i+1] * -1
      print(A)
  ans = max(ans, sum(A))

print(ans)
Problem p03069 (python)

Fixed submission:
N = int(input())
S = str(input())

white = S.count(".")
black = 0
ans = S.count(".")

for i in range(N):
  if S[i] == ".":
    white -=1
  else:
    black +=1
  ans = min(ans,white+black)

print(ans)

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

 white = 0
 black = 0
 first_black_index = 0

 while S[first_black_index] == ".":
   first_black_index += 1
   if first_black_index == N:
     print(0)
     break

 last_black_index = N
 if first_black_index != N:
   while S[last_black_index-1] == "#":
     last_black_index -= 1
     if last_black_index == 0:
       print(0)
       break


 if first_black_index != N and last_black_index != 0:
   S = S[first_black_index:last_black_index]

   for i in range(len(S)):
     if S[i] == "#":
       black +=1
     else:
       white +=1

   print(min(white,black))

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

white = 0
black = 0
first_black_index = 0
end_index = N

while S[first_black_index] == ".":
  first_black_index += 1
  if first_black_index == N:
    print(0)
    break

last_black_index = len(S)
if first_black_index != N:
  while S[len(S)] == "#":
    last_black_index -= 1
    if last_black_index == 0:
      print(0)
      break


if first_black_index != N and last_black_index != 0:
  S = S[first_black_index:last_black_index+1]

  for i in range(len(S)):
    if S[i] == "#":
      black +=1
    else:
      white +=1

  print(min(white,black))

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

 white = 0
 black = 0

 first_black_index = 0

 while S[first_black_index] == ".":
   first_black_index += 1
   if first_black_index == N:
     print(0)
     break
 if first_black_index != N:
   S = S[first_black_index:N+1]

   if S[len(S)-1] == "#":
     N = N-1


   for i in range(len(S)):
     if S[i] == "#":
       black +=1
     else:
       white +=1

   print(min(white,black))
Problem p03071 (python)

Fixed submission:
a = [int(i) for i in input().split()]
output = max(a)

b = a.index(max(a))

a[b] = a[b] - 1

output = output + max(a)

print(output)

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]~


output = max(a)

b = a.index(max(a))

a[b] = a[b] - 1

output = output + max(a)

print(output)
Problem p03110 (python)

Fixed submission:
N = int(input())

ans = 0
for i in range(N):
  x,u=map(str, input().split())
  if u == "JPY":
    ans += float(x)
  else:
    ans += float(x) * 380000.0

print(ans)

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

 ans = 0
 for i in range(N):
   x,u=map(str, input().split())
   if u == "JPY":
     ans += float(x)
   else:
     ans += float(x) * 380000.0

 print(ans)
Problem p03599 (python)

Fixed submission:
A,B,C,D,E,F = (int(i) for i in input().split())

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) >= ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

if ans != 0:
  print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))
else:
  print(str(A*100) + " 0")

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F = (int(i) for i in input().split())

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) > ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F = (int(i) for i in input().split())

water_list = []
suger_list = []

for i in range(F):
  for j in range(F):
    if 100*A*i + 100*B*j <= F:
      water_list.append(100*A*i + 100*B*j)

for i in range(F):
  for j in range(F):
    if C*i + D*i <= F:
      suger_list.append(C*i+D*j)

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) > ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))

Buggy submission (verdict: Runtime Error):
17 19 22 26 55 2802
Problem p03612 (python)

Fixed submission:
N = int(input())
P = [int(i) for i in input().split()]

count = 0
for i in range(N):
  if P[i] == i+1:
    if i+1 != N:
      P[i],P[i+1] = P[i+1],P[i]
    else:
      P[i],P[i-1] = P[i-1],P[i]
    count += 1
print(count)

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

count = 0
for i in range(N):
  if P[i] == i+1:
    P[i],P[i+1] = P[i+1],P[i]
    count += 1

print(count)
Problem p03695 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

colors = [0,0,0,0,0,0,0,0,0]

for a in A:
  if a < 400:
    colors[0] +=1
  elif 400<=a and a <800:
    colors[1] +=1
  elif 800<=a and a<1200:
    colors[2] +=1
  elif 1200<=a and a<1600:
    colors[3] +=1
  elif 1600<=a and a<2000:
    colors[4] +=1
  elif 2000<=a and a<2400:
    colors[5] +=1
  elif 2400<=a and a<2800:
    colors[6] +=1
  elif 2800<=a and a<3200:
    colors[7] +=1
  else:
    colors[8] +=1

ans = 0
for i in range(len(colors)-1):
  if colors[i] !=0 :
    ans +=1

if ans == 0:
  print(str(1) + " " + str(colors[8] + ans))
else:
  print(str(ans) + " " + str(colors[8] + ans))

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

 colors = [0,0,0,0,0,0,0,0,0]

 for a in A:
   if a < 400:
     colors[0] +=1
   elif 400<=a and a <800:
     colors[1] +=1
   elif 800<=a and a<1200:
     colors[2] +=1
   elif 1200<=a and a<1600:
     colors[3] +=1
   elif 1600<=a and a<2000:
     colors[4] +=1
   elif 2000<=a and a<2400:
     colors[5] +=1
   elif 2400<=a and a<2800:
     colors[6] +=1
   elif 2800<=a and a<3200:
     colors[7] +=1
   else:
     colors[8] +=1

 ans = 0
 for i in range(len(colors)-1):
   if colors[i] !=0:
     ans +=1

 print(str(ans) + " " + str(colors[8] + ans))
Problem p03699 (python)

Fixed submission:
N = int(input())
S = [int(input()) for i in range(N)]

ans = sum(S)
S.sort()

for s in S:
  if ans%10 == 0 and s%10 != 0:
    ans = ans - s
    break

if ans%10 != 0:
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
 N = int(input())
 S = [int(input()) for i in range(N)]

 ans = sum(S)
 S.sort()

 for s in S:
   if ans%10 == 0 and s%10 != 0:
     ans = ans - s
     break

 if ans%10 != 0:
   print(ans)
 else:
   print(0)
Problem p02600 (python)

Fixed submission:
X = int(input())

if X <= 599:
    print(8)
elif X <= 799:
    print(7)
elif X <= 999:
    print(6)
elif X <= 1199:
    print(5)
elif X <= 1399:
    print(4)
elif X <= 1599:
    print(3)
elif X <= 1799:
    print(2)
elif X <= 1999:
    print(1)

Buggy submission (verdict: Runtime Error):
def main():
    a, b, c = map(int, input().split())
    k = int(input())

    op = 0
    while not (a < b and b < c):
        if not a < b:
            b *= 2
            op += 1
        elif not b < c:
            c *= 2
            op += 1

    if op <= k:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
Problem p03049 (python)

Fixed submission:
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import heapq
import math
import bisect


def main():
    N = int(input())
    S = [input() for i in range(N)]

    a = b = ab = 0
    ans = 0
    for s in S:
        n = len(s)
        for j in range(n-1):
            if s[j] == "A" and s[j+1] == "B":
                ans += 1
        if s[0] == "B" and s[-1] == "A":
            ab += 1
        elif s[0] == "B":
            b += 1
        elif s[-1] == "A":
            a += 1

    if ab == 0:
        print(ans+min(a, b))
    elif a == 0 and b == 0:
        print(ans+ab-1)
    else:
        print(ans+ab+min(a, b))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
    S = [input() for i in range(N)]

    a = b = ab = 0
    ans = 0
    for s in S:
        n = len(s)
        for j in range(n-1):
            if s[j] == "A" and s[j+1] == "B":
                ans += 1
        if s[0] == "B" and s[-1] == "A":
            ab += 1
        elif s[0] == "B":
            b += 1
        elif s[-1] == "A":
            a += 1

    if a == 0 and b == 0:
        print(ans+ab-1)
    else:
        print(ans+ab+min(a, b))
Problem p03196 (python)

Fixed submission:
N, P = map(int, input().split())
res = {}


def pf(n):
    c = 2
    while c * c <= n:
        while not n % c:
            res[c] = res.get(c, 0) + 1
            n //= c
        c += 1

    if n != 1:
        res[n] = 1


def main():
    pf(P)

    ans = 1
    for d in res:
        ans *= pow(d, res[d]//N)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque


def main():
    n, p = map(int, input().split())

    div = []
    c = 1
    while c * c <= p:
        if not p % c:
            div.append(c)
            if c * c != p:
                div.append(p//c)
        c += 1

    div.sort()
    ans = 1
    for d in div:
        pp = pow(d, n)
        if pp > p:
            break
        if not p % pp:
            ans = max(ans, d)

    print(ans)


if __name__ == '__main__':
    main()
Problem p03385 (python)

Fixed submission:
s = input()
a, b, c = 0, 0, 0

for i in s:
    if i == "a" and a == 0:
        a += 1
    elif i == "b" and b == 0:
        b += 1
    elif i == "c" and c == 0:
        c += 1
    else:
        print("No")
        break
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()

if s[0] == s[1] && s[1] == s[2] && s[0] == s[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
i, x = 0, 0

while a+i <= b and i < k:
    x = a + i
    print(x)
    i += 1

i = k - 1
while b-i <= b:
    y = b - i
    if y <= x:
        i -= 1
        continue
    print(y)
    i -= 1

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
x = 0

for i in range(k):
    x = a + i
    if x > b:
        break
    print(x)


for i in range(k-1, -1, -1):
    y = b - i
    if y <= x:
        continue
    print(y)
Problem p03387 (python)

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

m = max(a, b, c)
if 3*m%2 == (a+b+c)%2:
    print((3*m-(a+b+c))//2)
else:
    print((3*(m+1)-(a+b+c))//2)

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

while True:
    if lst[0] == lst[1] and lst[1] == lst[2]:
        break
    
    minimum = min(lst)
    maximum = max(lst)

    if maximum-minimum >= 2:
        idx = lst.index(minimum)
        lst[idx] += 2
        
    else:
        idx = lst.index(minimum)
        lst[idx] += 1
        idx = lst.index(minimum)
        lst[idx] += 1
    n += 1
print(n)
Problem p03565 (python)

Fixed submission:
s_d = [i for i in input()]
t = input()
flg = True

for i in range(len(s_d)-1, -1, -1):
    if len(s_d) - i >= len(t) and s_d[i] == '?' or s_d[i] == t[0]:
        j, n = i+1, 1
        while j <= len(s_d) - 1 and n <= len(t) - 1:
            if s_d[j] == '?' or s_d[j] == t[n]:
                j += 1
                n += 1
            else:
                break

        if n >= len(t):
            s_d[i:i+len(t)] = t
            break
else:
    print("UNRESTORABLE")
    flg = False

if flg:
    for i in range(len(s_d)):
        if s_d[i] == '?':
            s_d[i] = 'a'

    print("".join(s_d))

Buggy submission (verdict: Runtime Error):
s_d = [i for i in input()]
t = input()
flg = True

for i in range(len(s_d)-1, -1, -1):
    if len(s_d) - i >= len(t) and s_d[i] == '?' or s_d[i] == t[0]:
        j, n = i+1, 1
        while j <= len(s_d) - 1:
            if s_d[j] == '?' or s_d[j] == t[n]:
                j += 1
                n += 1
            else:
                break

        if n >= len(t):
            s_d[i:i+len(t)] = t
            break
else:
    print("UNRESTORABLE")
    flg = False

if flg:
    for i in range(len(s_d)):
        if s_d[i] == '?':
            s_d[i] = 'a'

    print("".join(s_d))

Buggy submission (verdict: Runtime Error):
s_d = [i for i in input()]
t = input()
flg = True

for i in range(len(s_d)-1, -1, -1):
    if len(s_d) - i >= len(t) and s_d[i] == '?' or s_d[i] == t[0]:
        j, n = i+1, 1
        while j < len(s_d) - 1:
            if s_d[j] == '?' or s_d[j] == t[n]:
                j += 1
                n += 1
            else:
                break

        if n >= len(t):
            s_d[i:j] = t
            break
else:
    print("UNRESTORABLE")
    flg = False

if flg:
    for i in range(len(s_d)):
        if s_d[i] == '?':
            s_d[i] = 'a'

    print("".join(s_d))

Buggy submission (verdict: Runtime Error):
s_d = [i for i in input()]
t = input()
flg = True

for i in range(len(s_d)-1, -1, -1):
    if len(s_d) - i >= len(t) and s_d[i] == '?' or s_d[i] == t[0]:
        j, n = i+1, 1
        while s_d[j] == '?' or s_d[j] == t[n]:
            j += 1
            n += 1
            if j > len(s_d) - 1:
                break

        if n >= len(t):
            s_d[i:j] = t
            break
else:
    print("UNRESTORABLE")
    flg = False

if flg:
    for i in range(len(s_d)):
        if s_d[i] == '?':
            s_d[i] = 'a'

    print("".join(s_d))
Problem p03651 (python)

Fixed submission:
def gcd(a0, b0):
    a, b = max(a0, b0), min(a0, b0)
    while b != 0:
        a = a % b
        a, b = b, a

    return a


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    if n == 1:
        if k in a:
            print("POSSIBLE")
        else:
            print("IMPOSSIBLE")
    
    else:
        g = gcd(a[0], a[1])
        for i in range(2, len(a)):
            g = gcd(a[i], g)

        if k % g == 0 and k <= max(a):
            print("POSSIBLE")
        else:
            print("IMPOSSIBLE")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def gcd(a0, b0):
    a, b = max(a0, b0), min(a0, b0)
    while b != 0:
        a = a % b
        a, b = b, a

    return a


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    g = gcd(a[0], a[1])
    for i in range(2, len(a)):
        g = gcd(a[i], g)

    if k % g == 0 and k <= max(a):
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


if __name__ == '__main__':
    main()
Problem p02600 (python)

Fixed submission:
X= int(input())
if(X>=400 and X<=599):
	print(8)
elif(X>599 and X<800):
    print(7)
elif(X>=800 and X<1000):
    print(6)
elif(X>=1000 and X<1200):
    print(5)
elif(X>=1200 and X<1400):
    print(4)
elif(X>=1400 and X<1600):
    print(3)
elif(X>=1600 and X<1800):
    print(2)
elif(X>=1800 and X<2000):
    print(1)

Buggy submission (verdict: Runtime Error):
try:
	X= int(input())
  	if(X>=400 and X<=599):
    	print(8)
  	elif(X>599 and X<800):
    	print(7)
    elif(X>=800 and X<1000):
      	print(6)
    elif(X>=1000 and X<1200):
      	print(5)
    elif(X>=1200 and X<1400):
      	print(4)
    elif(X>=1400 and X<1600):
      	print(3)
    elif(X>=1600 and X<1800):
      	print(2)
    elif(X>=1800 and X<2000):
      	print(1)
except EOFError as e:
  print("")
Problem p02600 (python)

Fixed submission:
n = int(input())

if n <= 599:
    print("8")
elif n <=799:
    print("7")
elif n <=999:
    print("6")
elif n <=1199:
    print("5")
elif n <=1399:
    print("4")
elif n <=1599:
    print("3")
elif n <=1799:
    print("2")
elif n <=1999:
    print("1")

Buggy submission (verdict: Runtime Error):
n,k = input().split()
a = list(map(int,input().split()))
ten1 =0
ten2 =0
for x in range(int(n)-int(k)):
    ten1 = 0
    ten2 = 0
    for y in range(int(k)):
        ten1 += a[y+x]
        ten2 += a[y+1+x]
    if ten1 < ten2:
       print("Yes")
    else:
        print("No")

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

for x in range(n):
    if a[2] < a[1]:
        a[2] = a[2]*2
    elif a[0] > a[1]:
        a[1] = a[1]*2
    if a[0] < a[1] < a[2]:
        print("Yes")
        sys.exit()

print("No")
Problem p02687 (python)

Fixed submission:
n = input()

if n == "ABC":
    print("ARC")
else:
    print("ABC")

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

a = []
kaku = []
for x in range(n[1]) :
    a.append(list(map(int, input().split())))

kaku = [0]* len(m)
cou = 0

for x in range(n[1]):
    if m[a[x][0] -1 ] > m[a[x][1] -1 ]:
        kaku[a[x][0] -1 ] += 1
    else:
        kaku[a[x][0] - 1] -= 1000000

    if m[a[x][1] -1 ] > m[a[x][0] -1 ]:
        kaku[a[x][1] -1 ] += 1
    else:
        kaku[a[x][1] - 1] -= 1000000

for x in range(len(m)):
    if kaku[x] >= 0 :
        cou += 1

print(cou)
Problem p02696 (python)

Fixed submission:
import math

n = list(map(int,input().split()))
x = min(n[1]-1 , n[2])
if n[2] >= n[2]:
    print(math.floor(n[0] * x / n[1]))

Buggy submission (verdict: Runtime Error):
import math

n = list(map(int,input().split()))
x = min(b-1 , n[2])
if n[2] >= n[2]:
    print(math.floor(n[0] * x / n[1]))

Buggy submission (verdict: Runtime Error):
import math

n = list(map(int,input().split()))
#hikaku = 0

#for x in range(1,n[2]+1):
#    m = math.floor(n[0] * x // n[1]) - n[0] * math.floor(x // n[1])
#    if hikaku < m:
#        hikaku = m

x = min(b-1 , n[2])
if n[2] >= n[2]:
    print(math.floor(n[0] * x // n[1]))
Problem p02714 (python)

Fixed submission:
n = input()
s = list(input())
n = int(n)

r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r*g*b

for i in range(1,n):
    for j in range(min(i+1,n-i)):
        k = j*2 -i
        if j - i == k -j:
            if k <= n and s[i] != s[i+j] and s[i] != s[i-j] and s[i+j] != s[i-j]:
                ans -= 1
print(ans)

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

r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r*g*b

for i in range(1,n):
    for j in range(min(i+1,n-i)):
        if j - i == k -j:
            if k <= n and s[i] != s[i+j] and s[i] != s[i-j] and s[i+j] != s[i-j]:
                ans -= 1
print(ans)
Problem p02717 (python)

Fixed submission:
n=input().split()
X=n[0]
Y=n[1]
Z=n[2]

A=Y
B=X
C=A
A=Z

print(A,B,C)

Buggy submission (verdict: Runtime Error):
n=input().split()
m=input().split()

N=n[0]
Nn=n[1]
l = 0

for i in range(int(N)):
    if int(m[i])/(int(Nn)*4) >= 1:
        l+=1

if l >= int(Nn) :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
X=1
Y=2
Z=3

A=Y
B=X
C=A
A=Z

Print(A,B,C)
Problem p02732 (python)

Fixed submission:
import collections

n = int(input())
list1 = list(map(int,input().split()))
list2 = collections.Counter(list1)

kei1=0

for j in list2.values():
    kei1 += j * (j-1) // 2

for x in list1:
    print(kei1 - (list2[x] -1))

Buggy submission (verdict: Runtime Error):
import copy

n = int(input())
list1 = list(map(int,input().split()))
list2 = copy.copy(list1) 　　#全体の組み合わせ計算
list3 = copy.copy(list1)    #K番目の数字との組み合わせ計算

kei1=0
kei2=0

for x in range(n):
    l = list2.pop(0)
    if l in list2:
        kei1 += list2.count(l)

    k = list3.pop(x)
    if k in list3:
        kei2 += list3.count(k)

    print(kei1-kei2)
Problem p02780 (python)

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

m = [(e + 1) / 2 for e in p]

t = sum(m[0:K])
result = t
for i in range(N - K):
    t -= m[i]
    t += m[i + K]
    if t > result:
        result = t
print(result)

Buggy submission (verdict: Runtime Error):
import copy
n, k = input().split()
m = list(map(int, input().split()))
ans = 0
kazu =[]
kai = []
kitai2 = 0
for x in range(int(n)):
    kazu = []
    for l in range(int(k) - (int(k)-1)):
        if x+l < len(m):
           kazu.append(m[x+l])
    if ans < sum(kazu):
        ans = sum(kazu)
        kai = copy.deepcopy(kazu)

for j in range(int(k)):
    kitai = 0
    for g in range(kai[j]):
        kitai += g+1
    kitai2 += kitai / kai[j]
print(kitai2)
Problem p03371 (python)

Fixed submission:
a,b,c,x,y = map(int, input().split())
kei = 0
if c >= a/2 + b/2:
    kei = a * x + b*y

elif c*2 <= a+ b and a >= c * 2 and x > y:
    kei += c * (min(x,y)*2)
    kei += c * ((x - y)*2)

elif c*2 <= a+ b and b >= c * 2 and x < y:
    kei += c * (min(x,y)*2)
    kei += c * ((y - x)*2)

elif c <= a/2 + b/2:
    kei += c * (min(x,y)*2)
    if x > y:
        kei += a * (x -y)
    else:
        kei += b *(y-x)


print(kei)

Buggy submission (verdict: Runtime Error):
a,b,c,x,y = map(int, input().split())
kei = 0
if c > a/2 + b/2:
    kei = a * x + b*y

elif c*2 =< a+ b and a >= c*2 and b >= c*2:
    kei += c * (min(x,y)*2)
    if x > y:
        kei += c * ((x - y)*2)
    else:
        kei += c * ((y - x)*2)

elif c =< a/2 + b/2:
    kei += c * (min(x,y)*2)
    if x > y:
        kei += a * (x -y)
    else:
        kei += b *(y-x)


print(kei)
Problem p03387 (python)

Fixed submission:
n = list(map(int,input().split()))
ki = []
gu = []
count = 0

for x in range(3):
    if n[x] %2 == 0:
        ki.append(x)
    else:
        gu.append(x)

if len(gu) < len(ki) != 3:
    n[ki[0]] += 1
    n[ki[1]] += 1
    count +=1
elif len(ki) < len(gu) != 3:
    n[gu[0]] += 1
    n[gu[1]] += 1
    count +=1


n.sort(reverse=True)
count += (n[0] -n[1]) / 2
count += (n[0] -n[2]) / 2

print(int(count))

Buggy submission (verdict: Runtime Error):
n = int(input())
prev_t = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if (x + y) > (t - prev_t) or (x + y + (t - prev_t)) % 2:
        print("No")
        exit()
    prev_t = t
print("Yes")