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




a = A - 1
b = N - B
if a == b:
    print(a)
else:
    ans = (a if a < b else b) + 1
    print(ans)


N, A, B = [int(i) for i in input().split()]
a = A - 1
b = N - B
diff = abs(A - B)
if diff == 0:
    print(a)
else:
    print(a, b, diff)
    if diff == 2:
        print(1)
    else:
        if a < b:
            print(B - 1)
        else:
            print(N - A)




def is_even(num):
    return num % 2 == 0


N, A, B = [int(i) for i in input().split()]
#  N, A, B = [5, 2, 4]
#  N, A, B = [5, 2, 3]
#  N, A, B = [10, 2, 3]
#  N, A, B = [10, 7, 8]
#  N, A, B = [5, 2, 5]
#  N, A, B = [10, 2, 8]
#  N, A, B = [2, 1, 2]
#  N, A, B = [2, 1, 1]
is_even_a = is_even(A)
is_even_b = is_even(B)
if (is_even_a == True and is_even_b == True) or (
    is_even_a == False and is_even_b == False
):
    print((B - A) // 2)
else:
    print(min(A - 1, N - B) + 1 + ((B - A - 1) // 2))


Verdicts: Wrong Answer

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):
S = list(input())
s = len(S)
K = int(input())
A = []
j = 1

for i in range(0,s-1,1):
  if S[i] == S[i+1]:
    j += 1
  else:
    A.append(j)
    j = 1
A.append(j)

a = len(A)

b = 0
for i in range(a):
  b += i//2
  
x = b*K

if S[s-1] == S[0] and A[a-1] % 2 == 1 and A[1] % 2 == 1:
  x += K-1
  
print(x)

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

print(n, a, b)

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


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

if (b-a)%2 == 0:
    print((b-a)//2)
elif n-a < b-1:
    al = n-b+1
    b = n
    a += al
    r = (b-a)//2+al
    print(max(r, 1))
else:
    be = a
    b -= a
    a = 1
    r = (b-a)//2+be
    print(max(r, 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())
check=(b-a)%2
if check==0:
  ans=(b-a)/2
  print(ans)
else:
  ans=min(n-b,a-1)+1+(b-a-1)//2
  print(ans)

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


import math
N,a,b=(int(x) for x in input().split())
if abs(a-b)%2==0:
    print(abs(a-b)//2)
else:
    c1=a-1+1+(b-a)//2
    c2=N-b+1+(b-a)//2
    print(min(c1,c2))


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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n,a,b = map(int, input().split())
k = abs(a - b)
if k % 2 == 1:
    count = 0
    if n - b > a - 1:
        count += a - 1 + 1 + ((k - 1) // 2)
    else:
        count += n - b + 1 + ((k - 1) // 2)
    print(int(count))
else:
    print(k // 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):
def solve(N, A, B):
    return int(min(A - 1, N - B) + 1 + (B - A - 1)//2)

if __name__ == "__main__":
    n, a, b = map(int, input().split())
    print(int(solve(n, a, b)))


def solve(N, A, B):
    if A % 2 == B % 2:
        return (B - A) / 2
    return min(A - 1, N - B) + 1 + (B - A - 1)//2

if __name__ == "__main__":
    n, a, b = map(int, input().split())
    print(solve(n, a, b))


def solve(N, A, B):
    if A % 2 == B % 2:
        return (B - A) // 2
    return min(A-1, N-B) + 1 + (B - A -1)//2

if __name__ == "__main__":
    n, a, b = map(int, input().split())
    print(solve(n, a, b))


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

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

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

if a % 2 == b % 2:
  print((b - a) // 2)
else:
  print(min(a + (b - a - 1) // 2, n - b + 1 + (n - (a + (n - b + 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, "10 2 9".split())
aa = a - (a - 1)
bb = b - a
aaa = a + (n - b) + 1
bbb = n
result = []
if (a + b)%2 == 0:
    result.append(int(abs(((a+b)/2) - a)))
result += list(map(int, (b - 1, n - a, int(abs(((aa+bb)/2) - aa)) + a, int(abs(((aaa+bbb)/2) - aaa) + n - b + 1))))

print(min(result))


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


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

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

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


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

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


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

dist = b-a

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

#coding:utf-8
n, a, b = map(int, input().split())

dist = b-a

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

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

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

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

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

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

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

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

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

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


x,y,z = map(int, input().split())
if (z+y)%2==1:
	print(min(max(y,z)-1, max(x-y,x-z))
else:
	print((abs(y-z)+1)//2)


x,y,z = map(int, input().split())
if (z+y)%2==1:
        d = min(y + z - 2, 2*x-y-z)+1
        print(d//2)
else:
	print((abs(y-z)+1)//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):
#include <bits/stdc++.h>
using namespace std;

int main (){
  int n,a,b,ans;
  cin >> n >> a >> b;
  if ((b-a)% == 0){
    ans=(b-a)/2;
  }
  else{
    if(n-b > a-1){
      ans=a-1+1;
      b-=ans;
      a=1;
      ans+=(b-a)/2;
    }
    else{
      ans=n-b+1;
      a+=ans;
      b=n;
      ans+=(b-a)/2;
    }
  }
  cout << ans << endl;
}


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

if (B-A)%2==0:
    ans =(B-A)//2
else:
    ans = min(A-1,N-B) + (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())
S = B-A
C = 0
 
if S % 2 ==0:
  C = S / 2
else:
  D = min(N-A,B-1)
  if A-1 <= N-B:
    E = A + S//2
  else:
    E = N-B+1 + S//2
  C = min(D,E)
 
print(int(C-1))

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

if S % 2 ==0:
  C = S / 2
else:
  D = min(N-A,B-1)
  if A-1 <= N-B:
    E = A + S//2
  else:
    E = N-B+1 + S//2
  C = min(D,E)

print(int(C-2))

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

if S % 2 ==0:
  C = S / 2
else:
  D = min(N-A,B-1)
  if A-1 <= N-B:
    E = A + S//2
  else:
    E = N-B+1 + S//2
  C = min(D,E)

print(int(C+1))

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

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):
import sys
def input():
    return sys.stdin.readline()[:-1]
N,A,B=map(int,input().split())
if (B-A)%2==0:5 2 
    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((B+A-1)//2,((2*N-B+1-A)//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):
S = input().split(" ")
N = S[0]
A = S[1]
B = S[2]
C = B - A
if C % 2 == 0:
	print(C // 2)
	exit()
print(min(B - 1,N - A))

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

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

ans = 0
distAB = B - A

if distAB % 2 == 0:
    ans = distAB / 0

print(int(ans))


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

ans = 0
distAB = B - A

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

print(int(ans))


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

ans = 0
distAB = B - A

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

print(int(ans))

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

ans = 0
distAB = B - A

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

print(int(ans))

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

ans = 0
distAB = B - A

if distAB % 2 != 0:
    ans = distAB / 0

print(int(ans))


from decimal import *
N,A,B = map(int, input().split())

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

ans = 0
distAB = B - A

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

print(int(ans))

Verdicts: Runtime Error

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

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

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

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

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

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

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

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

if A < B:
    tmp = A
    A = B
    B = tmp

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

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

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

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,m,v,p = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
p-=1

a.sort(reverse=True)

ans=0
s = sum(a)

def safe(index):
    if a[p]>a[index]+m:
        return False
    i=0
    wall = -1
    while a[i]>=a[index]+m:
        if a[i]>=a[index]+m+1:
            wall = i
        i+=1
    if i>index:
        return True
    intg = 0
    while i<index:
        intg += a[index] + m - a[i]
        i+=1
    intg += (len(a)-1-index)*m + min(v,p - wall + 1)*m
    #print("intg = ",intg ,m*(v-1) )
    return intg >= m*(v-1)

left = 0
right = len(a)-1
ans = int((right - left)/2)
if safe(right):
    ans = right
else:
    j = safe(ans)
    while not(j and not safe(ans+1)):
        if j:
            left = ans
        else:
            right = ans
        ans = left + int((right - left)/2)
        j = safe(ans)
print(ans+1)


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

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

n, a, b = map(int, input().split())
if (b-a)%2 != 0:
    if a-1 <= n-b:
        ans = (b - a -1)//2 + 1 + a-1
    else:
        ans = (b - a - 1)//2 + 1 + n-b
else:
    ans = min((b - a) // 2, b-1, n-a)
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):
N, M, V, P = map(int, input().split())
pre = list(map(int, input().split()))
li = sorted(pre)
total = M * V
tf = False
for i in range(N):
	if li[i] + M >= li[-P]:
		tmp = i+1 + P - 1
		nokori = total - (M * tmp)
		count = i + 1
		while count <= N - P:
			if nokori <= 0:
				ans = N-i
				tf = True
				break	
			sa = (li[i]+M) - li[count]
			if sa <= 1:
				count += 1
				continue
			nokori -= sa-1
			count += 1
		if tf == True:
			break
print(ans)



N, A, B = map(int, input().split())
ans = 0
if (B - A) % 2 == 0:
	ans = (B - A) // 2
else:
	if N - A >= B - 1:
		dis = A - 1 + 1
		ans = dis + ((B-dis) - 1) //2
		
		
	else:
		
		dis = N - B + 1
		ans = dis + (N - (A+dis)) //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):
inputLine = input().split(' ')
N = int(inputLine[0])
A = int(inputLine[1])
B = int(inputLine[2])

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

inputLine = input().split(' ')
N = int(inputLine[0])
A = int(inputLine[1])
B = int(inputLine[2])

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

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

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

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

n, a, b = map(int, sys.stdin.readline().split())

def main():
    d = b - a
    if d % 2 == 0:
        return d // 2
    else:
        return min(n - b, abs(1 - a)) + 1 + (d - 1) // 2)

if __name__ == '__main__':
    ans = main()
    print(ans)

import sys

n, a, b = map(int, sys.stdin.readline().split())

def main():
    d = b - a
    if d % 2 == 0:
        return d // 2
    else:
        return min(n - b, abs(1 - a)) + 1 + (d - 1) // 2

if __name__ == '__main__':
    ans = main()
    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):
def main():
    n = 10**18
    a = 10**18
    b = 10**18
    print(n, a, b)
    n, a, b = map(int, input().split())

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

    else:
        print((b-a)//2)


if __name__ == '__main__':
    main()


def main():
    n = 10**18
    a = 10**18
    b = 10**18
    n, a, b = map(int, input().split())

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


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

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

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

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

Verdicts: Wrong Answer

Accepted