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 |
|---|---|---|---|---|---|---|---|
p02952 | #include <iostream>
using namespace std;
int soremade(int k) {
int i, ans, q;
for (i = 1, ans = 0, q = 9; i <= k; i++, q *= 10) {
if (i % 2 == 1)
ans += q;
}
return ans;
}
int keta(int n) {
int k = 0;
for (int i = 1; i <= n; i *= 10, k++)
;
return k;
}
int zeros(int k) {
int ans = 1;
for (int i = 1; i < k; i++, ans *= 10)
;
return ans;
}
int main() {
int n, k, ans;
cin >> n;
k = keta(n);
ans = soremade(k - 1);
if (k % 2 == 1)
ans += (n % zeros(k)) + 1;
cout << ans << endl;
return 0;
} | #include <iostream>
using namespace std;
int soremade(int k) {
int i, ans, q;
for (i = 1, ans = 0, q = 9; i <= k; i++, q *= 10) {
if (i % 2 == 1)
ans += q;
}
return ans;
}
int keta(int n) {
int k = 0;
for (int i = 1; i <= n; i *= 10, k++)
;
return k;
}
int zeros(int k) {
int ans = 1;
for (int i = 1; i < k; i++, ans *= 10)
;
return ans;
}
int main() {
int n, k, ans;
cin >> n;
k = keta(n);
ans = soremade(k - 1);
if (k % 2 == 1)
ans += (n - zeros(k)) + 1;
cout << ans << endl;
return 0;
} | [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 755,562 | 755,563 | u393325157 | cpp |
p02952 | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int pow10(int p) {
if (p == 0)
return 1;
return 10 * pow10(p - 1);
}
int main() {
int N;
cin >> N;
int d = log10(N) + 1;
int n = 0;
for (int i = 1; i < d; i += 2) {
n += pow10(i) - pow10(i - 1);
}
cout << ((d % 2 == 0) ? n : n + N % pow10(d - 1) + 1) << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int pow10(int p) {
if (p == 0)
return 1;
return 10 * pow10(p - 1);
}
int main() {
int N;
cin >> N;
int d = log10(N) + 1;
int n = 0;
for (int i = 1; i < d; i += 2) {
n += pow10(i) - pow10(i - 1);
}
cout << ((d % 2 == 0) ? n : n + N % pow10(d) - pow10(d - 1) + 1) << endl;
return 0;
} | [
"expression.operation.binary.add"
] | 755,564 | 755,565 | u442062970 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int res;
if (n < 10) {
res = n;
} else {
if (n < 100)
res = 9;
else {
if (n < 1000)
res = 9 + n - 99;
else {
if (n < 10000)
res = 9 + 999 - 99;
else {
if (n < 100000)
res = 9 + 900 + n - 9999;
else
res = 9 + 900 + 900000;
}
}
}
}
cout << res;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int res;
if (n < 10) {
res = n;
} else {
if (n < 100)
res = 9;
else {
if (n < 1000)
res = 9 + n - 99;
else {
if (n < 10000)
res = 9 + 999 - 99;
else {
if (n < 100000)
res = 9 + 900 + n - 9999;
else
res = 9 + 900 + 90000;
}
}
}
}
cout << res;
} | [
"literal.number.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 755,570 | 755,571 | u222252114 | cpp |
p02952 | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#include <tuple>
#define INF INT_MAX >> 1
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef long long ll;
using namespace std;
struct Point {
int x, y;
};
struct Edge {
int to, cost;
};
struct Node {
int from, to, cost;
};
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) {
int d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
} else {
x = 1;
y = 0;
}
return d;
}
int main(void) {
int n;
cin >> n;
int ans = 0;
/*
for(int i=10; i<=SIZE; i*=100){
if(n > i) ans += 9*i/10;
else if(n/(i/10) > 0){
ans += n % (i/10);
ans++;
break;
} else break;
}
*/
/*
if(n >= 10) ans+= 9;
if(n >= 1000) ans += 900;
if(n >= 100000) ans += 90000;
if(n / 10000 > 0 && n < 100000){
ans += n%10000;
ans++;
cout << ans << endl;
return 0;
}
if(n / 100 > 0 && n < 1000){
ans += n%100;
ans++;
cout << ans << endl;
return 0;
}
if(n / 1 > 0 && n < 10){
ans += n%100;
cout << ans << endl;
return 0;
}
cout << ans << endl;
*/
rep2(i, 1, n) {
if (i < 10)
ans++;
else if (100 <= i && i < 1000)
ans++;
else if (10000 <= i && i < 100000)
ans++;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#include <tuple>
#define INF INT_MAX >> 1
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef long long ll;
using namespace std;
struct Point {
int x, y;
};
struct Edge {
int to, cost;
};
struct Node {
int from, to, cost;
};
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) {
int d = a;
if (b != 0) {
d = extgcd(b, a % b, y, x);
y -= (a / b) * x;
} else {
x = 1;
y = 0;
}
return d;
}
int main(void) {
int n;
cin >> n;
int ans = 0;
/*
for(int i=10; i<=SIZE; i*=100){
if(n > i) ans += 9*i/10;
else if(n/(i/10) > 0){
ans += n % (i/10);
ans++;
break;
} else break;
}
*/
/*
if(n >= 10) ans+= 9;
if(n >= 1000) ans += 900;
if(n >= 100000) ans += 90000;
if(n / 10000 > 0 && n < 100000){
ans += n%10000;
ans++;
cout << ans << endl;
return 0;
}
if(n / 100 > 0 && n < 1000){
ans += n%100;
ans++;
cout << ans << endl;
return 0;
}
if(n / 1 > 0 && n < 10){
ans += n%100;
cout << ans << endl;
return 0;
}
cout << ans << endl;
*/
rep2(i, 1, n + 1) {
if (i < 10)
ans++;
else if (100 <= i && i < 1000)
ans++;
else if (10000 <= i && i < 100000)
ans++;
}
cout << ans << endl;
return 0;
} | [
"expression.operation.binary.add"
] | 755,595 | 755,596 | u117734686 | cpp |
p02952 | #include <cstdio>
int main() {
int n, ans = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
if (i >= 1 && i <= 9)
ans++;
if (i >= 100 && i <= 999)
ans++;
if (i >= 10001 && i <= 99999)
ans++;
}
printf("%d", ans);
return 0;
} | #include <cstdio>
int main() {
int n, ans = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
if (i >= 1 && i <= 9)
ans++;
if (i >= 100 && i <= 999)
ans++;
if (i >= 10000 && i <= 99999)
ans++;
}
printf("%d", ans);
return 0;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 755,601 | 755,602 | u464153313 | cpp |
p02952 | #include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
for (int i = 1; i < n; i++) {
int j = i, num = 0;
while (j) {
j /= 10;
num++;
}
if (num % 2 == 1)
ans++;
}
cout << ans << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
int j = i, num = 0;
while (j) {
j /= 10;
num++;
}
if (num % 2 == 1)
ans++;
}
cout << ans << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,609 | 755,610 | u047554023 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
string str;
for (int i = 0; i < n; ++i) {
str = to_string(i);
if (str.length() % 2 == 1) {
// cout << str.length() << endl;
ans++;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
string str;
for (int i = 1; i <= n; ++i) {
str = to_string(i);
if (str.length() % 2 == 1) {
ans++;
}
}
cout << ans << endl;
} | [
"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"
] | 755,613 | 755,614 | u256027816 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
int ans = 0;
scanf("%d", &n);
if (n == 0) {
printf("0\n");
} else if (n < 10) {
printf("%d\n", n);
} else if (n < 100) {
printf("9\n");
} else {
int m = n;
int a = 0, b = 0;
while (m) {
a++;
m /= 10;
}
if (a == 3) {
ans = 9 + n - 100 + 1;
} else if (a == 4) {
ans = 9 + 900;
} else if (a == 5) {
ans = 9 + 900 + n - 10000 + 1;
} else if (a == 6) {
ans = 9 + 900 + 90000;
}
}
printf("%d", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
int ans = 0;
scanf("%d", &n);
if (n == 0) {
printf("0\n");
} else if (n < 10) {
printf("%d\n", n);
} else if (n < 100) {
printf("9\n");
} else {
int m = n;
int a = 0, b = 0;
while (m) {
a++;
m /= 10;
}
if (a == 3) {
ans = 9 + n - 100 + 1;
} else if (a == 4) {
ans = 9 + 900;
} else if (a == 5) {
ans = 9 + 900 + n - 10000 + 1;
} else if (a == 6) {
ans = 9 + 900 + 90000;
}
printf("%d", ans);
}
return 0;
} | [] | 755,620 | 755,621 | u741061839 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int a = 0;
cin >> N;
for (int i = 1; i < N; i++) {
if (i < 10)
a++;
else if (i >= 100 && i < 1000)
a++;
else if (i >= 10000 && i < 100000)
a++;
}
cout << a << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
int a = 0;
cin >> N;
for (int i = 1; i <= N; i++) {
if (i < 10)
a++;
else if (i >= 100 && i < 1000)
a++;
else if (i >= 10000 && i < 100000)
a++;
}
cout << a << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,648 | 755,649 | u849439947 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
// おまじない
#define INCANT \
cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), \
cout << fixed << setprecision(20);
#define int long long
// alias
#define gcd __gcd
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, T b) { return (a = max(a, b)) == b; }
template <typename T> bool chmin(T &a, T b) { return (a = min(a, b)) == b; }
template <class T> int lb(vector<T> &x, T n) {
return lower_bound(all(x), n) - x.begin();
}
template <class T> int ub(vector<T> &x, T n) {
return upper_bound(all(x), n) - x.begin();
}
// for
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for (int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for (auto &&i : n)
// 入力
void in() {}
template <typename F, typename... R> bool in(F &f, R &...r) {
if (cin >> f) {
in(r...);
return true;
} else
return false;
}
// 出力
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print() {}
template <typename F, typename... R> void print(F f, R... r) {
out(f), indent(), print(r...);
}
// デバッグ出力
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
// 脳死
#define YN(x) out((x) ? "YES" : "NO"), indent()
#define Yn(x) out((x) ? "Yes" : "No"), indent()
#define yn(x) out((x) ? "yes" : "no"), indent()
// const
int INF = 1e18, MOD = 1e9 + 7;
double EPS = 1e-15, PI = acos(-1);
int dx[] = {0, 0, 1, 0, -1, -1, 1, 1, -1},
dy[] = {0, -1, 0, 1, 0, -1, -1, 1, 1};
// 数学的な
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int factorial(int a) { return a < 2 ? 1 : factorial(a - 1) * a; }
int summation(int a) { return a < 1 ? 0 : (a * a + a) / 2; }
int combination(int n, int r) {
int res = 1;
rep(i, 1, r + 1) { res *= n--, res /= i; }
return res;
}
bool isPrime(int n) {
rep(i, 2, sqrt(n) + 1) {
if (i > 3) {
i++;
}
if (!(n % i)) {
return false;
}
}
return true;
}
vector<int> divisor(int n) {
vector<int> ans;
rep(i, 1, sqrt(n) + 1) {
if (!(n % i)) {
ans.pb(i);
if (i * i < n) {
ans.pb(n / i);
}
}
}
return ans;
}
map<int, int> factorization(int n) {
map<int, int> ans;
rep(i, 2, sqrt(n) + 1) {
if (i > 3) {
i++;
}
while (!(n % i)) {
ans[i]++, n /= i;
}
}
if (n > 1) {
ans[n]++;
}
return ans;
}
// MOD int
int extgcd(int a, int b, int &x, int &y) {
int g = a;
x = 1, y = 0;
if (b) {
g = extgcd(b, a % b, y, x);
y -= a / b * x;
}
return g;
}
int invmod(int a, int m = MOD) {
int x = 0, y = 0;
extgcd(a, m, x, y);
return (x + m) % m;
}
struct mint {
int _num;
mint(int x = 0) : _num() {
_num = x % MOD;
if (_num < 0) {
_num += MOD;
}
}
inline mint operator=(int x) {
_num = x % MOD;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator=(mint x) {
_num = x._num;
return *this;
}
inline mint operator+(int x) { return mint(_num + x); }
inline mint operator+(mint x) {
int a = _num + x._num;
if (a >= MOD) {
a -= MOD;
}
return mint{a};
}
inline mint operator+=(int x) {
_num += x;
_num %= MOD;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator+=(mint x) {
_num += x._num;
if (_num >= MOD) {
_num -= MOD;
}
return *this;
}
inline mint operator++() {
_num++;
if (_num == MOD) {
_num = 0;
}
return *this;
}
inline mint operator-(int x) { return mint(_num - x); }
inline mint operator-(mint x) {
int a = _num - x._num;
if (a < 0) {
a += MOD;
}
return mint{a};
}
inline mint operator-=(int x) {
_num -= x;
_num %= MOD;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator-=(mint x) {
_num -= x._num;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator--() {
_num--;
if (_num == -1) {
_num = MOD - 1;
}
return *this;
}
inline mint operator*(int x) { return mint(_num * (x % MOD)); }
inline mint operator*(mint x) { return mint{_num * x._num % MOD}; }
inline mint operator*=(int x) {
_num *= mint(x);
_num %= MOD;
return *this;
}
inline mint operator*=(mint x) {
_num *= x._num;
_num %= MOD;
return *this;
}
inline mint operator/(int x) { return mint(_num * invmod(mint(x), MOD)); }
inline mint operator/(mint x) {
return mint{_num * invmod(x._num, MOD) % MOD};
}
inline mint operator/=(int x) {
_num *= invmod(mint(x), MOD);
_num %= MOD;
return *this;
}
inline mint operator/=(mint x) {
_num *= invmod(x._num, MOD);
_num %= MOD;
return *this;
}
inline mint pow(int x) {
mint ans = 1, cnt = *this;
for (int i = 1; i < x + 1; i *= 2) {
if (x & i) {
ans *= cnt;
x ^= i;
}
cnt *= cnt;
}
return ans;
}
inline operator int() { return _num; }
};
vector<mint> fac(1, 1), inv(1, 1);
void reserve(int a) {
if (fac.size() >= a)
return;
if (a < fac.size() * 2)
a = fac.size() * 2;
if (a >= MOD)
a = MOD;
while (fac.size() < a)
fac.push_back(fac.back() * (int)(fac.size()));
inv.resize(fac.size());
inv.back() = mint(1) / fac.back();
for (int i = inv.size() - 1; !inv[i - 1]; i--)
inv[i - 1] = inv[i] * i;
}
mint fact(int n) {
if (n < 0)
return 0;
reserve(n + 1);
return fac[n];
}
mint perm(int n, int r) {
if (r < 0 || n < r)
return 0;
reserve(n + 1);
return fac[n] * inv[n - r];
}
mint comb(int n, int r) {
if (r < 0 || n < r)
return 0;
reserve(n + 1);
return fac[n] * inv[r] * inv[n - r];
}
mint mcomb(int n, int r) {
return comb(n + r - 1, n - 1);
} // r個をn部屋に分ける
// UnionFind
struct UF {
vector<int> t;
UF(int size) : t(size, -1) {}
int root(int x) { return t[x] < 0 ? x : t[x] = root(t[x]); }
int size(int x) { return -t[root(x)]; }
bool isSame(int x, int y) { return root(x) == root(y); }
bool unite(int x, int y) {
x = root(x), y = root(y);
if (x != y) {
if (t[y] < t[x]) {
swap(x, y);
}
t[x] += t[y], t[y] = x;
}
return x != y;
}
};
// main
main() {
INCANT;
int n, res = 0;
in(n);
rep(i, 1, n + 1) {
if (i < 100000 && 1 > 9999 || i < 1000 && i > 99 || i < 10) {
res++;
}
}
print(res);
}
| #include <bits/stdc++.h>
using namespace std;
// おまじない
#define INCANT \
cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), \
cout << fixed << setprecision(20);
#define int long long
// alias
#define gcd __gcd
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, T b) { return (a = max(a, b)) == b; }
template <typename T> bool chmin(T &a, T b) { return (a = min(a, b)) == b; }
template <class T> int lb(vector<T> &x, T n) {
return lower_bound(all(x), n) - x.begin();
}
template <class T> int ub(vector<T> &x, T n) {
return upper_bound(all(x), n) - x.begin();
}
// for
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for (int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for (auto &&i : n)
// 入力
void in() {}
template <typename F, typename... R> bool in(F &f, R &...r) {
if (cin >> f) {
in(r...);
return true;
} else
return false;
}
// 出力
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print() {}
template <typename F, typename... R> void print(F f, R... r) {
out(f), indent(), print(r...);
}
// デバッグ出力
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
// 脳死
#define YN(x) out((x) ? "YES" : "NO"), indent()
#define Yn(x) out((x) ? "Yes" : "No"), indent()
#define yn(x) out((x) ? "yes" : "no"), indent()
// const
int INF = 1e18, MOD = 1e9 + 7;
double EPS = 1e-15, PI = acos(-1);
int dx[] = {0, 0, 1, 0, -1, -1, 1, 1, -1},
dy[] = {0, -1, 0, 1, 0, -1, -1, 1, 1};
// 数学的な
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int factorial(int a) { return a < 2 ? 1 : factorial(a - 1) * a; }
int summation(int a) { return a < 1 ? 0 : (a * a + a) / 2; }
int combination(int n, int r) {
int res = 1;
rep(i, 1, r + 1) { res *= n--, res /= i; }
return res;
}
bool isPrime(int n) {
rep(i, 2, sqrt(n) + 1) {
if (i > 3) {
i++;
}
if (!(n % i)) {
return false;
}
}
return true;
}
vector<int> divisor(int n) {
vector<int> ans;
rep(i, 1, sqrt(n) + 1) {
if (!(n % i)) {
ans.pb(i);
if (i * i < n) {
ans.pb(n / i);
}
}
}
return ans;
}
map<int, int> factorization(int n) {
map<int, int> ans;
rep(i, 2, sqrt(n) + 1) {
if (i > 3) {
i++;
}
while (!(n % i)) {
ans[i]++, n /= i;
}
}
if (n > 1) {
ans[n]++;
}
return ans;
}
// MOD int
int extgcd(int a, int b, int &x, int &y) {
int g = a;
x = 1, y = 0;
if (b) {
g = extgcd(b, a % b, y, x);
y -= a / b * x;
}
return g;
}
int invmod(int a, int m = MOD) {
int x = 0, y = 0;
extgcd(a, m, x, y);
return (x + m) % m;
}
struct mint {
int _num;
mint(int x = 0) : _num() {
_num = x % MOD;
if (_num < 0) {
_num += MOD;
}
}
inline mint operator=(int x) {
_num = x % MOD;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator=(mint x) {
_num = x._num;
return *this;
}
inline mint operator+(int x) { return mint(_num + x); }
inline mint operator+(mint x) {
int a = _num + x._num;
if (a >= MOD) {
a -= MOD;
}
return mint{a};
}
inline mint operator+=(int x) {
_num += x;
_num %= MOD;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator+=(mint x) {
_num += x._num;
if (_num >= MOD) {
_num -= MOD;
}
return *this;
}
inline mint operator++() {
_num++;
if (_num == MOD) {
_num = 0;
}
return *this;
}
inline mint operator-(int x) { return mint(_num - x); }
inline mint operator-(mint x) {
int a = _num - x._num;
if (a < 0) {
a += MOD;
}
return mint{a};
}
inline mint operator-=(int x) {
_num -= x;
_num %= MOD;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator-=(mint x) {
_num -= x._num;
if (_num < 0) {
_num += MOD;
}
return *this;
}
inline mint operator--() {
_num--;
if (_num == -1) {
_num = MOD - 1;
}
return *this;
}
inline mint operator*(int x) { return mint(_num * (x % MOD)); }
inline mint operator*(mint x) { return mint{_num * x._num % MOD}; }
inline mint operator*=(int x) {
_num *= mint(x);
_num %= MOD;
return *this;
}
inline mint operator*=(mint x) {
_num *= x._num;
_num %= MOD;
return *this;
}
inline mint operator/(int x) { return mint(_num * invmod(mint(x), MOD)); }
inline mint operator/(mint x) {
return mint{_num * invmod(x._num, MOD) % MOD};
}
inline mint operator/=(int x) {
_num *= invmod(mint(x), MOD);
_num %= MOD;
return *this;
}
inline mint operator/=(mint x) {
_num *= invmod(x._num, MOD);
_num %= MOD;
return *this;
}
inline mint pow(int x) {
mint ans = 1, cnt = *this;
for (int i = 1; i < x + 1; i *= 2) {
if (x & i) {
ans *= cnt;
x ^= i;
}
cnt *= cnt;
}
return ans;
}
inline operator int() { return _num; }
};
vector<mint> fac(1, 1), inv(1, 1);
void reserve(int a) {
if (fac.size() >= a)
return;
if (a < fac.size() * 2)
a = fac.size() * 2;
if (a >= MOD)
a = MOD;
while (fac.size() < a)
fac.push_back(fac.back() * (int)(fac.size()));
inv.resize(fac.size());
inv.back() = mint(1) / fac.back();
for (int i = inv.size() - 1; !inv[i - 1]; i--)
inv[i - 1] = inv[i] * i;
}
mint fact(int n) {
if (n < 0)
return 0;
reserve(n + 1);
return fac[n];
}
mint perm(int n, int r) {
if (r < 0 || n < r)
return 0;
reserve(n + 1);
return fac[n] * inv[n - r];
}
mint comb(int n, int r) {
if (r < 0 || n < r)
return 0;
reserve(n + 1);
return fac[n] * inv[r] * inv[n - r];
}
mint mcomb(int n, int r) {
return comb(n + r - 1, n - 1);
} // r個をn部屋に分ける
// UnionFind
struct UF {
vector<int> t;
UF(int size) : t(size, -1) {}
int root(int x) { return t[x] < 0 ? x : t[x] = root(t[x]); }
int size(int x) { return -t[root(x)]; }
bool isSame(int x, int y) { return root(x) == root(y); }
bool unite(int x, int y) {
x = root(x), y = root(y);
if (x != y) {
if (t[y] < t[x]) {
swap(x, y);
}
t[x] += t[y], t[y] = x;
}
return x != y;
}
};
// main
main() {
INCANT;
int n, res = 0;
in(n);
rep(i, 1, n + 1) {
if (i < 100000 && i > 9999 || i < 1000 && i > 99 || i < 10) {
res++;
}
}
print(res);
}
| [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 755,652 | 755,653 | u303059352 | cpp |
p02952 | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 909;
}
if (n >= 10000 && n <= 100000) {
ans = 909 + n - 10000 + 1;
}
if (n > 100000) {
ans = 90909;
}
printf("%d", ans);
} | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 909;
}
if (n >= 10000 && n < 100000) {
ans = 909 + n - 10000 + 1;
}
if (n >= 100000) {
ans = 90909;
}
printf("%d", ans);
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,666 | 755,665 | u477525609 | cpp |
p02952 | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 109;
}
if (n >= 10000 && n <= 100000) {
ans = 109 + n - 10000 + 1;
}
if (n > 100000) {
ans = 90909;
}
printf("%d", ans);
} | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 909;
}
if (n >= 10000 && n < 100000) {
ans = 909 + n - 10000 + 1;
}
if (n >= 100000) {
ans = 90909;
}
printf("%d", ans);
}
| [
"literal.number.change",
"assignment.value.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change"
] | 755,667 | 755,665 | u477525609 | cpp |
p02952 | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 109;
}
if (n >= 10000 && n < 100000) {
ans = 109 + n - 10000 + 1;
}
if (n == 100000) {
ans = 90909;
}
printf("%d", ans);
}
| #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 909;
}
if (n >= 10000 && n < 100000) {
ans = 909 + n - 10000 + 1;
}
if (n >= 100000) {
ans = 90909;
}
printf("%d", ans);
}
| [
"literal.number.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,668 | 755,665 | u477525609 | cpp |
p02952 | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 110;
}
if (n >= 10000 && n < 100000) {
ans = 110 + n - 10000 + 1;
}
if (n == 100000) {
ans = 90909;
}
printf("%d", ans);
} | #include <algorithm>
#include <stdio.h>
using namespace std;
int main() {
int n, ans;
scanf("%d", &n);
if (n < 10) {
ans = n;
}
if (n >= 10 && n < 100) {
ans = 9;
}
if (n >= 100 && n < 1000) {
ans = 9 + n - 100 + 1;
}
if (n >= 1000 && n < 10000) {
ans = 909;
}
if (n >= 10000 && n < 100000) {
ans = 909 + n - 10000 + 1;
}
if (n >= 100000) {
ans = 90909;
}
printf("%d", ans);
}
| [
"literal.number.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,669 | 755,665 | u477525609 | cpp |
p02952 | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
if (n >= 9)
ans += 9;
if (n >= 999)
ans += 900;
if (n >= 99999)
ans += 90000;
if (n > 0 && n < 9)
ans += n - 0;
if (n > 100 && n < 999)
ans += n - 100 + 1;
if (n > 10000 && n < 99999)
ans += n - 10000 + 1;
cout << ans;
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
if (n >= 9)
ans += 9;
if (n >= 999)
ans += 900;
if (n >= 99999)
ans += 90000;
if (n >= 0 && n < 9)
ans += n - 0;
if (n >= 100 && n < 999)
ans += n - 100 + 1;
if (n >= 10000 && n < 99999)
ans += n - 10000 + 1;
cout << ans;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,677 | 755,678 | u466318894 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
int b = a;
int n = 1;
while (a / 10 >= 1) {
a /= 10;
n += 1;
}
int ans = 0;
if (n = 1) {
ans = b;
} else if (n % 2 == 0) {
for (int i = 0; i < n / 2; ++i) {
ans += 9 * (pow(10, (i * 2)));
}
} else {
for (int i = 0; i < n / 2; ++i) {
ans += 9 * (pow(10, (i * 2)));
}
int l = pow(10, (n - 1));
ans += (b % l);
ans += 1;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
int b = a;
int n = 1;
while (a / 10 >= 1) {
a /= 10;
n += 1;
}
int ans = 0;
if (n == 1) {
ans = b;
} else if (n % 2 == 0) {
for (int i = 0; i < n / 2; ++i) {
ans += 9 * (pow(10, (i * 2)));
}
} else {
for (int i = 0; i < n / 2; ++i) {
ans += 9 * (pow(10, (i * 2)));
}
int l = pow(10, (n - 1));
ans += (b - l);
ans += 1;
}
cout << ans << endl;
} | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 755,693 | 755,692 | u567252408 | cpp |
p02952 | #include <iostream>
int main() {
int N;
std::cin >> N;
int nketa = 0;
int n = N;
while (n > 0) {
n /= 10;
++nketa;
}
int ans = 0;
int m = 1;
for (int i = 1; i < nketa; ++i) {
m *= 10;
if (i % 2 != 0)
ans += m - m / 10;
}
if (nketa % 2 != 0)
ans += N - m / 10 + 1;
std::cout << ans << std::endl;
return 0;
}
| #include <iostream>
int main() {
int N;
std::cin >> N;
int nketa = 0;
int n = N;
while (n > 0) {
n /= 10;
++nketa;
}
long long ans = 0;
int m = 1;
for (int i = 1; i < nketa; ++i) {
m *= 10;
if (i % 2 != 0)
ans += m - m / 10;
}
if (nketa % 2 != 0)
ans += N - m + 1;
std::cout << ans << std::endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operation.binary.remove"
] | 755,713 | 755,714 | u047150897 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
if (n > 99999) {
cout << 90909;
return 0;
}
if (n > 9999) {
cout << n % 10000 + 1 + 909;
return 0;
}
if (n > 999) {
cout << 909;
return 0;
}
if (n > 99) {
cout << n % 100 + 1 + 9;
return 0;
}
if (n > 9) {
cout << 9;
return 0;
}
cout << n;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
if (n > 99999) {
cout << 90909;
return 0;
}
if (n > 9999) {
cout << n - 10000 + 1 + 909;
return 0;
}
if (n > 999) {
cout << 909;
return 0;
}
if (n > 99) {
cout << n - 100 + 1 + 9;
return 0;
}
if (n > 9) {
cout << 9;
return 0;
}
cout << n;
return 0;
} | [
"expression.operator.arithmetic.change",
"io.output.change"
] | 755,741 | 755,742 | u666625234 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
using llong = long long;
#define rep(i, N) for (int i = 0; i < N; i++)
const llong MOD = 1e9 + 7;
const llong inf = 1 << 30;
int main() {
int N;
cin >> N;
int res = 0;
for (int i = 1; i < N; i++) {
string temp = to_string(i);
int digit = temp.size();
if (digit % 2)
res++;
}
cout << res << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using llong = long long;
#define rep(i, N) for (int i = 0; i < N; i++)
const llong MOD = 1e9 + 7;
const llong inf = 1 << 30;
int main() {
int N;
cin >> N;
int res = 0;
for (int i = 1; i <= N; i++) {
string temp = to_string(i);
int digit = temp.size();
if (digit % 2)
res++;
}
cout << res << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,751 | 755,752 | u877476774 | cpp |
p02952 | #include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int LIM = 4e6 + 3;
pair<int, int> arr[LIM + 3];
int main() {
int n;
cin >> n;
int Ans = 0;
for (int i = 1; i < n; i++) {
string s = to_string(i);
if ((s.size()) % 2 == 1)
Ans++;
}
cout << Ans << endl;
} | #include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int LIM = 4e6 + 3;
pair<int, int> arr[LIM + 3];
int main() {
int n;
cin >> n;
int Ans = 0;
for (int i = 1; i <= n; i++) {
string s = to_string(i);
if ((s.size()) % 2 == 1)
Ans++;
}
cout << Ans << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,753 | 755,754 | u540045035 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9 + 7;
int main() {
int n;
cin >> n;
int cnt = 0;
int d = 0;
for (int i = 1; i <= n; i++) {
if (i >= 1 && i < 10)
cnt++;
if (i >= 100 && i < 1000)
cnt++;
if (i > 10000 && i < 1e6)
cnt++;
}
cout << cnt << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9 + 7;
int main() {
int n;
cin >> n;
int cnt = 0;
int d = 0;
for (int i = 1; i <= n; i++) {
if (i >= 1 && i < 10)
cnt++;
if (i >= 100 && i < 1000)
cnt++;
if (i >= 10000 && i < 1e5)
cnt++;
}
cout << cnt << endl;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.number.change"
] | 755,757 | 755,758 | u876784108 | cpp |
p02952 | #include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (long long i = (a), i##Len_ = (b); i < i##Len_; i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
int main() {
ll N;
cin >> N;
ll res;
res = 0;
FOR(i, 1, N) {
ll tmp = i;
ll kai = 0;
while (tmp / 10 != 0) {
++kai;
tmp /= 10;
}
if (kai % 2 == 0) {
++res;
}
}
cout << res << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (long long i = (a), i##Len_ = (b); i < i##Len_; i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
int main() {
ll N;
cin >> N;
ll res;
res = 0;
FOR(i, 1, N + 1) {
ll tmp = i;
ll kai = 0;
while (tmp / 10 != 0) {
++kai;
tmp /= 10;
}
if (kai % 2 == 0) {
++res;
}
}
cout << res << endl;
return 0;
} | [
"expression.operation.binary.add"
] | 755,761 | 755,762 | u485731913 | cpp |
p02952 | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <stdio.h>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define urep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(x) (x).begin(), (x).end()
#define INF 1e18
typedef long long ll;
const ll MAX = 510000;
const ll mod = 1e9 + 7;
using namespace std;
ll dx[4] = {1, -1, 0, 0};
ll dy[4] = {0, 0, 1, -1};
ll N, M, X, Y, A, B, C, D, Q, K, R, W, H, P, L, G;
ll ans;
string S, T;
ll y[101010];
ll a[201010];
ll k[101010];
ll b[201010];
ll d[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll v[101010];
ll s[101010];
ll x[101010];
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
struct Edge {
ll to, cost;
Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge>> AdjList;
AdjList graph;
vector<ll> dist;
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
vector<ll> size;
UnionFind(ll N) : par(N), size(N) { //最初は全てが根であるとして初期化
for (ll i = 0; i < N; i++)
par[i] = i;
for (ll i = 0; i < N; i++)
size[i] = 1;
}
ll root(ll x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
ll GetSize(ll x) { return size[root(x)]; }
void unite(ll x, ll y) { // xとyの木を併合
ll rx = root(x); // xの根をrx
ll ry = root(y); // yの根をry
if (rx == ry)
return; // xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] =
ry; // xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
size[ry] += size[rx];
}
bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
ll rx = root(x);
ll ry = root(y);
return rx == ry;
}
};
int main() {
cin >> N;
ans = 0;
rep(i, 0, N) {
ll num = i;
ll tmp = 0;
while (num >= 1) {
num /= 10;
tmp++;
}
if (tmp % 2 == 1) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <stdio.h>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define urep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(x) (x).begin(), (x).end()
#define INF 1e18
typedef long long ll;
const ll MAX = 510000;
const ll mod = 1e9 + 7;
using namespace std;
ll dx[4] = {1, -1, 0, 0};
ll dy[4] = {0, 0, 1, -1};
ll N, M, X, Y, A, B, C, D, Q, K, R, W, H, P, L, G;
ll ans;
string S, T;
ll y[101010];
ll a[201010];
ll k[101010];
ll b[201010];
ll d[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll v[101010];
ll s[101010];
ll x[101010];
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
struct Edge {
ll to, cost;
Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge>> AdjList;
AdjList graph;
vector<ll> dist;
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
vector<ll> size;
UnionFind(ll N) : par(N), size(N) { //最初は全てが根であるとして初期化
for (ll i = 0; i < N; i++)
par[i] = i;
for (ll i = 0; i < N; i++)
size[i] = 1;
}
ll root(ll x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
ll GetSize(ll x) { return size[root(x)]; }
void unite(ll x, ll y) { // xとyの木を併合
ll rx = root(x); // xの根をrx
ll ry = root(y); // yの根をry
if (rx == ry)
return; // xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] =
ry; // xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
size[ry] += size[rx];
}
bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
ll rx = root(x);
ll ry = root(y);
return rx == ry;
}
};
int main() {
cin >> N;
ans = 0;
rep(i, 0, N + 1) {
ll num = i;
ll tmp = 0;
while (num >= 1) {
num /= 10;
tmp++;
}
if (tmp % 2 == 1) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.add"
] | 755,763 | 755,764 | u406225550 | cpp |
p02952 | #include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
typedef stack<int> IntStack;
typedef queue<int> IntQueue;
const double pi = 3.141592653589793;
//最大公約数
template <class T> T gcd(T a, T b) {
while (true) {
T r;
if (a % b == 0)
return b;
else {
r = a % b;
a = b;
b = r;
}
}
}
//最小公倍数
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
//文字0~9をint型0~9に変換
int char_to_int(char c) {
if (c == '0')
return 0;
if (c == '1')
return 1;
if (c == '2')
return 2;
if (c == '3')
return 3;
if (c == '4')
return 4;
if (c == '5')
return 5;
if (c == '6')
return 6;
if (c == '7')
return 7;
if (c == '8')
return 8;
if (c == '9')
return 9;
else
return -1;
}
// a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD) {
if (b == 0)
return 1;
else if (b % 2 == 0) {
long long int d = ModPower(a, b / 2, MOD);
return (d * d) % MOD;
} else {
return (a * ModPower(a, b - 1, MOD)) % MOD;
}
}
// nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD) {
if (n == 0 || r == 0)
return 1;
long long int Kn = 1, Kr = 1, Knr = 1;
long long int temp = 1;
for (long long int i = 1; i <= n; i++) {
temp *= i;
temp %= MOD;
if (i == n)
Kn = temp;
if (i == r)
Kr = temp;
if (i == n - r)
Knr = temp;
}
long long int x = ModPower(Kr, MOD - 2, MOD);
long long int y = ModPower(Knr, MOD - 2, MOD);
long long int ans;
ans = Kn * x;
ans %= MOD;
ans *= y;
ans %= MOD;
return ans;
}
// int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord) {
int y;
string ans = "";
for (int i = 0; i < ord; i++) {
y = x / (int)pow(2, ord - 1 - i);
y %= 2;
if (y == 0)
ans += "0";
else
ans += "1";
}
return ans;
}
// ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord) {
int res = 0;
for (int i = 0; i < ord; i++) {
if (x[i] == '1')
res += (int)pow(2, ord - 1 - i);
}
return res;
}
/*ここまでテンプレ*/ /*ここまでテンプレ*/
/*ここまでテンプレ*/ /*ここまでテンプレ*/
int main() {
int N;
cin >> N;
int ans = 0;
for (int i = 1; i <= N; i++) {
if (1 <= i && i <= 9)
ans++;
if (100 <= i && i <= 999)
ans++;
if (100000 <= i)
ans++;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
typedef stack<int> IntStack;
typedef queue<int> IntQueue;
const double pi = 3.141592653589793;
//最大公約数
template <class T> T gcd(T a, T b) {
while (true) {
T r;
if (a % b == 0)
return b;
else {
r = a % b;
a = b;
b = r;
}
}
}
//最小公倍数
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
//文字0~9をint型0~9に変換
int char_to_int(char c) {
if (c == '0')
return 0;
if (c == '1')
return 1;
if (c == '2')
return 2;
if (c == '3')
return 3;
if (c == '4')
return 4;
if (c == '5')
return 5;
if (c == '6')
return 6;
if (c == '7')
return 7;
if (c == '8')
return 8;
if (c == '9')
return 9;
else
return -1;
}
// a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD) {
if (b == 0)
return 1;
else if (b % 2 == 0) {
long long int d = ModPower(a, b / 2, MOD);
return (d * d) % MOD;
} else {
return (a * ModPower(a, b - 1, MOD)) % MOD;
}
}
// nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD) {
if (n == 0 || r == 0)
return 1;
long long int Kn = 1, Kr = 1, Knr = 1;
long long int temp = 1;
for (long long int i = 1; i <= n; i++) {
temp *= i;
temp %= MOD;
if (i == n)
Kn = temp;
if (i == r)
Kr = temp;
if (i == n - r)
Knr = temp;
}
long long int x = ModPower(Kr, MOD - 2, MOD);
long long int y = ModPower(Knr, MOD - 2, MOD);
long long int ans;
ans = Kn * x;
ans %= MOD;
ans *= y;
ans %= MOD;
return ans;
}
// int型10進数をord桁のstring型2進数に変換する
string binary(int x, int ord) {
int y;
string ans = "";
for (int i = 0; i < ord; i++) {
y = x / (int)pow(2, ord - 1 - i);
y %= 2;
if (y == 0)
ans += "0";
else
ans += "1";
}
return ans;
}
// ord桁のstring型2進数をint型10進数に変換する
int rep_binary(string x, int ord) {
int res = 0;
for (int i = 0; i < ord; i++) {
if (x[i] == '1')
res += (int)pow(2, ord - 1 - i);
}
return res;
}
/*ここまでテンプレ*/ /*ここまでテンプレ*/
/*ここまでテンプレ*/ /*ここまでテンプレ*/
int main() {
int N;
cin >> N;
int ans = 0;
for (int i = 1; i <= N; i++) {
if (1 <= i && i <= 9)
ans++;
if (100 <= i && i <= 999)
ans++;
if (10000 <= i && i <= 99999)
ans++;
}
cout << ans << endl;
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 755,771 | 755,772 | u397037010 | cpp |
p02952 | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int kazu(int x) {
int temp;
if (x < 10) {
return 1;
} else if (100 <= x && x < 1000) {
return 1;
} else if (10000 <= x && x < 100000) {
return 1;
} else {
return 0;
}
}
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i < n; i++) {
ans += kazu(i);
}
cout << ans;
return 0;
} | #include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int kazu(int x) {
int temp;
if (1 <= x && x < 10) {
return 1;
} else if (100 <= x && x < 1000) {
return 1;
} else if (10000 <= x && x < 100000) {
return 1;
} else {
return 0;
}
}
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
ans += kazu(i);
}
cout << ans;
return 0;
} | [
"control_flow.branch.if.condition.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,783 | 755,784 | u135203576 | cpp |
p02952 | #include <bits/stdc++.h>
#define ipair pair<int, int>
#define rep(i, n) for (i = 0; i < n; i++)
#define repj(i, j, n) for (i = j; i < n; i++)
#define PB(a, i) (a).push_back(i)
#define ALL(a) (a).begin(), (a).end()
#define SIZE(a, n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define VSORT(a, type) sort(ALL(a), greater<type>())
#define MAPIN(a, i, j) (a).insert(make_pair(i, j))
#define OK(i) cout << "OK " << i << endl
#define Yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define No cout << "No" << endl
#define NO cout << "NO" << endl
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> Matrix;
int main() {
int n, i, j;
bool t;
cin >> n;
j = 1;
i = 0;
if (n < 10) {
cout << n;
} else {
while (n / j > 0) {
if (j * 10 <= n) {
i += j * 9;
} else {
i += n % j + 1;
}
j *= 100;
}
cout << i;
}
return 0;
}
| #include <bits/stdc++.h>
#define ipair pair<int, int>
#define rep(i, n) for (i = 0; i < n; i++)
#define repj(i, j, n) for (i = j; i < n; i++)
#define PB(a, i) (a).push_back(i)
#define ALL(a) (a).begin(), (a).end()
#define SIZE(a, n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define VSORT(a, type) sort(ALL(a), greater<type>())
#define MAPIN(a, i, j) (a).insert(make_pair(i, j))
#define OK(i) cout << "OK " << i << endl
#define Yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define No cout << "No" << endl
#define NO cout << "NO" << endl
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> Matrix;
int main() {
int n, i, j;
bool t;
cin >> n;
j = 1;
i = 0;
if (n < 10) {
cout << n;
} else {
while (n / j > 0) {
if (j * 10 <= n) {
i += j * 9;
} else {
i += n % (j * 10) - j + 1;
}
j *= 100;
}
cout << i;
}
return 0;
}
| [
"assignment.change"
] | 755,785 | 755,786 | u274055316 | cpp |
p02952 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
typedef long long ll;
using namespace std;
ll rem(ll num, ll a) {
while (num >= a) {
num -= a;
}
return num;
}
int main() {
int a;
scanf("%d", &a);
int one = 0, three = 0, five = 0;
if (a > 1) {
one = min(9, a);
}
if (a > 99) {
three = min(999, a) - 100 + 1;
}
if (a > 9999) {
five = min(99999, a) - 10000 + 1;
}
cout << one + three + five << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
typedef long long ll;
using namespace std;
ll rem(ll num, ll a) {
while (num >= a) {
num -= a;
}
return num;
}
int main() {
int a;
scanf("%d", &a);
int one = 0, three = 0, five = 0;
if (a > 0) {
one = min(9, a);
}
if (a > 99) {
three = min(999, a) - 100 + 1;
}
if (a > 9999) {
five = min(99999, a) - 10000 + 1;
}
cout << one + three + five << endl;
return 0;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 755,801 | 755,802 | u327949948 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int keta(int x) {
for (int i = 1; i < 11; i++) {
if (x == 0 || x == 1) {
return 1;
}
if (x != 0 && x != 1) {
if (x % int(pow(10, i)) == x) {
return i;
break;
}
}
}
}
int main() {
int N;
cin >> N;
int ans = 0;
for (long long int i = 1; i < N; i++) {
if (keta(i) % 2 == 1) {
ans++;
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int keta(int x) {
for (int i = 1; i < 11; i++) {
if (x == 0 || x == 1) {
return 1;
}
if (x != 0 && x != 1) {
if (x % int(pow(10, i)) == x) {
return i;
break;
}
}
}
}
int main() {
int N;
cin >> N;
int ans = 0;
for (long long int i = 1; i <= N; i++) {
if (keta(i) % 2 == 1) {
ans++;
}
}
cout << ans << endl;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,805 | 755,806 | u096717230 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int digit = 1;
while (N >= pow(10, digit)) {
digit++;
}
switch (digit) {
case 1:
cout << N << endl;
case 2:
cout << 9 << endl;
break;
case 3:
cout << (N - 100 + 1) + 9 << endl;
break;
case 4:
cout << 900 + 9 << endl;
break;
case 5:
cout << (N - 10000 + 1) + 900 + 9 << endl;
break;
case 6:
cout << 90000 + 900 + 9 << endl;
break;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int digit = 1;
while (N >= pow(10, digit)) {
digit++;
}
switch (digit) {
case 1:
cout << N << endl;
break;
case 2:
cout << 9 << endl;
break;
case 3:
cout << (N - 100 + 1) + 9 << endl;
break;
case 4:
cout << 900 + 9 << endl;
break;
case 5:
cout << (N - 10000 + 1) + 900 + 9 << endl;
break;
case 6:
cout << 90000 + 900 + 9 << endl;
break;
}
}
| [
"control_flow.break.add"
] | 755,815 | 755,816 | u732546570 | cpp |
p02952 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
//最小公倍数
ll gcd(ll x, ll y) {
ll tmp = 0;
if (x < y) {
tmp = x;
x = y;
y = tmp;
}
while (y > 0) {
ll r = x % y;
x = y;
y = r;
}
return x;
}
//最大公倍数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//階乗
ll kaijo(ll k) {
ll sum = 1;
for (ll i = 1; i <= k; ++i) {
sum *= i;
sum %= 1000000000 + 7;
}
return sum;
}
// for(int i = ; i < ; i++){}
int main() {
int n;
cin >> n;
if (n < 10)
cout << n << endl;
else if (10 <= n && n < 100)
cout << 9 << endl;
else if (100 <= n && n < 1000)
cout << 9 + (n + 1) % 100 << endl;
else if (1000 <= n && n < 10000)
cout << 909 << endl;
else if (10000 <= n && n < 100000)
cout << 909 + (n + 1) % 10000 << endl;
else
cout << 90909 << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
//最小公倍数
ll gcd(ll x, ll y) {
ll tmp = 0;
if (x < y) {
tmp = x;
x = y;
y = tmp;
}
while (y > 0) {
ll r = x % y;
x = y;
y = r;
}
return x;
}
//最大公倍数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//階乗
ll kaijo(ll k) {
ll sum = 1;
for (ll i = 1; i <= k; ++i) {
sum *= i;
sum %= 1000000000 + 7;
}
return sum;
}
// for(int i = ; i < ; i++){}
int main() {
int n;
cin >> n;
if (n < 10)
cout << n << endl;
else if (10 <= n && n < 100)
cout << 9 << endl;
else if (100 <= n && n < 1000)
cout << 9 + (n + 1) - 100 << endl;
else if (1000 <= n && n < 10000)
cout << 909 << endl;
else if (10000 <= n && n < 100000)
cout << 909 + (n + 1) - 10000 << endl;
else
cout << 90909 << endl;
return 0;
} | [
"expression.operator.arithmetic.change",
"io.output.change"
] | 755,819 | 755,820 | u622585907 | cpp |
p02952 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
if (N > 100000)
cout << 90909;
else if (N >= 10000)
cout << N - 10000 + 909 + 1;
else if (N >= 1000)
cout << 909;
else if (N >= 100)
cout << N - 100 + 9 + 1;
else if (N >= 10)
cout << 9;
else
cout << N;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
if (N >= 100000)
cout << 90909;
else if (N >= 10000)
cout << N - 10000 + 909 + 1;
else if (N >= 1000)
cout << 909;
else if (N >= 100)
cout << N - 100 + 9 + 1;
else if (N >= 10)
cout << 9;
else
cout << N;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,826 | 755,827 | u582357587 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int n, s = 1, len, sum[10], ans;
int main() {
cin >> n;
int m = n;
while (m) {
s *= 10, len++;
m /= 10;
}
s /= 10;
if (len > 1)
ans += 9;
if (len > 3)
ans += 900;
if (len > 5)
ans += 90000;
if (len % 2 == 1)
ans += n % s + 1;
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n, s = 1, len, sum[10], ans;
int main() {
cin >> n;
int m = n;
while (m) {
s *= 10, len++;
m /= 10;
}
s /= 10;
if (len > 1)
ans += 9;
if (len > 3)
ans += 900;
if (len > 5)
ans += 90000;
if (len % 2 == 1)
ans += n - s + 1;
cout << ans;
return 0;
} | [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 755,837 | 755,838 | u727652622 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int f(int x) {
int r = 0;
while (x > 0) {
r++;
x /= 10;
}
return r;
}
int main() {
int n, i, ans = 0;
cin >> n;
for (i = 1; i < n; i++)
if (f(i) & 1)
ans++;
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
int f(int x) {
int r = 0;
while (x > 0) {
r++;
x /= 10;
}
return r;
}
int main() {
int n, i, ans = 0;
cin >> n;
for (i = 1; i <= n; i++)
if (f(i) & 1)
ans++;
cout << ans;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,843 | 755,844 | u415372660 | cpp |
p02952 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int a;
cin >> a;
int ans = 0;
for (int i = 1; i < a; i++) {
if (i < 10) {
ans++;
} else if (i >= 100 && i < 1000) {
ans++;
} else if (i >= 10000 && i < 100000) {
ans++;
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int a;
cin >> a;
int ans = 0;
for (int i = 1; i <= a; i++) {
if (i < 10) {
ans++;
} else if (i >= 100 && i < 1000) {
ans++;
} else if (i >= 10000 && i < 100000) {
ans++;
}
}
cout << ans << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,850 | 755,851 | u392569193 | cpp |
p02952 | /*================================================================
* Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
* 文件名称:B.cpp
* 创 建 者:YaliKiWi
* 创建日期:2019年08月04日
* 描 述:
*
================================================================*/
#include <bits/stdc++.h>
using namespace std;
int n, ans;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (register int i = 1; i <= n; i++) {
if ((i < 10 and i >= 1) or (i < 1000 and i > 100) or
(i < 100000 and i > 10000))
ans++;
}
cout << ans;
return 0;
} | /*================================================================
* Copyright (C) 2019 Sangfor Ltd. All rights reserved.
*
* 文件名称:B.cpp
* 创 建 者:YaliKiWi
* 创建日期:2019年08月04日
* 描 述:
*
================================================================*/
#include <bits/stdc++.h>
using namespace std;
int n, ans;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (register int i = 1; i <= n; i++) {
if ((i < 10 and i >= 1) or (i < 1000 and i >= 100) or
(i < 100000 and i >= 10000))
ans++;
}
cout << ans;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,876 | 755,877 | u409210574 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int keta_kount(int x) {
int keta_count = 0;
while (x > 0) {
keta_count++;
x /= 10;
}
return keta_count;
}
int main() {
int N;
cin >> N;
int all_count = 0;
for (int i = 1; i < N; i++) {
if (keta_kount(i) % 2 != 0) {
all_count++;
}
}
cout << all_count << endl;
} | #include <bits/stdc++.h>
using namespace std;
int keta_kount(int x) {
int keta_count = 0;
while (x > 0) {
keta_count++;
x /= 10;
}
return keta_count;
}
int main() {
int N;
cin >> N;
int all_count = 0;
for (int i = 1; i <= N; i++) {
if (keta_kount(i) % 2 != 0) {
all_count++;
}
}
cout << all_count << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,880 | 755,881 | u495881622 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7; // 10^9+7
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (!((11 <= i && i <= 99) || (1111 <= i && i <= 9999) ||
(111111 <= i && i <= 999999))) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7; // 10^9+7
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (!((10 <= i && i <= 99) || (1000 <= i && i <= 9999) ||
(100000 <= i && i <= 999999))) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 755,882 | 755,883 | u792423109 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7; // 10^9+7
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (!((11 <= i && i <= 99) && (1111 <= i && i <= 9999) &&
(111111 <= i && i <= 999999))) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7; // 10^9+7
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i <= n; i++) {
if (!((10 <= i && i <= 99) || (1000 <= i && i <= 9999) ||
(100000 <= i && i <= 999999))) {
ans++;
}
}
cout << ans << endl;
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change",
"misc.opposites"
] | 755,884 | 755,883 | u792423109 | cpp |
p02952 | #include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
if (ans < 10) {
cout << n << endl;
} else if (ans < 100) {
cout << 9 << endl;
} else if (ans < 1000) {
cout << (9 + ans - 99) << endl;
} else if (ans < 10000) {
cout << (10 - 1 + 1000 - 100) << endl;
} else if (ans < 100000) {
cout << (10 - 1 + 1000 - 100 + ans - 10000 + 1) << endl;
} else {
cout << (10 - 1 + 1000 - 100 + 100000 - 10000) << endl;
}
} | #include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = n;
if (ans < 10) {
cout << n << endl;
} else if (ans < 100) {
cout << 9 << endl;
} else if (ans < 1000) {
cout << (9 + ans - 99) << endl;
} else if (ans < 10000) {
cout << (10 - 1 + 1000 - 100) << endl;
} else if (ans < 100000) {
cout << (10 - 1 + 1000 - 100 + ans - 10000 + 1) << endl;
} else {
cout << (10 - 1 + 1000 - 100 + 100000 - 10000) << endl;
}
} | [
"variable_declaration.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 755,885 | 755,886 | u023751250 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int n, a = 1, b = 10, ans;
int main() {
scanf("%d", &n);
while (a < n) {
for (int i = a; i <= min(b - 1, n); i++)
ans++;
a *= 100;
b *= 100;
}
printf("%d", ans);
} | #include <bits/stdc++.h>
using namespace std;
int n, a = 1, b = 10, ans;
int main() {
scanf("%d", &n);
while (a <= n) {
for (int i = a; i <= min(b - 1, n); i++)
ans++;
a *= 100;
b *= 100;
}
printf("%d", ans);
} | [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 755,898 | 755,899 | u918731412 | cpp |
p02952 | #include <bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;
int countDigit(long long n) { return floor(log10(n) + 1); }
int main() {
ll n, count = 0;
cin >> n;
for (ll i = 0; i < n; i++) {
if (countDigit(i) % 2 == 1)
++count;
}
cout << count;
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;
int countDigit(long long n) { return floor(log10(n) + 1); }
int main() {
ll n, count = 0;
cin >> n;
for (ll i = 0; i <= n; i++) {
if (countDigit(i) % 2 == 1)
++count;
}
cout << count;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,906 | 755,907 | u853929315 | cpp |
p02952 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;
int main() {
int n;
int cnt = 0;
for (int i = 1; i <= n; ++i) {
int d = 0;
int t = i;
while (t) {
++d;
t /= 10;
}
if (d & 1)
++cnt;
}
cout << cnt << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;
int main() {
int n;
cin >> n;
int cnt = 0;
for (int i = 1; i <= n; ++i) {
int d = 0;
int t = i;
while (t) {
++d;
t /= 10;
}
if (d & 1)
++cnt;
}
cout << cnt << endl;
return 0;
} | [] | 755,908 | 755,909 | u577747009 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int count = 0;
for (int i = 1; i < N; i++) {
string s = to_string(i);
if (s.length() % 2 != 0)
count += 1;
}
cout << count << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int count = 0;
for (int i = 1; i <= N; i++) {
string s = to_string(i);
if (s.length() % 2 != 0)
count += 1;
}
cout << count << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 755,920 | 755,921 | u165405062 | cpp |
p02952 | #include <bits/stdc++.h> //Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define pii pair<int, int>
#define prec(n) fixed << setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
return out << "(" << a.first << "," << a.second << ")";
}
template <class A> ostream &operator<<(ostream &out, const vector<A> &a) {
out << "";
for (auto it = a.begin(); it != a.end(); it++) {
if (it != a.begin())
out << " ";
out << *it;
}
out << "";
return out;
}
template <class A, class B> istream &operator>>(istream &in, pair<A, B> &a) {
in >> a.first >> a.second;
return in;
}
template <class A> istream &operator>>(istream &in, vector<A> &a) {
for (A &i : a)
in >> i;
return in;
}
// ifstream cinn("input.txt");ofstream coutt("output.txt");
int f(int n) {
int ans = 0;
while (n) {
n = n / 10;
ans++;
}
if (ans & 1)
return ans;
return 0;
}
signed main() {
FASTER;
int n, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
ans += f(i);
}
cout << ans;
}
| #include <bits/stdc++.h> //Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define pii pair<int, int>
#define prec(n) fixed << setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
return out << "(" << a.first << "," << a.second << ")";
}
template <class A> ostream &operator<<(ostream &out, const vector<A> &a) {
out << "";
for (auto it = a.begin(); it != a.end(); it++) {
if (it != a.begin())
out << " ";
out << *it;
}
out << "";
return out;
}
template <class A, class B> istream &operator>>(istream &in, pair<A, B> &a) {
in >> a.first >> a.second;
return in;
}
template <class A> istream &operator>>(istream &in, vector<A> &a) {
for (A &i : a)
in >> i;
return in;
}
// ifstream cinn("input.txt");ofstream coutt("output.txt");
int f(int n) {
int ans = 0;
while (n) {
n = n / 10;
ans++;
}
if (ans % 2 == 1)
return 1;
return 0;
}
signed main() {
FASTER;
int n, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
ans += f(i);
}
cout << ans;
}
| [
"control_flow.branch.if.condition.change",
"identifier.replace.remove",
"literal.replace.add",
"function.return_value.change"
] | 755,926 | 755,927 | u047858101 | cpp |
p02952 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int n, ans;
int main() {
cin >> n;
rep(i, n) {
int cnt = 0;
int tmp = i;
while (tmp != 0) {
tmp /= 10;
cnt++;
}
if (cnt % 2 == 1)
ans++;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int n, ans;
int main() {
cin >> n;
REP(i, 1, n + 1) {
int cnt = 0;
int tmp = i;
while (tmp != 0) {
tmp /= 10;
cnt++;
}
if (cnt % 2 == 1)
ans++;
}
cout << ans << endl;
return 0;
}
| [
"call.arguments.add"
] | 755,932 | 755,933 | u519950235 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, a, i, s, ans = 0;
cin >> n;
for (i = 1; i <= n; i++) {
s = 0;
a = i;
while (a) {
a /= 10;
s++;
}
if (s % 2 == 0)
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, a, i, s, ans = 0;
cin >> n;
for (i = 1; i <= n; i++) {
s = 0;
a = i;
while (a) {
a /= 10;
s++;
}
if (s % 2)
ans++;
}
cout << ans << endl;
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 755,934 | 755,935 | u088895504 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, a, i, s, ans = 0;
cin >> n;
for (i = 10; i <= n; i++) {
s = 0;
a = i;
while (a) {
a /= 10;
s++;
}
if (s % 2)
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, a, i, s, ans = 0;
cin >> n;
for (i = 1; i <= n; i++) {
s = 0;
a = i;
while (a) {
a /= 10;
s++;
}
if (s % 2)
ans++;
}
cout << ans << endl;
return 0;
} | [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change"
] | 755,936 | 755,935 | u088895504 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, a, i, s, ans = 0;
cin >> n;
for (i = 10; i <= n; i++) {
s = 0;
a = i;
while (a) {
a /= 10;
s++;
}
if (s % 2 == 0)
ans++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, a, i, s, ans = 0;
cin >> n;
for (i = 1; i <= n; i++) {
s = 0;
a = i;
while (a) {
a /= 10;
s++;
}
if (s % 2)
ans++;
}
cout << ans << endl;
return 0;
} | [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 755,937 | 755,935 | u088895504 | cpp |
p02952 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
if (n <= 9)
cout << n << endl;
else if (n <= 99)
cout << "9" << endl;
else if (n <= 999)
cout << n - 99 + 9 << endl;
else if (n <= 9999)
cout << "909" << endl;
else if (n <= 99999)
cout << n - 9999 + 909 << endl;
else
cout << "90909" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 9)
cout << n << endl;
else if (n <= 99)
cout << "9" << endl;
else if (n <= 999)
cout << n - 99 + 9 << endl;
else if (n <= 9999)
cout << "909" << endl;
else if (n <= 99999)
cout << n - 9999 + 909 << endl;
else
cout << "90909" << endl;
return 0;
}
| [] | 755,938 | 755,939 | u432702669 | cpp |
p02953 | #define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T> using numr = std::numeric_limits<T>;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
const int INF = 1e9;
const ll LLINF = 1e16;
const int mod = 1000000007;
const int mod2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) {
std::cerr << " " << head;
debug_impl(tail...);
}
#if DEBUG
#define debug(...) \
do { \
std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:"; \
debug_impl(__VA_ARGS__); \
std::cerr << std::noboolalpha; \
} while (false)
#else
#define debug(...) \
{}
#endif
template <typename Container, typename Value = typename Container::value_type,
std::enable_if_t<!std::is_same<Container, std::string>::value,
std::nullptr_t> = nullptr>
std::istream &operator>>(std::istream &is, Container &v) {
for (auto &x : v) {
is >> x;
}
return is;
}
template <typename Container, typename Value = typename Container::value_type,
std::enable_if_t<!std::is_same<Container, std::string>::value,
std::nullptr_t> = nullptr>
std::ostream &operator<<(std::ostream &os, Container const &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); it++) {
os << (it != v.begin() ? "," : "") << *it;
}
return os << "}";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> h(n);
cin >> h;
bool ok = true;
int now = h[n - 1];
for (int i = n - 1; i > 0; i--) {
if (now >= h[i - 1] - 1) {
now = max(now, h[i - 1] - 1);
} else {
ok = false;
}
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T> using numr = std::numeric_limits<T>;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
const int INF = 1e9;
const ll LLINF = 1e16;
const int mod = 1000000007;
const int mod2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) {
std::cerr << " " << head;
debug_impl(tail...);
}
#if DEBUG
#define debug(...) \
do { \
std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:"; \
debug_impl(__VA_ARGS__); \
std::cerr << std::noboolalpha; \
} while (false)
#else
#define debug(...) \
{}
#endif
template <typename Container, typename Value = typename Container::value_type,
std::enable_if_t<!std::is_same<Container, std::string>::value,
std::nullptr_t> = nullptr>
std::istream &operator>>(std::istream &is, Container &v) {
for (auto &x : v) {
is >> x;
}
return is;
}
template <typename Container, typename Value = typename Container::value_type,
std::enable_if_t<!std::is_same<Container, std::string>::value,
std::nullptr_t> = nullptr>
std::ostream &operator<<(std::ostream &os, Container const &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); it++) {
os << (it != v.begin() ? "," : "") << *it;
}
return os << "}";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> h(n);
cin >> h;
bool ok = true;
int now = h[n - 1];
for (int i = n - 1; i > 0; i--) {
if (now >= h[i - 1] - 1) {
now = min(now, h[i - 1]);
} else {
ok = false;
}
}
if (ok)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | [
"misc.opposites",
"assignment.value.change",
"identifier.change",
"call.function.change",
"expression.operation.binary.remove"
] | 755,941 | 755,942 | u807585808 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++) // 0から
typedef long long ll;
ll binary_search(vector<ll> a, ll n, ll key) {
ll right = n, left = -1;
ll md = (right + left) / 2;
while (right - left > 1) {
if (a[md] <= key) {
right = md;
} else {
left = md;
}
md = (right + left) / 2;
}
if (left == -1)
return -1; //無い場合
return right;
}
vector<ll> prime;
void Prime(ll n) { //線形篩,素数列挙
vector<ll> p(n, 0);
p[0] = 1;
p[1] = 1;
for (ll i = 2; i < n; i++) {
if (p[i] == 0) {
prime.push_back(i);
p[i] = i;
}
ll k = prime.size();
for (ll j = 0; j < k && i * prime[j] < n && prime[j] <= p[i]; j++) {
p[i * prime[j]] = prime[j];
}
}
}
ll gcd(ll a, ll b) {
if (a < b) {
swap(a, b);
}
// a>=b
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
#define MOD ((ll)1e+9 + 7)
// cout<<fixed<<setprecision(10);
int main() {
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) { cin >> h[i]; }
ll tmp = h[0];
bool s = true;
rep(i, n - 1) {
if (h[i] > h[i + 1])
h[i + 1]++;
if (h[i] <= h[i + 1]) {
s = false;
}
}
if (s) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++) // 0から
typedef long long ll;
ll binary_search(vector<ll> a, ll n, ll key) {
ll right = n, left = -1;
ll md = (right + left) / 2;
while (right - left > 1) {
if (a[md] <= key) {
right = md;
} else {
left = md;
}
md = (right + left) / 2;
}
if (left == -1)
return -1; //無い場合
return right;
}
vector<ll> prime;
void Prime(ll n) { //線形篩,素数列挙
vector<ll> p(n, 0);
p[0] = 1;
p[1] = 1;
for (ll i = 2; i < n; i++) {
if (p[i] == 0) {
prime.push_back(i);
p[i] = i;
}
ll k = prime.size();
for (ll j = 0; j < k && i * prime[j] < n && prime[j] <= p[i]; j++) {
p[i * prime[j]] = prime[j];
}
}
}
ll gcd(ll a, ll b) {
if (a < b) {
swap(a, b);
}
// a>=b
ll r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
#define MOD ((ll)1e+9 + 7)
// cout<<fixed<<setprecision(10);
int main() {
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) { cin >> h[i]; }
ll tmp = h[0];
bool s = true;
rep(i, n - 1) {
if (h[i] > h[i + 1])
h[i + 1]++;
if (h[i] > h[i + 1]) {
s = false;
}
}
if (s) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 755,943 | 755,944 | u000113982 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
int main() {
int N;
cin >> N;
vi H(N);
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = N - 2; 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;
} | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
int main() {
int N;
cin >> N;
vi H(N);
for (int i = 0; i < N; i++)
cin >> H[i];
for (int i = N - 2; i >= 0; i--) {
if (H[i] - 1 == H[i + 1])
H[i]--;
else if (H[i] - 1 > H[i + 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 755,947 | 755,948 | u495692658 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> h(n);
for (long i = 0; i < n; i++)
cin >> h[i];
if (n == 1) {
cout << "No" << endl;
return 0;
}
for (long i = (n - 1); i > 0; i--) {
if (h[i - 1] > (h[i] + 1)) {
cout << "No" << endl;
return 0;
} else if (h[i - 1] > h[i]) {
h[i - 1]--;
}
}
cout << "Yes" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long n;
cin >> n;
vector<long> h(n);
for (long i = 0; i < n; i++)
cin >> h[i];
if (n == 1) {
cout << "Yes" << endl;
return 0;
}
for (long i = (n - 1); i > 0; i--) {
if (h[i - 1] > (h[i] + 1)) {
cout << "No" << endl;
return 0;
} else if (h[i - 1] > h[i]) {
h[i - 1]--;
}
}
cout << "Yes" << endl;
return 0;
} | [
"literal.string.change",
"io.output.change"
] | 755,953 | 755,954 | u708721324 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define int long long
#define inf ((ll)1e18)
#define mod 1000000007
#define double long double
#define ull unsigned long long
#define vi vector<ll>
#define ppi pair<int, int>
#define pii pair<pair<int, int>, int>
#define pb push_back
#define pi 2 * acos(0.0)
#define rev greater<int>()
#define pr(a, x, y) \
for (int i = x; i < y; i++) { \
cout << a[i] << " "; \
}
#define ps(s) \
for (auto i : s) { \
cout << i << " "; \
}
#define sp(x, y) fixed << setprecision(y) << x
#define w(x) \
ll x; \
cin >> x; \
while (x--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define test cout << "This is test" << endl;
#define str string
#define endl '\n'
#define e cout << '\n';
void kehsihba() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/*#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif*/
}
void solve() {
ll n;
cin >> n;
ll arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = n - 1; i > 0; i--) {
if (arr[i - 1] > arr[i]) {
arr[i - 1] -= 1;
}
if (arr[i - 1] > arr[i]) {
cout << "NO";
return;
}
}
cout << "YES";
}
int32_t main() {
kehsihba();
// init();
ll t = 1;
// cin>>t;
for (int k = 1; k <= t; k++) {
// cout<<"Case "<<k<<": ";
solve();
// e;
}
} | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define int long long
#define inf ((ll)1e18)
#define mod 1000000007
#define double long double
#define ull unsigned long long
#define vi vector<ll>
#define ppi pair<int, int>
#define pii pair<pair<int, int>, int>
#define pb push_back
#define pi 2 * acos(0.0)
#define rev greater<int>()
#define pr(a, x, y) \
for (int i = x; i < y; i++) { \
cout << a[i] << " "; \
}
#define ps(s) \
for (auto i : s) { \
cout << i << " "; \
}
#define sp(x, y) fixed << setprecision(y) << x
#define w(x) \
ll x; \
cin >> x; \
while (x--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define test cout << "This is test" << endl;
#define str string
#define endl '\n'
#define e cout << '\n';
void kehsihba() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/*#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif*/
}
void solve() {
ll n;
cin >> n;
ll arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = n - 1; i >= 1; i--) {
if (arr[i - 1] > arr[i]) {
arr[i - 1] -= 1;
}
if (arr[i - 1] > arr[i]) {
cout << "No";
return;
}
}
cout << "Yes";
}
int32_t main() {
kehsihba();
// init();
ll t = 1;
// cin>>t;
for (int k = 1; k <= t; k++) {
// cout<<"Case "<<k<<": ";
solve();
// e;
}
} | [
"control_flow.loop.for.condition.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 755,957 | 755,958 | u277394423 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using ll = long long;
int main() {
int n;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
int m = h[0];
bool f = true;
for (int i = 1; i < n; i++) {
int m = max(m, h[i]);
if (m - h[i] > 1)
f = false;
}
cout << (f ? "Yes" : "No") << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using ll = long long;
int main() {
int n;
cin >> n;
int h[n];
rep(i, n) cin >> h[i];
int m = h[0];
bool f = true;
for (int i = 1; i < n; i++) {
m = max(m, h[i]);
if (m - h[i] > 1)
f = false;
}
cout << (f ? "Yes" : "No") << endl;
return 0;
}
| [] | 755,965 | 755,966 | u970690920 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using Graph = vector<vector<int>>;
using GraphC = vector<vector<char>>;
const int INF = 1000000000;
typedef pair<int, int> P;
const int MAX_N = 200000;
const int MAX_L = 100000000;
const int MAX_SQRT_B = 10000;
typedef int64_t ll;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int N;
int main() {
cin >> N;
vector<int> a(N);
rep(i, N) { cin >> a.at(i); }
rep(i, N) {
if (i == 0 || a.at(i) > a.at(i - 1))
a.at(i)--;
}
rep(i, N - 1) {
if (a.at(i) > a.at(i + 1)) {
cout << "No" << endl;
return 0;
}
cout << "Yes" << endl;
return 0;
}
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using Graph = vector<vector<int>>;
using GraphC = vector<vector<char>>;
const int INF = 1000000000;
typedef pair<int, int> P;
const int MAX_N = 200000;
const int MAX_L = 100000000;
const int MAX_SQRT_B = 10000;
typedef int64_t ll;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int N;
int main() {
cin >> N;
vector<int> a(N);
rep(i, N) { cin >> a.at(i); }
rep(i, N) {
if (i == 0 || a.at(i) > a.at(i - 1))
a.at(i)--;
}
rep(i, N - 1) {
if (a.at(i) > a.at(i + 1)) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | [] | 755,971 | 755,972 | u992723601 | cpp |
p02953 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) \
cout << fixed << setprecision(i) // coutの浮動小数出力の桁数設定
using namespace std;
const int64 mod = 998244353;
int64 mpow(int64 mm, int64 xx) {
if (xx == 0) {
return 1;
}
int64 tmp = mpow(mm, xx / 2);
tmp *= tmp;
tmp %= mod;
if (xx % 2 == 1) {
tmp *= mm;
tmp %= mod;
}
return tmp;
}
int main() {
int64 nn;
cin >> nn;
vector<int64> hh(nn);
for (int64 ii = 0; ii < nn; ii++) {
cin >> hh[ii];
}
for (int64 ii = nn - 2; ii >= 0; ii--) {
if (hh[ii] > hh[ii + 1]) {
if (hh[ii] - hh[ii - 1] == 1) {
hh[ii]--;
} else {
puts("No");
return 0;
}
}
}
puts("Yes");
return 0;
} | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) \
cout << fixed << setprecision(i) // coutの浮動小数出力の桁数設定
using namespace std;
const int64 mod = 998244353;
int64 mpow(int64 mm, int64 xx) {
if (xx == 0) {
return 1;
}
int64 tmp = mpow(mm, xx / 2);
tmp *= tmp;
tmp %= mod;
if (xx % 2 == 1) {
tmp *= mm;
tmp %= mod;
}
return tmp;
}
int main() {
int64 nn;
cin >> nn;
vector<int64> hh(nn);
for (int64 ii = 0; ii < nn; ii++) {
cin >> hh[ii];
}
for (int64 ii = nn - 2; ii >= 0; ii--) {
if (hh[ii] > hh[ii + 1]) {
if (hh[ii] - hh[ii + 1] == 1) {
hh[ii]--;
} else {
puts("No");
return 0;
}
}
}
puts("Yes");
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 755,985 | 755,986 | u834987206 | cpp |
p02953 | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> vec(N);
vector<int> f(N, 0);
for (int i = 0; i < N; ++i)
cin >> vec[i];
for (int i = N - 1; i > 0; --i) {
if (vec[i - 1] <= vec[i])
continue;
if (f[i] == 1)
continue;
--vec[i - 1];
++f[i - 1];
if (vec[i - 1] > vec[i]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| #include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(void) {
int N;
cin >> N;
vector<int> vec(N);
vector<int> f(N, 0);
for (int i = 0; i < N; ++i)
cin >> vec[i];
for (int i = N - 1; i > 0; --i) {
if (vec[i - 1] <= vec[i])
continue;
if (f[i - 1] == 1)
continue;
--vec[i - 1];
++f[i - 1];
if (vec[i - 1] > vec[i]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 755,993 | 755,994 | u110044127 | cpp |
p02953 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<int> h(n);
string ans = "Yes";
rep(i, n) { cin >> h[i]; }
int t = -1;
rep(i, n - 1) {
int d = h[i] - h[i + 1];
if (d <= 1) {
if (h[i] - 1 > t)
h[i]--;
}
if (h[i] > h[i + 1]) {
ans = "No";
break;
}
t = max(t, h[i]);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<int> h(n);
string ans = "Yes";
rep(i, n) { cin >> h[i]; }
int t = -1;
rep(i, n - 1) {
int d = h[i] - h[i + 1];
if (d <= 1) {
if (h[i] > t)
h[i]--;
}
if (h[i] > h[i + 1]) {
ans = "No";
break;
}
t = max(t, h[i]);
}
cout << ans << endl;
return 0;
} | [
"expression.operation.binary.remove"
] | 755,995 | 755,996 | u487530783 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;
int main() {
ll n, h;
cin >> n;
ll ma = 0;
for (ll i = 0; i < n - 1; i++) {
cin >> h;
ma = max(ma, h);
if (ma - 1 > h) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;
int main() {
ll n, h;
cin >> n;
ll ma = 0;
for (ll i = 0; i < n; i++) {
cin >> h;
ma = max(ma, h);
if (ma - 1 > h) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 755,999 | 756,000 | u827741718 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
h[0]--;
rep(i, n - 1) {
if (h[i + 1] < h[i]) {
cno;
break;
}
if (h[i + 1] > h[i])
h[i + 1]--;
}
cyes;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
h[0]--;
rep(i, n - 1) {
if (h[i + 1] < h[i]) {
cno;
return 0;
}
if (h[i + 1] > h[i])
h[i + 1]--;
}
cyes;
return 0;
} | [
"control_flow.break.remove",
"control_flow.return.add",
"function.return_value.change"
] | 756,005 | 756,006 | u033937898 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
long long h[n];
string ans = "Yes";
for (int i = 0; i < n; i++)
cin >> h[i];
for (int i = n - 2; i > 0; i--) {
if (h[i] < h[i + 1])
h[i]--;
if (h[i] < h[i + 1]) {
ans = "No";
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
long long h[n];
string ans = "Yes";
for (int i = 0; i < n; i++)
cin >> h[i];
for (int i = n - 2; i > 0; i--) {
if (h[i] > h[i + 1])
h[i]--;
if (h[i] > h[i + 1]) {
ans = "No";
}
}
cout << ans << endl;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,013 | 756,014 | u864785784 | cpp |
p02953 | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
int n;
cin >> n;
vector<ll> h(n);
rep(i, n) cin >> h[i];
for (int i = n - 2; i >= 0; i--) {
if (h[i] == h[i + 1])
continue;
else if (h[i] <= h[i + 1] - 1)
h[i]--;
else {
cout << "No";
return 0;
}
}
cout << "Yes";
} | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
int n;
cin >> n;
vector<ll> h(n);
rep(i, n) cin >> h[i];
for (int i = n - 2; i >= 0; i--) {
if (h[i] <= h[i + 1])
continue;
else if (h[i] - 1 == h[i + 1])
h[i]--;
else {
cout << "No";
return 0;
}
}
cout << "Yes";
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 756,021 | 756,022 | u151236434 | cpp |
p02953 | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
int n;
cin >> n;
vector<ll> h(n);
rep(i, n) cin >> h[i];
for (int i = n - 2; i >= 0; i--) {
if (h[i] == h[i + 1])
continue;
else if (h[i] == h[i + 1] - 1)
h[i]--;
else {
cout << "No";
return 0;
}
}
cout << "Yes";
} | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
int n;
cin >> n;
vector<ll> h(n);
rep(i, n) cin >> h[i];
for (int i = n - 2; i >= 0; i--) {
if (h[i] <= h[i + 1])
continue;
else if (h[i] - 1 == h[i + 1])
h[i]--;
else {
cout << "No";
return 0;
}
}
cout << "Yes";
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"expression.operation.binary.remove"
] | 756,024 | 756,022 | u151236434 | cpp |
p02953 |
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T &a) {
return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) { return a < b ? a : b; }
template <class _T> static _T tp_max(_T a, _T b) { return a > b ? a : b; }
template <class _T> static void get1int(_T &a) {
const char *fmt = " %d";
if (sizeof(_T) == sizeof(long long)) {
fmt = " %lld";
}
if (scanf(fmt, &a) < 0) {
printf("g1int Error\n");
}
}
template <class _T> static void get2int(_T &a, _T &b) {
const char *fmt = " %d %d";
if (sizeof(_T) == sizeof(long long)) {
fmt = " %lld %lld";
}
if (scanf(fmt, &a, &b) < 0) {
printf("g2int Error\n");
}
}
template <class _T> static void get3int(_T &a, _T &b, _T &c) {
const char *fmt = " %d %d %d";
if (sizeof(_T) == sizeof(long long)) {
fmt = " %lld %lld %lld";
}
if (scanf(fmt, &a, &b, &c) < 0) {
printf("g3int Error\n");
}
}
template <class _T> static _T tp_pow(int base, int exp) {
_T ans = 1;
for (int i = 0; i < exp; i++) {
ans *= base;
}
return ans;
}
static void C_task();
int main() {
C_task();
fflush(stdout);
return 0;
}
static void C_task() {
int N;
get1int(N);
int bfrMax = 0;
int bfr = 0;
int now = 0;
const char *ans = "Yes\n";
for (int i = 0; i < N; i++) {
get1int(now);
if (bfr > now) {
bfr--;
} else {
now = tp_max(now - 1, bfr);
}
bfrMax = tp_max(bfrMax, bfr);
if ((bfr > now) || (bfrMax > now)) {
ans = "No\n";
break;
}
bfr = now;
}
printf(ans);
}
|
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T &a) {
return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) { return a < b ? a : b; }
template <class _T> static _T tp_max(_T a, _T b) { return a > b ? a : b; }
template <class _T> static void get1int(_T &a) {
const char *fmt = " %d";
if (sizeof(_T) == sizeof(long long)) {
fmt = " %lld";
}
if (scanf(fmt, &a) < 0) {
printf("g1int Error\n");
}
}
template <class _T> static void get2int(_T &a, _T &b) {
const char *fmt = " %d %d";
if (sizeof(_T) == sizeof(long long)) {
fmt = " %lld %lld";
}
if (scanf(fmt, &a, &b) < 0) {
printf("g2int Error\n");
}
}
template <class _T> static void get3int(_T &a, _T &b, _T &c) {
const char *fmt = " %d %d %d";
if (sizeof(_T) == sizeof(long long)) {
fmt = " %lld %lld %lld";
}
if (scanf(fmt, &a, &b, &c) < 0) {
printf("g3int Error\n");
}
}
template <class _T> static _T tp_pow(int base, int exp) {
_T ans = 1;
for (int i = 0; i < exp; i++) {
ans *= base;
}
return ans;
}
static void C_task();
int main() {
C_task();
fflush(stdout);
return 0;
}
static void C_task() {
int N;
get1int(N);
int bfrMax = 0;
int bfr = 0;
int now = 0;
const char *ans = "Yes\n";
for (int i = 0; i < N; i++) {
get1int(now);
if (bfr > now) {
bfr--;
} else {
now = tp_max(now - 1, bfr);
}
bfrMax = tp_max(bfrMax, now);
if ((bfr > now) || (bfrMax > now)) {
ans = "No\n";
break;
}
bfr = now;
}
printf(ans);
}
| [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 756,031 | 756,032 | u887675488 | cpp |
p02953 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
bool ans = true;
for (int i = 1; i <= n; i++) {
if (h[i] > h[i - 1])
h[i]--;
if (h[i] < h[i - 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
bool ans = true;
for (int i = 1; i < n; i++) {
if (h[i] > h[i - 1])
h[i]--;
if (h[i] < h[i - 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 756,037 | 756,038 | u009414205 | cpp |
p02953 | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n; i >= 0; i--)
#define REP(i, s, t) for (int i = s; i <= t; i++)
#define RREP(i, s, t) for (int i = s; i >= t; i--)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
int H[100010];
rep(i, N) cin >> H[i];
rep(i, N) {
int j = i;
while (j + 1 < N && H[i] > H[j + 1])
j++;
// cout << i << " " << j << endl;
if (H[i] - H[j] > 1) {
cout << "No" << endl;
return 0;
}
i = j;
}
cout << "Yes" << endl;
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n; i >= 0; i--)
#define REP(i, s, t) for (int i = s; i <= t; i++)
#define RREP(i, s, t) for (int i = s; i >= t; i--)
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
int H[100010];
rep(i, N) cin >> H[i];
rep(i, N) {
int j = i;
while (j + 1 < N && H[j] >= H[j + 1])
j++;
// cout << i << " " << j << endl;
if (H[i] - H[j] > 1) {
cout << "No" << endl;
return 0;
}
i = j;
}
cout << "Yes" << endl;
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.loop.condition.change",
"expression.operator.compare.change"
] | 756,047 | 756,048 | u965730380 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
}
if (n == 1) {
cout << "Yes" << endl;
return 0;
}
int max = 0;
for (int i = 0; i < n; i++) {
if (max - 1 > a[i]) {
cout << "NO" << endl;
return 0;
}
if (max < a[i]) {
max = a[i];
}
}
cout << "Yes" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a.at(i);
}
if (n == 1) {
cout << "Yes" << endl;
return 0;
}
int max = 0;
for (int i = 0; i < n; i++) {
if (max - 1 > a[i]) {
cout << "No" << endl;
return 0;
}
if (max < a[i]) {
max = a[i];
}
}
cout << "Yes" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,052 | 756,053 | u018890850 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
int main() {
int n;
cin >> n;
ll h[n];
rep(i, n) cin >> h[i];
bool ans = true;
for (int j = 1; j < n; j++) {
if (h[j - 1] + 1 == h[j]) {
h[j]--;
}
if (h[j - 1] > h[j]) {
ans = false;
break;
}
}
if (ans)
cout << "Yes" << endl;
else
cout << "No" << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
int main() {
int n;
cin >> n;
ll h[n];
rep(i, n) cin >> h[i];
bool ans = true;
for (int j = 1; j < n; j++) {
if (h[j - 1] < h[j]) {
h[j]--;
}
if (h[j - 1] > h[j]) {
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,054 | 756,055 | u096030913 | cpp |
p02953 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f(a, b) for (int i = a; i < b; i++)
#define mod 1000000007
#define inf (1LL << 60)
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<ll, pair<ll, ll>>
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
const int MAXN = 500005;
using namespace std;
int arr[MAXN], dp[MAXN];
int main() {
/* ifstream cin("input.txt");
ofstream cout("output.txt");*/
fast_io;
bool flag = true;
std::vector<ll> suffix;
ll n, mini = INT_MAX;
cin >> n;
ll arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = n - 1; i >= 0; i--) {
mini = min(mini, arr[i]);
suffix.pb(mini);
}
reverse(suffix.begin(), suffix.end());
for (int i = 0; i < n - 1; i++) {
if (arr[i] > suffix[i + 1] && abs(arr[i] - suffix[i + 1]) >= 2) {
flag = false;
break;
}
}
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f(a, b) for (int i = a; i < b; i++)
#define mod 1000000007
#define inf (1LL << 60)
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<ll, pair<ll, ll>>
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
const int MAXN = 500005;
using namespace std;
int arr[MAXN], dp[MAXN];
int main() {
/*ifstream cin("input.txt");
ofstream cout("output.txt");*/
fast_io;
bool flag = true;
std::vector<ll> suffix;
ll n, mini = INT_MAX;
cin >> n;
ll arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = n - 1; i >= 0; i--) {
mini = min(mini, arr[i]);
suffix.pb(mini);
}
reverse(suffix.begin(), suffix.end());
for (int i = 0; i < n - 1; i++) {
if (arr[i] > suffix[i + 1] && abs(arr[i] - suffix[i + 1]) >= 2) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,061 | 756,062 | u327245973 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
int main() {
int N;
string ans = "Yes";
cin >> N;
vint H(N);
rep(i, N) { cin >> H[i]; }
for (int i = N - 2; 0 <= i; i++) {
if (H[i] > H[i + 1]) {
if (H[i] == H[i + 1] + 1) {
H[i]--;
} else
ans = "No";
}
}
rep(i, N - 1) {
if (H[i] > H[i + 1]) {
ans = "No";
}
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
int main() {
int N;
string ans = "Yes";
cin >> N;
vint H(N);
rep(i, N) { cin >> H[i]; }
for (int i = N - 2; 0 <= i; i--) {
if (H[i] > H[i + 1]) {
if (H[i] == H[i + 1] + 1) {
H[i]--;
} else
ans = "No";
}
}
rep(i, N - 1) {
if (H[i] > H[i + 1]) {
ans = "No";
}
}
cout << ans;
return 0;
} | [] | 756,069 | 756,070 | u987913144 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
int main() {
int N;
string ans = "Yes";
cin >> N;
vint H(N);
rep(i, N) { cin >> H[i]; }
for (int i = N - 1; 0 <= i; i++) {
if (H[i] > H[i + 1]) {
if (H[i] == H[i + 1] + 1) {
H[i]--;
} else
ans = "No";
}
}
rep(i, N - 1) {
if (H[i] > H[i + 1]) {
ans = "No";
}
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
int main() {
int N;
string ans = "Yes";
cin >> N;
vint H(N);
rep(i, N) { cin >> H[i]; }
for (int i = N - 2; 0 <= i; i--) {
if (H[i] > H[i + 1]) {
if (H[i] == H[i + 1] + 1) {
H[i]--;
} else
ans = "No";
}
}
rep(i, N - 1) {
if (H[i] > H[i + 1]) {
ans = "No";
}
}
cout << ans;
return 0;
} | [
"literal.number.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 756,071 | 756,070 | u987913144 | cpp |
p02953 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;
class UnionFind {
public:
UnionFind(int N) : par(N) {
for (ll i = 0; i < N; i++) {
par[i] = i;
}
}
int root(int x) {
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) {
int rx = root(x);
int ry = root(y);
if (rx == ry)
return;
par[rx] = ry;
}
bool same(int x, int y) {
int rx = root(x);
int ry = root(y);
return rx == ry;
}
private:
vector<int> par;
};
ll gcd(ll a, ll b) {
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
ll fact(ll n) {
if (n <= 0) {
return 1;
}
if (n == 1) {
return 1;
}
return n * fact(n - 1) % MOD;
}
ll pow_fast(ll n, ll k) {
if (k == 0) {
return 1;
}
if (k == 1) {
return n;
}
if (k % 2 == 0) {
ll tmp = pow_fast(n, k / 2LL);
return tmp * tmp % MOD;
} else {
ll tmp = pow_fast(n, k / 2LL);
tmp *= tmp;
tmp %= MOD;
return tmp * n % MOD;
}
}
map<ll, ll> sosuu(ll n) {
map<ll, ll> res;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
res[i] += 1;
n /= i;
}
}
if (n != 1) {
res[n] += 1;
}
return res;
}
struct Dish {
ll time;
ll taste;
};
static ll FACTORIAL[10000010] = {};
ll nCk(ll n, ll k) {
if (FACTORIAL[1] == 0) {
FACTORIAL[0] = 1;
FACTORIAL[1] = 1;
for (ll i = 2; i <= 10000000; i++) {
FACTORIAL[i] = FACTORIAL[i - 1] * i;
FACTORIAL[i] %= MOD;
}
}
ll N_fact = FACTORIAL[n];
ll K_fact = pow_fast(FACTORIAL[k], MOD - 2);
ll N_K_fact = pow_fast(FACTORIAL[n - k], MOD - 2);
ll ret = N_fact;
ret %= MOD;
ret *= K_fact;
ret %= MOD;
ret *= N_K_fact;
ret %= MOD;
return ret;
}
void solve(string s, ll K) {
ll sum = 0;
for (ll i = s.size(); i <= s.size() + K; i++) {
// 25
ll cnt = pow_fast(25, i - s.size()) % MOD;
cnt *= nCk(i - 1, s.size() - 1);
cnt %= MOD;
// 26
cnt *= pow_fast(26, s.size() + K - i);
cnt %= MOD;
sum += cnt;
sum %= MOD;
}
cout << sum << endl;
return;
}
vector<string> explode(string s, char delim) {
vector<string> ret;
string cur;
for (ll i = 0; i < s.size(); i++) {
if (s[i] == delim) {
ret.push_back(cur);
cur.clear();
continue;
}
cur += s[i];
}
if (cur.size() != 0) {
ret.push_back(cur);
}
return ret;
}
template <typename T> void DEBUG(T var) {
static size_t cnt = 1;
cout << "[DEBUG] " << cnt << " :";
cout << "(" << typeid(var).name() << ")";
cout << var << endl;
cnt += 1;
}
struct Element {
char c;
bool visited;
ll cost;
};
vector<vector<ll>> comb(ll n) {
vector<vector<ll>> ans(n + 1, vector<ll>(n + 1));
ans[0][0] = 0;
for (ll i = 1; i <= n; i++) {
for (ll j = 0; j <= i; j++) {
if (j == 0 || j == i) {
ans[i][j] = 1;
continue;
}
ans[i][j] = ans[i - 1][j] + ans[i - 1][j - 1];
}
}
return ans;
}
int main() {
ll N;
cin >> N;
bool ok = true;
ll first;
cin >> first;
ll pre = first;
for (ll i = 1; i < N; i++) {
ll k;
cin >> k;
if (k > pre) {
k--;
}
if (k > pre) {
ok = false;
}
pre = k;
}
cout << (ok ? "Yes" : "No") << endl;
}
| #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;
class UnionFind {
public:
UnionFind(int N) : par(N) {
for (ll i = 0; i < N; i++) {
par[i] = i;
}
}
int root(int x) {
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) {
int rx = root(x);
int ry = root(y);
if (rx == ry)
return;
par[rx] = ry;
}
bool same(int x, int y) {
int rx = root(x);
int ry = root(y);
return rx == ry;
}
private:
vector<int> par;
};
ll gcd(ll a, ll b) {
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
ll fact(ll n) {
if (n <= 0) {
return 1;
}
if (n == 1) {
return 1;
}
return n * fact(n - 1) % MOD;
}
ll pow_fast(ll n, ll k) {
if (k == 0) {
return 1;
}
if (k == 1) {
return n;
}
if (k % 2 == 0) {
ll tmp = pow_fast(n, k / 2LL);
return tmp * tmp % MOD;
} else {
ll tmp = pow_fast(n, k / 2LL);
tmp *= tmp;
tmp %= MOD;
return tmp * n % MOD;
}
}
map<ll, ll> sosuu(ll n) {
map<ll, ll> res;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
res[i] += 1;
n /= i;
}
}
if (n != 1) {
res[n] += 1;
}
return res;
}
struct Dish {
ll time;
ll taste;
};
static ll FACTORIAL[10000010] = {};
ll nCk(ll n, ll k) {
if (FACTORIAL[1] == 0) {
FACTORIAL[0] = 1;
FACTORIAL[1] = 1;
for (ll i = 2; i <= 10000000; i++) {
FACTORIAL[i] = FACTORIAL[i - 1] * i;
FACTORIAL[i] %= MOD;
}
}
ll N_fact = FACTORIAL[n];
ll K_fact = pow_fast(FACTORIAL[k], MOD - 2);
ll N_K_fact = pow_fast(FACTORIAL[n - k], MOD - 2);
ll ret = N_fact;
ret %= MOD;
ret *= K_fact;
ret %= MOD;
ret *= N_K_fact;
ret %= MOD;
return ret;
}
void solve(string s, ll K) {
ll sum = 0;
for (ll i = s.size(); i <= s.size() + K; i++) {
// 25
ll cnt = pow_fast(25, i - s.size()) % MOD;
cnt *= nCk(i - 1, s.size() - 1);
cnt %= MOD;
// 26
cnt *= pow_fast(26, s.size() + K - i);
cnt %= MOD;
sum += cnt;
sum %= MOD;
}
cout << sum << endl;
return;
}
vector<string> explode(string s, char delim) {
vector<string> ret;
string cur;
for (ll i = 0; i < s.size(); i++) {
if (s[i] == delim) {
ret.push_back(cur);
cur.clear();
continue;
}
cur += s[i];
}
if (cur.size() != 0) {
ret.push_back(cur);
}
return ret;
}
template <typename T> void DEBUG(T var) {
static size_t cnt = 1;
cout << "[DEBUG] " << cnt << " :";
cout << "(" << typeid(var).name() << ")";
cout << var << endl;
cnt += 1;
}
struct Element {
char c;
bool visited;
ll cost;
};
vector<vector<ll>> comb(ll n) {
vector<vector<ll>> ans(n + 1, vector<ll>(n + 1));
ans[0][0] = 0;
for (ll i = 1; i <= n; i++) {
for (ll j = 0; j <= i; j++) {
if (j == 0 || j == i) {
ans[i][j] = 1;
continue;
}
ans[i][j] = ans[i - 1][j] + ans[i - 1][j - 1];
}
}
return ans;
}
int main() {
ll N;
cin >> N;
bool ok = true;
ll first;
cin >> first;
ll pre = first;
for (ll i = 1; i < N; i++) {
ll k;
cin >> k;
if (k > pre) {
k--;
}
if (k < pre) {
ok = false;
}
pre = k;
}
cout << (ok ? "Yes" : "No") << endl;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,072 | 756,073 | u789199225 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
a[i]--;
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i - 1]) {
a[i - 1]++;
if (a[i] > a[i - 1]) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
a[i]--;
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
a[i + 1]++;
if (a[i] > a[i + 1]) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change"
] | 756,074 | 756,075 | u406647332 | cpp |
p02953 | #ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#endif
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; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << 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 imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>,
// rb_tree_tag,tree_order_statistics_node_update>
template <typename T> void setmax(T &x, T y) { x = max(x, y); }
template <typename T> void setmin(T &x, T y) { x = min(x, y); }
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
void solve() {
int n;
cin >> n;
vector<int> a(n);
forn(i, n) cin >> a[i];
forn(i, n) {
if (!i)
a[i]--;
else {
if (a[i - 1] > a[i])
a[i]--;
if (a[i - 1] > a[i]) {
cout << "No";
return;
}
}
}
cout << "Yes";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
forn(i, t) { solve(); }
}
/*
1
1000000000000000000
*/ | #ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#endif
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; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << 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 imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>,
// rb_tree_tag,tree_order_statistics_node_update>
template <typename T> void setmax(T &x, T y) { x = max(x, y); }
template <typename T> void setmin(T &x, T y) { x = min(x, y); }
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
void solve() {
int n;
cin >> n;
vector<int> a(n);
forn(i, n) cin >> a[i];
forn(i, n) {
if (!i)
a[i]--;
else {
if (a[i - 1] < a[i])
a[i]--;
if (a[i - 1] > a[i]) {
cout << "No";
return;
}
}
}
cout << "Yes";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
forn(i, t) { solve(); }
}
/*
1
1000000000000000000
*/ | [
"misc.opposites",
"expression.operator.compare.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 756,076 | 756,077 | u088863512 | cpp |
p02953 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; // 10^9
const ll inff = 1000000000000000000; // 10^18
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
for (int i = 0; i < n; i++) {
if (i == 0)
h[i]--;
else if (h[i - 1] < h[i])
h[i]--;
else if (h[i - 1] == h[i])
continue;
else if (h[i - 1] > h[i]) {
cout << "NO" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; // 10^9
const ll inff = 1000000000000000000; // 10^18
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) cin >> h[i];
for (int i = 0; i < n; i++) {
if (i == 0)
h[i]--;
else if (h[i - 1] < h[i])
h[i]--;
else if (h[i - 1] == h[i])
continue;
else if (h[i - 1] > h[i]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,084 | 756,085 | u296989351 | cpp |
p02953 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout << (#x) << "=" << (x) << '\n'
#define mset(d, val) memset(d, val, sizeof(d))
#define setp(x) cout << fixed << setprecision(x)
#define forn(i, a, b) for (int i = (a); i < (b); i++)
#define fore(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
pbds;
void amin(ll &a, ll b) { a = min(a, b); }
void amax(ll &a, ll b) { a = max(a, b); }
void YES() { cout << "Yes\n"; }
void NO() { cout << "No\n"; }
void SD(int t = 0) { cout << "PASSED " << t << endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;
bool DEBUG = 0;
const int MAXN = 100005;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
ll a[n];
forn(i, 0, n) cin >> a[i];
a[0]--;
forn(i, 1, n) {
if (a[i] >= a[i - 1] + 1)
a[i]--;
if (a[i] < a[i - 1]) {
cout << "NO\n";
return 0;
}
}
YES();
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout << (#x) << "=" << (x) << '\n'
#define mset(d, val) memset(d, val, sizeof(d))
#define setp(x) cout << fixed << setprecision(x)
#define forn(i, a, b) for (int i = (a); i < (b); i++)
#define fore(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update>
pbds;
void amin(ll &a, ll b) { a = min(a, b); }
void amax(ll &a, ll b) { a = max(a, b); }
void YES() { cout << "Yes\n"; }
void NO() { cout << "No\n"; }
void SD(int t = 0) { cout << "PASSED " << t << endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;
bool DEBUG = 0;
const int MAXN = 100005;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
ll a[n];
forn(i, 0, n) cin >> a[i];
a[0]--;
forn(i, 1, n) {
if (a[i] >= a[i - 1] + 1)
a[i]--;
if (a[i] < a[i - 1]) {
cout << "No\n";
return 0;
}
}
YES();
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,089 | 756,090 | u353919145 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pbb pop_back
#define mp make_pair
#define popcount __builtin_popcountll
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define mem(array, value) memset(array, value, sizeof(array))
#define lcm(a, b) (abs(a) / gcd(a, b)) * abs(b)
#define random(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
#define PI 2 * acos(0.0)
#define EPS 1e-8
#define line cout << "\n==========\n"
#define fastRead \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << "\n";
}
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...);
}
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> orderedSet;
// int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1}; // 4
// Direction int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1}, dy[] = {0, 1, 0, -1, -1,
// 1, -1, 1}; // 8 Direction int dx[] = {-2, -1, 1, 2, 2, -1, 1, -2}, dy[] =
// {1, 2, 2, 1, -1, -2, -2, -1}; // Knight Direction
int Set(int mask, int pos) { return mask | (1 << pos); }
int Reset(int mask, int pos) { return mask & ~(1 << pos); }
bool Check(int mask, int pos) { return (bool)(mask & (1 << pos)); }
inline ll gcd(ll a, ll b) {
a = abs(a), b = abs(b);
while (b)
a = a % b, swap(a, b);
return a;
}
inline ll power(ll a, ll p) {
ll res = 1, x = a;
while (p) {
if (p & 1)
res = (res * x);
x = (x * x), p >>= 1;
}
return res;
}
inline ll mul_mod(ll a, ll p, ll m) {
ll res = 0, x = a % m;
while (p) {
if (p & 1)
res = (res + x) % m;
x = (x << 1) % m, p >>= 1;
}
return res;
}
inline ll big_mod(ll a, ll p, ll m) {
ll res = 1 % m, x = a % m;
while (p) {
if (p & 1)
res = (res * x) % m;
x = (x * x) % m, p >>= 1;
}
return res;
}
ll ext_gcd(ll A, ll B, ll *X, ll *Y) {
ll x2, y2, x1, y1, x, y, r2, r1, q, r;
x2 = 1, y2 = 0;
x1 = 0, y1 = 1;
for (r2 = A, r1 = B; r1 != 0;
r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y) {
q = r2 / r1, r = r2 % r1;
x = x2 - (q * x1), y = y2 - (q * y1);
}
*X = x2;
*Y = y2;
return r2;
}
inline ll mod_inv(ll a, ll m) {
ll x, y;
ext_gcd(a, m, &x, &y);
x %= m;
if (x < 0)
x += m;
return x;
}
const int INF = 1e9 + 9;
int main() {
#ifdef Lollipop
freopen("input.txt", "r", stdin);
// freopen ("output.txt", "w", stdout);
#endif
int n;
cin >> n;
int ara[n];
for (int i = 0; i < n; i++) {
cin >> ara[i];
}
for (int i = n - 1; i > 0; i--) {
if (ara[i] < ara[i - 1]) {
if (ara[i] >= ara[i - 1] - 1) {
ara[i - 1]--;
} else {
// trace(i);
return cout << "NO" << endl, 0;
}
}
}
cout << "YES" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pbb pop_back
#define mp make_pair
#define popcount __builtin_popcountll
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define mem(array, value) memset(array, value, sizeof(array))
#define lcm(a, b) (abs(a) / gcd(a, b)) * abs(b)
#define random(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
#define PI 2 * acos(0.0)
#define EPS 1e-8
#define line cout << "\n==========\n"
#define fastRead \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
cerr << name << " : " << arg1 << "\n";
}
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...);
}
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> orderedSet;
// int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1}; // 4
// Direction int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1}, dy[] = {0, 1, 0, -1, -1,
// 1, -1, 1}; // 8 Direction int dx[] = {-2, -1, 1, 2, 2, -1, 1, -2}, dy[] =
// {1, 2, 2, 1, -1, -2, -2, -1}; // Knight Direction
int Set(int mask, int pos) { return mask | (1 << pos); }
int Reset(int mask, int pos) { return mask & ~(1 << pos); }
bool Check(int mask, int pos) { return (bool)(mask & (1 << pos)); }
inline ll gcd(ll a, ll b) {
a = abs(a), b = abs(b);
while (b)
a = a % b, swap(a, b);
return a;
}
inline ll power(ll a, ll p) {
ll res = 1, x = a;
while (p) {
if (p & 1)
res = (res * x);
x = (x * x), p >>= 1;
}
return res;
}
inline ll mul_mod(ll a, ll p, ll m) {
ll res = 0, x = a % m;
while (p) {
if (p & 1)
res = (res + x) % m;
x = (x << 1) % m, p >>= 1;
}
return res;
}
inline ll big_mod(ll a, ll p, ll m) {
ll res = 1 % m, x = a % m;
while (p) {
if (p & 1)
res = (res * x) % m;
x = (x * x) % m, p >>= 1;
}
return res;
}
ll ext_gcd(ll A, ll B, ll *X, ll *Y) {
ll x2, y2, x1, y1, x, y, r2, r1, q, r;
x2 = 1, y2 = 0;
x1 = 0, y1 = 1;
for (r2 = A, r1 = B; r1 != 0;
r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y) {
q = r2 / r1, r = r2 % r1;
x = x2 - (q * x1), y = y2 - (q * y1);
}
*X = x2;
*Y = y2;
return r2;
}
inline ll mod_inv(ll a, ll m) {
ll x, y;
ext_gcd(a, m, &x, &y);
x %= m;
if (x < 0)
x += m;
return x;
}
const int INF = 1e9 + 9;
int main() {
#ifdef Lollipop
freopen("input.txt", "r", stdin);
// freopen ("output.txt", "w", stdout);
#endif
int n;
cin >> n;
int ara[n];
for (int i = 0; i < n; i++) {
cin >> ara[i];
}
for (int i = n - 1; i > 0; i--) {
if (ara[i] < ara[i - 1]) {
if (ara[i] >= ara[i - 1] - 1) {
ara[i - 1]--;
} else {
// trace(i);
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,091 | 756,092 | u353919145 | cpp |
p02953 | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7
using namespace std;
using ll = long long;
void solve() {
int n, h;
cin >> n;
int post_h = 0;
for (int i = 0; i < n; ++i) {
cin >> h;
if (post_h > h - 1) {
cout << "No";
return;
}
post_h = max(post_h, h - 1);
}
cout << "Yes";
}
int main() {
fastio;
solve();
return 0;
} | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7
using namespace std;
using ll = long long;
void solve() {
int n, h;
cin >> n;
int post_h = 0;
for (int i = 0; i < n; ++i) {
cin >> h;
if (post_h > h) {
cout << "No";
return;
}
post_h = max(post_h, h - 1);
// cout << post_h << " ";
}
cout << "Yes";
}
int main() {
fastio;
solve();
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 756,102 | 756,103 | u866535689 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i--) {
if (vec[i + 1] - vec[i] < 0)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i--) {
if (vec[i + 1] - vec[i] == -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"control_flow.loop.for.condition.change",
"control_flow.branch.if.condition.change"
] | 756,112 | 756,113 | u221285045 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i--) {
if (vec[i + 1] - vec[i] <= -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i--) {
if (vec[i + 1] - vec[i] == -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,114 | 756,113 | u221285045 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i > 0; i++) {
if (vec[i + 1] - vec[i] <= -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i--) {
if (vec[i + 1] - vec[i] == -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"control_flow.branch.if.condition.change"
] | 756,115 | 756,113 | u221285045 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i++) {
if (vec[i + 1] - vec[i] <= -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
// vector<vector<int>> mat(N, vector<int>(M, 0));
int main(int argc, const char *argv[]) {
// ABC136_C
int N;
cin >> N;
vector<int> vec(N, 0);
for (int i = 0; i < N; i++) {
cin >> vec[i];
}
int check = 1;
//右からやるといい
for (int i = N - 1; i >= 0; i--) {
if (vec[i + 1] - vec[i] == -1)
vec[i]--;
}
for (int i = 0; i < N - 1; i++) {
if (vec[i + 1] - vec[i] <= -1)
check = 0;
}
if (check == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,116 | 756,113 | u221285045 | cpp |
p02953 | #include <bits/stdc++.h>
// #undef DEBUG // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T> void debug(T value) { std::cerr << value; }
template <typename T, typename... Ts> void debug(T value, Ts... args) {
std::cerr << value << ", ";
debug(args...);
}
#define dbg(...) \
do { \
cerr << #__VA_ARGS__ << ": "; \
debug(__VA_ARGS__); \
cerr << " (L" << __LINE__ << ")" << endl; \
} while (0)
#else
#define dbg(...)
#endif
void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T &value, Ts &...args) {
std::cin >> value;
read_from_cin(args...);
}
#define in(type, ...) \
type __VA_ARGS__; \
read_from_cin(__VA_ARGS__);
template <typename T> void write_to_cout(const T &value) {
std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T &value, const Ts &...args) {
std::cout << value << ' ';
write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using namespace std;
int main() {
in(int, n);
vector<int> h(n);
rep(i, n) cin >> h[i];
int curr = h[n - 1];
for (int i = n - 2; i >= 0; --i) {
if (h[i] > curr) {
--h[i];
if (h[i] > curr) {
out("No");
return 0;
}
curr = min(curr, h[i]);
}
}
out("Yes");
}
| #include <bits/stdc++.h>
// #undef DEBUG // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T> void debug(T value) { std::cerr << value; }
template <typename T, typename... Ts> void debug(T value, Ts... args) {
std::cerr << value << ", ";
debug(args...);
}
#define dbg(...) \
do { \
cerr << #__VA_ARGS__ << ": "; \
debug(__VA_ARGS__); \
cerr << " (L" << __LINE__ << ")" << endl; \
} while (0)
#else
#define dbg(...)
#endif
void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T &value, Ts &...args) {
std::cin >> value;
read_from_cin(args...);
}
#define in(type, ...) \
type __VA_ARGS__; \
read_from_cin(__VA_ARGS__);
template <typename T> void write_to_cout(const T &value) {
std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T &value, const Ts &...args) {
std::cout << value << ' ';
write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using namespace std;
int main() {
in(int, n);
vector<int> h(n);
rep(i, n) cin >> h[i];
int curr = h[n - 1];
for (int i = n - 2; i >= 0; --i) {
if (h[i] > curr) {
--h[i];
if (h[i] > curr) {
out("No");
return 0;
}
}
curr = min(curr, h[i]);
}
out("Yes");
}
| [] | 756,119 | 756,120 | u505122009 | cpp |
p02953 | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> h(n);
for (auto &&i : h)
cin >> i;
for (int i = n - 1; i >= 0; i--) {
if (h[i] == h[i - 1] - 1) {
h[i - 1]--;
} else if (h[i] < h[i - 1]) {
cout << "No" << endl;
return (0);
}
}
for (int i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
cout << "No" << endl;
return (0);
}
}
cout << "Yes" << endl;
return (0);
} | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> h(n);
for (auto &&i : h)
cin >> i;
for (int i = n - 1; i > 0; i--) {
if (h[i] == h[i - 1] - 1) {
h[i - 1]--;
} else if (h[i] < h[i - 1]) {
cout << "No" << endl;
return (0);
}
}
for (int i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
cout << "No" << endl;
return (0);
}
}
cout << "Yes" << endl;
return (0);
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 756,121 | 756,122 | u490965711 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30
int main() {
int n;
cin >> n;
V<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = n - 1; i >= 0; i--) {
if (a[i] < a[i - 1]) {
a[i - 1]--;
}
}
for (int i = n - 1; i >= 0; i--) {
if (a[i] < a[i - 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30
int main() {
int n;
cin >> n;
V<ll> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = n - 1; i > 0; i--) {
if (a[i] < a[i - 1]) {
a[i - 1]--;
}
}
for (int i = n - 1; i > 0; i--) {
if (a[i] < a[i - 1]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 756,123 | 756,124 | u651235280 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) { cin >> h[i]; }
reverse(h.begin(), h.end());
bool ans = true;
rep(i, n - 1) {
if (h[i + 1] - h[1] >= 2) {
ans = false;
} else if (h[i + 1] - h[i] == 1) {
h[i + 1]--;
}
}
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
cin >> n;
vector<int> h(n);
rep(i, n) { cin >> h[i]; }
reverse(h.begin(), h.end());
bool ans = true;
rep(i, n - 1) {
if (h[i + 1] - h[i] >= 2) {
ans = false;
} else if (h[i + 1] - h[i] == 1) {
h[i + 1]--;
}
}
if (ans) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | [
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 756,136 | 756,137 | u692550512 | 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.at(i);
}
bool judge = true;
for (int i = 0; i < n - 1; i++) {
if (h.at(i) < h.at(i + 1)) {
h.at(i + 1)--;
}
if (h.at(i) == h.at(i + 1)) {
continue;
} else {
judge = false;
break;
}
}
if (judge) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
| #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.at(i);
}
bool judge = true;
for (int i = 0; i < n - 1; i++) {
if (h.at(i) < h.at(i + 1)) {
h.at(i + 1)--;
} else if (h.at(i) == h.at(i + 1)) {
continue;
} else {
judge = false;
break;
}
}
if (judge) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
| [
"control_flow.branch.else_if.replace.add",
"control_flow.branch.if.replace.remove"
] | 756,140 | 756,141 | u191114518 | cpp |
p02953 | //
// AtCoder Beginner Contest 136
// C - Build Stairs
//
#include <algorithm>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;
using ll = long long;
using ld = long double;
const double PI = 3.14159265358979323846;
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; } //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } //最小公倍数
int main() {
int n;
cin >> n;
vector<ll> h(n);
REP(i, n) cin >> h[i];
string ans = "Yes";
ll maxH = h[0];
FOR(i, 1, n - 1) {
if (maxH == h[i])
continue;
if (maxH == h[i] - 1)
continue;
if (maxH < h[i])
maxH = h[i];
else {
ans = "No";
break;
}
}
cout << ans << endl;
return 0;
}
| //
// AtCoder Beginner Contest 136
// C - Build Stairs
//
#include <algorithm>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;
using ll = long long;
using ld = long double;
const double PI = 3.14159265358979323846;
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; } //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } //最小公倍数
int main() {
int n;
cin >> n;
vector<ll> h(n);
REP(i, n) cin >> h[i];
string ans = "Yes";
ll maxH = h[0];
FOR(i, 1, n - 1) {
if (maxH == h[i])
continue;
if (maxH == h[i] - 1)
continue;
if (maxH < h[i])
maxH = h[i] - 1;
else {
ans = "No";
break;
}
}
cout << ans << endl;
return 0;
}
| [
"assignment.change"
] | 756,172 | 756,173 | u506417357 | 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];
}
string ans = "Yes";
for (int i = 1; i < N; ++i) {
if (H[i] == H[i - 1] + 1) {
--H[i];
} else if (H[i] < H[i - 1]) {
ans = "No";
}
}
cout << ans << 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];
}
string ans = "Yes";
for (int i = 1; i < N; ++i) {
if (H[i] >= H[i - 1] + 1) {
--H[i];
} else if (H[i] < H[i - 1]) {
ans = "No";
}
}
cout << ans << endl;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,176 | 756,177 | u879581330 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e9
const int mxN = 1e6;
ll a[mxN + 10], b[mxN + 1];
int main() {
int n;
cin >> n;
vector<ll> h;
for (int i = 0; i < n; i++) {
ll x;
cin >> x;
h.push_back(x);
}
int max = INT_MIN;
for (int i = 0; i < n; i++) {
if (h[i] > max) {
max = h[i];
} else {
if (max - h[i] != 1) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e9
const int mxN = 1e6;
ll a[mxN + 10], b[mxN + 1];
int main() {
int n;
cin >> n;
vector<ll> h;
for (int i = 0; i < n; i++) {
ll x;
cin >> x;
h.push_back(x);
}
int max = INT_MIN;
for (int i = 0; i < n; i++) {
if (h[i] >= max) {
max = h[i];
} else {
if (max - h[i] != 1) {
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,184 | 756,185 | u709070698 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e9
const int mxN = 1e6;
ll a[mxN + 10], b[mxN + 1];
int main() {
int n;
cin >> n;
vector<ll> h;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
h.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
if (h[i - 1] < h[i] or (i == 0)) {
h[i]--;
}
}
int flag = 0;
for (int i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
cout << "NO" << endl;
flag = 1;
break;
}
}
if (flag == 0) {
cout << "YES" << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e9
const int mxN = 1e6;
ll a[mxN + 10], b[mxN + 1];
int main() {
int n;
cin >> n;
vector<ll> h;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
h.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
if (h[i - 1] < h[i] or (i == 0)) {
h[i]--;
}
}
int flag = 0;
for (int i = 0; i < n - 1; i++) {
if (h[i] > h[i + 1]) {
cout << "No" << endl;
flag = 1;
break;
}
}
if (flag == 0) {
cout << "Yes" << endl;
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 756,186 | 756,187 | u709070698 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); i++)
int main() {
int n;
cin >> n;
vector<int64_t> H(n);
rep(i, n) cin >> H.at(i);
rep(i, n - 1) {
if (i == 0 || H.at(i - 1) < H.at(i))
H.at(i + 1)--;
}
rep(i, n - 1) {
if (H.at(i) > H.at(i + 1)) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); i++)
int main() {
int n;
cin >> n;
vector<int64_t> H(n);
rep(i, n) cin >> H.at(i);
rep(i, n - 1) {
if (i == 0 || H.at(i - 1) < H.at(i))
H.at(i)--;
}
rep(i, n - 1) {
if (H.at(i) > H.at(i + 1)) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | [
"expression.operation.binary.remove"
] | 756,190 | 756,191 | u480172743 | cpp |
p02953 | #include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL << 60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) FOR(i, 0, (n))
#define RREP(i, n) RFOR(i, 0, (n))
#define ITR(itr, mp) for (auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr, mp) for (auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i, a, b) ((a) <= (i) && (i) < (b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define SP << " " <<
typedef pair<int, int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
signed main() {
ios::sync_with_stdio(false);
cout.tie(0);
cout.precision(20);
int n;
cin >> n;
vector<int> h(n);
REP(i, n) cin >> h[i];
int min = INF;
REP(i, n) {
if (h[i] <= min) {
min = h[i];
} else {
h[i]--;
}
}
bool f = true;
REP(i, n - 1) { f &= h[i + 1] >= h[i]; }
cout << (f ? "Yes" : "No") << endl;
return 0;
} | #include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL << 60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) FOR(i, 0, (n))
#define RREP(i, n) RFOR(i, 0, (n))
#define ITR(itr, mp) for (auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr, mp) for (auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i, a, b) ((a) <= (i) && (i) < (b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define SP << " " <<
typedef pair<int, int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
signed main() {
ios::sync_with_stdio(false);
cout.tie(0);
cout.precision(20);
int n;
cin >> n;
vector<int> h(n);
REP(i, n) cin >> h[i];
int min = INF;
RREP(i, n) {
if (h[i] <= min) {
min = h[i];
} else {
h[i]--;
}
}
bool f = true;
REP(i, n - 1) { f &= h[i + 1] >= h[i]; }
cout << (f ? "Yes" : "No") << endl;
return 0;
} | [
"identifier.change"
] | 756,201 | 756,202 | u237054088 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
vector<int> b(a);
for (int i = 0; i < a; i++) {
cin >> b[i];
}
for (int i = a - 1; 0 < i; i--) {
if (b[i] >= b[i - 1]) {
} else if (b[i] == b[i - 1] + 1) {
b[i]--;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
vector<int> b(a);
for (int i = 0; i < a; i++) {
cin >> b[i];
}
for (int i = a - 1; 0 < i; i--) {
if (b[i] >= b[i - 1]) {
} else if (b[i] + 1 == b[i - 1]) {
b[i - 1]--;
} else {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"expression.operation.binary.remove"
] | 756,203 | 756,204 | u962609087 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
int main() {
ll N;
cin >> N;
vector<ll> H(N);
bool state = true;
repi(i, N, 0) { cin >> H[i]; }
repd(i, N - 2, 0) {
if (H.at(i + 1) - H.at(i) < -1) {
puts("No");
return 0;
} else if (H.at(i + 1) - H.at(i) != 0) {
H.at(i)--;
}
}
puts("Yes");
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
int main() {
ll N;
cin >> N;
vector<ll> H(N);
bool state = true;
repi(i, N, 0) { cin >> H[i]; }
repd(i, N - 2, 0) {
if (H.at(i + 1) - H.at(i) < -1) {
puts("No");
return 0;
} else if (H.at(i + 1) - H.at(i) < 0) {
H.at(i)--;
}
}
puts("Yes");
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 756,205 | 756,206 | u187013893 | cpp |
p02953 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1 << 30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
os << p.first << " " << p.second;
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (int i = 0; i < (int)v.size(); i++)
os << v[i] << (i + 1 != v.size() ? " " : "");
return os;
}
void solve() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
int max_h = -1;
for (int i = 0; i < n; i++) {
if (max_h - 1 > h[i]) {
cout << i << endl;
return;
}
max_h = max(max_h, h[i]);
}
cout << "Yes" << endl;
}
signed main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1 << 30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
os << p.first << " " << p.second;
return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (int i = 0; i < (int)v.size(); i++)
os << v[i] << (i + 1 != v.size() ? " " : "");
return os;
}
void solve() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++)
cin >> h[i];
int max_h = -1;
for (int i = 0; i < n; i++) {
if (max_h - 1 > h[i]) {
cout << "No" << endl;
return;
}
max_h = max(max_h, h[i]);
}
cout << "Yes" << endl;
}
signed main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
} | [
"io.output.change"
] | 756,207 | 756,208 | u952094438 | cpp |
p02953 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>
int main() {
long long n;
std::cin >> n;
std::vector<long long> v(n);
for (long long i = 0; i < n; i++) {
std::cin >> v[i];
}
v[0] = v[0] - 1;
for (long long i = 0; i < n; i++) {
if (v[i] > v[i - 1]) {
v[i]--;
}
if (v[i] < v[i - 1]) {
std::cout << "No" << std::endl;
return 0;
}
}
std::cout << "Yes" << std::endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>
int main() {
long long n;
std::cin >> n;
std::vector<long long> v(n);
for (long long i = 0; i < n; i++) {
std::cin >> v[i];
}
v[0] = v[0] - 1;
for (long long i = 1; i < n; i++) {
if (v[i] > v[i - 1]) {
v[i]--;
}
if (v[i] < v[i - 1]) {
std::cout << "No" << std::endl;
return 0;
}
}
std::cout << "Yes" << std::endl;
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 756,213 | 756,214 | u914739916 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N, ans = 0;
bool flag = true;
cin >> N;
vector<ll> vec(N + 1, 0);
for (int i = 1; i <= N; i++) {
cin >> vec[i];
if (vec[i] >= vec[i - 1]) {
continue;
} else if (vec[i] + 1 == vec[i - 1]) {
vec[i]--;
} else {
flag = false;
}
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N, ans = 0;
bool flag = true;
cin >> N;
vector<ll> vec(N + 1, 0);
for (int i = 1; i <= N; i++) {
cin >> vec[i];
if (vec[i] >= vec[i - 1]) {
continue;
} else if (vec[i] + 1 == vec[i - 1]) {
vec[i]++;
} else {
flag = false;
}
}
if (flag)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
| [] | 756,221 | 756,222 | u000217193 | cpp |
p02953 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, s, e) for (int i = (s); i < (e); i++)
#define all(obj) (obj).begin(), (obj).end()
#define int long long
signed main() {
int n;
cin >> n;
vector<int> a(n + 1, 0);
rep(i, n) cin >> a[i + 1];
bool ans = true;
fo(i, 1, n) {
if (a[i - 1] < a[i])
a[i] -= 1;
else if (a[i - 1] > a[i])
ans = false;
}
cout << (ans ? "Yes" : "No") << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, s, e) for (int i = (s); i < (e); i++)
#define all(obj) (obj).begin(), (obj).end()
#define int long long
signed main() {
int n;
cin >> n;
vector<int> a(n + 1, 0);
rep(i, n) cin >> a[i + 1];
bool ans = true;
fo(i, 1, n + 1) {
if (a[i - 1] < a[i])
a[i] -= 1;
else if (a[i - 1] > a[i])
ans = false;
}
cout << (ans ? "Yes" : "No") << endl;
} | [
"expression.operation.binary.add"
] | 756,223 | 756,224 | u443151804 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.