#include using namespace std; #define rep(i, a, n) for (int i=(a); i < (n); i++) #define per(i, a, n) for (int i=(n)-1; i >= (a); i--) #define ll long long #define x first #define y second const ll INF = 2e18; typedef pair pt; int n; ll m; ll go(vector> &xo){ ll res = INF; sort(xo.begin(), xo.end()); set active; set xs; //for(auto a : xo) cout << a.x.x << " " << a.x.y << endl; //cout<<"---------"< minY) { active.insert({xo[i].x.y, xo[i].x.x}); xs.insert({xo[i].x.x, xo[i].x.y}); } if(i < n-1 && xo[i+1].x.x == xo[i].x.x){ continue; } //cout << xo[i].y << ": "< (n / 2)){ ll tr =active.begin()->first; //cout<first) == minY){} else break; xs.erase({a->second, a->first}); active.erase(active.begin()); } } if(active.size() == n/2){ //for(auto a : xs) cout << a << " "; cout << endl; ll cur = (((--xs.end())->first) + 1) * (m - active.begin()->first); //ll cur = (xo[i].x.x+1) * (m-yo[yi].x.y); //cout << "yes " << (xo[i].x.x + 1) <<" " << (m - active.begin()->first) << ": " << cur << endl; res = min(res, cur); } } return res; } int main(void) { while(cin>>m>>n){ vector> v(n); rep(i,0,n)cin>>v[i].x.x>>v[i].x.y; //cout<