buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define mii map<lli, lli>
#define msi map<string, lli>
#define pii pair<lli, lli>
#define vi vector<lli>
#define vvi vector<vector<lli>>
... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define mii map<lli, lli>
#define msi map<string, lli>
#define pii pair<lli, lli>
#define vi vector<lli>
#define vvi vector<vector<lli>>
... | [["-", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 107]] | 1 | 323 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 2e5 + 10;
int main() {
// freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> a(n + 1);
a[0] = 0;
int cnt = 0;
for (... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 2e5 + 10;
int main() {
// freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> a(n + 1);
a[0] = 0;
long long cnt = 0;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 149 |
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
int n, a[200005];
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i != 0) {
if (a[i - 1] > a[i]) {
ans += a[i - 1] - a[i];
a[i] = a[i - 1];
}
}
}
cout <<... | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
long long n, a[200005];
cin >> n;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i != 0) {
if (a[i - 1] > a[i]) {
ans += a[i - 1] - a[i];
a[i] = a[i - 1];
}
}
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 119 |
require 'pp'
n = gets.to_i
a_n = gets.split.map(&:to_i)
i = 1
sum = 0
while i < n
if a_n[i-1] < a_n[i]
diff = a_n[i] - a_n[i-1]
sum += diff
a_n[i] += diff
end
i += 1
end
puts sum
| require 'pp'
n = gets.to_i
a_n = gets.split.map(&:to_i)
i = 1
sum = 0
while i < n
if a_n[i-1] > a_n[i]
diff = a_n[i-1] - a_n[i]
sum += diff
a_n[i] += diff
end
i += 1
end
puts sum
| [["-", 0, 89, 8, 170, 0, 121, 15, 738, 17, 18], ["+", 0, 89, 8, 170, 0, 121, 15, 738, 17, 47], ["+", 0, 662, 12, 738, 31, 742, 0, 738, 17, 33], ["+", 0, 662, 12, 738, 31, 742, 0, 738, 12, 612], ["-", 0, 662, 12, 738, 12, 742, 0, 738, 17, 33], ["-", 0, 662, 12, 738, 12, 742, 0, 738, 12, 612]] | 4 | 71 |
#include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define ll long long
#define debug(args...) ... | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define ll long long
#define debug(args...) ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 161 |
#include <bits/stdc++.h>
#define TASK "task"
/// 2020.08.22
using namespace std;
void rwFile() {
freopen(TASK ".in", "r", stdin);
freopen(TASK ".out", "w", stdout);
}
void solveA() {
int n, x, t;
cin >> n >> x >> t;
cout << (n + x - 1) / x * t;
}
void solveC() {
int n;
cin >> n;
int arr[n];
for (i... | #include <bits/stdc++.h>
#define TASK "task"
/// 2020.08.22
using namespace std;
void rwFile() {
freopen(TASK ".in", "r", stdin);
freopen(TASK ".out", "w", stdout);
}
void solveA() {
int n, x, t;
cin >> n >> x >> t;
cout << (n + x - 1) / x * t;
}
void solveC() {
int n;
cin >> n;
long long arr[n];
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 220 |
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define mp make_pair
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace... | #include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define mp make_pair
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 169 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f3f3f3f3f;
ll t, n, k, a[maxn], res;
int main() {
// freopen("in.txt","r",stdin);
cin >> t;
for (int i = 0; i < t; i++)
cin >> a[i];
for (int i = 0; i < t - 1; i++) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f3f3f3f3f;
ll t, n, k, a[maxn], res;
int main() {
// freopen("in.txt","r",stdin);
cin >> t;
for (int i = 0; i < t; i++)
cin >> a[i];
for (int i = 0; i < t - 1; i++) ... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13]] | 1 | 148 |
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define all(x) x.begin(), x.en... | /*COMPETITIVE PROGRAMMING C++ TEMPLATE */
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define all(x) x.begin(), x.en... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 223 |
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define JAM(x) cout << #x << " = " << x << "\n"
#define II() \
({ \
int a; ... | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define JAM(x) cout << #x << " = " << x << "\n"
#define II() \
({ \
int a; ... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]] | 1 | 514 |
//#include <fsociety>
#include <algorithm>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <unordered_set... | //#include <fsociety>
#include <algorithm>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <unordered_set... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]] | 1 | 198 |
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
... | #include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 957 |
#include <iostream>
using namespace std;
int main(void) {
int n, a[200010], i, ans = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
ans += (a[i - 1] - a[i]);
a[i] = a[i - 1];
}
}
cout << ans << '\n';
}
| #include <iostream>
using namespace std;
int main(void) {
long long int n, a[200010], i, ans = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
ans += (a[i - 1] - a[i]);
a[i] = a[i - 1];
}
}
cout << ans << '\n';
}
| [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 120 |
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stac... | #include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stac... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 57... | 1 | 1,425 |
n=int(input())
l=[int(i) for i in input().split()]
c=0
for i in range(1,n):
c=max(c,max(l[i-1]-l[i],0))
l[i]+=max(l[i-1]-l[i],0)
print(c) | n=int(input())
l=[int(i) for i in input().split()]
c=0
for i in range(1,n):
c+=max(l[i-1]-l[i],0)
l[i]+=max(l[i-1]-l[i],0)
print(c) | [["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 87 |
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
ll maxl(ll a, ll b) { return ((a < b) ? b : a); }
ll minl(ll a, ll b) { return ((a > b) ? b : a); }
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int ... | typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
ll maxl(ll a, ll b) { return ((a < b) ? b : a); }
ll minl(ll a, ll b) { return ((a > b) ? b : a); }
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 180 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int height = 0;
int step = 0;
for (int i = 0; i < N; i++) {
if (A[i] < height) {
step += height - A[i];
} else {
heig... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<ll> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
ll height = 0;
ll step = 0;
for (int i = 0; i < N; i++) {
if (A[i] < height) {
step += height - A[i];
} else {
height ... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 122 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
int main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int mx = a[0];
int tot = 0;
for (int i = 0; i < n; i++) {... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
int main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
ll mx = a[0];
ll tot = 0;
for (int i = 0; i < n; i++) {
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 152 |
#include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace... | #include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 151 |
#include <algorithm>
#include <array>
#include <bits/stdc++.h>
#include <deque>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define ll long long
#define ar array
int main() {
int n;
cin >> n;
int a... | #include <algorithm>
#include <array>
#include <bits/stdc++.h>
#include <deque>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define ll long long
#define ar array
int main() {
int n;
cin >> n;
ll a[... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 154 |
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define debug(x) cerr << #x << " : " << x << endl;
#define _all(x) x.begin(), x.end()
#define _sz(x) ((int)x.size())
typedef long long ll;
// code //
void solve() {}
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < ... | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define debug(x) cerr << #x << " : " << x << endl;
#define _all(x) x.begin(), x.end()
#define _sz(x) ((int)x.size())
typedef long long ll;
// code //
void solve() {}
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 132 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int max = sc.nextInt();
int ans = 0;
for (int i = 1; i < n; i++) {
int a = sc.nextInt();
if (a < max)
ans += max - a;
max =... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int max = sc.nextInt();
long ans = 0;
for (int i = 1; i < n; i++) {
int a = sc.nextInt();
if (a < max)
ans += max - a;
max ... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 121 |
/* An ACEASH Source code */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pii pair<int, int>
#define pll ... | /* An ACEASH Source code */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define pii pair<int, int>
#define pll ... | [["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 184 |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define mem0(x) memset(x, 0, sizeof(x))
#define mem1(x) memset(x, -1, sizeof(x))
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vv... | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define mem0(x) memset(x, 0, sizeof(x))
#define mem1(x) memset(x, -1, sizeof(x))
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vv... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 187 |
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
int ans = 0;
int nowmax = 0;
for (int i = 0; i < N; ++i) {
int num;
cin >> num;
if (num < nowmax) {
ans += (nowmax - num);
} else {
nowmax = num;
}
}
cout << ans << endl;
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
long long ans = 0;
long long nowmax = 0;
for (int i = 0; i < N; ++i) {
long long num;
cin >> num;
if (num < nowmax) {
ans += (nowmax - num);
} else {
nowmax = num;
}
}
cout << ans << endl;
return... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 86 |
#include <bits/stdc++.h>
#define drep(i, cc, n) for (int i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, (n)-1)
#define drrep(i, cc, n) for (int i = (cc); i >= (n); --i)
#define rrep(i, n) drrep(i, 0, (n)-1)
#define sz(s) (int)(s.size())
#define vecprint(v) ... | #include <bits/stdc++.h>
#define drep(i, cc, n) for (int i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, (n)-1)
#define drrep(i, cc, n) for (int i = (cc); i >= (n); --i)
#define rrep(i, n) drrep(i, 0, (n)-1)
#define sz(s) (int)(s.size())
#define vecprint(v) ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 214 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0, ans = 0, mx = 0, x = 0;
cin >> n;
cin >> x;
n--;
mx = x;
while (n--) {
cin >> x;
if (x < mx) {
ans += mx - x;
x = mx;
}
mx = max(mx, x);
}
cout << ans;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n = 0, ans = 0, mx = 0, x = 0;
cin >> n;
cin >> x;
n--;
mx = x;
while (n--) {
cin >> x;
if (x < mx) {
ans += mx - x;
x = mx;
}
mx = max(mx, x);
}
cout << ans;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 89 |
n=int(input())
a=list(map(int,input().split()))
sm=0
b=a[0]
for i in range(1,n):
if a[i]<a[i-1]:
sm+=b-a[i]
else:
b=a[i]
print(sm)
| n=int(input())
a=list(map(int,input().split()))
sm=0
b=a[0]
for i in range(1,n):
if a[i]<b:
sm+=b-a[i]
else:
b=a[i]
print(sm)
| [["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["+", 0, 7, 8, 196, 0, 57, 15, 6... | 5 | 77 |
#include <iostream>
using namespace std;
int main() {
int n, i, j, p, o, w = 0;
cin >> n;
cin >> p;
for (i = 1; i < n; i++) {
cin >> o;
w += max(p - o, 0);
p = max(p, o);
// cout << p;
}
cout << w << '\n';
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long int n, i, j, p, o, w = 0;
cin >> n;
cin >> p;
for (i = 1; i < n; i++) {
cin >> o;
w += max(p - o, (long long)0);
p = max(p, o);
// cout << p;
}
cout << w << '\n';
return 0;
}
| [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 11, 12, 2, 3, 4, 0, 74, 0, 24], ["+", 3, 4, 0, 74, 39, 77, 39, 86, 0, 96], ["+", 0, 11, 12, 2, 3, 4, 0, 74, 0, 25]] | 1 | 86 |
#include <bits/stdc++.h>
using namespace std;
template <typename T> inline void readin(T &x) {
x = 0;
T fh = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fh = -1;
for (; isdigit(ch); ch = getchar())
x = (x << 1) + (x << 3) + (ch ^ 48);
x *= fh;
}
inline void d_re... | #include <bits/stdc++.h>
using namespace std;
template <typename T> inline void readin(T &x) {
x = 0;
T fh = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fh = -1;
for (; isdigit(ch); ch = getchar())
x = (x << 1) + (x << 3) + (ch ^ 48);
x *= fh;
}
inline void d_re... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48]] | 1 | 428 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1000000007;
void solve() {
int n;
cin >> n;
vector<int> arr(n);
for (int c = 0; c < n; c++)
cin >> arr[c];
int sum = 0;
for (int c = 1; c < n; c++)
sum += max(0, arr[c - 1] - arr[c]), arr[c] = max(arr[c], arr[c - 1]);
cou... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1000000007;
void solve() {
int n;
cin >> n;
vector<int> arr(n);
for (int c = 0; c < n; c++)
cin >> arr[c];
ll int sum = 0;
for (int c = 1; c < n; c++)
sum += max(0, arr[c - 1] - arr[c]), arr[c] = max(arr[c], arr[c - 1]);
... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 172 |
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(A) A.be... | #include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(A) A.be... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 159 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int last = 0;
int ans = 0;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
if (x < last)
ans += abs(x - last);
last = max(last, x);
}
cout << ans << "\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int last = 0;
long long ans = 0;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
if (x < last)
ans += abs(x - last);
last = max(last, x);
}
cout << ans << "\n";
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 87 |
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
int n, m, k;
char str[200010];
int main() {
scanf("%d", &n);
m = 0;
k = 0;
for (int i = 1; i <= n; ++i) {
int x;
scanf("%d", &x);
if (k <= x)
k = x;
else
m += k - x;
}
printf("%d\n", m)... | #include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
int n, k;
char str[200010];
int main() {
scanf("%d", &n);
long long m = 0;
k = 0;
for (int i = 1; i <= n; ++i) {
int x;
scanf("%d", &x);
if (k <= x)
k = x;
else
m += k - x;
}
printf("%l... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 108 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
namespace IO {
const int SIZE = (1 << 20) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = obuf + SIZE - 1;
char _st[55];
int _qr = 0;
inline char gc() {
r... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 2e5 + 5;
const ll maxm = 1e3 + 5;
namespace IO {
const int SIZE = (1 << 20) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = obuf + SIZE - 1;
char _st[55];
int _qr = 0;
inline char gc() {
r... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13]] | 1 | 559 |
#pragma GCC optimize(2)
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#includ... | #pragma GCC optimize(2)
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#includ... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13]] | 1 | 387 |
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//# include <x86intrin.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using... | //#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//# include <x86intrin.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using... | [["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]] | 1 | 442 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
int a[n];
int sum1 = 0, sum2 = 0;
for (int i ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
ll a[n];
ll sum1 = 0, sum2 = 0;
for (int i = 0... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 159 |
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mk make_pair
#define fi first
#define lb lower_bound
#define test \
ll int t; \
cin >... | #include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mk make_pair
#define fi first
#define lb lower_bound
#define test \
ll int t; \
cin >... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 156 |
// By : BebekJK
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, ... | // By : BebekJK
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, ... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]] | 1 | 359 |
/* author:hellojim */
#include <algorithm>
#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#inc... | /* author:hellojim */
#include <algorithm>
#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#inc... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]] | 1 | 497 |
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool ... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 213 |
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,
// tree_order_statistics_node_update> ordered_set;
#define ll long long
#define scn... | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,
// tree_order_statistics_node_update> ordered_set;
#define ll long long
#define scn... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 163 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <time.h>
using namespace std;
#define rep_1(i, m, n) for (int i = m; i <= n; i++)
#define mem... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <time.h>
using namespace std;
#define rep_1(i, m, n) for (int i = m; i <= n; i++)
#define mem... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40]] | 1 | 307 |
n=int(input())
l=list(map(int,input().split()))
mx=l[0]
an=0
for i in range(1,n):
if l[i]<mx:
an+=mx-l[i]
else:
l[i]=mx
print(an) | n=int(input())
l=list(map(int,input().split()))
mx=l[0]
an=0
for i in range(1,n):
if l[i]<mx:
an+=mx-l[i]
else:
mx=l[i]
print(an) | [["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]] | 5 | 72 |
#include <bits/stdc++.h>
inline int read() {
char c = getchar();
int x = 0, s = 1;
while (c < '0' || c > '9') {
if (c == '-')
s = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * s;
}
using namespace std;
#define NewNode (TreeNode ... | #include <bits/stdc++.h>
inline int read() {
char c = getchar();
int x = 0, s = 1;
while (c < '0' || c > '9') {
if (c == '-')
s = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * s;
}
using namespace std;
#define NewNode (TreeNode ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 340 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int s = 0;
rep(i, n - 1) {
if (a[i + 1] < a[i]) {
s += a[i] - a[i + 1];
a[i +... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
ll s = 0;
rep(i, n - 1) {
if (a[i + 1] < a[i]) {
s += a[i] - a[i + 1];
a[i + ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 133 |
// zukonit14 - Kunal Raut
#include <bits/stdc++.h>
using namespace std;
/*/-----------------------------DEFINES----------------------------------/*/
#define ll long long
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi 3.1415926535
... | // zukonit14 - Kunal Raut
#include <bits/stdc++.h>
using namespace std;
/*/-----------------------------DEFINES----------------------------------/*/
#define ll long long
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi 3.1415926535
... | [["-", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22]] | 1 | 1,130 |
#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
long long ans = 0;
for (int i = 1; i <= n; i++) {
if (a[i] < a[i - 1]) {
ans += a[i - 1] - a[i];
a[i] = a[i - 1];
}
}
printf("%d"... | #include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
long long ans = 0;
for (int i = 1; i <= n; i++) {
if (a[i] < a[i - 1]) {
ans += a[i - 1] - a[i];
a[i] = a[i - 1];
}
}
printf("%ll... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 136 |
#include <algorithm>
#include <assert.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#includ... | #include <algorithm>
#include <assert.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#includ... | [["-", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 215 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
int count = 0;
int min = arr[0];
for (int i = 1; i ... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
long[] arr = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
long count = 0;
long min = arr[0];
for (int i = 1... | [["-", 8, 196, 0, 503, 39, 224, 468, 506, 0, 507], ["+", 8, 196, 0, 503, 39, 224, 468, 506, 0, 96], ["-", 0, 503, 49, 200, 51, 227, 39, 506, 0, 507], ["+", 0, 503, 49, 200, 51, 227, 39, 506, 0, 96], ["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 154 |
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B> string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const s... | #include <bits/stdc++.h>
using namespace std;
template <typename A, typename B> string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const s... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 988 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int n;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
ll mx = -1;
ll cnt = 0;
for (int i = 0; i < n; i++) {
mx = max(mx, a[i]);
if (a[i] < mx) {
cnt == cnt + (mx - a[i]);
}
}
cout << cnt;... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int n;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
ll mx = -1;
ll cnt = 0;
for (int i = 0; i < n; i++) {
mx = max(mx, a[i]);
if (a[i] < mx) {
cnt = cnt + (mx - a[i]);
}
}
cout << cnt;
... | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]] | 1 | 115 |
n = int(input())
a = list(map(int, input().split()))
m = 0
ma = a[0]
for i in range(1, n):
ma = max(ma, a[i])
m = max(m, ma-a[i])
print(m) | n = int(input())
a = list(map(int, input().split()))
m = 0
ma = a[0]
for i in range(1, n):
ma = max(ma, a[i])
m += ma-a[i]
print(m) | [["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 72 |
from math import ceil
def mlt(): return map(int, input().split())
x = int(input())
s = list(mlt())
res = 0
for n in range(1, x):
if s[n] < s[n-1]:
d = s[n-1]-s[n]
res += d
s[n] += 1
print(res)
| from math import ceil
def mlt(): return map(int, input().split())
x = int(input())
s = list(mlt())
res = 0
for n in range(1, x):
if s[n] < s[n-1]:
d = s[n-1]-s[n]
res += d
s[n] += d
print(res)
| [["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]] | 5 | 90 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 293 |
N = int(input())
a = [int(s) for s in input().split()]
b = int(0)
for i in range(N):
if a[i] <= a[int(i+1)]:
pass
else:
b = b + (a[i] - a[int(i+1)])
a[int(i+1)] = a[i]
print(b) | N = int(input())
a = [int(s) for s in input().split()]
b = int(0)
for i in range(N-1):
if a[i] <= a[int(i+1)]:
pass
else:
b = b + (a[i] - a[int(i+1)])
a[int(i+1)] = a[i]
print(b) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 97 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int maxi = a[0], ans = 0;
for (int i = 0; i < n; i++) {
if (maxi <= a[i]) {
maxi = a[i];
} else {
ans += maxi - a[i];
}
}
cout << ans... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
long long maxi = a[0], ans = 0;
for (int i = 0; i < n; i++) {
if (maxi <= a[i]) {
maxi = a[i];
} else {
ans += maxi - a[i];
}
}
cout ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 115 |
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int tc = 1;
// cin>>tc;
while (tc--) {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
int cnt = 0;
for (int i = 1; i < n; i++) {
if (h[i] < h[i - 1]) {
cnt += h[i -... | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int tc = 1;
// cin>>tc;
while (tc--) {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
long long cnt = 0;
for (int i = 1; i < n; i++) {
if (h[i] < h[i - 1]) {
cnt +=... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 130 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]] | 1 | 248 |
#include <bits/stdc++.h>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr << #x << " " << x << "\n"
#define debi cerr << "hey sparky\n"
#define x first
#define y s... | #include <bits/stdc++.h>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr << #x << " " << x << "\n"
#define debi cerr << "hey sparky\n"
#define x first
#define y s... | [["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51... | 1 | 592 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int i, a, b, sum = 0;
cin >> a;
b = a;
for (i = 1; i < n; i++) {
cin >> a;
if (a < b) {
sum += b - a;
} else {
b = a;
}
}
cout << sum << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long i, a, b, sum = 0;
cin >> a;
b = a;
for (i = 1; i < n; i++) {
cin >> a;
if (a < b) {
sum += b - a;
} else {
b = a;
}
}
cout << sum << endl;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 87 |
#include <bits/stdc++.h>
using namespace std;
int n, a[222222], ans;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
for (int i = 1; i < n; i++) {
if (a[i] > a[i - 1])
continue;
ans += a[i - 1] - a[i];
a[i] = a[i - 1];
}
printf("%d", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long n, a[222222], ans;
int main() {
scanf("%lld", &n);
for (int i = 0; i < n; i++)
scanf("%lld", &a[i]);
for (int i = 1; i < n; i++) {
if (a[i] > a[i - 1])
continue;
ans += a[i - 1] - a[i];
a[i] = a[i - 1];
}
printf("%lld", ans);
... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 129 |
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long int
const ll mod = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
// cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int &x : a)
cin >> x;
int st = 0;
... | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long int
const ll mod = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
// cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int &x : a)
cin >> x;
ll st = 0;
... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 48]] | 1 | 151 |
/* * In the name of GOD
* Thanks God */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
const int N = 201234;
int a[N], b[N];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 0;
int mx = 0;
... | /* * In the name of GOD
* Thanks God */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define int long long
const int N = 201234;
int a[N], b[N];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int a... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 1 | 180 |
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ios \
ios_base::sync_with_stdio(0); ... | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ios \
ios_base::sync_with_stdio(0); ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 204 |
/*
このコード、と~おれ!
Be accepted!
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·'* ☆
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <ioma... | /*
このコード、と~おれ!
Be accepted!
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·'* ☆
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <ioma... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, ... | 1 | 583 |
N = int(input())
pre = 0
ans = 0
for a in input().split():
a = int(a)
ans += max(a-pre, 0)
pre = max(pre, a)
print(ans) | N = int(input())
pre = 0
ans = 0
for a in input().split():
a = int(a)
ans += max(pre-a, 0)
pre = max(pre, a)
print(ans) | [["-", 0, 677, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 677, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 677, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 677, 12, 652, 3, 4, 0, 657, 12, 22]] | 5 | 53 |
#include <bits/stdc++.h>
struct fastio {
fastio() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
} _fastio_;
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
... | #include <bits/stdc++.h>
struct fastio {
fastio() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
} _fastio_;
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
... | [["-", 39, 343, 141, 344, 3, 347, 0, 77, 39, 40], ["+", 141, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["+", 0, 14, 8, 9, 0, 338, 39, 361, 0, 190], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 231 |
/*
*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include... | /*
*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 226 |
//ヘッダー
#include <bits/stdc++.h>
using namespace std;
//型定義
typedef long long ll;
//定数
const ll INF = 1e+18;
const int MOD = 1e+9 + 7;
// REPマクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define REP2(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define REPD2(i,... | //ヘッダー
#include <bits/stdc++.h>
using namespace std;
//型定義
typedef long long ll;
//定数
const ll INF = 1e+18;
const int MOD = 1e+9 + 7;
// REPマクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define REP2(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define REPD2(i,... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 332 |
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep2(i, s, n) for (int i = s; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ... | #define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep2(i, s, n) for (int i = s; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 653 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N;
cin >> N;
vector<int64_t> A(N);
for (int64_t &a : A) {
cin >> a;
}
int64_t ans = 0;
for (int64_t i = 1; i < N; i++) {
int64_t step = max(A[i] - A[i - 1], (int64_t)0);
ans += step;
A[i] += step;
}
cout << ans << en... | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N;
cin >> N;
vector<int64_t> A(N);
for (int64_t &a : A) {
cin >> a;
}
int64_t ans = 0;
for (int64_t i = 1; i < N; i++) {
int64_t step = max(A[i - 1] - A[i], (int64_t)0);
ans += step;
A[i] += step;
}
cout << ans << en... | [["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 103 |
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <fstream>
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() { return 42; }
using namespace std;
usin... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <fstream>
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() { return 42; }
using namespace std;
usin... | [["-", 8, 123, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 123, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 232 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
long long count = 0;
long long ans = 0;
for (int i = 0; i < N; i++) {
cin >> A[i];
if (count < A[i])
count = A[i];
else
ans += A[i] - count;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
long long count = 0;
long long ans = 0;
for (int i = 0; i < N; i++) {
cin >> A[i];
if (count < A[i])
count = A[i];
else
ans += count - A[i];
}
cout << ans << endl;
} | [["+", 75, 76, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 75, 76, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 95 |
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 998244353;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
int main(void) {
int n;
cin >> n;
int max = 0, ans = 0;
rep(i, n) {
int ... | #include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 998244353;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
int main(void) {
int n;
cin >> n;
int max = 0;
long long ans = 0;
rep(i, n... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 112 |
// In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char *s) { return (string)s; }
string to_string(string s) { return s; }
template <class A> string to_string(complex<... | // In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char *s) { return (string)s; }
string to_string(string s) { return s; }
template <class A> string to_string(complex<... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 48]] | 1 | 692 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n, t, mx;
int main() {
cin >> n;
mx = 0;
vector<int> vec(n, 0);
for (int i = 0; i < n; ++i)
cin >> vec[i];
for (int i = 0; i < n; ++i) {
mx = max(vec[i], mx);
if (vec[i] < mx)
t += (mx - vec[i]... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll n, t, mx;
int main() {
cin >> n;
mx = 0;
vector<ll> vec(n, 0);
for (int i = 0; i < n; ++i)
cin >> vec[i];
for (int i = 0; i < n; ++i) {
mx = max(vec[i], mx);
if (vec[i] < mx)
t += (mx - vec[i]);... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 126 |
#include <algorithm>
#include <fstream>
#include <iostream>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
int ceil(int a, int m) {
// division of a and m
if (a % m == 0) {
return a / m;
} else {
... | #include <algorithm>
#include <fstream>
#include <iostream>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
int ceil(int a, int m) {
// division of a and m
if (a % m == 0) {
return a / m;
} else {
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 422 |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
// change null_type here for map/set
typedef tree<int, null_typ... | #pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
// change null_type here for map/set
typedef tree<int, null_typ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 302 |
// tanzim bin nasir
#include <bits/stdc++.h>
typedef long long ll;
#define ff first
#define ss second
using namespace std;
void fast() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
gcd(b, a % b);
}
ll lcd(ll a, ll b) { return (a * b) / ... | // tanzim bin nasir
#include <bits/stdc++.h>
typedef long long ll;
#define ff first
#define ss second
using namespace std;
void fast() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
gcd(b, a % b);
}
ll lcd(ll a, ll b) { return (a * b) / ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 185 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
int cnt = 0;
int current_hight = A[0];
for (int i = 1; i < N; ++i) {
if (current_hight > A[i]) {
cnt += current_hight - A[i];
} el... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
long long cnt = 0;
long long current_hight = A[0];
for (int i = 1; i < N; ++i) {
if (current_hight >= A[i]) {
cnt += current_hight - A... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 118 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
int ans = 0;
for (int i = 1; i < n; i++) {
ans = ans + max(0, h[i - 1] - h[i]);
h[i] = max(h[i], h[i - 1]);
}
cout << ans << endl... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
vector<ll> h(n);
for (ll i = 0; i < n; i++)
cin >> h[i];
ll ans = 0;
for (ll i = 1; i < n; i++) {
ans = ans + max(0LL, h[i - 1] - h[i]);
h[i] = max(h[i], h[i - 1]);
}
cout << ans << endl;
}... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 11, 12, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 11, 12, ... | 1 | 122 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for (auto it = li.begin(); it != li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int c = 0, t = 0;
rep(... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for (auto it = li.begin(); it != li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
ll c = 0, t = 0;
rep(i,... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 130 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define print(x) \
for (... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define print(x) \
for (... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 226 |
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;
#define fastIO ... | #include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;
#define fastIO ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 217 |
#include <bits/stdc++.h>
using namespace std;
#define lli long long
#define ld long double
#define mod 1000000007
#define set(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'
const double PI = acos(-1);
const double epsilon = 1e-... | #include <bits/stdc++.h>
using namespace std;
#define lli long long
#define ld long double
#define mod 1000000007
#define set(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'
const double PI = acos(-1);
const double epsilon = 1e-... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 179 |
/*
* Author : Omkar Deshmukh
*/
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
// #define int long long
#define ll long long
#define endl '\n'
#define all(v) v.bg(), v.end()
#define intvect vector<int>
#define pii pair... | /*
* Author : Omkar Deshmukh
*/
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#define int long long
#define ll long long
#define endl '\n'
#define all(v) v.bg(), v.end()
#define intvect vector<int>
#define pii pair<in... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148]] | 1 | 407 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 95 |
n = int(input())
As = list(map(int, input().split()))
h = 0
for i in range(n - 1):
d = As[i + 1] - As[i]
if d > 0:
As[i+1] += d
h += d
print(h) | n = int(input())
As = list(map(int, input().split()))
h = 0
for i in range(n - 1):
d = As[i] - As[i + 1]
if d > 0:
As[i+1] += d
h += d
print(h) | [["-", 0, 662, 12, 657, 31, 206, 206, 657, 17, 72], ["-", 0, 662, 12, 657, 31, 206, 206, 657, 12, 612], ["+", 0, 662, 12, 657, 12, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 206, 206, 657, 12, 612]] | 5 | 71 |
#pragma GCC target("sse4.2")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define ln "\n"
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, e) for (ll i = e; i >= 0; i--)
#define rforsn(i, e, s) for (... | #pragma GCC target("sse4.2")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define ln "\n"
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, e) for (ll i = e; i >= 0; i--)
#define rforsn(i, e, s) for (... | [["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 74, 51, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 74, 51, 69, 341, 342, 0, 16, 12, 13]] | 1 | 2,500 |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
int main() {
int n;
const int max_n = 2 * 1e5;
int a[max_n + 1];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 0;
int current_min = a[0];
for (int i = 1; i < n; i++) {
if (a[i] > curr... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
int main() {
int n;
const int max_n = 2 * 1e5;
int a[max_n + 1];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
long long ans = 0;
int current_min = a[0];
for (int i = 1; i < n; i++) {
if (a[i] ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 136 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1 << 29;
using namespace std;
using ll = long long;
int main() {
int N, count = 0;
cin >> N;
vector<int> A(N);
int tallest = A[0];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 0; i < N; i++) {
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1 << 29;
using namespace std;
using ll = long long;
int main() {
ll N, count = 0;
cin >> N;
vector<ll> A(N);
ll tallest = A[0];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 0; i < N; i++) {
i... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 146 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define endl "\n"
#define INT long long int
using namespace std;
int main() {
ios::sync_with_stdio(false);
int m = 0, i, n, a, s = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
if (m < a) {
m = a;
} else {
s... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define endl "\n"
#define INT long long int
using namespace std;
int main() {
ios::sync_with_stdio(false);
INT m = 0, i, n, a, s = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
if (m < a) {
m = a;
} else {
s... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 98 |
#include <algorithm>
#include <bits/stdc++.h>
#include <chrono>
#include <map>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <thread>
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repu(i, k, n) for (ll i = k; i <= n; i++)
#define repd(i, k, n) for (ll i ... | #include <algorithm>
#include <bits/stdc++.h>
#include <chrono>
#include <map>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <thread>
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repu(i, k, n) for (ll i = k; i <= n; i++)
#define repd(i, k, n) for (ll i ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 874 |
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define... | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 203 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define pb push_back
#define size(v) (int)v.size()
#define fast \
ios_base::sync_with_stdio(false); ... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define pb push_back
#define size(v) (int)v.size()
#define fast \
ios_base::sync_with_stdio(false); ... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21]] | 1 | 271 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
int a0 = 0;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
if (a < a0) {
ans += a0 - a;
a = a0;
}
a0 = a;
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
int a0 = 0;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
if (a < a0) {
ans += a0 - a;
a = a0;
}
a0 = a;
}
cout << ans << endl;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 83 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
pair<int, int> c, d;
cin >> c.first >> c.second;
cin >> d.first >> d.second;
c.first--;
c.second--;
d.first--;
d.second--;
vector<string> a(h);
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
pair<int, int> c, d;
cin >> c.first >> c.second;
cin >> d.first >> d.second;
c.first--;
c.second--;
d.first--;
d.second--;
vector<string> a(h);
... | [["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22]] | 1 | 659 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip> //double精度 setprecision
#include <iostream>
#include <map>
#include <numeric> //lcm
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip> //double精度 setprecision
#include <iostream>
#include <map>
#include <numeric> //lcm
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 13]] | 1 | 710 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.