Language: C++

#include<cstdio>
#include<algorithm>
#define int long long;
using namespace std;
struct arr
  {
   int aa,bb;
  }a[100010];
int n;
long long b[100010];
int cmp(arr x,arr y)
  {
   if (x.aa!=y.aa) return x.aa>y.aa;
   return x.bb<y.bb;
  }
signed main()
  {
   scanf("%lld",&n);
   for (int i=1;i<=n;i++)
     {
      scanf("%lld",&a[i].aa);
      a[i].bb=i;b[i]=0;
	 }
   sort(a+1,a+1+n,cmp);
   int maxa=1;int maxb=1;
   while (true)
     {
      while ((a[maxb].aa==a[maxa].aa) && (maxb<=n)) maxb=maxb+1;
      if (maxb>n) break;
      b[a[maxa].bb]+=(maxb-1)*(a[maxa].aa-a[maxb].aa);
      a[maxa].aa=a[maxb].aa;
	  if (a[maxa].bb>a[maxb].bb) maxa=maxb;
	 }
   b[a[maxa].bb]+=a[maxa].aa*n;
   for (int i=1;i<=n;i++) printf("%lld\n",b[i]);
   return 0;
  } 

Compiler output:
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:7:4: note: in expansion of macro 'int'
    7 |    int aa,bb;
      |    ^~~
a.cc:7:8: error: 'aa' does not name a type
    7 |    int aa,bb;
      |        ^~
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:9:1: note: in expansion of macro 'int'
    9 | int n;
      | ^~~
a.cc:9:5: error: 'n' does not name a type
    9 | int n;
      |     ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:11:1: note: in expansion of macro 'int'
   11 | int cmp(arr x,arr y)
      | ^~~
a.cc:11:5: error: ISO C++ forbids declaration of 'cmp' with no type [-fpermissive]
   11 | int cmp(arr x,arr y)
      |     ^~~
a.cc: In function 'int cmp(arr, arr)':
a.cc:13:10: error: 'struct arr' has no member named 'aa'
   13 |    if (x.aa!=y.aa) return x.aa>y.aa;
      |          ^~
a.cc:13:16: error: 'struct arr' has no member named 'aa'
   13 |    if (x.aa!=y.aa) return x.aa>y.aa;
      |                ^~
a.cc:13:29: error: 'struct arr' has no member named 'aa'
   13 |    if (x.aa!=y.aa) return x.aa>y.aa;
      |                             ^~
a.cc:13:34: error: 'struct arr' has no member named 'aa'
   13 |    if (x.aa!=y.aa) return x.aa>y.aa;
      |                                  ^~
a.cc:14:13: error: 'struct arr' has no member named 'bb'
   14 |    return x.bb<y.bb;
      |             ^~
a.cc:14:18: error: 'struct arr' has no member named 'bb'
   14 |    return x.bb<y.bb;
      |                  ^~
a.cc: In function 'int main()':
a.cc:18:18: error: 'n' was not declared in this scope
   18 |    scanf("%lld",&n);
      |                  ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:19:9: note: in expansion of macro 'int'
   19 |    for (int i=1;i<=n;i++)
      |         ^~~
a.cc:19:13: error: 'i' was not declared in this scope
   19 |    for (int i=1;i<=n;i++)
      |             ^
a.cc:19:21: error: expected ')' before ';' token
   19 |    for (int i=1;i<=n;i++)
      |        ~            ^
      |                     )
a.cc:19:22: error: 'i' was not declared in this scope
   19 |    for (int i=1;i<=n;i++)
      |                      ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:25:4: note: in expansion of macro 'int'
   25 |    int maxa=1;int maxb=1;
      |    ^~~
a.cc:25:8: error: 'maxa' was not declared in this scope
   25 |    int maxa=1;int maxb=1;
      |        ^~~~
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:25:15: note: in expansion of macro 'int'
   25 |    int maxa=1;int maxb=1;
      |               ^~~
a.cc:25:19: error: 'maxb' was not declared in this scope
   25 |    int maxa=1;int maxb=1;
      |                   ^~~~
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:35:9: note: in expansion of macro 'int'
   35 |    for (int i=1;i<=n;i++) printf("%lld\n",b[i]);
      |         ^~~
a.cc:35:21: error: expected ')' before ';' token
   35 |    for (int i=1;i<=n;i++) printf("%lld\n",b[i]);
      |        ~            ^
      |                     )