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

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

	using namespace std;
	int main()
{
	int a,n[4],L=0,S=0,i,c=0;
	scanf("%d",&a);
	
	while(a!=0000){
		c=0;
		while(a!=6174){
			if(a==1111||a==2222||a==3333||a==4444||a==5555||a==6666||a==7777||a==8888||a==9999){
				
				break;
			}
		L=0;S=0;
		
		
		
		c++;
	n[0]=a/1000;
	n[1]=a/100-n[0]*10;
	n[2]=a/10-n[0]*100-n[1]*10;
	n[3]=a-n[0]*1000-n[1]*100-n[2]*10;
	sort(n,n+4);
	L+=n[3]*1000;
	L+=n[2]*100;
	L+=n[1]*10;
	L+=n[0];
	S+=n[0]*1000;
	S+=n[1]*100;
	S+=n[2]*10;
	S+=n[3];
	a=L-S;
	}
		
		if(a==1111||a==2222||a==3333||a==4444||a==5555||a==6666||a==7777||a==8888||a==9999){
			printf("NA\n");
		}
		else{
			printf("%d\n",c);
		}
	
	
	scanf("%d",&a);
	}
	return 0;
}

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

#include<stdio.h>
#include<stdlib.h>

int cmp(void const *a,void const *b)
{
	return *(char*)a-*(char*)b;
}

int main()
{
	int i,x,c;
	char s[5],t[5]={0};
	for(;scanf("%d\n",&x),x;)
	{
		if(!(x%1111))
		{
			puts("NA");
			continue;
		}
		for(c=0;x!=6174;c++)
		{
			itoa(x,s,10);
			qsort(s,4,sizeof(char),cmp);
			for(i=0;i<4;i++)
				t[3-i]=s[i];
			x=atoi(t)-atoi(s);
		}
		printf("%d\n",c);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:25: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
   22 |                         itoa(x,s,10);
      |                         ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
     int n,d[4],max,min,w[4]={1000,100,10,1};
     int c=0;
     cin >>n;
     while(n!=6174)
     {
       for(i=0;i<4;i++)
       {
             d[i]=n/w[i];
             n=n%w[i];
       }
       for(i=0;i<3;i++)
       {
          for(j=i+1;j<4;j++)
           {
                if(d[i]<d[j])
                 {
                    tmp=d[i];
                    d[i]=d[j];
                    d[j]=tmp;
                  }
            }
       }
        for(i=0;i<4;i++)
         {
              max=max+(d[i]*w[i]);
              min=min+(d[i]*w[3-i]);
         }
         n = max-min;
         c++;
     }
     cout << n << endl;
    return 0;
}
     
      
     
 

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'i' was not declared in this scope
   10 |        for(i=0;i<4;i++)
      |            ^
a.cc:15:12: error: 'i' was not declared in this scope
   15 |        for(i=0;i<3;i++)
      |            ^
a.cc:17:15: error: 'j' was not declared in this scope
   17 |           for(j=i+1;j<4;j++)
      |               ^
a.cc:21:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   21 |                     tmp=d[i];
      |                     ^~~
      |                     tm
a.cc:27:13: error: 'i' was not declared in this scope
   27 |         for(i=0;i<4;i++)
      |             ^
Language: C++

#include <cstdio>
#include <cstring>
#include <string>

using namespace std;

int main(){
	while(1){
		int n,l,s;
		int cnt = 0;
		string tmp;

		scanf("%d",&n);
		if(n == 0)break;
		if(n % 1111 == 0){
			printf("NA\n");
			continue;
		}

		while(n != 6174){
			tmp = to_string(n);

			sort(tmp.begin(),tmp.end());
			s = stoi(tmp);

			reverse(tmp.begin(),tmp.end());
			l = stoi(tmp);
			n = l - s;
			cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}

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

#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>

using namespace std;

int main(){

	while(1){
		int n=0,l,s;
		int cnt = 0;
		string tmp;

		cin >> tmp;
		n = atoi(tmp.c_str());

		if(n == 0)break;
		if(n % 1111 == 0){
			printf("NA\n");
			continue;
		}

		while(n != 6174){
			sort(tmp.begin(),tmp.end());
			s = atoi(tmp.c_str());

			sort(tmp.begin(),tmp.end(),greater<char>());
			l = atoi(tmp.c_str());
			n = l - s;

			for(int i=0,p=1000;i<4;i++,p/=10){
				tmp[i] = '0' + n/p;
				n %= p;
			}
			n = atoi(tmp.c_str());
			cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}

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

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

using namespace std;

int main(){

	while(1){
		int n=0,l,s;
		int cnt = 0;
		string tmp;

		cin >> tmp;
		n = atoi(tmp.c_str());

		if(n == 0)break;
		if(n % 1111 == 0){
			printf("NA\n");
			continue;
		}

		while(n != 6174){
			sort(tmp.begin(),tmp.end());
			s = atoi(tmp.c_str());

			sort(tmp.begin(),tmp.end(),greater<char>());
			l = atoi(tmp.c_str());
			n = l - s;

			for(int i=0,p=1000;i<4;i++,p/=10){
				tmp[i] = '0' + n/p;
				n %= p;
			}
			n = atoi(tmp.c_str());
			cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}

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

while 1:
    N = input()
    if N=='0000':break
    if N[0] ==N[1] == N[2] == N[3]:
        print('NA')
        continue
    cnt = 0
    while N != '6174':
        x = int(''.join(reversed(sorted(list(N))))) - int(''.join(sorted(list(N))))
        N = str(x).zfill(4) 
        cnt += 1

    print(cnt)

Compiler output:
a.cc:3:11: warning: multi-character character constant [-Wmultichar]
    3 |     if N=='0000':break
      |           ^~~~~~
a.cc:5:15: warning: multi-character character constant [-Wmultichar]
    5 |         print('NA')
      |               ^~~~
a.cc:8:16: warning: multi-character character constant [-Wmultichar]
    8 |     while N != '6174':
      |                ^~~~~~
a.cc:9:17: error: empty character constant
    9 |         x = int(''.join(reversed(sorted(list(N))))) - int(''.join(sorted(list(N))))
      |                 ^~
a.cc:9:59: error: empty character constant
    9 |         x = int(''.join(reversed(sorted(list(N))))) - int(''.join(sorted(list(N))))
      |                                                           ^~
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while 1:
      | ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;



/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	for (char s[5]; scanf("%s", s), strcmp(s, "0000")!=0;)
	{
		if (count(s, s + 4, s[0]) == 4)
		{
			cout << "NA" << endl;
			continue;
		}
		
		int ans = 0;
		while (strcmp(s, "6174") != 0)
		{
			char s1[5];
			strcpy(s1, s);
			sort(s1, s1 + 4);
			char s2[5];
			strcpy(s2, s);
			sort(s2, s2 + 4, greater<char>());
			int a1 = atoi(s1);
			int a2 = atoi(s2);
			sprintf(s, "%04d", a2 - a1);
			ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:41: error: 'strcmp' was not declared in this scope
   38 |         for (char s[5]; scanf("%s", s), strcmp(s, "0000")!=0;)
      |                                         ^~~~~~
a.cc:12:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <set>
  +++ |+#include <cstring>
   12 | #include <typeinfo>
a.cc:50:25: error: 'strcpy' was not declared in this scope
   50 |                         strcpy(s1, s);
      |                         ^~~~~~
a.cc:50:25: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
//#include <cstdio>
#include <stdio.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;



/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	for (char s[5]; scanf("%s", s), strcmp(s, "0000")!=0;)
	{
		if (count(s, s + 4, s[0]) == 4)
		{
			cout << "NA" << endl;
			continue;
		}
		
		int ans = 0;
		while (strcmp(s, "6174") != 0)
		{
			char s1[5];
			strcpy(s1, s);
			sort(s1, s1 + 4);
			char s2[5];
			strcpy(s2, s);
			sort(s2, s2 + 4, greater<char>());
			int a1 = atoi(s1);
			int a2 = atoi(s2);
			sprintf(s, "%04d", a2 - a1);
			ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:41: error: 'strcmp' was not declared in this scope
   39 |         for (char s[5]; scanf("%s", s), strcmp(s, "0000")!=0;)
      |                                         ^~~~~~
a.cc:13:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <set>
  +++ |+#include <cstring>
   13 | #include <typeinfo>
a.cc:51:25: error: 'strcpy' was not declared in this scope
   51 |                         strcpy(s1, s);
      |                         ^~~~~~
a.cc:51:25: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
using namespace std;
int main(){
  while(1){
  int count=0;
  int N;
  cin>>N;
  if(N==0)
  break;
  if(N%1111==0){
    cout<<"NA"<<endl;
    continue;
  }
   int L,S;
  while(N!=6174){
    int n[4];

   n[0]=N/1000;
   n[1]=N/100%10;
   n[2]=N/10%10;
   n[3]=N%10;

  sort(n,n+4);
  L=1000*n[3]+100*n[2]+10*n[1]+n[0];
  S=1000*n[0]+100*n[1]+10*n[2]+n[3];
  N=L-S;
  count++;
 }
 cout<<count<<endl;
 }
 return 0;
}

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

#include<iostream>
#include<algorithm>
#include<functional>
#include<cstring>
#include<cstdlib>

int main() {
	char str[4];
	while (std::cin >> str) {
		if (str[0] == str[1] == str[2] == str[3]) {
			if (str[0] == '0')
				break;
			else
				std::cout << "NA" << std::endl;
		}
		char l[4], s[4];
		int cnt = 0;
		while(str!="6174") {
			++cnt;
			std::memcpy(l, str, 4);
			std::memcpy(s, str, 4);
			std::sort(l, l + 4, std::greater<char>());
			std::sort(s, s + 4);
			int a = atoi(l) - atoi(s);
			itoa(a, str, 10);
		}
		std::cout << cnt << std::endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'itoa' was not declared in this scope
   25 |                         itoa(a, str, 10);
      |                         ^~~~
Language: C++

#include<stdio.h>
int main (){
	int N[4],L,S,c,i,a;
	while(1){
		for(i=0;i!=4;i++){
			scanf("%1d",&N[i]);
		}
		if(N[0]==N[1]&&N[2]==N[3]&&N[1]==N[2]){
			if(N[1]==0)
				break;
			else
				puts("NA");
		}
		else{
			for(i=0;c!=6174;i++){
				for(S=0;S!=4;S++){
					for(a=S;a!=4;a++){
						if(N[S]<N[a]){
							c=N[a];
							N[a]=N[S];
							N[S]=c;
						}
					}
				}
				L=1000*N[0]+100*N[1]+10*N[2]+N[3];
				S=1000*N[3]+100*N[2]+10*N[1]+N[0];
				L-=S;
				c=L;
				N[0]=L/1000;
				L%=1000;
				N[1]=L/100;
				L%=100;
				N[2]=L/10;
				L%=10;
				N[3]=L;
			}
			printf("%d\n",i);
		}
	}
}

#include<stdio.h>
int main (){
	int N[4],L,S,c,i,a;
	while(1){
		for(i=0;i!=4;i++){
			scanf("%1d",&N[i]);
		}
		if(N[0]==N[1]&&N[2]==N[3]&&N[1]==N[2]){
			if(N[1]==0)
				break;
			else
				puts("NA");
		}
		else{
			for(i=0;c!=6174;i++){
				for(S=0;S!=4;S++){
					for(a=S;a!=4;a++){
						if(N[S]<N[a]){
							c=N[a];
							N[a]=N[S];
							N[S]=c;
						}
					}
				}
				L=1000*N[0]+100*N[1]+10*N[2]+N[3];
				S=1000*N[3]+100*N[2]+10*N[1]+N[0];
				L-=S;
				c=L;
				N[0]=L/1000;
				L%=1000;
				N[1]=L/100;
				L%=100;
				N[2]=L/10;
				L%=10;
				N[3]=L;
			}
			printf("%d\n",i);
		}
	}
}

Compiler output:
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main (){
      |     ^~~~
a.cc:2:5: note: 'int main()' previously defined here
    2 | int main (){
      |     ^~~~
Language: C++

#include<stdio.h>
int main (){
	int N[4],L,S,c,i,a;
	while(1){
		for(i=0;i!=4;i++){
			scanf("%1d",&N[i]);
		}
		if(N[0]==N[1]&&N[2]==N[3]&&N[1]==N[2]){
			if(N[1]==0)
				break;
			else
				puts("NA");
		}
		else{
			for(i=0;c!=6174;i++){
				for(S=0;S!=4;S++){
					for(a=S;a!=4;a++){
						if(N[S]<N[a]){
							c=N[a];
							N[a]=N[S];
							N[S]=c;
						}
					}
				}
				L=1000*N[0]+100*N[1]+10*N[2]+N[3];
				S=1000*N[3]+100*N[2]+10*N[1]+N[0];
				L-=S;
				c=L;
				N[0]=L/1000;
				L%=1000;
				N[1]=L/100;
				L%=100;
				N[2]=L/10;
				L%=10;
				N[3]=L;
			}
			printf("%d\n",i);
		}
	}
}

#include<stdio.h>
int main (){
	int N[4],L,S,c,i,a;
	while(1){
		for(i=0;i!=4;i++){
			scanf("%1d",&N[i]);
		}
		if(N[0]==N[1]&&N[2]==N[3]&&N[1]==N[2]){
			if(N[1]==0)
				break;
			else
				puts("NA");
		}
		else{
			for(i=0;c!=6174;i++){
				for(S=0;S!=4;S++){
					for(a=S;a!=4;a++){
						if(N[S]<N[a]){
							c=N[a];
							N[a]=N[S];
							N[S]=c;
						}
					}
				}
				L=1000*N[0]+100*N[1]+10*N[2]+N[3];
				S=1000*N[3]+100*N[2]+10*N[1]+N[0];
				L-=S;
				c=L;
				N[0]=L/1000;
				L%=1000;
				N[1]=L/100;
				L%=100;
				N[2]=L/10;
				L%=10;
				N[3]=L;
			}
			printf("%d\n",i);
		}
	}
return 0;
}

Compiler output:
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main (){
      |     ^~~~
a.cc:2:5: note: 'int main()' previously defined here
    2 | int main (){
      |     ^~~~
Language: C++

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

	using namespace std;

	int main()
	{
		int m, n[4], mi[4], ma[4], na;
		int	max_int, min_int, n_int, ans;
		bool same = false;
			while (scanf("%1d", &n[i])){
				na = n[0];
				for (int i = 1; i < 4; i++){
					if (na != n[i]) same = true;
				}
				if (!same) cout << "NA" << endl;

			while(n[0] != 6 || n[1] != 1 || n[2] != 7 || n[3] != 4){
				if (!same) break;
				sort(n, n + 4);
				
				for (int i = 0; i < 4; i++){
					mi[i] = n[i];
					ma[3 - i] = n[i];
				}

				for (int i = 0; i < 4; i++){
					max_int = ma[i] * 10 ^ i;
					min_int = mi[i] * 10 ^ i;
				}
				n_int = max_int - min_int;
				for (int i = 0; i < 4; i++){
					n[i] = n_int / (10 ^ (3 - i)) % 10;
				}
				ans++;
			}

			if (!same) cout << ans << endl;
		}
		return (0);
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:48: error: 'i' was not declared in this scope; did you mean 'mi'?
   12 |                         while (scanf("%1d", &n[i])){
      |                                                ^
      |                                                mi
Language: C++

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

int rec(string N, int cnt) {
  vector<char> LN(4), SN(4);
  int L = 0, S = 0;
  for (int i = 0; i < 4; i++) {
    LN[i] = SN[i] = N[i] - '0';
  }
  sort(ALL(LN));
  sort(ALL(SN));
  for (int i = 0; i < 4; i++) {
    L *= 10;
    S *= 10;
    L += LN[3 - i];
    S += SN[i];
  }
  return (L - S == 6174) ? cnt + 1 : rec(to_string(L - S), cnt + 1);
}

signed main()
{
  string N;
  while (cin >> N, N != "0000") {
    if (N[0] == N[1] and N[2] == N[3] and N[0] == N[2]) print("NA");
    else if (N == "6174") print("0");
    else print(rec(N, 0));
  }

  return (0);
}

Compiler output:
a.cc: In function 'int rec(std::string, int)':
a.cc:10:8: error: 'ALL' was not declared in this scope
   10 |   sort(ALL(LN));
      |        ^~~
a.cc: In function 'int main()':
a.cc:25:57: error: 'print' was not declared in this scope; did you mean 'rint'?
   25 |     if (N[0] == N[1] and N[2] == N[3] and N[0] == N[2]) print("NA");
      |                                                         ^~~~~
      |                                                         rint
a.cc:26:27: error: 'print' was not declared in this scope; did you mean 'rint'?
   26 |     else if (N == "6174") print("0");
      |                           ^~~~~
      |                           rint
a.cc:27:10: error: 'print' was not declared in this scope; did you mean 'rint'?
   27 |     else print(rec(N, 0));
      |          ^~~~~
      |          rint
Language: C++

//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <cctype>
using namespace std;

int main() {
	string n,L,S;
	int R=0;
	while(1){
		cin>>n;
		if(n=="0000")break;
		if(n=="6174")cout<<"0"<<endl;
		L=S=n;
		sort(L.begin(),L.end(),greater<char>());
		sort(S.begin(),S.end());

		cout<<R<<endl;
	}



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |                 sort(L.begin(),L.end(),greater<char>());
      |                 ^~~~
      |                 short
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int solve(int num,int& cnt) {
	if (num == 6174)return cnt;
	cnt++;
	int s[5];
	for (int i = 0; i < 4; i++) {
		s[i] = num % 10;
		num -= s[i];
		num /= 10;
	}
	sort(s, s + 4);
	return solve((s[3] - s[0]) * 999 + (s[2] - s[1]) * 90), cnt);
}
int main() {
	int n;
	while (cin >> n) {
		if (!n)return 0;
		else if (n % 1111 == 0) {
			cout << "NA\n";
			continue;
		}
		int cnt;
		solve(n, cnt);
		cout << cnt << endl;
	}
}

Compiler output:
a.cc: In function 'int solve(int, int&)':
a.cc:14:21: error: too few arguments to function 'int solve(int, int&)'
   14 |         return solve((s[3] - s[0]) * 999 + (s[2] - s[1]) * 90), cnt);
      |                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:4:5: note: declared here
    4 | int solve(int num,int& cnt) {
      |     ^~~~~
a.cc:14:68: error: expected ';' before ')' token
   14 |         return solve((s[3] - s[0]) * 999 + (s[2] - s[1]) * 90), cnt);
      |                                                                    ^
      |                                                                    ;
a.cc:14:68: error: expected primary-expression before ')' token
Language: C++

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (;;) {
            int n=sc.nextInt();
            if(n==0) {
                break;
            }
            Integer[] l=d(n);
            if(l[0]==l[1]&&l[1]==l[2]&&l[2]==l[3]) {
                System.out.println("NA");
                continue;
            }
            int c=0;
            while(n!=6174) {
                c++;
                l=d(n);
                Arrays.sort(l,Comparator.reverseOrder());
                int a=c(l);
                Arrays.sort(l);
                int b=c(l);
                n=a-b;
            }
            System.out.println(c);
        }
    }
    static int c(Integer[] l) {
        int n=0;
        for(int i=0,j=1000;i<4;i++,j/=10) {
            n+=l[i]*j;
        }
        return n;
    }
    static Integer[] d(int n) {
        Integer[] l=new Integer[4];
        for(int i=0,j=1000;i<4;i++,j/=10) {
            l[i]=n/j;
            n%=j;
        }
        return l;
    }
}


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

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<Windows.h>
using namespace std;
int main(){
	char num[6]={0};
	
	while(1){
		int cnt = 0;
		scanf("%s",num);
		if(num[0] == num[1] && num[1] == num[2] && num[2] == num[3]){
			if(num[0] == 48)break;
			else puts("NA");
			continue;
		}
		if(num[0] == '6' && num[1] == '1' && num[2] == '7' && num[3] == '4'){
			puts("0");
			continue;
		}
		while(1){
			sort(num,num+4);
			int s = atoi(num);
			reverse(num,num+4);
			int l = atoi(num);
			int x = 0;
			if(l - s == 6174){
				printf("%d\n",cnt+1);
				break;
			}
			else{
				x = l - s;
				cnt++;
				for(int i = 0; i < 4; i++){
					num[i] = (x / pow(10,3-i))+48;
					x -= (num[i]-48) * pow(10,3-i);
				}
			}
		}
		
	}
	return 0;
}

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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n)n){
        int cnt = 0;
        bool flg = 0;
        while(1){
            if(n == 6174)break;
            if(n%1111 == 0){
                flg = 1;
                break;
            }
            int a[4]={0};
            a[0] = n/1000;
            a[1] = (n%1000)/100;
            a[2] = (n%100)/10;
            a[3] = n%10;
            int L[4],S[4];
            sort(a,a+4);
            for(int i = 0; i < 4; i++){
                L[3-i] = S[i] = a[i];
            }
            int l=0,s=0;
            for(int i = 0; i < 4; i++){
                l += L[3-i] * pow(10,i);
                s += S[3-i] * pow(10,i);
            }
            n = l - s;
            cnt++;
        }
        if(flg)puts("NA");
        else printf("%d\n",cnt);
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: expected ')' before 'n'
    8 |     while(scanf("%d",&n)n){
      |          ~              ^
      |                         )
a.cc:8:26: error: expected ';' before ')' token
    8 |     while(scanf("%d",&n)n){
      |                          ^
      |                          ;
Language: C++

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

using namespace std;

bool input(int a[]){
     int i, inp;
     scanf("%d",&inp);
     if(inp == 0) return false;
     for(i = 4;i >= 0;i--){
          a[i] = inp % 10;
          inp /= 10;
     }
     return true;
}

int main(void){
     int a[4], b[4], i, count;
     const int suc[4] = {6,1,7,4};
     while(input(a)){
          count = 0;
          while(1){
               for(i = 0;i < 4;i++)
                    if(suc[i] != a[i]) break;
               if(i == 4){
                    printf("%d\n",count);
                    break;
               }
               for(i = 1;i < 4;i++)
                    if(a[0] != a[i]) break;
               if(i == 4){
                    printf("NA\n");
                    break;
               }
               for(i = 0;i < 4;i++)
                    b[i] = a[i];
               sort(a,a + 4);
               sort(b,b + 4,greater<int>);
               for(i = 4;i >= 0;i--){
                    a[i] -= b[i];
                    if(a[i] < 0){
                         a[i - 1]--;
                         a[i] += 10;
                    }
               }
               count++;
          }
     }
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:29: error: 'greater' was not declared in this scope
   38 |                sort(b,b + 4,greater<int>);
      |                             ^~~~~~~
a.cc:38:37: error: expected primary-expression before 'int'
   38 |                sort(b,b + 4,greater<int>);
      |                                     ^~~
Language: C++

#include<iostream>
#include<string>
#include<sstream>
#include<cmath>
using namespace std;


bool allsame(int n){
  int tmp=n%10;
  n/=10;
  while(n!=0){
    if(tmp!=n%10){
      return 0;
    }
    tmp=n%10;
    n/=10;
  }
  return 1;
}

string toSortString(int n){
  stringstream ss;
  ss<<n;
  string tmp;
  ss>>tmp;
  sort(tmp.begin(),tmp.end());
  return tmp;
}

int make_l(string s){
  int res=0;
  for(int i=0;i<s.size();i++){
    res+=(s[i]-'0')*pow(double(10),i);
  }
  return res;
}

int make_s(string s){
  int res=0;
  for(int i=0;i<s.size();i++){
    res+=(s[s.size()-1-i]-'0')*pow(double(10),i);
  }
  return res;
}

int main(){
  int n;
  int ans=0;
  while(cin>>n,n!=0){
    if(allsame(n)){
      cout<<"NA"<<endl;
      continue;
    }
    while(n!=6174){
      ans++;
      int l,s;
      string tmp_n=toSortString(n);
      l=make_l(tmp_n);
      s=make_s(tmp_n);
      n=l-s;
    }
    if(n==6174){
      cout<<ans<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'std::string toSortString(int)':
a.cc:26:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   26 |   sort(tmp.begin(),tmp.end());
      |   ^~~~
      |   sqrt
Language: C++

#include<iostream>
#include<string>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<cassert>
using namespace std;


bool allsame(int n){
  int tmp=n%10;
  n/=10;
  while(n!=0){
    if(tmp!=n%10){
      return 0;
    }
    tmp=n%10;
    n/=10;
  }
  return 1;
}

string toSortString(int n){
  string res="0000";
  int tmp[4]={0,0,0,0};
  for(int i=0;n!=0;i++){
    tmp[i]=n%10;
    n/=10;
  }
  for(int i=0;i<4;i++){
    res[i]=tmp[i]+'0';
  }
  sort(res.begin(),res.end());
  return res;
}

int make_l(string s){
  int res=0;
  for(int i=0;i<s.size();i++){
    res+=(s[i]-'0')*pow(double(10),i);
  }
  return res;
}

int make_s(string s){
  int res=0;
  for(int i=0;i<s.size();i++){
    res+=(s[s.size()-1-i]-'0')*pow(double(10),i);
  }
  return res;
}

int main(){
  int n;
  int ans=0;
  while(cin>>n,n!=0){
    while(n!=6174){
      if(allsame(n)){
        cout<<"NA"<<endl;
        break;
      }
      ans++;
      int l,s;
      string tmp_n=toSortString(n);
      l=make_l(tmp_n);
      s=make_s(tmp_n);
      n=l-s;
      assert(ans<=7);
    

Compiler output:
a.cc: In function 'int main()':
a.cc:68:22: error: expected '}' at end of input
   68 |       assert(ans<=7);
      |                      ^
a.cc:57:19: note: to match this '{'
   57 |     while(n!=6174){
      |                   ^
a.cc:68:22: error: expected '}' at end of input
   68 |       assert(ans<=7);
      |                      ^
a.cc:56:21: note: to match this '{'
   56 |   while(cin>>n,n!=0){
      |                     ^
a.cc:68:22: error: expected '}' at end of input
   68 |       assert(ans<=7);
      |                      ^
a.cc:53:11: note: to match this '{'
   53 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<boost/lexical_cast.hpp>
using namespace std;

int main(){
  while(1){
    string N, L, S;
    cin >> N;
    if(N == "0000") break;
    
    int ans = 0;
    while(1){
      if(N == "6174"){
        cout << ans << endl;
        break;
      }
      
      L = N;
      S = N;
      
      sort(L.begin(), L.end(), greater<char>());
      sort(S.begin(), S.end());
      
      if(L == S){
        cout << "NA" << endl;
        break;
      }
      
      int n = boost::lexical_cast<int>(L) - boost::lexical_cast<int>(S);
      N = boost::lexical_cast<string>(n);
      
      ans++;
    }
  }
  return 0;
}

Compiler output:
a.cc:5:9: fatal error: boost/lexical_cast.hpp: No such file or directory
    5 | #include<boost/lexical_cast.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>

using namespace std;

bool func_a(int *N, int *count);

bool main()
{
	int N = 0;
	int count = 0;
	bool flag = true;

	cin >> N;
	
	if(N == 6174)
	{
		cout << 0 << endl;
		flag = false;
	}

	for(int i = 0; i <= 9; i++)
	{
		if(N == i + i * 10 + i * 100 + i * 1000)
		{
			cout << "NA" << endl; 
			flag = false;
		}
	}
	
	if(flag)
	{
		while( func_a(&N, &count) ){};

		cout << count << endl;
	}

	return false;
}

bool func_a(int *N, int *count)
{	
	int num = *N;
	int Nmax[4];
	int Nmin[4];
	int L = 0, S = 0;

	*count += 1;

	for(int i = 0; i < 4; i++)
	{
		Nmax[i] = Nmin[i] = num % 10;
		num /= 10;
	}

	for(int i = 0; i < 4; i++)
	{
		for(int j = 0; j < 4; j++)
		{
			if(Nmax[i] < Nmax[j])
			{
				int tmp = Nmax[i];
				Nmax[i] = Nmax[j];
				Nmax[j] = tmp;
			}
			if(Nmin[i] > Nmin[j])
			{
				int tmp = Nmin[i];
				Nmin[i] = Nmin[j];
				Nmin[j] = tmp;
			}
		}
	}

	int dz[4] = {1, 10, 100, 1000};

	for(int i= 0; i < 4; i++)
	{
		L += Nmax[i] * dz[i];
		S += Nmin[i] * dz[i];
	}

	*N = L - S;

	if(*N == 6174)
	{
		return false;
	}
	else
	{
		return true;
	}
}

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

#include<iostream>

using namespace std;

bool func_a(int *N, int *count);

bool main()
{
	int N = 0;
	int count = 0;
	bool flag = true;

	cin >> N;
	
	if(N == 6174)
	{
		cout << 0 << endl;
		flag = false;
	}

	for(int i = 0; i <= 9; i++)
	{
		if(N == i + i * 10 + i * 100 + i * 1000)
		{
			cout << "NA" << endl; 
			flag = false;
		}
	}
	
	if(flag)
	{
		while( func_a(&N, &count) ){};

		cout << count << endl;
	}

	return 0;
}

bool func_a(int *N, int *count)
{	
	int num = *N;
	int Nmax[4];
	int Nmin[4];
	int L = 0, S = 0;

	*count += 1;

	for(int i = 0; i < 4; i++)
	{
		Nmax[i] = Nmin[i] = num % 10;
		num /= 10;
	}

	for(int i = 0; i < 4; i++)
	{
		for(int j = 0; j < 4; j++)
		{
			if(Nmax[i] < Nmax[j])
			{
				int tmp = Nmax[i];
				Nmax[i] = Nmax[j];
				Nmax[j] = tmp;
			}
			if(Nmin[i] > Nmin[j])
			{
				int tmp = Nmin[i];
				Nmin[i] = Nmin[j];
				Nmin[j] = tmp;
			}
		}
	}

	int dz[4] = {1, 10, 100, 1000};

	for(int i= 0; i < 4; i++)
	{
		L += Nmax[i] * dz[i];
		S += Nmin[i] * dz[i];
	}

	*N = L - S;

	if(*N == 6174)
	{
		return false;
	}
	else
	{
		return true;
	}
}

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

#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	string s;
	while(cin >> s, s!= "0000") {
		int tmp = toInt(s);
		if(tmp == 6174) {
			cout << 0 << endl;
			goto next;
		} else if(tmp%1111 == 0) {
			cout << "NA" << endl;
			goto next;
		}
		
		int count = 1;
		while(true) {	
			sort(ALL(s));
			int a = toInt(s);
			sort(RALL(s));
			int b = toInt(s);
			int c = b - a;
			if(c == 6174) {
				break;
			} else {
				s = toStr(c);
				count++;
			}
		}
		cout << count << endl;

		next:;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:17: error: jump to label 'next'
   64 |                 next:;
      |                 ^~~~
a.cc:42:30: note:   from here
   42 |                         goto next;
      |                              ^~~~
a.cc:48:21: note:   crosses initialization of 'int count'
   48 |                 int count = 1;
      |                     ^~~~~
Language: Java

package nofill_nosubmit;
import java.util.Arrays;
import java.util.Scanner;
public class AOJ_260 
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			if(n==0)
				return;
			int a[]=new int[n];//パイプ
			int b[]=new int[n-1];//ジョイント
			int j[]=new int[n-1];
			int ans=0;
			int sum=0;
			for(int i=0;i<n;i++)
			{
				a[i]=in.nextInt();
				sum+=a[i];
			}
			for(int i=0;i<n-1;i++)
				b[i]=in.nextInt();
			Arrays.sort(b);
			for(int i=0;i<n-1;i++)//ジョイントを降順にソート
				j[i]=b[n-2-i];
			
			//給料=max(パイプの本数*パイプの長さの総和)
			 ans=n*sum;
			for(int i=0,k=n-1;i<n-1;i++,k--)//i+1がジョイントを使う数
			{
				sum+=j[i];
				ans=Math.max(ans,k*sum);
			}
			System.out.println(ans);
		}
	}
	public static void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}
}

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

import java.util.Scanner;
public class pasocon{
	public void output(){
		int[] p = new int[65000];
		int[] j = new int[65000];
		int[] k = new int[65000];
		Scanner scan = new Scanner(System.in);
		while(true){
			int w = 0;
			int z = 0;
			int s = 0;
			System.out.println("パイプの本数");
			int n = scan.nextInt();
			if(n == 0)break;
			for(int i = 0;i < n;i++){
				System.out.println("パイプの長さ");
				p[i] = scan.nextInt();
			}
			for(int u = 0; u < n - 1;u++){
				System.out.println("ジョイントの長さ");
				j[u] = scan.nextInt();
			}
			for(int q = 0; q < n;q++){
				if(p[q] + p[q+1] < j[q]){
					k[q] = p[q] +p[q+1] + j[q];
					s = s + k[q];
					w = w + 1;
					q = q + 1;
				}else{
					k[q] = p[q];
					w = w + 1;
					s = s + k[q];
				}
			}
			for(int d = 1;d < n;d++){
				z = s * w;
			}
			System.out.println(z);
		}
	}
	public static void main(String[] args){
	pasocon p = new pasocon();
	p.output();
	}
}

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

import java.util.Scanner;
public class pasocon{
	public void output(){
		int[] p = new int[65000];
		int[] j = new int[65000];
		int[] k = new int[65000];
		Scanner scan = new Scanner(System.in);
		while(true){
			int w = 0;
			int z = 0;
			int s = 0;
			System.out.println("パイプの本数");
			int n = scan.nextInt();
			if(n == 0)break;
			for(int i = 0;i < n;i++){
				System.out.println("パイプの長さ");
				p[i] = scan.nextInt();
			}
			for(int u = 0; u < n - 1;u++){
				System.out.println("ジョイントの長さ");
				j[u] = scan.nextInt();
			}
			for(int q = 0; q < n;q++){
				if(p[q] + p[q+1] < j[q]){
					k[q] = p[q] +p[q+1] + j[q];
					s = s + k[q];
					w = w + 1;
					q = q + 1;
				}else{
					k[q] = p[q];
					w = w + 1;
					s = s + k[q];
				}
			}
			for(int d = 1;d < n;d++){
				z = s * w;
			}
			System.out.println(z);
		}
	}
}

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

import java.util.Scanner;
public class pasocon{
	public void output(){
		int[] p = new int[65000];
		int[] j = new int[65000];
		int[] k = new int[65000];
		Scanner scan = new Scanner(System.in);
		while(true){
			int w = 0;
			int z = 0;
			int s = 0;
			System.out.println("パイプの本数");
			int n = scan.nextInt();
			if(n == 0)break;
			for(int i = 0;i < n;i++){
				System.out.println("パイプの長さ");
				p[i] = scan.nextInt();
			}
			for(int u = 0; u < n - 1;u++){
				System.out.println("ジョイントの長さ");
				j[u] = scan.nextInt();
			}
			for(int q = 0; q < n;q++){
				if(p[q] + p[q+1] < j[q]){
					k[q] = p[q] +p[q+1] + j[q];
					s = s + k[q];
					w = w + 1;
					q = q + 1;
				}else{
					k[q] = p[q];
					w = w + 1;
					s = s + k[q];
				}
			}
			for(int d = 1;d < n;d++){
				z = s * w;
			}
			System.out.println(z);
		}
	}
	public static void main(String[] args){
	pasocon p = new pasocon().run();
	p.output();
	}
}

Compiler output:
Main.java:2: error: class pasocon is public, should be declared in a file named pasocon.java
public class pasocon{
       ^
Main.java:42: error: cannot find symbol
	pasocon p = new pasocon().run();
	                         ^
  symbol:   method run()
  location: class pasocon
2 errors
Language: Java

import java.util.*;
public class Paipu{
	public static void main(String[] args){
		int n = 0, p = 0, j = 0, x = 0, y = 0;
		int psum = 0,jmax = 0, kei = 0, kei2 = 0;
		int a, b;
		int[][] hairetu = new int[2][65000];
		Scanner scan = new Scanner(System.in);
		while( true ){
			psum = 0;
			jmax = 0;
			System.out.println("パイプの本数を入力");
			n = scan.nextInt();
			if(n == 0) break;
			x = n;
			y = n;
			for(a = 0; a < x; a++){
				System.out.println("パイプの長さを入力");
				p = scan.nextInt();
				hairetu[0][a] = p;
				psum += p;
			}
			for(b = 0; b < y - 1; b++){
				System.out.println("ジョイントの長さを入力");
				j = scan.nextInt();
				hairetu[1][b] = j;
				if(j > jmax){
					jmax = j;
				}
			}
			kei = psum * n;
			kei2 = (psum + jmax) * (n - 1);
			if(kei > kei2){
				System.out.println(kei);
			}
			else{
				System.out.println(kei2);
			}
		}
	}
}
			

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

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<functional>
using namespace std;
int main(void)
{
	long long int i,n,paipu,p,joi[65000],honsuu,max,m;
	scanf("%lld",&n);
	honsuu=n;
	paipu=0;
	for(i=0;i<n;i++){
		scanf("%lld",&p);
		paipu+=p;
	}
	for(i=0;i<n-1;i++) scanf("%lld",&joi[i]);
	sort(joi,joi+n-1,greater<int>());
	max=paipu*honsuu;
	for(i=0;i<n-1;i++){
		paipu+=joi[i];
		honsuu--;
		m=paipu*honsuu;
		if(max<m) max=m;
	}
	printf("%lld",max);
	return 0;
}

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

#include <stdio.h>


int main(void)
{
	__int64 i, k;
	__int64 n;
	__int64 p[65000];
	__int64 j[64999];
	__int64 max;
	__int64 chain[64999];
	__int64 buf;
	__int64 p_no;
	__int64 j_max;
	__int64 bond;
	
	while (1){
		scanf("%I64d", &n);
		if (n == 0){
			break;
		}
		for (i = 0; i < n; i++){
			scanf("%I64d", &p[i]);
		}
		for (i = 0; i < n - 1; i++){
			scanf("%I64d", &j[i]);
		}
		
		
		/*繋げなかった時の給料*/
		buf = 0;
		for (i = 0; i < n; i++){
			buf += p[i];
			chain[i] = p[i];/*pをchainにコピー*/
		}
		max = n * buf;
		
		
		
		/*1本ずつ繋げて給料計算していく*/
		/*
		1.一番長いパイプをつなげる
		2.maxより給料が高いなら1へ
		3.maxより低くなったら終了
		*/
		p_no = n;
		while (p_no > 1){
			/*一番長いジョイントを探す*/
			j_max = 0;
			for (i = 1; i < n; i++){
				if (j[j_max] < j[i]){
					j_max = i;
				}
			}
			
			/*一番長いパイプをつなげる*/
			bond = 0;
			for (i = 0; i < n - 1; i++){
				if (i == j_max){
					bond = 1;
					chain[i] = chain[i] + j[i] + chain[i + 1];
					p_no--;
					i++;
				}
				else {
					chain[i - bond] = p[i];
				}
			}
			chain[n - 2] = p[i];
			
			/*給料判定*/
			buf = 0;
			for (i = 0; i < p_no; i++){
				buf += chain[i];
			}
			if (max <= buf * p_no){
				max = buf * p_no;
			}
			/*else {
				break;
			}*/
		}
		
		
		printf("%I64d\n", max);
	}
	
	
	return (0);
}

/*音ゲーに囲まれながら…*/

Compiler output:
main.c: In function 'main':
main.c:6:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    6 |         __int64 i, k;
      |         ^~~~~~~
      |         __int64_t
main.c:7:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    7 |         __int64 n;
      |         ^~~~~~~
      |         __int64_t
main.c:8:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    8 |         __int64 p[65000];
      |         ^~~~~~~
      |         __int64_t
main.c:9:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    9 |         __int64 j[64999];
      |         ^~~~~~~
      |         __int64_t
main.c:10:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   10 |         __int64 max;
      |         ^~~~~~~
      |         __int64_t
main.c:11:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   11 |         __int64 chain[64999];
      |         ^~~~~~~
      |         __int64_t
main.c:12:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   12 |         __int64 buf;
      |         ^~~~~~~
      |         __int64_t
main.c:13:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   13 |         __int64 p_no;
      |         ^~~~~~~
      |         __int64_t
main.c:14:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   14 |         __int64 j_max;
      |         ^~~~~~~
      |         __int64_t
main.c:15:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   15 |         __int64 bond;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <stdio.h>

int main(void)
{
	int p[65000];
	int j[64999];
	int n;
	__int64 sum;
	int flag;
	int max_j;
	int max_p;
	__int64 max;
	int i;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		for (i = 0; i < n; i++){
			scanf("%d", &p[i]);
		}
		for (i = 0; i < n - 1; i++){
			scanf("%d", &j[i]);
		}
		
		/*繋げてないとき*/
		max = 0;
		for (i = 0; i < n; i++){
			max += p[i];
		}
		max *= n;
		/*printf("%I64d\n", max);*/
		
		/*一番高い給料を調べる*/
		flag = 0;
		while (flag < n - 1){
			flag++;
			sum = 0;
			
			/*長いジョイントを調べる*/
			max_j = j[0];
			for (i = flag; i < n - 1; i++){
				if (max_j < j[i]){
					max_j = j[i];
				}
			}
			
			/*ジョイントをくっつける*/
			for (i = 0; i < n; i++){
				sum += p[i];
			}
			sum += max_j;
			
			/*給料計算*/
			if (max < sum * (n - flag)){
				max = sum * (n - flag);
			}
			/*printf("%I64d\n", sum * (n - flag));*/
		}
		
		printf("%I64d\n", max);
	}
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    8 |         __int64 sum;
      |         ^~~~~~~
      |         __int64_t
main.c:12:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   12 |         __int64 max;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <stdio.h>

int main(void)
{
	int p[65000];
	int j[64999];
	int n;
	__int64 sum;
	int flag;
	int max_j;
	int max_p;
	__int64 max;
	int i;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		for (i = 0; i < n; i++){
			scanf("%d", &p[i]);
		}
		for (i = 0; i < n - 1; i++){
			scanf("%d", &j[i]);
		}
		
		/*繋げてないとき*/
		max = 0;
		sum = 0;
		for (i = 0; i < n; i++){
			sum += p[i];
		}
		max = sum * n;
		/*printf("%lld\n", max);*/
		
		/*一番高い給料を調べる*/
		flag = 0;
		while (flag < n - 1){
			flag++;
			
			/*長いジョイントを調べる*/
			max_j = j[0];
			for (i = flag; i < n - 1; i++){
				if (max_j < j[i]){
					max_j = j[i];
				}
			}
			
			/*ジョイントをくっつける*/
			/*給料計算*/
			if (max < (sum + max_j) * (n - flag)){
				max = (sum + max_j) * (n - flag);
			}
			/*printf("%lld\n", sum * (n - flag));*/
		}
		
		printf("%I64d\n", max);
	}
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    8 |         __int64 sum;
      |         ^~~~~~~
      |         __int64_t
main.c:12:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   12 |         __int64 max;
      |         ^~~~~~~
      |         __int64_t
Language: C

include <stdio.h>

void sort(unsigned int *data,unsigned int n){
  unsigned int i,flag,tmp;

  do{
    flag = 0;
    for(i = 0;i < n-1;i++){
      if(data[i] > data[i+1]){
        tmp = data[i];
        data[i] = data[i+1];
        data[i+1] = tmp;
        flag = 1;
      }
    }
  }while(flag);

}

int main(){
  unsigned int n,i,sum,pipe;
  unsigned int joint[65000];
  unsigned int price;

  while(1){
    scanf("%d",&n);
    if(n == 0){
      break;
    }

    sum = 0;
    for(i = 0;i < n;i++){
      scanf("%d",&pipe);
      sum += pipe;
    }

    for(i = 0;i < n-1;i++){
      scanf("%d",&joint[i]);
    }

    sort(joint,n-1);

    price = sum*n;

    for(i = 0;i < n-1;i++){
      if(price < (sum+joint[i])*(n-1)){
        price = (sum+joint[i])*(n-1);
      }
    }

    printf("%u\n",price);
  }

  return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:26:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   26 |     scanf("%d",&n);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:26:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   26 |     scanf("%d",&n);
      |     ^~~~~
main.c:26:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:41:5: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   41 |     sort(joint,n-1);
      |     ^~~~
main.c:51:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   51 |     printf("%u\n",price);
      |     ^~~~~~
main.c:51:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:51:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;
typedef unsigned int uint;

int main() {
    sync_with_stdio(false);
    int n;
    while (cin >> n, n) {
        uint num = n, sum = 0, p;
        for (int i=0; i<n; ++i) {
            cin >> p;
            sum += p;
        }
        vector<uint> joint;
        uint j;
        for (int i=0; i<n-1; ++i) {
            cin >> j;
            joint.push_back(j);
        }
        sort(joint.begin(), joint.end(), greater<uint>());
        uint res = sum * n;
        for (int i=0; i<n-1; ++i) {
            sum += joint[i];
            num -= 1;
            if (res < sum * num) {
                res = sum * num;
            }
        }
        cout << res << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'sync_with_stdio' was not declared in this scope
   12 |     sync_with_stdio(false);
      |     ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long long n, t, v[65000], sum;

	while (true)
	{
		cin >> n;

		if (n == 0) { break; }

		sum = 0;

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

			sum += t;
		}
		
		for (int j = 0; j < n - 1; j++)
		{
			cin >> v[j];

			sum += v[j];
		}

		sort(v, v + n - 1);

		int ptr = 0;

		while(ptr++ < n)
		{
			if (ptr * sum < (ptr + 1) * (sum - v[ptr - 1]))
			{
				sum -= v[i - 1];
			}
			else
			{
				break;
			}
		}
		
		cout << ptr * sum << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:42: error: 'i' was not declared in this scope
   40 |                                 sum -= v[i - 1];
      |                                          ^
Language: C++

#include <algorithm>
#include <iostream>
#define N 65000
using namespace std;
typedef long long ll;

int main(){
  ll n,p,j[N],a,c;
  while(1){
    cin>>n;
    if(!n) break;
    c=0;
    for(int i=0;i<n;i++) cin>>p,cal+=p;
    for(int i=0;i<n-1;i++) cin>>j[i],c+=j[i];
    sort(j,j+n-1);
    a=c;
    for(int i=0;i<n-1;i++) c-=j[i],a=max(ans,c*(i+2));
    cout<<a<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: 'cal' was not declared in this scope
   13 |     for(int i=0;i<n;i++) cin>>p,cal+=p;
      |                                 ^~~
a.cc:17:42: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     for(int i=0;i<n-1;i++) c-=j[i],a=max(ans,c*(i+2));
      |                                          ^~~
      |                                          abs