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

// Membership Management
import java.util.*;

public class Main2 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			String[][] data = new String[n][];
			for (int i = 0; i < n; i++) {
				String str = scanner.next().replace(".", "");
				data[i] = str.split("[:,]");
			}
			Queue<Integer> queue = new LinkedList<Integer>();
			Set<String> result = new HashSet<String>();
			queue.add(0);
			while (!queue.isEmpty()) {
				int group = queue.poll();
				out:for(int i=1;i<data[group].length;i++){
					for(int j=1;j<n;j++){
						if(data[j][0].equals(data[group][i])){
							queue.add(j);
							continue out;
						}
					}
					result.add(data[group][i]);
				}
			}
			System.out.println(result.size());
		}
		scanner.close();
	}
}

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

#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<list>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<string>
#define REP(it,end) for (int it = 1; it <= (end); it++)
#define FOR(it,begin,end) for (int it = (begin); it <= (end); it++)
#define ROF(it,begin,end) for (int it = (begin); it >= (end); it--)
using namespace std;
map<string,int> toi;
vector<int> mem[201];
string s,tmp,stmp;
void getans(int u)
{
	int i,j,v;
	for(i=0;i<(int)mem[u].size();i++)
	{
		v=mem[u][i];
		//cout <<"u:"<<u<<" v:"<<v<<endl;system("pause");
		if(mem[v].size()>0)
		{
			mem[u].erase(mem[u].begin()+i);
			//for(i=0;i<(int)mem[u].size();i++)cout <<mem[0][i]<<" ";cout <<endl;
			getans(v);
			for(j=0;j<(int)mem[v].size();j++)
				mem[u].push_back(mem[v][j]);
			//for(i=0;i<(int)mem[u].size();i++)cout <<mem[0][i]<<" ";cout <<endl;
		}
	}
	sort(mem[u].begin(),mem[u].end());
	mem[u].resize(unique(mem[u].begin(),mem[u].end())-mem[u].begin());
}
int main()
{
	int idx,n,slen,i,j;
	while(cin>>n&&n!=0)
	{
		idx=0;toi.clear();
		for(i=0;i<201;i++)mem[i].clear();
		getline(cin,s);
		for(i=0;i<n;i++)
		{
			getline(cin,s);
			slen=s.size();
			tmp.clear();
			for(j=0;j<slen&&s[j]!=':';j++)
				tmp+=s[j];
			if(toi.find(tmp)==toi.end())toi[tmp]=idx++;
			stmp.clear();
			//cout <<tmp<<endl;
			for(j++;j<slen;j++)
			{
				if(s[j]==','||s[j]=='.')
				{
					//cout <<stmp<<endl;
					if(toi.find(stmp)==toi.end())toi[stmp]=idx++;
					mem[toi[tmp]].push_back(toi[stmp]);
					stmp.clear();
				}
				else stmp+=s[j];
			}
		}
		//map<string,int>::iterator it;for(it=toi.begin();it!=toi.end();it++)cout <<(it->first)<<" "<<(it->second)<<endl;
		getans(0);
		//for(i=0;i<(int)mem[0].size();i++)cout <<mem[0][i]<<" ";cout <<endl;
		cout <<mem[0].size()<<endl;
	}
	return 0;
}

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

// Membership Management
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			String[][] data = new String[n][];
			for (int i = 0; i < n; i++)
				data[i] = scanner.next().replace(".", "").split("[:,]");
			Queue<Integer> queue = new LinkedList<Integer>();
			Set<String> result = new HashSet<String>();
			boolean[] visited = new boolean[n];
			Arrays.fill(visited, false);
			queue.add(0);
			visited[0] = true;
			while (!queue.isEmpty()) {
				int group = queue.poll();
				out: for (int i = 1; i < data[i].length; i++) {
					for (int j = 0; j < data.length; j++) {
						if (data[j][0].equals(data[group][i]) && !visited[j]) {
							visited[j] = true;
							queue.add(j);
							continue out;
						}
					}
					result.add(data[group][i]);
				}
			}
			System.out.println(result.size());
		}
		scanner.close();
	}
}

Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

2
development:alice,bob,design,eve.
design:carol,alice.
3
one:another.
another:yetanother.
yetanother:dave.
3
friends:alice,bob,bestfriends,carol,fran,badcompany.
bestfriends:eve,alice.
badcompany:dave,carol.
5
a:b,c,d,e.
b:c,d,e,f.
c:d,e,f,g.
d:e,f,g,h.
e:f,g,h,i.
4
aa:bb.
cc:dd,ee.
ff:gg.
bb:cc.
0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2
      | ^
Language: C++

#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
set<string> S;

vector<string> split(string s) {
    vector<string> res;
    int i=0;
    while(s[i++]!=':') {}
    string s1;
    while(i<s.size()) {
        if(s[i]!=',' && s[i]!='.') s1+=s[i];
        else {
            res.pb(s1);
            s1="";
        }
        i++;
    }

    return res;

}
string func(string s) {
    int i=0;
    string s1;
    while(s[i] != ':') {
        s1+=s[i];
        i++;
    }
    return s1;
}
void solve() {
    S.clear();
    map<string, vector<string> > group;
    string s;
    string group1;
    cin>>s;
    group1 = func(s);

    group[func(s)] = split(s);
    rep(i,n-1) {
        cin>>s;
        group[func(s)] = split(s);
    }
    for(auto& e : group[group1]) {
        // cout<<e<<endl;
        S.insert(e);
    }
    for(auto& it : group) {
        if(S.find(it.fr)!=S.end()) {
            S.erase(it.fr);
            for(auto& e : it.sc) {
                S.insert(e);
            }
        }
    }
    cout<<S.size()<<endl;
    

}
int main() {
    while(cin>>n) {
        if(n==0) break;
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:58:5: error: 'cin' was not declared in this scope
   58 |     cin>>s;
      |     ^~~
a.cc:9:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    8 | #include <climits>
  +++ |+#include <iostream>
    9 | 
a.cc:78:5: error: 'cout' was not declared in this scope
   78 |     cout<<S.size()<<endl;
      |     ^~~~
a.cc:78:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:78:21: error: 'endl' was not declared in this scope
   78 |     cout<<S.size()<<endl;
      |                     ^~~~
a.cc:9:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    8 | #include <climits>
  +++ |+#include <ostream>
    9 | 
a.cc: In function 'int main()':
a.cc:83:11: error: 'cin' was not declared in this scope
   83 |     while(cin>>n) {
      |           ^~~
a.cc:83:11: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
using namespace std;
set<string>st;
map<string,int>mp;
bool vis[105]
char s[1111111];
struct group
{
    int cnt;
    char member[11][20],name[20];
}g[105];
void dfs(int id)
{
    if(vis[id]) return ;
    vis[id]=1;
    for(int i=0;i<g[id].cnt;i++)
    {
        if(mp.find(g[id].member[i])!=mp.end())
        {
            int x=mp[g[id].member[i]];
            dfs(x);
        }
        else st.insert(g[id].member[i]);
    }
}
int main()
{
    int n;
    while(scanf("%d",&n)==1)
    {
        if(n==0) break;
        int m=0;
        mp.clear();
        st.clear();
        for(int i=0;i<n;i++)
        {
            scanf("%s",s);
            int j=0,l=strlen(s);
            while(s[j]!=':') {g[i].name[j]=s[j];j++;}
            g[i].name[j]='\0';
            mp[g[i].name]=i;
            j++;
            g[i].cnt=0;
            while(j<l)
            {
                int k=j;
                while(s[j]!='.'&&s[j]!=',')
                {
                    g[i].member[g[i].cnt][j-k]=s[j];
                    j++;
                }
                g[i].member[g[i].cnt][j-k]='\0';
                j++;
                g[i].cnt++;
            }
        }
        memset(vis,0,sizeof(vis));
        dfs(0);
        int ans=st.size();
        printf("%d\n",ans);
    }
    return 0;
}

Compiler output:
a.cc:15:1: error: expected initializer before 'char'
   15 | char s[1111111];
      | ^~~~
a.cc: In function 'void dfs(int)':
a.cc:23:8: error: 'vis' was not declared in this scope
   23 |     if(vis[id]) return ;
      |        ^~~
a.cc:24:5: error: 'vis' was not declared in this scope
   24 |     vis[id]=1;
      |     ^~~
a.cc: In function 'int main()':
a.cc:46:24: error: 's' was not declared in this scope
   46 |             scanf("%s",s);
      |                        ^
a.cc:66:16: error: 'vis' was not declared in this scope
   66 |         memset(vis,0,sizeof(vis));
      |                ^~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <string.h>
#include <cstdio>
#include <set>
#include <map>
#include <string>
#include <iostream>
#include <sstream>
#define mod 1e9+7
using namespace std;
int n,i,j,k,m,num,b[1005]={0},l,h,mp[1005][15]={0},ans;
int ds(int x)
{
    if(mp[x][0]==0) b[x]=2;
    else
    {
        if(b[x]==1) return 0;
        b[x]=1
        for(int i=1;i<=mp[x][0];i++) ds(mp[x][i]);
    }
}
int main()
{
    char s[1005][20],a[300],p[20];
    while(scanf("%d",&n)&&n>0)
    {
        num=l=ans=0;
        for(i=0;i<n;i++)
        {
            scanf(" %s",a);
            m=strlen(a);
            a[m-1]=',';
            for(j=0;j<m;j++)
            {
                if(a[j]==':') break;
                s[num][j]=a[j];
            }
            s[num][j++]='\0';
            for(k=0;k<num;k++)
                if(strcmp(s[k],s[num])==0) break;
            if(k==num) num++;
            for(l=0;j<m;j++)
            {
                if(a[j]==',')
                {
                    s[num][l]='\0';
                    l=0;
                    for(h=0;h<num;h++)
                        if(strcmp(s[h],s[num])==0) break;
                    if(h==num) num++;
                    mp[k][0]++;
                    mp[k][mp[k][0]]=h;
                }
                else s[num][l++]=a[j];
            }
        }
        ds(0);
        for(i=0;i<num;i++)
        {
            if(b[i]==2) ans++;
            b[i]=mp[i][0]=0;
        }
        printf("%d\n",ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int ds(int)':
a.cc:24:15: error: expected ';' before 'for'
   24 |         b[x]=1
      |               ^
      |               ;
   25 |         for(int i=1;i<=mp[x][0];i++) ds(mp[x][i]);
      |         ~~~    
a.cc:25:36: error: expected ';' before ')' token
   25 |         for(int i=1;i<=mp[x][0];i++) ds(mp[x][i]);
      |                                    ^
      |                                    ;
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <iterator>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>

void pushset( std::map< std::string, std::vector< std::string > > *mp, std::set< std::string > *ans, std::string name, std::set< std::string > *group, std::map< std::string, int> *f ) {
	using namespace std;
	
	if( group->find(name) != group->end() ) {
		if( f->at(name) ) return;
		f->at(name) = 1;
		for( int i = 0; i < mp->at(name).size(); i++ ) {
			pushset( mp, ans, mp->at(name)[i], group, f );
		}
	} else {
		ans->insert( name );
	}
	
}

int solve( ) {
	using namespace std;

	int n;
	cin >> n;
	if( n == 0 ) return 1;

	vector< string > ss(n);
	map< string, vector< string > > mp;
	set<string> group;
	map< string, int > flg;
	string top;

	for( int i = 0; i < n; i++ ) {

		char tstr[1000];
		char *tok;
		cin >> ss[i];
	
		for( int j = 0; j < ss[i].length(); j++ )
			tstr[j] = ss[i][j];

		tstr[ss[i].length()] = '\0';
		tok = strtok( tstr, ":,.");

		string s;
		vector< string > st;
		for( int j = 0;;j++ ) {
			if( tok == NULL ) break;
			string str = string( tok );			
			if( j == 0 ) {
				s = str;
				if( i == 0 ) top = str;
				group.insert( str );
				flg[ str ] = 0;
			} else {
				st.push_back( str );
			}
			tok = strtok( NULL, ";,.");
		}

		mp[s] = st;

 	}
	set<string> ans;
	for( int i = 0; i < mp[top].size(); i++ ) {
		pushset( &mp, &ans, mp[top][i], &group,&flg );
	}
	cout << ans.size() << endl;
	return 0;
}

int main(void){

	while( true ) {
		if( solve() ) break;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:49:23: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
   49 |                 tok = strtok( tstr, ":,.");
      |                       ^~~~~~
      |                       strtoq
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <set>
using namespace std;
int vis[1000];
map<string,int> ma;
int Sum = 0;
int Vis;
string s;
set<int> se;
vector<int> v[1000];
int tt;
char ch[100000];
void find(int x)
{
    int i,j;
    if(vis[x] == 0) return ;
    for(i=0;i<v[x].size();i++){
        if(!vis[v[x][i]]) se.insert(v[x][i]);
        else find(v[x][i]);
    }
}
int main()
{
    int n,i,j;

    while(cin >> n && n)
    {
        ma.clear();
        memset(ch,0,sizeof(ch));
        memset(vis,0,sizeof(vis));
        getchar();
        Vis = 0;
        se.clear();
        for(i=0;i<1000;i++) v[i].clear();
        tt = 1;
        for(j=0;j<n;j++)
        {
            gets(ch);
            int len = strlen(ch);
            int flag = 1;
            for(i=0;i<len;i++){
                if(ch[i] != ':' && ch[i] != ',' && ch[i] != '.')
                    s += ch[i];
                else if(ch[i] == ':' && j == 0)
                {
                    if(!ma[s]){
                        ma[s] = tt++;
                    }
                    Vis = ma[s];
                    vis[ma[s]] = 1;
                    flag = ma[s];
                    s.clear();
                }
                else if(ch[i] == ':' && j != 0){
                    if(!ma[s]){
                        ma[s] = tt++;
                    }
                    vis[ma[s]] = 1;
                    flag = ma[s];
                    s.clear();
                }
                else if(ch[i] == ',' || ch[i] == '.'){
                    if(!ma[s]){
                        ma[s] = tt++;
                    }
                    v[flag].push_back(ma[s]);
                    s.clear();
                }
            }
        }
        Sum = 0;
        find(Vis);
        cout << se.size() << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'gets' was not declared in this scope; did you mean 'getw'?
   46 |             gets(ch);
      |             ^~~~
      |             getw
Language: C++

4
1
6
4
2
10
10
10
10
10
10
10
1
901
1
10
20
15
21
95
38
46
34
82
13
5
32
120
6
15
32
25
3
2
17
71



Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 4
      | ^
Language: C++

#include<map>
#include<string>
#include<vector>
#include<sstream>
#include<iostream>

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

using namespace std;

map< string,vector<string> > f;

vector<string> solve(const string &g){
	vector<string> member=f[g];
	rep(i,member.size())if(f.count(member[i])>0){
		vector<string> tmp=solve(member[i]);
		member.erase(member.begin()+i);	// erase group name
		i--;
		member.insert(member.end(),tmp.begin(),tmp.end());
	}
	sort(member.begin(),member.end());
	member.erase(unique(member.begin(),member.end()),member.end());
	return f[g]=member;
}

int main(){
	for(int n;cin>>n,n;){
		f.clear();
		string group1;
		rep(i,n){
			string s;	cin>>s;
			rep(j,s.length())if(s[j]==':' || s[j]==',' || s[j]=='.')	s[j]=' ';
			stringstream ss(s);
			string group;	ss>>group;
			vector<string> member;
			while(ss>>s)	member.pb(s);
			f[group]=member;
			if(i==0)	group1=group;
		}
		cout<<solve(group1).size()<<endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > solve(const std::string&)':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(member.begin(),member.end());
      |         ^~~~
      |         short
a.cc:23:22: error: 'unique' was not declared in this scope
   23 |         member.erase(unique(member.begin(),member.end()),member.end());
      |                      ^~~~~~
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <set>

using namespace std;

map<string,string> m;
set<string> parsed;
set<string> result;

void dfs(string s){
  if(parsed.count(s))
    return;
  parsed.insert(s);
  string tbp = m[s]; //to be parsed
  for(int i=0; i<tbp.size(); i++)
    if(tbp[i] == ',' || tbp[i] == '.')
      tbp[i] = ' ';
  
  stringstream ss(tbp);
  for(string st; ss>>st;){
    if(m.count(st))
      dfs(st);
    else
      result.insert(st);
  }
}


int main(){
  int n;
  while(true){
    string g1;
    cin >> n;
    if(n==0)
      break;
    m.clear();
    parsed.clear();
    result.clear();
    for(int i=0; i<n; i++){
      string s, s1, s2;
      cin >> s;
      s1 = s.substr(0,s.find(':'));
      s2 = s.substr(s.find(':')+1);
      m[s1] = s2;      
      if(i==0)
	g1 = s1;
    }
    dfs(g1);
    cout << result.size() << endl;
  }
  return 0;
}
#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <set>

using namespace std;

map<string,string> m;
set<string> parsed;
set<string> result;

void dfs(string s){
  if(parsed.count(s))
    return;
  parsed.insert(s);
  string tbp = m[s]; //to be parsed
  for(int i=0; i<tbp.size(); i++)
    if(tbp[i] == ',' || tbp[i] == '.')
      tbp[i] = ' ';
  
  stringstream ss(tbp);
  for(string st; ss>>st;){
    if(m.count(st))
      dfs(st);
    else
      result.insert(st);
  }
}


int main(){
  int n;
  while(true){
    string g1;
    cin >> n;
    if(n==0)
      break;
    m.clear();
    parsed.clear();
    result.clear();
    for(int i=0; i<n; i++){
      string s, s1, s2;
      cin >> s;
      s1 = s.substr(0,s.find(':'));
      s2 = s.substr(s.find(':')+1);
      m[s1] = s2;      
      if(i==0)
	g1 = s1;
    }
    dfs(g1);
    cout << result.size() << endl;
  }
  return 0;
}

Compiler output:
a.cc:64:20: error: redefinition of 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > m'
   64 | map<string,string> m;
      |                    ^
a.cc:9:20: note: 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > m' previously declared here
    9 | map<string,string> m;
      |                    ^
a.cc:65:13: error: redefinition of 'std::set<std::__cxx11::basic_string<char> > parsed'
   65 | set<string> parsed;
      |             ^~~~~~
a.cc:10:13: note: 'std::set<std::__cxx11::basic_string<char> > parsed' previously declared here
   10 | set<string> parsed;
      |             ^~~~~~
a.cc:66:13: error: redefinition of 'std::set<std::__cxx11::basic_string<char> > result'
   66 | set<string> result;
      |             ^~~~~~
a.cc:11:13: note: 'std::set<std::__cxx11::basic_string<char> > result' previously declared here
   11 | set<string> result;
      |             ^~~~~~
a.cc:68:6: error: redefinition of 'void dfs(std::string)'
   68 | void dfs(string s){
      |      ^~~
a.cc:13:6: note: 'void dfs(std::string)' previously defined here
   13 | void dfs(string s){
      |      ^~~
a.cc:87:5: error: redefinition of 'int main()'
   87 | int main(){
      |     ^~~~
a.cc:32:5: note: 'int main()' previously defined here
   32 | int main(){
      |     ^~~~
Language: C++

#include"bits/stdc++.h"

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

using ar4 = array<int, 4>;

int main()
{
	while (true) {
		// input
		int n;
		cin >> n;
		if (!n)break;
		vector<pair<int, int>> pt(n);
		REP(i, n) {
			int p, t;
			cin >> p >> t;
			pt[i] = { p,t };
		}

		// init
		vector<vector<int>> dp(n, vector<int>(4, INF));;
		if (pt[0].second < pt[0].first) {
			cout << "NG 1" << endl;
			goto end;
		}
		dp[0][1] = pt[0].first;
		FOR(i, 1, n) {
			int back = pt[i - 1].first;
			int to = pt[i].first;
			int time = pt[i].second - pt[i - 1].second;
			// 1
			if (2 * back + to <= time)
				dp[i][1] = min(dp[i][1], dp[i - 1][1] + back + to);
			if (3 * back + to <= time)
				dp[i][1] = min(dp[i][1], dp[i - 1][2] + back + to);
			if (4 * back + to <= time)
				dp[i][1] = min(dp[i][1], dp[i - 1][3] + back + to);
			// 2
			if (2 * abs(back - to) <= time)
				dp[i][2] = min(dp[i][2], dp[i - 1][1] + abs(back - to));
			// 3
			if (3 * abs(back - to) <= time)
				dp[i][3] = min(dp[i][3], dp[i - 1][2] + abs(back - to));
			if (*min_element(dp[i].begin(), dp[i].end()) == INF) {
				cout << "NG " << i + 1 << endl;
				goto end;
			}
		}
		int res = *min_element(dp.back().begin(), dp.back().end()) + pt.back().first;
		cout << "OK " << res << endl;
	end:;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: jump to label 'end'
   65 |         end:;
      |         ^~~
a.cc:60:38: note:   from here
   60 |                                 goto end;
      |                                      ^~~
a.cc:63:21: note:   crosses initialization of 'int res'
   63 |                 int res = *min_element(dp.back().begin(), dp.back().end()) + pt.back().first;
      |                     ^~~
a.cc:65:9: error: jump to label 'end'
   65 |         end:;
      |         ^~~
a.cc:38:30: note:   from here
   38 |                         goto end;
      |                              ^~~
a.cc:63:21: note:   crosses initialization of 'int res'
   63 |                 int res = *min_element(dp.back().begin(), dp.back().end()) + pt.back().first;
      |                     ^~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const double inf=1e8;
int main(){
	int n;
	while(cin>>n,n){
		vvi dp(n+1,vi(4,inf));//hav=out
		dp[0][0]=0;
		vp in(n);
		rep(i,n)cin>>in[i].first>>in[i].second;
		rep(i,n){
			bool h=false;
			rep(j,4)if(dp[i][j]!=inf){
				pii bpos=(i?in[i-1]:pii(0,0));
				int t=dp[i][j]+bpos.first+in[i].first;
				int tim=bpos.second+bpos.first*(j+1)+in[i].first;
				if(tim<=in[i].second)dp[i+1][1]=min(dp[i+1][1],t),h=true;
				if(j!=3){
					t=dp[i][j]+abs(in[i].first-bpos.first);
					tim=bpos.second+abs(in[i].first-bpos.first)*(j+1);
					if(tim<=in[i].second)dp[i+1][j+1]=min(dp[i+1][j+1],t),h=true;
				}
			}
			if(!h){
				cout<<"NG "<<i+1<<endl;
				goto end;
			}
		}
		int out=inf;
		rep(i,4)if(dp[n][i]!=inf)out=min(out,dp[n][i]+in[n-1].first);
		cout<<"OK "<<out<<endl;
		end:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:17: error: jump to label 'end'
   64 |                 end:;
      |                 ^~~
a.cc:58:38: note:   from here
   58 |                                 goto end;
      |                                      ^~~
a.cc:61:21: note:   crosses initialization of 'int out'
   61 |                 int out=inf;
      |                     ^~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const double inf=1e8;
int main(){
	int n;
	while(cin>>n,n){
		vvi dp(n+1,vi(4,inf));//hav=out
		dp[0][0]=0;
		vp in(n);
		rep(i,n)cin>>in[i].first>>in[i].second;
		rep(i,n){
			bool h=false;
			rep(j,4)if(dp[i][j]!=inf){
				pii bpos=(i?in[i-1]:pii(0,0));
				int t=dp[i][j]+bpos.first+in[i].first;
				int tim=bpos.second+bpos.first*(j+1)+in[i].first;
				if(tim<=in[i].second)dp[i+1][1]=min(dp[i+1][1],t),h=true;
				if(j!=3){
					t=dp[i][j]+abs(in[i].first-bpos.first);
					tim=bpos.second+abs(in[i].first-bpos.first)*(j+1);
					if(tim<=in[i].second)dp[i+1][j+1]=min(dp[i+1][j+1],t),h=true;
				}
			}
			if(!h){
				cout<<"NG "<<i+1<<endl;
				goto en;
			}
		}
		int out=inf;
		rep(i,4)if(dp[n][i]!=inf)out=min(out,dp[n][i]+in[n-1].first);
		cout<<"OK "<<out<<endl;
		en:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:17: error: jump to label 'en'
   64 |                 en:;
      |                 ^~
a.cc:58:38: note:   from here
   58 |                                 goto en;
      |                                      ^~
a.cc:61:21: note:   crosses initialization of 'int out'
   61 |                 int out=inf;
      |                     ^~~
Language: C++

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int, int>P;

int dp[41][4], p[41], t[41];
int main() {
	int n;
	while (scanf("%d", &n), n) {
		rep(i, n) scanf("%d%d", &p[i + 1], &t[i + 1]);
		memset(dp, 0x3f, sizeof(dp));
		dp[0][0] = 0;
		rep(i, n) {
			bool ok = 0;
			rep(j, 4) {
				if (dp[i][j] == INF)continue;
				ok = 1;
				if (j + 1 < 4) {
					int l = t[i] + abs(p[i + 1] - p[i])*(j + 1);
					if (l <= t[i + 1])
						dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + abs(p[i + 1] - p[i]));
				}
				int l = t[i] + p[i] * (j + 1) + p[i + 1];
				if (l <= t[i + 1])
					dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + p[i] + p[i + 1]);
			}
			if (!ok) {
				printf("NG %d\n", i); goto g;
			}
		}
		int Min = *min_element(dp[n], dp[n] + 4);
		if (Min == INF)printf("NG %d\n", n);
		else printf("OK %d\n", Min+p[n]);
	g:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: jump to label 'g'
   35 |         g:;
      |         ^
a.cc:29:60: note:   from here
   29 |                                 printf("NG %d\n", i); goto g;
      |                                                            ^
a.cc:32:21: note:   crosses initialization of 'int Min'
   32 |                 int Min = *min_element(dp[n], dp[n] + 4);
      |                     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

// dp[i][j] := i??????????¢¨????????§?????????, j????¢¨???????????£???????????¨?????????????????¢
int dp[50][5];

void solve(const int n, const vector<int> & p, const vector<int> & t) {

	for (int i = 0; i < 50; ++i) for (int j = 0; j < 5; ++j) dp[i][j] = INF;
	dp[0][0] = 0; // ?????????????¨????

	for (int i = 1; i <= n + 1; ++i) { // ?????????
		for (int j = 0; j <= 3; ++j) { // ?????¨????¢¨????????°
			if(dp[i - 1][j] == INF) continue;
			// ???????????????????????????
			{
				int dist = p[i - 1] + p[i]; // ?????¢
				int time = p[i - 1] * (j + 1) + p[i]; // ??????
				if(time <= (t[i] - t[i - 1])) { // ????????????
					dp[i][1] = min(dp[i][j], dp[i - 1][j] + dist);
				}
			}
			// ??????????????????
			{
				if(j == 3) continue;
				int dist = abs(p[i] - p[i - 1]); // ?????¢
				int time = abs(p[i] - p[i - 1]) * (j + 1); // ??????
				if(time <= (t[i] - t[i - 1])) { // ????????????
					chmin(dp[i][j + 1], dp[i - 1][j] + dist);
					dp[i][j + 1] = min(dp[i][j + 1], dp[i - 1][j] + dist);
				}
			}
		}
	}

	int ans = INF;
	for (int i = 0; i < 4; ++i) chmin(ans, dp[n + 1][i]);

	if (ans == INF) {
		// ???????????§?????????????????????
		int idx = 0;
		for (int i = 0; i <= n + 1; ++i) for (int j = 0; j <= 3; ++j) {
			if (dp[i][j] != INF) idx = max(idx, i + 1);
		}
		cout << "NG " << idx << endl;
	} else {
		cout << "OK " << ans << endl;
	}
}

int main(void) {

	while(1) {
		int n; cin >> n;
		if(n == 0) break;
		vector<int> p(n + 2), t(n + 2);

		p[0] = t[0] = 0; // ???????????????????????????
		for (int i = 1; i < n + 1; ++i)  cin >> p[i] >> t[i];
		p[n + 1] = 0, t[n + 1] = INF; // ???????????????

		solve(n, p, t);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'void solve(int, const std::vector<int>&, const std::vector<int>&)':
a.cc:30:41: error: 'chmin' was not declared in this scope
   30 |                                         chmin(dp[i][j + 1], dp[i - 1][j] + dist);
      |                                         ^~~~~
a.cc:38:37: error: 'chmin' was not declared in this scope
   38 |         for (int i = 0; i < 4; ++i) chmin(ans, dp[n + 1][i]);
      |                                     ^~~~~
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const int INF = INT_MAX/10;

int main()
{
	int n;
	while(cin >> n, n) {
		vi p(n+1), t(n+1);
		FOR(i, 1, n+1) {
			cin >> p[i] >> t[i];
		}

		vvi dp(n+1, vi(3+1, INF));
		if(p[1] <= t[1]) {
			dp[1][1] = p[1];
		} else {
			cout << "NG 1" << endl;
			goto next;
		}		

		FOR(i, 2, n+1) {
			bool update = false;
			FOR(s, 1, 3+1) {
				if(dp[i-1][s] == INF) {
					continue;
				}
				int tt = t[i]-t[i-1];
				int rt = p[i-1]*(s+1) + p[i];
				if(tt < rt) {
					continue;
				} else {
					dp[i][1] = min(dp[i][1], dp[i-1][s] + p[i-1] + p[i]);
					update = true;
				}
			}

			FOR(s, 1, 2+1) {
				if(dp[i-1][s] == INF) {
					continue;
				}
				int tt = t[i] - t[i-1];
				int rt = abs(p[i]-p[i-1])*(s+1);
				if(tt < rt) {
					continue;
				} else {
					dp[i][s+1] = min(dp[i][s+1], dp[i-1][s] + abs(p[i]-p[i-1]));
					update = true;
				}
			}

			if(!update) {
				cout << "NG " << i << endl;
				goto next;
			}
		}

		int ans = INF;
		FOR(i, 1, 3+1) {
			ans = min(ans, dp[n][i]);
		}
		cout << "OK " << ans+p[n] << endl;

		next:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:94:17: error: jump to label 'next'
   94 |                 next:;
      |                 ^~~~
a.cc:84:38: note:   from here
   84 |                                 goto next;
      |                                      ^~~~
a.cc:88:21: note:   crosses initialization of 'int ans'
   88 |                 int ans = INF;
      |                     ^~~
a.cc:94:17: error: jump to label 'next'
   94 |                 next:;
      |                 ^~~~
a.cc:49:30: note:   from here
   49 |                         goto next;
      |                              ^~~~
a.cc:88:21: note:   crosses initialization of 'int ans'
   88 |                 int ans = INF;
      |                     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <set>

using namespace std;

int n;
int d[190], c[401];
int t[20][20];
set< vector<int> > S;

void search(int L, int R){
	if(L+1==R){
		vector<int> v;
		for(int i=0;i+1<n;i++)
			v.push_back(t[i][i+1]);
		S.insert(v);
		return ;
	}
	int idx = 0;
	while(c[d[idx]]==0) idx++;
	c[d[idx]]--;
	
	bool check = true;
	t[0][R-1] = t[R-1][0] = d[idx];
	for(int i=1;i<n;i++){
		if(L<i&&i<R) continue;
		if(c[t[i][R-1] = t[R-1][i] = abs(t[0][R-1]-t[0][i])]==0) check = false;
		c[t[i][R-1]]--;
	}
	if(check) search(L, R-1);
	for(int i=1;i<n;i++)
		if(i<=L||R<=i) c[t[i][R-1]]++;

	check = true;
	t[L+1][n-1] = t[n-1][L+1] = d[idx];
	for(int i=0;i+1<n;i++){
		if(L<i&&i<R) continue;
		if(c[t[i][L+1] = t[L+1][i] = abs(t[i][n-1]-t[L+1][n-1])]==0) check = false;
		c[t[i][L+1]]--;
	}
	if(check) search(L+1, R);
	for(int i=0;i+1<n;i++)
		if(i<=L||R<=i) c[t[i][L+1]]++;

	c[d[idx]]++;
}

int main(){
	while(cin >> n, n){
		S.clear();
		memset(c, 0, sizeof(c));
		for(int i=0;i<n*(n-1)/2;i++){
			cin >> d[i];
			if(i!=0) c[d[i]]++;
		}
		t[0][n-1] = t[n-1][0] = d[0];
		search(0, n-1);
		for(set< vector<int> >::iterator it=S.begin();it!=S.end();it++){
			for(int i=0;i+1<it->size();i++)
				cout << (*it)[i] << " ";
			cout << it->back() << endl;
		}
		puts("-----");
	}
}

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

#include <iostream>
#include <vector>
#include <set>

using namespace std;

int n;
int d[190], c[401];
int t[20][20];
set< vector<int> > S;

void search(int L, int R){
	if(L+1==R){
		vector<int> v;
		for(int i=0;i+1<n;i++)
			v.push_back(t[i][i+1]);
		S.insert(v);
		return ;
	}
	int idx = 0;
	while(c[d[idx]]==0) idx++;
	c[d[idx]]--;
	
	bool check = true;
	t[0][R-1] = t[R-1][0] = d[idx];
	for(int i=1;i<n;i++){
		if(L<i&&i<R) continue;
		if(c[t[i][R-1] = t[R-1][i] = abs(t[0][R-1]-t[0][i])]==0) check = false;
		c[t[i][R-1]]--;
	}
	if(check) search(L, R-1);
	for(int i=1;i<n;i++)
		if(i<=L||R<=i) c[t[i][R-1]]++;

	check = true;
	t[L+1][n-1] = t[n-1][L+1] = d[idx];
	for(int i=0;i+1<n;i++){
		if(L<i&&i<R) continue;
		if(c[t[i][L+1] = t[L+1][i] = abs(t[i][n-1]-t[L+1][n-1])]==0) check = false;
		c[t[i][L+1]]--;
	}
	if(check) search(L+1, R);
	for(int i=0;i+1<n;i++)
		if(i<=L||R<=i) c[t[i][L+1]]++;

	c[d[idx]]++;
}

int main(){
	while(cin >> n, n){
		S.clear();
		memset(c, 0, sizeof(c));
		for(int i=0;i<n*(n-1)/2;i++){
			cin >> d[i];
			if(i!=0) c[d[i]]++;
		}
		t[0][n-1] = t[n-1][0] = d[0];
		search(0, n-1);
		for(set< vector<int> >::iterator it=S.begin();it!=S.end();it++){
			for(int i=0;i+1<it->size();i++)
				cout << (*it)[i] << " ";
			cout << it->back() << endl;
		}
		cout << "-----" << endl;
	}
}

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

#include <iostream>
#include <fstream>
#include <vector>
#include <set>

using namespace std;

int n;
int d[190], c[401];
int t[20][20];
set< vector<int> > S;

int abs(int x){ x > 0 ? x : -x; }

void search(int L, int R){
	if(L+1==R){
		vector<int> v;
		for(int i=0;i+1<n;i++)
			v.push_back(t[i][i+1]);
		S.insert(v);
		return ;
	}
	int idx = 0;
	while(c[d[idx]]==0) idx++;
	c[d[idx]]--;
	
	bool check = true;
	t[0][R-1] = t[R-1][0] = d[idx];
	for(int i=1;i<n;i++){
		if(L<i&&i<R) continue;
		if(c[t[i][R-1] = t[R-1][i] = abs(t[0][R-1]-t[0][i])]==0) check = false;
		c[t[i][R-1]]--;
	}
	if(check) search(L, R-1);
	for(int i=1;i<n;i++)
		if(i<=L||R<=i) c[t[i][R-1]]++;

	check = true;
	t[L+1][n-1] = t[n-1][L+1] = d[idx];
	for(int i=0;i+1<n;i++){
		if(L<i&&i<R) continue;
		if(c[t[i][L+1] = t[L+1][i] = abs(t[i][n-1]-t[L+1][n-1])]==0) check = false;
		c[t[i][L+1]]--;
	}
	if(check) search(L+1, R);
	for(int i=0;i+1<n;i++)
		if(i<=L||R<=i) c[t[i][L+1]]++;

	c[d[idx]]++;
}

int main(){
	while(cin >> n, n){
		S.clear();
		memset(c, 0, sizeof(c));
		for(int i=0;i<n*(n-1)/2;i++){
			cin >> d[i];
			if(i!=0) c[d[i]]++;
		}
		t[0][n-1] = t[n-1][0] = d[0];
		search(0, n-1);
		for(set< vector<int> >::iterator it=S.begin();it!=S.end();it++){
			for(int i=0;i+1<it->size();i++)
				cout << (*it)[i] << " ";
			cout << it->back() << endl;
		}
		puts("-----");
	}
}

Compiler output:
a.cc: In function 'int abs(int)':
a.cc:13:33: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | int abs(int x){ x > 0 ? x : -x; }
      |                                 ^
a.cc: In function 'int main()':
a.cc:55:17: error: 'memset' was not declared in this scope
   55 |                 memset(c, 0, sizeof(c));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <set>
  +++ |+#include <cstring>
    5 |
Language: Java

import java.util.*;

public class D{
	int n,m,d;
	public void run(){
		Scanner cin = new Scanner(System.in);
		while(true){
			m = cin.nextInt();
			n = cin.nextInt();
			d = cin.nextInt();
			if(m==0) break;
			int i,j,k,l;
			int[] board = new int[n * m];
			for(i=0;i<n;i++){
				for(j=0;j<m;j++){
					board[i * m + j] = cin.nextInt();
				}
			}
			int[][] matrix = new int[n*m][n*m];
			for(i=0;i<n;i++){
				for(j=0;j<m;j++){
					for(k=0;k<n;k++){
						for(l=0;l<m;l++){
							if(Math.abs(i-k)+Math.abs(j-l) == d){
								matrix[i*m+j][k*m+l] = 1;
							}
						}
					}
					matrix[i*m+j][i*m+j] = 1;
				}
			}
			int len = n*m;
			for(i=0;i<len;i++){
				for(j=i;j<len;j++){
					if(matrix[j][i]==1) break;
				}
				if(j!=len){
					int[] tmp = matrix[j].clone();
					matrix[j] = matrix[i].clone();
					matrix[i] = tmp.clone();
					for(l=i+1;l<len;l++){
						if(matrix[l][i]==0) continue;
						for(k=i;k<len;k++){
							matrix[l][k] ^= matrix[i][k];
						}
					}
				}
			}
			for(i=0;i<len;i++){
				for(j=0;j<len;j++){
					//System.out.print(matrix[i][j] + " ");
				}
				//System.out.println();
			}
			
			int[] ret = new int[len];
			for(i=0;i<len;i++){
				if(ret[i] != board[i]){
					if(matrix[i][i]==0) break;
					else{
						for(j=i;j<len;j++){
							ret[j] ^= matrix[i][j];
						}
					}
				}
			}
			//System.out.println(i);
			if(i!=len) System.out.println(0);
			else System.out.println(1);
		}
	}

	boolean ok(int y, int x){
		return y>=0 && x >=0 && y<n && x<m;
	}
	
	public static void main(String args[]) throws Exception{
		new D().run();
	}
}

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

#include <vector>
#include <bitset>
#include <iostream>
#include <algorithm>
#define coor(i,j) ((i)+(j)*m)
#define in(i,j) (0<=(i)&&(i)<m&&0<=(j)&&(j)<n)
using namespace std;
vector<bitset<626> > M(625);

int main(){
	int m,n,d;
	int i,j,k;
	int success,ans;
	for(;cin>>m>>n>>d,d;cout<<ans<<endl){
		//create M
		for(j=0;j<n;j++)
			for(i=0;i<m;i++){
				M[coor(i,j)].reset();
			}
		}
		for(j=0;j<n;j++)
			for(i=0;i<m;i++){
				M[coor(i,j)][coor(i,j)]=1;
				cin>>k;M[coor(i,j)][m*n]=k;

				for(k=0;k<=d;k++){
					if(in(i-k,j-(d-k)))M[coor(i,j)][coor(i-k,j-(d-k))]=1;
					if(in(i+k,j-(d-k)))M[coor(i,j)][coor(i+k,j-(d-k))]=1;
					if(in(i-k,j+(d-k)))M[coor(i,j)][coor(i-k,j+(d-k))]=1;
					if(in(i+k,j+(d-k)))M[coor(i,j)][coor(i+k,j+(d-k))]=1;
				}
			}

		//solve
		k=0;
		for(i=0;i<m*n;i++){
			for(j=k;j<m*n&&!M[j][i];j++);
			if(j==m*n)continue;
			swap(M[k],M[j]);
			for(j=k+1;j<m*n;j++)if(M[j][i])M[j]^=M[k];
			k++;
		}

		//finalize
		ans=1;
		for(j=k;j<m*n;j++)if(M[j][m*n])ans=0;
	}
}

Compiler output:
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

#include <cassert>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;

constexpr double EPS = 1e-8;

struct state {
	double a, b;

	state(double a_, double b_):a(a_), b(b_) {}

	bool operator<(const state &s) const {
		return a + EPS < s.a || (abs(a - s.a) < EPS && b + EPS < s.b);
	}
};

typedef pair<double, state> P;

inline double calc(double p1, double q1, double p2, double q2, double q) {
	if(q1 == q2) return p2;
	return (q - q1) / (q2 - q1) * (p2 - p1) + p1;
}

double dijkstra(const vector<int> &x, const vector<int> &y) {
	const int n = x.size();
	const state start(x.front(), x.back());

	map<state, double> dist;
	priority_queue<P, vector<P>, greater<P>> que;

	dist[start] = 0;
	que.push({0, start});

	while(!que.empty()) {
		const auto d = que.top().first;
		const auto s = que.top().second;
		que.pop();

		if(dist[s] + EPS < d) continue;
		if(abs(s.a - s.b) < EPS) return d;

		double a = s.a;
		double b = s.b;

		for(const bool &change : {false, true}) {
			const int curr_a = upper_bound(begin(x), end(x), static_cast<int>(a)) - begin(x) - 1;
			const int curr_b = upper_bound(begin(x), end(x), static_cast<int>(b)) - begin(x) - 1;

			const double py = (abs(a - x[curr_a]) < EPS ? y[curr_a] : y[curr_b]);

			for(const int &da : {-1, 1}) {
				int next_a = curr_a + da;
				if(da == -1 && !(abs(x[curr_a] - a) < EPS)) next_a = curr_a;
				if(next_a < 0 || next_a >= n) continue;

				const bool up = (py <= y[next_a]);

				for(const int &db : {-1, 1}) {
					int next_b = curr_b + db;
					if(db == -1 && !(abs(x[curr_b] - b) < EPS)) next_b = curr_b;

					bool ok = false;
					if(0 <= next_b && next_b < n) {
						if(up) ok = (y[next_a] <= y[next_b]);
						else   ok = (y[next_a] >= y[next_b]);
					}

					if(!ok && abs(py - y[next_a]) < EPS && abs(x[curr_b] - b) < EPS) {
						ok = true;
						next_b = curr_b;
					}

					if(ok) {
						const double ny = y[next_a];

						double ax = x[next_a];
						double bx = calc(b, py, x[next_b], y[next_b], ny);

						const double next_d = d + hypot(ax - a, ny - py) + hypot(bx - b, ny - py);

						if(change) swap(ax, bx);
						const state next_s(ax, bx);

						if(!dist.count(next_s) || dist[next_s] - EPS > next_d) {
							dist[next_s] = next_d;
							que.push({next_d, next_s});
						}
					}
				}
			}

			swap(a, b);
		}
	}
	assert(false);
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(10);

	for(int n; cin >> n && n;) {
		vector<int> x(n), y(n);

		for(int i = 0; i < n; ++i) {
			cin >> x[i] >> y[i];
		}

		cout << dijkstra(x, y) << endl;
	}

	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'double dijkstra(const std::vector<int>&, const std::vector<int>&)':
a.cc:52:44: error: 'upper_bound' was not declared in this scope
   52 |                         const int curr_a = upper_bound(begin(x), end(x), static_cast<int>(a)) - begin(x) - 1;
      |                                            ^~~~~~~~~~~
Language: C++

#include <vector>
#include <map>
#include <cstdio>
using namespace std;
vector<int> a;
int N,S,W,Q,g,i;
int hard(){
	int answer = 0, base = 1, sum = 0
	map<int,int> freq;
	freq[0] = 1;
	for(i=a.size()-1; i>=0; i--){
		sum = (a[i]*base + sum) % Q;
		base = (base*10) % Q;
		if(a[i])answer += freq[sum];
		freq[sum] ++;
	}
	return answer;
}
int easy(){
	int answer = 0, nonZero = 0;
	for(i=0; i<a.size(); i++){
		nonZero += (a[i]!=0 ? 1 : 0);
		answer += (a[i]%Q==0 ? nonZero : 0);
	}
	return answer;
}
main(){for(;scanf("%d%d%d%d",&N,&S,&W,&Q),Q;printf("%d\n",(Q==2||Q==5)?easy():hard()))for(g=S,i=0,a.clear();i<N;g=(g>>1)^((g&1)?W:0),i++)a.push_back((g/7)%10);}

Compiler output:
a.cc: In function 'int hard()':
a.cc:9:9: error: expected ',' or ';' before 'map'
    9 |         map<int,int> freq;
      |         ^~~
a.cc:10:9: error: 'freq' was not declared in this scope
   10 |         freq[0] = 1;
      |         ^~~~
a.cc: At global scope:
a.cc:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   27 | main(){for(;scanf("%d%d%d%d",&N,&S,&W,&Q),Q;printf("%d\n",(Q==2||Q==5)?easy():hard()))for(g=S,i=0,a.clear();i<N;g=(g>>1)^((g&1)?W:0),i++)a.push_back((g/7)%10);}
      | ^~~~
Language: C++

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

int n,m,c;
const int M=100000001; 

void solve(){
	int res=0;
	int dp[100][100];
	int cost[100][100];
	memset(cost,-1,sizeof(cost));
	memset(dp,M,sizeof(dp));
	for(int i=0;i<m;i++){
		int in,out;
		cin>>in>>out;
		in--;out--;
		cin>>cost[in][out];
	}
	bool update=true;
	while(update){
		dp[0][0]=0;
		update=false;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(cost[j][i]<0) continue;
				if(dp[res][i]>dp[res][j]+cost[j][i]){
					update=true;
					dp[res][i]=dp[res][j]+cost[j][i];
				}
			}
		}
	}
	res++;
	while(true){
		for(int i=0;i<n;i++)
			dp[res][i]=dp[0][i];
		dp[res][0]=0;
		update=true;
		while(update){
			update=false;
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					if(cost[j][i]<0) continue;
					if(dp[res][i]>dp[res-1][j]){
						update=true;
						dp[res][i]=dp[res-1][j];
					}
					if(dp[res][i]>dp[res][j]+cost[j][i]){
						update=true;
						dp[res][i]=dp[res][j]+cost[j][i];
					}
				}
			}
		}
		if(dp[res][n-1]<=c){
			cout<<res<<endl;
			return;
		}
		res++;
	}
}
	

int main()
{
	while(cin>>n>>m>>c){
		if(n==0) break;
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(cost,-1,sizeof(cost));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <cstdio>
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
#define PB push_back
#define MP make_pair
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int memo[100][100];
vector<vector<PII> > graph;

int main(){
	while(1){
		int n,m,c;
		cin>>n>>m>>c;
		memset(memo, -1, sizeof(memo));
		if(n==0)return 0;
		graph = vector<vector<PII> >(n);
		REP(i,m){
			int x,y,r;
			scanf("%d%d%d", &x,&y,&r);
			x--, y--;
			graph[x].PB(MP(y,r));
		}
		priority_queue<TIII, vector<TIII>, greater<TIII> > q;
		q.push(MT(0, 0, 0));
		while(!q.empty()){
			TIII tmp = q.top();
			q.pop();
			if(memo[tmp.T3][tmp.T1]!=-1)continue;
			memo[tmp.T3][tmp.T1] = tmp.T2;
			if(tmp.T3 == n-1){
				cout << tmp.T1 << endl;
				break;
			}
			REP(i, graph[tmp.T3].size()){
				q.push(MT(tmp.T1+1, tmp.T2, graph[tmp.T3][i].first));
				if(tmp.T2+graph[tmp.T3][i].second <= c)q.push(MT(tmp.T1, tmp.T2+graph[tmp.T3][i].second, graph[tmp.T3][i].first));
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: 'memset' was not declared in this scope
   29 |                 memset(memo, -1, sizeof(memo));
      |                 ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <iostream>
  +++ |+#include <cstring>
    7 | #include <string>