Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# D - Face Produces Unhappiness

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
S = input()
prev_c = None
s_compressed = ""
score = 0
for c in S:
    if c != prev_c:
        s_compressed += c
    else:
        # 初期スコアを出す
        score += 1

    prev_c = c

if len(s_compressed) == 1:
    print(N - 1)
    quit()
else:
    score += 2 * K

print(min((N - 1, score)))


Fixed submission:
# D - Face Produces Unhappiness

import sys
input = sys.stdin.readline
N, K = map(int, input().split())
S = input()

prev_c = None
score = 0
for c in S:
    if c == prev_c:
        score += 1
    prev_c = c

score += 2 * K

print(min((N - 1, score)))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split(' '))
sum = 0
ans = 0
while sum =< B:
    ans +=1
    sum += A
print(ans)

Fixed submission:
A, B = map(int, input().split(' '))
sum = 1
ans = 0
while sum < B:
    ans += 1
    sum += A - 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sum = 0
for i in range(1, N):
    sum += i
print(sum)

Fixed submission:
N = int(input())
print((1 + (N - 1)) * (N - 1) // 2)
Buggy python submission (verdict: Runtime Error):
a = input()
s = input()
if a >= 3200:
    print(s)
else:
    print('red')

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
list = list(map(int, input().split(' ')))

result = []
for v in itertools.permutations(list, N):
    avg = 0
    for num in v:
        if avg == 0:
            avg = num
        else:
            avg = (num + avg) / 2
    result.append(avg)

print(max(result))


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

list.sort()
avg = 0
for num in list:
    if avg == 0:
        avg = num
    else:
        avg = (num + avg) / 2
print(avg)
Buggy python submission (verdict: Runtime Error):
"""Even Relation
https://atcoder.jp/contests/abc126/tasks/abc126_d
"""
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000)


class Node:
    def __init__(self, node_id, color):
        self.node_id = node_id
        self.color = color
        self.edges = []

class Edge:
    def __init__(self, to, length):
        self.to = to
        self.length = length


def dfs(node, p):
    for edge in node.edges:
        # 親への枝は何もしない
        if edge.to == p:
            continue
        # 枝が偶数なら子を同じ色で塗る
        if edge.length % 2 == 0:
            graph[edge.to].color = node.color
        else:
            if node.color == 1:
                graph[edge.to].color = 0
            else:
                graph[edge.to].color = 1

        dfs(graph[edge.to], node.node_id)


N = int(input())

# グラフ初期化
graph = [Node(node_id=i, color=-1) for i in range(N + 1)]
for i in range(N - 1):
    u, v, w = map(int, input().split())
    graph[u].edges.append(Edge(v, w))
    graph[v].edges.append(Edge(u, w))

# 最初は0始まり
graph[1].color = 0

dfs(graph[1], -1)


for i in range(1, N + 1):
    print(graph[i].color)


Fixed submission:
"""Even Relation
https://atcoder.jp/contests/abc126/tasks/abc126_d
"""
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5 + 1)


class Node:
    def __init__(self, node_id, color):
        self.node_id = node_id
        self.color = color
        self.edges = []

class Edge:
    def __init__(self, to, length):
        self.to = to
        self.length = length


def dfs(node, p):
    for edge in node.edges:
        # 親への枝は何もしない
        if edge.to == p:
            continue
        # 枝が偶数なら子を同じ色で塗る
        if edge.length % 2 == 0:
            graph[edge.to].color = node.color
        else:
            if node.color == 1:
                graph[edge.to].color = 0
            else:
                graph[edge.to].color = 1

        dfs(graph[edge.to], node.node_id)


N = int(input())

# グラフ初期化
graph = [Node(node_id=i, color=-1) for i in range(N + 1)]
for i in range(N - 1):
    u, v, w = map(int, input().split())
    graph[u].edges.append(Edge(v, w))
    graph[v].edges.append(Edge(u, w))

# 最初は0始まり
graph[1].color = 0

dfs(graph[1], -1)


for i in range(1, N + 1):
    print(graph[i].color)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * N
count_WA = [0] * N
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i])

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] += 1
            
print(sum(count_AC) , sum(count_WA))

Fixed submission:
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * N
count_WA = [0] * N
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i]) - 1

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] = count_WA[p[i]] + 1
            
print(sum(count_AC) , sum([x * y for (x, y) in zip(count_AC, count_WA)]))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * M
count_WA = [0] * M
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i])

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] += 1
            
print(sum(count_AC) , sum(count_WA))

Fixed submission:
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * N
count_WA = [0] * N
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i]) - 1

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] = count_WA[p[i]] + 1
            
print(sum(count_AC) , sum([x * y for (x, y) in zip(count_AC, count_WA)]))
Buggy python submission (verdict: Runtime Error):
s = str(input())

if s[0] == s[1]:
    if s[2] == s[3] and s[0] != s[2]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[2]:
    if s[1] == s[3] and s[0] != s[1]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[3]:
    if s[1] == s[2] and s[0] != s[1]:
        print('Yes')
        else:
        print('No')
else:
    print('No')

Fixed submission:
s = str(input())

if s[0] == s[1]:
    if s[2] == s[3] and s[0] != s[2]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[2]:
    if s[1] == s[3] and s[0] != s[1]:
        print('Yes')
    else:
        print('No')
elif s[0] == s[3]:
    if s[1] == s[2] and s[0] != s[1]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N , M = map(int, input().split())
P = [0]*M
Y = [0]*M
x = [0]*M
for i in range(M):
    P[i],Y[i] =  map(int, input().split())

Y_s = sorted(Y)
count = [1]*(N+1)
ans = [0]*M
for i in range(M):
    j = Y.index(Y_s[i])
    ans[j] = str(P[j]).zfill(6) + str(count[P[j]]).zfill(6)
    count[P[j]] = count[P[j]] +1

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


Fixed submission:
import numpy as np
N , M = map(int, input().split())
P = [0]*M
Y = [0]*M
for i in range(M):
    P[i],Y[i] =  map(int, input().split())

Y_ = np.argsort(Y)
count = [1]*(N+1)
ans = [0]*M
for i in range(M):
    ans[Y_[i]] = str(P[Y_[i]]).zfill(6) + str(count[P[Y_[i]]]).zfill(6)
    count[P[Y_[i]]] = count[P[Y_[i]]] +1
 
for i in range (M):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
N , M = map(int, input().split())

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if is_prime(M) == True:
    if M/N == 1:
        print(N)
    else:
        print(1)
else:
    for i in range(int(M/N),0,-1):
        if M % i ==0:
            print(i)
            break

Fixed submission:
N,M= map(int, input().split())
yakusu =[]

for i in range(int(M**(1/2)),0,-1):
    if M % i == 0:
        yakusu.append(i)
        yakusu.append(int(M/i))

yakusu.sort(reverse=True)

for i in yakusu:
    if i <= M/N:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N , M = map(int, input().split())


for i in range(int(M/N),0,-1):
    if M % i ==0:
        print(i)
        break

    

Fixed submission:
N,M= map(int, input().split())
yakusu =[]

for i in range(int(M**(1/2)),0,-1):
    if M % i == 0:
        yakusu.append(i)
        yakusu.append(int(M/i))

yakusu.sort(reverse=True)

for i in yakusu:
    if i <= M/N:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N , M = map(int, input().split())
yakusuu = []

for i in range(int(M/N),0,-1):
    if M % i ==0:
        yakusuu.append(i)
        break
print (yakusuu[0])

Fixed submission:
N,M= map(int, input().split())
yakusu =[]

for i in range(int(M**(1/2)),0,-1):
    if M % i == 0:
        yakusu.append(i)
        yakusu.append(int(M/i))

yakusu.sort(reverse=True)

for i in yakusu:
    if i <= M/N:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
l = len(S)
flag = "Yes"
for i in range(l):
    for j in range(l):
        if (S[i] == S[j] and T[i] != T[j]):
            flag = "No"
        if (S[i] != S[j] and T[i] == T[j]):
            flag= "No"

print(flag)

Fixed submission:
S = input()
T = input()
l = len(S)
flag = "Yes"
Rs = [-1]*130
Rt = [-1]*130

for i in range(l):
    s = ord(S[i])
    t = ord(T[i])
    if Rs[s] < 0:
        Rs[s] = t
    if Rt[t] < 0:
        Rt[t] = s
    if Rs[s] > 0:
        if Rs[s] != t:
            flag = "No"
    if Rt[t] > 0:
        if Rt[t] != s:
            flag = "No"

print(flag)
Buggy python submission (verdict: Time Limit Exceeded):
#abc110 C
N, X = map(int, input().split())
x = list(map(int, input().split()))
distance = [ abs(x[i]-X) for i in range(N)]


for d in range(min(distance),0,-1):
    flag = 1
    for i in range(N):
        if distance[i] % d != 0:
            flag = 0
    if flag == 1:
        print(d)
        break

Fixed submission:
#abc110 C 最大公約数
N, X = map(int, input().split())
x= list(map(int, input().split()))
distance = [ abs(x[i]-X) for i in range(N)]

def gcd( x , y ):
    while y != 0:
        x,y = y, x%y
    return x

def GCD(lis):
    g = lis[0]
    for i in range(1,len(lis)):
        g = gcd( g , lis[i] )
    return g

maxD = GCD(distance)
print(maxD)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
x = list(map(int, input().split()))
L = [0]*(N-K+1) 

for i in range(N-K+1):
    L[i] = min((abs(x[i])+abs(x[i+K-1]-x[i])),(abs(x[i+K-1])+abs(x[i+K-1]-x[i]))
        
print(min(L))

Fixed submission:
N, K = map(int, input().split())
x = list(map(int, input().split()))
L = [0]*(N-K+1) 

for i in range(N-K+1):
    L[i] = min((abs(x[i])+abs(x[i+K-1]-x[i])),(abs(x[i+K-1])+abs(x[i+K-1]-x[i])))
        
print(min(L))
Buggy python submission (verdict: Runtime Error):
import collections


def solve(n, m, hist):
    cor = 0
    pen = 0
    for p, tries in hist.items():
        for i, t in enumerate(tries):
            if t == 'AC':
                cor += 1
                pen += i
                break
    return f'{cor} {pen}'


def input_to_int():
    return [int(r) for r in input().split(' ')]


if __name__ == "__main__":
    n, m = input_to_int()
    hist = collections.defaultdict(list)
    for _ in range(m):
        p, s = input().split(' ')
        hist[p].append(s)
    print(solve(n, m, hist))


Fixed submission:
import collections


def solve(n, m, hist):
    cor = 0
    pen = 0
    for p, tries in hist.items():
        for i, t in enumerate(tries):
            if t == 'AC':
                cor += 1
                pen += i
                break
    return '{0} {1}'.format(cor, pen)


def input_to_int():
    return [int(r) for r in input().split(' ')]


if __name__ == "__main__":
    n, m = input_to_int()
    hist = collections.defaultdict(list)
    for _ in range(m):
        p, s = input().split(' ')
        hist[p].append(s)
    print(solve(n, m, hist))
Buggy python submission (verdict: Runtime Error):
a=input()
print(str(ord(a)+1)

Fixed submission:
a=input()
b = chr(ord(a)+1)
print(b)
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
import copy

def cha(maze,h,w):
    maze = copy.deepcopy(maze)
    for i in range(h):
        for j in range(w):
            if maze[i][j] == ".":
                maze[i][j] = math.inf
            if maze[i][j] == "#":
                maze[i][j] = -1
    return maze

def bfs(maze,sy,sx):
    maze = copy.deepcopy(maze)
    maze[sy][sx] = 0
    que = deque([[sy,sx]])
    while que:
        y,x = que.popleft()
        for next_y,next_x in [(y+1,x),(y-1,x),(y,x+1),(y,x-1)]:
            if maze[next_y][next_x] == -1:
                continue
            dist = maze[next_y][next_x]
            if dist > maze[y][x] + 1:
                maze[next_y][next_x] = maze[y][x] + 1
                que.append([next_y,next_x])
    return maze

def search(maze):
    c = 0
    for i in maze:
        i.append(c)
        c = max(i)
    return c

def _main():
    h,w = map(int,input().split())
    maze = [["#"]*w]
    for _ in range(h):
        maze.append(list(input()))
    maze.append(["#"]*w)
    for i in range(h+2):
        maze[i].insert(0,"#")
        maze[i].insert(w+1,"#")
    C = 0
    for sy in range(h+2):
        for sx in range(w+2):
            if maze[sy][sx] == ".":
                C = max((search(bfs(cha(maze,h+2,w+2),sy,sx)),C))
    print(C)
if __name__=="__main__":
  	_main()

Fixed submission:
from collections import deque
import copy

def cha(maze,h,w):
    maze = copy.deepcopy(maze)
    for i in range(h):
        for j in range(w):
            if maze[i][j] == ".":
                maze[i][j] = 10**10
            if maze[i][j] == "#":
                maze[i][j] = -1
    return maze

def bfs(maze,sy,sx):
    maze = copy.deepcopy(maze)
    maze[sy][sx] = 0
    que = deque([[sy,sx]])
    while que:
        y,x = que.popleft()
        for next_y,next_x in [(y+1,x),(y-1,x),(y,x+1),(y,x-1)]:
            if maze[next_y][next_x] == -1:
                continue
            dist = maze[next_y][next_x]
            if dist > maze[y][x] + 1:
                maze[next_y][next_x] = maze[y][x] + 1
                que.append([next_y,next_x])
    return maze

def search(maze):
    c = 0
    for i in maze:
        i.append(c)
        c = max(i)
    return c

def _main():
    h,w = map(int,input().split())
    maze = [["#"]*w]
    for _ in range(h):
        maze.append(list(input()))
    maze.append(["#"]*w)
    for i in range(h+2):
        maze[i].insert(0,"#")
        maze[i].insert(w+1,"#")
    C = 0
    for sy in range(h+2):
        for sx in range(w+2):
            if maze[sy][sx] == ".":
                C = max((search(bfs(cha(maze,h+2,w+2),sy,sx)),C))
    print(C)

if __name__=="__main__":
    _main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m = map(int,input().split())
A = np.array([int(i) for i in input().split()])
A_half = A//2
lcm = 1
for i in A_half:
    lcm = np.lcm(lcm,i)
c = m//lcm
print(c//2 + c%2)


Fixed submission:
import numpy as np
import copy
n,m = map(int,input().split())
A = np.array([int(i) for i in input().split()])//2
lcm_ = 1
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

for i in A:
    lcm_ = lcm(lcm_,i)
c = 0
lcm_2 = copy.deepcopy(lcm_)
for _ in range(30):
    if lcm_2 % 2 == 0:
        c += 1
        lcm_2 = lcm_2//2
if np.all(A%(2**c) == 0):
    c = m//lcm_
    print(c//2 + c%2)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import math
a,b = [int(i) for i in input().split()]
print(a*b//math.gcd(a,b))


Fixed submission:
a,b = [int(i) for i in input().split()]
a_ = []
b_ = []
for i in range(1,a+1):
    if a%i == 0:
        a_.append(i)

for i in range(1,b+1):
    if b%i == 0:
        b_.append(i)

for i in a_[::-1]:
    if i in b_:
        m = i
        break


print(a*b//m)
Buggy python submission (verdict: Runtime Error):
n = int(input())

def func(n_):
    if n_ < 2:
        return 1
    else:
        return func(n_-2)*n_
c = 0
for i in list(str(func(n)))[::-1]:
    if i == "0":
        c += 1
    else:
        break
print(c)




Fixed submission:
import copy

n = int(input())
def calc(N):
    n_ = (N - N%10)//10
    c = 1
    s = copy.deepcopy(n_)
    while n_//(5**c) >= 1:
        c +=1
    c -= 1
    for i in range(1,c+1):
        s += n_//5**i
    return s

if n%2 == 1 or n == 0:
    print(0)
else:
    print(calc(n))

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

def func(n_):
    if n_ < 2:
        return 1
    else:
        return func(n_-2)*n_
c = 0
for i in list(str(func(n)))[::-1]:
    if i == "0":
        c += 1
    else:
        break
print(c)






Fixed submission:
import copy

n = int(input())
def calc(N):
    n_ = (N - N%10)//10
    c = 1
    s = copy.deepcopy(n_)
    while n_//(5**c) >= 1:
        c +=1
    c -= 1
    for i in range(1,c+1):
        s += n_//5**i
    return s

if n%2 == 1 or n == 0:
    print(0)
else:
    print(calc(n))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
c = 0
def cha_3(num_):
    d = 3 - len(num_)
    return d*"0" + num_

for i in range(1000):
    num = cha_3(str(i))
    num_c = 0
    for j in range(len(s)):
        if s[j] == num[num_c]:
            num_c += 1
            if num_c == 3:
                c += 1
                break
print(c)






Fixed submission:
n = int(input())
s = input()
c = 0
def cha_3(num_):
    d = 3 - len(num_)
    return d*"0" + num_

for i in range(1000):
    num = cha_3(str(i))
    num_c = 0
    for j in range(len(s)):
        if s[j] == num[num_c]:
            num_c += 1
            if num_c == 3:
                c += 1
                break
print(c)
Buggy python submission (verdict: Runtime Error):
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c
s = list(input())
k =int(input())
print(count(s*k))



Fixed submission:
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c
s = list(input())
k =int(input())
if k <= 10**5:
    print(count(s*k))
else:
    d2 = count(s*3)-count(s*2)
    d3 = count(s*4)-count(s*3)
    if d2 != d3:
        if k%2 == 1:
            print(d2*((k-2)//2+1) + count(s*2) + d3*((k-2)//2))
        else:
            print(d2*((k-2)//2) + count(s*2) + d3((k-2)//2))
    else:
        print(d2*(k-2) + count(s*2))

Buggy python submission (verdict: Runtime Error):
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c


if __name__=="__main__":
    s = list(input())
    k = int(input())
    c = 0
    l = []
    c += count(s*k)
    print(c)



Fixed submission:
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c
s = list(input())
k =int(input())
if k <= 10**5:
    print(count(s*k))
else:
    d2 = count(s*3)-count(s*2)
    d3 = count(s*4)-count(s*3)
    if d2 != d3:
        if k%2 == 1:
            print(d2*((k-2)//2+1) + count(s*2) + d3*((k-2)//2))
        else:
            print(d2*((k-2)//2) + count(s*2) + d3((k-2)//2))
    else:
        print(d2*(k-2) + count(s*2))

Buggy python submission (verdict: Runtime Error):
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c


if __name__=="__main__":
    s = list(input())
    k = int(input())
    c = 0
  	c += count(s*k)
    print(c)



Fixed submission:
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c
s = list(input())
k =int(input())
if k <= 10**5:
    print(count(s*k))
else:
    d2 = count(s*3)-count(s*2)
    d3 = count(s*4)-count(s*3)
    if d2 != d3:
        if k%2 == 1:
            print(d2*((k-2)//2+1) + count(s*2) + d3*((k-2)//2))
        else:
            print(d2*((k-2)//2) + count(s*2) + d3((k-2)//2))
    else:
        print(d2*(k-2) + count(s*2))
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if 0 < x < y:
    print(y-x)
elif x < 0 and y > 0 and abs(x) > abs(y):
    print(abs(x)-y+1)
elif x < 0 and y > 0 and abs(x) < abs(y):
    print(y-abs(x)+1)
elif x > y > 0:
    print(x-y+2)
elif x > 0 and y < 0 and abs(x) > abs(y):
    print(x-abs(y)+1)
elif x > 0 and y < 0 and abs(x) < abs(y):
    print(abs(y)-x+1)
elif abs(x) == abs(y):
    print(1)
elif x < y < 0:
    print(y-x)
else:
    print(x-y+2

Fixed submission:
x,y = map(int,input().split())
if 0 <= x < y:
    print(y-x)
elif x < 0 and y > 0 and abs(x) > abs(y):
    print(abs(x)-y+1)
elif x < 0 and y > 0 and abs(x) < abs(y):
    print(y-abs(x)+1)
elif x > y > 0:
    print(x-y+2)
elif x > 0 and y == 0:
    print(x+1)
elif x > 0 and y < 0 and abs(x) > abs(y):
    print(x-abs(y)+1)
elif x > 0 and y < 0 and abs(x) < abs(y):
    print(abs(y)-x+1)
elif abs(x) == abs(y):
    print(1)
elif x < y <= 0:
    print(y-x)
elif x == 0 and y < 0:
    print(abs(y)+1)
else:
    print(x-y+2)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if 0 < x < y:
    print(y-x)
elif x < 0 and y > 0 and abs(x) > abs(y):
    print(abs(x)-y+1)
elif x < 0 and y > 0 and abs(x) < abs(y):
    print(y-abs(x)+1)
elif x > y > 0:
    print(x-y+2)
elif x > 0 and y < 0 and abs(x) > abs(y):
    print(x-abs(y)+1)
elif x > 0 and y < 0 and abs(x) < abs(y):
    print(abs(y)-x+1)
elif abs(x) == abs(y):
    print(1)
elif x < y < 0:
    print(y-x)
else:
    print(x-y+2

Fixed submission:
x,y = map(int,input().split())
if 0 <= x < y:
    print(y-x)
elif x < 0 and y > 0 and abs(x) > abs(y):
    print(abs(x)-y+1)
elif x < 0 and y > 0 and abs(x) < abs(y):
    print(y-abs(x)+1)
elif x > y > 0:
    print(x-y+2)
elif x > 0 and y == 0:
    print(x+1)
elif x > 0 and y < 0 and abs(x) > abs(y):
    print(x-abs(y)+1)
elif x > 0 and y < 0 and abs(x) < abs(y):
    print(abs(y)-x+1)
elif abs(x) == abs(y):
    print(1)
elif x < y <= 0:
    print(y-x)
elif x == 0 and y < 0:
    print(abs(y)+1)
else:
    print(x-y+2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

x = 0
i = 0

while i < len(a):
    if a[i] != i+1:
        a.pop(i)
        x+=1
        i-=1
    i+=1
    
print(x if x != n else -1)

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

x = 1

for i in range(n):
    if a[i] == x:
        x += 1

print(n - x + 1 if x > 1 else -1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()

count=0
for i in range(0,N):
    if(S[i]=="A"):
        if(S[i+1]=="B"):
            if(S[i+2]=="C"):
                count+=1

print(count)
        

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

count=0
for i in range(0,N):
    if(S[i]=="A"):
        if(i<=N-3):
            if(S[i+1]=="B"):
                if(S[i+2]=="C"):
                    count+=1

print(count)

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

count=0
for i in range(0,N):
    if(S[i]=="A"):
        i=i+1
        if(S[i]=="B"):
            i=i+1
            if(S[i]=="C"):
                count+=1

print(count)

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

count=0
for i in range(0,N):
    if(S[i]=="A"):
        if(i<=N-3):
            if(S[i+1]=="B"):
                if(S[i+2]=="C"):
                    count+=1

print(count)