#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int _t; cin>>_t; rep(_,_t){ long long D,K; cin>>D>>K; vector> ps; for(int i=-D;i<=D;i++){ long long x = i; long long y = D - abs(i); ps.emplace_back(x,y); if(y!=0){ ps.emplace_back(x,-y); } } sort(ps.begin(),ps.end(),[&](pair x,pair y){ return x.first*x.first+x.second*x.second < y.first*y.first + y.second*y.second; }); if(ps.size()