Language: C++

#include<iostream>
#include<algorithm>
#include<tuple>
#include<set>
#include<vector>
#include<algorithm>
#include<bitset>

using namespace std;

const int H=4096;
const int W=4096;
//bitset<W> on[H];
bitset<W> hl[H];
bitset<W> vl[H];
bool on[H][W];
// bool hl[H][W];
// bool vl[H][W];
// //set<tuple<short,short> > hl,vl;
// bool g[H][W];

int main(){
cin.sync_with_s
  for(int m;cin>>m,m;){
    int x[123],y[123];
    for(int i=0;i<m;i++){
      cin>>x[i]>>y[i];
      x[i]+=2001;
      y[i]+=2001;
    }
    x[m]=x[0];
    y[m]=y[0];
    fill(*begin(on),*end(on),false);
    // fill(*begin(g),*end(g),false);
    // fill(*begin(vl),*end(vl),false);
    // fill(*begin(hl),*end(hl),false);
    for(int i=0;i<H;i++){
      //      on[i].reset();
      vl[i].reset();
      hl[i].reset();
    }
    for(int i=0;i<m;i++){
      if(x[i]==x[i+1]){
	for(int j=min(y[i],y[i+1]);j<max(y[i],y[i+1]);j++){
	  //	  cout<<j<<' '<<x[i]-1<<' '<<x[i]<<endl;
	  //	  vl.insert(make_tuple(j,x[i]-1));
	  vl[j][x[i]-1]=true;
	}
      }else if(y[i]==y[i+1]){
	for(int j=min(x[i],x[i+1]);j<max(x[i],x[i+1]);j++){
	  //	  cout<<j<<' '<<y[i]-1<<' '<<y[i]<<endl;
	  //	  hl.insert(make_tuple(j,y[i]-1));
	  hl[j][y[i]-1]=true;
	}
      }else{
	int x1=x[i],y1=y[i],x2=x[i+1],y2=y[i+1];
	if(x1>x2){
	  swap(x1,x2);
	  swap(y1,y2);
	}
	//	cerr<<x1<<' '<<y1<<' '<<x2<<' '<<y2<<endl;
	for(int j=0;j<x2-x1;j++){
	  double dsy=y1+(y2-y1)*1./(x2-x1)*j;
	  double dty=y1+(y2-y1)*1./(x2-x1)*(j+1);
	  int sy,ty;
	  if(abs(dsy-int(dsy+.5))<1e-9){
	    sy=dsy+.5;
	  }else{
	    if(y1<y2){
	      sy=dsy;
	    }else{
	      sy=dsy+1;
	    }
	  }
	  if(abs(dty-int(dty+.5))<1e-9){
	    ty=dty+.5;
	  }else{
	    if(y1<y2){
	      ty=dty+1;
	    }else{
	      ty=dty;
	    }
	  }
	  for(int k=sy;k!=ty;k+=(sy<ty)-(sy>ty)){
	    //	    cout<<k<<' '<<x1+j<<endl;
	    on[k-(sy>ty)][x1+j]=true;
	  }
	}
      }
    }
    vector<pair<short,short> > v;
    v.reserve(H*W*2/3);
    v.emplace_back(0,0);
    on[0][0]=true;
    int ans=H*W-1;
    while(!v.empty()){
      auto c=v.back();
      v.pop_back();
      int cy=c.first;
      int cx=c.second;
      for(int i=0;i<4;i++){
	static int dy[]={-1,0,1,0};
	static int dx[]={0,1,0,-1};
	int ny=cy+dy[i];
	int nx=cx+dx[i];
	bool f=false;
	if(0<=ny&&ny<H&&0<=nx&&nx<W&&!on[ny][nx]){
	  if(i%2){
	    //	    if(!vl.count(make_tuple(cy,min(cx,nx)))){
	    if(!vl[cy][min(cx,nx)]){
	      f=true;
	    }
	  }else{
	    //	    if(!hl.count(make_tuple(cx,min(cy,ny)))){
	    if(!hl[cx][min(cy,ny)]){
	      f=true;
	    }
	  }
	}
	if(f){
	  on[ny][nx]=true;
	  v.emplace_back(ny,nx);
	  ans--;
	}
      }
    }
    cout<<ans<<endl;
  }
}

	  

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'std::istream' {aka 'class std::basic_istream<char>'} has no member named 'sync_with_s'; did you mean 'sync_with_stdio'?
   23 | cin.sync_with_s
      |     ^~~~~~~~~~~
      |     sync_with_stdio
a.cc:24:18: error: 'm' was not declared in this scope; did you mean 'tm'?
   24 |   for(int m;cin>>m,m;){
      |                  ^
      |                  tm
a.cc:24:22: error: expected primary-expression before ')' token
   24 |   for(int m;cin>>m,m;){
      |                      ^