criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;
public class Main
{
	private class Data
	{
		long t;
		int s,d;
		Data(long t,int s,int d)
		{
			this.t = t;
			this.s = s;
			this.d = d;
		}
	}
	public void sort(Data[] datas)
	{
		for(int i = 0;i < datas.length - 1;i++)
		{
			for(int j = i + 1;j < datas.length;j++)
			{
				if(datas[i].t > datas[i].t)
				{
					Data tmp = datas[i];
					datas[i] = datas[j];
					datas[j] = tmp;
				}
			}
		}
	}
	public void solve()
	{
		Scanner cin = new Scanner(System.in);
		while(true)
		{
			int N = cin.nextInt();
			int M = cin.nextInt();
			if( N == 0 && M == 0)break;
			int[] infected = new int[N];
			infected[0]++;
			Data[] datas = new Data[M];
			for(int i = 0;i < M;i++)
			{
				datas[i] = new Data(cin.nextLong(),cin.nextInt() - 1,cin.nextInt() - 1);
			}
			
			sort(datas);
			for(int i = 0;i < M;i++)
			{
				if(infected[datas[i].s] > 0)
				{
					infected[datas[i].d]++;
				}
			}
			int ans = 0;
			for(int i = 0;i < N;i++)
			{
				if(infected[i] > 0)ans++;
			}
			
			System.out.println(ans);
		}
	}
	public static void main(String[] args)
	{
		new AOJ_2155().solve();
	}
}

Compiler output:
Main.java:65: error: cannot find symbol
		new AOJ_2155().solve();
		    ^
  symbol:   class AOJ_2155
  location: class Main
1 error
Language: C++

#include <cstdio>
#include <vector>
using namespace std;
struct dts{
    int t;
    int s;
    int d;
};

int main(void){
    int N,M,i,cnt;
    while(1){
        scanf("%d",&N);
        scanf("%d",&M);
        if(!N && !M){break;}
        int pcs[N];
        vector<dts> datas;
        for(i=0;i<N;i++){pcs[i]=0;}
        pcs[0]=1;
        cnt=0;
        for(i=0;i<M;i++){
            struct dts buf;
            scanf("%d",&buf.t);
            scanf("%d",&buf.s);
            scanf("%d",&buf.d);
            datas.push_back(buf);
        }
        sort(datas.begin(),datas.end(),[](const dts& x,const dts& y){return x.t < y.t;});
        for(i=0;i<M;i++){
            if(pcs[datas[i].s-1]){pcs[datas[i].d-1]=1;}
        }
        for(i=0;i<N;i++){if(pcs[i]){cnt++;}}
        printf("%d\n",cnt);
    }
    return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |         sort(datas.begin(),datas.end(),[](const dts& x,const dts& y){return x.t < y.t;});
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <vector>
using namespace std;
struct edge{
  int t;
  int from;
  int to;
  edge(){};
  edge(int t,int from,int to):t(t),from(from),to(to){};
  bool operator<(const edge& other) const {
	return t < other.t;
  }
};

int main(){
  int n,m;
  while(cin >> n >> m && n != 0){
	vector<edge> vec;
	for(int i = 0;i < m;i++){
	  int t,f,to;
	  cin >> t >> f >> to;
	  vec.emplace_back(t,f,to);
	}
	sort(vec.begin(),vec.end());
	vector<bool> infected(n,false);
	infected[0] = true;
	for(int i = 0;i < m;i++){
	  int to,from;
	  to = vec[i].to;
	  from = vec[i].from;
	  if(infected[from-1])infected[to-1] = true;
	}
	int res = 0;
	for(int i = 0;i < n;i++){
	  if(infected[i])res++;
	}
	cout << res << endl;
	
  }

  return 0;
}

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

#include<iostream>
using namespace std;
struct log{
  int T,s,d;
  bool operator<(const log &a)const{
    return T<a.T;
  }
};
const int MAX_N=30000;
int parent[MAX_N];
int depth[MAX_N];

void init(int n){
  for(int i=0;i<n;i++){
    parent[i]=i;
    depth[i]=0;
  }
}

int find(int x){
  if(parent[x]==x){
    return x;
  }else{
    return parent[x]=find(parent[x]);
  }
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;
  if(depth[x]<depth[y]){
    parent[x]=y;
  }else{
    parent[y]=x;
    if(depth[x]==depth[y])depth[x]++;
  }
}

bool same(int x,int y){
  return find(x)==find(y);
}

log l[30000];
int main(){
  int n,m;
  while(cin>>n>>m,n){
    init(n);
    for(int i=0;i<m;i++)
      cin>>l[i].T>>l[i].s>>l[i].d;
    sort(l,l+m);
    int ans=1;
    for(int i=0;i<m;i++){
      if(same(1,l[i].s)){
	ans++;
	if(!same(1,l[i].d))unite(1,l[i].d);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   51 |     sort(l,l+m);
      |     ^~~~
      |     short
Language: C++

#include<iostream>
using namespace std;

struct Data{
  
  int t,s,d;

  bool operator<(const Data& data)const{
    if(data.t != t)return t < data.t;  
    if(data.s != s)return s < data.s;
    return d < data.d;
  }
  
};
int main(){

  int N,M;
  
  while(1){

    cin >>N>>M;
    if(N==0 && M==0)break;
    
    Data data[M];
    for(int i=0 ; i < M ; i++){
      cin >>data[i].t>>data[i].s>>data[i].d;
    }
    
    sort(data,data+M);
    
    bool isinfected[N+1];
    for(int i=1 ; i <= N ; i++)isinfected[i]=false;
    isinfected[1]=true;
    
    int cnt=1;
    for(int i=0 ; i < M ; i++){
      if(isinfected[data[i].s] && !isinfected[data[i].d]){
	isinfected[data[i].d]=true;
	cnt++;
      }
    }
    
    cout <<cnt<<endl;
    
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   29 |     sort(data,data+M);
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<functional>
#include<map>
#define p pair<int,int>
#define P pair<int,p>
using namespace std;

bool c[20000];
int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		memset(c, false, sizeof(c));
		c[0] = true;
		P d[20000];
		for (int e = 0; e < b; e++) {
			int f, g, h; scanf("%d%d%d", &f, &g, &h); g--; h--;
			d[e] = P(f, p(g, h));
		}
		sort(d, d + b);
		for (int e = 0; e < b; e++) {
			if (c[d[e].second.first]) {
				c[d[e].second.second] = true;
			}
		}
		int e = 0;
		for (bool f : c) {
			if (f)e++;
		}
		cout << e << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'memset' was not declared in this scope
   18 |                 memset(c, false, sizeof(c));
      |                 ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include<map>
  +++ |+#include <cstring>
   10 | #define p pair<int,int>
Language: C++

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	long long n,m;
	while(cin>>n>>m,n){
		vector<pair<int,pair<int,int> > >v;
		pair<int,pair<int,int> >p;
		long long a[20001]={0},t,s=0;
		a[1]=1;
		r(i,m){
			cin>>p.first>>p.second.first>>p.second.second;
			v.pushback(p);
		}
		sort(v.begin(),v.end());
		r(i,m)if(a[v[i].second.first])a[v[i].second.second]=1;
		r(i,n+1)if(a[i])s++;
		cout<<s<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: 'class std::vector<std::pair<int, std::pair<int, int> > >' has no member named 'pushback'; did you mean 'push_back'?
   13 |                         v.pushback(p);
      |                           ^~~~~~~~
      |                           push_back
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, M, t, s, d, ans;
  vector< vector<int> > packets;
  while (cin >> N >> M, N) {
    vector<bool> infected(N, false);
    infected[0] = true;
    for (int i = 0; i < M; ++i) {
      cin >> t >> s >> d;
      packets.push_back({t, s-1, d-1});
    }
    sort(packets.begin(), packets.end());
    for (int i = 0; i < M; ++i) {
      s = packets[i][1];
      d = packets[i][2];
      if (infected[s]) infected[d] = true;
    }
    ans = 0;
    for (int i = 0; i < N; ++i) if (infected[i]) ++ans;
    cout << ans << endl;
    packets.erase(packets.begin(), packets.end());
  }
  return 0;
}

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

#include<iostream>
#include<map>
#include<algorithm>
#define M 20000
#define N 20001
using namespace std;
struct data{
	int t,s,d;
	bool operator<(const data &c){
		return t < c.t;
	}
};
int main(){
	while(true){
		int n,m;
		int ans=0;
		bool infected[N]={false,};
		data datas[M];
		scanf("%d%d", &n, &m);
		if(n==0&&m==0)
			break;
		for(int i=0;i<m;++i){
			scanf("%d%d%d", &datas[i].t, &datas[i].s, &datas[i].d);
		}
		sort(datas,datas+m);
		infected[1]=true;
		for(int i=0;i<m;++i){
			if( infected[datas[i].s] ){
				infected[datas[i].d]=true;
			}
		}
		for(int i=1;i<=n;++i){
			if( infected[i] )++ans;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: reference to 'data' is ambiguous
   18 |                 data datas[M];
      |                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:7:8: note:                 'struct data'
    7 | struct data{
      |        ^~~~
a.cc:23:42: error: 'datas' was not declared in this scope; did you mean 'data'?
   23 |                         scanf("%d%d%d", &datas[i].t, &datas[i].s, &datas[i].d);
      |                                          ^~~~~
      |                                          data
a.cc:25:22: error: 'datas' was not declared in this scope; did you mean 'data'?
   25 |                 sort(datas,datas+m);
      |                      ^~~~~
      |                      data
Language: C++

#include<iostream>
#include<vector>
using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}

Compiler output:
a.cc:3:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:3:198: error: expected '}' at end of input
    3 | using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}
      |                                                                    ~                                                                                                                                 ^
a.cc:3:198: error: expected '}' at end of input
    3 | using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}
      |                           ~                                                                                                                                                                          ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}}

Compiler output:
a.cc:3:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}}
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:3:199: error: expected '}' at end of input
    3 | using namespace std;main(){for(int N,M,i;cin>>N>>M,N;cout<<N<<endl){vector<int>v(N+1),s(M+1),d(M+1);for(i=0;i++<M;cin>>s[N]>>d[N])cin>>N;v[1]=N=1;for(i=0;i++<M;)if(v[s[i]]){v[d[i]]=1;v[d[i]]||N++;}}
      |                           ~                                                                                                                                                                           ^
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;

vector<pair<int, pair<int , int>>> l;

int v[20010];
int n, m, ans;


int main(void){
	int i;
	pair<int, pair<int, int>> p;
	while( cin >> n >> m, n){
		ans = 0;
		memset(l, 0, sizeof(l));
		memset(v, 0, sizeof(v));
		for(i = 0; i < m; i++){
			cin >> p.first >> p.second.first >> p.second.second;
			l.push_back(p);
		}
		sort(l.begin(), l.end());
		v[1] = 1;
		for(i = 0; i < m; i++) if(v[l[i].second.first]) v[l[i].second.second] = 1;
		for(i = 1; i <= n; i++) if(v[i]) ans++;
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: cannot convert 'std::vector<std::pair<int, std::pair<int, int> > >' to 'void*'
   19 |                 memset(l, 0, sizeof(l));
      |                        ^
      |                        |
      |                        std::vector<std::pair<int, std::pair<int, int> > >
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;

vector<pair<int, pair<int , int> > > l;

int v[20010];
int n, m, ans;


int main(void){
	int i;
	pair<int, pair<int, int>> p;
	while( cin >> n >> m, n){
		ans = 0;
		memset(l, 0, sizeof(l));
		memset(v, 0, sizeof(v));
		for(i = 0; i < m; i++){
			cin >> p.first >> p.second.first >> p.second.second;
			l.push_back(p);
		}
		sort(l.begin(), l.end());
		v[1] = 1;
		for(i = 0; i < m; i++) if(v[l[i].second.first]) v[l[i].second.second] = 1;
		for(i = 1; i <= n; i++) if(v[i]) ans++;
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: cannot convert 'std::vector<std::pair<int, std::pair<int, int> > >' to 'void*'
   19 |                 memset(l, 0, sizeof(l));
      |                        ^
      |                        |
      |                        std::vector<std::pair<int, std::pair<int, int> > >
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;

vector<pair<int, pair<int , int> > > l;

int v[20010];
int n, m, ans;


int main(void){
	int i;
	pair<int, pair<int, int> > p;
	while( cin >> n >> m, n){
		ans = 0;
		memset(l, 0, sizeof(l));
		memset(v, 0, sizeof(v));
		for(i = 0; i < m; i++){
			cin >> p.first >> p.second.first >> p.second.second;
			l.push_back(p);
		}
		sort(l.begin(), l.end());
		v[1] = 1;
		for(i = 0; i < m; i++) if(v[l[i].second.first]) v[l[i].second.second] = 1;
		for(i = 1; i <= n; i++) if(v[i]) ans++;
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: cannot convert 'std::vector<std::pair<int, std::pair<int, int> > >' to 'void*'
   19 |                 memset(l, 0, sizeof(l));
      |                        ^
      |                        |
      |                        std::vector<std::pair<int, std::pair<int, int> > >
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

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

using namespace std;

typedef pair<int , pair<int, int> > edge;

int main(){
	int n, m;
	
	while(cin >> n >> m, (n||m)){
		
		vector<edge> vc;
		int t, s, d;
		
		for(int i=0; i<m; ++i){
			
			cin>>t>>s>>d;
			vc.push_back(make_pair(t, make_pair(s, d));
		}
		
		sort(vc.begin(), vc.end());
		set<int> infect;
		infect.insert(1);
		int res = 0;
		for(int i=0; i<m; ++i){
			
			if(infect.count(vc[i].second.first) ^ infect.count(vc[i].second.second)){
				
				infect.insert(vc[i].second.first);
				infect.insert(vc[i].second.second); 
				res++;
			}
		}
		
		cout << res << endl;
	}
	
	return 0;
}
			
		
		

Compiler output:
a.cc: In function 'int main()':
a.cc:22:67: error: expected ')' before ';' token
   22 |                         vc.push_back(make_pair(t, make_pair(s, d));
      |                                     ~                             ^
      |                                                                   )
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

struct A{
	int t,s,d;
	A(int t,int s,int d):t(t),s(s),d(d){}
	bool operator<(const A &a)const{return t<a.t;}
};

bool infected[20000];
int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		vector<A> v;
		v.reserve(m);
		memset(infected,false,sizeof(infected));
		infected[0]=true;
		rep(i,m){
			int t,s,d;
			cin>>t>>s>>d;
			v.push_back(A(t,s-1,d-1));
		}
		sort(v.begin(),v.end());
		rep(i,v.size()){
			infected[v[i].d] |= infected[v[i].s];
		}
		cout<<count(infected,infected+n,true)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'memset' was not declared in this scope
   19 |                 memset(infected,false,sizeof(infected));
      |                 ^~~~~~
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 | using namespace std;
Language: C++

(allDP[i] == INF) {
                continue;
            }

            int cost = allDP[i];

            for(auto itr = hps.begin(); itr != hps.end(); itr++) {
                if(*itr - i > 0) {
                    cost += singleDP[*itr - i];
                }
            }

            answer = min(answer, cost);
        }

        cout << answer << endl;
    }

    return 0;
}

Compiler output:
a.cc:1:8: error: 'i' was not declared in this scope
    1 | (allDP[i] == INF) {
      |        ^
a.cc:1:10: error: expected ')' before '==' token
    1 | (allDP[i] == INF) {
      | ~        ^~~
      |          )
a.cc:5:24: error: 'allDP' was not declared in this scope
    5 |             int cost = allDP[i];
      |                        ^~~~~
a.cc:5:30: error: 'i' was not declared in this scope
    5 |             int cost = allDP[i];
      |                              ^
a.cc:7:13: error: expected unqualified-id before 'for'
    7 |             for(auto itr = hps.begin(); itr != hps.end(); itr++) {
      |             ^~~
a.cc:7:41: error: 'itr' does not name a type
    7 |             for(auto itr = hps.begin(); itr != hps.end(); itr++) {
      |                                         ^~~
a.cc:7:59: error: 'itr' does not name a type
    7 |             for(auto itr = hps.begin(); itr != hps.end(); itr++) {
      |                                                           ^~~
a.cc:13:13: error: 'answer' does not name a type
   13 |             answer = min(answer, cost);
      |             ^~~~~~
a.cc:14:9: error: expected declaration before '}' token
   14 |         }
      |         ^
a.cc:16:9: error: 'cout' does not name a type
   16 |         cout << answer << endl;
      |         ^~~~
a.cc:17:5: error: expected declaration before '}' token
   17 |     }
      |     ^
a.cc:19:5: error: expected unqualified-id before 'return'
   19 |     return 0;
      |     ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int hp[100];
int mp[100];
string target[100];
int damage[100];
int dp1[2][100010], dp2[2][100010];

int main(){
  int n, m;
  while(cin >> n, n){
    for(int i = 0; i < n; i++) cin >> hp[i];
    
    cin >> m;
    for(int i = 0; i < m; i++){
      string s;
      cin >> s >> mp[i] >> target[i] >> damage[i];
      //cout << s <<" " <<mp[i]<<" " << target[i]<<" " << damage[i] <<endl;
    }
    
    memset(dp1, 0, sizeof dp1);
    memset(dp2, 0, sizeof dp2);
    for(int i = 1; i <= 100000; i++){
      dp1[0][i] = dp2[0][i] = 1 << 30;
    }
    for(int i = 1; i <= m; i++){
      for(int j = 0; j <= 100000; j++){
        if(damage[i-1] == 0){
          dp1[i%2][j] = dp1[(i-1)%2][j]
          dp2[i%2][j] = dp2[(i-1)%2][j];   
        }
        else if(target[i-1] == "All"){
            dp1[i%2][j] = min(dp1[(i-1)%2][j], dp1[i%2][max(0,j - damage[i-1])] + mp[i-1]);
            dp2[i%2][j] = dp2[(i-1)%2][j];          
        }
        else{
            dp2[i%2][j] = min(dp2[(i-1)%2][j], dp2[i%2][max(0,j - damage[i-1])] + mp[i-1]);
            dp1[i%2][j] = dp1[(i-1)%2][j];
        }
      }
    }
    
    
    for(int i = 5000; i <= 10000; i++){
      //cout << i << " " << dp2[n][i] <<endl;
    }
    
    int ans = 1 << 30;
    for(int i = 0; i <= 100000; i++){
      int sum = dp1[m%2][i];
      //cout << i << " " << dp1[n][i] << endl;
      for(int j = 0; j < n; j++){
        if(hp[j] - i <= 0) continue;
        sum += dp2[m%2][hp[j] - i];
      }
      //cout << i << " " << sum <<endl;
      ans = min(ans, sum);
    }
    
    cout << ans <<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: expected ';' before 'dp2'
   31 |           dp1[i%2][j] = dp1[(i-1)%2][j]
      |                                        ^
      |                                        ;
   32 |           dp2[i%2][j] = dp2[(i-1)%2][j];
      |           ~~~
Language: C++

#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i, n) for ( int i = 0; i < (int)n; i++)
#define NMAX 100
#define MAX 1000000
#define INFTY (1<<21)


void setTable(int maxv, pair<int, int> v[NMAX], int vs,  int T[MAX+1]){
    rep(i, maxv+1) T[i] = INFTY;
    T[0] = 0;
    rep(i, vs){
	for ( int j = 1; j <= v[i].second; j++ ) T[j] = min(T[j], v[i].first);
	for ( int j = v[i].second+1; j <= maxv; j++ ){
	    T[j] = min(T[j], T[j-v[i].second] + v[i].first);
	}
    }
}

main(){
    int n, M[NMAX], TS[MAX+1], TA[MAX+1], ss, as;
    pair<int, int> S[NMAX], A[NMAX];

    string name, type;
    int maxh = 0;
    while( cin >> n && n ){
	ss = as = 0;
	rep(i, n) { cin >> M[i]; maxh = max(maxh, M[i]); }
	int m, cost, damage; 
	cin >> m;
	rep(i, m){
	    cin >> name >> cost >> type >> damage;
	    if ( type == "Single") S[ss++] = make_pair(cost, damage);
	    if ( type == "All") A[as++] = make_pair(cost, damage);
	}
	setTable(maxh, S, ss, TS);
	setTable(maxh, A, as, TA);
	
	int ans = INFTY;
	for( int a = 0; a <= maxh; a++ ){
	    int cost = TA[a];
	    for ( int i = 0; i < n; i++ ){
		int rem = M[i] - a;
		if ( rem <= 0 ) continue;
		cost += TS[rem];
	    }
	    ans = min(ans, cost);
	}
	cout << ans << endl;
    }
}

Compiler output:
a.cc:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:12: error: 'cin' was not declared in this scope
   28 |     while( cin >> n && n ){
      |            ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:51:9: error: 'cout' was not declared in this scope
   51 |         cout << ans << endl;
      |         ^~~~
a.cc:51:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:24: error: 'endl' was not declared in this scope
   51 |         cout << ans << endl;
      |                        ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<algorithm>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#define M 100
#define N 100
#define SINGLE 1
#define ALL 2
#define INFTY 1<<30
using namespace std;
struct magic{
	int mp;
	int type;
	int damage;
	bool operator<(const magic &m)const{
		return mp<m.mp;
	}
};
void solve(int n, int hp[N], int m, magic mag[M], int now, int &ans){
	bool bSolved=true;
	/*for(int i=0;i<n;++i){
		cout<<hp[i]<<' ';
	}
	cout<<endl;*/
	for(int i=0;i<n;++i){
		if(hp[i]>0){
			bSolved=false;
			break;
		}
	}
	if( bSolved ){
		ans=min(ans,now);
		return ;
	}

	for(int i=0;i<m;++i){
		int nx_hp[N];
		for(int j=0;j<n;++j){
			nx_hp[j]=hp[j];
		}
		if(mag[i].type==ALL){
			for(int j=0;j<n;++j){
				nx_hp[j]-=mag[i].damage;
			}
			solve( n,nx_hp,m,mag,now+mag[i].mp,ans );
		}else{
			for(int j=0;j<n;++j){
				if(nx_hp[j]>0){
					nx_hp[j]-=mag[i].damage;
					solve( n,nx_hp,m,mag,now+mag[i].mp,ans );
					nx_hp[j]+=mag[i].damage;
				}
			}
		}
	}
	return ;
}
int main(){
	while(true){
		int ans=INFTY;
		int n,m;
		int minmp=INFTY;
		int magsz=0;
		int hp[N]={0,};
		magic mag[M];

		scanf("%d", &n);
		if(n==0)break;
		for(int i=0;i<n;++i){
			scanf("%d", &hp[i]);
		}
		scanf("%d", &m);
		for(int i=0;i<m;++i){
			char type[17]="";
			scanf("%*s%d%s%d", &mag[magsz].mp, type, &mag[magsz].damage);
			if(strcmp(type,"All")==0)mag[magsz].type=ALL;
			else mag[magsz].type=SINGLE;
			if(mag[magsz].damage>0)
				++magsz;
			else{
				minmp=min(minmp,mag[magsz].mp);
			}
		}
		/*for(int i=0;i<magsz;++i){
			cout << "MP: " << mag[i].mp <<" TYPE: " << mag[i].type << " DAMAGE: " << mag[i].damage << endl;
		}*/
		sort(mag,mag+magsz);
		solve(n,hp,magsz,mag,0,ans);
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:28: error: 'strcmp' was not declared in this scope
   74 |                         if(strcmp(type,"All")==0)mag[magsz].type=ALL;
      |                            ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | #define M 100
Language: C++

#include <iostream>
#include <string>
#include <queue>

using namespace std;

class Magic{
public:
  string name;
  int mp;
  string target;
  int damage;
};
class Monster{
public:
  bool live;
  int hp;
  bool operator<(const Monster &s)const{
    return hp<s.hp;
  }
};

int n;
Monster mons[100];
int m;
Magic magic[100];
main(){
  while(1){
    cin >> n;
    if(n==0) break;

    for(int i=0;i<n;i++){
      cin >> mons[i].hp;
      mons[i].live=true;
    }
    cin >> m;
    for(int i=0;i<m;i++){
      cin >> magic[i].name;
      cin >> magic[i].mp;
      cin >> magic[i].target;
      cin >> magic[i].damage;
    }
    int monster=n;
    int ans=0;
    while(monster>0){
      sort(mons, mons+n);
      reverse(mons, mons+n);
      int nmax;
      double max=-1.0;
      int t;
      for(int i=0;i<m;i++){
	if(magic[i].target=="Single"){
	  for(int j=0;j<n;j++){
	    if(!mons[j].live) continue;
	    double tmp;
	    if(mons[j].hp>=magic[i].damage) tmp=(double)magic[i].damage;
	    else{
	      tmp=(double)mons[j].hp;
	      tmp+=(double)mons[j].hp-magic[i].damage;
	    }
	    tmp/=magic[i].mp;
	    if(max<tmp){
	      max=tmp;
	      nmax=i;
	    }
	    t=j;
	    break;
	  }
	}else{
	  double sum=0.0;
	  for(int j=0;j<n;j++){
	    if(!mons[j].live){
	      sum-=(double)magic[i].damage;
	    }
	    else if(mons[j].hp>=magic[i].damage) sum+=(double)magic[i].damage;
	    else{
	      sum+=(double)mons[j].hp;
	    }
	  }
	  sum/=magic[i].mp;
	  if(max<sum){
	    max=sum;
	    nmax=i;
	  }
	}
      }
      if(magic[nmax].target=="Single"){
	ans+=magic[nmax].mp;
	mons[t].hp-=magic[nmax].damage;
	if(mons[t].hp<=0){
	  mons[t].live=false;
	  monster--;
	}
      }else{
	ans+=magic[nmax].mp;
	for(int i=0;i<n;i++){
	  mons[i].hp-=magic[nmax].damage;
	  if(!mons[i].live) continue;
	  if(mons[i].hp<=0){
	    mons[i].live=false;
	    monster--;
	  }
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   27 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:46:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |       sort(mons, mons+n);
      |       ^~~~
      |       short
a.cc:47:7: error: 'reverse' was not declared in this scope
   47 |       reverse(mons, mons+n);
      |       ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

class Magic{
public:
  string name;
  int mp;
  string target;
  int damage;
};
class Monster{
public:
  bool live;
  int hp;
  bool operator<(const Monster &s)const{
    return hp<s.hp;
  }
};

int n;
Monster mons[100];
int m;
Magic magic[100];
main(){
  while(1){
    cin >> n;
    if(n==0) break;

    for(int i=0;i<n;i++){
      cin >> mons[i].hp;
      mons[i].live=true;
    }
    cin >> m;
    for(int i=0;i<m;i++){
      cin >> magic[i].name;
      cin >> magic[i].mp;
      cin >> magic[i].target;
      cin >> magic[i].damage;
    }
    int monster=n;
    int ans=0;
    while(monster>0){
      sort(mons, mons+n);
      reverse(mons, mons+n);
      int nmax;
      double max=-1.0;
      int t;
      for(int i=0;i<m;i++){
	if(magic[i].target=="Single"){
	  for(int j=0;j<n;j++){
	    if(!mons[j].live) continue;
	    double tmp;
	    if(mons[j].hp>=magic[i].damage) tmp=(double)magic[i].damage;
	    else{
	      tmp=(double)mons[j].hp;
	      tmp+=(double)mons[j].hp-magic[i].damage;
	    }
	    tmp/=magic[i].mp;
	    if(max<tmp){
	      max=tmp;
	      nmax=i;
	    }
	    t=j;
	    break;
	  }
	}else{
	  double sum=0.0;
	  for(int j=0;j<n;j++){
	    if(!mons[j].live){
	      sum-=(double)magic[i].damage;
	    }
	    else if(mons[j].hp>=magic[i].damage) sum+=(double)magic[i].damage;
	    else{
	      sum+=(double)mons[j].hp;
	    }
	  }
	  sum/=magic[i].mp;
	  if(max<sum){
	    max=sum;
	    nmax=i;
	  }
	}
      }
      if(magic[nmax].target=="Single"){
	ans+=magic[nmax].mp;
	mons[t].hp-=magic[nmax].damage;
	if(mons[t].hp<=0){
	  mons[t].live=false;
	  monster--;
	}
      }else{
	ans+=magic[nmax].mp;
	for(int i=0;i<n;i++){
	  mons[i].hp-=magic[nmax].damage;
	  if(!mons[i].live) continue;
	  if(mons[i].hp<=0){
	    mons[i].live=false;
	    monster--;
	  }
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:45:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   45 |       sort(mons, mons+n);
      |       ^~~~
      |       short
a.cc:46:7: error: 'reverse' was not declared in this scope
   46 |       reverse(mons, mons+n);
      |       ^~~~~~~
Language: C++

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

int main(){
	int n,m,d,h,i,j,r,s;
	string str;
	for(;cin>>n,n;cout<<r<<endl){
		vector<int>monster(n);
		for(h=i=0;i<n;i++){
			cin>>monster[i];
			if(h<monster[i])h=monster[i];
		}
		vector<pair<int,int> >_all,_single;
		vector<int>all(h+1),single(h+1);
		for(cin>>i;i--;){
			cin>>str>>m>>str>>d;
			if(d){
				if(s[0]=='A')_all.push_back(make_pair(m,d));
				else _single.push_back(make_pair(m,d));
			}
		}
		for(i=1;i<=h;i++){
			all[i]=9999999;
			single[i]=9999999;
			for(j=0;j<_all.size();j++){
				all[i]=min(all[i],all[max(0,i-_all[j].second)]+_all[j].first);
			}
			for(j=0;j<_single.size();j++){
				single[i]=min(single[i],single[max(0,i-_single[j].second)]+_single[j].first);
			}
		}

		r=9999999;
		for(i=0;i<=h;i++){
			s=all[i];
			for(j=0;j<monster.size();j++)s+=single[max(0,monster[j]-i)];
			if(r>s)r=s;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:37: error: invalid types 'int[int]' for array subscript
   20 |                                 if(s[0]=='A')_all.push_back(make_pair(m,d));
      |                                     ^
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 100009
using namespace std;

int dp1[10009];
int dp2[10006];
char s[25];

int num[105];

int main()
{
    int n,m,x,y;
    while(scanf("%d",&n)&&n!=0)
    {
        int ma=-1;
        for(int i=0; i<n; i++)
            scanf("%d",&num[i]);
        sort(num,num+n);
        memset(dp1,0,sizeof dp1);
        memset(dp2,0,sizeof dp2);
        scanf("%d",&m);
        for(int i=0; i<m; i++)
        {
            scanf("%s",s);
            scanf("%d",&x);
            scanf("%s",s);
            scanf("%d",&y);
//        printf("%d %d\n",x,y);
            if(s[0]=='S')
            {
                for(int j=x; j<=10000; j++)
                    dp1[j]=max(dp1[j],dp1[j-x]+y);//single
            }
            else
            {
                for(int j=x; j<=10000; j++)
                    dp2[j]=max(dp2[j],dp2[j-x]+y);//all
            }
        }
        long long ans=1(long long)<<62,sum;
        for(int i=0; i<ans; i++)
        {
//            sum=lower_bound(dp2,dp2+10000,num[i])-dp2;
            sum=i;
//        printf("%d\n",tmp);
            for(int j=0; j<n; j++)
            {
                sum+=lower_bound(dp1,dp1+10000,num[j]-dp2[i])-dp1;
            }
            ans=min(ans,sum);
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:25: error: expected primary-expression before 'long'
   43 |         long long ans=1(long long)<<62,sum;
      |                         ^~~~
a.cc:43:34: error: expression cannot be used as a function
   43 |         long long ans=1(long long)<<62,sum;
      |                                  ^
a.cc:47:13: error: 'sum' was not declared in this scope; did you mean 'num'?
   47 |             sum=i;
      |             ^~~
      |             num
Language: C++

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)10)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 15

int solve(vector<int> D){
	int res = INF, b = -1;
	for(int i = 0; i < D.size(); i++){
		if(D[i]){
			b = i
			break;
		}
	}
	if(b == -1) return 0;
	
	for(int i = b; i < D.size(); i++){
		D[i] = (D[i] - D[b] + MOD)%MOD;
		res = min(solve(D)+1,res);
	}
	
	return res;
}

signed main(){
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A;
	vector<int> D;
	string B, C;
	
	while(true){
		cin>>A;
		
		if(!A) break;
		
		D.clear();
		
		cin>>B>>C;
		
		for(int i = 0; i < A; i++){
			D.push_back((B[i] - C[i] + MOD)%MOD);
			// cout<<i<<" "<<D[i]<<endl;
		}
		
		cout<<solve(D, 0)<<endl;
	}
	
	
	return 0;
}


Compiler output:
a.cc: In function 'long long int solve(std::vector<long long int>)':
a.cc:25:30: error: expected ';' before 'break'
   25 |                         b = i
      |                              ^
      |                              ;
   26 |                         break;
      |                         ~~~~~ 
a.cc: In function 'int main()':
a.cc:62:28: error: too many arguments to function 'long long int solve(std::vector<long long int>)'
   62 |                 cout<<solve(D, 0)<<endl;
      |                       ~~~~~^~~~~~
a.cc:21:5: note: declared here
   21 | int solve(vector<int> D){
      |     ^~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(ll i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int G[10];
int ans = 1e9;
int keta;

void slove(int cnt, int* D){
	//???????????§?????´????????????????¨?
	int point;
	rep(i, keta){
		if(D[i] != G[i]){
			point = i;//???????????????????????????
			break;
		}
		if(i == keta - 1){
			ans = min(cnt, ans);
			return;
		}
	}

	reps(i, 1, keta){//????????????????????????
		cnt++;
		if(G[point] - D[point] >= 0){
			int sa = G[point] - D[point];
			reps(j, point, point + i){
				if(j > keta - 1) return;
				D[j] = (D[j] + sa) % 10;//mod
				ans = min(ans, slove(cnt, D));
			}
		}else{
			int sa = 10 + G[i] - D[i];
			reps(j, point, point + i){
				if(j > keta - 1) return;
				D[j] = (D[j] + sa) % 10;
				ans = min(ans, slove(cnt, D));
			}
		}
	}
	return;
}

int main(void){
	cin >> keta;

	int D[10];
	int d; cin >> d;
	int ten = pow(10, keta - 1);
	int i = 0;
	while(ten >= 1){
		D[i] = d / ten;
		printf("%d\n", D[i]);
		d %= ten;
		ten /= 10;
		i++;
	}

	int g; cin >> g;
	ten = pow(10, keta - 1); 
	i = 0;
	while(ten >= 1){
		G[i] = g / ten;
		g %= ten;
		ten /= 10;
		i++;
	}
	slove(0, D);
	printf("%d\n", ans);

	return 0;

}

Compiler output:
a.cc: In function 'void slove(int, int*)':
a.cc:52:53: error: invalid use of void expression
   52 |                                 ans = min(ans, slove(cnt, D));
      |                                                ~~~~~^~~~~~~~
a.cc:59:53: error: invalid use of void expression
   59 |                                 ans = min(ans, slove(cnt, D));
      |                                                ~~~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct Edge{int from, to; ll cost;};

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int dfs(vector<int> a, vector<int> b, int k, int i, int ret){
    if(i == k) return ret;
    if(a[i] == b[i]) return dfs(a, b, k, i+1, ret);
    int ret_ = INT_MAX;
    ret++;
    reppp(j, i, k){
        ret_ = min(ret_, dfs(a, b, k, j+1, ret));
        if((a[j] - b[j] + 10) % 10 != (a[i] - b[i] + 10 ) % 10) ret++;
    }
    return ret_;
}

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int k;
    while(scanf("%d", &k), k){
        string sa,sb;
        cin >> sa >> sb;
        vector<int> a(k), b(k);
        rep(k){
            a[i] = sa[i] - '0';
            b[i] = sb[i] - '0';
        }

        cout << dfs(a, b, k, 0, 0) << endl;
    }


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

#include <cstdio>
#include <vector>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)

using namespace std;

int k;

int dfs(vector<int> a, vector<int> b, int i){
    if(i == k-1) return (a[i] == b[i] ? 0LL : 1LL);

    int ret = INT_MAX, rotate = (b[i]-a[i]+10) % 10;
    vector<int> aa(a);
    aa[i] = b[i];
    reppp(j, i+1, k){
        ret = min(ret, dfs(aa, b, i+1));
        aa[j] = (a[j] + rotate) % 10;
    }
    ret = min(ret, dfs(aa, b, i+1));
    return ret + (a[i] == b[i] ? 0LL : 1LL);
}

int main(){
    while(scanf("%d", &k), k){
        char sa[10], sb[10];
        scanf("%s %s", sa, sb);
        vector<int> a(k), b(k);
        rep(k){
            a[i] = sa[i] - '0';
            b[i] = sb[i] - '0';
        }

        printf("%d\n", dfs(a, b, 0));
    }
}


Compiler output:
a.cc: In function 'int dfs(std::vector<int>, std::vector<int>, int)':
a.cc:15:15: error: 'INT_MAX' was not declared in this scope
   15 |     int ret = INT_MAX, rotate = (b[i]-a[i]+10) % 10;
      |               ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | 
a.cc:20:25: error: 'rotate' was not declared in this scope
   20 |         aa[j] = (a[j] + rotate) % 10;
      |                         ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

const int MAX_V = 200;

int V;
bool G[MAX_V][MAX_V];
int match[MAX_V];
bool used[MAX_V];

bool dfs(int v) {
	used[v] = true;
	for(int i = 0; i < V; i++) {
		if(!G[v][i]) continue;
		int u = i, w = match[u];
		if(w < 0 || (!used[w] && dfs(w))) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

int bipartite_matching() {
	int res = 0;
	memset(match, -1, sizeof(match));
	for(int v = 0; v < V; v++) {
		if(match[v] < 0) {
			memset(used, 0, sizeof(used));
			if(dfs(v)) {
				res++;
			}
		}
	}
	return res;
}

int N, M;
double xa[100], ya[100], xb[100], yb[100], v[100];

bool check(double k) {
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < M; j++) {
			double d = sqrt((xa[i] - xb[j]) * (xa[i] - xb[j]) + (ya[i] - yb[j]) * (ya[i] - yb[j]));
			G[i][j + N] = G[j + N][i] = d / v[i] <= k;
		}
	}

	return bipartite_matching() == M;
}

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


	while(cin >> N >> M, N) {
		V = N + M;
		for(int i = 0; i < N; i++) {
			cin >> xa[i] >> ya[i] >> v[i];
		}
		for(int i = 0; i < M; i++) {
			cin >> xb[i] >> yb[i];
		}

		double ng = 0, ok = 1e15;
		for(int loop = 0; loop < 100; loop++) {
			double mid = (ng + ok) / 2.0;
			if(check(mid)) ok = mid;
			else ng = mid;
		}
		cout << setprecision(15) << ok << endl;
	}

}

Compiler output:
a.cc: In function 'bool check(double)':
a.cc:50:36: error: 'sqrt' was not declared in this scope
   50 |                         double d = sqrt((xa[i] - xb[j]) * (xa[i] - xb[j]) + (ya[i] - yb[j]) * (ya[i] - yb[j]));
      |                                    ^~~~
Language: C++


  int i;
  double min,max,d;

  cout<<setprecision(8);
  cout<<setiosflags(ios::fixed);

  while(cin>>N>>M,N|M){
    v.resize(N);
    b.resize(M);
    for(i=0;i<N;i++)cin>>v[i].x>>v[i].y>>v[i].v;
    for(i=0;i<M;i++)cin>>b[i].x>>b[i].y;

    min=INT_MAX;
    p.resize(N);
    for(i=0;i<N;i++)p[i]=i;
    sort(p.begin(),p.end());
    do{

      max=0.0;
      for(i=0;i<N;i++){
	d=(v[p[i]].x-b[p[i]].x)*(v[p[i]].x-b[p[i]].x)+
	  (v[p[i]].y-b[p[i]].y)*(v[p[i]].y-b[p[i]].y);
	d=sqrt(d);
	d=d/v[p[i]].v;
	if(max<d)max=d;
      }
      if(max<min)min=max;

    }while(next_permutation(p.begin(),p.end()));

    cout<<min<<endl;
  }
}

Compiler output:
a.cc:5:3: error: 'cout' does not name a type
    5 |   cout<<setprecision(8);
      |   ^~~~
a.cc:6:3: error: 'cout' does not name a type
    6 |   cout<<setiosflags(ios::fixed);
      |   ^~~~
a.cc:8:3: error: expected unqualified-id before 'while'
    8 |   while(cin>>N>>M,N|M){
      |   ^~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;

struct data{double x,y,v;};

int main()
{
  vector<data> v,b;
  vector<int> p;
  int N,M
  int i;
  double min,max,d;

  cout<<setprecision(8);
  cout<<setiosflags(ios::fixed);

  while(cin>>N>>M,N|M){
    v.resize(N);
    b.resize(M);
    for(i=0;i<N;i++)cin>>v[i].x>>v[i].y>>v[i].v;
    for(i=0;i<M;i++)cin>>b[i].x>>b[i].y;

    min=INT_MAX;
    p.resize(N);
    for(i=0;i<N;i++)p[i]=i;
    sort(p.begin(),p.end());
    do{

      max=0.0;
      for(i=0;i<N;i++){
	d=(v[p[i]].x-b[p[i]].x)*(v[p[i]].x-b[p[i]].x)+
	  (v[p[i]].y-b[p[i]].y)*(v[p[i]].y-b[p[i]].y);
	d=sqrt(d);
	d=d/v[p[i]].v;
	if(max<d)max=d;
      }
      if(max<min)min=max;

    }while(next_permutation(p.begin(),p.end()));

    cout<<min<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: template argument 1 is invalid
   13 |   vector<data> v,b;
      |              ^
a.cc:13:14: error: template argument 2 is invalid
a.cc:16:3: error: expected initializer before 'int'
   16 |   int i;
      |   ^~~
a.cc:22:17: error: 'M' was not declared in this scope
   22 |   while(cin>>N>>M,N|M){
      |                 ^
a.cc:23:7: error: request for member 'resize' in 'v', which is of non-class type 'int'
   23 |     v.resize(N);
      |       ^~~~~~
a.cc:24:7: error: request for member 'resize' in 'b', which is of non-class type 'int'
   24 |     b.resize(M);
      |       ^~~~~~
a.cc:25:9: error: 'i' was not declared in this scope
   25 |     for(i=0;i<N;i++)cin>>v[i].x>>v[i].y>>v[i].v;
      |         ^
a.cc:26:9: error: 'i' was not declared in this scope
   26 |     for(i=0;i<M;i++)cin>>b[i].x>>b[i].y;
      |         ^
a.cc:30:9: error: 'i' was not declared in this scope
   30 |     for(i=0;i<N;i++)p[i]=i;
      |         ^
a.cc:35:11: error: 'i' was not declared in this scope
   35 |       for(i=0;i<N;i++){
      |           ^