Datasets:

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
p03149
#include <algorithm> #include <iostream> using namespace std; int a[4]; int main() { for (int i = 0; i < 4; i++) cin >> a[i]; sort(a, a + 4); if (a[0] == 1 && a[1] == 9 && a[2] == 7 && a[3] == 4) cout << "YES"; else cout << "NO"; return 0; }
#include <algorithm> #include <iostream> using namespace std; int a[4]; int main() { for (int i = 0; i < 4; i++) cin >> a[i]; sort(a, a + 4); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES"; else cout << "NO"; return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
947,315
947,316
u152424169
cpp
p03149
#include <iostream> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; #include <algorithm> #include <array> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <deque> #include <map> #include <queue> #include <string> #include <vector> #define all(x) (x).begin(), (x).end() void solve() {} int main() { bool n[10] = {}; int N[4] = {}; for (int i = 0; i < 4; i++) { cin >> N[i]; n[N[i]] = true; } bool ok = true; if (n[1] != true) ok = false; else if (n[4] != true) ok = false; else if (n[7] != true) ok = false; else if (n[9] != true) ok = false; if (ok) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
#include <iostream> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; #include <algorithm> #include <array> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <deque> #include <map> #include <queue> #include <string> #include <vector> #define all(x) (x).begin(), (x).end() void solve() {} int main() { bool n[10] = {}; int N[4] = {}; for (int i = 0; i < 4; i++) { cin >> N[i]; n[N[i]] = true; } bool ok = true; if (n[1] != true) ok = false; else if (n[4] != true) ok = false; else if (n[7] != true) ok = false; else if (n[9] != true) ok = false; if (ok) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,321
947,322
u824332405
cpp
p03149
#include <bits/stdc++.h> using namespace std; int a[20]; int main() { a[1] = 1, a[4] = 1, a[9] = 1, a[7] = 1; for (int i = 0; i < 4; i++) { int t; cin >> t; a[t] = 0; } if (a[1] || a[9] || a[7] || a[4]) { cout << "No\n"; } else cout << "Yes\n"; }
#include <bits/stdc++.h> using namespace std; int a[20]; int main() { a[1] = 1, a[4] = 1, a[9] = 1, a[7] = 1; for (int i = 0; i < 4; i++) { int t; cin >> t; a[t] = 0; } if (a[1] || a[9] || a[7] || a[4]) { cout << "NO\n"; } else cout << "YES\n"; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,323
947,324
u269278772
cpp
p03149
#include <bits/stdc++.h> using namespace std; bool judge(int a, int b, int c, int d, int x) { if (a == x || b == x || c == x || d == x) return true; } int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); int t = 0; if (judge(a, b, c, d, 1)) t++; if (judge(a, b, c, d, 9)) t++; if (judge(a, b, c, d, 7)) t++; if (judge(a, b, c, d, 4)) t++; if (t == 4) printf("YES\n"); else printf("NO\n"); }
#include <bits/stdc++.h> using namespace std; bool judge(int a, int b, int c, int d, int x) { if (a == x || b == x || c == x || d == x) return true; else return false; } int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); int t = 0; if (judge(a, b, c, d, 1)) t++; if (judge(a, b, c, d, 9)) t++; if (judge(a, b, c, d, 7)) t++; if (judge(a, b, c, d, 4)) t++; if (t == 4) printf("YES\n"); else printf("NO\n"); }
[ "control_flow.branch.else_if.replace.remove", "control_flow.branch.if.replace.add", "control_flow.return.add" ]
947,343
947,344
u676323984
cpp
p03149
#include <bits/stdc++.h> using namespace std; char N[4]; int main() { cin >> N[0] >> N[1] >> N[2] >> N[3]; sort(N, N + 4); if (!strcmp(N, "1479")) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; char N[4]; int main() { cin >> N[0] >> N[1] >> N[2] >> N[3]; sort(N, N + 4); if (!strcmp(N, "1479")) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,347
947,348
u056863173
cpp
p03149
#include <iostream> #include <string> int main() { int N[4]; for (int i = 0; i < 4; i++) std::cin >> N[i]; bool check = false; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) for (int k = 0; k < 4; k++) for (int l = 0; l < 4; l++) if (1000 * N[i] + 100 * N[j] + 10 * N[k] + N[l] == 1974) check = true; if (check) std::cout << "Yes" << std::endl; else std::cout << "No" << std::endl; return 0; }
#include <iostream> #include <string> int main() { int N[4]; for (int i = 0; i < 4; i++) std::cin >> N[i]; bool check = false; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) for (int k = 0; k < 4; k++) for (int l = 0; l < 4; l++) if (1000 * N[i] + 100 * N[j] + 10 * N[k] + N[l] == 1974) check = true; if (check) std::cout << "YES" << std::endl; else std::cout << "NO" << std::endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "expression.operation.binary.change" ]
947,351
947,352
u985625318
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string ans = "No"; for (int f = 0; f < S.size(); f++) for (int m = 0; m < S.size(); m++) { if (f + m > S.size()) continue; int l = S.size() - f - m; string check; for (int i = 0; i < f; i++) check += S[i]; for (int i = f + m; i < S.size(); i++) check += S[i]; if (check == "keyence") ans = "Yes"; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string ans = "NO"; for (int f = 0; f < S.size(); f++) for (int m = 0; m < S.size(); m++) { if (f + m > S.size()) continue; int l = S.size() - f - m; string check; for (int i = 0; i < f; i++) check += S[i]; for (int i = f + m; i < S.size(); i++) check += S[i]; if (check == "keyence") ans = "YES"; } cout << ans << endl; }
[ "literal.string.change", "literal.string.case.change", "variable_declaration.value.change", "assignment.value.change" ]
947,359
947,360
u840389344
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { string s; cin >> s; string u = "keyence", ans = "No"; int l = s.size(); for (int i = 0; i < l; i++) { for (int j = 0; j <= l - i - 1; j++) { string cp = s; cp = cp.erase(i, j); if (u == cp) { ans = "Yes"; } } } cout << ans; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { string s; cin >> s; string u = "keyence", ans = "NO"; int l = s.size(); for (int i = 0; i < l; i++) { for (int j = 0; j <= l - i - 1; j++) { string cp = s; cp = cp.erase(i, j); if (u == cp) { ans = "YES"; } } } cout << ans; }
[ "literal.string.change", "literal.string.case.change", "variable_declaration.value.change", "assignment.value.change" ]
947,361
947,362
u130651752
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { string s; cin >> s; string u = "keyence", ans = "No"; int l = s.size(); for (int i = 0; i < l; i++) { for (int j = 0; j < l - i - 1; j++) { string cp = s; cp = cp.erase(i, j); if (u == cp) { ans = "Yes"; } } } cout << ans; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long int main() { string s; cin >> s; string u = "keyence", ans = "NO"; int l = s.size(); for (int i = 0; i < l; i++) { for (int j = 0; j <= l - i - 1; j++) { string cp = s; cp = cp.erase(i, j); if (u == cp) { ans = "YES"; } } } cout << ans; }
[ "literal.string.change", "literal.string.case.change", "variable_declaration.value.change", "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "assignment.value.change" ]
947,364
947,362
u130651752
cpp
p03150
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int mod = 1000000007; void solve() { string s; cin >> s; if (s == "keyence") { cout << "Yes"; return; } int n = s.length(); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { string x = ""; for (int k = 0; k < n; k++) { if (k >= i && k <= j) { continue; } else { x.push_back(s[k]); } } if (x == "keyence") { cout << "YES"; return; } // cout<<x<<"\n" ; } } cout << "NO"; } int main() { int y; y = 1; // cin>>y ; while (y--) { solve(); } }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int mod = 1000000007; void solve() { string s; cin >> s; if (s == "keyence") { cout << "YES"; return; } int n = s.length(); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { string x = ""; for (int k = 0; k < n; k++) { if (k >= i && k <= j) { continue; } else { x.push_back(s[k]); } } if (x == "keyence") { cout << "YES"; return; } // cout<<x<<"\n" ; } } cout << "NO"; } int main() { int y; y = 1; // cin>>y ; while (y--) { solve(); } }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,368
947,369
u806692883
cpp
p03150
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <vector> // ceil(a/b) (a + (b - 1))/ b using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<int, int> P; const int inf = 1000000007; const ll mod = 1000000007; const double PI = 3.14159265358979323846; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } int cans(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; return 0; } int main() { string s; cin >> s; int N = s.size(); int dis = N - 7; bool f = false; for (int i = 0; i + 7 <= N; i++) { string ne = s; ne = ne.erase(i, dis); // cout << ne << endl; if (ne == "keyence") { f = true; } } if (f) cout << "Yes" << endl; else cout << "No" << endl; }
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <tuple> #include <vector> // ceil(a/b) (a + (b - 1))/ b using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<int, int> P; const int inf = 1000000007; const ll mod = 1000000007; const double PI = 3.14159265358979323846; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } int cans(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; return 0; } int main() { string s; cin >> s; int N = s.size(); int dis = N - 7; bool f = false; for (int i = 0; i + dis <= N; i++) { string ne = s; ne = ne.erase(i, dis); // cout << ne << endl; if (ne == "keyence") { f = true; } } if (f) cout << "YES" << endl; else cout << "NO" << endl; }
[ "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,379
947,378
u950174376
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int len = (int)(S.size()); bool ans = false; if (S.substr(0, 7) == "keyence" || S.substr(len - 7) == "keyence") ans = true; for (int i = 1; i < len - 1; i++) { string a = S.substr(0, i); string b = S.substr(len - 7 + i); if (a + b == "keyence") ans = true; } if (ans) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int len = (int)(S.size()); bool ans = false; if (S.substr(0, 7) == "keyence" || S.substr(len - 7) == "keyence") ans = true; for (int i = 1; i < 7; i++) { string a = S.substr(0, i); string b = S.substr(len - 7 + i); if (a + b == "keyence") ans = true; } if (ans) cout << "YES" << endl; else cout << "NO" << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
947,380
947,381
u418586218
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string s, key = "keyence"; cin >> s; auto solve = [&](int l) { int r = 1; while (l + r < s.size()) { string t = s; t.erase(l, r); if (t == key) { cout << "YES" << endl; return true; } r++; } return false; }; rep(i, s.size()) { if (solve(i)) { return 0; } } cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string s, key = "keyence"; cin >> s; auto solve = [&](int l) { int r = 0; while (l + r < s.size()) { string t = s; t.erase(l, r); if (t == key) { cout << "YES" << endl; return true; } r++; } return false; }; rep(i, s.size()) { if (solve(i)) { return 0; } } cout << "NO" << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
947,388
947,389
u713574885
cpp
p03150
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i > 0; i--) #define repi(i, x) \ for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++) #define all(x) (x).begin(), (x).end() #define F first #define S second #define mp make_pair #define mt make_tuple #define pb push_back #define eb emplace_back string solve(bool a) { return ((a) ? "Yes" : "No"); } typedef vector<int> Vi; typedef vector<Vi> VVi; typedef pair<int, int> Pi; typedef vector<Pi> VPi; typedef vector<long long> V; typedef vector<V> VV; typedef pair<long long, long long> P; typedef vector<P> VP; 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; } template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "{"; rep(i, v.size()) { if (i) os << ","; os << v[i]; } os << "}"; return os; } template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; } template <class T> istream &operator>>(istream &is, vector<T> &v) { rep(i, v.size()) { is >> v[i]; } return is; } const long long INFLL = 1LL << 60; const int INF = 1 << 30; const double PI = acos(-1); int main() { string s; int ans = 0; cin >> s; int left, right; string ter = "keyence"; for (left = 0; left < ter.size() and s[left] == ter[left]; left++) { } if (s[left] != ter[left] and left != 0) { // left--; } for (right = 0; right < ter.size() and s[s.size() - right - 1] == ter[ter.size() - 1 - right]; right++) { clog << s[s.size() - right - 1] << " " << ter[ter.size() - 1 - right] << endl; } if (s[s.size() - right - 1] != ter[ter.size() - 1 - right] and right != 0) { // right--; } clog << right << " " << left << endl; cout << solve(ter.size() <= left + right) << endl; }
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i > 0; i--) #define repi(i, x) \ for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++) #define all(x) (x).begin(), (x).end() #define F first #define S second #define mp make_pair #define mt make_tuple #define pb push_back #define eb emplace_back string solve(bool a) { return ((a) ? "YES" : "NO"); } typedef vector<int> Vi; typedef vector<Vi> VVi; typedef pair<int, int> Pi; typedef vector<Pi> VPi; typedef vector<long long> V; typedef vector<V> VV; typedef pair<long long, long long> P; typedef vector<P> VP; 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; } template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { os << "{"; rep(i, v.size()) { if (i) os << ","; os << v[i]; } os << "}"; return os; } template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; } template <class T> istream &operator>>(istream &is, vector<T> &v) { rep(i, v.size()) { is >> v[i]; } return is; } const long long INFLL = 1LL << 60; const int INF = 1 << 30; const double PI = acos(-1); int main() { string s; int ans = 0; cin >> s; int left, right; string ter = "keyence"; for (left = 0; left < ter.size() and s[left] == ter[left]; left++) { } if (s[left] != ter[left] and left != 0) { // left--; } for (right = 0; right < ter.size() and s[s.size() - right - 1] == ter[ter.size() - 1 - right]; right++) { clog << s[s.size() - right - 1] << " " << ter[ter.size() - 1 - right] << endl; } if (s[s.size() - right - 1] != ter[ter.size() - 1 - right] and right != 0) { // right--; } clog << right << " " << left << endl; cout << solve(ter.size() <= left + right) << endl; }
[ "literal.string.change", "literal.string.case.change", "function.return_value.change" ]
947,394
947,395
u179778090
cpp
p03150
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair<int, int>; int main() { string s; cin >> s; int l = (int)s.size(); bool ok = false; for (int i = 0; i < l; i++) { for (int j = i; j < l; j++) { string t = s.substr(0, i); string u = s.substr(j, l - i); if (t + u == "keyence") ok = true; } } if (ok) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair<int, int>; int main() { string s; cin >> s; int l = (int)s.size(); bool ok = false; for (int i = 0; i < l; i++) { for (int j = i; j < l; j++) { string t = s.substr(0, i); string u = s.substr(j, l - i); if (t + u == "keyence") ok = true; } } if (ok) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,400
947,401
u801916231
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { for (int j = 1; j <= s.size(); j++) { string t = s; if (t.erase(i, j) == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { for (int j = 0; j <= s.size(); j++) { string t = s; if (t.erase(i, j) == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
947,409
947,410
u298768617
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string S; cin >> S; string keyence = "keyence"; rep(i, S.size()) { for (int j = i + 1; j < S.size(); j++) { if (S.substr(0, i) + S.substr(j, S.size()) == keyence) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { string S; cin >> S; string keyence = "keyence"; string value; rep(i, S.size()) { for (int j = i; j < S.size(); j++) { if (S.substr(0, i) + S.substr(j, S.size()) == keyence) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "variable_declaration.add", "control_flow.loop.for.initializer.change", "expression.operation.binary.remove" ]
947,413
947,414
u579001504
cpp
p03148
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define INF 2147483647 #define LINF 9223372036854775807 #define MOD 1000000007 #define int long long #define rep(i, n) for (int i = 0; i < n; i++) //#define MODE 1 #ifdef MODE #define DEB(X) cout << #X << ": " << X << " "; #define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " "; #define END cout << endl; #else #define DEB(X) \ {} #define ARDEB(i, X) \ {} #define END \ {} #endif // typedef long long int ll; signed main() { int n, m; pair<int, int> s[111111]; cin >> n >> m; rep(i, n) { cin >> s[i].second >> s[i].first; } sort(s, s + n, greater<>()); priority_queue<int, vector<int>, greater<int>> pque; int net[111111] = {0}; int co = 0; int sans = 0; //ใ‚ซใƒณใ‚นใƒˆใ—ใŸใŠใ„ใ—ใ•ใƒใ‚คใƒณใƒˆ int ans; for (int i = 0; i < m; i++) { sans += s[i].first; if (net[s[i].second] == 0) co++; else pque.push(s[i].first); //ๅŒใ˜็จฎ้กžใŒ2ใค็›ฎไปฅ้™ใ‚’ใƒ—ใƒƒใ‚ทใƒฅ(ๅ–ใ‚Šๆ›ใˆใ‚‹ใ‹ใ‚‚) net[s[i].second]++; } ans = sans + co * co; for (int i = m; i < n; i++) { if (pque.empty()) break; if (net[s[i].second] == 0) { sans -= pque.top(); pque.pop(); sans += s[i].first; int ke = ans; ans = max(ans, sans + (co + 1) * (co + 1)); if (ke != ans) { net[s[i].second]++; co++; } } } // cout<<co<<endl; cout << ans << endl; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define INF 2147483647 #define LINF 9223372036854775807 #define MOD 1000000007 #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define MODE 1 #ifdef MODE #define DEB(X) cout << #X << ": " << X << " "; #define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " "; #define END cout << endl; #else #define DEB(X) \ {} #define ARDEB(i, X) \ {} #define END \ {} #endif // typedef long long int ll; signed main() { int n, m; pair<int, int> s[111111]; cin >> n >> m; rep(i, n) { cin >> s[i].second >> s[i].first; } sort(s, s + n, greater<>()); priority_queue<int, vector<int>, greater<int>> pque; int net[111111] = {0}; int co = 0; int sans = 0; //ใ‚ซใƒณใ‚นใƒˆใ—ใŸใŠใ„ใ—ใ•ใƒใ‚คใƒณใƒˆ int ans; for (int i = 0; i < m; i++) { sans += s[i].first; if (net[s[i].second] == 0) co++; else pque.push(s[i].first); //ๅŒใ˜็จฎ้กžใŒ2ใค็›ฎไปฅ้™ใ‚’ใƒ—ใƒƒใ‚ทใƒฅ(ๅ–ใ‚Šๆ›ใˆใ‚‹ใ‹ใ‚‚) net[s[i].second]++; } ans = sans + co * co; for (int i = m; i < n; i++) { if (pque.empty()) break; if (net[s[i].second] == 0) { sans -= pque.top(); pque.pop(); sans += s[i].first; int ke = ans; ans = max(ans, sans + (co + 1) * (co + 1)); // int a=sans+(co+1)*(co+1); // DEB(a)END if (ke <= ans) { net[s[i].second]++; co++; } // DEB(ans)END } } // cout<<co<<endl; cout << ans << endl; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
947,421
947,422
u901561754
cpp
p03148
/** * */ // {{{ header #include <bits/stdc++.h> using namespace std; using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using i128 = __int128_t; using u128 = __uint128_t; using f32 = float; using f64 = double; using f80 = __float80; using f128 = __float128; // }}} constexpr i64 INF = 1'010'000'000'000'000'000LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; // {{{ util #define FOR(i, start, end) \ for (i64 i = (start), i##_end = (end); i < i##_end; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(f, c, ...) \ (([&](decltype((c)) cccc) { \ return (f)(begin(cccc), end(cccc), ##__VA_ARGS__); \ })(c)) #define SLICE(f, c, l, r, ...) \ (([&](decltype((c)) cccc, decltype((l)) llll, decltype((r)) rrrr) { \ auto iiii = llll <= rrrr ? begin(cccc) + llll : end(cccc); \ auto jjjj = llll <= rrrr ? begin(cccc) + rrrr : end(cccc); \ return (f)(iiii, jjjj, ##__VA_ARGS__); \ })(c, l, r)) #define GENERIC(f) \ ([](auto &&...args) -> decltype(auto) { \ return (f)(forward<decltype(args)>(args)...); \ }) template <typename C> i64 SIZE(const C &c) { return static_cast<i64>(c.size()); } template <typename T, size_t N> i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); } bool is_odd(i64 x) { return x % 2 != 0; } bool is_even(i64 x) { return x % 2 == 0; } template <typename T> i64 cmp(T x, T y) { return (y < x) - (x < y); } template <typename T> i64 sgn(T x) { return cmp(x, T(0)); } // Haskell ใฎ divMod ใจๅŒใ˜ pair<i64, i64> divmod(i64 a, i64 b) { i64 q = a / b; i64 r = a % b; if ((b > 0 && r < 0) || (b < 0 && r > 0)) { --q; r += b; } return {q, r}; } i64 div_ceil(i64 a, i64 b) { i64 q = a / b; i64 r = a % b; if ((b > 0 && r > 0) || (b < 0 && r < 0)) ++q; return q; } i64 div_floor(i64 a, i64 b) { return divmod(a, b).first; } i64 modulo(i64 a, i64 b) { return divmod(a, b).second; } bool feq(f64 x, f64 y, f64 eps = EPS) { return fabs(x - y) < eps; } template <typename T, typename U> bool chmax(T &xmax, const U &x) { if (xmax < x) { xmax = x; return true; } return false; } template <typename T, typename U> bool chmin(T &xmin, const U &x) { if (x < xmin) { xmin = x; return true; } return false; } template <typename InputIt> auto SUM(InputIt first, InputIt last) { using T = typename iterator_traits<InputIt>::value_type; return accumulate(first, last, T()); } template <typename ForwardIt, typename UnaryOperation> ForwardIt transform_self(ForwardIt first, ForwardIt last, UnaryOperation op) { return transform(first, last, first, op); } template <typename C> void UNIQ(C &c) { c.erase(ALL(unique, c), end(c)); } template <typename BinaryFunc, typename UnaryFunc> auto ON(BinaryFunc bf, UnaryFunc uf) { return [bf, uf](const auto &x, const auto &y) { return bf(uf(x), uf(y)); }; } template <typename F> auto LT_ON(F f) { return ON(less<>(), f); } template <typename F> auto GT_ON(F f) { return ON(greater<>(), f); } template <typename T> void RD(T &x) { cin >> x; #ifdef PROCON_LOCAL assert(cin); #endif } template <typename T> void RD(vector<T> &v, i64 n) { v.reserve(n); REP(_, n) { T e; RD(e); v.emplace_back(e); } } template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) { for (auto first = begin(v), it = first; it != end(v); ++it) { if (it != first) out << ' '; out << *it; } return out; } template <typename T1, typename T2> ostream &operator<<(ostream &out, const pair<T1, T2> &p) { return out << '(' << p.first << ',' << p.second << ')'; } void PRINT() {} template <typename T, typename... TS> void PRINT(const T &x, const TS &...args) { cout << x; if (sizeof...(args)) { cout << ' '; PRINT(args...); } } template <typename... TS> void PRINTLN(const TS &...args) { PRINT(args...); cout << '\n'; } template <typename T> void DBG_IMPL(i64 line, const char *expr, const T &value) { #ifdef PROCON_LOCAL cerr << "[L " << line << "]: "; cerr << expr << " = " << value << "\n"; #endif } #define DBG(expr) DBG_IMPL(__LINE__, #expr, (expr)) // }}} // {{{ init struct ProconInit { static constexpr int IOS_PREC = 15; static constexpr bool AUTOFLUSH = false; ProconInit() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(IOS_PREC); #ifdef PROCON_LOCAL cerr << fixed << setprecision(IOS_PREC); #endif if (AUTOFLUSH) cout << unitbuf; } } PROCON_INIT; // }}} //-------------------------------------------------------------------- i64 N; i64 K; vector<pair<i64, i64>> A; void solve() { ALL(sort, A, greater<>()); vector<pair<i64, i64>> v; unordered_map<i64, i64> cnt; for (auto it = begin(A); it != begin(A) + K; ++it) { i64 d, t; tie(d, t) = *it; v.emplace_back(d, t); ++cnt[t]; } i64 ans = ALL(accumulate, v, 0LL, [](i64 x, const auto &e) { return x + e.first; }); ans += SIZE(cnt) * SIZE(cnt); i64 cur = ans; auto it = begin(A) + K; // ใพใ ้ฃŸใฃใฆใชใ„ auto jt = rbegin(v); // ใ‚‚ใ†้ฃŸใฃใŸ for (; it != end(A);) { i64 d, t; tie(d, t) = *it; // ๆ—ขๅ‡บใƒใ‚ฟใฏใ‚นใƒซใƒผ if (cnt.find(t) != end(cnt)) { ++it; continue; } for (; jt != rend(v); ++jt) { i64 dd, tt; tie(dd, tt) = *jt; // cnt[tt] >= 1 ใŒๆˆ็ซ‹ // 2ๅ€‹ไปฅไธŠ้ฃŸใฃใฆใŸใ‚‰ๅ…ฅใ‚Œๆ›ฟใˆ if (cnt[tt] >= 2) { --cnt[tt]; ++cnt[t]; cur = cur - dd + d + 2 * SIZE(cnt) - 1; chmax(ans, cur); break; } } if (jt == rend(v)) break; } PRINTLN(ans); } signed main() { RD(N); RD(K); A.reserve(N); REP(_, N) { i64 t, d; RD(t); RD(d); --t; // 0-based A.emplace_back(d, t); } solve(); return 0; }
/** * */ // {{{ header #include <bits/stdc++.h> using namespace std; using i8 = int8_t; using u8 = uint8_t; using i16 = int16_t; using u16 = uint16_t; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; using i128 = __int128_t; using u128 = __uint128_t; using f32 = float; using f64 = double; using f80 = __float80; using f128 = __float128; // }}} constexpr i64 INF = 1'010'000'000'000'000'000LL; constexpr i64 MOD = 1'000'000'007LL; constexpr f64 EPS = 1e-12; constexpr f64 PI = 3.14159265358979323846; // {{{ util #define FOR(i, start, end) \ for (i64 i = (start), i##_end = (end); i < i##_end; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(f, c, ...) \ (([&](decltype((c)) cccc) { \ return (f)(begin(cccc), end(cccc), ##__VA_ARGS__); \ })(c)) #define SLICE(f, c, l, r, ...) \ (([&](decltype((c)) cccc, decltype((l)) llll, decltype((r)) rrrr) { \ auto iiii = llll <= rrrr ? begin(cccc) + llll : end(cccc); \ auto jjjj = llll <= rrrr ? begin(cccc) + rrrr : end(cccc); \ return (f)(iiii, jjjj, ##__VA_ARGS__); \ })(c, l, r)) #define GENERIC(f) \ ([](auto &&...args) -> decltype(auto) { \ return (f)(forward<decltype(args)>(args)...); \ }) template <typename C> i64 SIZE(const C &c) { return static_cast<i64>(c.size()); } template <typename T, size_t N> i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); } bool is_odd(i64 x) { return x % 2 != 0; } bool is_even(i64 x) { return x % 2 == 0; } template <typename T> i64 cmp(T x, T y) { return (y < x) - (x < y); } template <typename T> i64 sgn(T x) { return cmp(x, T(0)); } // Haskell ใฎ divMod ใจๅŒใ˜ pair<i64, i64> divmod(i64 a, i64 b) { i64 q = a / b; i64 r = a % b; if ((b > 0 && r < 0) || (b < 0 && r > 0)) { --q; r += b; } return {q, r}; } i64 div_ceil(i64 a, i64 b) { i64 q = a / b; i64 r = a % b; if ((b > 0 && r > 0) || (b < 0 && r < 0)) ++q; return q; } i64 div_floor(i64 a, i64 b) { return divmod(a, b).first; } i64 modulo(i64 a, i64 b) { return divmod(a, b).second; } bool feq(f64 x, f64 y, f64 eps = EPS) { return fabs(x - y) < eps; } template <typename T, typename U> bool chmax(T &xmax, const U &x) { if (xmax < x) { xmax = x; return true; } return false; } template <typename T, typename U> bool chmin(T &xmin, const U &x) { if (x < xmin) { xmin = x; return true; } return false; } template <typename InputIt> auto SUM(InputIt first, InputIt last) { using T = typename iterator_traits<InputIt>::value_type; return accumulate(first, last, T()); } template <typename ForwardIt, typename UnaryOperation> ForwardIt transform_self(ForwardIt first, ForwardIt last, UnaryOperation op) { return transform(first, last, first, op); } template <typename C> void UNIQ(C &c) { c.erase(ALL(unique, c), end(c)); } template <typename BinaryFunc, typename UnaryFunc> auto ON(BinaryFunc bf, UnaryFunc uf) { return [bf, uf](const auto &x, const auto &y) { return bf(uf(x), uf(y)); }; } template <typename F> auto LT_ON(F f) { return ON(less<>(), f); } template <typename F> auto GT_ON(F f) { return ON(greater<>(), f); } template <typename T> void RD(T &x) { cin >> x; #ifdef PROCON_LOCAL assert(cin); #endif } template <typename T> void RD(vector<T> &v, i64 n) { v.reserve(n); REP(_, n) { T e; RD(e); v.emplace_back(e); } } template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) { for (auto first = begin(v), it = first; it != end(v); ++it) { if (it != first) out << ' '; out << *it; } return out; } template <typename T1, typename T2> ostream &operator<<(ostream &out, const pair<T1, T2> &p) { return out << '(' << p.first << ',' << p.second << ')'; } void PRINT() {} template <typename T, typename... TS> void PRINT(const T &x, const TS &...args) { cout << x; if (sizeof...(args)) { cout << ' '; PRINT(args...); } } template <typename... TS> void PRINTLN(const TS &...args) { PRINT(args...); cout << '\n'; } template <typename T> void DBG_IMPL(i64 line, const char *expr, const T &value) { #ifdef PROCON_LOCAL cerr << "[L " << line << "]: "; cerr << expr << " = " << value << "\n"; #endif } #define DBG(expr) DBG_IMPL(__LINE__, #expr, (expr)) // }}} // {{{ init struct ProconInit { static constexpr int IOS_PREC = 15; static constexpr bool AUTOFLUSH = false; ProconInit() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(IOS_PREC); #ifdef PROCON_LOCAL cerr << fixed << setprecision(IOS_PREC); #endif if (AUTOFLUSH) cout << unitbuf; } } PROCON_INIT; // }}} //-------------------------------------------------------------------- i64 N; i64 K; vector<pair<i64, i64>> A; void solve() { ALL(sort, A, greater<>()); vector<pair<i64, i64>> v; unordered_map<i64, i64> cnt; for (auto it = begin(A); it != begin(A) + K; ++it) { i64 d, t; tie(d, t) = *it; v.emplace_back(d, t); ++cnt[t]; } i64 ans = ALL(accumulate, v, 0LL, [](i64 x, const auto &e) { return x + e.first; }); ans += SIZE(cnt) * SIZE(cnt); i64 cur = ans; auto it = begin(A) + K; // ใพใ ้ฃŸใฃใฆใชใ„ auto jt = rbegin(v); // ใ‚‚ใ†้ฃŸใฃใŸ for (; it != end(A);) { i64 d, t; tie(d, t) = *it; // ๆ—ขๅ‡บใƒใ‚ฟใฏใ‚นใƒซใƒผ // cnt[t] == 0 ใฎๅฏ่ƒฝๆ€งใŒใ‚ใ‚‹ใŸใ‚ operator[] ใฏไฝฟใˆใชใ„ if (cnt.find(t) != end(cnt)) { ++it; continue; } for (; jt != rend(v); ++jt) { i64 dd, tt; tie(dd, tt) = *jt; // cnt[tt] >= 1 ใŒๆˆ็ซ‹ // 2ๅ€‹ไปฅไธŠ้ฃŸใฃใฆใŸใ‚‰ๅ…ฅใ‚Œๆ›ฟใˆ if (cnt[tt] >= 2) { --cnt[tt]; ++cnt[t]; cur = cur - dd + d + 2 * SIZE(cnt) - 1; chmax(ans, cur); ++jt; break; } } if (jt == rend(v)) break; } PRINTLN(ans); } signed main() { RD(N); RD(K); A.reserve(N); REP(_, N) { i64 t, d; RD(t); RD(d); --t; // 0-based A.emplace_back(d, t); } solve(); return 0; }
[ "expression.unary.arithmetic.add" ]
947,425
947,426
u254456372
cpp
p03148
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; const int INF = pow(2, 31) - 1; #define ll long long #define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl; #define REP(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { int N, K; cin >> N >> K; vector<pair<ll, ll>> dt(N); REP(i, N) { cin >> dt[i].second >> dt[i].first; } sort(dt.begin(), dt.end()); reverse(dt.begin(), dt.end()); ll dsum = 0; map<ll, ll> m; REP(i, K) { dsum += dt[i].first; m[dt[i].second]++; } ll ans = dsum + m.size() * m.size(); int r = K - 1; for (int i = K; i < N; i++) { if (m[dt[i].second] != 0) continue; while (m[dt[i].second] == 1 && r >= 0) r--; if (r == -1) break; m[dt[i].second]++; m[dt[r].second]--; dsum = dsum + dt[i].first - dt[r].first; ll tmp = dsum + m.size() * m.size(); ans = max(ans, tmp); r--; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; const int INF = pow(2, 31) - 1; #define ll long long #define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl; #define REP(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { int N, K; cin >> N >> K; vector<pair<ll, ll>> dt(N); REP(i, N) { cin >> dt[i].second >> dt[i].first; } sort(dt.begin(), dt.end()); reverse(dt.begin(), dt.end()); ll dsum = 0; map<ll, ll> m; REP(i, K) { dsum += dt[i].first; m[dt[i].second]++; } ll ans = dsum + m.size() * m.size(); int r = K - 1; for (int i = K; i < N; i++) { if (m[dt[i].second] != 0) continue; while (m[dt[r].second] == 1 && r >= 0) r--; if (r == -1) break; m[dt[i].second]++; m[dt[r].second]--; dsum = dsum + dt[i].first - dt[r].first; ll tmp = dsum + m.size() * m.size(); ans = max(ans, tmp); r--; } cout << ans << endl; return 0; }
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.loop.condition.change" ]
947,435
947,436
u353542198
cpp
p03148
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; const int INF = pow(2, 31) - 1; #define ll long long #define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl; #define REP(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { int N, K; cin >> N >> K; vector<pair<int, int>> dt(N); REP(i, N) { cin >> dt[i].second >> dt[i].first; } sort(dt.begin(), dt.end()); reverse(dt.begin(), dt.end()); ll dsum = 0; map<ll, ll> m; REP(i, K) { dsum += dt[i].first; m[dt[i].second]++; } ll ans = dsum + m.size() * m.size(); int r = K - 1; for (int i = K; i < N; i++) { if (m[dt[i].second] != 0) continue; while (m[dt[i].second] == 1 && r >= 0) r--; if (r == -1) break; m[dt[i].second]++; m[dt[r].second]--; dsum = dsum + dt[i].first - dt[r].first; ll tmp = dsum + m.size() * m.size(); ans = max(ans, tmp); r--; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; const int INF = pow(2, 31) - 1; #define ll long long #define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl; #define REP(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { int N, K; cin >> N >> K; vector<pair<ll, ll>> dt(N); REP(i, N) { cin >> dt[i].second >> dt[i].first; } sort(dt.begin(), dt.end()); reverse(dt.begin(), dt.end()); ll dsum = 0; map<ll, ll> m; REP(i, K) { dsum += dt[i].first; m[dt[i].second]++; } ll ans = dsum + m.size() * m.size(); int r = K - 1; for (int i = K; i < N; i++) { if (m[dt[i].second] != 0) continue; while (m[dt[r].second] == 1 && r >= 0) r--; if (r == -1) break; m[dt[i].second]++; m[dt[r].second]--; dsum = dsum + dt[i].first - dt[r].first; ll tmp = dsum + m.size() * m.size(); ans = max(ans, tmp); r--; } cout << ans << endl; return 0; }
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.loop.condition.change" ]
947,437
947,436
u353542198
cpp
p03148
#include <algorithm> #include <cassert> #include <cstring> #include <iostream> #include <set> #include <string> #include <vector> using namespace std; #define MOD 1000000007 int main() { int count[100001]; memset(count, 0, sizeof(count)); int n, k; cin >> n >> k; vector<pair<int, int>> susi; for (int i = 0; i < n; i++) { int neta, oisisa; cin >> neta >> oisisa; susi.push_back(make_pair(oisisa, neta)); } sort(susi.begin(), susi.end(), greater<pair<int, int>>()); long long ans = 0; long long num = 0; for (int i = 0; i < k; i++) { ans += susi[i].first; if (count[susi[i].second] == 0) { num++; } count[susi[i].second]++; } long long max = ans + num * num; int min = k - 1; int now = k; int flag = 0; for (int i = num; i <= n; i++) { for (int j = k - 1; j >= 0; j--) { if (count[susi[j].second] >= 2) { count[susi[j].second]--; ans -= susi[j].first; min = j - 1; flag = 1; break; } } if (flag == 0) { cout << max; return 0; } flag = 0; for (int j = k; j < n; j++) { if (count[susi[j].second] == 0) { count[susi[j].second]++; ans += susi[j].first; now = k + 1; num++; flag = 1; break; } } if (flag == 0) { cout << max; return 0; } flag = 0; long long temp = ans + num * num; if (max < temp) max = temp; } cout << max; return 0; }
#include <algorithm> #include <cassert> #include <cstring> #include <iostream> #include <set> #include <string> #include <vector> using namespace std; #define MOD 1000000007 int main() { int count[100001]; memset(count, 0, sizeof(count)); int n, k; cin >> n >> k; vector<pair<int, int>> susi; for (int i = 0; i < n; i++) { int neta, oisisa; cin >> neta >> oisisa; susi.push_back(make_pair(oisisa, neta)); } sort(susi.begin(), susi.end(), greater<pair<int, int>>()); long long ans = 0; long long num = 0; for (int i = 0; i < k; i++) { ans += susi[i].first; if (count[susi[i].second] == 0) { num++; } count[susi[i].second]++; } long long max = ans + num * num; int min = k - 1; int now = k; int flag = 0; for (int i = num; i <= n; i++) { for (int j = min; j >= 0; j--) { if (count[susi[j].second] >= 2) { count[susi[j].second]--; ans -= susi[j].first; min = j - 1; flag = 1; break; } } if (flag == 0) { cout << max; return 0; } flag = 0; for (int j = now; j < n; j++) { if (count[susi[j].second] == 0) { count[susi[j].second]++; ans += susi[j].first; now = k + 1; num++; flag = 1; break; } } if (flag == 0) { cout << max; return 0; } flag = 0; long long temp = ans + num * num; if (max < temp) max = temp; } cout << max; return 0; }
[ "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.operation.binary.change", "expression.operation.binary.remove", "identifier.change" ]
947,441
947,442
u051493691
cpp
p03148
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repr(i, n) for (ll i = n - 1; i >= 0; i--) #define repone(i, n) for (ll i = 1; i <= (ll)(n); i++) #define each(i, mp) for (auto i : mp) #define FOR(i, m, n) for (ll i = m; i < n; i++) const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; const ll mod = 1000000007; const ll inf = ll(1e9); const ll half_inf = ll(1e5); const ll ll_inf = ll(1e9) * ll(1e9); ll n, k; vector<P> dt; map<ll, ll> max_mp; bool used[half_inf]; priority_queue<ll, vector<ll>, greater<>> others; void solve() { sort(dt.begin(), dt.end(), greater<>()); ll ans = 0; ll tmp = 0, tmp2 = 0; rep(i, k) { if (!used[dt[i].second] && dt[i].first == max_mp[dt[i].second]) { tmp++; used[dt[i].second] = true; } else { others.push(dt[i].first); } ans += dt[i].first; tmp2 += dt[i].first; } ans += tmp * tmp; vector<pair<ll, ll>> v(max_mp.begin(), max_mp.end()); // sort from bigger. sort(v.begin(), v.end(), [](pair<ll, ll> a, pair<ll, ll> b) { return a.first > b.first; }); each(m, v) { if (used[m.first]) continue; if (others.empty()) break; ll minus = others.top(); others.pop(); tmp++; tmp2 = tmp2 - minus + m.second; ans = max(tmp2 + tmp * tmp, ans); } cout << ans << endl; } int main() { cin >> n >> k; dt.resize(n); rep(i, n) { ll t, d; cin >> t >> d; dt[i] = make_pair(d, t); max_mp[dt[i].second] = max(max_mp[dt[i].second], dt[i].first); } solve(); return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repr(i, n) for (ll i = n - 1; i >= 0; i--) #define repone(i, n) for (ll i = 1; i <= (ll)(n); i++) #define each(i, mp) for (auto i : mp) #define FOR(i, m, n) for (ll i = m; i < n; i++) const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; const ll mod = 1000000007; const ll inf = ll(1e9); const ll half_inf = ll(1e5); const ll ll_inf = ll(1e9) * ll(1e9); ll n, k; vector<P> dt; map<ll, ll> max_mp; bool used[half_inf]; priority_queue<ll, vector<ll>, greater<>> others; void solve() { sort(dt.begin(), dt.end(), greater<>()); ll ans = 0; ll tmp = 0, tmp2 = 0; rep(i, k) { if (!used[dt[i].second] && dt[i].first == max_mp[dt[i].second]) { tmp++; used[dt[i].second] = true; } else { others.push(dt[i].first); } ans += dt[i].first; tmp2 += dt[i].first; } ans += tmp * tmp; vector<pair<ll, ll>> v(max_mp.begin(), max_mp.end()); // sort from bigger. sort(v.begin(), v.end(), [](pair<ll, ll> a, pair<ll, ll> b) { return a.second > b.second; }); each(m, v) { if (used[m.first]) continue; if (others.empty()) break; ll minus = others.top(); others.pop(); tmp++; tmp2 = tmp2 - minus + m.second; ans = max(tmp2 + tmp * tmp, ans); } cout << ans << endl; } int main() { cin >> n >> k; dt.resize(n); rep(i, n) { ll t, d; cin >> t >> d; dt[i] = make_pair(d, t); max_mp[dt[i].second] = max(max_mp[dt[i].second], dt[i].first); } solve(); return 0; }
[ "call.arguments.change", "function.return_value.change", "expression.operation.binary.change" ]
947,446
947,447
u136378781
cpp
p03148
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, n, m) for (int i = n; i < m; i++) #define ll long long int using namespace std; int main() { int n, k; cin >> n >> k; vector<pair<ll, ll>> pairs(n); REP(i, n) { ll a, b; cin >> a >> b; pairs[i] = make_pair(b, a); } sort(pairs.begin(), pairs.end(), greater<pair<ll, ll>>()); int t[100000] = {}; ll tn = 0LL; ll sum = 0LL; priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> queue; REP(i, k) { sum += pairs[i].first; queue.push(pairs[i]); if (t[pairs[i].second] == 0) { tn++; } t[pairs[i].second]++; } ll result; result = sum + tn * tn; FOR(i, k, n) { pair<ll, ll> maxp = pairs[i]; if (t[maxp.second] >= 0) continue; pair<ll, ll> min; while (!queue.empty()) { min = queue.top(); queue.pop(); if (t[min.second] <= 1) continue; tn++; sum = sum - min.first + maxp.first; result = max(sum + tn * tn, result); t[maxp.second]++; t[min.second]--; break; } if (queue.empty()) break; } cout << result << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, n, m) for (int i = n; i < m; i++) #define ll long long int using namespace std; int main() { int n, k; cin >> n >> k; vector<pair<ll, ll>> pairs(n); REP(i, n) { ll a, b; cin >> a >> b; pairs[i] = make_pair(b, a); } sort(pairs.begin(), pairs.end(), greater<pair<ll, ll>>()); int t[100001] = {}; ll tn = 0LL; ll sum = 0LL; priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> queue; REP(i, k) { sum += pairs[i].first; queue.push(pairs[i]); if (t[pairs[i].second] == 0) { tn++; } t[pairs[i].second]++; } ll result; result = sum + tn * tn; FOR(i, k, n) { pair<ll, ll> maxp = pairs[i]; if (t[maxp.second] > 0) continue; pair<ll, ll> min; while (!queue.empty()) { min = queue.top(); queue.pop(); if (t[min.second] <= 1) continue; tn++; sum = sum - min.first + maxp.first; result = max(sum + tn * tn, result); t[maxp.second]++; t[min.second]--; break; } if (queue.empty()) break; } cout << result << endl; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
947,464
947,463
u620059302
cpp
p03148
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <numeric> #include <vector> using namespace std; typedef long long ll; int N, K; vector<int> D; map<int, int> t_max; vector<int> max_val, max_pos; void input_init(void) { cin >> N >> K; D.resize(N); for (int i = 0; i < N; ++i) { int t; cin >> t >> D[i]; if (t_max.count(t) == 0) t_max.insert(make_pair(t, D[i])); else t_max[t] = max(D[i], t_max[t]); } } void value_check(void) { map<int, int>::iterator itr; for (itr = t_max.begin(); itr != t_max.end(); ++itr) max_val.push_back(itr->second); sort(max_val.begin(), max_val.end(), greater<int>()); sort(D.begin(), D.end(), greater<int>()); int sz = max_val.size(); max_pos.resize(sz); int p = 0; for (int i = 0; i < N; ++i) { if (D[i] == max_val[p]) { max_pos[p] = i; ++p; if (p >= sz) break; } } } ll solve(void) { ll point_d = accumulate(D.begin(), D.begin() + K, (ll)0); int cur_k = 0; for (int i = 0; i < (int)max_pos.size(); ++i) { if (max_pos[i] > K - 1) break; ++cur_k; } ll point_k = (ll)cur_k * cur_k; ll max_v = point_d + point_k; int cur_p = K - 1; for (int k = cur_k + 1; k <= (int)max_pos.size(); ++k) { while (cur_p > 0) { if (binary_search(max_pos.begin(), max_pos.end(), cur_p) == true) --cur_p; else { point_d -= (ll)D[cur_p]; point_d += (ll)max_val[k - 1]; ll val = point_d + (ll)k * k; max_v = max(val, max_v); break; } } } return max_v; } int main(void) { cin.tie(0); ios::sync_with_stdio(false); input_init(); value_check(); ll ans = solve(); cout << ans << '\n'; return 0; }
#include <algorithm> #include <functional> #include <iostream> #include <map> #include <numeric> #include <vector> using namespace std; typedef long long ll; int N, K; vector<int> D; map<int, int> t_max; vector<int> max_val, max_pos; void input_init(void) { cin >> N >> K; D.resize(N); for (int i = 0; i < N; ++i) { int t; cin >> t >> D[i]; if (t_max.count(t) == 0) t_max.insert(make_pair(t, D[i])); else t_max[t] = max(D[i], t_max[t]); } } void value_check(void) { map<int, int>::iterator itr; for (itr = t_max.begin(); itr != t_max.end(); ++itr) max_val.push_back(itr->second); sort(max_val.begin(), max_val.end(), greater<int>()); sort(D.begin(), D.end(), greater<int>()); int sz = max_val.size(); max_pos.resize(sz); int p = 0; for (int i = 0; i < N; ++i) { if (D[i] == max_val[p]) { max_pos[p] = i; ++p; if (p >= sz) break; } } } ll solve(void) { ll point_d = accumulate(D.begin(), D.begin() + K, (ll)0); int cur_k = 0; for (int i = 0; i < (int)max_pos.size(); ++i) { if (max_pos[i] > K - 1) break; ++cur_k; } ll point_k = (ll)cur_k * cur_k; ll max_v = point_d + point_k; int cur_p = K - 1; for (int k = cur_k + 1; k <= (int)max_pos.size(); ++k) { while (cur_p > 0) { if (binary_search(max_pos.begin(), max_pos.end(), cur_p) == true) --cur_p; else { point_d -= (ll)D[cur_p]; point_d += (ll)max_val[k - 1]; ll val = point_d + (ll)k * k; max_v = max(val, max_v); --cur_p; break; } } } return max_v; } int main(void) { cin.tie(0); ios::sync_with_stdio(false); input_init(); value_check(); ll ans = solve(); cout << ans << '\n'; return 0; }
[ "expression.unary.arithmetic.add" ]
947,475
947,476
u282280353
cpp
p03148
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> typedef long long int ll; #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR_IN(i, a, b) for (int i = (a); i < (b); i++) #define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b)) #define BIT(b, i) (((b) >> (i)) & 1) #define LOG_F 1 #define LOG(...) \ if (LOG_F) \ fprintf(stderr, __VA_ARGS__) using namespace std; ll pow(int x, int n) { return n == 0 ? 1 : x * pow(x, n - 1); } /* n k ti di k n 10^5 ti n di 10^9 */ typedef pair<ll, int> P; // d,t int n, k; P ps[100000]; bool af[100000]; ll alt[100000]; int main() { cin >> n >> k; REP(i, n) { int t; ll d; cin >> t >> d; t--; ps[i] = P(d, t); } sort(ps, ps + n, greater<P>()); int tnum = 0; int cnt = 1; priority_queue<ll, vector<ll>, greater<ll>> que; REP(i, n) { if (i < k) { alt[0] += ps[i].first; } if (!af[ps[i].second]) { af[ps[i].second] = true; if (i >= k) { if (!que.empty()) { ll q = que.top(); que.pop(); alt[cnt] = alt[cnt - 1] - q + ps[i].first; LOG("alt[%d]=%lld\n", cnt, alt[cnt]); cnt++; } } else { tnum++; } } else { if (i < k) que.push(ps[i].first); } } ll ans = 0; REP(i, cnt + 1) { ans = max(ans, pow(tnum + i, 2) + alt[i]); LOG("%lld\n", alt[i]); } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> typedef long long int ll; #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR_IN(i, a, b) for (int i = (a); i < (b); i++) #define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b)) #define BIT(b, i) (((b) >> (i)) & 1) #define LOG_F 1 #define LOG(...) \ if (LOG_F) \ fprintf(stderr, __VA_ARGS__) using namespace std; ll pow(int x, int n) { return n == 0 ? 1 : x * pow(x, n - 1); } /* n k ti di k n 10^5 ti n di 10^9 */ typedef pair<ll, int> P; // d,t int n, k; P ps[100000]; bool af[100000]; ll alt[100000]; int main() { cin >> n >> k; REP(i, n) { int t; ll d; cin >> t >> d; t--; ps[i] = P(d, t); } sort(ps, ps + n, greater<P>()); int tnum = 0; int cnt = 1; priority_queue<ll, vector<ll>, greater<ll>> que; REP(i, n) { if (i < k) { alt[0] += ps[i].first; } if (!af[ps[i].second]) { af[ps[i].second] = true; if (i >= k) { if (!que.empty()) { ll q = que.top(); que.pop(); alt[cnt] = alt[cnt - 1] - q + ps[i].first; LOG("alt[%d]=%lld\n", cnt, alt[cnt]); cnt++; } } else { tnum++; } } else { if (i < k) que.push(ps[i].first); } } ll ans = 0; REP(i, cnt) { ans = max(ans, pow(tnum + i, 2) + alt[i]); LOG("%lld\n", alt[i]); } cout << ans << endl; return 0; }
[ "expression.operation.binary.remove" ]
947,491
947,492
u261243803
cpp
p03148
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector<pii> a(n); rep(i, n) cin >> a.at(i).second >> a.at(i).first; sort(a.rbegin(), a.rend()); map<int, bool> m; stack<int> s; ll sum = 0, type = 0; vector<ll> ans(n); rep(i, n) { if (i < k) { if (m[a.at(i).second]) { sum += a.at(i).first; s.push(a.at(i).first); ans[type] = sum; } else { sum += a.at(i).first - type * type; type++; sum += type * type; m[a.at(i).second] = true; ans[type] = sum; } } else { if (!m[a.at(i).second] && s.size() != 0) { sum -= s.top() + type * type; type++; sum += a.at(i).first + type * type; ans[type] = sum; s.pop(); m[a.at(i).second] = true; } else ans[type] = sum; } } ll res = 0; rep(i, n) res = max(res, ans[i]); cout << res << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector<pii> a(n); rep(i, n) cin >> a.at(i).second >> a.at(i).first; sort(a.rbegin(), a.rend()); map<int, bool> m; stack<int> s; ll sum = 0, type = 0; vector<ll> ans(n + 1); rep(i, n) { if (i < k) { if (m[a.at(i).second]) { sum += a.at(i).first; s.push(a.at(i).first); ans[type] = sum; } else { sum += a.at(i).first - type * type; type++; sum += type * type; m[a.at(i).second] = true; ans[type] = sum; } } else { if (!m[a.at(i).second] && s.size() != 0) { sum -= s.top() + type * type; type++; sum += a.at(i).first + type * type; ans[type] = sum; s.pop(); m[a.at(i).second] = true; } else ans[type] = sum; } } ll res = 0; rep(i, n + 1) res = max(res, ans[i]); cout << res << endl; }
[ "assignment.change" ]
947,504
947,505
u480831358
cpp
p03148
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector<pii> a(n); rep(i, n) cin >> a.at(i).second >> a.at(i).first; sort(a.rbegin(), a.rend()); map<int, bool> m; priority_queue<int, vector<int>, greater<int>> pq; ll sum = 0, type = 0; vector<ll> ans(n); rep(i, n) { if (i < k) { if (m[a.at(i).second]) { sum += a.at(i).first; pq.push(a.at(i).first); ans[type] = sum; } else { sum += a.at(i).first - type * type; type++; sum += type * type; m[a.at(i).second] = true; ans[type] = sum; } } else { if (!m[a.at(i).second] && !pq.empty()) { sum -= pq.top() + type * type; type++; sum += a.at(i).first + type * type; ans[type] = sum; pq.pop(); m[a.at(i).second] = true; } else ans[type] = sum; } } ll res = 0; rep(i, n) res = max(res, ans[i]); cout << res << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define pb push_back #define mp make_pair #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector<pii> a(n); rep(i, n) cin >> a.at(i).second >> a.at(i).first; sort(a.rbegin(), a.rend()); map<int, bool> m; priority_queue<int, vector<int>, greater<int>> pq; ll sum = 0, type = 0; vector<ll> ans(n + 1); rep(i, n) { if (i < k) { if (m[a.at(i).second]) { sum += a.at(i).first; pq.push(a.at(i).first); ans[type] = sum; } else { sum += a.at(i).first - type * type; type++; sum += type * type; m[a.at(i).second] = true; ans[type] = sum; } } else { if (!m[a.at(i).second] && !pq.empty()) { sum -= pq.top() + type * type; type++; sum += a.at(i).first + type * type; ans[type] = sum; pq.pop(); m[a.at(i).second] = true; } else ans[type] = sum; } } ll res = 0; rep(i, n + 1) res = max(res, ans[i]); cout << res << endl; }
[ "assignment.change" ]
947,506
947,507
u480831358
cpp
p03148
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long int ll; typedef pair<ll, ll> sushi; const int MAXN = 100001; int main() { ll n, k; cin >> n >> k; vector<sushi> v; for (int i = 0; i < n; i++) { ll t, d; cin >> t >> d; v.push_back(sushi(t, d)); } sort(v.begin(), v.end(), [](const sushi &s1, const sushi &s2) { return s1.second > s2.second; }); ll curNs = 0; // current syurui of neta ll curN[MAXN]; // current num for each neta ll curBS = 0; // current base score for (int i = 0; i < MAXN; i++) { curN[i] = 0; } for (int i = 0; i < k; i++) { if (curN[v[i].first] == 0) { curNs++; } curN[v[i].first]++; curBS += v[i].second; } ll res = curBS + curNs * curNs; ll addPtr = k + 1; ll delPtr = (k - 1) + 1; while (true) { while (addPtr < n) { addPtr++; if (curN[v[addPtr].first] == 0) { break; } } if (addPtr >= n) { break; } while (delPtr >= 0) { delPtr--; if (curN[v[delPtr].first] > 1) { break; } } if (delPtr < 0) { break; } curBS += v[addPtr].second - v[delPtr].second; curN[v[addPtr].first]++; curN[v[delPtr].first]--; curNs++; ll cur = curBS + curNs * curNs; res = max(cur, res); } cout << res << endl; return 0; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long int ll; typedef pair<ll, ll> sushi; const int MAXN = 100001; int main() { ll n, k; cin >> n >> k; vector<sushi> v; for (int i = 0; i < n; i++) { ll t, d; cin >> t >> d; v.push_back(sushi(t, d)); } sort(v.begin(), v.end(), [](const sushi &s1, const sushi &s2) { return s1.second > s2.second; }); ll curNs = 0; // current syurui of neta ll curN[MAXN]; // current num for each neta ll curBS = 0; // current base score for (int i = 0; i < MAXN; i++) { curN[i] = 0; } for (int i = 0; i < k; i++) { if (curN[v[i].first] == 0) { curNs++; } curN[v[i].first]++; curBS += v[i].second; } ll res = curBS + curNs * curNs; ll addPtr = k - 1; ll delPtr = (k - 1) + 1; while (true) { while (addPtr < n) { addPtr++; if (curN[v[addPtr].first] == 0) { break; } } if (addPtr >= n) { break; } while (delPtr >= 0) { delPtr--; if (curN[v[delPtr].first] > 1) { break; } } if (delPtr < 0) { break; } curBS += v[addPtr].second - v[delPtr].second; curN[v[addPtr].first]++; curN[v[delPtr].first]--; curNs++; ll cur = curBS + curNs * curNs; res = max(cur, res); } cout << res << endl; return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
947,536
947,537
u633065537
cpp
p03148
#include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } #define REP(i, n) for (int i = 0; i < n; i++) const long long INF = 1LL << 60; int MOD = 1000000007; int main() { std::ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; std::vector<pair<int, int>> sushi; std::vector<bool> used(101010, false); REP(i, n) { int t; int d; cin >> t >> d; sushi.push_back(make_pair(d, t)); } ll base = 0LL, cnt = 0LL; sort(sushi.begin(), sushi.end()); reverse(sushi.begin(), sushi.end()); priority_queue<int, vector<int>, greater<int>> que; REP(i, k) { base += sushi[i].first; if (!used[sushi[i].second]) { used[sushi[i].second] = true; cnt++; } que.push(sushi[i].first); } ll ans = base + cnt * cnt; for (int i = k; i < n; ++i) { if (cnt >= k) break; if (used[sushi[i].second]) continue; used[sushi[i].second] = true; cnt++; int m = que.top(); que.pop(); base -= m; base += sushi[i].first; ans = max(ans, base + (cnt * cnt)); } cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } #define REP(i, n) for (int i = 0; i < n; i++) const long long INF = 1LL << 60; int MOD = 1000000007; int main() { std::ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; std::vector<pair<int, int>> sushi; std::vector<bool> used(101010, false); REP(i, n) { int t; int d; cin >> t >> d; sushi.push_back(make_pair(d, t)); } ll base = 0LL, cnt = 0LL; sort(sushi.begin(), sushi.end()); reverse(sushi.begin(), sushi.end()); priority_queue<int, vector<int>, greater<int>> que; REP(i, k) { base += sushi[i].first; if (!used[sushi[i].second]) { used[sushi[i].second] = true; cnt++; } else que.push(sushi[i].first); } ll ans = base + cnt * cnt; for (int i = k; i < n; ++i) { if (cnt >= k) break; if (used[sushi[i].second]) continue; used[sushi[i].second] = true; cnt++; int m = que.top(); que.pop(); base -= m; base += sushi[i].first; ans = max(ans, base + cnt * cnt); } cout << ans << endl; return 0; }
[ "control_flow.branch.else_if.replace.remove", "control_flow.branch.if.replace.add", "call.arguments.change" ]
947,542
947,543
u604896914
cpp
p03148
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; ll k, n; typedef pair<ll, ll> P; set<ll> bonus; vector<P> sushi; int main() { cin >> n >> k; priority_queue<P, vector<P>, greater<P>> p1; priority_queue<P> p2; for (int i = 0; i < n; i++) { ll t, d; cin >> t >> d; sushi.push_back(P(d, t)); p2.push(P(d, t)); } sort(sushi.begin(), sushi.end(), greater<P>()); ll ans = 0; ll x = 0; for (int i = 0; i < k; i++) { if (bonus.find(sushi[i].second) == bonus.end()) { x++; bonus.insert(sushi[i].second); } else { p1.push(sushi[i]); } ans += sushi[i].first; } ans += x * x; // cout << ans << endl; ll E = 1; ll tmp = ans - 1; while (!p2.empty()) { if (p1.empty()) break; P a = p1.top(); p1.pop(); tmp -= a.first; while (!p2.empty()) { P b = p2.top(); p2.pop(); if (bonus.find(b.second) == bonus.end()) { bonus.insert(b.second); tmp += b.first; // cout << tmp << endl; // cout <<b.first<<" "<<b.second<<endl; ans = max(ans, tmp + (x + E) * (x + E)); E++; break; } } } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; ll k, n; typedef pair<ll, ll> P; set<ll> bonus; vector<P> sushi; int main() { cin >> n >> k; priority_queue<P, vector<P>, greater<P>> p1; priority_queue<P> p2; for (int i = 0; i < n; i++) { ll t, d; cin >> t >> d; sushi.push_back(P(d, t)); p2.push(P(d, t)); } sort(sushi.begin(), sushi.end(), greater<P>()); ll ans = 0; ll x = 0; for (int i = 0; i < k; i++) { if (bonus.find(sushi[i].second) == bonus.end()) { x++; bonus.insert(sushi[i].second); } else { p1.push(sushi[i]); } ans += sushi[i].first; } ans += x * x; // cout << ans << endl; ll E = 1; ll tmp = ans - x * x; while (!p2.empty()) { if (p1.empty()) break; P a = p1.top(); p1.pop(); tmp -= a.first; while (!p2.empty()) { P b = p2.top(); p2.pop(); if (bonus.find(b.second) == bonus.end()) { bonus.insert(b.second); tmp += b.first; // cout << tmp << endl; // cout <<b.first<<" "<<b.second<<endl; ans = max(ans, tmp + (x + E) * (x + E)); E++; break; } } } cout << ans << endl; }
[ "identifier.replace.add", "literal.replace.remove", "expression.operation.binary.change" ]
947,547
947,548
u126361752
cpp
p03148
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; int main() { // cin ใฎ้ซ˜้€ŸๅŒ–ใ‚‰ใ—ใ„ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> sushi; for (int i = 0; i < n; i++) { int t, d; cin >> t >> d; t--; sushi.push_back({d, t}); } sort(sushi.begin(), sushi.end()); // ใŠใ„ใ—ใ•้ †ใซๆ˜‡้ †ใ‚ฝใƒผใƒˆ reverse(sushi.begin(), sushi.end()); // ๆ˜‡้ †ใ‹ใ‚‰้™้ †ใธ vector<bool> usd(n, false); // nๅ€‹ใฎ้…ๅˆ—ใซใ™ในใฆfalse long long ans = 0; long long score = 0; int cnt = 0; // kๅ€‹ใซ้ธใฐใ‚Œใชใ‹ใฃใŸๅฏฟๅธ้” priority_queue<int> unused_repr; // kๅ€‹ใซ้ธใฐใ‚ŒใŸใŒไบŒๅ€‹็›ฎไปฅไธŠใ ใฃใŸๅฏฟๅธ้” // ๅฐใ•ใ„ใ‚‚ใฎใ‹ใ‚‰ๅ–ใ‚Šๅ‡บใ›ใ‚‹ๅ„ชๅ…ˆๅบฆไป˜ใใ‚ญใƒฅใƒผ priority_queue<int, vector<int>, greater<int>> used_subj; for (int i = 0; i < n; i++) { auto sus = sushi[i]; int d = sus.first; int t = sus.second; if (usd[i]) { if (i < k) { score += d; // ใ“ใฎ็จฎ้กžใŒไบŒๅ€‹ไปฅไธŠใฎใจใใฏๆถˆใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก used_subj.push(d); } } else { usd[t] = true; if (i < k) { score += d + 2 * cnt + 1; cnt++; } else { // k+1็•ช็›ฎไปฅ้™ใฎๅฏฟๅธใงไฝฟใ‚ใ‚Œใฆใ„ใชใ„ใ‚‚ใฎใฏ่ฟฝๅŠ ใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก unused_repr.push(d); } } } ans = score; while (!unused_repr.empty() && !used_subj.empty()) { int repr = unused_repr.top(); unused_repr.pop(); int subj = used_subj.top(); used_subj.pop(); score += (long long)repr - subj + 2 * cnt + 1; cnt++; ans = max(ans, score); } cout << ans << '\n'; return 0; }
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; int main() { // cin ใฎ้ซ˜้€ŸๅŒ–ใ‚‰ใ—ใ„ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> sushi; for (int i = 0; i < n; i++) { int t, d; cin >> t >> d; t--; sushi.push_back({d, t}); } sort(sushi.begin(), sushi.end()); // ใŠใ„ใ—ใ•้ †ใซๆ˜‡้ †ใ‚ฝใƒผใƒˆ reverse(sushi.begin(), sushi.end()); // ๆ˜‡้ †ใ‹ใ‚‰้™้ †ใธ vector<bool> usd(n, false); // nๅ€‹ใฎ้…ๅˆ—ใซใ™ในใฆfalse long long ans = 0; long long score = 0; int cnt = 0; // kๅ€‹ใซ้ธใฐใ‚Œใชใ‹ใฃใŸๅฏฟๅธ้” priority_queue<int> unused_repr; // kๅ€‹ใซ้ธใฐใ‚ŒใŸใŒไบŒๅ€‹็›ฎไปฅไธŠใ ใฃใŸๅฏฟๅธ้” // ๅฐใ•ใ„ใ‚‚ใฎใ‹ใ‚‰ๅ–ใ‚Šๅ‡บใ›ใ‚‹ๅ„ชๅ…ˆๅบฆไป˜ใใ‚ญใƒฅใƒผ priority_queue<int, vector<int>, greater<int>> used_subj; for (int i = 0; i < n; i++) { auto sus = sushi[i]; int d = sus.first; int t = sus.second; if (usd[t]) { if (i < k) { score += d; // ใ“ใฎ็จฎ้กžใŒไบŒๅ€‹ไปฅไธŠใฎใจใใฏๆถˆใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก used_subj.push(d); } } else { usd[t] = true; if (i < k) { score += d + 2 * cnt + 1; cnt++; } else { // k+1็•ช็›ฎไปฅ้™ใฎๅฏฟๅธใงไฝฟใ‚ใ‚Œใฆใ„ใชใ„ใ‚‚ใฎใฏ่ฟฝๅŠ ใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก unused_repr.push(d); } } } ans = score; while (!unused_repr.empty() && !used_subj.empty()) { int repr = unused_repr.top(); unused_repr.pop(); int subj = used_subj.top(); used_subj.pop(); score += (long long)repr - subj + 2 * cnt + 1; cnt++; ans = max(ans, score); } cout << ans << endl; return 0; }
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "io.output.change" ]
947,561
947,562
u725458677
cpp
p03148
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; int main() { // cin ใฎ้ซ˜้€ŸๅŒ–ใ‚‰ใ—ใ„ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> sushi; for (int i = 0; i < n; i++) { int t, d; cin >> t >> d; t--; sushi.push_back({d, t}); } sort(sushi.begin(), sushi.end()); // ใŠใ„ใ—ใ•้ †ใซๆ˜‡้ †ใ‚ฝใƒผใƒˆ reverse(sushi.begin(), sushi.end()); // ๆ˜‡้ †ใ‹ใ‚‰้™้ †ใธ vector<bool> usd(n, false); // nๅ€‹ใฎ้…ๅˆ—ใซใ™ในใฆfalse long long ans = 0; long long score = 0; int cnt = 0; // kๅ€‹ใซ้ธใฐใ‚Œใชใ‹ใฃใŸๅฏฟๅธ้” priority_queue<int> unused_repr; // kๅ€‹ใซ้ธใฐใ‚ŒใŸใŒไบŒๅ€‹็›ฎไปฅไธŠใ ใฃใŸๅฏฟๅธ้” // ๅฐใ•ใ„ใ‚‚ใฎใ‹ใ‚‰ๅ–ใ‚Šๅ‡บใ›ใ‚‹ๅ„ชๅ…ˆๅบฆไป˜ใใ‚ญใƒฅใƒผ priority_queue<int, vector<int>, greater<int>> used_subj; for (int i = 0; i < n; i++) { auto sus = sushi[i]; int d = sus.first; int t = sus.second; if (usd[i]) { if (i < k) { score += d; // ใ“ใฎ็จฎ้กžใŒไบŒๅ€‹ไปฅไธŠใฎใจใใฏๆถˆใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก used_subj.push(d); } } else { usd[t] = true; if (i < k) { score += d + 2 * cnt + 1; cnt++; } else { // k+1็•ช็›ฎไปฅ้™ใฎๅฏฟๅธใงไฝฟใ‚ใ‚Œใฆใ„ใชใ„ใ‚‚ใฎใฏ่ฟฝๅŠ ใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก unused_repr.push(d); } } } ans = score; while (!unused_repr.empty() && !used_subj.empty()) { int repr = unused_repr.top(); unused_repr.pop(); int subj = used_subj.top(); used_subj.pop(); score += (long long)repr - subj + 2 * cnt + 1; cnt++; ans = max(ans, score); } cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; int main() { // cin ใฎ้ซ˜้€ŸๅŒ–ใ‚‰ใ—ใ„ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> sushi; for (int i = 0; i < n; i++) { int t, d; cin >> t >> d; t--; sushi.push_back({d, t}); } sort(sushi.begin(), sushi.end()); // ใŠใ„ใ—ใ•้ †ใซๆ˜‡้ †ใ‚ฝใƒผใƒˆ reverse(sushi.begin(), sushi.end()); // ๆ˜‡้ †ใ‹ใ‚‰้™้ †ใธ vector<bool> usd(n, false); // nๅ€‹ใฎ้…ๅˆ—ใซใ™ในใฆfalse long long ans = 0; long long score = 0; int cnt = 0; // kๅ€‹ใซ้ธใฐใ‚Œใชใ‹ใฃใŸๅฏฟๅธ้” priority_queue<int> unused_repr; // kๅ€‹ใซ้ธใฐใ‚ŒใŸใŒไบŒๅ€‹็›ฎไปฅไธŠใ ใฃใŸๅฏฟๅธ้” // ๅฐใ•ใ„ใ‚‚ใฎใ‹ใ‚‰ๅ–ใ‚Šๅ‡บใ›ใ‚‹ๅ„ชๅ…ˆๅบฆไป˜ใใ‚ญใƒฅใƒผ priority_queue<int, vector<int>, greater<int>> used_subj; for (int i = 0; i < n; i++) { auto sus = sushi[i]; int d = sus.first; int t = sus.second; if (usd[t]) { if (i < k) { score += d; // ใ“ใฎ็จฎ้กžใŒไบŒๅ€‹ไปฅไธŠใฎใจใใฏๆถˆใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก used_subj.push(d); } } else { usd[t] = true; if (i < k) { score += d + 2 * cnt + 1; cnt++; } else { // k+1็•ช็›ฎไปฅ้™ใฎๅฏฟๅธใงไฝฟใ‚ใ‚Œใฆใ„ใชใ„ใ‚‚ใฎใฏ่ฟฝๅŠ ใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก unused_repr.push(d); } } } ans = score; while (!unused_repr.empty() && !used_subj.empty()) { int repr = unused_repr.top(); unused_repr.pop(); int subj = used_subj.top(); used_subj.pop(); score += (long long)repr - subj + 2 * cnt + 1; cnt++; ans = max(ans, score); } cout << ans << endl; return 0; }
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
947,563
947,562
u725458677
cpp
p03148
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; int main() { // cin ใฎ้ซ˜้€ŸๅŒ–ใ‚‰ใ—ใ„ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> sushi; for (int i = 0; i < n; i++) { int t, d; cin >> t >> d; t--; sushi.push_back({d, t}); } sort(sushi.begin(), sushi.end()); // ใŠใ„ใ—ใ•้ †ใซๆ˜‡้ †ใ‚ฝใƒผใƒˆ reverse(sushi.begin(), sushi.end()); // ๆ˜‡้ †ใ‹ใ‚‰้™้ †ใธ vector<bool> usd(n, false); // nๅ€‹ใฎ้…ๅˆ—ใซใ™ในใฆfalse long long ans = 0; long long score = 0; int cnt = 0; // kๅ€‹ใซ้ธใฐใ‚Œใชใ‹ใฃใŸๅฏฟๅธ้” priority_queue<int> unused_repr; // kๅ€‹ใซ้ธใฐใ‚ŒใŸใŒไบŒๅ€‹็›ฎไปฅไธŠใ ใฃใŸๅฏฟๅธ้” // ๅฐใ•ใ„ใ‚‚ใฎใ‹ใ‚‰ๅ–ใ‚Šๅ‡บใ›ใ‚‹ๅ„ชๅ…ˆๅบฆไป˜ใใ‚ญใƒฅใƒผ priority_queue<int, vector<int>, greater<int>> used_subj; for (int i = 0; i < n; i++) { auto sus = sushi[i]; int d = sus.first; int t = sus.second; if (usd[i]) { if (i < k) { score += d; // ใ“ใฎ็จฎ้กžใŒไบŒๅ€‹ไปฅไธŠใฎใจใใฏๆถˆใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก used_subj.push(d); } } else { usd[t] = true; if (i < k) { score += d + 2 * cnt + 1; cnt++; } else { // k+1็•ช็›ฎไปฅ้™ใฎๅฏฟๅธใงไฝฟใ‚ใ‚Œใฆใ„ใชใ„ใ‚‚ใฎใฏ่ฟฝๅŠ ใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก unused_repr.push(d); } } } ans = score; while (!unused_repr.empty() && !used_subj.empty()) { int repr = unused_repr.top(); unused_repr.pop(); int subj = used_subj.top(); used_subj.pop(); score += (long long)repr - subj + 2 * cnt + 1; cnt++; ans = max(ans, score); } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; int main() { // cin ใฎ้ซ˜้€ŸๅŒ–ใ‚‰ใ—ใ„ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> sushi; for (int i = 0; i < n; i++) { int t, d; cin >> t >> d; t--; sushi.push_back({d, t}); } sort(sushi.begin(), sushi.end()); // ใŠใ„ใ—ใ•้ †ใซๆ˜‡้ †ใ‚ฝใƒผใƒˆ reverse(sushi.begin(), sushi.end()); // ๆ˜‡้ †ใ‹ใ‚‰้™้ †ใธ vector<bool> usd(n, false); // nๅ€‹ใฎ้…ๅˆ—ใซใ™ในใฆfalse long long ans = 0; long long score = 0; int cnt = 0; // kๅ€‹ใซ้ธใฐใ‚Œใชใ‹ใฃใŸๅฏฟๅธ้” priority_queue<int> unused_repr; // kๅ€‹ใซ้ธใฐใ‚ŒใŸใŒไบŒๅ€‹็›ฎไปฅไธŠใ ใฃใŸๅฏฟๅธ้” // ๅฐใ•ใ„ใ‚‚ใฎใ‹ใ‚‰ๅ–ใ‚Šๅ‡บใ›ใ‚‹ๅ„ชๅ…ˆๅบฆไป˜ใใ‚ญใƒฅใƒผ priority_queue<int, vector<int>, greater<int>> used_subj; for (int i = 0; i < n; i++) { auto sus = sushi[i]; int d = sus.first; int t = sus.second; if (usd[t]) { if (i < k) { score += d; // ใ“ใฎ็จฎ้กžใŒไบŒๅ€‹ไปฅไธŠใฎใจใใฏๆถˆใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก used_subj.push(d); } } else { usd[t] = true; if (i < k) { score += d + 2 * cnt + 1; cnt++; } else { // k+1็•ช็›ฎไปฅ้™ใฎๅฏฟๅธใงไฝฟใ‚ใ‚Œใฆใ„ใชใ„ใ‚‚ใฎใฏ่ฟฝๅŠ ใ•ใ‚Œใ‚‹ไบˆๅ‚™่ปใจใ—ใฆไฟ็ฎก unused_repr.push(d); } } } ans = score; while (!unused_repr.empty() && !used_subj.empty()) { int repr = unused_repr.top(); unused_repr.pop(); int subj = used_subj.top(); used_subj.pop(); score += (long long)repr - subj + 2 * cnt + 1; cnt++; ans = max(ans, score); } cout << ans << endl; return 0; }
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "control_flow.return.add", "control_flow.return.0.add" ]
947,564
947,562
u725458677
cpp
p03148
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define repf(i, f, l) for (int i = f; i < (int)l; ++i) #define repit(it, t) \ for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) #define endl "\n" #define pb emplace_back #define lb lower_bound #define int long long #define ul unsigned long #define ull unsigned long long #define ll long long #define INF 1000000007 #define MOD 1000000007 #define fs first #define sd second #define DBG0(x) \ { cout << #x << ": " << x << "\t"; } #define DBG(x) \ { \ DBG0(x); \ cout << endl; \ } #define DBG2(x, y) \ { \ DBG0(x); \ DBG(y); \ } #define DBG3(x, y, z) \ { \ DBG0(x); \ DBG2(y, z); \ } #define DBG4(w, x, y, z) \ { \ DBG0(w); \ DBG3(x, y, z); \ } typedef vector<int> vint; typedef vector<ll> vll; typedef vector<ul> vul; typedef vector<ull> vull; typedef vector<bool> vbl; typedef pair<int, int> pii; signed main(void) { ios::sync_with_stdio(false); int n, k; cin >> n >> k; vint ts = vint(n); vint ds = vint(n); rep(i, n) { cin >> ts[i] >> ds[i]; } int kds; { set<int> s; rep(i, n) s.insert(ts[i]); kds = s.size() > k ? k : s.size(); } vector<pii> dss; rep(i, n) dss.push_back(pii(ds[i], ts[i])); sort(dss.begin(), dss.end()); reverse(dss.begin(), dss.end()); vint ans = vint(n, -1); map<int, int> mp = map<int, int>(); set<int> types; priority_queue<pii, vector<pii>, std::greater<pii>> que; priority_queue<pii, vector<pii>> get_que; int t_ans = 0; rep(i, n) { if (i < k) { que.push(dss[i]); t_ans += dss[i].fs; int ttt = dss[i].sd; if (mp.find(ttt) == mp.end()) { mp.insert(pii(ttt, 1)); } else { mp[ttt]++; } } else { get_que.push(dss[i]); } } int init_k = mp.size(); ans[init_k] = t_ans + init_k * init_k; repf(i, init_k + 1, kds + 1) { while (true) { pii dt = que.top(); que.pop(); int d = dt.fs; int t = dt.sd; if (mp[t] == 1) continue; t_ans -= d; mp[t]--; while (true) { pii newdt = get_que.top(); get_que.pop(); int dd = newdt.fs; int tt = newdt.sd; if (mp.find(tt) != mp.end()) { continue; } t_ans += dd; mp.insert(pii(tt, 1)); break; } break; } ans[i] = t_ans + i * i; } int fans = -1; rep(i, n) { fans = fans > ans[i] ? fans : ans[i]; } cout << fans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define repf(i, f, l) for (int i = f; i < (int)l; ++i) #define repit(it, t) \ for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) #define endl "\n" #define pb emplace_back #define lb lower_bound #define int long long #define ul unsigned long #define ull unsigned long long #define ll long long #define INF 1000000007 #define MOD 1000000007 #define fs first #define sd second #define DBG0(x) \ { cout << #x << ": " << x << "\t"; } #define DBG(x) \ { \ DBG0(x); \ cout << endl; \ } #define DBG2(x, y) \ { \ DBG0(x); \ DBG(y); \ } #define DBG3(x, y, z) \ { \ DBG0(x); \ DBG2(y, z); \ } #define DBG4(w, x, y, z) \ { \ DBG0(w); \ DBG3(x, y, z); \ } typedef vector<int> vint; typedef vector<ll> vll; typedef vector<ul> vul; typedef vector<ull> vull; typedef vector<bool> vbl; typedef pair<int, int> pii; signed main(void) { ios::sync_with_stdio(false); int n, k; cin >> n >> k; vint ts = vint(n); vint ds = vint(n); rep(i, n) { cin >> ts[i] >> ds[i]; } int kds; { set<int> s; rep(i, n) s.insert(ts[i]); kds = s.size() > k ? k : s.size(); } vector<pii> dss; rep(i, n) dss.push_back(pii(ds[i], ts[i])); sort(dss.begin(), dss.end()); reverse(dss.begin(), dss.end()); vint ans = vint(n + 1, -1); map<int, int> mp = map<int, int>(); set<int> types; priority_queue<pii, vector<pii>, std::greater<pii>> que; priority_queue<pii, vector<pii>> get_que; int t_ans = 0; rep(i, n) { if (i < k) { que.push(dss[i]); t_ans += dss[i].fs; int ttt = dss[i].sd; if (mp.find(ttt) == mp.end()) { mp.insert(pii(ttt, 1)); } else { mp[ttt]++; } } else { get_que.push(dss[i]); } } int init_k = mp.size(); ans[init_k] = t_ans + init_k * init_k; repf(i, init_k + 1, kds + 1) { while (true) { pii dt = que.top(); que.pop(); int d = dt.fs; int t = dt.sd; if (mp[t] == 1) continue; t_ans -= d; mp[t]--; while (true) { pii newdt = get_que.top(); get_que.pop(); int dd = newdt.fs; int tt = newdt.sd; if (mp.find(tt) != mp.end()) { continue; } t_ans += dd; mp.insert(pii(tt, 1)); break; } break; } ans[i] = t_ans + i * i; } int fans = -1; rep(i, n + 1) { fans = fans > ans[i] ? fans : ans[i]; } cout << fans << endl; return 0; }
[ "assignment.change", "expression.operation.binary.add" ]
947,571
947,572
u880359730
cpp
p03148
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; #define INF (1 << (4 * 4 - 1)) #define MOD 1000000007 #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin(), a.rend() struct SegmentTree { int n; vector<ll> node; SegmentTree(vector<ll> v) { int sz = v.size(); n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, 0); for (int i = 0; i < sz; i++) node[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; i--) node[i] = node[2 * i + 1] + node[2 * i + 2]; } void update(ll x, ll val) { x += (n - 1); node[x] = val; while (x > 0) { x = (x - 1) / 2; node[x] = node[2 * x + 1] + node[2 * x + 2]; } } }; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector<pair<ll, ll>> sushi; for (int i = 0; i < N; i++) { ll value, kind; cin >> kind >> value; sushi.push_back({value, kind}); } sort(rrng(sushi)); // for(auto it:sushi)cout<<it.first<<" "<<it.second<<endl; ll fx = 0; ll x = 0; vector<bool> usedx(N + 1, false); vector<ll> firstnum; // for(auto it:sushi)cout<<it.first<<" "<<it.second<<endl; // cout<<endl; for (int i = 0; i < K; i++) { if (!usedx[sushi[i].second]) { x++; firstnum.insert(firstnum.begin(), sushi[i].first); } else { firstnum.insert(firstnum.end(), sushi[i].first); } usedx[sushi[i].second] = true; } vector<ll> new_sushi; for (auto it : sushi) { // cout<<it.second<<endl; if (!usedx[it.second]) new_sushi.push_back(it.first); usedx[it.second] = true; } // cout<<fx<<endl; // for(auto it:firstnum)cout<<it<<endl; // for(auto it:sushi)cout<<it.first<<" "<<it.second<<endl; SegmentTree seg(firstnum); ll Max = 0; for (int i = 0; i + x <= K; i++) { if (i != 0) { if (i - 1 < new_sushi.size()) seg.update(firstnum.size() - i, new_sushi[i - 1]); } ll res = seg.node[0]; res += (i + x) * (i + x); Max = max(Max, res); // cout<<i<<" "<<res<<endl; // for(int i=0;i<seg.n;i++)cout<<seg.node[seg.n-1+i]<<" "; // cout<<endl; } cout << Max << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; #define INF (1 << (4 * 4 - 1)) #define MOD 1000000007 #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin(), a.rend() struct SegmentTree { int n; vector<ll> node; SegmentTree(vector<ll> v) { int sz = v.size(); n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, 0); for (int i = 0; i < sz; i++) node[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; i--) node[i] = node[2 * i + 1] + node[2 * i + 2]; } void update(ll x, ll val) { x += (n - 1); node[x] = val; while (x > 0) { x = (x - 1) / 2; node[x] = node[2 * x + 1] + node[2 * x + 2]; } } }; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, K; cin >> N >> K; vector<pair<ll, ll>> sushi; for (int i = 0; i < N; i++) { ll value, kind; cin >> kind >> value; sushi.push_back({value, kind}); } sort(rrng(sushi)); // for(auto it:sushi)cout<<it.first<<" "<<it.second<<endl; ll fx = 0; ll x = 0; vector<bool> usedx(N + 1, false); vector<ll> firstnum; // for(auto it:sushi)cout<<it.first<<" "<<it.second<<endl; // cout<<endl; for (int i = 0; i < K; i++) { if (!usedx[sushi[i].second]) { x++; firstnum.insert(firstnum.begin(), sushi[i].first); } else { firstnum.insert(firstnum.end(), sushi[i].first); } usedx[sushi[i].second] = true; } vector<ll> new_sushi; for (auto it : sushi) { // cout<<it.second<<endl; if (!usedx[it.second]) new_sushi.push_back(it.first); usedx[it.second] = true; } // cout<<fx<<endl; // for(auto it:firstnum)cout<<it<<endl; // for(auto it:sushi)cout<<it.first<<" "<<it.second<<endl; SegmentTree seg(firstnum); ll Max = 0; for (int i = 0; i + x <= K; i++) { if (i != 0) { if (i - 1 < new_sushi.size()) seg.update(firstnum.size() - i, new_sushi[i - 1]); else continue; } ll res = seg.node[0]; res += (i + x) * (i + x); Max = max(Max, res); // cout<<i<<" "<<res<<endl; // for(int i=0;i<seg.n;i++)cout<<seg.node[seg.n-1+i]<<" "; // cout<<endl; } cout << Max << endl; return 0; }
[ "control_flow.branch.else_if.replace.remove", "control_flow.branch.if.replace.add" ]
947,587
947,588
u864171425
cpp
p03148
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; int N, K; vector<P> dt; ll calc(int x) { ll point = (ll)x * x; int cnt = 0; set<int> us; vector<bool> ate(N, false); for (int i = 0; i < N; i++) { int d = dt[i].first, t = dt[i].second; if (us.find(t) == end(us)) { point += d; cnt++; us.insert(t); ate[i] = true; if (cnt == x) break; } } if (cnt == K) return point; for (int i = 0; i < N; i++) { if (!ate[i]) { point += dt[i].first; cnt++; if (cnt == K) return point; } } } int main() { cin.tie(0); ios::sync_with_stdio(0); cin >> N >> K; dt = vector<P>(N); set<int> us; for (int i = 0; i < N; i++) { int t, d; cin >> t >> d; dt.push_back(P(d, t)); us.insert(t); } sort(begin(dt), end(dt), greater<>()); int lx = 0, rx = min(K, (int)us.size()); while (rx - lx > 3) { int d = (rx - lx) / 3; int ax = lx + d, bx = rx - d; ll ap = calc(ax), bp = calc(bx); if (ap <= bp) lx = ax; else rx = bx; } ll ma = 0; for (int x = lx; x <= rx; x++) { ma = max(ma, calc(x)); } cout << ma << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; int N, K; vector<P> dt; ll calc(int x) { ll point = (ll)x * x; int cnt = 0; set<int> us; vector<bool> ate(N, false); for (int i = 0; i < N; i++) { int d = dt[i].first, t = dt[i].second; if (us.find(t) == end(us)) { point += d; cnt++; us.insert(t); ate[i] = true; if (cnt == x) break; } } if (cnt == K) return point; for (int i = 0; i < N; i++) { if (!ate[i]) { point += dt[i].first; cnt++; if (cnt == K) return point; } } } int main() { cin.tie(0); ios::sync_with_stdio(0); cin >> N >> K; dt = vector<P>(N); set<int> us; for (int i = 0; i < N; i++) { int t, d; cin >> t >> d; dt.push_back(P(d, t)); us.insert(t); } sort(begin(dt), end(dt), greater<>()); int lx = 1, rx = min(K, (int)us.size()); while (rx - lx > 3) { int d = (rx - lx) / 3; int ax = lx + d, bx = rx - d; ll ap = calc(ax), bp = calc(bx); if (ap <= bp) lx = ax; else rx = bx; } ll ma = 0; for (int x = lx; x <= rx; x++) { ma = max(ma, calc(x)); } cout << ma << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
947,612
947,613
u639989198
cpp
p03148
#include <algorithm> #include <complex> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N, K; P sushi[101000]; bool used[101000]; priority_queue<P, vector<P>, greater<P>> q; ll g[101000]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) { ll t, d; cin >> t >> d; t--; sushi[i] = P(d, t); } sort(sushi, sushi + N); reverse(sushi, sushi + N); fill(used, used + N, false); ll kind = 0; ll p_sum = 0; for (int i = 0; i < K; i++) { p_sum += sushi[i].first; if (!used[sushi[i].second]) { used[sushi[i].second] = true; kind++; } else { q.push(sushi[i]); } } fill(g, g + N, 0); g[kind] = p_sum + kind * kind; for (int i = K; i < N; i++) { if (q.empty()) { break; } if (used[sushi[i].second]) { continue; } used[sushi[i].second] = true; p_sum += sushi[i].first; P x = q.top(); q.pop(); p_sum -= x.first; kind++; g[kind] = p_sum + kind * kind; } ll res = 0; for (int i = 0; i < N; i++) { res = max(res, g[i]); } cout << res << endl; return 0; }
#include <algorithm> #include <complex> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N, K; P sushi[101000]; bool used[101000]; priority_queue<P, vector<P>, greater<P>> q; ll g[101000]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) { ll t, d; cin >> t >> d; t--; sushi[i] = P(d, t); } sort(sushi, sushi + N); reverse(sushi, sushi + N); fill(used, used + N, false); ll kind = 0; ll p_sum = 0; for (int i = 0; i < K; i++) { p_sum += sushi[i].first; if (!used[sushi[i].second]) { used[sushi[i].second] = true; kind++; } else { q.push(sushi[i]); } } fill(g, g + N, 0); g[kind] = p_sum + kind * kind; for (int i = K; i < N; i++) { if (q.empty()) { break; } if (used[sushi[i].second]) { continue; } used[sushi[i].second] = true; p_sum += sushi[i].first; P x = q.top(); q.pop(); p_sum -= x.first; kind++; g[kind] = p_sum + kind * kind; } ll res = 0; for (int i = 1; i <= N; i++) { res = max(res, g[i]); } cout << res << endl; return 0; }
[ "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" ]
947,614
947,615
u852158538
cpp
p03148
#include <algorithm> #include <complex> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N, K; P sushi[101000]; bool used[101000]; priority_queue<P, vector<P>, greater<P>> q; ll g[101000]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) { ll t, d; cin >> t >> d; t--; sushi[i] = P(d, t); } sort(sushi, sushi + N); reverse(sushi, sushi + N); fill(used, used + N, false); int kind = 0; ll p_sum = 0; for (int i = 0; i < K; i++) { p_sum += sushi[i].first; if (!used[sushi[i].second]) { used[sushi[i].second] = true; kind++; } else { q.push(sushi[i]); } } fill(g, g + N, 0); g[kind] = p_sum + kind * kind; for (int i = K; i < N; i++) { if (q.empty()) { break; } if (used[sushi[i].second]) { continue; } used[sushi[i].second] = true; p_sum += sushi[i].first; P x = q.top(); q.pop(); p_sum -= x.first; kind++; g[kind] = p_sum + kind * kind; } ll res = 0; for (int i = 0; i < N; i++) { res = max(res, g[i]); } cout << res << endl; return 0; }
#include <algorithm> #include <complex> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N, K; P sushi[101000]; bool used[101000]; priority_queue<P, vector<P>, greater<P>> q; ll g[101000]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) { ll t, d; cin >> t >> d; t--; sushi[i] = P(d, t); } sort(sushi, sushi + N); reverse(sushi, sushi + N); fill(used, used + N, false); ll kind = 0; ll p_sum = 0; for (int i = 0; i < K; i++) { p_sum += sushi[i].first; if (!used[sushi[i].second]) { used[sushi[i].second] = true; kind++; } else { q.push(sushi[i]); } } fill(g, g + N, 0); g[kind] = p_sum + kind * kind; for (int i = K; i < N; i++) { if (q.empty()) { break; } if (used[sushi[i].second]) { continue; } used[sushi[i].second] = true; p_sum += sushi[i].first; P x = q.top(); q.pop(); p_sum -= x.first; kind++; g[kind] = p_sum + kind * kind; } ll res = 0; for (int i = 1; i <= N; i++) { res = max(res, g[i]); } cout << res << endl; return 0; }
[ "variable_declaration.type.change", "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" ]
947,616
947,615
u852158538
cpp
p03148
#include <bits/stdc++.h> using namespace std; typedef struct node { int x, y; bool operator<(const struct node &n) const { return y > n.y; } } NODE, *PNODE; NODE a[100005]; int n, k, cnt = 0; int visited[100005]; stack<int> s; int main() { int i; long long ans = 0, res = 0, type = 0; scanf("%d%d", &n, &k); for (i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y); sort(a + 1, a + 1 + n); for (i = 1; i <= n; i++) { if (cnt < k) { if (!visited[a[i].x]) { visited[a[i].x] = 1; type++; } else s.push(a[i].y); res += a[i].y; cnt++; ans = max(ans, res + type * type); } else { if (s.empty()) break; if (visited[a[i].x]) continue; visited[a[i].x] = 1; type++; res += a[i].y; res -= s.top(); s.pop(); ans = max(ans, res + type * type); } } printf("%d", ans); return 0; }
#include <bits/stdc++.h> using namespace std; typedef struct node { int x, y; bool operator<(const struct node &n) const { return y > n.y; } } NODE, *PNODE; NODE a[100005]; int n, k, cnt = 0; int visited[100005]; stack<int> s; int main() { int i; long long ans = 0, res = 0, type = 0; scanf("%d%d", &n, &k); for (i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y); sort(a + 1, a + 1 + n); for (i = 1; i <= n; i++) { if (cnt < k) { if (!visited[a[i].x]) { visited[a[i].x] = 1; type++; } else s.push(a[i].y); res += a[i].y; cnt++; ans = max(ans, res + type * type); } else { if (s.empty()) break; if (visited[a[i].x]) continue; visited[a[i].x] = 1; type++; res += a[i].y; res -= s.top(); s.pop(); ans = max(ans, res + type * type); } } printf("%lld", ans); return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
947,621
947,622
u314499126
cpp
p03148
#include <bits/stdc++.h> using namespace std; typedef struct node { int x, y; bool operator<(const struct node &n) const { return y > n.y; } } NODE, *PNODE; NODE a[100005]; int n, k, cnt = 0; int visited[100005]; stack<int> s; int main() { int i; long long ans = 0, res = 0, type = 0; scanf("%d%d", &n, &k); for (i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y); sort(a + 1, a + 1 + n); for (i = 1; i <= n; i++) { if (cnt < k) { if (!visited[a[i].x]) { visited[a[i].x] = true; type++; } else s.push(a[i].y); res += a[i].y; cnt++; ans = max(ans, res + type * type); } else { if (s.empty()) break; if (visited[a[i].x]) continue; visited[a[i].x] = true; type++; res += a[i].y; res -= s.top(); s.pop(); ans = max(ans, res + type * type); } } printf("%d", ans); return 0; }
#include <bits/stdc++.h> using namespace std; typedef struct node { int x, y; bool operator<(const struct node &n) const { return y > n.y; } } NODE, *PNODE; NODE a[100005]; int n, k, cnt = 0; int visited[100005]; stack<int> s; int main() { int i; long long ans = 0, res = 0, type = 0; scanf("%d%d", &n, &k); for (i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y); sort(a + 1, a + 1 + n); for (i = 1; i <= n; i++) { if (cnt < k) { if (!visited[a[i].x]) { visited[a[i].x] = 1; type++; } else s.push(a[i].y); res += a[i].y; cnt++; ans = max(ans, res + type * type); } else { if (s.empty()) break; if (visited[a[i].x]) continue; visited[a[i].x] = 1; type++; res += a[i].y; res -= s.top(); s.pop(); ans = max(ans, res + type * type); } } printf("%lld", ans); return 0; }
[ "assignment.value.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
947,623
947,622
u314499126
cpp
p03148
#include <algorithm> #include <cstdio> #include <map> typedef long long ll; #define PII pair<ll, ll> #define T second #define D first using namespace std; ll n, k, sum, ans; PII a[100005]; map<ll, ll> mp; int main() { ll i, j, sz; scanf("%lld%lld", &n, &k); for (i = 0; i < n; i++) scanf("%lld%lld", &a[i].T, &a[i].D); sort(a, a + n, greater<PII>()); for (i = 0; i < k; i++) { mp[a[i].T]++; sum += a[i].D; } sz = mp.size(); ans = sum + sz * sz; j = k - 1; for (; i < n; i++) { if (mp.count(a[i].T)) continue; mp[a[i].T]++; while (j >= 0 && mp[a[j].T] == 1) j--; if (j < 0) break; sum += a[i].D - a[j].D; mp[a[j].T]--; sz = mp.size(); ans = max(ans, sum + sz * sz); } printf("%lld", ans); return 0; }
#include <algorithm> #include <cstdio> #include <map> typedef long long ll; #define PII pair<ll, ll> #define T second #define D first using namespace std; ll n, k, sum, ans; PII a[100005]; map<ll, ll> mp; int main() { ll i, j, sz; scanf("%lld%lld", &n, &k); for (i = 0; i < n; i++) scanf("%lld%lld", &a[i].T, &a[i].D); sort(a, a + n, greater<PII>()); for (i = 0; i < k; i++) { mp[a[i].T]++; sum += a[i].D; } sz = mp.size(); ans = sum + sz * sz; j = k - 1; for (; i < n; i++) { if (mp.count(a[i].T)) continue; mp[a[i].T]++; while (j >= 0 && mp[a[j].T] == 1) j--; if (j < 0) break; sum += a[i].D - a[j].D; mp[a[j].T]--; j--; sz = mp.size(); ans = max(ans, sum + sz * sz); } printf("%lld", ans); return 0; }
[ "expression.unary.arithmetic.add" ]
947,628
947,629
u093170535
cpp
p03149
#include <bits/stdc++.h> #include <cmath> #include <list> #include <stdio.h> #include <string.h> using namespace std; int main() { int N[4]; cin >> N[0] >> N[1] >> N[2] >> N[3]; int check[4] = {0, 0, 0, 0}; for (int i = 0; i < 4; i++) { if (N[i] = 1) check[0] = 1; if (N[i] = 4) check[1] = 1; if (N[i] = 7) check[2] = 1; if (N[i] = 9) check[3] = 1; } if (check[0] == 1 && check[1] == 1 && check[2] == 1 && check[3] == 1) { cout << "YES" << endl; } else cout << "NO" << endl; }
#include <bits/stdc++.h> #include <cmath> #include <list> #include <stdio.h> #include <string.h> using namespace std; int main() { int N[4]; cin >> N[0] >> N[1] >> N[2] >> N[3]; int check[4] = {0, 0, 0, 0}; for (int i = 0; i < 4; i++) { if (N[i] == 1) check[0] = 1; if (N[i] == 4) check[1] = 1; if (N[i] == 7) check[2] = 1; if (N[i] == 9) check[3] = 1; } if (check[0] == 1 && check[1] == 1 && check[2] == 1 && check[3] == 1) { cout << "YES" << endl; } else cout << "NO" << endl; }
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
947,668
947,669
u650243369
cpp
p03149
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; int n[4]; int main() { cin >> n[0] >> n[1] >> n[2] >> n[3]; sort(n, n + 4); if (n[0] == 1) if (n[1] == 4) if (n[2] == 7) if (n[3] == 9) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; int n[4]; int main() { cin >> n[0] >> n[1] >> n[2] >> n[3]; sort(n, n + 4); if (n[0] == 1) if (n[1] == 4) if (n[2] == 7) if (n[3] == 9) { cout << "YES" << endl; return 0; } cout << "NO" << endl; return 0; }
[ "control_flow.return.add" ]
947,676
947,677
u876442898
cpp
p03149
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; signed main() { int a[4]; cin >> a[0] >> a[1] >> a[2] >> a[3]; sort(a, a + 4); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) { puts("Yes"); } else puts("No"); }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; signed main() { int a[4]; cin >> a[0] >> a[1] >> a[2] >> a[3]; sort(a, a + 4); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) { puts("YES"); } else puts("NO"); }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
947,682
947,683
u016612263
cpp
p03149
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> #define int long long #define ll \ getchar(); \ getchar(); \ return 0; using namespace std; bool prime(int n) { int cnt = 0; for (int i = 1; i <= sqrt(n); i++) { if (n % i == 0) cnt++; } if (cnt != 1) return false; else return n != 1; } int gcd(int x, int y) { int ans; for (int i = (min(x, y)); i >= 1; i--) { if (x % i == 0 && y % i == 0) { ans = i; break; } } return ans; } int yakusuunowa(int n) { int ans = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) ans += i; } return ans; } int lcm(int x, int y) { return x * y / gcd(x, y); } int ketanowa(int n) { int cnt = 0, sum = 0; for (int i = 10; i <= n * 10; i *= 10) { if (i == 10) cnt += n % i; else sum += (n % i - n % (i / 10)) / (i / 10); } return cnt + sum; } signed main() { int cnta = 0, cntb = 0, cntc = 0, cntd = 0; int a[3]; for (int i = 0; i < 4; i++) cin >> a[i]; for (int i = 0; i < 4; i++) { if (a[i] == '1') cnta++; else if (a[i] == '9') cntb++; else if (a[i] == '7') cntc++; else if (a[i] == '4') cntd++; } if (cnta == 1 && cntb == 1 && cntc == 1 && cntd == 1) puts("YES"); else puts("NO"); ll }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> #define int long long #define ll \ getchar(); \ getchar(); \ return 0; using namespace std; bool prime(int n) { int cnt = 0; for (int i = 1; i <= sqrt(n); i++) { if (n % i == 0) cnt++; } if (cnt != 1) return false; else return n != 1; } int gcd(int x, int y) { int ans; for (int i = (min(x, y)); i >= 1; i--) { if (x % i == 0 && y % i == 0) { ans = i; break; } } return ans; } int yakusuunowa(int n) { int ans = 0; for (int i = 1; i <= n; i++) { if (n % i == 0) ans += i; } return ans; } int lcm(int x, int y) { return x * y / gcd(x, y); } int ketanowa(int n) { int cnt = 0, sum = 0; for (int i = 10; i <= n * 10; i *= 10) { if (i == 10) cnt += n % i; else sum += (n % i - n % (i / 10)) / (i / 10); } return cnt + sum; } signed main() { int cnta = 0, cntb = 0, cntc = 0, cntd = 0; char a[4]; for (int i = 0; i < 4; i++) cin >> a[i]; for (int i = 0; i < 4; i++) { if (a[i] == '1') cnta++; else if (a[i] == '9') cntb++; else if (a[i] == '7') cntc++; else if (a[i] == '4') cntd++; } if (cnta == 1 && cntb == 1 && cntc == 1 && cntd == 1) puts("YES"); else puts("NO"); ll }
[ "variable_declaration.type.primitive.change", "literal.number.change", "variable_declaration.array_dimensions.change" ]
947,686
947,687
u971256474
cpp
p03149
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(4); cin >> a[0] >> a[1] >> a[2] >> a[3]; sort(a.begin(), a.end()); if (a[0] != 1 || a[1] != 7 || a[2] != 9 || a[3] != 4) { cout << "NO" << "\n"; } else { cout << "YES" << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(4); cin >> a[0] >> a[1] >> a[2] >> a[3]; sort(a.begin(), a.end()); if (a[0] != 1 || a[1] != 4 || a[2] != 7 || a[3] != 9) { cout << "NO" << "\n"; } else { cout << "YES" << "\n"; } return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
947,698
947,699
u319242216
cpp
p03149
#include <iostream> using namespace std; int main() { int x[4], a = 0, b = 0, c = 0, d = 0; for (int i = 0; i < 4; i++) cin >> x[i]; for (int i = 0; i < 4; i++) { switch (x[i]) { case 1: a = 1; break; case 9: b = 1; break; case 7: c = 1; break; case 4: d = 1; break; } } cout << ((a & b & c & d) ? "OK" : "NG") << endl; return 0; }
#include <iostream> using namespace std; int main() { int x[4], a = 0, b = 0, c = 0, d = 0; for (int i = 0; i < 4; i++) cin >> x[i]; for (int i = 0; i < 4; i++) { switch (x[i]) { case 1: a = 1; break; case 9: b = 1; break; case 7: c = 1; break; case 4: d = 1; break; } } cout << ((a & b & c & d) ? "YES" : "NO") << endl; return 0; }
[ "literal.string.change", "io.output.change" ]
947,707
947,708
u759663933
cpp
p03149
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == 1 || b == 1 || c == 1 || d == 1) { if (a == 4 || b == 4 || c == 4 || d == 4) { if (a == 7 || b == 7 || c == 7 || d == 7) { if (a == 9 == b == 9 || c == 9 || d == 9) { cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == 1 || b == 1 || c == 1 || d == 1) { if (a == 4 || b == 4 || c == 4 || d == 4) { if (a == 7 || b == 7 || c == 7 || d == 7) { if (a == 9 || b == 9 || c == 9 || d == 9) { cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; return 0; }
[ "control_flow.branch.if.condition.change" ]
947,713
947,714
u923238225
cpp
p03149
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #define ll long long #define mod 1000000007 #define maxn 10000010 inline ll read() { ll x = 0; char c = getchar(), f = 1; for (; c < '0' || '9' < c; c = getchar()) if (c == '-') f = -1; for (; '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0'; return x * f; } inline void write(ll x) { static char buff[20], len; len = 0; if (x < 0) putchar('-'), x = -x; for (; x; x /= 10) buff[len++] = x % 10; if (!len) putchar('0'); else while (len) putchar(buff[--len] + '0'); } inline void writeln(ll x) { write(x); putchar('\n'); } inline void writesp(ll x) { write(x); putchar(' '); } int a[4]; int main() { for (int i = 1; i <= 4; i++) a[i] = read(); std::sort(a + 1, a + 5); if (a[1] == 1 && a[2] == 4 && a[3] == 7 && a[4] == 9) printf("Yes\n"); else printf("No\n"); }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #define ll long long #define mod 1000000007 #define maxn 10000010 inline ll read() { ll x = 0; char c = getchar(), f = 1; for (; c < '0' || '9' < c; c = getchar()) if (c == '-') f = -1; for (; '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0'; return x * f; } inline void write(ll x) { static char buff[20], len; len = 0; if (x < 0) putchar('-'), x = -x; for (; x; x /= 10) buff[len++] = x % 10; if (!len) putchar('0'); else while (len) putchar(buff[--len] + '0'); } inline void writeln(ll x) { write(x); putchar('\n'); } inline void writesp(ll x) { write(x); putchar(' '); } int a[4]; int main() { for (int i = 1; i <= 4; i++) a[i] = read(); std::sort(a + 1, a + 5); if (a[1] == 1 && a[2] == 4 && a[3] == 7 && a[4] == 9) printf("YES\n"); else printf("NO\n"); }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
947,715
947,716
u245106490
cpp
p03149
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(4); for (int i = 0; i < 4; i++) { cin >> a[i]; } sort(a.begin(), a.end()); if (a[0] == 1 && a[1] == 4 && a[3] == 7 && a[3] == 9) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(4); for (int i = 0; i < 4; i++) { cin >> a[i]; } sort(a.begin(), a.end()); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES" << endl; else cout << "NO" << endl; }
[ "literal.number.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
947,717
947,718
u654240084
cpp
p03149
#include <bits/stdc++.h> using namespace std; #define int long long int a[4]; signed main() { cin.tie(0); ios::sync_with_stdio(false); int n[4]; for (int i = 0; i < 4; i++) { cin >> n[i]; } for (int i = 0; i < 4; i++) { if (n[i] == 1) a[0]++; if (n[i] == 7) a[1]++; if (n[i] == 9) a[2]++; if (n[i] == 4) a[3]++; } int ans = 0; for (int i = 0; i < 4; i++) { ans |= a[i]; } cout << (ans == 1 ? "YES" : "NO") << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long int a[4]; signed main() { cin.tie(0); ios::sync_with_stdio(false); int n[4]; for (int i = 0; i < 4; i++) { cin >> n[i]; } for (int i = 0; i < 4; i++) { if (n[i] == 1) a[0]++; if (n[i] == 7) a[1]++; if (n[i] == 9) a[2]++; if (n[i] == 4) a[3]++; } int ans = 1; for (int i = 0; i < 4; i++) { ans &= a[i]; } cout << (ans == 1 ? "YES" : "NO") << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "expression.operator.change" ]
947,721
947,722
u344122377
cpp
p03149
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int a[4]; int main() { int i, j, k; scanf("%d%d%d%d", &a[1], &a[2], &a[3], &a[0]); sort(a, a + 3); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) printf("YES\n"); else printf("NO\n"); return 0; }
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int a[4]; int main() { int i, j, k; scanf("%d%d%d%d", &a[1], &a[2], &a[3], &a[0]); sort(a, a + 4); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) printf("YES\n"); else printf("NO\n"); return 0; }
[ "literal.number.change", "call.arguments.change", "expression.operation.binary.change" ]
947,723
947,724
u792421324
cpp
p03149
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int a[4]; int main() { int i, j, k; scanf("%d%d%d%d", &a[1], &a[2], &a[3], &a[0]); sort(a, a + 3); if (a[1] == 1 && a[2] == 4 && a[3] == 7 && a[4] == 9) printf("YES\n"); else printf("NO\n"); return 0; }
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int a[4]; int main() { int i, j, k; scanf("%d%d%d%d", &a[1], &a[2], &a[3], &a[0]); sort(a, a + 4); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) printf("YES\n"); else printf("NO\n"); return 0; }
[ "literal.number.change", "call.arguments.change", "expression.operation.binary.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
947,725
947,724
u792421324
cpp
p03149
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int a[4]; int main() { int i, j, k; scanf("%d%d%d%d", &a[1], &a[2], &a[3], &a[4]); sort(a, a + 3); if (a[1] == 1 && a[2] == 4 && a[3] == 7 && a[4] == 9) printf("YES\n"); else printf("NO\n"); return 0; }
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int a[4]; int main() { int i, j, k; scanf("%d%d%d%d", &a[1], &a[2], &a[3], &a[0]); sort(a, a + 4); if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) printf("YES\n"); else printf("NO\n"); return 0; }
[ "literal.number.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
947,726
947,724
u792421324
cpp
p03149
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; #define ll long long #define ull unsigned long long #define rep(i, N) for (int i = 0; i < N; i++) #define loop(i, N, M) for (int i = N; i < M; i++) #define MAX(v) *max_element(v.begin(), v.end()) #define MIN(v) *min_element(v.begin(), v.end()) #define SORTL2S(type, v) sort(v.begin(), v.end(), greater<type>()) #define SORTS2L(type, v) sort(v.begin(), v.end()) #define SORTMF(v, func) sort(v.begin(), v.end(), func) //ๅค‰ๆ•ฐ ll H, W; vector<int> vec(4); //่งฃๆณ• void solve() { SORTS2L(int, vec); if (vec[0] == 1 && vec[1] == 4 && vec[2] == 7 && vec[3] == 9) { cout << "YES"; } else { cout << "No"; } return; } int main() { //ๅ…ฅๅŠ› // cin >> H>>W; rep(i, 4) cin >> vec[i]; solve(); cout << endl; return 0; }
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; #define ll long long #define ull unsigned long long #define rep(i, N) for (int i = 0; i < N; i++) #define loop(i, N, M) for (int i = N; i < M; i++) #define MAX(v) *max_element(v.begin(), v.end()) #define MIN(v) *min_element(v.begin(), v.end()) #define SORTL2S(type, v) sort(v.begin(), v.end(), greater<type>()) #define SORTS2L(type, v) sort(v.begin(), v.end()) #define SORTMF(v, func) sort(v.begin(), v.end(), func) //ๅค‰ๆ•ฐ ll H, W; vector<int> vec(4); //่งฃๆณ• void solve() { SORTS2L(int, vec); if (vec[0] == 1 && vec[1] == 4 && vec[2] == 7 && vec[3] == 9) { cout << "YES"; } else { cout << "NO"; } return; } int main() { //ๅ…ฅๅŠ› // cin >> H>>W; rep(i, 4) cin >> vec[i]; solve(); cout << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,727
947,728
u426855695
cpp
p03149
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == 1 || b == 1 || c == 1 || d == 1) { if (a == 4 || b == 4 || c == 4 || d == 4) { if (a == 7 || b == 7 || c == 7 || d == 7) { if (a == 9 || b == 9 || c == 9 || d == 9) { cout << "Yes" << endl; return 0; } } } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a == 1 || b == 1 || c == 1 || d == 1) { if (a == 4 || b == 4 || c == 4 || d == 4) { if (a == 7 || b == 7 || c == 7 || d == 7) { if (a == 9 || b == 9 || c == 9 || d == 9) { cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,729
947,730
u077536797
cpp
p03150
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #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 << 63) - 600; const ll mod = 1e9 + 7; const int MAX = 1000000; const int MOD = 1000000007; int main() { string S; cin >> S; int N = S.size(); string T = "keyence"; rep(i, N) { rep(j, 8) { if (S.substr(0, j) + S.substr(N - 7 + j, 7 - j) == T) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; }
#include <algorithm> #include <assert.h> #include <bitset> #include <complex> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stack> #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 << 61) - 600; const ll mod = 1e9 + 7; const int MAX = 1000000; const int MOD = 1000000007; int main() { string S; cin >> S; int N = S.size(); string T = "keyence"; rep(i, N) { rep(j, 8) { if (S.substr(0, j) + S.substr(N - 7 + j, 7 - j) == T) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; }
[ "literal.number.change", "expression.operation.binary.change", "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,737
947,738
u841131859
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define int long long const int MOD = 1000000007; const int di[4] = {1, 0, -1, 0}; const int dj[4] = {0, 1, 0, -1}; signed main() { string s; cin >> s; int n = (int)s.size(); for (int l = 0; l < n; l++) { for (int r = l; r < n; r++) { string t = ""; for (int k = 0; k < n; k++) { if (l <= k && k <= r) continue; t = t + s[k]; } if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long const int MOD = 1000000007; const int di[4] = {1, 0, -1, 0}; const int dj[4] = {0, 1, 0, -1}; signed main() { string s; cin >> s; int n = (int)s.size(); for (int l = 0; l < n; l++) { for (int r = l; r <= n; r++) { string t = ""; for (int k = 0; k < n; k++) { if (l <= k && k < r) continue; t = t + s[k]; } if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
947,739
947,740
u212904724
cpp
p03150
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int N = S.size(); int subN = N - 7; if (subN < 0) { cout << "NO" << endl; return 0; } for (int i = 0; i < N; i++) { string first = S.substr(0, i); string middle = S.substr(i, subN); string last = S.substr(i + subN); string ans = first + last; // cout << ans << endl; if (ans == "keyence") { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int N = S.size(); int subN = N - 7; if (subN < 0) { cout << "NO" << endl; return 0; } for (int i = 0; i < N - subN + 1; i++) { string first = S.substr(0, i); string middle = S.substr(i, subN); string last = S.substr(i + subN); string ans = first + last; // cout << ans << endl; if (ans == "keyence") { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
[ "control_flow.loop.for.condition.change" ]
947,741
947,742
u521973174
cpp
p03150
#include <bits/stdc++.h> #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++) #define rep(i, n) FOR(i, 0, n) using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a > b) return false; a = b; return true; } template <class T> bool chmin(T &a, const T &b) { if (a < b) return false; a = b; return true; } /*-------------------------------------------*/ string key = "keyence"; string s; int main() { cin >> s; int num = 0; int i = 0, j = s.size() - 1, k = 6; while (i < 6 && s[i] == key[i]) { i++; num++; } while (k >= 0 && s[j] == key[k]) { j--; k--; num++; } cout << (num >= 7 ? "Yes\n" : "NO\n"); }
#include <bits/stdc++.h> #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++) #define rep(i, n) FOR(i, 0, n) using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a > b) return false; a = b; return true; } template <class T> bool chmin(T &a, const T &b) { if (a < b) return false; a = b; return true; } /*-------------------------------------------*/ string key = "keyence"; string s; int main() { cin >> s; int num = 0; int i = 0, j = s.size() - 1, k = 6; while (i < 6 && s[i] == key[i]) { i++; num++; } while (k >= 0 && s[j] == key[k]) { j--; k--; num++; } cout << (num >= 7 ? "YES\n" : "NO\n"); }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,747
947,748
u047554023
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n); i >= 0; i--) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define REVSORT(c) \ SORT(c); \ REVERSE(c) #define ALL(x) (x).begin(), (x).end() #define INF 1e9 const long long MOD = 1000000007; typedef long long ll; int main() { string S; cin >> S; int N = S.length(); N--; const string K = "keyence"; bool JD = false; if (S.find(K) != string::npos) { JD = true; } else { JD = false; for (int i = 1; i < 7; i++) { string L = S.substr(0, 7 - i); string R = S.substr(N - i, i); if (L + R == K) { JD = true; break; } } } cout << ((JD) ? "YES" : "NO") << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n); i >= 0; i--) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define REVSORT(c) \ SORT(c); \ REVERSE(c) #define ALL(x) (x).begin(), (x).end() #define INF 1e9 const long long MOD = 1000000007; typedef long long ll; int main() { string S; cin >> S; int N = S.length(); const string K = "keyence"; bool JD = false; if (S.find(K) != string::npos) { JD = true; } else { JD = false; for (int i = 1; i < 7; i++) { string L = S.substr(0, 7 - i); string R = S.substr(N - i, i); if (L + R == K) { JD = true; break; } } } cout << ((JD) ? "YES" : "NO") << endl; }
[ "expression.unary.arithmetic.remove" ]
947,751
947,752
u615258936
cpp
p03150
#include <bits/stdc++.h> using namespace std; using ll = long long; using pa = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vector<ll>>; const ll MOD = 1e9 + 7; const ll INF = 1e14; const long double EPS = 1e-11; #define eb emplace_back #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define repe(i, l, r) for (int i = (l); i < (r); i++) #define reper(i, l, r) for (int i = (r)-1; i >= (l); i--) void init() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } //--------------------------------------------------------------------------------// int main() { init(); string s, k = "keyence"; cin >> s; int N = s.size(); bool isok = false; rep(i, N - 7) { string t = s.substr(0, i) + s.substr(N - 7 + i, 7 - i); // cout << s.substr(0, i) << " " << s.substr(N - 7 + i, 7 - i) << endl; if (t == k) { isok = true; break; } } cout << (isok ? "YES" : "NO") << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using pa = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vector<ll>>; const ll MOD = 1e9 + 7; const ll INF = 1e14; const long double EPS = 1e-11; #define eb emplace_back #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define repe(i, l, r) for (int i = (l); i < (r); i++) #define reper(i, l, r) for (int i = (r)-1; i >= (l); i--) void init() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } //--------------------------------------------------------------------------------// int main() { init(); string s, k = "keyence"; cin >> s; int N = s.size(); bool isok = false; rep(i, 8) { string t = s.substr(0, i) + s.substr(N - 7 + i, 7 - i); // cout << s.substr(0, i) << " " << s.substr(N - 7 + i, 7 - i) << endl; if (t == k) { isok = true; break; } } cout << (isok ? "YES" : "NO") << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
947,765
947,766
u722535636
cpp
p03150
#include <bits/stdc++.h> using namespace std; bool f() { string s; cin >> s; string a = "keyence"; int l = s.size(); if (l < 7) return false; for (int i = 0; i < 8; i++) { if (s.substr(0, i) != a.substr(0, i)) continue; int j = 7 - i; if (s.substr(l - 1 - j, j) == a.substr(6 - j, j)) return true; } return false; } int main() { if (f()) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; bool f() { string s; cin >> s; string a = "keyence"; int l = s.size(); if (l < 7) return false; for (int i = 0; i < 8; i++) { if (s.substr(0, i) != a.substr(0, i)) return false; int j = 7 - i; if (s.substr(l - j, j) == a.substr(7 - j, j)) return true; } return false; } int main() { if (f()) cout << "YES" << endl; else cout << "NO" << endl; }
[ "control_flow.continue.remove", "control_flow.return.add", "function.return_value.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "literal.number.change", "control_flow.branch.if.condition.change" ]
947,773
947,774
u946322619
cpp
p03150
#include <bits/stdc++.h> using namespace std; bool f() { string s; cin >> s; string a = "keyence"; int l = s.size(); if (l < 7) return false; for (int i = 0; i < 8; i++) { if (s.substr(0, i) != a.substr(0, i)) continue; int j = 7 - i; if (s.substr(l - 1 - j, j) == a.substr(6 - j, j)) return true; } return false; } int main() { if (f()) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; bool f() { string s; cin >> s; string a = "keyence"; int l = s.size(); if (l < 7) return false; for (int i = 0; i < 8; i++) { if (s.substr(0, i) != a.substr(0, i)) continue; int j = 7 - i; if (s.substr(l - j, j) == a.substr(7 - j, j)) return true; } return false; } int main() { if (f()) cout << "YES" << endl; else cout << "NO" << endl; }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "literal.number.change", "control_flow.branch.if.condition.change" ]
947,773
947,775
u946322619
cpp
p03150
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; long long modpow(long long m, long long n) { if (n == 0) return 1; if (n % 2 == 0) { long long t = modpow(m, n / 2); return t / 2; } else { return modpow(m, n - 1) * m; } } int main() { string s, t; cin >> s; for (int j = 0; j < 7; j++) { t = s; t.erase(j, s.size() - 7); if (t == "keyence") { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; long long modpow(long long m, long long n) { if (n == 0) return 1; if (n % 2 == 0) { long long t = modpow(m, n / 2); return t / 2; } else { return modpow(m, n - 1) * m; } } int main() { string s, t; cin >> s; for (int j = 0; j < 7; j++) { t = s; t.erase(j, s.size() - 7); if (t == "keyence") { cout << "YES" << endl; return 0; } } cout << "NO" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,780
947,781
u687204015
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string S, keyence; int sizedif; cin >> S; keyence = "keyence"; sizedif = S.size() - 7; for (int k = 0; k < 7; k++) { if (S.at(k) != keyence.at(k)) { if (S.compare(k + sizedif, 7 - k, keyence, k, 7 - k) == 0) cout << "Yes" << endl; else cout << "No" << endl; return 0; } } cout << "Yes" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S, keyence; int sizedif; cin >> S; keyence = "keyence"; sizedif = S.size() - 7; for (int k = 0; k < 7; k++) { if (S.at(k) != keyence.at(k)) { if (S.compare(k + sizedif, 7 - k, keyence, k, 7 - k) == 0) cout << "YES" << endl; else cout << "NO" << endl; return 0; } } cout << "YES" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,782
947,783
u302893919
cpp
p03150
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { string S = "keyence"; string A, T; cin >> A; rep(i, S.size()) { rep(j, S.size()) { T = A; T.erase(i, j); if (T == S) { cout << "Yes"; return 0; } } } cout << "No"; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { string S = "keyence"; string A, T; cin >> A; rep(i, A.size()) { rep(j, A.size()) { T = A; T.erase(i, j); if (T == S) { cout << "YES"; return 0; } } } cout << "NO"; return 0; }
[ "identifier.change", "call.arguments.change", "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,798
947,797
u764860452
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define int long long #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define co(a) cout << a << endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp() pop_back() #define V vector #define P pair #define V2(a, b, c) V<V<int>> a(b, V<int>(c)) #define V2a(a, b, c, d) V<V<int>> a(b, V<int>(c, d)) #define incin(a) \ int a; \ cin >> a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(), a.end()), a.end()) #define pri priority_queue #define syo <int,V<int> #define ff fi.fi #define fs fi.se #define sf se.fi #define ss se.se //#define min min<int> //#define max max<int> template <class T> void cou(vector<vector<T>> a) { int b = a.size(); int c = a[0].size(); fo(i, b) { fo(j, c) { cout << a[i][j]; if (j == c - 1) cout << endl; else cout << ' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int keta(int a) { double b = a; b = log10(b); int c = b; return c + 1; } int souwa(int a) { return a * (a + 1) / 2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } */ int gcm(int a, int b) { int d = a, e = b, f; if (a < b) swap(a, b); int c, m = 1; while (m) { c = a % b; if (c == 0) { f = b; m--; } else { a = b; b = c; } } return f; } bool prime(int a) { if (a < 2) return false; else if (a == 2) return true; else if (a % 2 == 0) return false; double b = sqrt(a); for (int i = 3; i <= b; i += 2) { if (a % i == 0) { return false; } } return true; } struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) return a; else return par[a] = find(par[a]); } bool same(int a, int b) { return find(a) == find(b); } int Size(int a) { return -par[find(a)]; } void unite(int a, int b) { a = find(a); b = find(b); if (a == b) return; if (Size(b) > Size(a)) swap<int>(a, b); par[a] += par[b]; par[b] = a; } }; int ketas(int a) { string b = to_string(a); int c = 0; fo(i, keta(a)) { c += b[i] - '0'; } return c; } /*int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); }*/ int lcm(int a, int b) { return a / gcm(a, b) * b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ bool fe(int a, int b) { a %= 10; b %= 10; if (a == 0) a = 10; if (b == 0) b = 10; if (a > b) return true; else return false; } int INF = 1000000007; struct edge { int s, t, d; }; V<int> mojisyu(string a) { V<int> b(26, 0); fo(i, a.sz) { b[a[i] - 'a']++; } return b; } int wa2(int a) { if (a % 2 == 1) return a / 2; return a / 2 - 1; } signed main() { string a; cin >> a; int b = 0; string c = "keyense"; fo(i, a.sz) { if (a[i] == c[i]) b++; else break; } fo(i, a.sz) { if (a[a.sz - 1 - i] == c[c.sz - 1 - i]) b++; else break; } if (b >= 7) cout << "YES" << endl; else cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define co(a) cout << a << endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp() pop_back() #define V vector #define P pair #define V2(a, b, c) V<V<int>> a(b, V<int>(c)) #define V2a(a, b, c, d) V<V<int>> a(b, V<int>(c, d)) #define incin(a) \ int a; \ cin >> a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(), a.end()), a.end()) #define pri priority_queue #define syo <int,V<int> #define ff fi.fi #define fs fi.se #define sf se.fi #define ss se.se //#define min min<int> //#define max max<int> template <class T> void cou(vector<vector<T>> a) { int b = a.size(); int c = a[0].size(); fo(i, b) { fo(j, c) { cout << a[i][j]; if (j == c - 1) cout << endl; else cout << ' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int keta(int a) { double b = a; b = log10(b); int c = b; return c + 1; } int souwa(int a) { return a * (a + 1) / 2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } */ int gcm(int a, int b) { int d = a, e = b, f; if (a < b) swap(a, b); int c, m = 1; while (m) { c = a % b; if (c == 0) { f = b; m--; } else { a = b; b = c; } } return f; } bool prime(int a) { if (a < 2) return false; else if (a == 2) return true; else if (a % 2 == 0) return false; double b = sqrt(a); for (int i = 3; i <= b; i += 2) { if (a % i == 0) { return false; } } return true; } struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) return a; else return par[a] = find(par[a]); } bool same(int a, int b) { return find(a) == find(b); } int Size(int a) { return -par[find(a)]; } void unite(int a, int b) { a = find(a); b = find(b); if (a == b) return; if (Size(b) > Size(a)) swap<int>(a, b); par[a] += par[b]; par[b] = a; } }; int ketas(int a) { string b = to_string(a); int c = 0; fo(i, keta(a)) { c += b[i] - '0'; } return c; } /*int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); }*/ int lcm(int a, int b) { return a / gcm(a, b) * b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ bool fe(int a, int b) { a %= 10; b %= 10; if (a == 0) a = 10; if (b == 0) b = 10; if (a > b) return true; else return false; } int INF = 1000000007; struct edge { int s, t, d; }; V<int> mojisyu(string a) { V<int> b(26, 0); fo(i, a.sz) { b[a[i] - 'a']++; } return b; } int wa2(int a) { if (a % 2 == 1) return a / 2; return a / 2 - 1; } signed main() { string a; cin >> a; int b = 0; string c = "keyence"; fo(i, a.sz) { if (a[i] == c[i]) b++; else break; } fo(i, a.sz) { if (a[a.sz - 1 - i] == c[c.sz - 1 - i]) b++; else break; } if (b >= 7) cout << "YES" << endl; else cout << "NO" << endl; }
[ "literal.string.change", "variable_declaration.value.change" ]
947,806
947,807
u322177979
cpp
p03150
#include <bits/stdc++.h> using namespace std; const string X = "keyofscience"; int main() { string S; cin >> S; int N = (int)S.size(); for (int i = 0; i <= N; i++) { for (int j = i; j <= N; j++) { if ((i == 0 && j == 0) || (i == N && j == N)) { if (S == X) { cout << "YES" << endl; return 0; } } string T = S.substr(0, i) + S.substr(j, N - j); if (T == X) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const string X = "keyence"; int main() { string S; cin >> S; int N = (int)S.size(); for (int i = 0; i <= N; i++) { for (int j = i; j <= N; j++) { if ((i == 0 && j == 0) || (i == N && j == N)) { if (S == X) { cout << "YES" << endl; return 0; } } string T = S.substr(0, i) + S.substr(j, N - j); if (T == X) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "variable_declaration.value.change" ]
947,822
947,823
u904123392
cpp
p03150
#include <bits/stdc++.h> using namespace std; const string X = "keyofscience"; int main() { string S; cin >> S; int N = (int)S.size(); for (int i = 0; i <= N; i++) { for (int j = i; j <= N; j++) { if ((i == 0 && j == 0) || (i == N && j == N)) { if (S == X) { cout << "Yes" << endl; return 0; } } string T = S.substr(0, i) + S.substr(j, N - j); if (T == X) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const string X = "keyence"; int main() { string S; cin >> S; int N = (int)S.size(); for (int i = 0; i <= N; i++) { for (int j = i; j <= N; j++) { if ((i == 0 && j == 0) || (i == N && j == N)) { if (S == X) { cout << "YES" << endl; return 0; } } string T = S.substr(0, i) + S.substr(j, N - j); if (T == X) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "variable_declaration.value.change", "literal.string.case.change", "io.output.change" ]
947,824
947,823
u904123392
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define reps(i, n) for (int i = 1; i <= (n); ++i) #define all(x) (x).begin(), (x).end() //#define int long long using pii = pair<int, int>; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; signed main() { string s; char a[10] = {'k', 'e', 'y', 'e', 'n', 'c', 'e'}; cin >> s; int n = s.size(); if (s[0] == 'k' && s[1] == 'e' && s[2] == 'y' && s[3] == 'e' && s[4] == 'n' && s[5] == 'c' && s[6] == 'e') { cout << "YES\n"; } else if (s[n - 1] == 'e' && s[n - 2] == 'c' && s[n - 3] == 'n' && s[n - 4] == 'e' && s[n - 5] == 'y' && s[n - 6] == 'e' && s[n - 7] == 'k') cout << "YES\n"; else { int cnt = 0; rep(i, 7) { if (s[i] == a[i]) cnt++; else break; } for (int i = n - (7 - cnt); i < n; i++) { if (s[i] == a[cnt]) cnt++; else { cout << "No\n"; return 0; } } cout << "YES\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define reps(i, n) for (int i = 1; i <= (n); ++i) #define all(x) (x).begin(), (x).end() //#define int long long using pii = pair<int, int>; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; signed main() { string s; char a[10] = {'k', 'e', 'y', 'e', 'n', 'c', 'e'}; cin >> s; int n = s.size(); if (s[0] == 'k' && s[1] == 'e' && s[2] == 'y' && s[3] == 'e' && s[4] == 'n' && s[5] == 'c' && s[6] == 'e') { cout << "YES\n"; } else if (s[n - 1] == 'e' && s[n - 2] == 'c' && s[n - 3] == 'n' && s[n - 4] == 'e' && s[n - 5] == 'y' && s[n - 6] == 'e' && s[n - 7] == 'k') cout << "YES\n"; else { int cnt = 0; rep(i, 7) { if (s[i] == a[i]) cnt++; else break; } for (int i = n - (7 - cnt); i < n; i++) { if (s[i] == a[cnt]) cnt++; else { cout << "NO\n"; return 0; } } cout << "YES\n"; } return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,829
947,830
u803754262
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { const string k = "keyence"; string s; cin >> s; if (s == k) { cout << "YES" << endl; return 0; } int l = s.length(); for (int i = 0; i < l; i++) { for (int j = i; j < l; j++) { string S = ""; for (int si = 0; si < l; si++) { if (i <= si && si <= j) { continue; } else S.push_back(s[si]); } if (S == k) { cout << "YES" << endl; return 0; } } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { const string k = "keyence"; string s; cin >> s; if (s == k) { cout << "YES" << endl; return 0; } int l = s.length(); for (int i = 0; i < l; i++) { for (int j = i; j < l; j++) { string S = ""; for (int si = 0; si < l; si++) { if (i <= si && si <= j) { continue; } else S.push_back(s[si]); } if (S == k) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,837
947,838
u904833081
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { const string k = "keyence"; string s; cin >> s; if (s == k) { cout << "YES" << endl; return 0; } int l = s.length(); for (int i = 0; i < l; i++) { for (int j = i + 1; j < l + 1; j++) { string S = ""; for (int si = 0; si < l; si++) { if (i <= si && si < j) { continue; } else S.push_back(s[si]); } if (S == k) { cout << "YES" << endl; return 0; } } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { const string k = "keyence"; string s; cin >> s; if (s == k) { cout << "YES" << endl; return 0; } int l = s.length(); for (int i = 0; i < l; i++) { for (int j = i; j < l; j++) { string S = ""; for (int si = 0; si < l; si++) { if (i <= si && si <= j) { continue; } else S.push_back(s[si]); } if (S == k) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "control_flow.loop.for.initializer.change", "expression.operation.binary.remove", "control_flow.loop.for.condition.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change", "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,839
947,838
u904833081
cpp
p03150
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; #define intmax INT_MAX #define lmax LONG_MAX #define uintmax UINT_MAX #define ulmax ULONG_MAX #define llmax LLONG_MAX #define ll long long #define rep(i, a, N) for ((i) = (a); (i) < (N); (i)++) #define rrp(i, N, a) for ((i) = (N)-1; (i) >= (a); (i)--) #define llfor ll i, j #define sc(a) cin >> a #define pr(a) cout << a << endl #define pY puts("YES") #define pN puts("NO") #define py puts("Yes") #define pn puts("No") #define pnn printf("\n") #define pb(b) push_back(b) #define all(a) a.begin(), a.end() #define llvec vector<vector<ll>> #define charvec vector<vector<char>> #define size(a, b) (a, vector<ll>(b)) const int mod = 1e9 + 7; /* UnionFind๏ผš็ด ้›†ๅˆ็ณป็ฎก็†ใฎๆง‹้€ ไฝ“(union by size) isSame(x, y): x ใจ y ใŒๅŒใ˜้›†ๅˆใซใ„ใ‚‹ใ‹ใ€‚ ่จˆ็ฎ—้‡ใฏใชใ‚‰ใ— O(ฮฑ(n)) unite(x, y): x ใจ y ใ‚’ๅŒใ˜้›†ๅˆใซใ™ใ‚‹ใ€‚่จˆ็ฎ—้‡ใฏใชใ‚‰ใ— O(ฮฑ(n)) treeSize(x): x ใ‚’ๅซใ‚€้›†ๅˆใฎ่ฆ็ด ๆ•ฐใ€‚ */ struct UnionFind { vector<int> size, parents; UnionFind() {} UnionFind(int n) { // make n trees. size.resize(n, 0); parents.resize(n, 0); for (int i = 0; i < n; i++) makeTree(i); } void makeTree(int x) { parents[x] = x; // the parent of x is x size[x] = 1; } bool isSame(int x, int y) { return findRoot(x) == findRoot(y); } bool unite(int x, int y) { x = findRoot(x); y = findRoot(y); if (x == y) return false; if (size[x] > size[y]) { parents[y] = x; size[x] += size[y]; } else { parents[x] = y; size[y] += size[x]; } return true; } int findRoot(int x) { //ๆœจใฎๆ นใ‚’ๆŽขใ™,่จˆ็ฎ—้‡ๅ‰Šๆธ›ใฎใŸใ‚ไฝŽใ if (x != parents[x]) parents[x] = findRoot(parents[x]); return parents[x]; } int treeSize(int x) { return size[findRoot(x)]; } }; /*pi*/ const double pi = acos(-1); /*็นฐใ‚ŠไธŠใ’้™ค็ฎ—*/ ll cei(ll x, ll y) { ll ans = x / y; if (x % y != 0) ans++; return ans; } /*ๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐ*/ ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } /*ๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ*/ ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } /*nไน—*/ ll llpow(ll x, ll n) { ll i, ans = 1; rep(i, 0, n) ans *= x; return ans; } /*้šŽไน—*/ ll fact(ll x) { ll i, ans = 1; rep(i, 0, x) ans *= (x - i); return ans; } /*nCr*/ ll ncr(ll n, ll r) { return fact(n) / fact(r) / fact(n - r); } /*nPr*/ ll npr(ll n, ll r) { return fact(n) / fact(n - r); } /*primejudge*/ bool prime(ll a) { if (a <= 1) return false; ll i; for (i = 2; i * i <= a; i++) { if (a % i == 0) return false; } return true; } /*Fibonacciๆ•ฐๅˆ—*/ ll fib(ll x) { ll i, fibo[x + 10]; fibo[0] = 1; fibo[1] = 1; fibo[2] = 1; rep(i, 3, x + 1) fibo[i] = fibo[i - 1] + fibo[i - 2]; return fibo[x]; } /*ๆกๆ•ฐ*/ ll dig(ll n) { ll d = 0, tmp = n; while (tmp / 10 > 0) { tmp /= 10; d++; } return d; } /*่ฟท่ทฏ็งปๅ‹•*/ const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; llfor; //////////////////////////////////////////////////////////// int main() { string s; cin >> s; bool used = false, now = false; ll cnt = 0; string t = "keyence"; ll st, ed; ll n = s.length(); rep(st, 0, n) { rep(ed, st, n) { string u = ""; rep(i, 0, n) { if (i < st || ed < i) u += s[i]; } // cout<<st<<" "<<ed<<" "<<u<<endl; if (u == t) { pY; return 0; } } } pN; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> using namespace std; #define intmax INT_MAX #define lmax LONG_MAX #define uintmax UINT_MAX #define ulmax ULONG_MAX #define llmax LLONG_MAX #define ll long long #define rep(i, a, N) for ((i) = (a); (i) < (N); (i)++) #define rrp(i, N, a) for ((i) = (N)-1; (i) >= (a); (i)--) #define llfor ll i, j #define sc(a) cin >> a #define pr(a) cout << a << endl #define pY puts("YES") #define pN puts("NO") #define py puts("Yes") #define pn puts("No") #define pnn printf("\n") #define pb(b) push_back(b) #define all(a) a.begin(), a.end() #define llvec vector<vector<ll>> #define charvec vector<vector<char>> #define size(a, b) (a, vector<ll>(b)) const int mod = 1e9 + 7; /* UnionFind๏ผš็ด ้›†ๅˆ็ณป็ฎก็†ใฎๆง‹้€ ไฝ“(union by size) isSame(x, y): x ใจ y ใŒๅŒใ˜้›†ๅˆใซใ„ใ‚‹ใ‹ใ€‚ ่จˆ็ฎ—้‡ใฏใชใ‚‰ใ— O(ฮฑ(n)) unite(x, y): x ใจ y ใ‚’ๅŒใ˜้›†ๅˆใซใ™ใ‚‹ใ€‚่จˆ็ฎ—้‡ใฏใชใ‚‰ใ— O(ฮฑ(n)) treeSize(x): x ใ‚’ๅซใ‚€้›†ๅˆใฎ่ฆ็ด ๆ•ฐใ€‚ */ struct UnionFind { vector<int> size, parents; UnionFind() {} UnionFind(int n) { // make n trees. size.resize(n, 0); parents.resize(n, 0); for (int i = 0; i < n; i++) makeTree(i); } void makeTree(int x) { parents[x] = x; // the parent of x is x size[x] = 1; } bool isSame(int x, int y) { return findRoot(x) == findRoot(y); } bool unite(int x, int y) { x = findRoot(x); y = findRoot(y); if (x == y) return false; if (size[x] > size[y]) { parents[y] = x; size[x] += size[y]; } else { parents[x] = y; size[y] += size[x]; } return true; } int findRoot(int x) { //ๆœจใฎๆ นใ‚’ๆŽขใ™,่จˆ็ฎ—้‡ๅ‰Šๆธ›ใฎใŸใ‚ไฝŽใ if (x != parents[x]) parents[x] = findRoot(parents[x]); return parents[x]; } int treeSize(int x) { return size[findRoot(x)]; } }; /*pi*/ const double pi = acos(-1); /*็นฐใ‚ŠไธŠใ’้™ค็ฎ—*/ ll cei(ll x, ll y) { ll ans = x / y; if (x % y != 0) ans++; return ans; } /*ๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐ*/ ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } /*ๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ*/ ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } /*nไน—*/ ll llpow(ll x, ll n) { ll i, ans = 1; rep(i, 0, n) ans *= x; return ans; } /*้šŽไน—*/ ll fact(ll x) { ll i, ans = 1; rep(i, 0, x) ans *= (x - i); return ans; } /*nCr*/ ll ncr(ll n, ll r) { return fact(n) / fact(r) / fact(n - r); } /*nPr*/ ll npr(ll n, ll r) { return fact(n) / fact(n - r); } /*primejudge*/ bool prime(ll a) { if (a <= 1) return false; ll i; for (i = 2; i * i <= a; i++) { if (a % i == 0) return false; } return true; } /*Fibonacciๆ•ฐๅˆ—*/ ll fib(ll x) { ll i, fibo[x + 10]; fibo[0] = 1; fibo[1] = 1; fibo[2] = 1; rep(i, 3, x + 1) fibo[i] = fibo[i - 1] + fibo[i - 2]; return fibo[x]; } /*ๆกๆ•ฐ*/ ll dig(ll n) { ll d = 0, tmp = n; while (tmp / 10 > 0) { tmp /= 10; d++; } return d; } /*่ฟท่ทฏ็งปๅ‹•*/ const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; llfor; //////////////////////////////////////////////////////////// int main() { string s; cin >> s; bool used = false, now = false; ll cnt = 0; string t = "keyence"; ll st, ed; ll n = s.length(); rep(st, -1, n + 1) { rep(ed, st, n + 1) { string u = ""; rep(i, 0, n) { if (i < st || ed < i) u += s[i]; } // cout<<st<<" "<<ed<<" "<<u<<endl; if (u == t) { pY; return 0; } } } pN; return 0; }
[ "literal.number.change", "call.arguments.change" ]
947,853
947,854
u006717664
cpp
p03150
#include <iostream> using namespace std; int main() { string S; cin >> S; //ๅ…ฅๅŠ›็ต‚ไบ† char k[] = "keyence"; //ๅ…ˆ้ ญใŒkใงใชใ‘ใ‚Œใฐ๏ผŒๆœซๅฐพใŒkeyenceใซใชใ‚‹ใ—ใ‹ใชใ„ if (S[0] != k[0]) { if (S.substr(S.size() - 7) == k) cout << "Yes" << endl; else cout << "No" << endl; } //ๆœซๅฐพใŒeใงใชใ‘ใ‚Œใฐ๏ผŒๅ…ˆ้ ญใŒkeyenceใซใชใ‚‹ใ—ใ‹ใชใ„ else if (S[S.size() - 1] != k[6]) { if (S.substr(0, 7) == k) cout << "Yes" << endl; else cout << "No" << endl; } else { int l = 0, r = 6; //ๅทฆใ‹ใ‚‰keyenceใซไธ€่‡ดใ—ใฆใ„ใ‚‹็ฏ„ๅ›ฒใ‚’ๆŽข็ดข while (S[l] == k[l]) l++; //ๅณใ‹ใ‚‰keyenceใซใ‚“ไธ€่‡ดใ—ใฆใ„ใ‚‹็ฏ„ๅ›ฒใ‚’ๆŽข็ดข while (S[r - 6 + S.size() - 1] == k[r]) r--; // lใจrใŒไบคๅทฎใ—ใฆใ„ใ‚ŒใฐOK if (l > r) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <iostream> using namespace std; int main() { string S; cin >> S; //ๅ…ฅๅŠ›็ต‚ไบ† char k[] = "keyence"; //ๅ…ˆ้ ญใŒkใงใชใ‘ใ‚Œใฐ๏ผŒๆœซๅฐพใŒkeyenceใซใชใ‚‹ใ—ใ‹ใชใ„ if (S[0] != k[0]) { if (S.substr(S.size() - 7) == k) cout << "YES" << endl; else cout << "NO" << endl; } //ๆœซๅฐพใŒeใงใชใ‘ใ‚Œใฐ๏ผŒๅ…ˆ้ ญใŒkeyenceใซใชใ‚‹ใ—ใ‹ใชใ„ else if (S[S.size() - 1] != k[6]) { if (S.substr(0, 7) == k) cout << "YES" << endl; else cout << "NO" << endl; } else { int l = 0, r = 6; //ๅทฆใ‹ใ‚‰keyenceใซไธ€่‡ดใ—ใฆใ„ใ‚‹็ฏ„ๅ›ฒใ‚’ๆŽข็ดข while (S[l] == k[l]) l++; //ๅณใ‹ใ‚‰keyenceใซใ‚“ไธ€่‡ดใ—ใฆใ„ใ‚‹็ฏ„ๅ›ฒใ‚’ๆŽข็ดข while (S[r - 6 + S.size() - 1] == k[r]) r--; // lใจrใŒไบคๅทฎใ—ใฆใ„ใ‚ŒใฐOK if (l > r) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,870
947,871
u537852947
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { string s; cin >> s; for (int i = 0; i < 7; i++) { if (s.substr(0, i) + s.substr(s.size() - 7 + i) == "keyence") { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { string s; cin >> s; for (int i = 0; i < 7; i++) { if (s.substr(0, i) + s.substr(s.size() - 7 + i) == "keyence") { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,875
947,876
u842857133
cpp
p03150
#include <bits/stdc++.h> #include <numeric> using namespace std; #define ll long long #define mod107 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) using Graph = vector<vector<int>>; #define grepq priority_queue<double, std::vector<double>, std::greater<double>> #define all(v) v.begin(), v.end() #define PI acos(-1) const ll INF = 10010001010; const int inf = 1000034000; typedef vector<ll> vecl; typedef vector<int> veci; typedef tuple<string, int, int> TUP; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { string S; cin >> S; bool ok = false; string T; for (int i = 0; i < S.size(); i++) { for (int j = 0; j < S.size(); j++) { T = S; T.erase(i, j); if (T == "keyence") { ok = true; } // cout << T << endl; } } if (ok) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
#include <bits/stdc++.h> #include <numeric> using namespace std; #define ll long long #define mod107 1000000007 #define rep(i, n) for (int i = 0; i < n; ++i) using Graph = vector<vector<int>>; #define grepq priority_queue<double, std::vector<double>, std::greater<double>> #define all(v) v.begin(), v.end() #define PI acos(-1) const ll INF = 10010001010; const int inf = 1000034000; typedef vector<ll> vecl; typedef vector<int> veci; typedef tuple<string, int, int> TUP; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { string S; cin >> S; bool ok = false; string T; for (int i = 0; i < S.size(); i++) { for (int j = 0; j < S.size(); j++) { T = S; T.erase(i, j); if (T == "keyence") { ok = true; } // cout << T << endl; } } if (ok) { cout << "YES" << endl; } else { cout << "NO" << endl; } }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,883
947,884
u935370883
cpp
p03150
#include <bits/stdc++.h> // #define int long long #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repa(i, s, n) for (int i = s; i < (int)n; i++) #define MOD 1000000007 using namespace std; using ll = long long; typedef vector<int> vi; signed main() { string s; cin >> s; bool isOK = false; if (s == "keyence") isOK = true; rep(i, s.length()) { for (int j = 1; j <= s.length() - i; j++) { string copied = s; copied.erase(i, j); if (copied == "keyence") isOK = true; } } if (isOK) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> // #define int long long #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repa(i, s, n) for (int i = s; i < (int)n; i++) #define MOD 1000000007 using namespace std; using ll = long long; typedef vector<int> vi; signed main() { string s; cin >> s; bool isOK = false; if (s == "keyence") isOK = true; rep(i, s.length()) { for (int j = 1; j <= s.length() - i; j++) { string copied = s; copied.erase(i, j); if (copied == "keyence") isOK = true; } } if (isOK) cout << "YES" << endl; else cout << "NO" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,887
947,888
u510749912
cpp
p03150
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; using ld = long double; using Pii = pair<int, int>; using Pil = pair<int, ll>; using Pll = pair<ll, ll>; using Pid = pair<int, ld>; using Pis = pair<int, string>; #define rep(i, n) for (int i = 0; i < n; i++) #define repm(i, s, n) for (int i = s; i < n; i++) #define setprc(d) setprecision(d) const int INF = 1 << 30; const ll INF_L = 1LL << 60; const int MOD = 1e9 + 7; // ---------------------------------------------------------------- // String Functions // ---------------------------------------------------------------- int ctoi(char c) { if (isdigit(c)) return c - '0'; else if (islower(c)) return c - 'a'; else if (isupper(c)) return c - 'A'; else return -1; } char itocd(int i) { char c = i + '0'; if (isdigit(c)) return c; else return 0x00; } char itocl(int i) { char c = i + 'a'; if (islower(c)) return c; else return 0x00; } char itocu(int i) { char c = i + 'A'; if (isupper(c)) return c; else return 0x00; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Dynamical Programming // ---------------------------------------------------------------- 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; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Graph Theory // ---------------------------------------------------------------- vector<vector<int>> adjMat; vector<set<Pii>> adjList; void Dijkstra() {} void BellmanFord() {} void WarshallFloyd() {} // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Mathematical Functions // ---------------------------------------------------------------- ll gcd(ll A, ll B) { if (A % B == 0) { return (B); } else { return (gcd(B, A % B)); } } ll lcm(ll A, ll B) { return A * B / gcd(A, B); } ll divtimes(ll N, ll D) { ll res = 0; while (N % D == 0) { N /= D; res++; } return res; } ll powMod(ll B, ll P) { if (P == 0) return 1; if (P % 2 == 0) { ll t = powMod(B, P / 2); return t * t % MOD; } return B * powMod(B, P - 1) % MOD; } /* ---------------------------------- Factorial, Permutation, Combination ---------------------------------- */ const int FAC_INIT_SIZE = 1e6 + 9; vector<ll> fac, finv, inv; void factModInit() { fac.resize(FAC_INIT_SIZE); finv.resize(FAC_INIT_SIZE); inv.resize(FAC_INIT_SIZE); fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < FAC_INIT_SIZE; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } ll factMod(ll N) { return fac[N] % MOD; } ll factInvMod(ll N) { return finv[N] % MOD; } ll permMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else return factMod(N) * factInvMod(N - K) % MOD; } ll combMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else if (N < FAC_INIT_SIZE) { return factMod(N) * (factInvMod(K) * factInvMod(N - K) % MOD) % MOD; } else { ll ans = 1; ll Ks = K < N - K ? K : N - K; for (ll i = N; i > N - Ks; i--) { ans *= i; ans %= MOD; } return ans * factInvMod(Ks) % MOD; } } /* ---------------------------------- Sieve of Eratosthenes ---------------------------------- */ vector<bool> isprime; void sieveInit(int size) { int sb = size + 9; isprime.resize(sb); isprime[0] = isprime[1] = false; isprime[2] = true; for (int i = 2; i < sb; i++) { if (i % 2 == 0) isprime[i] = false; else isprime[i] = true; } for (int i = 3; i * i <= sb; i += 2) { if (isprime[i]) { int m = 3 * i; while (m < sb) { isprime[m] = false; m += 2 * i; } } else { continue; } } } // ---------------------------------------------------------------- int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int s = (int)(S.size()); string k = "keyence"; string res = "No"; rep(i, 8) { if (S.substr(0, 7 - i) + S.substr(s - i, i) == k) res = "Yes"; } cout << res << endl; }
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; using ld = long double; using Pii = pair<int, int>; using Pil = pair<int, ll>; using Pll = pair<ll, ll>; using Pid = pair<int, ld>; using Pis = pair<int, string>; #define rep(i, n) for (int i = 0; i < n; i++) #define repm(i, s, n) for (int i = s; i < n; i++) #define setprc(d) setprecision(d) const int INF = 1 << 30; const ll INF_L = 1LL << 60; const int MOD = 1e9 + 7; // ---------------------------------------------------------------- // String Functions // ---------------------------------------------------------------- int ctoi(char c) { if (isdigit(c)) return c - '0'; else if (islower(c)) return c - 'a'; else if (isupper(c)) return c - 'A'; else return -1; } char itocd(int i) { char c = i + '0'; if (isdigit(c)) return c; else return 0x00; } char itocl(int i) { char c = i + 'a'; if (islower(c)) return c; else return 0x00; } char itocu(int i) { char c = i + 'A'; if (isupper(c)) return c; else return 0x00; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Dynamical Programming // ---------------------------------------------------------------- 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; } // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Graph Theory // ---------------------------------------------------------------- vector<vector<int>> adjMat; vector<set<Pii>> adjList; void Dijkstra() {} void BellmanFord() {} void WarshallFloyd() {} // ---------------------------------------------------------------- // ---------------------------------------------------------------- // Mathematical Functions // ---------------------------------------------------------------- ll gcd(ll A, ll B) { if (A % B == 0) { return (B); } else { return (gcd(B, A % B)); } } ll lcm(ll A, ll B) { return A * B / gcd(A, B); } ll divtimes(ll N, ll D) { ll res = 0; while (N % D == 0) { N /= D; res++; } return res; } ll powMod(ll B, ll P) { if (P == 0) return 1; if (P % 2 == 0) { ll t = powMod(B, P / 2); return t * t % MOD; } return B * powMod(B, P - 1) % MOD; } /* ---------------------------------- Factorial, Permutation, Combination ---------------------------------- */ const int FAC_INIT_SIZE = 1e6 + 9; vector<ll> fac, finv, inv; void factModInit() { fac.resize(FAC_INIT_SIZE); finv.resize(FAC_INIT_SIZE); inv.resize(FAC_INIT_SIZE); fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < FAC_INIT_SIZE; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } ll factMod(ll N) { return fac[N] % MOD; } ll factInvMod(ll N) { return finv[N] % MOD; } ll permMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else return factMod(N) * factInvMod(N - K) % MOD; } ll combMod(ll N, ll K) { if (N < 0 || K < 0 || N < K) return 0; else if (N < FAC_INIT_SIZE) { return factMod(N) * (factInvMod(K) * factInvMod(N - K) % MOD) % MOD; } else { ll ans = 1; ll Ks = K < N - K ? K : N - K; for (ll i = N; i > N - Ks; i--) { ans *= i; ans %= MOD; } return ans * factInvMod(Ks) % MOD; } } /* ---------------------------------- Sieve of Eratosthenes ---------------------------------- */ vector<bool> isprime; void sieveInit(int size) { int sb = size + 9; isprime.resize(sb); isprime[0] = isprime[1] = false; isprime[2] = true; for (int i = 2; i < sb; i++) { if (i % 2 == 0) isprime[i] = false; else isprime[i] = true; } for (int i = 3; i * i <= sb; i += 2) { if (isprime[i]) { int m = 3 * i; while (m < sb) { isprime[m] = false; m += 2 * i; } } else { continue; } } } // ---------------------------------------------------------------- int main() { std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int s = (int)(S.size()); string k = "keyence"; string res = "NO"; rep(i, 8) { if (S.substr(0, 7 - i) + S.substr(s - i, i) == k) res = "YES"; } cout << res << endl; }
[ "literal.string.change", "literal.string.case.change", "variable_declaration.value.change", "assignment.value.change" ]
947,889
947,890
u947236878
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans = "keyence"; int pos = 0; // try at the beginning if (s.substr(0, 7) == ans) pos = 1; // try at the end if (s.substr((int)s.size() - 7, 7) == ans) pos = 1; // try the other possible way for (int i = 1; i <= 6; i++) { if ((s.substr(0, i) == ans.substr(0, i)) && (s.substr((int)s.size() - i, 7 - i) == ans.substr(i, 7 - i))) pos = 1; } if (pos == 1) cout << "YES"; else cout << "NO"; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans = "keyence"; int pos = 0; // try at the beginning if (s.substr(0, 7) == ans) pos = 1; // try at the end if (s.substr((int)s.size() - 7, 7) == ans) pos = 1; // try the other possible way for (int i = 1; i <= 6; i++) { if ((s.substr(0, i) == ans.substr(0, i)) && (s.substr((int)s.size() - (7 - i), 7 - i) == ans.substr(i, 7 - i))) pos = 1; } if (pos == 1) cout << "YES"; else cout << "NO"; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
947,891
947,892
u004676431
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rev(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define rev1(i, n) for (int i = (int)(n); i > 0; i--) #define pb push_back #define all(v) (v).begin(), (v).end() using ll = long long; using P = pair<int, int>; /* ------------------------------------------------ */ ll fact(int i) { //้šŽไน— if (i == 0) return 1; return (fact(i - 1)) * i; } ll gcd(ll a, ll b) { //ๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐ if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { //ๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ return a * b / gcd(a, b); } int keta(ll n) { //ๆกๆ•ฐใ‚’ๆฑ‚ใ‚ใ‚‹ if (n == 0) return 1; int count = 0; while (n != 0) { n /= 10; count++; } return count; } ll ketasum(ll n) { //ๅ„ๆกใฎๅ’Œ ll sum = 0; while (n != 0) { sum += n % 10; n /= 10; } return sum; } /* ------------------------------------------------ */ int main() { string s; cin >> s; rep(i, 8) { if (s.substr(0, i) + s.substr(s.size() - i - 1) == "keyence") { cout << "YES\n"; return 0; } else continue; } cout << "NO\n"; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rev(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define rev1(i, n) for (int i = (int)(n); i > 0; i--) #define pb push_back #define all(v) (v).begin(), (v).end() using ll = long long; using P = pair<int, int>; /* ------------------------------------------------ */ ll fact(int i) { //้šŽไน— if (i == 0) return 1; return (fact(i - 1)) * i; } ll gcd(ll a, ll b) { //ๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐ if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { //ๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ return a * b / gcd(a, b); } int keta(ll n) { //ๆกๆ•ฐใ‚’ๆฑ‚ใ‚ใ‚‹ if (n == 0) return 1; int count = 0; while (n != 0) { n /= 10; count++; } return count; } ll ketasum(ll n) { //ๅ„ๆกใฎๅ’Œ ll sum = 0; while (n != 0) { sum += n % 10; n /= 10; } return sum; } /* ------------------------------------------------ */ int main() { string s; cin >> s; rep(i, 8) { if (s.substr(0, i) + s.substr(s.size() - (7 - i)) == "keyence") { cout << "YES\n"; return 0; } else continue; } cout << "NO\n"; return 0; }
[ "control_flow.branch.if.condition.change", "identifier.replace.add", "literal.replace.remove" ]
947,904
947,905
u608773191
cpp
p03150
#include <algorithm> #include <atomic> #include <cmath> #include <future> #include <iostream> #include <map> #include <mutex> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <thread> #include <vector> #define int long long #define endre \ getchar(); \ getchar(); \ return 0 #define INF 1000000007 #define rep(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define prique(T) priority_queue<T, vector<T>, greater<T>> #define vecunique(vec) \ sort(vec.begin(), vec.end()); \ decltype(vec)::iterator result = std::unique(vec.begin(), vec.end()); \ vec.erase(result, vec.end()) using namespace std; bool prime(int n) { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return n != 1; } int gcd(int x, int y) { if (x < y) swap(x, y); if (y == 0) return x; return gcd(y, x % y); } int lcm(int x, int y) { return x * y / gcd(x, y); } int kai(int n) { if (n == 0) return 1; return (kai(n - 1) * n) % INF; } int mod_pow(int x, int y, int mod) { int res = 1; while (y > 0) { if (y & 1) { res = res * x % mod; } x = x * x % mod; y >>= 1; } return res; } int mystoi(string s) { int cnt = 0; for (int i = 0; i < s.size(); i++) { cnt += (int)(s[i] - '0') * mod_pow(10, s.size() - i - 1, INF); } return cnt; } /*--------Library Zone!--------*/ signed main() { string s; cin >> s; if (s == "keyence") cout << "YES" << endl; if (s.substr(0, 1) == "k" && s.substr(s.size() - 6, 6) == "eyence") cout << "YES" << endl; else if (s.substr(0, 2) == "ke" && s.substr(s.size() - 5, 5) == "yence") cout << "YES" << endl; else if (s.substr(0, 3) == "key" && s.substr(s.size() - 4, 4) == "ence") cout << "YES" << endl; else if (s.substr(0, 4) == "keye" && s.substr(s.size() - 3, 3) == "nce") cout << "YES" << endl; else if (s.substr(0, 5) == "keyen" && s.substr(s.size() - 2, 2) == "ce") cout << "YES" << endl; else if (s.substr(0, 6) == "keyenc" && s.substr(s.size() - 1, 1) == "e") cout << "YES" << endl; else if (s.substr(s.size() - 7, 7) == "keyence") cout << "YES" << endl; else if (s.substr(0, 7) == "keyence") cout << "YES" << endl; else cout << "NO" << endl; endre; }
#include <algorithm> #include <atomic> #include <cmath> #include <future> #include <iostream> #include <map> #include <mutex> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <thread> #include <vector> #define int long long #define endre \ getchar(); \ getchar(); \ return 0 #define INF 1000000007 #define rep(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define prique(T) priority_queue<T, vector<T>, greater<T>> #define vecunique(vec) \ sort(vec.begin(), vec.end()); \ decltype(vec)::iterator result = std::unique(vec.begin(), vec.end()); \ vec.erase(result, vec.end()) using namespace std; bool prime(int n) { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return n != 1; } int gcd(int x, int y) { if (x < y) swap(x, y); if (y == 0) return x; return gcd(y, x % y); } int lcm(int x, int y) { return x * y / gcd(x, y); } int kai(int n) { if (n == 0) return 1; return (kai(n - 1) * n) % INF; } int mod_pow(int x, int y, int mod) { int res = 1; while (y > 0) { if (y & 1) { res = res * x % mod; } x = x * x % mod; y >>= 1; } return res; } int mystoi(string s) { int cnt = 0; for (int i = 0; i < s.size(); i++) { cnt += (int)(s[i] - '0') * mod_pow(10, s.size() - i - 1, INF); } return cnt; } /*--------Library Zone!--------*/ signed main() { string s; cin >> s; if (s == "keyence") cout << "YES" << endl; else if (s.substr(0, 1) == "k" && s.substr(s.size() - 6, 6) == "eyence") cout << "YES" << endl; else if (s.substr(0, 2) == "ke" && s.substr(s.size() - 5, 5) == "yence") cout << "YES" << endl; else if (s.substr(0, 3) == "key" && s.substr(s.size() - 4, 4) == "ence") cout << "YES" << endl; else if (s.substr(0, 4) == "keye" && s.substr(s.size() - 3, 3) == "nce") cout << "YES" << endl; else if (s.substr(0, 5) == "keyen" && s.substr(s.size() - 2, 2) == "ce") cout << "YES" << endl; else if (s.substr(0, 6) == "keyenc" && s.substr(s.size() - 1, 1) == "e") cout << "YES" << endl; else if (s.substr(s.size() - 7, 7) == "keyence") cout << "YES" << endl; else if (s.substr(0, 7) == "keyence") cout << "YES" << endl; else cout << "NO" << endl; endre; }
[ "control_flow.branch.else_if.replace.add", "control_flow.branch.if.replace.remove" ]
947,906
947,907
u147049801
cpp
p03150
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; i++) #define rep1(i, n) for (int i = 1; i <= (int)n; i++) #define sp(n) cout << fixed << setprecision(n) 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; } typedef long long ll; using namespace std; string target = "keyence"; int main(void) { string s; cin >> s; rep(i, 8) { string f = s.substr(0, i), l = s.substr(s.size() - (7 - i), (7 - i)); // cout<<f<<" "<<l<<endl; if (f + l == target) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; i++) #define rep1(i, n) for (int i = 1; i <= (int)n; i++) #define sp(n) cout << fixed << setprecision(n) 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; } typedef long long ll; using namespace std; string target = "keyence"; int main(void) { string s; cin >> s; rep(i, 8) { string f = s.substr(0, i), l = s.substr(s.size() - (7 - i), (7 - i)); // cout<<f<<" "<<l<<endl; if (f + l == target) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,912
947,913
u222866518
cpp
p03150
#include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { string s; cin >> s; int n = s.size(); rep(i, n) { for (int j = i; j < n; ++j) { string t = ""; rep(k, n) { if (k >= i && k < j) { continue; } t += s[k]; } if (t == "keyence") { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; return 0; }
#include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { string s; cin >> s; int n = s.size(); rep(i, n) { for (int j = i; j < n; ++j) { string t = ""; rep(k, n) { if (k >= i && k < j) { continue; } t += s[k]; } if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,916
947,917
u596311864
cpp
p03150
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define rep2(i, x, n) for (int i = (int)(x); i < (int)(n); i++) #define repit(itr, x) for (auto itr = x.begin(); itr != x.end(); itr++) #define repitr(ritr, x) for (auto ritr = x.rbegin(); ritr != x.rend(); ritr++) #define ALL(n) begin(n), end(n) using ll = long long; using namespace std; int main() { string s; cin >> s; string key = "keyence"; rep(i, key.size()) { if (key[i] != s[i]) { string subs = s.substr(s.size() - key.size() + i); string subk = key.substr(i); // cerr << subs << endl; // cerr << subk << endl; if (subs == subk) { cout << "YES" << endl; } else { 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 repr(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define rep2(i, x, n) for (int i = (int)(x); i < (int)(n); i++) #define repit(itr, x) for (auto itr = x.begin(); itr != x.end(); itr++) #define repitr(ritr, x) for (auto ritr = x.rbegin(); ritr != x.rend(); ritr++) #define ALL(n) begin(n), end(n) using ll = long long; using namespace std; int main() { string s; cin >> s; string key = "keyence"; rep(i, key.size()) { if (key[i] != s[i]) { string subs = s.substr(s.size() - key.size() + i); string subk = key.substr(i); // cerr << subs << endl; // cerr << subk << endl; if (subs == subk) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; } } cout << "YES" << endl; return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,920
947,921
u617826263
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string title = "keyence"; int N = S.size(), M = title.size(); bool flag = false; for (int i = 0; i < M + 1; i++) { string leftSide = S.substr(0, i); string rightSide = S.substr(N - M + i, M - i); if (leftSide + rightSide == title) flag = true; } if (flag) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; string title = "keyence"; int N = S.size(), M = title.size(); bool flag = false; for (int i = 0; i < M + 1; i++) { string leftSide = S.substr(0, i); string rightSide = S.substr(N - M + i, M - i); if (leftSide + rightSide == title) flag = true; } if (flag) cout << "YES" << endl; else cout << "NO" << endl; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,935
947,936
u735528230
cpp
p03150
#include <algorithm> #include <cmath> #include <cstdint> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using ll = long long; int main() { std::string s; std::cin >> s; std::string keyence = "keyence"; for (int i = 0; i < keyence.size() + 1; i++) { if (s.substr(0, i) + s.substr(s.size() - (keyence.size() - i)) == keyence) { std::cout << "Yes"; return 0; } } std::cout << "No"; return 0; }
#include <algorithm> #include <cmath> #include <cstdint> #include <iomanip> #include <iostream> #include <numeric> #include <string> #include <vector> using ll = long long; int main() { std::string s; std::cin >> s; std::string keyence = "keyence"; for (int i = 0; i < keyence.size() + 1; i++) { if (s.substr(0, i) + s.substr(s.size() - (keyence.size() - i)) == keyence) { std::cout << "YES"; return 0; } } std::cout << "NO"; return 0; }
[ "literal.string.change", "literal.string.case.change", "expression.operation.binary.change" ]
947,944
947,945
u157368592
cpp
p03150
#include <bits/stdc++.h> #include <cctype> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() typedef long long int ll; #define pi 3.1415926535897932384 #define E9 1000000000 #define eps 1e-4 #define pii pair<int, int> int main() { string S; cin >> S; string k = "keyence"; bool flag = false; rep(i, S.size()) { for (int j = i; j < S.size(); j++) { string s = S.substr(0, i) + S.substr(j); if (s == k) flag = true; } } cout << (flag ? "Yes" : "No") << endl; // cout << fixed << setprecision(6); return 0; }
#include <bits/stdc++.h> #include <cctype> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() typedef long long int ll; #define pi 3.1415926535897932384 #define E9 1000000000 #define eps 1e-4 #define pii pair<int, int> int main() { string S; cin >> S; string k = "keyence"; bool flag = false; rep(i, S.size()) { for (int j = i; j < S.size(); j++) { string s = S.substr(0, i) + S.substr(j); if (s == k) flag = true; } } cout << (flag ? "YES" : "NO") << endl; // cout << fixed << setprecision(6); return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
947,952
947,953
u474180590
cpp
p03150
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; using P = pair<ll, ll>; const ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) #define REPS(i, n) for (ll(i) = 1; (i) <= (n); (i)++) #define RREP(i, n) for (ll(i) = (n - 1); (i) >= 0; (i)--) #define RREPS(i, n) for (ll(i) = (n); (i) > 0; (i)--) #define pb push_back #define mp make_pair #define F first #define S second #define UNIQUE(v) v.erase(unique(ALL(v)), v.end()); template <class T> inline void chmin(T &a, T b) { if (a > b) { a = b; } } template <class T> inline void chmax(T &a, T b) { if (a < b) { a = b; } } signed main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); string S; cin >> S; bool ok = 0; string k = "keyence"; REP(i, 8) { if (S.substr(0, i) == k.substr(0, i) && S.substr(S.size() - i) == k.substr(7 - i)) ok = 1; } cout << (ok ? "YES" : "NO") << "\n"; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; using P = pair<ll, ll>; const ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) #define REPS(i, n) for (ll(i) = 1; (i) <= (n); (i)++) #define RREP(i, n) for (ll(i) = (n - 1); (i) >= 0; (i)--) #define RREPS(i, n) for (ll(i) = (n); (i) > 0; (i)--) #define pb push_back #define mp make_pair #define F first #define S second #define UNIQUE(v) v.erase(unique(ALL(v)), v.end()); template <class T> inline void chmin(T &a, T b) { if (a > b) { a = b; } } template <class T> inline void chmax(T &a, T b) { if (a < b) { a = b; } } signed main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); string S; cin >> S; bool ok = 0; string k = "keyence"; REP(i, 8) { if (S.substr(0, i) == k.substr(0, i) && S.substr(S.size() - 7 + i) == k.substr(i)) ok = 1; } cout << (ok ? "YES" : "NO") << "\n"; }
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
947,956
947,957
u017078415
cpp
p03150
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; string k = "keyence"; int n = s.length(); bool flag = true; for (int i = 0; i <= 7; i++) { string t = s.substr(0, (7 - i)) + s.substr(n - i, i); if (k == t) flag = true; } if (flag) cout << "YES" << "\n"; else cout << "NO" << "\n"; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; string k = "keyence"; int n = s.length(); bool flag = false; for (int i = 0; i <= 7; i++) { string t = s.substr(0, (7 - i)) + s.substr(n - i, i); if (k == t) flag = true; } if (flag) cout << "YES" << "\n"; else cout << "NO" << "\n"; }
[ "misc.opposites", "variable_declaration.value.change" ]
947,958
947,959
u873762144
cpp
p03150
#include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; #define repl(i, l, r) for (int i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) int main() { string s; cin >> s; int n = s.size(); string t = "keyence"; rep(i, 8) { string ns = s.substr(0, i) + s.substr(n - 1 - i); if (ns == t) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
#include <iostream> #include <queue> #include <vector> using namespace std; using ll = long long; #define repl(i, l, r) for (int i = l; i < r; i++) #define rep(i, n) repl(i, 0, n) int main() { string s; cin >> s; int n = s.size(); string t = "keyence"; rep(i, 8) { string ns = s.substr(0, i) + s.substr(n - 7 + i); if (ns == t) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
[]
947,966
947,967
u936602931
cpp
p03150
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ll int64_t #define str string #define rep(i, n) for (ll i = 0; i < n; i++) #define rrep(i, n) for (ll i = 1; i <= n; i++) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define pb push_back #define mod 1000000007 #define PI 3.141592653589793 #define vec vector #define dump(x) cerr << #x << "=" << x << endl using namespace std; #define INF 1000000000 #define MAX_V 10 bool compare_by_b(pair<string, ll> a, pair<string, ll> b) { if (a.second != b.second) return a.second < b.second; else return a.first < b.first; } bool my_compare(pair<ll, ll> a, pair<ll, ll> b) { if (a.first != b.first) return a.first < b.first; if (a.second != b.second) return a.second > b.second; else return true; } ll modpow(ll a, ll n, ll mod1) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod1; a = a * a % mod1; n >>= 1; } return res; } ll factorial(ll n) { ll x = 1; rrep(i, n)(x *= i) %= mod; return x; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } const ll MAX = 5100000; const ll MOD = 1000000007; ll fac[MAX], finv[MAX], inv[MAX]; // ใƒ†ใƒผใƒ–ใƒซใ‚’ไฝœใ‚‹ๅ‰ๅ‡ฆ็† void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // ไบŒ้ …ไฟ‚ๆ•ฐ่จˆ็ฎ— ll COM(ll n, ll k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } using graph = vector<vector<ll>>; pair<pair<ll, ll>, ll> p[100010]; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; rep(i, s.size()) { for (ll j = i + 1; j < s.size(); j++) { string t = s.substr(0, i) + s.substr(j + 1, s.size() - j - 1); if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ll int64_t #define str string #define rep(i, n) for (ll i = 0; i < n; i++) #define rrep(i, n) for (ll i = 1; i <= n; i++) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define pb push_back #define mod 1000000007 #define PI 3.141592653589793 #define vec vector #define dump(x) cerr << #x << "=" << x << endl using namespace std; #define INF 1000000000 #define MAX_V 10 bool compare_by_b(pair<string, ll> a, pair<string, ll> b) { if (a.second != b.second) return a.second < b.second; else return a.first < b.first; } bool my_compare(pair<ll, ll> a, pair<ll, ll> b) { if (a.first != b.first) return a.first < b.first; if (a.second != b.second) return a.second > b.second; else return true; } ll modpow(ll a, ll n, ll mod1) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod1; a = a * a % mod1; n >>= 1; } return res; } ll factorial(ll n) { ll x = 1; rrep(i, n)(x *= i) %= mod; return x; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } const ll MAX = 5100000; const ll MOD = 1000000007; ll fac[MAX], finv[MAX], inv[MAX]; // ใƒ†ใƒผใƒ–ใƒซใ‚’ไฝœใ‚‹ๅ‰ๅ‡ฆ็† void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // ไบŒ้ …ไฟ‚ๆ•ฐ่จˆ็ฎ— ll COM(ll n, ll k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } using graph = vector<vector<ll>>; pair<pair<ll, ll>, ll> p[100010]; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; rep(i, s.size()) { for (ll j = i; j < s.size(); j++) { string t = s.substr(0, i) + s.substr(j, s.size() - j); if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }
[ "control_flow.loop.for.initializer.change", "expression.operation.binary.remove" ]
947,976
947,977
u356754940
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string key{"keyence"}; if (s == key) { cout << "YES"; return 0; } for (int i = 0; i < (int)s.length() - 7; i++) { for (int j = i; j < (int)s.length(); j++) { for (int k = 0; k < 8; k++) { // cout << s.substr(i,k)+s.substr(j,7-k) << endl; if (s.substr(i, k) + s.substr(j, 7 - k) == key) { if (i > 0 && j - i > k) continue; if (i == 0 && j + 7 - k != (int)s.length() - 1) continue; cout << "YES"; return 0; } } } } cout << "NO"; // zxlxbwhcvkpvoahiohfozjtceocbsgdnpnbpuyqejdbwgnapzeyence }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string key{"keyence"}; if (s == key) { cout << "YES"; return 0; } for (int i = 0; i < (int)s.length() - 7; i++) { for (int j = i; j < (int)s.length(); j++) { for (int k = 0; k < 8; k++) { // cout << s.substr(i,k)+s.substr(j,7-k) << endl; if (s.substr(i, k) + s.substr(j, 7 - k) == key) { if (i > 0 && j - i > k) continue; if (i == 0 && j + 7 - k != (int)s.length()) continue; cout << "YES"; return 0; } } } } cout << "NO"; // zxlxbwhcvkpvoahiohfozjtceocbsgdnpnbpuyqejdbwgnapzeyence }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
947,982
947,983
u515923980
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { const string keyword = "keyence"; string S; cin >> S; bool is_satisfied = false; for (size_t len_head = 0; len_head <= keyword.size(); len_head++) { size_t len_tail = keyword.size() - len_head; if (S.substr(0, len_head) == keyword.substr(0, len_head) && S.substr(S.size() - len_tail) == keyword.substr(S.size() - len_tail)) { is_satisfied = true; break; } } string ans = is_satisfied ? "YES" : "NO"; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { const string keyword = "keyence"; string S; cin >> S; bool is_satisfied = false; for (size_t len_head = 0; len_head <= keyword.size(); len_head++) { size_t len_tail = keyword.size() - len_head; if (S.substr(0, len_head) == keyword.substr(0, len_head) && S.substr(S.size() - len_tail) == keyword.substr(keyword.size() - len_tail)) { is_satisfied = true; break; } } string ans = is_satisfied ? "YES" : "NO"; cout << ans << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
947,986
947,987
u068765697
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(), a.end()), a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int, vector<int>, greater<int>> #define PriP \ priority_queue<P<int, int>, vector<P<int, int>>, greater<P<int, int>>> #define all(a) (a).begin(), (a).end() #define ff first.first #define fs first.second #define sf second.first #define ss second.second signed main() { string s; cin >> s; if (s == "keyence") { cout << "YES" << endl; return 0; } int n = s.size(); fo(i, n) { for (int j = i; j < n; j++) { string t = ""; fo(k, n) { if (i <= k && k >= j) continue; t.pb(s[k]); } if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define bgn begin() #define sz size() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(), a.end()), a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int, vector<int>, greater<int>> #define PriP \ priority_queue<P<int, int>, vector<P<int, int>>, greater<P<int, int>>> #define all(a) (a).begin(), (a).end() #define ff first.first #define fs first.second #define sf second.first #define ss second.second signed main() { string s; cin >> s; if (s == "keyence") { cout << "YES" << endl; return 0; } int n = s.size(); fo(i, n) { for (int j = i; j < n; j++) { string t = ""; fo(k, n) { if (i <= k && k <= j) continue; t.pb(s[k]); } if (t == "keyence") { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
948,035
948,036
u790461875
cpp
p03150
#include <bits/stdc++.h> using namespace std; template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); } template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); } typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<long long> vlong; typedef vector<string> vstring; #define _GLIBCXX_DEBUG #define vpush(a, x) a.push_back(x); #define rep(i, n) REP(i, 0, n) #define all(v) v.begin(), v.end() #define REP(i, x, n) for (int i = x; i < n; i++) const int INF = 1 << 30; const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}; const int dy[] = {0, -1, 0, 1, 1, -1, -1, 1}; #define stp(x) setprecision(x) int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin >> s; string key = "keyence"; if (s == key) { cout << "YES" << '\n'; return (0); } int si = s.size(); rep(i, si) { rep(j, si) { string cp; rep(k, i) { cp += s[k]; } REP(k, j, si) { cp += s[k]; } if (cp == key) { cout << "YES" << '\n'; return (0); } } } cout << "No" << '\n'; return (0); }
#include <bits/stdc++.h> using namespace std; template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); } template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); } typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; typedef vector<long long> vlong; typedef vector<string> vstring; #define _GLIBCXX_DEBUG #define vpush(a, x) a.push_back(x); #define rep(i, n) REP(i, 0, n) #define all(v) v.begin(), v.end() #define REP(i, x, n) for (int i = x; i < n; i++) const int INF = 1 << 30; const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}; const int dy[] = {0, -1, 0, 1, 1, -1, -1, 1}; #define stp(x) setprecision(x) int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin >> s; string key = "keyence"; if (s == key) { cout << "YES" << '\n'; return (0); } int si = s.size(); rep(i, si) { rep(j, si) { string cp; rep(k, i) { cp += s[k]; } REP(k, j, si) { cp += s[k]; } if (cp == key) { cout << "YES" << '\n'; return (0); } } } cout << "NO" << '\n'; return (0); }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
948,041
948,042
u132033278
cpp
p03150
#include <bits/stdc++.h> using namespace std; #define INF 1001001001 #define LINF 1001001001001001001 #define MOD 1000000007 #define MOD2 998244353 template <class T, class U> bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> bool chmin(T &a, const U &b) { if (b < a) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0, _i = (n); i < _i; ++i) #define rep1(i, a, b) for (int a_ = (a), b_ = (b), i = a_; i < b_; ++i) #define repr(i, n) for (int _i = (n), i = _i; i > 0; --i) #define db(x) cerr << #x << " = " << x << " "; #define db2(x, y) \ cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ") "; #define db3(x, y, z) \ cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y \ << ", " << z << ") "; #define ln cout << endl; #define all(a) (a).begin(), (a).end() #define dig(n) to_string(n).length() #define pb push_back #define eb emplace_back #define mp make_pair #define se second #define fi first typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> iP; typedef pair<P, P> PP; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { bool flag = false; ll ans = 0, sum = 0; string s; cin >> s; int l = s.length(); rep1(i, 1, l + 1) { rep1(j, i, (l + 1 - i)) { string tmp = s; tmp.erase(i, j); if (tmp == "keyence") { flag = true; break; } } } // cout <<fixed<<setprecision(16)<< << endl; if (flag) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define INF 1001001001 #define LINF 1001001001001001001 #define MOD 1000000007 #define MOD2 998244353 template <class T, class U> bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> bool chmin(T &a, const U &b) { if (b < a) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0, _i = (n); i < _i; ++i) #define rep1(i, a, b) for (int a_ = (a), b_ = (b), i = a_; i < b_; ++i) #define repr(i, n) for (int _i = (n), i = _i; i > 0; --i) #define db(x) cerr << #x << " = " << x << " "; #define db2(x, y) \ cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ") "; #define db3(x, y, z) \ cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y \ << ", " << z << ") "; #define ln cout << endl; #define all(a) (a).begin(), (a).end() #define dig(n) to_string(n).length() #define pb push_back #define eb emplace_back #define mp make_pair #define se second #define fi first typedef long long ll; typedef pair<int, int> P; typedef pair<int, P> iP; typedef pair<P, P> PP; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { bool flag = false; ll ans = 0, sum = 0; string s; cin >> s; int l = s.length(); rep1(i, 1, l + 1) { rep1(j, 0, (l + 1 - i)) { string tmp = s; tmp.erase(i, j); if (tmp == "keyence") { flag = true; break; } } } // cout <<fixed<<setprecision(16)<< << endl; if (flag) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
948,045
948,046
u355424600
cpp
p03150
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if (s == "keyence") { cout << "YES" << endl; return 0; } for (int i = 0; i < s.size(); i++) for (int j = 1; j + i <= s.size(); j++) { string ss = s.substr(0, i) + s.substr(i + j); // cout<<i<<" "<<j<<" "<<ss<<endl; if (ss == "keyence") { cout << "YES" << endl; return 0; } } cout << "N0" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if (s == "keyence") { cout << "YES" << endl; return 0; } for (int i = 0; i < s.size(); i++) for (int j = 1; j + i <= s.size(); j++) { string ss = s.substr(0, i) + s.substr(i + j); // cout<<i<<" "<<j<<" "<<ss<<endl; if (ss == "keyence") { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
[ "literal.string.change", "io.output.change" ]
948,057
948,058
u792037966
cpp
p03150
#include <iostream> #include <string> using namespace std; int main(int argc, char const *argv[]) { string S; cin >> S; string k = "keyence"; string str1, str2; int find1, find2, find3; for (int i = 1; i <= 6; i++) { str1 = k.substr(0, i); str2 = k.substr(i, 7 - i); find1 = S.find(str1); find2 = S.find(str2); find3 = S.find(k); if ((find1 != string::npos && find2 != string::npos) && (find1 < find2) && (0 == find1) && (S.size() - (7 - i) == find3)) { cout << "YES" << endl; return 0; } if (find3 != string::npos) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main(int argc, char const *argv[]) { string S; cin >> S; string k = "keyence"; string str1, str2; int find1, find2, find3; for (int i = 1; i <= 6; i++) { str1 = k.substr(0, i); str2 = k.substr(i, 7 - i); find1 = S.find(str1); find2 = S.rfind(str2); find3 = S.find(k); if ((find1 != string::npos && find2 != string::npos) && (find1 < find2) && (0 == find1) && (S.size() - (7 - i) == find2)) { cout << "YES" << endl; return 0; } if (find3 != string::npos) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }
[ "assignment.value.change", "call.function.change", "identifier.change", "control_flow.branch.if.condition.change" ]
948,065
948,064
u912952979
cpp