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 |
|---|---|---|---|---|
def main():
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, len(a)):
humidai = max(0, a[i] - a[i-1])
ans += humidai
a[i] += humidai
print(ans)
if __name__ == '__main__':
main() | def main():
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, len(a)):
humidai = max(0, a[i-1] - a[i])
ans += humidai
a[i] += humidai
print(ans)
if __name__ == '__main__':
main() | [["+", 3, 4, 0, 657, 31, 206, 206, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 206, 206, 657, 12, 612], ["-", 3, 4, 0, 657, 12, 206, 206, 657, 17, 33], ["-", 3, 4, 0, 657, 12, 206, 206, 657, 12, 612]] | 5 | 87 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v.at(i);
int h = 0;
for (int i = 0; i < n - 1; i++) {
if (v.at(i) > v.at(i + 1)) {
h += v.at(i) - v.at(i + 1);
v.at(i + 1) = v.at(i);
}
}
cout <<... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v.at(i);
long long h = 0;
for (int i = 0; i < n - 1; i++) {
if (v.at(i) > v.at(i + 1)) {
h += v.at(i) - v.at(i + 1);
v.at(i + 1) = v.at(i);
}
}
c... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 134 |
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
int ans = 0;
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for (int... | import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
long ans = 0;
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for (in... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 170 |
#include <bits/stdc++.h>
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define forf(i, n) for (int i = 0;... | #include <bits/stdc++.h>
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define forf(i, n) 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 | 145 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (auto &x : a)
cin >> x;
int ans = 0;
int mx = 0;
for (int i = 0; i < n; i++) {
if (a[i] < mx)
ans += mx - a[i];
mx = max(a[i], mx);
}
c... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (auto &x : a)
cin >> x;
long long ans = 0;
int mx = 0;
for (int i = 0; i < n; i++) {
if (a[i] < mx)
ans += mx - a[i];
mx = max(a[i], mx);
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 114 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0;
int m = 0;
int a;
for (int i = 0; i < n; i++) {
cin >> a;
if (a < m) {
sum += m - a;
} else {
m = a;
}
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
uint64_t sum = 0;
int m = 0;
int a;
for (int i = 0; i < n; i++) {
cin >> a;
if (a < m) {
sum += m - a;
} else {
m = a;
}
}
cout << sum << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 79 |
N = int(input())
A = list(map(int,input().split()))
ans = 0
high = 0
for i in range(1,N):
if A[i-1] > high:
high = A[i-1]
if A[i] < hihg:
ans += high - A[i]
print(ans) | N = int(input())
A = list(map(int,input().split()))
ans = 0
high = 0
for i in range(1,N):
if A[i-1] > high:
high = A[i-1]
if A[i] < high:
ans += high - A[i]
print(ans)
| [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]] | 5 | 79 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll a[n];
int sum = 0;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
if (a[i] > a[i + 1]) {
sum += (a[i] - a[i + 1]);
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll a[n];
ll sum = 0;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n - 1; i++)
if (a[i] > a[i + 1]) {
sum += (a[i] - a[i + 1]... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 150 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
}
int sum = 0;
for (int i = 1; i < n; i++) {
if (x[i] < x[i - 1]) {
sum += x[i - 1] - x[i];
x[i] = x[i - 1];
}
}
cout << sum;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
}
long long sum = 0;
for (int i = 1; i < n; i++) {
if (x[i] < x[i - 1]) {
sum += x[i - 1] - x[i];
x[i] = x[i - 1];
}
}
cout << sum;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 118 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> v(N);
for (int i = 0; i < N; i++) {
scanf("%d", &v[i]);
}
long long S = 0;
for (int i = 1; i < N; i++) {
if (v[i - 1] > v[i]) {
S += (v[i - 1] - v[i]);
v[i] = v[i - 1];
}
}
pri... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> v(N);
for (int i = 0; i < N; i++) {
scanf("%d", &v[i]);
}
long long S = 0;
for (int i = 1; i < N; i++) {
if (v[i - 1] > v[i]) {
S += (v[i - 1] - v[i]);
v[i] = v[i - 1];
}
}
pri... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 142 |
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ar[] = new int[n];
for (int i = 0; i < n; i++)
ar[i] = sc.nextInt();
int preh = ar[0], table, ans = 0;
for (int i = 0; i < n; i++) {
t... |
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ar[] = new int[n];
for (int i = 0; i < n; i++)
ar[i] = sc.nextInt();
long preh = ar[0], table, ans = 0;
for (int i = 0; i < n; i++) {
... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 151 |
// ⚫⚫ | ⚫➖➖ ⚫⚫ ⚫➖⚫⚫ ⚫➖⚫⚫ | ➖⚫⚫⚫ ⚫ | ⚫➖ | ⚫➖⚫ ⚫ ➖⚫⚫ | ➖⚫➖⚫ ➖➖➖ ➖⚫⚫ ⚫ ⚫➖⚫
#include <bits/stdc++.h>
#define n0_nnE int main() {
using namespace std;
typedef long long ll;
n0_nnE int mx = 0, n, an = 0;
cin >> n;
vector<int> ls(n);
for (int &x : ls)
cin >> x;
for (int x : ls) {
mx = max(mx, x);
an += mx - x;
}
cout <... | // ⚫⚫ | ⚫➖➖ ⚫⚫ ⚫➖⚫⚫ ⚫➖⚫⚫ | ➖⚫⚫⚫ ⚫ | ⚫➖ | ⚫➖⚫ ⚫ ➖⚫⚫ | ➖⚫➖⚫ ➖➖➖ ➖⚫⚫ ⚫ ⚫➖⚫
#include <bits/stdc++.h>
#define n0_nnE int main() {
using namespace std;
typedef long long ll;
n0_nnE ll mx = 0, n, an = 0;
cin >> n;
vector<ll> ls(n);
for (ll &x : ls)
cin >> x;
for (ll x : ls) {
mx = max(mx, x);
an += mx - x;
}
cout << an... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 0, 42, 0, 22], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 36, 36, 36, 36, 0, 30, 0, 338, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 338, 39, 78]] | 1 | 82 |
n = int(input())
wa = 0
m = 0
l = list(map(int, input().split()))
for i in range(1, n):
m = max(l[i], m)
if m >= l[i]:
wa += m - l[i]
print(wa) | n = int(input())
wa = 0
m = 0
l = list(map(int, input().split()))
for i in range(n):
m = max(l[i], m)
if m > l[i]:
wa += m - l[i]
print(wa) | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]] | 5 | 72 |
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
const ll mod = 1000000007;
main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i +... | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
const ll mod = 1000000007;
main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
ll ans = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 142 |
#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>;
using V = vector<int>;
int main(int argc, char const *argv[]) {
int n;
cin >> n;
int a, b = 0, ans = 0;
rep(i, n) {
cin >> a;
if (a > b)
b = a;
else
... | #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>;
using V = vector<int>;
int main(int argc, char const *argv[]) {
int n;
cin >> n;
int a, b = 0;
long long int ans = 0;
rep(i, n) {
cin >> a;
if (a > b)
b = ... | [["-", 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, 14, 8, 9, 0, 43, 39, 86, 39, 40]] | 1 | 109 |
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int sum = 0, A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
if (i == 0)
continue;
if (A[i] < A[i - 1]) {
sum += (A[i - 1] - A[i]);
A[i] = A[i - 1];
}
}
cout << sum << endl;
} | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
long long sum = 0, A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
if (i == 0)
continue;
if (A[i] < A[i - 1]) {
sum += (A[i - 1] - A[i]);
A[i] = A[i - 1];
}
}
cout << sum << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 110 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int sum = 0;
int max = 0;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a.at(i);
}
for (int i = 0; i < N; i++) {
if (a.at(i) > max) {
max = a.at(i);
} else {
sum += max - a.at(i);
}
}
c... | #include <bits/stdc++.h>
using namespace std;
int main() {
long N;
long sum = 0;
long max = 0;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a.at(i);
}
for (int i = 0; i < N; i++) {
if (a.at(i) > max) {
max = a.at(i);
} else {
sum += max - a.at(i);
}
}
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 121 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int m = 0;
int ans = 0;
rep(i, n) {
if (a[i] < m) {
ans += m - a[i];
}
m = max(m, a[i]);
}... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int m = 0;
ll ans = 0;
rep(i, n) {
if (a[i] < m) {
ans += m - a[i];
}
m = max(m, a[i]);
}
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 115 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, count;
cin >> N;
vector<int> a;
count = 0;
for (int i = 0; i < N; i++) {
cin >> a.at(i);
if (i > 0) {
if (a.at(i - 1) > a.at(i)) {
count += a.at(i - 1) - a.at(i);
a.at(i) = a.at(i - 1);
}
}
}
cout <... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
long long count;
cin >> N;
vector<int> a(N);
count = 0;
for (int i = 0; i < N; i++) {
cin >> a.at(i);
if (i > 0) {
if (a.at(i - 1) > a.at(i)) {
count += a.at(i - 1) - a.at(i);
a.at(i) = a.at(i - 1);
}
... | [["-", 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], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]] | 1 | 124 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
// Your code here!
long long N;
cin >> N;
vector<long long> A(N);
for (long long i = 0; i < N; i++) {
cin >> A[i];
}
long long ans = 0, tmp = 0;
for (long long i = 1; i < N; i++) {
if (A[i] < A[i - 1] + tmp) {
ans += A[i - 1] +... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
// Your code here!
long long N;
cin >> N;
vector<long long> A(N);
for (long long i = 0; i < N; i++) {
cin >> A[i];
}
long long ans = 0, tmp = 0;
for (long long i = 1; i < N; i++) {
if (A[i] < A[i - 1] + tmp) {
ans += A[i - 1] +... | [["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]] | 1 | 146 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, x, n) for (int i = x; i < n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod = 1'000'000'007;
int main() {
int n;
cin >> n;
vi a(n);
rep(i, n) cin >> a.at(i);
i... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, x, n) for (int i = x; i < n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
const int mod = 1'000'000'007;
int main() {
int n;
cin >> n;
vi a(n);
rep(i, n) cin >> a.at(i);
l... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 175 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int size = sc.nextInt();
int max = 0;
int total = 0;
for (int i = 0; i < size; i++) {
int sci = sc.nextInt();
if (max < sci)
max = sci;
else if (m... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long size = sc.nextInt();
long max = 0;
long total = 0;
for (long i = 0; i < size; i++) {
long sci = sc.nextInt();
if (max < sci)
max = sci;
else ... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 7, 502, 503, 39, 506, 0, 507], ["+", 8, 196, 0, 7, 502, 503, 39, 506, 0, 96], ["-", 0, 7, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 7, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 111 |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
void solve() {
int n;
cin >> n;
vector<int> v(n);
for (int &i : v) {
cin >> i;
}
int sum = 0;
int mx = v[0];
for (int i = 1; i < n; i++) {
if (v[i] < mx) {
... | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
void solve() {
int n;
cin >> n;
vector<int> v(n);
for (int &i : v) {
cin >> i;
}
long long sum = 0;
int mx = v[0];
for (int i = 1; i < n; i++) {
if (v[i] < ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 158 |
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<db, db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef... | #pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<db, db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 777 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
const long long INF = 1LL << 60;
const int MOD = 1e9 + 7;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
r... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
const long long INF = 1LL << 60;
const int MOD = 1e9 + 7;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
r... | [["-", 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 | 247 |
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
int main() {
int N;
cin >> N;
vector<ll> height(N);
for (int i = 0; i < N; i++)
cin >> height[i];
int ma = 0, su = 0;
for (int i = 0; i < N; i++) {
if (height[i] > ma)
ma = height[i];
su += ma - he... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
int main() {
int N;
cin >> N;
vector<ll> height(N);
for (int i = 0; i < N; i++)
cin >> height[i];
ll ma = 0, su = 0;
for (int i = 0; i < N; i++) {
if (height[i] > ma)
ma = height[i];
su += ma - hei... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 112 |
#include <bits/stdc++.h>
using namespace std;
#define MAX 100001
#define MOD 1000000007
#define ll long long
#define ld long double
#define fast \
ios::sync_with_stdio(0); \
cin.tie(0); ... | #include <bits/stdc++.h>
using namespace std;
#define MAX 100001
#define MOD 1000000007
#define ll long long
#define ld long double
#define fast \
ios::sync_with_stdio(0); \
cin.tie(0); ... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 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, 52, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 7, 10, 43, 39, 78]] | 1 | 145 |
N = int(input())
A = list(map(int, list(input().split())))
total = 0
for i in range(0, N-1):
step = A[i+1] - A[i]
if step > 0 :
total = total + step
A[i] = A[i] + step
print(total) | N = int(input())
A = list(map(int, list(input().split())))
total = 0
for i in range(1, N):
step = A[i-1] - A[i]
if step > 0 :
total = total + step
A[i] = A[i] + step
print(total) | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 662, 12, 657, 31, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 31, 206, 206, 657, 17, 33]] | 5 | 81 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
int i;
for (i = 0; i < n; i++)
cin >> a[i];
int stools = 0;
int diff;
int maxi = 0;
for (i = 1; i < n; i++) {
maxi = max(maxi, a[i]);
diff = (maxi - a[i]);
stools += diff;
}
cout << stools;
return... | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
int i;
for (i = 0; i < n; i++)
cin >> a[i];
long long int stools = 0;
long int diff;
int maxi = 0;
for (i = 0; i < n; i++) {
maxi = max(maxi, a[i]);
diff = (maxi - a[i]);
stools += diff;
}
cout << st... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]] | 1 | 110 |
#include <iostream>
using namespace std;
int main() {
int N;
int A, AA;
int ans = 0;
cin >> N;
int times = N - 1;
int s;
cin >> A;
for (int i = 0; i < times; i++) {
cin >> AA;
if (A > AA) {
s = A - AA;
ans += s;
AA += s;
A = AA;
} else {
A = AA;
}
}
cou... | #include <iostream>
using namespace std;
int main() {
int N;
int A, AA;
long long ans = 0;
cin >> N;
int times = N - 1;
int s;
cin >> A;
for (int i = 0; i < times; i++) {
cin >> AA;
if (A > AA) {
s = A - AA;
ans += s;
AA += s;
A = AA;
} else {
A = AA;
}
}... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 102 |
#include <cstdio>
#include <cstring>
using namespace std;
char opt[200011];
int main() {
int sum = 0;
scanf("%s", opt + 1);
int len = strlen(opt + 1);
for (int i = 1; i <= len; i++) {
int x = opt[x] - '0';
sum += x;
sum %= 9;
}
if (sum)
puts("No");
else
puts("Yes");
} | #include <cstdio>
#include <cstring>
using namespace std;
char opt[200011];
int main() {
int sum = 0;
scanf("%s", opt + 1);
int len = strlen(opt + 1);
for (int i = 1; i <= len; i++) {
int x = opt[i] - '0';
sum += x;
sum %= 9;
}
if (sum)
puts("No");
else
puts("Yes");
} | [["-", 49, 50, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 22]] | 1 | 101 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 125 |
n=input()
s=sum(int(c) for c in n)
if n%9==0:
print('Yes')
else:
print('No')
| n=input()
s=sum(int(c) for c in n)
if s%9==0:
print('Yes')
else:
print('No')
| [["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22]] | 5 | 39 |
N = input()
sum = 0
for n in range(len(N)):
tmp = int(n)
sum += tmp
if(sum % 9 == 0):
print('Yes')
else:
print('No') | N = input()
sum = 0
for n in range(len(N)):
tmp = int(N[n])
sum += tmp
if(sum % 9 == 0):
print('Yes')
else:
print('No') | [["+", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 73]] | 5 | 51 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
ll ans = 0;
for (ll i = 0; i < s.size(); i++) {
ans = ans + (s[i] - 48);
}
if (ans % 9 == 0)
cout << "YES";
else
cout << "... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
ll ans = 0;
for (ll i = 0; i < s.size(); i++) {
ans = ans + (s[i] - 48);
}
if (ans % 9 == 0)
cout << "Yes";
else
cout << "... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 101 |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
string n;
ll sum = 0;
cin >> n;
for (int i = 0; i < n.length(); i++) {
sum += int(n[i]);
}
if (sum % 9 == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
string n;
ll sum = 0;
cin >> n;
for (int i = 0; i < n.length(); i++) {
sum += (n[i] - 48);
}
if (sum % 9 == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 40], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13]] | 1 | 91 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define ceil(n, m) ((n / m) + (n % m ? 1 : 0))
#define mod(n, m) (((n % m) + m) % m)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define ceil(n, m) ((n / m) + (n % m ? 1 : 0))
#define mod(n, m) (((n % m) + m) % m)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
... | [["-", 0, 16, 12, 23, 0, 41, 15, 16, 12, 13], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 12, 13], ["-", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6]] | 1 | 115 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int sum = 0;
for (int i = 0; i < s.size(); i++) {
int a = s.at(i) + '0';
sum += a;
}
bool ans;
if (sum % 9 == 0 || s == "0") {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int sum = 0;
for (int i = 0; i < s.size(); i++) {
int a = s.at(i) - '0';
sum += a;
}
if (sum % 9 == 0 || s == "0") {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
| [["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35]] | 1 | 99 |
// HovalHaq!
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int m = 0;
for (char c : S) {
m = (m + c - 9);
if (m >= 9)
m -= 9;
}
cout << (m ? "Yes" : "No");
}
| // HovalHaq!
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int m = 0;
for (char c : S) {
m = (m + (c - '0'));
if (m >= 9)
m -= 9;
}
cout << (m ? "No" : "Yes");
}
| [["+", 0, 11, 12, 23, 0, 16, 12, 23, 0, 24], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 12, 23, 0, 16, 12, 103, 0, 104], ["+", 0, 16, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 0, 11, 12, 23, 0, 16, 12, 23, 0, 25], ["-", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 0, 16,... | 1 | 68 |
n = list(input())
count = 0
for i in range(len(n)):
count += int(n[i])
count %= 9
if count == 0:
print('YES')
else:
print('NO') | n = list(input())
count = 0
for i in range(len(n)):
count += int(n[i])
count %= 9
if count == 0:
print('Yes')
else:
print('No') | [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 53 |
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for (int i = a; i < n; ++i)
#define MAX(x)... | /*ॐ नमो भगवते वासुदेवाय नमः*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for (int i = a; i < n; ++i)
#define MAX(x)... | [["+", 0, 11, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 73]] | 1 | 429 |
#include <bits/stdc++.h>
typedef long long int ll;
typedef long long unsigned int llu;
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(), (a).end()
#define YUGEN ... | #include <bits/stdc++.h>
typedef long long int ll;
typedef long long unsigned int llu;
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(), (a).end()
#define YUGEN ... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 165 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;
void solve() {
string s;
cin >> s;
int sum = 0;
for (auto x : s)
sum += (x - '0');
if (sum % 9 == 0)
cout << "YES";
else
cout << "NO";
}
int32_t main() {
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;
void solve() {
string s;
cin >> s;
int sum = 0;
for (auto x : s)
sum += (x - '0');
if (sum % 9 == 0)
cout << "Yes";
else
cout << "No";
}
int32_t main() {
... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 115 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string S;
cin >> S;
int sum = 0;
rep(i, S.size()) sum += S[i];
if (sum % 9 == 0)
cout << "Yes\n";
else
cout << "No\n";
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string S;
cin >> S;
int sum = 0;
rep(i, S.size()) sum += S[i] - '0';
if (sum % 9 == 0)
cout << "Yes\n";
else
cout << "No\n";
}
| [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]] | 1 | 86 |
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
const int N = 1e5 + 5;
int main() {
string s;
cin >> s;
ll sum = 0;
for (auto e : s) {
sum += (int)e - '0';
sum = sum % 9;
}
if (sum % 9)
cout << "NO";
else
cout << "YES";
ret... | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
const int N = 1e5 + 5;
int main() {
string s;
cin >> s;
ll sum = 0;
for (auto e : s) {
sum += (int)e - '0';
sum = sum % 9;
}
if (sum % 9)
cout << "No";
else
cout << "Yes";
ret... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 89 |
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define ve vector
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpl vector<pll>
#define fi first
#define all(a) (a).begin(), (a).end()
#define si(x) ... | /* Aditya0412 */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define ve vector
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpl vector<pll>
#define fi first
#define all(a) (a).begin(), (a).end()
#define si(x) ... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 452 |
from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
x = sum(list(map(int, input().split())))
i... | from collections import defaultdict
from collections import deque
from collections import Counter
import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
x = sum(list(map(int, input().split())))
i... | [["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 110 |
#include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie(nullptr);
#define re... | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie(nullptr);
#define re... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 509 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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 FOR(i, a, b) for (... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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 FOR(i, a, b) for (... | [["+", 0, 7, 8, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 8, 1, 0, 11, 12, 16, 12, 103, 0, 125]] | 1 | 165 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define ff first
#define ss second
#define p pair<ll, ll>
#define pb push_back
#define endl '\n'
#define w(t) \
ll te... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define ff first
#define ss second
#define p pair<ll, ll>
#define pb push_back
#define endl '\n'
#define w(t) \
ll te... | [["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]] | 1 | 121 |
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int, int>
#define fast \
ios_base::sync_with_stdio(0); ... | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int, int>
#define fast \
ios_base::sync_with_stdio(0); ... | [["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 286 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
//#pragma GCC optimize("Ofast")
//#... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
//#pragma GCC optimize("Ofast")
//#... | [["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]] | 1 | 351 |
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static MyScanner scan;
public static PrintWriter out;
public static void main(String[] args) {
scan = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t ... | import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static MyScanner scan;
public static PrintWriter out;
public static void main(String[] args) {
scan = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t ... | [["-", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["-", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491]] | 3 | 1,354 |
n=int(input())
ans=n%9
if n!=0 and (ans==0 or ans==9):
print("Yes")
else:
print("No") | n=int(input())
ans=n%9
if (ans==0 or ans==9):
print("Yes")
else:
print("No") | [["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 667, 79], ["-", 0, 656, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 355]] | 5 | 42 |
#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 (... | [["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 197 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
int stools = 0;
for (int i = 1; i < n; i++) {
if (v[i] < v[i - 1]) {
stools += (v[i - 1] - v[i]);
v[i] = v[i - 1];
}
}
cout << stools;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
vector<long long int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
long long int stools = 0;
for (int i = 1; i < n; i++) {
if (v[i] < v[i - 1]) {
stools += (v[i - 1] - v[i]);
v[i] = v[i - 1];... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]] | 1 | 123 |
#include <iostream>
using namespace std;
int main(void) {
int N, d, ans = 0;
cin >> N;
int A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 1; i < N; i++) {
if (A[i] < A[i - 1]) {
d = A[i - 1] - A[i];
ans += d;
A[i] += d;
}
}
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main(void) {
int N, d;
long long ans = 0;
cin >> N;
int A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 1; i < N; i++) {
if (A[i] < A[i - 1]) {
d = A[i - 1] - A[i];
ans += d;
A[i] += d;
}
}
cout << ans ... | [["-", 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 | 118 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, h = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i < n; i++)
if (a[i] - a[i - 1] < 0) {
int diff = a[i - 1] - a[i];
a[i] += diff;
h += diff;
}
cout << ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll h = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i < n; i++)
if (a[i] - a[i - 1] < 0) {
int diff = a[i - 1] - a[i];
a[i] += diff;
h += diff;
}
cou... | [["-", 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 | 119 |
#include <bits/stdc++.h>
#include <stdio.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define _USE_MATH_DEFINES
#define f first
//#define s second
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define INF 1000000000000000000
#define MAXN (int)(1e7)... | #include <bits/stdc++.h>
#include <stdio.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define _USE_MATH_DEFINES
#define f first
//#define s second
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define INF 1000000000000000000
#define MAXN (int)(1e7)... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]] | 1 | 231 |
n = int(input())
vals = list(map(int, input().split()))
ma = vals[0]
res = [0 for _ in range(n)]
for i, val in enumerate(vals):
if val < ma:
res[i] = ma - val
if ma < val:
ma = val
print(max(res)) | n = int(input())
vals = list(map(int, input().split()))
ma = vals[0]
res = [0 for _ in range(n)]
for i, val in enumerate(vals):
if val < ma:
res[i] = ma - val
if ma < val:
ma = val
print(sum(res)) | [["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]] | 5 | 81 |
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out, true);
int n = in.nextInt();
int max = Integer.MIN_VALUE;
int a[] = new int[n];
int sum = 0;
for (int i = 0; i < n;... | import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out, true);
int n = in.nextInt();
long max = Integer.MIN_VALUE;
long a[] = new long[n];
long sum = 0;
for (int i = 0; i ... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 0, 503, 49, 200, 51, 227, 39, 506, 0, 507], ["+", 0, 503, 49, 200, 51, 227, 39, 506, 0, 96], ["-", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22]] | 3 | 156 |
#include <math.h>
#include <stdio.h>
#include <string.h>
int main(void) {
int i, n;
long int b;
scanf("%d", &n);
long int a[n];
int sum = 0;
for (i = 0; i < n; i++) {
scanf("%ld", &b);
a[i] = b;
}
for (i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
sum = sum + (a[i - 1] - a[i]);
a[i... | #include <math.h>
#include <stdio.h>
#include <string.h>
int main(void) {
int i, n;
long int b;
scanf("%d", &n);
long int a[n];
long int sum = 0;
for (i = 0; i < n; i++) {
scanf("%ld", &b);
a[i] = b;
}
for (i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
sum = sum + (a[i - 1] - a[i]);
... | [["+", 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]] | 0 | 146 |
n = input()
a = list(map(int, input().split()))
max_a_list = [0]*n
max_a_list[0] = a[0]
for i in range(1,n):
max_a_list[i] = max(max_a_list[i - 1],a[i])
sum_ = 0
for i in range(n):
if max_a_list[i] > a[i]:
sum_ += max_a_list[i] - a[i]
print(sum_)
| n = int(input())
a = list(map(int, input().split()))
max_a_list = [0]*n
max_a_list[0] = a[0]
for i in range(1,n):
max_a_list[i] = max(max_a_list[i - 1],a[i])
sum_ = 0
for i in range(n):
if max_a_list[i] > a[i]:
sum_ += max_a_list[i] - a[i]
print(sum_)
| [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 104 |
import java.util.Scanner;
public class Main {
public static int N;
public static int[] A;
public static int[] A_work;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
N = Integer.parseInt(scan.next());
A = new int[N];
A_work = new int[N];
for (int n = 0; n < N... | import java.util.Scanner;
public class Main {
public static int N;
public static int[] A;
public static int[] A_work;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
N = Integer.parseInt(scan.next());
A = new int[N];
A_work = new int[N];
for (int n = 0; n < N... | [["-", 0, 235, 8, 498, 0, 195, 39, 506, 0, 507], ["+", 0, 235, 8, 498, 0, 195, 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 | 228 |
N = int(input())
A = [0]*N
A = list(map(int, input().split()))
sum_step = 0
for n in range(0, N):
if A[n] >= A[n-1]:
pass
else:
sum_step += A[n-1] - A[n]
A[n] = A[n-1]
print(sum_step) | N = int(input())
A = [0]*N
A = list(map(int, input().split()))
sum_step = 0
for n in range(1,N):
if A[n] < A[n-1]:
sum_step += A[n-1] - A[n]
A[n] = A[n-1]
print(sum_step) | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 674, 0, 675], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95]] | 5 | 89 |
n = int(input())
a = list(map(int,input().split()))
ans = 0
m = a[0]
for i in range(1,n):
if a[i] > m:
ans += a[i]-m
m = a[i]
print(ans)
| n = int(input())
a = list(map(int,input().split()))
ans = 0
m = a[0]
for i in range(1,n):
if a[i] <= m:
ans += -a[i]+m
else:
m = a[i]
print(ans)
| [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 1, 0, 677, 12, 657, 31, 664, 17, 33], ["-", 64, 196, 0, 1, 0, 677, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 677, 12, 657, 17, 72], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]] | 5 | 70 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
// int[] arr = new int[n];
int total = 0;
int p = sc.nextInt();
for (int i = 1; i < n; i++) {
int c = sc.nextInt();
if (p - c > 0) {
... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
// int[] arr = new int[n];
long total = 0;
int p = sc.nextInt();
for (int i = 1; i < n; i++) {
int c = sc.nextInt();
if (p - c > 0) {
... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 117 |
#include <bits/stdc++.h>
#define ll long long
const ll mod = 1000000007;
using namespace std;
int main() {
int n;
cin >> n;
int A[n];
for (int i = 0; i < n; i++)
cin >> A[i];
int total = 0;
int h = -1;
for (int i = 0; i < n; i++) {
h = max(h, A[i]);
total += (h - A[i]);
}
cout << total;... | #include <bits/stdc++.h>
#define ll long long
const ll mod = 1000000007;
using namespace std;
int main() {
ll n;
cin >> n;
ll A[n];
for (ll i = 0; i < n; i++)
cin >> A[i];
ll total = 0;
ll h = -1;
for (ll i = 0; i < n; i++) {
h = max(h, A[i]);
total += (h - A[i]);
}
cout << total;
}
| [["-", 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 | 108 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
long long int ans = 0;
long long int step = 0;
for (int i = 0; i < n - 1; i++) {
if (step + a[i] < a[i + 1]) {
step = a[i + 1] + step - a[i];
ans += step... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
long long int ans = 0;
long long int step = 0;
for (int i = 0; i < n - 1; i++) {
if (step + a[i] > a[i + 1]) {
step = -a[i + 1] + step + a[i];
ans += ste... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 11, 12, 16, 31, 16, 31, 91, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72]] | 1 | 134 |
#include <iostream>
using namespace std;
int main() {
int N, A;
int ans = 0;
int pre = 0;
cin >> N;
for (size_t i = 0; i < N; i++) {
cin >> A;
if (pre > A) {
ans += pre - A;
} else {
pre = A;
}
}
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main() {
int N, A;
long ans = 0;
int pre = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A;
if (pre > A) {
ans += pre - A;
} else {
pre = A;
}
}
cout << ans << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40]] | 1 | 78 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, sum = 0;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 1; i < N; i++) {
int d = vec.at(i - 1) - vec.at(i);
if (d > 0) {
sum += d;
vec.at(i) += d;
}
}
cout << sum ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, sum = 0;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 1; i < N; i++) {
int64_t d = vec.at(i - 1) - vec.at(i);
if (d > 0) {
sum += d;
vec.at(i) += d;
}
}
cout... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]] | 1 | 119 |
#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.at(i);
}
int ans = 0;
for (int i = 1; i < N; i++) {
if (A.at(i) <= A.at(i - 1)) {
ans += (A.at(i - 1) - A.at(i));
A.at(i) = A.at(i - 1);
} else
... | #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.at(i);
}
long long ans = 0;
for (int i = 1; i < N; i++) {
if (A.at(i) <= A.at(i - 1)) {
ans += (A.at(i - 1) - A.at(i));
A.at(i) = A.at(i - 1);
} e... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 142 |
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int ans = 0;
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1]) {
ans += A[i] - A[i + 1];
A[i + 1] += A[i] - A[i + 1];
}
}
cout << ans;
}
| #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int64_t A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int64_t ans = 0;
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1]) {
ans += A[i] - A[i + 1];
A[i + 1] += A[i] - A[i + 1];
}
}
cout << ans;... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 124 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int now = a[0], ans = 0;
REP(i, n - 1) {
if (a[i] >= now) {
n... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, n) for (int i = 1; i <= (n); i++)
typedef long long ll;
int main() {
int n;
cin >> n;
vector<ll> a(n);
rep(i, n) cin >> a[i];
ll now = a[0], ans = 0;
REP(i, n - 1) {
if (a[i] >= now) {
now... | [["-", 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 | 124 |
#include <algorithm>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846264338327950L
int res;
int main() {
cin.tie(nullptr);
i... | #include <algorithm>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846264338327950L
ll res;
int main() {
cin.tie(nullptr);
io... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 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 | 167 |
n = int(input())
a = list(map(int,input().split()))
s = a[0]
ans = 0
for i in range(1,n):
ans += max(0,a[i]-s)
s = max(s,a[i])
print(ans)
| n = int(input())
a = list(map(int,input().split()))
s = a[0]
ans = 0
for i in range(1,n):
ans += max(0,s-a[i])
s = max(s,a[i])
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 | 72 |
#include <bits/stdc++.h>
using namespace std;
int main() {
// C-step
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
int val;
cin >> val;
a[i] = val;
}
int height = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i + 1] >= a[i]) {
continue;
}
int stool = a[i] ... | #include <bits/stdc++.h>
using namespace std;
int main() {
// C-step
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
int val;
cin >> val;
a[i] = val;
}
long long height = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i + 1] >= a[i]) {
continue;
}
int stool =... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 132 |
n=int(input())
a=list(map(int,input().split()))
ans = 0
for i in range(n-2):
s = a[i+1] -a[i]
if s < 0:
ans = ans - s
a[i+1]=a[i]
print(ans) | n=int(input())
a=list(map(int,input().split()))
ans = 0
for i in range(n-1):
s = a[i+1] -a[i]
if s < 0:
ans = ans - s
a[i+1]=a[i]
print(ans) | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 76 |
#include <bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL << ((ll)n))
#define SUBS(s, f, t) ((s).substr((f), (t) - (f)))
#define ALL... | #include <bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL << ((ll)n))
#define SUBS(s, f, t) ((s).substr((f), (t) - (f)))
#define ALL... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 152 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
long long ans = 0;
for (int i = 1; i < n; i++) {
if (arr[i - 1] < arr[i]) {
ans += arr[i - 1] - arr[i];
arr[i] = arr[i - 1];
}
}
cout << ans;
retu... | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
long long ans = 0;
for (int i = 1; i < n; i++) {
if (arr[i - 1] > arr[i]) {
ans += arr[i - 1] - arr[i];
arr[i] = arr[i - 1];
}
}
cout << ans;
retu... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 118 |
#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];
vector<int> b = a;
int ans = 0;
for (int i = 1; i < N; i++) {
if (a[i] < a[i - 1])
a[i] = a[i - 1];
ans += a[i] - b[i];
}
cout << ans << endl;
r... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<long> a(N);
for (int i = 0; i < N; i++)
cin >> a[i];
vector<long> b = a;
long ans = 0;
for (int i = 1; i < N; i++) {
if (a[i] < a[i - 1])
a[i] = a[i - 1];
ans += a[i] - b[i];
}
cout << ans << endl;
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 125 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
//
// Scanner sc = new Scanner(System.in);
... |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
//
// Scanner sc = new Scanner(System.in);
... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 208 |
// package Contest#176;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
StringTokenizer st = new StringTokenizer(br... | // package Contest#176;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
StringTokenizer st = new StringTokenizer(br... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 182 |
input()
A = list(map(int, input.split()))
sum = 0
for i in range(1, len(A)):
if A[i] < A[i-1]:
sum += A[i-1] - A[i]
A[i] = A[i-1]
print(sum)
| input()
A = list(map(int, input().split()))
sum = 0
for i in range(1, len(A)):
if A[i] < A[i-1]:
sum += A[i-1] - A[i]
A[i] = A[i-1]
print(sum)
| [["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]] | 5 | 75 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
vector<int> m(n);
m[0] = v[0];
for (int i = 1; i < n; i++) {
if (v[i] < m[i - 1]) {
m[i] = m[i - 1];
} else {
m[i] = v[i];
}
}
int ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
vector<long> m(n);
m[0] = v[0];
for (long i = 1; i < n; i++) {
if (v[i] < m[i - 1]) {
m[i] = m[i - 1];
} else {
m[i] = v[i];
}
}
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96]] | 1 | 171 |
/*==========================================================================*/
/*
AUTHOR: BPZ
CREATED: 30.08.2020 11:16:54
*/
/*--------------------------------------------------------------------------*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.... | /*==========================================================================*/
/*
AUTHOR: BPZ
CREATED: 30.08.2020 11:16:54
*/
/*--------------------------------------------------------------------------*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 142 |
N=int(input())
A=list(map(int,input().split()))
count=0
for num in range(N):
if A[num]>A[num+1]:
count=count+A[num]-A[num+1]
A[num+1]=A[num]
else:
continue
print(count) | N=int(input())
A=list(map(int,input().split()))
count=0
for num in range(N-1):
if A[num]>A[num+1]:
count=count+A[num]-A[num+1]
A[num+1]=A[num]
else:
continue
print(count) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 82 |
number = int(input())
tall = list(map(int, input().split()))
addition = 0
for each in range(1, number + 1):
difference = tall[each - 1] - tall[each]
if difference > 0:
addition += difference
tall[each] += difference
print(addition) | number = int(input())
tall = list(map(int, input().split()))
addition = 0
for each in range(1, number):
difference = tall[each - 1] - tall[each]
if difference >= 0:
addition += difference
tall[each] += difference
print(addition) | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]] | 5 | 71 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(a) a.begin(), a.end()
const int maxn = 100010;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
int n, m, a[maxn];
string s, ss;
int main() {
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(a) a.begin(), a.end()
const int maxn = 200010;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
int n, m, a[maxn];
string s, ss;
int main() {
... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]] | 1 | 199 |
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
int n;
cin >> n;
int ans = 0, p;
cin >> p;
for (int i = 1; i < n; i++) {
int q;
cin >> q;
if (q < p)
ans += p - q;
else
p = q;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int32_t main() {
int n;
cin >> n;
long long ans = 0, p;
cin >> p;
for (int i = 1; i < n; i++) {
int q;
cin >> q;
if (q < p)
ans += p - q;
else
p = q;
}
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 | 79 |
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
priority_queue<int32_t> que;
que.push(0);
int32_t cnt = 0;
for (int i = 0; i < N; i++) {
int32_t a;
cin >> a;
if (que.top() > a)
cnt += que.top() - a;
que.push(a);
}
cout << cnt << endl;
} | #include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
priority_queue<int64_t> que;
que.push(0);
int64_t cnt = 0;
for (int i = 0; i < N; i++) {
int64_t a;
cin >> a;
if (que.top() > a)
cnt += que.top() - a;
que.push(a);
}
cout << cnt << endl;
} | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]] | 1 | 95 |
#include <bits/stdc++.h>
using namespace std;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "[ ";
for (auto a : v)
os << a << " ";
os << "]";
return os;
}
int main() {
cout << fixed << setprecision(0);
int N;
cin >> N;
vector<int> A(N);
for (auto &a : A)
... | #include <bits/stdc++.h>
using namespace std;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "[ ";
for (auto a : v)
os << a << " ";
os << "]";
return os;
}
int main() {
cout << fixed << setprecision(0);
int N;
cin >> N;
vector<int> A(N);
for (auto &a : A)
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 173 |
#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.at(i);
}
int max = A.at(0);
int ans = 0;
for (int i = 1; i < N; i++) {
if (A.at(i) < max) {
ans += max - A.at(i);
} else {
max = A.at(i);
}
... | #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.at(i);
}
int max = A.at(0);
long long ans = 0;
for (int i = 1; i < N; i++) {
if (A.at(i) < max) {
ans += max - A.at(i);
} else {
max = A.at(i);
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 126 |
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 0;
for (int i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
ans += (a[i ... | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
ll a[n];
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
ll ans = 0;
for (ll i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
ans += (a[i - 1] ... | [["-", 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 | 144 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 550 |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int beforeA = 0;
int ans = 0;
for (int cnt = 0; cnt < n; cnt++) {
int a = sc.nextInt();
int step = 0;
if (be... | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int beforeA = 0;
long ans = 0;
for (int cnt = 0; cnt < n; cnt++) {
int a = sc.nextInt();
int step = 0;
if (b... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 130 |
N=int(input())
A=list(map(int,input().split()))
ans = 0
for i in range (1,N):
if A[i-1] > high:
high = A[i-1]
if high > A[i-1]:
ans += high - A[i]
print (ans) | N=int(input())
A=list(map(int,input().split()))
ans = 0
high = 0
for i in range (1,N):
if A[i-1] > high:
high = A[i-1]
if high > A[i]:
ans += high - A[i]
print (ans) | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612]] | 5 | 78 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int sumStep = 0;
int maxA = sc.nextInt();
for (int i = 1; i < n; i++) {
int a = sc.nextInt();
maxA = Math.max(maxA, a);
sumStep += m... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sumStep = 0;
int maxA = sc.nextInt();
for (int i = 1; i < n; i++) {
int a = sc.nextInt();
maxA = Math.max(maxA, a);
sumStep += ... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96]] | 3 | 115 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] height = new int[n];
for (int i = 0; i < n; i++) {
height[i] = sc.nextInt();
}
int temp = 0;
int totalHeight = 0;
for (int i... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] height = new int[n];
for (int i = 0; i < n; i++) {
height[i] = sc.nextInt();
}
int temp = 0;
long totalStandHeight = 0;
for ... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 2... | 3 | 162 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h;
int count = 0;
int prev = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (i == 0) {
prev = x;
} else {
if (prev <= x) {
prev = x;
} else {
count += prev - x;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h;
long long count = 0;
long prev = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (i == 0) {
prev = x;
} else {
if (prev <= x) {
prev = x;
} else {
count += prev... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.