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

Fixed submission:
"""
"""


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


def read_int(): return int(input())


def read_array(): return list(map(int, input().split(' ')))


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def solve(string):
    if string[2] == string[3] and string[4] == string[5]:
        print('Yes')
    else:
        print('No')


string = input()
solve(string)

Buggy submission (verdict: Runtime Error):
"""
"""


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


def read_int(): return int(input())


def read_array(): return list(map(int, input().split(' ')))


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def solve(string):
    if string[2] == string[3] and string[4] == string[5]:
        print('Yes')
    else:
        print('No')


T = read_int()

string = input()
solve(string)
Problem p02729 (python)

Fixed submission:
"""
"""

from math import factorial


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


def read_int(): return int(input())


def read_array(): return list(map(int, input().split(' ')))


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def combine(n, r):
    try:
        return (factorial(n) / factorial(n - r)) * (1 / r)
    except:
        return 0


def solve(N, M):
    choose_evens = combine(N, 2)
    choose_odds = combine(M, 2)
    return int(choose_evens + choose_odds)


N, M = read_array()
print(solve(N, M))

Buggy submission (verdict: Runtime Error):
"""
"""

from math import factorial


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


def read_int(): return int(input())


def read_array(): return list(map(int, input().split(' ')))


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


def combine(n, r):
    return (factorial(n) / factorial(n - r)) * (1 / r)


def solve(N, M):
    choose_evens = combine(N, 2)
    choose_odds = combine(M, 2)
    return choose_evens + choose_odds


print('input()', input())
N, M = read_array()
print('N, M', N, M)
solve(N, M)
Problem p02725 (python)

Fixed submission:
k, n = map(float, input().split())
m = list(map(float, input().split()))
half_k = k / 2
min = float(1000000)
for i in range(int(n)):
    first = m[i]
    last = m[i-1]
    len = last - first
    if len < 0:
        len = len + k
    if min > len:
        min = len
print(int(min))

Buggy submission (verdict: Runtime Error):
k, n = map(float, input().split())
m = list(map(float, input().split()))
min = float(0)
half_k = k / 2
for i in range(n):
    first = m[i]
    last = m[i-1]
    len = last - first
    if len < 0:
        len = len + k
    if min < len:
        min = len
print(int(min))
Problem p02835 (python)

Fixed submission:
value = map(int,input().strip().split())

def sumValue(values):
	sum_value = 0
	for value in values:
		sum_value = sum_value + value
	return sum_value

if sumValue(value) >= 22:
	print("bust")
else:
	print("win")

Buggy submission (verdict: Runtime Error):

value = map(int, input().strip().split())

def sumValue(values):
  sum_value = 0
  for value in values:
    sum_value = sum_value + value
  return sum_value


if sumVlaue(value) == 22:
  print("bust")
else:
  print("win")
Problem p02753 (python)

Fixed submission:
S = input()
a = S.count("A")

if a == 3 or a == 0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
a = count("A")
if a == 3:
    print("No")
else:
    print("Yes")
Problem p02771 (python)

Fixed submission:
A, B, C = map(int, input().split())

if A == B and B != C:
    print("Yes")
elif B == C and A != B:
    print("Yes")
elif A == C and A != B:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
vA, B, C = map(int, input().split())

if A == B and B != C:
    print("Yes")
elif B == C and A != B:
    print("Yes")
elif A == C and A != B:
    print("Yes")
else:
    pirnt("No")
Problem p02777 (python)

Fixed submission:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if S == U:
    A = A - 1 
else:
    B = B - 1 

print(str(A) + " " + str(B))

Buggy submission (verdict: Runtime Error):
S, T ＝ map(str, input().split())
A, B ＝ map(int, input().split())
U ＝ input()

if S ＝＝ U:
    A ＝ A － 1
else：
    B ＝ B － 1
  
print(A)
print(B)

Buggy submission (verdict: Runtime Error):
S, T ＝ map(str, input().split())
A, B ＝ map(int, input().split())
U ＝ input()

if S ＝＝ U：
    A ＝ A － 1
else：
    B ＝ B － 1
print(str(A)＋str(B))
Problem p02880 (python)

Fixed submission:
N = int(input())
aaa = 0 
box = []
for i in range(1, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1 
        break
    else:
        aaa = 0 
if aaa == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
aaa = 0
box = []
for i in range(0, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1
        print("Yes")
if aaa ==0:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
aaa = 0
box = []
for i in range(0, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1
        print("yes")
if aaa ==0:
    print("no")
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
S = S[0:K-1] + S[K-1].lower() + S[K:]
print(S)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
S[K-1] = S[K-1].lower()
print(S)
Problem p03075 (python)

Fixed submission:

list = []
for i in range(6):
    a = int(input())
    list.append(a)

flag = False
for i in range(5):
    for j in range(i+1, 5):
        if list[j] - list[i] > list[5]:
            flag = True

if flag:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = 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)

ABC = []
for i in range(X):
    for j in range(Y):
        if i + 1 + j + 1 > K:
            break
        for k in range(Z):
            if i + 1 + j + 1 + k + 1 > K:
                break
            ABC.append(A[i] + B[j] + C[k])

ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])
Problem p03108 (python)

Fixed submission:
import copy
N, M = map(int, input().split())
A = []
B = []
for i in range(M):
    a, b = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)


class UnionFind:
    def __init__(self, n):
        self.Parent = [-1 for i in range(N)]

    def root(self, x):
        if self.Parent[x] < 0:
            return x
        self.Parent[x] = self.root(self.Parent[x])
        return copy.deepcopy(self.Parent[x])

    def size(self, x):
        return -copy.deepcopy(self.Parent[self.root(x)])

    def connect(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.size(x) < self.size(y):
            x, y = y, x
        self.Parent[x] += copy.deepcopy(self.Parent[y])
        self.Parent[y] = x
        return True


ans = [0 for i in range(M)]
ans[M - 1] = N * (N - 1) / 2
unif = UnionFind(N)

for i in range(M-1, 0, -1):
    ans[i - 1] = ans[i]
    if unif.root(A[i]) != unif.root(B[i]):
        ans[i - 1] -= unif.size(A[i]) * unif.size(B[i])
        unif.connect(A[i], B[i])

for i in range(M):
    print(int(ans[i]))

Buggy submission (verdict: Runtime Error):
import copy
N, M = map(int, input().split())
A = []
B = []
for i in range(M):
    a, b = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)


class UnionFind:
    def __init__(self, n):
        self.Parent = [-1 for i in range(N)]

    def root(self, x):
        if self.Parent[x] < 0:
            return x
        self.Parent[x] = self.root(self.Parent[x])
        return copy.deepcopy(self.Parent[x])

    def size(self, x):
        return -copy.deepcopy(self.Parent[self.root(x)])

    def connect(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.size(x) < self.size(y):
            x, y = y, x
        self.Parent[x] += self.deepcopy(self.Parent[y])
        self.Parent[y] = x
        return True


ans = [0 for i in range(M)]
ans[M - 1] = N * (N - 1) / 2
unif = UnionFind(N)

for i in range(M-1, 1, -1):
    ans[i - 1] = ans[i]
    if unif.root(A[i]) != unif.root(B[i]):
        ans[i - 1] -= unif.size(A[i]) * unif.size(B[i])
        unif.connect(A[i], B[i])

for i in range(M):
    print(int(ans[i]))
Problem p02753 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
s1 = s[0]
s2 = s[1]
s3 = s[2]

if s1==s2:
	if s1==s3:
		print("No")
	else:
		print("Yes")
else:
	print("Yes")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
s1 = int(s[0])
s2 = int(s[1])
s3 = int(s[2])

if s1==s2:
	if s1==s3:
		print("No")
	else:
		print("Yes")
else:
	print("Yes")
Problem p02725 (python)

Fixed submission:
s = input().split(" ")
k = int(s[0])
n = int(s[1])

d = input().split(" ")
dist = []

for i in d:
    dist.append(int(i))

res = dist[n-1] - dist[0]

for i in range(1, n):
    diff = dist[i] - dist[i-1]
    aux = k - diff
    if aux < res:
        res = aux

print(str(res))

Buggy submission (verdict: Runtime Error):
s = input().split(" ")
k = int(s[0])
n = int(s[1])

d = input().split(" ")
dist = []

for i in range(0,n):
    dist.append(int(d[i]))

ex = dist[0] + k - dist[n-1]
res = k - ex

for i in range(1, n):
 	diff = dist[i] - dist[i-1]
    aux = res + ex - diff
    
    if aux < res:
        res = aux
        
	ex = diff

print(str(res))
Problem p02990 (python)

Fixed submission:
from math import factorial

def nCr(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))
  
mod = 10**9 + 7 
 
N,K = map(int,input().split())

for i in range(K):
  if (N - K - i) < 0:
    print(0)
  else:
    # 赤を仕切りと考える、仕切りの左右には箱(N-K+1個)がある、その中のどの箱(i+1個)を用いるか
    box_comb = nCr(N-K+1, i+1) % mod
    # 各箱にK個の青を入れる組み合わせ、空箱はナシ→K個の青の間(K-1)に仕切りをi個入れる
    blue_comb = nCr(K-1, i) % mod
    print((box_comb * blue_comb) % mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

def nCr(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))
  
mod = 10**9 + 7 
 
N,K = map(int,input().split())

for i in range(K):
  # 赤を仕切りと考える、仕切りの左右には箱(N-K+1個)がある、その中のどの箱(i+1個)を用いるか
  box_comb = nCr(N-K+1, i+1) % mod
  # 各箱にK個の青を入れる組み合わせ、空箱はナシ→K個の青の間(K-1)に仕切りをi個入れる
  blue_comb = nCr(K-1, i) % mod
  print((box_comb * blue_comb) % mod)
Problem p02785 (python)

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

h.sort(reverse = True)

if k > n:
  k = n

for i in range(k):
  h[i] = 0

ans = 0
for i in range(n):
  ans += h[i]
  
print(ans)

Buggy submission (verdict: Runtime Error):
h = int(input())
mem = [0] * 100
cnt = 0
 
def atk(k):
    if k == 1:
        mem[1] = 1
        return 1
    else:
        j = int(k // 2)
        l = 0
        while k / ( 2 ** l) >1:
            l += 1
 
        if mem[l] == 0:
            mem[l] = atk(j) * 2 + 1
            return mem[l]
        else:        
            return mem[l]

atk(h)
mem.sort(reverse = True)
print(mem[0])
Problem p02829 (python)

Fixed submission:
Answer = [1, 2, 3]

A = int(input())
B = int(input())

Answer.remove(A)
Answer.remove(B)

print(Answer[0])

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

i = 0
j = 0
bt = 0

while i < n:
  while j < n - i:
    if a[i+j] == i+1:
      bt += 1
      break
    if j + i == n-1:
      if i == 0:
        bt = -1
      j = n + 1
      i = n + 1
      
    j += 1
  i += 1
  
if bt != -1:
  bt = n - bt
  
print(bt)

Buggy submission (verdict: Runtime Error):
ans = [1, 2, 3]
ans.romove(int(input()))
ans.romove(int(input()))

print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
 
  while x % y != 0:
    z = y
    y = x % y
    x = z
  return y
 
def lcm(m,n):
  return int(m * n / gcd(m,n))
 
inputNum = list(map(int, input().split()))
a = inputNum[0]
b = inputNum[1]
 
print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
 
  while x % y != 0:
    z = y
    y = x % y
    x = z
  return y
 
def lcm(m,n):
  return int(m * n / gcd(m,n))
 
inputNum = list(map(int, input().split()))
a = inputNum[0]
b = inputNum[1]
 
print(gcd(a,b))
print(lcm(a,b))
Problem p02832 (python)

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

bt = 0 #break times
i = 0  
j = 0  #iterator

while i < n:
  while j < n:
    if array[j] == i+1:
      bt += 1
      break
      
    else:
      if j == n-1:
        if i == 0:
          bt = -1
          i = n+1
          j = n+1
          break
        else:
          i = n+1
          j = n+1
          break
          
    j += 1
  i +=1
  
if bt != -1:
  bt = n - bt
  
print(bt)

Buggy submission (verdict: Runtime Error):
N = int(input()) - 1
array = list(map(int, input().split()))

breaktime = 0
i = 0
while i <= N:
  for j in range(N+1):
    if array[j] == i+1:
      del array[i:j]
      N = N - (j - i)
      breaktime += j-i
      break
    if j==N and array[j] != i+1:
      if i == 0:
        breaktime = -1
      else:
        del array[i:]
        breaktime += N-i+1
        break
  if breaktime == -1:
    break
  i += 1

print(breaktime)
Problem p02834 (python)

Fixed submission:
#読み込み部
N, u, v = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N-1)]

#グラフ作成部
graph = [[] for i in range(N+1)]
for i,j in AB:
    graph[i].append(j)
    graph[j].append(i)

#深さ優先探索
def dfs(v):
    dist = [-1] * (N+1)
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in graph[v]:
            if dist[w] >= 0:
                continue
            dist[w] = dw
            stack.append(w)
    return dist

DU,DV = dfs(u),dfs(v)
 
answer = 0
for u,v in zip(DU[1:],DV[1:]):
    if u < v:
        x = v - 1
        if answer < x:
            answer = x

print(answer)

Buggy submission (verdict: Runtime Error):
n, u, v = int(input())
print(n, u, v)
Problem p02847 (python)

Fixed submission:
def f(S):
    d = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
    return print(d[str(S)])
f(input())

Buggy submission (verdict: Runtime Error):
def f(N,S):
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ret_s = ""
    for s in S:
        num = (alpha.index(str(s)) + int(N))
        if num <= 25:
            pass
        else:
            num = num-(num//26)*26
        ret_s += alpha[num]
    return print(ret_s)

a = input()
b = input()

f(a,b)

Buggy submission (verdict: Runtime Error):
def f(N,S):
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ret_s = ""
    for s in S:
        num = (alpha.index(str(s)) + int(N))
        if num <= 25:
            pass
        else:
            num = num-(num//26)*26
        ret_s += alpha[num]
    return print(ret_s)

a = input()
b = input()
Problem p02777 (python)

Fixed submission:
S,T = input().split()
cnt = [int(i) for i in input().split()]
U = input()
 
if U == S:
  cnt[0] -= 1
else:
  cnt[1] -= 1

print(" ".join([str(j) for j in cnt]))

Buggy submission (verdict: Runtime Error):
S,T = input().split()
cnt = [int(i) for i input().split()]
U = input()

if U == S:
  cnt[0] -= 1
else:
  cnt[1] -= 1

print(" ".join(cnt))
Problem p02779 (python)

Fixed submission:
import numpy as np

N = int(input())
S = np.array([int(i) for i in input().split()])

if len(np.unique(S))==len(S):
  print("YES")
else:
  print("NO")

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

flg = 0
for i in range(1,N):
  if S[i] = S[i-1]:
    flg = 1
    
if flg == 1:
  print("NO")
else:
  print("YES")
Problem p02832 (python)

Fixed submission:
# シンプルに左から探索するだけ
N = int(input())
A = [int(i) for i in input().split()]

L = [i+1 for i in range(N)]

cnt = 0
k = 0
for j in A:
  if j == L[k]:
    k += 1
  else:
    cnt += 1 

if k == 0:
  print(-1)
else:
  print(cnt)

Buggy submission (verdict: Runtime Error):
# シンプルに左から探索するだけ
N = int(input())
A = [int(i) for i in input().split()]

L = [i+1 for i in range(3)]

cnt = 0
k = 0
for j in A:
  if j == L[k]:
    k += 1
  else:
    cnt += 1 

if k == 0:
  print(-1)
else:
  print(cnt)
Problem p02912 (python)

Fixed submission:
from heapq import heappop, heappush, heapify
n, m = map(int, input().split())
a = [-int(i) for i in input().split()]

heapify(a)
for _ in range(m):
  l = heappop(a)
  heappush(a, -((-l)//2))

print(-sum(a))

Buggy submission (verdict: Runtime Error):
from heapq import heappop, heappush, heapify
n, m = map(int, input().split())
a = [-int(i) for i in input().split()]

heapify(a)
for _ in range(m):
  l = heappop(a)
  heappush(a, -((-l)//2))
  print(l,a)

print(-sum(a))
Problem p02793 (python)

Fixed submission:
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c=c*A_//fractions.gcd(c,A_)
for A_ in A:
    a+=c//A_
print(int(a%w))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c=c*A_//fractions.gcd(c,A_)
for A_ in A:
    a+=c/A_
print(int(a%w))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=((a+c//A_)*c_/c)%w
    #a=(a*c_//c+c_//A_)%w
    c=c_
print(int(a))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=((a+c//)*c_/c)%w
    #a=(a*c_//c+c_//A_)%w
    c=c_
print(int(a))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=((a+c/A_)*c_//c)%w
    #a=(a*c_//c+c_//A_)%w
    c=c_
print(int(a))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=(a*c_/c+c_//A_)%w
    c=c_
print(int(a))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=(a*c_//c+c_/A_)%w
    c=c_
print(int(a))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=(a*c_/c+c_/A_)%w
    c=c_
print(int(a))

Buggy submission (verdict: Runtime Error):
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for i in range(N):
    c_=c*A[i]//fractions.gcd(c,A[i])
    a=a*c_/c+c_/A[i]
    c=c_
print(int(a%w))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for i in range(N):
    c_=c*A[i]//math.gcd(c,A[i])
    a=a*c_/c+c_/A[i]
    c=c_
print(int(a%w))
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(map(int,input().split()))
S.sort()
S.reverse()
p = [S.pop(0)]
c = S
f = False

for i in range(N):
    np = []
    nc = []
    for j in range(len(p)):
        for k in range(len(c)):
            if c[k] < p[j]:
                np.append(c.pop(k))
                f = True
                break
        if f == False:
            print("No")
            exit(0)
        f = False
    print(np)
    p += np
    p.sort()
    p.reverse()

print("Yes")
Problem p02951 (python)

Fixed submission:
strList = input().split()
A, B, C = [int(s) for s in strList]

if (A - B) >= C:
    print(0)
elif A - B < C:
    print(C - A + B)

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

result = 0

if len(num) != 1:
  result = int((len(num)-2)//2 * ("90") + "9")

if len(num) % 2 == 0:
  print(result)
else:
  AAA = int("1" + (len(num) - 1) * "0") - 1
  print(result + int(num) - AAA)
Problem p03286 (python)

Fixed submission:
def sigma4jou(k):
    total = 0
    for i in range(k):
        total += 4 ** (i)
    return(total)

def pketa(N):
    k = 1
    while N - sigma4jou(k) > 0:
        k += 1
    return(2 * k - 1)

def mketa(N):
    k = 1
    while N + 2 * sigma4jou(k) < 0:
        k += 1
    return(2 * k)

def getResult(N):
    result = ""
    if N == 0:
        result += "0"
    elif N > 0:
        k = pketa(N)
        for i in range(k, 0, -2):
            j = int((i+1)/2)
            if abs((sigma4jou(j) - N) // (2 ** (i-1))) % 2 == 0:
                result += "1"
            else:
                result += "0"
            if i > 1:
                if abs(((sigma4jou(j) - N)) // (2 ** (i-2))) % 2 == 1:
                    result += "1"
                else:
                    result += "0"
    elif N < 0:
        k = mketa(N)
        for i in range(k, 0, -2):
            j = int(i/2)
            if abs((N + 2 * sigma4jou(j)) // (2 ** (i-1))) % 2 == 0:
                result += "1"
            else:
                result += "0"
            if i > 1:
                if abs(((N + 2 * sigma4jou(j))) // (2 ** (i-2))) % 2 == 1:
                    result += "1"
                else:
                    result += "0"
    return(result)

N = int(input())
print(getResult(N))

Buggy submission (verdict: Runtime Error):
def sigma4jou(k):
    total = 0
    for i in range(k):
        total += 4 ** (i)
    return(total)

def pketa(N):
    k = 1
    while N - sigma4jou(k) > 0:
        k += 1
    return(2 * k - 1)

def mketa(N):
    k = 1
    while N + 2 * sigma4jou(k) < 0:
        k += 1
    return(2 * k)

def getResult(N):
    result = ""
    if N == 0:
        result += "0"
    elif N > 0:
        k = pketa(N)
        for i in range(k, 0, -2):
            j = int((i+1)/2)
            if abs((sigma4jou(j) - N) // (2 ** (i-1))) % 2 == 0:
                result += "1"
            else:
                result += "0"
            if i > 1:
                if abs(((sigma4jou(j) - N)) // (2 ** (i-2))) % 2 == 1:
                    result += "1"
                else:
                    result += "0"
    elif N < 0:
        k = mketa(N)
        for i in range(k, 0, -2):
            j = int(i/2)
            if abs((N + 2 * sigma4jou(j)) // (2 ** (i-1))) % 2 == 0:
                result += "1"
            else:
                result += "0"
            if i > 1:
                if abs(((N + 2 * sigma4jou(j))) // (2 ** (i-2))) % 2 == 1:
                    result += "1"
                else:
                    result += "0"
    return(result)

N = input()
print(getResult(N))
Problem p03315 (python)

Fixed submission:
stri = input()
stri = stri.replace("+", "1 ").replace("-", "-1 ")
numList = [int(s) for s in stri.split()]

print(sum(numList))

Buggy submission (verdict: Runtime Error):
stri = input()
stri = stri.replace("+", "1 ").replace("-", "-1 ")
numList = [int(s) for s in stri.split()]

print(sum(intList))