-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Minimal_Square.cpp
More file actions
114 lines (108 loc) · 2.3 KB
/
A_Minimal_Square.cpp
File metadata and controls
114 lines (108 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//https://codeforces.com/problemset/problem/1353/F
#include <iostream>
#include <cmath>
#include <algorithm>
#include <limits>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <time.h>
using namespace std;
#define MOD 1000000007LL
#define LL long long
#define ULL unsigned long long
#define LD long double
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define si(n) scanf("%d", &n)
#define sf(n) scanf("%f", &n)
#define sl(n) scanf("%lld", &n)
#define slu(n) scanf("%llu", &n)
#define sd(n) scanf("%lf", &n)
#define ss(n) scanf("%s", n)
#define pnl printf("\n")
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, n) for (int i = (n); i >= 0; i--)
#define DB(x) cout << "\n" \
<< #x << " = " << (x) << "\n";
#define CL(a, b) memset(a, b, sizeof(a))
#define GOLD ((1 + sqrt(5)) / 2)
const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230;
void swaps(char *x, char *y)
{
char temp;
temp = *x;
*x = *y;
*y = temp;
}
void swapi(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
ULL gcd(ULL a, ULL b)
{
if (a == 0)
return b;
if (b == 0)
return a;
if (a == 1 || b == 1)
return 1;
if (a == b)
return a;
if (a > b)
return gcd(b, a % b);
else
return gcd(a, b % a);
}
#define SIZE 1000001
void preprocess()
{
} //end prepreprocess
void refresh()
{
} //end refresh
void compute()
{
int a, b;
scanf("%d %d", &a, &b);
if (a > b)
{
if (2 * b >= a)
printf("%d\n", 4 * b * b);
else
printf("%d\n", a * a);
}
else
{
if (2 * a >= b)
printf("%d\n", 4 * a * a);
else
printf("%d\n", b * b);
}
} //end compute
int main()
{
#ifdef debug
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("log.txt", "w", stderr);
#endif
int t, i, j;
preprocess();
scanf("%d", &t);
while (t--)
{
compute();
} //end while
#ifdef debug
fprintf(stdout, "\nTIME: %.3lf sec\n", (double)clock() / (CLOCKS_PER_SEC));
#endif
return 0;
} //end main*