Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
default_A = A.copy()
counted = list(map(lambda x:x*0, list(range(10))))

'''
counted2 = [[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9]]
for a in A:
    counted2[a-1][0] += 1
count2 = 0
for i in range(10):
    if counted2[i][0]>0:
        count2 += 1

iranai = count2-K
min_2 = 1<<15
min_number = []
for i in range(len(counted2)):
    for j in range(len(counted2)-1, i, -1):
        if counted2[j][0] < counted2[j-1][0]:
            counted2[j], counted2[j-1] = counted2[j-1], counted2[j]

for i in range(10):
    if counted2[0][0] == 0:
        counted2.pop(0)

last_min = 0
if iranai > 0:
    for i in range(iranai):
        last_min += counted2[i][0]
    print(last_min)
else:
    print(0)
'''


def BallCount(A):
    global counted
    for a in A:
        counted[a-1] += 1
    count = 0
    for i in range(10):
        if counted[i]>0:
            count+=1
    #print("count ",count, "A ", A)
    counted = [0,0,0,0,0,0,0,0,0,0]
    return count

#print(BallCount(A))
min_ = 1<<15
def func(reciveA):
    change_count = 0
    global default_A
    for i in range(N):
        #print("reciveA[i] ", reciveA[i] , "A[i] " ,default_A[i])
        if reciveA[i]!=default_A[i]:
            change_count += 1

        #print("change count", change_count)
    global min_
    min_ = min(min_, change_count)


def bfs(pos):
    ballcount = BallCount(A)

    if ballcount==K:
        #print("ballcount ",ballcount )
        func(A)
    if pos==N:
        return
    for i in default_A:
        A[pos] = i
        bfs(pos+1)
    
bfs(0)
if min_ == (1<<15):
    print(0)
else:
    print(min_)


Fixed submission:
# coding:utf-8
#masu = map(float, input().split())
masu = input()
count = 0
for be in masu:
    be_ = int(be)
    if be_==1:
        count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
inp = input()
N = int(inp)

eigyo = []

b = []
Ci = []
for i in range(N):
    N_ = list(map(int, input().split()))
    eigyo.append(N_)
    Ci.append(sum(N_))

P = []
for i in range(N):
    P.append(list(map(int, input().split())))


ans = 0
a = list(map(lambda x: x*0, list(range(10))))
count = 0

def func():
    #score = 0
    global count
    count += 1
    #print(count, a)
    cc = 0
    for i in range(N):
        count_c = 0
        for j,element in enumerate(eigyo[N]):
            if element==a[j]:
                count_c += 1
        cc += P[i][count_c]

    global ans
    ans = max(ans, cc)
            
    #ans = max(ans, score)

def dfs(pos):
    if pos==10:
        func()
        return
    a[pos] = 0
    dfs(pos+1)
    a[pos] = 1
    dfs(pos+1)


dfs(0)
print(ans)


Fixed submission:
# coding:utf-8
inp = input()
N = int(inp)

eigyo = []

b = []
Ci = []
for i in range(N):
    N_ = list(map(int, input().split()))
    eigyo.append(N_)
    Ci.append(sum(N_))

P = []
for i in range(N):
    P.append(list(map(int, input().split())))


ans = -(1<<30)
a = list(map(lambda x: x*0, list(range(10))))
count = 0

def func():
    #score = 0
    global count
    count += 1
    #print(count, a)
    cc = 0
    if count!=1:
        for i in range(N):
            count_c = 0
            for j,element in enumerate(eigyo[i]):
                if element==a[j] and a[j]==1:
                    count_c += 1
            cc += P[i][count_c]
        global ans
        ans = max(ans, cc)
            
    #ans = max(ans, score)

def dfs(pos):
    if pos==10:
        func()
        return
    a[pos] = 0
    dfs(pos+1)
    a[pos] = 1
    dfs(pos+1)


dfs(0)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = list(map(int, input().split()))

buff = [0 for i in range(10)]

for i in range(N):
    buff[A[i]] += 1


ans = 0
# print(buff)
for i in range(N-2):
    ans = max(ans,buff[i]+buff[i+1]+buff[i+2])

print(ans)

Fixed submission:
N = int(input())

A = list(map(int, input().split()))

buff = [0 for i in range(10**5)]

for i in range(N):
    buff[A[i]] += 1


ans = 0
# print(buff)
for i in range(N-2):
    ans = max(ans,buff[i]+buff[i+1]+buff[i+2])

ans = max(ans, buff[N-2])
ans = max(ans, buff[N-1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

A = []
B = []
buff = [0 for i in range(N+1)]
buff2 = [0 for i in range(N+1)]

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.append(b)
        # buff[b] = 1
        buff[b] = 1
    if b == N:
        B.append(a)
        buff2[a] = 1

# print(buff)
# print(buff2)

seikai1 = []
for i in range(N+1):
    if buff[i] == 1:
        seikai1.append(i)

for i in range(N+1):
    if buff2[i] == 1:
        if i in seikai1:
            print('POSSIBLE')
            exit()
# for i in range(len(buff)):
#     for j in range(len(buff2)):
#         if buff[i] == 1 and buff2[j] == 1:
#             print('POSSIBLE')
#             exit()

print('IMPOSSIBLE')



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

A = []
B = []
buff = [0 for i in range(N+1)]
buff2 = [0 for i in range(N+1)]

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.append(b)
        # buff[b] = 1
        buff[b] = 1
    if b == N:
        B.append(a)
        buff2[a] = 1

for i in range(N+1):
    if buff[i] == 1 and buff2[i] == 1:
        print('POSSIBLE')
        exit()



# print(buff)
# print(buff2)

# seikai1 = []
# for i in range(N+1):
#     if buff[i] == 1:
#         seikai1.append(i)

# for i in range(N+1):
#     if buff2[i] == 1:
#         if i in seikai1:
#             print('POSSIBLE')
#             exit()
# for i in range(len(buff)):
#     for j in range(len(buff2)):
#         if buff[i] == 1 and buff2[j] == 1:
#             print('POSSIBLE')
#             exit()

print('IMPOSSIBLE')

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

A = []
B = []
buff = [0 for i in range(M+1)]

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.append(b)
        # buff[b] = 1
    if b == N:
        B.append(a)

# print(A)
# print(B)
for i in range(len(A)):
    for j in range(len(B)):
        if A[i] == B[j]:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')



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

A = []
B = []
buff = [0 for i in range(N+1)]
buff2 = [0 for i in range(N+1)]

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.append(b)
        # buff[b] = 1
        buff[b] = 1
    if b == N:
        B.append(a)
        buff2[a] = 1

for i in range(N+1):
    if buff[i] == 1 and buff2[i] == 1:
        print('POSSIBLE')
        exit()



# print(buff)
# print(buff2)

# seikai1 = []
# for i in range(N+1):
#     if buff[i] == 1:
#         seikai1.append(i)

# for i in range(N+1):
#     if buff2[i] == 1:
#         if i in seikai1:
#             print('POSSIBLE')
#             exit()
# for i in range(len(buff)):
#     for j in range(len(buff2)):
#         if buff[i] == 1 and buff2[j] == 1:
#             print('POSSIBLE')
#             exit()

print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())

# B = [0 for i in range(N)]
B = []
for i in range(N):
    B.append(A[i])
    B = B[::-1]


print(' '.join(B))

Fixed submission:
N = int(input())
A = list(input().split())

# B = [0 for i in range(N)]
med = N // 2
B = ['0' for i in range(N)]
fo = []
# for i in range(med, N):
#     fo.append
if N % 2 == 0:
    f_c = med
    for i in range(0, N, 2):
        B[f_c] = A[i]
        f_c += 1

    # print(f_c)
    # print(B)
    B = B[::-1]
    f_c = med
    for i in range(1, N, 2):
        B[f_c] = A[i]
        f_c += 1

    B = B[::-1]
    # print(B)
    print(' '.join(B))

else:
    B[med] = A[0]
    f_c = med+1
    for i in range(1, N, 2):
        B[f_c] = A[i]
        f_c += 1
    # print(B)
    B = B[::-1]
    # print(B)
    f_c = med
    for i in range(0, N, 2):
        B[f_c] = A[i]
        f_c += 1

    B = B[::-1]
    print(' '.join(B))
Buggy python submission (verdict: Time Limit Exceeded):
import math

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

l = abs(N - M)

# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = math.factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans)
        exit()

    else:
        _m = math.factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans)
        exit()



_n = math.factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)


Fixed submission:
import math

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

l = abs(N - M)

# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = math.factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()

    else:
        _m = math.factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()



_n = math.factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)

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

l = abs(N - M)

def factorial(n):
    m = 1
    for i in range(2, n+1):
        m *= i
    return m


# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans)
        exit()

    else:
        _m = factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans)
        exit()



_n = factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)






Fixed submission:
import math

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

l = abs(N - M)

# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = math.factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()

    else:
        _m = math.factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()



_n = math.factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)

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

l = abs(N - M)

def factorial(n):
    m = 1
    for i in range(2, n+1):
        m *= i
    return m


# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:
    _n = factorial(N)
    _m = factorial(M)
    ans = _n * _m
    print(ans)
    exit()


_n = factorial(N)
_m = factorial(M)

ans = (_n * _m * 2) % (10**9+7)
print(ans)



Fixed submission:
import math

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

l = abs(N - M)

# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = math.factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()

    else:
        _m = math.factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()



_n = math.factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())

S = sorted(S)
_list = []
ans = list(S.pop(1))
# print(S)
for e in range(len(S)):
    buff = ans.copy()
    buff2 = []
    for n in range(len(S[e])):

        # print(e, n, S[e])
        for a in range(len(buff)):
            if S[e][n] == buff[a]:
                buff2.append(buff[a])
                buff[a] = '00000000'

    # print(buff2)
    ans = buff2.copy()


ans = sorted(ans)
ans = ''.join(ans)

print(ans)

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

alfa = [chr(i) for i in range(97,97+26)]
counter = [1000000 for i in range(26)]

for s in S:
    for i in range(26):
        counter[i] = min(s.count(alfa[i]), counter[i])

ans = ''
for i in range(26):
    for j in range(counter[i]):
        ans += alfa[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

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

d = defaultdict(int)

for i in range(N):
    d[A[i]] += 1

ans = 0
se = 0
dd = [0 for i in range(3)]
for k, v in d.items():
    value = v // 3 + (v % 3)
    dd[value] += 1
    if value % 3 == 0 or value % 3 == 1:
        ans += 1
    else:
        se += 1

print(ans + ((se//2)*2))

Fixed submission:
from collections import defaultdict

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

d = defaultdict(int)

for i in range(N):
    d[A[i]] += 1

def func(v):
    if v < 3:
        return v
    a = v//3 + v%3

    return func(a)

ans = 0
se = 0
dd = [0 for i in range(3)]
for k, v in d.items():
    value = v // 3 + (v % 3)
    value = func(v)
    # dd[value] += 1
    if value % 3 == 0 or value % 3 == 1:
        ans += 1
    else:
        se += 1

print(ans + ((se//2)*2))
Buggy python submission (verdict: Runtime Error):
a,p,b = list(map(int, input().split()))
if p == '+':
  print(a+b)
else:
  print(a-b)

Fixed submission:
a,p,b = input().split()
a = int(a)
b = int(b)
if p == '+':
  print(a+b)
else:
  print(a-b)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)[::-1]
memo = [0 for i in range(N)]
memo[0] = N-1
memo[1] = N-1
if N % 2 == 0:
    for i in range(2, N):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()
else:
    for i in range(2, N-1):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()


# 最初(N//2)**2にしていた、それぞれの場合の数ではなくなってしまう
print((2**(N // 2))%(10**9+7))

Fixed submission:
a,p,b = input().split()
a = int(a)
b = int(b)
if p == '+':
  print(a+b)
else:
  print(a-b)
Buggy python submission (verdict: Runtime Error):
N=int(input())
n=N%10
if n==2 or n==4 or n==5 or n==7 or n==9:
    ptint('hon')
elif n==3
    print('bon')
else:
    print('pon')


Fixed submission:
a = int(input())
a %= 10

if a==0 or a==1 or a==6 or a==8:
  print("pon")
elif a==3:
  print("bon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
N=int(input())
n=N%10
if n==2,4,5,7,9:
    ptint('hon')
elif n==0,1,6,8:
    print('pon')
else:
    print('bon')

Fixed submission:
a = int(input())
a %= 10

if a==0 or a==1 or a==6 or a==8:
  print("pon")
elif a==3:
  print("bon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
N=int(input())
n=N%10
if n=2,4,5,7,9:
    print('hon')
elif n=0,1,6,8:
    print('pon')
else:
    print('bon')

Fixed submission:
a = int(input())
a %= 10

if a==0 or a==1 or a==6 or a==8:
  print("pon")
elif a==3:
  print("bon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
>>> for N in range(1:1000):
>>> if N%10==2,4,5,7,9:
    print("hon")
>>> elif N%10==0,1,6,8:
    print("pon")
>>> else:
    print("bon")

Fixed submission:
a = int(input())
a %= 10

if a==0 or a==1 or a==6 or a==8:
  print("pon")
elif a==3:
  print("bon")
else:
  print("hon")
Buggy python submission (verdict: Runtime Error):
s,w=map(int.input().split());
if s<=w:
  print('unsafe');
else:
  print('safe');


Fixed submission:
def issafe(S,W):
    if S > W:
        return "safe"
    return "unsafe"

S,W = map(int,input().split())
print(issafe(S,W))

Buggy python submission (verdict: Runtime Error):
s,w=map(int.input().split())
if s<=w:
  print('unsafe')
else:
  print('safe')

Fixed submission:
def issafe(S,W):
    if S > W:
        return "safe"
    return "unsafe"

S,W = map(int,input().split())
print(issafe(S,W))

Buggy python submission (verdict: Runtime Error):
s,w=map(int.input().split());
if s<=w:
  print(unsafe);
else:
  print(safe);


Fixed submission:
def issafe(S,W):
    if S > W:
        return "safe"
    return "unsafe"

S,W = map(int,input().split())
print(issafe(S,W))

Buggy python submission (verdict: Runtime Error):
s,w=map(int.input().split())
if s<=w:
  print(unsafe)
else:
  print(safe)

Fixed submission:
def issafe(S,W):
    if S > W:
        return "safe"
    return "unsafe"

S,W = map(int,input().split())
print(issafe(S,W))
Buggy python submission (verdict: Runtime Error):
import math
R=int(input())
print(2*math.pi*r)

Fixed submission:
import math
r=int(input())
print(2*r*math.pi)

Buggy python submission (verdict: Runtime Error):
1<=R<=100
π=float(input(3.14))
Circle_Pond=2*R*π
print(Circle_Pond)

Fixed submission:
import math
r=int(input())
print(2*r*math.pi)

Buggy python submission (verdict: Runtime Error):
1<=R<=100
Circle_Pond=R*2*3.14
print(Circle_Pond)

Fixed submission:
import math
r=int(input())
print(2*r*math.pi)
Buggy python submission (verdict: Runtime Error):
x = int(input())
for i in range(2,x+1):
  if x%i==0:
    a = 0
    b = a-i
    break
while a**5 -b**5 != x:
  a+= 1
  b+= 1
print(a,b)

Fixed submission:
x = int(input())

cands = [(i**5,i) for i in range(-500,500)]

for a,i in cands:
  for b,j in cands:
    if a-b == x:
      print(i,j)
      exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))

score = {}

for i, a in enumerate(A):
  if i ==0:
    continue
  
  s = i-a
  if s not in score:
    score[s] = []
  score[s].append(i)

from bisect import bisect_left
ans = 0
for i, a in enumerate(A):
  if i+a in score:
    index = bisect_left(score[i+a], i)
    ans += len(score[i+a]) - index
    score[i+a] = score[i+a][index:]
print(ans)

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

score = {}

for i, a in enumerate(A):
  if i ==0:
    continue
  
  s = i-a
  if s not in score:
    score[s] = 0
  score[s]+=1

from bisect import bisect_left
ans = 0
for i, a in enumerate(A):
  if i+a in score:
    ans += score[i+a]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from collections import Counter

s = input()
s = list(s)[::-1]
A = [int(s[i])  * (10**(i))for i in range(len(s))]
A = [0] + list(accumulate(A))
A = [a%2019 for a in A]

A = Counter(A).most_common()
ans = 0
for _, count in A:
  if count == 1:
    break
  ans += count*(count-1)//2
print(ans)

Fixed submission:
from itertools import accumulate
from collections import Counter

s = input()
s = list(s)[::-1]
ten = [1]
for _ in range(len(s)):
  ten.append(ten[-1]*10 % 2019)
  
A = [(int(s[i])  * ten[i])%2019 for i in range(len(s))]
A = list(accumulate(A))
A = [a%2019 for a in A]
A = [0] + A

A = Counter(A).most_common()
ans = 0
for _, count in A:
  if count == 1:
    break
  ans += count*(count-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from collections import Counter

s = input()
s = list(s)[::-1]
A = [int(s[i])  * (10**(i))for i in range(len(s))]
A = [0] + list(accumulate(A))
A = [a%2019 for a in A]

A = Counter(A).most_common()
ans = 0
for _, count in A:
  if count == 1:
    break
  ans += count*(count-1)//2
print(ans)

Fixed submission:
from itertools import accumulate
from collections import Counter

s = input()
s = list(s)[::-1]
ten = [1]
for _ in range(len(s)):
  ten.append(ten[-1]*10 % 2019)
  
A = [(int(s[i])  * ten[i])%2019 for i in range(len(s))]
A = list(accumulate(A))
A = [a%2019 for a in A]
A = [0] + A

A = Counter(A).most_common()
ans = 0
for _, count in A:
  if count == 1:
    break
  ans += count*(count-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,c= map(int,input().split())
s = input()
i = 0

def func(s,k,c):
  i = 0
  res = []
  while 1:
    if s[i] == 'o':
      res.append(i)
      if len(ans1)== k:
        break
      i += c
  return res
ans1 = set(func(s,k,c))
ans2 = set(func(s[::-1],k,c))

ans = list(ans1.intersection(ans2))
for a in ans:
  print(a)

Fixed submission:
n,k,c= map(int,input().split())
s = input()
i = 0

def func(s,k,c):
  i = 0
  res = []
  while 1:
    if s[i] == 'o':
      res.append(i)
      if len(res)== k:
        break
      i += c
    i+= 1
  return res
ans1 = func(s,k,c)
ans2 = func(s[::-1],k,c)
ans2 = [n-a-1 for a in ans2]
ans2 = ans2[::-1]

for i in range(k):
  if ans1[i]==ans2[i]:
    print(ans1[i]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n,k,c = map(int,input().split())
s = input()

dp = [[] for _ in range(k)]

days = [i for i in range(n) if s[i] == 'o']
dp[0] = [[day] for day in days]


for day in days:
  for i in range(k-1):
    for j in range(len(dp[i])):
      if dp[i][j][-1] +c < day:
        dp[i+1].append(dp[i][j]+[day])

ans = set(dp[k-1][0])
for lst in dp[k-1]:
  ans = ans.intersection(set(lst))
ans = list(ans)
ans.sort()
for a in ans:
  print(a+1)
  

Fixed submission:
n,k,c= map(int,input().split())
s = input()
i = 0

def func(s,k,c):
  i = 0
  res = []
  while 1:
    if s[i] == 'o':
      res.append(i)
      if len(res)== k:
        break
      i += c
    i+= 1
  return res
ans1 = func(s,k,c)
ans2 = func(s[::-1],k,c)
ans2 = [n-a-1 for a in ans2]
ans2 = ans2[::-1]

for i in range(k):
  if ans1[i]==ans2[i]:
    print(ans1[i]+1)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
r = y-x+1
for k in range(1,n):
  ans = 0
  left=right=circle = 0
  for i in range(1,n+1):
    #left
    if i < x:
      if i + k <= x:#円に届かない
        left += 1
        continue
      elif r/2 == k- (x-i):
        left += 1
      elif r/2 > k - (x-i):
        left += 2
      if (x-i)+1 < k and k - (x-i)-1 - (n-y) <= 0:
        left += 1
  #right
    elif i >= y:
      if i + k <= n:
        right += 1
      if i == y:
        continue
      if r / 2 == k-(i-y):
        right += 1
      elif r / 2 > k-(i-y)>0:
      #if  k - (i- y)> 0 and (k-(i-y))< r//2:
        right += 2
  #circle
  if r /2 == k:
    circle = r//2
  elif r/2 > k:
    circle = r
  print(left+right+circle)
        

Fixed submission:
n,x,y = map(int,input().split())
r = y-x+1
for k in range(1,n):
  ans = 0
  left=right=circle = 0
  for i in range(1,n+1):
    #left
    if i < x:
      if i + k <= x:#円に届かない
        left += 1
        continue
      elif r/2 == k- (x-i):
        left += 1
      elif r/2 > k - (x-i):
        left += 2
      if (x-i)+1 < k and k - (x-i)-1 - (n-y) <= 0:
        left += 1
  #right
    elif i >= y:
      if i + k <= n:
        right += 1
      if i == y:
        continue
      if r / 2 == k-(i-y):
        right += 1
      elif r / 2 > k-(i-y)>0:
      #if  k - (i- y)> 0 and (k-(i-y))< r//2:
        right += 2
  #circle
  if r /2 == k:
    circle = r//2
  elif r/2 > k:
    circle = r
  print(left+right+circle)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  graph[a].append(b)
  graph[b].append(a)
  
one = n//3 + bool(n%3)
two = n//3 + bool(n%3>1)
three = n//3
nums = [three+1,one,two]
perms = [0 for i in range(n)]



def dfs(i,n):
  global nums
  perms[i] = (nums[n]-1)*3 + n
  nums[n] -= 1 
  for node in graph[i]:
    if perms[node] == 0:
      next_n = (3-n)%3
      if nums[next_n] == 0:
        dfs(node,0)
      else:
        dfs(node,next_n)


for i in range(n):
  dfs(i,1)
  if sum(perms) == n*(n+1)//2:
    break
  perms = [0 for _ in range(n)]
  nums = [three+1,one,two]
print(*perms)

Fixed submission:
S = input()
hi = ['hi','hihi','hihihi','hihihihi','hihihihihi']
print('Yes'if S in hi else 'No')
Buggy python submission (verdict: Runtime Error):
S = input()
s = set(input())
print('Yes' if len(s)>1 else 'No')



Fixed submission:
s = set(input())
print('Yes' if len(s)>1 else 'No')