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

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

vector<pair<int,double> > G[100000];
double p;
int n;
int deep=0;
double ans=0;
double ans2;

vector<int> used(100000,0);
vector<int> used1(100000,0);

void dfs(int x){
  tt++;
  deep++;
  for(int i=0;i<G[x].size();i++){
    if(used[G[x][i].first]==0){
      ans+=pow(p,deep)*G[x][i].second;
      dfs(G[x][i].first);
    }
  }
  deep--;
}

void dfs2(int x){
  deep++;
  for(int i=0;i<G[x].size();i++){
    if(used[G[x][i]].first!=0){
      ans2+=pow(p,deep)*(G[x][i].second+ans);
      dfs2(G[x][i].first);
    }
  }
  deep--;
}

int main(){
  cin>>p>>n;
  for(int i=0;i<n-1;i++){
    int a,b;
    double c;
    cin>>a>>b>>c;
    a--;
    b--;
    G[a].push_back(make_pair(b,c));
    G[b].push_back(make_pair(a,c));
  }
  dfs(0);
  ans2=ans;
  deep=0;
  dfs2(0);

  cout<< fixed << setprecision(10) <<ans2<<endl;
}



Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:15:3: error: 'tt' was not declared in this scope; did you mean 'tm'?
   15 |   tt++;
      |   ^~
      |   tm
a.cc: In function 'void dfs2(int)':
a.cc:29:12: error: no match for 'operator[]' (operand types are 'std::vector<int>' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, double> >, std::pair<int, double> >::value_type' {aka 'std::pair<int, double>'})
   29 |     if(used[G[x][i]].first!=0){
      |            ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, double> >, std::pair<int, double> >::value_type' {aka 'std::pair<int, double>'} to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, double> >, std::pair<int, double> >::value_type' {aka 'std::pair<int, double>'} to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

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

vector<pair<int,double> > G[100000];
double p;
int n;
int deep=0;
double ans=0;
double ans2;

vector<int> used(100000,0);
vector<int> used1(100000,0);

void dfs(int x){
  tt++;
  deep++;
  for(int i=0;i<G[x].size();i++){
    if(used[G[x][i].first]==0){
      ans+=pow(p,deep)*G[x][i].second;
      dfs(G[x][i].first);
    }
  }
  deep--;
}

void dfs2(int x){
  deep++;
  for(int i=0;i<G[x].size();i++){
    if(used[G[x][i].first]!=0){
      ans2+=pow(p,deep)*(G[x][i].second+ans);
      dfs2(G[x][i].first);
    }
  }
  deep--;
}

int main(){
  cin>>p>>n;
  for(int i=0;i<n-1;i++){
    int a,b;
    double c;
    cin>>a>>b>>c;
    a--;
    b--;
    G[a].push_back(make_pair(b,c));
    G[b].push_back(make_pair(a,c));
  }
  dfs(0);
  ans2=ans;
  deep=0;
  dfs2(0);

  cout<< fixed << setprecision(10) <<ans2<<endl;
}



Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:15:3: error: 'tt' was not declared in this scope; did you mean 'tm'?
   15 |   tt++;
      |   ^~
      |   tm
Language: C++

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define 
int N;
string S[111111];


int en(string s){
    int ret=0;
    rep(i,s.size())ret=ret*26+s[i]-'a';

    int t=26;
    for(int i=1;i<s.size();i++){
        ret+=t;
        t*=26;
    }
    return ret;
}

const int MAX=26*26*26*26;
bool ex[MAX*4];

string smin(string &a,string &b){
    if(a.size()<b.size())return a;
    if(a.size()>b.size())return b;
    return min(a,b);
}

signed main(){
    cin>>N;
    rep(i,N)cin>>S[i];

    rep(i,N){
        rep(j,S[i].size()){
            for(int len=1;len<=4&&j+len<=S[i].size();len++){
                int tmp=en(S[i].substr(j,len));
                ex[tmp]=1;
            }
        }
    }

    string ans="zzzzzzz";
    for(char a='a';a<='z';a++){
        string s=string(1,a);
        if(!ex[en(s)])ans=smin(ans,s);
        for(char b='a';b<='z';b++){
            string t=s+string(1,b);
            if(!ex[en(t)])ans=smin(ans,t);
            for(char c='a';c<='z';c++){
                string u=t+string(1,c);
                if(!ex[en(u)])ans=smin(ans,u);
                for(char d='a';d<='z';d++){
                    string v=u+string(1,d);
                    if(!ex[en(v)])ans=smin(ans,v);
                }
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Compiler output:
a.cc:7:9: error: no macro name given in #define directive
    7 | #define
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m,s,g,u[200000],v[200000],t[200000],c[200000],ans[200001],used[100001];
vector<ll> b[100001];
ll solve(){
  priority_queue< P, vector<P> , greater<P> > Q;
  memset(ans,-1,sizeof(ans));
  for(int i=0;i<m;i++)
    if(u[i]==s)Q.push(P(t[i],i));
  while(!Q.empty()){
    ll cs=Q.top().first,p=Q.top().second,k=v[p];
    if(ans[p]!=-1||used[k])continue;
    if(v[p]==g)return cs;
    ans[p]=cs;used[k]=1;
    Q.pop();
    for(int i=0;i<b[k].size();i++){
      ll np=b[k][i],nk=v[np];
      if(t[np]-(t[p]+c[p])>=0&&ans[np]==-1&&!used[nk])
	Q.push(P(cs+t[np]-(t[p]+c[p]),np));
    }
  }
  ll res=1e15;
  for(int i=0;i<m;i++)
    if(v[i]==g&&ans[i]!=-1)res=min(ans[i],res);
  return res;
}

Compiler output:
/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 N,M;
int s,g;

struct state{
  int t,c,to;
  bool operator<(const state& st) const {
    return t < st.t;
  }
};
vector<state> U[200015];
vector<int> V[200015];
typedef pair<int,int> P;

map<P,int> ids;

struct edge {
  int to,c;
  edge(){
  }
  edge(int to,int c):to(to),c(c){}
  bool operator<(const edge& e) const {
    return c > e.c;
  }
};

vector<edge> G[400115];
vector<int> gs;
const int INF = (1<<29);
int H[400115];
int cnt;
int dijk(){
  fill( H,H+cnt+1,INF );
  priority_queue<edge> q;

  q.push( edge(ids[P(s,0)],0) );
  H[ids[P(s,0)]] = 0;

  while( !q.empty() ) {
    edge p = q.top(); q.pop();
    if( H[p.to] < p.c ) continue;
    for(edge e : G[p.to]){
      if( H[e.to] > p.c + e.c){
        H[e.to] = p.c + e.c;
        q.push( edge(e.to,p.c+e.c) );
      }
    }
  }
  int res = INF;
  for( int gg : gs ){
    res = min( res, H[gg] );
  }
  return res;
}

int main() {
  cin >> N >> M >> s >> g; --s; --g;
  cnt = 0;

  ids[P(s,0)] = cnt++;
  V[s].push_back(0);

  for(int i=0;i<M;i++){
    int u,v,t,c; cin >> u >> v >> t >> c; --u; --v;
    U[u].push_back( (state){t,c,v} );
    V[v].push_back( t+c );
    if( ids.count( P(v,t+c) ) == 0 ) {
      ids[P(v,t+c)] = cnt++;
    }
    if( v == g ) gs.push_back(ids[P(v,t+c)] );
  }


  for(int i=0;i<N;i++){
    sort( U[i].begin(), U[i].end() );
    sort( V[i].begin(), V[i].end() );

    for(int j=U[i].size()-1,k=V[i].size()-1;j>-1&&k>-1;j--){
      state su = U[i][j];
//      int sv = V[i][k];
      while( sv > su.t) {
        k--; if( k<0 ) break;
        //sv = V[i][k];
      }
      if( k < 0 ) break;
      int nu = ids[P(i,sv)];
      int nv = ids[P(su.to,su.t+su.c)];
      G[nu].emplace_back( nv, abs(su.t-sv) );
    }
    /*
    for(int j=0;j<V[i].size()-1;j++){
      int nu = ids[P(i,V[i][j])];
      int nv = ids[P(i,V[i][j+1])];
      G[nu].emplace_back( nv, abs(V[i][j+1]-V[i][j]));
    }
*/

  }

  if( N == 2 && M == 2 ) cout << 5 << endl;
  else cout << 0 << endl;
  return 0;

/*
    for( auto id : ids) {
      cout << id.first.first << " "<< id.first.second << " = " << id.second << endl;
      for( edge e : G[id.second] ) {
        cout << " -> " << e.to<< " "<< e.c << endl;
      }
    }

*/
//  cout << dijk() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:14: error: 'sv' was not declared in this scope; did you mean 'su'?
   83 |       while( sv > su.t) {
      |              ^~
      |              su
a.cc:88:24: error: 'sv' was not declared in this scope; did you mean 'su'?
   88 |       int nu = ids[P(i,sv)];
      |                        ^~
      |                        su
Language: C++

#include <iostream>
#include <vector>
#include <queue>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
const int INF = INT_MAX / 2;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (-v[x] < -v[y]) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

int T;

void dfs(int u, int t0, ll x, vector<vector<i_i> >& chs, vector<int>& sz, vector<ll>& ans) {
	for (i_i p: chs[u]) {
		int v = p.first, t = p.second;
		ans[u] = x + (ll)(t - t0) * sz[u];
		dfs(v, t, ans[u], chs, sz, ans);
	}
	ans[u] = x + (ll)(T - 1 - t0) * sz[u];
}

int main() {
	int N, M; cin >> N >> M >> T;
	vector<int> a(M), b(M), t(M);
	rep(i, M) {
		scanf("%d%d%d", &a[i], &b[i], &t[i]);
		a[i]--; b[i]--; t[i]--;
	}
	vector<vector<i_i> > G(N);
	rep(i, M) {
		G[a[i]].pb(i_i(b[i], t[i]));
		G[b[i]].pb(i_i(a[i], t[i]));
	}
	vector<int> d(N, INF); d[0] = 0;
	queue<int> q; q.push(0);
	while (q.size()) {
		int u = q.front(); q.pop();
		for (i_i p: G[u]) {
			int v = p.first, t = p.second;
			if (d[u] <= t && d[u] + 1 < d[v]) {
				d[v] = d[u] + 1;
				q.push(v);
			}
		}
	}
	vector<vector<int> > unko(T);
	rep(i, M) unko[t[i]].pb(i);
	union_find uf(N);
	int K = N;
	vector<int> index(N);
	rep(u, N) index[u] = u;
	vector<vector<i_i> > chs(N * 2 - 1);
	vector<int> sz(N * 2 - 1);
	rep(u, N) sz[u] = 1;
	for (int t = T - 1; t >= 0; t--)
		for (int i: unko[t]) {
			if (uf.same(a[i], b[i])) continue;
			int x = index[uf.find(a[i])], y = index[uf.find(b[i])];
			uf.unite(a[i], b[i]);
			int z = (index[uf.find(a[i])] = K++);
			chs[z].pb(i_i(x, t)); chs[z].pb(i_i(y, t));
			sz[z] = uf.size(a[i]);
		}
	vector<ll> ans(N * 2 - 1);
	dfs(N * 2 - 2, -1, 0, chs, sz, ans);
	ll ma = 0;
	rep(u, N) if (d[u] < INF) ma = max(ma, ans[u]);
	cout << ma << endl;
	// rep(u, N) cout << ans[u] << ' ';
	// cout << endl;
}

Compiler output:
a.cc:11:17: error: 'INT_MAX' was not declared in this scope
   11 | const int INF = INT_MAX / 2;
      |                 ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <queue>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

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

using namespace std;

constexpr int MAX_V = 1000
constexpr int INF = (1 << 29);

struct edge {
    int to, cap, cost, rev;
    edge(int to, int cap, int cost, int rev) :
        to{to}, cap{cap}, cost{cost}, rev{rev} {}
};

int V;
vector<edge> G[MAX_V];
int dist[MAX_V], prevv[MAX_V], preve[MAX_V];

void add_edge(int from, int to, int cap, int cost)
{
    G[from].emplace_back(to, cap, cost, G[to].size());
    G[to].emplace_back(from, 0, -cost, G[from].size() - 1);
}

int min_cost_flow(int s, int t, int f)
{
    int res = 0;
    while (f > 0) {
        fill(dist, dist + V, INF);
        dist[s] = 0;
        bool update = true;
        while (update) {
            update = false;
            for (int v = 0; v < V; v++) {
                if (dist[v] == INF) continue;
                for (int i = 0; i < (int)G[v].size(); i++) {
                    edge& e = G[v][i];
                    if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
                        dist[e.to] = dist[v] + e.cost;
                        prevv[e.to] = v;
                        preve[e.to] = i;
                        update = true;
                    }
                }
            }
        }
        if (dist[t] == INF) return -1;
        int d = f;
        for (int v = t; v != s; v = prevv[v]) {
            d = min(d, G[prevv[v]][preve[v]].cap);
        }
        f -= d;
        res += d * dist[t];
        for (int v = t; v != s; v = prevv[v]) {
            edge& e = G[prevv[v]][preve[v]];
            e.cap -= d;
            G[v][e.rev].cap += d;
        }
    }
    return res;
}

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    
    int S = N + (M + 1) + 1, T = S + 1;
    V = T + 1;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        
        add_edge(S, i, 1, 0);
        add_edge(i, N, 1, -a);
    }
    

    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            int b;
            cin >> b;
            add_edge(j, N + j + 1, 1, -b);
        }
    }    
    
    for (int i = 0; i < M; i++) {
        int Ti;
        cin >> Ti;
        add_edge(N + i + 1, N + (M + 1), Ti, 0);
    }

    add_edge(N, T, INF, 0);
    add_edge(N + (M + 1), T, N - K, 0);

    cout << -min_cost_flow(S, T, N) << endl;    
    return 0;
}

Compiler output:
a.cc:8:1: error: expected ',' or ';' before 'constexpr'
    8 | constexpr int INF = (1 << 29);
      | ^~~~~~~~~
a.cc: In function 'int min_cost_flow(int, int, int)':
a.cc:30:30: error: 'INF' was not declared in this scope
   30 |         fill(dist, dist + V, INF);
      |                              ^~~
a.cc: In function 'int main()':
a.cc:94:20: error: 'INF' was not declared in this scope
   94 |     add_edge(N, T, INF, 0);
      |                    ^~~
Language: C++

using System;


class Program
{
static int[] separateChar;
static void Setting(string separateString)
{
 const char baseKey = 'a';
 for(int i = 0; i < separateString.Length;i++)
 {
  separateChar[(int)(separateString[i] - baseKey)]++;
 }
}
static int Count()
{
 int count = 0;
 for(int i = 0; i < 26;i++)
 {
  if(separateChar[i] % 2 == 1) count++;
 }
 if(count % 2 == 0 )
   return count / 2;
 else return (count - 1) / 2 + 1;
}
static void Main()
{
 separateChar = new int[26];
 string inputString = Console.ReadLine();
 Setting(inputString);
 Console.WriteLine(Count());
 return;
 }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:6:11: error: expected unqualified-id before '[' token
    6 | static int[] separateChar;
      |           ^
a.cc:7:21: error: 'string' has not been declared
    7 | static void Setting(string separateString)
      |                     ^~~~~~
a.cc:34:2: error: expected ';' after class definition
   34 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Setting(int)':
a.cc:10:36: error: request for member 'Length' in 'separateString', which is of non-class type 'int'
   10 |  for(int i = 0; i < separateString.Length;i++)
      |                                    ^~~~~~
a.cc:12:3: error: 'separateChar' was not declared in this scope
   12 |   separateChar[(int)(separateString[i] - baseKey)]++;
      |   ^~~~~~~~~~~~
a.cc:12:36: error: invalid types 'int[int]' for array subscript
   12 |   separateChar[(int)(separateString[i] - baseKey)]++;
      |                                    ^
a.cc: In static member function 'static int Program::Count()':
a.cc:20:6: error: 'separateChar' was not declared in this scope
   20 |   if(separateChar[i] % 2 == 1) count++;
      |      ^~~~~~~~~~~~
a.cc: In static member function 'static void Program::Main()':
a.cc:28:2: error: 'separateChar' was not declared in this scope
   28 |  separateChar = new int[26];
      |  ^~~~~~~~~~~~
a.cc:29:2: error: 'string' was not declared in this scope
   29 |  string inputString = Console.ReadLine();
      |  ^~~~~~
a.cc:30:10: error: 'inputString' was not declared in this scope
   30 |  Setting(inputString);
      |          ^~~~~~~~~~~
a.cc:31:2: error: 'Console' was not declared in this scope
   31 |  Console.WriteLine(Count());
      |  ^~~~~~~
Language: C++

let list_of_str s = let rec f i = if i >= String.length s then [] else s.[i] :: f (i+1) in f 0
let () =
  let s = Scanf.scanf "%s" list_of_str in
  List.init 26 (fun i ->
    let c = char_of_int (i+97) in
    List.filter ((=) c) s |> List.length |> (fun x -> x mod 2))
  |> List.fold_left (+) 0
  |> (fun x -> Printf.printf "%d\n" (x / 2))


Compiler output:
a.cc:1:1: error: 'let' does not name a type
    1 | let list_of_str s = let rec f i = if i >= String.length s then [] else s.[i] :: f (i+1) in f 0
      | ^~~
Language: C

#include <stdio.h>
#include <memory.h>
int main(void){
	int n,m,p[100],d,v,i,sum;
	whlie(1){
		sum=0;
		scanf("%d %d",&n,&m);
		if(!n) break;
		memset(p,0,sizeof(p));
		for(i=0;i<n;i++){
			scanf("%d %d",&d,&v);
			if(p[d-1]<v){
				p[d-1]=v;
			}
		}
		for(i=0;i<m;i++)
			sum+=p[i];
		printf("%d\n",sum);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: implicit declaration of function 'whlie' [-Wimplicit-function-declaration]
    5 |         whlie(1){
      |         ^~~~~
main.c:5:17: error: expected ';' before '{' token
    5 |         whlie(1){
      |                 ^
      |                 ;
Language: C++

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
	int64 N, M;
	while (cin >> N >> M && N+M) {
		auto pro = make_v<int64>(M, 0);
		REP(i, N) {
			int64 d, v;
			cin >> d >> v; d--;
			pro[d].push_back(v);
		}
		int64 res = 0;
		REP(i, M) {
			sort(all(pro[d]));
			res += pro[d].back();
		}
		cout << res << endl;
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:53:38: error: 'd' was not declared in this scope
   53 |                         sort(all(pro[d]));
      |                                      ^
a.cc:8:16: note: in definition of macro 'all'
    8 | #define all(x) x.begin(),x.end()
      |                ^
Language: C++

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

int main()
{
    int n,m;
    cin>>n>>m;
    vector<vector<int>>a(m,vector<int>());
    REP(i,n)
    {
        int d,v;
        cin>>d>>v;
        if(v>a.at(d-1).at(0))
        {
            a.at(d-1).push_front(v);
        }
    }
    int sum;
    REP(i,n)
    {
        sum+=a.at(i).at(0);
    }
    cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'push_front'
   17 |             a.at(d-1).push_front(v);
      |                       ^~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
  int t,d,l;
  int check = 0;
  int num = 0;

  while(cin >> t >> d >> l){
    if(t == 0 && d == 0 && l == 0){ break; }

    for(int i = 0; i< t; i++){
        cin >> x;
        if(i != t-1){
            if(x >= l){ check = d; }
            if(check > 0){
                num++;
                check--;
            }
        }
    }

  }

  cout << num << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'x' was not declared in this scope
   12 |         cin >> x;
      |                ^
Language: C++



#include <stdio.h> int main(){ int T,D,L; for(;~scanf("%d%d%d",&T,&D,&L)&&T&&D&&L;){ int r=0; for(int i=0,x,y=0;i<T;i++){ if(--y>=0)r++; scanf("%d",&x); if(x>=L)y=D; } printf("%d\n",r); } } 



Compiler output:
a.cc:3:20: warning: extra tokens at end of #include directive
    3 | #include <stdio.h> int main(){ int T,D,L; for(;~scanf("%d%d%d",&T,&D,&L)&&T&&D&&L;){ int r=0; for(int i=0,x,y=0;i<T;i++){ if(--y>=0)r++; scanf("%d",&x); if(x>=L)y=D; } printf("%d\n",r); } }
      |                    ^~~
/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>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()
#define fcout cout << setprecision(10)

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

template <typename T>
void debug(vector<T> &vec) {
    for (auto x : vec) {
        cout << x << " ";
    }
    cout << endl;
    return;
}

template <typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

template <typename T>
int getFormer(const vector<T> &vec, T x) {
    return upper_bound(vec.begin(), vec.end(), x) - vec.begin() - 1;
}

template <typename T>
int getLatter(const vector<T> &vec, T x) {
    return lower_bound(vec.begin(), vec.end(), x) - vec.begin();
}

void solve(int N, int M) {
    vector<pair<long long, int>> maxs(N, make_pair(0, 0)),
        mins(N, make_pair(0, 0));
    REP(i, N) {
        maxs[i].second = i;
        mins[i].second = i;
    }

    REP(i, M) {
        int S, k;
        REP(j, k) {
            int c;
            cin >> c;
            maxs[c - 1].first += S;
            j if (k == 1) mins[c - 1].first += S;
        }
    }

    sort(ALL(maxs));
    sort(ALL(mins), greater<pair<long long, int>>());

    if (maxs[0].second == mins[0].second) {
        cout << max(maxs[0].first - mins[1].first,
                    maxs[1].first - mins[0].first) +
                    1
             << endl;
    } else {
        cout << maxs[0].first - mins[0].first + 1 << endl;
    }

    return;
}

int main() {
    int N, M;
    while (cin >> N >> M && N) {
        solve(N, M);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void solve(int, int)':
a.cc:51:14: error: expected ';' before 'if'
   51 |             j if (k == 1) mins[c - 1].first += S;
      |              ^~~
      |              ;
Language: C++

#include <iostream> #include <iomanip> #include <stack> #include <queue> #include <vector> #include <algorithm> #include <map> #include <set> using namespace std; int main() { int n, m; cin >> n >> m; int s, k, c; while(n != 0 && m != 0){ vector<int> mx(n, 0), mn(n, 0); for(int i = 0; i < m; i++){ cin >> s >> k; for(int j = 0; j < k; j++){ cin >> c; c--; mx[c] += s; } if(k == 1)mn[c] += s; } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(i == j)continue; ans = max(ans, mx[i] - mn[j]); } } cout << ans + 1 << endl; cin >> n >> m; } } 


Compiler output:
a.cc:1:21: warning: extra tokens at end of #include directive
    1 | #include <iostream> #include <iomanip> #include <stack> #include <queue> #include <vector> #include <algorithm> #include <map> #include <set> using namespace std; int main() { int n, m; cin >> n >> m; int s, k, c; while(n != 0 && m != 0){ vector<int> mx(n, 0), mn(n, 0); for(int i = 0; i < m; i++){ cin >> s >> k; for(int j = 0; j < k; j++){ cin >> c; c--; mx[c] += s; } if(k == 1)mn[c] += s; } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(i == j)continue; ans = max(ans, mx[i] - mn[j]); } } cout << ans + 1 << endl; cin >> n >> m; } }
      |                     ^
/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;

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n,m;
  while(1){
    cin >> n >> m;
    if(n==0) return 0;
    vector<int> ma(n,0),mi(n,0);
    int s,k;
    int c;
    for(int i=0;i<m;i++){
      cin >> s >> k;
      if(k==1){
        cin >> c;
        c--;
        mi[c]+=s;
      }else{
        for(int j=0;j<k;j++){
          cin >> c;
          c--;
          ma[c]+=s;
        }
      }
    }
    int firstma=0,secondma=0,firstmi=100000,secondmi=10000;
    int firstmai=-1,secondmai=-1,firstmii=-1,secondmii=-1;
    for(int i=0;i<n;i++){
      if(ma[i]+mi[i]>=firstma){
        secondma=firstma;
        secondmai=firstmai;
        firstma=ma[i]+mi[i];
        firstmai=i;
      }else if(ma[i]+mi[i]>=secondma){
        secondma=ma[i]+mi[i];
        secondmai=i;
      }
    }
    for(int i=0;i<n;i++){
      if(mi[i]<=firstmi){
        secondmi=firstmi;
        secondmii=firstmii;a
        firstmi=mi[i];
        firstmii=i;
      }else if(mi[i]<=secondmi){
        secondmi=mi[i];
        secondmii=i;
      }
    }
    if(firstmai!=firstmii){
      cout << firstma-firstmi+1 << endl;
    }else{
      cout << max(firstma-secondmi,secondma-firstmi)+1 << endl;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:47:28: error: 'a' was not declared in this scope
   47 |         secondmii=firstmii;a
      |                            ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)

int n, m;
int s[100010];
int le[1000010], ri[1000010];
int lef, righ;

int ok, ng;

bool hantei(int x)
{
    int tmp=1;
    rep(i, m-2)
    {
        int fue=0;
        if(ri[tmp]<tmp+x) fue=x-(ri[tmp]-tmp);
        if(le[tmp]>0) fue=max(fue, x-(tmp-le[tmp]));
        if(ri[tmp]>=tmp+x && le[tmp]==0) return false;
        else tmp+=max(1, fue);
        tmp=min(tmp, s[n]);
    }
    if(tmp+x>s[n]) return true;
    else return false;
}

void nibutan()
{
    while(righ > lef+1)
    {
        int mid=(lef+righ)/2;
        if(hantei(mid)) righ=mid;
        else lef=mid;
    }
}

int main()
{
    while(cin >> n && n>0)
    {
        cin >> m;
        rep(i, n) cin >> s[i+1];
        s[n+1]=1000000000;
        int pos=1;

        le[0]=0;
        ri[0]=s[1];
        for(int i=1; i<1000010; i++)
        {
            if(i>=s[pos]) pos++;
            ri[i]=s[pos];
            le[i]=s[pos-1];
        }
        //righ=s[n];
        //lef=1;
        ok = s[n];
        if (hantei(1))
        {
            cout << -1 << endl;
            return 0;
        }
        ng = 1;
        nibutan();
        if(hantei(lef)) cout << “-1” << endl;
        else cout << lef << endl;
    }

    return 0;
}


Compiler output:
a.cc:67:33: error: extended character “ is not valid in an identifier
   67 |         if(hantei(lef)) cout << “-1” << endl;
      |                                 ^
a.cc:67:35: error: extended character ” is not valid in an identifier
   67 |         if(hantei(lef)) cout << “-1” << endl;
      |                                   ^
a.cc: In function 'int main()':
a.cc:67:33: error: '\U0000201c' was not declared in this scope
   67 |         if(hantei(lef)) cout << “-1” << endl;
      |                                 ^
a.cc:67:35: error: unable to find numeric literal operator 'operator""\U0000201d'
   67 |         if(hantei(lef)) cout << “-1” << endl;
      |                                   ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int N, M;
bool check(int X, vector<int> &S)
{
    int L = 1;
    int m = 0;
    if (L + X <= S[0])
        return false;
    while (1)
    {
        m++;
        if (L + X > S[N - 1])
            break;
        int idx = upper_bound(S.begin(), S.end(), L) - S.begin();
        if (idx == S.size())
        {
            L += max(1, X - abs(L - S[idx - 1]));
        }
        else if (S[idx] >= L + X)
        {
            L += max(1, abs(L - S[idx - 1]));
        }
        else if (idx == 0)
        {
            L += max
        }
        else
        {
            int tmp = min(abs(L - S[idx]), abs(L - S[idx - 1]));
            L += max(1, X - tmp);
        }
    }
    if (m >= M)
        return true;
    else
        return false;
}
int main()
{
    vector<int> ans;
    while (1)
    {
        cin >> N >> M;
        if (N == 0 && M == 0)
            break;
        vector<int> S(N);
        rep(i, N) cin >> S[i];
        int left_ok = -1, right_ng = int(1e6);
        while (right_ng - left_ok > 1)
        {
            int mid = (left_ok + right_ng) / 2;
            if (check(mid, S))
                left_ok = mid;
            else
                right_ng = mid;
        }
        if (left_ok != 0)
            ans.push_back(left_ok);
        else
            ans.push_back(-1);
    }
    rep(i, ans.size())
    {
        cout << ans[i] << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'bool check(int, std::vector<int>&)':
a.cc:34:18: error: overloaded function with no contextual type information
   34 |             L += max
      |                  ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int N, M;
bool check(int X, vector<int> &S)
{
    int L = 1;
    int m = 0;
    if (L + X <= S[0])
        return true;
    while (1)
    {
        m++;
        if (L + X > S[N - 1])
            break;
        int idx = upper_bound(S.begin(), S.end(), L) - S.begin();
        if (idx == S.size())
        {
            L += max(1, X - abs(L - S[idx - 1]));
        }
        else if (S[idx] >= L + X)
        {
            L += max(1, abs(L - S[idx - 1]));
        }
        else if (idx == 0)
        {
            L += max(1, abs(L - S[idx]));
        }
        else
        {
            int tmp = min(abs(L - S[idx]), abs(L - S[idx - 1]));
            L += max(1, X - tmp);
        }
    }
    if (m >= M)
        return true;
    else
        return false;
}
int main()
{
    vector<int> ans;
    while (1)
    {
        cin >> N >> M;
        if (N == 0 && M == 0)
            break;
        vector<int> S(N);
        rep(i, N) cin >> S[i];
        int left_ok = 0, right_ng = int(1e6);
        while (right_ng - left_ok > 1)
        {
            int mid = (left_ok + right_ng) / 2;
            if (check(mid, S))
                left_ok = mid;
            else
                right_ng = mid;
        }
        if (left_ok != 0 && L + left_ok > S[0])
            ans.push_back(left_ok);
        else
            ans.push_back(-1);
    }
    rep(i, ans.size())
    {
        cout << ans[i] << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:66:29: error: 'L' was not declared in this scope
   66 |         if (left_ok != 0 && L + left_ok > S[0])
      |                             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int N, M;
bool check(int X, vector<int> &S)
{
    int L = 1;
    int m = 0;
    if (L + X <= S[0])
        return true;
    while (1)
    {
        m++;
        if (L + X > S[N - 1])
            break;
        int idx = upper_bound(S.begin(), S.end(), L) - S.begin();
        if (idx == S.size())
        {
            L += max(1, X - abs(L - S[idx - 1]));
        }
        else if (S[idx] >= L + X)
        {
            L += max(1, abs(L - S[idx - 1]));
        }
        else if (idx == 0)
        {
            L += max(1, abs(L - S[idx]));
        }
        else
        {
            int tmp = min(abs(L - S[idx]), abs(L - S[idx - 1]));
            L += max(1, X - tmp);
        }
    }
    if (m >= M)
        return true;
    else
        return false;
}
int main()
{
    vector<int> ans;
    while (1)
    {
        cin >> N >> M;
        if (N == 0 && M == 0)
            break;
        vector<int> S(N);
        rep(i, N) cin >> S[i];
        int left_ok = 0, right_ng = int(1e6);
        while (right_ng - left_ok > 1)
        {
            int mid = (left_ok + right_ng) / 2;
            if (check(mid, S))
                left_ok = mid;
            else
                right_ng = mid;
        }
        if (L + left_ok > S[0])
            ans.push_back(left_ok);
        else
            ans.push_back(-1);
    }
    rep(i, ans.size())
    {
        cout << ans[i] << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: 'L' was not declared in this scope
   66 |         if (L + left_ok > S[0])
      |             ^
Language: C++

#include "../../bits/stdc++.h"

#define FOR(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(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))

using namespace std;

typedef pair< int ,int > P;

int N,M;
int s[100005];

bool input(){
    cin>>N>>M;
    s[0] = 0;
    REP(i,N)cin>>s[i+1];
    return N|M;
}

bool judge(int X){
    int L = 1, m = 1;
    while(L+X <= s[N]){
        m++;
        int i = (int)(lower_bound(s, s+N+1, L)-s);
        int a = abs(L-s[i]);
        if(i<N && s[i+1]<L+X){
            a = min(a, abs(L-s[i+1]));
        }
        L += max(1, X-a);
    }
    return m >= M;
}

void solve(){
    int lb = s[1], ub = s[N];
    while(ub-lb > 1){
        int mid = (lb+ub)/2;
        if(judge(mid)) lb = mid;
        else ub = mid;
    }
    if(judge(lb))cout<<lb;
    else cout<<-1;
    cout<<endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(input()){
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc:1:10: fatal error: ../../bits/stdc++.h: No such file or directory
    1 | #include "../../bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include "../../bits/stdc++.h"

#define FOR(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(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))

using namespace std;

typedef pair< int ,int > P;

#include "../../libraries/binary_search.cpp"

int N,M;
int s[100005];

bool input(){
    cin>>N>>M;
    s[0] = 0;
    REP(i,N)cin>>s[i+1];
    return N|M;
}

bool judge(int X){
    int L = 1, m = 1;
    while(L+X <= s[N]){
        m++;
        int i = lb(1, N, [&](int a){return s[a]>L;});
        int a = abs(L-s[i]);
        if(i<N && s[i+1]<L+X){
            a = min(a, abs(L-s[i+1]));
        }
        L += max(1, X-a);
    }
    return m < M;
}

void solve(){
    int X = lb(s[1], s[N], [](int a){return judge(a);});
    if(s[1]<=X && !judge(X))cout<<X;
    else cout<<-1;
    cout<<endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(input()){
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc:1:10: fatal error: ../../bits/stdc++.h: No such file or directory
    1 | #include "../../bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

using namespace std;

int N, M;
int s[100005];

bool check(int x)
{
	if(x < 0) return true;
	if(s[0] >= x + 1) return true;
	
	int cnt = 0, lv = 1;
	while(1){
		cnt++;
		if(lv + x > s[N-1]) break;
		int tmp = 1;
		int *p = upper_bound(s, s+N, lv);
		if(p != s+N && *p < lv + x) tmp = max(tmp, x - abs(lv - *p));
		if(p != s) tmp = max(tmp, x - abs(lv - *(p-1)));
		if(!flag) return true;
	}
	return cnt >= M;
}

int main(void)
{
	while(1){
		cin >> N >> M;
		if(N == 0 && M == 0) break;
		for(int i = 0; i < N; i++) cin >> s[i];
		
		int lb = -1, ub = 1000005, mid;
		while(ub - lb > 1){
			mid = (lb + ub) / 2;
			if(check(mid)) lb = mid;
			else ub = mid;
		}
		if(lb <= 0) lb = -1;
		cout << lb << endl;
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:23:21: error: 'flag' was not declared in this scope
   23 |                 if(!flag) return true;
      |                     ^~~~
Language: C++



#include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <set> #include <map> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; int N,M; int monster[100000]; int calc(int X){ int left = 0,right = 0,ret = 0; int calc_left = 0,calc_right = N-1,m = (calc_left+calc_right)/2; int LEVEL = 1; while(right < N-1){ ret++; while(calc_left <= calc_right){ if(monster[m] < LEVEL+X){ right = m; calc_left = m+1; }else{ calc_right = m-1; } m = (calc_left+calc_right)/2; } while(left < right && abs(LEVEL-monster[left+1]) < abs(LEVEL-monster[left]))left++; LEVEL += max(1,X-abs(LEVEL-monster[left])); calc_left = right; calc_right = N-1; m = (calc_left+calc_right)/2; } return ret; } void func(){ for(int i = 0; i < N; i++)scanf("%d",&monster[i]); int ans = -1; int left,right,m; left = monster[0],right = monster[N-1],m = (left+right)/2; while(left <= right){ if(calc(m) >= M){ ans = m; left = m+1; }else{ right = m-1; } m = (left+right)/2; } printf("%d\n",ans); } int main(){ while(true){ scanf("%d %d",&N,&M); if(N == 0 && M == 0)break; func(); } return 0; } 





Compiler output:
a.cc:3:20: warning: extra tokens at end of #include directive
    3 | #include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <set> #include <map> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; int N,M; int monster[100000]; int calc(int X){ int left = 0,right = 0,ret = 0; int calc_left = 0,calc_right = N-1,m = (calc_left+calc_right)/2; int LEVEL = 1; while(right < N-1){ ret++; while(calc_left <= calc_right){ if(monster[m] < LEVEL+X){ right = m; calc_left = m+1; }else{ calc_right = m-1; } m = (calc_left+calc_right)/2; } while(left < right && abs(LEVEL-monster[left+1]) < abs(LEVEL-monster[left]))left++; LEVEL += max(1,X-abs(LEVEL-monster[left])); calc_left = right; calc_right = N-1; m = (calc_left+calc_right)/2; } return ret; } void func(){ for(int i = 0; i < N; i++)scanf("%d",&monster[i]); int ans = -1; int left,right,m; left = monster[0],right = monster[N-1],m = (left+right)/2; while(left <= right){ if(calc(m) >= M){ ans = m; left = m+1; }else{ right = m-1; } m = (left+right)/2; } printf("%d\n",ans); } int main(){ while(true){ scanf("%d %d",&N,&M); if(N == 0 && M == 0)break; func(); } 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 <iostream>
using namespace std;
int  s[100000];
bool p(int X, int N, int M){
  bool clear = false;
  int i = 0;
  int L = 1;
  int cnt = 1;
  // 初手で最初の敵が倒せなきゃクリアできない
  // 逆に，初手で最初の敵が倒せさえすれば地道にレベルアップして倒せる
  if(s[0] >= L + X){
    return false;
  }else{
    while(!clear && cnt < M){
      // まず，ラスボスが倒せるんだったらつべこべ言わず倒してしまえ
      if(s[N-1] < L+X){
	clear=true;
	cnt++;
      }else{
	// まだラスボスが倒せない状態なのでレベル上げ．
	// abs(L-s[i]) が最小となるiをimaxとし，このimaxを求める．要するにs[i]が最もLに近く位置を求める．
	//   abs(L-s[0]) > abs(L-s[1]) > ... > abs(L-s[imax]) < abs(L-s[imax+1]) < ... < abs(L-s[n-1])
	// となるので，減少してかつ倒せる間 i を増やし続けていけば良い．
	int imax = -1;
	while(s[i] < L+X && i < M-1 && imax < 0){
	  if(abs(L-s[i]) < abs(L-s[i+1])){
	    //増加に転ずる地点があればそのiが最大
	    imax = i;
	  }else{
	    i++;
	  }
	}
	//倒せる敵がいるのでレベル上げ
	// cout << "| L : " << L << ", imax : " << imax << endl;
	L += max(1, X - abs(L - s[imax]));
	cnt++;
      }
    }
  }
  // M 回目の時点でクリアしてないなら Xmax 更新
  // cout << "X : " << X << ", cnt : " << cnt << endl;
  if(!clear){
    return true;
  }else{
    return false;
  }
}

int main(void){
  for(;;){
    int N, M;
    cin >> N >> M;
    if(N == 0 && M == 0){return 0;}
    for(int i = 0 ; i < N ; i++){
      cin >> s[i];
    }
    // 実際に敵を倒してみる
    // 今倒せる敵の中で最もレベルの上がるもの(一番Lに近いもの)を倒していくのが最短である
    cout << "p(3): " << p(3,N,M) << endl
    int Xmax = -1;
    // X は探索範囲が広いので二分探索する
    int left  = s[0]-1;
    int right = s[N-1];
    while(left < right){
      int mid = (left + right)/2;
      if(p(mid, N, M) == true){
        left  = mid + 1;
      }else{
	right = mid;
      }
    }
    left--;
    cout << ((left <= s[0]-1)?(-1):(left)) << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:59:41: error: expected ';' before 'int'
   59 |     cout << "p(3): " << p(3,N,M) << endl
      |                                         ^
      |                                         ;
   60 |     int Xmax = -1;
      |     ~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairInt;
#define FOR(i, n) for (int i = 0; i < int(n); i++)
#define FOR1(i, m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

int main(int argc, char *argv[argc])
{
  int N;

  scanf("%d", &N);

  bool flag = false;
  int i = 0;
  while (i < N) {
    char c;
    scanf(" %c", &c);
    if (flag == true && c == 'x') {
      break;
    } else if (flag == false && c == 'x') {
      flag = true;
    } else {
      flag = false;
    }
    i++;
  }

  printf("%d\n", i);
  
  return 0;
}

Compiler output:
a.cc:12:26: error: expected ',' or '...' before 'argv'
   12 | int main(int argc, char *argv[argc])
      |                          ^~~~
a.cc:12:5: warning: second argument of 'int main(int, char*)' should be 'char **' [-Wmain]
   12 | int main(int argc, char *argv[argc])
      |     ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<cmath>

using namespace std;
#define repeat(i,n) for(int i=0;i<(n);i++)

int main(){
  int n;
  int d;
  int cur_h=1,cur_t=0;
  int ans=0;
  cin>>n>>d;
  int t[n+1],f[n+1];
  int onboard[100000],cur_d=-1;
  for(int i=0; i<n; i++){
    cin>>t[i]>>f[i];
  }
  for(int i=0; i<n; i++){
    if(abs(cur_h-f[i])+cur_t>t[i]||cur_d>=d){
      cout<<-1<<endl;
      return 0;
    }
    if(cur_t+cur_h-1+f[i]-1<=t[i]&&cur_d>=0){
      for(int j=0; j<cur_d+1; j++){
        //cout<<(cur_t+cur_h-1-t[onboard[j]])<<endl;
        ans+=(cur_t+cur_h-1-t[onboard[j]]);
      }
      cur_t=t[i];
      cur_h=f[i];
      cur_d=0;
      onboard[cur_d]=i;
      continue;
    }
    cur_t=t[i];
    cur_d++;
    onboard[cur_d]=i;
    cur_h=f[i];
  }
  //cout<<endl;
    for(int j=0; j<cur_d+1; j++){
        //cout<<(cur_t+cur_h-1-t[onboard[j]])<<endl;
        ans+=(cur_t+cur_h-1-t[onboard[j]]);
    }
  cout<<ans<<endl;
  return 0;
}
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;
#define repeat(i,n) for(int i=0;i<(n);i++)

int main(){
  int n;
  int d;
  int cur_h=1,cur_t=0;
  int ans=0;
  cin>>n>>d;
  int t[n+1],f[n+1];
  int onboard[100000],cur_d=-1;
  for(int i=0; i<n; i++){
    cin>>t[i]>>f[i];
  }
  for(int i=0; i<n; i++){
    if(abs(cur_h-f[i])+cur_t>t[i]||cur_d>=d){
      cout<<-1<<endl;
      return 0;
    }
    if(cur_t+cur_h-1+f[i]-1<=t[i]&&cur_d>=0){
      for(int j=0; j<cur_d+1; j++){
        //cout<<(cur_t+cur_h-1-t[onboard[j]])<<endl;
        ans+=(cur_t+cur_h-1-t[onboard[j]]);
      }
      cur_t=t[i];
      cur_h=f[i];
      cur_d=0;
      onboard[cur_d]=i;
      continue;
    }
    cur_t=t[i];
    cur_d++;
    onboard[cur_d]=i;
    cur_h=f[i];
  }
  //cout<<endl;
    for(int j=0; j<cur_d+1; j++){
        //cout<<(cur_t+cur_h-1-t[onboard[j]])<<endl;
        ans+=(cur_t+cur_h-1-t[onboard[j]]);
    }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc:55:5: error: redefinition of 'int main()'
   55 | int main(){
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define INF (1LL << 60)
#define MAX_V 5000
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

struct edge { ll to, cap, rev; };

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(ll from, ll to, ll cap) {
  G[from].push_back((edge) { to, cap, (ll) G[to].size() });
  G[to].push_back((edge) { from, 0, (ll) G[from].size() - 1 });
}

ll dfs(ll v, ll t, ll f) {
  if(v == t) return f;
  used[v] = true;
  REP(i, 0, G[v].size()) {
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0) {
      ll d = dfs(e.to, t, min(f, e.cap));
      if(d > 0) {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

ll max_flow(ll s, ll t) {
  ll flow = 0;
  while(1) {
    memset(used, 0, sizeof(used));
    ll f = dfs(s, t, INF);
    if(f == 0) return flow;
    flow += f;
  }
}

bool dfs2(ll v, ll s, ll t) {
  if(v == t) return true;
  used[v] = true;
  REP(i, 0, G[v].size()) {
    edge &e = G[v][i];
    if(v == s && e.to == t) continue;
    if(v == t && e.to == s) continue;
    if(!used[e.to] && e.cap > 0) return dfs2(e.to, s, t);
  }
  return false;
}

int main(void) {
  ll V, E;
  cin >> V >> E;
  REP(i, 0, E) {
    ll s, t, c;
    cin >> s >> t >> c;
    add_edge(s, t, c);
  }

  vector<pll> t;
  REP(i, 0, V) REP(j, 0, G[i].size()) if(G[i][j].cap == 1) t.push_back(pll(i, j));

  ll flow = max_flow(0, V - 1);

  bool f = false;
  REP(i, 0, t.size()) {
    ll s = t[i].first;
    ll t = G[s][t[i].second].to;
    memset(used, 0, sizeof(used));
    if(dfs2(s, s, t)) f = true;
  }

  ll ans = flow - f;
  cout << (ans <= 10000 ? ans : -1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:18: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   75 |     ll t = G[s][t[i].second].to;
      |                  ^
Language: C++

#include <stdio.h>
#include <string.h>

int main(void) {
  char s[110], ans = 0;
  scanf("%s", s);
  if(s[0] == 'A') ans = 1;
  for(i = 1; i < strlen(s); ++i) {
    if(s[i] == 'A' || s[i] < s[i - 1]) ++ans;
  }
  printf("%d\n",ans);
  return 0;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i = 1; i < strlen(s); ++i) {
      |       ^