Language: C++

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;


void yes(){
   cout<<"Yes";
   // exit(0);
}

void no(){
   cout<<"No";
   // exit(0);
}


int n, m;
string s, t;

int32_t main(){_
   
   cin >> n;
   vector<int> a(n);

   for (int i = 0; i < n; ++i)
   {
      cin >> a[i];
   }

   int ans = 0;

   int mx = a[0];
   for (int i = 1; i < n; ++i)
   {
      ans += max(mx - a[i], 0LL);
      smax(mx, a[i]);
   }


   cout<<ans;

   return 0;
}#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;


void yes(){
   cout<<"Yes";
   // exit(0);
}

void no(){
   cout<<"No";
   // exit(0);
}


int n, m;
string s, t;

int32_t main(){_
   
   cin >> n;
   vector<int> a(n);

   for (int i = 0; i < n; ++i)
   {
      cin >> a[i];
   }

   int ans = 0;

   int mx = a[0];
   for (int i = 1; i < n; ++i)
   {
      ans += max(mx - a[i], 0LL);
      smax(mx, a[i]);
   }


   cout<<ans;

   return 0;
}

Compiler output:
a.cc:54:2: error: stray '#' in program
   54 | }#include <bits/stdc++.h>
      |  ^
a.cc:54:3: error: 'include' does not name a type
   54 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:58:11: error: redefinition of 'const long long int mod'
   58 | const int mod = (int)1e9 + 7;
      |           ^~~
a.cc:5:11: note: 'const long long int mod' previously defined here
    5 | const int mod = (int)1e9 + 7;
      |           ^~~
a.cc:66:34: error: redefinition of 'template<class T, class T2> void smin(T&, T2)'
   66 | template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
      |                                  ^~~~
a.cc:13:34: note: 'template<class T, class T2> void smin(T&, T2)' previously declared here
   13 | template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
      |                                  ^~~~
a.cc:66:109: error: redefinition of 'template<class T, class T2> void smax(T&, T2)'
   66 | template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
      |                                                                                                             ^~~~
a.cc:13:109: note: 'template<class T, class T2> void smax(T&, T2)' previously declared here
   13 | template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
      |                                                                                                             ^~~~
a.cc:67:11: error: redefinition of 'const long long int N'
   67 | const int N = 5*(int)1e5 + 10;
      |           ^
a.cc:14:11: note: 'const long long int N' previously defined here
   14 | const int N = 5*(int)1e5 + 10;
      |           ^
a.cc:70:6: error: redefinition of 'void yes()'
   70 | void yes(){
      |      ^~~
a.cc:17:6: note: 'void yes()' previously defined here
   17 | void yes(){
      |      ^~~
a.cc:75:6: error: redefinition of 'void no()'
   75 | void no(){
      |      ^~
a.cc:22:6: note: 'void no()' previously defined here
   22 | void no(){
      |      ^~
a.cc:81:5: error: redefinition of 'long long int n'
   81 | int n, m;
      |     ^
a.cc:28:5: note: 'long long int n' previously declared here
   28 | int n, m;
      |     ^
a.cc:81:8: error: redefinition of 'long long int m'
   81 | int n, m;
      |        ^
a.cc:28:8: note: 'long long int m' previously declared here
   28 | int n, m;
      |        ^
a.cc:82:8: error: redefinition of 'std::string s'
   82 | string s, t;
      |        ^
a.cc:29:8: note: 'std::string s' previously declared here
   29 | string s, t;
      |        ^
a.cc:82:11: error: redefinition of 'std::string t'
   82 | string s, t;
      |           ^
a.cc:29:11: note: 'std::string t' previously declared here
   29 | string s, t;
      |           ^
a.cc:84:9: error: redefinition of 'int32_t main()'
   84 | int32_t main(){_
      |         ^~~~
a.cc:31:9: note: 'int32_t main()' previously defined here
   31 | int32_t main(){_
      |         ^~~~