Problem: 2N players are running a competitive table tennis training on N tables numbered from 1 to N.  The training consists of _rounds_. In each round, the players form N pairs, one pair per table. In each pair, competitors play a match against each other. As a result, one of them wins and the other one loses.  The winner of the match on table X plays on table X-1 in the next round, except for the winner of the match on table 1 who stays at table 1.  Similarly, the loser of the match on table X plays on table X+1 in the next round, except for the loser of the match on table N who stays at table N.  Two friends are playing their first round matches on distinct tables A and B. Let's assume that the friends are strong enough to win or lose any match at will. What is the smallest number of rounds after which the friends can get to play a match against each other?

Submission attempts (in order):
import numpy as np

in_string = input()
in_arr = in_string.split()
N = np.int64(in_arr[0])
A = np.int64(in_arr[1])
B = np.int64(in_arr[2])

if ((A-B) % np.int64(2)) == np.int64(0):
    print(np.int64((B-A)/np.int64(2)))
else:
    if (N-B) > A-np.int64(1):
        print(int(A+((B-A)-1)/2)
    else:
        print(int(N-B+1+(N-(A+N-B+1))/2))


finished = False
solutions = []

def rec(A, B, n):
    global finished
    global solutions

    if (A == B):
        finished = True
        solutions.append(n)

    if not finished:
        if A == 1:
                rec(A+1, B+1, n+1)
                rec(A+1, B-1, n+1)
                rec(A, B+1, n+1)
                rec(A, B-1, n+1)
        elif A == N:
                rec(A, B+1, n+1)
                rec(A, B-1, n+1)
                rec(A-1, B+1, n+1)
                rec(A-1, B-1, n+1)
        elif B == 1:
                rec(A+1, B+1, n+1)
                rec(A+1, B, n+1)
                rec(A-1, B+1, n+1)
                rec(A-1, B, n+1)
        elif B == N:
                rec(A+1, B, n+1)
                rec(A+1, B-1, n+1)
                rec(A-1, B, n+1)
                rec(A-1, B-1, n+1)
        else:
                rec(A+1, B+1, n+1)
                rec(A+1, B-1, n+1)
                rec(A-1, B+1, n+1)
                rec(A-1, B-1, n+1)

while True:
    in_string = input("Input in the Format: N A B, where N stands for the Number of Tables, A for the Position of Player A and B Position of Player B:\n")
    if len(in_string) == 5:
        in_arr = in_string.split()
        global N
        global A
        global B
        N = int(in_arr[0])
        A = int(in_arr[1])
        B = int(in_arr[2])

        if 2 <= N <= pow(10,18) and 1 <= A < B <= N:
            break
        else:
            print("Input Invalid, try again")
    else:
        print("Input Invalid, try again")

rec(A, B, 0)
solutions.sort()
print(solutions[0])

in_string = input()
in_arr = in_string.split()
N = in_arr[0]
A = in_arr[1]
B = in_arr[2]

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

in_string = input()
in_arr = in_string.split()
N = int(in_arr[0])
A = int(in_arr[1])
B = int(in_arr[2])

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted