#include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int Q;cin>>Q; for(;Q--;) { int D,K; cin>>D>>K; vector >X; for(int x=0;x<=D;x++) { int y=D-x; X.push_back(make_pair(x,y)); X.push_back(make_pair(x,-y)); X.push_back(make_pair(-x,y)); X.push_back(make_pair(-x,-y)); } sort(X.begin(),X.end()); X.erase(unique(X.begin(),X.end()),X.end()); vector > >A(X.size()); for(int i=0;i