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

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

using namespace std;

char s[100000];

int max(int a,int b) {
	return (a < b) ? b : a;
}
int min(int a, int b) {
	return (a > b) ? b : a;
}

int main() {
	cin >> s;
	int mode;
	int num = 0;
	if (s[0] == 'B') {
		mode = 1;
	}
	else {
		mode = 2;
	}

	int	len = strlen(s);
	for (int i = 0; i < len;i++) {
		if (s[i] == 'B') {
			if (mode == 2) {
				mode = 1;
				num++;
			}
		}
		else {
			if (mode == 1) {
				mode = 2;
				num++;
			}
		}
	}
	
	printf("%d",num);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:23: error: 'strlen' was not declared in this scope
   27 |         int     len = strlen(s);
      |                       ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

/#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

int main() {

	string s;
	cin >> s;

	int cnt = 0;
	char p;
	rep(i, 0, s.length()) {
		if (i == 0) p = s[i];
		if (p != s[i]) {
			cnt++;
			p = s[i];
		}
	}
	cout << cnt << endl;

	return 0;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | /#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: expected unqualified-id before '/' token
    1 | /#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'string' was not declared in this scope
    7 |         string s;
      |         ^~~~~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> s;
      |         ^~~
a.cc:8:16: error: 's' was not declared in this scope
    8 |         cin >> s;
      |                ^
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout << cnt << endl;
      |         ^~~~
a.cc:19:24: error: 'endl' was not declared in this scope
   19 |         cout << cnt << endl;
      |                        ^~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String S = sc.next();
		// スペース区切りの整数の入力
		String sa[] = new String[S.length()];
		int counter = 0;
		for(int i=0; i<S.length(); i++){
			sa[i] = S.charAt(i);
			if(i > 1){
				if(sa[i].equals(sa[i-1])){
					
				}
				else{
					counter = counter + 1;
				}
			}
		}
		System.out.println(counter);
}
}

Compiler output:
Main.java:11: error: incompatible types: char cannot be converted to String
			sa[i] = S.charAt(i);
			                ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String S = sc.nextInt();
		// スペース区切りの整数の入力
		String sa[] = new String[S.length];
		int counter = 0;
		for(int i=0; i<S.length; i++){
			sa[i] = S.charAt(i);
			if(i > 1){
				if(sa[i].equals(sa[i-1])){
					
				}
				else{
					counter = counter + 1;
				}
			}
		}
		System.out.println(counter);
}
}

Compiler output:
Main.java:6: error: incompatible types: int cannot be converted to String
		String S = sc.nextInt();
		                     ^
Main.java:8: error: cannot find symbol
		String sa[] = new String[S.length];
		                          ^
  symbol:   variable length
  location: variable S of type String
Main.java:10: error: cannot find symbol
		for(int i=0; i<S.length; i++){
		                ^
  symbol:   variable length
  location: variable S of type String
Main.java:11: error: incompatible types: char cannot be converted to String
			sa[i] = S.charAt(i);
			                ^
4 errors
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <map>

using namespace std;


class Solution{

public:
    int min_cost(const vector<int>& A){

        map<int, int> freq;
        for(int start = 0, i = start + 1; i <= A.size(); i ++)
            if(i == A.size() || A[i] < A[i - 1]){
                freq[A[i - 1] - A[start]] ++;
                start = i;
                i = start;
            }

        assert(freq.rbegin()->first > 0);
        return freq.rbegin()->second;
    }
};

int main() {

    int N, T;
    scanf("%d%d", &N, &T);

    vector<int> A(N);
    for(int i = 0 ; i < N; i ++) scanf("%d", &A[i]);
    printf("%d\n", Solution().min_cost(A));

    return 0;
}


Compiler output:
a.cc: In member function 'int Solution::min_cost(const std::vector<int>&)':
a.cc:22:9: error: 'assert' was not declared in this scope
   22 |         assert(freq.rbegin()->first > 0);
      |         ^~~~~~
a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    4 | #include <map>
  +++ |+#include <cassert>
    5 |
Language: C++

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    map <int,int> cnt;
    int n,t; cin>>n>>t; 
    int  mn = INT_MAX, x, mx = 0 ; 
    for (int i=0;i<n;i++){
        cin >> x ; 
        mn = min(mn,x);
        cnt[x-mn]++;
        mx = max(mx,x-mn);
    }
    if (mx == 0){
        cout << 0 << endl;
        return ; 
    }
    cout << max(0LL,min(t/2LL,cnt[mx])) << endl ; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:37:15: error: 'INT_MAX' was not declared in this scope
   37 |     int  mn = INT_MAX, x, mx = 0 ;
      |               ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   17 | #include <functional>
  +++ |+#include <climits>
   18 | #define   mod  998244353
a.cc:39:16: error: 'x' was not declared in this scope
   39 |         cin >> x ;
      |                ^
a.cc:42:9: error: 'mx' was not declared in this scope; did you mean 'mn'?
   42 |         mx = max(mx,x-mn);
      |         ^~
      |         mn
a.cc:44:9: error: 'mx' was not declared in this scope; did you mean 'mn'?
   44 |     if (mx == 0){
      |         ^~
      |         mn
a.cc:48:35: error: 'mx' was not declared in this scope; did you mean 'mn'?
   48 |     cout << max(0LL,min(t/2LL,cnt[mx])) << endl ;
      |                                   ^~
      |                                   mn
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>

using namespace std;

const int MAX_N = 100000;

int N, T;
int A[MAX_N];
map<int, int, greater<int>> mp;

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

    cin >> N >> T;

    int minc = INT_MAX;

    for (int i = 0; i < N; i++) {
        cin >> A[i];
        minc = min(minc, A[i]);
        int bft = A[i] - minc;
        if (mp.count(bft)) {
            mp[bft]++;
        } else {
            mp.insert(make_pair(bft, 1));
        }
    }

    cout << mp.begin()->second << "\n";

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 'INT_MAX' was not declared in this scope
   25 |     int minc = INT_MAX;
      |                ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <queue>
  +++ |+#include <climits>
    9 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX],mx[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll n,MX=0,t;
    cin>>n>>t;
    for(int i=0; i<n; i++)
        cin>>arr[i];
    mx[n-1]=arr[n-1];
    for(int i=n-2; i>=0; i--)
        mx[i]=max(mx[i+1],arr[i]);
    map<ll,int>mp;
    for(int i=0; i<n-1; i++)
    {
        if(arr[i]>=mx[i+1])
            continue;
        ll prof=mx[i+1]-arr[i];
        prof*=(t/2);
        mp[prof]++;
        MX=max(MX,prof);
    }
    cout<<max(mp[MX],1ll)<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: no matching function for call to 'max(std::map<long long int, int>::mapped_type&, long long int)'
   37 |     cout<<max(mp[MX],1ll)<<endl;
      |           ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:37:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   37 |     cout<<max(mp[MX],1ll)<<endl;
      |           ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: '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:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:37:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   37 |     cout<<max(mp[MX],1ll)<<endl;
      |           ~~~^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;
int n,t,sum,maxn,maxn1,ans,a[100001];
int main()
{
    cin>>n>>t;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=n;i;i--)
    {
        maxn=max(a[i],maxn);
        sum=max(maxn-a[i],sum);
    }。
    for(int i=n;i;i--)
    {
        maxn1=max(a[i],maxn1);
        if(maxn1-a[i]==sum) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc:12:6: error: extended character 。 is not valid in an identifier
   12 |     }。
      |      ^
a.cc: In function 'int main()':
a.cc:12:6: error: '\U00003002' was not declared in this scope
   12 |     }。
      |      ^~
a.cc:13:17: error: 'i' was not declared in this scope
   13 |     for(int i=n;i;i--)
      |                 ^
Language: C++

//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,t;cin>>n>>t;
  vl a(n);
  rep(i,n)cin>>a[i];
  ll MIN=INF;
  ll MAX=0;
  vector<P>vec(n);
  vl diff(n);
  rep(i,n){
    MIN=min(MIN,a[i]);
    MAX=max(MAX,a[i]);
    diff[i]=MAX-MIN;
  }
  ll MINd=INF;
  rep(i,n)MINd=min(MINd,diff[i]);
  set<ll>S;
  rep(i,n){
    if(MINd==diff[i])S.insert(MIN[i]);
  }
  cout<<S.size()<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:34: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   32 |     if(MINd==diff[i])S.insert(MIN[i]);
      |                                  ^
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define DEBUG 1
#define ll         long long
#define REP(i, n) for (long long i = 0; i < (n); i++) 

//10 100
//7 10 4 5 9 3 6 8 2 1

//高橋くんは、 4-9 か 3-8を行う
//どちらかわからないので、青木くんは9と8のコストを下げる

//右から見ていって、最大の差を求めればよい
//最大の差を求めた後は、

int main(){
    int N,T;
    cin >> N >> T;
    vector <int> a(N);
    REP(i,N)cin >> a[i];
    vector <vector<pair<int,int>>> sa(N);

    //(左から見ていって)現状の最小値
    int be_min = MOD;

    int sa_max = 0;
    for(int i = 0; i < N; ++i)
    {
        if(be_min < a[i])continue;
        be_min = a[i];
        for(int j = i + 1; j < N; ++j)
        {
            if(sa_max > a[j] - a[i])continue;
            sa_max = max(sa_max, a[j] - a[i]);
            sa[i].push_back({a[j] - a[i], j});
        }
    }

    vector <int> cost(N, 0);
    for(int i = 0; i < N; ++i)
    {
        if(sa[i].size() == 0)continue;
        sort(sa[i].rbegin(),sa[i].rend());

        for(int j = 0; j < sa[i].size(); ++j)
        {
            if(sa_max == sa[i][j].first)cost[sa[i][j].second] = 1;
            else
            {
                break;
            }
        }
    }

    int res = 0;
    for(int i = 0; i < N; ++i)
    {
        if(cost[i] == 1)++res;
    }
    cout << res << endl;
    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:18: error: 'MOD' was not declared in this scope
   38 |     int be_min = MOD;
      |                  ^~~
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int nx[4]={0,1,-1,0};
int ny[4]={1,0,0,-1};
int main(){
  ll n,t;
  cin>>n>>t;
  vll a(n);
  rep(i,n) cin>>a[i];
  vll b(n);
  ll k=0;
  for(int i=n-1;i>=0:i--){
    k=max(k,a[i]);
    b[i]=k-a[i];
  }
  ll ans=0;
  sort(all(b));
  ll cu=b[n-1];
  for(int i=n-1;i>=0;i--){
    if(b[i]!=cu) break;
    ans++;
  }
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   47 |   for(int i=n-1;i>=0:i--){
      |                 ^
a.cc:47:21: error: expected ';' before ':' token
   47 |   for(int i=n-1;i>=0:i--){
      |                     ^
      |                     ;
a.cc:52:15: error: expected ')' before ';' token
   52 |   sort(all(b));
      |               ^
      |               )
a.cc:47:6: note: to match this '('
   47 |   for(int i=n-1;i>=0:i--){
      |      ^
a.cc:56:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |     ans++;
      |     ^~~
      |     abs
a.cc:58:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   58 |   COUT(ans);
      |        ^~~
a.cc:17:24: note: in definition of macro 'COUT'
   17 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	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] = Integer.parseInt(sc.next());
		int[] b = new int[n]; Arrays.fill(b, 0);
		int[] c = new int[n]; Arrays.fill(c, 0);
		//PriorityQueue<Integer> alr = new PriorityQueue<Integer>();
		try {
			boolean[] bool = new boolean[1000000001]; Arrays.fill(bool, false);

		} catch (Exception e) {

			System.out.println(-1);
		}
		int count = 0; int max = 0; int dis = 0; int ans = 0;
		for (int i = n-1; i >= 0; i--) {
			if(max < a[i]) {
				count = 1;
				max = a[i];
			}else if(max == a[i]){
				count++;
			}else {
				b[i] = max;
				c[i] = count;
				dis = Math.max(max-a[i], dis);
			}
		}

		for (int i = 0; i < n; i++) {
			/*if(alr.isEmpty()) {
				if(b[i]-a[i] == dis) {
					alr.add(b[i]);
					ans += c[i];
				}
			}else {
				if((b[i]-a[i]==dis)&&!(alr.contains(b[i]))) {
					alr.add(b[i]);
					ans += c[i];
				}
			}*/
			if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
				bool[b[i]] = true;
				ans += c[i];
			}
		}
		System.out.println(ans);
		sc.close();
	}
}

Compiler output:
Main.java:48: error: cannot find symbol
			if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
			                       ^
  symbol:   variable bool
  location: class Main
Main.java:49: error: cannot find symbol
				bool[b[i]] = true;
				^
  symbol:   variable bool
  location: class Main
2 errors
Language: Java

import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	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] = Integer.parseInt(sc.next());
		int[] b = new int[n]; Arrays.fill(b, 0);
		int[] c = new int[n]; Arrays.fill(c, 0);
		PriorityQueue<Integer> alr = new PriorityQueue<Integer>();
		boolean[] bool = new boolean[1000000000]; Arrays.fill(bool, false);
		int count = 0; int max = 0; int dis = 0; int ans = 0;
		for (int i = n-1; i >= 0; i--) {
			if(max < a[i]) {
				count = 1;
				max = a[i];
			}else if(max == a[i]){
				count++;
			}else {
				b[i] = max;
				c[i] = count;
				dis = Math.max(max-a[i], dis);
			}
		}
		for (int i = 0; i < n; i++) {
			/*if(alr.isEmpty()) {
				if(b[i]-a[i] == dis) {
					alr.add(b[i]);
					ans += c[i];
				}
			}else {
				if((b[i]-a[i]==dis)&&!(alr.contains(b[i]))) {
					alr.add(b[i]);
					ans += c[i];
				}
			}*/
			if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
				bool[b[i]] = true;
				ans += c[i];
			}
		}
		System.out.println(ans);
		sc.close();
	}

Compiler output:
Main.java:49: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#define N 100005
using namespace std;
int n, t;
int a[N];
int main() {
  cin>>n>>t;
  for (int i = 0; i < n; ++i) {
    cin>>a[i];
  }
  int minv = INT_MAX;
  int maxv = 0;
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      minv = min(minv, a[i]);
    } else {
      maxv = max(maxv, a[i] - minv);
      minv = min(minv, a[i]);
    }
  }
  int tot=0;
  minv = INT_MAX;
  for (int i = 0; i < n; ++i) {
    if (i == 0) minv = min(minv, a[i]);
    else {
      if (a[i] - minv == maxv) {
        tot++;
      }
      minv = min(minv, a[i]);
    }
  }
  cout<<tot<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'INT_MAX' was not declared in this scope
   14 |   int minv = INT_MAX;
      |              ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <set>
  +++ |+#include <climits>
    5 | #define N 100005
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
    int n,t,max=0,c=0,mc=1;
    short short int a[100010],b[100010];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=n-2;i>=0;i--){
        sort(b+i+1,b+i+2+c);
        c++;
        if(max==b[n-1]-a[i]){
            mc++;
        }
        if(max<b[n-1]-a[i]){
            max=b[n-1]-a[i];
            mc=1;
        }
    }
    cout<<mc;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
    6 |     short short int a[100010],b[100010];
      |           ^~~~~
      |           -----
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,t,max=0,c=0,mc=1;
    short short int a[100010],b[100010];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=n-2;i>=0;i--){
        sort(b+i+1,b+i+2+c);
        c++;
        if(max==b[n-1]-a[i]){
            mc++;
        }
        if(max<b[n-1]-a[i]){
            max=b[n-1]-a[i];
            mc=1;
        }
    }
    cout<<mc;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
    6 |     short short int a[100010],b[100010];
      |           ^~~~~
      |           -----
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,t,max=0,mc=1;
    short short int a[100010],b[100010];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=n-2,c=0;i>=0;i--,c++){
        sort(b+i+1,b+i+2+c);
        if(max==b[n-1]-a[i]){
            mc++;
        }
        if(max<b[n-1]-a[i]){
            max=b[n-1]-a[i];
            mc=1;
        }
    }
    cout<<mc;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
    6 |     short short int a[100010],b[100010];
      |           ^~~~~
      |           -----
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
int main(){
    long int n,t,max=0,mc=1;
    short short int a[100010],b[100010];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=n-2,c=0;i>=0;i--,c++){
        sort(b+i+1,b+i+2+c);
        if(max==b[n-1]-a[i]){
            mc++;
        }
        if(max<b[n-1]-a[i]){
            max=b[n-1]-a[i];
            mc=1;
        }
    }
    cout<<mc;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
    6 |     short short int a[100010],b[100010];
      |           ^~~~~
      |           -----
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,t,max=0,mc=1;
    short short int a[100010],b[100010];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=n-2,c=0;i>=0;i--,c++){
        sort(b+i+1,b+i+2+c);
        if(max==b[n-1]-a[i]){
            mc++;
        }
        if(max<b[n-1]-a[i]){
            max=b[n-1]-a[i];
            mc=1;
        }
    }
    if(t<mc){
        cout<<t;
    }
    else{
        cout<<mc;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
    6 |     short short int a[100010],b[100010];
      |           ^~~~~
      |           -----
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
    int n,t,max=0,mc=1;
    short short int a[100010],b[100010];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=n-2,c=0;i>=0;i--,c++){
        sort(b+i+1,b+i+2+c);
        if(max==b[n-1]-a[i]){
            mc++;
        }
        if(max<b[n-1]-a[i]){
            max=b[n-1]-a[i];
            mc=1;
        }
    }
    cout<<mc;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
    6 |     short short int a[100010],b[100010];
      |           ^~~~~
      |           -----
Language: C++

#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n,t,min=1000000009;
  cin>>n>>t;
  vector<int> a(n),b(n);
  std::map<int, int> mp;
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
    b[i] = (min>a[i] ? 0:a[i]-min); 
    min=std::min(min,a[i]);
    mp[b[i]]++;
  }
  sort(b.begin(), b.end());
  cout<<mp[b.back();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: expected ']' before ';' token
   19 |   cout<<mp[b.back();
      |                    ^
      |                    ]
Language: C++

N, T = map(int,input().split())
A = list(map(int,input().split()))
p = 0
ans = 1
for i in range(1, N):
    if p == A[i] - A[i-1]:
        ans += 1
    elif p < A[i] - A[i-1]:
        p = A[i] - A[i-1]
        ans = 1
print(ans)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, T = map(int,input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
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;
  long long a[n];
  cin>>n>>t;
  long long m[n],M[n];
  REP(i,n){
    cin>>a[i];
  }
  m[0]=a[0];
  M[n-1]=0;
  REP(i,n){
    if(i>0){
      if(a[i]<m[i-1]){
        m[i]=a[i];
      }
    }
  }
  for(int i=n-1;i>=1;i--){
    if(a[i]>M[i]){
      M[i-1]=a[i];
    }
  }
  long long dM=0;
  REP(i,n){
    dM = max(dM,M[i]-m[i]);
  }
  REP(i,n){
    
  
  return 0;
}



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

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
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;
  long long a[n];
  cin>>n>>t;
  long long Maximum=0;
  long long m[n],M[n];
  REP(i,n){
    cin>>a[i];
    if(i>0){
      Maximum=max(Maximum,a[i]);
    }
  }
  m[0]=a[0];
  M[0]=Maximum;
  M[n-1]=0;
  REP(i,n){
    if(i>0){
      if(a[i]<m[i-1]){
        m[i]=a[i];
      }
    }
  }
  for(int i=n-1;i>=1;i--){
    if(a[i]>M[i]){
      M[i-1]=a[i];
    }
  }
  long long dM=0;
  REP(i,n){
    dM = max(dM,M[i]-m[i]);
  }
  REP(i,n){
    
  
  return 0;
}



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

#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>

using namespace std;

using ll = long long;

void Print(vector<ll> nums)
{
	for (int i = 0; i < nums.size(); i++)
	{
		cout << nums[i] << " ";
	}
	cout << endl;
}
int main()
{
	int n, t;
	cin >> n >> t;
	vector<ll> prices(n);
	for (int i = 0; i < n; i++)
	{
		cin >> prices[i];
	}

	unordered_map<int, int> profits; // profit, cnt;

	ll min = pow(10, 10);
	ll min_index = 0;
	ll current_profit = 0;
	ll max_profit = -1LL * pow(10, 10);
	ll last_max_profit_bottom_index = -1;
	ll cnt = 0;

	for (ll i = 0; i < n; i++)
	{
		ll price = prices[i];
		if (min > price)
		{
			min = price;
			min_index = i;
		}

		current_profit = price - min;
		if (max_profit <= current_profit && ((i == n - 1) || prices[i + 1] <= prices[i]))
		{
			if (max_profit < current_profit)
			{
				cnt = 0;
			}

			max_profit = current_profit;
			if (last_max_profit_bottom_index != min_index)
			{
				cnt++;
			}
			last_max_profit_bottom_index = min_index;
		}

		// Print({min, min_index, cnt, price, current_profit, max_profit, last_max_profit_bottom_index});
	}

	cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: 'pow' was not declared in this scope
   32 |         ll min = pow(10, 10);
      |                  ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std; 

int main(void)
{ 
  cin.tie(0); 
  ios::sync_with_stdio(false); 
  
  int n,t,res=0; 
  vector <int> v; 
  
  cin >> n; 
  for(int i=0;i<n;i++) 
  { 
    cin >> t; 
    v.push_back(t); 
  } 
  
  int lo = v[0],hi=v[0];
  for(int i=1;i<n;i++) 
  { 
    if(v[i]<hi) 
    { 
      res++; 
      lo = v[i]; 
      hi = v[i]; 
    } 
    else 
    { 
      hi = v[i]; 
    } 
  } 
  
  if(lo!=hi) res++; 
  cout << res << endl; 
  return 0;
}




Compiler output:
a.cc:3:21: error: extended character   is not valid in an identifier
    3 | using namespace std; 
      |                     ^
a.cc:3:21: error: '\U000000a0' does not name a type
    3 | using namespace std; 
      |                     ^
Language: C++

#include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,t,res=0; vector <int> v; cin >> n; for(int i=0;i<n;i++) { cin >> t; v.push_back(t); } int lo = v[0],hi=v[0]; for(int i=1;i<n;i++) { if(v[i]<hi) { res++; lo = v[i]; hi = v[i]; } else { hi = v[i]; } } if(lo!=hi) res++; cout << res << endl; return 0; }


Compiler output:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,t,res=0; vector <int> v; cin >> n; for(int i=0;i<n;i++) { cin >> t; v.push_back(t); } int lo = v[0],hi=v[0]; for(int i=1;i<n;i++) { if(v[i]<hi) { res++; lo = v[i]; hi = v[i]; } else { hi = v[i]; } } if(lo!=hi) res++; cout << res << endl; return 0; }
      |                          ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    int n,t,res=0;
    vector <int> v;
  
    cin >> n;
    for(int i=0;i<n;i++)
    {
      cin >> t;
      v.push_back(t);
    }
  
    in lo = v[0],hi=v[0];
    for(int i=1;i<n;i++)
    {
         if(v[i]<hi)
         {
              res++;
              lo = v[i];
              hi = v[i];
         }
         else
         {
           hi = v[i];
         }
    }
  
  if(lo!=hi) res++;
  cout << res << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'in' was not declared in this scope; did you mean 'n'?
   20 |     in lo = v[0],hi=v[0];
      |     ^~
      |     n
a.cc:23:18: error: 'hi' was not declared in this scope; did you mean 'i'?
   23 |          if(v[i]<hi)
      |                  ^~
      |                  i
a.cc:26:15: error: 'lo' was not declared in this scope; did you mean 'log'?
   26 |               lo = v[i];
      |               ^~
      |               log
a.cc:35:6: error: 'lo' was not declared in this scope; did you mean 'log'?
   35 |   if(lo!=hi) res++;
      |      ^~
      |      log
a.cc:35:10: error: 'hi' was not declared in this scope
   35 |   if(lo!=hi) res++;
      |          ^~
Language: C++

#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;
int deco[1000];

void Sequence() {
	int n,t;
	cin >> n >> t;
	ll row = INF;
	ll rem = 0;
	int rc = 0;
	for (size_t i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		if (row > a) {
			rc = 1;
		}else if (row == a) {
			rc++;
		}
		row = min(a, row);
		if (i == 0) continue;

		if (rem < a - row) {
			rem = a - row;
		}

	}
	cout <<  << endl;
}
int main() {
	Sequence();
	return 0;
}



Compiler output:
a.cc:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
a.cc: In function 'void Sequence()':
a.cc:49:18: error: expected primary-expression before '<<' token
   49 |         cout <<  << endl;
      |                  ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N,T;
  cin >> N >> T;
  ll A[100010];
  for(int i=1;i<=N;i++){
    cin >> A[i];
  }
  ll ans=0;
  ll min_v=A[1];
  ll cost=0;
  for(int i=2;i<=N;i++){
    if(cost<A[i]-min_v){
      cost=A[i]-min_v;
      ans=1;
    }else if(cost==max_v-min_v){
      ans++;
    }
    min_v=min(min_v,A[i]);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: 'max_v' was not declared in this scope
   50 |     }else if(cost==max_v-min_v){
      |                    ^~~~~
Language: C++

include<bits/stdc++.h>

using namespace std;

int main(){
    int n,t,p,q=0,ans=0;
    bool x[1000000001]={0};
    scanf("%d %d",&n,&t);
    vector<int> a(n);
    for (auto&e:a) scanf("%d",&e);
    p=a[0];
    for (int i=1;i<n;i++) {
        p=min(p,a[i]);
        q=max(q,a[i]-p);
    }
    p=a[0];
    for (int i=1;i<n;i++) {
        x[a[i]]=1;
        if (a[i]-q>=0 && x[a[i]-q]==1) ans++;
        if (a[i]+q<=1000000000 && x[a[i]+q]==1) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'scanf' was not declared in this scope
    8 |     scanf("%d %d",&n,&t);
      |     ^~~~~
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> a(n);
      |     ^~~~~~
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> a(n);
      |            ^~~
a.cc:10:17: error: 'a' was not declared in this scope
   10 |     for (auto&e:a) scanf("%d",&e);
      |                 ^
a.cc:11:7: error: 'a' was not declared in this scope
   11 |     p=a[0];
      |       ^
a.cc:13:11: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |         p=min(p,a[i]);
      |           ^~~
      |           main
a.cc:14:11: error: 'max' was not declared in this scope
   14 |         q=max(q,a[i]-p);
      |           ^~~
a.cc:22:5: error: 'printf' was not declared in this scope
   22 |     printf("%d\n",ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<bits/stdc++.h>
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
	int n, t;
	cin >> n >> t;

	vector<int> a(n);
	vector<int> b(n);

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

	for (int i = 0; i < n; i++)
	{
		int max = 0;
		for (int j = i+1; j < n; j++)
		{
			if(a[j]-a[i] > max )
			{
				max = a[j] - a[i];
			}
		}
		b[i] = max;
	}

	sort(b.begin(), b.end());

	int s_max = b[n-1];
	int counter = 1;

	for (int i = n-2; i >= 0; i--)
	{
		if(s_max == b[i])
			counter++;
		else
			break;
	}

	cout << counter << endl;

	return 0;
}

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



#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,b) for(int i=0;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<=b;i++)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;

//差が最大になる区間を全て1減らすと、maxをとった結果が1下がる。
//前処理で区間ごとの最大値(最小値)を配列にいれる(公式解説)
//i<jにしか興味がないので、逐次更新する。解説ブログ等

int main() {

	//入力
	int n, t;
	cin >> n >> t;
	vector<int> a(n);
	for (auto& e : a) {
		cin >> e;
	}

	//ループ前の変数の初期化
	int max_diff = 0;
	int min_cost = INT_MAX;
	int cnt = 0;

	//最小値の右しか関係ない。
	//その時々の最小値との差だけ考えればいい。

	//差が更新されたら、それ以前のカウントは意味がなくなるので
	//１からやりなおせばいい。

	//りんごの数は無制限なので、Tは実は使わくてもよい。

	for (int i = 0; i < n; ++i) {
		min_cost = min(min_cost, a[i]);
		int diff = a[i] - min_cost;
		if (max_diff < diff) {
			cnt = 1;
			max_diff = diff;
		}
		else if (diff == max_diff) {
			++cnt;
		}
	}
	cout << cnt << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:24: error: 'INT_MAX' was not declared in this scope
   41 |         int min_cost = INT_MAX;
      |                        ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   15 | #include <iomanip>
  +++ |+#include <climits>
   16 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
#define debug(x) cerr << #x << ":" << x << endl;

int main()
{
  int N, T;
  cin >> N >> T;
  vector< int64 > a(N);
  for (int i = 0; i < N; ++i) cin >> a[i];
  map< int64, int64 > mp;
  int l = a[0];
  for (int i = 0; i < N; ++i) {
    if (i == N - 1) {
      mp[a[i] - l]++;
    } else if (a[i + 1] > a[i]) {
      l = min(l, a[i]);
    } else {
      // debug(a[i]);
      // debug(l);
      mp[a[i] - l]++;
      l = a[i + 1];
    }
  }

  int64 mx = 0, ans = 0;
  for (auto m : mp) {
    if (m.first > mx) ans = m.second;
  }

  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   18 |       l = min(l, a[i]);
      |           ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:18:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   18 |       l = min(l, a[i]);
      |           ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:18:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   18 |       l = min(l, a[i]);
      |           ~~~^~~~~~~~~
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


int
main(void){  
  ll n, t;
  cin >> n >> t;
  ll a[n];
  ll a_min, a_min_prev;
  int count = 0;
  REP(i, n){
    cin >> a[i];    
  }  
  ll diff_m=0LL;
  ll temp_m;
  a_min_prev = a[0];
  FOR(i, 1, n) {    
    a_min = min(a_min_prev, a[i]);
    temp_m = (a[i] - a_min[i-1]);
    if(temp_m > diff_m) {
      diff_m = temp_m;
      count = 1;
    }
    else if (temp_m == diff_m) {
      ++count;
    }
    a_min_prev = a_min;
  }
 
  cout << count << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:27: error: invalid types 'll {aka long long int}[int]' for array subscript
   56 |     temp_m = (a[i] - a_min[i-1]);
      |                           ^
Language: C++

int main(void) {
  int N,T;
  scanf("%d %d",&N,&T);


  int A,min=10000,ans=0,num=0;

  for (int i = 0; i < N; i++) {
    cin >> A;
    min = std::min(min,A);
    if (ans < A-min) {
      ans = A - min;
      num = 1;
    }else if(ans == A-min){
      num ++;
    }
  }
  printf("%d\n",num);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
    3 |   scanf("%d %d",&N,&T);
      |   ^~~~~
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'min'?
    9 |     cin >> A;
      |     ^~~
      |     min
a.cc:10:16: error: 'min' is not a member of 'std'
   10 |     min = std::min(min,A);
      |                ^~~
a.cc:18:3: error: 'printf' was not declared in this scope
   18 |   printf("%d\n",num);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void) {