#include <bits/stdc++.h>   using namespace std;   const long long int MAX = 1000000007;   const long long int MAXN = 100010;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t;     cin >> t;     while (t--) {       long long int n, k;       cin >> n >> k;       if (n % 2 == 0 && k % 2 == 1)         cout <<  NO  << endl;       else if (n % 2 == 1 && k % 2 == 0)         cout <<  NO  << endl;       else {         if (k * k <= n)           cout <<  YES  << endl;         else           cout <<  NO  << endl;       }     }     return 0;   }   