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

#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main(){

  int n,i,j,sum,sum2,x[10000],a;

  while(1){
    sum=0;
    sum2=0;
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      scanf("%d",&x[i]);
    }
    sort(x,x+n);
    sum=x[0];
    for(i=1;i<n;i++){ 
      sum2+=sum;
      sum+=x[i];
    }
    printf("%d\n",sum2);
  }
  return 0;
}

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

#include <algorithm>
using namespace std;

int a[10000];
int main(){
  int n,i;
  long long int z,r;
  for(;scanf("%d",&n),n;printf("%lld\n",r)){
    for(i=0;i<n;i++)scanf("%d",a+i);
    sort(a,a+n);
    for(z=r=i=0;i<n-1;i++)z+=a[i],r+=z;
  }
}

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

#include <stdio.h>

#define MAX_PEAPLE	( 10000 )

int needTime[ MAX_PEAPLE ];

int tmp[ MAX_PEAPLE ];

void sort( int data[], int size );
__int64 getWaitTime( int data[], int size );

int main( void )
{
	int n;
	int i;
	
	while( scanf( "%d", &n ) != EOF )
	{
		if( n == 0 )break;
		for( i = 0; i < n; i++ )
		{
			scanf( "%d", &needTime[i] );
		}
		sort( needTime, n );
		printf( "%llu\n", (unsigned)getWaitTime( needTime, n ) );
	}
	
	return (0);
}

__int64 getWaitTime( int data[], int size )
{
	__int64 waitTime[ MAX_PEAPLE ];
	int i;
	__int64 totalWaitTime;
	
	waitTime[0] = 0;
	for( i = 1; i < size; i++ )
	{
		waitTime[i] = waitTime[i - 1] + data[i - 1];
	}
	
	for( i = 0, totalWaitTime = 0; i < size; i++ )
	{
		totalWaitTime += waitTime[i];
	}
	
	return (totalWaitTime);
}

void sort( int data[], int size )
{
	int i;
	int j;
	int k;
	int l;
	
	if( size <= 1 )return;
	
	i = 0;
	j = size / 2;
	k = 0;
	
	sort( data, size / 2 );
	sort( data + size / 2, size - (size / 2) );
	
	while( i < size / 2 && j < size )
	{
		if( data[i] < data[j] )
		{
			tmp[k] = data[i];
			k++;
			i++;
		}
		else
		{
			tmp[k] = data[j];
			k++;
			j++;
		}
	}
	while( i < size / 2 )
	{
		tmp[k] = data[i];
		k++;
		i++;
	}
	while( j < size )
	{
		tmp[k] = data[j];
		k++;
		j++;
	}
	
	for( l = 0; l < size; l++ )
	{
		data[l] = tmp[l];
	}
}

Compiler output:
main.c:10:1: error: unknown type name '__int64'; did you mean '__int64_t'?
   10 | __int64 getWaitTime( int data[], int size );
      | ^~~~~~~
      | __int64_t
main.c:31:1: error: unknown type name '__int64'; did you mean '__int64_t'?
   31 | __int64 getWaitTime( int data[], int size )
      | ^~~~~~~
      | __int64_t
main.c: In function 'getWaitTime':
main.c:33:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   33 |         __int64 waitTime[ MAX_PEAPLE ];
      |         ^~~~~~~
      |         __int64_t
main.c:35:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   35 |         __int64 totalWaitTime;
      |         ^~~~~~~
      |         __int64_t
Language: C++

#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	
	while (scanf("%d", &n) != EOF){
		int waitt[10000] = {0};
		int i, j;
		long long sum;
		
		for (i = 0; i < n; i++) scanf("%d", waitt + i);
		sort(waitt, waitt + n);
		for (i = 0; i < n; i++){
			for (j = 0; j <= i; j++){
				sum += waitt[i][j];
			}
		}
		printf("%ld\n", sum);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:48: error: invalid types 'int[int]' for array subscript
   19 |                                 sum += waitt[i][j];
      |                                                ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

#define rep(X, Y) for( int (X) = 0; (X) < (Y); ++(X) )

int main(){
	int i, cnt;
	std::vector<int> vec;

	while( std::cin >> cnt, cnt ){
		while(cnt--)
			std::cin >> i, vec.push_back(i);

		std::sort( vec.begin(), vec.end() );

		rep( i, 2 )
			rep( l, vec.size() - 2 )	
				vec[l + 1] += vec[l];

		std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;

		vec.clear();
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:42: error: no matching function for call to 'min(std::vector<int>::size_type, int)'
   21 |                 std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:21:42: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
   21 |                 std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:21:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   21 |                 std::cout << vec[std::min(vec.size() - 2, 0)] << std::endl;
      |                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

int main(){


	vector<unsigned long long> t(10001, 61);
	int p;
	int i;
	vector<unsigned long long> total(10001, 0);
	int matu = 0;


	while (1){

		for (i = 0; i <= 10000; i++){
			t[i] = 61;
		}
		for (i = 0; i <= 10000; i++){
			total[i] = 0;
		}
		matu = 0;

		cin >> p;
		if (p == 0){
			break;
		}

		for (i = 0; i < p; i++){
			cin >> t[i];
		}
		sort(t.begin(), t.begin() + i - 1);


		for (i = 1; i < p; i++){
			total[i] = t[i - 1] + total[i - 1];
		}

		for (i = 0; i < p; i++){
			matu += total[i];
		}

		cout << matu << endl;

		
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'vector' was not declared in this scope
    4 |         vector<unsigned long long> t(10001, 61);
      |         ^~~~~~
a.cc:4:16: error: expected primary-expression before 'unsigned'
    4 |         vector<unsigned long long> t(10001, 61);
      |                ^~~~~~~~
a.cc:7:16: error: expected primary-expression before 'unsigned'
    7 |         vector<unsigned long long> total(10001, 0);
      |                ^~~~~~~~
a.cc:14:25: error: 't' was not declared in this scope
   14 |                         t[i] = 61;
      |                         ^
a.cc:17:25: error: 'total' was not declared in this scope
   17 |                         total[i] = 0;
      |                         ^~~~~
a.cc:21:17: error: 'cin' was not declared in this scope
   21 |                 cin >> p;
      |                 ^~~
a.cc:27:32: error: 't' was not declared in this scope
   27 |                         cin >> t[i];
      |                                ^
a.cc:29:22: error: 't' was not declared in this scope
   29 |                 sort(t.begin(), t.begin() + i - 1);
      |                      ^
a.cc:29:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   29 |                 sort(t.begin(), t.begin() + i - 1);
      |                 ^~~~
      |                 short
a.cc:33:25: error: 'total' was not declared in this scope
   33 |                         total[i] = t[i - 1] + total[i - 1];
      |                         ^~~~~
a.cc:37:33: error: 'total' was not declared in this scope
   37 |                         matu += total[i];
      |                                 ^~~~~
a.cc:40:17: error: 'cout' was not declared in this scope
   40 |                 cout << matu << endl;
      |                 ^~~~
a.cc:40:33: error: 'endl' was not declared in this scope
   40 |                 cout << matu << endl;
      |                                 ^~~~
Language: C++

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

int func(int dt[],int num){
	unsigned long long int c=num;
	unsigned long long int time=0;
	for(int i=0;i<c-1;i++){
		time+=(c-(i+1))*dt[i];
	}
	return time;
}

int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0)break;
		unsigned long long int cost[n];
		unsigned long long int ans=0;
		for(int i=0;i<n;i++){
			cin>>cost[i];
		}
		sort(cost,cost+n);
		ans=func(cost,n);
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: cannot convert 'long long unsigned int*' to 'int*'
   25 |                 ans=func(cost,n);
      |                          ^~~~
      |                          |
      |                          long long unsigned int*
a.cc:5:14: note:   initializing argument 1 of 'int func(int*, int)'
    5 | int func(int dt[],int num){
      |          ~~~~^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int n,a[10000];
while(true){
scanf("%d",&n);
if(n==0)return 0;
for(int i=0;i<n;i++)scanf("%d",&a[i]);
long long int ans=0;
sort(a,a+n);
for(int i=0;i<n;i++)ans+=(ll)a[i]*(n-1-i);
printf("%lld\n",ans);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: 'll' was not declared in this scope
   14 | for(int i=0;i<n;i++)ans+=(ll)a[i]*(n-1-i);
      |                           ^~
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<climits>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<set>
#include<stack>
#include<functional>
#include<queue>
using namespace std;
#define int long long long

signed main(){
    int N,T[10000];
    while(cin>>N,N){
        for(int i=0;i<N;i++) cin>>T[i];
        sort(T,T+N);
        int ans=0,sum=0;
        for(int i=0;i<N;i++){
            ans += sum; sum += T[i];
        }
        printf("%d\n",ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'long long long' is too long for GCC
   15 | #define int long long long
      |                       ^~~~
a.cc:18:5: note: in expansion of macro 'int'
   18 |     int N,T[10000];
      |     ^~~
a.cc:15:23: error: 'long long long' is too long for GCC
   15 | #define int long long long
      |                       ^~~~
a.cc:20:13: note: in expansion of macro 'int'
   20 |         for(int i=0;i<N;i++) cin>>T[i];
      |             ^~~
a.cc:15:23: error: 'long long long' is too long for GCC
   15 | #define int long long long
      |                       ^~~~
a.cc:22:9: note: in expansion of macro 'int'
   22 |         int ans=0,sum=0;
      |         ^~~
a.cc:15:23: error: 'long long long' is too long for GCC
   15 | #define int long long long
      |                       ^~~~
a.cc:23:13: note: in expansion of macro 'int'
   23 |         for(int i=0;i<N;i++){
      |             ^~~
Language: C++

#include<stdio.h>
int main(){

int [10001]={};
int a=0.s=0;
int n;

while(1){
scanf("%d",&n);
if(n==0)break;
for(int i=0;i<n;i++)
scanf("%d",&n[i]);

for(int i=0;i<n;i++)
for(int j=n-1;j>i;j--)
if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}

if(n==1)s=0;
else{
for(int i=1;i<n;i++)
{
a=a+n[i-1];s+=a;
}

}
printf("%d\n",s);
a=0;s=0;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:6: error: expected identifier before numeric constant
    4 | int [10001]={};
      |      ^~~~~
a.cc:4:6: error: expected ']' before numeric constant
    4 | int [10001]={};
      |      ^~~~~
      |      ]
a.cc:4:5: error: structured binding declaration cannot have type 'int'
    4 | int [10001]={};
      |     ^
a.cc:4:5: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:4:5: error: empty structured binding declaration
a.cc:5:7: error: unable to find numeric literal operator 'operator""s'
    5 | int a=0.s=0;
      |       ^~~
a.cc:12:14: error: invalid types 'int[int]' for array subscript
   12 | scanf("%d",&n[i]);
      |              ^
a.cc:16:5: error: invalid types 'int[int]' for array subscript
   16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
      |     ^
a.cc:16:10: error: invalid types 'int[int]' for array subscript
   16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
      |          ^
a.cc:16:24: error: invalid types 'int[int]' for array subscript
   16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
      |                        ^
a.cc:16:29: error: invalid types 'int[int]' for array subscript
   16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
      |                             ^
a.cc:16:34: error: invalid types 'int[int]' for array subscript
   16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
      |                                  ^
a.cc:16:41: error: invalid types 'int[int]' for array subscript
   16 | if(n[j]<n[j-1]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
      |                                         ^
a.cc:18:9: error: 's' was not declared in this scope
   18 | if(n==1)s=0;
      |         ^
a.cc:22:6: error: invalid types 'int[int]' for array subscript
   22 | a=a+n[i-1];s+=a;
      |      ^
a.cc:22:12: error: 's' was not declared in this scope
   22 | a=a+n[i-1];s+=a;
      |            ^
a.cc:26:15: error: 's' was not declared in this scope
   26 | printf("%d\n",s);
      |               ^
Language: C++

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

using namespace std;

int main(void)
{
	int  n;
	
	while(cin >> n, n){
		int a = 0;
		long longint ans = 0;
		int time[10000];
		for(int i = 0; i < n; i++){
			cin >> time[i];
		}
		
		sort(time, time + n);
		int temp = n;
		for(int j = 0; j < n-1; j++){
			a = 0;
			for(int ii = 0; ii < temp-1; ii++){
				a += time[ii];
			}
			ans += a;
			temp--;
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: expected initializer before 'ans'
   13 |                 long longint ans = 0;
      |                              ^~~
a.cc:26:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |                         ans += a;
      |                         ^~~
      |                         abs
a.cc:29:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |                 cout << ans << endl;
      |                         ^~~
      |                         abs
Language: C++

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int x[10000000]; int n, sum2; long long sum;
int main() {
	while (true) {
		memset(x, 0, sizeof(x));
		cin >> n;
		if (!n) { break; }
		for (int i = 0; i < n; i++) {
			cin >> x[i];
		}
		sort(x, x + n);
		sum2 = 0;
		sum = 0;
		for (int i = 0; i < n; i++) {
			sum += sum2;
			sum2 += a[i];
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:33: error: 'a' was not declared in this scope
   19 |                         sum2 += a[i];
      |                                 ^
Language: C++

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

int main(){
	int n,i,sum,wait;
	vector<int> w;
	while(cin>>n,n){
		w.assign(n,0);
		for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
		sort(w.begin(),w.end());
		for(sum=wait=0,i=0;i<n-1;wait+=w[i],sum+=wait,++i);
		co
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:39: error: 'ut' was not declared in this scope
   11 |                 for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
      |                                       ^~
a.cc:11:52: error: expected ')' before ';' token
   11 |                 for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
      |                    ~                               ^
      |                                                    )
a.cc:11:56: error: expected ';' before ')' token
   11 |                 for(i=0;i<n;cin>>w[i],ut<<sum<<endl;++i);
      |                                                        ^
      |                                                        ;
a.cc:14:17: error: 'co' was not declared in this scope
   14 |                 co
      |                 ^~
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
using namespace std;
int main() {
	int n;;
	while (cin >> n, n) {
		vector<long long> a(n);
		for (long long &x : a)cin >> x;
		sort(a.begin(), a.end());
		long long sum = 0;
		for (long long &x : a)sum1+=sum,sum+=x;
		//sum = 0;
		//for (long long &x : a)x = (sum += x);
		cout << sum1 << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:39: error: 'sum1' was not declared in this scope; did you mean 'sum'?
   18 |                 for (long long &x : a)sum1+=sum,sum+=x;
      |                                       ^~~~
      |                                       sum
a.cc:21:25: error: 'sum1' was not declared in this scope; did you mean 'sum'?
   21 |                 cout << sum1 << endl;
      |                         ^~~~
      |                         sum
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n, t[10000];

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

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

    sort(t, t+n);

    int ans = 0;
    for (int i = 0; i < n; i++) ans += ans + t[i] - t[0];
    cout << ans << endl;
  }
  
}

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

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

using namespace std;

int main(void){
  int n;
  long long unsigned int sum;

  while (scanf("%d", &n), n){
    vector<int> vec;
    for (int i=0; i<n; i++){
      int x;
      scanf("%d", &x);
      vec.push_back(x);
    }
    sort(vec.begin(), vec.end());
    sum = 0;
    for (int i=0; i<n-1; i++){
      sum += vec[i]*(n-1-i);
    }
    cout << sum << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout << sum << endl;
      |     ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:23:20: error: 'endl' was not declared in this scope
   23 |     cout << sum << endl;
      |                    ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <algorithm>
  +++ |+#include <ostream>
    4 |
Language: C++

#include <bits/stdc++.h>

using namespace std;
vector<int> list;
 
int main(){
  int n;
  while(cin>>n,n!=0){
    list.clear();
    for(int i=0;i<n;i++){
      int tmp;
      cin>>tmp;
      list.push_back(tmp);
    }
    sort(list.begin(),list.end());
    long long ans=0;
    long long pre=0;
    for(int i=0;i<n;i++){
      ans+=pre;
      pre=pre+list[i];
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: reference to 'list' is ambiguous
    9 |     list.clear();
      |     ^~~~
In file included from /usr/include/c++/14/list:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:4:13: note:                 'std::vector<int> list'
    4 | vector<int> list;
      |             ^~~~
a.cc:13:7: error: reference to 'list' is ambiguous
   13 |       list.push_back(tmp);
      |       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:4:13: note:                 'std::vector<int> list'
    4 | vector<int> list;
      |             ^~~~
a.cc:15:10: error: reference to 'list' is ambiguous
   15 |     sort(list.begin(),list.end());
      |          ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:4:13: note:                 'std::vector<int> list'
    4 | vector<int> list;
      |             ^~~~
a.cc:15:23: error: reference to 'list' is ambiguous
   15 |     sort(list.begin(),list.end());
      |                       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:4:13: note:                 'std::vector<int> list'
    4 | vector<int> list;
      |             ^~~~
a.cc:20:15: error: reference to 'list' is ambiguous
   20 |       pre=pre+list[i];
      |               ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:4:13: note:                 'std::vector<int> list'
    4 | vector<int> list;
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<int> list;
 
int main(){
  int n;
  while(cin>>n,n!=0){
    list.clear();
    for(int i=0;i<n;i++){
      int tmp;
      cin>>tmp;
      list.push_back(tmp);
    }
    sort(list.begin(),list.end());
    long long ans=0;
    long long pre=0;
    for(int i=0;i<n;i++){
      ans+=pre;
      pre=pre+list[i];
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: reference to 'list' is ambiguous
    8 |     list.clear();
      |     ^~~~
In file included from /usr/include/c++/14/list:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:13: note:                 'std::vector<int> list'
    3 | vector<int> list;
      |             ^~~~
a.cc:12:7: error: reference to 'list' is ambiguous
   12 |       list.push_back(tmp);
      |       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:13: note:                 'std::vector<int> list'
    3 | vector<int> list;
      |             ^~~~
a.cc:14:10: error: reference to 'list' is ambiguous
   14 |     sort(list.begin(),list.end());
      |          ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:13: note:                 'std::vector<int> list'
    3 | vector<int> list;
      |             ^~~~
a.cc:14:23: error: reference to 'list' is ambiguous
   14 |     sort(list.begin(),list.end());
      |                       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:13: note:                 'std::vector<int> list'
    3 | vector<int> list;
      |             ^~~~
a.cc:19:15: error: reference to 'list' is ambiguous
   19 |       pre=pre+list[i];
      |               ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:13: note:                 'std::vector<int> list'
    3 | vector<int> list;
      |             ^~~~
Language: C++

#include "bits/stdc++.h"
#include<iostream>
#include<cstdio>
#include<cmath>
#include<bitset>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> list;

int main(){
  int n;
  while(cin>>n,n!=0){
    list.clear();
    for(int i=0;i<n;i++){
      int tmp;
      cin>>tmp;
      list.push_back(tmp);
    }
    sort(list.begin(),list.end());
    long long ans=0;
    long long pre=0;
    for(int i=0;i<n;i++){
      ans+=pre;
      pre=pre+list[i];
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: reference to 'list' is ambiguous
   14 |     list.clear();
      |     ^~~~
In file included from /usr/include/c++/14/list:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:9:13: note:                 'std::vector<int> list'
    9 | vector<int> list;
      |             ^~~~
a.cc:18:7: error: reference to 'list' is ambiguous
   18 |       list.push_back(tmp);
      |       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:9:13: note:                 'std::vector<int> list'
    9 | vector<int> list;
      |             ^~~~
a.cc:20:10: error: reference to 'list' is ambiguous
   20 |     sort(list.begin(),list.end());
      |          ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:9:13: note:                 'std::vector<int> list'
    9 | vector<int> list;
      |             ^~~~
a.cc:20:23: error: reference to 'list' is ambiguous
   20 |     sort(list.begin(),list.end());
      |                       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:9:13: note:                 'std::vector<int> list'
    9 | vector<int> list;
      |             ^~~~
a.cc:25:15: error: reference to 'list' is ambiguous
   25 |       pre=pre+list[i];
      |               ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:9:13: note:                 'std::vector<int> list'
    9 | vector<int> list;
      |             ^~~~
Language: C++

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

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int lines = Integer.parseInt(sc.nextLine());

		while (lines != 0) {
			int[] wait = new int[lines];
			for (int i = 0; i < lines; i++) {
				wait[i] = Integer.parseInt(sc.nextLine());
			}
			
			Arrays.sort(wait);
			
			long sum = 0;
			for (int i = 0; i < lines; i++) {
				sum = sum + (lines - i - 1) * wait[i];
			}
			System.out.println(sum);

			lines = Integer.parseInt(sc.nextLine());
		}
	}
}

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.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include <algorithm>
using namespace std;

const int MAX = 10000;
int main()
{
	int N;
	while (cin >> N, N)
	{
		int a[MAX];
		for (int i=0; i<N; i++)
			cin >> a[i];

		sort(&a[0], &a[N]);

		int sum = 0;
		for (int i=1; i<N; i++)
			sum += (N-i)*a[i-1];

		cout << sum << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: 'cin' was not declared in this scope
    8 |         while (cin >> N, N)
      |                ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:20:17: error: 'cout' was not declared in this scope
   20 |                 cout << sum << endl;
      |                 ^~~~
a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:32: error: 'endl' was not declared in this scope
   20 |                 cout << sum << endl;
      |                                ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(int argc, char **argv)
{
	int n, *array, tmp;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		array = (int *)calloc(n, sizeof(int));
		
		for(int i = 0; i < n; i++)[
			cin >> array[i];
		}
		sort(array, array+n);
		
		tmp = array[0];
		for(int i = 1; i < (n-1); i++){
			array[i] += array[i-1];
			tmp += array[i];
		}
		
		cout << tmp << endl;
		free(array);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:19:25: warning: capture of variable 'std::cin' with non-automatic storage duration
   19 |                         cin >> array[i];
      |                         ^~~
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::istream std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:19:28: error: expected ',' before '>>' token
   19 |                         cin >> array[i];
      |                            ^~~
      |                            ,
a.cc:19:29: error: expected identifier before '>>' token
   19 |                         cin >> array[i];
      |                             ^~
a.cc:19:40: error: expected ']' before ';' token
   19 |                         cin >> array[i];
      |                                        ^
      |                                        ]
a.cc: In lambda function:
a.cc:19:40: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:33:9: error: expected unqualified-id before 'return'
   33 |         return 0;
      |         ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

import java.io.*;
import java.util.List;
import java.util.ArrayList;


public class Main{
	public static void main(String args[]){
		new Main();
	}

	public Main(){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		List<Integer> nums = new ArrayList<Integer>();

		try{
			String line;
			while((line = br.readLine()) != null){
				int num = Integer.parseInt(line);

				if(num == 0){
					break;
				}

				nums.add(num);
			}

		}catch(IOException err){
			err.printStackTrace();
		}

		int n = nums.get(0);
		nums.remove(0);

		int[] dst = new int[nums.size()];
		for(int i=0; i<nums.size(); i++){
			dst[i] = nums.get(i);
		}

		sort(dst);

		int sum = 0;
		for(int i=0; i<n; i++){
			sum += dst[i] * (n-i-1);
		}

		System.out.println(sum);

	}

	public void sort(int[] a){
		for(int i=0; i<a.length-1; i++){
			for(int j=a.length-1; j>i; j--){
				if(a[j] < a[j-1]){
					int t = a[j];
					a[j] = a[j-1];
					a[j-1] = t;
				}
			}
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
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.List;
      | ^~~~~~
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.ArrayList;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main{
      | ^~~~~~
Language: C++

import java.io.*;
import java.util.List;
import java.util.ArrayList;


public class Main{
	public static void main(String args[]){
		new Main();
	}

	public Main(){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		List<int[]> nums = new ArrayList<int[]>();
		List<Integer> ans = new ArrayList<Integer>();

		try{
			String line;
			while((line = br.readLine()) != null){
				int data_size = Integer.parseInt(line);

				if(data_size == 0) break;

				int[] num_set = new int[data_size];

				for(int i=0; i<data_size; i++){
					num_set[i] = Integer.parseInt(br.readLine());
				}
				nums.add(num_set);
			}

		}catch(IOException err){
			err.printStackTrace();
		}

		for(int i=0; i<nums.size(); i++){
			int[] dst = nums.get(i);
			sort(dst);

			int sum = 0;
			for(int j=0; j<dst.length; j++){
				sum += dst[j] * (dst.length-j-1);
			}

			ans.add(sum);
		}

		for(int i=0; i<ans.size(); i++){
			System.out.println(ans.get(i));
		}
	}

	public void sort(int[] a){
		for(int i=0; i<a.length-1; i++){
			for(int j=a.length-1; j>i; j--){
				if(a[j] < a[j-1]){
					int t = a[j];
					a[j] = a[j-1];
					a[j-1] = t;
				}
			}
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
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.List;
      | ^~~~~~
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.ArrayList;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main{
      | ^~~~~~
Language: C++

/*
AizuOnline A0121
A Milk Shop
*/
#include <stdio.h>
#include <stdlib.h>

int int_lessp(int *a,int *b)
{
  return(*a - *b);
}

main()
{
  int i,c,n[10001];
  long int sum;

  while(EOF!=scanf("%d",&c) && c > 0)
    { sum = 0;
      for(i=0;i<c;i++)
         scanf("%d",n+i);
         
      qsort(n,c,sizeof(int),int_lessp);
      
      for(i=0;i<c;i++)
        sum += (c-i-1)*n[i];

      printf("%lld\n",sum);

    }
return(0);
}

Compiler output:
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:23:29: error: invalid conversion from 'int (*)(int*, int*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
   23 |       qsort(n,c,sizeof(int),int_lessp);
      |                             ^~~~~~~~~
      |                             |
      |                             int (*)(int*, int*)
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/stdlib.h:36,
                 from a.cc:6:
/usr/include/stdlib.h:971:34: note:   initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C++

t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}

Compiler output:
a.cc:1:3: warning: multi-character character constant [-Wmultichar]
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      |   ^~~~
a.cc:1:1: error: 't' does not name a type
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      | ^
a.cc:1:9: error: 'n' does not name a type
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      |         ^
a.cc:1:13: error: ISO C++ forbids declaration of 'c' with no type [-fpermissive]
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      |             ^
a.cc: In function 'int c(int*)':
a.cc:1:22: error: 'z' was not declared in this scope
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      |                      ^
a.cc:1:34: warning: no return statement in function returning non-void [-Wreturn-type]
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      |                                  ^
a.cc: At global scope:
a.cc:1:39: error: expected constructor, destructor, or type conversion before '(' token
    1 | t['~~'];n,z;c(int*x){z=*1[&x]-*x;}main(s){for(;s=scanf("%d",&n)*n;printf("%d\n",s)){for(;s;)scanf("%d",t+--s);for(qsort(t,n,4,c);n;)s+=t[--n]*n;}exit(0);}
      |                                       ^
Language: C++

#include <iostream>
#include <stdlib.h>
using namespace std;
int int_cmp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int main(){
int i,j,n,t[10010];
while(cin>>n,n){
__int64 s=0;
for(i=0;i<n;i++)cin>>t[i];
qsort(t,n,sizeof(int),int_cmp);
for(i=0;i<n;i++)s+=t[i]*(n-i-1);
cout<<s<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    8 | __int64 s=0;
      | ^~~~~~~
      | __int64_t
a.cc:11:17: error: 's' was not declared in this scope
   11 | for(i=0;i<n;i++)s+=t[i]*(n-i-1);
      |                 ^
a.cc:12:7: error: 's' was not declared in this scope
   12 | cout<<s<<endl;
      |       ^
Language: C++

#include <iostream>

using namespace std;

int main() {
  for (;;) {
    int n, p[10000];
    cin >> n;
    if (!n) return 0;
    for (int i = 0; i < n; i++)
      cin >> p[i];
    sort(p, p+n);
    int s = 0;
    for (int i = 1; i < n; i++)
      s += p[i-1]*(n-i);
    cout << s << endl;
  }
}

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

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

int main()
{
	int n;

	while( cin >> n && n ){
		vector< int > line;
		for( int i = 0; i < n; ++i ){
			int d;
			cin >> d;
			line.push_back( d );
		}
		sort( line.begin(), line.end() );
		long long output = 0;
		for( int i = 0; i < n - 1; ++i ){
			output += ( line[ i ] * ( n - i - 1 ) );
			if( output < 0 ) __debugbreak();
		}
		cout << output << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:42: error: '__debugbreak' was not declared in this scope
   21 |                         if( output < 0 ) __debugbreak();
      |                                          ^~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <queue>
using namespace std;
int num[10005];
int main(){
	int n;
	while(scanf("%d",&n) && n){
		for(int i=0;i<n;i++){
			int r;
			scanf("%d",&num[i]);
		}
		sort(num,num+n);
		int ans=0;
		for(int i=0;i<n;i++){
			ans+=num[i]*(n-1-i);
		}
		printf("%d\n",ans);
	}
}

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

#include<stdio.h>

int main() 
{
	
	while(scanf("%d",&n)!=EOF)
	{
		int x[10000],fake,sum=0;

	for(int t=0;;t++)
	{
		scanf("%d",&x[t]);

		if(x[t]==0)
		{
			break;
		}
		if(t!=0||t<n)
		{
			for(int r=0;r<=t;r++)
			{
				if(x[t]<x[r])
				{
					fake=x[t];
					x[t]=x[r];
					x[r]=fake;
				}
			}
		}
	}

	for(int t=0;t<n;t++)
	{
		sum+=x[t]*(n-t-1);
	}

	printf("%d\n",sum);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: 'n' was not declared in this scope
    6 |         while(scanf("%d",&n)!=EOF)
      |                           ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){int n,i,t;for(long int ans;cin>>n,n;cout<<ans<<endl){vector<int> m;for(ans=i=0;i++<n;m.push_back(t))cin>>t;sort(m.begin(),m.end());for(i=1;i<n;i++)ans+=m[i-1]*(n-i);}}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:119: error: 'sort' was not declared in this scope; did you mean 'short'?
    4 | int main(){int n,i,t;for(long int ans;cin>>n,n;cout<<ans<<endl){vector<int> m;for(ans=i=0;i++<n;m.push_back(t))cin>>t;sort(m.begin(),m.end());for(i=1;i<n;i++)ans+=m[i-1]*(n-i);}}
      |                                                                                                                       ^~~~
      |                                                                                                                       short
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int TIME[11111],sum[11111],ret;
  int n;
  while(1){
    cin >> n;
    if(!n)break;
    memset( TIME , 0 , sizeof(TIME) );
    memset( sum , 0 , sizeof(sum) );
    for(int i=0;i<n;i++){
      cin >> TIME[i];
    }
    sort( TIME , TIME + n );
    ret = 0;
    sum[0] = 0;
    for(int i=1;i<n;i++){
      sum[i] = TIME[i-1] + sum[i-1];
      ret += sum[i];
    }
    cout << ret << endl;
  }
}

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

)
		{
			ans += (n-(i+1))*T[i];
		}

		cout << ans << endl;
	}
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before ')' token
    1 | )
      | ^
a.cc:6:17: error: 'cout' does not name a type
    6 |                 cout << ans << endl;
      |                 ^~~~
a.cc:7:9: error: expected declaration before '}' token
    7 |         }
      |         ^
a.cc:8:1: error: expected declaration before '}' token
    8 | }
      | ^
Language: C++

#include <iostream>
int a[10010];
int main()
{
         while(1)
         {
                    memset(a,0,sizeof(0));
                    int n;
                    cin >> n;
                    if(n==0)break;
                    for(int i=0;i<n;i++)cin >> a[i];
                    ll ans=0ll;
                    sort(a,a+n);
                    for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
                    cout << ans << endl;
         }
         return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: 'memset' was not declared in this scope
    7 |                     memset(a,0,sizeof(0));
      |                     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | int a[10010];
a.cc:9:21: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |                     cin >> n;
      |                     ^~~
      |                     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:21: error: 'll' was not declared in this scope
   12 |                     ll ans=0ll;
      |                     ^~
a.cc:13:21: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |                     sort(a,a+n);
      |                     ^~~~
      |                     short
a.cc:14:43: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |                     for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
      |                                           ^~~
      |                                           abs
a.cc:15:21: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |                     cout << ans << endl;
      |                     ^~~~
      |                     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:15:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |                     cout << ans << endl;
      |                             ^~~
      |                             abs
a.cc:15:36: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   15 |                     cout << ans << endl;
      |                                    ^~~~
      |                                    std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include <cstring>
using namespace std;
int a[10010];
int main()
{
         while(1)
         {
                    memset(a,0,sizeof(0));
                    int n;
                    cin >> n;
                    if(n==0)break;
                    for(int i=0;i<n;i++)cin >> a[i];
                    ll ans=0ll;
                    sort(a,a+n);
                    for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
                    cout << ans << endl;
         }
         return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'll' was not declared in this scope
   14 |                     ll ans=0ll;
      |                     ^~
a.cc:15:21: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |                     sort(a,a+n);
      |                     ^~~~
      |                     short
a.cc:16:43: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |                     for(int i=0;i<n-1;i++)ans+=a[i]*(n-1-i);
      |                                           ^~~
      |                                           abs
a.cc:17:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |                     cout << ans << endl;
      |                             ^~~
      |                             abs