Language: C++

#include <bits/stdc++.h>
#define uint unsigned lor lor
#define ll lor lor
#define db lor double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi totor<int>
#define vl totor<ll>
#define rep(i, x, y) for(register int i = x; i <= y; i ++)
#define rrep(i, x, y) for(register int i = x; i >= y; i --)
#define eps 1e-15
#define lb(x) x & -x
#define sz(x) (x).size()
usir namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
ll f(ll A, ll B) 
{
    ll lim = A*B;
    ll l = 0, r = B;
    while (r - l > 1) 
    {
        ll mid = (l + r) / 2;
        bool f = true;
        if (mid * (A + 1) >= lim)f = false;
        ll x = (A + mid + 1) / 2;
        for (ll xx = x - 2; xx < x + 3; ++xx) {
            if (xx >= 1 && xx <= mid) {
                ll y = xx * (A + 1 + mid - xx);
                if (y >= lim)f = false;
            }
        }
        (f ? l : r) = mid;
    }
    return l;
}
 
int main() 
{
    int Q = read();
    while (Q --) 
    {
        ll A, B;
        A = read1();
        B = read1();
        ll bb = f(A, B);
        ll aa = f(B, A);
        ll ans = aa + bb;
        ll x = B - bb - 1, y = A - aa - 1;
        ans += max(0ll, min(x, y));
        cout << ans << endl;
    }
}


Compiler output:
a.cc:20:1: error: 'usir' does not name a type
   20 | usir namespace std;
      | ^~~~
a.cc:3:12: error: 'lor' does not name a type
    3 | #define ll lor lor
      |            ^~~
a.cc:28:8: note: in expansion of macro 'll'
   28 | inline ll read1()
      |        ^~
a.cc:3:12: error: 'lor' does not name a type
    3 | #define ll lor lor
      |            ^~~
a.cc:35:1: note: in expansion of macro 'll'
   35 | ll f(ll A, ll B)
      | ^~
a.cc: In function 'int main()':
a.cc:3:12: error: 'lor' was not declared in this scope; did you mean 'log'?
    3 | #define ll lor lor
      |            ^~~
a.cc:61:9: note: in expansion of macro 'll'
   61 |         ll A, B;
      |         ^~
a.cc:62:9: error: 'A' was not declared in this scope
   62 |         A = read1();
      |         ^
a.cc:62:13: error: 'read1' was not declared in this scope; did you mean 'read'?
   62 |         A = read1();
      |             ^~~~~
      |             read
a.cc:63:9: error: 'B' was not declared in this scope
   63 |         B = read1();
      |         ^
a.cc:3:16: error: expected ';' before 'lor'
    3 | #define ll lor lor
      |                ^~~
a.cc:64:9: note: in expansion of macro 'll'
   64 |         ll bb = f(A, B);
      |         ^~
a.cc:3:16: error: expected ';' before 'lor'
    3 | #define ll lor lor
      |                ^~~
a.cc:65:9: note: in expansion of macro 'll'
   65 |         ll aa = f(B, A);
      |         ^~
a.cc:3:16: error: expected ';' before 'lor'
    3 | #define ll lor lor
      |                ^~~
a.cc:66:9: note: in expansion of macro 'll'
   66 |         ll ans = aa + bb;
      |         ^~
a.cc:3:16: error: expected ';' before 'lor'
    3 | #define ll lor lor
      |                ^~~
a.cc:67:9: note: in expansion of macro 'll'
   67 |         ll x = B - bb - 1, y = A - aa - 1;
      |         ^~
a.cc:68:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |         ans += max(0ll, min(x, y));
      |         ^~~
      |         abs
a.cc:68:29: error: 'x' was not declared in this scope
   68 |         ans += max(0ll, min(x, y));
      |                             ^
a.cc:68:32: error: 'y' was not declared in this scope
   68 |         ans += max(0ll, min(x, y));
      |                                ^
a.cc:68:25: error: 'min' was not declared in this scope; did you mean 'std::min'?
   68 |         ans += max(0ll, min(x, y));
      |                         ^~~
      |                         std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:68:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   68 |         ans += max(0ll, min(x, y));
      |                ^~~
      |                std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:69:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   69 |         cout << ans << endl;
      |         ^~~~
      |         std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:69:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   69 |         cout << ans << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~