fork(4) download
  1. # S. Kondrashov
  2. k = int(input())
  3. t = int(input())
  4. if k>1000000000 or t>1000000000:
  5. print("INPUT DATA ERROR")
  6. else:
  7. if t/k%2 != 1: print(t%k)
  8. else: print(k - t%k)
  9.  
Success #stdin #stdout 0.01s 6360KB
stdin
5
8
stdout
2