#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, int N){
long long mn = 0, mx = 1e18;
set<long long> st;
long long pre = -1, prepre = 1e18 + 1;
vector<long long> a;
while(mn != -1){
MinMax(pre + 1, prepre - 1, &mn, &mx);
if(mn == -1) break;
if(mn == mx){
a.push_back(mn);
break;
}else{
a.push_back(mn);
a.push_back(mx);
pre = mn, prepre = mx;
}
if(a.size() == N) break;
}
sort(a.begin(), a.end());
// for(auto i : a) cerr << i << ' ';
// cerr << endl;
long long res = 0;
for(int i = 1; i < N; i++){
if(res < a[i] - a[i - 1]){
res = a[i] - a[i - 1];
}
}
return res;
}