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

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <stdlib.h>
#include <math.h>

using namespace std;

int main (void)
{
	long C,c,n,m,a[10000][10000],z[10000],o[10000];
	C = 0;
	c = 0;

	cin >> n >> m;
	c++;
	if (n == 0 && m == 0)
	{
		break;
	}
	if (c > 5)
	{
		break;
	}

	for (long i = 0; i < m; i++)    //?????????
	{
		z[i] = 0;
		o[i] = 0;
	}
	for (long i = 0; i < m; i++)
	{
		for (long j = 0; j < n; j++)
		{
			cin >> a[j][i];
			if (a[j][i] == 0)
			{
				z[i] += 1;
			}
			else
			{
				o[i] += 1;
			}
		}
	}

	for (long i = 0; i < m; i++)
	{
		if (z[i] < o[i])
		{
			for (long j = 0; j < n; j++)
			{
				if (a[j][i] == 0)
				{
					a[j][i] = 0;
					a[j][i] = 1;
				}
				else  if (a[j][i] == 1)
				{
					a[j][i] = 0;
				}
			}
		}
	}

	for (long i = 0; i < m; i++)       //?????????
	{
		z[i] = 0;
		o[i] = 0;
	}

	for (long j = 0; j < n; j++)
	{
		for (long i = 0; i < m; i++)
		{
			if (a[j][i] == 0)
			{
				z[j] += 1;
			}
			else if (a[j][i] == 1)
			{
				o[j] += 1;
			}
		}
	}

	for (long j = 0; j < n; j++)
	{
		if (z[j] < o[j])
		{
			for (long i = 0; i < m; i++)
			{
				if (a[j][i] == 0)
				{
					a[j][i] = 1;
				}
				else if (a[j][i] == 1)
				{
					a[j][i] = 0;
				}
			}
		}
	}

	for (long j = 0; j < n; j++)
	{
		for (long i = 0; i < m; i++)
		{
			if (a[j][i] == 0)
			{
				C += 1;
			}
		}
	}

	cout << C << endl;
	C = 0;

	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: break statement not within loop or switch
   26 |                 break;
      |                 ^~~~~
a.cc:30:17: error: break statement not within loop or switch
   30 |                 break;
      |                 ^~~~~
a.cc: At global scope:
a.cc:127:1: error: expected declaration before '}' token
  127 | }
      | ^
Language: C++

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

int a[102][10002], f[10], n, m;

int calc(int f[10]){
	int ans = 0;
	for(int i = 0;i < m;i++){
		int res = 0;
		for(int j = 0;j < n;j++){
			if(f[j])res += !a[j][i];
			else res += a[j][i];
		}
		ans += max(res, n-res);
	}
	return ans;
}

int solve(int k, int b){
	if(k == n)return 0;
	int a[3];
	for(int i = 0;i < 10;i++)f[i] = c[i];
	f[k] = b;
	a[0] = calc(f);
	a[1] = solve(k+1, 0);
	a[2] = solve(k+1, 1);
	sort(a, a+3);
	return a[2];
}

int main(){
	while(cin >> n >> m, n){
		for(int i = 0;i < n;i++)
		for(int j = 0;j < m;j++)cin >> a[i][j];
		int x, y;
		fill(f, f+10, 0);
		x = solve(0, 0);
		y = solve(0, 1);
		cout << max(x, y) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:31:41: error: 'c' was not declared in this scope
   31 |         for(int i = 0;i < 10;i++)f[i] = c[i];
      |                                         ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_R=10;
const int MAX_C=10000;
int pan[MAX_R][MAX_C];

int r,c;

void reverse(int row){
    for(int i=0; i<c; i++){
        if(pan[row][i]==0) pan[row][i]=1;
        else pan[row][i]=0;
    }
}

int dfs(int row, int rev){
    if(rev) reverse(row);
    if(row==(r-1)){
        if(rev) reverse(row);
        int cnt=0;
        int a,b;
        for(int j=0; j<c; j++){
            for(int i=0; i<r; j++){
                if(pan[i][j]==1) a++;
            }
            b=r-a;
            b>a?(cnt+=b):(cnt+=a);
        }
        return cnt;
    }
    a=dfs(row+1, 0);
    b=dfs(row+1, 1);
    if(rev) reverse(row);
    return a>b?a:b;
}
int solve(){
    int a=dfs(0,0);
    int b=dfs(0,1);
    return a>b?a:b;
}

int main(){
    while((cin>>r)&&(cin>>c)&&(r>0)){
        for(int i=0; i<r; i++){
            for(int j=0; j<c; j++){
                cin>>pan[i][j];
            }
        }
        cout<<solve()<<endl;
    }
}


Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:34:5: error: 'a' was not declared in this scope
   34 |     a=dfs(row+1, 0);
      |     ^
a.cc:35:5: error: 'b' was not declared in this scope
   35 |     b=dfs(row+1, 1);
      |     ^
Language: C++

/*直接对行用dfs:TLE*/
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_R=10;
const int MAX_C=10000;
int pan[MAX_R][MAX_C];

int r,c;

void reverse(int row){
    for(int i=0; i<c; i++){
        if(pan[row][i]==0) pan[row][i]=1;
        else pan[row][i]=0;
    }
}

int dfs(int row){
    if(rev) reverse(row);
    if(row==(r-1)){
        if(rev) reverse(row);
        int cnt=0;
        int a,b;
        for(int j=0; j<c; j++){
            for(int i=0; i<r; j++){
                if(pan[i][j]==1) a++;
            }
            b=r-a;
            b>a?(cnt+=b):(cnt+=a);
        }
        return cnt;
    }
    int a=dfs(row+1);
    reverse(row);
    int b=dfs(row+1);
    return a>b?a:b;
}
int solve(){
    return dfs(0);
}

int main(){
    while((cin>>r)&&(cin>>c)&&(r>0)){
        for(int i=0; i<r; i++){
            for(int j=0; j<c; j++){
                cin>>pan[i][j];
            }
        }
        cout<<solve()<<endl;
    }
}


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:21:8: error: 'rev' was not declared in this scope
   21 |     if(rev) reverse(row);
      |        ^~~
a.cc:23:12: error: 'rev' was not declared in this scope
   23 |         if(rev) reverse(row);
      |            ^~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_R=10;
const int MAX_C=10000;
int pan[MAX_R][MAX_C];

int r,c;

void reverse(int row){
    for(int i=0; i<c; i++){
        if(pan[row][i]==0) pan[row][i]=1;
        else pan[row][i]=0;
    }
}

int dfs(int row){
    if(row==(r-1)){
        if(rev) reverse(row);
        int cnt=0;
        int a,b;
        for(int j=0; j<c; j++){
            for(int i=0; i<r; j++){
                if(pan[i][j]==1) a++;
            }
            b=r-a;
            b>a?(cnt+=b):(cnt+=a);
        }
        return cnt;
    }
    int a=dfs(row+1);
    reverse(row);
    int b=dfs(row+1);
    return a>b?a:b;
}
int solve(){
    return dfs(0);
}

int main(){
    while((cin>>r)&&(cin>>c)&&(r>0)){
        for(int i=0; i<r; i++){
            for(int j=0; j<c; j++){
                cin>>pan[i][j];
            }
        }
        cout<<solve()<<endl;
    }
}


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:21:12: error: 'rev' was not declared in this scope
   21 |         if(rev) reverse(row);
      |            ^~~
Language: C++

#include<iostream>  
#include<cstring>  
#include<cstdio>  
#include<cmath>  
#include<algorithm>  
  
using namespace std;  
  
bool s[15][10005]= {0};  
  
int n, m;  
  
int dfs(int x)  
{  
    if(x==n+1)  
    {  
        int sum=0;  
        int term=0;  
        for(int j=1;j<=m;j++)  
        {  
            for(int i=1;i<=n;i++)  
                if(s[i][j]==1)term++;  
            sum += term > n-term ? term : n-term;  
            term=0;  
        }  
        return sum;  
    }  
    int a=dfs(x+1);  
    for(int i=1;i<=m;i++)  
        s[x][i]=!s[x][i];  
    int b=dfs(x+1);  
    return a>b?a:b;
}  
  
int main()  
{  
    //freopen("in.in","r",stdin);  
    while(scanf("%d%d",&n,&m)!=EOF)  
    {  
        if(n==0&&m==0)break;  
        ans=0;  
        for(int i=1; i<=n; i++)  
            for(int j=1; j<=m; j++)  
                scanf("%d",&s[i][j]);  
        dfs(1);  
        printf("%d\n",ans);  
    }  
    return 0;  
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |         ans=0;
      |         ^~~
      |         abs
Language: C++

#include<iostream>  
#include<cstring>  
#include<cstdio>  
#include<cmath>  
#include<algorithm>  
  
using namespace std;  
  
bool s[15][10005]= {0};  
  
int n, m;  

void reverse(int row){
    for(int i=1; i<=c; i++){
        if(s[row][i]==0) s[row][i]=1;
        else s[row][i]=0;
    }
}

int dfs(int x)  
{  
    if(x==n+1)  
    {  
        int sum=0;  
        int term=0;  
        for(int j=1;j<=m;j++)  
        {  
            for(int i=1;i<=n;i++)  
                if(s[i][j]==1)term++;  
            sum += term > n-term ? term : n-term;  
            term=0;  
        }  
        return sum;  
    }  
    int a=dfs(x+1);  
    reverse(x);
    //for(int i=1;i<=m;i++)  
      //  s[x][i]=!s[x][i];  
    int b=dfs(x+1);  
    return a>b?a:b;
}  
  
int main()  
{  
    //freopen("in.in","r",stdin);  
    while(scanf("%d%d",&n,&m)!=EOF)  
    {  
        if(n==0&&m==0)break;   
        for(int i=1; i<=n; i++)  
            for(int j=1; j<=m; j++)  
                scanf("%d",&s[i][j]);  
        cout<<dfs(1)<<endl;  
    }  
    return 0;  
} 


Compiler output:
a.cc: In function 'void reverse(int)':
a.cc:14:21: error: 'c' was not declared in this scope
   14 |     for(int i=1; i<=c; i++){
      |                     ^
Language: C++

#include<iostream>  
#include<cstring>  
#include<cstdio>  
#include<cmath>  
#include<algorithm>  
  
using namespace std;  
  
bool s[15][10005]= {0};  
  
int n, m;  

void reverse(int row){
    for(int i=1; i<=m; i++){
        if(s[row][i]==0) s[row][i]=1;
        else s[row][i]=0;
    }
}

int dfs(int x)  
{  
    if(x==n+1)  
    {  
        int sum=0;  
        int term=0;  
        for(int j=1;j<=m;j++)  
        {  
            for(int i=1;i<=n;i++)  
                if(s[i][j]==1)term++;  
            //sum += term > n-term ? term : n-term;  
            tern>n-tern?(sum+=term):(sum+=(n-term));
            term=0;  
        }  
        return sum;  
    }  
    int a=dfs(x+1);  
    reverse(x);
    //for(int i=1;i<=m;i++)  
      //  s[x][i]=!s[x][i];  
    int b=dfs(x+1);  
    return a>b?a:b;
}  
  
int main()  
{  
    //freopen("in.in","r",stdin);  
    while(scanf("%d%d",&n,&m)!=EOF)  
    {  
        if(n==0&&m==0)break;   
        for(int i=1; i<=n; i++)  
            for(int j=1; j<=m; j++)  
                scanf("%d",&s[i][j]);  
        cout<<dfs(1)<<endl;  
    }  
    return 0;  
}  


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:31:13: error: 'tern' was not declared in this scope; did you mean 'term'?
   31 |             tern>n-tern?(sum+=term):(sum+=(n-term));
      |             ^~~~
      |             term
Language: C++

#include <algorithm>
#include <cstdio>
using namespace std;

const int MAX_R=15;
const int MAX_C=10005;
bool pan[MAX_R][MAX_C]={0};

int r,c;

void reverse(int row){
    for(int i=0; i<c; i++){
        if(pan[row][i]==0) pan[row][i]=1;
        else pan[row][i]=0;
    }
}

int dfs(int row){
    if(row==r){
        int cnt=0;
        int a,b;
        for(int j=0; j<c; j++){
            a=0;
            for(int i=0; i<r; j++){
                if(pan[i][j]==1) a++;
            }
            b=r-a;
            a>r-a?(cnt+=a):(cnt+=(r-a));
        }
        return cnt;
    }
    int a=dfs(row+1);
    reverse(row);
    int b=dfs(row+1);
    return a>b?a:b;
}

int main(){
    while((scanf("%d%d", &r, &c)!=EOF)){
        if(r==0&&c==0) break;
        for(int i=0; i<r; i++){
            for(int j=0; j<c; j++){
                cin>>pan[i][j];
            }
        }
        cout<<dfs(0)<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'cin' was not declared in this scope
   43 |                 cin>>pan[i][j];
      |                 ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:46:9: error: 'cout' was not declared in this scope
   46 |         cout<<dfs(0)<<endl;
      |         ^~~~
a.cc:46:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:46:23: error: 'endl' was not declared in this scope
   46 |         cout<<dfs(0)<<endl;
      |                       ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <cstdio>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm.h>

int n,m;
int sen[10][10000];
int maxi;

void saiki(int dep){
	if(dep>=m){
		int cont=0;
		for(int i=0;i<m;i++){
			int con[2];
			con[0]=0;con[1]=0;
			for(int j=0;j<n;j++){
				con[sen[j][i]]++;
			}
			cont+=max(con[0],con[1]);
		}
		if(cont>maxi){
			maxi=cont;
		}
		return;
	}
	
	saiki(dep+1);
	for(int i=0;i<m;i++){
		if(sen[dep][i]==0){
			sen[dep][i]=1;
		}else{
			sen[dep][i]=0;
		}
	}
	
	saiki(dep+1);
	for(int i=0;i<m;i++){
		if(sen[dep][i]==0){
			sen[dep][i]=1;
		}else{
			sen[dep][i]=0;
		}
	}
}

int main(){
		while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				scanf("%d",&sen[i][j]);
			}
		}
		maxi=0;
		saiki(0);
		
		printf("%d\n",maxi);
	}
}

Compiler output:
a.cc:2:9: fatal error: algorithm.h: No such file or directory
    2 | #include<algorithm.h>
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<algorithm>

int n,m;
int sen[10][10000];
int maxi;

void saiki(int dep){
	if(dep>=m){
		int cont=0;
		for(int i=0;i<m;i++){
			int con[2];
			con[0]=0;con[1]=0;
			for(int j=0;j<n;j++){
				con[sen[j][i]]++;
			}
			cont+=max(con[0],con[1]);
		}
		if(cont>maxi){
			maxi=cont;
		}
		return;
	}
	
	saiki(dep+1);
	for(int i=0;i<m;i++){
		if(sen[dep][i]==0){
			sen[dep][i]=1;
		}else{
			sen[dep][i]=0;
		}
	}
	
	saiki(dep+1);
	for(int i=0;i<m;i++){
		if(sen[dep][i]==0){
			sen[dep][i]=1;
		}else{
			sen[dep][i]=0;
		}
	}
}

int main(){
		while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				scanf("%d",&sen[i][j]);
			}
		}
		maxi=0;
		saiki(0);
		
		printf("%d\n",maxi);
	}
}

Compiler output:
a.cc: In function 'void saiki(int)':
a.cc:17:31: error: 'max' was not declared in this scope; did you mean 'std::max'?
   17 |                         cont+=max(con[0],con[1]);
      |                               ^~~
      |                               std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<stdio.h>
int r,c,s[10][10000],n;

int f(int d[10][10000],bool t[10]){
	int max=0,i,j,jk;
	for(i=0;i<r;i++){
		if(t[i]){
			for(j=0;j<c;j++){
				d[i][j]= 1-d[i][j];
			}
		}
	}
	for(i=0;i<r;i++){
		jk=0;
		for(j=0;j<c;j++){
			jk+=d[i][j];
		}
		if(jk>c-jk) max+=jk;
		else max+=c-jk;
	}
	
	return max;
}
void search(bool turn[10],int k){
	if(r==k){
		int o;
		o=f(s,turn);
		if(o>n)n=o;
	}
	else{
		turn[k]=true;
		search(turn,k+1);
		turn[k]=false;
		search(turn,k+1);
	}
}

void main(){
	int i,j;
	bool b[10];
	for(;;){
		scanf("%d%d",&r,&c);
		if(!r && !c)break;
		n=0;
		for(i=0;i<r;i++) for(j=0;j<c;j++) scanf("%d",&s[i][j]);
		search(b,0);
		printf("%d\n",n+3);
	}
}

Compiler output:
a.cc:38:1: error: '::main' must return 'int'
   38 | void main(){
      | ^~~~
Language: C++

#include<string.h>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
#define INF 10000000

int max(int a,int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
int main(){
	while(1){
		int senbei[10][1000];
		int r,c,i,count,a,ans=0;
		int d[10];
		cin>>r>>c;
		if(r==0&&c==0)break;
		for(i=0;i<r;i++){
			d[i]=0;
			for(int j=0;j<c;j++){
				cin>>senbei[i][j];
			}
		
		}
		for (int i = 0; i < (1 << r); i++) {
			a=0;
			for (int j = 0; j < r; j++) {
				d[j]=((i >> j) & 1);
			}
			for(int j=0;j<c;j++){
				count=0;
				for(int k=0;k<r;k++){
					if(senbei[k][j]==d[k]){
						count++;
					}
				}
				if(count>r/2){
					a+=count;
				}else{
					a+=(r-count);
				}
			}
			ans=max(ans,a);
		}
		cout<<ans<<endl;
	}
	return 0;
}	

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'cin' was not declared in this scope
   21 |                 cin>>r>>c;
      |                 ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include<queue>
  +++ |+#include <iostream>
    6 | using namespace std;
a.cc:50:17: error: 'cout' was not declared in this scope
   50 |                 cout<<ans<<endl;
      |                 ^~~~
a.cc:50:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:50:28: error: 'endl' was not declared in this scope
   50 |                 cout<<ans<<endl;
      |                            ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #include<queue>
  +++ |+#include <ostream>
    6 | using namespace std;
Language: C++

#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
while(true) {
int r, c;
int fld[10000] = {0};
scanf("%d%d", &r, &c);
if(r == 0)
break;
for(int i = 0; i < r; ++i) {
for(int j = 0; j < c; ++j) {
int t;
scanf("%d", %t);
fld[j] |= t << i;
}
}
int ans = 0;
for(int bit = 0; bit < (1 << r); ++bit) {
int sum = 0;
for(int i = 0; i < c; ++i) {
int f = fld[i] ^ bit;
int x = 0;
for(int j = 0; j < r; ++j)
x += (f >> j) & 1;
sum += max(x, r - x);
}
ans = max(ans, sum);
}
printf("%d\n", ans);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: expected primary-expression before '%' token
   16 | scanf("%d", %t);
      |             ^
Language: C++

#include <iostream>

using namespace std;

const int MAX_R = 10, MAX_C = 10000;
int osenbei[MAX_R][MAX_C];
int tosenbei[MAX_R][MAX_C];
int R, C;
int A;

void dfs(int depth, int turn){
    if(depth == R){
        int a = 0;
        memcpy(tosenbei, osenbei, sizeof(osenbei));
        for(int i=0; i<R; i++){
            if(turn & 1<<i){
                int *row = tosenbei[i];
                for(int j=0; j<C; j++)
                    row[j] ^= 1;
            }
        }
        for(int i=0; i<C; i++){
            int s = 0;
            for(int j=0; j<R; j++)
                s += tosenbei[j][i];
            a += max(s, R-s);
        }
        A = max(a, A);
    }else{
        dfs(depth + 1, turn);
        dfs(depth + 1, turn ^ (1<<depth));
    }
}

void solve(){
    A = 0;
    dfs(0, 0);
    cout << A << endl;
}

int main(){
    while(scanf("%d %d", &R, &C), R|C){
        for(int i=0; i<R; i++)
            for(int j=0; j<C; j++)
                scanf("%d", &osenbei[i][j]);
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:14:9: error: 'memcpy' was not declared in this scope
   14 |         memcpy(tosenbei, osenbei, sizeof(osenbei));
      |         ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <cstring>
using namespace std;
int main(){
	int h,w;
	while(scanf("%d%d",&h,&w),(h|w)){
		bool field[16][100010] = {{0}};
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				int a;
				scanf("%d",&a);
				field[i][j] = a == 1;
			}
		}
		int ans = 0;
		for(int i = 0; i < (1 << h); i++){
			bool board[16][100010];
			for(int j = 0; j < h; j++){
				//j陦檎岼繧偵?縺」縺上ｊ霑斐☆縺ェ繧?				if(i & (1 << j)){
					for(int k = 0; k < w; k++){
						board[j][k] = !field[j][k];
					}
				}
				else{
					for(int k = 0; k < w; k++){
						board[j][k] = field[j][k];
					}
				}
			}
			for(int j = 0; j < w; j++){
				int black = 0,white = 0;
				for(int k = 0; k < h; k++){
					if(board[k][j]) black++;
					else white++;
				}
				if(black > white){
					for(int k = 0; k < h; k++){
						board[k][j] = !board[k][j];
					}
				}
			}
			int cnt = 0;
			for(int j = 0; j < h; j++){
				for(int k = 0; k < w; k++){
					if(!board[j][k])cnt++;
				}
			}
			ans = max(ans,cnt);
		}
		printf("%d\n",ans);
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:33: error: 'else' without a previous 'if'
   31 |                                 else{
      |                                 ^~~~
a.cc:33:55: error: 'j' was not declared in this scope
   33 |                                                 board[j][k] = field[j][k];
      |                                                       ^
a.cc:40:44: error: 'board' was not declared in this scope
   40 |                                         if(board[k][j]) black++;
      |                                            ^~~~~
a.cc:45:49: error: 'board' was not declared in this scope
   45 |                                                 board[k][j] = !board[k][j];
      |                                                 ^~~~~
a.cc:52:45: error: 'board' was not declared in this scope
   52 |                                         if(!board[j][k])cnt++;
      |                                             ^~~~~
a.cc:57:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |                 printf("%d\n",ans);
      |                               ^~~
      |                               abs
a.cc: At global scope:
a.cc:59:5: error: expected unqualified-id before 'return'
   59 |     return 0;
      |     ^~~~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^
Language: Java

import java.util.*;
public class P0526{
    int[][] M = new int[101][101];
    int [] d = new int[101];
    int[] flg = new int[101];
    int a,n,m,c,e,k,min,z;
    public void compute(){
	Scanner scan = new Scanner(System.in);
	for(int i=0;i<101;i++){
	    for(int j=0;j<101;j++){
		M[i][j]=99999999;
	    }
	    d[i]=99999999;
	    flg[i]=0;
	}
	n=scan.nextInt();
	k=scan.nextInt();
	for(int i=0;i<k;i++){
	    a=scan.nextInt();
	    if(a==0){
		c=scan.nextInt();
		e=scan.nextInt();
		for(int j=1;j<=n;j++){
		    d[j]=99999999;
		    flg[j]=0;
		    
		}
		d[c]=0;
		while(true){
		    min=99999999;
		    for(int j=1;j<=n;j++){
			if(d[j]<min&&flg[j]==0){
			    min=d[j];
			    m=j;
			}
		    }
		    if(min==99999999)break;
		    flg[m]=1;
		    for(int j=1;j<=n;j++){
			if(d[j]>d[m]+M[m][j]){
			    d[j]=d[m]+M[m][j];
			}
		    }
		}
		if(d[e]==99999999){
		    System.out.println(-1);
		}else{
		    System.out.println(d[e]);
		}

	    }else{
		c=scan.nextInt();
		e=scan.nextInt();
		z=scan.nextInt();
		if(M[c][e]>z){
		    M[c][e]=z;
		    M[e][c]=z;
		}
	    }
	}
		
    }
    public static void main(String[] args){
	P0526 p = new P0526();
	p.compute();
    }
}

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

import java.util.*;
public class Main{
    int max =(1<<27);
    int[][] M = new int[101][101];
    int [] d = new int[101];
    int[] flg = new int[101];
    int a,n,m,c,e,k,min,z;
    public void compute(){
	Scanner scan = new Scanner(System.in);
	for(int i=0;i<101;i++){
	    for(int j=0;j<101;j++){
		M[i][j]=;
	    }
	    d[i]=max;
	    flg[i]=0;
	}
	n=scan.nextInt();
	k=scan.nextInt();
	for(int i=0;i<k;i++){
	    a=scan.nextInt();
	    if(a==0){
		c=scan.nextInt();
		e=scan.nextInt();
		for(int j=1;j<=n;j++){
		    d[j]=max;
		    flg[j]=0;
		    
		}
		d[c]=0;
		while(true){
		    min=max;
		    for(int j=1;j<=n;j++){
			if(d[j]<min&&flg[j]==0){
			    min=d[j];
			    m=j;
			}
		    }
		    if(min==max)break;
		    flg[m]=1;
		    for(int j=1;j<=n;j++){
			if(d[j]>d[m]+M[m][j]){
			    d[j]=d[m]+M[m][j];
			}
		    }
		}
		if(d[e]==max){
		    System.out.println(-1);
		}else{
		    System.out.println(d[e]);
		}

	    }else{
		c=scan.nextInt();
		e=scan.nextInt();
		z=scan.nextInt();
		if(M[c][e]>z){
		    M[c][e]=z;
		    M[e][c]=z;
		}
	    }
	}
		
    }
    public static void main(String[] args){
	Main p = new Main();
	p.compute();
    }
}

Compiler output:
Main.java:12: error: illegal start of expression
		M[i][j]=;
		        ^
1 error
Language: C

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

long ship[100][100];

int main(){
  int k,r,i,a,b,n,j;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,8,sizeof(ship));
    for(i=0;i<n;i++){
    	ship[i][i]=0;
    }
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",(ship[a-1][b-1]>100000001)?-1:ship[a-1][b-1]);
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        for(j=0;j<n;j++){
        	for(ii=0;ii<n;ii++){
        		if(ship[j][b-1]+p+ship[a-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][b-1]+p+ship[a-1][ii];
        			ship[ii][j]=ship[j][b-1]+p+ship[a-1][ii];
        		}
        		if(ship[j][a-1]+p+ship[b-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][a-1]+p+ship[b-1][ii];
        			ship[ii][j]=ship[j][a-1]+p+ship[b-1][ii];
        		}
        	}
        }
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:21: error: 'ii' undeclared (first use in this function); did you mean 'i'?
   24 |                 for(ii=0;ii<n;ii++){
      |                     ^~
      |                     i
main.c:24:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define INF 1000000
int graph[101][101],n,c,d;

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return x<y?x:y;
}

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j]=i==j?0:INF;

    for(i=0;i<k;i++){
      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=e;
graph[d][c]=e
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'warshall_floyd':
main.c:9:31: error: implicit declaration of function 'min' [-Wimplicit-function-declaration]
    9 |       graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
      |                               ^~~
main.c: In function 'main':
main.c:31:14: error: expected ';' before 'warshall_floyd'
   31 | graph[d][c]=e
      |              ^
      |              ;
   32 |         warshall_floyd();
      |         ~~~~~~~~~~~~~~
Language: C

#include<stdio.h>
#define INF 1000000
int graph[101][101],n,c,d;

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return x<y?x:y;
}

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++){
      for(j=0;j<=n;j++)
	graph[i][j]=INF;
      garph[i][i]=0;
    }
    for(i=0;i<k;i++){
      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=e;
	graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'warshall_floyd':
main.c:9:31: error: implicit declaration of function 'min' [-Wimplicit-function-declaration]
    9 |       graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
      |                               ^~~
main.c: In function 'main':
main.c:24:7: error: 'garph' undeclared (first use in this function); did you mean 'graph'?
   24 |       garph[i][i]=0;
      |       ^~~~~
      |       graph
main.c:24:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>

#define INF 1 << 29

using namespace std;


typedef int Weight; 

struct Edge{
    int src;
    int dst;
    Weight weight;

    Edge(int src, int dst, Weight weight):
        src(src), dst(dst), weight(weight){ }
};

struct Node{
    int index;
    Weight cost;
    int prev;

    Node(int index, Weight cost, int prev) :
        index(index), cost(cost), prev(prev){ }
};

bool operator <(const Node &a, const Node &b){
    if(a.cost == b.cost){
        return a.index > b.index;
    }else{
        return a.cost > b.cost;
    }
}

void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){
    int n=costs.size();
    priority_queue<Node> q;

    costs.assign(n,INF);
    prev.assign(n,-1);
    costs[s] = 0;
    q.push(Node(s,0,-2));

    while(!q.empty()){
        Node fix = q.top(); 
        q.pop();
        if(prev[fix.index] != -1) continue;
       
        costs[fix.index] = fix.cost;
        prev[fix.index] = fix.prev;

        for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed
            if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){
                q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index));
            }
        }
    }
}

int main(){
    int n,k,req,a,b,c;
    cin >> n >> k;
    vector<Weight> costs(n);
    vector<int> prev(n);
    vector<vector<Edge> > edges(n);

    for(int i=0;i<k;i++){
        cin >> req;
        if(req){
            cin >> a >> b >> c;
            edges[a-1].push_back(Edge(a-1,b-1,c));
            edges[b-1].push_back(Edge(b-1,a-1,c));
        }else{
            cin >> a >> b;
            dijkstra(a-1,costs,prev,edges);
            if(costs[b-1] == INF){
                cout << -1 << endl;
            }else{
                cout << costs[b-1] << endl;
            }
        }
    }
}

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

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>

#define INF 1 << 29

using namespace std;


typedef int Weight; 

struct Edge{
    int src;
    int dst;
    Weight weight;

    Edge(int src, int dst, Weight weight):
        src(src), dst(dst), weight(weight){ }
};

struct Node{
    int index;
    Weight cost;
    int prev;

    Node(int index, Weight cost, int prev) :
        index(index), cost(cost), prev(prev){ }
};

bool operator <(const Node &a, const Node &b){
    if(a.cost == b.cost){
        return a.index > b.index;
    }else{
        return a.cost > b.cost;
    }
}

void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){
    int n=costs.size();
    priority_queue<Node> q;

    costs.assign(n,INF);
    prev.assign(n,-1);
    costs[s] = 0;
    q.push(Node(s,0,-2));

    while(!q.empty()){
        Node fix = q.top(); 
        q.pop();
        if(prev[fix.index] != -1) continue;
       
        costs[fix.index] = fix.cost;
        prev[fix.index] = fix.prev;

        for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed
            if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){
                q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index));
            }
        }
    }
}

int main(){
    int n,k,req,a,b,c;
    cin >> n >> k;
    vector<Weight> costs(n);
    vector<int> prev(n);
    vector<vector<Edge> > edges(n);

    for(int i=0;i<k;i++){
        cin >> req;
        if(req){
            cin >> a >> b >> c;
            bool isexist = false;
            for(int j=0;j<edges[a-1].size();j++){
                if(edges[a-1][j].dst == b-1 && edges[a-1][j].weight > c){
                    edges[a-1][j].weight = c;
                    isexist = true;
                }
            }
            if(!isexist){
                edges[a-1].push_back(Edge(a-1,b-1,c));
            }

            isexist = false;
            for(int j=0;j<edges[b-1].size();j++){
                if(edges[b-1][j].dst == a-1 && edges[b-1][j].weight > c){
                    edges[b-1][j].weight = c;
                    isexist = true;
                }
            }
            if(!isexist){
                edges[b-1].push_back(Edge(b-1,a-1,c));
            }
        }else{
            cin >> a >> b;
            dijkstra(a-1,costs,prev,edges);
            if(costs[b-1] == INF){
                cout << -1 << endl;
            }else{
                cout << costs[b-1] << endl;
            }
        }
    }
}

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

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>

#define INF 1 << 29

using namespace std;


typedef int Weight; 

struct Edge{
    int src;
    int dst;
    Weight weight;

    Edge(int src, int dst, Weight weight):
        src(src), dst(dst), weight(weight){ }
};

struct Node{
    int index;
    Weight cost;
    int prev;

    Node(int index, Weight cost, int prev) :
        index(index), cost(cost), prev(prev){ }
};

bool operator <(const Node &a, const Node &b){
    if(a.cost == b.cost){
        return a.index > b.index;
    }else{
        return a.cost > b.cost;
    }
}

void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){
    int n=costs.size();
    priority_queue<Node> q;

    costs.assign(n,INF);
    prev.assign(n,-1);
    costs[s] = 0;
    q.push(Node(s,0,-2));

    while(!q.empty()){
        Node fix = q.top(); 
        q.pop();
        if(prev[fix.index] != -1) continue;
       
        costs[fix.index] = fix.cost;
        prev[fix.index] = fix.prev;

        for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed
            if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){
                q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index));
            }
        }
    }
}

int main(){
    int n,k,req,a,b,c;


    while(cin >> n >> k){
        if((n|k) == 0) break;
        vector<Weight> costs(n);
        vector<int> prev(n);
        vector<vector<Edge> > edges(n);

        for(int i=0;i<k;i++){
            cin >> req;
            if(req){
                cin >> a >> b >> c;
                bool isexist = false;
                for(int j=0;j<edges[a-1].size();j++){
                    if(edges[a-1][j].dst == b-1 && edges[a-1][j].weight > c){
                        edges[a-1][j].weight = c;
                        isexist = true;
                    }
                }
                if(!isexist){
                    edges[a-1].push_back(Edge(a-1,b-1,c));
                }

                isexist = false;
                for(int j=0;j<edges[b-1].size();j++){
                    if(edges[b-1][j].dst == a-1 && edges[b-1][j].weight > c){
                        edges[b-1][j].weight = c;
                        isexist = true;
                    }
                }
                if(!isexist){
                    edges[b-1].push_back(Edge(b-1,a-1,c));
                }
            }else{
                cin >> a >> b;
                dijkstra(a-1,costs,prev,edges);
                if(costs[b-1] == INF){
                    cout << -1 << endl;
                }else{
                    cout << costs[b-1] << endl;
                }
            }
        }
    }
}

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

#include<iostream>
#include<queue>
#include<vector>
#define INF 1<<28
#define F first
#define S second
using namespace std;

typedef pair < int, int > P;
int ans[111];
int n;

int solve(int a){
  vector < P > g[111];
  priority_queue < P, vector<P>, greater<P> > que;
  fill(ans, ans+n+1, INF);
  
  ans[a] = 0;
  que.push( P(0, a) );

  while(!que.empty()){
    P p = que.top(); que.pop();

    if(ans[p.S] < p.F) continue;
    for(int i=0;i<g[p.S].size();i++){
      P pp = g[p.S][i];
      if(ans[pp.F] > ans[p.S] + pp.S){
	ans[pp.F] = ans[p.S] + pp.S;
	que.push( P(ans[pp.F], pp.F) );
      }
    }
  }
}

int main(){
    
    int k;
    int q, a, b, c;

  
    while(true){
      cin >> n >> k;
      if(!n && !k) break;
      
      while(k--){
	cin >> q;
	if(q){
	  cin >> a >> b >> c;
	  g[a].push_back( P(b, c) );
	  g[b].push_back( P(a, c) );
	}
	else{
	  cin >> a >> b;
	  solve(a);
	  
	  if(ans[b] == INF) cout << -1 << endl;
	  else cout << ans[b] << endl;
	}
      }
    }
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
a.cc: In function 'int main()':
a.cc:49:11: error: 'g' was not declared in this scope
   49 |           g[a].push_back( P(b, c) );
      |           ^
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;
int x,a,b,c,d,e;
int f[100][100];

int fod()
{
	int mi[100];
	bool used[100];
	for(int j=0;j<n;j++){
		mi[j]=INT_MAX;
		used[j]=false;
	}
	mi[a-1]=0;
	while(true){
		int v=-1;
		for(int j=0;j<n;j++){
			if(!used[j]&&(v==-1||mi[j]<mi[v]))v=j;
		}

		if(v==-1)break;
		used[v]=true;
		bool z=false;
		for(int j=0;j<n;j++){
			if(f[v][j]!=INT_MAX){
			mi[j]=min(mi[j],mi[v]+f[v][j]);
			z=true;
			}
		}
		if(!z)break;
	}
	if(mi[b-1]==INT_MAX)return -1;
	return mi[b-1];
}
int main()
{
	for(;;){
		scanf("%d%d",&n,&k);
		if(!n&&!k)return 0;
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)f[i][j]=INT_MAX;

		for(int i=0;i<k;i++){
			scanf("%d",&x);
			if(x==0){
				scanf("%d%d",&a,&b);
				printf("%d\n",fod());
			}
			else{
				scanf("%d%d%d",&c,&d,&e);
				f[c-1][d-1]=min(f[c-1][d-1],e);
				f[d-1][c-1]=min(f[d-1][c-1],e);
			}
		}

	}
}

Compiler output:
a.cc: In function 'int fod()':
a.cc:14:23: error: 'INT_MAX' was not declared in this scope
   14 |                 mi[j]=INT_MAX;
      |                       ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc:28:37: error: 'INT_MAX' was not declared in this scope
   28 |                         if(f[v][j]!=INT_MAX){
      |                                     ^~~~~~~
a.cc:28:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:35:21: error: 'INT_MAX' was not declared in this scope
   35 |         if(mi[b-1]==INT_MAX)return -1;
      |                     ^~~~~~~
a.cc:35:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int main()':
a.cc:43:65: error: 'INT_MAX' was not declared in this scope
   43 |                 for(int i=0;i<n;i++)for(int j=0;j<n;j++)f[i][j]=INT_MAX;
      |                                                                 ^~~~~~~
a.cc:43:65: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;
int x,a,b,c,d,e;
int f[100][100];
/*int INT_MAX=2147483467;*/
int fod()
{
	int mi[100];
	bool used[100];
	for(int j=0;j<n;j++){
		mi[j]=INT_MAX/3;
		used[j]=false;
	}
	mi[a-1]=0;
	while(true){
		int v=-1;
		for(int j=0;j<n;j++){
			if(!used[j]&&(v==-1||mi[j]<mi[v]))v=j;
		}

		if(v==-1)break;
		used[v]=true;
		bool z=false;
		for(int j=0;j<n;j++){
			if(f[v][j]!=INT_MAX/3){
			mi[j]=min(mi[j],mi[v]+f[v][j]);
			z=true;
			}
		}
		if(!z)break;
	}
	if(mi[b-1]==INT_MAX/3)return -1;
	return mi[b-1];
}
int main()
{
	for(;;){
		scanf("%d%d",&n,&k);
		if(!n&&!k)return 0;
		for(int i=0;i<n;i++)for(int j=0;j<n;j++){
			f[i][j]=INT_MAX;
			if(i==j)f[i][j]=0;
		}
		for(int i=0;i<k;i++){
			scanf("%d",&x);
			if(x==0){
				scanf("%d%d",&a,&b);
				printf("%d\n",fod());
			}
			else{
				scanf("%d%d%d",&c,&d,&e);
				f[c-1][d-1]=min(f[c-1][d-1],e);
				f[d-1][c-1]=min(f[d-1][c-1],e);
			}
		}

	}
}

Compiler output:
a.cc: In function 'int fod()':
a.cc:14:23: error: 'INT_MAX' was not declared in this scope
   14 |                 mi[j]=INT_MAX/3;
      |                       ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc:28:37: error: 'INT_MAX' was not declared in this scope
   28 |                         if(f[v][j]!=INT_MAX/3){
      |                                     ^~~~~~~
a.cc:28:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:35:21: error: 'INT_MAX' was not declared in this scope
   35 |         if(mi[b-1]==INT_MAX/3)return -1;
      |                     ^~~~~~~
a.cc:35:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int main()':
a.cc:44:33: error: 'INT_MAX' was not declared in this scope
   44 |                         f[i][j]=INT_MAX;
      |                                 ^~~~~~~
a.cc:44:33: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>
using namespace std;

int INF=1e9;

void dijkstra(int a,int b,int *mindist,int cost[101][101],bool *used,int n){
  
  int cur,cur_spot;
  
  for(int i=0 ; i < 101 ; i++){
    mindist[i]=INF;
    used[i]=0;
  }
  
  mindist[a]=0;
  
  for(int _=0 ; _ < n ; _++){
    cur=INT_MAX;
    for(int i=1 ; i <= n ;i++){
      if(mindist[i] <= cur && used[i] == 0){
	cur = mindist[i];
	cur_spot=i;
      }
    }
    
    used[cur_spot]=1;
    
    for(int i=1 ; i <= n ; i++){
      if(cost[cur_spot][i] != -1){
	if(mindist[i] > mindist[cur_spot]+cost[cur_spot][i]){
	  mindist[i]=mindist[cur_spot]+cost[cur_spot][i];
	}
      }
    }
  }
  
  if(mindist[b] != INF){
    cout <<mindist[b]<<endl;
  }else{
    cout <<"-1"<<endl;
  }

}
int main(){
  
  int n,k,mindist[101],a,b,c,d,e,first;
  int cost[101][101];
  bool used[101];
  
  while(1){
  
    cin >>n>>k;
    if( n == 0 && k == 0)break;
    
    for(int i=0 ; i < 101 ; i++){
      for(int j=0 ; j < 101 ; j++){
	cost[i][j]= -1;
      }
    }
    
    for(int i=0 ; i < k ; i++){
      
      cin >>first;
      
      if(first == 0){
	cin >>a>>b;
	dijkstra(a,b,mindist,cost,used,n);
      }else{
	cin >>c>>d>>e;
	if(cost[c][d] > e || cost[c][d] == -1){
	   cost[c][d]=e;
	   cost[d][c]=e;
	}
      }
    }
    
  }
  return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(int, int, int*, int (*)[101], bool*, int)':
a.cc:18:9: error: 'INT_MAX' was not declared in this scope
   18 |     cur=INT_MAX;
      |         ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include<cstdio>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>



using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
vector<pair<int,int>???> edge[102];//[?§????] <??????????????????>
int N,K;
int map[102];//????????°????????????????????¢


int main(){
	while(1){
		scanf("%d %d",&N,&K);
		if(N==0&&K==0)break;
		rep(i,K){
			int type;
			scanf("%d",&type);
			if(type==0){//??¨????\¨
				int s,g;
				scanf("%d %d",&s,&g);
				s--;g--;
				priority_queue< pair<int,int>, vector< pair<int,int> >, greater< pair<int,int> > > q;
				rep(i,N)map[i]=INF;
				map[s]=0;
				q.push( make_pair(0,s) );
				while(!q.empty()){
					pair<int,int> p=q.top();
					q.pop();
					int c=p.second;
					if(map[c]<p.first) continue;
					rep(i,edge[c].size()){
						pair<int,int> e=edge[c][i];
						if(map[e.first]>map[c]+e.second){
							map[e.first]=map[c]+e.second;
							q.push( make_pair(map[e.first],e.first));
						}
					}
				}
				if(map[g]==INF)map[g]=-1;
				printf("%d\n",map[g]);
			}else{
				int a,b,c;
				scanf("%d %d %d",&a,&b,&c);
				a--;b--;
				edge[a].push_back(make_pair(b,c));
				edge[b].push_back(make_pair(a,c));
			}
		}
	}
}

Compiler output:
a.cc:13:22: warning: trigraph ??> ignored, use -trigraphs to enable [-Wtrigraphs]
   13 | vector<pair<int,int>???> edge[102];//[?§????] <??????????????????>
a.cc:13:24: error: template argument 1 is invalid
   13 | vector<pair<int,int>???> edge[102];//[?§????] <??????????????????>
      |                        ^
a.cc:13:24: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:38:55: error: request for member 'size' in 'edge[c]', which is of non-class type 'int'
   38 |                                         rep(i,edge[c].size()){
      |                                                       ^~~~
a.cc:11:32: note: in definition of macro 'rep'
   11 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:39:72: error: invalid types 'int[int]' for array subscript
   39 |                                                 pair<int,int> e=edge[c][i];
      |                                                                        ^
a.cc:52:41: error: request for member 'push_back' in 'edge[a]', which is of non-class type 'int'
   52 |                                 edge[a].push_back(make_pair(b,c));
      |                                         ^~~~~~~~~
a.cc:53:41: error: request for member 'push_back' in 'edge[b]', which is of non-class type 'int'
   53 |                                 edge[b].push_back(make_pair(a,c));
      |                                         ^~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int mp[101][101];
bool flg[101] ={};
int n,q;
int dis[101];

int sssp(int s,int g) {
  for(int i=1;i<=n;i++) dis[i] = 1000000000,flg[i] = 0;
  //flg[s] = 1;
  dis[s] = 0;
  int ima;

  while(1) {
    int mindis = 1000000000;
   
    for(int i=1;i<=n;i++)
      if(mindis > dis[i] && flg[i] == 0) {
	ima = i;
	mindis = dis[i];
      }

    /*
    if(mindis == 1000000000) return -1;    
    flg[ima] = 1;
    if(ima == g) return dis[ima];
    */
    
    if(mindis == 1000000000) break;
    flg[ima] = 1;

    for(int i=1;i<=n;i++) 
      if(dis[i] >dis[ima] + mp[ima][i] && mp[ima][i] != -1) 
	dis[i] = dis[ima]+mp[ima][i];
    
  }

  return dis[g];
}


int main() {

  while(1) {
  cin >> n >> q;
  if(n == 0 && q == 0) break;

  for(int i=0;i<=n;i++){ 
    //    dis[i] = 1000000000;
    //flg[i] = 0;
    for(int j=0;j<=n;j++)
      mp[i][j] = -1; 
  }

  bool sta;
  int s,g,c;
  for(int i=0;i<q;i++) {
    cin >> sta;
    if(sta == 0) {
      cin  >> s >> g;
      //for(int i=1;i<=n;i++) if(mp[s][i] !=-1)dis[i] = mp[s][i];
      int ans = sssp(s,g);
      cout << ans<< endl;
    }
    else {
      cin >> s >> g >> c;
      if(mp[s][g] != -1) {
	mp[s][g] = min(c ,mp[s][g]);
	mp[g][s] = min( mp[g][s] ,c);      
      }
      else {
	mp[s][g] = c;
	mp[g][s] = c;
      }
      
    }
  }
  
  
  return 0;
  
  }
      

Compiler output:
a.cc: In function 'int main()':
a.cc:83:4: error: expected '}' at end of input
   83 |   }
      |    ^
a.cc:43:12: note: to match this '{'
   43 | int main() {
      |            ^