#include "Alice.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function
// Alice() to function Bob() through these variables. you had better not use the same global variables in function
// Alice() and in function Bob().
vector<pair<int, int>> Alice()
{
int n = 50;
long long x = setN(n);
vector<pair<int, int>> ans;
for (long long i = 2; i <= n; i++)
{
ans.push_back({x % i + 1, i});
}
return ans;
}
#include "Bob.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function
// Alice() to function Bob() through these variables. you had better not use the same global variables in function
// Alice() and in function Bob().
long long Bob(std::vector<std::pair<int, int>> V)
{
long long ans = 0, period = 1;
for (int i = 0; i < V.size(); ++i)
{
long long dv = V[i].second, rem = V[i].first - 1;
while (ans % dv != rem)
{
ans += period;
}
period *= dv / __gcd(dv, period);
}
return ans;
}