From be6678fbca007e73d69c9a9c5cddb8241a987149 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Mon, 15 Jul 2019 19:58:48 +0700 Subject: So I gave up on a number theory one --- codechef/mmax.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 codechef/mmax.py (limited to 'codechef/mmax.py') diff --git a/codechef/mmax.py b/codechef/mmax.py new file mode 100755 index 0000000..e62fc7d --- /dev/null +++ b/codechef/mmax.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 +for _ in range(int(input())): + n = int(input()) + k = int(input()) + m = k % n + print(min(m * 2, (n - m) * 2, n - 1)) -- cgit 1.4.1