Problem Statement
Increasing Array
Implementation
void solve() {
ll n;
cin >> n;
vll a(n);
rep(i, n) cin >> a[i];
ll ans = 0;
FOR(i, 1, n - 1) {
ans += max(0, a[i - 1] - a[i]);
a[i] = max(a[i], a[i - 1]);
}
cout << ans << "\n";
}