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 | change_count int64 0 100 |
|---|---|---|---|---|---|
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < 0; i++)
cin >> R[i];
int maxv = -2000000000; //???????°??????????????????????????¨????
int minv = R[0];
for (int i = 1; i < n;
i++) { // ?????... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> R[i];
int maxv = -2000000000;
int minv = R[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 122 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int min_ = 1e9;
int max_ = 1 - min_;
for (int i = 0; i < n; i++) {
int R;
cin >> R;
max(R - min_, max_);
min_ = min(R, min_);
}
cout << max_ << endl;
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int min_ = 2e9;
int max_ = 1 - min_;
for (int i = 0; i < n; i++) {
int R;
cin >> R;
max_ = max(R - min_, max_);
min_ = min(R, min_);
}
cout << max_ << endl;
return 0;
} | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32]] | 1 | 83 | 4 |
#include <iostream>
int main() {
{
using namespace std;
const int MAX = 9223372036854775807LL;
long long int n;
cin >> n;
long long int current_profit = -MAX;
long long int min = +MAX;
long long int max_profit = -MAX;
for (long long int i = 0; i < n; i++) {
long long int r;
... | #include <iostream>
int main() {
{
using namespace std;
const int MAX = 1000000000LL;
long long int n;
cin >> n;
long long int current_profit = -MAX;
long long int min = +MAX;
long long int max_profit = -MAX;
for (long long int i = 0; i < n; i++) {
long long int r;
cin >... | [["-", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 51, 13]] | 1 | 121 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> R[i];
int maxv = -20000000000; // ???????°??????????????????????????¨????
int minv = R[0];
for (int i = 1; i < n; i++) { // ????????§?... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> R[i];
int maxv = -2000000000; // ???????°??????????????????????????¨????
int minv = R[0];
for (int i = 1; i < n; i++) { // ????????§??... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 121 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
// i = 0~n-1
int main(void) {
int n;
cin >> n;
int R[n];
cin >> R[0];
int minv = R[0];
int maxv = -10 ^ (9);
for (int j = 1; j < n; j++) {
cin >> R[j];
maxv = max(maxv, R[j] - minv);
minv = min(minv, R[j]);
}
cout << maxv <<... | #include <algorithm>
#include <iostream>
using namespace std;
int main(void) {
int n;
cin >> n;
int R[n];
cin >> R[0];
int minv = R[0];
int maxv = -1000000000;
for (int j = 1; j < n; j++) {
cin >> R[j];
maxv = max(maxv, R[j] - minv);
minv = min(minv, R[j]);
}
cout << maxv << endl;
r... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 140], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 24], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 13], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 111 | 6 |
#include <cstdio>
#include <iostream>
static const int kExtremelyHighPrice = 1000 * 1000 * 1000 + 1;
int main() {
int input_size;
int number;
int current_min = kExtremelyHighPrice;
int current_max_profit = -1;
std::cin >> input_size;
for (int i = 0; i < input_size; i++) {
std::cin >> number;
int ... | #include <cstdio>
#include <iostream>
static const int kExtremelyHighPrice = 2000 * 1000 * 1000 + 3;
int main() {
int input_size;
int number;
int current_min = kExtremelyHighPrice;
int current_max_profit = -kExtremelyHighPrice;
std::cin >> input_size;
for (int i = 0; i < input_size; i++) {
std::cin >... | [["-", 49, 50, 51, 16, 31, 16, 31, 16, 31, 13], ["+", 49, 50, 51, 16, 31, 16, 31, 16, 31, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]] | 1 | 111 | 7 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> R(n);
for (int i = 0; i < n; i++) {
cin >> R[i];
}
vector<int> minOfRAppearedBefore(n);
minOfRAppearedBefore[0] = R[0];
for (int i = 1; i < n; i++) {
minOfRAppearedBefore[i] = min(minOfRAppearedBefore[i -... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> R(n);
for (int i = 0; i < n; i++) {
cin >> R[i];
}
vector<int> minOfRAppearedBefore(n);
minOfRAppearedBefore[0] = R[0];
for (int i = 1; i < n; i++) {
minOfRAppearedBefore[i] = min(minOfRAppearedBefore[i -... | [["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 150 | 2 |
#include <array>
#include <iostream>
#include <limits>
using namespace std;
int main() {
int len;
cin >> len;
array<int, 200000> nums;
for (int i = 0; i < len; i++)
cin >> nums[i];
int mi = nums[0];
int diffMax = numeric_limits<int>::min();
for (int i = 0; i < len - 1; i++) {
diffMax = max<int... | #include <array>
#include <iostream>
#include <limits>
using namespace std;
int main() {
int len;
cin >> len;
array<int, 200000> nums;
for (int i = 0; i < len; i++)
cin >> nums[i];
int mi = nums[0];
int diffMax = numeric_limits<int>::min();
for (int i = 1; i < len; i++) {
diffMax = max<int>(di... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 131 | 4 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int a[200000];
int n;
int maxv = -200000000;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int minv = a[0];
for (int j = 0; j < n; j++) {
maxv = max(maxv, a[j] - minv);
minv = min(minv, a[j]);
}
cout << maxv... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int a[200000];
int n;
int maxv = -2000000000;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int minv = a[0];
for (int j = 1; j < n; j++) {
maxv = max(maxv, a[j] - minv);
minv = min(minv, a[j]);
}
cout << max... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 112 | 4 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[200000];
int i;
for (i = 0; i < n; i++) {
cin >> a[i];
}
int maxn = -20000000000;
int minn = a[0];
for (i = 1; i < n; i++) {
maxn = max(maxn, a[i] - minn);
minn = min(minn, a[i]);
}
cou... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[200000];
int i;
for (i = 0; i < n; i++) {
cin >> a[i];
}
int maxn = -2000000000;
int minn = a[0];
for (i = 1; i < n; i++) {
maxn = max(maxn, a[i] - minn);
minn = min(minn, a[i]);
}
cout... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 115 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r), end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout << #x << ": " << x << endl
#define fcout(n) cout << fixed << setprecision((... | #include <bits/stdc++.h>
using namespace std;
#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r), end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout << #x << ": " << x << endl
#define fcout(n) cout << fixed << setprecision((... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]] | 1 | 369 | 3 |
#include <bits/stdc++.h>
using namespace std;
int tag[2000005];
int main() {
int n;
cin >> n;
int maxs = -1000000005, mins = 1000000005;
// cout<<mins<<endl;
for (int i = 0; i < n; i++) {
cin >> tag[i];
if (tag[i] - mins > maxs)
maxs = tag[i] - mins;
if (i && tag[i] < mins)
mins = tag[... | #include <bits/stdc++.h>
using namespace std;
int tag[2000005];
int main() {
int n;
cin >> n;
int maxs = -1000000005, mins = 1000000005;
// cout<<mins<<endl;
for (int i = 0; i < n; i++) {
cin >> tag[i];
if (i && tag[i] - mins > maxs)
maxs = tag[i] - mins;
if (tag[i] < mins)
mins = tag[... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]] | 1 | 102 | 4 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<int> r;
int _r;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> _r;
r.push_back(_r);
}
int minval = r[0];
int maxval = -2000000000;
for (int j = 1; j < n - 1; j++) {
... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<int> r;
int _r;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> _r;
r.push_back(_r);
}
int minval = r[0];
int maxval = -2000000000;
for (int j = 1; j < n; j++) {
max... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 127 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], n;
cin >> n;
int i;
for (i = 0; i < n; i++)
cin >> R[i];
int maxv = 2000000000;
int minv = R[0];
for (i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> R[i];
int maxv = -2000000000;
int minv = R[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R... | [["-", 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], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 119 | 7 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int r[n];
for (int i = 0; i < n; i++)
cin >> r[i];
int MAX = -2000000000, MIN = r[0];
for (int i = 0; i < n; i++) {
MAX = max(MAX, r[i] - MIN);
MIN = min(MIN, r[i]);
}
cout << MAX << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int r[n];
for (int i = 0; i < n; i++)
cin >> r[i];
int MAX = -2000000000, MIN = r[0];
for (int i = 1; i < n; i++) {
MAX = max(MAX, r[i] - MIN);
MIN = min(MIN, r[i]);
}
cout << MAX << endl;
return 0;
} | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 109 | 2 |
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
int n;
cin >> n;
int *a_price;
a_price = new int[n];
for (int i = 0; i < n; i++) {
cin >> a_price[i];
}
int min = 1000000000;
int maxd = -999999999;
for (int j = 1; j < n; j++) {
if (a_price[j - 1] < min)
mi... | #include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
int n;
cin >> n;
int *a_price;
a_price = new int[n];
for (int i = 0; i < n; i++) {
cin >> a_price[i];
}
int min = 1000000000;
int maxd = -999999999;
for (int j = 1; j < n; j++) {
if (a_price[j - 1] < min)
mi... | [["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22]] | 1 | 137 | 4 |
#include <algorithm>
#include <iostream>
using namespace std;
#define MAX 200000
int main(void) {
int R[MAX], n = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv = -200000000;
int minv = R[0];
for (int i = 0; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R... | #include <algorithm>
#include <iostream>
using namespace std;
#define MAX 200000
int main(void) {
int R[MAX], n = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv = -2000000000;
int minv = R[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 119 | 4 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int R, n;
int ans, min_R = -1000000000;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R;
if (i == 0)
min_R = R;
else {
ans = max(ans, R - min_R);
min_R = min(min_R, R);
}
}
cout << ans << endl... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int R, n;
int min_R, ans = -1000000000;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R;
if (i == 0)
min_R = R;
else {
ans = max(ans, R - min_R);
min_R = min(min_R, R);
}
}
cout << ans << endl... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22]] | 1 | 92 | 4 |
#include <algorithm>
#include <cstdio>
using namespace std;
const int MAX_VALUE = 200000;
int R[MAX_VALUE];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &R[i]);
int min_val = R[0];
int max_val = -1000000001;
for (int j = 0; j < n; j++) {
max_val = max(max_val, R[j... | #include <algorithm>
#include <cstdio>
using namespace std;
const int MAX_VALUE = 200000;
int R[MAX_VALUE];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &R[i]);
int min_val = R[0];
int max_val = -1000000001;
for (int j = 1; j < n; j++) {
max_val = max(max_val, R[j... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 131 | 2 |
#include "bits/stdc++.h"
using namespace std;
int main() {
int n;
cin >> n;
int ans = -1, minv;
cin >> minv;
for (int i = 1; i < n; ++i) {
int a;
cin >> a;
ans = max(ans, a - minv);
minv = min(minv, a);
}
cout << ans << endl;
// system("pause");
} | #include "bits/stdc++.h"
using namespace std;
int main() {
int n;
cin >> n;
int ans = -INT_MIN, minv;
cin >> minv;
for (int i = 1; i < n; ++i) {
int a;
cin >> a;
ans = max(ans, a - minv);
minv = min(minv, a);
}
cout << ans << endl;
} | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22]] | 1 | 82 | 3 |
#include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int R[200000] = {0}, n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> R[i];
int minv = R[0];
int maxv = -2000000000;
for (int i = 0; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R[i]);... | #include <algorithm>
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int R[200000] = {0}, n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> R[i];
int minv = R[0];
int maxv = -2000000000;
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R[i]);... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 117 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, A[200000];
int maxv = -2000000;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int minv = A[0];
for (int i = 0; i < n; i++) {
maxv = max(maxv, A[i] - minv);
minv = min(minv, A[i]);
}
cout << maxv <<... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, A[200000];
int maxv = -2000000000;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int minv = A[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, A[i] - minv);
minv = min(minv, A[i]);
}
cout << maxv... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 113 | 4 |
#include <iostream>
using namespace std;
int main() {
int n, maxv, minv;
cin >> n;
int r[2];
cin >> r[0] >> r[1];
maxv = r[1] - r[0];
if (r[0] < r[1]) {
minv = r[0];
} else
minv = r[1];
for (int i = 2; i < n; i++) {
int a;
cin >> a;
if (maxv < a - minv) {
maxv = a - minv;
}... | #include <iostream>
using namespace std;
int main() {
int n, maxv, minv;
cin >> n;
int r[2];
cin >> r[0] >> r[1];
maxv = r[1] - r[0];
if (r[0] < r[1]) {
minv = r[0];
} else
minv = r[1];
for (int i = 2; i < n; i++) {
int a;
cin >> a;
if (maxv < a - minv) {
maxv = a - minv;
}... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 142 | 2 |
#include <iostream>
#include <vector>
using namespace std;
//---------------------------------------
int max_profit(vector<int> vec);
//---------------------------------------
int main(void) {
int num;
vector<int> num_all;
cin >> num;
for (int i = 0; i < num; i++) {
int n;
cin >> n;
num_all.push_... | #include <iostream>
#include <vector>
using namespace std;
//---------------------------------------
int max_profit(vector<int> vec);
//---------------------------------------
int main(void) {
int num;
vector<int> num_all;
cin >> num;
for (int i = 0; i < num; i++) {
int n;
cin >> n;
num_all.push_... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 186 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define N 200000
int main() {
lli ans, n, mini;
lli a[N];
cin >> n;
for (lli i = 0; i < n; i++) {
lli k;
cin >> k;
a[i] = k;
}
ans = a[1] - a[0];
mini = a[0];
for (lli i = 1; i < n - 1; i++) {
ans = max(ans, a[i]... | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define N 200000
int main() {
lli ans, n, mini;
lli a[N];
cin >> n;
for (lli i = 0; i < n; i++) {
lli k;
cin >> k;
a[i] = k;
}
ans = a[1] - a[0];
mini = a[0];
for (lli i = 1; i < n; i++) {
ans = max(ans, a[i] - m... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 137 | 2 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
int max_profit(vector<int> &price) {
int profit;
long long int max = -999999999;
int min = 1;
for (int i = 1; i <= price.size() - 1; i++) {
if (price[0] > min) {
min = price[0];
} ... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
int max_profit(vector<int> &price) {
int profit;
long long int max = -999999999;
int min = 1;
for (int i = 1; i <= price.size() - 1; i++) {
if (i == 1) {
min = price[0];
} else if ... | [["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16,... | 1 | 191 | 9 |
#include <cstdio>
using namespace std;
int main(void) {
int n;
long r[200000], maxv, minv;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &r[i]);
}
maxv = r[1] - r[0];
minv = r[0];
for (int i = 1; i < n; i++) {
if (minv > r[i - 1])
minv = r[i - 1];
if (maxv < r[i] - minv)
... | #include <cstdio>
using namespace std;
int main(void) {
int n;
long long r[200000], maxv, minv;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%ld", &r[i]);
}
maxv = r[1] - r[0];
minv = r[0];
for (int i = 1; i < n; i++) {
if (minv > r[i - 1])
minv = r[i - 1];
if (maxv < r[i] - m... | [["+", 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, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 152 | 4 |
#include <bits/stdc++.h>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)
using namespace std;
int main() {
int n;
cin >> n;
int r[n];
for (int i = 0; i < n; i++) {
cin >> r[i];
}
int maxv = -1000000001;
... | #include <bits/stdc++.h>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)
using namespace std;
int main() {
int n;
cin >> n;
int r[n];
for (int i = 0; i < n; i++) {
cin >> r[i];
}
int maxv = -1000000001;
... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]] | 1 | 138 | 5 |
#include <iostream>
using namespace std;
int main() {
int n, r, max = 0, min = 0;
cin >> n;
cin >> min;
for (int i = 1; i < n; i++) {
cin >> r;
if (max < r - min)
max = r - min;
if (min > r)
min = r;
}
cout << max << endl;
} | #include <iostream>
using namespace std;
int main() {
int n, r, max = -1e9, min;
cin >> n;
cin >> min;
for (int i = 1; i < n; i++) {
cin >> r;
if (max < r - min)
max = r - min;
if (min > r)
min = r;
}
cout << max << endl;
} | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32]] | 1 | 83 | 4 |
#include <algorithm>
#include <iostream>
void calc_profit(int n, int **ppfx);
int main() {
int n = 0;
int *pfx;
std::cin >> n;
calc_profit(n, &pfx);
delete[] pfx;
}
void calc_profit(int n, int **ppfx) {
int idx = 0;
int maxv = -200000000, minv = 0;
*ppfx = new int[n];
for (int i = 0; i < n; i++)... | #include <algorithm>
#include <iostream>
void calc_profit(int n, int **ppfx);
int main() {
int n = 0;
int *pfx;
std::cin >> n;
calc_profit(n, &pfx);
delete[] pfx;
}
void calc_profit(int n, int **ppfx) {
int idx = 0;
int maxv = -2000000000, minv = 0;
*ppfx = new int[n];
for (int i = 0; i < n; i++... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25]] | 1 | 186 | 6 |
#include <algorithm>
#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 max0 = a[1] - a[0];
int min0 = a[0];
for (int i = 1; i < n - 1; i++) {
max0 = max(max0, a[i] - min0);
min0 = min(min0, a[i]);
}
cout << max0 <<... | #include <algorithm>
#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 max0 = a[1] - a[0];
int min0 = a[0];
for (int i = 1; i < n; i++) {
max0 = max(max0, a[i] - min0);
min0 = min(min0, a[i]);
}
cout << max0 << end... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 122 | 2 |
#include <algorithm>
#include <iostream>
#include <limits>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> R;
for (int i = 0; i < n; ++i) {
int r;
cin >> r;
R.push_back(r);
}
int maxv = R[1] - R[0];
int minv = R[0];
for (int j = 2; j < n; ++j) {
maxv ... | #include <algorithm>
#include <iostream>
#include <limits>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> R;
for (int i = 0; i < n; ++i) {
int r;
cin >> r;
R.push_back(r);
}
int maxv = R[1] - R[0];
int minv = R[0];
for (int j = 1; j < n; ++j) {
maxv ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 133 | 2 |
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <iostream>
typedef int type;
typedef long long ll;
using namespace std;
const bool isDebug = false;
void showArray(type A[], int N) {
for (int i = 0; i < N; i++) {
printf("%d", A[i]);
if (i != N - 1)
printf(" ");
}
printf("\n");
}
i... | #include <climits>
#include <cstdio>
#include <cstdlib>
#include <iostream>
typedef int type;
typedef long long ll;
using namespace std;
const bool isDebug = false;
void showArray(type A[], int N) {
for (int i = 0; i < N; i++) {
printf("%d", A[i]);
if (i != N - 1)
printf(" ");
}
printf("\n");
}
i... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 399 | 6 |
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int n, a[MAX];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int maxv = -20000000000, minv = a[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, a[i] - minv);
minv = min(minv, a[i]... | #include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 200000;
int main() {
int n, a[MAX];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int maxv = -2000000000, minv = a[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, a[i] - minv);
minv = min(minv, a[i])... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 119 | 2 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int array[n];
for (int i = 0; i < n; i++) {
cin >> array[i];
}
int min = array[0];
int max = array[1] - array[0];
for (int i = 1; i < n - 1; i++) {
if ((array[i] - min) > max) {
max = array[i] - min;
}
if (ar... | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int array[n];
for (int i = 0; i < n; i++) {
cin >> array[i];
}
int min = array[0];
int max = array[1] - array[0];
for (int i = 1; i < n; i++) {
if ((array[i] - min) > max) {
max = array[i] - min;
}
if (array... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 137 | 2 |
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
... | /*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
... | [["+", 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], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]] | 1 | 93 | 5 |
#include <iostream>
using namespace std;
int main() {
int max = 300000;
int R[max], n;
cin >> n;
for (int j = 0; j < n; j++)
cin >> R[j];
int diff_max = -20000000000000;
int val_min = R[0];
for (int j = 1; j < n; j++) {
if (R[j] - val_min > diff_max)
diff_max = (R[j] - val_min);
if (R[j... | #include <iostream>
using namespace std;
int main() {
int max = 300000;
int R[max], n;
cin >> n;
for (int j = 0; j < n; j++)
cin >> R[j];
int diff_max = -2000000000;
int val_min = R[0];
for (int j = 1; j < n; j++) {
if (R[j] - val_min > diff_max)
diff_max = (R[j] - val_min);
if (R[j] - ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 128 | 2 |
#include <bits/stdc++.h>
// #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int r[2000000], n;
int maxans = -2000000;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &r[i]);
}
int minans = r[0];
for (int i = 0; i < n; i++) {
maxans = max(maxans, r[... | #include <bits/stdc++.h>
// #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int r[2000000], n;
int maxans = -999999999;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &r[i]);
}
int minans = r[0];
for (int i = 1; i < n; i++) {
maxans = max(maxans,... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 133 | 4 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> r(n);
for (int i = 0; i < n; i++) {
cin >> r[i];
}
int maxv = r[0] - r[1];
int minv = r[0];
for (int j = 1; j <= n - 1; j++) {
maxv = max(maxv, r[j] - minv);
minv = min(minv, r[j]);
}
co... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> r(n);
for (int i = 0; i < n; i++) {
cin >> r[i];
}
int maxv = r[1] - r[0];
int minv = r[0];
for (int j = 1; j <= n - 1; j++) {
maxv = max(maxv, r[j] - minv);
minv = min(minv, r[j]);
}
co... | [["-", 49, 50, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 13], ["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 13], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 13]] | 1 | 124 | 4 |
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <unordered_map>
#define min(a, b) (a) > (b) ? (b) : (a)
#define max(a, b) (a) > (b) ? (a) : (b)
using namespace st... | #include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <unordered_map>
#define min(a, b) (a) > (b) ? (b) : (a)
#define max(a, b) (a) > (b) ? (a) : (b)
using namespace st... | [["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147], ["+", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35]] | 1 | 263 | 4 |
#include <stdio.h>
// dp seearch
// res = max(res,Rj - minRi)
// scan one time
int main() {
int min_i = 0; // first input
int j = 0; // second input
int ans = 1000000050;
int n = 0;
scanf("%d", &n);
scanf("%d", &min_i);
for (int k = 1; k < n; k++) {
scanf("%d", &j);
if (j - min_i > ans)
... | #include <stdio.h>
// dp seearch
// res = max(res,Rj - minRi)
// scan one time
int main() {
int min_i = 0; // first input
int j = 0; // second input
int ans = -1000000500;
int n = 0;
scanf("%d", &n);
scanf("%d", &min_i);
for (int k = 1; k < n; k++) {
scanf("%d", &j);
if (j - min_i > ans)
... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 116 | 2 |
#include <iostream>
int main() {
int number;
std::cin >> number;
int price[number];
for (int i = 0; i < number; i++) {
std::cin >> price[i];
}
int maximum = price[1] - price[0];
int low_index = 0;
int high_index = 1;
for (int i = 0; i < number; i++) {
if (price[low_index] < price[i]) {
... | #include <iostream>
int main() {
int number;
std::cin >> number;
int price[number];
for (int i = 0; i < number; i++) {
std::cin >> price[i];
}
int maximum = price[1] - price[0];
int low_index = 0;
int high_index = 1;
for (int i = 0; i < number; i++) {
if (price[low_index] < price[i]) {
... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]] | 1 | 183 | 4 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <utility>
#include <vector>
using namespace std;
#define INF 1000000000
int main(void) {
int n;
scanf("%d", &n);
int r[n];
for (int i = 0; i < n; i++) {
scanf("%d", &... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <utility>
#include <vector>
using namespace std;
#define INF 1000000000
int main(void) {
int n;
scanf("%d", &n);
int r[n];
for (int i = 0; i < n; i++) {
scanf("%d", &... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 217 | 2 |
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repi(i, n, a) for (int i = a; i < n; ++i)
int main(void) {
int n, i, j, max = 0, now = 0;
scanf("%d", &n);
int r[n], d[n];
d[0] = 0;
rep(i, n) {
scanf("%d", &r[i]);
if (i)
d[i] = r[i] - r[i - 1];
}
rep(i, n) {
now ... | #include <stdio.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repi(i, n, a) for (int i = a; i < n; ++i)
int main(void) {
int n, i, j, max = 0, now = 0;
scanf("%d", &n);
int r[n], d[n];
d[0] = 0;
rep(i, n) {
scanf("%d", &r[i]);
if (i)
d[i] = r[i] - r[i - 1];
}
rep(i, n) {
now ... | [["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]] | 1 | 200 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main(void) {
int n, r[200000], ma = -100000000, mi;
cin >> n;
for (int i = 0; i < n; i++)
cin >> r[i];
mi = r[0];
for (int j = 1; j < n - 1; j++) {
ma = max(ma, r[j] - mi);
mi = min(mi, r[j]);
}
cout << ma << endl;
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main(void) {
int n, r[200000], ma = -1000000000, mi;
cin >> n;
for (int i = 0; i < n; i++)
cin >> r[i];
mi = r[0];
for (int j = 1; j < n; j++) {
ma = max(ma, r[j] - mi);
mi = min(mi, r[j]);
}
cout << ma << endl;
}
| [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 111 | 4 |
#include <stdio.h>
#define NMAX 200000
#define RMAX 1000000000
int main() {
int a[NMAX] = {0};
int n = 0;
scanf("%d", &n);
int maxv = 0;
int minv = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
minv = a[0];
maxv = a[0];
for (int i = 1; i < n; i++) {
maxv = (maxv > a[i] - minv) ? max... | #include <stdio.h>
#define NMAX 200000
#define RMAX 1000000000
int main() {
int a[NMAX] = {0};
int n = 0;
scanf("%d", &n);
int maxv = 0;
int minv = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
minv = a[0];
maxv = a[1] - a[0];
for (int i = 1; i < n; i++) {
maxv = (maxv > a[i] - minv... | [["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 69, 28, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 70]] | 1 | 163 | 5 |
#include <iostream>
using namespace std;
const int kMaxN = 200000;
int main() {
int n;
int A[kMaxN];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int min = A[0] > A[1] ? A[0] : A[1];
int r = A[1] - A[0];
for (int i = 2; i < n; i++) {
if (A[i] - min > r) {
r = A[i];
}
... | #include <iostream>
using namespace std;
const int kMaxN = 200000;
int main() {
int n;
int A[kMaxN];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int min = A[0] < A[1] ? A[0] : A[1];
int r = A[1] - A[0];
for (int i = 2; i < n; i++) {
if (A[i] - min > r) {
r = A[i] - min;
... | [["-", 0, 43, 49, 50, 51, 41, 15, 16, 17, 47], ["+", 0, 43, 49, 50, 51, 41, 15, 16, 17, 18], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 150 | 4 |
#include <algorithm>
#include <iostream>
using namespace std;
// FX取引(最大利益算出)
int main() {
int n, a, first, second, small;
cin >> n >> first >> second;
small = min(first, second);
//三つ目からの時価
for (int i = 1; i < n - 1; i++) {
//時間tの時価入力
cin >> a;
//新たな最大利益
if (second <= a) {
first = m... | #include <algorithm>
#include <iostream>
using namespace std;
// FX取引(最大利益算出)
int main() {
int n, a, first, second, small;
cin >> n >> first >> second;
small = min(first, second);
//三つ目からの時価
for (int i = 1; i < n - 1; i++) {
//時間tの時価入力
cin >> a;
//新たな最大利益
if (second - first <= a - small) {... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]] | 1 | 114 | 6 |
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[200000];
int minid[200000];
int total = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i == 0)
continue;
if (a[minid[i - 1]] > a[i]) {
minid[i] = i;
} else {
minid[i] = minid[... | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[200000];
int minid[200000];
int total = -1000000000;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i == 0)
continue;
if (a[minid[i - 1]] > a[i]) {
minid[i] = i;
} else {
minid[i... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 141 | 2 |
#include <algorithm>
#include <iostream>
int main() {
int n, maxv = -2000000000, minv;
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cin >> n;
int rt[n];
for (int i = 0; i < n; ++i) {
std::cin >> rt[i];
}
minv = rt[0];
for (int i = 1; i < n - 1; ++i) {
maxv = std::max(maxv, rt[i] -... | #include <algorithm>
#include <iostream>
int main() {
int n, maxv = -2000000000, minv;
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cin >> n;
int rt[n];
for (int i = 0; i < n; ++i) {
std::cin >> rt[i];
}
minv = rt[0];
for (int i = 1; i < n; ++i) {
maxv = std::max(maxv, rt[i] - min... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 139 | 2 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
//--------------------... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
//--------------------... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 749 | 4 |
#include <climits>
#include <iostream>
#include <vector>
using ull = unsigned long long;
using ll = long long;
int main() {
uint64_t n;
std::cin >> n;
std::vector<ll> r(n);
for (int i = 0; i < n; ++i) {
std::cin >> r[i];
}
ll r_min = LONG_MAX;
ll profit_max = LONG_MIN;
for (int i = 0; i < n; ++i)... | #include <climits>
#include <iostream>
#include <vector>
using ull = unsigned long long;
using ll = long long;
int main() {
uint64_t n;
std::cin >> n;
std::vector<ll> r(n);
for (int i = 0; i < n; ++i) {
std::cin >> r[i];
}
ll r_min = LONG_MAX;
ll profit_max = LONG_MIN;
for (int i = 1; i < n; ++i)... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 17, 33], ["+", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13]] | 1 | 139 | 4 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int maxv = -1000000000;
int minv;
int R[200000];
for (int t = 0; t < n; t++) {
cin >> R[t];
}
minv = R[0];
for (int j = 0; j < n; j++) {
maxv = max(maxv, R[j] - minv);
minv = min(minv, R[j]);
}
... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int maxv = -1000000000;
int minv;
int R[200000];
for (int t = 0; t < n; t++) {
cin >> R[t];
}
minv = R[0];
for (int j = 1; j < n; j++) {
maxv = max(maxv, R[j] - minv);
minv = min(minv, R[j]);
}
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 116 | 2 |
/*
* Getting Started - Maximum Profit
* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_D&lang=jp
*/
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int maxv = -1000000000;
int minv;
cin >> minv;
for (int i = 2; i < n; i++) {
int v;
c... | /*
* Getting Started - Maximum Profit
* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_D&lang=jp
*/
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int maxv = -1000000000;
int minv;
cin >> minv;
for (int i = 1; i < n; i++) {
int v;
c... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 86 | 2 |
#include "bits/stdc++.h"
using namespace std;
int main() {
int n, min, max = -1000000000;
cin >> n;
int R[200000];
for (int i = 0; i < n; i++)
cin >> R[i];
min = R[0];
for (int i = 1; i < n - 1; i++) {
if (min > R[i])
min = R[i];
if (max < abs(R[i + 1] - min))
max = R[i + 1] - min;... | #include "bits/stdc++.h"
using namespace std;
int main() {
int n, min, max = -1000000000;
cin >> n;
int R[200000];
for (int i = 0; i < n; i++)
cin >> R[i];
min = R[0];
for (int i = 0; i < n - 1; i++) {
if (min > R[i])
min = R[i];
if (max < R[i + 1] - min)
max = R[i + 1] - min;
}
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 2, 63, 22], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 24], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 25]] | 1 | 128 | 5 |
#include <algorithm>
#include <iostream>
#define MAX_N 200010
const int INF = 1 << 30;
int MaxProfit(const int n, const int R[]) {
int max_diff[MAX_N], min = R[0];
max_diff[0] = -INF;
for (int i = 1; i < n; i++) {
max_diff[i] = std::max(max_diff[i - 1], R[i] - min);
min = std::min(min, R[i]);
}
ret... | #include <algorithm>
#include <iostream>
#define MAX_N 200010
const int INF = 1 << 30;
int MaxProfit(const int n, const int R[]) {
int max_diff[MAX_N], min = R[0];
max_diff[0] = -INF;
for (int i = 1; i < n; i++) {
max_diff[i] = std::max(max_diff[i - 1], R[i] - min);
min = std::min(min, R[i]);
}
ret... | [["+", 0, 37, 0, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 37, 0, 69, 341, 342, 0, 16, 12, 13]] | 1 | 174 | 2 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, num[200000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num[i];
}
int minv = num[0], maxv = -20000000000;
for (int i = 1; i < n; i++) {
maxv = max(maxv, num[i] - minv);
minv = min(minv, num[i]);
}
cout <<... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, num[200000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num[i];
}
int minv = num[0], maxv = -2000000000;
for (int i = 1; i < n; i++) {
maxv = max(maxv, num[i] - minv);
minv = min(minv, num[i]);
}
cout << ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 112 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, r[200000], Max = -1000000000, Min;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> r[i];
}
Min = r[0];
for (int i = 0; i < n; i++) {
Max = max(r[i] - Min, Max);
Min = min(r[i], Mi... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, r[200000], Max = -999999999, Min;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> r[i];
}
Min = r[0];
for (int i = 1; i < n; i++) {
Max = max(r[i] - Min, Max);
Min = min(r[i], Min... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 127 | 4 |
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int r;
int maxv = 0;
int minv = 0;
for (int i = 0; i < n; i++) {
cin >> r;
if (i == 0) {
minv = r;
continue;
}
if (maxv < r - minv) {
maxv = r - minv;
}
if (minv > r) {
minv = r;
}... | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int r;
int maxv = 0;
int minv = 0;
for (int i = 0; i < n; i++) {
cin >> r;
if (i == 0) {
minv = r;
continue;
}
if (maxv < r - minv or maxv == 0) {
maxv = r - minv;
}
if (minv > r) {
mi... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 354], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 103 | 4 |
#define pb push_back
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
int pro[300000];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> pro[i];
int ans = 0, min_ = 0;
for (int i = 0; i < n; i++) {
ans = max(ans, pro[i] - pro[min_]);
if (pro[min_] > pro[i])
... | #define pb push_back
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
int pro[300000];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> pro[i];
int ans = INT_MIN, min_ = 0;
for (int i = 1; i < n; i++) {
ans = max(ans, pro[i] - pro[min_]);
if (pro[min_] > pro[i... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 130 | 4 |
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
int main() {
int N;
cin >> N;
int R[N + 2];
int ans = -9999999999999;
for (int... | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <stdio.h>
#include <vector>
using namespace std;
map<int, int> mpa, mpb;
int main() {
int N;
cin >> N;
int R[N + 2];
int ans = -9999999999999;
for (int... | [["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22]] | 1 | 142 | 2 |
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ... | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 162 | 4 |
#include <stdio.h>
using namespace std;
int main() {
int n, min, max = -1e30, tmp;
scanf("%d", &n);
scanf("%d", &min);
for (int i = 0; i < n - 1; i++) {
scanf("%d", &tmp);
if (max < tmp - min)
max = tmp - min;
if (tmp < min)
min = tmp;
}
printf("%d\n");
return 0;
}
| #include <stdio.h>
int main() {
int n, min, max = -1e30, tmp;
scanf("%d", &n);
scanf("%d", &min);
for (int i = 0; i < n - 1; i++) {
scanf("%d", &tmp);
if (max < tmp - min)
max = tmp - min;
if (tmp < min)
min = tmp;
}
printf("%d\n", max);
return 0;
}
| [["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 233], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 256], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 35], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 106 | 6 |
#include <stdio.h>
int main() {
int n, r, max, r_base;
scanf("%d", &n);
scanf("%d", &r_base);
max = 1 - (10 ^ 9);
for (int i = 0; i < n - 1; i++) {
scanf("%d", &r);
if (max < r - r_base) {
max = r - r_base;
}
if (r_base > r) {
r_base = r;
}
}
printf("%d\n", max);
}
| #include <stdio.h>
int main() {
int n, r, max, r_base;
scanf("%d", &n);
scanf("%d", &r_base);
max = 1 - 1000000000;
for (int i = 0; i < n - 1; i++) {
scanf("%d", &r);
if (max < r - r_base) {
max = r - r_base;
}
if (r_base > r) {
r_base = r;
}
}
printf("%d\n", max);
}
| [["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 13], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 140], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["-", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 113 | 6 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> mon;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
mon.push_back(x);
}
vector<int> mi(n);
mi[0] = mon[0];
for (int i = 1; i < n; i++) {
mi[i] = (min(mi[i - ... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<int> mon;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
mon.push_back(x);
}
vector<int> mi(n);
mi[0] = mon[0];
for (int i = 1; i < n; i++) {
mi[i] = (min(mi[i - ... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 235 | 2 |
#include <stdio.h>
int main() {
int n;
int a[1000000] = {};
int min;
int max = -1000000000;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
min = a[0];
for (int j = 1; j < n - 1; j++) {
if (max < a[j] - min) {
max = a[j] - min;
}
if (min > a[j]) {
min = a... | #include <stdio.h>
int main() {
int n;
int a[1000000] = {};
int min;
int max = -1000000000;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
min = a[0];
for (int j = 1; j < n; j++) {
if (max < a[j] - min) {
max = a[j] - min;
}
if (min > a[j]) {
min = a[j];... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 140 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> R(N);
for (int i = 0; i < N; ++i)
cin >> R[i];
int mini = R[0];
int ans = INT_MIN;
for (int i = 0; i < N; ++i) {
ans = max(ans, R[i] - mini);
mini = min(mini, R[i]);
}
cout << ans << endl;
return 0;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> R(N);
for (int i = 0; i < N; ++i)
cin >> R[i];
int mini = R[0];
int ans = INT_MIN;
for (int i = 1; i < N; ++i) {
ans = max(ans, R[i] - mini);
mini = min(mini, R[i]);
}
cout << ans << endl;
return 0;
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 113 | 2 |
#include <iostream>
using namespace std;
#define NMAX 200000
int main() {
int N;
int R[NMAX];
int max[NMAX];
int ans;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> R[i];
}
max[N - 1] = -1;
max[N - 2] = R[N - 1];
for (int i = N - 3; i >= 0; i--) {
if (max[i + 1] < R[i + 1])
max[... | #include <iostream>
using namespace std;
#define NMAX 200000
int main() {
int N;
int R[NMAX];
int max[NMAX];
int ans;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> R[i];
}
max[N - 1] = -1;
max[N - 2] = R[N - 1];
for (int i = N - 3; i >= 0; i--) {
if (max[i + 1] < R[i + 1])
max[... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 205 | 2 |
#include <cstdio>
int main() {
int n;
int R[200000];
int cur_min = 0;
int max = 0;
scanf("%d", &n);
scanf("%d", &R[0]);
cur_min = R[0];
for (int i = 1; i < n; i++) {
scanf("%d", &R[i]);
max = (R[i] - cur_min > max) ? R[i] - cur_min : max;
if (cur_min > R[i]) {
cur_min = R[i];
}
... | #include <cstdio>
int main() {
int n;
int R[200000];
int cur_min = 0;
int max = 0x80000000;
scanf("%d", &n);
scanf("%d", &R[0]);
cur_min = R[0];
for (int i = 1; i < n; i++) {
scanf("%d", &R[i]);
max = (R[i] - cur_min > max) ? R[i] - cur_min : max;
if (cur_min > R[i]) {
cur_min = R[i... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 136 | 2 |
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
long long minv = 1e+9;
long long ans = 0;
for (int i = 0; i < n; i++) {
long long v;
scanf("%lld", &v);
ans = max(ans, v - minv);
minv = min(minv, v);
}
printf("%lld\n", ans... | #include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
long long minv = 2e+9;
long long ans = -2e+9;
for (int i = 0; i < n; i++) {
long long v;
scanf("%lld", &v);
ans = max(ans, v - minv);
minv = min(minv, v);
}
printf("%lld\n",... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 101 | 4 |
#include <algorithm>
#include <climits>
#include <cstdio>
using namespace std;
int getMaxProfit(int[], int);
int main() {
int n;
scanf("%d", &n);
int data[n];
for (int i = 0; i < n; i++)
scanf("%d", &data[i]);
printf("%d\n", getMaxProfit(data, n));
return 0;
}
int getMaxProfit(int data[], int n) {
... | #include <algorithm>
#include <climits>
#include <cstdio>
using namespace std;
int getMaxProfit(int[], int);
int main() {
int n;
scanf("%d", &n);
int data[n];
for (int i = 0; i < n; i++)
scanf("%d", &data[i]);
printf("%d\n", getMaxProfit(data, n));
return 0;
}
int getMaxProfit(int data[], int n) {
... | [["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 178 | 2 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
#define INF 999999999
int in[200001], ma[200001], mi[200001];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> in[i];
mi[0] = in[0];
for (int j = 1; j ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
#define INF 999999999
int in[200001], ma[200001], mi[200001];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> in[i];
mi[0] = in[0];
for (int j = 1; j ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 221 | 2 |
#include <iostream>
#include <limits.h>
using namespace std;
int main(void) {
int n;
int r;
int max = INT_MAX;
int min = 100000000;
cin >> n;
cin >> r;
min = r;
for (int i = 1; i < n; i++) {
cin >> r;
if (r - min > max) {
max = r - min;
}
if (min > r)
min = r;
}
cout ... | #include <iostream>
#include <limits.h>
using namespace std;
int main(void) {
int n;
int r;
int max = -2000000000;
int min;
cin >> n;
cin >> r;
min = r;
for (int i = 1; i < n; i++) {
cin >> r;
if (r - min > max) {
max = r - min;
}
if (min > r)
min = r;
}
cout << max <... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 98 | 4 |
# -*- coding: utf-8 -*-
import math
def is_prime(x):
# Primality Test
if x == 2:
return True
if x <= 1 or x % 2 == 0:
return False
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return False
i += 2
return True
def to_int(v):
return int(v)
i... | # -*- coding: utf-8 -*-
import math
def is_prime(x):
# Primality Test
if x == 2:
return True
if x <= 1 or x % 2 == 0:
return False
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return False
i += 2
return True
def to_int(v):
return int(v)
i... | [["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 121 | 2 |
import math
def isprime(num):
if num == 2:
return True
if num == 1 or num % 2 == 0:
return False
i = 3
for i in range(3, math.floor(math.sqrt(num)), 2):
if num % i == 0:
return False
return True
def count_prime_numbers(number_list):
cnt = 0
for target i... | import math
def isprime(num):
if num == 2:
return True
if num == 1 or num % 2 == 0:
return False
i = 3
for i in range(3, math.floor(math.sqrt(num))+1, 2):
if num % i == 0:
return False
return True
def count_prime_numbers(number_list):
cnt = 0
for target... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 121 | 2 |
n = int(input())
c = 0
def devisor(n):
if n == 2:
return 1
else:
if n < 2 or n % 2 == 0:
return 0
elif pow(2,n-1,n) == 1:
return 1
for i in range(n):
x = int(input())
c += devisor(x)
print(c) | n = int(input())
c = 0
def devisor(n):
if n == 2:
return 1
else:
if n < 2 or n % 2 == 0:
return 0
elif pow(2,n-1,n) == 1:
return 1
else: return 0
for i in range(n):
x = int(input())
c += devisor(x)
print(c) | [["+", 75, 76, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 37, 0, 38], ["+", 0, 57, 75, 76, 8, 196, 0, 37, 0, 612]] | 5 | 81 | 4 |
def p(n):
if n==2:return 1
if not n&1:return 0
return pow(2,n-1,n)
print(sum(1 for _ in range(int(input())) if p(int(input())))) | def p(n):
if n==2:return 1
if not n&1:return 0
return pow(2,n-1,n)==1
print(sum(1 for _ in range(int(input())) if p(int(input())))) | [["+", 0, 14, 8, 196, 0, 37, 0, 666, 667, 60], ["+", 0, 14, 8, 196, 0, 37, 0, 666, 0, 612]] | 5 | 61 | 2 |
import math
def is_prime(x):
if x == 2:
return True
if (x == 1) or (x % 2 == 0):
return False
for i in range(3, math.ceil(math.sqrt(x)), 2):
if x % i == 0:
return False
return True
if __name__ == '__main__':
element_number = int(input())
input_array =... | import math
def is_prime(x):
if x == 2:
return True
if (x == 1) or (x % 2 == 0):
return False
for i in range(3, math.ceil(math.sqrt(x))+1, 2):
if x % i == 0:
return False
return True
if __name__ == '__main__':
element_number = int(input())
input_array... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 120 | 2 |
import math
def is_prime(x):
if x == 2:
return True
if (x == 1) or (x % 2 == 0):
return False
for i in range(3, math.ceil(math.sqrt(x))+1, 2):
if x % i == 0:
return False
return True
if __name__ == '__main__':
element_number = int(input())
output = 0... | import sys
import math
def is_prime(x):
if x == 2:
return True
if (x == 1) or (x % 2 == 0):
return False
for i in range(3, math.ceil(math.sqrt(x))+1, 2):
if x % i == 0:
return False
return True
if __name__ == '__main__':
element_number = int(input())
... | [["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487]] | 5 | 116 | 2 |
import math
def isprime(x):
if x == 2:
return True
elif x < 2 or x % 2 == 0:
return False
else:
for i in range(3, int(math.sqrt(x)),2):
if x % i == 0:
return False
return True
n = int(input())
cnt = 0
for i in range(n):
x = int(input())
if isprime(x):
cnt += 1
print(str(cnt)) | import math
def isprime(x):
if x == 2:
return True
elif x < 2 or x % 2 == 0:
return False
else:
for i in range(3, int(math.sqrt(x)) + 1,2):
if x % i == 0:
return False
return True
n = int(input())
cnt = 0
for i in range(n):
x = int(input())
if isprime(x):
cnt += 1
print(str(cnt)) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 104 | 2 |
def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
l = x ** 0.5
for i in range(3, int(x ** 0.5), 2):
if x % i == 0:
return 0
return 1
import sys
def solve():
file_input = sys.stdin
N = file_input.readline()
cnt = 0
for l in file_input... | def is_prime(x):
if x == 2:
return 1
elif x % 2 == 0:
return 0
l = x ** 0.5
for i in range(3, int(x ** 0.5) + 1, 2):
if x % i == 0:
return 0
return 1
import sys
def solve():
file_input = sys.stdin
N = file_input.readline()
cnt = 0
for l in file_i... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 98 | 2 |
def isPrime(x):
if x==2:
return True
if x<2 or x%2==0:
return False
for n in range(3,round(x**0.5),2):
if x%n==0:
return False
return True
n=int(input())
num=[int(input()) for i in range(n)]
i=0
for nm in num:
if isPrime(nm):
i+=1... | def isPrime(x):
if x==2:
return True
if x<2 or x%2==0:
return False
for n in range(3,int(x**0.5)+1,2):
if x%n==0:
return False
return True
n=int(input())
num=[int(input()) for i in range(n)]
i=0
for nm in num:
if isPrime(nm):
i+=1
p... | [["-", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 100 | 4 |
import math
def judge(n):
if n<2:
return False
i=2
while i<=math.sqrt(n):
if n%i==0:
return False
i+=1
return True
count=0
n=int(input())
for i in range(n):
if judge(int(input())):
count+=1 | import math
def judge(n):
if n < 2:
return False
i = 2
while i <= math.sqrt(n):
if n % i == 0:
return False
i += 1
return True
count = 0
n = int(input())
for i in range(n):
if judge(int(input())):
count += 1
print(count) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 75 | 4 |
def isPrime(n):
if n == 2 or n == 3:
return True
elif n == 1 or n % 2 == 0 or n % 3 == 0:
return False
N = int(n ** 0.5)
for i in range(5, N, 2):
if n % i == 0:
return False
return True
N = int(input())
ans = 0
for _ in range(N):
a = int(input())
ans += 1... | def isPrime(n):
if n == 2 or n == 3:
return True
elif n == 1 or n % 2 == 0 or n % 3 == 0:
return False
N = int(n ** 0.5)
for i in range(5, N + 1, 2):
if n % i == 0:
return False
return True
N = int(input())
ans = 0
for _ in range(N):
a = int(input())
ans ... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 108 | 2 |
import math
n = int(eval(input()))
count = 0
b = 0
for i in range(n):
a = int(eval(input()))
h = math.trunc(math.sqrt(a))+1
if a == 1:
b = 1
if a == 2:
b = 0
elif a % 2 == 0:
b = 1
else:
i = 3
while i <= h:
if a % i == 0:
b = 1
... | import math
n = int(eval(input()))
count = 0
for i in range(n):
a = int(eval(input()))
h = math.trunc(math.sqrt(a))+1
b = 0
if a == 1:
b = 1
if a == 2:
b = 0
elif a % 2 == 0:
b = 1
else:
i = 3
while i <= h:
if a % i == 0:
b ... | [["-", 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, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]] | 5 | 114 | 6 |
import math
ans = 0
N = int(input())
for i in range(N):
a = int(input())
if a == 2:
ans += 1
elif a%2 == 0:
continue
else:
if math.pow(2, a-1, a) == 1:
ans += 1
print(ans) | ans = 0
N = int(input())
for i in range(N):
a = int(input())
if a == 2:
ans += 1
elif a%2 == 0:
continue
else:
if pow(2, a-1, a) == 1:
ans += 1
print(ans) | [["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 0, 57, 15, 666, 0, 652, 63, 319, 500, 22], ["-", 0, 57, 15, 666, 0, 652, 63, 319, 0, 131]] | 5 | 70 | 4 |
n = int(input())
count = 0
for i in range(n):
x = int(input())
if x == 2:
count += 1
elif x % 2 == 0:
continue
else:
if pow(2, x - 1, x):
count += 1
print(count) | n = int(input())
count = 0
for i in range(n):
x = int(input())
if x == 2:
count += 1
elif x % 2 == 0:
continue
else:
if pow(2, x - 1, x) == 1:
count += 1
print(count) | [["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612]] | 5 | 64 | 2 |
import math
N = int(input())
ans = 0
def solve(x):
if x==2:
return 1
elif x%2:
return 0
else:
for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
if x%i ==0:
return 0
return 1
for i in range(N):
if solve(int(input())) ==1:
ans +=1
prin... | import math
N = int(input())
ans = 0
def solve(x):
if x==2:
return 1
elif x%2==0:
return 0
else:
for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
if x%i ==0:
return 0
return 1
for i in range(N):
if solve(int(input())) ==1:
ans +=1
p... | [["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 60], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612]] | 5 | 98 | 2 |
n = int(input())
def isprime(m):
if m == 2:
return 1
elif m < 2 or m % 2 == 0:
return 0
else:
p = 3
while p < m**0.5:
if m % p == 0:
return 0
p = p + 2
return 1
cnt = 0
for i in range(n):
cnt += isprime(int(input()))
print(cnt) | n = int(input())
def isprime(m):
if m == 2:
return 1
elif m < 2 or m % 2 == 0:
return 0
else:
p = 3
while p <= m**0.5:
if m % p == 0:
return 0
p = p + 2
return 1
cnt = 0
for i in range(n):
cnt += isprime(int(input()))
#print("*{:}".format(cnt))
#print("")
print(cnt) | [["-", 75, 76, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 75, 76, 8, 196, 0, 52, 15, 666, 667, 19]] | 5 | 88 | 2 |
import math
n=int(input())
s=0
for i in range(n):
a=int(input())
b=math.ceil(a**0.5)
if a==2:
s+=1
elif a%2==0 or a < 2:
continue
else:
c=0
for j in range(3,a+1,2):
if a%j==0:
c+=1
break
if c==0:
s+=1
pri... | import math
n=int(input())
s=0
for i in range(n):
a=int(input())
b=math.ceil(a**0.5)
if a==2:
s+=1
elif a%2==0 or a < 2:
continue
else:
c=0
for j in range(3,b+1,2):
if a%j==0:
c+=1
break
if c==0:
s+=1
pri... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]] | 5 | 101 | 2 |
def main():
N = int(input())
print(IsPrime(N))
def IsPrime(N):
count = 0
for i in range(N):
inputNum = int(input())
if(inputNum == 2):
count += 1
continue
elif(inputNum % 2 == 0):
continue
flag = 0
for j in range(3, int(pow(in... | def main():
N = int(input())
print(IsPrime(N))
def IsPrime(N):
count = 0
for i in range(N):
inputNum = int(input())
if(inputNum == 2):
count += 1
continue
elif(inputNum % 2 == 0):
continue
flag = 0
for j in range(3, int(pow(in... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 127 | 2 |
for _ in[0]*int(input()):
x=int(input())
if 2 in[x,pow(2,x,x)]:c+=1
print(c)
| c=0
for _ in[0]*int(input()):
x=int(input())
if 2 in[x,pow(2,x,x)]:c+=1
print(c)
| [["+", 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]] | 5 | 45 | 3 |
import sys
input()
print(len(1 for x in map(int,sys.stdin)if 2 in[x,pow(2,x,x)]))
| import sys
input()
print(len([1 for x in map(int,sys.stdin)if 2 in[x,pow(2,x,x)]]))
| [["+", 3, 4, 0, 652, 3, 4, 0, 658, 0, 70], ["+", 0, 658, 0, 678, 0, 666, 0, 634, 0, 73]] | 5 | 38 | 2 |
import sys
input()
print(len(1 for x in map(int,sys.stdin)if 2 in[x,pow(2,x,x)]))
| import sys
input()
print(sum(1 for x in map(int,sys.stdin)if 2 in[x,pow(2,x,x)]))
| [["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]] | 5 | 38 | 2 |
import math
N = int(input())
count = 0
for _ in range(N):
m = int(input())
rm = int(math.sqrt(m))
flag = 0
for i in range(2,rm+1):
if m %rm ==0:
flag = 1
break
if flag ==0 :count=count +1
##print(m,flag)
print(count) | import math
N = int(input())
count = 0
for _ in range(N):
m = int(input())
rm = int(math.sqrt(m))
flag = 0
for i in range(2,rm+1):
if m %i ==0:
flag = 1
break
if flag ==0 :count=count +1
print(count) | [["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]] | 5 | 81 | 2 |
def is_prime(x):
if x==2:
return 1
elif x&1==0:
return 0
elif pow(2,x-1,x)==1:
return 1
else:
return 0
N = int(input())
for i in range(N):
n=int(input())
c+=is_prime(n)
print(c) | def is_prime(x):
if x==2:
return 1
elif x&1==0:
return 0
elif pow(2,x-1,x)==1:
return 1
else:
return 0
N = int(input())
c=0
for i in range(N):
n=int(input())
c+=is_prime(n)
print(c) | [["+", 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]] | 5 | 76 | 3 |
# coding: UTF-8
n = int(input())
count = 0
for i in range(n):
num = int(input())
if (num < 2):
continue
elif (num == 2):
count += 1
continue
elif (num % 2 == 0):
continue
if pow(2,num-1,num):
count += 1
print(count)
| # coding: UTF-8
n = int(input())
count = 0
for i in range(n):
num = int(input())
if (num < 2):
continue
elif (num == 2):
count += 1
continue
elif (num % 2 == 0):
continue
if pow(2,num-1,num) == 1:
count += 1
print(count)
| [["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]] | 5 | 76 | 2 |
from math import sqrt
def prime_numbers(n):
total = 0
for x in n:
if is_prime(x):
total += 1
return total
def is_prime(x):
if x == 2:
return True
elif x < 2 or x % 2 ==0:
return False
for i in range(3, int(sqrt(x)), 2):
if x % i == 0:
re... | from math import sqrt
def prime_numbers(n):
total = 0
for x in n:
if is_prime(x):
total += 1
return total
def is_prime(x):
if x == 2:
return True
elif x < 2 or x % 2 == 0:
return False
for i in range(3, int(sqrt(x)) + 1, 2):
if x % i == 0:
... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 126 | 2 |
import math
def is_prime(x):
if x == 2:
return True
if x < 2 or x % 2 == 0:
return False
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return False
i = i + 2
return True
n = int(input())
numbers = [int(input()) for i in n]
count = 0
for i in range... | import math
def is_prime(x):
if x == 2:
return True
if x < 2 or x % 2 == 0:
return False
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return False
i = i + 2
return True
n = int(input())
numbers = [int(input()) for i in range(n)]
count = 0
for i i... | [["+", 0, 662, 12, 658, 0, 659, 12, 652, 63, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 25]] | 5 | 108 | 3 |
from math import sqrt
n=int(input())
count=0
for i in range(n):
x=int(input())
if x==1:
count=count+1
elif x!=2 and x%2==0:
count=count
elif x==2 or x==3 or x==5:
count=count
else:
for j in range(2,int(sqrt(x))+1):
print(j)
if x%j==0:
... | from math import sqrt
n=int(input())
count=0
for i in range(n):
x=int(input())
if x==1:
count=count+1
elif x!=2 and x%2==0:
count=count+1
elif x==2 or x==3 or x==5:
count=count
else:
for j in range(2,int(sqrt(x))+1):
if x%j==0:
count=co... | [["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 114 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.