Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import bisect
n,k = map(int,input().split())
x = list(map(int,input().split()))
bindex = bisect.bisect_left(x,0)
mainasu = x[:bindex] #[-30,-20,-10]
purasu = x[bindex:] #[10,20,30]
"""
for i in range(len(mainasu)-2,-1,-1): #0は対象ではない
  mainasu[i] = mainasu[i+1]+mainasu[i]
#[-60,-30,-10]
for i in range(1,len(purasu)):
  purasu[i] = purasu[i-1]+purasu[i]
#[10,30,60]
"""
ans = 10**9
if len(mainasu) >= k:
  ans = min(ans,abs(mainasu[-k]))
if len(purasu) >= k:
  ans = min(ans,purasu[k-1])
if mainasu != []:
  for i in range(len(mainasu)-k,len(mainasu)): #-2~2
    if i >= len(purasu):break
    a = abs(mainasu[i])
    b = purasu[i]
    ans = min(ans,a*2+b,a+b*2)
print(ans)
                

Fixed submission:
n,k = map(int,input().split())
x = list(map(int,input().split()))
l,r = 0,0
anus = 10**9
for i in range(n):
  l = i
  r = i+(k-1)
  if r >= n:
    break
  anus = min(anus,abs(x[l])+abs(x[r]-x[l]),abs(x[r])+abs(x[r]-x[l]))
print(anus)

Buggy python submission (verdict: Runtime Error):
import bisect
n,k = map(int,input().split())
x = list(map(int,input().split()))
bindex = bisect.bisect_left(x,0)
mainasu = x[:bindex] #[-30,-20,-10]
purasu = x[bindex:] #[10,20,30]
"""
for i in range(len(mainasu)-2,-1,-1): #0は対象ではない
  mainasu[i] = mainasu[i+1]+mainasu[i]
#[-60,-30,-10]
for i in range(1,len(purasu)):
  purasu[i] = purasu[i-1]+purasu[i]
#[10,30,60]
"""
ans = 10**9
if len(mainasu) >= k:
  ans = min(ans,abs(mainasu[-k]))
if len(purasu) >= k:
  ans = min(ans,purasu[k-1])

for i in range(len(mainasu)-k,len(mainasu)): #-2~2
  if i >= len(purasu):break
  a = abs(mainasu[i])
  b = purasu[i]
  ans = min(ans,a*2+b,a+b*2)
print(ans)

Fixed submission:
n,k = map(int,input().split())
x = list(map(int,input().split()))
l,r = 0,0
anus = 10**9
for i in range(n):
  l = i
  r = i+(k-1)
  if r >= n:
    break
  anus = min(anus,abs(x[l])+abs(x[r]-x[l]),abs(x[r])+abs(x[r]-x[l]))
print(anus)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())


count = 0
for i in range(len(s)):
  if s[i] == "1":
    count = i
  else:
    st = s[i]
    break
if count ==0:
  print(st)
elif k <= count+1:
  print(1)
else:
  print(st)

Fixed submission:
s = input()
k = int(input())


count = 0
for i in range(len(s)):
  if s[i] == "1":
    count = i+1
  else:
    st = s[i]
    break

if k <= count:
  print(1)
else:
  print(st)
Buggy python submission (verdict: Runtime Error):
#4と、7
n =int(input())

for i in 16:
  s = n - (i*7)
  if s < 0:
    break
  if s%4==0:
    print("Yes")
    exit()
print("No")


Fixed submission:
#4と、7
n =int(input())

for i in range(16):
  s = n - (i*7)
  if s < 0:
    break
  if s%4==0:
    print("Yes")
    exit()
print("No")
Buggy python submission (verdict: Runtime Error):
#ABC105-D Candy Distribution
"""
al~arの合計がmの倍数となる通り数を調べる。
愚直に累積和をとって判定するには、O(n(n+1)/2)で不十分
実は、al~arの合計がmの倍数になる条件は、累積和をbとして、
b(l-1),brのmod m が同値になることである。
よって、累積和のmod mの個数をdictで保存しておいて、
同じ値のnC2つまり、n(n-1)//2の合計が答えとなる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
def cumsum(lst): #元のリストを保持
    res = lst[:]
    for i in range(1,len(res)):
        res[i] += res[i-1]
    return res
lst2 = cumsum(lst1)

dic1 = dict()
for i in lst2:
    res = i%m
    if res in dic1:
        dic1[res] += 1
    else:
        dic1[res] = 1

ans = 0
for i in dic1.values():
    if i >= 2:
        ans += i*(i-1)//2

print(ans+dic1[0])


Fixed submission:
#ABC105-D Candy Distribution
"""
al~arの合計がmの倍数となる通り数を調べる。
愚直に累積和をとって判定するには、O(n(n+1)/2)で不十分
実は、al~arの合計がmの倍数になる条件は、累積和をbとして、
b(l-1),brのmod m が同値になることである。
よって、累積和のmod mの個数をdictで保存しておいて、
同じ値のnC2つまり、n(n-1)//2の合計が答えとなる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
def cumsum(lst): #元のリストを保持
    res = lst[:]
    for i in range(1,len(res)):
        res[i] += res[i-1]
    return res
lst2 = cumsum(lst1)

dic1 = dict()
for i in lst2:
    res = i%m
    if res in dic1:
        dic1[res] += 1
    else:
        dic1[res] = 1

ans = 0
for i in dic1.values():
    if i >= 2:
        ans += i*(i-1)//2

res = 0 if 0 not in dic1 else dic1[0]
print(ans+res)
Buggy python submission (verdict: Runtime Error):
import fractions as math

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

#同じく最小公倍数
def lcmlist(l):
    a = l[0]
    for i in range(len(l)):
        a = int(a)
        a = a*l[i]/math.gcd(a,l[i])
    return int(a)

if n == 1:
    print(list1[0]-1)
    exit()

lcm = lcmlist(list1)
lcm -= 1
ans = 0
for i in list1:
    ans += lcm%i

print(ans)

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

ans = 0
for i in list1:
    ans += i-1
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions as math

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

#同じく最小公倍数
def lcmlist(l):
    a = l[0]
    for i in range(len(l)):
        a = int(a)
        a = a*l[i]/math.gcd(a,l[i])
    return int(a)

if n == 1:
    print(list1[0]-1)

lcm = lcmlist(list1)
lcm -= 1
ans = 0
for i in list1:
    ans += lcm%i

print(ans)


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

ans = 0
for i in list1:
    ans += i-1
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions as math

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

#同じく最小公倍数
def lcmlist(l):
    a = l[0]
    for i in range(len(l)):
        a = int(a)
        a = a*l[i]/math.gcd(a,l[i])
    return int(a)

lcm = lcmlist(list1)
lcm -= 1
ans = 0
for i in list1:
    ans += lcm%i

print(ans)


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

ans = 0
for i in list1:
    ans += i-1
print(ans)

Buggy python submission (verdict: Runtime Error):
import math

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

#同じく最小公倍数
def lcmlist(l):
    a = l[0]
    for i in range(len(l)):
        a = int(a)
        a = a*l[i]/math.gcd(a,l[i])
    return int(a)

lcm = lcmlist(list1)
lcm -= 1
ans = 0
for i in list1:
    ans += lcm%i

print(ans)

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

ans = 0
for i in list1:
    ans += i-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst1 = list(map(int,input().split()))

def func(a,b):
    for i in range(21):
        if (a>>i)&(b>>i): #AND回路
            return False
    return True

ans = 0
i = 0
j = 1

while i < n:
    host = lst1[i]
    while j < n:
        if not func(host,lst1[j]):
            break
        host = host^lst1[j]
        j += 1
        ans += 1
    i += 1
    j = i+1

ans += n

print(ans)

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

def func(a,b):
    for i in range(21):
        if (a>>i)&(b>>i): #AND回路
            return False
    return True

def add_point(length):
    res = 0
    for i in range(1,length):
        res += i
    return res

a,b,count,ans = 0,1,0,0
host = lst1[0]
#尺取法
while True:
    if b >= n and a >= n:
        break
    while  b<n and func(host,lst1[b]):
        host = host^lst1[b]
        b += 1
    host = host^lst1[a] #使わなくなる部分を引く
    if b -a > 1:
        ans += b-a-1
    a += 1

ans += n
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst1 = list(map(int,input().split()))

def func(a,b):
    for i in range(21):
        if (a>>i)&(b>>i): #AND回路
            return False
    return True

def add_point(length):
    res = 0
    for i in range(1,length):
        res += i
    return res

ans = 0
i = 0
j = 1
flag = 0 #連続フラグ
while i < n:
    host = lst1[i]
    while j < n:
        if not func(host,lst1[j]):
            break
        host = host^lst1[j]
        j += 1
        ans += 1
    i += 1
    j = i+1
    

ans += n

print(ans)

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

def func(a,b):
    for i in range(21):
        if (a>>i)&(b>>i): #AND回路
            return False
    return True

def add_point(length):
    res = 0
    for i in range(1,length):
        res += i
    return res

a,b,count,ans = 0,1,0,0
host = lst1[0]
#尺取法
while True:
    if b >= n and a >= n:
        break
    while  b<n and func(host,lst1[b]):
        host = host^lst1[b]
        b += 1
    host = host^lst1[a] #使わなくなる部分を引く
    if b -a > 1:
        ans += b-a-1
    a += 1

ans += n
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst1 = list(map(int,input().split()))

def func(a,b):
    for i in range(21):
        if (a>>i)&(b >>i): #AND回路
            return False
    return True



ans = 0

for i in range(n-1):
    host = lst1[i]
    for j in range(i+1,n):
        if not func(host,lst1[j]):
            break
        host = host^lst1[j]
        ans += 1

ans += n

print(ans)

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

def func(a,b):
    for i in range(21):
        if (a>>i)&(b>>i): #AND回路
            return False
    return True

def add_point(length):
    res = 0
    for i in range(1,length):
        res += i
    return res

a,b,count,ans = 0,1,0,0
host = lst1[0]
#尺取法
while True:
    if b >= n and a >= n:
        break
    while  b<n and func(host,lst1[b]):
        host = host^lst1[b]
        b += 1
    host = host^lst1[a] #使わなくなる部分を引く
    if b -a > 1:
        ans += b-a-1
    a += 1

ans += n
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

def search(a,b,c):
    lst = [0,0,0]
    if a%2 == b%2:
        lst = [1,1,0]
        if a%2==c%2:
            lst = [1,1,1]
    elif a%2 == c%2:
        lst = [1,0,1]
    else:
        lst = [0,1,1]
    return lst


def make(a,b,c):
    lst = [a,b,c]
    lst.sort()
    lst[0] += 2
    return lst[0],lst[1],lst[2]

if __name__ == "__main__":
    ans = 0
    l = search(a,b,c)
    if sum(l) == 3:
        pass
    else:
        ans += 1
        a += l[0]
        b += l[1]
        c += l[2]
    while a != b or a != c:
        a,b,c = make(a,b,c)
        ans += 1
    print(ans)

Fixed submission:
lst1 = list(input())
if len(lst1) != 3:
    print("No")
    exit()
for i in ["a","b","c"]:
    if not i in lst1:
        print("No")
        exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
lst1 = list(input())
iflen(lst1) != 3:
    print("No")
    exit()
for i in ["a","b","c"]:
    if not i in lst1:
        print("No")
        exit()
print("Yes")

Fixed submission:
lst1 = list(input())
if len(lst1) != 3:
    print("No")
    exit()
for i in ["a","b","c"]:
    if not i in lst1:
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int,input().split())

def search(a,b,c):
    lst = [0,0,0]
    if a%2 == b%2:
        lst = [1,1,0]
        if a%2==c%2:
            lst = [1,1,1]
    elif a%2 == c%2:
        lst = [1,0,1]
    else:
        lst = [0,1,1]
    return lst


def make(a,b,c):
    lst = [a,b,c]
    lst.sort()
    lst[0] += 2
    return lst[0],lst[1],lst[2]

if __name__ == "__main__":
    ans = 0
    l = search(a,b,c)
    if sum(l) == 3:
        pass
    else:
        ans += 1
        for i,j in zip(l,[a,b,c]):
            j += i
    while a != b or a != c:
        a,b,c = make(a,b,c)
        ans += 1
    print(ans)
    

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

def search(a,b,c):
    lst = [0,0,0]
    if a%2 == b%2:
        lst = [1,1,0]
        if a%2==c%2:
            lst = [1,1,1]
    elif a%2 == c%2:
        lst = [1,0,1]
    else:
        lst = [0,1,1]
    return lst


def make(a,b,c):
    lst = [a,b,c]
    lst.sort()
    lst[0] += 2
    return lst[0],lst[1],lst[2]

if __name__ == "__main__":
    ans = 0
    l = search(a,b,c)
    if sum(l) == 3:
        pass
    else:
        ans += 1
        a += l[0]
        b += l[1]
        c += l[2]
    while a != b or a != c:
        a,b,c = make(a,b,c)
        ans += 1
    print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c+d))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst1 = list(map(int,input().split()))

lst1 = list(set(lst1))

if len(lst1) == 4:
    print("Four")
else:
    print('Three')

Fixed submission:
n = int(input())
lst1 = list(input().split())

lst1 = list(set(lst1))

if len(lst1) == 4:
    print("Four")
else:
    print('Three')
Buggy python submission (verdict: Runtime Error):
from collections import deque
h,w = map(int,input().split())
list1 = [list(input()) for i in range(h) ]
visited = [[-1]*w for i in range(h)]
black_count = 0
for i in range(h):
	black_count += list1[i].count("#")
def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [gy, gx]:
            return visited[y][x]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if 0 <= new_y < h and \
				0 <= new_x < w and\
				maze[new_y][new_x] == "." and \
                visited[new_y][new_x] == -1:
				
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])

shortest = bfs(list1,visited,0,0,h-1,w-1)

print(h*w - black_count - shortest-1) #-1はスタート地点

Fixed submission:
from collections import deque
h,w = map(int,input().split())
list1 = [list(input()) for i in range(h) ]
visited = [[-1]*w for i in range(h)]
black_count = 0
for i in range(h):
	black_count += list1[i].count("#")
def bfs(maze, visited, sy, sx, gy, gx):
	queue = deque([[sy, sx]])
	visited[sy][sx] = 0
	while queue:
		y, x = queue.popleft()
		if [y, x] == [gy, gx]:
			return visited[y][x]
		for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
			new_y, new_x = y+j, x+k
			if 0 <= new_y < h and \
				0 <= new_x < w and\
				maze[new_y][new_x] == "." and \
				visited[new_y][new_x] == -1:
				
				visited[new_y][new_x] = visited[y][x] + 1
				queue.append([new_y, new_x])
	return -1

shortest = bfs(list1,visited,0,0,h-1,w-1)
if shortest == -1:
	print(-1)
	exit()
print(h*w - black_count - shortest-1) #-1はスタート地点
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)

n,y = map(int,input().split())

y = y//1000

shihei_set = [1,5,10]
ans = ""
def func(depth,value,ten,five,one):
	global ans
	if depth == n:
		if value == y:
			ans = str(ten) + " " + str(five) + " " + str(one)
			return True
		return False
	if func(depth+1,value+shihei_set[2],ten+1,five,one):
		return True
	elif func(depth+1,value+shihei_set[1],ten,five+1,one):
		return True
	elif func(depth+1,value+shihei_set[0],ten,five,one+1):
		return True
	else:
		return False

if func(0,0,0,0,0):
	print(ans)
else:
	print("-1 -1 -1")

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

y = y//1000

for a in range(n+1):
	for b in range(0,n+1-a):
		c = n - (a+b)
		if y == 10*a + 5*b + c:
			print(a,b,c)
			exit()


print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n,k = map(int,readline().split())
lst1 = list(map(int,readline().split()))

dic1 = dict()

for i in lst1:
    if i in dic1:
        dic1[i] += 1
    else:
        dic1[i] = 1

values = list(dic1.values())

values.sort()

ans = 0
while k < len(values):
    ans += values.pop(0)

print(ans)


Fixed submission:
import sys
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n,k = map(int,readline().split())
lst1 = list(map(int,readline().split()))

dic1 = dict()

for i in lst1:
    if i in dic1:
        dic1[i] += 1
    else:
        dic1[i] = 1

values = list(dic1.values())

values.sort()

values = deque(values)

ans = 0
while k < len(values):
    ans += values.popleft()

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
lst1 = [list(map(int,readline().split())) for i in range(n)]

lst2 = [list(map(int,readline().split())) for i in range(n)]

#曜日、時刻にどの店が営業しているかを埋め込む
lst3 = [[] for _ in range(10)]
for i in range(n):
    for j in range(10):
        if lst1[i][j] == 1:
            lst3[j].append(i)

#ビット全探索
def bit_search(lst):
    keta = len(lst)
    bit_lst = []
    for i in range(2**keta):
        sub = [0]*10
        for j in range(keta):
            if ((i>>j) &1):
                for k in lst3[j]:
                    sub[k] += 1
        bit_lst.append(sub)
    return bit_lst


dummy = [0]*(10)
all_lst = bit_search(dummy)

ans = -10**9
for i in all_lst[1:]:
    res = 0
    for j in range(n):
        res += lst2[j][i[j]]
    ans = max(res,ans)

print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
lst1 = [list(map(int,readline().split())) for i in range(n)]

lst2 = [list(map(int,readline().split())) for i in range(n)]

#曜日、時刻にどの店が営業しているかを埋め込む
lst3 = [[] for _ in range(10)]
for i in range(n):
    for j in range(10):
        if lst1[i][j] == 1:
            lst3[j].append(i)

#ビット全探索
def bit_search(lst):
    keta = len(lst)
    bit_lst = []
    for i in range(2**keta):
        sub = [0]*n
        for j in range(keta):
            if ((i>>j) &1):
                for k in lst3[j]:
                    sub[k] += 1
        bit_lst.append(sub)
    return bit_lst


dummy = [0]*(10)
all_lst = bit_search(dummy)

ans = -10**9
for i in all_lst[1:]:
    res = 0
    for j in range(n):
        res += lst2[j][i[j]]
    ans = max(res,ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
from operator import itemgetter
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,c = map(int,readline().split())
ch = []*c
for i in range(n):
    s,t,c = map(int,readline().split())
    ch[c-1].append([s,t])
imos = [0]*(10**5+1)
for i in ch:
    i.sort()
    for j in range(1,len(i)):
        s,t = i[j]
        if i[j-1][1] < s:
            imos[s-1] += 1
        else:
            imos[s] += 1
        imos[t] -= 1

for i in range(1,len(imos)):
    imos[i] += imos[i-1]

print(max(imos))



Fixed submission:
import sys
from operator import itemgetter
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,c = map(int,readline().split())
ch = [[[0,0]] for _ in range(c)]
for i in range(n):
    s,t,c = map(int,readline().split())
    ch[c-1].append([s,t])
imos = [0]*(10**5+1)
for i in ch:
    i.sort()
    for j in range(1,len(i)):
        s,t = i[j]
        if i[j-1][1] < s:
            imos[s-1] += 1
        else:
            imos[s] += 1
        imos[t] -= 1

for i in range(1,len(imos)):
    imos[i] += imos[i-1]

print(max(imos))
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
h,w = map(int,readline().split())
lst1 = [list(map(int,readline().split())) for i in range(10)]

#まず、数字をiから１に変える時の最小コストを計算する。
from scipy.sparse.csgraph import shortest_path,floyd_warshall
from scipy.sparse import csr_matrix
lc = csr_matrix(lst1)
cost_lst = shortest_path(lc,method="FW")

#全探索でコストを求める。
ans = 0
for i in range(h):
    lst2 = list(map(int,readline().split()))
    for j in lst2:
        if j != -1:
            ans += cost_lst[j][1]

print(int(ans))


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
h,w = map(int,readline().split())
lst1 = [list(map(int,readline().split())) for i in range(10)]

#まず、数字をiから１に変える時の最小コストを計算する。
from scipy.sparse.csgraph import shortest_path,floyd_warshall
from scipy.sparse import csr_matrix
lc = csr_matrix(lst1)
cost_lst = shortest_path(lc,method="FW")

#全探索でコストを求める。
ans = 0
for i in range(h):
    lst2 = list(map(int,readline().split()))
    for j in lst2:
        if j != -1:
            ans += cost_lst[j][1]

print(int(ans))
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = readline().rstrip().decode('utf-8')

t = ""
for i in s:
    if not i == "x":
        t += i

if t[::] != t[::-1]:
    print(-1)

else:
    ans = 0
    left,right = 0,len(s)-1
    while True:
        if left == right:
            break
        if s[left] == "x" and s[right] != "x":
            ans += 1
            left += 1
        elif s[left] != "x" and s[right] == "x":
            ans += 1
            right -= 1
        else:
            left += 1
            right -= 1
    print(ans)




Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = readline().rstrip().decode('utf-8')

t = ""
for i in s:
    if not i == "x":
        t += i

if t[::] != t[::-1]:
    print(-1)

else:
    ans = 0
    left,right = 0,len(s)-1
    while True:
        if right - left <= 0:
            break
        if s[left] == "x" and s[right] != "x":
            ans += 1
            left += 1
        elif s[left] != "x" and s[right] == "x":
            ans += 1
            right -= 1
        else:
            left += 1
            right -= 1
    print(ans)
Buggy python submission (verdict: Runtime Error):
print(max(0,x-t))

Fixed submission:
x,t = map(int,input().split())
print(max(0,x-t))
Buggy python submission (verdict: Runtime Error):
s = input()
ans = ""
for i in range(len(s),2):
  ans += s[i]
print(ans)


Fixed submission:
s = input()
ans = ""
for i in range(0,len(s),2):
  ans += s[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()

if a+b >= 10:
    print("error")
else:
    print(a+b)

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

if a+b >= 10:
    print("error")
else:
    print(a+b)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
lst1 = [list(map(int,input().split())) for i in range(m)]

lst2 = [0]*n

for i,j in lst1:
    lst2[i] += 1
    lst2[j] += 1

for i in lst2:
    print(i) 

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

lst2 = [0]*n

for i,j in lst1:
    lst2[i-1] += 1
    lst2[j-1] += 1

for i in lst2:
    print(i)
Buggy python submission (verdict: Runtime Error):
#AGC014-B Unplanned Queries
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m = map(int,readline().split())
dic1 = defaultdict(int)
for i in range(n):
    a,b = map(int,readline().split())
    dic1[a] += 1
    dic1[b] += 1

for i in dic1.values():
    if not even(i):
        print("NO")
        exit()
print("YES")

Fixed submission:
#AGC014-B Unplanned Queries
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m = map(int,readline().split())
dic1 = defaultdict(int)
for i in range(m):
    a,b = map(int,readline().split())
    dic1[a] += 1
    dic1[b] += 1

for i in dic1.values():
    if not even(i):
        print("NO")
        exit()
print("YES")