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

int n;
int t[22][22];

int solve(int idx){
  int res = 0;
  rep(i,n){
    if(t[idx][i] > 0){
      t[i][idx] = 0;
      res = max(res,t[idx][i]+solve(i));
    }
  }
  return res;
}

int main(void){
  while(cin>>n,n){
    memset(t,0,sizeof(t));

    int sum = 0;
    rep(i,n-1){
      int a,b,cost;
      cin>>a>>b>>cost;
      t[a-1][b-1] = t[b-1][a-1] = cost;
      sum += cost * 2;
    }

    rep(i,n){
      int cnt=0, idx;
      rep(j,n){
        if(t[i][j] > 0 || t[i][j] == -1){
          cnt++;
          idx = j;
        }
      }
      if(i != 0 && cnt == 1){
        sum -= 2 * t[i][idx];
        t[i][idx] = t[idx][i]= -1;
      }
    }

    cout<<sum-solve(0)<<endl;
  }

  return 0;
}

Compiler output:
main.c: In function 'solve':
main.c:6:3: error: implicit declaration of function 'rep' [-Wimplicit-function-declaration]
    6 |   rep(i,n){
      |   ^~~
main.c:6:7: error: 'i' undeclared (first use in this function)
    6 |   rep(i,n){
      |       ^
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:11: error: expected ';' before '{' token
    6 |   rep(i,n){
      |           ^
      |           ;
main.c: In function 'main':
main.c:16:9: error: 'cin' undeclared (first use in this function)
   16 |   while(cin>>n,n){
      |         ^~~
main.c:17:5: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   17 |     memset(t,0,sizeof(t));
      |     ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
  +++ |+#include <string.h>
    1 | int n;
main.c:17:5: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   17 |     memset(t,0,sizeof(t));
      |     ^~~~~~
main.c:17:5: note: include '<string.h>' or provide a declaration of 'memset'
main.c:20:9: error: 'i' undeclared (first use in this function)
   20 |     rep(i,n-1){
      |         ^
main.c:20:15: error: expected ';' before '{' token
   20 |     rep(i,n-1){
      |               ^
      |               ;
Language: C++

#include <iostream>
using namespace std;

int n;
int t[22][22];

int solve(int idx){
  int res = 0;
  rep(i,n){
    if(t[idx][i] > 0){
      t[i][idx] = 0;
      res = max(res,t[idx][i]+solve(i));
    }
  }
  return res;
}

int main(void){
  while(cin>>n,n){
    memset(t,0,sizeof(t));

    int sum = 0;
    rep(i,n-1){
      int a,b,cost;
      cin>>a>>b>>cost;
      t[a-1][b-1] = t[b-1][a-1] = cost;
      sum += cost * 2;
    }

    rep(i,n){
      int cnt=0, idx;
      rep(j,n){
        if(t[i][j] > 0 || t[i][j] == -1){
          cnt++;
          idx = j;
        }
      }
      if(i != 0 && cnt == 1){
        sum -= 2 * t[i][idx];
        t[i][idx] = t[idx][i]= -1;
      }
    }

    cout<<sum-solve(0)<<endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   rep(i,n){
      |       ^
a.cc:9:3: error: 'rep' was not declared in this scope; did you mean 'res'?
    9 |   rep(i,n){
      |   ^~~
      |   res
a.cc: In function 'int main()':
a.cc:20:5: error: 'memset' was not declared in this scope
   20 |     memset(t,0,sizeof(t));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:23:9: error: 'i' was not declared in this scope
   23 |     rep(i,n-1){
      |         ^
a.cc:23:5: error: 'rep' was not declared in this scope
   23 |     rep(i,n-1){
      |     ^~~
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int n;
int cost[20][20];
int edgenum[20];
int dis[20];//?????????????????????????????§??????????????¢????????????????????????

void dfs(int idx,int totalcost,int parent) {
	if (edgenum[idx] == 1) {
		dis[idx] = -1;
		return;
	}
	dis[idx] = totalcost;
	for (int i = 0; i < n; i++) {
		if (cost[idx][i] > 0 && i != parent) {
			dfs(i, totalcost + cost[idx][i], idx);
		}
	}
}

int main() {
	while (cin >> n, n) {
		int ans = 0;
		for (int i = 0; i < n - 1; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
			ans += (c * 2);
		}
		for (int i = 1; i < n; i++) {
			int ct = 0, idx = 0;
			for (int j = 0; j < n; j++) {
				if (cost[i][j] > 0)ct++, idx = j;
			}
			edgenum[i] = ct;
			if (ct == 1) {
				ans -= (cost[i][idx] * 2);
			}
		}
		dfs(0, 0, -1);
		int biggest = 0;
		for (int i = 0; i < n; i++) {
			biggest = std::max(biggest, dis[i]);
		}
		std::cout << ans - biggest << std::endl;
		memset(cost, 0, sizeof(cost));
		memset(dis, 0, sizeof(dis));
		memset(edgenum, 0, sizeof(edgenum));
	}
	return 0;
}

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

#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int n;
int cost[20][20];
int edgenum[20];
int dis[20];//?????????????????????????????§??????????????¢????????????????????????

void dfs(int idx,int totalcost,int parent) {
	if (edgenum[idx] == 1) {
		dis[idx] = -1;
		return;
	}
	dis[idx] = totalcost;
	for (int i = 0; i < n; i++) {
		if (cost[idx][i] > 0 && i != parent) {
			dfs(i, totalcost + cost[idx][i], idx);
		}
	}
}

int main() {
	while (cin >> n, n) {
		int ans = 0;
		for (int i = 0; i < n - 1; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
			ans += (c * 2);
		}
		for (int i = 1; i < n; i++) {
			int ct = 0, idx = 0;
			for (int j = 0; j < n; j++) {
				if (cost[i][j] > 0)ct++, idx = j;
			}
			edgenum[i] = ct;
			if (ct == 1) {
				ans -= (cost[i][idx] * 2);
			}
		}
		dfs(0, 0, -1);
		int biggest = 0;
		for (int i = 0; i < n; i++) {
			biggest = std::max(biggest, dis[i]);
		}
		std::cout << ans - biggest << std::endl;
		memset(cost, 0, sizeof(cost));
		memset(dis, 0, sizeof(dis));
		memset(edgenum, 0, sizeof(edgenum));
	}
	return 0;
}

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

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int n;
int cost[50][50]={0};
vvi v(22);
ll maxi_cost=0,sum=0;
void dfs(int node){
    rep(i,v[node].size()){
        int to=v[node][i];
        if(v[to].size()==0)continue;
            if(v[node].size()==1)
                sum+=cost[node][to];
            else{
                sum+=2*cost[node][to];
                cmax(maxi_cost,cost[node][to]);
            }
            dfs(to);
        }
    }
int main(){
    while(cin>>n,n){
        memset(cost,0,sizeof(cost));
        maxi_cost=0;
        sum=0;
    vvi ujimatu(n+1);
    rep(i,n-1){
        int to,from,val;
        cin>>from>>to>>val;
        ujimatu[from].push_back(to);
        cost[to][from]=cost[from][to]=val;
    }
    v=ujimatu;
    dfs(1);
    cout<<sum-maxi_cost<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:9: error: 'memset' was not declared in this scope
   63 |         memset(cost,0,sizeof(cost));
      |         ^~~~~~
a.cc:23:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   22 | #include <stack>
  +++ |+#include <cstring>
   23 | #define vi vector<int>
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#include <stdlib.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int n;
int cost[50][50]={0};
vvi v(22);
ll maxi_cost=0,sum=0;
void dfs(int node){
    rep(i,v[node].size()){
        int to=v[node][i];
        if(v[to].size()==0)continue;
            if(v[node].size()==1)
                sum+=cost[node][to];
            else{
                sum+=2*cost[node][to];
                cmax(maxi_cost,cost[node][to]);
            }
            dfs(to);
        }
    }
int main(){
    while(cin>>n,n){
        memset(cost,0,sizeof(cost));
        maxi_cost=0;
        sum=0;
    vvi ujimatu(n+1);
    rep(i,n-1){
        int to,from,val;
        cin>>from>>to>>val;
        ujimatu[from].push_back(to);
        cost[to][from]=cost[from][to]=val;
    }
    v=ujimatu;
    dfs(1);
    cout<<sum-maxi_cost<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:9: error: 'memset' was not declared in this scope
   64 |         memset(cost,0,sizeof(cost));
      |         ^~~~~~
a.cc:24:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   23 | #include <stdlib.h>
  +++ |+#include <cstring>
   24 | #define vi vector<int>
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#include <stdlib.h>
#include<cstdio>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int n;
int cost[50][50]={0};
vvi v(22);
ll maxi_cost=0,sum=0;
void dfs(int node){
    rep(i,v[node].size()){
        int to=v[node][i];
        if(v[to].size()==0)continue;
            if(v[node].size()==1)
                sum+=cost[node][to];
            else{
                sum+=2*cost[node][to];
                cmax(maxi_cost,cost[node][to]);
            }
            dfs(to);
        }
    }
int main(){
    while(cin>>n,n){
        memset(cost,0,sizeof(cost));
        maxi_cost=0;
        sum=0;
    vvi ujimatu(n+1);
    rep(i,n-1){
        int to,from,val;
        cin>>from>>to>>val;
        ujimatu[from].push_back(to);
        cost[to][from]=cost[from][to]=val;
    }
    v=ujimatu;
    dfs(1);
    cout<<sum-maxi_cost<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: 'memset' was not declared in this scope
   65 |         memset(cost,0,sizeof(cost));
      |         ^~~~~~
a.cc:25:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   24 | #include<cstdio>
  +++ |+#include <cstring>
   25 | #define vi vector<int>
Language: C++

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

int num;
int a[21][21]={0};

int retcost(int Island){
	int x=0;
	for(int i=1;i<=num;i++){
		if(a[Island][i]){
			a[i][Island]=0;
			x=max(x,a[Island][i]+cost(i));
		}
	}
	return x;
}

int main(void){
	while(cin>>num,num){
		int I1,I2,t,I[num+1]={0},Cost=0;
		for(int i=1;i<num;i++){
			cin>>I1>>I2>>t;
			a[I1][I2]=a[I2][I1]=t;
			I[I1]++,I[I2]++;
			Cost+=t*2;
		}
		for(int i=2;i<=num;i++){
			for(int j=2;j<=num;j++){
				if(I[i]==1||I[j]==1){
					Cost-=a[i][j]*2;
					a[i][j]=a[j][i]=0;
				}
			}
		}
		cout<<Cost-retcost(1)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int retcost(int)':
a.cc:12:46: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   12 |                         x=max(x,a[Island][i]+cost(i));
      |                                              ^~~~
      |                                              cosl
Language: C++

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

int num;
int a[21][21];

int retcost(int Island){
	int x=0;
	for(int i=1;i<=num;i++){
		if(a[Island][i]){
			a[i][Island]=0;
			x=max(x,a[Island][i]+retcost(i));
		}
	}
	return x;
}

int main(void){
	while(cin>>num,num){
		int I1,I2,t,ans,I[num+1],Cost=0;
		memset(a,0,sizeof(a));
		memset(I,0,sizeof(I));
		for(int i=1;i<num;i++){
			cin>>I1>>I2>>t;
			a[I1][I2]=a[I2][I1]=t;
			I[I1]++,I[I2]++;
			Cost+=t*2;
		}
		for(int i=2;i<=num;i++){
			for(int j=2;j<=num;j++){
				if(I[i]==1||I[j]==1){
					Cost-=a[i][j]*2;
					a[i][j]=a[j][i]=0;
				}
			}
		}
		ans=Cost-retcost(1);
		cout<<ans<<endl;
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:40:18: error: expected '}' at end of input
   40 |         return 0;
      |                  ^
a.cc:18:15: note: to match this '{'
   18 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

int n;
int G[20][20];

int par[20];
bool dis[20];
vector<int> chil[20]; 

void make_tree(int v){
	for(int i = 0; i < n; i++){
		if(i != par[v] && G[i][v] >= 0){
			par[i] = v;
			chil[v].push_back(i);
			make_tree(i);
		}
	}
}
int dfs(int v){
	if(dis[v]){
		return 0;
	}
	int res = 0;
	int maxi = 0;
	for(int i = 0; i < n; i++){
		if(i != par[v] && G[i][v] >= 0){
			int d = dfs(i) + G[i][v];
			res += 2 * d;
			maxi = max(maxi, d);
		}
	}
	return res - maxi;
}
		

int main(){
	while(cin >> n && n){
		memset(G, -1, sizeof(G));
		fill(par, par + 20, -1);
		fill(dis, dis + 20, false);
		for(int i = 0; i < n-1;i++){
			int t, f, m;
			cin >> t >> f >> m;
			G[t-1][f-1] = G[f-1][t-1] = m;
		}
		make_tree(0);
		for(int i = 0; i < n; i++){
			if(chil[i].empty()) dis[par[i]] = true;
		}
		cout << dfs(0) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:17: error: 'memset' was not declared in this scope
   55 |                 memset(G, -1, sizeof(G));
      |                 ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <algorithm>
  +++ |+#include <cstring>
   12 | using namespace std;
Language: C++

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

struct edge{
    int to,cost;
};

int n;
vector<edge> G[30];
const int INF=1000000000;
bool passed[30];
bool passed2[30];

// ÊÉÄAµÄRXgðvZ
int rec(int s){
    passed[s]=true;
    int sumCost=0;
    bool f=false;
    for(int i = 0; i < G[s].size(); i++){
        edge e=G[s][i];
        if(s==4){
            //cout<<endl;
        }
        if(passed[e.to])
            continue;
        f=true;
        int res=rec(e.to);
        if(res!=-1)
            sumCost+=res+e.cost*2;
    }
    if(!f)
        return -1;
    return sumCost;
}

int dfs(int s){
    passed2[s]=true;
    // e[gÅÄA
    int maxCost=0;
    int idx;
    int tc=0;
    int sumCost=0;
    for(int i = 0; i < G[s].size(); i++){
        int to=G[s][i].to;
        int cost=G[s][i].cost;
        if(passed2[to])
            continue;
        memset(passed,0,sizeof(passed));
        passed[s]=true;
        int res=rec(to);
        int val=0;
        if(res!=-1)
            val+=cost*2;
        if(maxCost<val){
            sumCost+=maxCost;
            maxCost=val;
            idx=to;
            tc=cost;
        }
        else
            sumCost+=val;
    }
    if(tc==0)
        return 0;
    // àÁÆàlª¬³¢[gÖiÞ
    return dfs(idx)+tc+sumCost;
}

int main(){
    while(cin>>n&&n!=0){
        memset(passed2,0,sizeof(passed2));
        for(int i = 0; i < n; i++)
            G[i].clear();
        for(int i = 0; i < n-1; i++){
            edge e;
            int from,to;
            cin>>from>>to>>e.cost;
            from--;to--;
            e.to=to;
            G[from].push_back(e);
            e.to=from;
            G[to].push_back(e);
        }
        int res=dfs(0);
        cout<<res<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:51:9: error: 'memset' was not declared in this scope
   51 |         memset(passed,0,sizeof(passed));
      |         ^~~~~~
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 | #include <string>
a.cc: In function 'int main()':
a.cc:74:9: error: 'memset' was not declared in this scope
   74 |         memset(passed2,0,sizeof(passed2));
      |         ^~~~~~
a.cc:74:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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

int maxn;
vector<int> to[21];
int cost[21][21];
int tree[21];//その木の種類を示す //0:tree,1:leaf,2:last
bool isgo[21];


int dfs(int t,int c)
{
	int sum = 0;
	isgo[t] = true;
	bool go = false;
	for(int i=0;i<to[t].size();++i){
		int next = to[t][i];
		if(isgo[next])
			continue;
		else{
			go = true;
			int num = dfs(next,cost[t][next]);
			if(num == 0){
				tree[next] = 1;
				tree[t] = 2;
			}
			sum += num;
		}
	}
	if(go)
		return sum+c;
	else//どこにも行くところがなかった
		return 0;
}

int maxcost;

void check(int t,int sumc)//2回目のＤＦＳ・・・ムダー
{
	bool b=false;
	isgo[t] = true;
	for(int i=0;i<to[t].size();++i){
		int next = to[t][i];
		if(tree[next] == 1 || isgo[next])
			continue;
		else{
			b = true;
			check(next,cost[t][next]+sumc);
		}
	}
	if(!b){//行き先がない
		if(maxcost < sumc)
			maxcost = sumc;
	}
}

int main(void)
{
	while(1){
		cin >> maxn;
		if(maxn == 0)
			return 0;
		memset(isgo,false,sizeof(isgo));
		memset(tree,0,sizeof(tree));
		for(int i=0;i<maxn-1;++i){
			int a,b,c;
			cin >> a >> b >> c;
			to[a].push_back(b);
			to[b].push_back(a);
			cost[a][b] = c;
			cost[b][a] = c;
		}
		int sum = dfs(1,0)*2;
		memset(isgo,false,sizeof(isgo));
		maxcost = 0;
		check(1,0);
		cout << sum - maxcost << endl;
	}
	
	return 0;
}

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

int n;
int t[22][22];

int solve(int idx){
  int res = 0;
  rep(i,n){
    if(t[idx][i] > 0){
      t[i][idx] = 0;
      res = max(res,t[idx][i]+solve(i));
    }
  }
  return res;
}

int main(void){
  while(cin>>n,n){
    memset(t,0,sizeof(t));

    int sum = 0;
    rep(i,n-1){
      int a,b,cost;
      cin>>a>>b>>cost;
      t[a-1][b-1] = t[b-1][a-1] = cost;
      sum += cost * 2;
    }

    rep(i,n){
      int cnt=0, idx;
      rep(j,n){
        if(t[i][j] > 0 || t[i][j] == -1){
          cnt++;
          idx = j;
        }
      }
      if(i != 0 && cnt == 1){
        sum -= 2 * t[i][idx];
        t[i][idx] = t[idx][i]= -1;
      }
    }

    cout<<sum-solve(0)<<endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:6:7: error: 'i' was not declared in this scope
    6 |   rep(i,n){
      |       ^
a.cc:6:3: error: 'rep' was not declared in this scope; did you mean 'res'?
    6 |   rep(i,n){
      |   ^~~
      |   res
a.cc: In function 'int main()':
a.cc:16:9: error: 'cin' was not declared in this scope
   16 |   while(cin>>n,n){
      |         ^~~
a.cc:17:5: error: 'memset' was not declared in this scope
   17 |     memset(t,0,sizeof(t));
      |     ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int n;
a.cc:20:9: error: 'i' was not declared in this scope
   20 |     rep(i,n-1){
      |         ^
a.cc:20:5: error: 'rep' was not declared in this scope
   20 |     rep(i,n-1){
      |     ^~~
a.cc:41:5: error: 'cout' was not declared in this scope
   41 |     cout<<sum-solve(0)<<endl;
      |     ^~~~
a.cc:41:25: error: 'endl' was not declared in this scope
   41 |     cout<<sum-solve(0)<<endl;
      |                         ^~~~
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <cstring>
using namespace std;
typedef long long int lli;
typedef pair<int,int> P;
const int INF=100000000;
const long long int INF_=1000000000000000000;
 
int N;
vector<int> T[20];
int Cost[20][20];
int Count[20];
bool Done[20];


/*
void dfs(int v,int cost,int count){
    if(ANS<=cost) return;
    if(count==N-1){
        ANS=cost;
        return;
    }
    for(int i=0; i<T[v].size(); ++i){
        if(Cost[v][T[v][i]]!=INF){
			int tmp=Cost[v][T[v][i]];
            Cost[v][T[v][i]]=Cost[T[v][i]][v]=INF;
            dfs(v,cost,count+1);
            Cost[v][T[v][i]]=Cost[T[v][i]][v]=tmp;
			if(!Done[v][T[v][i]]){
                Done[v][T[v][i]]=true;
                dfs(T[v][i],cost+Cost[v][T[v][i]],count);
                Done[v][T[v][i]]=false;
            }
        }
    }
}
 
int main(){
	cin.tie(0);
    ios::sync_with_stdio(0);
    while(cin >> N&&N!=0){
		ANS=INF;
		for(int i=0; i<N; ++i) T[i].clear();
        memset(Done,0,sizeof(Done));
        memset(Count,0,sizeof(Count));
        fill_n((int*)Cost,20*20,INF);
        for(int i=0; i<N-1; ++i){
            int a,b,t;
            cin >> a >> b >> t;
            --a; --b;
            T[a].push_back(b);
            T[b].push_back(a);
            Cost[a][b]=Cost[b][a]=t;
            ++Count[a];
            ++Count[b];
        }
        for(int i=1; i<N; ++i){
			if(Count[i]<=1){
				for(int j=0; j<T[i].size(); ++j){
					Done[i][T[i][j]]=Done[T[i][j]][i]=true;
				}
			}
		}
        dfs(0,0,0);
        cout << ANS << endl;
    }
    return 0;
}
*/

int dfs(int v){
	int result=0;
	Done[v]=true;
	for(int i=0; i<T[v].size(); ++i){
		if(Count[T[v][i]]>1&&!Done[T[v][i]]&&Cost[v][T[v][i]]!=INF){
			result=max(result,Cost[v][T[v][i]]+dfs(T[v][i]));
		}
	}
	return result;
}

int main(){
	cin.tie(0);
    ios::sync_with_stdio(0);
    while(cin >> N&&N){
		for(int i=0; i<N; ++i) T[i].clear();
        memset(Done,0,sizeof(Done));
        memset(Count,0,sizeof(Count));
        fill_n((int*)Cost,20*20,INF);
        int sum=0;
        for(int i=0; i<N-1; ++i){
            int a,b,t;
            cin >> a >> b >> t;
            --a; --b;
            T[a].push_back(b);
            T[b].push_back(a);
            Cost[a][b]=Cost[b][a]=t;
            ++Count[a];
            ++Count[b];
        }
        for(int i=1; i<N; ++i){
			if(Count[i]>1){
				//cout << i << endl;
				for(int j=0; j<T[i].size(); ++j){
					if(Count[T[i][j]]>1){
						sum+=Cost[i][T[i][j]];
					}
				}
			}
		}
		
		for(int i=0; i<T[0].size(); ++i){
			//cout << Cost[0][T[0][i]] << endl;
			if(Count[T[0][i]]>1) sum+=2*Cost[0][T[0][i]];
		}
		}
		//cout << sum << endl;
		//cout << dfs(0) << endl;
        cout << sum-dfs(0) << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:122:17: error: 'sum' was not declared in this scope
  122 |         cout << sum-dfs(0) << endl;
      |                 ^~~
a.cc: At global scope:
a.cc:124:5: error: expected unqualified-id before 'return'
  124 |     return 0;
      |     ^~~~~~
a.cc:125:1: error: expected declaration before '}' token
  125 | }
      | ^
Language: Java


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		loop: while (true) {
			w = scanner.nextInt();
			h = scanner.nextInt();
			if ((w | h) == 0)
				break;
			count = 0;
			visited = new boolean[h][w];
			sx = -1;
			sy = -1;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int now = scanner.nextInt();
					if (now == 0) {
						count++;
						if (sx == -1) {
							sy = i;
							sx = j;
						}
					} else {
						visited[i][j] = true;
					}
				}
			}
			if(count%2==1){
				System.out.println("No");
				continue;
			}
			}
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (visited[i][j])
						continue;
					int count = 0;
					for (int k = 0; k < 4; k++) {
						int x = j + vx[k];
						int y = i + vy[k];
						if (!isOK(x, y))
							continue;
						if (!visited[y][x])
							count++;
					}
					if (count < 2) {
						System.out.println("No");
						continue loop;
					}
				}
			}

			System.out.println(dfs(sx, sy, 0) ? "Yes" : "No");
		}

	}

	private boolean dfs(int x, int y, int deep) {
		if (count - deep < Math.abs(x - sx) + Math.abs(y - sy))
			return false;

		for (int i = 0; i < 4; i++) {
			int nx = x + vx[i];
			int ny = y + vy[i];
			if (!isOK(nx, ny))
				continue;
			if (ny == sy && nx == sx && deep + 1 == count)
				return true;
			if (visited[ny][nx])
				continue;
			boolean res = check(nx, ny);
			if (!res)
				continue;
			visited[ny][nx] = true;
			if (dfs(nx, ny, deep + 1))
				return true;
			visited[ny][nx] = false;
		}
		return false;

	}

	private boolean check(int x, int y) {
		loop: for (int i = 4; i < vx.length; i++) {
			int nx = x + vx[i];
			int ny = y + vy[i];
			if (!isOK(nx, ny))
				continue;
			if (nx == sx && ny == sy)
				continue;
			if (visited[ny][nx])
				continue;
			int count = 0;
			for (int j = 0; j < 4; j++) {
				int nnx = nx + vx[j];
				int nny = ny + vy[j];
				if (!isOK(nnx, nny))
					continue;
				if (visited[nny][nnx])
					continue;
				count++;
				if (count == 2)
					continue loop;
			}
			return false;
		}
		return true;
	}

	private boolean isOK(int x, int y) {
		if (0 <= x && x < w && 0 <= y && y < h)
			return true;
		return false;
	}

	boolean[][] visited;
	boolean ans;
	int count, w, h, sx, sy;
	int[] vx = { 0, 1, 0, -1, 1, 1, -1, -1 };
	int[] vy = { -1, 0, 1, 0, -1, 1, 1, -1 };
}

Compiler output:
Main.java:66: error: unnamed classes are a preview feature and are disabled by default.
	private boolean dfs(int x, int y, int deep) {
	        ^
  (use --enable-preview to enable unnamed classes)
Main.java:126: error: class, interface, enum, or record expected
	int count, w, h, sx, sy;
	^
Main.java:129: error: class, interface, enum, or record expected
}
^
3 errors
Language: Java

import java.util.*;
public class No11 {

	/**
	 * @param args
	 */
	public static int[][] map;
	static int W,H,sh = 0,sw = 0;
	static boolean res = false;
	static boolean first = true;
	static int[][] d = {{0,1,0,-1},{1,0,-1,0}};
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextInt()){
			W = sc.nextInt();
			H = sc.nextInt();
			sc.nextLine();
			if(W == 0 && H == 0)break;
			map = new int[H][W];
			res = false;
			for(int i =0;i<H;i++){
				for(int j = 0;j<W;j++){
					map[i][j] = sc.nextInt();
				}
			}
			boolean invalid = true;
			loop:for(int i = 0;i<H;i++){
				for(int j = 0;j<W;j++){
					if(map[i][j] == '0'){
						sh = i;
						sw = j;
						invalid = false;
						break loop;
					}
				}
			}
			if(invalid) break;
			solve(sh,sw);
			System.out.println(res);
		}
	}
	public static void solve(int h,int w){
		map[h][w] = 1;
		if(res == true) return;
		if(isInNear(sh,sw,h,w)){
			if(filled()){
				res = true;
				return;
			}
		}
		first = false;
		for(int s = 0;s<4;s++){
			int nh,nw;
			nh = h + d[0][s];nw = w + d[1][s];
			if(0<=nh && nh<H && 0 <= nw && nw < W){
				if(map[nh][nw] == 0){
					solve(nh,nw);
				}
			}
		}
		map[h][w] = 0;

	}
	public static boolean filled(){
		boolean ans = true;
		loop:for(int i = 0;i<H;i++){
			for(int j = 0;j<W;j++){
				if(map[i][j] == 0){
					ans = false;
					break loop;
				}
			}
		}
		return ans;
	}
	public static boolean isInNear(int sx,int sy, int tx, int ty){
		for(int s = 0;s<4;s++){
			int nx = sx,ny = sy;
			nx += d[0][s];ny += d[1][s];
			if(nx == tx && ny == ty) return true;
		}
		return false;
	}

}

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

int w,h;
int d[9][9],q[9][9];
int a[4]={-1,0,1,0};
int X,Y,C,t;
int b=0;
int chk(int x,int y){
	int i=0,ans=1;
	if(q[y][x])return 0;
	q[y][x]=1;
	if(d[y][x])return y==Y&&x==X;
	for(;i<4;i++)ans+=chk(x+a[i],y+a[(i+1)%4]);
	return ans;
}
int dfs(int x,int y,int c){
	int i=0;
	if(!c&&x==X&&y==Y)return 1;
	memset(q,0,324),
	if(d[y][x]||chk(x,y) != c+(x!=X||y!=Y))return 0;
	if(b++ > 120000)return 2;
	d[y][x]=1;
	for(;i<4;i++)if(t=dfs(x+a[i],y+a[(i+1)%4],c-1))return t;
	return d[y][x]=0;
}
int main(i,j){
	for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
		memset(d,-1,324);
		for(j=0;j++<h;)for(i=0;i++<w;i++)scanf("%d",&t),(d[j][i]=t)||(++C,X=i,Y=j);
	}
	return 0;
}

Compiler output:
main.c: In function 'dfs':
main.c:17:9: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   17 |         memset(q,0,324),
      |         ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
  +++ |+#include <string.h>
    1 | int w,h;
main.c:17:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   17 |         memset(q,0,324),
      |         ^~~~~~
main.c:17:9: note: include '<string.h>' or provide a declaration of 'memset'
main.c:18:9: error: expected expression before 'if'
   18 |         if(d[y][x]||chk(x,y) != c+(x!=X||y!=Y))return 0;
      |         ^~
main.c: In function 'main':
main.c:24:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   24 | int main(i,j){
      |     ^~~~
main.c:24:5: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:25:22: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   25 |         for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
      |                      ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int w,h;
main.c:25:22: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   25 |         for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
      |                      ^~~~~
main.c:25:22: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:25:46: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   25 |         for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
      |                                              ^~~~
main.c:25:46: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:26:17: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   26 |                 memset(d,-1,324);
      |                 ^~~~~~
main.c:26:17: note: include '<string.h>' or provide a declaration of 'memset'
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
const static int dy[4] = {0, -1, 0, 1}, dx[4] = {1, 0, -1, 0};

int W, H;
int c[7][7];
pair< int, int > first;
int64 used;
set< pair< int64, unsigned char > > sets;

#define getShift(x, y) (int64)(x + y * W)
inline bool dfs(int x, int y, int bit) {
  if((used >> getShift(x, y)) & 1) return(false);
  used |= 1LL << getShift(x, y);
  for(int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
    if((bit >> getShift(nx, ny)) & 1) dfs(nx, ny, bit);
  }
  return(true);
}

inline bool check(int64 bit, int x, int y)
{
  if(sets.find(make_pair(bit, y * W + x)) != sets.end()) return(false);
  if(bit == 0) return(make_pair(x, y) == first);
  int ret = 0; used = 0LL;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(!((bit >> getShift(j, i)) & 1)) continue;
      ret += dfs(j, i, bit);
    }
  }

  if(ret >= 2) {
    if(rand() % 4 == 0) sets.insert(make_pair(bit, y * W + x));
    return(false);
  }
  for(int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
    if(!(bit >> getShift(nx, ny) & 1)) continue;
    if(check(bit&~(1LL << getShift(nx, ny)), nx, ny)) return(true);
  }
  if(rand() % 4 == 0) sets.insert(make_pair(bit, y * W + x));
  return(false);
}


int main()
{
  srand((int)"iky");
  while(scanf("%d %d",&W, &H), W) {
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        scanf("%d", &c[i][j]);
      }
    }
    int64 mask = 0LL;
    int cost = 0;
    first = make_pair(-1, -1);
    for(int i = 0; i < H; i++) {
      for(int j = 0; j < W; j++) {
        mask |= (int64)!c[i][j] << getShift(j, i);
        if(c[i][j] == 0) first = make_pair(j, i), cost++;
      }
    }
    if(cost & 1 || first == make_pair(-1, -1)) puts("No");
    else puts(check(mask, first.first, first.second) ? "Yes" : "No");
    sets.clear();
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:9: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   53 |   srand((int)"iky");
      |         ^~~~~~~~~~
Language: C++

#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#include<cassert>
#include<set>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(c)   (c).begin(),(c).end()
#define pb push_back

typedef long long ll;

bool vis[10][10];
char m[10][10];
int check[10][10];

int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

bool isout(int ney,int nex,int r,int c){
  return nex==-1||ney==-1||nex==c||ney==r;
}

bool isok(int y,int x,int r,int c){
  int all=0,cnt=0;
  rep(i,4){
    int nex=x+dx[i],ney=y+dy[i];
    if (isout(ney,nex,r,c))continue;
    all++;
    if (m[ney][nex] == '0')cnt++;
  }
  if (cnt <= 1)return false;
  return true;
}

bool vis2[10][10];
void canvisitall(int r,int c,int y,int x,
		 int &tmp){
  if (vis2[y][x])return;
  vis2[y][x]=true;
  tmp--;
  rep(i,4){
    int nex=x+dx[i],ney=y+dy[i];
    if (isout(ney,nex,r,c)||
	m[ney][nex] == '1')continue;
    canvisitall(r,c,ney,nex,tmp);
  }
}

ll geta(int r,int c){
  ll ret=0;
  rep(i,r){
    rep(j,c)ret=ret*2+vis[i][j];
  }
  return ret;
}

set<ll> S;
int ini;
bool search(int r,int c,int y,int x,int cnt,
	    int sy,int sx,int py,int px){
  if (cnt==0){
    return x==sx && y == sy;
  }
  if (vis[y][x])return false;
  check[y][x]=cnt;

  int tmp=cnt+1;
  rep(i,r)rep(j,c)vis2[i][j]=vis[i][j];
  vis2[sy][sx]=false;

  canvisitall(r,c,y,x,tmp);
  if ((x!=sx||y!=sy) && tmp != 0){
    return false;
  }

  vis[y][x]=true;

  /*
  ll tmp2=geta(r,c);
  if (S.find(tmp2) != S.end()){
    vis[y][x]=false;
    return false;
  }
  S.insert(tmp2);
  *


  rep(i,4){
    int nex=x+dx[i],ney=y+dy[i];
    if (isout(ney,nex,r,c)||
	m[ney][nex] == '1')continue;
    if (nex == px && ney == py)continue;
    if (search(r,c,ney,nex,cnt-1,sy,sx,y,x))return true;
  }
  vis[y][x]=false;
  return false;
}

main(){
  int r,c;
  while(cin>>c>>r && r){
    S.clear();
    int sx=0,sy=0;
    int cnt=0;
    bool haveans=true;
    rep(i,r){
      rep(j,c){
	cin>>m[i][j];
	if (m[i][j] == '0')sx=j,sy=i,cnt++;
	vis[i][j]=false;
      }
    }

    rep(i,r){
      rep(j,c){
	if (m[i][j]=='0'&&!isok(i,j,r,c))haveans=false;
      }
    }

    ini=cnt;
    if (ini == 1||ini == 0){
      //cout <<"Yes" << endl;
      cout <<"No" << endl;
      continue;
    }
    if (ini > 1 && haveans && search(r,c,sy,sx,cnt,sy,sx,-1,-1))
      cout << "Yes" << endl;
    else cout <<"No" << endl;
  }
  return false;
}

Compiler output:
a.cc:82:3: error: unterminated comment
   82 |   /*
      |   ^
a.cc: In function 'bool search(int, int, int, int, int, int, int, int, int)':
a.cc:80:18: error: expected '}' at end of input
   80 |   vis[y][x]=true;
      |                  ^
a.cc:64:41: note: to match this '{'
   64 |             int sy,int sx,int py,int px){
      |                                         ^
a.cc:80:12: warning: control reaches end of non-void function [-Wreturn-type]
   80 |   vis[y][x]=true;
      |   ~~~~~~~~~^~~~~
Language: C++

int w,h;
int d[9][9];
int a[4]={-1,0,1,0};
int X,Y,C,t;

int b=0;
int dfs(int x,int y,int c){
	int i=0;
	if(!c&&x==X&&y==Y)return 1;
	if(d[y][x])return 0;
	if(b++ > (1<<19))return 2;
	 d[y][x]=1;
	for(;i<4;i++)if(t=dfs(x+a[i],y+a[(i+1)%4],c-1))return t;
	return d[y][x]=0;
}
int main(i,j){
	for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
		memset(d,-1,324);
		for(j=1;j<=h;j++)for(i=1;i<=w;i++)scanf("%d",&t),(d[j][i]=t)||(++C,X=i,Y=j);
	}
	return 0;
}

Compiler output:
a.cc:16:5: error: cannot declare '::main' to be a global variable
   16 | int main(i,j){
      |     ^~~~
a.cc:16:10: error: 'i' was not declared in this scope
   16 | int main(i,j){
      |          ^
a.cc:16:12: error: 'j' was not declared in this scope
   16 | int main(i,j){
      |            ^
a.cc:16:13: error: expression list treated as compound expression in initializer [-fpermissive]
   16 | int main(i,j){
      |             ^
Language: C++

int w,h;
int d[9][9],q[9][9];
int a[4]={-1,0,1,0};
int X,Y,C,t;
int b=0;
int chk(int x,int y){
	int i=0,ans=1;
	if(q[y][x])return 0;
	q[y][x]=1;
	if(d[y][x])return y==Y&&x==X;

	for(;i<4;i++)ans+=chk(x+a[i],y+a[(i+1)%4]);
	return ans;
}
void output(int a[9][9]){
	int i,j;
	for(i=1;i<=h;i++){
		for(j=1;j<=w;j++)printf("%d",!!a[i][j]);
		puts("");
	}
}
int dfs(int x,int y,int c){
	int i=0;
	if(!c&&x==X&&y==Y)return 1;
	memset(q,0,324);
	if(d[y][x]||chk(x,y) != c+(x!=X||y!=Y))return 0;
	if(b++ > 190000)return 2;
	d[y][x]=1;
	for(;i<4;i++)if(t=dfs(x+a[i],y+a[(i+1)%4],c-1))return t;
	return d[y][x]=0;
}
int main(i,j){
	for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
		memset(d,-1,324);
		for(j=1;j<=h;j++)for(i=1;i<=w;i++)scanf("%d",&t),(d[j][i]=t)||(++C,X=i,Y=j);
	}
	return 0;
}

Compiler output:
a.cc: In function 'void output(int (*)[9])':
a.cc:18:34: error: 'printf' was not declared in this scope
   18 |                 for(j=1;j<=w;j++)printf("%d",!!a[i][j]);
      |                                  ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int w,h;
a.cc:19:17: error: 'puts' was not declared in this scope
   19 |                 puts("");
      |                 ^~~~
a.cc: In function 'int dfs(int, int, int)':
a.cc:25:9: error: 'memset' was not declared in this scope
   25 |         memset(q,0,324);
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int w,h;
a.cc: At global scope:
a.cc:32:5: error: cannot declare '::main' to be a global variable
   32 | int main(i,j){
      |     ^~~~
a.cc:32:10: error: 'i' was not declared in this scope
   32 | int main(i,j){
      |          ^
a.cc:32:12: error: 'j' was not declared in this scope
   32 | int main(i,j){
      |            ^
a.cc:32:13: error: expression list treated as compound expression in initializer [-fpermissive]
   32 | int main(i,j){
      |             ^
Language: C++

int w,h;
int d[9][9],q[9][9];
int a[4]={-1,0,1,0};
int X,Y,C,t;
int b=0;
int chk(int x,int y){
	int i=0,ans=1;
	if(q[y][x])return 0;
	q[y][x]=1;
	if(d[y][x])return y==Y&&x==X;
	for(;i<4;i++)ans+=chk(x+a[i],y+a[(i+1)%4]);
	return ans;
}
int dfs(int x,int y,int c){
	int i=0;
	if(!c&&x==X&&y==Y)return 1;
	memset(q,0,324),
	if(d[y][x]||chk(x,y) != c+(x!=X||y!=Y))return 0;
	if(b++ > 120000)return 2;
	d[y][x]=1;
	for(;i<4;i++)if(t=dfs(x+a[i],y+a[(i+1)%4],c-1))return t;
	return d[y][x]=0;
}
int main(i,j){
	for(;C=0,b=0,scanf("%d%d\n",&w,&h),h;puts(C>3&&dfs(X,Y,C)==1?"Yes":"No")){
		memset(d,-1,324);
		for(j=0;j++<h;)for(i=0;i++<w;i++)scanf("%d",&t),(d[j][i]=t)||(++C,X=i,Y=j);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int dfs(int, int, int)':
a.cc:17:9: error: 'memset' was not declared in this scope
   17 |         memset(q,0,324),
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int w,h;
a.cc:18:9: error: expected primary-expression before 'if'
   18 |         if(d[y][x]||chk(x,y) != c+(x!=X||y!=Y))return 0;
      |         ^~
a.cc: At global scope:
a.cc:24:5: error: cannot declare '::main' to be a global variable
   24 | int main(i,j){
      |     ^~~~
a.cc:24:10: error: 'i' was not declared in this scope
   24 | int main(i,j){
      |          ^
a.cc:24:12: error: 'j' was not declared in this scope
   24 | int main(i,j){
      |            ^
a.cc:24:13: error: expression list treated as compound expression in initializer [-fpermissive]
   24 | int main(i,j){
      |             ^
Language: C++


#include<cstdio>
int table[7][7],a,b,l,m;

int solve(int x,int y,int z){
	if(z==a*b)return (x==l&&y==m)?1:0;
	if(x<0 || x>=b || y<0 || y>=a ||table[x][y]==1) return 0;
	table[x][y]=1;
	int res=0;
	res=solve(x+xx[0],y+yy[0],z+1)||solve(x+xx[1],y+yy[1],z+1)||solve(x+xx[2],y+yy[2],z+1)||solve(x+xx[3],y+yy[3],z+1);
	table[x][y]=0;
	return res;	
}

int main(){
	while(scanf("%d%d",&a,&b),a,b){
		int z=0;
		for(int i=0;i<b;i++){
			for(int j=0;j<a;j++){
				scanf("%d",&table[j][i]);
				z+=table[j][i];
				if(table[j][i]==0)l=j,m=i;
			}
		}
		puts(solve(l,m,z)?"Yes":"No");	
	}
} 

Compiler output:
a.cc: In function 'int solve(int, int, int)':
a.cc:10:21: error: 'xx' was not declared in this scope; did you mean 'x'?
   10 |         res=solve(x+xx[0],y+yy[0],z+1)||solve(x+xx[1],y+yy[1],z+1)||solve(x+xx[2],y+yy[2],z+1)||solve(x+xx[3],y+yy[3],z+1);
      |                     ^~
      |                     x
a.cc:10:29: error: 'yy' was not declared in this scope; did you mean 'y'?
   10 |         res=solve(x+xx[0],y+yy[0],z+1)||solve(x+xx[1],y+yy[1],z+1)||solve(x+xx[2],y+yy[2],z+1)||solve(x+xx[3],y+yy[3],z+1);
      |                             ^~
      |                             y
Language: C++

3 4
1 0 3 0 2 1
2 3 2 5 3 4
5 3 5 5 6 4
3 2
1 0 3 0 2 1
2 3 2 5 3 4
5 3 5 5 6 4
0 0

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

import java.util.Scanner;
public class main {
	Scanner sc = new Scanner(System.in);
    int m,k,s,t;
	int kei;
	
    public void kei(){
    	m = sc.nextInt();
    	while(m!=0){
            k = sc.nextInt();
            for(int i=0;i<=k-1;i++){
            	s = sc.nextInt();
            	t = sc.nextInt();
            	kei = kei+t-s;
            }
        	if(kei>m){
        		System.out.println("OK");
        	}else{
        		System.out.println(m-kei);
        	}
        	kei = 0;
        	m =sc.nextInt();
    		
    	}
    	
    }
	public static void main(String[] args) {
		Main t = new Main();
		t.kei();

Compiler output:
Main.java:29: error: reached end of file while parsing
		t.kei();
		        ^
1 error
Language: Java

import java.util.*;

public class v02_0238_sano{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	while(true){
	    int t=scan.nextInt();
	    if(t==0){
		break;
	    }
	    int n=scan.nextInt();
	    for(int i=0;i<n;i++){
		int from=scan.nextInt();
		int to=scan.nextInt();
		t-=to-from;
	    }
	    if(t<=0){
		System.out.println("OK");
	    }else{
		System.out.println(t);
	    }
	}
    }
}

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

import java.io.*;

public class TimeToStudy{
    public static void main(String[] args){
	try{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String tmp = br.readLine();
	while(tmp != null && Integer.parseInt(tmp) != 0){
	    int norma = Integer.parseInt(tmp);
	    int times = Integer.parseInt(br.readLine());
	    int actual = 0;
	    
	    for(int i = 0; i < times; i++){
		//args[++index] ??§???????????????????£??????§????????§??????????????????????????§????????§???nt?????§?????¶???
		String[] values = br.readLine().split(" " , 2);
		actual += Integer.parseInt(values[1])- Integer.parseInt(values[0]);
	    }

	    if(actual >= norma){
		System.out.println("OK");
	    }else{
		System.out.println(norma - actual);
	    }

	    tmp = br.readLine();
	}

	}catch(IOException e){
	    System.out.println(e);
	}
	
    }
}

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

#include <stdio.h>

int main(void){

	while(1){
		int t, n, s, f, sum=0, i;
		scanf("%d", &t);
		if(t==0) break;
		scanf(" %d", &n);
		
		for(i=0; i<n; i++){
			scanf(" %d %d", &s, &f);
			sum += f-s;
		}
		
		if(sum >= t) printf("OK\n");
		else printf("%d\n", t-sum);1	
	
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:48: error: expected ';' before '}' token
   17 |                 else printf("%d\n", t-sum);1
      |                                             ^   
      |                                                ;
   18 | 
   19 |         }
      |         ~
Language: C

#include<stdio>

int main(void){
int t,n,s,f,i;

while(scanf("%d",&t)&&t!=0){
for(i=0;i<t;i++){
scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d%d",&s,&f);
t=t-s+f;
}
if(t>0)
printf("%d\n",t);
else
printf("OK\n");
}
}
return 0;
}

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

#include<stdio>

int main(void){
int t,n,s,f,i,j;

while(scanf("%d",&t)&&t!=0){
for(i=0;i<t;i++){
scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d%d",&s,&f);
t=t-s+f;
}
if(t>0)
printf("%d\n",t);
else
printf("OK\n");
}
}
return 0;
}

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