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

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

int main() {
    int n;
    cin >> n;
    vector<pair<string, long long>> inp;
    for (int i = 0; i < n; ++i) {
        string s;
        long long p;
        cin >> s >> p;
        inp.push_back(make_pair(s, p));
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; ++i) {
        char c;
        string s;
        cin >> c >> s;
        if (c == '+') {
            long long p;
            cin >> p;
            inp.push_back(make_pair(s, p));
        }
        else {
            inp.push_back(make_pair(s, -1LL));
        }
    }
    set<long long> se;
    for (int i = 0; i < n + m; ++i) {
        if (inp[i].second == -1) continue;
        inp[i].second = inp[i].second * (n + m) + i;
        se.insert(inp[i].second);
    }
    map<long long, int> _mp;
    int c = n + m + 5;
    for (auto i : se) {
        _mp[i] = --c;
    }
    map<string, int> mp;
    vector<string> getname(n + m + 9);
    BIT bit(n + m + 9);
    for (int i = 0; i < n; ++i) {
        mp[inp[i].first] = _mp[inp[i].second];
        getname[mp[inp[i].first]] = inp[i].first;
        bit.add(mp[inp[i].first], 1);
    }
    int sz = n;
    int lowwork = bit.lowerbound(sz / 5) - 1;
    for (int i = n; i < n + m; ++i) {
        if (inp[i].second != -1) {
            mp[inp[i].first] = _mp[inp[i].second];
            getname[mp[inp[i].first]] = inp[i].first;
            bit.add(mp[inp[i].first], 1);
            ++sz;
            int lw = bit.lowerbound(sz / 5) - 1;
            if (mp[inp[i].first] <= lw) {
                cout << inp[i].first << " is working hard now.\n";
            }
            else {
                cout << inp[i].first << " is not working now.\n";
            }
            if (lw != lowwork) {
                if (lw > lowwork) {
                    if (inp[i].first != getname[lw])
                        cout << getname[lw] << " is working hard now.\n";

                }
                else {
                    cout << getname[lowwork] << " is not working now.\n";
                }

                lowwork = lw;
            }
        }
        else {
            bit.add(mp[inp[i].first], -1);
            --sz;
            int lw = bit.lowerbound(sz / 5) - 1;
            if (lw != lowwork) {
                if (lw > lowwork) {
                    cout << getname[lw] << " is working hard now.\n";
                }
                else {
                    if (inp[i].first != getname[lowwork])
                        cout << getname[lowwork] << " is not working now.\n";
                }

                lowwork = lw;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:5: error: 'BIT' was not declared in this scope
   42 |     BIT bit(n + m + 9);
      |     ^~~
a.cc:46:9: error: 'bit' was not declared in this scope
   46 |         bit.add(mp[inp[i].first], 1);
      |         ^~~
a.cc:49:19: error: 'bit' was not declared in this scope
   49 |     int lowwork = bit.lowerbound(sz / 5) - 1;
      |                   ^~~
Language: C

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	long long a,temp;
	scanf("%I64d",&a);
	int num=1;
	while(1){
		temp=(num+1)*num/2;
		if(temp>=a) break;
		num++;
	}
	if(temp==a){
		for(int i=1;i<=num;i++)
			printf(")");
		for(int i=1;i<=num;i++)
			printf("(");
		printf("\n");
	}
	else {
		long long temp2=temp-a-1;
		for(int i=1;i<=num;i++){
			if(i==num-temp2) printf("(");
			printf(")");
		}
		for(int i=1;i<num;i++){
			printf("(");
		}
		printf("\n");
	}
}

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

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6+10;
vector<int>g[maxn];
int depth[maxn];
long long cnt[maxn];
void dfs(int s)
{
	for(int i=0;i<g[s].size();i++)
	{
		depth[g[s][i]] = depth[s]+1;
		dfs(g[s][i]);
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	int a,b;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		g[a].push_back(b);
	}
	depth[1] = 0;
	dfs(1);
	for(int i=1;i<=n;i++)
	{
		cnt[depth[i]]++;
	}
	long long ans = 0;
	for(int i=1;i<=n;i++)
	{
	
		long long tmp = cnt[i]*(cnt[i]-1);
		tmp/=2;
		ans+=tmp;
	}
	cout<<ans<<endl;
	return 0; 
 } 

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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<set>
#include<map>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define fi first
#define se second
#define dbg(...) cerr<<"["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"<<endl;
typedef vector<int> VI;
typedef long long ll;
typedef pair<double,int> PII;
const ll p=998244353;
const ll mod=1e9+7;
const int maxn=1e5+100;
map<ll,int> mp;

struct node
{
    int to,next;
}e[maxn*2];

int tol=0;
int head[maxn];
void add(int u,int v)
{
    e[++tol].to=v,e[tol].next=head[u],head[u]=tol;
}
ll dfs(int u,int f)
{
    ll ans=1;
    for(int i=head[u];i;i=e[i].next)
    {
        int v=e[i].to;
        if(v==f) continue;
        ans=(ans+dfs(v,u)*mod%p)%p;
    }
    mp[ans]++;
    return ans;
}


int main()
{
    int n;
    scanf("%d",&n);
    rep(i,1,n)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        add(u,v),add(v,u);
    }
    mp.clear();
    dfs(1,0);
    ll ans=0;
    map<ll,int>::iterator it;
    for(it=mp.begin();it!=mp.end();it++) ans+=1ll*(it->se)*(it->se-1)/2;
    printf("%lld\n",ans);
    return 0;
}

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

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <stack>
#include <vector>
using namespace std;
 

typedef long long ll;

const int maxn = 1e5+10;
const ll p = 9901;

int n,m,k;
ll has[maxn];
vector<int>edg[maxn];
map<ll,ll>mp;
map<ll,ll>::iterator it;
void dfs(int u,int fa){
    has[u]=1;
    for(int v:edg[u]){
        dfs(v,u);
        has[u]=(has[u]+has[v]*p)%mod;
    }
    mp[has[u]]++;
}
int main()
{
    int u,v;
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        scanf("%d%d",&u,&v);
        edg[u].push_back(v);
    }
    dfs(1,0);
    ll ans=0;
    for(it =mp.begin();it!=mp.end();it++){
        ans+=(it->second-1)*it->second/2;
    }
    printf("%lld\n",ans);
    return 0;
}




Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:28:34: error: 'mod' was not declared in this scope; did you mean 'modf'?
   28 |         has[u]=(has[u]+has[v]*p)%mod;
      |                                  ^~~
      |                                  modf
Language: C++

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef unsigned long long ull;
int n,a,c;
ull b=21387612863821
ull ans;
map<ull,ull>m;
vector<int>v[100009];
ull dfs(int x){
  ull res=1;
  r(i,v[x].size()) res*=dfs(v[x][i]);
  res*=b;
  //cout<<x<<' '<<m[res]<<endl;
  ans+=m[res]++;
  return res;
}
signed main(){
  cin>>n;
  r(i,n-1){
    cin>>a>>c;
    v[a].push_back(c);
  }
  dfs(1);
  cout<<ans<<endl;
}


Compiler output:
a.cc:7:1: error: expected ',' or ';' before 'ull'
    7 | ull ans;
      | ^~~
a.cc: In function 'ull dfs(int)':
a.cc:15:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |   ans+=m[res]++;
      |   ^~~
      |   abs
a.cc: In function 'int main()':
a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;

const int N = 1e5 + 5, INF = 0x3f3f3f3f;

struct P
{
	ll dif; int id;
	P(ll dif = 0, int id = -1) :dif(dif), id(id) {}
	P operator + (const P &a) const
	{
		return P(dif + a.dif, id);
	}
};

bool cmp(P a,P b){
    return a.dif>b.dif;
}

P p[N];
int n, pos, ans, loc[N];
ll d1, d2, L, a[N], b[N], c[N], d[N];
bool f, vis[N];

ll ok(int mid, int i)
{
	if (i <= mid) return p[mid].dif - a[p[i].id] + b[p[i].id];
	return p[mid].dif;
}

int main()
{
	while (~scanf("%d%lld", &n, &L))
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%lld%lld", &a[i], &b[i]);
			p[i] = P(a[i] - b[i], i);
		}
		for (int i = 0; i < n; i++)
		{
			scanf("%lld", &c[i]);
			if (i) c[i] += c[i - 1];
		}
		sort(p, p + n,cmp);
		for (int i = 0; i < n; i++)
			loc[p[i].id] = i;
        int fu = n;
        for(int i = 0;i < n;i++){
            if(p[i].dif<=0){
                fu = i;
                break;
            }
        }
		for (int i = 1; i < n; i++)
			p[i] = p[i] + p[i - 1];
		ans = INF;
		int first = 0;
		for (int i = 0; i < n; i++)
		{
			ll len = L - a[i];
			int l = -1, r = fu-1;

//			if(len==10&&first){
//                cout<<1<<endl;
//			}
//			else if(len==10&&!first){
//                first = 1;
//			}
			while (r - l > 1)
			{
				int mid = (l + r)/2;
				if (ok(mid, loc[i]) < len) l = mid;
				else r = mid;
			}
			int now = r - (r >= loc[i]);
			if (ok(r, loc[i])>=len&&ok(r, loc[i]) > c[now]) ans = min(ans, now + 2);
		}
		printf("%d\n", ans == INF ? -1 : ans);
	}
	return 0;
}

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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <string>

using namespace std;

typedef long long LL;
typedef vector <int>    VI;
typedef pair <int,int>  PII;
#define FOR(i,x,y)  for(int i = (int)(x);i < (int)(y);++ i)
#define IFOR(i,x,y) for(int i = (int)(x);i > (int)(y);-- i)
#define pb  push_back
#define mp  make_pair
#define fi  first
#define se  second
#define fi  first
#define se  second

const int maxn = 100010;

int n, li[maxn];
LL L, sum[maxn], c[maxn];

struct Num{
    LL a, b;
    bool operator < (const Num& rhs) const{
        return a-b > rhs.a-rhs.b;
    }
}s[maxn];

void Init() {
    LL ca = 0;
    int idx = 1;
    FOR(i, 2, n+1) {
        ca = ca+s[i].a-s[i].b-c[idx];
        if(ca <= 0) break;
        ++ idx;
    }
    li[1] = idx;
    FOR(i, 2, n+1) {
        if(i-1 > idx) {li[i] = idx; continue;}
        if(idx == n) {li[i] = n; continue;}
        ca += s[i-1].a-s[i-1].b+s[i].b-s[i].a;
        while(ca > 0 && idx < n) {
            ++ idx;
            ca += s[idx+1].a-s[idx+1].b-c[idx];
        }
        li[i] = idx;
    }
}

int ff = n+1;

bool judge(int x) {
    -- x;
    FOR(i, 1, n+1) {
        LL lim = L-s[i].a;
        if(li[i] <= x) continue;
        if(i > x && sum[x] >= lim)  return true;    
        if(i <= x && sum[x+1]-s[i].a+s[i].b >= lim) return true;
    }
    return false;
}

int main() {
    while(~scanf("%d%lld", &n, &L)) {
        LL mx = -1;
        FOR(i, 1, n+1) 
            scanf("%lld%lld", &s[i].a, &s[i].b), 
            mx = max(mx, s[i].a);
        s[n+1].a = s[n+1].b = 0;
        FOR(i, 1 ,n+1) scanf("%lld", c+i);
        if(mx >= L) {printf("1\n"); continue;}
        sort(s+1, s+n+1);
        ff = n;
        FOR(i, 1, n+1) if(s[i].a <= s[i].b) {ff = i; break;}
        sum[0] = 0;
        FOR(i, 1, n+1) sum[i] = sum[i-1]+s[i].a-s[i].b;
        Init();
        int l = 1, r = ff;
        //cout << l << " " << r << endl;
        if(l > r) {printf("-1\n"); continue;}
        while(l < r) {
            int mid = (l+r) >> 1;
            if(judge(mid))  r = mid;
            else    l = mid+1;
        }
        if(judge(l))    printf("%d\n", l);
        else    printf("-1\n");
    }
    return 0;
}

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

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
const int N = 1e5 + 5;

LL n, m;
LL c[N], day[N];
P drinks[N];

bool check(int mid) {
  LL sum = 0, tmp = drinks[mid].first - drinks[mid].second;
  for (int i = 1; i < mid; ++i) sum += drinks[i].first - drinks[i].second;
  for (int i = 1; i <= n; ++i) {
    if (day[i] < mid) continue;
    if (i < mid) {
      if (sum + tmp + drinks[i].second >= m) return true;
    }
    else {
      if (sum + drinks[i].first >= m) return true;
    }
  }
  return false;
}

int main() {
  scanf("%lld%lld", &n, &m);
  LL mx = -1;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld%lld", &drinks[i].first, &drinks[i].second);
    mx = max(mx, drinks[i].first);
  }
  for (int i = 1; i <= n; ++i) scanf("%lld", c + i);
  if (mx >= m) {
    puts("1");
    continue;
  }
  sort(drinks + 1, drinks + 1 + n, [](const P& a, const P& b) {
       return a.first - a.second > b.first - b.second;
       });
  int p = 1;
  LL sum = 0;
  for (int i = 2; i <= n; ++i) {
    sum += drinks[i].first - drinks[i].second - c[p];
    if (sum <= 0) break;
    p++;
  }
  day[1] = p;
  for (int i = 2; i <= n; ++i) {
    if (p < i - 1) {
      day[i] = p;
      continue;
    }
    if (p == n) {
      day[i] = n;
      continue;
    }
    sum += drinks[i-1].first - drinks[i-1].second - (drinks[i].first - drinks[i].second);
    while (p < n && sum > 0) {
      ++p;
      sum += drinks[p+1].first - drinks[p+1].second - c[p];
    }
    day[i] = p;
  }
  int l = 1, r = n, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid)) r = (ans = mid) - 1;
    else l = mid + 1;
  }
  printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:5: error: continue statement not within a loop
   41 |     continue;
      |     ^~~~~~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=10100;
//map<int,int> dp,v,c;
VI cand,d[N];
int w,h,k,n,x,y,v[N],c[N],dp[N];
//int query(int x) { return (--dp.upper_bound(x))->se;}
int solve(VI x) {
	v.clear(); c.clear();
	cand.clear();
	for (auto p:x) {
		if (p%2==0) c[p/2+1]=2;
		else v[p/2+1]=1;
		cand.pb(p/2+1);
		if (p/2+2<=(w+1)/2) cand.pb(p/2+2);
		if (p/2+3<=(w+1)/2) cand.pb(p/2+3);
	}
	cand.pb((w+1)/2);
	cand.pb(0);
	sort(all(cand));
	cand.erase(unique(all(cand)),cand.end());
	dp.clear();
	dp[0]=0;
	rep(x,1,SZ(cand)) {
		int i=cand[x];
		dp[i]=query(i-1)+v[i];
		if (i-2>=0) dp[i]=min(dp[i],query(i-2)+c[i]);
	}
	return dp[w/2+1];
/*	rep(i,1,w/2+2) {
		v[i]=c[i]=0;
	}
	for (auto p:x) {
		if (p%2==0) c[p/2+1]=1; else v[p/2+1]=1;
	}
	dp[0]=0;
	rep(i,1,w/2+2) {
		dp[i]=dp[i-1]+v[i];
		if (i>=2) dp[i]=min(dp[i],dp[i-2]+2*c[i]);
	}
	return dp[w/2+1];*/
}
int main() {
	scanf("%d%d%d",&w,&h,&k);
	k-=(w+1)/2;
	if (k<0) {
		puts("-1");
		return 0;
	}
	scanf("%d",&n);
	rep(i,0,n) {
		scanf("%d%d",&x,&y);
		if (y%2==0) d[y/2].pb(x);
	}
	int r=0;
	rep(i,1,h/2+1) r+=solve(d[i]);
	int cur=(h/2)*(w/2+1)-r;
	int dd=min(r,k); r-=dd; k-=dd;
	dd=min(cur,k); cur-=dd; k-=dd;
	printf("%d\n",cur+r*2);
}

Compiler output:
a.cc: In function 'int solve(VI)':
a.cc:32:11: error: request for member 'clear' in 'v', which is of non-class type 'int [10100]'
   32 |         v.clear(); c.clear();
      |           ^~~~~
a.cc:32:22: error: request for member 'clear' in 'c', which is of non-class type 'int [10100]'
   32 |         v.clear(); c.clear();
      |                      ^~~~~
a.cc:45:12: error: request for member 'clear' in 'dp', which is of non-class type 'int [10100]'
   45 |         dp.clear();
      |            ^~~~~
a.cc:49:23: error: 'query' was not declared in this scope
   49 |                 dp[i]=query(i-1)+v[i];
      |                       ^~~~~
Language: Java

 to QA team as a release candidate. However, they reported that some tests failed! Because we were too lazy to set up a continuous integration system, we have no idea when our software corrupted. We only know that the software passed all the test at the past revision 

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
 to QA team as a release candidate. However, they reported that some tests failed! Because we were too lazy to set up a continuous integration system, we have no idea when our software corrupted. We only know that the software passed all the test at the past revision 
 ^
1 error
Language: Java

We are developing the world's coolest AI robot product. After the long struggle, we finally managed to send our product at revision 

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
We are developing the world's coolest AI robot product. After the long struggle, we finally managed to send our product at revision 
^
Main.java:1: error: unclosed character literal
We are developing the world's coolest AI robot product. After the long struggle, we finally managed to send our product at revision 
                           ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep1(i,n) for(int i=1;i<=n;++i)


int main(void){
	ll A,B,N,res=LLONG_MAX;
	cin>>A>>B>>N;
	rep1(i,N)rep1(j,N){
		if(B*j%i==0){
			ll x=abs(B*j/i - A);
			res = min(res,x);
		}
	}
	cout<<res<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'll' was not declared in this scope
    7 |         ll A,B,N,res=LLONG_MAX;
      |         ^~
a.cc:8:14: error: 'A' was not declared in this scope
    8 |         cin>>A>>B>>N;
      |              ^
a.cc:8:17: error: 'B' was not declared in this scope
    8 |         cin>>A>>B>>N;
      |                 ^
a.cc:8:20: error: 'N' was not declared in this scope
    8 |         cin>>A>>B>>N;
      |                    ^
a.cc:11:27: error: expected ';' before 'x'
   11 |                         ll x=abs(B*j/i - A);
      |                           ^~
      |                           ;
a.cc:12:25: error: 'res' was not declared in this scope
   12 |                         res = min(res,x);
      |                         ^~~
a.cc:12:39: error: 'x' was not declared in this scope
   12 |                         res = min(res,x);
      |                                       ^
a.cc:15:15: error: 'res' was not declared in this scope
   15 |         cout<<res<<endl;
      |               ^~~
Language: C++

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int N, M, k[111];
Vec< set< int > > adj;

int main() {
	cin >> N >> M;
	memset(k, -1, sizeof(k));
	adj.assign(N, set< int >());
	
	int cnt = 0;
	while (cnt < 3 * N) {
		bool end = true;
		for_(v,0,N) {
			if ((int)adj[v].size() == k[v]) continue;
			end = false;
			
			cout << "lst " << v << endl;
			cin >> k[v];
			for_(i,0,k[v]) {
				int vi; cin >> vi;
				if (vi >= 0) adj[v].insert(vi);
			}
			
			++cnt;
			if (cnt == 3 * N) break;
		}
		if (end) break;
	}
	
	int ans = 0;
	for_(v,0,N) {
		for (int u : adj[v]) {
			ans += (k[u] - 1);
		}
	}
	cout << "ans " << ans << endl;
}

Compiler output:
a.cc:7:1: error: 'Vec' does not name a type
    7 | Vec< set< int > > adj;
      | ^~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'adj' was not declared in this scope
   12 |         adj.assign(N, set< int >());
      |         ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,j,k,c=0,d=0,ans=0;
  cin>>n>>m;
  int s=0,t=2*n+1;

  for(i=0;i<n;i++){
    cout << "lst " << i << endl;
    cin >> k;
    ans+=k*(k-1)/2;
    add_edge(s,i+1,k);
    add_edge(n+i+1,t,k);
    for(j=0;j<k;j++) cin >> c;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'add_edge' was not declared in this scope
   12 |     add_edge(s,i+1,k);
      |     ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 21474836

int main(){
  int n,m;
  cin>>n>>m;

  int ans=0;
  rep(i,n){
    int k;
    cout << "lst " << i << endl;
    cin>>k;
    ans += k *

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: expected primary-expression at end of input
   26 |     ans += k *
      |               ^
a.cc:26:15: error: expected '}' at end of input
a.cc:22:11: note: to match this '{'
   22 |   rep(i,n){
      |           ^
a.cc:26:15: error: expected '}' at end of input
   26 |     ans += k *
      |               ^
a.cc:17:11: note: to match this '{'
   17 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10LL * TEN(n-1); }

using P = pair<int, int>;
bool ok(vector<P> v) {
    sort(begin(v), end(v));
    vector<P> st;
    for (auto p: v) {
        while (st.size() && st.back().second < p.first) {
            st.pop_back();
        }
        if (st.size() && st.back().second < p.second) {
            return false;
        }
        st.push_back(p);
    }
    return true;
}

int main() {
    int h, w;
    scanf("%d %d", &h, &w);
    int n = h*w;
    int rid[n];
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        rid[a] = i;
    }

    for (int y = 0; y < h; y++) {
        vector<P> v[2];
        for (int x = 0; x < w-1; x++) {
            int id = y*w+x;
            v[x%2].push_back(P(rid[id], rid[id+1]));
        }
        if (!ok(v[0]) || !ok(v[1])) {
            cout << "NO" << endl;
            return 0;
        }
    }

    for (int x = 0; x < w; x++) {
        vector<P> v[2];
        for (int y = 0; y < h; y++) {
            int id = y*w+x;
            v[y%2].push_back(P(rid[id], rid[id+w]));
        }
        if (!ok(v[0]) || !ok(v[1])) {
            cout << "NO" << endl;
            return 0;
        }        
    }
    cout << "YES" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'bool ok(std::vector<std::pair<int, int> >)':
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(begin(v), end(v));
      |     ^~~~
      |     short
Language: C++

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

using namespace std;
using ll = long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10LL * TEN(n-1); }

using P = pair<int, int>;
bool ok(vector<P> v) {
    sort(begin(v), end(v));
    vector<P> st;
    for (auto p: v) {
        while (st.size() && st.back().second < p.first) {
            st.pop_back();
        }
        if (st.size() && st.back().second < p.second) {
            return false;
        }
        st.push_back(p);
    }
    return true;
}

int main() {
    int h, w;
    scanf("%d %d", &h, &w);
    int n = h*w;
    int rid[n];
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        rid[a] = i;
    }

    for (int y = 0; y < h; y++) {
        vector<P> v[2];
        for (int x = 0; x < w-1; x++) {
            int id = y*w+x;
            v[x%2].push_back(P(rid[id], rid[id+1]));
        }
        if (!ok(v[0]) || !ok(v[1])) {
            cout << "NO" << endl;
            return 0;
        }
    }

    for (int x = 0; x < w; x++) {
        vector<P> v[2];
        for (int y = 0; y < h-1; y++) {
            int id = y*w+x;
            v[y%2].push_back(P(rid[id], rid[id+w]));
        }
        if (!ok(v[0]) || !ok(v[1])) {
            cout << "NO" << endl;
            return 0;
        }        
    }
    cout << "YES" << endl;
    return 0;
}

Compiler output:
a.cc:4:10: fatal error: pair: No such file or directory
    4 | #include <pair>
      |          ^~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++>
#define N 100
#define M 100
#define inrange(i,j) ((i)>=0&&(i)<m&&(j)>=0&&(j)<n)
using namespace std;

int main(void){
	int m,n,c;
	cin>>m>>n;
	bool m[M][N];
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			m[i][j]=true;
		}
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			cin>>c;
			if(c=='x'){
				if(inrange(i,j))m[i][j]=false;
				if(inrange(i+1,j))m[i+1][j]=false;
				if(inrange(i-1,j))m[i-1][j]=false;
				if(inrange(i,j+1))m[i][j+1]=false;
				if(inrange(i,j-1))m[i][j-1]=false;
				if(inrange(i+1,j+1))m[i+1][j+1]=false;
				if(inrange(i-1,j+1))m[i-1][j+1]=false;
				if(inrange(i+1,j-1))m[i+1][j-1]=false;
				if(inrange(i-1,j-1))m[i][j]=false;
			}else if(c=='o'){
				if(inrange(i,j))m[i][j]=false;
				if(inrange(i,j+1))m[i][j+1]=false;
				if(inrange(i,j-1))m[i][j-1]=false;
			}
		}
	}
	int c=0;
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			if(m[i][j])c++;
		}
	}
	cout<<c<<endl;
	return 0;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>

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

using namespace std;

int main(void){
  int n,ret = 0,in,d;
  cin>>n>>d;
  rep(i,n){
    cin>>in;
    ret += (in>d?in-d:0);
  }
  cout<<(ret?ret:"kusoge")<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: operands to '?:' have different types 'int' and 'const char*'
   18 |   cout<<(ret?ret:"kusoge")<<endl;
      |          ~~~^~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
	int N,d,p[1000],count=0;
	cin >> N >> d;
	for(int i=0;i<1000;i++){
		cout << p[i];
		if(p[i] > d){
			count = count + (p[i]-d)
		}
	}
	if(count == 0){
		cout << "kusoge\n";
	}
	else{
		cout << count << "\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:49: error: expected ';' before '}' token
    9 |                         count = count + (p[i]-d)
      |                                                 ^
      |                                                 ;
   10 |                 }
      |                 ~
Language: C++

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

int main(){
  int n,a;
  cin>>n>>a;
  int memo;
  int ans=0;
  lp(i,n){
    cin>>memo;
    else if(memo>a) ans+=memo-a;
  }
  if(ans<=0) cout<<"kusoge"<<endl;
  else cout<<ans<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'else' without a previous 'if'
   12 |     else if(memo>a) ans+=memo-a;
      |     ^~~~
Language: C++

#include<iostream
using namespace std;
int main(){
int n,a[3]={0,0,0},z;
cin>>n;
while(n--){cin>>z;a[z%3]++;}
if(a[1]+a[2]==0)cout<<"0"<<endl;
else{
int s=a[0]+min(a[1],a[2]);
if(a[1]!=a[2])s++;
cout<<s<<endl;
}
return 0;
}

Compiler output:
a.cc:1:18: error: missing terminating > character
    1 | #include<iostream
      |                  ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
 int n, a = 0, b = 0, c = 0, result = 0;
 cin >> n;
 
 for (int i = 0; i < n; i++)
 {
   int tmp;
   cin >> tmp;
   if(tmp % 3 == 0)
     a++;
   if(tmp % 3 == 1)
     b++;
   if(tmp % 3 == 2)
     c++;
 }

 if(b == 0 && c == 0)
 {
   cout << 1 << endl;
   exit(0);
 }

 result += a;
 result += 2 * min(b, c);
 
 if(abs(b - c) == 1)
 {
   result++;
 }
 else if(abs(b - c) == 2)
 {
   result += 2;
 }

 cout << result << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: expected '}' at end of input
   39 |  cout << result << endl;
      |                         ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<c:\bits\stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[500000]={}, a0=0, a1=0, a2=0, count=1, sum = 0,b=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(a[i]%3 == 0) a0++;
		else if(a[i]%3 == 1) a1++;
		else if(a[i]%3 == 2) a2++;
	}
	while(1){
      //  cout<<a0<<" "<<a1<<" "<<a2<<" "<<count<<endl;
		if(a2>=2 && a1 >= 1){
			count+=3; a2 -= 2; a1 -= 1;sum+=5;
			count+=a0;
            a0=0;
		}else if(a1 >= 2 && a2 >=1){
			count += 3; a1 -= 2; a2 -= 1;sum+=4;
            count+=a0;
            a0=0;
			
		}else if(sum%3==1 && a1>=1){
			count++; a1--;sum+=1;
			count+=a0;
            a0=0;
           
		}else if(sum%3==2 && a2>=1){
			count++; a2--;sum+=2;
			count+=a0;
            a0=0;
                
		}else if(sum%3==0&& a2>=1){
			count++; a2--;sum+=2;		
            count+=a0;
            a0=0;
		}else if(sum%3==0&& a1>=1){
			count++; a1--;sum+=1;
			count+=a0;
            a0=0;
            
		}else{break;}
		if(a0==0&&a1==0&&a2==0)break;
	}
    if(count>=n)count=n;
	cout<<count<<endl;
	return 0;
}
		




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

#include<c:\bits\stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[500000]={}, a0=0, a1=0, a2=0, count=0, sum = 0,b=0;
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(a[i]%3 == 0) a0++;
		else if(a[i]%3 == 1) a1++;
		else if(a[i]%3 == 2) a2++;
	}
	while(1){
      // cout<<endl<<a0<<" "<<a1<<" "<<a2<<" "<<count<<" "<<sum<<" .";
		if(sum%3!=2 && a1 >= 2 && a2 >=1){
			count += 3; a1 -= 2; a2 -= 1;sum+=4;
            count+=a0;
            a0=0;
		}else if(sum%3!=1 && a2>=2 && a1 >= 1){
			count+=3; a2 -= 2; a1 -= 1;sum+=5;
			count+=a0;
            a0=0;
		}else if(sum%3==1 && a1>=1){
			count++; a1--;sum+=1;
			count+=a0;
            a0=0;
		}else if(sum%3==2 && a2>=1){
			count++; a2--;sum+=2;
			count+=a0;
            a0=0;
		}else if(count==0&& a2>=1){
			count++; a2--;sum+=2;		
            count+=a0;
            a0=0;
		}else if(count==0&& a1>=1){
			count++; a1--;sum+=1;
			count+=a0;
            a0=0;
        }else if(a0!=0||a1!=0||a2!=0){
            count++;
            break;
		}else{ break;}
		
		if(a0==0&&a1==0&&a2==0){break;}
	}
    if(count>=n)count=n;
	
	cout<<count<<endl;
	return 0;
}
		




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


int T;
int N;
int s[100001];
int t[100001];

int hikage(int start, int time);

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

	fgets(temp, sizeof(temp), stdin);
	sscanf(temp, "%d", &T);
	fgets(temp, sizeof(temp), stdin);
	sscanf(temp, "%d", &N);

	int pos = 1;
	int n = N;
	s[0] = 0;
	t[0] = 0;
	while (n--) {
		fgets(temp, sizeof(temp), stdin);
		sscanf(temp, "%d %d", &s[pos], &t[pos]);
		pos++;
	}

	int h;
	int time;
	int max = 0;
	N++;
	for (time = 0; time < t[N - 1]; time++) {
		h = hikage(time, T);
		if (h > max) max = h;
	}

	printf("%d", max);

	return 0;
}

int hikage(int start, int time) {
	// ??\????????¢???????????????????????????
	int end = start + T;

	// ????????????????\?????????????????????° T - ????\????????????\??±???????????????

	int i, j;
	int x, y;
	int flag = 0;
	int play_time = 0;

	for (i = 1; i < N; i++) {
		if (flag == 0) {
			if (start >= t[i - 1] && start <= s[i]) {
				if (end < t[i]) {
					return end - s[i];
				}
				else {
					// ?????¨????????????????????????????????¨????±?
					play_time = t[i] - s[i];
				}
				flag = 1;
			}
			else if (start >= s[i] && start <= t[i]) {
				if (end < t[i]) {
					return end - start;
				}
				else {
					// t[i] - start ?????\?????????????????????????????????
					play_time = t[i] - start;
				}
				flag = 1;
			}
			continue;
		}

		if (end >= t[i]) play_time += t[i] - s[i];
		else {
			if (end >= s[i]) {
				play_time += end - s[i];
				return play_time;
			}
			else {
				return play_time;
			}
		}
	}
	return play_time;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:13:35: error: 'stdin' was not declared in this scope
   13 |         fgets(temp, sizeof(temp), stdin);
      |                                   ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | 
a.cc:13:9: error: 'fgets' was not declared in this scope
   13 |         fgets(temp, sizeof(temp), stdin);
      |         ^~~~~
a.cc:14:9: error: 'sscanf' was not declared in this scope
   14 |         sscanf(temp, "%d", &T);
      |         ^~~~~~
a.cc:37:9: error: 'printf' was not declared in this scope
   37 |         printf("%d", max);
      |         ^~~~~~
a.cc:37:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

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

int main(){
  int T, N, temp[10][100100], temp2 = 0, ans, i, j = 0, tempT;

  cin>>T>>N;

  for(i = 0; i < N; i++){
    cin>>temp[0][i]>>temp[1][i];
  }


  tempT = T;

  for(i = 0; i < N; i++){
    tempT += temp[0][j];
    if(i){ans -= temp[1][i-1] - temp[0][i-1];}
    
    for(; j < N && temp[1][j] <= tempT; j++){
      ans += tempT - temp[0][j];
    }
    if(j < N && temp[0][j] <= tempT){
      ans  += tempT - temp[0][j];
    }
    
    temp2 = max(temp2, ans);
  }

  cout<<temp2<<endl;
  

  return 0;
}
*/



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 <queue>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
struct edge { int to, cap, rev; };
const int INF = (1 << 30);
int K, N, M, V, E, level[109], iter[109]; vector<vector<edge> > G; vector<pair<int, int> > G2;
void add_edge(int v1, int v2, int cap) {
	G[v1].push_back(edge{ v2, cap, (int)G[v2].size() });
	G[v2].push_back(edge{ v1, 0, (int)G[v1].size() - 1 });
}
void bfs(int s) {
	memset(level, -1, sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (int i = 0; i<(int)G[v].size(); i++) {
			edge &e = G[v][i];
			if (e.cap > 0 && level[e.to] < 0) {
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}
int dfs(int v, int t, int f) {
	if (v == t) return f;
	for (int &i = iter[v]; i < (int)G[v].size(); i++) {
		edge &e = G[v][i];
		if (e.cap > 0 && level[v] < level[e.to]) {
			int 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;
}
int max_flow(int s, int t) {
	int flow = 0, f = 0;
	for (;;) {
		bfs(s);
		if (level[t] < 0) return flow;
		memset(iter, 0, sizeof(iter));
		while ((f = dfs(s, t, INF)) > 0) flow += f;
	}
	return -1;
}
int main() {
	cin >> K >> N >> M; V = K + N + 2, E = M;
	G.resize(V);
	for (int i = 1; i <= K; i++) {
		add_edge(K + N + 1, i, 9999999);
	}
	for (int i = 0; i < E; i++) {
		int s, t, u;
		cin >> s >> t >> u;
		if (s > t) swap(s, t);
		if (1 <= s && t <= K) continue;
		if(1 <= s && s <= K) add_edge(s, t, u);
		else if(s == 0) add_edge(t, s, u);
		else add_edge(s, t, u), add_edge(t, s, u);
		G2.push_back(make_pair(s, t));
	}
	int res = max_flow(V - 1, 0);
	vector<vector<edge> > G3 = G;
	int ret = 0;
	for (int i = 0; i < E; i++) {
		G = G3;
		int s = G2[i].first, t = G2[i].second;
		if (1 <= s && s <= K) add_edge(s, t, 9999999);
		else if (s == 0) add_edge(t, s, 9999999);
		else add_edge(s, t, 9999999), add_edge(t, s, 9999999);
		ret = max(ret, res + max_flow(V - 1, 0));
	}
	if (ret >= 9999999) cout << "overfuro" << endl;
	else cout << ret << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void bfs(int)':
a.cc:15:9: error: 'memset' was not declared in this scope
   15 |         memset(level, -1, sizeof(level));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
a.cc: In function 'int max_flow(int, int)':
a.cc:50:17: error: 'memset' was not declared in this scope
   50 |                 memset(iter, 0, sizeof(iter));
      |                 ^~~~~~
a.cc:50:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define MAX_V 105
#define ll int
const ll INF = 1 << 28;
struct edge{
  ll to,cap,rev;
  edge(ll to ,ll cap,ll rev):to(to),cap(cap),rev(rev){}
};
vector<edge> G[MAX_V];
vector<edge> G2[MAX_V];
bool used[MAX_V];
void add_edge(ll from,ll to,ll cap){
  G[from].push_back(edge(to,cap,G[to].size()));
  G[to].push_back(edge(from,cap,G[from].size()-1));
}
ll dfs(ll v, ll t,ll f){
  if(v==t) return f;
  used[v]=true;
  for(ll i=0;i<G[v].size();i++){
    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 dfs2(ll v, ll t,ll f){
  if(v==t) return f;
  used[v]=true;
  for(ll i=0;i<G2[v].size();i++){
    edge &e = G2[v][i];
    if(!used[e.to] && e.cap>0){
      ll d=dfs2(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G2[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}
ll flow=0;
ll max_flow(ll s,ll t){
  for(;;){
    memset(used,0,sizeof(used));
    ll f=dfs(s,t,INF);
    if(f==0) return flow;
    flow+=f;
  }
}
ll max_flow2(ll s,ll t){
  ll flow2=0;
  for(;;){
    memset(used,0,sizeof(used));
    ll f=dfs2(s,t,INF);
    if(f==0) return flow2;
    flow2+=f;
  }
}
int main(){
  ll k,n,m,i,j,a,b,c,x,y;
  cin >> k >> n >> m;
  ll s=MAX_V-1,t=0;
  for(i=0;i<m;i++){
    cin >> a >> b >> c;
    add_edge(a,b,c);
  }
  for(i=1;i<=k;i++){
    add_edge(s,i,INF);
  }
  ll ans=max_flow(s,t);
  for(i=1;i<MAX_V-1;i++){
    for(j=0;j<G[i].size();j++){
      if(G{i][j].cap!=0) continue;
      for(x=0;x<MAX_V;x++) G2[x]=G[x];
      G2[i][j].cap=INF;
      ans=max(ans,flow+max_flow2(s,t));
      if(ans>=INF/2) break;
    }
  } if(ans>=INF/2) cout << "overfuro" << endl;
  else cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:11: error: expected ')' before '{' token
   81 |       if(G{i][j].cap!=0) continue;
      |         ~ ^
      |           )
a.cc:81:13: error: expected primary-expression before ']' token
   81 |       if(G{i][j].cap!=0) continue;
      |             ^
Language: C

#include <stdio.h>


int main(void){
    scanf("%d %d",&N,&M);
    printf("%d",N-M);
    return 0;
}



Compiler output:
main.c: In function 'main':
main.c:5:20: error: 'N' undeclared (first use in this function)
    5 |     scanf("%d %d",&N,&M);
      |                    ^
main.c:5:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:23: error: 'M' undeclared (first use in this function)
    5 |     scanf("%d %d",&N,&M);
      |                       ^
Language: C++

#include<iostream>
using namespace std;
main(){
  int a b;
  cin>>a>>b;
  cout<<a-b-1<<endl;
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:4:9: error: expected initializer before 'b'
    4 |   int a b;
      |         ^
a.cc:5:8: error: 'a' was not declared in this scope
    5 |   cin>>a>>b;
      |        ^
a.cc:5:11: error: 'b' was not declared in this scope
    5 |   cin>>a>>b;
      |           ^
Language: C++

#include <stdio.h>

int N,M,i,K;

int fun(K)
  {
    if((K)==0){return 1;}
    else
    {
      return fun((K)/2)+K;
    }
  }




int main()
{

  scanf("%d %d",&N,&M);
  int a[M];

  for (i=0; i<=M-1; i++)
    {
      scanf("%d",&a[i]);
    }
  K=N-M;
  printf("%d\n",fun(K)-K);
}

Compiler output:
a.cc:6:3: error: expected ',' or ';' before '{' token
    6 |   {
      |   ^
a.cc: In function 'int main()':
a.cc:28:20: error: 'fun' cannot be used as a function
   28 |   printf("%d\n",fun(K)-K);
      |                 ~~~^~~
Language: C++

#include<stdio.h>
int main(){
	int answer,N,M[m],a;
	scanf("%d %d",&N,&m);
	for(int i=0;i<N;i++){
		M[i]=i;
	}
	for(int i=0;i<m;i++){
		scanf("%d",a);
		M[a]=1000;
	}
	int L=0;
	while(N>1){
		N/=2;
		L+=N;
	}
	for(int i=0;i<N;i=i+2){
		if(M[i]!=i||M[i+1]!=(i+1)){
			L=L-1;
		}
	}
	printf("%d\n",L);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:24: error: 'm' was not declared in this scope
    3 |         int answer,N,M[m],a;
      |                        ^
a.cc:6:17: error: 'M' was not declared in this scope
    6 |                 M[i]=i;
      |                 ^
a.cc:10:17: error: 'M' was not declared in this scope
   10 |                 M[a]=1000;
      |                 ^
a.cc:18:20: error: 'M' was not declared in this scope
   18 |                 if(M[i]!=i||M[i+1]!=(i+1)){
      |                    ^
Language: C++

#include <iostream>
using namespace std;

int main(){
	int n, m;
	cin >> n >> m;

	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
	}
	cout << (n-m) -1; << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:27: error: expected primary-expression before '<<' token
   12 |         cout << (n-m) -1; << endl;
      |                           ^~
Language: C++

#include<iostream>

using namespace std;

int main () {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for(int i = 0; i < m; i++) cin >> a[i];
    n -= m;
    long long ans = 0;
    while(n > 1) {
        ans += n / 2;
        n = n / 2;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> a(m);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | 
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> a(m);
      |            ^~~
a.cc:9:39: error: 'a' was not declared in this scope
    9 |     for(int i = 0; i < m; i++) cin >> a[i];
      |                                       ^
Language: C++

using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        for (int i = 0; i < m; i++) Console.ReadLine();
        Console.WriteLine(n - m - 1);
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Hello
      | ^~~~~~
Language: C++

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

int main(){
  int a,b;
  cin>>a>>b;
  a-=b;
  int c;
  for(int i=0;i<m;i++)cin>>c;
  cout<<a/2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'm' was not declared in this scope
    9 |   for(int i=0;i<m;i++)cin>>c;
      |                 ^
Language: C++

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	int a[n],i,j=0;
	for(i=0;i<n;i++){
		scanf("%d",a+i);
	}
	
	int max=INT_MIN,min=INT_MAX;
	int total;
	i=0;
	while(1){
		total=0;
		for(j=0;j<m;j++){
			total+=a[i];
			i++
		}
		
		if(total>max){
			max=total;
		}
		
		if(total<min){
			min=total;
		}
		
		if(i==n){
			break;
		}
	}
	
	printf("%d\n",max-min);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:28: error: expected ';' before '}' token
   24 |                         i++
      |                            ^
      |                            ;
   25 |                 }
      |                 ~
Language: C++

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

using namespace std;

int gcd(int x, int y){
  if(x%y) return gcd(y, x%y);
  return y;
}

int lcm(int x, int y){
  return x*y/gcd(x, y);
}

int N, M, A[1024];

int main(){
  memset(A, 0, sizeof(A));
  queue<int> q;
  cin >> N >> M;
  for(int i=0;i<N;i++){
    int x; cin >> x;
    q.push(x);
  }

  int res = 0;
  int l = lcm(N, M);
  for(int i=0;i<l/M;i++){
    int maxr = 0, minr = 1<<20;
    for(int j=0;j<M;j++){
      int p = q.front(); q.pop();
      maxr = max(maxr, p);
      minr = min(minr, p);
      q.push(p);
    }
    res += maxr - minr;
  }

  cout << res << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: 'memset' was not declared in this scope
   19 |   memset(A, 0, sizeof(A));
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
using namespace std;

int Euclid(int x,int y){
  if(!(x%y))
    return y;

  return Euclid(y,x/y);
}
int main(int argc, char *argv[])
{
  int x,y,w[1000];
  cin >> x >> y;

  for(int i=0; i<x; i++)
    cin >> w[i];

  while(num%y)
    num += x;

  int sum = 0;
  int max=0;
  int min=0;

  for(int i=0; i<num; i++){
    int ind = i%x;

    if(w[max]<w[ind])
      max=ind;
    else if(w[min]>w[ind])
      min=ind;
    
    if(i%y == y-1){
      sum += w[max]-w[min];
      max = ind+1;
      min = max;
    }

  }
  cout << sum<< "\n";
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:18:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   18 |   while(num%y)
      |         ^~~
      |         enum
a.cc:25:18: error: 'num' was not declared in this scope; did you mean 'sum'?
   25 |   for(int i=0; i<num; i++){
      |                  ^~~
      |                  sum
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;
typedef pair<int, int> pii;
typedef vector< vector<pii> > Graph;

struct Edge {
    int from, to, cost;
    Edge(int a, int b, int c) : from(a), to(b), cost(c) {};
};

int depth[100010];
void getDepth(Graph &G, int point) {
    for(size_t i=0; i<G[point].size(); i++) {
        int to = G[point][i].first;
        if(depth[to] != -1) continue;
        depth[to] = depth[point] + 1;
        getDepth(G, to);
    }
}

int main() {
    double p; cin >> p;
    int n; cin >> n;
    Graph G(n);
    vector<Edge> ve;
    rep(i,0,n-1) {
        int x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        G[x].push_back(pii(y, c));
        G[y].push_back(pii(x, c));
        ve.push_back(Edge(x, y, c));
    }

    memset(depth, -1, sizeof(depth));
    depth[0] = 0;
    getDepth(G, 0);

    double E = 0.0;
    rep(i,0,ve.size()) {
        int x = depth[ ve[i].from ];
        int y = depth[ ve[i].to ];
        int d = max(x, y);
        E += ve[i].cost * pow(p, d);
    }

    double ans = 2 * E;
    rep(i,0,ve.size()) {
        int x = depth[ ve[i].from ];
        int y = depth[ ve[i].to ];
        int d = max(x, y);b
        ans += E * pow(p, d);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:52:27: error: 'b' was not declared in this scope
   52 |         int d = max(x, y);b
      |                           ^