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 <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
}
bool ans = true;
for (int i = 1; i < N; i++) {
if (H[i - 1] == H[i]) {
continue;
}
if (H[i - 1] + 1 == H[i]) {
H[i]--;
} else {
ans = false;
break;
}
}
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
}
bool ans = true;
for (int i = 1; i < N; i++) {
if (H[i - 1] == H[i]) {
continue;
}
if (H[i - 1] < H[i]) {
H[i]--;
} else {
ans = false;
break;
}
}
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 756,859 | 756,860 | u275786410 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m = 0;
string ans = "Yes";
vector<int> c(n);
for (int i = 0; i < n; i++) {
cin >> c[i];
if (m - c[i] >= 2) {
cout << "No";
return 0;
}
m = max(m, c[i]);
}
cout << ans;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m = 0;
cin >> n;
string ans = "Yes";
vector<int> c(n);
for (int i = 0; i < n; i++) {
cin >> c[i];
if (m - c[i] >= 2) {
cout << "No";
return 0;
}
m = max(m, c[i]);
}
cout << ans;
}
| [] | 756,861 | 756,862 | u885523920 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> H(n, 0);
for (int i = 0; i < n; i++) {
cin >> H[i];
}
for (int i = n - 2; i >= 0; i--) {
if (H[i] == H[i + 1]) {
continue;
}
if (H[i] == H[i + 1] + 1) {
H[i] -= 1;
continue;
}
cout << "No" << endl;
return 0;
}
cout << "Yes" << endl;
return 0;
}
| #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> H(n, 0);
for (int i = 0; i < n; i++) {
cin >> H[i];
}
for (int i = n - 2; i >= 0; i--) {
if (H[i] <= H[i + 1]) {
continue;
}
if (H[i] == H[i + 1] + 1) {
H[i] -= 1;
continue;
}
cout << "No" << endl;
return 0;
}
cout << "Yes" << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,872 | 756,873 | u231230182 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, flag = 1, s;
cin >> n;
vector<int> v;
for (int i = 0; i < n; i++) {
cin >> a;
v.push_back(a);
}
for (int i = 0; i < n - 1; i++) {
if (v[i] >= v[i + 1]) {
if (v[i] - v[i + 1] > 1) {
cout << "Nohel" << endl;
return 0;
} else if (v[i] - v[i + 1] == 1) {
v[i]--;
} else if (v[i] == v[i + 1]) {
if (i == 0)
v[i]--;
else {
if (v[i - 1] != v[i]) {
v[i]--;
}
}
}
}
}
for (int i = 0; i < n - 1; i++) {
if (v[i] > v[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, flag = 1, s;
cin >> n;
vector<int> v;
for (int i = 0; i < n; i++) {
cin >> a;
v.push_back(a);
}
for (int i = 0; i < n - 1; i++) {
if (v[i] >= v[i + 1]) {
if (v[i] - v[i + 1] > 1) {
cout << "No" << endl;
return 0;
} else if (v[i] - v[i + 1] == 1) {
v[i]--;
} else if (v[i] == v[i + 1]) {
if (i == 0)
v[i]--;
else {
if (v[i - 1] != v[i]) {
v[i]--;
}
}
}
}
}
for (int i = 0; i < n - 1; i++) {
if (v[i] > v[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| [
"literal.string.change",
"io.output.change"
] | 756,881 | 756,882 | u674491576 | cpp |
p02953 | //
// main.cpp
// qtSubstitute
//
// Created by Happy on 17/09/18.
// Copyright © 2018 Mayank Yadav. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
int data[N];
for (int i = 0; i < N; i++) {
cin >> data[N];
}
bool b = true;
for (int i = N - 1; i > 0; i--) {
if (data[i] < data[i - 1]) {
data[i - 1]--;
}
}
for (int i = 0; i < N - 1; i++) {
if (data[i] > data[i + 1]) {
b = false;
}
}
if (b) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
| //
// main.cpp
// qtSubstitute
//
// Created by Happy on 17/09/18.
// Copyright © 2018 Mayank Yadav. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
int data[N];
for (int i = 0; i < N; i++) {
cin >> data[i];
}
bool b = true;
for (int i = N - 1; i > 0; i--) {
if (data[i] < data[i - 1]) {
data[i - 1]--;
}
}
// cout<<endl;
// for(int i=0;i<N;i++){
// cout<<data[i]<<endl;
// }
for (int i = 0; i < N - 1; i++) {
if (data[i] > data[i + 1]) {
b = false;
// cout<<"bkpt at ";
// cout<<i<<endl;
}
}
if (b) {
cout << "Yes";
} else {
cout << "No" << endl;
}
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"io.output.newline.add"
] | 756,883 | 756,884 | u403563240 | cpp |
p02953 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
typedef long long ll;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};
const int INF = 1e9;
#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
int guki(int a) {
if (a % 2 == 0)
return 0;
else
return 1;
}
int gcd(int a, int b) {
if (a % b == 0) {
return b;
} else {
return (gcd(b, a % b));
}
}
int lcm(int a, int b) {
int x = gcd(a, b);
return (a * b / x);
}
using namespace std;
ll k(ll a) {
a--;
ll ans = 0;
while (a != 0) {
ans += a;
a--;
}
return ans;
}
// global val ^^
int main() {
int n;
cin >> n;
n--;
int x;
cin >> x;
int i1, i2;
int y;
bool fl;
i1 = x;
REP(i, n) {
cin >> y;
if (i == 0) {
i2 = y;
if (x == y + 1) {
x = y;
continue;
}
}
if ((x == y) || (x + 1 == y)) {
continue;
} else if (x + 1 < y) {
y--;
x = y;
} else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
typedef long long ll;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};
const int INF = 1e9;
#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
int guki(int a) {
if (a % 2 == 0)
return 0;
else
return 1;
}
int gcd(int a, int b) {
if (a % b == 0) {
return b;
} else {
return (gcd(b, a % b));
}
}
int lcm(int a, int b) {
int x = gcd(a, b);
return (a * b / x);
}
using namespace std;
ll k(ll a) {
a--;
ll ans = 0;
while (a != 0) {
ans += a;
a--;
}
return ans;
}
// global val ^^
int main() {
int n;
cin >> n;
n--;
int x;
cin >> x;
int i1, i2;
int y;
bool fl;
i1 = x;
REP(i, n) {
cin >> y;
if (i == 0) {
i2 = y;
if (x == y + 1) {
x = y;
continue;
}
}
if ((x == y) || (x + 1 == y)) {
continue;
} else if (x + 1 < y) {
y--;
x = y;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,888 | 756,889 | u339558464 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
#define rep(i, n) for (int i = 0; i < n; i++)
#define fogg(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define test \
int t; \
cin >> t; \
while (t--)
#define debug(x) cout << '>' << #x << ':' << x << "\n";
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
int main() {
int n;
cin >> n;
int a[n];
rep(i, n) { cin >> a[i]; }
int flag = 1;
for (int i = n - 1; i > 0; i--) {
if (a[i - 1] > a[i]) {
if (a[i - 1] - 1 <= a[i]) {
a[i - 1]--;
} else {
flag = 0;
break;
}
}
}
if (flag == 1) {
cout << "YES";
} else {
cout << "NO";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
#define rep(i, n) for (int i = 0; i < n; i++)
#define fogg(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define test \
int t; \
cin >> t; \
while (t--)
#define debug(x) cout << '>' << #x << ':' << x << "\n";
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
int main() {
int n;
cin >> n;
int a[n];
rep(i, n) { cin >> a[i]; }
int flag = 1;
for (int i = n - 1; i > 0; i--) {
if (a[i - 1] > a[i]) {
if (a[i - 1] - 1 <= a[i]) {
a[i - 1]--;
} else {
flag = 0;
break;
}
}
}
if (flag == 1) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,892 | 756,893 | u391494739 | cpp |
p02953 | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pii std::pair<int, int>
#define pli std::pair<ll, int>
#define pil std::pair<int, ll>
#define psi std::pair<string, int>
#define pll std::pair<ll, ll>
#define pci std::pair<char, int>
#define sll(x) scanf("%lld", &x)
#define prll(x) printf("%lld ", x)
#define pri(x) printf("%d ", x)
#define si(x) scanf("%d", &x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int, int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int, ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll INF = 10000000000000;
const ll mod = 1e9 + 7;
using namespace std;
void add(ll &a, ll b) {
a += b;
if (a >= mod)
a -= mod;
}
ll mul(ll a, ll b) { return (a * b) % mod; }
ull Pow(ull a, ull b) {
if (b == 0)
return 1;
ull c = Pow(a, b / 2);
if (b % 2)
return (a * ((c * c) % mod)) % mod;
return (c * c) % mod;
}
int main() {
IOS;
cout.precision(30);
int n;
cin >> n;
vll a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
a[0]--;
for (int i = 1; i < n; i++) {
if (a[i] - 1 >= a[i - 1])
a[i]--;
else if (a[i] < a[i - 1])
return cout << "NO" << endl, 0;
}
cout << "YES" << endl;
return 0;
}
| #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define pii std::pair<int, int>
#define pli std::pair<ll, int>
#define pil std::pair<int, ll>
#define psi std::pair<string, int>
#define pll std::pair<ll, ll>
#define pci std::pair<char, int>
#define sll(x) scanf("%lld", &x)
#define prll(x) printf("%lld ", x)
#define pri(x) printf("%d ", x)
#define si(x) scanf("%d", &x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int, int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int, ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const ll INF = 10000000000000;
const ll mod = 1e9 + 7;
using namespace std;
void add(ll &a, ll b) {
a += b;
if (a >= mod)
a -= mod;
}
ll mul(ll a, ll b) { return (a * b) % mod; }
ull Pow(ull a, ull b) {
if (b == 0)
return 1;
ull c = Pow(a, b / 2);
if (b % 2)
return (a * ((c * c) % mod)) % mod;
return (c * c) % mod;
}
int main() {
IOS;
cout.precision(30);
int n;
cin >> n;
vll a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
a[0]--;
for (int i = 1; i < n; i++) {
if (a[i] - 1 >= a[i - 1])
a[i]--;
else if (a[i] < a[i - 1])
return cout << "No" << endl, 0;
}
cout << "Yes" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"function.return_value.change",
"expression.operation.binary.change",
"io.output.change"
] | 756,902 | 756,903 | u752814744 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
long long n;
long long a[500000];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i < n; i++) {
if (a[i] - 1 >= a[i - 1]) {
a[i]--;
}
}
for (int i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
cout << "NO";
return 0;
}
}
cout << "YES";
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
long long n;
long long a[500000];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i < n; i++) {
if (a[i] - 1 >= a[i - 1]) {
a[i]--;
}
}
for (int i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
cout << "No";
return 0;
}
}
cout << "Yes";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,927 | 756,928 | u798339690 | cpp |
p02953 | #include <algorithm>
#include <iostream>
using namespace std;
int i[114514];
int main() {
int a, b, c, d = 0, e;
cin >> a >> i[0];
for (int n = 1; n < a; n++) {
cin >> i[n];
if (i[n] > i[n - 1])
i[n]--;
if (i[n - 1] > i[n])
d++;
}
if (d > 0)
cout << "NO\n";
else
cout << "YES\n";
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
int i[114514];
int main() {
int a, b, c, d = 0, e;
cin >> a >> i[0];
for (int n = 1; n < a; n++) {
cin >> i[n];
if (i[n] > i[n - 1])
i[n]--;
if (i[n - 1] > i[n])
d++;
}
if (d > 0)
cout << "No\n";
else
cout << "Yes\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,929 | 756,930 | u699392591 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, memo = 0;
cin >> n;
vector<int> h(n);
vector<int> j(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int num = h[n - 1];
for (int i = n - 1; i < 0; i--) {
if (h[i] - 1 > num) {
cout << "No" << endl;
return 0;
}
num = min(num, h[i]);
}
cout << "Yes" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, memo = 0;
cin >> n;
vector<int> h(n);
vector<int> j(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int num = h[n - 1];
for (int i = n - 1; i >= 0; i--) {
if (h[i] - 1 > num) {
cout << "No" << endl;
return 0;
}
num = min(num, h[i]);
}
cout << "Yes" << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 756,933 | 756,934 | u735909278 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(a, b) for (int a = 0; a < (b); ++a)
#define REP1(i, n) for (int i = 1; i <= (n); ++i)
#define debug(x) cerr << #x << ": " << x << '\n'
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1 << 29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
template <class T = int> T in() {
T x;
cin >> x;
return (x);
}
template <class T> void print(T &x) { cout << x << '\n'; }
const int MOD = (int)1e9 + 7;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMint() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
if (a > b) {
swap(a, b);
}
return gcd(a, b % a);
}
ll lcm(ll a, ll b) {
ll g;
g = gcd(a, b);
return a * b / g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int h[n + 10];
REP(i, n) { cin >> h[i]; }
for (int i = n - 1; i > 0; i--) {
if (h[i - 1] > h[i]) {
h[i - 1]--;
}
}
REP(i, n) {
if (h[i] > h[i + 1]) {
print("No");
return 0;
}
}
print("Yes");
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(a, b) for (int a = 0; a < (b); ++a)
#define REP1(i, n) for (int i = 1; i <= (n); ++i)
#define debug(x) cerr << #x << ": " << x << '\n'
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1 << 29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
template <class T = int> T in() {
T x;
cin >> x;
return (x);
}
template <class T> void print(T &x) { cout << x << '\n'; }
const int MOD = (int)1e9 + 7;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMint() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
if (a > b) {
swap(a, b);
}
return gcd(a, b % a);
}
ll lcm(ll a, ll b) {
ll g;
g = gcd(a, b);
return a * b / g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int h[n + 10];
REP(i, n) { cin >> h[i]; }
for (int i = n - 1; i > 0; i--) {
if (h[i - 1] > h[i]) {
h[i - 1]--;
}
}
REP(i, n - 1) {
if (h[i] > h[i + 1]) {
print("No");
return 0;
}
}
print("Yes");
return 0;
}
| [
"expression.operation.binary.add"
] | 756,935 | 756,936 | u311671153 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(a, b) for (int a = 0; a < (b); ++a)
#define REP1(i, n) for (int i = 1; i <= (n); ++i)
#define debug(x) cerr << #x << ": " << x << '\n'
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1 << 29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
template <class T = int> T in() {
T x;
cin >> x;
return (x);
}
template <class T> void print(T &x) { cout << x << '\n'; }
const int MOD = (int)1e9 + 7;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMint() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
if (a > b) {
swap(a, b);
}
return gcd(a, b % a);
}
ll lcm(ll a, ll b) {
ll g;
g = gcd(a, b);
return a * b / g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int h[n + 10];
REP(i, n) { cin >> h[i]; }
for (int i = n - 1; i > 0; i--) {
if (h[i - 1] > h[i]) {
h[i - 1]--;
}
}
REP(i, n) {
if (h[i] > h[i + 1]) {
print("No");
return 0;
}
}
print("Yes");
return 0;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(a, b) for (int a = 0; a < (b); ++a)
#define REP1(i, n) for (int i = 1; i <= (n); ++i)
#define debug(x) cerr << #x << ": " << x << '\n'
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1 << 29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
template <class T = int> T in() {
T x;
cin >> x;
return (x);
}
template <class T> void print(T &x) { cout << x << '\n'; }
const int MOD = (int)1e9 + 7;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMint() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
if (a > b) {
swap(a, b);
}
return gcd(a, b % a);
}
ll lcm(ll a, ll b) {
ll g;
g = gcd(a, b);
return a * b / g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int h[n + 10];
REP(i, n) { cin >> h[i]; }
for (int i = n - 1; i > 0; i--) {
if (h[i - 1] > h[i]) {
h[i - 1]--;
}
}
REP(i, n - 1) {
if (h[i] > h[i + 1]) {
print("No");
return 0;
}
}
print("Yes");
return 0;
}
| [
"expression.operation.binary.add"
] | 756,937 | 756,936 | u311671153 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
const string YES = "Yes";
const string NO = "No";
int func(long long N, std::vector<long long> H) {
// cout << N << endl;
// for (auto& e : H) {
// cout << e << " ";
// }
for (ll i = N - 1; i > 0; i--) {
if (H[i - 1] == H[i] + 1) {
H[i]--;
} else if (H[i - 1] > H[i]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// cout << fixed << setprecision(5);
long long N;
// scanf("%lld", &N);
cin >> N;
std::vector<long long> H(N);
for (int i = 0; i < N; i++) {
// scanf("%lld", &H[i]);
cin >> H[i];
}
func(N, std::move(H));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
const string YES = "Yes";
const string NO = "No";
int func(long long N, std::vector<long long> H) {
// cout << N << endl;
// for (auto& e : H) {
// cout << e << " ";
// }
for (ll i = N - 1; i > 0; i--) {
if (H[i - 1] == H[i] + 1) {
H[i - 1]--;
} else if (H[i - 1] > H[i]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// cout << fixed << setprecision(5);
long long N;
// scanf("%lld", &N);
cin >> N;
std::vector<long long> H(N);
for (int i = 0; i < N; i++) {
// scanf("%lld", &H[i]);
cin >> H[i];
}
func(N, std::move(H));
return 0;
}
| [
"expression.operation.binary.add"
] | 756,938 | 756,939 | u766205979 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
const string YES = "Yes";
const string NO = "No";
int func(long long N, std::vector<long long> H) {
// cout << N << endl;
// for (auto& e : H) {
// cout << e << " ";
// }
rep1r(i, N - 1) {
// for (ll i = N - 1; i > 0; i--) {
if (H[i - 1] <= H[i]) {
continue;
// } else if (H[i - 1] == H[i] + 1) {
} else if (H[i] - H[i - 1] == -1) {
H[i]++;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// cout << fixed << setprecision(5);
long long N;
// scanf("%lld", &N);
cin >> N;
std::vector<long long> H(N);
for (int i = 0; i < N; i++) {
// scanf("%lld", &H[i]);
cin >> H[i];
}
func(N, std::move(H));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
const string YES = "Yes";
const string NO = "No";
int func(long long N, std::vector<long long> H) {
// cout << N << endl;
// for (auto& e : H) {
// cout << e << " ";
// }
rep1r(i, N - 1) {
// for (ll i = N - 1; i > 0; i--) {
if (H[i - 1] <= H[i]) {
continue;
// } else if (H[i - 1] == H[i] + 1) {
} else if (H[i] - H[i - 1] == -1) {
H[i - 1]--;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// cout << fixed << setprecision(5);
long long N;
// scanf("%lld", &N);
cin >> N;
std::vector<long long> H(N);
for (int i = 0; i < N; i++) {
// scanf("%lld", &H[i]);
cin >> H[i];
}
func(N, std::move(H));
return 0;
}
| [
"expression.operation.binary.add"
] | 756,948 | 756,949 | u766205979 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
const string YES = "Yes";
const string NO = "No";
int func(long long N, std::vector<long long> H) {
rep(i, N - 1) {
if (H[i] <= H[i + 1]) {
continue;
} else {
if (H[i + 1] - H[i] == -1) {
H[i + 1]--;
} else {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// cout << fixed << setprecision(5);
long long N;
scanf("%lld", &N);
// cin >> N;
std::vector<long long> H(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &H[i]);
// cin >> H[i];
}
func(N, std::move(H));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
const string YES = "Yes";
const string NO = "No";
int func(long long N, std::vector<long long> H) {
rep(i, N - 1) {
if (H[i] <= H[i + 1]) {
continue;
} else {
if (H[i + 1] - H[i] == -1) {
H[i + 1]++;
} else {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// cout << fixed << setprecision(5);
long long N;
scanf("%lld", &N);
// cin >> N;
std::vector<long long> H(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &H[i]);
// cin >> H[i];
}
func(N, std::move(H));
return 0;
}
| [] | 756,951 | 756,952 | u766205979 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 2; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 2; i++) {
if (H[i] < H[i + 1])
H[i]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,964 | 756,965 | u270825463 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 2; i++) {
if (A[i] < A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 2; i++) {
if (H[i] < H[i + 1])
H[i]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,966 | 756,965 | u270825463 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 2; i++) {
if (A[i] < A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 2; i++) {
if (H[i] > H[i + 1])
H[i + 1]--;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,967 | 756,965 | u270825463 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 2; i++) {
if (A[i] < A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 2; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,968 | 756,965 | u270825463 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 2; i++) {
if (A[i] < A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 2; i++) {
if (H[i] < H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,969 | 756,965 | u270825463 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 2; i++) {
if (A[i] < A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 2; i++) {
if (H[i] < H[i + 1])
H[i + 1]--;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int check(int A[], int N) {
for (int i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1])
return 0;
}
return 1;
}
int main() {
int N;
cin >> N;
int H[N];
for (int i = 0; i < N; i++) {
cin >> H[i];
H[i] -= 1;
}
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1])
H[i + 1]++;
}
if (check(H, N))
printf("Yes");
else
printf("No");
return 0;
}
| [
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,970 | 756,965 | u270825463 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repback(i, n, k) for (int i = int(n); i >= (int)(k); --i)
typedef long long ll;
int main() {
int n, m;
cin >> n;
vector<int> h(n); //配列
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < n - 1; i++) {
if (i == 0)
continue;
if (h[i - 1] > h[i]) {
puts("No");
return 0;
}
if (h[i - 1] < h[i]) {
h[i]--;
}
}
puts("Yes");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repback(i, n, k) for (int i = int(n); i >= (int)(k); --i)
typedef long long ll;
int main() {
int n, m;
cin >> n;
vector<int> h(n); //配列
for (int i = 0; i < n; i++) {
cin >> h[i];
}
for (int i = 0; i < n; i++) {
if (i == 0)
continue;
if (h[i - 1] > h[i]) {
puts("No");
return 0;
}
if (h[i - 1] < h[i]) {
h[i]--;
}
}
puts("Yes");
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 756,971 | 756,972 | u453500284 | 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 > 1; i--) {
if (H[i - 1] > H[i] + 1) {
cout << "No" << endl;
return 0;
}
if (H[i - 1] == H[i] + 1) {
H[i - 1]--;
}
}
cout << "Yes" << 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[i];
}
for (int i = N - 1; i > 0; i--) {
if (H[i - 1] > H[i] + 1) {
cout << "No" << endl;
return 0;
}
if (H[i - 1] == H[i] + 1) {
H[i - 1]--;
}
}
cout << "Yes" << endl;
} | [
"control_flow.loop.for.initializer.change",
"literal.number.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 756,973 | 756,974 | u510383220 | cpp |
p02953 | //#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
template <class c>
typename enable_if<sizeof dud<c>(0) != 1, debug &>::type operator<<(c i) {
cerr << boolalpha << i;
return *this;
}
template <class c, int = 0>
typename enable_if<sizeof dud<c>(0) == 1, debug &>::type operator<<(c i) {
return *this << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
};
#define watch(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ((X) > 0 ? (X) : (-(X)))
#define S(X) ((X) * (X))
#define SZ(V) (int)V.size()
#define FORN(i, n) for (int i = 0; i < n; i++)
#define FORAB(i, a, b) for (int i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C) ((B) <= (A) && (A) <= (C))
#define AIN(A, B, C) assert(IN(A, B, C))
// typedef int LL;
typedef long long int LL;
// typedef __int128 LLL;
typedef long long LLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PLL> VPL;
typedef vector<PII> VP;
typedef vector<double> VD;
typedef vector<vector<int>> VVI;
typedef long double ld;
const LL MOD = 998244353;
int a[200005], b[200005];
void solve(int ks) {
int n;
scanf("%d", &n);
FORAB(i, 1, n) scanf("%d", &a[i]);
for (int i = n - 1; i >= 1; i--) {
if (a[i + 1] >= a[i])
;
a[i]--;
if (a[i + 1] < a[i]) {
printf("No\n");
return;
}
}
printf("Yes\n");
}
int main() {
#ifdef LOCAL
double start_time = clock();
freopen("C:\\Home\\ContestCodes\\sample.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif
if (0) {
int T;
scanf("%d", &T);
// AIN(T, 1, 25);
for (int ks = 1; ks <= T; ks++) {
solve(ks);
fprintf(stderr, "%d done\n", ks);
}
} else {
solve(0);
}
#ifdef LOCAL
double end_time = clock();
fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC);
#endif
return 0;
}
| //#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
template <class c>
typename enable_if<sizeof dud<c>(0) != 1, debug &>::type operator<<(c i) {
cerr << boolalpha << i;
return *this;
}
template <class c, int = 0>
typename enable_if<sizeof dud<c>(0) == 1, debug &>::type operator<<(c i) {
return *this << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
};
#define watch(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ((X) > 0 ? (X) : (-(X)))
#define S(X) ((X) * (X))
#define SZ(V) (int)V.size()
#define FORN(i, n) for (int i = 0; i < n; i++)
#define FORAB(i, a, b) for (int i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C) ((B) <= (A) && (A) <= (C))
#define AIN(A, B, C) assert(IN(A, B, C))
// typedef int LL;
typedef long long int LL;
// typedef __int128 LLL;
typedef long long LLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PLL> VPL;
typedef vector<PII> VP;
typedef vector<double> VD;
typedef vector<vector<int>> VVI;
typedef long double ld;
const LL MOD = 998244353;
int a[200005], b[200005];
void solve(int ks) {
int n;
scanf("%d", &n);
FORAB(i, 1, n) scanf("%d", &a[i]);
for (int i = n - 1; i >= 1; i--) {
if (a[i + 1] >= a[i])
continue;
a[i]--;
if (a[i + 1] < a[i]) {
printf("No\n");
return;
}
}
printf("Yes\n");
}
int main() {
#ifdef LOCAL
double start_time = clock();
freopen("C:\\Home\\ContestCodes\\sample.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif
if (0) {
int T;
scanf("%d", &T);
// AIN(T, 1, 25);
for (int ks = 1; ks <= T; ks++) {
solve(ks);
fprintf(stderr, "%d done\n", ks);
}
} else {
solve(0);
}
#ifdef LOCAL
double end_time = clock();
fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC);
#endif
return 0;
}
| [
"control_flow.continue.add"
] | 756,978 | 756,979 | u484505863 | cpp |
p02953 | #include <bits/stdc++.h>
#include <stdint.h>
#define ii pair<int, int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long int
using namespace std;
int32_t main() {
int n, x;
cin >> n;
int c = 0;
for (int i = 0; i < n; i++) {
cin >> x;
if (x < c) {
cout << "NO";
return 0;
} else if (x > c) {
c = max(c, x - 1);
}
}
cout << "YES";
}
| #include <bits/stdc++.h>
#include <stdint.h>
#define ii pair<int, int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long int
using namespace std;
int32_t main() {
int n, x;
cin >> n;
int c = 0;
for (int i = 0; i < n; i++) {
cin >> x;
if (x < c) {
cout << "No";
return 0;
} else if (x > c) {
c = max(c, x - 1);
}
}
cout << "Yes";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,982 | 756,983 | u894807349 | cpp |
p02953 | #include <bits/stdc++.h>
#include <stdint.h>
#define ii pair<int, int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long int
using namespace std;
int32_t main() {
int n, x;
cin >> n;
int c = 0;
for (int i = 0; i < n; i++) {
cin >> x;
if (x < c) {
cout << "NO\n";
return 0;
} else if (x > c) {
c = max(c, x - 1);
}
}
cout << "YES\n";
}
| #include <bits/stdc++.h>
#include <stdint.h>
#define ii pair<int, int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long int
using namespace std;
int32_t main() {
int n, x;
cin >> n;
int c = 0;
for (int i = 0; i < n; i++) {
cin >> x;
if (x < c) {
cout << "No";
return 0;
} else if (x > c) {
c = max(c, x - 1);
}
}
cout << "Yes";
}
| [
"literal.string.change",
"io.output.change"
] | 756,984 | 756,983 | u894807349 | cpp |
p02953 | /*
Converted from Scratch by scratch2cpp
(https://github.com/yos1up/scratch2cpp).
*/
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
#define debug \
cerr << "--" << __LINE__ << "--" \
<< "\n"
typedef long long ll;
using namespace std;
class Var { // NOTE: immutable
public:
mutable string sval;
mutable long double dval;
enum NumericState { UNKNOWN = -1, STRINGY = 0, NUMERIC = 1 };
mutable NumericState numericState;
mutable bool svalValid, dvalValid; // TODO: initialize at here?
Var() { *this = Var(""); }
Var(string s) {
sval = s;
svalValid = true;
dvalValid = false;
numericState = UNKNOWN;
}
Var(long double d) {
dval = d;
svalValid = false;
dvalValid = true;
numericState = NUMERIC;
}
Var(const Var &v) {
sval = string(v.sval);
dval = v.dval;
svalValid = v.svalValid;
dvalValid = v.dvalValid;
numericState = v.numericState;
}
void fillDval() const {
if (dvalValid)
return;
double d;
bool numeric = isNumericString(sval, &d);
if (numeric) {
numericState = NUMERIC;
dval = d;
} else {
numericState = STRINGY;
dval = 0.0;
}
dvalValid = true;
}
static bool isNumericString(const string &s, double *ptr) {
char *ep;
// cause side-effect: errno can be ERANGE after calling strtod
*ptr = strtod(s.c_str(), &ep);
// TODO: support long double (with strtold)
// Scratch 3.0 recognize the string cause underflows or overflows as Numeric
return NULL != ep && '\0' == ep[0] && s[0] != '\0';
}
bool isNumeric() const {
fillDval();
return numericState == NUMERIC;
}
void fillSval() const {
if (svalValid)
return;
sval = (floor(dval) == dval) ? to_string((ll)dval) : to_string(dval);
svalValid = true;
}
long double asNumber() const {
fillDval();
return dval;
}
string asString() const {
fillSval();
return sval;
}
Var operator+(const Var &y) const {
return Var(this->asNumber() + y.asNumber());
}
Var operator+=(const Var &y) {
*this = *this + y;
return *this;
}
Var operator-(const Var &y) const {
return Var(this->asNumber() - y.asNumber());
}
Var operator*(const Var &y) const {
return Var(this->asNumber() * y.asNumber());
}
Var operator/(const Var &y) const {
return Var(this->asNumber() / y.asNumber());
}
Var operator%(const Var &y) const {
return Var(fmod(this->asNumber(), y.asNumber()));
}
bool operator<(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() < y.asNumber();
} // compare as number if both can be interpreted as numeric
return this->asString() < y.asString();
}
bool operator>(const Var &y) const { return y < *this; }
bool operator==(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() == y.asNumber();
} // compare as numeric if both are numeric
return this->asString() == y.asString();
}
friend ostream &operator<<(ostream &os, const Var &p);
friend istream &operator>>(istream &is, const Var &p);
};
ostream &operator<<(ostream &os, const Var &p) {
os << p.asString();
return os;
}
istream &operator>>(istream &is, Var &p) {
string s;
is >> s;
p = Var(s);
return is;
}
Var letterOf(Var index, Var sourceString) {
/* index: 1-origined */
string str = sourceString.asString();
int idx = (int)(index.asNumber() - 1);
// seem to be dirty but Scratch seems to do like this.
// ex. letterOf(0.01, "world") == "w", letterOf(1.99, "world") == "w",
// letterOf(5.99, "world") == "d"
if (0 <= idx && idx < str.size())
return Var(str.substr(idx, 1));
return Var();
}
class VarList {
public:
vector<Var> data;
VarList(const vector<Var> &x) { data = x; }
void push_back(const Var &x) { data.push_back(x); }
void pop_back() { data.pop_back(); }
void clear() { data.clear(); }
int size() { return (int)data.size(); }
Var getLineOfList(const Var &index) const {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
// (unlike 'letterOf', index==0.9 does not work.)
if (0 <= idx && idx < data.size())
return data[idx];
return Var();
}
void setLineOfListTo(const Var &index, const Var &v) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data[idx] = v;
}
void deleteLineOfList(const Var &index) {
/* index: 1-origined */
string kwd = index.asString();
if (kwd == "all") {
data.clear();
} else if (kwd == "last") {
data.pop_back();
} else {
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data.erase(data.begin() + idx);
}
}
void insertAtIndexOfList(const Var &item, const Var &index) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx <= data.size())
data.insert(data.begin() + idx, item);
}
void insertAtRandomOfList(const Var &item) {
int idx = rand() % (data.size() + 1);
data.insert(data.begin() + idx, item);
}
string asString() const {
/* concatenate elements of list with space */
// TODO: concatenated without spaces only if all elements are single
// characters. (Is it an official bug? (or feature?))
string ret;
for (int i = 0; i < data.size(); i++) {
if (i > 0)
ret += ' ';
ret += data[i].asString();
}
return ret;
}
int itemNumOfList(const Var &item) const {
auto itr = find(data.begin(), data.end(), item);
if (itr == data.end())
return 0;
return 1 + (int)(itr - data.begin());
/* index: 1-origined */
}
friend ostream &operator<<(ostream &os, const VarList &p);
};
ostream &operator<<(ostream &os, const VarList &p) {
os << p.asString();
return os;
}
long double randUniform(const long double x, const long double y) {
if (x > y)
return randUniform(y, x);
if (floor(x) == x && floor(y) == y) {
ll xi = (ll)round(x), yi = (ll)round(y);
return xi + rand() % (yi - xi + 1);
} else {
return x + (y - x) * (0.0 + rand()) / RAND_MAX;
}
}
Var buf_answer; // for "answer"
// ============================= Scripts =============================
// variable declaration
Var var_n(0);
Var var_i(0);
// list declaration
VarList list_h({});
// prototype declaration of functions
int main();
// contents of functions
int main() {
cin >> buf_answer;
var_n = buf_answer;
for (int cnt_0 = 0; cnt_0 < var_n.asNumber(); cnt_0++) {
cin >> buf_answer;
list_h.push_back(buf_answer);
}
var_i = Var(0);
for (int cnt_1 = 0; cnt_1 < (var_n - Var(1)).asNumber(); cnt_1++) {
var_i += Var(1);
}
if ((!(list_h.getLineOfList(var_i) ==
list_h.getLineOfList((var_i + Var(1)))))) {
if ((list_h.getLineOfList(var_i) <
list_h.getLineOfList((var_i + Var(1))))) {
list_h.setLineOfListTo((var_i + Var(1)),
(list_h.getLineOfList((var_i + Var(1))) - Var(1)));
} else {
cout << Var("No") << endl;
return 0;
}
}
cout << Var("Yes") << endl;
return 0;
return 0;
}
| /*
Converted from Scratch by scratch2cpp
(https://github.com/yos1up/scratch2cpp).
*/
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
#define debug \
cerr << "--" << __LINE__ << "--" \
<< "\n"
typedef long long ll;
using namespace std;
class Var { // NOTE: immutable
public:
mutable string sval;
mutable long double dval;
enum NumericState { UNKNOWN = -1, STRINGY = 0, NUMERIC = 1 };
mutable NumericState numericState;
mutable bool svalValid, dvalValid; // TODO: initialize at here?
Var() { *this = Var(""); }
Var(string s) {
sval = s;
svalValid = true;
dvalValid = false;
numericState = UNKNOWN;
}
Var(long double d) {
dval = d;
svalValid = false;
dvalValid = true;
numericState = NUMERIC;
}
Var(const Var &v) {
sval = string(v.sval);
dval = v.dval;
svalValid = v.svalValid;
dvalValid = v.dvalValid;
numericState = v.numericState;
}
void fillDval() const {
if (dvalValid)
return;
double d;
bool numeric = isNumericString(sval, &d);
if (numeric) {
numericState = NUMERIC;
dval = d;
} else {
numericState = STRINGY;
dval = 0.0;
}
dvalValid = true;
}
static bool isNumericString(const string &s, double *ptr) {
char *ep;
// cause side-effect: errno can be ERANGE after calling strtod
*ptr = strtod(s.c_str(), &ep);
// TODO: support long double (with strtold)
// Scratch 3.0 recognize the string cause underflows or overflows as Numeric
return NULL != ep && '\0' == ep[0] && s[0] != '\0';
}
bool isNumeric() const {
fillDval();
return numericState == NUMERIC;
}
void fillSval() const {
if (svalValid)
return;
sval = (floor(dval) == dval) ? to_string((ll)dval) : to_string(dval);
svalValid = true;
}
long double asNumber() const {
fillDval();
return dval;
}
string asString() const {
fillSval();
return sval;
}
Var operator+(const Var &y) const {
return Var(this->asNumber() + y.asNumber());
}
Var operator+=(const Var &y) {
*this = *this + y;
return *this;
}
Var operator-(const Var &y) const {
return Var(this->asNumber() - y.asNumber());
}
Var operator*(const Var &y) const {
return Var(this->asNumber() * y.asNumber());
}
Var operator/(const Var &y) const {
return Var(this->asNumber() / y.asNumber());
}
Var operator%(const Var &y) const {
return Var(fmod(this->asNumber(), y.asNumber()));
}
bool operator<(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() < y.asNumber();
} // compare as number if both can be interpreted as numeric
return this->asString() < y.asString();
}
bool operator>(const Var &y) const { return y < *this; }
bool operator==(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() == y.asNumber();
} // compare as numeric if both are numeric
return this->asString() == y.asString();
}
friend ostream &operator<<(ostream &os, const Var &p);
friend istream &operator>>(istream &is, const Var &p);
};
ostream &operator<<(ostream &os, const Var &p) {
os << p.asString();
return os;
}
istream &operator>>(istream &is, Var &p) {
string s;
is >> s;
p = Var(s);
return is;
}
Var letterOf(Var index, Var sourceString) {
/* index: 1-origined */
string str = sourceString.asString();
int idx = (int)(index.asNumber() - 1);
// seem to be dirty but Scratch seems to do like this.
// ex. letterOf(0.01, "world") == "w", letterOf(1.99, "world") == "w",
// letterOf(5.99, "world") == "d"
if (0 <= idx && idx < str.size())
return Var(str.substr(idx, 1));
return Var();
}
class VarList {
public:
vector<Var> data;
VarList(const vector<Var> &x) { data = x; }
void push_back(const Var &x) { data.push_back(x); }
void pop_back() { data.pop_back(); }
void clear() { data.clear(); }
int size() { return (int)data.size(); }
Var getLineOfList(const Var &index) const {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
// (unlike 'letterOf', index==0.9 does not work.)
if (0 <= idx && idx < data.size())
return data[idx];
return Var();
}
void setLineOfListTo(const Var &index, const Var &v) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data[idx] = v;
}
void deleteLineOfList(const Var &index) {
/* index: 1-origined */
string kwd = index.asString();
if (kwd == "all") {
data.clear();
} else if (kwd == "last") {
data.pop_back();
} else {
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data.erase(data.begin() + idx);
}
}
void insertAtIndexOfList(const Var &item, const Var &index) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx <= data.size())
data.insert(data.begin() + idx, item);
}
void insertAtRandomOfList(const Var &item) {
int idx = rand() % (data.size() + 1);
data.insert(data.begin() + idx, item);
}
string asString() const {
/* concatenate elements of list with space */
// TODO: concatenated without spaces only if all elements are single
// characters. (Is it an official bug? (or feature?))
string ret;
for (int i = 0; i < data.size(); i++) {
if (i > 0)
ret += ' ';
ret += data[i].asString();
}
return ret;
}
int itemNumOfList(const Var &item) const {
auto itr = find(data.begin(), data.end(), item);
if (itr == data.end())
return 0;
return 1 + (int)(itr - data.begin());
/* index: 1-origined */
}
friend ostream &operator<<(ostream &os, const VarList &p);
};
ostream &operator<<(ostream &os, const VarList &p) {
os << p.asString();
return os;
}
long double randUniform(const long double x, const long double y) {
if (x > y)
return randUniform(y, x);
if (floor(x) == x && floor(y) == y) {
ll xi = (ll)round(x), yi = (ll)round(y);
return xi + rand() % (yi - xi + 1);
} else {
return x + (y - x) * (0.0 + rand()) / RAND_MAX;
}
}
Var buf_answer; // for "answer"
// ============================= Scripts =============================
// variable declaration
Var var_n(0);
Var var_i(0);
// list declaration
VarList list_h({});
// prototype declaration of functions
int main();
// contents of functions
int main() {
cin >> buf_answer;
var_n = buf_answer;
for (int cnt_0 = 0; cnt_0 < var_n.asNumber(); cnt_0++) {
cin >> buf_answer;
list_h.push_back(buf_answer);
}
var_i = Var(0);
for (int cnt_1 = 0; cnt_1 < (var_n - Var(1)).asNumber(); cnt_1++) {
var_i += Var(1);
if ((!(list_h.getLineOfList(var_i) ==
list_h.getLineOfList((var_i + Var(1)))))) {
if ((list_h.getLineOfList(var_i) <
list_h.getLineOfList((var_i + Var(1))))) {
list_h.setLineOfListTo(
(var_i + Var(1)),
(list_h.getLineOfList((var_i + Var(1))) - Var(1)));
} else {
cout << Var("No") << endl;
return 0;
}
}
}
cout << Var("Yes") << endl;
return 0;
return 0;
}
| [] | 756,985 | 756,986 | u917972976 | cpp |
p02953 | #define sp ' '
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a, b, i, ans, max;
cin >> a;
ans = 0;
max = 0;
for (i = 1; i <= a; i++) {
cin >> b;
if (max - b > 1) {
ans = -1;
}
if (b >= max) {
max = b;
}
}
if (ans == 0) {
cout << "yes";
} else {
cout << "no";
}
return 0;
} | #define sp ' '
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a, b, i, ans, max;
cin >> a;
ans = 0;
max = 0;
for (i = 1; i <= a; i++) {
cin >> b;
if (max - b > 1) {
ans = -1;
}
if (b >= max) {
max = b;
}
}
if (ans == 0) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,989 | 756,990 | u293317519 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N;
cin >> N;
vector<ll> H(N);
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = 0; i < N; i++) {
if (i == 0)
H[i]--;
else if (H[i] - H[i - 1] >= 1)
H[i]--;
if (H[i - 1] > H[i]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N;
cin >> N;
vector<ll> H(N);
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = 0; i < N; i++) {
if (i == 0)
H[i]--;
else if (H[i] - H[i - 1] >= 1)
H[i]--;
if (i != 0 && H[i - 1] > H[i]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 756,999 | 757,000 | u839397805 | cpp |
p02953 |
#include <iomanip>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
void C();
bool subC(int *, int);
int main() { C(); }
void C() {
int N;
cin >> N;
int *H = new int[N];
for (int i = 0; i < N; i++)
cin >> H[i];
if (subC(H, N))
cout << "yes" << endl;
else
cout << "no" << endl;
delete[] H;
}
bool subC(int *H, int len) {
int tempMax = 0;
for (int i = 0; i < len - 1; i++) {
tempMax = fmax(tempMax, H[i]);
if (tempMax >= H[i + 1] + 2)
return false;
}
return true;
}
// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー
// 作業を開始するためのヒント:
// 1. ソリューション エクスプローラー
// ウィンドウを使用してファイルを追加/管理します
// 2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
// 3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
// 4. エラー一覧ウィンドウを使用してエラーを表示します
// 5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード
// ファイルを作成するか、[プロジェクト] > [既存の項目の追加]
// と移動して既存のコード ファイルをプロジェクトに追加します
// 6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] >
// [プロジェクト] と移動して .sln ファイルを選択します
|
#include <iomanip>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
void C();
bool subC(int *, int);
int main() { C(); }
void C() {
int N;
cin >> N;
int *H = new int[N];
for (int i = 0; i < N; i++)
cin >> H[i];
if (subC(H, N))
cout << "Yes" << endl;
else
cout << "No" << endl;
delete[] H;
}
bool subC(int *H, int len) {
int tempMax = 0;
for (int i = 0; i < len - 1; i++) {
tempMax = fmax(tempMax, H[i]);
if (tempMax >= H[i + 1] + 2)
return false;
}
return true;
}
// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー
// 作業を開始するためのヒント:
// 1. ソリューション エクスプローラー
// ウィンドウを使用してファイルを追加/管理します
// 2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
// 3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
// 4. エラー一覧ウィンドウを使用してエラーを表示します
// 5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード
// ファイルを作成するか、[プロジェクト] > [既存の項目の追加]
// と移動して既存のコード ファイルをプロジェクトに追加します
// 6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] >
// [プロジェクト] と移動して .sln ファイルを選択します
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,001 | 757,002 | u882535643 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
const int N = 40;
const int LOG = 21;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLMOD = 998244353;
const ll LLINF = 1e18;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vi a(n);
forn(i, n) cin >> a[i];
forn(i, n - 1) {
if (a[i] > a[i + 1] || (a[i] == a[i + 1] && (!i || a[i - 1] < a[i])))
a[i]--;
if (a[i] > a[i + 1]) {
cout << "NO\n";
return 0;
}
if (i && a[i - 1] > a[i]) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
const int N = 40;
const int LOG = 21;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLMOD = 998244353;
const ll LLINF = 1e18;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vi a(n);
forn(i, n) cin >> a[i];
forn(i, n - 1) {
if (a[i] > a[i + 1] || (a[i] == a[i + 1] && (!i || a[i - 1] < a[i])))
a[i]--;
if (a[i] > a[i + 1]) {
cout << "No\n";
return 0;
}
if (i && a[i - 1] > a[i]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,003 | 757,004 | u711540245 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, d = 1;
cin >> n;
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
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 - 1])
d = 0;
}
if (d)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, d = 1;
cin >> n;
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
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 - 1])
d = 0;
}
if (d)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,005 | 757,006 | u397130503 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int N;
cin >> N;
int maxn, curr;
cin >> maxn;
for (int i = 1; i < N; i++) {
cin >> curr;
if (maxn - curr < -1) {
cout << "No";
return 0;
}
maxn = max(curr, maxn);
}
cout << "Yes";
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int N;
cin >> N;
int maxn, curr;
cin >> maxn;
for (int i = 1; i < N; i++) {
cin >> curr;
if (maxn - curr > 1) {
cout << "No";
return 0;
}
maxn = max(curr, maxn);
}
cout << "Yes";
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.unary.arithmetic.remove"
] | 757,010 | 757,011 | u554988565 | cpp |
p02953 | #include <algorithm>
#include <bits/stdc++.h>
#include <map>
#include <string>
#include <unordered_map>
typedef long long int ll;
using namespace std;
#define MAXN 10001
#define MOD 1000000007
#define X first
#define Y second
ll t, n, i, j;
int main() {
cin >> n;
vector<ll> v(n);
for (i = 0; i < n; i++)
cin >> v[i];
v[0] -= 1;
for (i = 1; i < n; i++) {
if (v[i] > v[i - 1])
v[i] -= 1;
else if (v[i] < v[i - 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| #include <algorithm>
#include <bits/stdc++.h>
#include <map>
#include <string>
#include <unordered_map>
typedef long long int ll;
using namespace std;
#define MAXN 10001
#define MOD 1000000007
#define X first
#define Y second
ll t, n, i, j;
int main() {
cin >> n;
vector<ll> v(n);
for (i = 0; i < n; i++)
cin >> v[i];
v[0] -= 1;
for (i = 1; i < n; i++) {
if (v[i] > v[i - 1])
v[i] -= 1;
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,018 | 757,019 | u929156598 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#define db "knapsack"
#define fi first
#define se second
#define endl '\n'
const int INF = 1e9 + 1;
const int maxN = 1e5 + 2;
const int mod = 1e9 + 7;
typedef long long ll;
typedef int Array[maxN];
typedef ll LLArray[maxN];
typedef pair<int, int> PII;
typedef PII PIIArray[maxN];
void docfile() {
if (ifstream("FORM.inp")) {
freopen("FORM.inp", "r", stdin);
freopen("FORM.out", "w", stdout);
} else if (ifstream(db ".inp")) {
freopen(db ".inp", "r", stdin);
freopen(db ".out", "w", stdout);
}
}
//-----------------------------------------------------------------------------
int n, m;
Array a;
void solve() {
m = a[1];
for (int i = 2; i <= n; i++) {
m = max(m, a[i] - 1);
if (m > a[i]) {
cout << "NO";
return;
}
}
cout << "YES";
}
void input() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
solve();
}
int main() {
docfile();
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
input();
}
//-----------------------------------------------------------------------------
/*
template <typename T>
void write (T a)
{
if (a < 0)
{
putchar ('-');
write (-a);
return;
}
if (a < 10)
{
putchar ('0' + a);
return;
}
write (a / 10);
putchar ((char)('0' + (a % 10)));
}
void read(long long& x)
{
x = 0;
int f = 1;
char ch = getchar();
while (!isdigit(ch))
f = ch == '-' ? - f : f, ch = getchar();
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
*/
| #include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#define db "knapsack"
#define fi first
#define se second
#define endl '\n'
const int INF = 1e9 + 1;
const int maxN = 1e5 + 2;
const int mod = 1e9 + 7;
typedef long long ll;
typedef int Array[maxN];
typedef ll LLArray[maxN];
typedef pair<int, int> PII;
typedef PII PIIArray[maxN];
void docfile() {
if (ifstream("FORM.inp")) {
freopen("FORM.inp", "r", stdin);
freopen("FORM.out", "w", stdout);
} else if (ifstream(db ".inp")) {
freopen(db ".inp", "r", stdin);
freopen(db ".out", "w", stdout);
}
}
//-----------------------------------------------------------------------------
int n, m;
Array a;
void solve() {
m = a[1];
for (int i = 2; i <= n; i++) {
m = max(m, a[i] - 1);
if (m > a[i]) {
cout << "No";
return;
}
}
cout << "Yes";
}
void input() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
solve();
}
int main() {
docfile();
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
input();
}
//-----------------------------------------------------------------------------
/*
template <typename T>
void write (T a)
{
if (a < 0)
{
putchar ('-');
write (-a);
return;
}
if (a < 10)
{
putchar ('0' + a);
return;
}
write (a / 10);
putchar ((char)('0' + (a % 10)));
}
void read(long long& x)
{
x = 0;
int f = 1;
char ch = getchar();
while (!isdigit(ch))
f = ch == '-' ? - f : f, ch = getchar();
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
*/
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,023 | 757,024 | u162854028 | cpp |
p02953 | /* ###########################
# Author : Pranay Garg #
# College : SGSITS #
###########################
*/
#include <bits/stdc++.h>
#define ll long long int
#define ironman \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define MOD 1000000007
#define endl '\n'
#define INF 1e18L + 1
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug1(x) cout << #x << " " << x << endl;
#define debug2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define debug3(x, y, z) \
cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z \
<< endl;
using namespace std;
template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); }
template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); }
void fastio() {
ironman
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
}
bool prime[100005];
void SieveOfEratosthenes(ll n) // O(nloglogn)
{
memset(prime, true, sizeof(prime));
for (ll p = 2; p * p <= n; p++) {
if (prime[p] == true) {
for (ll i = p * p; i <= n; i += p)
prime[i] = false;
}
}
}
bool isPrime(ll n) // O(sqrt(n))
{
if (n < 2)
return false;
for (ll i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
std::vector<ll> factors(ll n) // O(sqrt(n))
{
std::vector<ll> f;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
f.push_back(i);
n = n / i;
}
}
if (n > 1)
f.push_back(n);
return f;
}
ll gcd(ll a, ll b) // O(logn)
{
if (!b)
return a;
return gcd(b, a % b);
}
ll modpow(ll x, ll n, ll m) // O(logn)// used for calculating (x^n)%m
{
if (n == 0)
return 1 % m;
ll u = modpow(x, n / 2, m);
u = (u % m * u % m) % m;
if (n % 2 == 1)
u = (u % m * x % m) % m;
return u % m;
}
ll eulerstotientfunction(ll n) // O(sqrt(n))
{
ll ans = n;
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0) {
while (n % i == 0)
n = n / i;
ans -= ans / i;
}
}
if (n > 1)
ans -= ans / n;
return ans;
}
ll modinverse(ll x, ll m) // O(logn)
{
ll temp = eulerstotientfunction(m);
return modpow(x, temp - 1, m);
}
ll ncr(ll n, ll k) {
ll res = 1;
k = min(k, n - k);
for (ll i = 0; i < k; i++) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
int main() {
// fastio();
ll n;
cin >> n;
std::vector<ll> arr(n);
for (ll i = 0; i < n; i++)
cin >> arr[i];
arr[0]--;
for (ll i = 0; i < n - 1; i++) {
if (arr[i + 1] < arr[i])
arr[i + 1]--;
}
for (ll i = 0; i < n; i++) {
if (arr[i] > arr[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | /* ###########################
# Author : Pranay Garg #
# College : SGSITS #
###########################
*/
#include <bits/stdc++.h>
#define ll long long int
#define ironman \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define MOD 1000000007
#define endl '\n'
#define INF 1e18L + 1
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug1(x) cout << #x << " " << x << endl;
#define debug2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define debug3(x, y, z) \
cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z \
<< endl;
using namespace std;
template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); }
template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); }
void fastio() {
ironman
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
}
bool prime[100005];
void SieveOfEratosthenes(ll n) // O(nloglogn)
{
memset(prime, true, sizeof(prime));
for (ll p = 2; p * p <= n; p++) {
if (prime[p] == true) {
for (ll i = p * p; i <= n; i += p)
prime[i] = false;
}
}
}
bool isPrime(ll n) // O(sqrt(n))
{
if (n < 2)
return false;
for (ll i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
std::vector<ll> factors(ll n) // O(sqrt(n))
{
std::vector<ll> f;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
f.push_back(i);
n = n / i;
}
}
if (n > 1)
f.push_back(n);
return f;
}
ll gcd(ll a, ll b) // O(logn)
{
if (!b)
return a;
return gcd(b, a % b);
}
ll modpow(ll x, ll n, ll m) // O(logn)// used for calculating (x^n)%m
{
if (n == 0)
return 1 % m;
ll u = modpow(x, n / 2, m);
u = (u % m * u % m) % m;
if (n % 2 == 1)
u = (u % m * x % m) % m;
return u % m;
}
ll eulerstotientfunction(ll n) // O(sqrt(n))
{
ll ans = n;
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0) {
while (n % i == 0)
n = n / i;
ans -= ans / i;
}
}
if (n > 1)
ans -= ans / n;
return ans;
}
ll modinverse(ll x, ll m) // O(logn)
{
ll temp = eulerstotientfunction(m);
return modpow(x, temp - 1, m);
}
ll ncr(ll n, ll k) {
ll res = 1;
k = min(k, n - k);
for (ll i = 0; i < k; i++) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
int main() {
// fastio();
ll n;
cin >> n;
std::vector<ll> arr(n);
for (ll i = 0; i < n; i++)
cin >> arr[i];
arr[0]--;
for (ll i = 0; i < n - 1; i++) {
if (arr[i + 1] > arr[i])
arr[i + 1]--;
}
for (ll i = 0; i < n - 1; i++) {
if (arr[i] > arr[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 757,029 | 757,030 | u374444191 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main() {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
--h[0];
bool can = true;
for (int i = 1; i < n; i++) {
if (h[i - 1] < h[i])
--h[i];
else if (h[i - 1] > h[i])
can = false;
}
if (can)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main() {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
--h[0];
bool can = true;
for (int i = 1; i < n; i++) {
if (h[i - 1] < h[i])
--h[i];
else if (h[i - 1] > h[i])
can = false;
}
if (can)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,033 | 757,034 | u708258059 | cpp |
p02953 | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
struct edge {
int to, cost;
};
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> P;
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const int mx4[] = {0, 1, 0, -1};
const int my4[] = {1, 0, -1, 0};
const int mx8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int my8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
int n;
cin >> n;
vi h(n);
rep(i, n) cin >> h[i];
int flag = 1;
for (int i = 1; i < n; i++) {
if (h[i] < h[i - 1])
h[i]++;
if (h[i] - h[i - 1] > 1)
flag = 0;
}
cout << (flag ? "Yes" : "No") << endl;
return 0;
} | #include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
struct edge {
int to, cost;
};
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> P;
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const int mx4[] = {0, 1, 0, -1};
const int my4[] = {1, 0, -1, 0};
const int mx8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int my8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
int n;
cin >> n;
vi h(n);
rep(i, n) cin >> h[i];
int flag = 1;
for (int i = 1; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
if (h[i] - h[i - 1] < 0)
flag = 0;
}
cout << (flag ? "Yes" : "No") << endl;
return 0;
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 757,035 | 757,036 | u216772548 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> H;
while (N--) {
int h;
cin >> h;
H.push_back(h);
}
bool valid = true;
for (int i = H.size() - 1; i > 0; i--) {
int ldiff = H[i] - H[i - 1];
if (ldiff == -1) {
H[i]--;
} else if (ldiff < -1) {
valid = false;
break;
}
}
if (valid) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> H;
while (N--) {
int h;
cin >> h;
H.push_back(h);
}
bool valid = true;
for (int i = H.size() - 1; i > 0; i--) {
int ldiff = H[i] - H[i - 1];
if (ldiff == -1) {
H[i - 1]--;
} else if (ldiff < -1) {
valid = false;
break;
}
}
if (valid) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"expression.operation.binary.add"
] | 757,037 | 757,038 | u074372598 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
typedef long long LL;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
LL N;
cin >> N;
vector<LL> H(N);
rep(i, N) { cin >> H[i]; }
bool noflag = false;
for (int i = N - 1; i >= 0; i--) {
LL comp = H[i] - H[i - 1];
if (comp == -1) {
H[i - 1]--;
} else if (comp <= -2) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
typedef long long LL;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
LL N;
cin >> N;
vector<LL> H(N);
rep(i, N) { cin >> H[i]; }
bool noflag = false;
for (int i = N - 1; i > 0; i--) {
LL comp = H[i] - H[i - 1];
if (comp == -1) {
H[i - 1]--;
} else if (comp <= -2) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 757,039 | 757,040 | u758765597 | cpp |
p02953 | #include <iostream>
#include <vector>
using namespace std;
int solve(int N, std::vector<unsigned long long> &H) {
if (N == 1) {
return 0;
}
for (int i = N - 2; i >= 0; --i) {
if (H[i] > H[i + 1]) {
if (H[i] - H[i - 1] > 1) {
return -1;
} else {
H[i]--;
}
}
}
return 0;
}
int main() {
int N;
cin >> N;
std::vector<unsigned long long> H(N);
for (int i = 0; i < N; ++i) {
cin >> H[i];
}
int flag = solve(N, H);
if (flag == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int solve(int N, std::vector<unsigned long long> &H) {
if (N == 1) {
return 0;
}
for (int i = N - 2; i >= 0; --i) {
if (H[i] > H[i + 1]) {
if (H[i] - H[i + 1] > 1) {
return -1;
} else {
H[i]--;
}
}
}
return 0;
}
int main() {
int N;
cin >> N;
std::vector<unsigned long long> H(N);
for (int i = 0; i < N; ++i) {
cin >> H[i];
}
int flag = solve(N, H);
if (flag == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 757,043 | 757,044 | u463950771 | cpp |
p02953 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> data(N);
rep(i, N) { cin >> data.at(i); }
ll low = (ll)data.at(0);
for (int i = 1; i < N; i++) {
if (low < (ll)data.at(i)) {
if (low > (ll)(data.at(i) - 1)) {
cout << "No" << endl;
return 0;
} else if (low == data.at(i) - 1) {
// nothing.do
} else {
low = (ll)data.at(i);
}
} else if (low == data.at(i)) {
// nothing.do
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
vector<int> data(N);
rep(i, N) { cin >> data.at(i); }
ll low = (ll)data.at(0);
for (int i = 1; i < N; i++) {
if (low < (ll)data.at(i)) {
if (low > (ll)(data.at(i) - 1)) {
cout << "No" << endl;
return 0;
} else if (low == data.at(i) - 1) {
// nothing.do
} else {
low = (ll)data.at(i) - 1;
}
} else if (low == data.at(i)) {
// nothing.do
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| [
"assignment.change"
] | 757,051 | 757,052 | u728628785 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string ans = "Yes";
vector<int> h(n);
cin >> h.at(0);
for (int i = 1; i < n; i++) {
cin >> h.at(i);
if (h.at(i) == h.at(i - 1)) {
continue;
} else if (h.at(i) - 1 == h.at(i - 1)) {
h.at(i) += 1;
} else {
ans = "No";
break;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string ans = "Yes";
vector<int> h(n);
cin >> h.at(0);
for (int i = 1; i < n; i++) {
cin >> h.at(i);
if (h.at(i) == h.at(i - 1)) {
continue;
} else if (h.at(i) > h.at(i - 1)) {
h.at(i) -= 1;
} else {
ans = "No";
break;
}
}
cout << ans << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"expression.operator.change"
] | 757,061 | 757,062 | u194421002 | 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 check = true;
for (int i = 0; i < N - 1; i++) {
if (H.at(N - 1 - i) >= H.at(N - 2 - i))
continue;
else if (H.at(N - 1 - i) >= H.at(N - 2 - i))
H.at(N - 2 - i)--;
else {
check = false;
break;
}
}
if (check)
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 check = true;
for (int i = 0; i < N - 1; i++) {
if (H.at(N - 1 - i) >= H.at(N - 2 - i))
continue;
else if (H.at(N - 1 - i) >= H.at(N - 2 - i) - 1)
H.at(N - 2 - i)--;
else {
check = false;
break;
}
}
if (check)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 757,067 | 757,068 | u700981792 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> H(N, 0);
for (int i = 0; i < N; i++) {
scanf("%d", &H.at(i));
}
for (int i = N - 1; i >= 0; i--) {
if (H.at(i) < H.at(i - 1)) {
H.at(i - 1)--;
}
if (H.at(i) < H.at(i - 1)) {
printf("No");
return 0;
}
}
printf("Yes");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> H(N, 0);
for (int i = 0; i < N; i++) {
scanf("%d", &H.at(i));
}
for (int i = N - 1; i > 0; i--) {
if (H.at(i) < H.at(i - 1)) {
H.at(i - 1)--;
}
if (H.at(i) < H.at(i - 1)) {
printf("No");
return 0;
}
}
printf("Yes");
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 757,069 | 757,070 | u553129408 | cpp |
p02953 | #include <bits/stdc++.h>
int main(void) {
using namespace std;
int N, a = 1;
cin >> N;
int H[N];
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = N - 1; i > 0; i--) {
if (H[i] + 1 < H[i - 1])
break;
else if (H[i] + 1 == H[i - 1])
H[i - 1]--;
}
if (a == 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <bits/stdc++.h>
int main(void) {
using namespace std;
int N, a = 1;
cin >> N;
int H[N];
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = N - 1; i > 0; i--) {
if (H[i] + 1 < H[i - 1]) {
a = 0;
break;
} else if (H[i] + 1 == H[i - 1])
H[i - 1]--;
}
if (a == 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"assignment.add"
] | 757,073 | 757,074 | u533334387 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
H[0]--;
for (int i = 1; i < N; i++) {
if (H[i - 1] < H[i]) {
H[i]--;
}
}
bool flag = true;
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i]) {
flag = false;
}
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<long long> H(N);
for (int i = 0; i < N; i++) {
cin >> H[i];
}
H[0]--;
for (int i = 1; i < N; i++) {
if (H[i - 1] < H[i]) {
H[i]--;
}
}
bool flag = true;
for (int i = 0; i < N - 1; i++) {
if (H[i] > H[i + 1]) {
flag = false;
}
}
if (flag) {
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,080 | 757,081 | u904123392 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pi acos(-1)
#define sqr(x) ((x) * (x))
#define pdd pair<double, double>
#define MEMS(x) memset(x, -1, sizeof(x))
#define MEM(x) memset(x, 0, sizeof(x))
#define MXN 200005
#define FOR(i, a, b) for (int i = a; i < (b); i++)
/*long long pow(long long a, long long b) {
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a ;
a = a * a ;
b >>= 1;
}
return res;*/
/*ll dfs(ll i,ll cnt,bool vis[],vector<ll>v[]){
if(v[i].size()==1&&i!=1){vis[i]=1;return pow(4,cnt,r);}
ll j=0;ll res=0;vis[i]=1;
while(j< v[i].size()){
if(vis[v[i][j]]==0){
res=res%r+(dfs(v[i][j],cnt+1,vis,v))%r;
}
j++;
}
return res;
}*/
/*ll b_s(vector<ll> b,ll l,ll r){
ll m=(l+r)/2;
if(l>r)return 0;
else if(r>=l){
ll cnt=0;
for(ll i=0;i<b.size();i++){
cnt=cnt+b[i]/m;
}
if(cnt>=k){c.pb(m); return b_s(b,m+1,r);}
else if(cnt<k) return b_s(b,l,m-1);
}
}
*/
ll dp[10][10][10][10];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// FOR(i,0,10){FOR(j,0,10){FOR(p,0,10){FOR(q,0,10){dp[i][j][p][q]=10000ll;}}}}
ll n;
cin >> n;
ll arr[n];
vector<ll> v;
for (ll i = 0; i < n; i++) {
cin >> arr[i];
}
v.pb(arr[0] - 1);
bool f = false;
for (ll i = 1; i < n; i++) {
if (v[i - 1] < arr[i]) {
v.pb(arr[i] - 1);
} else if (v[i - 1] == arr[i])
v.pb(arr[i]);
else if (v[i - 1] > arr[i]) {
f = true;
break;
}
}
if (f)
cout << "NO";
else
cout << "YES";
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pi acos(-1)
#define sqr(x) ((x) * (x))
#define pdd pair<double, double>
#define MEMS(x) memset(x, -1, sizeof(x))
#define MEM(x) memset(x, 0, sizeof(x))
#define MXN 200005
#define FOR(i, a, b) for (int i = a; i < (b); i++)
/*long long pow(long long a, long long b) {
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a ;
a = a * a ;
b >>= 1;
}
return res;*/
/*ll dfs(ll i,ll cnt,bool vis[],vector<ll>v[]){
if(v[i].size()==1&&i!=1){vis[i]=1;return pow(4,cnt,r);}
ll j=0;ll res=0;vis[i]=1;
while(j< v[i].size()){
if(vis[v[i][j]]==0){
res=res%r+(dfs(v[i][j],cnt+1,vis,v))%r;
}
j++;
}
return res;
}*/
/*ll b_s(vector<ll> b,ll l,ll r){
ll m=(l+r)/2;
if(l>r)return 0;
else if(r>=l){
ll cnt=0;
for(ll i=0;i<b.size();i++){
cnt=cnt+b[i]/m;
}
if(cnt>=k){c.pb(m); return b_s(b,m+1,r);}
else if(cnt<k) return b_s(b,l,m-1);
}
}
*/
ll dp[10][10][10][10];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// FOR(i,0,10){FOR(j,0,10){FOR(p,0,10){FOR(q,0,10){dp[i][j][p][q]=10000ll;}}}}
ll n;
cin >> n;
ll arr[n];
vector<ll> v;
for (ll i = 0; i < n; i++) {
cin >> arr[i];
}
v.pb(arr[0] - 1);
bool f = false;
for (ll i = 1; i < n; i++) {
if (v[i - 1] < arr[i]) {
v.pb(arr[i] - 1);
} else if (v[i - 1] == arr[i])
v.pb(arr[i]);
else if (v[i - 1] > arr[i]) {
f = true;
break;
}
}
if (f)
cout << "No";
else
cout << "Yes";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,088 | 757,089 | u434248058 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pi acos(-1)
#define sqr(x) ((x) * (x))
#define pdd pair<double, double>
#define MEMS(x) memset(x, -1, sizeof(x))
#define MEM(x) memset(x, 0, sizeof(x))
#define MXN 200005
#define FOR(i, a, b) for (int i = a; i < (b); i++)
/*long long pow(long long a, long long b) {
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a ;
a = a * a ;
b >>= 1;
}
return res;*/
/*ll dfs(ll i,ll cnt,bool vis[],vector<ll>v[]){
if(v[i].size()==1&&i!=1){vis[i]=1;return pow(4,cnt,r);}
ll j=0;ll res=0;vis[i]=1;
while(j< v[i].size()){
if(vis[v[i][j]]==0){
res=res%r+(dfs(v[i][j],cnt+1,vis,v))%r;
}
j++;
}
return res;
}*/
/*ll b_s(vector<ll> b,ll l,ll r){
ll m=(l+r)/2;
if(l>r)return 0;
else if(r>=l){
ll cnt=0;
for(ll i=0;i<b.size();i++){
cnt=cnt+b[i]/m;
}
if(cnt>=k){c.pb(m); return b_s(b,m+1,r);}
else if(cnt<k) return b_s(b,l,m-1);
}
}
*/
ll dp[10][10][10][10];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// FOR(i,0,10){FOR(j,0,10){FOR(p,0,10){FOR(q,0,10){dp[i][j][p][q]=10000ll;}}}}
ll n;
cin >> n;
ll arr[n];
vector<ll> v;
for (ll i = 0; i < n; i++) {
cin >> arr[i];
}
v.pb(arr[0]);
bool f = false;
for (ll i = 1; i < n; i++) {
if (v[i - 1] < arr[i]) {
v.pb(arr[i] - 1);
} else if (v[i - 1] == arr[i])
v.pb(arr[i]);
else if (v[i - 1] > arr[i]) {
f = true;
break;
}
}
if (f)
cout << "NO";
else
cout << "YES";
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<LL, LL>
#define pi acos(-1)
#define sqr(x) ((x) * (x))
#define pdd pair<double, double>
#define MEMS(x) memset(x, -1, sizeof(x))
#define MEM(x) memset(x, 0, sizeof(x))
#define MXN 200005
#define FOR(i, a, b) for (int i = a; i < (b); i++)
/*long long pow(long long a, long long b) {
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a ;
a = a * a ;
b >>= 1;
}
return res;*/
/*ll dfs(ll i,ll cnt,bool vis[],vector<ll>v[]){
if(v[i].size()==1&&i!=1){vis[i]=1;return pow(4,cnt,r);}
ll j=0;ll res=0;vis[i]=1;
while(j< v[i].size()){
if(vis[v[i][j]]==0){
res=res%r+(dfs(v[i][j],cnt+1,vis,v))%r;
}
j++;
}
return res;
}*/
/*ll b_s(vector<ll> b,ll l,ll r){
ll m=(l+r)/2;
if(l>r)return 0;
else if(r>=l){
ll cnt=0;
for(ll i=0;i<b.size();i++){
cnt=cnt+b[i]/m;
}
if(cnt>=k){c.pb(m); return b_s(b,m+1,r);}
else if(cnt<k) return b_s(b,l,m-1);
}
}
*/
ll dp[10][10][10][10];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// FOR(i,0,10){FOR(j,0,10){FOR(p,0,10){FOR(q,0,10){dp[i][j][p][q]=10000ll;}}}}
ll n;
cin >> n;
ll arr[n];
vector<ll> v;
for (ll i = 0; i < n; i++) {
cin >> arr[i];
}
v.pb(arr[0] - 1);
bool f = false;
for (ll i = 1; i < n; i++) {
if (v[i - 1] < arr[i]) {
v.pb(arr[i] - 1);
} else if (v[i - 1] == arr[i])
v.pb(arr[i]);
else if (v[i - 1] > arr[i]) {
f = true;
break;
}
}
if (f)
cout << "No";
else
cout << "Yes";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,090 | 757,089 | u434248058 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef map<str, int> mapsi;
typedef map<str, int>::iterator mapsitr;
typedef map<int, int> mint;
typedef map<ll, ll> mll;
typedef set<int> si;
typedef set<ll> sll;
typedef si ::iterator sitr;
typedef si ::reverse_iterator rsitr;
typedef sll ::iterator sltr;
typedef sll ::reverse_iterator rsltr;
#define mset multiset
typedef mset<int> msi;
typedef mset<ll> msll;
typedef msi ::iterator msitr;
typedef msi ::reverse_iterator msritr;
typedef msll ::iterator msltr;
typedef msll ::reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper(char x) {
if (97 <= int(x) && int(x) <= 126)
return char(x - 32);
else if (65 <= int(x) && int(x) <= 90)
return x;
}
char to_lower(char x) {
if (97 <= int(x) && int(x) <= 126)
return x;
else if (65 <= int(x) && int(x) <= 90)
return char(x + 32);
}
int numerize(char x) {
if (48 <= int(x) && int(x) <= 57)
return int(x - '0');
else if (97 <= int(x) && int(x) <= 126)
return int(x - 96);
else if (65 <= int(x) && int(x) <= 90)
return int(x - 64);
}
bool isect(int l1, int r1, int l2, int r2) {
pii p1, p2;
p1 = mp(l1, r1);
p2 = mp(l2, r2);
if (p1 > p2)
swap(p1, p2);
if (p2.fi <= p1.se)
return true;
else
return false;
}
ll fexp(ll num1, ll num2, ll MOD) {
if (num2 == 0)
return 1;
else if (num2 == 1)
return num1;
else {
ll temp = fexp(num1, num2 / 2, MOD);
ll res = ((temp % MOD) * (temp % MOD)) % MOD;
if (num2 % 2 == 1)
res = ((res % MOD) * (num1 % MOD)) % MOD;
return res;
}
}
ll invmod(ll num, ll MOD) { return fexp(num, MOD - 2, MOD); }
ll gcd(ll num1, ll num2) {
if (num1 < num2)
swap(num1, num2);
ll num3 = num1 % num2;
while (num3 > 0) {
num1 = num2;
num2 = num3;
num3 = num1 % num2;
}
return num2;
}
ll lcm(ll num1, ll num2) { return (ll)(num1 / gcd(num1, num2)) * num2; }
// end of Template
ll mx[200000], mn[200000], h[200000];
int n;
bool valid = true;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
mn[n + 1] = INT_MAX;
for (int i = 1; i <= n; i++)
cin >> h[i];
for (int i = n; i >= 1; i--) {
mn[i] = min(h[i], mn[i + 1]);
}
for (int i = 1; i < n; i++) {
ll z = mn[i + 1];
if (h[i] > z) {
if (h[i] - z >= 2) {
valid = false;
break;
}
}
}
if (valid)
cout << "YES\n";
else
cout << "NO\n";
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef map<str, int> mapsi;
typedef map<str, int>::iterator mapsitr;
typedef map<int, int> mint;
typedef map<ll, ll> mll;
typedef set<int> si;
typedef set<ll> sll;
typedef si ::iterator sitr;
typedef si ::reverse_iterator rsitr;
typedef sll ::iterator sltr;
typedef sll ::reverse_iterator rsltr;
#define mset multiset
typedef mset<int> msi;
typedef mset<ll> msll;
typedef msi ::iterator msitr;
typedef msi ::reverse_iterator msritr;
typedef msll ::iterator msltr;
typedef msll ::reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper(char x) {
if (97 <= int(x) && int(x) <= 126)
return char(x - 32);
else if (65 <= int(x) && int(x) <= 90)
return x;
}
char to_lower(char x) {
if (97 <= int(x) && int(x) <= 126)
return x;
else if (65 <= int(x) && int(x) <= 90)
return char(x + 32);
}
int numerize(char x) {
if (48 <= int(x) && int(x) <= 57)
return int(x - '0');
else if (97 <= int(x) && int(x) <= 126)
return int(x - 96);
else if (65 <= int(x) && int(x) <= 90)
return int(x - 64);
}
bool isect(int l1, int r1, int l2, int r2) {
pii p1, p2;
p1 = mp(l1, r1);
p2 = mp(l2, r2);
if (p1 > p2)
swap(p1, p2);
if (p2.fi <= p1.se)
return true;
else
return false;
}
ll fexp(ll num1, ll num2, ll MOD) {
if (num2 == 0)
return 1;
else if (num2 == 1)
return num1;
else {
ll temp = fexp(num1, num2 / 2, MOD);
ll res = ((temp % MOD) * (temp % MOD)) % MOD;
if (num2 % 2 == 1)
res = ((res % MOD) * (num1 % MOD)) % MOD;
return res;
}
}
ll invmod(ll num, ll MOD) { return fexp(num, MOD - 2, MOD); }
ll gcd(ll num1, ll num2) {
if (num1 < num2)
swap(num1, num2);
ll num3 = num1 % num2;
while (num3 > 0) {
num1 = num2;
num2 = num3;
num3 = num1 % num2;
}
return num2;
}
ll lcm(ll num1, ll num2) { return (ll)(num1 / gcd(num1, num2)) * num2; }
// end of Template
ll mx[200000], mn[200000], h[200000];
int n;
bool valid = true;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
mn[n + 1] = INT_MAX;
for (int i = 1; i <= n; i++)
cin >> h[i];
for (int i = n; i >= 1; i--) {
mn[i] = min(h[i], mn[i + 1]);
}
for (int i = 1; i < n; i++) {
ll z = mn[i + 1];
if (h[i] > z) {
if (h[i] - z >= 2) {
valid = false;
break;
}
}
}
if (valid)
cout << "Yes\n";
else
cout << "No\n";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,095 | 757,096 | u337775536 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int n, a[100010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n - 1; i >= 1; i--) {
if (a[i] > a[i + 1])
a[i]--;
}
string res = "yes";
for (int i = 2; i <= n; i++) {
if (a[i] < a[i - 1]) {
res = "no";
break;
}
}
cout << res << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int n, a[100010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n - 1; i >= 1; i--) {
if (a[i] > a[i + 1])
a[i]--;
}
string res = "Yes";
for (int i = 2; i <= n; i++) {
if (a[i] < a[i - 1]) {
res = "No";
break;
}
}
cout << res << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 757,099 | 757,100 | u521078006 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int n, a[100010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n - 1; i >= 1; i--) {
if (a[i] > a[i + 1])
a[i]--;
}
string res = "yes";
for (int i = 2; i <= n; i++) {
if (a[i] < a[i - 1]) {
res = "no";
break;
}
}
cout << res << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int n, a[100010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = n - 1; i >= 1; i--) {
if (a[i] > a[i + 1])
a[i]--;
}
string res = "Yes";
for (int i = 2; i <= n; i++) {
if (a[i] < a[i - 1]) {
res = "No";
break;
}
}
cout << res << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 757,099 | 757,101 | u521078006 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for (ll i = (a); i > (b); --i)
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CINT(...) \
int __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
ll __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};
ll N;
VL H;
signed main() {
cin >> N;
REP(i, N) {
LCIN(h);
if (i && h > H[i]) {
H.emplace_back(h - 1);
} else
H.emplace_back(h);
}
REP(i, N - 1) {
if (H[i + 1] < H[i])
eputs("No");
}
puts("Yes");
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for (ll i = (a); i > (b); --i)
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define VECCIN(x) \
for (auto &youso_ : (x)) \
cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
T x;
cin >> x;
return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
cin >> head;
CIN(move(tail)...);
}
#define CINT(...) \
int __VA_ARGS__; \
CIN(__VA_ARGS__)
#define DCIN(...) \
double __VA_ARGS__; \
CIN(__VA_ARGS__)
#define LCIN(...) \
ll __VA_ARGS__; \
CIN(__VA_ARGS__)
#define SCIN(...) \
string __VA_ARGS__; \
CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v) \
{ \
FOREACH(x, v) { cout << x << " "; } \
cout << "\n"; \
}
template <typename T = string> inline void eputs(T s) {
cout << s << "\n";
exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;
typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};
ll N;
VL H;
signed main() {
cin >> N;
REP(i, N) {
LCIN(h);
if (i && h > H[i - 1]) {
H.emplace_back(h - 1);
} else
H.emplace_back(h);
}
REP(i, N - 1) {
if (H[i + 1] < H[i])
eputs("No");
}
puts("Yes");
} | [
"control_flow.branch.if.condition.change"
] | 757,102 | 757,103 | u139031151 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
// long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
//最大公約数
unsigned gcd(unsigned a, unsigned b) {
if (a < b)
return gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
int main() {
int N;
cin >> N;
vector<ll> H(N);
REP(i, N) cin >> H.at(i);
if (H.size() == 1) {
yes;
return 0;
}
bool flag = true;
for (int i = H.size() - 1; i >= 1; i--) {
if (H.at(i) < H.at(i - 1))
H.at(i)--;
if (H.at(i) < H.at(i - 1))
flag = false;
}
if (flag)
yes;
else
no;
} | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
// long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
//最大公約数
unsigned gcd(unsigned a, unsigned b) {
if (a < b)
return gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
int main() {
int N;
cin >> N;
vector<ll> H(N);
REP(i, N) cin >> H.at(i);
if (H.size() == 1) {
yes;
return 0;
}
bool flag = true;
for (int i = H.size() - 1; i >= 1; i--) {
if (H.at(i) < H.at(i - 1))
H.at(i - 1)--;
if (H.at(i) < H.at(i - 1))
flag = false;
}
if (flag)
yes;
else
no;
} | [
"expression.operation.binary.add"
] | 757,104 | 757,105 | u832995587 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int i;
vector<int> H(N, 0);
for (i = 0; i < N; i++)
cin >> H.at(i);
int maxa = H.at(0) - 1;
bool ans = 1;
for (i = 0; i < N - 1; i++) {
if (H.at(i) - 1 > H.at(i + 1) || H.at(i + 1) - 1 < maxa) {
ans = 0;
break;
}
if (maxa < H.at(i) - 1)
maxa = H.at(i) - 1;
}
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int i;
vector<int> H(N, 0);
for (i = 0; i < N; i++)
cin >> H.at(i);
int maxa = H.at(0) - 1;
bool ans = 1;
for (i = 0; i < N - 1; i++) {
if (H.at(i) - 1 > H.at(i + 1) || H.at(i + 1) < maxa) {
ans = 0;
break;
}
if (maxa < H.at(i) - 1)
maxa = H.at(i) - 1;
}
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 757,109 | 757,110 | u634999820 | cpp |
p02953 | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
int main() {
int n, h, m = 0;
cin >> n;
bool res = true;
for (int i = 0; i < n; i++) {
cin >> h;
if (m - h >= 2) {
res = false;
break;
}
m = max(m, h);
}
if (res == true) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
int main() {
int n, h, m = 0;
cin >> n;
bool res = true;
for (int i = 0; i < n; i++) {
cin >> h;
if (m - h >= 2) {
res = false;
break;
}
m = max(m, h);
}
if (res == true) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,111 | 757,112 | u403813525 | cpp |
p02953 | #include <iostream>
using namespace std;
typedef long long INT;
bool f(INT N, INT H[]) {
INT a = H[0];
for (INT i = 1; i < N; ++i) {
INT b = H[i];
if (b < a - 1) {
return false;
}
a = max(a, b - 1);
}
return true;
}
int main() {
static INT N, H[100000];
cin >> N;
for (INT i = 0; i < N; ++i) {
cin >> H[i];
}
cout << (f(N, H) ? "Yes" : "No") << endl;
return 0;
}
| #include <iostream>
using namespace std;
typedef long long INT;
bool f(INT N, INT H[]) {
INT a = H[0];
for (INT i = 1; i < N; ++i) {
INT b = H[i];
if (b < a) {
return false;
}
a = max(a, b - 1);
}
return true;
}
int main() {
static INT N, H[100000];
cin >> N;
for (INT i = 0; i < N; ++i) {
cin >> H[i];
}
cout << (f(N, H) ? "Yes" : "No") << endl;
return 0;
}
| [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 757,115 | 757,116 | u729417323 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
int main() {
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
//freopen("test.txt","r",stdin);
//freopen("output.txt","w",stdout);
#endif*/
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
if (i == 0)
continue;
if (v[i] > v[i - 1])
v[i]--;
if (v[i] < v[i - 1]) {
cout << "NO";
return 0;
}
}
cout << "YES";
/*#ifndef ONLINE_JUDGE
cout << "\nTime Elapsed : " << 1.0 * clock() << " ms\n";
#endif*/
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
int main() {
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
//freopen("test.txt","r",stdin);
//freopen("output.txt","w",stdout);
#endif*/
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
if (i == 0)
continue;
if (v[i] > v[i - 1])
v[i]--;
if (v[i] < v[i - 1]) {
cout << "No";
return 0;
}
}
cout << "Yes";
/*#ifndef ONLINE_JUDGE
cout << "\nTime Elapsed : " << 1.0 * clock() << " ms\n";
#endif*/
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,121 | 757,122 | u482034961 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
int main() {
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
//freopen("test.txt","r",stdin);
//freopen("output.txt","w",stdout);
#endif*/
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
if (i == 0) {
v[i]--;
continue;
}
if (v[i] > v[i - 1])
v[i]--;
if (v[i] < v[i - 1]) {
cout << "NO";
return 0;
}
}
cout << "YES";
/*#ifndef ONLINE_JUDGE
cout << "\nTime Elapsed : " << 1.0 * clock() << " ms\n";
#endif*/
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
int main() {
/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
//freopen("test.txt","r",stdin);
//freopen("output.txt","w",stdout);
#endif*/
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
if (i == 0) {
v[i]--;
continue;
}
if (v[i] > v[i - 1])
v[i]--;
if (v[i] < v[i - 1]) {
cout << "No";
return 0;
}
}
cout << "Yes";
/*#ifndef ONLINE_JUDGE
cout << "\nTime Elapsed : " << 1.0 * clock() << " ms\n";
#endif*/
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,123 | 757,124 | u482034961 | cpp |
p02953 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> H(N);
vector<int> I(N);
if (N == 1) {
cout << "Yes";
} else {
for (int i = 0; i < N; i++) {
cin >> H[i];
}
for (int i = N - 1; i > 0; i--) {
if (H[i] == H[i - 1] + 1) {
H[i - 1] = H[i - 1] - 1;
}
}
I = H;
sort(I.begin(), I.end());
if (H == I) {
cout << "Yes";
} else {
cout << "No";
}
}
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> H(N);
vector<int> I(N);
if (N == 1) {
cout << "Yes";
} else {
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] = H[i - 1] - 1;
}
}
I = H;
sort(I.begin(), I.end());
if (H == I) {
cout << "Yes";
} else {
cout << "No";
}
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 757,125 | 757,126 | u698598617 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
using namespace std;
int n, ans, x, y;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
if (x > y)
x--;
if (x < y) {
cout << "NO";
return 0;
}
y = x;
}
cout << "YES";
}
| #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
using namespace std;
int n, ans, x, y;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
if (x > y)
x--;
if (x < y) {
cout << "No";
return 0;
}
y = x;
}
cout << "Yes";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,129 | 757,130 | u080863136 | cpp |
p02953 | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int H[N], G[N - 1];
for (int i = 1; i <= N; i++)
cin >> H[i];
H[0] = H[1];
int ans = 0;
for (int i = N - 1; i > 0; i--) {
if (H[i] <= H[i + 1])
continue;
else if (H[i] == H[i + 1] + 1)
continue;
else
ans++;
}
if (ans == 0)
cout << "Yes";
else
cout << "No";
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int H[N], G[N - 1];
for (int i = 1; i <= N; i++)
cin >> H[i];
H[0] = H[1];
int ans = 0;
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]--;
else
ans++;
}
if (ans == 0)
cout << "Yes";
else
cout << "No";
return 0;
}
| [] | 757,137 | 757,138 | u057617112 | cpp |
p02953 | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a, s, v = 1;
cin >> a;
vector<int> z(a);
for (s = 0; s < a; s++) {
cin >> z.at(s);
}
reverse(z.begin(), z.end());
for (s = 0; s < a; s++) {
if (z.at(s) + 1 == z.at(s + 1)) {
z.at(s + 1) -= 1;
}
if (z.at(s) + 1 < z.at(s + 1)) {
v = 0;
break;
}
}
if (v == 0) {
cout << "No" << endl;
}
if (v == 1) {
cout << "Yes" << endl;
}
} | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a, s, v = 1;
cin >> a;
vector<int> z(a);
for (s = 0; s < a; s++) {
cin >> z.at(s);
}
reverse(z.begin(), z.end());
for (s = 0; s < a - 1; s++) {
if (z.at(s) + 1 == z.at(s + 1)) {
z.at(s + 1) -= 1;
}
if (z.at(s) + 1 < z.at(s + 1)) {
v = 0;
break;
}
}
if (v == 0) {
cout << "No" << endl;
}
if (v == 1) {
cout << "Yes" << endl;
}
} | [
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 757,145 | 757,146 | u116662310 | cpp |
p02953 | //#pragma comment(linker, "/stack:200000000") // (UNCOMMENT WHEN HAVING LOTS OF
//RECURSIONS)
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops") // $ (UNCOMMENT WHEN TRYING TO
//BRUTEFORCE WITH A LOT OF LOOPS)\
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define int long long
#define ll long long
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define fre(i, a, b) for (int i = a; i <= b; i++)
#define rpe(i, a, b) for (i = a - 1; i >= b; i--)
#define rp(i, n) rep(i, 0, n)
#define fr(i, n) fre(i, 1, n)
#define trav(a, x) for (auto &a : x)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define endl "\n"
#define F first
#define S second
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int, int>>
#define viii vector<vector<vector<int>>>
#define cd complex<double>
#define PI acos(-1)
#define pie 3.14159265358979323846
#define all(c) (c).begin(), (c).end()
#define prec(n) fixed << setprecision(n)
#define print_time \
{ \
cout << flush; \
cerr << endl \
<< "Time taken: " << fixed << setprecision(3) \
<< 1.0 * clock() / CLOCKS_PER_SEC << " secs\n"; \
}
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) * (b)) / gcd((a), (b))
#define bc(n) __builtin_popcountll(n)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits
#define lps(v, x) (lower_bound(all(v), x) - v.begin())
#define ups(v, x) (upper_bound(all(v), x) - v.begin())
typedef long double ld;
typedef long double LD;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
// -------------------------<RNG>-------------------------
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers.
// ------------------------</RNG>-------------------------
#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
auto clk = clock();
const int inft = (1LL << 61);
const int inf = 5e18;
const int mod = 1e9 + 7;
const int mod1 = 998244353;
const int N = 1e6 + 1e4 + 1e2 + 1;
const int M = 3 * (1e5 + 1e3 + 1e1);
int modpow(int x, int n, int mod) {
x %= mod;
int res = 1;
while (n > 0) {
if (n & 1)
res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
// -----------------<Modular Arithmetic>------------------
// template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
// template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
int add(int a, int b, int c) {
int res = a + b;
return (res >= c ? res - c : res);
}
int mod_neg(int a, int b, int c) {
int res;
if (abs(a - b) < c)
res = a - b;
else
res = (a - b) % c;
return (res < 0 ? res + c : res);
}
int mul(int a, int b, int c) {
ll res = (ll)a * b;
return (res >= c ? res % c : res);
}
ll mulmod(ll a, ll b, ll m) {
ll q = (ll)(((LD)a * (LD)b) / (LD)m);
ll r = a * b - q * m;
if (r > m)
r %= m;
if (r < 0)
r += m;
return r;
}
template <typename T> T expo(T e, T n) {
T x = 1, p = e;
while (n) {
if (n & 1)
x = x * p;
p = p * p;
n >>= 1;
}
return x;
}
template <typename T> T power(T e, T n, T m) {
T x = 1, p = e;
while (n) {
if (n & 1)
x = mul(x, p, m);
p = mul(p, p, m);
n >>= 1;
}
return x;
}
template <typename T> T extended_euclid(T a, T b, T &x, T &y) {
T xx = 0, yy = 1;
y = 0;
x = 1;
while (b) {
T q = a / b, t = b;
b = a % b;
a = t;
t = xx;
xx = x - q * xx;
x = t;
t = yy;
yy = y - q * yy;
y = t;
}
return a;
}
template <typename T> T mod_inverse(T a, T n) {
T x, y, z = 0;
T d = extended_euclid(a, n, x, y);
return (d > 1 ? -1 : mod_neg(x, z, n));
}
// -----------------</Modular Arithmetic>-----------------
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin.exceptions(cin.failbit);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
cout << fixed << setprecision(10);
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout) ;
#endif // ONLINE_JUDGE
int n;
cin >> n;
int a[n] = {0};
int mn = 1e9 + 7;
rp(i, n) cin >> a[i], mn = min(mn, a[i]);
trace(mn);
rep(i, 1, n) {
if (a[i] > a[i - 1]) {
a[i]--;
}
if (a[i] < a[i - 1]) {
cout << "NO";
return 0;
}
}
// rp(i,n)
// {
// cerr << a[i] << " " ;
// }cerr << endl ;
//
// rep(i,1,n)
// {
// if(a[i-1] > a[i])
// {
// cout << "NO" ;
// return 0 ;
// }
// }
cout << "YES";
cerr << endl
<< endl
<< "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
return 0;
}
| //#pragma comment(linker, "/stack:200000000") // (UNCOMMENT WHEN HAVING LOTS OF
//RECURSIONS)
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops") // $ (UNCOMMENT WHEN TRYING TO
//BRUTEFORCE WITH A LOT OF LOOPS)\
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define int long long
#define ll long long
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define fre(i, a, b) for (int i = a; i <= b; i++)
#define rpe(i, a, b) for (i = a - 1; i >= b; i--)
#define rp(i, n) rep(i, 0, n)
#define fr(i, n) fre(i, 1, n)
#define trav(a, x) for (auto &a : x)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define endl "\n"
#define F first
#define S second
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int, int>>
#define viii vector<vector<vector<int>>>
#define cd complex<double>
#define PI acos(-1)
#define pie 3.14159265358979323846
#define all(c) (c).begin(), (c).end()
#define prec(n) fixed << setprecision(n)
#define print_time \
{ \
cout << flush; \
cerr << endl \
<< "Time taken: " << fixed << setprecision(3) \
<< 1.0 * clock() / CLOCKS_PER_SEC << " secs\n"; \
}
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) * (b)) / gcd((a), (b))
#define bc(n) __builtin_popcountll(n)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits
#define lps(v, x) (lower_bound(all(v), x) - v.begin())
#define ups(v, x) (upper_bound(all(v), x) - v.begin())
typedef long double ld;
typedef long double LD;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
// -------------------------<RNG>-------------------------
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers.
// ------------------------</RNG>-------------------------
#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " ";
__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
auto clk = clock();
const int inft = (1LL << 61);
const int inf = 5e18;
const int mod = 1e9 + 7;
const int mod1 = 998244353;
const int N = 1e6 + 1e4 + 1e2 + 1;
const int M = 3 * (1e5 + 1e3 + 1e1);
int modpow(int x, int n, int mod) {
x %= mod;
int res = 1;
while (n > 0) {
if (n & 1)
res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
// -----------------<Modular Arithmetic>------------------
// template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
// template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
int add(int a, int b, int c) {
int res = a + b;
return (res >= c ? res - c : res);
}
int mod_neg(int a, int b, int c) {
int res;
if (abs(a - b) < c)
res = a - b;
else
res = (a - b) % c;
return (res < 0 ? res + c : res);
}
int mul(int a, int b, int c) {
ll res = (ll)a * b;
return (res >= c ? res % c : res);
}
ll mulmod(ll a, ll b, ll m) {
ll q = (ll)(((LD)a * (LD)b) / (LD)m);
ll r = a * b - q * m;
if (r > m)
r %= m;
if (r < 0)
r += m;
return r;
}
template <typename T> T expo(T e, T n) {
T x = 1, p = e;
while (n) {
if (n & 1)
x = x * p;
p = p * p;
n >>= 1;
}
return x;
}
template <typename T> T power(T e, T n, T m) {
T x = 1, p = e;
while (n) {
if (n & 1)
x = mul(x, p, m);
p = mul(p, p, m);
n >>= 1;
}
return x;
}
template <typename T> T extended_euclid(T a, T b, T &x, T &y) {
T xx = 0, yy = 1;
y = 0;
x = 1;
while (b) {
T q = a / b, t = b;
b = a % b;
a = t;
t = xx;
xx = x - q * xx;
x = t;
t = yy;
yy = y - q * yy;
y = t;
}
return a;
}
template <typename T> T mod_inverse(T a, T n) {
T x, y, z = 0;
T d = extended_euclid(a, n, x, y);
return (d > 1 ? -1 : mod_neg(x, z, n));
}
// -----------------</Modular Arithmetic>-----------------
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin.exceptions(cin.failbit);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
cout << fixed << setprecision(10);
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout) ;
#endif // ONLINE_JUDGE
int n;
cin >> n;
int a[n] = {0};
int mn = 1e9 + 7;
rp(i, n) cin >> a[i], mn = min(mn, a[i]);
trace(mn);
rep(i, 1, n) {
if (a[i] > a[i - 1]) {
a[i]--;
}
if (a[i] < a[i - 1]) {
cout << "No";
return 0;
}
}
// rp(i,n)
// {
// cerr << a[i] << " " ;
// }cerr << endl ;
//
// rep(i,1,n)
// {
// if(a[i-1] > a[i])
// {
// cout << "NO" ;
// return 0 ;
// }
// }
cout << "Yes";
cerr << endl
<< endl
<< "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,154 | 757,155 | u392480834 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A, value) memset(A, value, sizeof(A))
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pi;
typedef pair<ll, int> pl;
typedef pair<ll, ll> pll;
typedef pair<double, double> pd;
// change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
// g++ -std=c++11 your_file.cpp -o your_program
ll mypow(ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1)
ans = (ans * a) % MOD;
b /= 2;
a = (a * a) % MOD;
}
return ans;
}
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ifstream in("");
ofstream out("");
clock_t begin = clock();
int n;
cin >> n;
int arr[MAX];
REP(i, n) { cin >> arr[i]; }
arr[0]--;
FOR(i, 1, n - 1) {
if (arr[i - 1] == arr[i])
continue;
else if (arr[i - 1] < arr[i] &&
(arr[i + 1] >= arr[i] or arr[i + 1] == arr[i] - 1))
arr[i]--;
else {
cout << "NO" << endl;
return 0;
}
}
REP(i, n - 1) {
if (arr[i] > arr[i + 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
clock_t end = clock();
double esecs = double(end - begin) / CLOCKS_PER_SEC;
// cout << esecs << " seconds" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A, value) memset(A, value, sizeof(A))
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pi;
typedef pair<ll, int> pl;
typedef pair<ll, ll> pll;
typedef pair<double, double> pd;
// change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
// g++ -std=c++11 your_file.cpp -o your_program
ll mypow(ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1)
ans = (ans * a) % MOD;
b /= 2;
a = (a * a) % MOD;
}
return ans;
}
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ifstream in("");
ofstream out("");
clock_t begin = clock();
int n;
cin >> n;
int arr[MAX];
REP(i, n) { cin >> arr[i]; }
arr[0]--;
FOR(i, 1, n - 1) {
if (arr[i - 1] == arr[i])
continue;
else if (arr[i - 1] < arr[i] &&
(arr[i + 1] >= arr[i] or arr[i + 1] == arr[i] - 1))
arr[i]--;
else {
cout << "No" << endl;
return 0;
}
}
REP(i, n - 1) {
if (arr[i] > arr[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
clock_t end = clock();
double esecs = double(end - begin) / CLOCKS_PER_SEC;
// cout << esecs << " seconds" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,160 | 757,161 | u372798233 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
ll n, ans = 0;
cin >> n;
ll a[n];
for (ll i = 0; i < n; i++)
cin >> a[i];
for (ll i = n - 2; i >= 0; i--) {
if (a[i] > a[i + 1])
a[i]--;
if (a[i] > a[i - 1])
ans = 1;
}
if (ans == 1)
cout << "No";
else
cout << "Yes";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
ll n, ans = 0;
cin >> n;
ll a[n];
for (ll i = 0; i < n; i++)
cin >> a[i];
for (ll i = n - 2; i >= 0; i--) {
if (a[i] > a[i + 1])
a[i]--;
if (a[i] > a[i + 1])
ans = 1;
}
if (ans == 1)
cout << "No";
else
cout << "Yes";
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 757,168 | 757,169 | u240116138 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define Q queue<ll>
#define DQ deque<ll>
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back
#define mp make_pair
#define mt make_tuple
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define loop(x, y, z) for (ll i = x; i <= y; i += z)
#define rloop(x, y, z) for (ll i = x; i >= y; i -= z)
#define all(x) x.begin(), x.end()
#define sum(x) accumulate(all(x), 0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define mem(a, b) memset(a, b, sizeof(a))
#define watch(x) cout << (#x) << " is " << x
#define endl "\n"
ll gcd(ll a, ll b) { return (!b) ? a : gcd(b, a % b); }
void display(vi &v, string c) {
for (auto x : v)
cout << x << c;
}
string solve(vi &v) {
ll maxi = v[0];
loop(1, v.size() - 1, 1) {
if (maxi - v[i] > 1)
return "NO";
maxi = max(maxi, v[i]);
}
return "Yes";
}
int main() {
IOS ll n;
cin >> n;
vi v(n);
loop(0, n - 1, 1) cin >> v[i];
if (is_sorted(all(v)))
cout << "Yes";
else
cout << solve(v);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define Q queue<ll>
#define DQ deque<ll>
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back
#define mp make_pair
#define mt make_tuple
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define loop(x, y, z) for (ll i = x; i <= y; i += z)
#define rloop(x, y, z) for (ll i = x; i >= y; i -= z)
#define all(x) x.begin(), x.end()
#define sum(x) accumulate(all(x), 0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define mem(a, b) memset(a, b, sizeof(a))
#define watch(x) cout << (#x) << " is " << x
#define endl "\n"
ll gcd(ll a, ll b) { return (!b) ? a : gcd(b, a % b); }
void display(vi &v, string c) {
for (auto x : v)
cout << x << c;
}
string solve(vi &v) {
ll maxi = v[0];
loop(1, v.size() - 1, 1) {
if (maxi - v[i] > 1)
return "No";
maxi = max(maxi, v[i]);
}
return "Yes";
}
int main() {
IOS ll n;
cin >> n;
vi v(n);
loop(0, n - 1, 1) cin >> v[i];
if (is_sorted(all(v)))
cout << "Yes";
else
cout << solve(v);
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"function.return_value.change"
] | 757,174 | 757,175 | u859773831 | 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);
}
int ans = 1;
for (int i = N; i > 0; i--) {
if (H.at(i) < H.at(i - 1)) {
H.at(i - 1) -= 1;
if (H.at(i) < H.at(i - 1)) {
ans = 0;
break;
} else
continue;
} else
continue;
}
if (ans == 1)
cout << "Yes" << endl;
else if (ans == 0)
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);
}
int ans = 1;
for (int i = N - 1; i > 0; i--) {
if (H.at(i) < H.at(i - 1)) {
H.at(i - 1) -= 1;
if (H.at(i) < H.at(i - 1)) {
ans = 0;
break;
} else
continue;
} else
continue;
}
if (ans == 1)
cout << "Yes" << endl;
else if (ans == 0)
cout << "No" << endl;
}
| [
"control_flow.loop.for.initializer.change"
] | 757,176 | 757,177 | u727223350 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define pb push_back
#define fastIO \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " " << x << endl;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
struct greaterr {
template <class T> bool operator()(T const &a, T const &b) const {
return a > b;
}
};
vector<bool> sieve(1000007, true);
void help() {
sieve[0] = false;
sieve[1] = false;
for (int i = 2; i * i <= 1000000; ++i) {
if (sieve[i]) {
for (int j = i * i; j <= 1000000; j += i)
sieve[j] = false;
}
}
}
int main() {
fastIO
int n;
cin >> n;
int arr[n];
fo(i, n) cin >> arr[i];
fo(i, n) {
if (i == 0 || arr[i - 1] <= arr[i] - 1)
arr[i]--;
if (i && arr[i - 1] > arr[i]) {
cout << "NO";
return 0;
}
}
cout << "YES";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define pb push_back
#define fastIO \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " " << x << endl;
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)
struct greaterr {
template <class T> bool operator()(T const &a, T const &b) const {
return a > b;
}
};
vector<bool> sieve(1000007, true);
void help() {
sieve[0] = false;
sieve[1] = false;
for (int i = 2; i * i <= 1000000; ++i) {
if (sieve[i]) {
for (int j = i * i; j <= 1000000; j += i)
sieve[j] = false;
}
}
}
int main() {
fastIO
int n;
cin >> n;
int arr[n];
fo(i, n) cin >> arr[i];
fo(i, n) {
if (i == 0 || arr[i - 1] <= arr[i] - 1)
arr[i]--;
if (i && arr[i - 1] > arr[i]) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,180 | 757,181 | u702142173 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN = 1e5 + 7;
int arr[MAXN];
int main() {
ios::sync_with_stdio(0);
int n, flag = 0;
cin >> n;
arr[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
for (int i = 1; i <= n; i++) {
if (arr[i - 1] - arr[i] == 1)
arr[i - 1]--;
if (arr[i] == arr[i - 1] && arr[i] > arr[i - 2])
arr[i - 1]--;
if (arr[i] < arr[i - 1] && arr[i - 1] - arr[i] > 1) {
flag = 1;
break;
}
}
for (int i = 1; i <= n; i++) {
if (arr[i] < arr[i - 1]) {
flag = 1;
break;
}
}
if (flag)
cout << "No" << endl;
else
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN = 1e5 + 7;
int arr[MAXN];
int main() {
ios::sync_with_stdio(0);
// while(1){
int n, flag = 0;
cin >> n;
arr[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
for (int i = 1; i <= n; i++) {
if (arr[i - 1] - arr[i] == 1)
arr[i - 1]--;
else if (arr[i] == arr[i - 1] && arr[i] > arr[i - 2])
arr[i - 1]--;
else if (arr[i] < arr[i - 1] && arr[i - 1] - arr[i] > 1) {
flag = 1;
break;
}
}
for (int i = 1; i <= n; i++) {
if (arr[i] < arr[i - 1]) {
flag = 1;
break;
}
}
if (flag)
cout << "No" << endl;
else
cout << "Yes" << endl;
//}
return 0;
}
| [
"control_flow.branch.else_if.replace.add",
"control_flow.branch.if.replace.remove"
] | 757,184 | 757,183 | u872015944 | cpp |
p02953 | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<ll> v1, v2;
for (int i = 0; i < n; i++) {
ll a;
cin >> a;
v1.push_back(a);
}
for (int i = 0; i < n; i++) {
v2.push_back(v1[n - 1 - i]);
}
for (int i = 0; i < n; i++) {
if (i == 0) {
if (v2[i] >= v2[i + 1]) {
v2[i]++;
continue;
} else {
cout << "No" << endl;
return 0;
}
} else if (i == n - 1) {
if (v2[i] <= v2[i - 1])
continue;
else {
cout << "No" << endl;
return 0;
}
}
if (v2[i] >= v2[i + 1]) {
if (v2[i] + 1 <= v2[i - 1])
v2[i]++;
continue;
} else {
if (v2[i] + 1 < v2[i + 1]) {
cout << "No" << endl;
return 0;
} else if (v2[i] + 1 > v2[i - 1]) {
cout << "No" << endl;
return 0;
} else {
v2[i]++;
continue;
}
}
}
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<ll> v1, v2;
for (int i = 0; i < n; i++) {
ll a;
cin >> a;
v1.push_back(a);
}
for (int i = 0; i < n; i++) {
v2.push_back(v1[n - 1 - i]);
}
for (int i = 0; i < n; i++) {
if (i == 0) {
if (v2[i] >= v2[i + 1] - 1) {
v2[i]++;
continue;
} else {
cout << "No" << endl;
return 0;
}
} else if (i == n - 1) {
if (v2[i] <= v2[i - 1])
continue;
else {
cout << "No" << endl;
return 0;
}
}
if (v2[i] >= v2[i + 1]) {
if (v2[i] + 1 <= v2[i - 1])
v2[i]++;
continue;
} else {
if (v2[i] + 1 < v2[i + 1]) {
cout << "No" << endl;
return 0;
} else if (v2[i] + 1 > v2[i - 1]) {
cout << "No" << endl;
return 0;
} else {
v2[i]++;
continue;
}
}
}
cout << "Yes" << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 757,185 | 757,186 | u750836455 | cpp |
p02953 | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int h[100005], n, maxh;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &h[i]);
}
for (int i = n - 1; i >= 1; i--) {
if (h[i + 1] >= h[i]) {
continue;
} else if (h[i + 1] + 1 == h[i]) {
--h[i];
} else {
printf("No");
return 0;
}
}
printf("Yes");
} | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int h[100005], n, maxh;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
for (int i = n - 1; i >= 1; i--) {
if (h[i + 1] >= h[i]) {
continue;
} else if (h[i + 1] + 1 == h[i]) {
h[i]--;
} else {
printf("No");
return 0;
}
}
printf("Yes");
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 757,195 | 757,196 | u477525609 | cpp |
p02953 | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int h[100005], n, maxh;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &h[i]);
}
for (int i = n - 1; i >= 1; i--) {
if (h[i + 1] >= h[i]) {
continue;
} else if (h[i + 1] + 1 == h[i]) {
h[i]--;
} else {
printf("No");
return 0;
}
}
printf("Yes");
} | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int h[100005], n, maxh;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &h[i]);
}
for (int i = n - 1; i >= 1; i--) {
if (h[i + 1] >= h[i]) {
continue;
} else if (h[i + 1] + 1 == h[i]) {
h[i]--;
} else {
printf("No");
return 0;
}
}
printf("Yes");
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 757,197 | 757,196 | u477525609 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define MP make_pair
#define F first
#define S second
#define inf 10000000000000
#define vll vector<ll>
using namespace std;
const int N = 100005;
void solve() {
ll n, a[N], i;
cin >> n;
a[0] = 0;
for (i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] - 1 >= a[i - 1])
a[i]--;
else if (a[i] >= a[i - 1])
;
else {
cout << "NO";
return;
}
}
cout << "YES";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t = 1;
// cin>>t;
while (t--)
solve();
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define MP make_pair
#define F first
#define S second
#define inf 10000000000000
#define vll vector<ll>
using namespace std;
const int N = 100005;
void solve() {
ll n, a[N], i;
cin >> n;
a[0] = 0;
for (i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] - 1 >= a[i - 1])
a[i]--;
else if (a[i] >= a[i - 1])
;
else {
cout << "No";
return;
}
}
cout << "Yes";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t = 1;
// cin>>t;
while (t--)
solve();
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,206 | 757,207 | u850006519 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int x = a[n - 1];
for (int i = n - 1; i >= 0; i--) {
if (a[i] <= x) {
x = a[i];
} else {
if (a[i] - 1 <= x) {
x = a[i] - 1;
} else {
cout << "NO";
return 0;
}
}
}
cout << "YES";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int x = a[n - 1];
for (int i = n - 1; i >= 0; i--) {
if (a[i] <= x) {
x = a[i];
} else {
if (a[i] - 1 <= x) {
x = a[i] - 1;
} else {
cout << "No";
return 0;
}
}
}
cout << "Yes";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,208 | 757,209 | u888514242 | cpp |
p02953 | #include <iostream>
#include <vector>
#define re(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
re(i, n) cin >> a[i];
int p = -100;
re(i, n) {
if (p < a[i])
p = a[i] - 1;
else if (p = a[i])
p = a[i];
else
{
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | #include <iostream>
#include <vector>
#define re(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
re(i, n) cin >> a[i];
int p = -100;
re(i, n) {
if (p < a[i])
p = a[i] - 1;
else if (p == a[i])
p = a[i];
else {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
} | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 757,211 | 757,212 | u437083392 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1) {
cout << "Yes";
return 0;
}
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
for (int i = 1; i < n; ++i) {
int pre = h[i - 1];
int cur = h[i];
if (cur > (pre + 1)) {
cur = cur - 1;
h[i] = cur;
}
if (pre > cur) {
cout << "No";
return 0;
}
}
cout << "Yes";
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1) {
cout << "Yes";
return 0;
}
int h[n];
for (int i = 0; i < n; i++)
cin >> h[i];
for (int i = 1; i < n; ++i) {
int pre = h[i - 1];
int cur = h[i];
if (cur >= (pre + 1)) {
cur = cur - 1;
h[i] = cur;
}
if (pre > cur) {
cout << "No";
return 0;
}
}
cout << "Yes";
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,221 | 757,222 | u331991493 | cpp |
p02953 | #include <bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
#define st(v) (v).begin(), (v).end()
#define pr pair<int, int>
const int dx[4] = {1, 0, 0, -1};
const int dy[4] = {0, -1, 1, 0};
void solve() {
int n;
cin >> n;
vector<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]) {
cout << "NO\n";
return;
} else if (a[i] > a[i - 1]) {
a[i]--;
}
}
cout << "YES\n";
return;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int q = 1;
// cin >> q;
// while(q--)
for (int i = 1; i <= q; i++)
solve();
}
| #include <bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
#define st(v) (v).begin(), (v).end()
#define pr pair<int, int>
const int dx[4] = {1, 0, 0, -1};
const int dy[4] = {0, -1, 1, 0};
void solve() {
int n;
cin >> n;
vector<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]) {
cout << "No\n";
return;
} else if (a[i] > a[i - 1]) {
a[i]--;
}
}
cout << "Yes\n";
return;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int q = 1;
// cin >> q;
// while(q--)
for (int i = 1; i <= q; i++)
solve();
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,225 | 757,226 | u082568020 | cpp |
p02953 | #include <iostream>
using namespace std;
int a[100002];
int suff[100002];
int main() {
int i;
int n;
cin >> n;
for (i = 1; i <= n; i++)
cin >> a[i];
suff[n] = a[n];
for (i = n - 1; i >= 1; i--)
suff[i] = min(suff[i + 1], a[i]);
bool ok = true;
for (i = 1; i <= n; i++)
if (a[i] - suff[i] >= 2)
ok = false;
if (ok)
cout << "YES\n";
else
cout << "NO\n";
return 0;
} | #include <iostream>
using namespace std;
int a[100002];
int suff[100002];
int main() {
int i;
int n;
cin >> n;
for (i = 1; i <= n; i++)
cin >> a[i];
suff[n] = a[n];
for (i = n - 1; i >= 1; i--)
suff[i] = min(suff[i + 1], a[i]);
bool ok = true;
for (i = 1; i <= n; i++)
if (a[i] - suff[i] >= 2)
ok = false;
if (ok)
cout << "Yes\n";
else
cout << "No\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,227 | 757,228 | u359313068 | cpp |
p02953 | #include <iostream>
#include <string>
using namespace std;
int main(void) {
int n;
cin >> n;
int left, right;
right = 0;
cin >> left;
for (int i = 1; i < n; i++) {
cin >> right;
if (left - right > 0) {
cout << "NO";
return 0;
}
if (abs(right - left) >= 1) {
right--;
}
left = right;
}
cout << "YES";
} | #include <iostream>
#include <string>
using namespace std;
int main(void) {
int n;
cin >> n;
int left, right;
right = 0;
cin >> left;
for (int i = 1; i < n; i++) {
cin >> right;
if (left - right > 0) {
cout << "No";
return 0;
}
if (abs(right - left) >= 1) {
right--;
}
left = right;
}
cout << "Yes";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,231 | 757,232 | u294138643 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
bool flag = true;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
}
for (int j = n - 1; j > 0; j--) {
if (h[j - 1] <= h[j]) {
} else if (h[j - 1] == h[j] + 1) {
h[j - 1]--;
} else
flag = false;
}
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
bool flag = true;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h.at(i);
}
for (int j = n - 1; j > 0; j--) {
if (h[j - 1] <= h[j]) {
} else if (h[j - 1] == h[j] + 1) {
h[j - 1]--;
} else
flag = false;
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,233 | 757,234 | u501163846 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int A[100005];
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL), cout.tie(NULL);
int N;
cin >> N;
for (int i = 1; i <= N; i++)
cin >> A[i];
for (int i = N - 1; i >= 1; i--) {
if (A[i] > A[i - 1])
A[i]--;
if (A[i] > A[i - 1]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int A[100005];
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL), cout.tie(NULL);
int N;
cin >> N;
for (int i = 1; i <= N; i++)
cin >> A[i];
for (int i = N - 1; i >= 1; i--) {
if (A[i] > A[i + 1])
A[i]--;
if (A[i] > A[i + 1]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 757,245 | 757,246 | u363653022 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
int N;
int main() {
cin >> N;
int H[N + 1];
rep(i, N) cin >> H[i];
bool flg = true;
for (int i = N - 2; i >= 0; i--) {
if (H[i] == H[i + 1] + 1)
H[i] = H[i] - 1;
if (H[i] > H[i + 1] + 1) {
flg = false;
break;
}
}
cout << ((flg == true) ? "YES" : "NO") << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
int N;
int main() {
cin >> N;
int H[N + 1];
rep(i, N) cin >> H[i];
bool flg = true;
for (int i = N - 2; i >= 0; i--) {
if (H[i] == H[i + 1] + 1)
H[i] = H[i] - 1;
if (H[i] > H[i + 1] + 1) {
flg = false;
break;
}
}
cout << ((flg == true) ? "Yes" : "No") << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,253 | 757,254 | u244391385 | cpp |
p02953 | #include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int pre = -999;
rep(i, n) {
if (pre <= a[-1]) {
pre = a[i] - 1;
} else if (pre <= a[i]) {
pre = a[i];
} else {
puts("No");
return 0;
}
}
puts("Yes");
return 0;
}
| #include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int pre = -999;
rep(i, n) {
if (pre <= a[i] - 1) {
pre = a[i] - 1;
} else if (pre <= a[i]) {
pre = a[i];
} else {
puts("No");
return 0;
}
}
puts("Yes");
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 757,264 | 757,265 | u305810543 | cpp |
p02953 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int pre = 999;
rep(i, n) {
if (pre <= a[i] - 1) {
pre = a[i] - 1;
} else if (pre <= a[i]) {
pre = a[i];
} else {
puts("No");
return 0;
}
}
puts("Yes");
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
int pre = -999;
rep(i, n) {
if (pre <= a[i] - 1) {
pre = a[i] - 1;
} else if (pre <= a[i]) {
pre = a[i];
} else {
puts("No");
return 0;
}
}
puts("Yes");
return 0;
} | [
"expression.operation.unary.arithmetic.add"
] | 757,268 | 757,269 | u743473047 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
main() {
int N;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
int pre = -999;
for (int i = 0; i < N; i++) {
if (pre <= H[i] - 1) {
pre = H[i] - 1;
} else if (pre <= H[i]) {
pre = H[i];
} else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
main() {
int N;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
int pre = -999;
for (int i = 0; i < N; i++) {
if (pre <= H[i] - 1) {
pre = H[i] - 1;
} else if (pre <= H[i]) {
pre = H[i];
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,272 | 757,271 | u103850114 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
main() {
int N;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
int pre = -999;
for (int i = 0; i < N; i++) {
if (pre <= H[i] - 1) {
pre = H[i];
} else if (pre <= H[i]) {
pre = H[i];
} else {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
main() {
int N;
cin >> N;
vector<int> H(N);
for (int i = 0; i < N; i++) {
cin >> H.at(i);
}
int pre = -999;
for (int i = 0; i < N; i++) {
if (pre <= H[i] - 1) {
pre = H[i] - 1;
} else if (pre <= H[i]) {
pre = H[i];
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| [
"assignment.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,273 | 757,271 | u103850114 | cpp |
p02953 | #include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int &x : h)
cin >> x;
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i - 1] > h[i]) {
cout << "NO\n";
return 0;
}
if (h[i - 1] < h[i])
h[i]--;
}
cout << "YES\n";
return 0;
} | #include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int &x : h)
cin >> x;
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i - 1] > h[i]) {
cout << "No\n";
return 0;
}
if (h[i - 1] < h[i])
h[i]--;
}
cout << "Yes\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,277 | 757,278 | u164054572 | cpp |
p02953 | #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
#define int long long int
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define dbg(x) \
{ cerr << "> " << #x << ": " << x << endl; }
#define dbg2(x, y) \
{ cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << endl; }
#define dbg3(x, y, z) \
{ \
cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << " , " << #z \
<< ": " << z << endl; \
}
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const int MOD = 1e9 + 7;
signed main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
IOS;
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int c = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1])
a[i]--;
if (a[i] > a[i + 1])
return cout << "No", 0;
}
cout << "Yes";
return 0;
} | #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
#define int long long int
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define dbg(x) \
{ cerr << "> " << #x << ": " << x << endl; }
#define dbg2(x, y) \
{ cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << endl; }
#define dbg3(x, y, z) \
{ \
cerr << "> " << #x << ": " << x << " , " << #y << ": " << y << " , " << #z \
<< ": " << z << endl; \
}
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const int MOD = 1e9 + 7;
signed main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
IOS;
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int c = 0;
for (int i = 1; i < n; i++) {
if (a[i] > a[i - 1])
a[i]--;
if (a[i] < a[i - 1])
return cout << "No", 0;
}
cout << "Yes";
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 757,285 | 757,286 | u788280580 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
signed main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
h[0]--;
for (int i = 0; i < n; i++) {
if (h[i - 1] < h[i]) {
h[i]--;
}
if (h[i - 1] > h[i]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
signed main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i - 1] < h[i]) {
h[i]--;
}
if (h[i - 1] > h[i]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 757,292 | 757,293 | u344122377 | cpp |
p02953 | #include <iostream>
using namespace std;
int main() {
int n, x = 0, z, m;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> z;
if (z > x) {
z--;
} else if (x > z) {
cout << "NO" << endl;
return 0;
}
x = z;
}
cout << "YES" << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, x = 0, z, m;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> z;
if (z > x) {
z--;
} else if (x > z) {
cout << "No" << endl;
return 0;
}
x = z;
}
cout << "Yes" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,302 | 757,303 | u692047098 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int f = 1;
a[0] = a[0] - 1;
for (int i = 1; i < n; i++) {
if (a[i - 1] < a[i])
a[i] = a[i] - 1;
}
for (int i = 1; i < n; i++) {
if (a[i - 1] <= a[i])
;
else
f = 0;
}
if (f)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int f = 1;
a[0] = a[0] - 1;
for (int i = 1; i < n; i++) {
if (a[i - 1] < a[i])
a[i] = a[i] - 1;
}
for (int i = 1; i < n; i++) {
if (a[i - 1] <= a[i])
;
else
f = 0;
}
if (f)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,308 | 757,309 | u006069211 | cpp |
p02953 | #include <iomanip>
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int flag = 0;
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i] - h[i - 1] < -1) {
flag = 1;
break;
}
else if (h[i] - h[i - 1] > 0) {
h[i]--;
}
}
if (flag == 1) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
| #include <iomanip>
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int flag = 0;
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i] - h[i - 1] < 0) {
flag = 1;
break;
}
else if (h[i] - h[i - 1] > 0) {
h[i]--;
}
}
if (flag == 1) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 757,333 | 757,334 | u161609067 | cpp |
p02953 | #include <iomanip>
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int flag = 0;
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i] - h[i - 1] < -1) {
flag = 1;
break;
} else if (h[i] - h[i - 1] == -1) {
h[i]--;
}
}
if (flag == 1) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
| #include <iomanip>
#include <iostream>
#include <math.h>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int n;
cin >> n;
int h[n];
for (int i = 0; i < n; i++) {
cin >> h[i];
}
int flag = 0;
h[0]--;
for (int i = 1; i < n; i++) {
if (h[i] - h[i - 1] < 0) {
flag = 1;
break;
}
else if (h[i] - h[i - 1] > 0) {
h[i]--;
}
}
if (flag == 1) {
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 757,335 | 757,334 | u161609067 | cpp |
p02953 | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
// namespace mp = boost::multiprecision;
// namespace mt = boost::math
// using Bint = mp::cpp_int;
typedef long long ll;
typedef pair<int, int> P;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
int n;
cin >> n;
int h[n];
bool flag = true, only = true;
rep(i, n) {
cin >> h[i];
if (i == 0)
h[0]--;
if (i > 1) {
if (h[i - 1] >= h[i - 2]) {
h[i - 1]--;
}
}
}
rep(i, n) {
if (i > 0) {
if (h[i] < h[i - 1])
flag = false;
}
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
// namespace mp = boost::multiprecision;
// namespace mt = boost::math
// using Bint = mp::cpp_int;
typedef long long ll;
typedef pair<int, int> P;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
int n;
cin >> n;
int h[n];
bool flag = true, only = true;
rep(i, n) {
cin >> h[i];
if (i == 0)
h[0]--;
if (i > 1) {
if (h[i - 1] > h[i - 2]) {
h[i - 1]--;
}
}
}
rep(i, n) {
if (i > 0) {
if (h[i] < h[i - 1])
flag = false;
}
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,338 | 757,339 | u201827503 | cpp |
p02953 | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
// namespace mp = boost::multiprecision;
// namespace mt = boost::math
// using Bint = mp::cpp_int;
typedef pair<int, int> P;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
int n;
cin >> n;
int h[n];
bool flag = true, only = true;
rep(i, n) {
cin >> h[i];
h[0]--;
if (i > 1) {
if (h[i] <= h[i - 1] && h[i - 1] >= h[i - 2]) {
h[i - 1]--;
}
}
}
rep(i, n) {
if (i > 0) {
if (h[i] < h[i - 1])
flag = false;
}
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/math/common_factor_rt.hpp>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
// namespace mp = boost::multiprecision;
// namespace mt = boost::math
// using Bint = mp::cpp_int;
typedef pair<int, int> P;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
int n;
cin >> n;
int h[n];
bool flag = true, only = true;
rep(i, n) {
cin >> h[i];
h[0]--;
if (i > 1) {
if (h[i] <= h[i - 1] && h[i - 1] > h[i - 2]) {
h[i - 1]--;
}
}
}
rep(i, n) {
if (i > 0) {
if (h[i] < h[i - 1])
flag = false;
}
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 757,341 | 757,342 | u201827503 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rec(i, n) for (i = 0; i < n; i++)
int main() {
int i, n;
bool ans = true;
cin >> n;
vector<int> height(n);
vector<int> flag(n);
flag.at(0) = 0;
rec(i, n) { cin >> height.at(i); }
rec(i, n - 1) {
if (height.at(i) - 1 == height.at(i + 1) && flag.at(i) == 0) {
flag.at(i + 1) = 1;
} else if (height.at(i) > height.at(i + 1)) {
ans = false;
} else if (height.at(i) == height.at(i + 1)) {
flag.at(i + 1) = flag.at(i);
} else
flag.at(i + 1) = 0;
}
if (ans == true)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rec(i, n) for (i = 0; i < n; i++)
int main() {
int i, n;
bool ans = true;
cin >> n;
vector<int> height(n);
vector<int> flag(n);
flag.at(0) = 0;
rec(i, n) { cin >> height.at(i); }
rec(i, n - 1) {
if (height.at(i) - 1 == height.at(i + 1) && flag.at(i) == 0) {
flag.at(i + 1) = 1;
} else if (height.at(i) > height.at(i + 1)) {
ans = false;
} else if (height.at(i) == height.at(i + 1)) {
flag.at(i + 1) = flag.at(i);
} else
flag.at(i + 1) = 0;
}
if (ans == true)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 757,346 | 757,347 | u460608786 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int h[n + 10];
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]--;
for (int i = 0; i < n - 1; i++)
if (h[i] > h[i + 1]) {
cout << "No";
return 0;
}
cout << "Yes";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int h[n + 10];
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]--;
for (int i = 0; i < n - 1; i++)
if (h[i] > h[i + 1]) {
cout << "No";
return 0;
}
cout << "Yes";
return 0;
} | [
"control_flow.loop.for.initializer.change"
] | 757,368 | 757,369 | u957558006 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, s = 0, i = 0;
string F = "Yes";
cin >> N;
vector<int> H(N);
while (i < N) {
cin >> H.at(i);
i++;
}
while (s < N) {
if (s > 0) {
if (H.at(N - s) - H.at(N - s - 1) >= 2) {
F = "No";
break;
} else if (H.at(N - s - 1) - H.at(N - s) == 1) {
H.at(N - s - 1) = H.at(N - s - 1) - 1;
}
}
s++;
}
cout << F << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, s = 0, i = 0;
string F = "Yes";
cin >> N;
vector<int> H(N);
while (i < N) {
cin >> H.at(i);
i++;
}
while (s < N) {
if (s > 0) {
if (H.at(N - s - 1) - H.at(N - s) >= 2) {
F = "No";
break;
} else if (H.at(N - s - 1) - H.at(N - s) == 1) {
H.at(N - s - 1) = H.at(N - s - 1) - 1;
}
}
s++;
}
cout << F << endl;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 757,372 | 757,373 | u820051975 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.