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

#include <cstdio>

using i32 = int;
using i64 = long long;
constexpr i32 maxn = 100000;

inline i32 in() {
	static i32 n;
	scanf("%d", &n);
	return n;
}

i32 a[maxn + 1];

i32 main() {
	const i32 n = in(), T = in();
	for (i32 i = 1; i <= n; ++i)
		a[i] = in();
	a[n + 1] = -1;
	
	std::pair<i32, i32> ans = std::make_pair(0, 0);
	for (i32 l = 1, r = 1; r <= n; ++r)
		if (a[r + 1] < a[r]) {
			const i32 val = a[r] - a[l];
			if (val > ans.first) ans = std::make_pair(val, 1);
			else if (val == ans.first) ++ans.second;
			l = r + 1;
		}
	printf("%d\n", ans.second);
	
	return 0;
}

Compiler output:
a.cc: In function 'i32 main()':
a.cc:21:14: error: 'pair' is not a member of 'std'
   21 |         std::pair<i32, i32> ans = std::make_pair(0, 0);
      |              ^~~~
a.cc:2:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
    1 | #include <cstdio>
  +++ |+#include <utility>
    2 | 
a.cc:21:22: error: expected primary-expression before ',' token
   21 |         std::pair<i32, i32> ans = std::make_pair(0, 0);
      |                      ^
a.cc:21:27: error: expected primary-expression before '>' token
   21 |         std::pair<i32, i32> ans = std::make_pair(0, 0);
      |                           ^
a.cc:21:29: error: 'ans' was not declared in this scope
   21 |         std::pair<i32, i32> ans = std::make_pair(0, 0);
      |                             ^~~
a.cc:21:40: error: 'make_pair' is not a member of 'std'
   21 |         std::pair<i32, i32> ans = std::make_pair(0, 0);
      |                                        ^~~~~~~~~
a.cc:21:40: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
a.cc:25:57: error: 'make_pair' is not a member of 'std'
   25 |                         if (val > ans.first) ans = std::make_pair(val, 1);
      |                                                         ^~~~~~~~~
a.cc:25:57: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
Language: C++

#include<iostream>
#include<algorithm>
#define MAX 100005
using namespace std;
ll a[MAX],ans=0;
typedef long long ll;
int main() {
	//最多买卖T
	int N, T;
	cin >> N >> T;
	ll tmp = 0,pro=0;
	cin >> a[1];
	tmp = a[1];
	for (int i = 2; i <= N; i++){
		cin >> a[i];
		if (a[i] > tmp) {
			if (a[i] - tmp >= pro) {
				pro = a[i] - tmp;
				ans++;
			}
			tmp = a[i];
		}
		else {
			tmp = a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:5:1: error: 'll' does not name a type
    5 | ll a[MAX],ans=0;
      | ^~
a.cc: In function 'int main()':
a.cc:12:16: error: 'a' was not declared in this scope
   12 |         cin >> a[1];
      |                ^
a.cc:19:33: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |                                 ans++;
      |                                 ^~~
      |                                 abs
a.cc:27:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
#define maxn  100500
#define inf 0x3f3f3f3f
int a[maxn];
int main()
{
	int ans = 0;
	int n, t;
	scanf_s("%d%d", &n, &t);
	for (int i = 1; i <= n; i++) {
		scanf_s("%d", &a[i]);
	}
	int temp, maxx;
	temp = inf;
	maxx = -inf;
	for (int i = 1; i <= n; i++) {
		temp = min(temp, a[i]);
		maxx = max(maxx, a[i]-temp);
	}

	temp = inf;
	for (int i = 1; i <= n; i++) {
		temp = min(temp, a[i]);
		if (maxx == a[i]-temp)ans++;
	}
	printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   16 |         scanf_s("%d%d", &n, &t);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <bits/stdc++>h>

using namespace std;

int main(){
  long long int a, b , c[100010], x[100010];
  
  cin >> a >> b;
  
  for(int i=0;i<a;i++)
    cin >> c[i];
  
  x[0] = 1e15;
  
  for(int i=0;i<a;i++){
    x[i+1] = min(c[i+1] , x[i]);
  }
    int p = -1e9;
    int ans = 0;
  
  for(int i=0;i<a;i++){
    
    if(x[i]-c[i] > p){
      p = x[i] - c[i];
      ans = 1;
    }
    
    else if(x[i] - c[i] == p){
      ans ++;
    }
    
  }
  
  cout << ans << endl;
  
}
      
      


Compiler output:
a.cc:2:24: warning: extra tokens at end of #include directive
    2 | #include <bits/stdc++>h>
      |                        ^
a.cc:2:10: fatal error: bits/stdc++>: No such file or directory
    2 | #include <bits/stdc++>h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)



#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)



int main(){
    int n,t;cin>>n>>t;
    int a[n];rep(i,n)cin>>a[i];
    int cur=a[0];
    multiset<int> ms;
    rep(i,n-1){
        if(a[i]>a[i-1])continue;
        ms.insert(a[i-1]-cur);
        if(cur>a[i])cur=a[i];
    }
    ms.insert(a[n-1]-cur);
    int ans=1;
    auto it=ms.end();
    --it;
    int mval=(*it);
    while(it!=ms.begin()){
        if(*(--it)!=mval)break;
        else ++ans;
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc:20:24: error: redefinition of 'template<class T> bool chmax(T&, const T&)'
   20 | template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:6:24: note: 'template<class T> bool chmax(T&, const T&)' previously declared here
    6 | template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:21:24: error: redefinition of 'template<class T> bool chmin(T&, const T&)'
   21 | template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:7:24: note: 'template<class T> bool chmin(T&, const T&)' previously declared here
    7 | template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
      |                        ^~~~~
Language: C++

#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<utility>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<cstdio>
using namespace std;
int A[100100];
map<int,int> mp;
int main()
{
	int N,T,lst;
	cin>>N>>T;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		if(!i)
			int x=A[i];
		else	int x=min(lst,A[i-1]);
		mp[A[i]-x]++;
		lst=x;
	}
	map<int,int>::iterator it=mp.end();
	it--;
	cout<<it->second<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: error: 'x' was not declared in this scope
   32 |                 mp[A[i]-x]++;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  long long t;
  cin>>n>>t;
  if(n==1){
    cout<<0<<endl;
    return 0;
  }
  long long a[n];
  REP(i,n){
    cin>>a[i];
  }
  long long opt[n]={};//町iでりんごを買って最適に売った時の利益
  vector<int> p[n];//町iで買ったりんごをどの町で売るのが最適か?
  long long M=0;
  for(int i=n-2;i>=0;i--){
    if(M<a[i+1]){
      M = a[i+1];
      p[i].push_back(i+1);
    }else if(M==a[i+1]){
      p[i].push_back(i+1);
      REP(j,(int)p[i+1].size()){
        p[i].push_back(p[i+1][j]);
      }
    }else{
      REP(j,(int)p[i+1].size()){
        p[i].push_back(p[i+1][j]);
      }
    }
    opt[i]=(M-a[i])*(t/2);
  }
  long long maxp=0;
  REP(i,n){
    maxp = max(maxp,opt[i]);
  }
  bool used[n]={};
  int ans=0;
  REP(i,n){
    if(opt[i]==maxp){
      REP(j,(int)p[i].size()){
        if(!used(p[i][j])){
          ans++;
          used(p[i][j]) = true;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:129:17: error: 'used' cannot be used as a function
  129 |         if(!used(p[i][j])){
      |             ~~~~^~~~~~~~~
a.cc:131:15: error: 'used' cannot be used as a function
  131 |           used(p[i][j]) = true;
      |           ~~~~^~~~~~~~~
Language: C

#include<stdio.h>
int main(){
    int a[100000],i,j,n,N=0,num=0;
    int max=0;
    scanf("%d%d",&n,&N);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        if（i>0&&a[i-1]-a[i]>max)
        max=a[i-1]-a[i];
    }
 
    for(i=0;i<n-1;i++){
     if(max==a[i]-a[i+1])
     num++;
        }
        if(N<num)
        num=N;
        printf("%d",num);
        return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: 'if\U0000ff08i' undeclared (first use in this function)
    8 |         if（i>0&&a[i-1]-a[i]>max)
      |         ^~~~~
main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:33: error: expected ';' before ')' token
    8 |         if（i>0&&a[i-1]-a[i]>max)
      |                                 ^
      |                                 ;
main.c:8:33: error: expected statement before ')' token
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ll N, T;
    cin >> N >> T;
    ll A[N + 5];
    map<ll, ll> mp;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    ll max_v = -2000000000000;
    ll min_v = R[0];
    for (int i = 0; i < N; i++)
    {
        max_v = max(max_v, A[i] - min_v);
        min_v = min(min_v, A[i]);
    }
    ll dis = max_v;
    ll cnt = 0;
    for (int i = 0; i < N; i++)
    {
        mp[A[i]]++;
        if (mp[A[i] - dis])
        {
            cnt++;
        }
    }
    cout<<min(T/2,cnt)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: 'R' was not declared in this scope
   15 |     ll min_v = R[0];
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n, t;
    cin >> n >> t;
    int A[n];
    int mn = INT_MAX;
    int mx = 0;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        mn = min(mn, A[i]);
        mx = max(mx, A[i] - mn);
    }

    int count = 0;
    int mn2 = INT_MAX;
    for (int i = 0; i < n; i++) {
        mn2 = min(mn2, A[i]);
        if (A[i] - mn2 == mx) {
            count++;
        }
    }

    cout << count << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'INT_MAX' was not declared in this scope
   18 |     int mn = INT_MAX;
      |              ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cmath>
  +++ |+#include <climits>
    7 | typedef long long ll;
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF INT_MAX
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll
#define P pair<int,int>

#define MAX 100005
int a[MAX];

// 利益の最大値 first  配列の場所 second
vector<P> max_dif;

signed main(){
  int n,t; cin>>n>>t;
  for(int i=0; i<n; i++) cin>>a[i];
  
  max_dif.push_back(mk(-1,-1));
  int minl=INF;
  for(int i=0; i<n; i++){
    minl=min(minl,a[i]);
    int d=a[i]-minl;
    if(d==max_dif[0].first) max_dif.push_back(mk(d,i));
    else if(d>max_dif[0].first){
      max_dif.clear();
      max_dif.push_back(mk(d,i));
    }
  }
  
  cout<<max_dif.size()<<en;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'INT_MAX' was not declared in this scope
   23 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:52:12: note: in expansion of macro 'INF'
   52 |   int minl=INF;
      |            ^~~
a.cc:23:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   22 | #include <numeric>
  +++ |+#include <climits>
   23 | #define INF INT_MAX
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int N, T;
int in[100001];

int main() {

	cin >> N >> T;
	for (int i = 0; i < N; i++)ifs >> in[i];
	int ct = 1, biggest = -1, small = in[0];
	int ans = 0;
	int beforesmall = 0;
	for (int i = 1; i <= N; i++) {
		beforesmall = small;
		small = min(small, in[i]);
		if (i != N && in[i] > in[i - 1])ct++;
		else {
			if (ct != 0) {
				if (biggest == in[i - 1] - beforesmall) {
					ans++;
				}
				else if (biggest < in[i - 1] - beforesmall) {
					biggest = in[i - 1] - beforesmall;
					ans = 1;
				}
				ct = 0;
			}
		}
		//cout << i << " " << biggest << " " << small << endl;
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:36: error: 'ifs' was not declared in this scope
   12 |         for (int i = 0; i < N; i++)ifs >> in[i];
      |                                    ^~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
	int N, T;
	cin>>N>>T;
	vector<int> A, B;
	A.resize(N);
	B.resize(N-1);
	cin>>A[0];
	int min=A[0];
	for(int i=1; i<N; i++){
		cin>>A[i];
		B[i-1]=A[i]-min;
		if(min > A[i]){
			min=A[i];
		}
	}
	
	sort(B.begin(), B.end());

	int cnt=0;
	for(int i=N-2; i>0; i--){
		if(B[i]==B[i-1]){
			cnt++;
		}else{
			break;
		}
	}

	cout<<cnt+1<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(B.begin(), B.end());
      |         ^~~~
      |         short
Language: C++

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

using namespace std;

int main(void) {
	int N, T, minprice, maxgain, cost;
	vector<int> A(100000), m(100000);
	
	cin >> N >> T;

	for (int i = 0; i < N; i++) cin >> A[i];

	minprice = INT_MAX;
	maxgain = -INT_MAX;
	for (int i = 0; i < N; i++) {
		minprice = min(minprice, A[i]);
		m[i] = A[i] - minprice;
		if (maxgain < m[i]) maxgain = m[i];
	}

	cost = 0;
	for (int i = 0; i < N; i++) if (maxgain == m[i]) cost++;

	cout << cost << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'INT_MAX' was not declared in this scope
   15 |         minprice = INT_MAX;
      |                    ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<vector>
  +++ |+#include <climits>
    4 |
Language: Java

import java.util.*;

public class Main2 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int A[] = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		// i 以前の最小値
		int min[] = new int[N];
		min[0] = A[0];
		for (int i = 1; i < N; i++) {
			if (A[i] < min[i-1]) {
				min[i] = A[i];
			} else {
				min[i] = min[i-1];
			}
		}
		// i 以降のAiの最大値
		int max[] = new int[N];
		max[N-1] = A[N-1];
		for (int i = N - 2; i >=0; i--) {
			if(A[i] > max[i + 1]) {
				max[i] = A[i];
			} else {
				max[i] = max[i + 1];
			}
		}
		// 最大の価格差
		int maxgap = 0;
		for (int i = 0; i < N; i++) {
			if (maxgap < max[i] - min[i]) {
				maxgap = max[i] - min[i];
			}
		}
		// maxgapを作る場所の数を算出
		// 連続したものはカウントしない
		int prevmax = 0;
		int prevmin = 0;
		int count = 0;
		for (int i = 0; i < N; i++) {
			if (max[i] - min[i] == maxgap && (prevmax != max[i] || prevmin != min[i])) {
				count++;
			}
			prevmax = max[i];
			prevmin = min[i];
		}
		System.out.println(count);
	}
}


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

#include <stdio.h>

int main(void){
    int N, T;
    scanf("%d %d\n" , &N, &T);
    char A[N], D[N];
    scanf("%s", A);
    int i, j=A[1], k=0;

    for(i=2; i<N; i++){
        if(j<A[i]){
            D[k]=A[i]-j;
            k++;
        }else if(j==A[i]){
            D[k]=0;
            k++;
        }else if(j>A[i]){
            j=A[i];
        }
    }
    
    int l=D[0];

    for(i=0; i<k; i++){
        if(l<D[i]{
            l=D[i];
        }
    }

    j=0;

    for(i=0; i<k; i++){
        if(l==D[i]){
            j++;
        }
    }

    printf("%d", j);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:18: error: expected ')' before '{' token
   25 |         if(l<D[i]{
      |           ~      ^
      |                  )
main.c:28:5: error: expected expression before '}' token
   28 |     }
      |     ^
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int N,T;
    cin >> N >> T;
    int A[N];
    for(int i=0;i<N;i++) scanf("%d", &A[i]);

    int minA[N],profit[N];
    int min_value=INT_MAX;
    int max_value=0;
    int suffer=0;
    for(int i=0;i<N;i++){
        if(A[i]<min_value) min_value=A[i];
        minA[i]=min_value;
        profit[i]=A[i]-minA[i];
        if(max_value==profit[i]){
            suffer++;
        }else if(max_value<profit[i]){
            max_value=profit[i];
            suffer=1;
        }
    }
    cout << suffer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'INT_MAX' was not declared in this scope
   13 |     int min_value=INT_MAX;
      |                   ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cmath>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>

using namespace std;

int main(){
    int N,T;
    cin >> N >> T;
    int A[N];
    for(int i=0;i<N;i++) scanf("%d", &A[i]);

    int minA[N],profit[N];
    int min_value=INT_MAX;
    int max_value=0;
    int suffer=0;
    for(int i=0;i<N;i++){
        if(A[i]<min_value) min_value=A[i];
        minA[i]=min_value;
        profit[i]=A[i]-minA[i];
        if(max_value==profit[i]){
            suffer++;
        }else if(max_value<profit[i]){
            max_value=profit[i];
            suffer=1;
        }
    }
    cout << suffer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'INT_MAX' was not declared in this scope
   12 |     int min_value=INT_MAX;
      |                   ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

#include<iostream>
using namespace std;

int main(){
	int n, t;
	int *a;

	cin>> n>> t;
	a= new int[n];

	for(int i=0; i<n; i++) cin>> a[i];

	int minA[n];
	int profit[n];

	minA[0]= a[0];
	profit[0]= -a[0];

	for(int i=1; i<n; i++) minA[i]= min(minA[i-1], a[i]);
	for(int i=1; i<n; i++) profit[i]= a[i]-minA[i-1]; 

	int maxProfit= INT_MIN;
	int numMax=0;
	for(int i=0; i<n; i++) maxProfit= max(maxProfit, profit[i]);
	for(int i=0; i<n; i++){
		if(profit[i] == maxProfit) numMax++;			
	}

	cout<< numMax<< endl;

	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: 'INT_MIN' was not declared in this scope
   22 |         int maxProfit= INT_MIN;
      |                        ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include<iostream>
using namespace std;

int main(){
	int n, t;
	int *a;

	cin>> n>> t;
	a= new int[n];

	for(int i=0; i<n; i++) cin>> a[i];

	int minA[n];
	int profit[n];

	minA[0]= a[0];
	profit[0]= -a[0];

	for(int i=1; i<n; i++) minA[i]= min(minA[i-1], a[i]);
	for(int i=1; i<n; i++) profit[i]= a[i]-minA[i-1]; 

	int maxProfit= INT_MIN;
	int numMax=0;
	for(int i=0; i<n; i++) maxProfit= max(maxProfit, profit[i]);
	for(int i=0; i<n; i++){
		if(profit[i] == maxProfit) numMax++;			
	}

	cout<< numMax<< endl;

	return 0;	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: 'INT_MIN' was not declared in this scope
   22 |         int maxProfit= INT_MIN;
      |                        ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;

#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
const int maxn = 1e6 + 20;
int dp[maxn];
void work() {
    int n, t;
    scanf("%d%d", &n, &t);
    if (n == 1) while(1);
    int mi = INT_MAX;
    int mx = -INT_MAX;
    for (int i = 1; i <= n; ++i) {
        int x;
        scanf("%d", &x);
        dp[i] = max(0, x - mi);
        mi = min(mi, x);
        mx = max(mx, dp[i]);
    }
    int tim = 0;
    for (int i = 1; i <= n; ++i) {
        tim += dp[i] == mx;
    }
//    for (int i = 1; i <= n; ++i) {
////        cout << dp[i] << " ";
//    }
//    cout << endl;
    
    int ans = min(t / 2, tim);
    cout << ans << endl;
}

int main() {
#ifdef local
    freopen("data.txt","r",stdin);
#endif
    work();
    return 0;
}


Compiler output:
a.cc: In function 'void work()':
a.cc:24:14: error: 'INT_MAX' was not declared in this scope
   24 |     int mi = INT_MAX;
      |              ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <queue>
  +++ |+#include <climits>
   17 | #include <string>
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
int n;
ll t;
ll m;
ll sa, kazu, 
ll a[100010]; 
int main()
{
	cin >> n >> t;
	cin >> a[0];
	m=a[0];
	kazu=0;
	sa=-1;
	repp(i, 1, n)
	{
		cin >> a[i];
		if(a[i]>m)
		{
			if(a[i]-m==sa)
			{
				kazu++;
			}
			else if(a[i]-m>sa)
			{
				kazu=1;
				sa=a[i]-m;
			}
		}
		else
		{
			m=a[i];
		}
	}
	cout << kazu << endl;
	return 0;
}

Compiler output:
a.cc:15:4: error: expected initializer before 'a'
   15 | ll a[100010];
      |    ^
a.cc: In function 'int main()':
a.cc:19:16: error: 'a' was not declared in this scope
   19 |         cin >> a[0];
      |                ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
int n;
ll t;
ll m;
ll sa kazu, 
ll a[100010]; 
int main()
{
	cin >> n >> t;
	cin >> a[0];
	m=a[0];
	kazu=0;
	sa=-1;
	rep(i, 1, n)
	{
		cin >> a[i];
		if(a[i]>m)
		{
			if(a[i]-m==sa)
			{
				kazu++;
			}
			else if(a[i]-m>sa)
			{
				kazu=1;
				sa=a[i]-m;
			}
		}
		else
		{
			m=a[i];
		}
	}
	cout << kazu << endl;
	return 0;
}

Compiler output:
a.cc:23:20: error: macro "rep" passed 3 arguments, but takes just 2
   23 |         rep(i, 1, n)
      |                    ^
a.cc:2:9: note: macro "rep" defined here
    2 | #define rep(i,n) for(int i = 0; i < n; i++)
      |         ^~~
a.cc:14:7: error: expected initializer before 'kazu'
   14 | ll sa kazu,
      |       ^~~~
a.cc: In function 'int main()':
a.cc:19:16: error: 'a' was not declared in this scope
   19 |         cin >> a[0];
      |                ^
a.cc:21:9: error: 'kazu' was not declared in this scope
   21 |         kazu=0;
      |         ^~~~
a.cc:22:9: error: 'sa' was not declared in this scope
   22 |         sa=-1;
      |         ^~
a.cc:23:9: error: 'rep' was not declared in this scope
   23 |         rep(i, 1, n)
      |         ^~~
Language: C++

#include "math.h"
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#include <set>
 
#define ifor(i, a, b) for (int i = (a); i < (b); i++)
#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long double ld;
typedef long long int lli;
typedef complex<double> P;
const double eps = 1e-11;
int vex[4] = {1, 0, -1, 0};
int vey[4] = {0, 1, 0, -1};
typedef vector<double> Vec;
typedef vector<int> vec;
typedef vector<Vec> MAT;
typedef vector<vec> mat;
lli MOD = 1000000007;
int main() {
    lli n,t;
    cin >> n >> t;
    lli a[100005];
    lli b[100005];
    lli c[100005];
 
    c[n] = 0;
    rep(i,n)cin >> a[i];
 
    b[0] =  a[0];
    rep(i,n-1)b[i+1] = min(b[i],a[i+1]);
    rrep(i,n)c[i] = max(c[i+1],a[i]);
    rep(i,n-1){
        cerr << b[i] << ' ' << c[i+1] << endl;
    }
    vector<pair<lli,pair<lli,lli>>> data;
    rep(i,n-1)data.push_back(make_pair(c[i+1]-b[i],make_pair(c[i+1],b[i])));
    sort(data.begin(),data.end());
    reverse(data.begin(),data.end());
    map<lli,lli> map1,map2;
    rep(i,min(t/2,n-1)){
        if(data[0].first == data[i].first) {
            map1[data[i].second.first]++;
            map2[data[i].second.first]++;
        }else{
            break;
        }
    }
    cout << min(map1.size(),map2.size())<<endl;
}
 
Submission

Compiler output:
a.cc:61:1: error: 'Submission' does not name a type
   61 | Submission
      | ^~~~~~~~~~
Language: C++

#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e10
using namespace std;

long long abs(long long a){
	return ((a>0)?a:-1*a);
}

int main(){
	long long n,t,high,low;
	cin>>n>>t;
	long long a[n],tmp[n];
	rep(i,n){
		cin>>a[i];
	}
	for(int i=n-1;i>=0;i--){
		if(i==n-1)tmp[i]=a[i];
		else{
			if(tmp[i+1]<a[i])tmp[i]=a[i];
			else tmp[i]=tmp[i+1];
		}
	}
	long long cnt=0,diff=0;
	int er;
	rep(i,n){
		if((tmp[i]-a[i])>diff){
			diff=abs(tmp[i]-a[i]);
			cnt=1;
		}else if((tmp[i]-a[i])==diff){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:33: error: call of overloaded 'abs(long long int)' is ambiguous
   29 |                         diff=abs(tmp[i]-a[i]);
      |                              ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:7:11: note: candidate: 'long long int abs(long long int)'
    7 | long long abs(long long a){
      |           ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(void){
	int n,i;
	ll a[100100],t,itr[100100],tmp=-1,cnt=0,dft=-1,ans;
	cin >> n >> t;
	(t+1)/=2;
	for(i=0; i<n; i++){
		cin >> a[i];
	}
	for(i=(n-1); i>=0; i--){
		if(tmp<a[i]){
			itr[i] = a[i];
			tmp = a[i];
		}else{
			itr[i] = tmp;
		}
		itr[i] -= a[i];
	}
	for(i=0; i<n; i++){
		dft = max(dft,itr[i]);
	}
	for(i=0; i<n; i++){
		if(dft==itr[i]){
			cnt++;
		}
	}
	ans = min(t,cnt);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: lvalue required as left operand of assignment
   13 |         (t+1)/=2;
      |         ~~^~~
Language: C++

#include <iostream>
using namespace std;

int town[100000];
int dis[100000];
int max=0;
int price=0;
int N;
int apple;
int ans;

int main() {
	cin >> N >> apple;
	for (int i = 0; i < N; i++) {
		cin >> town[i];
	}
	for (int i = N - 1; i >= 0; i--) {
		dis[i] = max - town[i];
		if (max < town[i])max = town[i];
	}
	dis[N - 1] = 0;
	for (int i = 0; i < N; i++) {
		if (price < dis[i])price = dis[i];
	}
	for (int i = 0; i < N; i++) {
		if (dis[i] == price)ans++;
	}
	cout << ans << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: reference to 'max' is ambiguous
   18 |                 dis[i] = max - town[i];
      |                          ^~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int max'
    6 | int max=0;
      |     ^~~
a.cc:19:21: error: reference to 'max' is ambiguous
   19 |                 if (max < town[i])max = town[i];
      |                     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int max'
    6 | int max=0;
      |     ^~~
a.cc:19:35: error: reference to 'max' is ambiguous
   19 |                 if (max < town[i])max = town[i];
      |                                   ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int max'
    6 | int max=0;
      |     ^~~
Language: C++

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul

mod = 10 ** 9 + 7
sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = I()
G = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = LI()
    G[a - 1] += [b - 1]
    G[b - 1] += [a - 1]

cond = [(-INF, INF) for _ in range(n)]
k = I()
for _ in range(k):
    v, p = LI()
    cond[v - 1] = (p, p)

ans = [0] * n
visited = [0] * n
def f(u):
    visited[u] = 1
    max_ret = cond[u][1]
    min_ret = cond[u][0]
    u_flg = max_ret % 2 if max_ret == min_ret else -1
    for v in G[u]:
        if visited[v]:
            continue
        x, y, flg = f(v)
        if flg != -1 and u_flg == flg:
            print("No")
            exit()
        max_ret = min(max_ret, y + 1)
        min_ret = max(min_ret, x - 1)
    if min_ret > max_ret:
        print("No")
        exit()
    cond[u] = (max_ret, min_ret)
    return min_ret, max_ret, u_flg

f(0)
print("Yes")
visited = [0] * n
ans = [-1] * n
ans[0] = cond[0][0]
def f2(u):
    visited[u] = 1
    for v in G[u]:
        if visited[v]:
            continue
        ans[v] = ans[u] + 1 if cond[v][0] <= ans[u] + 1 <= cond[v][1] else ans[u] - 1
        f2(v)

f2(0)
print(*ans, sep="\n")

Compiler output:
a.cc:20:62: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   20 | def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
      |                                                              ^~~~~~~
a.cc:21:61: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   21 | def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
      |                                                             ^~~~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import defaultdict, deque, Counter
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long N = 100010;
vector<long long> g[N];
long long a[N];

void ini() {
    for(long long i = 0; i < N; i++) {
        a[i] = -1;
    }
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        ini();
        long long n;
        cin >> n;
        for(long long i = 1; i < n; i++) {
            long long v, u;
            cin >> v >> u;
            g[v].push_back(u);
            g[u].push_back(v);
        }
        long long k, root;
        cin >> k;
        priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > >pq;
        for(long long i = 1; i <= k; i++) {
            long long idx, x;
            cin >> idx >> x;
            a[idx] = x;
            pq.push({x, idx});
        }
        while(!pq.empty()) {
            pair<long long, long long> p = pq.top();
            pq.pop();
            long long x = p.first, y = p.second;
            for(long long i = 0; i < g[y].size(); i++) {
                if(a[i] == -1) {
                    a[i] = x + 1;
                    pq.push({x + 1, i});
                }
                else if(a[z] != 0) {
                    if(abs(a[i] - x) != 1) {
                        cout << "No" << endl;
                        return 0;
                    }
                }
            }
        }
        cout << "Yes" << endl;;
        for(long long i = 1; i <= n; i++){
            cout << a[i] << endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:27: error: 'z' was not declared in this scope
   48 |                 else if(a[z] != 0) {
      |                           ^
Language: C++


void dfsr(int now,int p){
	ll ma = ans[now] + 1;
	ll mi = ans[now] - 1;
	fore(x, E[now]) {
		if (x != p) {
			if ((rec[now].first <= mi) && (mi <= rec[now].second))ans[x] = mi;
			else ans[x] = ma;
			dfsr(x, now);
		}
	}
}

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

	int N;
	cin >> N;
	for (int i = 0; i < N-1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].pb(b);
		E[b].pb(a);
	}
	int K;
	cin >> K;
	for (int i = 0; i < K; i++) {
		int v, p;
		cin >> v >> p;
		v--;
		num[v] = p;
		parity[v] = p % 2;
	}

	dfs(0,-1);
	ans[0] = rec[0].first;
	dfsr(0,-1);
	puts("Yes");
	for (int i = 0; i < N; i++)puts(ans[i]);


	return 0;
}

Compiler output:
a.cc: In function 'void dfsr(int, int)':
a.cc:3:9: error: 'll' was not declared in this scope
    3 |         ll ma = ans[now] + 1;
      |         ^~
a.cc:4:11: error: expected ';' before 'mi'
    4 |         ll mi = ans[now] - 1;
      |           ^~~
      |           ;
a.cc:5:14: error: 'x' was not declared in this scope
    5 |         fore(x, E[now]) {
      |              ^
a.cc:5:17: error: 'E' was not declared in this scope
    5 |         fore(x, E[now]) {
      |                 ^
a.cc:5:9: error: 'fore' was not declared in this scope
    5 |         fore(x, E[now]) {
      |         ^~~~
a.cc: In function 'int main()':
a.cc:15:9: error: 'ios' has not been declared
   15 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:16:9: error: 'cin' was not declared in this scope
   16 |         cin.tie(nullptr);
      |         ^~~
a.cc:24:17: error: 'E' was not declared in this scope
   24 |                 E[a].pb(b);
      |                 ^
a.cc:33:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   33 |                 num[v] = p;
      |                 ^~~
      |                 enum
a.cc:34:17: error: 'parity' was not declared in this scope
   34 |                 parity[v] = p % 2;
      |                 ^~~~~~
a.cc:37:9: error: 'dfs' was not declared in this scope; did you mean 'dfsr'?
   37 |         dfs(0,-1);
      |         ^~~
      |         dfsr
a.cc:38:9: error: 'ans' was not declared in this scope
   38 |         ans[0] = rec[0].first;
      |         ^~~
a.cc:38:18: error: 'rec' was not declared in this scope
   38 |         ans[0] = rec[0].first;
      |                  ^~~
a.cc:40:9: error: 'puts' was not declared in this scope
   40 |         puts("Yes");
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
struct edge{int to,cap,rev;};
vector<int> nex[114514];
int mi[114514],ma[114514],st;
int col[114514];
int used[114514];
int ans[114514];
int used2[114514];
bool fl = true;
pair<int,int> dfs(int s){
	used[s]=1;
	for(int i=0;i<nex[s].size();i++){
		int nx = nex[s][i];
		if(used[nx]==0){
			pair<int,int> P = dfs(nx);
			int lef = max(P.first-1,0LL);
			int rig = P.second+1;
			ma[s] = min(ma[s],rig);
			mi[s] = max(mi[s],lef);
		}
	}
	//cout<<2<<endl;
	return mp(mi[s],ma[s]);
}
signed main(){
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
		nex[x].pb(y);
		nex[y].pb(x);
	}
	for(int i=1;i<=n;i++){
		mi[i]=0;
		ma[i]=inf;
	}
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		int v,p;
		cin>>v>>p;
		mi[v] = p;
		ma[v] = p;
		col[v] = 2 - p%2;
		if(st == 0)st = v;
	}
	queue<int> que;
	que.push(st);
	while(!que.empty()){
		int idx = que.front(); que.pop();
		for(int i=0;i<nex[idx].size();i++){
			int nx = nex[idx][i];
			if( col[nx] == 0){
				col[nx] = 3 -col[idx];
				que.push(nx);
			}
			else if(col[idx] + col[nx] != 3){
				cout<<"No"<<endl;
				return 0;
			}
		}
		//cout<<1<<endl;
	}
	pair<int,int> tmp = dfs(st);
	if(fl == false){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<=n;i++){
		ans[i]=-1;
	}
	while(!que.empty()){que.pop();}
	que.push(st);
	ans[st]=mi[st];
	used2[st]=1;
	while(!que.empty()){
		int idx = que.front(); que.pop();
		for(int i=0;i<nex[idx].size();i++){
			int nx = nex[idx][i];
			if(used2[nx] == 0){
				used2[nx]=1;
				if(mi[nx] <= ans[idx]-1 && ans[idx]-1 <= ma[nx]){
					ans[nx] = ans[idx]-1;
				}
				else if(mi[nx] <= ans[idx]+1 && ans[idx]+1 <= ma[nx]){
					ans[nx] = ans[idx]+1;
				}
				if(ans[nx] == -1){
					cout<<"No"<<endl;
					return 0;
				}
				que.push(nx);
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(ans[i]==-1){
			cout<<"No"<<endl;
			return 0;
		}
	
	cout<<"Yes"<<endl;
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:114:2: error: expected '}' at end of input
  114 | }
      |  ^
a.cc:31:14: note: to match this '{'
   31 | signed main(){
      |              ^
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
struct edge{int to,cap,rev;};
vector<int> nex[114514];
int mi[114514],ma[114514],st;
int col[114514];
int used[114514];
int ans[114514];
int used2[114514];
bool fl = true;
pair<int,int> dfs(int s){
	used[s]=1;
	for(int i=0;i<nex[s].size();i++){
		int nx = nex[s][i];
		if(used[nx]==0){
			pair<int,int> P = dfs(nx);
			int lef = max(P.first-1,0LL);
			int rig = P.second+1;
			ma[s] = min(ma[s],rig);
			mi[s] = max(mi[s],lef);
		}
	}
	//cout<<2<<endl;
	return mp(mi[s],ma[s]);
}
signed main(){
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
		nex[x].pb(y);
		nex[y].pb(x);
	}
	for(int i=1;i<=n;i++){
		mi[i]=0;
		ma[i]=inf;
	}
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		int v,p;
		cin>>v>>p;
		mi[v] = p;
		ma[v] = p;
		col[v] = 2 - p%2;
		if(st == 0)st = v;
	}
	queue<int> que;
	que.push(st);
	while(!que.empty()){
		int idx = que.front(); que.pop();
		for(int i=0;i<nex[idx].size();i++){
			int nx = nex[idx][i];
			if( col[nx] == 0){
				col[nx] = 3 -col[idx];
				que.push(nx);
			}
			else if(col[idx] + col[nx] != 3){
				cout<<"No"<<endl;
				return 0;
			}
		}
		//cout<<1<<endl;
	}
	pair<int,int> tmp = dfs(st);
	if(fl == false){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<=n;i++){
		ans[i]=-1;
	}
	while(!que.empty()){que.pop();}
	que.push(st);
	ans[st]=mi[st];
	used2[st]=1;
	while(!que.empty()){
		int idx = que.front(); que.pop();
		for(int i=0;i<nex[idx].size();i++){
			int nx = nex[idx][i];
			if(used2[nx] == 0){
				used2[nx]=1;
				if(mi[nx] <= ans[idx]-1 && ans[idx]-1 <= ma[nx]){
					ans[nx] = ans[idx]-1;
				}
				else if(mi[nx] <= ans[idx]+1 && ans[idx]+1 <= ma[nx]){
					ans[nx] = ans[idx]+1;
				}
				if(ans[nx] == -1){
					cout<<"No"<<endl;
					return 0;
				}
				que.push(nx);
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(ans[i]==-1){
			cout<<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:105:31: error: expected primary-expression before '<' token
  105 |                         cout<<<"No"<<endl;
      |                               ^
a.cc:105:36: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
  105 |                         cout<<<"No"<<endl;
      |                                ~~~~^~~~~~