problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k ⌀ | fixed_code stringlengths 12 526k ⌀ | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M ⌀ | fixed_submission_id int64 2 1.54M ⌀ | user_id stringlengths 10 10 ⌀ | language stringclasses 9 values |
|---|---|---|---|---|---|---|---|
p02953 | #include <iostream>
using namespace std;
int main() {
long long n, i, f = 0, a[100010], j = 1;
cin >> n;
cin >> a[0];
for (i = 1; i < n; i++) {
long long c;
cin >> c;
if (c != a[j - 1])
a[j++] = c;
}
if (n == 1)
cout << "Yes" << endl;
else if (n == 2 && a[0] - a[1] < 2)
cout << "Yes" << endl;
else if (n == 2 && a[0] - a[1] > 1)
cout << "No" << endl;
else {
for (i = 0; i < j - 2; i++) {
if (a[i] > a[i + 1] && a[i + 1] > a[i + 2]) {
f = 0;
break;
} else if (a[i] - a[i + 1] > 1) {
f = 0;
break;
} else
f = 1;
}
if (f == 1 && a[j - 2] - a[j - 1] < 2)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long n, i, f = 0, a[100010], j = 1;
cin >> n;
cin >> a[0];
for (i = 1; i < n; i++) {
long long c;
cin >> c;
if (c != a[j - 1])
a[j++] = c;
}
if (j == 1)
cout << "Yes" << endl;
else if (j == 2 && a[0] - a[1] < 2)
cout << "Yes" << endl;
else if (j == 2 && a[0] - a[1] > 1)
cout << "No" << endl;
else {
for (i = 0; i < j - 2; i++) {
if (a[i] > a[i + 1] && a[i + 1] > a[i + 2]) {
f = 0;
break;
} else if (a[i] - a[i + 1] > 1) {
f = 0;
break;
} else
f = 1;
}
if (f == 1 && a[j - 2] - a[j - 1] < 2)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 757,374 | 757,375 | u283026992 | cpp |
p02953 | #include <stdio.h>
int main() {
int N, i, ans = 0;
scanf("%d", &N);
int H[N];
for (i = 0; i < N; i++) {
scanf("%d", &H[i]);
}
for (i = 0; i < N - 1; i++) {
if (H[i] + 1 == H[i + 1]) {
H[i + 1] += 1;
} else if (H[i] > H[i + 1] + 1) {
ans = 1;
}
}
if (ans == 1) {
printf("NO");
} else {
printf("YES");
}
} | #include <stdio.h>
int main() {
int N, i, ans = 0;
scanf("%d", &N);
int H[N];
for (i = 0; i < N; i++) {
scanf("%d", &H[i]);
}
for (i = 0; i < N - 1; i++) {
if (H[i] == H[i + 1] + 1) {
H[i + 1] += 1;
} else if (H[i] > H[i + 1] + 1) {
ans = 1;
}
}
if (ans == 1) {
printf("No");
} else {
printf("Yes");
}
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change",
"misc.off_by_one",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,376 | 757,377 | u911952711 | cpp |
p02953 | #include <stdio.h>
int main() {
int N, i, ans = 0;
scanf("%d", &N);
int H[N];
for (i = 0; i < N; i++) {
scanf("%d", &H[i]);
}
for (i = 0; i < N - 1; i++) {
if (H[i] == H[i + 1] + 1) {
H[i + 1] += 1;
} else if (H[i] > H[i + 1] + 1) {
ans = 1;
}
}
if (ans == 1) {
printf("NO");
} else {
printf("YES");
}
} | #include <stdio.h>
int main() {
int N, i, ans = 0;
scanf("%d", &N);
int H[N];
for (i = 0; i < N; i++) {
scanf("%d", &H[i]);
}
for (i = 0; i < N - 1; i++) {
if (H[i] == H[i + 1] + 1) {
H[i + 1] += 1;
} else if (H[i] > H[i + 1] + 1) {
ans = 1;
}
}
if (ans == 1) {
printf("No");
} else {
printf("Yes");
}
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,378 | 757,377 | u911952711 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("INP.txt", "r", stdin);
// freopen("OUT.txt", "w", stdout);
ll n;
cin >> n;
vector<ll> hold(n);
for (ll i = 0; i < n; i++) {
cin >> hold[i];
}
for (ll i = n - 1; i >= 0; i++) {
if (hold[i] > hold[i + 1]) {
if (hold[i] - 1 <= hold[i + 1]) {
hold[i]--;
} else {
cout << "No" << '\n';
}
}
}
cout << "Yes" << '\n';
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("INP.txt", "r", stdin);
// freopen("OUT.txt", "w", stdout);
ll n;
cin >> n;
vector<ll> hold(n);
for (ll i = 0; i < n; i++) {
cin >> hold[i];
}
for (ll i = n - 2; i >= 0; i--) {
if (hold[i] > hold[i + 1]) {
if (hold[i] - 1 <= hold[i + 1]) {
hold[i]--;
} else {
cout << "No" << '\n';
return 0;
}
}
}
cout << "Yes" << '\n';
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operation.binary.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 757,379 | 757,380 | u508700891 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int h, H;
cin >> H;
H--;
for (int i = 0; i < N; i++) {
cin >> h;
if (H - h >= 1) {
cout << "No" << endl;
return 0;
;
}
if (h > H)
H = h - 1;
}
cout << "Yes" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int h, H;
cin >> H;
H--;
for (int i = 1; i < N; i++) {
cin >> h;
if (H - h >= 1) {
cout << "No" << endl;
return 0;
;
}
if (h > H)
H = h - 1;
}
cout << "Yes" << endl;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 757,383 | 757,384 | u259672270 | cpp |
p02953 | #include <iostream>
using namespace std;
int main(void) {
int n;
cin >> n;
int h, currentH;
cin >> currentH;
for (int i = 1; i < n; i++) {
cin >> h;
if (currentH - h >= 2) {
cout << "No";
return 0;
} else if (h > currentH) {
currentH = h - 1;
}
}
cout << "Yes";
}
| #include <iostream>
using namespace std;
int main(void) {
int n;
cin >> n;
int h, currentH;
cin >> currentH;
currentH--;
for (int i = 1; i < n; i++) {
cin >> h;
if (currentH - h >= 1) {
cout << "No";
return 0;
}
if (h > currentH) {
currentH = h - 1;
}
}
cout << "Yes";
}
| [
"expression.unary.arithmetic.add",
"literal.number.change",
"control_flow.branch.if.condition.change",
"control_flow.branch.if.replace.add",
"control_flow.branch.else_if.replace.remove"
] | 757,385 | 757,386 | u496279623 | cpp |
p02953 | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int current_val = 0;
int max_val = 0;
int flg = 0;
for (int i = 0; i < N; i++) {
cin >> current_val;
if (max_val <= current_val) {
max_val = current_val;
} else if (max_val - 1 <= current_val) {
max_val = max_val;
} else {
flg = 1;
}
}
if (flg == 0)
cout << "yes";
else
cout << "no";
return 0;
} | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int current_val = 0;
int max_val = 0;
int flg = 0;
for (int i = 0; i < N; i++) {
cin >> current_val;
if (max_val <= current_val) {
max_val = current_val;
} else if (max_val - 1 <= current_val) {
max_val = max_val;
} else {
flg = 1;
}
}
if (flg == 0)
cout << "Yes";
else
cout << "No";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,387 | 757,388 | u616025987 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast \
ios::sync_with_stdio(false); \
cin.tie(NULL);
/////////////////////////////////////////////
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define debug(x...)
#endif
////////////////////////////////
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (auto &i : a)
cin >> i;
for (int i = 0; i < n; ++i) {
if (i == 0) {
if (a[i] > 1)
a[i]--;
} else {
if (a[i] > a[i - 1]) {
a[i]--;
}
}
}
bool f = false;
for (int i = 0; i < n - 1; ++i) {
if (a[i] > a[i + 1])
f = true;
}
if (f) {
cout << "NO\n";
} else
cout << "YES\n";
}
signed main(int argc, char *argv[]) {
fast;
int t = 1;
// cin>>t;
while (t--)
solve();
} | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast \
ios::sync_with_stdio(false); \
cin.tie(NULL);
/////////////////////////////////////////////
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define debug(x...)
#endif
////////////////////////////////
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (auto &i : a)
cin >> i;
for (int i = 0; i < n; ++i) {
if (i == 0) {
if (a[i] > 1)
a[i]--;
} else {
if (a[i] > a[i - 1]) {
a[i]--;
}
}
}
bool f = false;
for (int i = 0; i < n - 1; ++i) {
if (a[i] > a[i + 1])
f = true;
}
if (f) {
cout << "No\n";
} else
cout << "Yes\n";
}
signed main(int argc, char *argv[]) {
fast;
int t = 1;
// cin>>t;
while (t--)
solve();
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,393 | 757,394 | u487128874 | cpp |
p02953 |
#include <bits/stdc++.h>
using namespace std;
/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */
/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i > (b); --i)
#define FOR_ALL(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define FOR_ALLR(i, c) \
for (__typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); ++i)
#define SZ(array) (sizeof(array) / sizeof(array[0]))
#define lc(x) (x << 1) /* 2*x */
#define rc(x) (x << 1 | 1) /* 2*x+1 */
#define lowbit(x) (x & (-x)) /* 0b10100 -> 0b100 */
typedef long long LL;
typedef map<int, int> MII;
typedef pair<int, int> PII;
typedef set<int> SI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<int> VI;
typedef vector<string> VS;
/* check if a key is in container C */
template <class C> inline bool in_(const typename C::key_type &k, const C &A) {
return A.find(k) != A.end();
}
inline bool in_(const string &s, const string &S) {
return S.find(s) != string::npos;
}
const int inf = 1e9;
int main() {
#ifdef foo_
freopen("foo", "rt", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
int n;
while (cin >> n) {
int h = -inf;
bool good = true;
FOR(i, 0, n) {
int x;
cin >> x;
if (x < h) {
good = false;
break;
}
if (x > h)
h = --x;
else
h = x;
}
if (good)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */
/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i > (b); --i)
#define FOR_ALL(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define FOR_ALLR(i, c) \
for (__typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); ++i)
#define SZ(array) (sizeof(array) / sizeof(array[0]))
#define lc(x) (x << 1) /* 2*x */
#define rc(x) (x << 1 | 1) /* 2*x+1 */
#define lowbit(x) (x & (-x)) /* 0b10100 -> 0b100 */
typedef long long LL;
typedef map<int, int> MII;
typedef pair<int, int> PII;
typedef set<int> SI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<int> VI;
typedef vector<string> VS;
/* check if a key is in container C */
template <class C> inline bool in_(const typename C::key_type &k, const C &A) {
return A.find(k) != A.end();
}
inline bool in_(const string &s, const string &S) {
return S.find(s) != string::npos;
}
const int inf = 1e9;
int main() {
#ifdef foo_
freopen("foo", "rt", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
int n;
while (cin >> n) {
int h = -inf;
bool good = true;
FOR(i, 0, n) {
int x;
cin >> x;
if (x < h)
good = false;
else if (x > h)
h = --x;
else
h = x;
}
if (good)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
| [] | 757,395 | 757,396 | u668711082 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define zzz \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0);
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
int main() {
zzz;
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 0; i < n - 1; ++i) {
if (a[i + 1] > a[i])
a[i + 1]--;
else if (a[i + 1] == a[i])
continue;
else {
cout << "NO";
return 0;
}
}
cout << "YES";
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define zzz \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0);
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
int main() {
zzz;
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 0; i < n - 1; ++i) {
if (a[i + 1] > a[i])
a[i + 1]--;
else if (a[i + 1] == a[i])
continue;
else {
cout << "No";
return 0;
}
}
cout << "Yes";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,401 | 757,402 | u608668320 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i < n; i++) {
if (a[i] > a[i + 1]) {
a[i]--;
}
}
for (int i = 1; i < n; i++) {
if (a[i] > a[i + 1]) {
cout << "NO";
return 0;
}
}
cout << "YES";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
if (a[i] > a[i - 1]) {
a[i]--;
}
}
for (int i = 1; i < n; i++) {
if (a[i] > a[i + 1]) {
cout << "No";
return 0;
}
}
cout << "Yes";
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,405 | 757,404 | u542075673 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
#define speed_up \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main() {
speed_up ll n, flag = 1;
cin >> n;
ll h[n];
rep(i, 0, n) cin >> h[i];
rep(i, 1, n) {
if (h[i] >= h[i - 1] + 1)
h[i - 1] -= 1;
}
rep(i, 0, n - 1) {
if (h[i] > h[i + 1]) {
flag = 0;
break;
}
}
if (flag)
cout << "Yes";
else
cout << "No";
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define speed_up \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main() {
speed_up ll n, flag = 1;
cin >> n;
ll h[n];
rep(i, 0, n) cin >> h[i];
rep(i, 1, n) {
if (h[i] >= h[i - 1] + 1)
h[i]--;
}
rep(i, 0, n - 1) {
if (h[i] > h[i + 1]) {
flag = 0;
break;
}
}
if (flag)
cout << "Yes";
else
cout << "No";
return 0;
} | [
"expression.operation.binary.remove"
] | 757,408 | 757,409 | u223028888 | cpp |
p02953 | #include <bits/stdc++.h>
typedef long long ll;
#define REP(i, a, b) for (int i = a; i < b; i++)
#define IN(n) \
int n; \
cin >> n;
#define ARR(arr, i, n) \
int arr[n]; \
REP(i, 0, n) { cin >> arr[i]; }
#define MOD 1000000007
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
// code comes here
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
if (n == 1) {
cout << "No" << endl;
} else {
int i;
for (i = n - 1; i >= 0; i--) {
if (h[i] - h[i + 1] > 0) {
if (h[i] - h[i + 1] == 1) {
h[i] = h[i] - 1;
} else {
cout << "No" << endl;
break;
}
}
}
if (i < 0) {
cout << "Yes" << endl;
}
}
return 0;
}
| #include <bits/stdc++.h>
typedef long long ll;
#define REP(i, a, b) for (int i = a; i < b; i++)
#define IN(n) \
int n; \
cin >> n;
#define ARR(arr, i, n) \
int arr[n]; \
REP(i, 0, n) { cin >> arr[i]; }
#define MOD 1000000007
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
// code comes here
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
if (n == 1) {
cout << "Yes" << endl;
} else {
int i;
for (i = n - 2; i >= 0; i--) {
if (h[i] - h[i + 1] > 0) {
if (h[i] - h[i + 1] == 1) {
h[i] = h[i] - 1;
} else {
cout << "No" << endl;
break;
}
}
}
if (i < 0) {
cout << "Yes" << endl;
}
}
return 0;
}
| [
"literal.string.change",
"io.output.change",
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 757,413 | 757,412 | u447706255 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
int h[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int a = 0;
for (int i = 0; i < n - 1; i++) {
if (a > h[i]) {
cout << "No";
return 0;
}
if (a < h[i]) {
h[i]--;
a = h[i];
} else {
a = h[i];
}
}
cout << "Yes";
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
int h[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int a = 0;
for (int i = 0; i < n; i++) {
if (a > h[i]) {
cout << "No";
return 0;
} else if (a < h[i]) {
h[i]--;
a = h[i];
} else {
a = h[i];
}
}
cout << "Yes";
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.branch.else_if.replace.add",
"control_flow.branch.if.replace.remove"
] | 757,414 | 757,415 | u817464145 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
int h[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int a = 0;
for (int i = 0; i < n - 1; i++) {
if (a > h[i]) {
cout << "No";
}
if (a < h[i]) {
h[i]--;
a = h[i];
} else {
a = h[i];
}
}
cout << "Yes";
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n;
int h[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int a = 0;
for (int i = 0; i < n; i++) {
if (a > h[i]) {
cout << "No";
return 0;
} else if (a < h[i]) {
h[i]--;
a = h[i];
} else {
a = h[i];
}
}
cout << "Yes";
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.return.add",
"control_flow.return.0.add",
"control_flow.branch.else_if.replace.add",
"control_flow.branch.if.replace.remove"
] | 757,416 | 757,415 | u817464145 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> h(n), tmp(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
tmp[i] = h[i];
}
bool flag = true;
for (int i = n; i > 0; i--) {
if (h[i - 1] - h[i] == 1)
h[i - 1]--;
else if (h[i - 1] - h[i] > 0)
flag = false;
}
cout << (flag ? "Yes" : "No") << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> h(n), tmp(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
tmp[i] = h[i];
}
bool flag = true;
for (int i = n - 1; i > 0; i--) {
if (h[i - 1] - h[i] == 1)
h[i - 1]--;
else if (h[i - 1] - h[i] > 0)
flag = false;
}
cout << (flag ? "Yes" : "No") << endl;
return 0;
} | [
"control_flow.loop.for.initializer.change"
] | 757,428 | 757,429 | u525137785 | cpp |
p02953 | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(), v.end()
#define rep(i, a, b) for (i = (ll)a; i < (ll)b; i++)
#define revrep(i, a, b) for (i = (ll)a; i >= (ll)b; i--)
#define ii pair<ll, ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a, ll b) {
ll res = 1;
while (b > 0) {
if (b & 1)
res = (res * a) % mod;
a = (a * a) % mod;
b /= 2;
}
return res;
}
#define rs resize
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cout.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
const ll N = 100009;
ll i, n, w;
ll a[N];
bool p;
int main() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
rep(i, 1, n + 1) cin >> a[i];
p = 1;
w = a[1];
rep(i, 2, n + 1) {
if (a[i] < w) {
p = 0;
break;
}
w = max(w, a[i] - 1);
}
if (!p) {
p = 1;
w = a[n];
revrep(i, n - 1, 1) {
if (a[i] - 1 > w) {
p = 0;
break;
}
w = max(w, a[i] - 1);
}
if (!p) {
p = 1;
w = a[1] - 1;
rep(i, 2, n + 1) {
if (a[i] < w) {
p = 0;
break;
}
w = max(w, a[i] - 1);
}
if (!p) {
w = a[n] - 1;
p = 1;
revrep(i, n - 1, 1) {
if (a[i] - 1 > w) {
p = 0;
break;
}
w = max(w, a[i] - 1);
}
}
}
}
cout << (p ? "Yes" : "No");
return 0;
} | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(), v.end()
#define rep(i, a, b) for (i = (ll)a; i < (ll)b; i++)
#define revrep(i, a, b) for (i = (ll)a; i >= (ll)b; i--)
#define ii pair<ll, ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a, ll b) {
ll res = 1;
while (b > 0) {
if (b & 1)
res = (res * a) % mod;
a = (a * a) % mod;
b /= 2;
}
return res;
}
#define rs resize
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cout.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
const ll N = 100009;
ll i, n, w;
ll a[N];
bool p;
int main() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
rep(i, 1, n + 1) cin >> a[i];
p = 1;
w = a[1];
rep(i, 2, n + 1) {
if (a[i] < w) {
p = 0;
break;
}
w = max(w, a[i] - 1);
}
if (!p) {
p = 1;
w = a[n];
revrep(i, n - 1, 1) {
if (a[i] - 1 > w) {
p = 0;
break;
}
w = min(w, a[i]);
}
if (!p) {
p = 1;
w = a[1] - 1;
rep(i, 2, n + 1) {
if (a[i] < w) {
p = 0;
break;
}
w = max(w, a[i] - 1);
}
if (!p) {
w = a[n] - 1;
p = 1;
revrep(i, n - 1, 1) {
if (a[i] - 1 > w) {
p = 0;
break;
}
w = min(w, a[i]);
}
}
}
}
cout << (p ? "Yes" : "No");
return 0;
} | [
"misc.opposites",
"assignment.value.change",
"identifier.change",
"call.function.change",
"expression.operation.binary.remove"
] | 757,442 | 757,443 | u794573819 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int n, h[100010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &h[i]);
for (int i = n; i > 1; i--)
if (h[i - 1] - h[i] >= 2) {
printf("NO\n");
return 0;
} else if (h[i - 1] - h[i] == 1)
h[i - 1]--;
printf("YES\n");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n, h[100010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &h[i]);
for (int i = n; i > 1; i--)
if (h[i - 1] - h[i] >= 2) {
printf("No\n");
return 0;
} else if (h[i - 1] - h[i] == 1)
h[i - 1]--;
printf("Yes\n");
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,447 | 757,448 | u829878015 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat (i, a, b) for (int i = (a); i < (b); i++)
#define rep (i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
const int MAX_N = 1e5 + 5;
int main() {
int n, t, i;
cin >> n;
vector<int> height;
vector<bool> lock(n, false);
if (n == 1) {
puts("Yes");
return 0;
}
for (i = 0; i < n; i++) {
cin >> t;
height.push_back(t);
}
for (i = 0; i < n - 1; i++) {
debug(i);
if (height[i] > height[i + 1]) {
if (!lock[i]) {
height[i]--;
lock[i] = true;
if (i - 1 >= 0 && height[i - 1] > height[i]) {
i = i - 2;
}
}
}
}
for (i = 0; i < n - 1; i++) {
if (height[i] > height[i + 1]) {
puts("No");
return 0;
}
}
puts("Yes");
}
| #include <bits/stdc++.h>
using namespace std;
// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat (i, a, b) for (int i = (a); i < (b); i++)
#define rep (i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
const int MAX_N = 1e5 + 5;
int main() {
int n, t, i;
cin >> n;
vector<int> height;
vector<bool> lock(n, false);
if (n == 1) {
puts("Yes");
return 0;
}
for (i = 0; i < n; i++) {
cin >> t;
height.push_back(t);
}
for (i = 0; i < n - 1; i++) {
if (height[i] > height[i + 1]) {
if (!lock[i]) {
height[i]--;
lock[i] = true;
if (i - 1 >= 0 && height[i - 1] > height[i]) {
i = i - 2;
}
}
}
}
for (i = 0; i < n - 1; i++) {
if (height[i] > height[i + 1]) {
puts("No");
return 0;
}
}
puts("Yes");
}
| [
"call.remove"
] | 757,454 | 757,455 | u765690804 | cpp |
p02953 | #include <iostream>
#include <math.h>
#include <vector>
typedef long long ll;
using namespace std;
ll rem(ll num, ll a) {
while (num >= a) {
num -= a;
}
return num;
}
bool maxima(int index, int n, vector<int> &v) {
int a = 0;
int b = 2147483647;
if (index - 1 > 0) {
a = v[index - 1];
}
if (index + 1 < n) {
b = v[index + 1];
}
if (a <= v[index] && v[index] > b) {
return true;
}
return false;
}
int main() {
int a;
scanf("%d", &a);
vector<int> v(a);
for (int i = 0; i < a; i++) {
scanf("%d", &v[i]);
}
v[0]--;
for (int i = 1; i < a; i++) {
if (v[i] > v[i - 1])
v[i]--;
else if (v[i] < v[i - 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | #include <iostream>
#include <math.h>
#include <vector>
typedef long long ll;
using namespace std;
ll rem(ll num, ll a) {
while (num >= a) {
num -= a;
}
return num;
}
bool maxima(int index, int n, vector<int> &v) {
int a = 0;
int b = 2147483647;
if (index - 1 > 0) {
a = v[index - 1];
}
if (index + 1 < n) {
b = v[index + 1];
}
if (a <= v[index] && v[index] > b) {
return true;
}
return false;
}
int main() {
int a;
scanf("%d", &a);
vector<int> v(a);
for (int i = 0; i < a; i++) {
scanf("%d", &v[i]);
}
v[0]--;
for (int i = 1; i < a; i++) {
if (v[i] > v[i - 1])
v[i]--;
else if (v[i] < v[i - 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,461 | 757,462 | u327949948 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#ifdef _IS_LOCAL //
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout \
if (false) \
cout
#define debug() if (false)
#define dvout \
if (false) \
cout
#endif //
#define next asdnext
#define prev asdprev
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define vrep(i, v) for (auto &i : v)
#define all(x) (x).begin(), (x).end()
#define vout(v) \
for (auto &i : v) { \
cout << i << " "; \
} \
cout << "\n"; //配列出力
#define vin(v) \
for (auto &i : v) \
cin >> i; //配列入力
#define vecin(v, n) \
vec(v, n); \
vin(v);
#define vec(v, n) vector<int> v(n, 0);
#define mod (int)(1e9 + 7)
typedef long long ll;
typedef unsigned long long ull;
void Main() {
int N;
cin >> N;
vecin(H, N);
int now = -1;
for (int i = 0; i < N; i++) {
if (H[i] < now) {
cout << "NO\n";
return;
} else {
if (H[i] == now) {
} else {
now = H[i] - 1;
}
}
}
cout << "Yes\n";
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << std::fixed << std::setprecision(15);
Main();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#ifdef _IS_LOCAL //
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout \
if (false) \
cout
#define debug() if (false)
#define dvout \
if (false) \
cout
#endif //
#define next asdnext
#define prev asdprev
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define vrep(i, v) for (auto &i : v)
#define all(x) (x).begin(), (x).end()
#define vout(v) \
for (auto &i : v) { \
cout << i << " "; \
} \
cout << "\n"; //配列出力
#define vin(v) \
for (auto &i : v) \
cin >> i; //配列入力
#define vecin(v, n) \
vec(v, n); \
vin(v);
#define vec(v, n) vector<int> v(n, 0);
#define mod (int)(1e9 + 7)
typedef long long ll;
typedef unsigned long long ull;
void Main() {
int N;
cin >> N;
vecin(H, N);
int now = -1;
for (int i = 0; i < N; i++) {
if (H[i] < now) {
cout << "No\n";
return;
} else {
if (H[i] == now) {
} else {
now = H[i] - 1;
}
}
}
cout << "Yes\n";
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << std::fixed << std::setprecision(15);
Main();
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,471 | 757,472 | u111937495 | cpp |
p02953 | // https://atcoder.jp/contests/abc136/tasks/abc136_c
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> v(n);
REP(i, n) cin >> v[i];
REP(i, n - 1) {
if (v[i] > v[i + 1]) {
v[i]--;
}
if (v[i] > v[i + 1]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| // https://atcoder.jp/contests/abc136/tasks/abc136_c
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> v(n);
REP(i, n) cin >> v[i];
REP(i, n - 1) {
if (v[i] > v[i + 1]) {
v[i + 1]++;
}
if (v[i] > v[i + 1]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| [
"expression.operation.binary.add"
] | 757,479 | 757,480 | u858107870 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep for (int i = 0; i < n; i++)
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
int a[n];
rep { cin >> a[i]; }
string frag = "Yes";
for (int i = n - 1; i > 0; i--) {
if (a[i - 1] - a[i] == 1)
a[i] -= 1;
else if (a[i - 1] - a[i] > 1)
frag = "No";
}
cout << frag << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep for (int i = 0; i < n; i++)
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
int a[n];
rep { cin >> a[i]; }
string frag = "Yes";
for (int i = n - 1; i > 0; i--) {
if (a[i - 1] - a[i] == 1)
a[i - 1] -= 1;
else if (a[i - 1] - a[i] > 1)
frag = "No";
}
cout << frag << endl;
}
| [
"assignment.change"
] | 757,485 | 757,486 | u974214237 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep for (int i = 0; i < n; i++)
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
int a[n];
rep { cin >> a[i]; }
string frag = "Yes";
for (int i = n - 1; i > 0; i++) {
if (a[i - 1] - a[i] == 1)
a[i] -= 1;
else if (a[i - 1] - a[i] > 1)
frag = "No";
}
cout << frag << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep for (int i = 0; i < n; i++)
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
int a[n];
rep { cin >> a[i]; }
string frag = "Yes";
for (int i = n - 1; i > 0; i--) {
if (a[i - 1] - a[i] == 1)
a[i - 1] -= 1;
else if (a[i - 1] - a[i] > 1)
frag = "No";
}
cout << frag << endl;
}
| [
"assignment.change"
] | 757,487 | 757,486 | u974214237 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> v(N);
for (long long i = 0; i < N; i++) {
cin >> v[i];
}
bool frag = true;
for (long long i = N - 1; i >= 0; i--) {
if ((v[i - 1] - v[i]) >= 2) {
frag = false;
break;
} else if ((v[i - 1] - v[i]) == 1) {
v[i - 1] = v[i - 1] - 1;
}
}
if (frag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> v(N);
for (long long i = 0; i < N; i++) {
cin >> v[i];
}
bool frag = true;
for (long long i = N - 1; i > 0; i--) {
if ((v[i - 1] - v[i]) >= 2) {
frag = false;
break;
} else if ((v[i - 1] - v[i]) == 1) {
v[i - 1] = v[i - 1] - 1;
}
}
if (frag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 757,506 | 757,507 | u652609504 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = n - 1; i >= 1; i--) {
if (a[i] < a[i - 1]) {
if (a[i - 1] - a[i] > 1) {
printf("NO\n");
return 0;
}
a[i - 1]--;
}
}
printf("YES\n");
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = n - 1; i >= 1; i--) {
if (a[i] < a[i - 1]) {
if (a[i - 1] - a[i] > 1) {
printf("No\n");
return 0;
}
a[i - 1]--;
}
}
printf("Yes\n");
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,508 | 757,509 | u284539389 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; ++i) {
cin >> H.at(i);
}
bool flg = true;
int minN = INT_MAX;
for (int i = N - 1; i > 0; --i) {
minN = min(minN, H.at(i));
if (H.at(i) > H.at(i - 1)) {
continue;
} else {
H.at(i - 1)--;
minN = min(minN, H.at(i - 1));
if (minN < H.at(i - 1)) {
flg = false;
break;
}
}
}
if (flg) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; ++i) {
cin >> H.at(i);
}
bool flg = true;
int minN = INT_MAX;
for (int i = N - 1; i > 0; --i) {
minN = min(minN, H.at(i));
if (H.at(i) >= H.at(i - 1)) {
continue;
} else {
H.at(i - 1)--;
minN = min(minN, H.at(i - 1));
if (minN < H.at(i - 1)) {
flg = false;
break;
}
}
}
if (flg) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,518 | 757,519 | u920340928 | cpp |
p02953 | #include <stdio.h>
#define N 100001
int main(void) {
int i, n, judge = 1;
long long int h[N];
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%lld", &h[i]);
for (i = 1; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
judge = 0;
break;
}
}
printf(judge ? "Yes\n" : "N0\n");
return 0;
} | #include <stdio.h>
#define N 100001
int main(void) {
int i, n, judge = 1;
long long int h[N];
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%lld", &h[i]);
for (i = 1; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
judge = 0;
break;
}
}
printf(judge ? "Yes\n" : "No\n");
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 757,522 | 757,523 | u391667116 | cpp |
p02953 | #include <stdio.h>
#define N 100001
int main(void) {
int i, n, judge = 1;
long long int h[N];
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%lld", &h[i]);
for (i = 0; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
judge = 0;
break;
}
}
printf(judge ? "Yes\n" : "N0\n");
return 0;
} | #include <stdio.h>
#define N 100001
int main(void) {
int i, n, judge = 1;
long long int h[N];
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%lld", &h[i]);
for (i = 1; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
judge = 0;
break;
}
}
printf(judge ? "Yes\n" : "No\n");
return 0;
} | [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 757,524 | 757,523 | u391667116 | cpp |
p02953 | #include <stdio.h>
#define N 100001
int main(void) {
int i, n, judge = 1;
long long int h[N];
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%lld", &h[i]);
for (i = 0; i < n; i++) {
if (h[i] > h[i - 1])
h[i - 1]--;
else if (h[i] < h[i - 1]) {
judge = 0;
break;
}
}
printf(judge ? "Yes\n" : "N0\n");
return 0;
} | #include <stdio.h>
#define N 100001
int main(void) {
int i, n, judge = 1;
long long int h[N];
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%lld", &h[i]);
for (i = 1; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
judge = 0;
break;
}
}
printf(judge ? "Yes\n" : "No\n");
return 0;
} | [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operation.binary.remove",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 757,525 | 757,523 | u391667116 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
int ans = 0;
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N - 1; i++) {
if (vec.at(i) > vec.at(i + 1) + 1) {
ans = 1;
} else if (vec.at(i) > vec.at(i + 1)) {
vec.at(i) = vec.at(i) - 1;
}
}
if (ans == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vec(N);
int ans = 0;
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
for (int i = 0; i < N - 1; i++) {
if (vec.at(i) > vec.at(i + 1) + 1) {
ans = 1;
} else if (vec.at(i) > vec.at(i + 1)) {
vec.at(i + 1) = vec.at(i + 1) + 1;
}
}
if (ans == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
| [
"assignment.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 757,534 | 757,535 | u105533331 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long int a[n];
int f = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int x = a[n - 1];
for (int i = n - 2; i >= 0; i--) {
if (a[i] <= a[i - 1])
x = a[i];
else {
if (a[i] - x > 1)
f = 1;
}
}
if (f == 1)
cout << "No" << endl;
else
cout << "Yes" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long int a[n];
int f = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int x = a[n - 1];
for (int i = n - 2; i >= 0; i--) {
if (a[i] <= x)
x = a[i];
else {
if (a[i] - x > 1)
f = 1;
}
}
if (f == 1)
cout << "No" << endl;
else
cout << "Yes" << endl;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 757,538 | 757,537 | u148049084 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int able = 1;
arr[0]--;
for (int i = 1; i < n; i++) {
if (arr[i] > arr[i - 1])
arr[i]--;
}
for (int i = 0; i < n - 1; i++) {
if (arr[i] - arr[i + 1] < 0) {
able = 0;
break;
}
}
if (able)
cout << "Yes";
else
cout << "No";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int able = 1;
arr[0]--;
for (int i = 1; i < n; i++) {
if (arr[i] > arr[i - 1])
arr[i]--;
}
for (int i = 0; i < n - 1; i++) {
if (arr[i] - arr[i + 1] > 0) {
able = 0;
break;
}
}
if (able)
cout << "Yes";
else
cout << "No";
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,541 | 757,542 | u222252114 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
int N, i;
// cout << "debug" << endl;
cin >> N;
vector<long> vec(N + 1);
vec.at(0) = 0;
for (i = 1; i < N + 1; i++) {
cin >> vec.at(i);
}
// cout << "N= " << N << endl;
//右から順にみて、1より大きく高いならアウト
for (i = N; i > 0; i--) {
if (vec.at(i - 1) > vec.at(i) + 1) {
cout << "no" << endl;
break;
} else if (vec.at(i - 1) == vec.at(i) + 1) {
// 1だけ高いなら下げる
vec.at(i - 1)--;
// cout << "doun" << endl;
}
}
if (i <= 1)
cout << "yes" << endl;
} // endmain | #include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
int N, i;
// cout << "debug" << endl;
cin >> N;
vector<long> vec(N + 1);
vec.at(0) = 0;
for (i = 1; i < N + 1; i++) {
cin >> vec.at(i);
}
// cout << "N= " << N << endl;
//右から順にみて、1より大きく高いならアウト
for (i = N; i > 0; i--) {
if (vec.at(i - 1) > vec.at(i) + 1) {
cout << "No" << endl;
break;
} else if (vec.at(i - 1) == vec.at(i) + 1) {
// 1だけ高いなら下げる
vec.at(i - 1)--;
// cout << "doun" << endl;
}
}
if (i <= 1)
cout << "Yes" << endl;
} // endmain | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,549 | 757,550 | u844703694 | cpp |
p02953 | #include <stdio.h>
#include <vector>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> A(N);
for (int i = 0; i < N; i++) {
scanf("%d", &A.at(i));
}
bool flg = true;
int i = N - 2;
while (i >= 0) {
/// printf("%d\n",A.at(i)-A.at(i+1) );
if (A.at(i) - A.at(i + 1) == 1) {
A.at(i) = A.at(i) = 0;
} else if (A.at(i) - A.at(i + 1) >= 2) {
flg = false;
break;
}
i--;
}
if (flg == true) {
printf("%s\n", "Yes");
} else {
printf("%s\n", "No");
}
/*
for(int i=0;i<N;i++){
printf("%d ",A.at(i));
}
*/
return 0;
} | #include <stdio.h>
#include <vector>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> A(N);
for (int i = 0; i < N; i++) {
scanf("%d", &A.at(i));
}
bool flg = true;
int i = N - 2;
while (i >= 0) {
if (A.at(i) - A.at(i + 1) == 1) {
A.at(i) = A.at(i) - 1;
} else if (A.at(i) - A.at(i + 1) >= 2) {
flg = false;
break;
}
i--;
}
if (flg == true) {
printf("%s\n", "Yes");
} else {
printf("%s\n", "No");
}
/// for(int i=0;i<N;i++){
/// printf("%d ",A.at(i));
///}
return 0;
} | [] | 757,553 | 757,554 | u161168905 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod = 1e9 + 7;
int main() {
int N;
cin >> N;
vll H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
string ans = "Yes";
if (H[0] > 1) {
H[0] -= 1;
}
for (int i = 1; i < N; i++) {
if (i == N - 1) {
if (H[i - 1] > H[i]) {
ans = "No";
break;
}
} else {
if (H[i - 1] == H[i] - 1) {
H[i] -= 1;
} else if (H[i - 1] > H[i]) {
ans = "No";
break;
}
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod = 1e9 + 7;
int main() {
int N;
cin >> N;
vll H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
string ans = "Yes";
if (H[0] > 1) {
H[0] -= 1;
}
for (int i = 1; i < N; i++) {
if (i == N - 1) {
if (H[i - 1] > H[i]) {
ans = "No";
break;
}
} else {
if (H[i - 1] < H[i]) {
H[i] -= 1;
} else if (H[i - 1] > H[i]) {
ans = "No";
break;
}
}
}
cout << ans << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 757,558 | 757,559 | u420528322 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
int m = 0, minn, maxn;
while (m < n) {
scanf("%d", &a[m++]);
}
minn = a[0], maxn = a[0];
for (int i = 0; i < n - 1; i++) {
if (a[i] - a[i + 1] == 2) {
printf("No\n");
return 0;
} else if (a[i] - a[i + 1] == 1) {
swap(a[i], a[i + 1]);
}
}
printf("Yes\n");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
int m = 0, minn, maxn;
while (m < n) {
scanf("%d", &a[m++]);
}
minn = a[0], maxn = a[0];
for (int i = 0; i < n - 1; i++) {
if (a[i] - a[i + 1] >= 2) {
printf("No\n");
return 0;
} else if (a[i] - a[i + 1] == 1) {
swap(a[i], a[i + 1]);
}
}
printf("Yes\n");
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,570 | 757,571 | u333991119 | cpp |
p02953 | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int N;
cin >> N;
vector<int> C(N);
for (int i = 0; i < N; i++) {
cin >> C.at(i);
}
for (int i = 0; i < N - 1; i++) {
if (i == 0) {
if (C.at(i) - 1 > C.at(i + 1)) {
cout << "No" << endl;
break;
} else {
C.at(i) -= 1;
}
}
else if (C.at(i - 1) < C.at(i)) {
C.at(i) -= 1;
} else if (C.at(i) > C.at(i + 1)) {
cout << "No" << endl;
break;
}
if (i == N - 2) {
cout << "Yes" << endl;
}
}
if (N == 1) {
cout << "Yes" << endl;
}
} | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int N;
cin >> N;
vector<int> C(N);
for (int i = 0; i < N; i++) {
cin >> C.at(i);
}
for (int i = 0; i < N - 1; i++) {
if (i == 0) {
if (C.at(i) - 1 > C.at(i + 1)) {
cout << "No" << endl;
break;
} else {
C.at(i) -= 1;
}
}
else if (C.at(i - 1) < C.at(i)) {
C.at(i) -= 1;
}
if (C.at(i) > C.at(i + 1)) {
cout << "No" << endl;
break;
}
if (i == N - 2) {
cout << "Yes" << endl;
}
}
if (N == 1) {
cout << "Yes" << endl;
}
} | [
"control_flow.branch.if.replace.add",
"control_flow.branch.else_if.replace.remove"
] | 757,572 | 757,573 | u913104858 | cpp |
p02953 | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int N;
cin >> N;
vector<int> C(N);
for (int i = 0; i < N; i++) {
cin >> C.at(i);
}
for (int i = 0; i < N - 1; i++) {
if (i == 0) {
if (C.at(i) - 1 > C.at(i + 1)) {
cout << "No" << endl;
} else {
C.at(i) -= 1;
}
}
else if (C.at(i - 1) < C.at(i)) {
C.at(i) -= 1;
} else if (C.at(i) > C.at(i + 1)) {
cout << "No" << endl;
break;
}
if (i == N - 2) {
cout << "Yes" << endl;
}
}
if (N == 1) {
cout << "Yes" << endl;
}
}
| #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int N;
cin >> N;
vector<int> C(N);
for (int i = 0; i < N; i++) {
cin >> C.at(i);
}
for (int i = 0; i < N - 1; i++) {
if (i == 0) {
if (C.at(i) - 1 > C.at(i + 1)) {
cout << "No" << endl;
break;
} else {
C.at(i) -= 1;
}
}
else if (C.at(i - 1) < C.at(i)) {
C.at(i) -= 1;
}
if (C.at(i) > C.at(i + 1)) {
cout << "No" << endl;
break;
}
if (i == N - 2) {
cout << "Yes" << endl;
}
}
if (N == 1) {
cout << "Yes" << endl;
}
} | [
"control_flow.branch.if.replace.add",
"control_flow.branch.else_if.replace.remove"
] | 757,574 | 757,573 | u913104858 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
size_t N;
cin >> N;
vector<int> H(N, 0);
for (int i = 0; i < N; ++i) {
cin >> H[i];
}
int Ha = H[N - 1];
bool is_d = true;
for (int i = N - 2; i >= 0; --i) {
if (H[i] > Ha + 1) {
is_d = false;
break;
} else if (H[i] == Ha + 1) {
continue;
} else if (H[i] < Ha + 1) {
Ha = H[i];
}
}
if (is_d) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
size_t N;
cin >> N;
vector<int> H(N, 0);
for (int i = 0; i < N; ++i) {
cin >> H[i];
}
int Ha = H[N - 1];
bool is_d = true;
for (int i = N - 2; i >= 0; --i) {
if (H[i] > Ha + 1) {
is_d = false;
break;
} else if (H[i] == Ha + 1) {
continue;
} else if (H[i] < Ha + 1) {
Ha = H[i];
}
}
if (is_d) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,587 | 757,588 | u898714404 | cpp |
p02953 | #include <bits/stdc++.h>
typedef long long int64;
int main() {
int64 n;
scanf("%lld", &n);
int64 *h = new int64[n];
for (int i = 0; i < n; i++) {
scanf("%lld", &h[i]);
}
if (h[0] > 0)
h[0] -= 1;
int64 max = h[0];
int no = 0;
for (int i = 1; i < n; i++) {
if (h[i] > max) {
h[i] -= 1;
max = h[i];
}
if (h[i - 1] > h[i]) {
no = 1;
break;
}
}
if (no)
printf("NO\n");
else
printf("YES\n");
delete[] h;
return 0;
} | #include <bits/stdc++.h>
typedef long long int64;
int main() {
int64 n;
scanf("%lld", &n);
int64 *h = new int64[n];
for (int i = 0; i < n; i++) {
scanf("%lld", &h[i]);
}
if (h[0] > 0)
h[0] -= 1;
int64 max = h[0];
int no = 0;
for (int i = 1; i < n; i++) {
if (h[i] > max) {
h[i] -= 1;
max = h[i];
}
if (h[i - 1] > h[i]) {
no = 1;
break;
}
}
if (no)
printf("No\n");
else
printf("Yes\n");
delete[] h;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,598 | 757,599 | u220152525 | cpp |
p02953 | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<pair<int, int>>> vvp;
typedef vector<pair<int, int>> vp;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i, s, n) for (int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f ? "yes" : "no")
#define YN(f) (f ? "YES" : "NO")
#define Yn(f) (f ? "Yes" : "No")
#define mod (1e9 + 7)
#define inf (1e9 + 7)
#define nil -1
int main() {
int N;
cin >> N;
vi H(N);
for (int i = 0; i < N; i++)
cin >> H[i];
string ans = "Yes";
for (int i = N - 1; i >= 1; i--) {
if (H[i - 1] - H[i] == 1) {
H[i - 1]--;
} else if (H[i - 1] - H[i] == 2) {
ans = "No";
}
}
cout << ans << endl;
} | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<pair<int, int>>> vvp;
typedef vector<pair<int, int>> vp;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i, s, n) for (int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f ? "yes" : "no")
#define YN(f) (f ? "YES" : "NO")
#define Yn(f) (f ? "Yes" : "No")
#define mod (1e9 + 7)
#define inf (1e9 + 7)
#define nil -1
int main() {
int N;
cin >> N;
vi H(N);
for (int i = 0; i < N; i++)
cin >> H[i];
string ans = "Yes";
for (int i = N - 1; i >= 1; i--) {
if (H[i - 1] - H[i] == 1) {
H[i - 1]--;
} else if (H[i - 1] - H[i] >= 2) {
ans = "No";
}
}
cout << ans << endl;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,611 | 757,612 | u902151549 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
uint64_t N;
cin >> N;
vector<uint64_t> H;
for (uint64_t i = 0; i < N; i++) {
uint64_t tmp;
cin >> tmp;
H.push_back(tmp);
}
bool ans = true;
uint64_t max = H[0];
if (N > 1) {
for (uint64_t i = 0; i < N; i++) {
uint64_t h = H[i];
uint64_t h_next = H[i + 1];
if (h > h_next) {
h = h - 1;
if (max > h) {
ans = false;
break;
}
H[i] = h;
max = h;
}
if (h <= h_next) {
continue;
} else {
ans = false;
break;
}
}
}
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char *argv[]) {
uint64_t N;
cin >> N;
vector<uint64_t> H;
for (uint64_t i = 0; i < N; i++) {
uint64_t tmp;
cin >> tmp;
H.push_back(tmp);
}
bool ans = true;
uint64_t max = H[0];
if (N > 1) {
for (uint64_t i = 0; i < N - 1; i++) {
uint64_t h = H[i];
uint64_t h_next = H[i + 1];
if (h > h_next) {
h = h - 1;
if (max > h) {
ans = false;
break;
}
H[i] = h;
max = h;
}
if (h <= h_next) {
continue;
} else {
ans = false;
break;
}
}
}
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 757,620 | 757,621 | u307752464 | cpp |
p02953 | #include "bits/stdc++.h"
using namespace std;
int N;
vector<int> H;
int main() {
string answer = "yes";
cin >> N;
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
H.emplace_back(tmp);
}
H[0] -= 1;
for (int i = 1; i < N; i++) {
if (H[i] - H[i - 1] == 0)
continue;
else if (H[i] - H[i - 1] > 0) {
H[i] -= 1;
continue;
} else {
answer = "no";
break;
}
}
cout << answer << endl;
return 0;
} | #include "bits/stdc++.h"
using namespace std;
int N;
vector<int> H;
int main() {
string answer = "Yes";
cin >> N;
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
H.emplace_back(tmp);
}
H[0] -= 1;
for (int i = 1; i < N; i++) {
if (H[i] - H[i - 1] == 0)
continue;
else if (H[i] - H[i - 1] > 0) {
H[i] -= 1;
continue;
} else {
answer = "No";
break;
}
}
cout << answer << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 757,624 | 757,625 | u436976004 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; ++i) {
cin >> h[i];
}
for (int i = n; i > 0; --i) {
if (h[i] < h[i - 1])
h[i - 1]--;
}
bool is_valid = true;
for (int i = 0; i < n - 1; ++i) {
if (h[i + 1] < h[i])
is_valid = false;
}
if (is_valid) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; ++i) {
cin >> h[i];
}
for (int i = n - 1; i > 0; --i) {
if (h[i] < h[i - 1])
h[i - 1]--;
}
bool is_valid = true;
for (int i = 0; i < n - 1; ++i) {
if (h[i + 1] < h[i])
is_valid = false;
}
if (is_valid) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"control_flow.loop.for.initializer.change"
] | 757,632 | 757,633 | u559765551 | cpp |
p02953 | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int N, i, ans = 0;
bool flag = 0;
int H[100000] = {0};
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", H + i);
}
for (i = 1; i < N; i++) {
if (H[i - 1] < H[i]) {
H[i]--;
} else if (H[i - 1] != H[i]) {
flag = 1;
break;
}
}
if (flag) {
printf("NO");
} else {
printf("yes");
}
return 0;
} | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int N, i, ans = 0;
bool flag = 0;
int H[100000] = {0};
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", H + i);
}
for (i = 1; i < N; i++) {
if (H[i - 1] < H[i]) {
H[i]--;
} else if (H[i - 1] != H[i]) {
flag = 1;
break;
}
}
if (flag) {
printf("No");
} else {
printf("Yes");
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,638 | 757,639 | u424405505 | cpp |
p02953 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long mod = 1e9 + 7;
int main() {
int n, ans = 1;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
for (int i = n - 1; i > 0; i--) {
if (h[i] >= h[i - 1])
continue;
else if (h[i] >= h[i] - 1)
h[i - 1] -= 1;
else
ans = 0;
}
if (n == 1)
cout << "Yes" << endl;
else if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long mod = 1e9 + 7;
int main() {
int n, ans = 1;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
for (int i = n - 1; i > 0; i--) {
if (h[i] >= h[i - 1])
continue;
else if (h[i] >= h[i - 1] - 1)
h[i - 1] -= 1;
else
ans = 0;
}
if (n == 1)
cout << "Yes" << endl;
else if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 757,640 | 757,641 | u969617556 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {
int t;
while (b > 0) {
t = b;
b = a % b;
a = t;
}
return a;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
ll a, b, c, d, e, k, l, m, n, o = 1, o1 = 9, o2 = 10, p, q, x, y, z, max1 = 0,
ans = 0, n1;
string s, t, u;
cin >> n;
ll h[n];
for (ll i = 0; i < n; i++) {
cin >> h[i];
}
for (ll i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
cout << "No" << endl;
break;
}
if (h[i] < h[i + 1]) {
h[i + 1]--;
}
}
cout << "Yes" << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {
int t;
while (b > 0) {
t = b;
b = a % b;
a = t;
}
return a;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
ll a, b, c, d, e, k, l, m, n, o = 1, o1 = 9, o2 = 10, p, q, x, y, z, max1 = 0,
ans = 0, n1;
string s, t, u;
cin >> n;
ll h[n];
for (ll i = 0; i < n; i++) {
cin >> h[i];
}
for (ll i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
cout << "No" << endl;
return 0;
}
if (h[i] < h[i + 1]) {
h[i + 1]--;
}
}
cout << "Yes" << endl;
}
| [
"control_flow.break.remove",
"control_flow.return.add",
"function.return_value.change"
] | 757,650 | 757,651 | u953532675 | cpp |
p02953 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, H[100009];
int i, j, max;
bool flag;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> H[i];
}
if (n == 1)
cout << "yes" << endl;
else {
max = H[1];
flag = true;
for (i = 2; i <= n; i++) {
if (H[i] > max) {
max = H[i];
flag = true;
} else if (H[i] < max) {
if (flag == true) {
flag = false;
max -= 1;
}
if (H[i] < max) {
cout << "no" << endl;
return 0;
}
}
}
cout << "yes" << endl;
}
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, H[100009];
int i, j, max;
bool flag;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> H[i];
}
if (n == 1) {
cout << "Yes" << endl;
} else {
max = H[1];
flag = true;
for (i = 2; i <= n; i++) {
if (H[i] > max) {
max = H[i];
flag = true;
} else if (H[i] < max) {
if (flag == true) {
flag = false;
max -= 1;
}
if (H[i] < max) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,652 | 757,653 | u477710819 | cpp |
p02953 | // code by PARTH_4399 for competitive programming
#include <bits/stdc++.h>
using namespace std;
#define l long // -2^31 to +2^31-1 (upper limit ~ 2*(10^9))
#define ul unsigned long // 0 to +2^32-1
#define ll long long // -2^63 to +2^63-1 (upper limit ~ 9*(10^18))
#define ull unsigned long long // 0 to +2^64-1
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
// const double pi=acos(-1.0); // cout<<fixed<<setprecision(n)<<pi; - for n
// decimal digits, use <iomanip.h>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// code
ll int n, i, f = 0, max = 0;
cin >> n;
ll int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 1; i < n; i++) {
if (a[i] < a[i - 1])
a[i - 1]--;
if (a[i] < a[i - 1]) {
f = 1;
break;
}
if (a[i - 1] > max)
max = a[i - 1];
if (a[i] < max) {
f = 1;
break;
}
}
if (f == 1)
cout << "NO";
else
cout << "YES";
return 0;
} | // code by PARTH_4399 for competitive programming
#include <bits/stdc++.h>
using namespace std;
#define l long // -2^31 to +2^31-1 (upper limit ~ 2*(10^9))
#define ul unsigned long // 0 to +2^32-1
#define ll long long // -2^63 to +2^63-1 (upper limit ~ 9*(10^18))
#define ull unsigned long long // 0 to +2^64-1
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
// const double pi=acos(-1.0); // cout<<fixed<<setprecision(n)<<pi; - for n
// decimal digits, use <iomanip.h>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// code
ll int n, i, f = 0, max = 0;
cin >> n;
ll int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 1; i < n; i++) {
if (a[i] <= a[i - 1])
a[i - 1]--;
if (a[i] < a[i - 1]) {
f = 1;
break;
}
if (a[i - 1] > max)
max = a[i - 1];
if (a[i] < max) {
f = 1;
break;
}
}
if (f == 1)
cout << "No";
else
cout << "Yes";
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,656 | 757,655 | u053309694 | cpp |
p02953 | #include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
int *a = new int[n];
bool *used = new bool[n];
fill(used, used + n, 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]) {
if (!used[i]) {
used[i] = 1;
a[i]--;
i = max(i - 2, 0);
} else {
puts("NO");
return 0;
}
}
}
puts("YES");
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
int *a = new int[n];
bool *used = new bool[n];
fill(used, used + n, 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]) {
if (!used[i]) {
used[i] = 1;
a[i]--;
i = max(i - 2, 0);
} else {
puts("No");
return 0;
}
}
}
puts("Yes");
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,660 | 757,661 | u704687987 | cpp |
p02953 | #include <iostream>
using namespace std;
int n;
int a[10000];
int main() {
cin >> n;
for (int i = 0; i < n; ++i)
cin >> a[i];
bool flag = false;
for (int j = 0; j < n; ++j) {
if (a[j] - a[j - 1] < 0) {
flag = true;
break;
} else if (j == 0) {
} else if (a[j] - a[j - 1] > 0) {
a[j]--;
}
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "Yes" << endl;
}
}
| #include <iostream>
using namespace std;
int n;
int a[100000];
int main() {
cin >> n;
for (int i = 0; i < n; ++i)
cin >> a[i];
bool flag = false;
for (int j = 0; j < n; ++j) {
if (a[j] - a[j - 1] < 0) {
flag = true;
break;
} else if (j == 0) {
} else if (a[j] - a[j - 1] > 0) {
a[j]--;
}
}
if (flag) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"literal.string.change",
"io.output.change"
] | 757,662 | 757,663 | u326647750 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
const int m = 100000 + 5;
int a[m];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int f = 1;
for (int i = n - 1; i > 0; i--) {
if (a[i] < a[i - 1]) {
if (a[i - 1] - a[i] == 1)
a[i - 1] = a[i - 1] - 1;
else {
f = 0;
break;
}
}
}
if (f)
printf("YES\n");
else
printf("NO\n");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
const int m = 100000 + 5;
int a[m];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int f = 1;
for (int i = n - 1; i > 0; i--) {
if (a[i] < a[i - 1]) {
if (a[i - 1] - a[i] == 1)
a[i - 1] = a[i - 1] - 1;
else {
f = 0;
break;
}
}
}
if (f)
printf("Yes\n");
else
printf("No\n");
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,665 | 757,666 | u744950774 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define MAX 100000
int h[MAX];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
string ans = "Yes";
for (int i = 0; i < n - 1; i++) {
if (h[i] >= h[i + 1]) {
h[i]--;
}
}
for (int i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
ans = "No";
break;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define MAX 100000
int h[MAX];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> h[i];
string ans = "Yes";
for (int i = 0; i < n - 1; i++) {
if (h[i] < h[i + 1]) {
h[i + 1]--;
}
}
// for(int i=0;i<n;i++)cout<<h[i]<<endl;
for (int i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
ans = "No";
break;
}
}
cout << ans << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,667 | 757,668 | u055447809 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[100000];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
a[0]--;
if (n == 1) {
cout << "Yes";
return 0;
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
cout << "No";
return 0;
}
if (a[i] < a[i + 1])
a[i + 1]--;
}
cout << "YES";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[100000];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
a[0]--;
if (n == 1) {
cout << "Yes";
return 0;
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
cout << "No";
return 0;
}
if (a[i] < a[i + 1])
a[i + 1]--;
}
cout << "Yes";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,670 | 757,671 | u118789292 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[100000];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
a[0]--;
if (n == 1) {
cout << "Yes";
return 0;
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
cout << "NO";
return 0;
}
if (a[i] < a[i + 1])
a[i + 1]--;
}
cout << "YES";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a[100000];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
a[0]--;
if (n == 1) {
cout << "Yes";
return 0;
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
cout << "No";
return 0;
}
if (a[i] < a[i + 1])
a[i + 1]--;
}
cout << "Yes";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,672 | 757,671 | u118789292 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// C++14 (GCC 5.4.1)
#define LLINF (1LL << 60)
typedef long long ll;
#define mod 1000000007
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define rrepd(i, a, b) for (int i = (a); i >= (b); i--)
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline T divrup(T a, T b) {
if (a % b)
return a / b + 1;
else
return a / b;
}
#define dbg_v1(i, V) \
do { \
cout << "-v1----\n"; \
rep(i, V.size()) cout << " " << i << "\t:" << V[i] << endl; \
cout << endl; \
} while (0)
#define dbg_v2(i, k, V) \
do { \
cout << "-v2----\n"; \
rep(i, V.size()) { \
rep(k, V[0].size()) cout << " " << V[i][k]; \
cout << endl; \
} \
} while (0)
int main() {
int N;
cin >> N;
vector<int> H(N);
rep(i, N) cin >> H[i];
bool isOK = true;
/*if(N==1){
cout << "Yes" <<endl;
return 0;
}
if(H[0]==H[1]-1)H[1]=H[0];
else if(H[0]-1==H[1])H[0]=H[1];
else if(H[0]>H[1]) isOK=false;
repd(i,1,N-1){
if(H[i-1]<=H[i] && H[i]<=H[i+1])continue;
if(H[i-1]<=H[i]-1 && H[i]-1<=H[i+1]){
H[i]--;
}else{
isOK=false;
break;
}
}
if(H[N-2]>H[N-1])isOK=false;
cout << ((isOK) ? "Yes" : "No") <<endl;*/
if (N == 1) {
cout << "Yes" << endl;
return 0;
}
int m1;
if (H[0] == H[1] - 1) {
H[1] = H[0];
m1 = H[0];
} else if (H[0] - 1 == H[1]) {
H[0] = H[1];
m1 = H[1];
} else if (H[0] > H[1]) {
cout << "Yes" << endl;
return 0;
} else {
m1 = H[1] - 1;
}
int max = H[1];
repd(i, 2, N) {
if (max == H[i])
continue; /* 地続き 保留 */
if (max < H[i]) { /* 十分な単調増加 */
max = H[i];
m1 = max - 1;
} else if (m1 == H[i]) { /* 許容できそうな単調減少 */
m1 = max - 1;
} else {
isOK = false;
break;
}
}
cout << ((isOK) ? "Yes" : "No") << endl;
return (0);
} | #include <bits/stdc++.h>
using namespace std;
// C++14 (GCC 5.4.1)
#define LLINF (1LL << 60)
typedef long long ll;
#define mod 1000000007
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define rrepd(i, a, b) for (int i = (a); i >= (b); i--)
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T> inline T divrup(T a, T b) {
if (a % b)
return a / b + 1;
else
return a / b;
}
#define dbg_v1(i, V) \
do { \
cout << "-v1----\n"; \
rep(i, V.size()) cout << " " << i << "\t:" << V[i] << endl; \
cout << endl; \
} while (0)
#define dbg_v2(i, k, V) \
do { \
cout << "-v2----\n"; \
rep(i, V.size()) { \
rep(k, V[0].size()) cout << " " << V[i][k]; \
cout << endl; \
} \
} while (0)
int main() {
int N;
cin >> N;
vector<int> H(N);
rep(i, N) cin >> H[i];
bool isOK = true;
/*if(N==1){
cout << "Yes" <<endl;
return 0;
}
if(H[0]==H[1]-1)H[1]=H[0];
else if(H[0]-1==H[1])H[0]=H[1];
else if(H[0]>H[1]) isOK=false;
repd(i,1,N-1){
if(H[i-1]<=H[i] && H[i]<=H[i+1])continue;
if(H[i-1]<=H[i]-1 && H[i]-1<=H[i+1]){
H[i]--;
}else{
isOK=false;
break;
}
}
if(H[N-2]>H[N-1])isOK=false;
cout << ((isOK) ? "Yes" : "No") <<endl;*/
if (N == 1) {
cout << "Yes" << endl;
return 0;
}
int m1;
if (H[0] == H[1] - 1) {
H[1] = H[0];
m1 = H[0];
} else if (H[0] - 1 == H[1]) {
H[0] = H[1];
m1 = H[1];
} else if (H[0] > H[1]) {
cout << "No" << endl;
return 0;
} else {
m1 = H[1] - 1;
}
int max = H[1];
repd(i, 2, N) {
if (max == H[i])
continue; /* 地続き 保留 */
if (max < H[i]) { /* 十分な単調増加 */
max = H[i];
m1 = max - 1;
} else if (m1 == H[i]) { /* 許容できそうな単調減少 */
m1 = max - 1;
} else {
isOK = false;
break;
}
}
cout << ((isOK) ? "Yes" : "No") << endl;
return (0);
} | [
"literal.string.change",
"io.output.change"
] | 757,690 | 757,691 | u216459554 | cpp |
p02953 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
int A[100010];
int main() {
int i, n;
cin >> n;
for (i = 1; i <= n; i++)
cin >> A[i];
for (i = n - 1; i; i--) {
if (A[i] > A[i + 1] + 1) {
cout << "NO" << endl;
return 0;
} else if (A[i] == A[i + 1] + 1)
A[i]--;
}
cout << "YES" << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
int A[100010];
int main() {
int i, n;
cin >> n;
for (i = 1; i <= n; i++)
cin >> A[i];
for (i = n - 1; i; i--) {
if (A[i] > A[i + 1] + 1) {
cout << "No" << endl;
return 0;
} else if (A[i] == A[i + 1] + 1)
A[i]--;
}
cout << "Yes" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,717 | 757,718 | u950345492 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, flag;
int *h;
cin >> n;
h = new int[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
if (n == 1) {
cout << "Yes" << endl;
} else {
flag = 0;
for (int i = (n - 1); i > 0 && flag != 1; i--) {
if (h[i - 1] > h[i]) {
h[i - 1] -= 1;
if (h[i - 1] > h[i]) {
flag = 1;
}
}
}
if (flag == 1) {
cout << "NO" << endl;
} else {
cout << "Yes" << endl;
}
}
delete h;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, flag;
int *h;
cin >> n;
h = new int[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
if (n == 1) {
cout << "Yes" << endl;
} else {
flag = 0;
for (int i = (n - 1); i > 0 && flag != 1; i--) {
if (h[i - 1] > h[i]) {
h[i - 1] -= 1;
if (h[i - 1] > h[i]) {
flag = 1;
}
}
}
if (flag == 1) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
delete h;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,719 | 757,720 | u779636842 | cpp |
p02953 | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int t = 0, n, a;
bool flag = 0;
bool flag1 = 0;
cin >> n;
while (n--) {
cin >> a;
if (a > t) {
t = a;
flag1 = 0;
} else if (a == t)
t = a;
else if (a == t - 1) {
if (flag1) {
flag = 1;
break;
} else {
flag1 = 1;
t = a - 1;
}
} else {
flag = 1;
break;
}
}
if (flag)
cout << "No" << endl;
else
cout << "Yes" << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
int t = 0, n, a;
bool flag = 0;
bool flag1 = 0;
cin >> n;
while (n--) {
cin >> a;
if (a > t) {
t = a;
flag1 = 0;
} else if (a == t)
t = a;
else if (a == t - 1) {
if (flag1) {
flag = 1;
break;
} else {
flag1 = 1;
t = a;
}
} else {
flag = 1;
break;
}
}
if (flag)
cout << "No" << endl;
else
cout << "Yes" << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 757,737 | 757,738 | u451010951 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, max = 0;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++) {
if (a[i] < max) {
cout << "No" << endl;
return 0;
}
if (a[i] >= a[i++]) {
a[i]--;
if (a[i] > max)
max = a[i];
}
}
cout << "Yes" << endl;
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, max = 0;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++) {
if (a[i] < max) {
cout << "No" << endl;
return 0;
}
if (a[i] >= a[i + 1]) {
a[i]--;
if (a[i] > max)
max = a[i];
}
}
cout << "Yes" << endl;
return 0;
}
| [
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 757,761 | 757,762 | u323966851 | cpp |
p02953 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
bool answer = true;
cin >> N;
vector<long long> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
long long b = -1;
for (int i = 0; i < N - 1; i++) {
long long a = 0;
a = vec.at(i + 1) - vec.at(i);
if (a <= -2)
answer = false;
if (a == -1) {
if (b == -1)
b = vec.at(i);
else if (b < vec.at(i)) {
answer = false;
} else if (b > vec.at(i)) {
b = vec.at(i);
}
}
}
if (answer == true)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
bool answer = true;
cin >> N;
vector<long long> vec(N);
for (int i = 0; i < N; i++) {
cin >> vec.at(i);
}
long long b = -1;
for (int i = 0; i < N - 1; i++) {
long long a = 0;
a = vec.at(i + 1) - vec.at(i);
if (a <= -2)
answer = false;
if (a == -1) {
if (b == -1)
b = vec.at(i);
else if (b > vec.at(i)) {
answer = false;
} else if (b < vec.at(i)) {
b = vec.at(i);
}
}
}
if (answer == true)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,764 | 757,765 | u641446860 | cpp |
p02953 | #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int N, temp;
int arr[100001];
scanf("%d", &N);
for (temp = 1; temp <= N; temp++) {
scanf(" %d", &arr[temp]);
}
for (temp = N; temp > 1; temp--) {
if (arr[temp] < arr[temp - 1]) {
arr[temp - 1] -= 1;
}
}
for (temp = 1; temp < N; temp++) {
if (arr[temp] > arr[temp + 1]) {
printf("NO");
return 0;
}
}
printf("YES");
return 0;
} | #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int N, temp;
int arr[100001];
scanf("%d", &N);
for (temp = 1; temp <= N; temp++) {
scanf(" %d", &arr[temp]);
}
for (temp = N; temp > 1; temp--) {
if (arr[temp] < arr[temp - 1]) {
arr[temp - 1] -= 1;
}
}
for (temp = 1; temp < N; temp++) {
if (arr[temp] > arr[temp + 1]) {
printf("No");
return 0;
}
}
printf("Yes");
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,768 | 757,769 | u096338524 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, border = 0, H[100000], Highest = 0;
cin >> N;
for (int i = 0; i < N - 2; i++) {
cin >> H[i];
}
for (int i = 0; i < N; i++) {
if (H[i + 1] - H[i] > 1 && border < H[i + 1]) {
border = H[i + 1] - 1;
}
if (H[i] > Highest) {
Highest = H[i] - 1;
}
if (H[i + 2] < border || Highest > H[i]) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, border = 0, H[100000], Highest = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N - 2; i++) {
if (H[i + 1] - H[i] > 1 && border < H[i + 1]) {
border = H[i + 1] - 1;
}
if (H[i] > Highest) {
Highest = H[i] - 1;
}
if (H[i + 2] < border || Highest > H[i]) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 757,776 | 757,777 | u534015096 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, border = 0, H[100000], Highest = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N; i++) {
if (H[i + 1] - H[i] > 1 && border < H[i + 1]) {
border = H[i + 1] - 1;
}
if (H[i] > Highest) {
Highest = H[i] - 1;
}
if (H[i + 2] < border || Highest > H[i]) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, border = 0, H[100000], Highest = 0;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = 0; i < N - 2; i++) {
if (H[i + 1] - H[i] > 1 && border < H[i + 1]) {
border = H[i + 1] - 1;
}
if (H[i] > Highest) {
Highest = H[i] - 1;
}
if (H[i + 2] < border || Highest > H[i]) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | [
"control_flow.loop.for.condition.change"
] | 757,778 | 757,777 | u534015096 | cpp |
p02953 | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll N;
cin >> N;
vector<ll> H(N);
REP(i, N) cin >> H[i];
for (ll i = N - 2; i >= 0; i--) {
if (H[i] + 1 > H[i + 1]) {
cout << "No" << endl;
return 0;
} else if (H[i] + 1 == H[i + 1])
H[i]--;
}
cout << "Yes" << endl;
return 0;
}
| #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll N;
cin >> N;
vector<ll> H(N);
REP(i, N) cin >> H[i];
for (ll i = N - 2; i >= 0; i--) {
if (H[i] - 1 > H[i + 1]) {
cout << "No" << endl;
// cout << i;
return 0;
} else if (H[i] - 1 == H[i + 1])
H[i]--;
}
cout << "Yes" << endl;
// REP(i, N) cout << H[i];
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 757,781 | 757,782 | u716566635 | cpp |
p02953 | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll N;
cin >> N;
vector<ll> H(N);
REP(i, N) cin >> H[i];
for (ll i = N - 2; i >= 0; i--) {
if (H[i] + 1 < H[i + 1]) {
cout << "No" << endl;
return 0;
} else if (H[i] + 1 == H[i + 1])
H[i]--;
}
cout << "Yes" << endl;
return 0;
}
| #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll N;
cin >> N;
vector<ll> H(N);
REP(i, N) cin >> H[i];
for (ll i = N - 2; i >= 0; i--) {
if (H[i] - 1 > H[i + 1]) {
cout << "No" << endl;
// cout << i;
return 0;
} else if (H[i] - 1 == H[i + 1])
H[i]--;
}
cout << "Yes" << endl;
// REP(i, N) cout << H[i];
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 757,783 | 757,782 | u716566635 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ll long long
#define ggr \
getchar(); \
getchar(); \
return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll> P;
ll gcd(ll x, ll y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }
ll a[114514];
ll n;
signed main() {
cin >> n;
rep(i, n) cin >> a[i];
ll memo = 0;
rep(i, n) {
if (a[i] > a[i + 1]) {
if (memo == 0)
memo = a[i];
else {
if (memo - a[i + 1] >= 2) {
puts("No");
ggr
}
}
}
if (a[i] < a[i + 1])
memo = 0;
}
rep(i, n - 1) {
if (a[i] > a[i + 1]) {
if (a[i] - a[i + 1] >= 2) {
puts("No");
ggr
}
}
}
puts("Yes");
ggr
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ll long long
#define ggr \
getchar(); \
getchar(); \
return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll> P;
ll gcd(ll x, ll y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }
ll a[114514];
ll n;
signed main() {
cin >> n;
rep(i, n) cin >> a[i];
ll memo = 0;
rep(i, n - 1) {
if (a[i] > a[i + 1]) {
if (memo == 0)
memo = a[i];
else {
if (memo - a[i + 1] >= 2) {
puts("No");
ggr
}
}
}
if (a[i] < a[i + 1])
memo = 0;
}
rep(i, n - 1) {
if (a[i] > a[i + 1]) {
if (a[i] - a[i + 1] >= 2) {
puts("No");
ggr
}
}
}
puts("Yes");
ggr
}
| [
"expression.operation.binary.add"
] | 757,784 | 757,785 | u971256474 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, H = 0, Flag = 0;
cin >> N;
vector<int> V(N);
for (int i = 0; i < N; ++i) {
cin >> V.at(i);
}
for (int i = 0; i < N - 1; ++i) {
if (V.at(i) - V.at(i + 1) > 1) {
Flag = 1;
break;
} else if (V.at(i) - V.at(i + 1) == 1) {
if (V.at(i) < H) {
Flag = 1;
break;
} else {
H = max(H, V.at(i));
}
}
}
if (Flag == 0) {
cout << "YES" << endl;
} else if (Flag == 1) {
cout << "NO" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, H = 0, Flag = 0;
cin >> N;
vector<int> V(N);
for (int i = 0; i < N; ++i) {
cin >> V.at(i);
}
for (int i = 0; i < N - 1; ++i) {
if (V.at(i) - V.at(i + 1) > 1) {
Flag = 1;
break;
} else if (V.at(i) - V.at(i + 1) == 1) {
if (V.at(i) < H) {
Flag = 1;
break;
} else {
H = max(H, V.at(i));
}
}
}
if (Flag == 0) {
cout << "Yes" << endl;
} else if (Flag == 1) {
cout << "No" << endl;
}
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,798 | 757,799 | u770964565 | cpp |
p02953 | #include <bits/stdc++.h>
#include <chrono>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace chrono;
#define all(a) a.begin(), a.end()
#define sz(x) (int(x.size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef vector<string> vs;
template <class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P) {
in >> P.first >> P.second;
return in;
}
template <class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> &P) {
out << "(" << P.first << ", " << P.second << ")";
return out;
}
template <class T> istream &operator>>(istream &in, vector<T> &arr) {
for (auto &x : arr)
in >> x;
return in;
}
template <class T> ostream &operator<<(ostream &out, vector<T> &arr) {
for (auto &x : arr)
out << x << ' ';
cout << "\n";
return out;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vi a(n);
cin >> a;
a[0]--;
for (int i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
cout << "NO";
return 0;
}
if (a[i - 1] < a[i]) {
a[i]--;
}
}
cout << "YES";
return 0;
} | #include <bits/stdc++.h>
#include <chrono>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace chrono;
#define all(a) a.begin(), a.end()
#define sz(x) (int(x.size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef vector<string> vs;
template <class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P) {
in >> P.first >> P.second;
return in;
}
template <class T1, class T2>
ostream &operator<<(ostream &out, pair<T1, T2> &P) {
out << "(" << P.first << ", " << P.second << ")";
return out;
}
template <class T> istream &operator>>(istream &in, vector<T> &arr) {
for (auto &x : arr)
in >> x;
return in;
}
template <class T> ostream &operator<<(ostream &out, vector<T> &arr) {
for (auto &x : arr)
out << x << ' ';
cout << "\n";
return out;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vi a(n);
cin >> a;
a[0]--;
for (int i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
cout << "No";
return 0;
}
if (a[i - 1] < a[i]) {
a[i]--;
}
}
cout << "Yes";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,805 | 757,806 | u158297468 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
const int N = 100005;
const int inf = 1e18;
int pow(int a, int b) {
int res = 1;
while (b > 0) {
if (b & 1) {
res = res * a;
}
a = a * a;
b >>= 1;
}
return res;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for (int x = 0; x < n; x++) {
cin >> a[x];
}
int c = 0;
for (int x = n - 1; x > 0; x--) {
if (a[x] < a[x - 1]) {
if (a[x - 1] - a[x] == 1) {
a[x - 1]--;
} else {
c++;
break;
}
}
}
if (c == 0) {
cout << "YES";
} else {
cout << "NO";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
const int N = 100005;
const int inf = 1e18;
int pow(int a, int b) {
int res = 1;
while (b > 0) {
if (b & 1) {
res = res * a;
}
a = a * a;
b >>= 1;
}
return res;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for (int x = 0; x < n; x++) {
cin >> a[x];
}
int c = 0;
for (int x = n - 1; x > 0; x--) {
if (a[x] < a[x - 1]) {
if (a[x - 1] - a[x] == 1) {
a[x - 1]--;
} else {
c++;
break;
}
}
}
if (c == 0) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,807 | 757,808 | u859774897 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = {0, 1, 0, -1};
ll dy[4] = {1, 0, -1, 0};
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
// input
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) { cin >> h[i]; }
// output
ll tmp = h[0];
rep(i, n - 1) {
if (h[i + 1] - tmp >= 2) {
puts("No");
return 0;
}
tmp = max(h[i + 1], tmp);
}
puts("Yes");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = {0, 1, 0, -1};
ll dy[4] = {1, 0, -1, 0};
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
// input
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) { cin >> h[i]; }
// output
ll tmp = h[0];
rep(i, n - 1) {
if (tmp - h[i + 1] >= 2) {
puts("No");
return 0;
}
tmp = max(h[i + 1], tmp);
}
puts("Yes");
return 0;
} | [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 757,809 | 757,810 | u946090308 | cpp |
p02953 | #include "bits/stdc++.h"
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(), a.end())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MP(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define INF LLONG_MAX / 2
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) \
cerr << #v << ":"; \
rep(i, v.size()) cerr << " " << v[i]; \
cerr << endl
using namespace std;
int MOD = 1000000007;
signed main() {
int n;
cin >> n;
int h[100010];
rep(i, n) { cin >> h[i]; }
if (n == 1) {
cout << "Yes" << endl;
return 0;
}
for (int i = n - 1; i >= 0; i--) {
if (h[i - 1] > h[i]) {
h[i - 1]--;
if (h[i - 1] > h[i]) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl
// https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a rm -r -f
// test;oj dl http://abc136.contest.atcoder.jp/tasks/abc136_b
| #include "bits/stdc++.h"
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(), a.end())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MP(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define INF LLONG_MAX / 2
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) \
cerr << #v << ":"; \
rep(i, v.size()) cerr << " " << v[i]; \
cerr << endl
using namespace std;
int MOD = 1000000007;
signed main() {
int n;
cin >> n;
int h[100010];
rep(i, n) { cin >> h[i]; }
if (n == 1) {
cout << "Yes" << endl;
return 0;
}
for (int i = n - 1; i >= 1; i--) {
if (h[i - 1] > h[i]) {
h[i - 1]--;
if (h[i - 1] > h[i]) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl
// https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a rm -r -f
// test;oj dl http://abc136.contest.atcoder.jp/tasks/abc136_b
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 757,816 | 757,817 | u548768105 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
a[0]--;
for (int i = 1; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
if (a[i] > a[i - 1]) {
a[i]--;
}
} else if (a[i] > a[i + 1]) {
a[i]--;
}
}
for (int i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
cout << "NO";
return 0;
}
}
cout << "YES";
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
a[0]--;
for (int i = 1; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
if (a[i] > a[i - 1]) {
a[i]--;
}
} else if (a[i] > a[i + 1]) {
a[i]--;
}
}
for (int i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
cout << "No";
return 0;
}
}
cout << "Yes";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,818 | 757,819 | u825143564 | cpp |
p02953 | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <string>
using namespace std;
inline int read() {
int res = 0, fh = 1;
char ch = getchar();
while ((ch > '9' || ch < '0') && ch != '-')
ch = getchar();
if (ch == '-')
fh = -1, ch = getchar();
while (ch >= '0' && ch <= '9')
res = res * 10 + ch - '0', ch = getchar();
return fh * res;
}
const int maxn = 100010;
int n, a[maxn];
int main() {
n = read();
for (int i = 1; i <= n; i++)
a[i] = read();
for (int i = 2; i <= n; i++) {
if (a[i] - 1 >= a[i - 1])
a[i]--;
}
for (int i = 2; i <= n; i++)
if (a[i] < a[i - 1])
return puts("NO"), 0;
return printf("YES\n"), 0;
} | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <string>
using namespace std;
inline int read() {
int res = 0, fh = 1;
char ch = getchar();
while ((ch > '9' || ch < '0') && ch != '-')
ch = getchar();
if (ch == '-')
fh = -1, ch = getchar();
while (ch >= '0' && ch <= '9')
res = res * 10 + ch - '0', ch = getchar();
return fh * res;
}
const int maxn = 100010;
int n, a[maxn];
int main() {
n = read();
for (int i = 1; i <= n; i++)
a[i] = read();
for (int i = 2; i <= n; i++) {
if (a[i] - 1 >= a[i - 1])
a[i]--;
}
for (int i = 2; i <= n; i++)
if (a[i] < a[i - 1])
return puts("No"), 0;
return printf("Yes\n"), 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"function.return_value.change",
"io.output.change"
] | 757,820 | 757,821 | u970579664 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
long long g = GCD(a, b);
return a / g * b;
}
int main() {
int N;
cin >> N;
vector<long long> ve(N);
rep(i, 0, N) { cin >> ve[i]; }
long long mae = ve[0] - 1;
bool yn = true;
rep(i, 1, N) {
if (mae > ve[i]) {
yn = false;
} else if (mae != ve[i]) {
mae = ve[i] - 1;
} else {
mae = ve[i];
}
}
if (yn) {
cout << "Yes" << endl;
} else {
cout << "NO" << endl;
}
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
long long g = GCD(a, b);
return a / g * b;
}
int main() {
int N;
cin >> N;
vector<long long> ve(N);
rep(i, 0, N) { cin >> ve[i]; }
long long mae = ve[0] - 1;
bool yn = true;
rep(i, 1, N) {
if (mae > ve[i]) {
yn = false;
} else if (mae != ve[i]) {
mae = ve[i] - 1;
} else {
mae = ve[i];
}
}
if (yn) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,824 | 757,825 | u183971632 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define pb push_back
#define mp make_pair
#define F first
#define S second
int main() {
string ans = "Yes";
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) { cin >> h[i]; }
for (int i = n - 1; i >= 1; i--) {
if (h[i - 1] <= h[i])
continue;
if (h[i - 1] + 1 == h[i]) {
h[i - 1] -= 1;
continue;
}
ans = "No";
break;
}
cout << ans << "\n";
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define pb push_back
#define mp make_pair
#define F first
#define S second
int main() {
string ans = "Yes";
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) { cin >> h[i]; }
for (int i = n - 1; i >= 1; i--) {
if (h[i - 1] <= h[i])
continue;
if (h[i - 1] == h[i] + 1) {
h[i - 1] -= 1;
continue;
}
ans = "No";
break;
}
cout << ans << "\n";
return 0;
}
| [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change",
"misc.off_by_one"
] | 757,829 | 757,830 | u459548136 | cpp |
p02953 | /***************************************************************
File name: C.cpp
Author: ljfcnyali
Create time: 2019年08月04日 星期日 19时58分04秒
***************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)
#define mem(a) memset((a), 0, sizeof(a))
#define str(a) strlen(a)
typedef long long LL;
int a[100010], n;
int main() {
scanf("%d", &n);
int sum = 0;
REP(i, 1, n) scanf("%d", &a[i]);
for (int i = n; i >= 2; --i) {
if (a[i] <= a[i - 1])
--a[i - 1];
}
REP(i, 1, n - 1) if (a[i] > a[i + 1]) {
puts("No\n");
return 0;
}
puts("Yes");
return 0;
} | /***************************************************************
File name: C.cpp
Author: ljfcnyali
Create time: 2019年08月04日 星期日 19时58分04秒
***************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)
#define mem(a) memset((a), 0, sizeof(a))
#define str(a) strlen(a)
typedef long long LL;
int a[100010], n;
int main() {
scanf("%d", &n);
int sum = 0;
REP(i, 1, n) scanf("%d", &a[i]);
for (int i = n; i >= 2; --i) {
if (a[i] < a[i - 1])
--a[i - 1];
}
REP(i, 1, n - 1) if (a[i] > a[i + 1]) {
puts("No\n");
return 0;
}
puts("Yes");
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,831 | 757,832 | u192982222 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define int long long
bool cd(int n) {
int c = 0;
while (n) {
n /= 10;
c++;
}
return c & 1;
}
int32_t main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
a[0]--;
for (int i = 1; i < n; i++) {
if (a[i] == a[i - 1])
continue;
else if (a[i] - a[i - 1] > 0)
a[i]--;
else {
cout << "NO";
return 0;
}
}
cout << "YES";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
bool cd(int n) {
int c = 0;
while (n) {
n /= 10;
c++;
}
return c & 1;
}
int32_t main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
a[0]--;
for (int i = 1; i < n; i++) {
if (a[i] == a[i - 1])
continue;
else if (a[i] - a[i - 1] > 0)
a[i]--;
else {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,835 | 757,836 | u781762706 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define loop(i, a, b) for (int i = a; i < b; i++)
#define test() \
int t; \
cin >> t; \
loop(test, 1, t + 1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout << "\n"
#define sp cout << " "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(), x.end()
template <class C> void min_self(C &a, C b) { a = min(a, b); }
template <class C> void max_self(C &a, C b) { a = max(a, b); }
void mod(ll &n, ll m = MOD) { n %= m, n += m, n %= m; }
const int MAXN = 1e5 + 5;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
fastio();
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
int f = 0, mx = h[0];
for (int i = 1; i < n; i++) {
if (mx > h[i] + 1) {
f = 1;
break;
}
mx = max(mx, h[i]);
}
if (f)
cout << "NO\n";
else
cout << "YES\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define loop(i, a, b) for (int i = a; i < b; i++)
#define test() \
int t; \
cin >> t; \
loop(test, 1, t + 1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout << "\n"
#define sp cout << " "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(), x.end()
template <class C> void min_self(C &a, C b) { a = min(a, b); }
template <class C> void max_self(C &a, C b) { a = max(a, b); }
void mod(ll &n, ll m = MOD) { n %= m, n += m, n %= m; }
const int MAXN = 1e5 + 5;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
fastio();
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
int f = 0, mx = h[0];
for (int i = 1; i < n; i++) {
if (mx > h[i] + 1) {
f = 1;
break;
}
mx = max(mx, h[i]);
}
if (f)
cout << "No\n";
else
cout << "Yes\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,837 | 757,838 | u908436921 | cpp |
p02953 | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int curr;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (i == 0)
curr = x - 1;
else {
if (x > curr)
curr = x - 1;
else if (x == curr)
;
else {
cout << "NO";
return 0;
}
}
}
cout << "YES";
} | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int curr;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (i == 0)
curr = x - 1;
else {
if (x > curr)
curr = x - 1;
else if (x == curr)
;
else {
cout << "No";
return 0;
}
}
}
cout << "Yes";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,848 | 757,849 | u339979795 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int n, a[100010] = {0};
int main() {
cin >> n;
int f = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
if (a[i] < a[i - 1])
a[i]++;
if (a[i] < a[i - 1])
f = 1;
}
if (f)
cout << "NO";
else
cout << "YES";
} | #include <bits/stdc++.h>
using namespace std;
int n, a[100010] = {0};
int main() {
cin >> n;
int f = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
if (a[i] < a[i - 1])
a[i]++;
if (a[i] < a[i - 1])
f = 1;
}
if (f)
cout << "No";
else
cout << "Yes";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,854 | 757,855 | u709966987 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll MOD = 1000000007;
int main() {
int n;
scanf("%d", &n);
vector<int> h(n);
for (int &i : h)
scanf("%d", &i);
for (int i = 1; i < n; ++i) {
if (h[i] > h[i - 1])
--h[i];
}
bool ans = true;
for (int i = 0; i < n - 1; ++i) {
if (h[i] > h[i + 1]) {
ans = false;
break;
}
}
if (ans) {
puts("YES");
} else {
puts("NO");
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const ll MOD = 1000000007;
int main() {
int n;
scanf("%d", &n);
vector<int> h(n);
for (int &i : h)
scanf("%d", &i);
for (int i = 1; i < n; ++i) {
if (h[i] > h[i - 1])
--h[i];
}
bool ans = true;
for (int i = 0; i < n - 1; ++i) {
if (h[i] > h[i + 1]) {
ans = false;
break;
}
}
if (ans) {
puts("Yes");
} else {
puts("No");
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,856 | 757,857 | u843954136 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int n;
int h[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> h[i];
h[0] = h[1];
for (int i = 1; i <= n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
cout << "NO";
return 0;
}
}
cout << "YES";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int n;
int h[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> h[i];
h[0] = h[1];
for (int i = 1; i <= n; i++) {
if (h[i] > h[i - 1])
h[i]--;
else if (h[i] < h[i - 1]) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,858 | 757,859 | u651116403 | cpp |
p02953 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define sz(x) (int)x.size()
#define aint(v) v.begin(), v.end()
#define x first
#define y second
#define in(x) cin >> x;
#define inde(x) \
ll(x); \
cin >> x;
#define rep(ai, j, k) for (ll ai = j; ai < k; ai++)
#define sep(ai, j, k) for (ll ai = j; ai >= k; ai--)
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define inputarr(x, y) \
for (int ai = 0; ai < y; ai++) { \
cin >> x[ai]; \
}
#define inpprefixarr(arr, y) \
cin >> arr[0]; \
for (ll ai = 1; ai < y; ai++) { \
ll temp; \
cin >> temp; \
arr[ai] = temp + arr[ai - 1]; \
}
#define watch(x) cout << (#x) << " is " << (x) << endl
#define watcharrsz(x) \
cout << (#x) << " starts:\n"; \
for (int ai = 0; ai < sz(x); ai++) { \
cout << x[ai] << " "; \
} \
cout << "\n" << (#x) << "ends\n";
#define watcharr(x, n) \
cout << (#x) << " starts:\n"; \
for (int ai = 1; ai <= n; ai++) { \
cout << x[ai] << " "; \
} \
cout << "\n" << (#x) << "ends\n";
#define watchg(x, n, y) \
cout << (#x) << " starts:\n"; \
for (int ai = 0; ai <= n; ai++) { \
cout << (ai) << ":"; \
for (int aj = 0; aj < x[ai].size(); aj++) { \
cout << x[ai][aj] << y; \
} \
cout << "\n"; \
} \
cout << "\n" << (#x) << "ends\n";
#define watch2darr(x, m, n, y) \
cout << (#x) << " starts:\n"; \
for (int ai = 1; ai <= m; ai++) { \
for (int aj = 1; aj <= n; aj++) { \
cout << x[ai][aj] << y; \
} \
cout << "\n"; \
} \
cout << "\n" << (#x) << "ends\n";
#define print(x, y) cout << (x) << y;
#define printarrsz(x, y) \
for (int ai = 0; ai < sz(x); ai++) { \
cout << x[ai] << y; \
} \
cout << "\n";
#define printarr(x, n, y) \
for (int ai = 0; ai < n; ai++) { \
cout << x[ai] << y; \
} \
cout << "\n";
#define print2darr(x, m, n, y) \
for (int ai = 0; ai < m; ai++) { \
for (int aj = 0; aj < n; aj++) { \
cout << x[ai][aj] << y; \
} \
cout << "\n"; \
} \
cout << "\n";
#define mod(x) = (x % m + m) % m;
const ll m = (ll)1000000007;
const ll N = 3e6 + 5;
const ll INF = 1ll << 63;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<pii> vpii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<pll, vpll, greater<pll>> pqg;
/***************************Code Begins Here *****************************/
void solve() {
// Never use x,y here, try to use i,j in loops only
inde(n);
ll he[n];
inputarr(he, n);
ll ok = 0;
ll dec = 0;
ll maxx = he[0];
rep(i, 0, n) {
maxx = max(maxx, he[i]);
if (maxx - he[i] >= 2) {
ok = 1;
}
}
if (ok) {
print("NO", endl);
} else {
print("YES", endl);
}
}
signed main() {
ios ll t = 1;
// cin>>t;
while (t--)
solve();
return 0;
} | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define sz(x) (int)x.size()
#define aint(v) v.begin(), v.end()
#define x first
#define y second
#define in(x) cin >> x;
#define inde(x) \
ll(x); \
cin >> x;
#define rep(ai, j, k) for (ll ai = j; ai < k; ai++)
#define sep(ai, j, k) for (ll ai = j; ai >= k; ai--)
#define ios \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define inputarr(x, y) \
for (int ai = 0; ai < y; ai++) { \
cin >> x[ai]; \
}
#define inpprefixarr(arr, y) \
cin >> arr[0]; \
for (ll ai = 1; ai < y; ai++) { \
ll temp; \
cin >> temp; \
arr[ai] = temp + arr[ai - 1]; \
}
#define watch(x) cout << (#x) << " is " << (x) << endl
#define watcharrsz(x) \
cout << (#x) << " starts:\n"; \
for (int ai = 0; ai < sz(x); ai++) { \
cout << x[ai] << " "; \
} \
cout << "\n" << (#x) << "ends\n";
#define watcharr(x, n) \
cout << (#x) << " starts:\n"; \
for (int ai = 1; ai <= n; ai++) { \
cout << x[ai] << " "; \
} \
cout << "\n" << (#x) << "ends\n";
#define watchg(x, n, y) \
cout << (#x) << " starts:\n"; \
for (int ai = 0; ai <= n; ai++) { \
cout << (ai) << ":"; \
for (int aj = 0; aj < x[ai].size(); aj++) { \
cout << x[ai][aj] << y; \
} \
cout << "\n"; \
} \
cout << "\n" << (#x) << "ends\n";
#define watch2darr(x, m, n, y) \
cout << (#x) << " starts:\n"; \
for (int ai = 1; ai <= m; ai++) { \
for (int aj = 1; aj <= n; aj++) { \
cout << x[ai][aj] << y; \
} \
cout << "\n"; \
} \
cout << "\n" << (#x) << "ends\n";
#define print(x, y) cout << (x) << y;
#define printarrsz(x, y) \
for (int ai = 0; ai < sz(x); ai++) { \
cout << x[ai] << y; \
} \
cout << "\n";
#define printarr(x, n, y) \
for (int ai = 0; ai < n; ai++) { \
cout << x[ai] << y; \
} \
cout << "\n";
#define print2darr(x, m, n, y) \
for (int ai = 0; ai < m; ai++) { \
for (int aj = 0; aj < n; aj++) { \
cout << x[ai][aj] << y; \
} \
cout << "\n"; \
} \
cout << "\n";
#define mod(x) = (x % m + m) % m;
const ll m = (ll)1000000007;
const ll N = 3e6 + 5;
const ll INF = 1ll << 63;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<pii> vpii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<pll, vpll, greater<pll>> pqg;
/***************************Code Begins Here *****************************/
void solve() {
// Never use x,y here, try to use i,j in loops only
inde(n);
ll he[n];
inputarr(he, n);
ll ok = 0;
ll dec = 0;
ll maxx = he[0];
rep(i, 0, n) {
maxx = max(maxx, he[i]);
if (maxx - he[i] >= 2) {
ok = 1;
}
}
if (ok) {
print("No", endl);
} else {
print("Yes", endl);
}
}
signed main() {
ios ll t = 1;
// cin>>t;
while (t--)
solve();
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,866 | 757,867 | u777824330 | cpp |
p02953 | #include <iostream>
#define max(a, b) (a) > (b) ? (a) : (b);
using namespace std;
const int MAXN = 1e5 + 10;
int H[MAXN] = {0}, N, ans = 0, l = -1, r = -1;
int main() {
cin >> N;
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = 1; i < N; i++) {
if (H[i] <= H[i - 1]) {
if (l == -1) {
l = i - 1;
}
r = i;
ans = max(ans, H[l] - H[r]);
} else
l = -1;
}
if (ans >= 2)
cout << "NO";
else
cout << "YES";
return 0;
} | #include <iostream>
#define max(a, b) (a) > (b) ? (a) : (b);
using namespace std;
const int MAXN = 1e5 + 10;
int H[MAXN] = {0}, N, ans = 0, l = -1, r = -1;
int main() {
cin >> N;
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = 1; i < N; i++) {
if (H[i] <= H[i - 1]) {
if (l == -1) {
l = i - 1;
}
r = i;
ans = max(ans, H[l] - H[r]);
} else
l = -1;
}
if (ans >= 2)
cout << "No";
else
cout << "Yes";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,868 | 757,869 | u592284018 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// for(int i = 0; i < n; i++)
int main() {
int n, x = 1;
cin >> n;
vector<long> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
if (i != 0 && h.at(i) > h.at(i - 1) || i == 0)
h.at(i)--;
if (i != 0 && h.at(i) < h.at(i - 1))
x = 0;
}
if (x)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | #include <bits/stdc++.h>
using namespace std;
// for(int i = 0; i < n; i++)
int main() {
int n, x = 1;
cin >> n;
vector<long> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
if (i != 0 && h.at(i) > h.at(i - 1) || i == 0)
h.at(i)--;
if (i != 0 && h.at(i) < h.at(i - 1))
x = 0;
}
if (x)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,871 | 757,872 | u743438759 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// for(int i = 0; i < n; i++)
int main() {
int n, x = 1;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
if (i != 0 && h.at(i) > h.at(i - 1) || i == 0)
h.at(i)--;
if (i != 0 && h.at(i) < h.at(i - 1))
x = 0;
}
if (x)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | #include <bits/stdc++.h>
using namespace std;
// for(int i = 0; i < n; i++)
int main() {
int n, x = 1;
cin >> n;
vector<long> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
if (i != 0 && h.at(i) > h.at(i - 1) || i == 0)
h.at(i)--;
if (i != 0 && h.at(i) < h.at(i - 1))
x = 0;
}
if (x)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"variable_declaration.type.primitive.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,873 | 757,872 | u743438759 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<long> H(N);
for (int n = 0; n < N; n++) {
cin >> H[n];
}
bool can = true;
long max_high = 0;
for (int n = 0; n < N; n++) {
if (max_high - H[n] >= 2) {
can = false;
}
if (max_high < H[n]) {
max_high = H[n];
}
}
if (can) {
cout << "YES"
<< "\n";
} else {
cout << "NO"
<< "\n";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<long> H(N);
for (int n = 0; n < N; n++) {
cin >> H[n];
}
bool can = true;
long max_high = 0;
for (int n = 0; n < N; n++) {
if (max_high - H[n] >= 2) {
can = false;
}
if (max_high < H[n]) {
max_high = H[n];
}
}
if (can) {
cout << "Yes"
<< "\n";
} else {
cout << "No"
<< "\n";
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,879 | 757,880 | u518623219 | cpp |
p02953 | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
int h[n];
for (int i = n - 1; i >= 0; i--) {
cin >> h[n];
}
for (int i = 0; i < n - 1; i++) {
if (h[i] >= h[i + 1]) {
continue;
} else if (h[i] + 1 == h[i + 1]) {
h[i + 1]--;
continue;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
int h[n];
for (int i = n - 1; i >= 0; i--) {
cin >> h[i];
}
for (int i = 0; i < n - 1; i++) {
if (h[i] >= h[i + 1]) {
continue;
} else if (h[i] + 1 == h[i + 1]) {
h[i + 1]--;
continue;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 757,881 | 757,882 | u504407856 | cpp |
p02953 | #include <iostream>
using namespace std;
int main(void) {
int n, h[100000];
bool flg = true;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = n - 2; i >= 0; i--) {
if (h[i] > h[i - 1]) {
h[i]--;
}
if (h[i] > h[i - 1]) {
flg = false;
}
}
if (flg)
puts("Yes");
else
puts("No");
}
| #include <iostream>
using namespace std;
int main(void) {
int n, h[100000];
bool flg = true;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = n - 2; i >= 0; i--) {
if (h[i] > h[i + 1]) {
h[i]--;
}
if (h[i] > h[i + 1]) {
flg = false;
}
}
if (flg)
puts("Yes");
else
puts("No");
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 757,884 | 757,885 | u024809932 | cpp |
p02953 | #include <bits/stdc++.h>
#define re register
#define rep(i, a, b) for (re int i = a, i##end = b; i <= i##end; i++)
#define drep(i, a, b) for (re int i = a, i##end = b; i >= i##end; i--)
#define repp(i, a, b) for (re int i = a, i##end = b; i < i##end; i++)
#define drepp(i, a, b) for (re int i = a, i##end = b; i > i##end; i--)
#define Erep(i, x) for (int i = head[x]; ~i; i = Edge[i].nxt)
#define ll long long
#define debug(x) cerr << #x << " = " << x << endl
#define lowbit(x) (x & -x)
#define ms(x, a) memset(x, a, sizeof x)
using namespace std;
template <class T> inline bool Max(T &x, T y) { return x < y ? x = y, 1 : 0; }
template <class T> inline bool Min(T &x, T y) { return x > y ? x = y, 1 : 0; }
template <class T> inline T rd() {
static char ch;
static bool neg;
static T x = 0;
for (ch = neg = 0; ch < '0' || '9' < ch; neg |= ch == '-', ch = getchar())
;
for (x = 0; '0' <= ch && ch <= '9'; (x *= 10) += ch - '0', ch = getchar())
;
return x = (neg ? -x : x);
}
const int mod = 1e9 + 7, oo = 1e9, M = 1e5 + 5;
int A[M];
int main() {
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
int n = rd<int>(), mx = 0;
rep(i, 1, n) {
int x = rd<int>();
if (i == 1)
continue;
if (x - mx > 1)
return puts("No"), 0;
Max(mx, x);
}
puts("Yes");
return 0;
}
| #include <bits/stdc++.h>
#define re register
#define rep(i, a, b) for (re int i = a, i##end = b; i <= i##end; i++)
#define drep(i, a, b) for (re int i = a, i##end = b; i >= i##end; i--)
#define repp(i, a, b) for (re int i = a, i##end = b; i < i##end; i++)
#define drepp(i, a, b) for (re int i = a, i##end = b; i > i##end; i--)
#define Erep(i, x) for (int i = head[x]; ~i; i = Edge[i].nxt)
#define ll long long
#define debug(x) cerr << #x << " = " << x << endl
#define lowbit(x) (x & -x)
#define ms(x, a) memset(x, a, sizeof x)
using namespace std;
template <class T> inline bool Max(T &x, T y) { return x < y ? x = y, 1 : 0; }
template <class T> inline bool Min(T &x, T y) { return x > y ? x = y, 1 : 0; }
template <class T> inline T rd() {
static char ch;
static bool neg;
static T x = 0;
for (ch = neg = 0; ch < '0' || '9' < ch; neg |= ch == '-', ch = getchar())
;
for (x = 0; '0' <= ch && ch <= '9'; (x *= 10) += ch - '0', ch = getchar())
;
return x = (neg ? -x : x);
}
const int mod = 1e9 + 7, oo = 1e9, M = 1e5 + 5;
int A[M];
int main() {
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
int n = rd<int>(), mx = 0;
rep(i, 1, n) {
int x = rd<int>();
if (i == 1)
continue;
if (mx - x > 1)
return puts("No"), 0;
Max(mx, x);
}
puts("Yes");
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 757,888 | 757,889 | u941446746 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(void) {
int N;
cin >> N;
vector<int> H(N);
rep(i, N) cin >> H[i];
if (N == 1) {
cout << "yes" << endl;
return 0;
}
rep(i, N - 1) {
if (H[i] > H[i + 1]) {
H[i + 1]++;
}
if (H[i] > H[i + 1]) {
cout << "no" << endl;
return 0;
}
}
cout << "yes" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(void) {
int N;
cin >> N;
vector<int> H(N);
rep(i, N) cin >> H[i];
if (N == 1) {
cout << "Yes" << endl;
return 0;
}
rep(i, N - 1) {
if (H[i] > H[i + 1]) {
H[i + 1]++;
}
if (H[i] > H[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,895 | 757,896 | u285043842 | cpp |
p02953 | #include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
int N, i, o = 0;
cin >> N;
int H[N];
for (i = 0; i < N; i++)
cin >> H[i];
for (i = 0; i < N - 1; i++) {
if (H[i] - H[i + 1] > 1) {
cout << "No\n";
break;
} else if (H[i + 1] > H[i]) {
H[i]--;
}
}
if (i == N - 1)
cout << "Yes\n";
} | #include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
int N, i, o = 0;
cin >> N;
int H[N];
for (i = 0; i < N; i++)
cin >> H[i];
for (i = 0; i < N - 1; i++) {
if (H[i] - H[i + 1] > 0) {
cout << "No\n";
break;
} else if (H[i + 1] > H[i]) {
H[i + 1]--;
}
}
if (i == N - 1)
cout << "Yes\n";
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 757,897 | 757,898 | u909375072 | cpp |
p02953 | // Author :: ABHINAV3010 ::
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll, ll> p;
ll mod = 1000000007;
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
fast;
ll n;
cin >> n;
vector<ll> v;
for (ll i = 0; i < n; i++) {
ll a;
cin >> a;
v.pb(a);
}
bool flag = true;
vector<ll> g = v;
for (ll i = 1; i < n; i++) {
ll dif = v[i] - v[i - 1];
if (dif <= -2) {
flag = false;
break;
} else if (dif == -1) {
v[i - 1]--;
} else if (dif == 0) {
continue;
}
}
for (ll i = 1; i < n; i++) {
if (v[i] < v[i - 1]) {
flag = false;
break;
}
}
bool flag1 = true;
for (ll i = g.size() - 2; i >= 0; i--) {
ll dif = g[i] - g[i + 1];
if (dif >= 2) {
flag1 = false;
break;
} else if (dif == 1) {
g[i]--;
}
}
for (ll i = 1; i < n; i++) {
if (g[i] < g[i - 1]) {
flag1 = false;
break;
}
}
if (flag1 == false && flag == false) {
cout << "NO";
} else {
cout << "YES";
}
return 0;
}
| // Author :: ABHINAV3010 ::
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll, ll> p;
ll mod = 1000000007;
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
fast;
ll n;
cin >> n;
vector<ll> v;
for (ll i = 0; i < n; i++) {
ll a;
cin >> a;
v.pb(a);
}
bool flag = true;
vector<ll> g = v;
for (ll i = 1; i < n; i++) {
ll dif = v[i] - v[i - 1];
if (dif <= -2) {
flag = false;
break;
} else if (dif == -1) {
v[i - 1]--;
} else if (dif == 0) {
continue;
}
}
for (ll i = 1; i < n; i++) {
if (v[i] < v[i - 1]) {
flag = false;
break;
}
}
bool flag1 = true;
for (ll i = g.size() - 2; i >= 0; i--) {
ll dif = g[i] - g[i + 1];
if (dif >= 2) {
flag1 = false;
break;
} else if (dif == 1) {
g[i]--;
}
}
for (ll i = 1; i < n; i++) {
if (g[i] < g[i - 1]) {
flag1 = false;
break;
}
}
if (flag1 == false && flag == false) {
cout << "No";
} else {
cout << "Yes";
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,904 | 757,905 | u071109514 | cpp |
p02953 | #include <algorithm>
#include <cstdio>
#include <cstring>
void Unused(...) {}
#ifndef DEBUG
#define echo(...) Unused(__VA_ARGS__)
#else
#define echo(...) fprintf(stderr, __VA_ARGS__)
#endif
const int MaxN = int(1e5) + 7;
int n;
int main() {
scanf("%d", &n);
int nowmax = 0;
for (int i = 0; i < n; ++i) {
int now;
scanf("%d", &now);
if (nowmax - now > 1) {
printf("no\n");
return 0;
}
nowmax = std::max(nowmax, now);
}
printf("yes\n");
return 0;
}
| #include <algorithm>
#include <cstdio>
#include <cstring>
void Unused(...) {}
#ifndef DEBUG
#define echo(...) Unused(__VA_ARGS__)
#else
#define echo(...) fprintf(stderr, __VA_ARGS__)
#endif
const int MaxN = int(1e5) + 7;
int n;
int main() {
scanf("%d", &n);
int nowmax = 0;
for (int i = 0; i < n; ++i) {
int now;
scanf("%d", &now);
if (nowmax - now > 1) {
printf("No\n");
return 0;
}
nowmax = std::max(nowmax, now);
}
printf("Yes\n");
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,906 | 757,907 | u905333381 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll md = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
vector<ll> a(n);
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
vector<ll> suf(n);
ll ci = n - 1;
for (ll i = n - 2; i >= 0; i--) {
if (a[i] > a[ci]) {
suf[i] = a[i] - a[n - 1];
} else {
ci = i;
}
}
for (ll i = 0; i < n; i++) {
if (suf[i] > 1) {
cout << "No";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll md = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n;
cin >> n;
vector<ll> a(n);
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
vector<ll> suf(n);
ll ci = n - 1;
for (ll i = n - 2; i >= 0; i--) {
if (a[i] > a[ci]) {
suf[i] = a[i] - a[ci];
} else {
ci = i;
}
}
for (ll i = 0; i < n; i++) {
if (suf[i] > 1) {
cout << "No";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| [
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 757,908 | 757,909 | u770383589 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
int n, m;
int i, j, k;
char s[1000000];
cin >> n;
if (n == 1) {
cout << "Yes";
return 0;
}
for (i = 0; i < n; i++) {
cin >> s[i];
}
for (i = 0; i < n - 1; i++) {
if (s[i] > s[i + 1]) {
int t = i;
while (t < n - 1) {
if (s[i] - s[t] > 1) {
cout << "No";
return 0;
}
t++;
}
}
}
cout << "Yes";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
int n, m;
int i, j, k;
int s[1000000];
cin >> n;
if (n == 1) {
cout << "Yes";
return 0;
}
for (i = 0; i < n; i++) {
cin >> s[i];
}
for (i = 0; i < n - 1; i++) {
if (s[i] > s[i + 1]) {
int t = i;
while (t < n) {
if (s[i] - s[t] > 1) {
cout << "No";
return 0;
}
t++;
}
}
}
cout << "Yes";
} | [
"variable_declaration.type.primitive.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 757,920 | 757,921 | u241345538 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
int n, m;
int i, j, k;
char s[1000000];
cin >> n;
if (n == 1) {
cout << "Yes";
return 0;
}
for (i = 0; i < n; i++) {
cin >> s[i];
}
for (i = 0; i < n - 1; i++) {
if (s[i] > s[i + 1]) {
int t = i;
while (t < n) {
if (s[i] - s[t] > 1) {
cout << "No";
return 0;
}
t++;
}
}
}
cout << "Yes";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
int n, m;
int i, j, k;
int s[1000000];
cin >> n;
if (n == 1) {
cout << "Yes";
return 0;
}
for (i = 0; i < n; i++) {
cin >> s[i];
}
for (i = 0; i < n - 1; i++) {
if (s[i] > s[i + 1]) {
int t = i;
while (t < n) {
if (s[i] - s[t] > 1) {
cout << "No";
return 0;
}
t++;
}
}
}
cout << "Yes";
} | [
"variable_declaration.type.primitive.change"
] | 757,922 | 757,921 | u241345538 | cpp |
p02953 | #include <algorithm>
#include <cstdio>
using namespace std;
int n, h[100001];
bool vis[100001];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &h[i]);
for (int i = 1; i < n; i++) {
if (h[i - 1] < h[i] && h[i] >= h[i + 1])
h[i]--;
if (h[i] > h[i + 1]) {
puts("NO");
return 0;
}
}
puts("YES");
} | #include <algorithm>
#include <cstdio>
using namespace std;
int n, h[100001];
bool vis[100001];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &h[i]);
for (int i = 1; i < n; i++) {
if (h[i - 1] < h[i] && h[i] >= h[i + 1])
h[i]--;
if (h[i] > h[i + 1]) {
puts("No");
return 0;
}
}
puts("Yes");
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 757,923 | 757,924 | u095403512 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.