ZhenlongDai/ACPR huggingface dataset:
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int((b-a)/2))
else:
    print(
        min(a-1, n-b)
        + 1
        + (b-a-1)
    )

Failing test case input:
-2 -2 31

Expected output:
-16


Actual output:
0


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

if (b - a) % 2 == 0:
    print((b-a)
else:
    print(min(a-1, n-b)+1+(b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input_lines = input().split()
N = int(input_lines[0])
A = int(input_lines[1])
B = int(input_lines[2])

ans = 0
if (B-A)%2 == 0:
    print(int((B-A)/2))
else:
    ans = int((A-B-1)/2)
    A+=ans
    B-=ans
    print(min(N-A,B-1)+ans)


Failing test case input:
-1 2 189

Expected output:
-96


Actual output:
-3


Fixed submission (verdict: Accepted):
input_lines = input().split()
N = int(input_lines[0])
A = int(input_lines[1])
B = int(input_lines[2])

ans = 0
if (B-A)%2 == 0:
    print(int((B-A)
else:
    print(min(A-1,N-B)+1+int((B-A-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int((b-a)/2))
else:
    print(min(b-1, n-a)+1+int((b-a-1)/2))

Failing test case input:
-2 1 32

Expected output:
-18


Actual output:
13


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

if (b - a) % 2 == 0:
    print((b-a)
else:
    print(min(a-1, n-b)+1+(b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, A: int, B: int):
    s = abs(B-A)
    if s == 1:
        print(2)
    else:
        from math import ceil
        print(ceil(s/2))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(N, A, B)

if __name__ == '__main__':
    main()


Failing test case input:
0 4 249

Expected output:
-126


Actual output:
123


Fixed submission (verdict: Accepted):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, A: int, B: int):
    from math import ceil
    if (B-A)%2 == 0:
        print((B-A)
        
    else:
        print(min(A-1, N-B)+1+(B-A-1)


    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(N, A, B)

if __name__ == '__main__':
    main()
Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,A,B = [int(x) for x in input().split()];

l = max(A-1,B-1);
r = max(N-B,N-A);
if (B-A)%2 == 0 :
    print(min(int(B-A)/2,l,r));
else :
    print(min(l,r));

Failing test case input:
0 -1 172

Expected output:
-85


Actual output:
1


Fixed submission (verdict: Accepted):
N,A,B = [int(x) for x in input().split()];




lm = A + (B-A-1)


rm = N-B+1 + (B-A-1)

if (B-A)%2 == 0 :
    print((B-A)
else :
    print(min(lm,rm));

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inputLine = input().split(' ')
N = int(inputLine[0])
A = int(inputLine[1])
B = int(inputLine[2])

if abs(A - B) % 2 == 1:
  print(min((max(A, B) - 1), (N - (max(A, B)))))
else:
  print( abs(A - B) / 2)

Failing test case input:
1 -6 44

Expected output:
25


Actual output:
25.0


Fixed submission (verdict: Accepted):
inputLine = input().split(' ')
N = int(inputLine[0])
A = int(inputLine[1])
B = int(inputLine[2])

if (B - A) % 2 == 1:
  returnNum = int(min((N - B), (A - 1)))
  print(int(returnNum + 1 + (B - A - 1) 
else:
  print(int((B - A)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input_lines = input().split()
N = int(input_lines[0])
A = int(input_lines[1])
B = int(input_lines[2])

ans = 0
if (B-A)%2 == 0:
    print(int((B-A)/2))
else:
    while B-A>1:
        A+=1
        B-=1
        ans+=1
    print(min(N-A,B-1)+ans)


Failing test case input:
6 -1 36

Expected output:
-11


Actual output:
7


Fixed submission (verdict: Accepted):
input_lines = input().split()
N = int(input_lines[0])
A = int(input_lines[1])
B = int(input_lines[2])

ans = 0
if (B-A)%2 == 0:
    print(int((B-A)
else:
    print(min(A-1,N-B)+1+int((B-A-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n,a,b=MI()
    ans=10**18+5
    if (b-a)%2==0:ans=(b-a)
    ans=min(ans,b-1,n-a)
    print(ans)
main()

Failing test case input:
0 2 189

Expected output:
-95


Actual output:
-2


Fixed submission (verdict: Accepted):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n,a,b=MI()
    if (b-a)%2==0:print((b-a)
    else:
        ans=min((2*n-a-b+1)
        print(ans)

main()
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = list(map(int, input().split()))
sa = b-a
if sa%2==0:
  print(int(sa/2))
else:
  print(int((sa-1)/2)+min(b-1,n-a)+1)


Failing test case input:
0 -1 86

Expected output:
-42


Actual output:
45


Fixed submission (verdict: Accepted):
n,a,b = list(map(int, input().split()))
if (b-a)%2==0:
  print(int((b-a)
else:
  print(min(a-1,n-b) + 1 + int((b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())

if (b - a) % 2 == 0:
    ans = (b - a) 
else:
    x = b - 1
    y = n - a
    ans = min(x,y)
print(ans)


Failing test case input:
6 0 28

Expected output:
14


Actual output:
28


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

if (b - a) % 2 == 0:
    ans = (b - a) 
else:
    x = b - 1
    y = n - a
    w = n - b
    z = a - 1
    ans = min((y+w+1)
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int,input().split())
mid = N/2
if (B-A)%2 == 0:
  answer = 0
else:
  answer = min(int(N-A), int(B-1))

print(answer)

Failing test case input:
0 4 249

Expected output:
-126


Actual output:
-4


Fixed submission (verdict: Accepted):
N, A, B = map(int,input().split())
if (B-A)%2 == 0:
  answer = int((B-A)
else:
  answer = min(A-1, N-B)+1+int((B-A-1)

print(answer)

Problem: p02823
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if (b - a)%2 == 0:
    print(int((b-a)/2))
else:
    print(int(min(n-a, b-1)+1+(b-a-1)/2))

Failing test case input:
-1 4 189

Expected output:
-97


Actual output:
88


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

if (b - a)%2 == 0:
    print((b-a)
else:
    print(min(a-1, n-b)+1+(b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
    
    
    if sub % 2 == 0:
        return sub / 2
    
    else:
        if left_s < right_s:
            return B - 1
        else:
            return N - A
    
if __name__ == '__main__':
    print(int(main()))

Failing test case input:
0 -1 104

Expected output:
-51


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
        
    
    if sub % 2 == 0:
        return sub 
    
    else:
        return (min(left_s, right_s) + 1 + ((sub - 1)
    
if __name__ == '__main__':
    print(main())
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
li = list(map(int,input().split()))
n = li[0]
a = li[1]
b = li[2]
ans = 0
if (b-a)%2 == 0:
    ans = (b-a)
elif a-1<n-b:
    ans=b-1
else:
    ans=n-a




print(ans)




Failing test case input:
1 -6 44

Expected output:
25


Actual output:
50


Fixed submission (verdict: Accepted):
li = list(map(int,input().split()))
n = li[0]
a = li[1]
b = li[2]
ans = 0
if (b-a)%2 == 0:
    ans = (b-a)
else:
    if a-1>n-b:
        ans+=n-b
        ans = ans-(-(b-a)
    else:
        ans+=a-1
        ans = ans-(-(b-a)
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = [int(i) for i in input().split()]
if (b-a)%2==0:
    print(int( (b-a)/2 ))
else:
    r = int( a + (b-a-1)/2 )
    l = int( n-b+1 + ( n - (a+n-b+1) )/2 )
    print(min(n-a,b-1))

Failing test case input:
0 1 24

Expected output:
-12


Actual output:
-1


Fixed submission (verdict: Accepted):
n,a,b = [int(i) for i in input().split()]
if (b-a)%2==0:
    print((b-a)
else:
    r = a + (b-a-1)
    l = n-b+1 + ( n - (a+n-b+1) )
    print(min(r,l))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
    
    
    if sub % 2 == 0:
        return sub / 2
    
    else:
        if left_s > right_s:
            return B - 1
        else:
            return N - A
    
if __name__ == '__main__':
    print(int(main()))

Failing test case input:
0 2 57

Expected output:
-29


Actual output:
56


Fixed submission (verdict: Accepted):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
        
    
    if sub % 2 == 0:
        return sub 
    
    else:
        return (min(left_s, right_s) + 1 + ((sub - 1)
    
if __name__ == '__main__':
    print(main())

Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,A,B = [int(x) for x in input().split()];

l = max(A-1,B-1);
r = max(N-B,N-A);
if (B-A)%2 == 0 :
    print(min(int((B-A)/2),l,r));
else :
    print(min(l,r));

Failing test case input:
1 -2 44

Expected output:
23


Actual output:
3


Fixed submission (verdict: Accepted):
N,A,B = [int(x) for x in input().split()];




lm = A + (B-A-1)


rm = N-B+1 + (B-A-1)

if (B-A)%2 == 0 :
    print((B-A)
else :
    print(min(lm,rm));

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = (int(i) for i in input().split())

len = b-a
if ((len % 2) == 0):
    print(int(len/2))
    exit()
else:
    r = [a-1, n-b]
    print(min(r) + int((len+1)/2) + 1)
    exit()


Failing test case input:
1 -1 86

Expected output:
-41


Actual output:
-40


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

x = b-a
if ((x % 2) == 0):
    print(x
    exit()
else:
    print(min(a-1, n-b) + 1 + (b-a-1)
    exit()
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, a, b = map(int, input().split())
    if abs(a - b) % 2 == 0:
        print(abs(a - b) / 2)
    else:
        mi = min(a, b) - 1
        ma = n - max(a, b)
        print(min(mi, ma) + abs(a - b))


if __name__ == '__main__':
    main()

Failing test case input:
0 -1 86

Expected output:
-42


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    n, a, b = map(int, input().split())
    if abs(a - b) % 2 == 0:
        print(abs(a - b) 
    else:
        mi = min(a, b) - 1
        ma = n - max(a, b)
        print(min(mi, ma) + (abs(a - b) + 1) 


if __name__ == '__main__':
    main()

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if abs(a - b) % 2 == 0:
    ans = abs(a - b) 
else:
    ans = min(max(a, b) - 1, max(n - a, n - b))

print(ans)


Failing test case input:
-4 1 18

Expected output:
-13


Actual output:
-5


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

if abs(a - b) % 2 == 0:
    ans = abs(a - b) 
else:
    ans = min(a + (b - a - 1) 

print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int, input().split())
if (B-A) % 2 == 0:
  print((B-A) / 2)
else:
  print(min(A-1,N-B) + 1 + (B-A-1)/2)


Failing test case input:
5 1 27

Expected output:
13


Actual output:
13.0


Fixed submission (verdict: Accepted):
N,A,B = map(int, input().split())
if (B-A)%2==0:
  print((B-A)
else:
  print(min(A-1,N-B)+1+(B-A-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, a, b = map(int, input().split())
if (b-a)%2 != 0:
    ans = min(b-1, n-a)
else:
    ans = min(math.ceil((b - a) / 2), b-1, n-a)
print(ans)

Failing test case input:
0 0 459

Expected output:
-229


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
if (b-a)%2 != 0:
    if a-1 <= n-b:
        ans = (b - a -1)
    else:
        ans = (b - a - 1)
else:
    ans = min((b - a) 
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if (b - a) % 2 == 1:
    print(min(b-1, n-a-1))
else:
    print(b - a - 1)

Failing test case input:
6 0 28

Expected output:
14


Actual output:
27


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

mid = b - a

if mid % 2 == 0:
    print(mid 
else:
    print(min(a - 1, n - b) + 1 + (mid - 1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())
if (B-A)%2 == 0:
    print(int((B-A)/2))
else:
    a = N - A + 1
    b = N - B + 1
    print(int(min([A -1 + (B-A-1)/2,a + (b-a-1)/2])))

Failing test case input:
10 4 7

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())
temp = 0
if (B-A)%2 == 0:
    print(int((B-A)
else:
    a = N - A + 1
    b = N - B + 1
    print(min([B-1,N-A,A + (B-A-1)
Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, a, b = map(int,input().split())
if (b-a)%2 == 0:
    print(int((b-a)/2))
else:
    if n-b < a:
        print(n-a)
    else:
        print(b-1)

Failing test case input:
-1 4 189

Expected output:
-97


Actual output:
-5


Fixed submission (verdict: Accepted):
n, a, b = map(int,input().split())
if a % 2 == b % 2:
    print((b-a)
else:
    ans = min(n-b, a-1) + 1 + (b-a-1)
    print(ans)

Problem: p02823
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if (a+b)%2==0:
    print(abs(a-b))
else:
    
    temp=min(b-1,n-a)
    if temp==b-1:
        ans=a-1+(b-a-1)
    else:
        ans=n-b+(b-a-1)
    print(ans)

Failing test case input:
0 2 94

Expected output:
46


Actual output:
92


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if (a+b)%2==0:
    print(abs(a-b)
else:
    
    temp=min(b-1,n-a)
    if temp==b-1:
        ans=(b+a-1)
    else:
        
        ans=(n+1-b+n+1-a-1)
    print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inputLine = input().split(' ')
N = int(inputLine[0])
A = int(inputLine[1])
B = int(inputLine[2])

if abs(A - B) % 2 == 1:
  print(int(min((max(A, B) - 1), (N - (max(A, B))))))
else:
  print(int(abs(A - B) / 2))


Failing test case input:
-4 1 18

Expected output:
-13


Actual output:
-22


Fixed submission (verdict: Accepted):
inputLine = input().split(' ')
N = int(inputLine[0])
A = int(inputLine[1])
B = int(inputLine[2])

if (B - A) % 2 == 1:
  returnNum = int(min((N - B), (A - 1)))
  print(int(returnNum + 1 + (B - A - 1) 
else:
  print(int((B - A)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, a, b = map(int, input().split())
    if abs(a - b) % 2 == 0:
        print(int(abs(a - b) / 2))
    else:
        mi = min(a, b) - 1
        ma = n - max(a, b)
        print(min(mi, ma) + abs(a - b))


if __name__ == '__main__':
    main()

Failing test case input:
1 -1 96

Expected output:
-46


Actual output:
2


Fixed submission (verdict: Accepted):
def main():
    n, a, b = map(int, input().split())
    if abs(a - b) % 2 == 0:
        print(abs(a - b) 
    else:
        mi = min(a, b) - 1
        ma = n - max(a, b)
        print(min(mi, ma) + (abs(a - b) + 1) 


if __name__ == '__main__':
    main()

Problem: p02823
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = list(map(int, input().split()))
N = s[0]
A = s[1]
B = s[2]

if (B - A) % 2 == 0:
  print(int((B-A) / 2))
else:
  print(int(min(A-1,N - B) + B - A))

Failing test case input:
4 -1 62

Expected output:
-26


Actual output:
5


Fixed submission (verdict: Accepted):
s = list(map(int, input().split()))
N = s[0]
A = s[1]
B = s[2]

if (B - A) % 2 == 0:
  print((B - A) 
else:
  print(min(A - 1,N - B) +  1 + (B - A - 1)
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if a % 2 == b % 2:
  print((b - a) / 2)
else:
  distA = a - 1
  distB = n - b
  if distA < distB:
    ans = distA + (b - distA - 1) 
    if b - distA % 2 == 1:
      print(ans)
    else:
      print(ans + 1)
  else:
    ans = distB + (n - (a + distB)) 
    if a + distB % 2 == n % 2:
      print(ans)
    else:
      print(ans + 1)
      


Failing test case input:
-1 0 612

Expected output:
306


Actual output:
306.0


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

if a % 2 == b % 2:
  print((b - a) 
else:
  distA = a - 1
  distB = n - b
  if distA < distB:
    ans = distA + (b - distA - 1) 
    if b - distA % 2 == 1:
      print(ans)
    else:
      print(ans + 1)
  else:
    ans = distB + (n - (a + distB)) 
    if a + distB % 2 == n % 2:
      print(ans)
    else:
      print(ans + 1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int,input().split())
mid = N/2
if (B-A)%2 == 0:
  answer = int((B-A)/2)
else:
  answer = min(int(N-A), int(B-1))

print(answer)

Failing test case input:
0 1 24

Expected output:
-12


Actual output:
-1


Fixed submission (verdict: Accepted):
N, A, B = map(int,input().split())
if (B-A)%2 == 0:
  answer = int((B-A)
else:
  answer = min(A-1, N-B)+1+int((B-A-1)

print(answer)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)
else:
    
    ans = ((b-a)+2-1)
print(ans)


Failing test case input:
0 2 57

Expected output:
-29


Actual output:
56


Fixed submission (verdict: Accepted):
n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)
else:
    ans = min(n-a, b-1)
    ans = min(ans, min(a-1, n-b) + (b-a-1)
    
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print((b-a)/2)
else:
  x=(a+b-1)
  l=[x,n-x]
  print(min(l))

Failing test case input:
0 2 127

Expected output:
-64


Actual output:
-128


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print((b-a)
else:
  x=(a+b-1)
  l=[x,n-x]
  print(min(l))
Problem: p02823
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n, a, b = LI()
    a, b = min(a,b), max(a,b)
    ans = 0
    if (b-a)%2 == 0:
        ans = (b-a)
    else:
        ans = min(b-1, n-a)
    print(ans)
main()


Failing test case input:
6 -1 81

Expected output:
41


Actual output:
82


Fixed submission (verdict: Accepted):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n, a, b = LI()
    a, b = min(a,b), max(a,b)
    ans = 0
    if (b-a)%2 == 0:
        ans = (b-a)
    else:
        ans = min(a+(b-a-1)
    print(ans)
main()

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int(abs(a - b)/2))
elif (b - a) % 2 == 1:

    upfold = a - 1
    downfold = n - b

    print(int(min([upfold, downfold]) + (b - a - 1)/2))

Failing test case input:
-2 5 38

Expected output:
-23


Actual output:
-24


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

if (b - a) % 2 == 0:
    print(int(abs(a - b)
elif (b - a) % 2 == 1:

    print(min([a, n - b + 1]) + (b - a - 1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = (int(i) for i in input().split()) 
dif = abs(a-b)

if dif % 2 == 0:
    print(int(dif/2))
else:
    if 2*n - a -b >= a + b:
        print(int(max(a-1,b-1)))
    else:
        print(int(max(n-a-1,n-b-1)))

Failing test case input:
6 -2 81

Expected output:
-33


Actual output:
7


Fixed submission (verdict: Accepted):
n, a, b = (int(i) for i in input().split()) 
dif = b-a

if dif % 2 == 0:
    print(dif
else:
    if a + b - 2 <= 2*n - a -b:
        print(((a + b - 1)
    else:
        print(((2*n - a - b + 1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def resolve():
    n,a, b = map(int, input().split())
    if (b-a)%2 == 1:
        print(max((a-1),(n-b)))
    else:
        print(int((b-a)/2))

resolve()

Failing test case input:
1 3 38

Expected output:
-19


Actual output:
2


Fixed submission (verdict: Accepted):
def resolve():
    n,a, b = map(int, input().split())
    if (b-a)%2 == 1:
        ans=min(a-1,n-b)+1+(b-a-1)
    else:
        ans=((b-a)

    print(int(ans))


resolve()
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
sa = B - A
if sa % 2 == 0:
  print(int(sa/2))
else:
  print(min(N -A, B -1) -1)

Failing test case input:
-2 1 32

Expected output:
-18


Actual output:
-4


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
sa = B - A
if sa % 2 == 0:
   print(int(sa
else:
   print(int(min(A -1,N -B) + 1 + (B- A)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

n, a, b = [int(i) for i in input().split()]

if a > b:
  a, b = b, a

num_play = (b - a) / 2

if num_play.is_integer():
  print(int(num_play))
else:
  print(b - 1)


Failing test case input:
1 -1 86

Expected output:
-41


Actual output:
85


Fixed submission (verdict: Accepted):
import math

n, a, b = [int(i) for i in input().split()]

if (a + b) % 2 == 0:
  print((b - a) 
else:
  result = min(a - 1, n - b) + 1 + (b - a - 1) 
  print(result)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)
else:
    ans = min(n-a, b-1)
print(ans)


Failing test case input:
7 1 28

Expected output:
-7


Actual output:
6


Fixed submission (verdict: Accepted):
n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)
else:
    ans = min(n-a, b-1)
    ans = min(ans, min(a-1, n-b) + (b-a-1)
    
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)
else:
    
    ans = (b-(a-1))
print(ans)


Failing test case input:
-1 1 32

Expected output:
-17


Actual output:
32


Fixed submission (verdict: Accepted):
n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)
else:
    ans = min(n-a, b-1)
    ans = min(ans, min(a-1, n-b) + (b-a-1)
    
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, A, B = map(int, input().split())

    R = max(A, B)
    L = min(A, B)
    sub = R - L

    left_s = L - 1
    right_s = N - R
    
    
    if sub % 2 == 0:
        return sub / 2
    
    else:
        if left_s < right_s:
            return R - 1
        else:
            return N - L
    
if __name__ == '__main__':
    print(int(main()))

Failing test case input:
-4 1 18

Expected output:
-13


Actual output:
-5


Fixed submission (verdict: Accepted):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
        
    
    if sub % 2 == 0:
        return sub 
    
    else:
        return (min(left_s, right_s) + 1 + ((sub - 1)
    
if __name__ == '__main__':
    print(main())
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
cnt=0
if (b-a)%2 == 0:
  cnt=b-(b+a)/2
  print(cnt)
  exit()
if (b-a)%2 == 1:
    if a-1 >= n-b:
      cnt=n-a
      print(cnt)
      exit()
    if a-1 <= n-b:
      cnt=b-1
      print(cnt)
      exit()

Failing test case input:
0 2 40

Expected output:
19


Actual output:
19.0


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
cnt=0
c=100000000000000000
if (b-a)%2 == 0:
  cnt=b-(b+a)
  print(cnt)
  exit()
if (b-a)%2 == 1:
    cnt=min(a-1,n-b)+1+((b-a-1)
    print(cnt)
    exit()

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
  print(int(b - (a+b)/2))
  print("a")
else:
  if (a - 1) >= (n - b):
    print((n-b) + 1 + int(n - (n+a+(n-b)+1)/2))
  else:
    print((a-1) + 1 + int(b-(a-1)-1 - (b-(a-1)-1 + 1)/2))
    

Failing test case input:
1 -2 96

Expected output:
49


Actual output:
49
a


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

if (b - a) % 2 == 0:
  print(b - (a+b)
else:
  if (a - 1) > (n - b):
    print((n-b) + 1 + (b-a-1)
  else:
    print((a-1) + 1 + (b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = (int(i) for i in input().split()) 
dif = abs(a-b)

if dif % 2 == 0:
    print(int(dif/2))
else:
    if 2*n - a -b >= a + b:
        print(int((a + b-1)/2))
    else:
        print(int((2*n - a -b - 1)/2))

Failing test case input:
-1 5 38

Expected output:
-22


Actual output:
-23


Fixed submission (verdict: Accepted):
n, a, b = (int(i) for i in input().split()) 
dif = b-a

if dif % 2 == 0:
    print(dif
else:
    if a + b - 2 <= 2*n - a -b:
        print(((a + b - 1)
    else:
        print(((2*n - a - b + 1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if abs(A - B) % 2 == 1:
    print(abs(A - B))
else:
    print(min(max(A - 1, B - 1,), max(N - A, N - B)))


Failing test case input:
-1 5 38

Expected output:
-22


Actual output:
33


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

if abs(A - B) % 2 == 0:
    print(abs(A - B) 
else:
    ans = min(A - 1, N - B) + (B - A - 1) 
    print(ans)
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, A: int, B: int):
    from math import ceil
    if (B-A)%2 == 0:
        print(ceil((B-A)/2))
        exit()

    if B < N-A:
        print(N-A)
    else:
        print(B-1)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(N, A, B)

if __name__ == '__main__':
    main()


Failing test case input:
10 4 7

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, A: int, B: int):
    from math import ceil
    if (B-A)%2 == 0:
        print((B-A)
        
    else:
        print(min(A-1, N-B)+1+(B-A-1)


    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(N, A, B)

if __name__ == '__main__':
    main()

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

if abs(A-B)%2==0:
    ans=abs(A-B)
else:
    ans=min(N-A,B-1)

print(ans)



Failing test case input:
11 -2 81

Expected output:
-28


Actual output:
13


Fixed submission (verdict: Accepted):

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

if abs(A-B)%2==0:
    ans=(B-A)
else:
    m1=N-B
    m2=A-1
    
    ans=min(m1+(N-A-m1-1)

print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = list(map(int, input().split()))
sa = b-a
if sa%2==0:
  print(int(sa/2))
else:
  print(int((sa-1)/2)+min(b-1,n-a))

Failing test case input:
0 0 459

Expected output:
-229


Actual output:
229


Fixed submission (verdict: Accepted):
n,a,b = list(map(int, input().split()))
if (b-a)%2==0:
  print(int((b-a)
else:
  print(min(a-1,n-b) + 1 + int((b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int,input().split())
if (B-A)%2 == 0:
  answer = int((B-A)/2)
else:
  answer = int(B-1)
print(answer)

Failing test case input:
1 -2 83

Expected output:
-39


Actual output:
82


Fixed submission (verdict: Accepted):
N, A, B = map(int,input().split())
if (B-A)%2 == 0:
  answer = int((B-A)
else:
  answer = min(A-1, N-B)+1+int((B-A-1)

print(answer)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if (B-A)%2==0:
  ans=(B-A)
else:
  ans=min(B-1,N-A)
print(ans)  

Failing test case input:
0 0 336

Expected output:
168


Actual output:
336


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if (B-A)%2==0:
  ans=(B-A)
else:
  ans=min(A+(B-A-1)
print(ans)
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int, input().split())
if (A-B)%2 ==0:
  print(A/B/2)
else:
  print(min(A-1,N-B)+1+(B-A-1)/2)


Failing test case input:
6 -1 81

Expected output:
41


Actual output:
-0.006172839506172839


Fixed submission (verdict: Accepted):
N,A,B = map(int, input().split())
if (B-A)%2==0:
  print((B-A)
else:
  print(min(A-1,N-B)+1+(B-A-1)

Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, a, b = map(int, input().split())
diff = b - a
print(b-1 if (b-a)%2 else int(diff/2))


Failing test case input:
7 1 28

Expected output:
-7


Actual output:
27


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
if (b-a)%2 == 0 :
    print((b-a)
else :
    print((b-a)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]

if (B - A) % 2 == 0:
  ans = (B + A) / 2
else:
  if (N - A) > (B - 1):
    ans = A - 1
    A = 1
    B = B - ans
    ans = ans + 1
    B = B - 1
    ans = ((B + A) / 2) + ans
  else:
    ans = N - B
    B = N
    A = A + ans
    ans = ans + 1
    A = A + 1
    ans = (B + A) / 2 + ans
  
print(ans)

Failing test case input:
0 1 713

Expected output:
356


Actual output:
357.0


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]

if (B - A) % 2 == 0:
  ans = (B - A) 
else:
  if (N - A) > (B - 1):
    ans = A - 1
    A = 1
    B = B - ans
    ans = ans + 1
    B = B - 1
    ans = ((B - A) 
  else:
    ans = N - B
    B = N
    A = A + ans
    ans = ans + 1
    A = A + 1
    ans = ((B - A) 
  
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())



if (b-a)%2 == 0:
    if b-a > b-1 or b-a > n-a:
        pass
    else:
        print(int((b-a)/2))
        exit(0)
if n-a >= b-1:
    r = n-a-1
    print(r)
else:
    r = b-1
    print(r)


Failing test case input:
1 -8 64

Expected output:
36


Actual output:
63


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

if (b-a)%2 == 0:
    print((b-a)
elif n-a < b-1:
    al = n-b+1
    b = n
    a += al
    r = (b-a)
    print(max(r, 1))
else:
    be = a
    b -= a
    a = 1
    r = (b-a)
    print(max(r, 1))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int,input().split())

if (b-a)%2 == 0:
    print(int((b-a)/2))
else:
    print(min(b-1, n-a))

Failing test case input:
1 0 53

Expected output:
-25


Actual output:
1


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

if (b-a)%2 == 0:
    print((b-a)
else:
    print(min(a-1, n-b) + 1 + (b-a-1)
Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, a, b = map(int,input().split())
if (b-a)%2 == 0:
    print(int((b-a)/2))
else:
    if n-b <= a:
        print(n-a-1)
    else:
        print(b-1)

Failing test case input:
4 -1 62

Expected output:
-26


Actual output:
4


Fixed submission (verdict: Accepted):
n, a, b = map(int,input().split())
if a % 2 == b % 2:
    print((b-a)
else:
    ans = min(n-b, a-1) + 1 + (b-a-1)
    print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
bg = max(a,b)
sm = min(a,b)

if (bg - sm) % 2 == 0:
    ans = (bg - sm) 
else:
    x = bg - 1
    y = n - sm
    ans = min(x,y)
print(ans)


Failing test case input:
11 -2 81

Expected output:
-28


Actual output:
13


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

if (b - a) % 2 == 0:
    ans = (b - a) 
else:
    x = b - 1
    y = n - a
    w = n - b
    z = a - 1
    ans = min((y+w+1)
print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int, input().split())
  
N -= 1
A -= 1
B -= 1

ans = 0
distAB = B - A

if distAB % 2 == 0:
    ans = distAB / 2
else:
    if (N-B) < A:
        ans = (N-B+1) + ((distAB-1)/2)-1
    else:
        ans = A+1 + ((distAB-1)/2)-1

print(int(ans))

Failing test case input:
1 -2 185

Expected output:
-90


Actual output:
-91


Fixed submission (verdict: Accepted):
from decimal import *
N,A,B = map(int, input().split())

N -= 1
A -= 1
B -= 1

ans = 0
distAB = B - A

if distAB % 2 == 0:
    ans = Decimal(distAB) / Decimal(2)
else:
    if (N-B) < A:
        ans = (N-B+1) + (Decimal(distAB-1)/Decimal(2))
    else:
        ans = A+1 + (Decimal(distAB-1)/Decimal(2))

print(int(ans))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=[int(x) for x in input().split()]

if (B-A)%2==0:
    print(int((B-A)/2))

else:
    if B-1 <= N-A:
        print(int(min((B-A-1)/2+A,B-1)))
    if B-1 > N-A:
        print(int(min(N-A, (N-(A+N-(B+1))/2 + N-B+1))))


Failing test case input:
0 2 27

Expected output:
-14


Actual output:
-13


Fixed submission (verdict: Accepted):
N,A,B=[int(x) for x in input().split()]

if (B-A)%2==0:
    print(int((B-A)

else:
    if B-1 <= N-A:
        print(int(min((B-A-1)
    if B-1 > N-A:
        print(int(min(N-A, (N-(A+N-B+1))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
C=B-A
D=min(A-1,N-B)+1 + (B - A - 1)/2
if C%2==1:
    print (D)
else:
    print(C/2)

Failing test case input:
0 2 94

Expected output:
46


Actual output:
46.0


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
C=B-A
D=min(A-1,N-B)+1 + (B - A - 1)
if C%2==1:
    print (D)
else:
    print(C
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if (A+B)%2==0:
	P=B-(A+B)
else:
	P=float("inf")
if (A+B)%2==1:
	Q=A-1
	B-=Q
	Q+=1
	B-=1
	Q+=B-(B+1)
else:
	Q=float("inf")
if (A+B)%2==1:
	R=N-B+1
	B=N
	A-=R
	R+=B-(A+B)
else:
	R=float("inf")
print(min(P,Q,R))

Failing test case input:
1 -2 83

Expected output:
-39


Actual output:
-164


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if (A+B)%2==0:
	P=(B-A)
else:
	P=float("inf")
if (A+B)%2==1:
	Q=A
	Q+=(B-Q-(B-Q+1)
else:
	Q=float("inf")

if (A+B)%2==1:
	R=N-B+1
	B=N
	A+=R
	R+=B-(A+B)
else:
	R=float("inf")
print(min(P,Q,R))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
if (B-A)%2==0:
  print(int((B-A)/2))
elif B-1>=N-A:
  print(N-A)
else:
  print(B-1)

Failing test case input:
0 2 127

Expected output:
-64


Actual output:
-2


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if (B-A)%2==0:
  print((B-A)
elif (B-1)>=(N-A):
  
  
  
  print(((B-A-1)
else:
  
  
  
  print(((B-A-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())
if (B-A)%2==0:
    print(str(int(B-(B+A)/2)))
else:
    if N-A>B-1:
        print(str(int(A+(B-A-1)/2)))
    else:
        print(str(int(B+(B-A-1)/2)))

Failing test case input:
0 2 27

Expected output:
-14


Actual output:
39


Fixed submission (verdict: Accepted):
N,A,B = map(int,input().split())
if (B-A)%2==0:
    print(str(int(B-(B+A)
else:
    if N-B>A-1:
        print(str(int(A+(B-A-1)
    else:
        print(str(int(N-B+1+(B-A-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = list(map(int, input().split()))

if (b-a)%2==0:
    print(int((b-a)/2))
else:
    if b-a==1:
        if a-1 < n-b:
            print(a)
        else:
            print(n-a)
    else:
        if a==1 or b==n:
            print(int((b-a-1)/2+1))
        elif a-1 < n-b:
            
            print(int(a+(b-a-1)/2))
        else:
            print(int(n-b+1+(n-(a+n-b+1))/2))

Failing test case input:
-1 1 10

Expected output:
-6


Actual output:
5


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

if (b-a)%2==0:
    print(int((b-a)
else:
    
    if b-a==1:
        if a-1 < n-b:
            print(a)
        else:
            print(n-a)
    else:
       
        
        if a-1 < n-b:
            
            print(int(a+(b-a-1)
        else:
            print(int(n-b+1+(n-(a+n-b+1))

Problem: p02823
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())

d = b-a
d_nearest_side = min(a-1, n-b)
if d % 2 == 0:
    print(int(d/2))
else:
    move_side = 1 + (d-1)/2 + d_nearest_side
    print(int(move_side-1))

Failing test case input:
1 -2 185

Expected output:
-90


Actual output:
-91


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
d = b-a
d_nearest_side = min(a-1, n-b)
if d % 2 == 0:
    print(d
else:
    move_side = 1 + (d-1)
    print(int(move_side))
Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

dis = B - A
if dis % 2 == 0:
    ans = dis 
else:
    ans = 1 + (B - A + 1) 
print(ans)


Failing test case input:
-2 -2 31

Expected output:
-16


Actual output:
35


Fixed submission (verdict: Accepted):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

dis = B - A
if dis % 2 == 0:
    ans = dis 
else:
    ans = min(A - 1, N - B) + 1 + ((B - A) 

print(ans)

Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,A,B=map(int,input().split())
ans=0
if (B-A)%2==0:
	ans=(B-A)
	print(ans)
else:
	if A <= N-B:
		print(B-1)
	else:
		print(N-A)

Failing test case input:
0 5 459

Expected output:
227


Actual output:
454


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)
else:
    if A<=N-B:
        print(A+(B-A)
    else:
        print(N-B+1+(B-A)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math
N,a, b =list(map(int,input().split(" ")))
case1 = 10 ** 20 
case2 = 10 ** 20 
case3 = 10 ** 20 

if (b - a ) % 2 == 0:
    case3 = (b-a)


step = (a-1)
case1 = step + ( (b - step) - 1)



step = (N - b)
case2 = step+  ( N - (a + step) )



print(min([case1,case2,case3]))

Failing test case input:
-4 1 53

Expected output:
26


Actual output:
-5


Fixed submission (verdict: Accepted):

import math
N,a, b =list(map(int,input().split(" ")))
case1 = 10 ** 20 
case2 = 10 ** 20 
case3 = 10 ** 20 

if (b - a ) % 2 == 0:
    case3 = (b-a)

else:


    step = (a-1)
    
    step = step + 1 
    case1 = step +   (  ((b - step)  - 1 ) 


    
    step = (N - b)
    step = step + 1  

    case2 = step+  (   ( N - (a + step) )



print(min([case1,case2,case3]))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
result = 0
if (b - a)%2 == 1:
    temp1 = b - 1
    temp2 = n - a
    if temp1 < temp2:
        result = temp1
    else:
        result = temp2
else:
    result = (b - a) 
print(result)


Failing test case input:
1 3 38

Expected output:
-19


Actual output:
-2


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
result = 0
if (b - a)%2 == 1:
    temp1 = a - 1
    temp2 = n - b
    work = temp1 if temp1 < temp2 else temp2
    if (b-a)
        result = work
    else:
        result = work + 1 + (b-a-1)
else:
    result = (b - a) 
print(result)
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,A,B = map(int,input().split())
if A%2 == B%2 :
    print(math.ceil(abs(B-A)/2))
 
else:
    k = min(A-1,N-B)
    m = (B-A-1)
    print(k+1+m)

Failing test case input:
-1 4 189

Expected output:
-97


Actual output:
-5


Fixed submission (verdict: Accepted):
import math
N,A,B = map(int,input().split())
if A%2 == B%2 :
    print((B-A)
 
else:
    k = min(A-1,N-B)
    m = (B-A-1)
    print(k+1+m)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int,input().split())

d = b - a
if d == 1:
    ans = max(min(n-a,a-1),min(n-b,b-1))
    print(ans)
else:
    ans = int(d/2)
    print(ans)

Failing test case input:
1 3 8

Expected output:
-4


Actual output:
2


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

d = b - a
if d % 2 == 0:
    print(d
else:
    do = min(a-1,n-b)
    print(do+1+(b-a-1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def min_steps_v2(n, a, b):
    if (b - a) % 2 == 0:
        return int((b - a) / 2)
 
    
    a_diff = a - 1
    b_diff = n - b
 
    if a_diff > b_diff:
      steps_to_even = n - b + 1
      remain_steps = min_steps_v2(n, a + (n - b) + 1, n)
    else:
      steps_to_even = a
      remain_steps = min_steps_v2(n, 1, b - a)
 
    return steps_to_even + remain_steps


Failing test case input:
0 3 27

Expected output:
12


Actual output:

Fixed submission (verdict: Accepted):
import numpy as np

def min_steps_v2(n, a, b):
    n = np.int64(n)
    a = np.int64(a)
    b = np.int64(b)

    if (b - a) % 2 == 0:
        return np.int64(int(b - a) 
 
    
    a_diff = a - 1
    b_diff = n - b
 
    if a_diff > b_diff:
      steps_to_even = n - b + 1
      remain_steps = min_steps_v2(n, a + (n - b) + 1, n)
    else:
      steps_to_even = a
      remain_steps = min_steps_v2(n, 1, b - a)
 
    return steps_to_even + remain_steps

numbers = input().split(' ')
 
n = int(numbers[0])
a = int(numbers[1])
b = int(numbers[2])
 
print(min_steps_v2(n, a, b))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, A, B = list(map(int, input().split()))
    if A in (1, N) or B in (1, N):
        return B - A
    if (A ^ B) & 1:
        return min(B - 1, N - A)
    return (B - A) 

print(main())


Failing test case input:
4 -2 40

Expected output:
21


Actual output:
42


Fixed submission (verdict: Accepted):
def main():
    N, A, B = list(map(int, input().split()))
    if (A ^ B) & 1:
        return min((A - 1) + 1 + (B - A - 1) 
                   (N - B) + 1 + (N - (A + N - B + 1)) 
    return (B - A) 

print(main())
Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, a, b = map(int, input().split())
num = abs(a-b)
if num%2 == 0:
    half = num
    print(half)
else:

    edge = min(N-min(a,b), max(a,b)-1)
    print(edge)


Failing test case input:
1 0 679

Expected output:
-338


Actual output:
1


Fixed submission (verdict: Accepted):
N, a, b = map(int, input().split())
num = b - a
if num%2 == 0:
    half = num
    print(half)
else:
    edge = min(N-a, b-1)
    edge2 = min((b-a-1)
    print(min(edge2, edge))

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

if A-B%2==0:
    ans=abs(A-B)
else:
    ans=max(min(A-1,N-A),min(B-1,N-B))

print(ans)



Failing test case input:
-2 5 38

Expected output:
-23


Actual output:
-7


Fixed submission (verdict: Accepted):

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

if abs(A-B)%2==0:
    ans=(B-A)
else:
    m1=N-B
    m2=A-1
    
    ans=min(m1+(N-A-m1-1)

print(ans)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

if abs(B - A) % 2 == 0:
    print(abs(B - A) / 2)
else:
    print(min(A - 1, N - B) + 1 + (B - A - 1) / 2)


Failing test case input:
6 -2 81

Expected output:
-33


Actual output:
-33.0


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

if abs(B - A) % 2 == 0:
    print(abs(B - A) 
else:
    print(min(A - 1, N - B) + 1 + (B - A - 1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = list(map(int, input().split()))

if (B-A)%2 == 0:
    print(int((B-A)/2))
else:
    n = min(A-1,N-B)
    print(n+(B-A))


Failing test case input:
-2 5 38

Expected output:
-23


Actual output:
-7


Fixed submission (verdict: Accepted):
N,A,B = list(map(int, input().split()))

if (B-A)%2 == 0:
    print(((B-A)
else:
    n = min(A-1,N-B)
    print(n+(B-A+1)

Problem: p02823
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
        
    
    if sub % 2 == 0:
        return sub / 2
    
    else:
        return (min(left_s, right_s) + 1 + ((sub - 1)/2))
    
if __name__ == '__main__':
    print(main())

Failing test case input:
1 -1 86

Expected output:
-41


Actual output:
-41.0


Fixed submission (verdict: Accepted):
def main():
    N, A, B = map(int, input().split())
    
    sub = B - A

    left_s = A - 1
    right_s = N - B
        
    
    if sub % 2 == 0:
        return sub 
    
    else:
        return (min(left_s, right_s) + 1 + ((sub - 1)
    
if __name__ == '__main__':
    print(main())

Problem: p02823
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,A,B=map(int,input().split())
ans=0
if (B-A)%2==0:
	ans=(B-A)
	print(ans)
else:
	if A < N-B:
		print(B-1)
	else:
		print(N-A)

Failing test case input:
1 -2 59

Expected output:
-27


Actual output:
3


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)
else:
    if A<=N-B:
        print(A+(B-A)
    else:
        print(N-B+1+(B-A)