about summary refs log tree commit diff
path: root/codechef/mmax.py
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-07-15 19:58:48 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-07-15 19:58:48 +0700
commitbe6678fbca007e73d69c9a9c5cddb8241a987149 (patch)
treee00165734b3b3ab2ca8d47e32ef5d7868b4804c3 /codechef/mmax.py
parent6c0ea3cc3364733e8d8fe7625b128f817d55b2cd (diff)
downloadcp-be6678fbca007e73d69c9a9c5cddb8241a987149.tar.gz
So I gave up on a number theory one
Diffstat (limited to 'codechef/mmax.py')
-rwxr-xr-xcodechef/mmax.py6
1 files changed, 6 insertions, 0 deletions
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))