CF2009E Klee's SUPER DUPER LARGE Array!!!

题目描述

### 题目大意 你将得到一个长度为 $n$ 的序列 $a=[k,k+1,k+2,\dots, k+n-1]$,请求出 $S$ 的值,其中 $$S=\min\limits_{1\le x\le n}|(\sum\limits_{i=1}^x a_i)-(\sum\limits_{i=x+1}^n a_i)|$$

输入格式

**本题存在多组测试数据**。第一行为一个正整数 $T$($1\le T\le 10^4$),表示数据组数。对于每组数据分别给出用空格隔开的两个整数 $n$ 与 $k$($2\le n,k\le 10^9$)。

输出格式

对于每组数据,输出一行一个整数 $S$。

说明/提示

In the first sample, $ a = [2, 3] $ . When $ i = 1 $ is chosen, $ x = |2-3| = 1 $ . It can be shown this is the minimum possible value of $ x $ . In the third sample, $ a = [3, 4, 5, 6, 7] $ . When $ i = 3 $ is chosen, $ x = |3 + 4 + 5 - 6 - 7| = 1 $ . It can be shown this is the minimum possible value of $ x $ .