HTML & JS
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int a,b;
        
        cin>>a>>b;
        
        int x=min(a,b);
        int y=max(a,b);
        //making a smaller side 
        a=x;
        //making b bigger one
        b=y;
        //If b<2a, then we have to make both sides of square 2a
        //Which will create square just big enough to fit both sides
        if(b<2*a)cout<<4*a*a<<"\n";
        //If b>2a, then we have to make both sides of square b
         //Which will create square just big enough to fit both sides
        else cout<<b*b<<"\n";
    }
}

Generated URL:

Output:

16
16
4
9
64
9
64
40000
Report Bug