/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 324.0 KiB

Code

                            /*in the name of almighty ALLAH*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define endl '\n'
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
#define MOD2 987654319
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define sz(x) (int)x.size()

template <typename T> using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using multi_pbds = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

//***********************************START*******************************************//

void solve()
{
    int x, y; cin >> x >> y;
    if(x == 1 || y == 1) cout << "-1\n";
    else {
        if(x != 2 && y != 2) cout << "2\n";
        else if(x != 3 && y != 3) cout << "3\n";
        else cout << "5\n";
    }

}

//***********************************END*********************************************//
int32_t main(){ fast

    int32_t t = 1, i;
      cin >> t;
    for(i = 1; i <= t; i++)
    {
       // cout << "Case " << i << ": ";
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1235 A. Valid Integer
Contest
Happy New Year 2026
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 14:42:28
Judged At
2026-01-06 14:42:29
Judged By
Score
100
Total Time
1ms
Peak Memory
532.0 KiB