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

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

if A%2!=0 and B%2!=0:
        print("Yes")
else :
        print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
before=[]
ans="Yes"
for i in range(N):
        s=input()
        if s in before:
                ans="No"
        if len(before)>0:
                if before[-1][-1]!=s[0]:
                        ans="No"
        before.append(s)

print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A%2!=0 and B%2!=0:
        print("Yes")
else :
        print("No")
Problem p03273 (python)

Fixed submission:
H,W=map(int,input().split())
bd=[]

for i in range(H):
        bd.append(input())

x=set()
y=set()

for i in range(H):
        for j in range(W):
                if bd[i][j]=="#":
                        x.add(j)
                        y.add(i)
for i in y:
        for j in x:
                print(bd[i][j],end="")
        print()

Buggy submission (verdict: Runtime Error):
H,W=mamp(int,input().split())
bd=[]

for i in range(H):
        bd.append(input())

x=set()
y=set()

for i in range(H):
        for j in range(W):
                if bd[i][j]=="#":
                        x.add(j)
                        y.add(i)
for i in y:
        for j in x:
                print(bd[i][j],end="")
        print()
Problem p03281 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N = int(input())
count = 0

for i in range(1, N + 1):
    a = []
    if i % 2 == 0:
        continue

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

    if len(a) == 8:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
count=0

for i in range(1,N+1):
    a=[]
    if i%2==0:
        continue
     for j in range(1,i+1):
         if i%j==0:
             a.append(j)

    if len(a)==8:
        count+=1

print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
conut=0

for i in range(1,N+1):
    a=[]
    if i%2==0:
        continue
     for j in range(1,i+1):
         if i%j==0:
             a.append(j)

    if len(a)==8:
        count+=1

print(count)

Buggy submission (verdict: Runtime Error):
N=in(input())
conut=0

for i in range(1,N+1):
    a=[]
    if i%2==0:
        continue
     for j in range(1,i+1):
         if i%j==0:
             a.append(j)

    if len(a)==8:
        count+=1

print(count)
Problem p03289 (python)

Fixed submission:
S = input()
if(S[0]=='A' and S[2:-1].count('C') == 1):
  cnt = 0
  for i in S:
    if(not (97<=ord(i) and ord(i)<=122)):
      cnt+=1
  if(cnt==2):
    print('AC')
  else:
    print('WA')
else:
  print('WA')

Buggy submission (verdict: Runtime Error):
S=input()
if(S[0]=="A" and S[2,-1].count("C")==1):
    cnt=0
    for i in S:
        if(97<=ord(i) and ord(i)<=122):
            cnt+=1
    if(cnt==2):
            print("AC")
    else :
            print("WA")
else :
    print("WA")
Problem p03292 (python)

Fixed submission:
task=list(map(int,input().split()))
print(sorted(task)[2]-sorted(task)[0])

Buggy submission (verdict: Runtime Error):
task=list(map(int,intput().split()))
task.sort()
cost=0
for i in range(1,3):
    cost+=task[i]-task[i-1]

print(cost)
Problem p03293 (python)

Fixed submission:
S = input()
T = input()
for i in range(len(S)):
    if S[i] == T[0]:
        new_s = S[i:] + S[:i]
        if new_s == T:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
for i in range(len(S)):
    if S[i]==T[0]:
        new_s=S[i:]+S[:i]
         if new_s==T:
             print("Yes")
             exit()

print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
for i in range(len(S)):
    if S[i]==T[0]:
        new_s=S[i:]+S[:i]
         if new_s==T:
             print("Yes")
             exit()

print("No")
Problem p03316 (python)

Fixed submission:
n = input()
tmp = 0

for i in range(len(n)):
    tmp += int(n[i])
if(int(n)%tmp==0):
    print("Yes")
else:
    print("No")

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

for i in range(len(S)):
    num+=int(S[i])

if ((int)S%num)==0 :
    print("Yes")

else :
    print("No")
Problem p03565 (python)

Fixed submission:
input_A = input()
input_T = input()
input_A, input_T = list(input_A), list(input_T)

if len(input_A) >= len(input_T):
    for i in range(len(input_A)-len(input_T), -1, -1):
        clear_flg = True
        for j in range(len(input_T)):
            if not (input_A[i + j] == '?' or input_A[i + j] == input_T[j]):
                clear_flg = False
                break

        if clear_flg is True:
            input_A[i:i + len(input_T)] = input_T
            input_A = ''.join(input_A).replace('?', 'a')
            break
else:
    clear_flg = False

if clear_flg is True:
    print(input_A)
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
input_A = input()
input_T = input()
input_A, input_T = list(input_A), list(input_T)

if len(input_A) >= len(input_T):
    for i in range(len(input_A)-len(input_T), -1, -1):
        clear_flg = True
        for j in range(len(input_T)):
            if not (input_A[i + j] == '?' or input_A[i + j] == input_T[j]):
                clear_flg = False
                break

        if clear_flg is True:
            input_A[i:i + len(input_T)] = input_T
            input_A = ''.join(input_A).replace('?', 'a')
            break
        else:
            input_A = 'UNRESTORABLE'
else:
    input_A = 'UNRESTORABLE'
print(input_A)

Buggy submission (verdict: Runtime Error):
input_A = input()
input_T = input()
input_A, input_T = list(input_A), list(input_T)

for i in range(len(input_A)-len(input_T), 0, -1):
    clear_flg = True
    for j in range(len(input_T)):
        if not (input_A[i + j] == '?' or input_A[i + j] == input_T[j]):
            clear_flg = False
            break

    if clear_flg is True:
        input_A[i:i + len(input_T)] = input_T
        input_A = ''.join(input_A).replace('?', 'a')
    else:
        input_A = 'UNRESTORABLE'
print(input_A)
Problem p03633 (python)

Fixed submission:
# import math
from fractions import gcd
from functools import reduce

N = int(input())
T = map(int, [input() for _ in range(N)])

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(T))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N = int(input())
T = map(int, [input() for _ in range(N)])

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(T))
Problem p03160 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[0]*(n)
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    dp[i]=min(abs(h[i-1]-h[i])+dp[i-1],abs(h[i-2]-h[i])+dp[i-2])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[1<<60]*(n)
dp[0]=0
for i in range(1,n):
    for j in range(1,(k+1)):
        if i>=j:
            dp[i]=min(abs(h[i-j]-h[i])+dp[i-j],abs(dp[i]))
        else:
            break
print(dp[-1])

Buggy submission (verdict: Runtime Error):
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[1<<60]*(n)
    dp[0]=0
    for i in range(1,n):
        for j in range(1,(k+1)):
            if i>=j:
                dp[i]=min(abs(h[i-j]-h[i])+dp[i-j],abs(dp[i]))
            else:
                break
    print(dp[-1])
Problem p03293 (python)

Fixed submission:
Spr = input()
T = list(input())
S = list(Spr)

change = ""
ok = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change += T[j+i]
    for k in range(i):
      change += T[k]
    if Spr == change:
      if ok == 0:
      	print("Yes")
      	ok = 1
    change = ""

if i == len(S) - 1 and ok == 0:
  print("No")

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())

change = []
flag = 0
get = 0

for i in range(len(S)):
  if S[0] == T[i]:
    get = 1
    for j in range(len(S) - i):
      change.append(T[j+i])
    for k in range(i):
      change.append(T[k])
      
if get == 1:
	for check in range(len(S)):
  		if S[check] != change[check]:
    		flag = 1

if flag == 1:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
T = list(input())

change = []
flag = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change.append(T[j+i])
    for k in range(i):
      change.append(T[k])
      
for check in range(len(S)):
  if S[check] != change[check]:
    flag = 1

if flag == 1:
  print("No")
else:
  print("Yes")
Problem p03328 (python)

Fixed submission:
a,b = (int(i) for i in input().split())

length = b - a
result = 0

for j in range(length):
  result += j
  
print(result + length - b)

Buggy submission (verdict: Runtime Error):
a,b = (int(i) for i in input().split())

length = b - a
count = length - 1

for j in range(length):
  a -= count
  print(a)
  if a =< 0:
    print(1 - a)
    break
  else:
    count -= 1
    print(count)
Problem p03645 (python)

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

first = []
second = []
flag = 0
end = True

for i in range(M):
  a,b = map(int,input().split(" "))
  if b == N:
    second.append(a)
  if a == 1:
    first.append(b)

first.sort()
second.sort()
    
if len(first) == 0 or len(second) == 0:
  print("IMPOSSIBLE")
else:
  firsti = 0
  secondi = 0
  while(end == True):
    if first[firsti] == second[secondi]:
      print("POSSIBLE")
      break
    elif first[firsti] < second[secondi]:
      firsti += 1
      if firsti > len(first) - 1:
        print("IMPOSSIBLE")
        break
    else:
      secondi += 1
      if secondi > len(second) - 1:
        print("IMPOSSIBLE")
        break

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split(" "))

first = []
second = []
flag = 0
end = True

for i in range(M):
  a,b = map(int,input().split(" "))
  if b == N:
    second.append(a)
  if a == 1:
    first.append(b)

first.sort()
second.sort()
    
if len(first) == 0 or len(second) == 0:
  print("IMPOSSIBLE")
else:
  firsti = 0
  secondi = 0
  while(end == True):
    if first[firsti] == second[secondi]:
      print("POSSIBLE")
      break
    elif first[firsti] < second[secondi]:
      firsti += 1
      if firsti > len(first) - 1:
        print("IMPOSSIBLE")
        break
    else:
      second += 1
      if secondi > len(second) - 1:
        print("IMPOSSIBLE")
        break

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split(" "))

first = []
second = []
flag = 0
end = True

for i in range(M):
  a,b = map(int,input().split(" "))
  if b == N:
    second.append(a)
  if a == 1:
    first.append(b)
    
if len(first) == 0 or len(second) == 0:
  print("IMPOSSIBLE")
else:
  firsti = 0
  secondi = 0
  while(end == True):
    if first[firsti] == second[secondi]:
      print("POSSIBLE")
      break
    elif first[firsti] < second[secondi]:
      firsti += 1
      if firsti > len(first) - 1:
        print("IMPOSSIBLE")
        break
    else:
      second += 1
      if secondi > len(second) - 1:
        print("IMPOSSIBLE")
        break
Problem p03646 (python)

Fixed submission:
K = int(input())

N = 50

ans = [i for i in range(N)]
x,y = divmod(K,N)

ans = list(map(lambda a:a+x,ans))

for i in range(y):
    ans[i] += N + 1
    ans = list(map(lambda a:a-1,ans))

print(N)
print(*ans)

Buggy submission (verdict: Runtime Error):
K = int(input())

result = ""

for i in range(K):
  if i == K - 1:
    result += K
  else:
    result += K
    
print(K)
print(result)
Problem p03994 (python)

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

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if K == 0:
        break
    else:
        if (123 - ord(sArr[i])) <= K:
            K -= (123 - ord(sArr[i])) % 26
            sArr[i] = "a"

if K > 0:
    K %= 26
    sArr[endpoint] = chr(ord(sArr[endpoint]) + K)

for j in range(len(sArr)):
    result += sArr[j]

print(result)

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if ord("z") - ord(sArr[i]) + 1 <= K:
        K -= ord("z") - ord(sArr[i]) + 1
        sArr[i] = "a"

while K > 0:
    if ord("z") - ord(sArr[endpoint]) >= K:
        sArr[endpoint] = chr(ord(sArr[endpoint]) + K)
        K = 0
    else:
        sArr[endpoint] = "z"
        K -= ord("z") - ord(sArr[endpoint])
        endpoint -= 1
    if endpoint == 0 and K != 0:
        while endpoint != len(s) - 1 or K != 0:
            sArr[endpoint] = "a"
            K -= 1
            endpoint += 1

for j in range(len(sArr)):
    result += sArr[j]

print(result)

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if ord("z") - ord(sArr[i]) + 1 <= K:
        K -= ord("z") - ord(sArr[i]) + 1
        sArr[i] = "a"

while K > 0:
    if ord("z") - ord(sArr[endpoint]) >= K:
        sArr[endpoint] = chr(ord(sArr[endpoint]) + K)
        K = 0
    else:
        sArr[endpoint] = "z"
        K -= ord("z") - ord(sArr[endpoint])
        endpoint -= 1
    if endpoint == 0 and K != 0:
        while endpoint != len(s) - 1:
            sArr[endpoint] = "a"
            K -= 1
            endpoint += 1

for j in range(len(sArr)):
    result += sArr[j]

print(result)

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if ord("z") - ord(sArr[i]) + 1 <= K:
        K -= ord("z") - ord(sArr[i]) + 1
        sArr[i] = "a"

while K > 0:
    if ord("z") - ord(sArr[endpoint]) >= K:
        sArr[endpoint] = chr(ord(sArr[endpoint]) + K)
        K = 0
    else:
        sArr[endpoint] = "z"
        K -= ord("z") - ord(sArr[endpoint])
        endpoint -= 1
    if endpoint == 0 and K != 0:
        while endpoint != len(s) - 1:
            sArr[endpoint] = "a"
            K -= 1

for j in range(len(sArr)):
    result += sArr[j]

print(result)

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())

sArr = list(s)
endpoint = len(sArr) - 1
result = ""

for i in range(len(sArr)):
    if ord("z") - ord(sArr[i]) + 1 <= K:
        K -= ord("z") - ord(sArr[i]) + 1
        sArr[i] = "a"

while K > 0:
    if ord("z") - ord(sArr[endpoint]) >= K:
        sArr[endpoint] = chr(ord(sArr[endpoint]) + K)
        K = 0
    else:
        sArr[endpoint] = "z"
        K -= ord("z") - ord(sArr[endpoint])
        endpoint -= 1

for j in range(len(sArr)):
    result += sArr[j]

print(result)
Problem p03457 (python)

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

for i in range(N):
    t, x, y = map(int, input().split())
    if (x+y) > t or (x+y+t) % 2 == 1:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import sys
N = int(input())
lis = []
for i in range(N):
    s_raw = input().split()
    s = [int(j) for j in s_raw]
    lis.append(s)

def travel(t, x, y, count):
    if t > lis[N-1][0]:
        print("Yes")
        sys.exit()
    if t == lis[count][0]:
        if x == lis[count][1] and y == lis[count][2]:
            count += 1
        else:
            return
    travel(t+1, x+1, y, count)
    travel(t+1, x-1, y, count)
    travel(t+1, x, y+1, count)
    travel(t+1, x, y-1, count)

travel(0, 0, 0, 0)
print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import sys
N = int(input())
lis = []
for i in range(N):
    s_raw = input().split()
    s = [int(j) for j in s_raw]
    lis.append(s)

def travel(t, x, y, count):
    if t > lis[N-1][0]:
        print("YES")
        sys.exit()
    if t == lis[count][0]:
        if x == lis[count][1] and y == lis[count][2]:
            count += 1
        else:
            return
    travel(t+1, x+1, y, count)
    travel(t+1, x-1, y, count)
    travel(t+1, x, y+1, count)
    travel(t+1, x, y-1, count)

travel(0, 0, 0, 0)
print("NO")
Problem p03471 (python)

Fixed submission:
# -*- coding:utf-8 -*-
N, Y = map(int, input().split())
flag = False

def isValid(l, m, n):
    sum = l*10000 + m*5000 + n*1000
    if sum == Y:
        return True
    return False

for i in reversed(range(N+1)):
    for j in range(N+1):
        if i + j > N:
            break
        else:
            if isValid(i, j, N-i-j):
                flag = True
                print("{0} {1} {2}".format(i, j, N-i-j))
                break
        if flag:
            break
    if flag:
        break

if not flag:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

N, Y = map(int, input().split())

count = 0

for i in range((Y//10000)+1):
    for j in range((Y//5000)+1):
        k = (Y -i*10000 + j*5000) // 1000
        if i + j + k == N:
            print("{0} {1} {2}".format(i, j, k))
            exit()

print("-1 -1 -1")
Problem p03330 (python)

Fixed submission:
import itertools

N, C = map(int, input().split())
# N, C = 500, 30

D = []
for _ in range(C):
    D.append(list(map(int, input().split())))
    # D.append([100] * C)

diff_by_pos_color_pair = [[0 for _ in range(C)] for _ in range(3)]
for i in range(N):
    for j, color_from in enumerate(map(lambda x: int(x) - 1, input().split())):
        # for j, color_from in enumerate([0] * N):
        pos = (i + j) % 3
        for color_to in range(C):
            diff_by_pos_color_pair[pos][color_to] += D[color_from][color_to]


min_diff = float("inf")
for ccs in itertools.permutations(range(C), 3):
    diff = 0
    for pos, color in enumerate(ccs):
        diff += diff_by_pos_color_pair[pos][color]
    min_diff = min(min_diff, diff)

print(min_diff)

Buggy submission (verdict: Runtime Error):
import itertools

N, C = map(int, input().split())
D = []
for _ in range(C):
    D.append(list(map(int, input().split())))

diff_by_pos_color_pair = [[0 for _ in range(C)] for _ in range(3)]
for i in range(N):
    for j, color_from in enumerate(map(lambda x: int(x) - 1, input().split())):
        pos = (i + j) % 3
        for color_to in range(C):
            diff_by_pos_color_pair[pos][color_to] += D[color_from][color_to]


min_diff = float("inf")
for ccs in itertools.permutations(range(C), 3):
    diff = 0
    for pos, color in enumerate(ccs):
        diff += diff_by_pos_color_pair[pos][ccs[color]]
    min_diff = min(min_diff, diff)

print(min_diff)

Buggy submission (verdict: Runtime Error):
import itertools

N, C = map(int, input().split())
D = []
for _ in range(C):
    D.append(list(map(int, input().split())))
c = []
for _ in range(N):
    c.append(list(map(lambda x: int(x) - 1, input().split())))

diff_by_pos_color_pair = [[0 for _ in range(C)] for _ in range(3)]
for i in range(N):
    for j in range(N):
        pos = (i + j) % 3
        for color in range(C):
            diff_by_pos_color_pair[pos][color] += D[c[i][j]][color]


min_diff = float("inf")
for ccs in itertools.permutations(range(C), 3):
    diff = 0
    for pos, color in enumerate(ccs):
        diff += diff_by_pos_color_pair[pos][ccs[color]]
    min_diff = min(min_diff, diff)

print(min_diff)
Problem p03573 (python)

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

if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
table = []
table.append(list("_" * (W + 2)))
for _ in range(H):
    table.append(list("_" + input() + "_"))
table.append(list("_" * (W + 2)))

for h in range(1, H + 1):
    for w in range(1, W + 1):
        if table[h][w] == "#":
            continue
        count = 0
        for _h in [-1, 0, +1]:
            for _w in [-1, 0, +1]:
                print(h + _h, w + _w)
                if table[h + _h][w + _w] == "#":
                    count += 1
        table[h][w] = str(count)

for h in range(1, H + 1):
    print("".join(table[h]).replace("_", ""))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
table = []
table.append(list("_" * (W + 2)))
for _ in range(H):
    table.append(list("_" + input() + "_"))
table.append(list("_" * (W + 2)))

for h in range(1, H + 1):
    for w in range(1, W + 1):
        if table[h][w] == "#":
            continue
        count = 0
        print(h, w, "---------")
        for _h in [-1, 0, +1]:
            for _w in [-1, 0, +1]:
                print(h + _h, w + _w)
                if table[h + _h][w + _w] == "#":
                    count += 1
        table[h][w] = str(count)

for h in range(1, H + 1):
    print("".join(table[h]).replace("_", ""))
Problem p03080 (python)

Fixed submission:
n=int(input())
s=input()
t=s.count('R')
if 2*t>n:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=input()
s=input()
t=s.count('R')
if 2*t>n:
    print('Yes')
else:
    print('No')
Problem p03081 (python)

Fixed submission:
n,q=map(int,input().split())
c=input()
s=[input().split() for _ in [0]*q]
def judge(x,opt):
    for y in s:
        if y[0]==c[x]:
            if y[1]=='L':
                x-=1
            else:
                x+=1
            if not opt:
                if x>=n:
                    return False
                elif x<0:
                    return True
            else:
                if x<0:
                    return False
                elif x>=n:
                    return True
    return False
def bisect(l,r,opt):
    center=(r+l)//2
    if judge(center,opt):
        if r-l<=1:
            if not opt:
                return l+1
            else:
                return  n-l
        if not opt:
            return bisect(center+1,r,opt)
        else:
            return bisect(l,center,opt)
    else:
        if r-l<=1:
            if not opt:
                return l
            else:
                return n-r
        if not opt:
            return bisect(l,center,opt)
        else:
            return bisect(center+1,r,opt)
def func():
    l=bisect(0,n,0)
    r=bisect(0,n,1)
    print(n-l-r)
func()

Buggy submission (verdict: Runtime Error):
%%time
n,q=map(int,input().split())
c=input()
s=[input().split() for _ in [0]*q]
def judge(x,opt):
    for y in s:
        if y[0]==c[x]:
            if y[1]=='L':
                x-=1
            else:
                x+=1
            if not opt:
                if x>=n:
                    return False
                elif x<0:
                    return True
            else:
                if x<0:
                    return False
                elif x>=n:
                    return True
    return False
def bisect(l,r,opt):
    print(l,r)
    center=(r+l)//2
    if judge(center,opt):
        if r-l<=1:
            if not opt:
                return l+1
            else:
                return  n-l
        if not opt:
            return bisect(center+1,r,opt)
        else:
            return bisect(l,center,opt)
    else:
        if r-l<=1:
            if not opt:
                return l
            else:
                return n-r
        if not opt:
            return bisect(l,center,opt)
        else:
            return bisect(center+1,r,opt)
def func():
    l=bisect(0,n,0)
    r=bisect(0,n,1)
    print(n-l-r)
func()