TnT/Multi_CodeNet4Repair huggingface dataset:
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):
N, a, b = map(int, input().split())
num = abs(a-b)

if num%2 == 0:
    print(num/2)
else:
    print(min(N-min(a,b), max(a,b)-1))

N, a, b = map(int, input().split())
num = abs(a-b)

if num%2 == 0:
    print(num/2)
else:
    print(min(N-min(a,b), max(a,b)-1))

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)/2))
else:
  print(int((b-a-1)/2+1+min(n-b,a-1))

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print((b-a)/2)
elif (n-b)>(a-1):
  print(int((b-a+1)/2+1))
else:
  print(int((b-a-1)/2)+1)

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print((b-a)/2)
elif (n-b)>(a-1):
  print(int((b-a+1)/2+1))
else:
  print(int((b-a-1)/2))

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)//2))

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

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)/2))

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

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)/2))

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

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print((b-a)/2)
elif (n-b)>(a-1):
  print(int((b-a+1)/2+1))
else:
  print(int((b-a)/2+1))

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int(abs(a - b)/2), 'faeag')
elif (b - a) % 2 == 1:
    print(int(min([a, n - b + 1]) + (b - a - 1)//2))


n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int(abs(a - b)//2))
elif (b - a) % 2 == 1:
    print(int(min([a, n - b + 1]) + (b - a - 1)//2))


Verdicts: Wrong Answer

Accepted
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):
n,a,b=map(int,input().split())
if (abs(a-b)%2)==0:
    print((abs(a-b)))
    print(int((abs(a-b))/2))
else:
    if abs(a-1)<abs(n-b):
        dis=abs(a-1)
        b=b-1
        print(int((abs(a-b))/2)+dis+1)
    elif abs(a-1)>=abs(n-b):
        dis=abs(b-n)
        a=a+1
        print(int((abs(a-b))/2)+dis+1)


n,a,b=map(int,input().split())
if ((b-a)%2)==0:
    print(int(((b-a)//2)))
elif ((b-a)%2)==1:
    if (a-1)<(n-b):
        dis=(a-1)
        b=b-1
        print(int(((b-a)//2))+dis+1)
    elif (a-1)>=(n-b):
        dis=(n-b)
        a=a+1
        print(int(((b-a)//2))+dis+1)


Verdicts: Wrong Answer

Accepted
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):
N,a,b=map(int,input().split())

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

N,a,b=map(int,input().split())

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

Verdicts: Wrong Answer

Accepted
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):
N,A,B = map(int, input().split())

if abs(A-B)-1 % 2 == 0:
    A_side = A
    A_right = N-A+1
    B_left = B
    B_right = N-B+1
    
    if A < N/2 and B < N/2:
        print(max(A-1, B-1))
    elif A > N/2 and B > N/2:
        print(max(A_right-1, B_right-1))
    elif A < N/2 and B > N/2:
        print(min(A_right-1, B-1))
    elif B < N/2 and A > N/2:
        print(min(A-1, B_right-1))
    elif A == N/2:
        print(A-1)
    elif B == N/2:
        print(B-1)
        
else:
    if A == B:
        print(0)
    else:
        print(abs(A-B)/2)

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

if (abs(A-B)-1) % 2 == 0:
    A_side = A
    A_right = N-A+1
    B_left = B
    B_right = N-B+1
    M = (N+1)/2
    
    if A <= M and B <= M:
        print(max(A-1, B-1))
    elif A >= M and B >= M:
        print(max(A_right-1, B_right-1))
    elif A <= M and B >= M:
        print(min(A_right-1, B-1))
    elif B <= M and A >= M:
        print(min(A-1, B_right-1))
        
else:
    if A == B:
        print(0)
    else:
        print(int(abs(A-B))/2)



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

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

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

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

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

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

N,A,B = map(int, input().split())
a = A % 2
b = B % 2
ans = 0
if a == b:
    ans = (B-A)//2
else:
    ans = min(A-1, N-B) + 1 + (B-A-1)//2

print(ans)
    

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
N,A,B = map(int, input().split(" "))
distance = abs(B - A)
res=0
if distance % 2 == 0:
  res = distance/2
else:
  a,b = min(A,B), max(A,B)
  res = distance//2 + min(a-1, N-b)+1
print(res)

N,A,B = map(int, input().split(" "))
distance = abs(B - A)
res=0
if distance % 2 == 0:
  res = distance/2
else:
  a,b = min(A,B), max(A,B)
  ans = distance//2 + min(a-1, N-b)+1


N,A,B = map(int, input().split(" "))
distance = abs(B - A)
res=0
if distance % 2 == 0:
  res = distance//2
else:
  res = distance//2 + min(min(A,B)-1, N-max(A,B))+1
print(res)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
n,a,b=map(int,input().split())
if (b-a)%2 == 0:
 print((b-a)/2)
else:
 print(min(b-1,n-a))

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


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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
N, A, B = map(int,input().split())

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

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

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

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

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

Verdicts: Wrong Answer

Runtime Error

Accepted
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):
N, A, B = [int(n) for n in input().split()]
if (B-A)%2==0:
    print((B-A)/2)
else:
    print((B-A-1)/2)


N, A, B = [int(n) for n in input().split()]
if (B-A)%2==0:
    print((B-A)//2)
else:
    print(A+(B-A)//2 if (A-1) < (N-B) else (N-B+1)+(B-A)//2)


Verdicts: Wrong Answer

Accepted
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):
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")
print("なんでA問題から答えがあわないの！！！")

N,A,B = map(int,input().split())
temp = 0
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    a = N - A + 1
    b = N - B + 1
    print(min([B-1,N-A,A + (B-A-1)//2,a + (b-a-1)//2]))

Verdicts: Wrong Answer

Accepted
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):
n, a, b = (int(i) for i in input().split())

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


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

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


Verdicts: Wrong Answer

Accepted
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):
N,A,B = map(int,input().split())

if (abs(A-B)==1):
    return min(A,B)
elif: abs(A-B)==2:
    return abs(A-B)-1

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

matches = 1
for i in range(N):
    if A==B:
        print(matches)
        break
    elif abs(A-B) == 1:
        print(matches)
        break
    else:
        if A == min(A,B):
            A+=1 if A!=1 else 0
            B-=1
            matches +=1
        else:
            B+=1 if B!=1 else 0
            A-=1
            matches +=1

N,A,B = map(int,input().split())
print((A+B)//2)

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

min_num = min(A,B)
max_num = max(A,B)
if max_num >N : print(0)
else:
    matches = 0
    while(True):
        if max_num==min_num:
            print(matches)
            break
        else:
            if max_num - min_num == 1:
                max_num-=1
                min_num-=1 if min_num != 1else 0
                matches+=1
                max_arr.append(max_num)
                min_arr.append(min_num)
            else:
                min_num+=1 if min_num != 1 or max_num > 2 else 0
                max_num-=1
                matches+=1
                max_arr.append(max_num)
                min_arr.append(min_num)

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

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
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):
if (b-a)%2==0:
    print((b-a)//2) 
else:
    m = min(b-1,n-a)
    M = min(a-1,n-b)+(b-a-1)//2
    print(min(m,M))

n,a,b = map(int,input().split())

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

Verdicts: Runtime Error

Accepted
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 math
n,a,b=map(int,input().split())

a_length=a-1
b_length=n-b

if not (b-a)%2:
    print(b-a//2)
elif b_length>=a_length:
    print(min(b-1,a+(b-a-1)//2))
elif b_length<a_length:
    print(min(n-a,n-b+(b-a-1)//2))

n,a,b=map(int,input().split())

a_length=a
b_length=n-b

if not (b-a)%2:
    print(b-a//2)
elif b_length>=a_length:
    print(a+(b-a-1)//2)
elif b_length<a_length:
    print(n-b+(b-a)//2+1)

n,a,b=map(int,input().split())

a_length=a-1
b_length=n-b

if not (b-a)%2:
    print((b-a)//2)
elif b_length>=a_length:
    print(a+(b-a-1)//2)
elif b_length<a_length:
    print(n-b+1+(b-a-1)//2)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
n, a, b = map(int, input().split())

e = (b+a) // 2
even = (b-e) + (e-a)
upper = max(a-1, b-1)
lower = max(n-a, n-b)

print(min([even, lower, upper]))


n, a, b = map(int, input().split())

if 0 == (b-a) % 2:
    print((b-a) // 2)

else:
    upper = max(a-1, b-1)
    lower = max(n-a, n-b)

	print(min(upper, lower))

def upper_cnt(a, b):
    upper_cnt = n-b + 1
    a += upper_cnt
    upper_cnt += ((n-a) // 2)    
    return upper_cnt

def lower_cnt(a, b):
    lower_cnt = a-1 + 1
    b -= lower_cnt
    lower_cnt += ((b-1) // 2)
    return lower_cnt

n, a, b = map(int, input().split())

if 0 == (b-a) % 2:
    print((b-a) // 2)

else:
    up = upper_cnt(a, b)
    low = lower_cnt(a, b)
    print(min(up, low))


Verdicts: Wrong Answer

Runtime Error

Accepted
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):
N,a,b = map(int,input().split())

if (b-a)%2 ==0:
  ams = (b-a)//2
else:
  ans = min(a-1,N-b)+1 + (b-a-1)//2
print(ans)

N,a,b = map(int,input().split())

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

Verdicts: Runtime Error

Accepted
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):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and D => F:
  print(D)
elif D+F > E+G and D <= F:
  print(F)
elif D+F < E+G and E => G:
  print(E)
else:
  print(G)


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)


N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and D => F:
  print(D)
elif D+F > E+G and D <= F:
  print(F)
elif D+F < E+G and E => G:
  pritn(E)
else:
  print(G)


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)


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)


N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and E => G:
  print(E)
elif D+F > E+G and E < G:
  print(G)
elif D+F < E+G and D => F:
  print(D)
else:
  print(F)


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)


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)


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)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
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):
def main2():
    N, A, B = map(int, input().split())

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

if __name__ == "__main__":
    main()

def main3():
    N, A, B = map(int, input().split())
    
    d = B - A
    if d % 2 == 0:
        print(d // 2)
    else:
        print(min(((d + 1) // 2 + N - B ), ((d + 1) // 2 + A - 1)))
         
if __name__ == "__main__":
    main3()

Verdicts: Runtime Error

Accepted
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):
N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

cum_A = [0]
for ai in A:
    cum_A.append(cum_A[-1] + ai)

cur_Ai = A[P]
ans = P
j = P
for i in range(P, N):
    if (i + 1 < N) and (A[i] == A[i + 1]):
        continue

    while A[j] >= A[i] + M:
        j += 1

    if A[i] + M < A[P - 1]:
        break
    elif (
        M * (P - 1)
        + (A[i] + M) * (i + 1 - j)
        - (cum_A[i + 1] - cum_A[j])
        + M * (N - i - 1)
        >= M * V
    ):
        ans = i + 1
    else:
        break

print(ans)


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

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


Verdicts: Runtime Error

Accepted
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

N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
if P == 1:
  Asorted = sorted(A)
else:
  Asorted = sorted(A)[:-(P-1)]

n = len(Asorted)
start=0
end = n
Ap = A[-1]
total = V*M
while start < end -1:
  #print(start, end)
  i = (start+end-1)//2
  Ai = Asorted[i]
  if i == n-1:
    start = n-1
    break
  limit = (Ai + M)*(n-i-1) - sum(Asorted[i+1:]) + (i+P)*M
  if limit >= total:
    end = i+1
  else:
    start = i+1
print(np.sum(np.asarray(A)>=Asorted[start]))

import numpy as np

N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
Asorted = sorted(A)[:-(P-1)]

n = len(Asorted)
start=0
end = n
Ap = A[-1]
total = V*M
while start < end -1:
  #print(start, end)
  i = (start+end-1)//2
  Ai = Asorted[i]
  limit = (Ai + M)*(n-i-1) - sum(Asorted[i+1:]) + (i+P)*M
  if limit >= total:
    end = i+1
  else:
    start = i+1
print(np.sum(np.asarray(A)>=Asorted[start]))

N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
Asorted = sorted(A)

n = len(Asorted)
start=0
end = n-P
Ap = A[-P]
total = V*M
while start < end -1:
  #print(start, end)
  i = (start+end-1)//2
  Ai = Asorted[i]
  if Ai + M < Ap:
    start = i+1
    continue
  limit = (Ai + M)*(n-P-i-1) - sum(Asorted[i+1:n-P]) + (i+P)*M
  if limit >= total:
    end = i+1
  else:
    start = i+1
print(n-start)

import numpy as np

N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
Asorted = sorted(A)[:-(P-1)]

n = len(Asorted)
start=0
end = n
Ap = A[-1]
total = V*M
while start < end -1:
  #print(start, end)
  i = (start+end-1)//2
  Ai = Asorted[i]
  if i == n-1:
    start = n-1
    break
  limit = (Ai + M)*(n-i-1) - sum(Asorted[i+1:]) + (i+P)*M
  if limit >= total:
    end = i+1
  else:
    start = i+1
print(np.sum(np.asarray(A)>=Asorted[start]))

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
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):
 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) + 1 // 2))


if __name__ == '__main__':
    main()

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()

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) + 1) // 2)


if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Wrong Answer

Accepted
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 sys
input = sys.stdin.readline


def main():
    N,A,B = (int(x) for x in input().split())


    def calc(n, a, b, ans):
        if abs(a-b)%2 == 0:
            return ans + (abs(a-b)//2)
        else:
            if min(a,b) - (n - max(a,b)) <= 0:
                a -= 1 if not a==1 else 0
                b -= 1 if not b==1 else 0
            else:
                a += 1 if not a==n else 0
                b += 1 if not b==n else 0
            ans += 1
            return calc(n,a,b,ans)



    
    if abs(A-B)%2 == 0:
        print(abs(a-b)//2)
        quit()
    
    
    
    left = min(A,B) -1
    right = N - max(A,B) - 1
    
    
    if left - right <= 0:
        print(calc(N, 1, B-left, left))
    else:
        print(calc(N, A+right, N, right))

if __name__ == '__main__':
    main()

import sys
input = sys.stdin.readline

def calc(n, a, b, ans, move):
    if (b-a)%2 == 0:
        return ans + (b-a)//2
    else:
        if move == 1:
            a += move
        else:
            b += move
        return calc(n, a, b, ans+1, move)
            
        

def main():
    N,A,B = (int(x) for x in input().split())

    if (B-A)%2 == 0:
        print((B-A)//2)
    else:
        left = A - 1
        right = N - B
        
        if left <= right:
            print(calc(N, 1, B-left, left, -1))
        else:
            print(calc(N, A+right, N, right, 1))        



if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
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):
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)

a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]
ans = 0

print(N,A,B)

if(A == B):
  ans = 0
elif(A > B):
  ooi = A
  sukunai = B
else:
  ooi = B
  sukunai = A

if (ooi - sukunai) % 2 == 0:
  while True:
    ooi = ooi - 1
    sukunai = sukunai + 1
    ans += 1
    if(ooi == sukunai):
      break
else:
  if (N - sukunai) > (ooi - 1):
    ans = ooi - 1
  else:
    ans = N - sukunai
  
print(ans)

a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]
ans = 0

if(A == B):
  ans = 0

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

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)

a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]
ans = 0

print(N,A,B)

if(A == B):
  ans = 0

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

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 = B - 1
  else:
    ans = N - A
  
print(ans)

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)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
n,a,b=map(int,input().split())
ans1=(k-1)//2+1
ans2=min(b-1,n-a)
print(min(ans1,ans2))

n,a,b=map(int,input().split())
k=b-a-1
if k%2!=0:
    ans=(k+1)//2
    print(ans)    
else:
    ans=min(b-1,n-a)
    ans1=min(a-1,n-b)+1+k//2
    print(min(ans,ans1))

Verdicts: Runtime Error

Accepted
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):
    N, A, B = map(int, input().split())
    sa = B - A
    if sa % 2 == 0:
      print(int(sa/2))
    else:
      print(int(min(A -1,N -B) + 1 + (B- A)//2))

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
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):
n,a,b=map(int,input().split())
if (a-b)%2==0:
  ans=(a-b)//2
else:
  ans=min(a-1,b-1,n-a,n-b)+1+(b-a)//2
print(ans)

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

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

n,a,b=map(int,input().split())
if (a-b)%2==0:
  ans=(a-b)//2
else:
  ans=min(max(a-1,b-1),max(n-a,n-b))
print(ans)

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
N, A, B = map(int,input().split())
mid = N/2
if (B-A)%2 == 0:
  answer = -1#int((B-A)/2)
else:
  answer = -1#min(int(N-A), int(B-1))

print(answer)

N, A, B = map(int,input().split())
if (B-A)%2 == 0:
  answer = int(B-A/2)
else:
  answer = min(int((A+B-1)/2), int((2*N-A-B+1)/2))

print(answer)

N, A, B = map(int,input().split())
mid = N/2
if (B-A)%2 == 0:
  answer = -1#int((B-A)/2)
else:
  answer = min(int(N-A), int(B-1))

print(answer)

N, A, B = map(int,input().split())
mid = N/2
if (B-A)%2 == 0:
  answer = 0#int((B-A)/2)
else:
  answer = min(int(N-A), int(B-1))

print(answer)

N, A, B = map(int,input().split())
if (B-A)%2 == 0:
  answer = int((B-A)//2)
else:
  answer = min(int(int(A+B-1)//2), int(int(2*N-A-B+1)//2))

print(answer)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted