Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
#define lson root<<1
#define rson root<<1|1
#define Mid (l+r>>1)
struct Seg_Tree{
	int Min,lazy;
}tree[MAXN<<2];
int N,Q,cnt,ans;
int a[MAXN],sum1[MAXN],sum0[MAXN];
vector < int > S[MAXN]; 
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}
inline void push_down(Int root){
	tree[lson].lazy+=tree[root].lazy,
	tree[rson].lazy+=tree[root].lazy,
	tree[lson].Min+=tree[root].lazy,
	tree[rson].Min+=tree[root].lazy,
	tree[root].lazy=0;
}
inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
	if(l==Pos && r==Pos){
		tree[root].Min=min(tree[root].Min,k);
		return ;
	}if(tree[root].lazy) push_down(root);
	if(Pos<=Mid) Insert(lson,l,Mid,Pos,k);
	else Insert(rson,Mid+1,r,Pos,k);
	tree[root].Min=min(tree[lson].Min,tree[rson].Min);
}
inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
	if(l>=L && r<=R){
		tree[root].lazy+=k,tree[root].Min+=k;
		return ;
	}if(tree[root].lazy) push_down(root);
	if(R<=Mid) Update(lson,l,Mid,L,R,k);
	else if(L>Mid) Update(rson,Mid+1,r,L,R,k);
	else Update(lson,l,Mid,L,R,k),Update(rson,Mid+1,r,L,R,k);
	tree[root].Min=min(tree[lson].Min,tree[rson].Min);
}
inline int Query(Int root,Int l,Int r,Int L,Int R){
	if(l>=L && r<=R) return tree[root].Min;
	if(tree[root].lazy) push_down(root);
	if(R<=Mid) return Query(lson,l,Mid,L,R);
	else if(L>Mid) return Query(rson,Mid+1,r,L,R);
	else return min(Query(lson,l,Mid,L,R),Query(rson,Mid+1,r,L,R));
}
int main(){
	N=read();for(register int i=1;i<=N;i++) 
	    a[i]=read(),sum1[i]=sum1[i-1]+(a[i]==1),sum0[i]=sum0[i-1]+(a[i]==0);
	Q=read();for(register int i=1;i<=Q;i++){
		int x=read(),y=read();
		S[x].push_back(y); 
	}for(register int i=0;i<500005;++i) tree[i].Min=1e9;
	Insert(1,0,N,0,0);
	for(register int i=1;i<=N;i++){
		for(register int j=0;j<S[i].size();j++) Insert(1,0,N,S[i][j],Query(1,0,N,0,S[i][j]));
		Update(1,0,N,0,i-1,a[i]?1:-1);
	}printf("%d",Query(1,0,N,0,N)+sum0[N]);
	return 0;
}

Compiler output:
a.cc:19:13: error: variable or field 'push_down' declared void
   19 | inline void push_down(Int root){
      |             ^~~~~~~~~
a.cc:19:23: error: 'Int' was not declared in this scope; did you mean 'int'?
   19 | inline void push_down(Int root){
      |                       ^~~
      |                       int
a.cc:26:13: error: variable or field 'Insert' declared void
   26 | inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
      |             ^~~~~~
a.cc:26:20: error: 'Int' was not declared in this scope; did you mean 'int'?
   26 | inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
      |                    ^~~
      |                    int
a.cc:26:29: error: 'Int' was not declared in this scope; did you mean 'int'?
   26 | inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
      |                             ^~~
      |                             int
a.cc:26:35: error: 'Int' was not declared in this scope; did you mean 'int'?
   26 | inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
      |                                   ^~~
      |                                   int
a.cc:26:41: error: 'Int' was not declared in this scope; did you mean 'int'?
   26 | inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
      |                                         ^~~
      |                                         int
a.cc:26:49: error: 'Int' was not declared in this scope; did you mean 'int'?
   26 | inline void Insert(Int root,Int l,Int r,Int Pos,Int k){
      |                                                 ^~~
      |                                                 int
a.cc:35:13: error: variable or field 'Update' declared void
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |             ^~~~~~
a.cc:35:20: error: 'Int' was not declared in this scope; did you mean 'int'?
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |                    ^~~
      |                    int
a.cc:35:29: error: 'Int' was not declared in this scope; did you mean 'int'?
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |                             ^~~
      |                             int
a.cc:35:35: error: 'Int' was not declared in this scope; did you mean 'int'?
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |                                   ^~~
      |                                   int
a.cc:35:41: error: 'Int' was not declared in this scope; did you mean 'int'?
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |                                         ^~~
      |                                         int
a.cc:35:47: error: 'Int' was not declared in this scope; did you mean 'int'?
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |                                               ^~~
      |                                               int
a.cc:35:53: error: 'Int' was not declared in this scope; did you mean 'int'?
   35 | inline void Update(Int root,Int l,Int r,Int L,Int R,Int k){
      |                                                     ^~~
      |                                                     int
a.cc:45:18: error: 'Int' was not declared in this scope; did you mean 'int'?
   45 | inline int Query(Int root,Int l,Int r,Int L,Int R){
      |                  ^~~
      |                  int
a.cc:45:27: error: 'Int' was not declared in this scope; did you mean 'int'?
   45 | inline int Query(Int root,Int l,Int r,Int L,Int R){
      |                           ^~~
      |                           int
a.cc:45:33: error: 'Int' was not declared in this scope; did you mean 'int'?
   45 | inline int Query(Int root,Int l,Int r,Int L,Int R){
      |                                 ^~~
      |                                 int
a.cc:45:39: error: 'Int' was not declared in this scope; did you mean 'int'?
   45 | inline int Query(Int root,Int l,Int r,Int L,Int R){
      |                                       ^~~
      |                                       int
a.cc:45:45: error: 'Int' was not declared in this scope; did you mean 'int'?
   45 | inline int Query(Int root,Int l,Int r,Int L,Int R){
      |                                             ^~~
      |                                             int
a.cc:45:50: error: expression list treated as compound expression in initializer [-fpermissive]
   45 | inline int Query(Int root,Int l,Int r,Int L,Int R){
      |                                                  ^
a.cc: In function 'int main()':
a.cc:53:35: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   53 |         N=read();for(register int i=1;i<=N;i++)
      |                                   ^
a.cc:55:35: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   55 |         Q=read();for(register int i=1;i<=Q;i++){
      |                                   ^
a.cc:58:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   58 |         }for(register int i=0;i<500005;++i) tree[i].Min=1e9;
      |                           ^
a.cc:59:9: error: 'Insert' was not declared in this scope; did you mean 'assert'?
   59 |         Insert(1,0,N,0,0);
      |         ^~~~~~
      |         assert
a.cc:60:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   60 |         for(register int i=1;i<=N;i++){
      |                          ^
a.cc:61:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   61 |                 for(register int j=0;j<S[i].size();j++) Insert(1,0,N,S[i][j],Query(1,0,N,0,S[i][j]));
      |                                  ^
a.cc:61:83: error: 'Query' cannot be used as a function
   61 |                 for(register int j=0;j<S[i].size();j++) Insert(1,0,N,S[i][j],Query(1,0,N,0,S[i][j]));
      |                                                                              ~~~~~^~~~~~~~~~~~~~~~~
a.cc:62:17: error: 'Update' was not declared in this scope
   62 |                 Update(1,0,N,0,i-1,a[i]?1:-1);
      |                 ^~~~~~
a.cc:63:27: error: 'Query' cannot be used as a function
   63 |         }printf("%d",Query(1,0,N,0,N)+sum0[N]);
      |                      ~~~~~^~~~~~~~~~~