#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #ifdef local #include "debug_print.hpp" #else #define dump(...) void(0); #endif #include #include namespace man { constexpr inline bool scope(const int l, const int x, const int r) noexcept { return l <= x && x <= r; } inline int64_t solve() noexcept { using namespace std::views; int64_t d, x, y; std::cin >> d >> x >> y; const auto dist = x * x + y * y; const int nx = x - y, ny = y + x; const int mx = x + y, my = y - x; return (scope(0, nx, d) && scope(0, ny, d)) || (scope(0, mx, d) && scope(0, my, d)) ? dist : 0; } } int main() { std::cin.tie(nullptr) -> sync_with_stdio(false); int t; std::cin >> t; for([[maybe_unused]] const auto _: std::views::iota(0, t)) { std::cout << man::solve() << '\n'; } }