regions.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
regions.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
^
regions.java:5: error: class, interface, or enum expected
using ll = long long;
^
regions.java:6: error: class, interface, or enum expected
using db = long double;
^
regions.java:7: error: class, interface, or enum expected
using str = string;
^
regions.java:9: error: class, interface, or enum expected
using pi = pair<int, int>;
^
regions.java:10: error: class, interface, or enum expected
using pl = pair<ll, ll>;
^
regions.java:11: error: class, interface, or enum expected
using pd = pair<db, db>;
^
regions.java:13: error: class, interface, or enum expected
using vi = vector<int>;
^
regions.java:14: error: class, interface, or enum expected
using vb = vector<bool>;
^
regions.java:15: error: class, interface, or enum expected
using vl = vector<ll>;
^
regions.java:16: error: class, interface, or enum expected
using vd = vector<db>;
^
regions.java:17: error: class, interface, or enum expected
using vs = vector<str>;
^
regions.java:18: error: class, interface, or enum expected
using vpi = vector<pi>;
^
regions.java:19: error: class, interface, or enum expected
using vpl = vector<pl>;
^
regions.java:20: error: class, interface, or enum expected
using vpd = vector<pd>;
^
regions.java:22: error: illegal character: '#'
#define mp make_pair
^
regions.java:22: error: class, interface, or enum expected
#define mp make_pair
^
regions.java:23: error: illegal character: '#'
#define f first
^
regions.java:24: error: illegal character: '#'
#define s second
^
regions.java:26: error: illegal character: '#'
#define sz(x) (int)(x).size()
^
regions.java:27: error: illegal character: '#'
#define bg(x) begin(x)
^
regions.java:28: error: illegal character: '#'
#define all(x) bg(x), end(x)
^
regions.java:29: error: illegal character: '#'
#define sor(x) sort(all(x))
^
regions.java:30: error: illegal character: '#'
#define ft front()
^
regions.java:31: error: illegal character: '#'
#define bk back()
^
regions.java:32: error: illegal character: '#'
#define pb push_back
^
regions.java:33: error: illegal character: '#'
#define pf push_front
^
regions.java:35: error: illegal character: '#'
#define lb lower_bound
^
regions.java:36: error: illegal character: '#'
#define ub upper_bound
^
regions.java:38: error: illegal character: '#'
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
^
regions.java:38: error: class, interface, or enum expected
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
^
regions.java:38: error: class, interface, or enum expected
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
^
regions.java:39: error: illegal character: '#'
#define F0R(i, a) FOR(i, 0, a)
^
regions.java:40: error: illegal character: '#'
#define ROF(i, a, b) for (int i = (b) - 1; i >= (a); i--)
^
regions.java:40: error: class, interface, or enum expected
#define ROF(i, a, b) for (int i = (b) - 1; i >= (a); i--)
^
regions.java:40: error: class, interface, or enum expected
#define ROF(i, a, b) for (int i = (b) - 1; i >= (a); i--)
^
regions.java:41: error: illegal character: '#'
#define R0F(i, a) ROF(i, 0, a)
^
regions.java:42: error: illegal character: '#'
#define EACH(a, x) for (auto& a : x)
^
regions.java:45: error: class, interface, or enum expected
const int MXN = 2e5 + 10;
^
regions.java:46: error: class, interface, or enum expected
const int MXR = 25010;
^
regions.java:47: error: class, interface, or enum expected
const ll INF = 1e18;
^
regions.java:49: error: class, interface, or enum expected
const int BLOCK = 450;
^
regions.java:51: error: class, interface, or enum expected
int N, R, Q; vi adj[MXN]; int L[MXN]; // L[i] = Region of i
^
regions.java:51: error: class, interface, or enum expected
int N, R, Q; vi adj[MXN]; int L[MXN]; // L[i] = Region of i
^
regions.java:51: error: class, interface, or enum expected
int N, R, Q; vi adj[MXN]; int L[MXN]; // L[i] = Region of i
^
regions.java:53: error: class, interface, or enum expected
int timer = 1, in[MXN], out[MXN]; vi S[MXR]; // Sorted list of {in, out} for each region
^
regions.java:53: error: class, interface, or enum expected
int timer = 1, in[MXN], out[MXN]; vi S[MXR]; // Sorted list of {in, out} for each region
^
regions.java:55: error: class, interface, or enum expected
vi large; int up[BLOCK][MXR], down[BLOCK][MXR];
^
regions.java:55: error: class, interface, or enum expected
vi large; int up[BLOCK][MXR], down[BLOCK][MXR];
^
regions.java:57: error: class, interface, or enum expected
int ind[MXN];
^
regions.java:61: error: class, interface, or enum expected
void DFS(int X, int P) {
^
regions.java:62: error: class, interface, or enum expected
in[X] = timer++; S[L[X]].pb(X);
^
regions.java:64: error: class, interface, or enum expected
EACH(Y, adj[X]) if (Y != P) DFS(Y, X); out[X] = timer - 1;
^
regions.java:64: error: class, interface, or enum expected
EACH(Y, adj[X]) if (Y != P) DFS(Y, X); out[X] = timer - 1;
^
regions.java:65: error: class, interface, or enum expected
}
^
regions.java:66: error: class, interface, or enum expected
bool isAnc(int A, int B) { return in[A] <= in[B] && out[B] <= out[A]; }
^
regions.java:71: error: class, interface, or enum expected
int ans = 0; int L = 0, R = 0; int last = 0; deque<int> anc;
^
regions.java:71: error: class, interface, or enum expected
int ans = 0; int L = 0, R = 0; int last = 0; deque<int> anc;
^
regions.java:71: error: class, interface, or enum expected
int ans = 0; int L = 0, R = 0; int last = 0; deque<int> anc;
^
regions.java:73: error: class, interface, or enum expected
while (L < sz(S[A]) || R < sz(S[B])) {
^
regions.java:75: error: class, interface, or enum expected
while (sz(anc) && !isAnc(anc.bk, S[A][L])) anc.pop_back(); anc.pb(S[A][L++]);
^
regions.java:76: error: class, interface, or enum expected
}
^
regions.java:77: error: class, interface, or enum expected
else { while (sz(anc) && !isAnc(anc.bk, S[B][R])) anc.pop_back(); ans += sz(anc); R++; }
^
regions.java:77: error: class, interface, or enum expected
else { while (sz(anc) && !isAnc(anc.bk, S[B][R])) anc.pop_back(); ans += sz(anc); R++; }
^
regions.java:77: error: class, interface, or enum expected
else { while (sz(anc) && !isAnc(anc.bk, S[B][R])) anc.pop_back(); ans += sz(anc); R++; }
^
regions.java:80: error: class, interface, or enum expected
}
^
regions.java:83: error: class, interface, or enum expected
ios_base::sync_with_stdio(false); cin.tie(0);
^
regions.java:85: error: class, interface, or enum expected
cin >> N >> R >> Q >> L[1];
^
regions.java:87: error: class, interface, or enum expected
FOR(i, 2, N + 1) { int A; cin >> A >> L[i]; adj[A].pb(i), adj[i].pb(A); }
^
regions.java:87: error: class, interface, or enum expected
FOR(i, 2, N + 1) { int A; cin >> A >> L[i]; adj[A].pb(i), adj[i].pb(A); }
^
regions.java:87: error: class, interface, or enum expected
FOR(i, 2, N + 1) { int A; cin >> A >> L[i]; adj[A].pb(i), adj[i].pb(A); }
^
regions.java:87: error: class, interface, or enum expected
FOR(i, 2, N + 1) { int A; cin >> A >> L[i]; adj[A].pb(i), adj[i].pb(A); }
^
regions.java:91: error: class, interface, or enum expected
int cur = 0; FOR(i, 1, R + 1) if (sz(S[i]) >= BLOCK) large.pb(i), ind[i] = cur++;
^
regions.java:91: error: class, interface, or enum expected
int cur = 0; FOR(i, 1, R + 1) if (sz(S[i]) >= BLOCK) large.pb(i), ind[i] = cur++;
^
regions.java:93: error: class, interface, or enum expected
F0R(i, sz(large)) {
^
regions.java:96: error: class, interface, or enum expected
down[i][j] = genAns(j, large[i]);
^
regions.java:97: error: class, interface, or enum expected
}
^
regions.java:100: error: class, interface, or enum expected
int A, B; cin >> A>> B;
^
regions.java:102: error: class, interface, or enum expected
if (sz(S[A]) >= BLOCK) cout << up[ind[A]][B] << "\n";
^
regions.java:104: error: class, interface, or enum expected
else if (sz(S[B]) >= BLOCK) cout << down[ind[B]][A] << "\n";
^
regions.java:106: error: class, interface, or enum expected
else cout << genAns(A, B) << "\n";
^
regions.java:107: error: class, interface, or enum expected
}
^
83 errors