Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

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

struct flow{
	vector<edge> G[1002];
	bool used[1002];
	void add_edge(int from,int to,int cap){
		edge a = {to,cap,G[to].size()};
		edge b = {from,0,G[from].size()};
		G[from].push_back(a);
		G[to].push_back(b);
	}
	int dfs(int v,int t,int f){
		if(v == t)return f;
		used[v] = true;
		for(int i = 0 ; i < G[v].size() ; i ++){
			edge &e = G[v][i];
			if(!used[e.to] && 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;
			flow += f;
		}
	}
	void init(){
		rep(i,1002)G[i].clear();
	}
}F;

int flag[1002];
void dfs(int v){
	if(flag[v] == 1)return;
	flag[v] = 1;
	rep(i,F.G[v].size()){
		edge ed = F.G[v][i];
		if(ed.cap > 0)dfs(ed.to);
	}
}
void dfs_rev(int v){
	if(flag[v] == -1)return;
	flag[v] = -1;
	rep(i,F.G[v].size()){
		edge ed = F.G[v][i];
		if(ed.cap == 0)dfs_rev(ed.to);
	}
}

int main(){
	while(1){
		int n,m,s,t;
		cin >> n >> m >> s >> t;
		if(n == 0)return 0;
		int a[10002],b[10002];
		rep(i,m){
			scanf("%d%d",&a[i],&b[i]);
		}
		
		F.init();
		rep(i,m){
			F.add_edge(a[i],b[i],1);
		}
		int ret = F.max_flow(s,t);
		rep1(i,n)flag[i] = 0;
		dfs(s);
		dfs_rev(t);
		int cnt = 0;
		rep(i,m){
			if(flag[a[i]] == -1 && flag[b[i]] == 1)cnt ++;
		}
		printf("%d %d\n",ret+(cnt==0?0:1),cnt);
	}
}

Compiler output:
a.cc: In member function 'void flow::add_edge(int, int, int)':
a.cc:47:44: warning: narrowing conversion of '((flow*)this)->flow::G[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   47 |                 edge a = {to,cap,G[to].size()};
      |                                  ~~~~~~~~~~^~
a.cc:48:46: warning: narrowing conversion of '((flow*)this)->flow::G[from].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   48 |                 edge b = {from,0,G[from].size()};
      |                                  ~~~~~~~~~~~~^~
a.cc: In member function 'int flow::max_flow(int, int)':
a.cc:71:25: error: 'memset' was not declared in this scope
   71 |                         memset(used,0,sizeof(used));
      |                         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include<cmath>
  +++ |+#include <cstring>
   11 | using namespace std;