Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
const int MAXN = 1e5 + 5; 
int N,M,a[MAXN],b[MAXN],p[MAXN]; 
int pa[MAX_N]; 
int getf(int x) { while (x != pa[x]) x = pa[x] = pa[pa[x]]; return x; } 
vector<int> G[MAX_N]; 
long long f[MAX_N], sum[MAX_N];
bool vis[MAX_N]; 
int main () { 
	N = gi(), M = gi();
	for (int i = 1; i <= N; i++) { 
		a[i] = gi(), b[i] = gi(); 
		a[i] = max(a[i] - b[i], 0);
		p[i] = i, pa[i] = i; 
	} 
	sort(&p[1], &p[N + 1], [](const int &l, const int &r) { return a[l] < a[r]; } ); 
	for (int i = 1; i <= M; i++) { 
		int u = gi(), v = gi(); 
		G[u].push_back(v), G[v].push_back(u); 
	} 
	for (int i = 1; i <= N; i++) { 
		vector<int> son;
		int x = p[i]; 
		vis[x] = 1, sum[x] = b[x]; 
		for (auto v : G[x]) {
			if (!vis[v] || getf(x) == getf(v)) continue; 
			son.push_back(getf(v)); 
			sum[x] += sum[getf(v)]; 
			pa[getf(v)] = x; 
		} 
		f[x] = sum[x] + a[x]; 
		for (auto v : son) f[x] = min(f[x], sum[x] - sum[v] + max(1ll * a[x], f[v])); 
	} 
	printf("%lld\n", f[p[N]]); 
    return 0; 
} 

Compiler output:
a.cc:64:8: error: 'MAX_N' was not declared in this scope; did you mean 'MAXN'?
   64 | int pa[MAX_N];
      |        ^~~~~
      |        MAXN
a.cc: In function 'int getf(int)':
a.cc:65:31: error: 'pa' was not declared in this scope; did you mean 'pi'?
   65 | int getf(int x) { while (x != pa[x]) x = pa[x] = pa[pa[x]]; return x; }
      |                               ^~
      |                               pi
a.cc: At global scope:
a.cc:66:15: error: 'MAX_N' was not declared in this scope; did you mean 'MAXN'?
   66 | vector<int> G[MAX_N];
      |               ^~~~~
      |               MAXN
a.cc:67:13: error: 'MAX_N' was not declared in this scope; did you mean 'MAXN'?
   67 | long long f[MAX_N], sum[MAX_N];
      |             ^~~~~
      |             MAXN
a.cc:67:25: error: 'MAX_N' was not declared in this scope; did you mean 'MAXN'?
   67 | long long f[MAX_N], sum[MAX_N];
      |                         ^~~~~
      |                         MAXN
a.cc:68:10: error: 'MAX_N' was not declared in this scope; did you mean 'MAXN'?
   68 | bool vis[MAX_N];
      |          ^~~~~
      |          MAXN
a.cc: In function 'int main()':
a.cc:70:13: error: 'gi' was not declared in this scope; did you mean 'pi'?
   70 |         N = gi(), M = gi();
      |             ^~
      |             pi
a.cc:74:27: error: 'pa' was not declared in this scope; did you mean 'pi'?
   74 |                 p[i] = i, pa[i] = i;
      |                           ^~
      |                           pi
a.cc:79:17: error: 'G' was not declared in this scope
   79 |                 G[u].push_back(v), G[v].push_back(u);
      |                 ^
a.cc:79:32: error: 'v' was not declared in this scope
   79 |                 G[u].push_back(v), G[v].push_back(u);
      |                                ^
a.cc:84:17: error: 'vis' was not declared in this scope
   84 |                 vis[x] = 1, sum[x] = b[x];
      |                 ^~~
a.cc:84:29: error: 'sum' was not declared in this scope
   84 |                 vis[x] = 1, sum[x] = b[x];
      |                             ^~~
a.cc:85:31: error: 'G' was not declared in this scope
   85 |                 for (auto v : G[x]) {
      |                               ^
a.cc:89:25: error: 'pa' was not declared in this scope; did you mean 'pi'?
   89 |                         pa[getf(v)] = x;
      |                         ^~
      |                         pi
a.cc:91:17: error: 'f' was not declared in this scope
   91 |                 f[x] = sum[x] + a[x];
      |                 ^
a.cc:94:26: error: 'f' was not declared in this scope
   94 |         printf("%lld\n", f[p[N]]);
      |                          ^