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

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N = int(input())
g = [[] for _ in range(N)]
ans = [0 for _ in range(N-1)]

def dfs(v, c=-1, p=-1):
    k = 1
    for i in range(len(g[v])):
        u = g[v][i][0]
        ei = g[v][i][1]
        if u == p:
            continue
        if k == c:
            k += 1
        ans[ei] = k
        k += 1
        dfs(u, ans[ei], v)


for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append([b, i])
    g[b].append([a, i])
dfs(0)
mx = 0
for i in range(N):
    mx = max(mx, len(g[i]))
print(mx)
for i in range(N-1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
g = [[] for _ in range(N)]
ans = [0 for _ in range(N-1)]

def dfs(v, c=-1, p=-1):
    k = 1
    for i in range(len(g[v])):
        u = g[v][i][0]
        ei = g[v][i][1]
        if u == p:
            continue
        if k == c:
            k += 1
        ans[ei] = k
        k += 1
        dfs(u, ans[ei], v)


for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append((b, i))
    g[b].append((a, i))
dfs(0)
mx = 0
for i in range(N):
    mx = max(mx, len(g[i]))
print(mx)
for i in range(N-1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
g = [[] for _ in range(N)]
ans = [[] for _ in range(N-1)]

def dfs(v, c=-1, p=-1):
    k = 1
    for i in range(len(g[v])):
        u = g[v][i][0]
        ei = g[v][i][1]
        if u == p:
            continue
        if k == c:
            k += 1
        ans[ei] = k
        k += 1
        dfs(u, ans[ei], v)


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

Buggy submission (verdict: Runtime Error):
N = int(input())
g = [[] for _ in range(N)]
ans = [[] for _ in range(N-1)]

def dfs(v, c=-1, p=-1):
    k = 1
    for i in range(len(g[v])):
        u = g[v][i][0]
        ei = g[v][i][1]
        if u == p:
            continue
        if k == c:
            k += 1
        ans[ei] = k
        k += 1
        dfs(u, ans[ei], v)


for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append((b, i))
    g[b].append((a, i))
dfs(0)
mx = 0
for i in range(N):
    mx = max(mx, len(g[i]))
print(mx)
for i in range(N-1):
    print(ans[i])
Problem p02921 (python)

Fixed submission:
*A, = input()
*B, = input()
ans = 0
if A[0] == B[0]:
  ans += 1
if A[1] == B[1]:
  ans += 1
if A[2] == B[2]:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
n = np.array(n)
m = np.array(m)
x = n % m
print(sum(x))
Problem p02922 (python)

Fixed submission:
A, B = map(int, input().split())
ans = 0
tap = 0
for i in range(10000):
    if B == 1:
        break
    if i == 0:
        tap += A
        ans += 1
    if i >= 1:
        tap -= 1
        tap += A
        ans += 1
    if tap >= B:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
ans = math.ceil((A-1)/(B-1))
print(ans)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if B % A = 0:
  print(int(B//A * A))
else:
  print(B//A * A + 1)
Problem p02924 (python)

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy submission (verdict: Runtime Error):
N = int(input())
n = [x for x in range(1, N+1)]
print(sum[:-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
n = np.array(n)
m = np.array(m)
x = n % m
print(sum(x))
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
to = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

count = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    count[p] += x

stack = [0]
visited = [0] * N
while stack:
    v = stack.pop()
    visited[v] = 1
    for next_v in to[v]:
        if visited[next_v] == 1:
            continue
        count[next_v] += count[v]
        stack.append(next_v)
print(*count)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
rl = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    rl[a].append(b)
    rl[b].append(a)
cnt = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    cnt[p] += x

def dfs(v, pv):
    for next_v in rl[v]:
        if next_v == pv:
            continue
        cnt[next_v] += cnt[v]
        dfs(next_v, v)
dfs(0, -1)
print(cnt)

Buggy submission (verdict: Runtime Error):
def dfs(v, p=-1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

N, Q = map(int, input().split())
to = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
ans = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
dfs(0)
print(*ans)
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())
K = A + B
if K % 2 == 0:
    print(K//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)
dp = [[0] * 13 for _ in range(l+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
mul = 1
for i in range(l):
    if S[-(i+1)] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(j * mul + k) % 13] += dp[i][k]
                dp[i+1][(j * mul + k) % 13] %= MOD
    else:
        j = int(S[-(i+1)])
        for k in range(13):
            dp[i+1][(j * mul + k) % 13] += dp[i][k]
            dp[i+1][(j * mul + k) % 13] %= MOD
    mul = mul * 10 % 13
print(dp[l][5])
Problem p02960 (python)

Fixed submission:
S = input()
l = len(S)
dp = [[0] * 13 for _ in range(l+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
mul = 1
for i in range(l):
    if S[-(i+1)] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(j * mul + k) % 13] += dp[i][k]
                dp[i+1][(j * mul + k) % 13] %= MOD
    else:
        j = int(S[-(i+1)])
        for k in range(13):
            dp[i+1][(j * mul + k) % 13] += dp[i][k]
            dp[i+1][(j * mul + k) % 13] %= MOD
    mul = mul * 10 % 13
print(dp[l][5])

Buggy submission (verdict: Runtime Error):
s=input()
l=len(s)
mod=10**9+7
dp=[[0 for j in range(13)] for i in range(l+1)]
dp[0][0]=1 #初期値の設定
for i in range(l):
if s[i]=='?': #?のときは各値(0～9)について更新する
  for j in range(10):
    for k in range(13):
      dp[i+1][(k*10+j)%13]+=dp[i][k]%mod
else:
  for k in range(13): #整数のときはその値について更新する
    dp[i+1][(k*10+int(s[i]))%13]+=dp[i][k]%mod
print(dp[-1][5]%mod) #最後まで更新を行ったときのあまりが5となる数の個数が答え

Buggy submission (verdict: Runtime Error):
S = input()
L = len(input())
dp = [[0 for _ in range(13)] for _ in range(L+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
for i in range(L):
  if S[i] == '?':
    for j in range(10):
      for k in range(13):
        dp[i][(k*10+j)%13] += dp[i][j]
  else:
    for k in range(13):
      dp[i][(k*10+int(i))%13] += dp[i][j]
print(dp[L][5]

Buggy submission (verdict: Runtime Error):
S = input()
L = len(input())
dp = [[0] * 13 for _ in range(L+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
for i in range(L):
  if S[i] == '?':
    for j in range(10):
      for k in range(13):
        dp[i][(k*10+j)%13] += dp[i][j]
  else:
    for k in range(13):
      dp[i][(k*10+int(i))%13] += dp[i][j]
print(dp[L][5]
Problem p02971 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A)
for x in A:
    if x == B[-1]:
        print(B[-2])
    else:
        print(B[-1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
*H, = map(int, input().split())
H.sort(reverse=True)
if len(H) - K <= 0:
    print(0)
else:
    print(sum(H[K:]))
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())
print((A*3+P)//2)

Buggy submission (verdict: Runtime Error):
A, P = map(int, input())
print((A*3+P)//2)
Problem p03032 (python)

Fixed submission:
N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for pick in range(min(K+1, N+1)):
    for right in range(pick+1):
        left = pick-right
        pick_list = V[:right]+V[N-left:]

        pick_list = sorted(pick_list)
        tmp_ans = sum(pick_list)
        rem = min(K-pick, len(pick_list))
        for i in range(rem):
            if pick_list[i] < 0:
                tmp_ans -= pick_list[i]
            else:
                break
        ans = max(tmp_ans, ans)
print(ans)

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

for pick in range(min(K+1, N+1)):
    for right in range(pick+1):
        left = pick - right
        pick_list = V[:right] + V[N-left:]

        pick_list = sorted(pick_list)
        tmp_ans = sum(pick_list)
        rem = min(K - pick, len(pick_list))
        for i in range(rem):
            if pick_list[i] < 0:
                tmp_ans -= pick_list[i]
            else:
                break
        ans = max(tmp_ans, ans)
print(ans)

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

for pick in range(min(K+1, N+1)):
    for right in range(pick+1):
        left = pick - right
        pick_list = V[:right] + V[N-left:]

        pick_list.sort()
        tmp_ans = sum(pick_list)
        rem = min(K - pick, len(pick_list))
        for i in range(rem):
            if pick_list[i] < 0:
                tmp_ans -= pick_list[i]
            else:
                break
        ans = max(tmp_ans, ans)
print(ans)

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

for pick in range(min(K+1, N+1)):
    for right in range(pick+1):
        left = pick - right
        pick_list = V[:right] + V[N-left:]

        pick_list.sort()
        tmp_ans = sum(pick_list)
        rem = min(K - pick, len(pick_list))
        for i in range(rem):
            if pick_list[i] < 0:
                tmp_ans -= pick_list[i]
            else:
                break
        ans = max(tmp_ans, ans)
print(ans)
Problem p03238 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
if N == 1:
    print('Hello World')
else:
    print(A+B)

Buggy submission (verdict: Runtime Error):
N, A, B, = map(int, [int(input()) for _ in range(3)])
if N == 1:
    print('Hello World')
else:
    print(A+B)
Problem p03243 (python)

Fixed submission:
S = input()
if len(set(S)) == 1:
    print(S)
    exit()
for i in range(int(S), 1000):
    if len(set(str(i))) == 1:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
S = input()
if len(set(S)) == 1:
    print(S)
    exit()
for i in range(int(S), 1000):
    if len(set(i)) == 1:
        print(i)
        exit()
Problem p03262 (python)

Fixed submission:
import fractions
N, X = map(int, input().split())
*x, = [int(v) - X for v in input().split()]
chk = 0
for v in x:
    chk = fractions.gcd(chk, v)
print(abs(chk))

Buggy submission (verdict: Runtime Error):
import fractions
N, X = map(int, input().split())
*x, = sorted(list(map(int, input().split())))
kyori = sorted([abs(X - xx) for xx in x])
print(fractions.gcd(kyori[0], kyori[1]))
Problem p03263 (python)

Fixed submission:
H, W = map(int, input().split())
a = [list(map(int, input().split()))for _ in range(H)]
ans = []
for i in range(H):
    for j in range(W-1):
        if a[i][j] % 2 == 1:
            a[i][j] -= 1
            a[i][j+1] += 1
            ans.append([i, j, i, j+1])

w = W - 1
for i in range(H-1):
    if a[i][w] % 2 == 1:
        a[i][w] -= 1
        a[i+1][w] += 1
        ans.append([i, w, i+1, w])
print(len(ans))
aaaa = [list(map(lambda x: x+1, li)) for li in ans]
for x,y,z,a in aaaa:
    print(x, y, z, a)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = [list(map(int, input().split()))for _ in range(H)]
ans = []
for i in range(H):
    for j in range(W-1):
        if a[i][j] % 2 == 1:
            a[i][j] -= 1
            a[i][j+1] += 1
            ans.append([i, j, i, j+1])

w = W - 1
for i in range(H-1):
    if a[i][w] % 2 == 1:
        a[i][w] -= 1
        a[i+1][w] += 1
        ans.append([i, w, i+1, w])
print(len(ans))
for x in [list(map(lambda x: x+1, li)) for li in ans]:
    print(*x,)
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
print(max([A+B, A-B, A*B]))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())
print(max(max(A+B, A-B), A*B))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())
print(max(A+B, A-B, A*B))
Problem p03380 (python)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
A.sort()
m = A[-1]
x = m / 2
ans = A[0]
for i in range(1, N-1):
    if abs(ans - x) > abs(A[i] - x):
        ans = A[i]
print(m, ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
N = int(input())
*A, = map(int, input().split())
A.sort()
m = A[-1]
x = m / 2
print(m, min(abs(x - A[bisect_left(A, x)]), abs(x - A[bisect_left(A, x) + 1])))
Problem p03424 (python)

Fixed submission:
_ = input()
*S, = input().split()
l = len(set(S))
if l == 4:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
_ = input()
*S, = map(int, input().split())
l = len(set(S))
if l == 4:
    print("Four")
else:
    print("Three")
Problem p03487 (python)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
dic = {}
ans = 0
for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1
for k, v in dic.items():
    if k == v:
        continue
    elif k > v:
        ans += v
    else:
        ans += v - k
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
*A, = map(int, input().split())
dic = {}
for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1
for k, v in dic.items():
    if k == v:
        continue
    elif k > v:
        ans += v
    else:
        ans += v - k
print(ans)
Problem p03543 (python)

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

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

Fixed submission:
N = int(input())
K = int(input())
ans = 1
for _ in range(N):
  ans = min(ans*2, ans+K)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = 1
for _ in range(N):
  ans += min(ans*2, ans+K)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = 1
for _ in range(N):
  ans = min(ans*2, ans+K)
print(ans)
Problem p04031 (python)

Fixed submission:
n = int(input())
*a, = map(int, input().split())
atai = round(sum(a) / n)
ans = 0
for x in a:
    if x == atai:
        pass
    else:
        ans += (x - atai) ** 2
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
*a, = map(int, input())
atai = math.ceil(sum(a) / n)
ans = 0
for x in a:
  if x == atai:
    pass
  else:
    ans += (x - atai) ** 2
print(ans)
Problem p02556 (python)

Fixed submission:
import numpy as np

def dist(d1, d2):
    return abs(d1[0]-d2[0]) + abs(d1[1]-d2[1])

n = int(input())
list1 = np.zeros((n))
list2 = np.zeros((n))
xy_list = []
for i in range(n):
    x, y = map(int, input().split())
    xy_list.append([x, y])
    list1[i] = x+y
    list2[i] = x-y

num = np.zeros((4), dtype=int)
num[0] = np.argmax(list1)
num[1] = np.argmax(list2)
num[2] = np.argmin(list1)
num[3] = np.argmin(list2)

ans = 0
for d1 in range(4):
    for d2 in range(d1+1, 4):
        # print(num[d1], num[d2], dist(xy_list[num[d1]], xy_list[num[d2]]))
        ans = max(ans, dist(xy_list[num[d1]], xy_list[num[d2]]))

print(ans)

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

def dist(d1, d2):
    return abs(d1[0]-d2[0]) + abs(d1[1]-d2[1])

n = int(input())
list1 = np.zeros((n))
list2 = np.zeros((n))
xy_list = []
for i in range(n):
    x, y = map(int, input().split())
    xy_list.append([x, y])
    list1[i] = x+y
    list2[i] = x-y

num = np.zeros((4), dtype=int)
num[0] = np.argmax(list1)
num[1] = np.argmax(list2)
num[2] = np.argmin(list1)
num[3] = np.argmin(list2)

ans = 0
for d1 in range(4):
    for d2 in range(d1+1, 4):
        # print(num[d1], num[d2], dist(xy_list[num[d1]], xy_list[num[d2]]))
        ans = max(ans, dist(xy_list[num[d1]], xy_list[num[d2]]))

print(ans)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if n==0:
    print(x)
else:
    p = list(map(int, input().split()))
    p.sort()
    i = 0
    while i < n and p[i] < x:
        i += 1

    if p[i] != x:
        print(x)
    else:
        j = 1
        up = x+j
        down = x-j
        while True:
            if i-j>=0 and p[i-j] != x-j:
                print(x-j)
                break
            elif i-j < 0:
                print(x-j)
                break
            if i+j<n and p[i+j] != x+j:
                print(x+j)
                break
            elif i+j >= n:
                print(x+j)
                break
            j += 1

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n==0:
    print(x)
else:
    p = list(map(int, input().split()))
    p.sort()
    i = 0
    while i < n and p[i] < x:
        i += 1

    if p[i] != x:
        print(x)
    else:
        j = 1
        up = x+j
        down = x-j
        while True:
            if p[i-j] != x-j:
                print(x-j)
                break
            if p[i+j] != x+j:
                print(x+j)
                break
            j += 1
Problem p02647 (python)

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

diff_list = [0 for num in range(n)]
diff_list[0] = a_in[0]
for i in range(1, n):
    diff_list[i] = a_in[i] - a_in[i-1]

itr = k
if k > 41:
    itr = 41
for i in range(itr):
    new_list = [0 for num in range(n)]
    d_sum = 0
    for j, d in enumerate(diff_list):
        d_sum += d
        if j-d_sum > 0:
            new_list[j-d_sum] += 1
        else:
            new_list[0] += 1
        if d_sum+j+1 < n:
            new_list[j+d_sum+1] -= 1
    # print(new_list)
    diff_list = new_list.copy()

ans = 0
for d in diff_list:
    ans += d
    print(ans, end= ' ')

Buggy submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
a_in = list(map(int, input().split()))

diff_list = [0 for num in range(n)]
diff_list[0] = a_in[0]
for i in range(1, n):
    diff_list[i] = a_in[i] - a_in[i-1]

itr = k
if k > 10*math.log(n):
    itr = 10*math.log(n)
for i in range(itr):
    new_list = [0 for num in range(n)]
    d_sum = 0
    for j, d in enumerate(diff_list):
        d_sum += d
        if j-d_sum > 0:
            new_list[j-d_sum] += 1
        else:
            new_list[0] += 1
        if d_sum+j+1 < n:
            new_list[j+d_sum+1] -= 1
    # print(new_list)
    diff_list = new_list.copy()

ans = 0
for d in diff_list:
    ans += d
    print(ans, end= ' ')
Problem p02697 (python)

Fixed submission:
n, m = map(int, input().split())
center1 = (m+1) // 2
center2 = center1 + m
for i in range(m):
    if i % 2 == 0:
        a = center1 - i // 2
        b = center1 + i // 2 + 1
    else:
        a = center2 - i // 2
        b = center2 + (i+1) // 2 + 1
    print(f"{a} {b}")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if 2*m+1 == n:
    for i in range(1, m+1):
        print(f"{i} {n-i}")
else:
    array = [0]*(n+1)
    now = 1
    for i in range(1, m+1):
        while array[now] == 1:
            now += 1
        print(f"{now} {now+i}")
        array[now+i] = 1
        now += 1
Problem p02717 (python)

Fixed submission:
x, y, z = map(int, input().split())
print(z, end=' ')
print(x, end=' ')
print(y)

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
print(f'{z} {x} {y}')
Problem p02721 (python)

Fixed submission:
n, k, c = map(int, input().split())
s = " " + input()
work_fw = [0]*k
work_bw = [0]*k
i = 1
now_k = 0
while i <= n and now_k < k:
    if s[i] == 'o':
        work_fw[now_k] = i
        now_k += 1
        i += c
    i += 1
if now_k != k:
    print("")
else:
    i = n
    now_k = k - 1
    while i > 0 and now_k >= 0:
        if s[i] == 'o':
            work_bw[now_k] = i
            now_k -= 1
            i -= c
        i -= 1
    # print(work_fw)
    # print(work_bw)
    for i in range(k):
        if work_fw[i] == work_bw[i]:
            print(work_fw[i] )

Buggy submission (verdict: Runtime Error):
common = []

def bool_work(s, n, k, c):
    i = 0
    while s[i] == 'o':
        if i+c+1 < n:
            j = 1
            if s[j] == 'x':
                while s[j] == 'x':
                    j += 1
            wo_i = bool_work(s[j:], n - j, k, c)
            if j < i+c+1:
                j = i+c+1
                if s[j] == 'x':
                    while s[j] == 'x':
                        j += 1
            w_i = bool_work(s[j:], n - j, k - 1, c)
            if wo_i == 0 and w_i == 1:
                common.append(i)
                return 1
            if wo_i + w_i >= 2:
                return 2
            else:
                return wo_i + w_i
        elif i+c+1 >= n:
            if k > 1:
                return 0
            elif n == 1:
                return 1
            else:
                for char in s[1:]:
                    if char == 'o':
                        return 2
                return 1


n, k, c = map(int, input().split())
s = input()
while s[-1] == 'x':
    s.pop(-1)
bool_work(s, n, k, c)
for com in common:
    print(com)
Problem p02953 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
flag = 0
result = 1
for i in range(n-1):
	if h[i]==h[i+1]+1 and flag==0:
		flag=1
	elif h[i]==h[i+1] and flag==1:
		continue
	elif h[i]<=h[i+1]:
		flag=0
	else:
		result = 0
if result:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
flag = 0
result = 1
for i in range(n-1):
	if h[i]==h[i+1]+1 and flag==0:
		flag=1
	elif h[i]==h[i+1] and flag==1:
	elif h[i]<=h[i+1]:
		flag=0
	else:
		result = 0
if result:
	print("Yes")
else:
	print("No")
Problem p02786 (python)

Fixed submission:
def calc(x):
  if x == 0:
    return 0;
  return 1 + calc(x // 2) * 2

h = int(input())

print(calc(h))

Buggy submission (verdict: Runtime Error):
def calc(x):
  return 1 + calc(x // 2)

h = int(input())

print(calc(h))
Problem p02705 (python)

Fixed submission:
a=float(input())
print(a*2*3.1415926535)

Buggy submission (verdict: Runtime Error):
a
Problem p02843 (python)

Fixed submission:
a = int(input())
if a%100<=((a-(a%100))/100)*5:
    print(1)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
a = input()
if (a%100)<=(a/100*5):
    print(1)
else:
	print(0)