criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
using int=long long;
#define fi first
#define se second
struct edge{int to,rev;};
using Graph=vector<vector<edge>>;
#define pb push_back
#define INF 100000000

void add_edge(int from,int to,Graph &graph)
{
    graph[from].pb((edge){to,(int)graph[to].size()});
    graph[to].pb((edge){from,(int)graph[from].size()-1});
}

void bfs(int s,Graph graph,vector<int> a)
{
    int n=graph.size();
    vector<int> d(n,INF);
    d[s]=0;
    queue<int> que;
    que.push(s);
    vector<bool> visit(n,false);
    visit[s]=true;
    vector<vector<int>> lis(n);
    lis[s].pb(a[s]);
    vector<int> ans(n);
    ans[s]=1;
    int v;
    while (!que.empty())
    {
        v=que.front();
        que.pop();
        for (int i=0;i<graph[v].size();i++)
        {
            edge &e=graph[v][i];
            if (!visit[e.to] && d[e.to]>d[v]+1)
            {
                d[e.to]=d[v]+1;
                visit[e.to]=true;
                prev[e.to]=v;
                lis[e.to]=lis[v];
                auto itr=lower_bound(lis[e.to].begin(),lis[e.to].end(),a[e.to]);
                if (itr==lis[e.to].end())
                {
                    ans[e.to]=ans[v]+1;
                    lis[e.to].pb(a[e.to]);
                }
                else 
                {
                    ans[e.to]=ans[v];
                    *itr=a[e.to];
                }
                que.push(e.to);
            }
        }
    }
    for (int i=0;i<n;i++) cout << ans[i] << endl;
    return ;
}

int main()
{
    int N;cin >> N;
    vector<int> a(N);
    for (int i=0;i<N;i++)
    {
        cin >> a[i];
    }
    Graph graph(N,vector<edge> ());
    int u,v;
    for (int i=0;i<N-1;i++)
    {
        cin >> u>>v;
        u--;v--;
        add_edge(u,v,graph);
    }
    bfs(0,graph,a);
    return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'int'
    3 | using int=long long;
      |       ^~~
a.cc: In function 'void bfs(int, Graph, std::vector<int>)':
a.cc:42:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   42 |                 prev[e.to]=v;
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int ans[223456],dp[223456],v[223456],n,INF=1e9+1,nowans;
vector<int>edge[223456];

void dfs(int parent,int idx){
  int l=0,r=n+1;
  while(r-l>1){
    int mid=(l+r)>>1;
    (dp[mid]<v[idx]?l:r)=mid;
  }
  int preidx=r,prevalue=dp[r];
  dp[r]=v[idx];
  chmax(nowans,r);
  ans[idx]=now;
  for(int q:edge[idx])if(q!=parent)dfs(idx,q);
  dp[preidx]=prevalue;
  while(dp[nowans]==INF)nowans--;
}

int main(){
  for(int i=1;i<223456;i++)dp[i]=INF;
  cin>>n;
  for(int i=0;i<n;i++)cin>>v[i];
  for(int i=1;i<n;i++){
    int a,b;cin>>a>>b;a--;b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  dfs(-1,0);
  for(int i=0;i<n;i++)cout<<ans[i]<<endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:15:3: error: 'chmax' was not declared in this scope
   15 |   chmax(nowans,r);
      |   ^~~~~
a.cc:16:12: error: 'now' was not declared in this scope; did you mean 'pow'?
   16 |   ans[idx]=now;
      |            ^~~
      |            pow
Language: C

#include <bits/stdc++.h>
#define INF 0x7f7f7f7f
using namespace std;
const int N = 2e5 + 5;
vector<int> G[N] = {};
int val[N] = {};
int n;
stack<int> ls[N];
int ans[N] = {};
bool ha[N] = {};
int t = 0;
int bs(int x) {
    int l = 1, r = t, mid;
    while (l <= r) {
        mid = (l + r) >> 1;
        if (ls[mid].top() < x)
            l = mid + 1;
        else r = mid - 1;
    }
    return l;
}
void dfs(int u, int f) {
    int idx = bs(val[u]);
    if (val[u] < ls[idx].top()) {
        ha[u] = true;
        ls[idx].emplace(val[u]);
        t = max(idx, t);
    }
    ans[u] = t;
    for (const int &v : G[u])
        if (v != f) dfs(v, u);
    if (ha[u]) {
        ls[idx].pop();
        if (ls[idx].top() == INF)
            t--;
    }
}
int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> val[i];
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    ls[0].emplace(0);
    for (int i = 1; i <= n; i++)
        ls[i].emplace(INF);
    dfs(1, 0);
    for (int i = 1; i <= n; i++)
        cout << ans[i] << "\n";
    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int M = 2e5 + 100;
vector<int> e[M];
int a[M], ans[M];
multiset<int> st;

void dfs(int u, int pre) {
	st.insert(a[u]);
	int era = -1;
	auto it = st.lower_bound(a[u]);
	if (++it != st.end()) {
		era = *it;
		st.erase(it);
	}
	ans[u] = st.size();
	for (auto v : e[u]) {
		if (v != pre) {
			dfs(v, u);
		}
	}
	if (era != -1) st.insert(era);
	st.erase(s.find(a[u]));
}

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n - 1; i++) {
		int u, v; cin >> u >> v;
		--u, --v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(0, -1);
	for (int i = 0; i < n; i++) cout << ans[i] << "\n";
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:24:18: error: 's' was not declared in this scope
   24 |         st.erase(s.find(a[u]));
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 200005;
bool visit[MAX_N];
vector<int> G[MAX_N];
int a[MAX_N],dp[MAX_N],ans[MAX_N];

void dfs(vector<int> dp, int x)
{
	if (visit[x]) return;
	visit[x] = true;
	auto it = lower_bound(dp.begin(), dp.end(), a[x]);
	if (it == dp.end()) dp.push_back(a[x]);
	else *it = a[x];
	ans[x] = dp.size();
	rep(i,G[x].size())
	{
		dfs(dp,G[x][i]);
	}
}

int main()
{
	int N;
	cin >> N;
	rep(i,N)
	{
		cin >> a[i];
	}
	rep(i,N-1)
	{
		int u,v;
		cin >> u >> v;
		u--;
		v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	vector<int> dp;
	dp.push_back(a[0]);
	dfs(dp,0);
	rep(i,N)
	{
		cout << ans[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::vector<int>, int)':
a.cc:13:13: error: reference to 'visit' is ambiguous
   13 |         if (visit[x]) return;
      |             ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:6: note:                 'bool visit [200005]'
    7 | bool visit[MAX_N];
      |      ^~~~~
a.cc:14:9: error: reference to 'visit' is ambiguous
   14 |         visit[x] = true;
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:6: note:                 'bool visit [200005]'
    7 | bool visit[MAX_N];
      |      ^~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
#include <array>
using namespace std;
int n;
int a[200000];
int pa[200000];
vector<int> ch[200000];
int ans[200000];
int dp[200000]
void dfs(int now,int mem){
	int md;
	int id=lower_bound(dp,dp+n,a[now])-dp;
	if(dp[id]==1e9+7){
		md=dp[id];
		dp[id]=a[now];
		ans[now]=mem+1;
	}else{
		md=dp[id];
		dp[id]=a[now];
		ans[now]=mem;
	}
	for(int i=0;i<ch[now].size();i++){
		if(ch[now][i]==pa[now]){
			continue;
		}else{
			pa[ch[now][i]]=now;
			dfs(ch[now][i],ans[now]);
		}
	}
	dp[id]=md;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		ch[u].push_back(v);
		ch[v].push_back(u);
	}
	pa[0]=-1;
	for(int i=0;i<n;i++){
		dp[i]=1e9+7;
	}
	dfs(0,0);
	for(int i=0;i<n;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Compiler output:
a.cc:23:1: error: expected initializer before 'void'
   23 | void dfs(int now,int mem){
      | ^~~~
a.cc: In function 'int main()':
a.cc:59:17: error: 'dp' was not declared in this scope
   59 |                 dp[i]=1e9+7;
      |                 ^~
a.cc:61:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   61 |         dfs(0,0);
      |         ^~~
      |         ffs
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int n;
int a[200000];
int pa[200000];
vector<int> ch[200000];
int ans[200000];
void dfs(now,vector<int> dp){
	*lower_bound(dp.begin(),dp.end(),a[now])=a[now];
	ans[now]=(lower_bound(dp.begin(),dp.end(),1e9+7)-dp.begin());
	for(int i=0;i<ch[now].size();i++){
		if(ch[now][i]==pa[now]){
			continue;
		}else{
			pa[ch[now][i]]=now;
			dp.push_back(1e9+7);
			dfs(id,dp);
			dp.pop_back();
		}
	}
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		ch[u].push_back(v);
		ch[v].push_back(u);
	}
	pa[0]=-1;
	vector<int> dp;
	dp.push_back(1e9+7);
	dfs(0,dp);
	for(int i=0;i<n;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

Compiler output:
a.cc:21:6: error: variable or field 'dfs' declared void
   21 | void dfs(now,vector<int> dp){
      |      ^~~
a.cc:21:10: error: 'now' was not declared in this scope; did you mean 'pow'?
   21 | void dfs(now,vector<int> dp){
      |          ^~~
      |          pow
a.cc:21:26: error: expected primary-expression before 'dp'
   21 | void dfs(now,vector<int> dp){
      |                          ^~
a.cc: In function 'int main()':
a.cc:50:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   50 |         dfs(0,dp);
      |         ^~~
      |         ffs
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int n;
int a[200000];
int pa[200000];
vector<int> ch[200000];
void parent(int root){
	for(int i=0;i<ch[root].size();i++){
		if(ch[root][i]==pa[root]){
			continue;
		}else{
			pa[ch[root][i]]=root;
			parent(ch[root][i]);
		}
	}
}
int ans[200000];
void dfs(vector<int> id,vector<int> dp){
	*lower_bound(dp.begin(),dp.end(),a[id.back()])=a[id.back()];
	ans[id.back()]=(lower_bound(dp.begin(),dp.end(),1e9+7)-dp.begin());
	for(int i=0;i<ch[id.back()].size();i++){
		if(ch[id.back()][i]==pa[id.back()]){
			continue;
		}else{
			id.push_back(ch[id.back()][i]);
			dp.push_back(1e9+7);
			dfs(hoge,id,dp);
			id.pop_back();
			dp.pop_back();
		}
	}
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		ch[u].push_back(v);
		ch[v].push_back(u);
	}
	pa[0]=-1;
	parent(0);
	vector<int> hoge;
	vector<int> id;
	vector<int> dp;
	id.push_back(0);
	dp.push_back(1e9+7);
	dfs(id,dp);
	for(int i=0;i<n;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::vector<int>, std::vector<int>)':
a.cc:40:29: error: 'hoge' was not declared in this scope
   40 |                         dfs(hoge,id,dp);
      |                             ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 1001001001;
const int MAX_N = 200005;

vi a, ans;
vi to[MAX_N];
int dp[MAX_N];

void dfs(int v, int p=-1){
	int i = lower_bound(dp, dp+MAX_N, a[v]) -dp;
	int old = dp[i];
	dp[i] = a[v];
	ans[v] = i;
	if(p!=-1) ans[v] = max(ans[v], ans[p]);
	for(int u : to[v]){
		if(u == p) continue;
		dfs(u, v);
	}
	dp[i] = old;
}

int main(){
	int n; cin >> n;
	a = ans = vi(n); rep(i,n) cin >> a[i];

	rep(i,n-1){
		int u, v; cin >> u >> v;
		u--; v--;
		to[u].push_back(v);
		to[v].push_back(u);
	}
	memset(dp, INF, sizepf(dp));
	dp[0] = -INF;
	dfs(0);
	rep(i,n){
		cout << ans[i] <<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:25: error: 'sizepf' was not declared in this scope; did you mean 'size_t'?
   43 |         memset(dp, INF, sizepf(dp));
      |                         ^~~~~~
      |                         size_t
Language: C++

#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

void dfs(int pos);

vector<int> tree[SIZE];
vector<LL> dp;
LL node_num[SIZE];
LL res[SIZE];
bool visit[SIZE];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N;
    cin >> N;
    dp.resize(N);
    for(int i = 0; i < N; ++i) {
        dp[i] = LINF;

    }

    for(int i = 1; i <= N; ++i) {
        cin >> node_num[i];

    }

    for(int i = 0; i < N - 1; ++i) {
        int u, v;
        cin >> u >> v;
        tree[u].pb(v);
        tree[v].pb(u);

    }

    dfs(1);
    for(int i = 1; i <= N; ++i) {
        cout << res[i] << endl;

    }

    return 0;
}

void dfs(int pos) {
    if(visit[pos]) return;
    visit[pos] = true;

    int p = lower_bound(all(dp), node_num[pos]) - dp.begin();
    LL tmp = dp[p];
    dp[p] = node_num[pos];
    res[pos] = lower_bound(all(dp), LINF) - dp.begin();

    for(int i = 0; i < tree[pos].size(); ++i) {
        dfs(tree[pos][i]);

    }

    dp[p] = tmp;
    return;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:84:8: error: reference to 'visit' is ambiguous
   84 |     if(visit[pos]) return;
      |        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:47:6: note:                 'bool visit [200005]'
   47 | bool visit[SIZE];
      |      ^~~~~
a.cc:85:5: error: reference to 'visit' is ambiguous
   85 |     visit[pos] = true;
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:47:6: note:                 'bool visit [200005]'
   47 | bool visit[SIZE];
      |      ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>

#define INF 1000000009

using namespace std;

void dfs( const vector<vector<int>>& table, const vector<int>& values, vector<bool>& checked, int node, vector<int>& dp,
          vector<int>& ans )
{
    checked[node] = true;

    int old_value;

    auto it = lower_bound(dp.begin(), dp.end(), values[node] );
    old_value = *it;
    *it = values[node];

    for(auto new_node:table[node]){
        if(not checked[new_node]) dfs( table, values, checked, new_node, dp, stack_dp, ans);
    }

    ans[node] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();

    *it = old_value;

    return;
}


int main()
{
    int N,u,v;
    cin >> N;

    vector<int> values(N, 0);
    vector<vector<int>> table(N, vector<int>());

    vector<bool> checked(N, false);
    vector<int> dp(N, INF);
    vector<int> ans(N, 0);

    for(int i=0;i<N;++i){
        cin >> values[i];
    }
    
    for(int i=1;i<N;++i){
        cin >> u >> v;
        table[u-1].push_back(v-1);
        table[v-1].push_back(u-1);
     }

    dfs( table, values, checked, 0, dp, ans);

    for(int i=0;i<N;++i){
        cout << ans[i] << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'void dfs(const std::vector<std::vector<int> >&, const std::vector<int>&, std::vector<bool>&, int, std::vector<int>&, std::vector<int>&)':
a.cc:22:78: error: 'stack_dp' was not declared in this scope
   22 |         if(not checked[new_node]) dfs( table, values, checked, new_node, dp, stack_dp, ans);
      |                                                                              ^~~~~~~~
Language: Java

//make sure to make new file!
import java.io.*;
import java.util.*;
//replace treeset with arraylist
public class F165b{

   public static int[] values;
   public static ArrayList<ArrayList<Integer>> adj;
   public static ArrayList<ArrayList<Integer>> lis;
   public static int[] answer;
   
   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      int n = Integer.parseInt(f.readLine());
      
      StringTokenizer st = new StringTokenizer(f.readLine());
      values = new int[n+1];
      for(int k = 1; k <= n; k++){
         values[k] = Integer.parseInt(st.nextToken());
      }
      
      adj = new ArrayList<ArrayList<Integer>>(n+1);
      for(int k = 0; k <= n; k++) adj.add(new ArrayList<Integer>());
      
      for(int k = 0; k < n-1; k++){
         st = new StringTokenizer(f.readLine());
         int a = Integer.parseInt(st.nextToken());
         int b = Integer.parseInt(st.nextToken());
         
         adj.get(a).add(b);
         adj.get(b).add(a);
      }
      
      
      lis = new ArrayList<ArrayList<Integer>>();
      answer = new int[n+1];
      
      dfs(1, -1);
      
      StringJoiner sj = new StringJoiner("\n");
      for(int k = 1; k <= n; k++){
         sj.add(""+answer[k]);
      }
      out.println(sj.toString());
      
      
      
      out.close();
   }
   
   public static void dfs(int v, int p){
      int loc = -1;
      //get answer for itself
      if(lis.isEmpty()){
         lis.add(new ArrayList<Integer>());
         lis.get(0).add(values[v]);
         loc = 0;
      } else if(values[v] <= lis.get(0).get(lis.get(0).size()-1)){
          //add to first list
         lis.get(0).add(values[v]);
         
         loc = 0;
      } else if(values[v] > lis.get(lis.size()-1).get(lis.get(lis.size()-1).size()-1)){
         //add
         lis.add(new ArrayList<Integer>());
         lis.get(lis.size()-1).add(values[v]);
         loc = lis.size()-1;
      } else {
         int l = 0;
         int r = lis.size()-1;
         int ans = r;
         
         while(l <= r){
            int mid = l + (r-l)/2;
            
            if(values[v] <= lis.get(mid).get(lis.get(mid).size()-1)){
               r = mid-1;
               ans = mid;
            } else {
               l = mid+1;
               
            }
         }
         
         
         lis.get(ans).add(values[v]);
         
         loc = ans;
      }
      
      answer[v] = lis.size();
      
      for(int nei : adj.get(v)){
         if(nei == p) 
            continue;
         dfs(nei,v);
      }
      
      //remove
      lis.get(loc).remove(lis.get(loc).size()-1);
      if(lis.get(loc).isEmpty()){
         lis.remove(lis.size()-1);
      }
      
      
   }
}

Compiler output:
Main.java:5: error: class F165b is public, should be declared in a file named F165b.java
public class F165b{
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define SZ(v) ((int)(v).size())
using ll = long long;

const int MAXN = 2e5+1;

int ans[MAXN];
vector<int> G[MAXN];
vector<int> best[MAXN];
bool change[MAXN];
int val[MAXN];

void dfs(int u, int p)
{
	int lo(0), up(MAXN-1);
	while (lo < up)
	{
		int mid = (lo+up+1)/2;
		if (SZ(best[mid]) and best[mid].back() < val[u])
			lo = mid;
		else 
			up = mid-1;
	}
	if (best[lo].back() < val[u])
		++lo;
	ans[u] = lo;
	best[lo].push_back(val[u]);
	for (auto v : G[u])
		if (v != p)
			dfs(v, u);
	best[ans[u]].pop_back();
}5

int main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int N;
	cin >> N;
	for (int i(0); i < N; ++i)
		cin >> val[i];
	for (int i(1); i < N; ++i)
	{
		int _u, _v;
		cin >> _u >> _v;
		--_u, --_v;
		G[_u].push_back(_v);
		G[_v].push_back(_u);
	}

	ans[0] = 0;
	best[0].push_back(val[0]);
	for (auto v : G[0])
		dfs(v, 0);
	for (int i(0); i < N; ++i)
		cout << ans[i]+1 << '\n';
}


Compiler output:
a.cc:34:2: error: expected unqualified-id before numeric constant
   34 | }5
      |  ^
Language: C++

from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 9)
 
n = int(input())
a = list(map(int, input().split()))
to = [[] for _ in range(n)]
for i in range(n-1):
  u, v = map(int, input().split())
  u -= 1; v -= 1
  to[u].append(v)
  to[v].append(u)
l = []
u = []
ans = [0 for _ in range(n)]
# print(to)
# exit()
def dfs(v, before=-1):
  # print(v)
  global l,u, to, a, ans
  for next_v in to[v]:
    if next_v == before:
      continue
    if len(l) == 0:
      l.append(a[next_v])
      u.append(next_v)
    elif a[next_v] > l[-1]:
      # Lの末尾よりaが大きければ増加部分列を延長できる
      l.append(a[next_v])
      u.append(next_v)
    else:
      # そうでなければ、「aより小さい最大要素の次」をaにする
      # 該当位置は、二分探索で特定できる
      l[bisect_left(l, a[next_v])] = a[next_v]
    ans[next_v] = len(l)
    dfs(next_v, v)
    if len(u) > 0 and u[-1] == next_v:
      l.pop(); u.pop()
    
dfs(0)
for i in range(n):
  print(ans[i]+1)



Compiler output:
a.cc:16:3: error: invalid preprocessing directive #print
   16 | # print(to)
      |   ^~~~~
a.cc:17:3: error: invalid preprocessing directive #exit
   17 | # exit()
      |   ^~~~
a.cc:19:5: error: invalid preprocessing directive #print
   19 |   # print(v)
      |     ^~~~~
a.cc:28:9: error: invalid preprocessing directive #L\U0000306e\U0000672b\U00005c3e\U00003088\U0000308aa\U0000304c\U00005927\U0000304d\U00003051\U0000308c\U00003070\U00005897\U000052a0\U000090e8\U00005206\U00005217\U00003092\U00005ef6\U00009577\U00003067\U0000304d\U0000308b
   28 |       # Lの末尾よりaが大きければ増加部分列を延長できる
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:9: error: extended character 、 is not valid in an identifier
   32 |       # そうでなければ、「aより小さい最大要素の次」をaにする
      |         ^
a.cc:32:9: error: extended character 「 is not valid in an identifier
a.cc:32:9: error: extended character 」 is not valid in an identifier
a.cc:32:9: error: invalid preprocessing directive #\U0000305d\U00003046\U00003067\U0000306a\U00003051\U0000308c\U00003070\U00003001\U0000300ca\U00003088\U0000308a\U00005c0f\U00003055\U00003044\U00006700\U00005927\U00008981\U00007d20\U0000306e\U00006b21\U0000300d\U00003092a\U0000306b\U00003059\U0000308b
   32 |       # そうでなければ、「aより小さい最大要素の次」をaにする
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:33:9: error: extended character 、 is not valid in an identifier
   33 |       # 該当位置は、二分探索で特定できる
      |         ^
a.cc:33:9: error: invalid preprocessing directive #\U00008a72\U00005f53\U00004f4d\U00007f6e\U0000306f\U00003001\U00004e8c\U00005206\U000063a2\U00007d22\U00003067\U00007279\U00005b9a\U00003067\U0000304d\U0000308b
   33 |       # 該当位置は、二分探索で特定できる
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from bisect import bisect_left
      | ^~~~
a.cc:10:11: error: 'v' does not name a type
   10 |   u -= 1; v -= 1
      |           ^
a.cc:38:16: error: 'u' does not name a type
   38 |       l.pop(); u.pop()
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int ans[223456],dp[223456],v[223456],n,INF=1e9+1;
struct P{int I,V;};
P cha[223456];
vector<int>edge[223456];

void dfs(int p,int i){
  int l=0,r=n+1;
  while(r-l>1){
    int mid=(l+r)>>1;
    (dp[mid]<v[idx]?l:r)=mid;
  }
  cha[idx]={r,dp[r]};
  dp[r]=v[idx];
  chmax(now,r);
  ans[idx]=now;
  for(int q:edge[idx])if(q!=p)dfs(idx,q);
  dp[cha[idx].I]=cha[idx].V;
  while(dp[now]==INF)now--;
}

int main(){
  for(int i=1;i<223456;i++)dp[i]=INF;
  cin>>n;
  for(int i=0;i<n;i++)cin>>v[i];
  for(int i=1;i<n;i++){
    int a,b;cin>>a>>b;a--;b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  dfs(-1,0);
  for(int i=0;i<n;i++)cout<<ans[i]<<endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:16: error: 'idx' was not declared in this scope
   13 |     (dp[mid]<v[idx]?l:r)=mid;
      |                ^~~
a.cc:15:7: error: 'idx' was not declared in this scope
   15 |   cha[idx]={r,dp[r]};
      |       ^~~
a.cc:17:9: error: 'now' was not declared in this scope; did you mean 'pow'?
   17 |   chmax(now,r);
      |         ^~~
      |         pow
a.cc:17:3: error: 'chmax' was not declared in this scope
   17 |   chmax(now,r);
      |   ^~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 2e5 + 100;

int A[N];
vi G[N];
int ans[N];
vector<int> inc;

void dfs(int s , int p){
	if(inc.size() == 0){
		ans[s] = 1;
		inc.pb(A[s]);
		for(auto it : G[s]){
			if(it == p) continue;
			dfs(it , s);
		}
	}
	else{
		int type = 0;
		int idx , val;
		if(A[s] < inc[0]){
			idx = 0;
			val = inc[0];
			inc[0] = A[s];
		}
		else if(A[s] > inc.back()){
			inc.pb(A[s]);
			type = 1;
		}
		else{
			int lo = 0 , hi = inc.size()-1 , ans = lo;
			while(lo <= hi){
				int mid = (lo+hi)>>1;
				if(inc[mid] < A[s]){
					ans = mid;
					lo = mid+1;
				}
				else{
					hi = mid-1;
				}
			}
			idx = ans+1;
			val = inc[ans+1];
			inc[ans+1] = A[s];
		}
		ans[s] = inc.size();
		for(auto it : G[s]){
			if(it == p) continue;
			dfs(it , s);
		}
		if(type == 1){
			inc.pop_back();
		}
		else{
			inc[idx] = val;
		}
	}

}


int main(){
	fio; cout<<fixed<<setprecision(25);	
	int n; cin >> n;
	for(int i = 1;i <= n ; ++i)
		cin >> A[i];
	int u , v;
	for(int i= 0;i < n-1 ; ++i){
		cin >> u >> v;
		G[u].pb(v);
		G[v].pb(u);
	}	
	// inc.pb(A[1]);
	dfs(1 , -1);
	for(int i =1 ;i <= n ; ++i)
		cout << ans[i] << endl;








	return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define all(v) (v).begin(), (v).end()
#define _sz(v) (int)(v).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long ull;



const int N = (int)2e5 + 5;

struct SegmentTree {
    struct Node {
        Node *l, *r;
        int sz;
        int mx;

        Node(): sz(0), mx(0) {};

        Node(int _sz): sz(_sz), mx(0) {
            if (sz != 1) {
                l = new Node(sz / 2);
                r = new Node(sz - sz / 2);
            }
        }

        void recalc() {
            if (sz != 1)
                mx = max(l->mx, r->mx);
        }

        void modify(int pos, int val) {
            if (sz == 1) {
                mx = val;
            } else {
                if (pos < sz / 2)
                    l->modify(pos, val);
                else
                    r->modify(pos - sz / 2, val);
                recalc();
            }
        }
        int get(int i) {
            if (i >= sz)
                return mx;
            if (i <= 0)
                return 0;
            return max(l->get(i), r->get(i - sz / 2));
        }
    };

    int n;
    Node* root;
    vector<int> memory[N];

    SegmentTree() {};
    SegmentTree(int _n): n(_n) {
        root = new Node(n);
        for (int i = 0; i < n; ++i)
            st[i] = {0};
    }

    int get(int r) {
        return root->get(r);
    }
    void modify(int pos, int val) {
        memory[pos].push_back(val);
        root->modify(pos, val);
    }
    void rollback(int pos) {
        memory[pos].pop_back();
        root->modify(pos, memory[pos].back());
    }
};


int a[N];
vector<int> g[N];
SegmentTree tree;
int ans[N];

void dfs(int v, int p) {
    int val = 1 + tree.get(a[v]);
    ans[v] = max(ans[v], val);
    tree.modify(a[v], val);
    for (int u : g[v]) {
        if (u != p) {
            ans[u] = ans[v];
            dfs(u, v);
        }
    }
    tree.rollback(a[v]);
}

int main()
{
    //freopen("input.txt", "r", stdin);


    int n;
    scanf("%d", &n);

    vector<int> xs;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        xs.push_back(a[i]);
    }
    sort(all(xs));
    xs.erase(unique(all(xs)), xs.end());
    for (int i = 0; i < n; ++i)
        a[i] = lower_bound(all(xs), a[i]) - xs.begin();

    /*
    for (int i = 0; i < n; ++i)
        printf("%d ", a[i]);
    printf("\n");
    */

    for (int i = 1; i < n; ++i) {
        int u, v;
        scanf("%d %d", &u, &v);
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    tree = SegmentTree(n);

    dfs(0, -1);

    for (int i = 0; i < n; ++i) {
        printf("%d\n", ans[i]);
    }


}


Compiler output:
a.cc: In constructor 'SegmentTree::SegmentTree(int)':
a.cc:64:13: error: 'st' was not declared in this scope; did you mean 'std'?
   64 |             st[i] = {0};
      |             ^~
      |             std
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
ll qpow(ll a,ll b){ll res=1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
struct graph
{
    int head[maxn],nxt[maxn<<1],to[maxn<<1],w[maxn<<1],sz;
    void init(){memset(head,-1,sizeof(head));}
    graph(){init();}
    void push(int a,int b,int c){nxt[sz]=head[a],to[sz]=b,w[sz]=c,head[a]=sz++;}
    int& operator[](const int a){return to[a];}
}g;
int n,a[maxn],b[maxn];
struct BIT
{
    int bit[maxn];
    vector<pair<int,int> > update(int x,int k){
        vector<pair<int,int> >v;
        while(x<=n){
            if(bit[x]<k){
                v.push_back(make_pair(x,bit[x]));
                bit[x]=k;
            }
            x+=x&-x;
        }
        return v;
    }
    int query(int x){
        int tmp = 0;
        while(x){
            tmp=max(tmp,bit[x]);
            x-=x&-x;
        }
        return tmp;
    }
}bit;
int ans[maxn];
void dfs(int now,int pre)
{
    ans[now]=bit.query(a[now]-1)+1;
    vector<pair<int,int> >v=bit.update(a[now],ans[now]);;
    for(int i = g.head[now];~i;i = g.nxt[i]){
        if(g[i]==pre)continue;
        dfs(g[i],now);
    }
    for(int i = 0;i < v.size();++i){
        bit.bit[v[i].first]=v[i].second;
    }
}
int main()
{
    scanf("%d",&n);
    for(int i = 1;i <= n;++i)scanf("%d",&a[i]),b[i]=a[i];
    sort(b+1,b+1+n);
    m = unique(b+1,b+1+n)-b-1;
    for(int i = 1;i <= n;++i)a[i]=lower_bound(b+1,b+1+m,a[i])-b;
    for(int i = 1;i < n;++i){
        int c,d;
        scanf("%d%d",&c,&d);
        g.push(c,d,0),g.push(d,c,0);
    }
    dfs(1,0);
    for(int i = 1;i <= n;++i)printf("%d\n",ans[i]);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:5: error: 'm' was not declared in this scope; did you mean 'tm'?
   57 |     m = unique(b+1,b+1+n)-b-1;
      |     ^
      |     tm
Language: Java

import java.io.*;
import java.util.*;
 
public class Main
{
    
    public static void main(Strimg[] args)
    { 
      Scanner sc=new Scanner(System.in);
      int N=sc.nextInt();
      int [] arr= new int[N];
      for(int i=0;i<N;i++)
      {
        arr[i]=sc.nextInt(); 
      }
      for(int i=0;i<N;i++)
      {
        int x=sc.nextInt();
        int y=sc.nextInt();
        
        int res=arr[x-1];
        for(int j=x-1;j<y;j++)
        {
          res=Math.min(res,arr[j]);
        }
        System.out.println(res);
      }
    }
}

Compiler output:
Main.java:7: error: cannot find symbol
    public static void main(Strimg[] args)
                            ^
  symbol:   class Strimg
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 2e5;
const char newl = '\n';
ll num=1, cnt=0, sum=0;
vl checked(MAX), ans(MAX, 1), path[MAX];

void dfs(ll v) {
  checked(v) = 1;
  
  for(ll i: G[v]) if(!checked[i]) {
    path[i] = path[v];
    path[i].push_back(i);
    
    for(ll j: path[v]) if(a[j]<a[i]) chmax(ans[i],ans[j]+1);
    
    dfs(i);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n;
  cin >> n;
  ll a(n);
  rep(i, n) cin >> a[i];
  
  ll u, v;
  rep(_, n-1) {
    cin >> u >> v;
    u--, v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  
  rep2(i, n) cout << ans[i] << newl;
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:28:10: error: no match for call to '(vl {aka std::vector<long long int>}) (ll&)'
   28 |   checked(v) = 1;
      |   ~~~~~~~^~~
a.cc:30:13: error: 'G' was not declared in this scope
   30 |   for(ll i: G[v]) if(!checked[i]) {
      |             ^
a.cc:34:27: error: 'a' was not declared in this scope
   34 |     for(ll j: path[v]) if(a[j]<a[i]) chmax(ans[i],ans[j]+1);
      |                           ^
a.cc: In function 'int main()':
a.cc:47:21: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   47 |   rep(i, n) cin >> a[i];
      |                     ^
a.cc:53:5: error: 'G' was not declared in this scope
   53 |     G[u].push_back(v);
      |     ^
Language: Java

import java.io.*;
import java.util.*;
 
public class Main
{
    
    public static int check(int A,int B,int N)
    { 
      Scanner sc=new Scanner(System.in);
      int N=sc.nextInt();
      int [] arr= new int[N];
      for(int i=0;i<N;i++)
      {
        arr[i]=sc.nextInt(); 
      }
      for(int i=0;i<N;i++)
      {
        int x=sc.nextInt();
        int y=sc.nextInt();
        
        int res=arr[x-1];
        for(int =x-1;j<y;j++)
        {
          res=Math.min(res,arr[i]);
        }
        System.out.println(res);
      }
    }
}

Compiler output:
Main.java:22: error: not a statement
        for(int =x-1;j<y;j++)
            ^
Main.java:22: error: ';' expected
        for(int =x-1;j<y;j++)
               ^
Main.java:22: error: illegal start of expression
        for(int =x-1;j<y;j++)
                ^
Main.java:22: error: not a statement
        for(int =x-1;j<y;j++)
                      ^
Main.java:22: error: ')' expected
        for(int =x-1;j<y;j++)
                        ^
Main.java:22: error: ';' expected
        for(int =x-1;j<y;j++)
                            ^
6 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ii, null_type,less<ii>, rb_tree_tag,tree_order_statistics_node_update>

#define Mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

struct graph {
	ll n;
	
	vector<ll> *adj;
	
	graph(ll V) {
		n = V;
		adj = new vector<ll>[V];
	}
	
	void AddEdge(ll a, ll b) {
		
		adj[a].pb(b);
	}
};

void DFS(vector< pair < ll, ll > > &lis, ll value[], ll ans[], 
vector<ll> adj[], ll index, ll n) {
	
	if (index != 0) {
		
		ll ok = 1;
		for (ll i = 0; i < lis.size(); i++) {
			if (value[lis[i].ff] < value[index])
				ok = max(ok, lis[i].ss + 1);
		}
		
		ans[index] = ok;
		lis.pb({index,ok});
	}
	
	for (auto it = adj[index].begin(); it != adj[index].end(); it++)
		DFS(lis,value, ans, adj, *it, n);
		
	if (index != 0)
		lis.pop_back();
}

int main()
{
    fastio;
//	#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r" , stdin);
//    freopen("output.txt", "w" , stdout);
//    #endif
    ll n, a, b;
    cin >> n;
    
    graph g(n);
    
    ll value[n];
    
    rep(i, n) cin >> value[i];
    
    rep(i, n) {
    	cin >> a >> b;
    	a--;
    	b--;
    	g.AddEdge(a,b);
	}
	
	ll ans[n] = {0};
	ans[0] = 1;
	vector<pair<ll, ll>> lis;
	lis.pb({0,1});
	
	DFS(lis, value, ans, g.adj, 0, n);
	
	rfor (ll i = 0; i < n; i++)
		cout << ans[i] << "\n";
	
	//code
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: expected primary-expression before 'long'
    8 | #define ll long long
      |            ^~~~
a.cc:98:15: note: in expansion of macro 'll'
   98 |         rfor (ll i = 0; i < n; i++)
      |               ^~
a.cc:98:25: error: 'i' was not declared in this scope
   98 |         rfor (ll i = 0; i < n; i++)
      |                         ^
Language: Java

import java.io.*;
import java.util.*;

public class Main
{
    
    public static int check(int A,int B,int N)
    { 
      Scanner sc=new Scanner(System.in);
      int N=sc.nextInt();
      int [] arr= ne int[N];
      for(int i=0;i<N;i++)
      {
        arr[i]=sc.nextInt(); 
      }
      for(int i=0;i<N;i++)
      {
        int x=sc.nextInt();
        int y=sc.nextInt();
        
        int res=arr[x-1];
        for(int =x-1;j<y;j++)
        {
          res=Math.min(res,arr[i]);
        }
        System.out.println(res);
      }
    }
}

Compiler output:
Main.java:11: error: ';' expected
      int [] arr= ne int[N];
                    ^
Main.java:11: error: ']' expected
      int [] arr= ne int[N];
                         ^
Main.java:11: error: ';' expected
      int [] arr= ne int[N];
                          ^
Main.java:22: error: not a statement
        for(int =x-1;j<y;j++)
            ^
Main.java:22: error: ';' expected
        for(int =x-1;j<y;j++)
               ^
Main.java:22: error: illegal start of expression
        for(int =x-1;j<y;j++)
                ^
Main.java:22: error: not a statement
        for(int =x-1;j<y;j++)
                      ^
Main.java:22: error: ')' expected
        for(int =x-1;j<y;j++)
                        ^
Main.java:22: error: ';' expected
        for(int =x-1;j<y;j++)
                            ^
9 errors
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
using namespace std;
vector<vector<int> > ki;
vector<int> rw;
int memo[300000];
int visit[300000];

void solve(int now,int p,int tmp){
    visit[now]++;
    if(rw[now]>rw[p]) tmp++;
    memo[now]=max(memo[p],tmp);
    rep(i,ki[now].size()){
        if(visit[ki[now][i]]) continue;
        solve(ki[now][i],now,tmp);
    }
    return;
}

int main(){
    int n; cin >> n;
    rw.resize(n+1);
    ki.resize(n);
    rep(i,n){
        cin >> rw[i];
        visit[i]=0;
    }
    rw[n]=-1;
    rep(i,n-1){
        int u,v; cin >> u >> v;
        u--; v--;
        ki[u].push_back(v);
        ki[v].push_back(u);
    }
    solve(0,n,0);
    rep(i,n) cout << memo[i] << endl;
return 0;
}







Compiler output:
a.cc: In function 'void solve(int, int, int)':
a.cc:16:5: error: reference to 'visit' is ambiguous
   16 |     visit[now]++;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:5: note:                 'int visit [300000]'
   13 | int visit[300000];
      |     ^~~~~
a.cc:20:12: error: reference to 'visit' is ambiguous
   20 |         if(visit[ki[now][i]]) continue;
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:5: note:                 'int visit [300000]'
   13 | int visit[300000];
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:32:9: error: reference to 'visit' is ambiguous
   32 |         visit[i]=0;
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:5: note:                 'int visit [300000]'
   13 | int visit[300000];
      |     ^~~~~
Language: C

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


static int ANS = 0;
void DFS(int V,vector<vector<int> >&GRAPH,vector<int>& used, vector<int>& LIS, vector<int> & data,vector<int> & ANS)
{
  if(used[V] == 1)return;
  used[V] = 1;
  // DEBUG(V);
  int P = data[V];
  auto itr = lower_bound(ALL(LIS),P);
  int mem = *itr;
  *itr = P;
  int SIZE = distance(LIS.begin(),lower_bound(ALL(LIS),INF));
  ANS[V] = SIZE;
  for (int i = 0; i < GRAPH[V].size(); i++)
  {
    if(used[GRAPH[V][i]] == 0)
    {
      DFS(GRAPH[V][i],GRAPH,used,LIS,data,ANS);
    }
  }
  *itr = mem;

  

  return;
}

void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
  }
  vector<vector<int> > GRAPH(N);
  for (int i = 0; i < N-1; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    GRAPH[A].push_back(B);
    GRAPH[B].push_back(A);
  }
  vector<int> used(N,0);
  vector<int> LIS(N+1,INF);
  vector<int> ANS(N,0);
  DFS(0,GRAPH,used,LIS,vec,ANS);
  for (int i = 0; i < N; i++)
  {
    cout<<ANS[i]<<endl;
  }
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll N;
v ans(N);
v a(N);
vv edges(N);

void dfs(ll pre,ll now, v dp){
    ll tmp = upper_bound(all(dp), now)-dp.begin();
    if(tmp < dp.size())dp[tmp] = now;
    else dp.PB(now);
    ans[now] = dp.size();
}
int main(){
    cin>>N;
    rep(i,0,N)cin>>a[i];
    rep(i,0,N-1){
        ll c,d;
        cin>>c>>d;
        c--;d--;
        edges[c].PB(d);
        edges[d].PB(c);
    }
    v d;
    dp(-1,0,v);
    rep(i,0,N)cout<<ans[i]<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:14: error: expected primary-expression before ')' token
   54 |     dp(-1,0,v);
      |              ^
a.cc:54:5: error: 'dp' was not declared in this scope; did you mean 'd'?
   54 |     dp(-1,0,v);
      |     ^~
      |     d