• + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    def pageCount(n, p): return min(p//2,n//2-p//2)

    if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input().strip())
    
    p = int(input().strip())
    
    result = pageCount(n, p)
    
    fptr.write(str(result) + '\n')
    
    fptr.close()