#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "gap.h"
long long findGap(int t, int n)
{
if(t == 1){
vector<ll> a(n);
ll st = 0;
ll en = 1e18;
ll l = 0;
ll r = n-1;
while(l <= r){
MinMax(st,en,&a[l],&a[r]);
st = a[l]+1;
en = a[r]-1;
l ++, r --;
}
ll ans = 0;
for(int i=1;i<n;i++) ans = max(ans , a[i] - a[i-1]);
return ans;
}
else {
ll l,r;
MinMax(0,1e18,&l,&r);
ll b_sz = (r - l - 1) / (n - 1);
ll mod = (r - l - 1) % (n - 1);
vector<ll> pos;
pos.push_back(l);
cout<<b_sz<<endl;
for(int i=0;i<n-1-mod;i++){
ll a,b;
MinMax((l+1)+i*b_sz,(l+1)+(i+1)*b_sz-1,&a,&b);
if(a != -1){
pos.push_back(a);
pos.push_back(b);
}
}
b_sz ++;
for(int i=n-1-mod;i<n-1;i++){
ll a,b;
MinMax((l+1)+i*b_sz,(l+1)+(i+1)*b_sz-1,&a,&b);
if(a != -1){
pos.push_back(a);
pos.push_back(b);
}
}
pos.push_back(r);
int sz = pos.size();
ll ans = 0;
for(int i=1;i<sz;i++) ans = max(ans , pos[i] - pos[i-1]);
}
return ans;
}