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,M,V,P = map(int, input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)
count = 0
for i in range (N):
  if i <= P:
    count += 1
  elif A[i] + M < A[P-1]:
    continue
  else:
    sum = M*(P-1) + M*(N-(i+1)) 
    for j in range (P,i-1):
      sum += A[P-1]+M -A[j]
    if sum >= M*V:
      count +=1
print(count)

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

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())
ans = 0

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

print(ans)

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

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

print(ans)

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

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

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 = list(map(int, input().split()))
sa = b-a-1

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

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

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

n,a,b = list(map(int, input().split()))
sa = b-a
if sa%2==0:
  print(int(sa//2))
else:
  print(min(a-1,n-b) + 1 + int((sa-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):
X,A,B = map(int,input().split())
if A+B %2 == 0:
    A_min = A- 1
    B_min = X - B
    AB_div = A - B
    if A_min - B_min < 0:
    	if B_min < AB_div:
    		print(AB_div)
    	else:
    		print(A_div)
    else:
    	if B_min < AB_div:
    		print(AB_div)
    	else:
    		print(B_min)
else:
	A_min = A-1
	B_min = X - B
	if A_min < B_min:
		print(B)
	else:
		print(X-A)

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

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

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 = input()
A = input()
B = input()
if (B-A)%2==1:
  	print(A)
else:
    print((B-A)//2)


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


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

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 math as m

[N, A, B] = [int(x) for x in input().split()]

dif = abs(B-A)
half = N/2
if dif %2==1:
  print(m.ceil(dif/2))
else:
  n = N-B
  if A>= n:
    print(m.ceil(n/2 +A-n+dif))
  else:
    print(m.ceil(n/2+dif))


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

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

mid = b - a

if mid % 2 == 0:
    print(mid // 2)
else:
    print(min(a - 1, n - b) + 1 + (mid - 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 (b-a)%2==0:
  print((b-a)/2)
else:
  l=[n-a,b]
  print(min(l))

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

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

n,a,b=map(int(input()))
if (b-a)%2==0:
  print((b-a)/2)
else:
  l=[n-a,b]
  print(min(l))

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

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

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

Verdicts: Wrong Answer

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

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

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

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

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

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

n,a,b=map(int,input().split())
c=min(a,b)
d=max(a,b)
e=min(2*n-a-b,a+b-2)
f=min(c-1,n-d)
if d-c==1:
  print(f+1)
elif (d-c)%2==0:
  print((d-c)//2)
else:
  print((e+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):
import sys
from collections import defaultdict
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M, V, P = map(int, input().split())

A = list(map(int, input().split()))
A.sort(reverse=True)

NUM = [0] * N
ACN = [0] * N
cnt = 0
mx = A[0]

# cnt and accumulation
for a in A:
    d = mx - a
    cnt += 1
    NUM[d] += 1
    ACN[d] = cnt

# P Number Problem
PROBLEM_P = 0
p = P
for i in range(0, A[0]+1):
    if NUM[i] == 0:
        continue

    p -= NUM[i]

    if p < 0:
        PROBLEM_P = i
        break

    if i == (A[0]+1) and p > 0:
        print(N)
        exit()

#print("NUM", NUM)
#print("PROBLEM_P", PROBLEM_P)

# R Number Problem
R = PROBLEM_P + M

# P-1 Problem
ans = 0
NG_POINT = (P-1) * M
NG_POINT += (N - ACN[R]) * M
MV = M * V


num_p = ACN[PROBLEM_P] - P

print(1)
exit()

for r in range(R, -1, -1):
    need_point = M
    total = (need_point * NUM[r]) + NG_POINT

    for q in range(r-1, PROBLEM_P, -1):
        if NUM[q] == 0:
            continue
        total += NUM[q] * (q - r + M)

    total += num_p * (PROBLEM_P - r + M)

    if total >= MV:
        ans = r
        break
    else:
        NG_POINT += NUM[r] * M

print(ACN[ans])


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

ans = 0

sml = A
big = B

if (A-B) > 0:
    sml = B
    big = A

if (A - B) % 2 == 0:
    ans = (big - sml) // 2
else:
    s = sml - 1
    b = N - big

    if s > b:
        t = (big - sml) + (2*b) + 1
    else:
        t = (big - sml) + (2*s) + 1

    ans = t // 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 sys
input = sys.stdin.readline
N, A, B = map(int, input())

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


import sys
input = sys.stdin.readline
N, A, B = map(int, input().split())

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


import sys
input = sys.stdin.readline
N, A, B = map(int, input().split())

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


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

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

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

N,A,B = [int(x) for x in input().split()];
print(A);
print(B);
print(N);
#lm = int(A + (B-A-1)/2);
lm = A + int((B-A-1)/2);
#print(lm);
#rm = int(N-B+1 + (B-A-1)/2);
rm = N-B+1 + int((B-A-1)/2);
#print(rm);
if (B-A)%2 == 0 :
    print(int((B-A)/2));
else :
    print(min(lm,rm));

N,A,B = [int(x) for x in input().split()];
#print(A);

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

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


import sys
N,A,B = map(int,input().split())
if (A-B) % 2 == 0:
  print((A-B)//2)
  sys.exit(0)
else:
  if A == 1 or B == 1:
    print(B-A)
  else:
    print(B-A+1)

import sys
N,A,B = map(int,input().split())
if (A-B) % 2 == 0:
  print((A-B)//2)
  sys.exit(0)
else:
	print(B-A-1)


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

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):
from decimal import *
def resolve():

    tn,ta, tb = map(int, input().split())
    n=Decimal(tn)
    a=Decimal(ta)
    b=Decimal(tb)
    if (b-a)%2 == 1:
        ans=min(a-1,n-b)+1+(b-a-1)/2
    else:
        ans=(b-a)/2

    print(int(ans))

from decimal import *
def resolve():

    tn,ta, tb = map(int, input().split())
    n=Decimal(tn)
    a=Decimal(ta)
    b=Decimal(tb)
    if (b-a)%2 == 1:
        ans=min(a-1,n-b)+1+(b-a-1)/2
    else:
        ans=(b-a)/2

    print(int(ans))

resolve()

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 a%2==b%2:
  print(b-a//2)
else:
  ans=[]
  ans.append(((b-(a))-1)//2+a)
  ans.append((n-(a+(n-b+1)))//2+(n-b))
  print(min(ans))

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

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

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

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())
a=A
b=B
if (B-A)%2==0:
    ans=int((B-A)/2)
    print("{:20d}".format(ans))
else:
    ans=B-1
    ans=min(ans,N-A)
    ans2=A-1
    A=1
    B=B-(a-1)
    ans2+=1
    B-=1
    ans2+=int((B-A)/2)
    ans=min(ans,ans2)
    A=a
    B=b
    ans2=N-B
    B=N
    A=A+(N-b)
    ans2+=1
    A+=1
    ans2+=int((B-A)/2)
    ans=min(ans,ans2)
    print(int(ans))

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

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 (A - B) % 2 == 0 :
  print (abs(A - B) // 2)
else:
  print(min(max(A, B) - 1, N - min(A, B))

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

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 (abs(a - b) % 2 == 0):
    print((a-b)/2)
else:
    print(min(max(a-1,b-1),max(n-a,n-b)))

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

n, a, b = map(int, input().split())
if (a - 1) >= (n - b):
    count = (n-b)
    a = a + (n - b)
    b = n
else:
    count = (a - 1)
    b = b - (a - 1)
    a = 1

if ((b - a) % 2 == 0):
    print(min(min(b-1,n-a),(b-a)//2))
elif a == 1 and (b - a) % 2 != 0:
    print(min(min(b - 1, n - a), (b - 1 - a) // 2 + 1) + count)
elif b == n and (b - a) % 2 != 0:
    print(min(min(b - 1, n - a), (b - 1 - a) // 2 + 1)+count)
else:
    print(min(b-1,n-a)+count)

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((B-A+1)//2+min(A-1, N-B))

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

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

Verdicts: 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())
print(min(abs(a-b),max(a-1,b-1),max(n-a,n-b)))

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

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

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


Verdicts: 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):
# -*- coding: utf-8 -*-

N, A, B=map(int, input().split())
C=0
if (B-A)%2==0:
    C=(B-A)/2
else:
    if A-1 > N-B:
        C=N-A
    elif A-1 < N-B:
        C=B-1
    else:
        C=B-1

print(C)

# -*- coding: utf-8 -*-

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

if (B-A) % 2 == 0:
    C=(B-A)//2
else:
    if A-1 > N-B:
        C1=N-B
        C2=(N-A-C1) // 2
        C= C1 + C2 + 1
    else:
        C1=A-1
        C2=(B-1-C1) // 2
        C= C1 + C2 + 1

print(C)

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(B - A) % 2 == 0:
    print(abs(B - A))
else:
    print(max(A - 1, N - B) + 1 + (B - A - 1) / 2)


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)


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

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


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)


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

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


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())
if abs(B-A+1)%2 ==0 :
    print(math.ceil(abs(B-A)/2))

elif abs(B-A+1)%2==1:
    if B <= math.ceil(N/2):
        print(B-1)
    elif A >= math.ceil(N/2):
        print(N-A)
    elif B-1 > N - A:
        print(N-A)
    elif N-A > B-1:
        print(B-1)



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


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


# N, A, B = 10 ** 18, 2, 10 ** 18
N, A, B = 100, 5, 12


def main(n, a, b):
    # print(n, a, b)
    distance = b - a

    if distance % 2 == 0:
        return distance // 2
    else:
        if a == n - b + 1:
            return b - 1
        if a < n - b + 1:
            return a - 1 + (b - a) // 2 + 1
        if a > n - b + 1:
            return (n - b) + (b - a) // 2 + 1


print(main(N, A, B))


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


def main(n, a, b):
    distance = b - a

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


print(main(N, A, B))


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):
def agc_041a(input): 
    N,A,B=map(int,input.split())
    a=abs(B-A)/2
    r=max([A,B])-1
    l=N-min([A,B])
    if abs(B-A) % 2 == 0:
        return a
    return min([l,r])
  
  
print(agc_041a(input()))

def main(input): 
    N,A,B=map(int,input.split())
    a=abs(B-A)//2
    if abs(B-A) % 2 == 0:
        return a
    return min([A-1,N-B])+1+a
  
print(main(input()))

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

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

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

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

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(diff//2)
else:
    print(min(a-1,n-b)+1+(b-a-1)//2)


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


Verdicts: Runtime Error

Accepted