#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair < ll ,ll> pll;
ll n,a,b;
map < pll , ll >vis;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> a >> b;
ll le,ri, ans = 0;
bool all = 0;
for(ll i = 0; i < n; i++){
cin >> le >> ri;
if(ri-le+1==a*b){
all = 1
}
for(ll j = le; j <= ri&&!all; j++){
ll t = j;
ll x = (t+(t/b))%a;
ll y = t%b;
if(!vis[{x,y}]){
ans++;
}
vis[{x,y}]++;
}
}
if(all)ans=a*b;
cout << ans << endl;
}
Compilation message
strange_device.cpp: In function 'int main()':
strange_device.cpp:21:3: error: expected ';' before '}' token
}
^