Language: C++

#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <fstream>

using namespace std;

#define RED_FILE

//#ifdef RED_FILE
ifstream ifs("input.txt");
ofstream ofs("output.txt");
#define cin ifs
#define cout ofs
#endif

struct edge{
	int to,cap,rev;
	int id;
};

const int MAX_V=1000;
const int INF=1000000000;
const int MAX_E=20000;

vector<edge> G[MAX_V];
bool used[MAX_V];
// ûüªÜÁ½©Ç¤©
bool isDirected[2*MAX_E+1];
// »ÌûüªÇ¿ç©
int fromNode[2*MAX_E+1];
// Ü¾¶«Äéü©Ç¤©
bool isUsable[2*MAX_E];
// idxðßé
int lineIdx[501][501];

void add_edge(int from,int to,int cap,int id){
	edge e;
	e.id=id;
	e.to = to;
	e.cap = cap;
	e.rev = G[to].size();
	G[from].push_back(e);
	e.to = from;
	e.cap = 0;
	e.rev = G[from].size()-1;
	G[to].push_back(e);
}

// ÁpXðTõ
int dfs(int v,int t,int f){
	if(v==t)
		return f;
	used[v] = true;
	for(int i=0;i<(int)(G[v].size());i++){
		edge &e=G[v][i];
		if(!used[e.to]&&isUsable[e.id]){
			// Ü¾ûüª¢è
			if(!isDirected[e.id]){
				isDirected[e.id]=true;
				fromNode[e.id]=v;
				if(e.cap==0){
					swap(e.cap,G[e.to][e.rev].cap);
				}
			}
			if(e.cap>0){
				int d = dfs(e.to,t,min(f,e.cap));
				if(d>0){
					e.cap-=d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow = 0;
	while(1){
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(f==0)
			return flow;
		else
			flow+=f;
	}
	return 0;
}

int main(){
	memset(isUsable,0,sizeof(isUsable));
	int n,e,q;
	cin>>n>>e>>q;
	for(int i = 0; i < e; i++){
		int f,t;
		cin>>f>>t;
		// Æè ¦¸ÇÁ
		add_edge(f,t,1,i);
		isUsable[i]=true;
		lineIdx[f][t]=lineIdx[t][f]=i;
	}
	// »ÝÌÅåflowðßé
	int cflow=max_flow(1,n);
	for(int j=0;j<q;j++){
		int m,a,b;
		cin>>m>>a>>b;
		if(m==1){
			add_edge(a,b,1,e);
			lineIdx[a][b]=lineIdx[b][a]=e;
			isUsable[e]=true;
			e++;
			cflow+=max_flow(1,n);
		}
		else{
			// Ú±ªØê½Æ«AØê½êÉt[ª¬êÄ¢é©»¤ÅÈ¢©Åêª¯
			int eidx=lineIdx[a][b];
			// êxà¬êÄ¢È¢
			if(!isDirected[eidx]){
				// Øé¾¯
				//lineIdx[a][b]=lineIdx[b][a]=-1;
				isUsable[eidx]=false;
			}
			else{
				for(int i = 0; i < (int)G[a].size(); i++){
					// ­©
					if(eidx==G[a][i].id){
						if(fromNode[eidx]==a){
							// ûüÍÜÁÄ¢éªAt[ÉÍÖWµÈ¢
							if(G[a][i].cap==1){
								lineIdx[a][b]=lineIdx[b][a]=-1;
								isUsable[eidx]=false;
							}
							// flowª¬êÄ¢éêAg©çtÜÅAt©çfÜÅAf©çsÜÅ»ê¼ê
							// 1Ìflowð¬µÄµß·
							else{
								isUsable[eidx]=false;
								memset(used,0,sizeof(used));
								dfs(n,b,1);
								memset(used,0,sizeof(used));
								dfs(a,1,1);
								cflow--;
								// Øf
								//lineIdx[a][b]=lineIdx[b][a]=-1;
								// ¬¹éÈç¬·
								cflow+=max_flow(1,n);
							}
						}
						else{
							// ûüÍÜÁÄ¢éªAt[ÉÍÖWµÈ¢
							if(G[a][i].cap==0){
								//lineIdx[a][b]=lineIdx[b][a]=-1;
								isUsable[eidx]=false;
							}
							else{
								isUsable[eidx]=false;
								memset(used,0,sizeof(used));
								dfs(n,a,1);
								memset(used,0,sizeof(used));
								dfs(b,1,1);
								cflow--;
								// Øf
								//lineIdx[a][b]=lineIdx[b][a]=-1;
								// ¬¹éÈç¬·
								cflow+=max_flow(1,n);
							}
						}
						break;
					}
				}
			}
		}
		cout<<cflow<<endl;
	}
	return 0;
}

Compiler output:
a.cc:16:2: error: #endif without #if
   16 | #endif
      |  ^~~~~