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
8 values
p02943
#include <bits/stdc++.h> #define dbug(x) cout << #x << "=" << x << endl using namespace std; template <typename T> void read(T &t) { t = 0; char ch = getchar(); int f = 1; while ('0' > ch || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } do { (t *= 10) += ch - '0'; ch = getchar(); } while ('0' <= ch && ch <= '9'); t *= f; } const int maxn = 20010; char s[maxn], ch, ans[maxn], t[maxn]; bool cmp(char a[], char b[]) { int n = strlen(a + 1), m = strlen(b + 1); if (n != m) return n < m; for (int i = 1; i <= n; i++) if (a[i] != b[i]) return a[i] < b[i]; return 0; } int n, k; bool solve() { int len = 0; while (t[n - len] == ch && len < n) len++; // if (!len&&k>1) return 0; // printf("%s\n",t+1); for (int i = 2; i <= k && len < n; i++) { for (int j = n + 1; j <= n * 2; j++) t[j] = t[n - (j - n) + 1]; if (i < k) for (int j = len + 1; j <= n + len; j++) t[j - len] = t[j]; else for (int j = n - len + 1; j <= n * 2 - len; j++) t[j - n + len] = t[j]; t[n + 1] = 0; len *= 2; // printf(" %s\n",t+1); } t[n + 1] = 0; return 1; } int main() { // freopen("1.txt","r",stdin); read(n); read(k); scanf("%s", s + 1); ch = 'z'; for (int i = 1; i <= n; i++) ch = min(ch, s[i]); if (k >= 14) { for (int i = 1; i <= n; i++) printf("%c", ch); printf("\n"); } else { for (int i = n + 1; i <= n * 2; i++) s[i] = s[n - (i - n) + 1]; for (int i = 1; i <= n * 2 + 1; i++) ans[i] = 'z' + 1; /*if (k==1) { for (int i=1;i<=n;i++) { for (int j=i;j<=i+n-1;j++) t[j-i+1]=s[j]; if (cmp(t,ans)) { for (int j=1;j<=n;j++) ans[j]=t[j]; ans[n+1]=0; } } printf("%s\n",ans+1); return 0; }*/ for (int i = 1; i <= n; i++) { for (int j = i; j <= i + n - 1; j++) t[j - i + 1] = s[j]; if (solve() && cmp(t, ans)) { for (int j = 1; j <= n; j++) ans[j] = t[j]; ans[n + 1] = 0; } } printf("%s\n", ans + 1); } return 0; }
#include <bits/stdc++.h> #define dbug(x) cout << #x << "=" << x << endl using namespace std; template <typename T> void read(T &t) { t = 0; char ch = getchar(); int f = 1; while ('0' > ch || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } do { (t *= 10) += ch - '0'; ch = getchar(); } while ('0' <= ch && ch <= '9'); t *= f; } const int maxn = 20010; char s[maxn], ch, ans[maxn], t[maxn]; bool cmp(char a[], char b[]) { int n = strlen(a + 1), m = strlen(b + 1); if (n != m) return n < m; for (int i = 1; i <= n; i++) if (a[i] != b[i]) return a[i] < b[i]; return 0; } int n, k; bool solve() { int len = 0; while (t[n - len] == ch && len < n) len++; for (int i = 2; i <= k && len < n; i++) { for (int j = n + 1; j <= n * 2; j++) t[j] = t[n - (j - n) + 1]; if (i < k) for (int j = len + 1; j <= n + len; j++) t[j - len] = t[j]; else for (int j = n - len + 1; j <= n * 2 - len; j++) t[j - n + len] = t[j]; t[n + 1] = 0; len *= 2; } t[n + 1] = 0; return 1; } int main() { read(n); read(k); scanf("%s", s + 1); ch = 'z'; for (int i = 1; i <= n; i++) ch = min(ch, s[i]); if (k >= 14) { for (int i = 1; i <= n; i++) printf("%c", ch); printf("\n"); } else { for (int i = n + 1; i <= n * 2; i++) s[i] = s[n - (i - n) + 1]; for (int i = 1; i <= n * 2 + 1; i++) ans[i] = 'z' + 1; for (int i = 1; i <= n + 1; i++) { for (int j = i; j <= i + n - 1; j++) t[j - i + 1] = s[j]; if (solve() && cmp(t, ans)) { for (int j = 1; j <= n; j++) ans[j] = t[j]; ans[n + 1] = 0; } } printf("%s\n", ans + 1); } return 0; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
742,667
742,668
u910146840
cpp
p02943
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define all(a) begin(a), end(a) #define FOR(x, val, to) for (int x = (val); x < int((to)); ++x) #define FORE(x, val, to) for (auto x = (val); x <= (to); ++x) #define FORR(x, arr) for (auto &x : arr) #define FORS(x, plus, arr) \ for (auto x = begin(arr) + (plus); x != end(arr); ++x) #define FORREV(x, plus, arr) \ for (auto x = (arr).rbegin() + (plus); x != (arr).rend(); ++x) #define REE(s_) \ { \ cout << s_ << '\n'; \ exit(0); \ } #define GET(arr) \ for (auto &i : (arr)) \ sc(i) #define whatis(x) cerr << #x << " is " << (x) << endl; #define e1 first #define e2 second #define INF 0x7f7f7f7f typedef std::pair<int, int> pi; typedef std::vector<int> vi; typedef std::vector<std::string> vs; typedef int64_t ll; typedef uint64_t ull; #define umap unordered_map #define uset unordered_set using namespace std; using namespace __gnu_pbds; #ifdef _WIN32 #define getchar_unlocked() _getchar_nolock() #define _CRT_DISABLE_PERFCRIT_LOCKS #endif template <class L, class R> ostream &operator<<(ostream &os, map<L, R> P) { for (auto const &vv : P) os << "(" << vv.first << "," << vv.second << ")"; return os; } template <class T> ostream &operator<<(ostream &os, set<T> V) { os << "["; for (auto const &vv : V) os << vv << ","; os << "]"; return os; } template <class T> ostream &operator<<(ostream &os, vector<T> V) { os << "["; for (auto const &vv : V) os << vv << ","; os << "]"; return os; } template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) { os << "(" << P.first << "," << P.second << ")"; return os; } inline int fstoi(const string &str) { auto it = str.begin(); bool neg = 0; int num = 0; if (*it == '-') neg = 1; else num = *it - '0'; ++it; while (it < str.end()) num = num * 10 + (*it++ - '0'); if (neg) num *= -1; return num; } inline void getch(char &x) { while (x = getchar_unlocked(), x < 33) { ; } } inline void getstr(string &str) { str.clear(); char cur; while (cur = getchar_unlocked(), cur < 33) { ; } while (cur > 32) { str += cur; cur = getchar_unlocked(); } } template <typename T> inline bool sc(T &num) { bool neg = 0; int c; num = 0; while (c = getchar_unlocked(), c < 33) { if (c == EOF) return false; } if (c == '-') { neg = 1; c = getchar_unlocked(); } for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48; if (neg) num *= -1; return true; } template <typename T, typename... Args> inline void sc(T &num, Args &...args) { bool neg = 0; int c; num = 0; while (c = getchar_unlocked(), c < 33) { ; } if (c == '-') { neg = 1; c = getchar_unlocked(); } for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48; if (neg) num *= -1; sc(args...); } template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // s.find_by_order(), // s.order_of_key() <- works like // lower_bound template <typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define N 1000001 int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, k; sc(n, k); string s; getstr(s); while (k--) { string cp = s; sort(all(cp)); if (cp.front() == cp.back()) REE(s) /* if(unique(all(cp)) == cp.begin()+1) REE(s) */ string ss = s + string(s.rbegin(), s.rend()); string ret(n, 'z'); if (!k) { FOR(i, 0, n) { if (ret > string(ss.begin() + i, ss.begin() + i + n)) { ret = string(ss.begin() + i, ss.begin() + i + n); } } REE(ret) } FOR(i, 0, n) { string nw = string(ss.begin() + i, ss.begin() + i + n); reverse(all(nw)); if (ret > nw) { ret = nw; } } reverse(all(ret)); s = ret; } }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define all(a) begin(a), end(a) #define FOR(x, val, to) for (int x = (val); x < int((to)); ++x) #define FORE(x, val, to) for (auto x = (val); x <= (to); ++x) #define FORR(x, arr) for (auto &x : arr) #define FORS(x, plus, arr) \ for (auto x = begin(arr) + (plus); x != end(arr); ++x) #define FORREV(x, plus, arr) \ for (auto x = (arr).rbegin() + (plus); x != (arr).rend(); ++x) #define REE(s_) \ { \ cout << s_ << '\n'; \ exit(0); \ } #define GET(arr) \ for (auto &i : (arr)) \ sc(i) #define whatis(x) cerr << #x << " is " << (x) << endl; #define e1 first #define e2 second #define INF 0x7f7f7f7f typedef std::pair<int, int> pi; typedef std::vector<int> vi; typedef std::vector<std::string> vs; typedef int64_t ll; typedef uint64_t ull; #define umap unordered_map #define uset unordered_set using namespace std; using namespace __gnu_pbds; #ifdef _WIN32 #define getchar_unlocked() _getchar_nolock() #define _CRT_DISABLE_PERFCRIT_LOCKS #endif template <class L, class R> ostream &operator<<(ostream &os, map<L, R> P) { for (auto const &vv : P) os << "(" << vv.first << "," << vv.second << ")"; return os; } template <class T> ostream &operator<<(ostream &os, set<T> V) { os << "["; for (auto const &vv : V) os << vv << ","; os << "]"; return os; } template <class T> ostream &operator<<(ostream &os, vector<T> V) { os << "["; for (auto const &vv : V) os << vv << ","; os << "]"; return os; } template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) { os << "(" << P.first << "," << P.second << ")"; return os; } inline int fstoi(const string &str) { auto it = str.begin(); bool neg = 0; int num = 0; if (*it == '-') neg = 1; else num = *it - '0'; ++it; while (it < str.end()) num = num * 10 + (*it++ - '0'); if (neg) num *= -1; return num; } inline void getch(char &x) { while (x = getchar_unlocked(), x < 33) { ; } } inline void getstr(string &str) { str.clear(); char cur; while (cur = getchar_unlocked(), cur < 33) { ; } while (cur > 32) { str += cur; cur = getchar_unlocked(); } } template <typename T> inline bool sc(T &num) { bool neg = 0; int c; num = 0; while (c = getchar_unlocked(), c < 33) { if (c == EOF) return false; } if (c == '-') { neg = 1; c = getchar_unlocked(); } for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48; if (neg) num *= -1; return true; } template <typename T, typename... Args> inline void sc(T &num, Args &...args) { bool neg = 0; int c; num = 0; while (c = getchar_unlocked(), c < 33) { ; } if (c == '-') { neg = 1; c = getchar_unlocked(); } for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48; if (neg) num *= -1; sc(args...); } template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // s.find_by_order(), // s.order_of_key() <- works like // lower_bound template <typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define N 1000001 int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, k; sc(n, k); string s; getstr(s); while (k--) { string cp = s; sort(all(cp)); if (cp.front() == cp.back()) REE(s) /* if(unique(all(cp)) == cp.begin()+1) REE(s) */ string ss = s + string(s.rbegin(), s.rend()); string ret(n, 'z'); if (!k) { FORE(i, 0, n) { if (ret > string(ss.begin() + i, ss.begin() + i + n)) { ret = string(ss.begin() + i, ss.begin() + i + n); } } REE(ret) } FORE(i, 0, n) { string nw = string(ss.begin() + i, ss.begin() + i + n); reverse(all(nw)); if (ret > nw) { ret = nw; } } reverse(all(ret)); s = ret; } }
[ "identifier.change", "call.function.change" ]
742,669
742,670
u761407600
cpp
p02943
// warm heart, wagging tail,and a smile just for you! // // ▒█████▒▒ // ██████████▒ // ▒████████████▒ // ██████████████████ // ████████████████████▒ // ▒██████████████████████▒ // ▒███████████████████████ // ▒████▒▒▒▒▒▒█████████████████▒ // ███▒▒▒▒▒▒██████████████████████▒▒▒ // ▒██▒▒███████████████████████▒▒▒▒▒██████ // ▒█████████████████████████▒▒▒▒▒▒█████████▒ // ▒█████████████████████▒▒▒▒▒▒██████████████ // ▒████ ████▒▒▒▒▒████ ████▒ // ▒█████▒ ████ ▒▒▒▒███████ ████ ██████▒ // ▒██▒▒▒▒▒ ██████ █████████ ██████ ██▒▒▒██▒ // █████████ ████████ █████████ ████████ ▒▒▒▒█████ // ▒█████████ ██████ ████████▒ ██████ █████████ // ▒██████████ ████ █████▒▒▒▒▒▒ ████ ██████████ // ████████████ ▒▒▒▒▒▒▒████████ ███████████▒ // ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒ // ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒ // ▒▒▒▒▒▒▒▒▒██████████████ ███████▒▒▒▒███████████ // █████████████████████████ ███████▒▒▒██████████████▒ // █████████████████████████████ ███████▒▒▒██████████████████▒ // ██████████████████████████████████████████████████████████████████████ // ██████████████████████████████████████████████████████████████████▒ // ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒ // #include "bits/stdc++.h" using namespace std; #define MOD 1000000007 //#define MOD 998244353 const double EPS = 1e-9; #define INF (1LL << 60) #define D double #define fs first #define sc second #define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (b - 1); i >= (a); --i) #define REP(i, n) FOR(i, 0, (n)) #define RREP(i, n) RFOR(i, 0, (n)) #define ITR(itr, mp) for (auto itr = (mp).begin(); itr != (mp).end(); ++itr) #define RITR(itr, mp) for (auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr) #define range(i, a, b) ((a) <= (i) && (i) < (b)) #define debug(x) cout << #x << " = " << (x) << endl; #define SP << " " << typedef pair<int, int> P; typedef vector<int> vec; typedef vector<vector<int>> mat; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; string s; cin >> n >> k >> s; char c = 'z'; REP(i, n) c = min(c, s[i]); if (k >= 14) { REP(i, n) cout << c; cout << endl; return 0; } REP(_, k - 1) { string t = s; reverse(t.begin(), t.end()); string u = s + t; reverse(u.begin(), u.end()); string res = t; REP(i, n) res = min(res, u.substr(i + 1, n)); reverse(res.begin(), res.end()); s = res; } string t = s; reverse(t.begin(), t.end()); string u = s + t; string res = s; REP(i, n) res = min(res, u.substr(i + 1, n)); s = res; cout << s << endl; return 0; }
// warm heart, wagging tail,and a smile just for you! // // ▒█████▒▒ // ██████████▒ // ▒████████████▒ // ██████████████████ // ████████████████████▒ // ▒██████████████████████▒ // ▒███████████████████████ // ▒████▒▒▒▒▒▒█████████████████▒ // ███▒▒▒▒▒▒██████████████████████▒▒▒ // ▒██▒▒███████████████████████▒▒▒▒▒██████ // ▒█████████████████████████▒▒▒▒▒▒█████████▒ // ▒█████████████████████▒▒▒▒▒▒██████████████ // ▒████ ████▒▒▒▒▒████ ████▒ // ▒█████▒ ████ ▒▒▒▒███████ ████ ██████▒ // ▒██▒▒▒▒▒ ██████ █████████ ██████ ██▒▒▒██▒ // █████████ ████████ █████████ ████████ ▒▒▒▒█████ // ▒█████████ ██████ ████████▒ ██████ █████████ // ▒██████████ ████ █████▒▒▒▒▒▒ ████ ██████████ // ████████████ ▒▒▒▒▒▒▒████████ ███████████▒ // ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒ // ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒ // ▒▒▒▒▒▒▒▒▒██████████████ ███████▒▒▒▒███████████ // █████████████████████████ ███████▒▒▒██████████████▒ // █████████████████████████████ ███████▒▒▒██████████████████▒ // ██████████████████████████████████████████████████████████████████████ // ██████████████████████████████████████████████████████████████████▒ // ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒ // #include "bits/stdc++.h" using namespace std; #define MOD 1000000007 //#define MOD 998244353 const double EPS = 1e-9; #define INF (1LL << 60) #define D double #define fs first #define sc second #define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define RFOR(i, a, b) for (int i = (b - 1); i >= (a); --i) #define REP(i, n) FOR(i, 0, (n)) #define RREP(i, n) RFOR(i, 0, (n)) #define ITR(itr, mp) for (auto itr = (mp).begin(); itr != (mp).end(); ++itr) #define RITR(itr, mp) for (auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr) #define range(i, a, b) ((a) <= (i) && (i) < (b)) #define debug(x) cout << #x << " = " << (x) << endl; #define SP << " " << typedef pair<int, int> P; typedef vector<int> vec; typedef vector<vector<int>> mat; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; string s; cin >> n >> k >> s; char c = 'z'; REP(i, n) c = min(c, s[i]); if (k >= 14) { REP(i, n) cout << c; cout << endl; return 0; } REP(_, k - 1) { string t = s; reverse(t.begin(), t.end()); string u = s + t; reverse(u.begin(), u.end()); string res = s; REP(i, n) res = min(res, u.substr(i + 1, n)); reverse(res.begin(), res.end()); s = res; } string t = s; reverse(t.begin(), t.end()); string u = s + t; string res = s; REP(i, n) res = min(res, u.substr(i + 1, n)); s = res; cout << s << endl; return 0; }
[ "variable_declaration.value.change", "identifier.change" ]
742,681
742,682
u239493918
cpp
p02943
#include <bits/stdc++.h> using namespace std; const int max_n = 5555, inf = 1000111222; int n, k; string s; string getr(const string &s, int pos) { return {s.rbegin() + s.length() - 1 - pos, s.rbegin() + s.length() - 1 - pos + n}; } string one_step(const string &s) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; string res = s; for (int i = 1; i < n; ++i) { res = min(res, t.substr(i, n)); } return res; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); cin >> n >> k >> s; --k; char mn = s[0]; for (char c : s) { mn = min(mn, c); } if (k) { string rs = s; reverse(rs.begin(), rs.end()); int mx = 0, pos = 0; string t = s + rs; for (int i = 0; i < t.length(); ++i) { int st = i; while (i < t.length() && t[i] == mn) { ++i; } int cnt = i - st; if (i - 1 >= s.length() && (mx < cnt || mx == cnt && getr(t, pos) > getr(t, i))) { pos = i - 1; mx = cnt; } } // cout << t << endl; // cout << mx << " " << pos << " " << getr(t, pos) << endl; s = getr(t, pos); reverse(s.begin(), s.end()); --k; // cout << "$" << s << " " << k << endl; mx = min(mx, n); k = min(k, 20); while (k--) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; s = getr(t, s.length() + mx - 1); reverse(s.begin(), s.end()); mx *= 2; mx = min(mx, n); } // cout << s << endl; } cout << one_step(s) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int max_n = 5555, inf = 1000111222; int n, k; string s; string getr(const string &s, int pos) { return {s.rbegin() + s.length() - 1 - pos, s.rbegin() + s.length() - 1 - pos + n}; } string one_step(const string &s) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; string res = s; for (int i = 1; i < n; ++i) { res = min(res, t.substr(i, n)); } return res; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); cin >> n >> k >> s; --k; char mn = s[0]; for (char c : s) { mn = min(mn, c); } if (k) { string rs = s; reverse(rs.begin(), rs.end()); int mx = 0, pos = 0; string t = s + rs; for (int i = 0; i < t.length(); ++i) { int st = i; while (i < t.length() && t[i] == mn) { ++i; } int cnt = i - st; if (i - 1 >= s.length() && (mx < cnt || mx == cnt && getr(t, pos) > getr(t, i - 1))) { pos = i - 1; mx = cnt; } } // cout << t << endl; // cout << mx << " " << pos << " " << getr(t, pos) << endl; s = getr(t, pos); reverse(s.begin(), s.end()); --k; // cout << "$" << s << " " << k << endl; mx = min(mx, n); k = min(k, 20); while (k--) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; s = getr(t, s.length() + mx - 1); reverse(s.begin(), s.end()); mx *= 2; mx = min(mx, n); } // cout << s << endl; } cout << one_step(s) << endl; return 0; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one", "call.arguments.add" ]
742,687
742,688
u844891589
cpp
p02943
#include <bits/stdc++.h> using namespace std; const int max_n = 5555, inf = 1000111222; int n, k; string s; string getr(const string &s, int pos) { return {s.rbegin() + s.length() - 1 - pos, s.rbegin() + s.length() - 1 - pos + n}; } string one_step(const string &s) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; string res = s; for (int i = 1; i <= n; ++i) { res = min(res, t.substr(i, n)); } return res; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); cin >> n >> k >> s; --k; char mn = s[0]; for (char c : s) { mn = min(mn, c); } if (k) { string rs = s; reverse(rs.begin(), rs.end()); int mx = 0, pos = 0; string t = s + rs; for (int i = 0; i < t.length(); ++i) { int st = i; while (i < t.length() && t[i] == mn) { ++i; } int cnt = i - st; if (cnt == 0) { continue; } if (i >= n && (mx < cnt || mx == cnt && getr(t, pos) > getr(t, i))) { pos = i - 1; mx = cnt; } } // cout << t << endl; // cout << mx << " " << pos << " " << getr(t, pos) << endl; s = getr(t, pos); reverse(s.begin(), s.end()); --k; // cout << "$" << s << " " << k << endl; mx = min(mx, n); while (k--) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; s = getr(t, s.length() + mx - 1); reverse(s.begin(), s.end()); mx *= 2; mx = min(mx, n); if (mx == n) { break; } } // cout << s << endl; } cout << one_step(s) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int max_n = 5555, inf = 1000111222; int n, k; string s; string getr(const string &s, int pos) { return {s.rbegin() + s.length() - 1 - pos, s.rbegin() + s.length() - 1 - pos + n}; } string one_step(const string &s) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; string res = s; for (int i = 1; i <= n; ++i) { res = min(res, t.substr(i, n)); } return res; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); cin >> n >> k >> s; --k; char mn = s[0]; for (char c : s) { mn = min(mn, c); } if (k) { string rs = s; reverse(rs.begin(), rs.end()); int mx = 0, pos = 0; string t = s + rs; for (int i = 0; i < t.length(); ++i) { int st = i; while (i < t.length() && t[i] == mn) { ++i; } int cnt = i - st; if (cnt == 0) { continue; } if (i >= n && (mx < cnt || mx == cnt && getr(t, pos) > getr(t, i - 1))) { pos = i - 1; mx = cnt; } } // cout << t << endl; // cout << mx << " " << pos << " " << getr(t, pos) << endl; s = getr(t, pos); reverse(s.begin(), s.end()); --k; // cout << "$" << s << " " << k << endl; mx = min(mx, n); while (k--) { string rs = s; reverse(rs.begin(), rs.end()); string t = s + rs; s = getr(t, s.length() + mx - 1); reverse(s.begin(), s.end()); mx *= 2; mx = min(mx, n); if (mx == n) { break; } } // cout << s << endl; } cout << one_step(s) << endl; return 0; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one", "call.arguments.add" ]
742,689
742,690
u844891589
cpp
p02943
#include <algorithm> #include <bitset> #include <cassert> #include <ciso646> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; //#define int long long typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; const ll mod = 998244353; const ll INF = mod * mod; typedef pair<int, int> P; #define stop \ char nyaa; \ cin >> nyaa; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define Rep(i, sta, n) for (int i = sta; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define per1(i, n) for (int i = n; i >= 1; i--) #define Rep1(i, sta, n) for (int i = sta; i <= n; i++) typedef pair<ll, ll> LP; typedef vector<ll> vec; typedef vector<string> svec; typedef long double ld; typedef pair<ld, ld> LDP; const ld eps = 1e-5; void solve() { int n, k; string s; cin >> n >> k >> s; ll d = k / 2; int mi = 100; rep(i, n) { mi = min(mi, s[i] - 'a'); } string ansg = s; int mlen = 0; if (k > 28) { rep(i, n) { cout << char('a' + mi); } cout << endl; return; } rep(i, n) { int le = i; while (i + 1 < n && s[i] == s[i + 1]) i++; if (s[i] - 'a' != mi) continue; int len = i - le + 1; if (i == n - 1) { ll tim = (1 << k); if (tim * len >= n) { rep(j, n) { cout << char('a' + mi); } cout << endl; return; } string nex; rep(j, tim * len) { nex.push_back('a' + mi); } // cout << "?" << nex.size() << endl; int cur = le - 1; while (nex.size() < n) { nex.push_back(s[cur]); cur--; } ansg = min(ansg, nex); } else { ll tim = (1 << d); if (tim * len > n) { rep(j, n) { cout << char('a' + mi); } cout << endl; return; } string c; rep(j, tim * len) { c.push_back('a' + mi); } int cur = i + 1; while (c.size() < n) { int id = cur; if (cur >= n) id = 2 * n - 1 - cur; c.push_back(s[id]); cur++; } ansg = min(ansg, c); } } cout << ansg << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); // cout << fixed << setprecision(5); // init(); solve(); // cout << "finish" << endl; // stop return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <ciso646> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; //#define int long long typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; const ll mod = 998244353; const ll INF = mod * mod; typedef pair<int, int> P; #define stop \ char nyaa; \ cin >> nyaa; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define Rep(i, sta, n) for (int i = sta; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define per1(i, n) for (int i = n; i >= 1; i--) #define Rep1(i, sta, n) for (int i = sta; i <= n; i++) typedef pair<ll, ll> LP; typedef vector<ll> vec; typedef vector<string> svec; typedef long double ld; typedef pair<ld, ld> LDP; const ld eps = 1e-5; void solve() { int n, k; string s; cin >> n >> k >> s; ll d = k / 2; int mi = 100; rep(i, n) { mi = min(mi, s[i] - 'a'); } string ansg = s; int mlen = 0; if (k > 28) { rep(i, n) { cout << char('a' + mi); } cout << endl; return; } rep(i, n) { int le = i; while (i + 1 < n && s[i] == s[i + 1]) i++; if (s[i] - 'a' != mi) continue; int len = i - le + 1; if (i == n - 1) { ll tim = (1 << k); if (tim * len >= n) { rep(j, n) { cout << char('a' + mi); } cout << endl; return; } string nex; rep(j, tim * len) { nex.push_back('a' + mi); } // cout << "?" << nex.size() << endl; int cur = le - 1; while (nex.size() < n) { nex.push_back(s[cur]); cur--; } ansg = min(ansg, nex); } else { ll tim = (1 << k - 1); if (tim * len > n) { rep(j, n) { cout << char('a' + mi); } cout << endl; return; } string c; rep(j, tim * len) { c.push_back('a' + mi); } int cur = i + 1; while (c.size() < n) { int id = cur; if (cur >= n) id = 2 * n - 1 - cur; c.push_back(s[id]); cur++; } ansg = min(ansg, c); } } cout << ansg << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); // cout << fixed << setprecision(5); // init(); solve(); // cout << "finish" << endl; // stop return 0; }
[ "identifier.change", "expression.operation.binary.change" ]
742,694
742,695
u294531924
cpp
p02943
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 //#define MOD 998244353 #define INF 1145141919810893364 #define PI 3.141592653589 typedef pair<int, int> PP; typedef long long ll; #define int ll #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++i) #define OREP(i, n) for (int i = 1; i <= (n); ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i) #define GOODBYE \ cout << "-1" << endl; \ return 0 #define MM << " " << #define Endl endl bool comp(queue<char> G, queue<char> H) { if (G.size() > H.size()) swap(G, H); int F = G.size(); REP(i, F) { char g = G.front(), h = H.front(); G.pop(); H.pop(); if (g < h) { return true; } else if (g > h) { return false; } } return true; } signed main() { int N, K; string S; cin >> N >> K; cin >> S; int e = 1; REP(k, K - 1) { string U; queue<char> O, P; REP(i, N) { O.push(S[i]); } P = O; REP(i, N) { P.pop(); P.push(S[N - i - 1]); if (comp(P, O)) { O = P; } } REP(i, N) { U.push_back(O.front()); O.pop(); } reverse(U.begin(), U.end()); S = U; e *= 2; if (e >= K) break; } string U; queue<char> O, P; REP(i, N) { O.push(S[i]); } P = O; REP(i, N) { P.pop(); P.push(S[N - i - 1]); if (comp(P, O)) { O = P; } } REP(i, N) { U.push_back(O.front()); O.pop(); } S = U; cout << S << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 //#define MOD 998244353 #define INF 1145141919810893364 #define PI 3.141592653589 typedef pair<int, int> PP; typedef long long ll; #define int ll #define setdouble setprecision #define REP(i, n) for (int i = 0; i < (n); ++i) #define OREP(i, n) for (int i = 1; i <= (n); ++i) #define RREP(i, n) for (int i = (n)-1; i >= 0; --i) #define GOODBYE \ cout << "-1" << endl; \ return 0 #define MM << " " << #define Endl endl bool comp(queue<char> G, queue<char> H) { if (G.size() > H.size()) swap(G, H); int F = G.size(); REP(i, F) { char g = G.front(), h = H.front(); G.pop(); H.pop(); if (g < h) { return true; } else if (g > h) { return false; } } return true; } signed main() { int N, K; string S; cin >> N >> K; cin >> S; int e = 1; REP(k, K - 1) { string U; queue<char> O, P; REP(i, N) { O.push(S[i]); } P = O; REP(i, N) { P.pop(); P.push(S[N - i - 1]); if (comp(P, O)) { O = P; } } REP(i, N) { U.push_back(O.front()); O.pop(); } reverse(U.begin(), U.end()); S = U; e *= 2; // cout << S << endl; if (e >= 2 * N) break; } string U; queue<char> O, P; REP(i, N) { O.push(S[i]); } P = O; REP(i, N) { P.pop(); P.push(S[N - i - 1]); if (comp(P, O)) { O = P; } } REP(i, N) { U.push_back(O.front()); O.pop(); } S = U; cout << S << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.branch.if.condition.change" ]
742,700
742,701
u554953477
cpp
p02943
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; #define fr first #define sc second int main() { static int n, k; static string s; cin >> n >> k >> s; char c = 'z'; for (int i = 0; i < s.size(); i++) { c = min(c, s[i]); } if (k >= 14) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } int l = 0; vector<int> vec; string u = s; reverse(s.begin(), s.end()); u += s; // cout << u << endl; for (int i = 0; i < u.size(); i++) { int j = i; while (j < u.size() && u[j] == c) j++; if (l < j - i) { l = j - i; vec.clear(); vec.push_back(i); } else if (l == j - i) { vec.push_back(i); } } int x = (1 << (k - 1)) * l; if (x >= n) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } /*cout << x << endl; for(int i = 0 ; i < vec.size() ; i ++){ cout << vec[i] << endl; }*/ string ret = ""; for (int i = 0; i < vec.size(); i++) { int id = vec[i]; if (id < n - x) continue; string ret_ = ""; for (int j = id - 1; j >= id - (n - x); j--) { ret_ += u[j]; } if (ret == "") ret = ret_; else { for (int j = 0; j < n - x; j++) { if (ret[j] < ret_[j]) break; else if (ret[j] > ret_[j]) { ret = ret_; break; } } } } for (int i = 0; i < x; i++) { printf("%c", c); } cout << ret << endl; }
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; #define fr first #define sc second int main() { static int n, k; static string s; cin >> n >> k >> s; char c = 'z'; for (int i = 0; i < s.size(); i++) { c = min(c, s[i]); } if (k >= 14) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } int l = 0; vector<int> vec; string u = s; reverse(s.begin(), s.end()); u += s; // cout << u << endl; for (int i = 0; i < u.size(); i++) { int j = i; while (j < u.size() && u[j] == c) j++; if (l < j - i) { l = j - i; vec.clear(); vec.push_back(i); } else if (l == j - i) { vec.push_back(i); } } int x = (1 << (k - 1)) * l; if (x >= n) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } /*cout << x << endl; for(int i = 0 ; i < vec.size() ; i ++){ cout << vec[i] << endl; }*/ string ret = ""; for (int i = 0; i < vec.size(); i++) { int id = vec[i]; if (id < n - l) continue; string ret_ = ""; for (int j = id - 1; j >= id - (n - x); j--) { ret_ += u[j]; } if (ret == "") ret = ret_; else { for (int j = 0; j < n - x; j++) { if (ret[j] < ret_[j]) break; else if (ret[j] > ret_[j]) { ret = ret_; break; } } } } for (int i = 0; i < x; i++) { printf("%c", c); } cout << ret << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
742,723
742,724
u957457849
cpp
p02943
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; #define fr first #define sc second int main() { static int n, k; static string s; cin >> n >> k >> s; char c = 'z'; for (int i = 0; i < s.size(); i++) { c = min(c, s[i]); } if (k >= 13) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } int l = 0; vector<int> vec; string u = s; reverse(s.begin(), s.end()); u += s; // cout << u << endl; for (int i = 0; i < u.size(); i++) { int j = i; while (j < u.size() && u[j] == c) j++; if (l < j - i) { l = j - i; vec.clear(); vec.push_back(i); } else if (l == j - i) { vec.push_back(i); } } int x = (1 << (k - 1)) * l; if (x >= n) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } /*cout << x << endl; for(int i = 0 ; i < vec.size() ; i ++){ cout << vec[i] << endl; }*/ string ret = ""; for (int i = 0; i < vec.size(); i++) { int id = vec[i]; if (id < n - x) continue; string ret_ = ""; for (int j = id - 1; j >= id - (n - x); j--) { ret_ += u[j]; } if (ret == "") ret = ret_; else { for (int j = 0; j < n - x; j++) { if (ret[j] < ret_[j]) break; else if (ret[j] > ret_[j]) { ret = ret_; break; } } } } for (int i = 0; i < x; i++) { printf("%c", c); } cout << ret << endl; }
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> P; #define fr first #define sc second int main() { static int n, k; static string s; cin >> n >> k >> s; char c = 'z'; for (int i = 0; i < s.size(); i++) { c = min(c, s[i]); } if (k >= 14) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } int l = 0; vector<int> vec; string u = s; reverse(s.begin(), s.end()); u += s; // cout << u << endl; for (int i = 0; i < u.size(); i++) { int j = i; while (j < u.size() && u[j] == c) j++; if (l < j - i) { l = j - i; vec.clear(); vec.push_back(i); } else if (l == j - i) { vec.push_back(i); } } int x = (1 << (k - 1)) * l; if (x >= n) { string ret = ""; for (int i = 0; i < n; i++) { ret += c; } cout << ret << endl; return 0; } /*cout << x << endl; for(int i = 0 ; i < vec.size() ; i ++){ cout << vec[i] << endl; }*/ string ret = ""; for (int i = 0; i < vec.size(); i++) { int id = vec[i]; if (id < n - l) continue; string ret_ = ""; for (int j = id - 1; j >= id - (n - x); j--) { ret_ += u[j]; } if (ret == "") ret = ret_; else { for (int j = 0; j < n - x; j++) { if (ret[j] < ret_[j]) break; else if (ret[j] > ret_[j]) { ret = ret_; break; } } } } for (int i = 0; i < x; i++) { printf("%c", c); } cout << ret << endl; }
[ "literal.number.change", "control_flow.branch.if.condition.change", "identifier.change" ]
742,725
742,724
u957457849
cpp
p02943
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; int k, n; cin >> n >> k >> s; vector<int> cnt(n, 0); char best = *min_element(s.begin(), s.end()); if (k > 14) { for (int i = 0; i < n; ++i) cout << best; } else { if (k == 1) { string t = s, ans = s; reverse(t.begin(), t.end()); s += t; for (int i = 0; i < n + 1; ++i) { if (ans > s.substr(i, n)) ans = s.substr(i, n); } cout << ans; return 0; } string t = s; reverse(t.begin(), t.end()); string ans = s; s += t; k -= 1; int cnt = 0; for (int i = s.size() - 1; i >= 0; --i) { if (s[i] == best) cnt++; else { cnt = 0; } int get = min(n, cnt << k); // cout << cnt << endl; if (i < n - get) { // cout << "bug" << endl; continue; } string tmp = s.substr(i - n + get, n - get); reverse(tmp.begin(), tmp.end()); ans = min(ans, string(get, best) + tmp); } cout << ans; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; int k, n; cin >> n >> k >> s; vector<int> cnt(n, 0); char best = *min_element(s.begin(), s.end()); if (k > 15) { for (int i = 0; i < n; ++i) cout << best; } else { if (k == 1) { string t = s, ans = s; reverse(t.begin(), t.end()); s += t; for (int i = 0; i < n + 1; ++i) { if (ans > s.substr(i, n)) ans = s.substr(i, n); } cout << ans; return 0; } string t = s; reverse(t.begin(), t.end()); string ans = s; s += t; k -= 1; int cnt = 0; for (int i = s.size() - 1; i >= 0; --i) { if (s[i] == best) cnt++; else { cnt = 0; } int get = min(n, cnt << k); // cout << cnt << endl; if (i < n - cnt) { // cout << "bug" << endl; continue; } string tmp = s.substr(i - n + get, n - get); reverse(tmp.begin(), tmp.end()); ans = min(ans, string(get, best) + tmp); } cout << ans; } return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change", "identifier.change" ]
742,726
742,727
u295095169
cpp
p02943
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int N, K; string S; string cv; int main() { ios_base::sync_with_stdio(0); cin >> N >> K >> S; for (int i = N - 1; i >= 0; i--) S += S[i]; cv = S.substr(0, N); for (int i = 1; i <= N; i++) cv = min(cv, S.substr(i, N)); if (K == 1) { cout << cv << "\n"; return 0; } K--; int na = 1; while (na < N && cv[na] == cv[na - 1]) na++; int ntot = na; for (int i = 0; i < K; i++) { ntot = min(N, na * 2); if (ntot == N) break; } for (int i = 0; i < ntot; i++) cout << cv[0]; for (int i = 0; i < N - ntot; i++) cout << cv[i + na]; cout << "\n"; }
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; int N, K; string S; string cv; int main() { ios_base::sync_with_stdio(0); cin >> N >> K >> S; for (int i = N - 1; i >= 0; i--) S += S[i]; cv = S.substr(0, N); for (int i = 1; i <= N; i++) cv = min(cv, S.substr(i, N)); if (K == 1) { cout << cv << "\n"; return 0; } K--; // cout << cv << endl; int na = 1; while (na < N && cv[na] == cv[na - 1]) na++; int ntot = na; for (int i = 0; i < K; i++) { ntot = min(N, ntot * 2); if (ntot == N) break; } for (int i = 0; i < ntot; i++) cout << cv[0]; for (int i = 0; i < N - ntot; i++) cout << cv[i + na]; cout << "\n"; }
[ "assignment.value.change", "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
742,742
742,743
u409373192
cpp
p02944
#include <bits/stdc++.h> #define For(i, x, y) for (register int i = (x); i <= (y); i++) #define FOR(i, x, y) for (register int i = (x); i < (y); i++) #define Dow(i, x, y) for (register int i = (x); i >= (y); i--) #define Debug(v) \ for (auto i : v) \ printf("%lld ", i); \ puts("") #define mp make_pair #define fi first #define se second #define pb push_back #define ep emplace_back #define siz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define fil(a, b) memset((a), (b), sizeof(a)) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pa; typedef pair<ll, ll> PA; typedef vector<int> poly; inline ll read() { ll x = 0, f = 1; char c = getchar(); while ((c < '0' || c > '9') && (c != '-')) c = getchar(); if (c == '-') f = -1, c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); return x * f; } const int N = 2e5 + 10; int n, m, a[N]; ll L[N], R[N], newL[N], newR[N]; int pre[N], nxt[N]; inline void Del(int x) { pre[nxt[x]] = pre[x], nxt[pre[x]] = nxt[x]; } int main() { n = read(), m = read(); For(i, 1, n) a[i] = read(); set<pa> s; For(i, 1, n) s.insert(mp(a[i], i)), pre[i] = i - 1, nxt[i] = i + 1, L[i] = R[i] = 1; ll ans = n; while (!s.empty()) { // for (int i=1;i!=n+1;i=nxt[i]) printf("%d %d\n",i,a[i]);puts(""); int u = (*s.begin()).se; s.erase(s.begin()); int l = u, r = u; while (a[pre[l]] == a[l]) l = pre[l]; while (a[nxt[r]] == a[r]) r = nxt[r]; poly v; for (int i = l; i != r; i = nxt[i]) v.pb(i); v.pb(r); if (siz(v) < m) { for (auto i : v) s.erase(mp(a[i], i)), Del(i); continue; } ll S = 0; FOR(i, m - 1, siz(v)) S += L[v[i - m + 1]], ans += S * R[v[i]]; l = m - 1, r = l + m - 1; int cnt = siz(v) / m; For(i, 1, cnt) { newR[i] = 0; For(j, l, min(r, siz(v) - 1)) newR[i] += R[v[j]]; l += m, r += m; } r = siz(v) - m, l = r - m + 1; Dow(i, cnt, 1) { newL[i] = 0; For(j, max(l, 0), r) newL[i] += L[v[j]]; l -= m, r -= m; } for (auto i : v) s.erase(mp(a[i], i)); FOR(i, 0, cnt) { a[v[i]]++, L[v[i]] = newL[i + 1], R[v[i]] = newR[i + 1]; s.insert(mp(a[v[i]], v[i])); } FOR(i, cnt, siz(v)) Del(v[i]); S = 0; FOR(i, m - 1, cnt) S += L[v[i - m + 1]], ans -= S * R[v[i]]; s.insert(mp(a[v[0]], v[0])); } printf("%lld\n", ans); }
#include <bits/stdc++.h> #define For(i, x, y) for (register int i = (x); i <= (y); i++) #define FOR(i, x, y) for (register int i = (x); i < (y); i++) #define Dow(i, x, y) for (register int i = (x); i >= (y); i--) #define Debug(v) \ for (auto i : v) \ printf("%lld ", i); \ puts("") #define mp make_pair #define fi first #define se second #define pb push_back #define ep emplace_back #define siz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define fil(a, b) memset((a), (b), sizeof(a)) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pa; typedef pair<ll, ll> PA; typedef vector<int> poly; inline ll read() { ll x = 0, f = 1; char c = getchar(); while ((c < '0' || c > '9') && (c != '-')) c = getchar(); if (c == '-') f = -1, c = getchar(); while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); return x * f; } const int N = 2e5 + 10; int n, m, a[N]; ll L[N], R[N], newL[N], newR[N]; int pre[N], nxt[N]; inline void Del(int x) { pre[nxt[x]] = pre[x], nxt[pre[x]] = nxt[x]; } int main() { n = read(), m = read(); For(i, 1, n) a[i] = read(); set<pa> s; For(i, 1, n) s.insert(mp(a[i], i)), pre[i] = i - 1, nxt[i] = i + 1, L[i] = R[i] = 1; ll ans = n; while (!s.empty()) { // for (int i=1;i!=n+1;i=nxt[i]) printf("%d ",a[i]);puts(""); int u = (*s.begin()).se; s.erase(s.begin()); int l = u, r = u; while (a[pre[l]] == a[l]) l = pre[l]; while (a[nxt[r]] == a[r]) r = nxt[r]; poly v; for (int i = l; i != r; i = nxt[i]) v.pb(i); v.pb(r); if (siz(v) < m) { for (auto i : v) s.erase(mp(a[i], i)), a[i] = 0; continue; } ll S = 0; FOR(i, m - 1, siz(v)) S += L[v[i - m + 1]], ans += S * R[v[i]]; l = m - 1, r = l + m - 1; int cnt = siz(v) / m; For(i, 1, cnt) { newR[i] = 0; For(j, l, min(r, siz(v) - 1)) newR[i] += R[v[j]]; l += m, r += m; } r = siz(v) - m, l = r - m + 1; Dow(i, cnt, 1) { newL[i] = 0; For(j, max(l, 0), r) newL[i] += L[v[j]]; l -= m, r -= m; } for (auto i : v) s.erase(mp(a[i], i)); FOR(i, 0, cnt) { a[v[i]]++, L[v[i]] = newL[i + 1], R[v[i]] = newR[i + 1]; s.insert(mp(a[v[i]], v[i])); } FOR(i, cnt, siz(v)) Del(v[i]); S = 0; FOR(i, m - 1, cnt) S += L[v[i - m + 1]], ans -= S * R[v[i]]; s.insert(mp(a[v[0]], v[0])); } printf("%lld\n", ans); } /* 10 2 1 2 4 1 4 2 1 1 4 2 */
[ "assignment.variable.change", "call.arguments.change", "assignment.change" ]
742,744
742,745
u026342954
cpp
p02944
#include <algorithm> #include <cassert> #include <cstdio> #include <iostream> #include <vector> #define debug(...) fprintf(stderr, __VA_ARGS__) #define fi first #define se second using namespace std; inline char nc() { return getchar(); static char buf[100000], *l = buf, *r = buf; return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r) ? EOF : *l++; } template <class T> void read(T &x) { x = 0; int f = 1, ch = nc(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = nc(); } while (ch >= '0' && ch <= '9') { x = x * 10 - '0' + ch; ch = nc(); } x *= f; } typedef long long ll; typedef pair<int, int> pii; const int maxn = 2e5 + 50; const int maxp = maxn * 25; int n, L; vector<pii> num; struct node { int l, r, L, R; node(int l = 0, int r = 0, int L = 0, int R = 0) : l(l), r(r), L(L), R(R) {} inline bool operator<(const node &other) const { return l < other.l; } }; vector<node> rec[2]; int main() { // freopen("1.in","r",stdin); // freopen("1.out","w",stdout); read(n), read(L); for (int i = 1; i <= n; ++i) { int x; read(x); num.push_back(make_pair(x, i)); } sort(num.begin(), num.end()); ll an = n; int cur = 0, now = 0, pt = 0; while (true) { cur ^= 1; rec[cur ^ 1].clear(); if (rec[cur].size() == 0) { if (pt < num.size()) now = num[pt].fi; else break; } else ++now; while (pt < num.size() && num[pt].fi == now) rec[cur].push_back(node(num[pt].se, num[pt].se, 1, 1)), ++pt; sort(rec[cur].begin(), rec[cur].end()); for (int l = 0, r; l < rec[cur].size(); l = r + 1) { static node tmp[maxn]; r = l; while (r < rec[cur].size() && rec[cur][r + 1].l == rec[cur][r].r + 1) ++r; if (r - l + 1 < L) continue; for (int j = r, sum = 0; j >= l + L - 1; --j) { sum += rec[cur][j].R; an += (ll)rec[cur][j - L + 1].L * sum; } int k = (r - l + 1) / L; tmp[0].l = rec[cur][l].l - 1; for (int j = 1; j <= k; ++j) { tmp[j].l = tmp[j].r = tmp[j - 1].l + 1; tmp[j].L = tmp[j].R = 0; } tmp[k].r = rec[cur][r].r; for (int j = l; j <= r; ++j) { int x = j - l + 1, y = r - j + 1; if (x >= L) tmp[x / L].R += rec[cur][j].R; if (y >= L) tmp[k - y / L + 1].L += rec[cur][j].L; } for (int j = k, sum = 0; j >= L; --j) { sum += tmp[j].R; an -= (ll)tmp[j - L + 1].L * sum; } for (int j = 1; j <= k; ++j) rec[cur ^ 1].push_back(tmp[j]); } } printf("%lld\n", an); return 0; }
#include <algorithm> #include <cassert> #include <cstdio> #include <iostream> #include <vector> #define debug(...) fprintf(stderr, __VA_ARGS__) #define fi first #define se second using namespace std; inline char nc() { return getchar(); static char buf[100000], *l = buf, *r = buf; return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r) ? EOF : *l++; } template <class T> void read(T &x) { x = 0; int f = 1, ch = nc(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = nc(); } while (ch >= '0' && ch <= '9') { x = x * 10 - '0' + ch; ch = nc(); } x *= f; } typedef long long ll; typedef pair<int, int> pii; const int maxn = 2e5 + 50; const int maxp = maxn * 25; int n, L; vector<pii> num; struct node { int l, r, L, R; node(int l = 0, int r = 0, int L = 0, int R = 0) : l(l), r(r), L(L), R(R) {} inline bool operator<(const node &other) const { return l < other.l; } }; vector<node> rec[2]; int main() { // freopen("1.in","r",stdin); // freopen("1.out","w",stdout); read(n), read(L); for (int i = 1; i <= n; ++i) { int x; read(x); num.push_back(make_pair(x, i)); } sort(num.begin(), num.end()); ll an = n; int cur = 0, now = 0, pt = 0; while (true) { cur ^= 1; rec[cur ^ 1].clear(); if (rec[cur].size() == 0) { if (pt < num.size()) now = num[pt].fi; else break; } else ++now; while (pt < num.size() && num[pt].fi == now) rec[cur].push_back(node(num[pt].se, num[pt].se, 1, 1)), ++pt; sort(rec[cur].begin(), rec[cur].end()); for (int l = 0, r; l < rec[cur].size(); l = r + 1) { static node tmp[maxn]; r = l; while (r + 1 < rec[cur].size() && rec[cur][r + 1].l == rec[cur][r].r + 1) ++r; if (r - l + 1 < L) continue; for (int j = r, sum = 0; j >= l + L - 1; --j) { sum += rec[cur][j].R; an += (ll)rec[cur][j - L + 1].L * sum; } int k = (r - l + 1) / L; tmp[0].l = rec[cur][l].l - 1; for (int j = 1; j <= k; ++j) { tmp[j].l = tmp[j].r = tmp[j - 1].l + 1; tmp[j].L = tmp[j].R = 0; } tmp[k].r = rec[cur][r].r; for (int j = l; j <= r; ++j) { int x = j - l + 1, y = r - j + 1; if (x >= L) tmp[x / L].R += rec[cur][j].R; if (y >= L) tmp[k - y / L + 1].L += rec[cur][j].L; } for (int j = k, sum = 0; j >= L; --j) { sum += tmp[j].R; an -= (ll)tmp[j - L + 1].L * sum; } for (int j = 1; j <= k; ++j) rec[cur ^ 1].push_back(tmp[j]); } } printf("%lld\n", an); return 0; }
[ "control_flow.loop.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
742,756
742,757
u002951552
cpp
p02944
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> #define ll long long using namespace std; int n, k, tot, pre[400005], nxt[400005], a[400005], l[400005], r[400005], sl[400005], sr[400005]; ll ans; bool flag[400005]; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q; int main() { scanf("%d%d", &n, &k); tot = n; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); pre[i] = i - 1, nxt[i] = i + 1; q.push(make_pair(a[i], i)); l[i] = r[i] = 1; } nxt[n] = 0; while (!q.empty()) { int node = q.top().second; q.pop(); if (flag[node]) continue; int L = node, R = node, len = 1; while (a[pre[L]] == a[node]) L = pre[L], len++; while (a[nxt[R]] == a[node]) R = nxt[R], len++; // printf("solve(%d,%d,%d)\n",node,a[node],len); // printf("L=%d,R=%d\n",L,R); int last = 0; for (int i = L, j = 1; i != nxt[R]; i = nxt[i], j++) { sl[j] = sl[j - 1] + l[i]; sr[j] = sr[j - 1] + r[i]; if (i <= n) last = i; if (last && j >= k) ans += 1ll * sl[min(j - k + 1, last)] * r[i]; flag[i] = 1; } if (len < k) { nxt[pre[L]] = pre[nxt[R]] = 0; continue; } for (int i = 1; i <= len / k; i++) { r[tot + i] = sr[min(len, (i + 1) * k - 1)] - sr[i * k - 1]; l[tot + i] = sl[len - (len / k - i + 1) * k + 1] - sl[max(0, len - (len / k - i + 2) * k + 1)]; } nxt[pre[L]] = tot + 1, pre[tot + 1] = pre[L]; pre[nxt[R]] = tot + len / k, nxt[tot + len / k] = nxt[R]; for (int i = 1; i < len / k; i++) { nxt[tot + i] = tot + i + 1; pre[tot + i + 1] = tot + i; } for (int i = 1; i <= len / k; i++) a[tot + i] = a[L] + 1; q.push(make_pair(a[tot + 1], tot + 1)); tot += len / k; // printf("ans=%lld\n",ans); } printf("%lld\n", ans + n); return 0; }
#include <algorithm> #include <cstdio> #include <cstring> #include <queue> #define ll long long using namespace std; int n, k, tot, pre[400005], nxt[400005], a[400005], l[400005], r[400005], sl[400005], sr[400005]; ll ans; bool flag[400005]; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q; int main() { scanf("%d%d", &n, &k); tot = n; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); pre[i] = i - 1, nxt[i] = i + 1; q.push(make_pair(a[i], i)); l[i] = r[i] = 1; } nxt[n] = 0; while (!q.empty()) { int node = q.top().second; q.pop(); if (flag[node]) continue; int L = node, R = node, len = 1; while (a[pre[L]] == a[node]) L = pre[L], len++; while (a[nxt[R]] == a[node]) R = nxt[R], len++; int last = 0; for (int i = L, j = 1; i != nxt[R]; i = nxt[i], j++) { sl[j] = sl[j - 1] + l[i]; sr[j] = sr[j - 1] + r[i]; if (i <= n) last = j; if (last && j >= k) ans += 1ll * sl[min(j - k + 1, last)] * r[i]; flag[i] = 1; } if (len < k) { nxt[pre[L]] = pre[nxt[R]] = 0; continue; } for (int i = 1; i <= len / k; i++) { r[tot + i] = sr[min(len, (i + 1) * k - 1)] - sr[i * k - 1]; l[tot + i] = sl[len - (len / k - i + 1) * k + 1] - sl[max(0, len - (len / k - i + 2) * k + 1)]; } nxt[pre[L]] = tot + 1, pre[tot + 1] = pre[L]; pre[nxt[R]] = tot + len / k, nxt[tot + len / k] = nxt[R]; for (int i = 1; i < len / k; i++) { nxt[tot + i] = tot + i + 1; pre[tot + i + 1] = tot + i; } for (int i = 1; i <= len / k; i++) a[tot + i] = a[L] + 1; q.push(make_pair(a[tot + 1], tot + 1)); tot += len / k; } printf("%lld\n", ans + n); return 0; }
[ "assignment.value.change", "identifier.change" ]
742,758
742,759
u656762776
cpp
p02944
//#define USEPB_DS #define USETR1 #define CPPELEVEN #define GPP /* * temp.cpp * * Created on: 2012-7-18 * Author: BSBandme */ //#pragma comment(linker, "/STACK:1024000000,1024000000") #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <vector> using namespace std; #ifndef CPPELEVEN #ifdef USETR1 #include <tr1/unordered_map> #include <tr1/unordered_set> using namespace tr1; #endif #else #include <unordered_map> #include <unordered_set> #endif #ifdef USEPB_DS #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> using namespace __gnu_pbds; // binomial_heap_tag, rc_binomial_heap_tag, thin_heap_tag, binary_heap_tag typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq_type; // splay_tree_tag, ov_tree_tag typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> tree_type; #endif #define mpr make_pair typedef unsigned int ui; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<double> vd; typedef vector<string> vs; typedef map<string, int> mpsi; typedef map<double, int> mpdi; typedef map<int, int> mpii; const double pi = acos(0.0) * 2.0; const long double eps = 1e-10; const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, -1}}; template <class T> inline T abs1(T a) { return a < 0 ? -a : a; } #ifndef CPPELEVEN template <class T> inline T max1(T a, T b) { return b < a ? a : b; } template <class T> inline T max1(T a, T b, T c) { return max1(max1(a, b), c); } template <class T> inline T max1(T a, T b, T c, T d) { return max1(max1(a, b, c), d); } template <class T> inline T max1(T a, T b, T c, T d, T e) { return max1(max1(a, b, c, d), e); } template <class T> inline T min1(T a, T b) { return a < b ? a : b; } template <class T> inline T min1(T a, T b, T c) { return min1(min1(a, b), c); } template <class T> inline T min1(T a, T b, T c, T d) { return min1(min1(a, b, c), d); } template <class T> inline T min1(T a, T b, T c, T d, T e) { return min1(min1(a, b, c, d), e); } #else template <typename t, typename t1> t min1(t a, t1 b) { return a < b ? a : b; } template <typename t, typename... arg> t min1(t a, arg... arr) { return min1(a, min1(arr...)); } template <typename t, typename t1> t max1(t a, t1 b) { return a > b ? a : b; } template <typename t, typename... arg> t max1(t a, arg... arr) { return max1(a, max1(arr...)); } #endif inline int jud(double a, double b) { if (abs(a) < eps && abs(b) < eps) return 0; else if (abs1(a - b) / max(abs1(a), abs1(b)) < eps) return 0; if (a < b) return -1; return 1; } template <typename t> inline int jud(t a, t b) { if (a < b) return -1; if (a == b) return 0; return 1; } // f_lb == 1代表返回相同的一串的左边界,f_small == // 1代表返回如果没有寻找的值返回小的数 template <typename it, typename t1> inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1) { if (na == 0) return 0; int be = 0, en = na - 1; if (*a <= *(a + na - 1)) { if (f_lb == 0) while (be < en) { int mid = (be + en + 1) / 2; if (jud(*(a + mid), val) != 1) be = mid; else en = mid - 1; } else while (be < en) { int mid = (be + en) / 2; if (jud(*(a + mid), val) != -1) en = mid; else be = mid + 1; } if (f_small && jud(*(a + be), val) == 1) be--; if (!f_small && jud(*(a + be), val) == -1) be++; } else { if (f_lb) while (be < en) { int mid = (be + en + 1) / 2; if (jud(*(a + mid), val) != -1) be = mid; else en = mid - 1; } else while (be < en) { int mid = (be + en) / 2; if (jud(*(a + mid), val) != 1) en = mid; else be = mid + 1; } if (!f_small && jud(*(a + be), val) == -1) be--; if (f_small && jud(*(a + be), val) == 1) be++; } return be; } template <class T> inline T lowb(T num) { return num & (-num); } #ifdef GPP inline int bitnum(ui nValue) { return __builtin_popcount(nValue); } inline int bitnum(int nValue) { return __builtin_popcount(nValue); } inline int bitnum(ull nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); } inline int bitnum(ll nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); } inline int bitmaxl(ui a) { if (a == 0) return 0; return 32 - __builtin_clz(a); } inline int bitmaxl(int a) { if (a == 0) return 0; return 32 - __builtin_clz(a); } inline int bitmaxl(ull a) { int temp = a >> 32; if (temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); } inline int bitmaxl(ll a) { int temp = a >> 32; if (temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); } #else #endif long long pow(long long n, long long m, long long mod = 0) { if (m < 0) return 0; long long ans = 1; long long k = n; while (m) { if (m & 1) { ans *= k; if (mod) ans %= mod; } k *= k; if (mod) k %= mod; m >>= 1; } return ans; } #define MOD 1000000007 template <class t1, class t2> inline void add(t1 &a, t2 b, int mod = -1) { if (mod == -1) mod = MOD; a += b; while (a >= mod) a -= mod; while (a < 0) a += mod; } template <class t> void output1(t arr) { for (int i = 0; i < (int)arr.size(); i++) cerr << arr[i] << ' '; cerr << endl; } template <class t> void output2(t arr) { for (int i = 0; i < (int)arr.size(); i++) output1(arr[i]); } //....................密..........封..........线..........下..........禁..........止..........hack............................................... const int maxn = 200100; int n, l; int orig[maxn]; struct Range { int from, to; vi align_to[2]; bool operator<(const Range &other) const { if (from == other.from) { return to < other.to; } return from < other.from; } } buf[maxn * 3]; int lbuf; map<int, vector<int>> all_range; int temp[2][maxn], ltemp; int main() { //............................不要再忘了检查maxn大小了!!!!BSBandme你个SB!!!!........................................ ios_base::sync_with_stdio(0); #ifdef DEBUG //...................................................................................................... freopen("input.txt", "r", stdin); #endif //........................................................................................................... scanf("%d%d", &n, &l); for (int i = 0; i < n; i++) { scanf("%d", orig + i); buf[lbuf].from = i; buf[lbuf].to = i + 1; buf[lbuf].align_to[0].push_back(0); buf[lbuf].align_to[1].push_back(0); buf[lbuf].align_to[0].push_back(1); buf[lbuf].align_to[1].push_back(1); all_range[orig[i]].push_back(lbuf++); } ll ans = 0; for (auto &it : all_range) { vi &all_r = it.second; sort(all_r.begin(), all_r.end(), [&](const int &a, const int &b) { return buf[a] < buf[b]; }); for (int i = 0, nxt_i = 0; i < (int)all_r.size(); i = nxt_i) { while (nxt_i < (int)all_r.size() - 1 && buf[all_r[nxt_i + 1]].from == buf[all_r[nxt_i]].to) { nxt_i++; } nxt_i++; ltemp = 1; temp[0][0] = temp[1][0] = 0; for (int j = i; j < nxt_i; j++) { int no = all_r[j]; auto rbuf = buf[no]; ltemp--; for (int k = 0, rsum = 0; k < (int)rbuf.align_to[0].size(); k++) { temp[0][ltemp] += rbuf.align_to[0][k]; temp[1][ltemp++] += rbuf.align_to[1][rbuf.align_to[0].size() - k - 1]; if (k >= l) { rsum += rbuf.align_to[1][rbuf.align_to[0].size() - k - 1 + l]; } temp[0][ltemp] = temp[1][ltemp] = 0; ans -= 1ll * rbuf.align_to[0][k] * rsum; } } for (int j = l, sum = 0; j < ltemp; j++) { sum += temp[1][j - l]; ans += 1ll * temp[0][j] * sum; } if (ltemp >= l) { buf[lbuf].from = buf[all_r[i]].from; buf[lbuf].to = buf[all_r[nxt_i - 1]].to; buf[lbuf].align_to[0].push_back(0); buf[lbuf].align_to[1].push_back(0); for (int j = l; j < ltemp; j++) { if (j % l == 0) { buf[lbuf].align_to[0].push_back(0); buf[lbuf].align_to[1].push_back(0); } buf[lbuf].align_to[0].back() += temp[0][j]; buf[lbuf].align_to[1].back() += temp[1][ltemp - j - 1]; } all_range[it.first + 1].push_back(lbuf++); } } } cout << ans + n << endl; return 0; }
//#define USEPB_DS #define USETR1 #define CPPELEVEN #define GPP /* * temp.cpp * * Created on: 2012-7-18 * Author: BSBandme */ //#pragma comment(linker, "/STACK:1024000000,1024000000") #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <vector> using namespace std; #ifndef CPPELEVEN #ifdef USETR1 #include <tr1/unordered_map> #include <tr1/unordered_set> using namespace tr1; #endif #else #include <unordered_map> #include <unordered_set> #endif #ifdef USEPB_DS #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> using namespace __gnu_pbds; // binomial_heap_tag, rc_binomial_heap_tag, thin_heap_tag, binary_heap_tag typedef __gnu_pbds::priority_queue<int, greater<int>, pairing_heap_tag> pq_type; // splay_tree_tag, ov_tree_tag typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> tree_type; #endif #define mpr make_pair typedef unsigned int ui; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<double> vd; typedef vector<string> vs; typedef map<string, int> mpsi; typedef map<double, int> mpdi; typedef map<int, int> mpii; const double pi = acos(0.0) * 2.0; const long double eps = 1e-10; const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, -1}}; template <class T> inline T abs1(T a) { return a < 0 ? -a : a; } #ifndef CPPELEVEN template <class T> inline T max1(T a, T b) { return b < a ? a : b; } template <class T> inline T max1(T a, T b, T c) { return max1(max1(a, b), c); } template <class T> inline T max1(T a, T b, T c, T d) { return max1(max1(a, b, c), d); } template <class T> inline T max1(T a, T b, T c, T d, T e) { return max1(max1(a, b, c, d), e); } template <class T> inline T min1(T a, T b) { return a < b ? a : b; } template <class T> inline T min1(T a, T b, T c) { return min1(min1(a, b), c); } template <class T> inline T min1(T a, T b, T c, T d) { return min1(min1(a, b, c), d); } template <class T> inline T min1(T a, T b, T c, T d, T e) { return min1(min1(a, b, c, d), e); } #else template <typename t, typename t1> t min1(t a, t1 b) { return a < b ? a : b; } template <typename t, typename... arg> t min1(t a, arg... arr) { return min1(a, min1(arr...)); } template <typename t, typename t1> t max1(t a, t1 b) { return a > b ? a : b; } template <typename t, typename... arg> t max1(t a, arg... arr) { return max1(a, max1(arr...)); } #endif inline int jud(double a, double b) { if (abs(a) < eps && abs(b) < eps) return 0; else if (abs1(a - b) / max(abs1(a), abs1(b)) < eps) return 0; if (a < b) return -1; return 1; } template <typename t> inline int jud(t a, t b) { if (a < b) return -1; if (a == b) return 0; return 1; } // f_lb == 1代表返回相同的一串的左边界,f_small == // 1代表返回如果没有寻找的值返回小的数 template <typename it, typename t1> inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1) { if (na == 0) return 0; int be = 0, en = na - 1; if (*a <= *(a + na - 1)) { if (f_lb == 0) while (be < en) { int mid = (be + en + 1) / 2; if (jud(*(a + mid), val) != 1) be = mid; else en = mid - 1; } else while (be < en) { int mid = (be + en) / 2; if (jud(*(a + mid), val) != -1) en = mid; else be = mid + 1; } if (f_small && jud(*(a + be), val) == 1) be--; if (!f_small && jud(*(a + be), val) == -1) be++; } else { if (f_lb) while (be < en) { int mid = (be + en + 1) / 2; if (jud(*(a + mid), val) != -1) be = mid; else en = mid - 1; } else while (be < en) { int mid = (be + en) / 2; if (jud(*(a + mid), val) != 1) en = mid; else be = mid + 1; } if (!f_small && jud(*(a + be), val) == -1) be--; if (f_small && jud(*(a + be), val) == 1) be++; } return be; } template <class T> inline T lowb(T num) { return num & (-num); } #ifdef GPP inline int bitnum(ui nValue) { return __builtin_popcount(nValue); } inline int bitnum(int nValue) { return __builtin_popcount(nValue); } inline int bitnum(ull nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); } inline int bitnum(ll nValue) { return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32); } inline int bitmaxl(ui a) { if (a == 0) return 0; return 32 - __builtin_clz(a); } inline int bitmaxl(int a) { if (a == 0) return 0; return 32 - __builtin_clz(a); } inline int bitmaxl(ull a) { int temp = a >> 32; if (temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); } inline int bitmaxl(ll a) { int temp = a >> 32; if (temp) return 32 - __builtin_clz(temp) + 32; return bitmaxl(int(a)); } #else #endif long long pow(long long n, long long m, long long mod = 0) { if (m < 0) return 0; long long ans = 1; long long k = n; while (m) { if (m & 1) { ans *= k; if (mod) ans %= mod; } k *= k; if (mod) k %= mod; m >>= 1; } return ans; } #define MOD 1000000007 template <class t1, class t2> inline void add(t1 &a, t2 b, int mod = -1) { if (mod == -1) mod = MOD; a += b; while (a >= mod) a -= mod; while (a < 0) a += mod; } template <class t> void output1(t arr) { for (int i = 0; i < (int)arr.size(); i++) cerr << arr[i] << ' '; cerr << endl; } template <class t> void output2(t arr) { for (int i = 0; i < (int)arr.size(); i++) output1(arr[i]); } //....................密..........封..........线..........下..........禁..........止..........hack............................................... const int maxn = 200100; int n, l; int orig[maxn]; struct Range { int from, to; vi align_to[2]; bool operator<(const Range &other) const { if (from == other.from) { return to < other.to; } return from < other.from; } } buf[maxn * 3]; int lbuf; map<int, vector<int>> all_range; int temp[2][maxn], ltemp; int main() { //............................不要再忘了检查maxn大小了!!!!BSBandme你个SB!!!!........................................ ios_base::sync_with_stdio(0); #ifdef DEBUG //...................................................................................................... freopen("input.txt", "r", stdin); #endif //........................................................................................................... scanf("%d%d", &n, &l); for (int i = 0; i < n; i++) { scanf("%d", orig + i); buf[lbuf].from = i; buf[lbuf].to = i + 1; buf[lbuf].align_to[0].push_back(0); buf[lbuf].align_to[1].push_back(0); buf[lbuf].align_to[0].push_back(1); buf[lbuf].align_to[1].push_back(1); all_range[orig[i]].push_back(lbuf++); } ll ans = 0; for (auto &it : all_range) { vi &all_r = it.second; sort(all_r.begin(), all_r.end(), [&](const int &a, const int &b) { return buf[a] < buf[b]; }); for (int i = 0, nxt_i = 0; i < (int)all_r.size(); i = nxt_i) { while (nxt_i < (int)all_r.size() - 1 && buf[all_r[nxt_i + 1]].from == buf[all_r[nxt_i]].to) { nxt_i++; } nxt_i++; ltemp = 1; temp[0][0] = temp[1][0] = 0; for (int j = i; j < nxt_i; j++) { int no = all_r[j]; auto rbuf = buf[no]; ltemp--; for (int k = 0, rsum = 0; k < (int)rbuf.align_to[0].size(); k++) { temp[0][ltemp] += rbuf.align_to[0][k]; temp[1][ltemp++] += rbuf.align_to[1][rbuf.align_to[0].size() - k - 1]; if (k >= l) { rsum += rbuf.align_to[1][rbuf.align_to[0].size() - k - 1 + l]; } temp[0][ltemp] = temp[1][ltemp] = 0; ans -= 1ll * rbuf.align_to[0][k] * rsum; } } for (int j = l, sum = 0; j < ltemp; j++) { sum += temp[1][j - l]; ans += 1ll * temp[0][j] * sum; } if (ltemp > l) { buf[lbuf].from = buf[all_r[i]].from; buf[lbuf].to = buf[all_r[nxt_i - 1]].to; buf[lbuf].align_to[0].push_back(0); buf[lbuf].align_to[1].push_back(0); for (int j = l; j < ltemp; j++) { if (j % l == 0) { buf[lbuf].align_to[0].push_back(0); buf[lbuf].align_to[1].push_back(0); } buf[lbuf].align_to[0].back() += temp[0][j]; buf[lbuf].align_to[1].back() += temp[1][ltemp - j - 1]; } all_range[it.first + 1].push_back(lbuf++); } } } cout << ans + n << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
742,762
742,763
u192548438
cpp
p02945
#pragma GCC optimize("O3") #define _GLIBCXX_DEBUG #include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <string_view> #include <vector> using namespace std; /*----------macros----------*/ // output================ #define endl '\n' #define fcout(a) cout << fixed << setprecision((int)(a)) // typedef=============== typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; // const number========== constexpr ll INF9 = (ll)1e9 + 1; constexpr ll INF18 = (ll)1e18 + 1; constexpr ll MOD = 1000000007; constexpr ll MOD2 = 998244353; constexpr ld PI = 3.141592653589793L; // member================ #define pb push_back #define eb emplace_back #define pf push_front #define mp make_pair #define fi first #define se second // others================ #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; (i) < (n); ++(i)) #define reps(i, n) for (int i = 1; (i) <= (n); ++(i)) #define rrep(i, n) for (int i = n - 1; (i) >= 0; --(i)) #define repbit(bit, n) for (int bit = 0; (bit) < (1 << (n)); ++(bit)) #define ifbit(bit, i) if ((bit) & (1 << (i))) #define CtoI(c) int((c)) - int('0') #define ItoC(c) char((c) + '0') // functions============= template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } // vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1}; // vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 }; /*--------additional--------*/ /*----------main------------*/ int main() { /*----------fastio----------*/ std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios::sync_with_stdio(false); /*----------solve-----------*/ int a, b; cin >> a, b; cout << max(a + b, max(a - b, a * b)) << endl; return 0; }
#pragma GCC optimize("O3") #define _GLIBCXX_DEBUG #include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <string_view> #include <vector> using namespace std; /*----------macros----------*/ // output================ #define endl '\n' #define fcout(a) cout << fixed << setprecision((int)(a)) // typedef=============== typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; // const number========== constexpr ll INF9 = (ll)1e9 + 1; constexpr ll INF18 = (ll)1e18 + 1; constexpr ll MOD = 1000000007; constexpr ll MOD2 = 998244353; constexpr ld PI = 3.141592653589793L; // member================ #define pb push_back #define eb emplace_back #define pf push_front #define mp make_pair #define fi first #define se second // others================ #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; (i) < (n); ++(i)) #define reps(i, n) for (int i = 1; (i) <= (n); ++(i)) #define rrep(i, n) for (int i = n - 1; (i) >= 0; --(i)) #define repbit(bit, n) for (int bit = 0; (bit) < (1 << (n)); ++(bit)) #define ifbit(bit, i) if ((bit) & (1 << (i))) #define CtoI(c) int((c)) - int('0') #define ItoC(c) char((c) + '0') // functions============= template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } // vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1}; // vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 }; /*--------additional--------*/ /*----------main------------*/ int main() { /*----------fastio----------*/ std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios::sync_with_stdio(false); /*----------solve-----------*/ int a, b; cin >> a >> b; cout << max(a + b, max(a - b, a * b)) << endl; return 0; }
[]
742,766
742,767
u884476319
cpp
p02945
#include <algorithm> #include <iostream> using namespace std; int ans[3]; int main() { int a, b; cin >> a >> b; ans[0] = a + b; ans[1] = a - b; ans[2] = a * b; sort(ans, ans + 3); cout << ans[0]; }
#include <algorithm> #include <iostream> using namespace std; int ans[3]; int main() { int a, b; cin >> a >> b; ans[0] = a + b; ans[1] = a - b; ans[2] = a * b; sort(ans, ans + 3); cout << ans[2]; }
[ "literal.number.change", "variable_access.subscript.index.change", "io.output.change" ]
742,768
742,769
u700846375
cpp
p02945
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) \ ; \ for (ll i = 0; i < (ll)n; i++) int main() { ll a, b; cin >> a >> b; ll x, y, z; x = a + b; y = x - b; z = x * b; cout << max(x, max(y, z)) << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) \ ; \ for (ll i = 0; i < (ll)n; i++) int main() { ll a, b; cin >> a >> b; ll x, y, z; x = a + b; y = a - b; z = a * b; cout << max(x, max(y, z)) << endl; }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
742,776
742,777
u678961336
cpp
p02945
#include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { int a, b, c; cin >> a; cout << max(a * b, max(a + b, a - b)) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { int a, b; cin >> a >> b; cout << max(a * b, max(a + b, a - b)) << endl; return 0; }
[ "variable_declaration.remove" ]
742,786
742,787
u581850493
cpp
p02945
#include <iostream> using namespace std; int main() { int A, B, SUM, DIF, MUL; cin >> A >> B; SUM = A + B; DIF = A - B; MUL = A * B; if (SUM >= DIF) { if (SUM >= MUL) { cout << SUM; } } else if (DIF >= MUL) { cout << DIF; } else cout << MUL; return 0; }
#include <iostream> using namespace std; int main() { int A, B, SUM, DIF, MUL; cin >> A >> B; SUM = A + B; DIF = A - B; MUL = A * B; if (SUM >= DIF && SUM >= MUL) { cout << SUM; } else if (DIF >= MUL) { cout << DIF; } else cout << MUL; return 0; }
[ "control_flow.branch.if.condition.change" ]
742,790
742,791
u863370423
cpp
p02945
/* In the name of Allah MohammadErfan Gooneh */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; #define endl '\n' #define all(a, n) \ for (int i = 0; i < n; i++) \ cout << a[i] << " "; \ cout << endl; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); const ll MAXN = 1e6 + 10; const ll INF = 8e18; const ll MOD = 1e9 + 7; int main() { IOS; int x, a; cin >> x >> a; cout << max(max(a + x, x * a), abs(x - a)); return 0; }
/* In the name of Allah MohammadErfan Gooneh */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; #define endl '\n' #define all(a, n) \ for (int i = 0; i < n; i++) \ cout << a[i] << " "; \ cout << endl; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); const ll MAXN = 1e6 + 10; const ll INF = 8e18; const ll MOD = 1e9 + 7; int main() { IOS; int x, a; cin >> x >> a; cout << max(max(a + x, x * a), x - a); return 0; }
[ "call.remove", "call.arguments.change" ]
742,812
742,813
u001975975
cpp
p02945
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin(), a.rend() #define maxs(x, y) (x = max(x, y)) #define mins(x, y) (x = min(x, y)) #define limit(x, l, r) max(l, min(x, r)) #define lims(x, l, r) (x = max(l, min(x, r))) #define isin(x, l, r) ((l) <= (x) && (x) < (r)) #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)), x.end()) #define show(x) cout << #x << " = " << x << endl; #define print(x) cout << x << endl; #define PQ(T) priority_queue<T, v(T), greater<T>> #define bn(x) ((1 << x) - 1) #define dup(x, y) (((x) + (y)-1) / (y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int, int> P; typedef tuple<int, int, int> T; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; typedef vector<T> vt; int main() { int a, b; cin >> a >> b; int ans = 0; maxs(ans, a + b); maxs(ans, a - b); maxs(ans, a * b); cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin(), a.rend() #define maxs(x, y) (x = max(x, y)) #define mins(x, y) (x = min(x, y)) #define limit(x, l, r) max(l, min(x, r)) #define lims(x, l, r) (x = max(l, min(x, r))) #define isin(x, l, r) ((l) <= (x) && (x) < (r)) #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)), x.end()) #define show(x) cout << #x << " = " << x << endl; #define print(x) cout << x << endl; #define PQ(T) priority_queue<T, v(T), greater<T>> #define bn(x) ((1 << x) - 1) #define dup(x, y) (((x) + (y)-1) / (y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int, int> P; typedef tuple<int, int, int> T; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; typedef vector<T> vt; int main() { int a, b; cin >> a >> b; int ans = -100; maxs(ans, a + b); maxs(ans, a - b); maxs(ans, a * b); cout << ans << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
742,822
742,823
u814715203
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (a + b >= a - b || a + b >= a * b) { cout << a + b; } else if (a - b >= a * b) { cout << a - b; } else { cout << a * b; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (a + b >= a - b && a + b >= a * b) { cout << a + b; } else if (a - b >= a * b) { cout << a - b; } else { cout << a * b; } return 0; }
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
742,824
742,825
u523119383
cpp
p02945
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod = 1000000007; const int MAX_N = 1000; // n の最大値 // nCk を取得 double nCk(int n, int k) { double res = 1.0; for (int i = 0; i < n; i++) { res *= 0.5; } for (int i = 0; i < k; i++) { res *= (double)(n - i); res /= (double)(k - i); } return res; } int main() { ll h, w, k; cin >> h >> w; ll c = -500; c = max(h + w, c); c = max(h - w, c); c = (h * w, c); cout << c << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod = 1000000007; const int MAX_N = 1000; // n の最大値 // nCk を取得 double nCk(int n, int k) { double res = 1.0; for (int i = 0; i < n; i++) { res *= 0.5; } for (int i = 0; i < k; i++) { res *= (double)(n - i); res /= (double)(k - i); } return res; } int main() { ll h, w, k; cin >> h >> w; ll c = -500; c = max(h + w, c); c = max(h - w, c); c = max(h * w, c); cout << c << endl; }
[ "call.add" ]
742,857
742,858
u722640678
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int X = A + B; int Y = A - B; int Z = A * B; int ans = max(X, Y); int C = max(ans, Z); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int X = A + B; int Y = A - B; int Z = A * B; int ans = max(X, Y); int C = max(ans, Z); cout << C << endl; }
[ "identifier.change", "io.output.change" ]
742,861
742,862
u580593895
cpp
p02941
#ifdef __LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define itn int #define fi first #define se second #define intmax numeric_limits<int>::max() #define llmax numeric_limits<ll>::max() #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 rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--) #define rrep1(i, n) for (int i = (int)(n); i >= 1; i--) #define all(vec) vec.begin(), vec.end() #define sortt(vec) sort((vec).begin(), (vec).end()) #define rsort(vec) sort((vec).rbegin(), (vec).rend()) typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<int, int> pii; typedef tuple<ll, ll, ll> tlll; typedef tuple<int, int, int> tiii; const ll mod = 1e9 + 7; const int inf = 1 << 30; const ll lnf = 1ll << 60; int main() { itn n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; vector<int> b(n); rep(i, n) cin >> b[i]; priority_queue<pii> q; rep(i, n) { if (b[i] > a[i]) q.push(pii(b[i], i)); if (b[i] < a[i]) { cout << -1 << endl; return 0; } } int ans = 0; while (a != b) { int x, itr; tie(x, itr) = q.top(); q.pop(); int y = b[(itr + n - 1) % n] + b[(itr + 1) % n]; if (x - a[itr] > y) { ans += (x - a[itr]) / y; x -= (x - a[itr]) / y * y; b[itr] = x; if (x != a[itr]) q.push(pii(x, itr)); } else { cout << -1 << endl; return 0; } } cout << ans << endl; }
#ifdef __LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } #define itn int #define fi first #define se second #define intmax numeric_limits<int>::max() #define llmax numeric_limits<ll>::max() #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 rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--) #define rrep1(i, n) for (int i = (int)(n); i >= 1; i--) #define all(vec) vec.begin(), vec.end() #define sortt(vec) sort((vec).begin(), (vec).end()) #define rsort(vec) sort((vec).rbegin(), (vec).rend()) typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<int, int> pii; typedef tuple<ll, ll, ll> tlll; typedef tuple<int, int, int> tiii; const ll mod = 1e9 + 7; const int inf = 1 << 30; const ll lnf = 1ll << 60; int main() { itn n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; vector<int> b(n); rep(i, n) cin >> b[i]; priority_queue<pii> q; rep(i, n) { if (b[i] > a[i]) q.push(pii(b[i], i)); if (b[i] < a[i]) { cout << -1 << endl; return 0; } } ll ans = 0; while (a != b) { int x, itr; tie(x, itr) = q.top(); q.pop(); int y = b[(itr + n - 1) % n] + b[(itr + 1) % n]; if (x - a[itr] >= y) { ans += (x - a[itr]) / y; x -= (x - a[itr]) / y * y; b[itr] = x; if (x != a[itr]) q.push(pii(x, itr)); } else { cout << -1 << endl; return 0; } } cout << ans << endl; }
[ "variable_declaration.type.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
742,871
742,870
u136342563
cpp
p02941
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; #define fi first #define se second #define all(v) (v).begin(), (v).end() const ll inf = (1e18); // const ll mod=998244353; const ll mod = 1000000007; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll c, ll d) { return c / GCD(c, d) * d; } struct __INIT { __INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } __init; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } int main() { ll n; cin >> n; V<ll> a(n), b(n); priority_queue<P> pq; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { cin >> b[i]; pq.emplace(b[i], i); } ll ans = 0; while (pq.size()) { auto p = pq.top(); pq.pop(); if (p.fi == 0) continue; if (0 <= p.fi - b[(p.se + n - 1) % n] - b[(p.se + 1) % n]) { ll s = b[(p.se + n - 1) % n], t = b[(p.se + 1) % n]; ans += (p.fi) / (s + t); if ((p.fi) / (s + t) == 0) { cout << -1 << "\n"; return 0; } b[p.se] -= (p.fi) / (s + t) * (s + t); p.fi %= (s + t); if (p.fi) pq.emplace(p.fi, p.se); } else { cout << -1 << "\n"; return 0; } } cout << ans << "\n"; }
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; template <class T> using V = vector<T>; #define fi first #define se second #define all(v) (v).begin(), (v).end() const ll inf = (1e18); // const ll mod=998244353; const ll mod = 1000000007; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll c, ll d) { return c / GCD(c, d) * d; } struct __INIT { __INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } __init; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } int main() { ll n; cin >> n; V<ll> a(n), b(n); priority_queue<P> pq; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { cin >> b[i]; pq.emplace(b[i] - a[i], i); } ll ans = 0; while (pq.size()) { auto p = pq.top(); pq.pop(); if (p.fi == 0) continue; if (0 <= p.fi - b[(p.se + n - 1) % n] - b[(p.se + 1) % n]) { ll s = b[(p.se + n - 1) % n], t = b[(p.se + 1) % n]; ans += (p.fi) / (s + t); if ((p.fi) / (s + t) == 0) { cout << -1 << "\n"; return 0; } b[p.se] -= (p.fi) / (s + t) * (s + t); p.fi %= (s + t); if (p.fi) pq.emplace(p.fi, p.se); } else { cout << -1 << "\n"; return 0; } } cout << ans << "\n"; }
[ "expression.operation.binary.add" ]
742,925
742,926
u822169805
cpp
p02941
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long const int INF = 1LL << 60; signed main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i]; priority_queue<pair<int, int>> q; for (int i = 0; i < n; i++) { cin >> b[i]; q.push({b[i], i}); } int ans = 0; while (!q.empty()) { auto p = q.top(); q.pop(); int idx = p.second; int left = (idx - 1 + n) % n, right = (idx + 1) % n; int diff = (b[idx] - a[idx]) / (b[left] + b[right]); int val = b[idx] - (b[left] + b[right]) * diff; if (diff == 0 || val <= a[idx]) continue; b[idx] = val; q.push({val, idx}); ans += diff; } if (a != b) ans = -1; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long const int INF = 1LL << 60; signed main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i]; priority_queue<pair<int, int>> q; for (int i = 0; i < n; i++) { cin >> b[i]; q.push({b[i], i}); } int ans = 0; while (!q.empty()) { auto p = q.top(); q.pop(); int idx = p.second; int left = (idx - 1 + n) % n, right = (idx + 1) % n; int diff = (b[idx] - a[idx]) / (b[left] + b[right]); int val = b[idx] - (b[left] + b[right]) * diff; if (diff == 0 || val < a[idx]) continue; b[idx] = val; q.push({val, idx}); ans += diff; } if (a != b) ans = -1; cout << ans << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
742,988
742,989
u344122377
cpp
p02941
#include <algorithm> #include <assert.h> #include <bitset> #include <cfloat> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (int i = 1; i <= n; i++) #define int long long #define ll long long #define eps LDBL_EPSILON #define mod (int)1000000007 #define INF INT_MAX / 10 #define P pair<int, int> #define prique priority_queue using namespace std; int gcd(int a, int b) { if (!b) return a; return gcd(b, a % b); } int lcm(int a, int b) { return a / gcd(a, b) * b; } bool isprime(int n) { if (n == 1) return false; for (int i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } int mypow(int a, int b) { if (!b) return 1; if (b % 2) return mypow(a, b - 1) * a; int memo = mypow(a, b / 2); return memo * memo; } int modpow(int a, int b, int m = mod) { if (!b) return 1; if (b % 2) return modpow(a, b - 1, m) * a % m; int memo = modpow(a, b / 2, m); return memo * memo % m; } class modInt { int value, modulo; public: template <typename T> constexpr modInt(T value = 0, int modulo = mod) : value(value), modulo(modulo) { value %= T(modulo); } inline constexpr operator int() const { return value; } inline constexpr modInt &operator+=(modInt x) { value += x.value; if (value >= modulo) value -= modulo; return *this; } inline constexpr modInt &operator++() { if (value == modulo - 1) value = 0; else value++; return *this; } inline constexpr modInt &operator-() const { return modInt(0) -= *this; } inline constexpr modInt &operator-=(modInt x) { value -= x.value; if (value < 0) value += modulo; return *this; } inline constexpr modInt &operator--() { if (value == 0) value = modulo - 1; else value--; return *this; } inline constexpr modInt &operator*=(modInt x) { value = value * x.value % mod; return *this; } inline modInt &operator/=(modInt x) { return operator*=(x.inv()); } modInt pow(modInt x, int y) { if (!y) return 1; if (y & 1) return pow(x, y - 1); modInt memo = pow(x, y / 2); return memo * memo; } inline modInt inv() { return pow(*this, modulo - 2); } template <typename T> modInt operator+(T x) { return modInt(*this) += x; } template <typename T> modInt &operator+=(T x) { return modInt(*this) += modInt(x); } template <typename T> modInt operator-(T x) { return modInt(*this) -= x; } template <typename T> modInt &operator-=(T x) { return modInt(*this) -= modInt(x); } template <typename T> modInt operator*(T x) { return modInt(*this) *= x; } template <typename T> modInt &operator*=(T x) { return modInt(*this) *= modInt(x); } template <typename T> modInt operator/(T x) { return modInt(*this) /= x; } template <typename T> modInt &operator/=(T x) { return modInt(*this) /= modInt(x); } }; istream &operator>>(istream ist, modInt &x) { int a; ist >> a; x = a; return ist; } class UnionFind { int *par, *rank; P *notparent; vector<P> *size; int opcount = 0; public: UnionFind(unsigned int size) { par = new int[size + 1]; rank = new int[size + 1]; this->size = new vector<P>[size + 1]; notparent = new P[size + 1]; rep(i, size + 1) { par[i] = i; rank[i] = 0; this->size[i].push_back(make_pair(-1, 1)); notparent[i] = make_pair(INF, i); } } int find(int n, int t = INF) { if (opcount <= t) { if (par[n] == n) return n; return par[n] = find(par[n]); } if (notparent[n].first <= t) return find(notparent[n].second, t); return n; } void unite(int n, int m) { n = find(n); m = find(m); if (n == m) { opcount++; return; } if (rank[n] < rank[m]) { par[n] = m; notparent[n] = make_pair(opcount, m); size[m].push_back( make_pair(opcount, size[m].back().second + size[n].back().second)); } else { par[m] = n; notparent[m] = make_pair(opcount, n); size[n].push_back( make_pair(opcount, size[n].back().second + size[m].back().second)); if (rank[n] == rank[m]) rank[n]++; } opcount++; } bool same(int n, int m, int t = INF) { return find(n, t) == find(m, t); } int getsize(int n, int t = INF) { n = find(n, t); auto ite = lower_bound(size[n].begin(), size[n].end(), make_pair(t, (int)0)); if (ite == size[n].end()) ite--; if (t < (*ite).first) ite--; return (*ite).second; } }; class RollingHash { string s; int n, m, base; deque<int> has; public: RollingHash(string s, int m, int b) : n(s.size()), m(m), base(b) { init(s, m, b); } void init(string s, int m, int b) { n = s.size(); has.resize(n); base = b; this->s = s; this->m = m; rep(i, n) { has[i] = (int)s[i]; if (i) has[i] += base * has[i - 1] % m; has[i] %= m; } } operator int() const { return has.back(); } void cut(int a, int b) { assert(!(a >= b || a < 0 || n < b)); rep(i, a) has.pop_front(); rep(i, n - b) has.pop_back(); s = s.substr(a, b); int memo = modpow(modpow(base, n - b, m), m - 2, m); rep(i, b - a) { has[i] *= memo; has[i] %= mod; } n = b - a; } int query(int a, int b) { assert(!(a >= b || a < 0 || n < b)); return (has[b - 1] - modpow(base, b - a, m) * (!a ? 0 : has[a - 1]) % m + m) % m; } int operator+(RollingHash t) { assert(m == t.m && base == t.base); return (has[n - 1] * modpow(base, t.n, m) % m + t.has[t.n - 1]) % m; } RollingHash &operator+=(string t) { s += t; has.resize(n + t.size()); for (int i = n; i < n + t.size(); i++) { has[i] = (int)t[i] * base % m; has[i] += base * has[i - 1] % m; has[i] %= m; } n += t.size(); return *this; } }; template <typename T, typename U> class SegTree { int n = 1; T *node = NULL; U *lazy = NULL; bool *lazyflag = NULL; T nodee; U lazye; function<T(T, T)> nodef; function<U(U, U)> lazyf; function<T(int, T, U)> updf; void eval(int k, int l, int r) { if (lazyflag[k]) { node[k] = updf(r - l, node[k], lazy[k]); if (r - l > 1) { lazyflag[2 * k + 1] = lazyflag[2 * k + 2] = true; lazy[2 * k + 1] = lazyf(lazy[2 * k + 1], lazy[k]); lazy[2 * k + 2] = lazyf(lazy[2 * k + 2], lazy[k]); } lazyflag[k] = false; lazy[k] = lazye; } } public: SegTree(int m, int init, T nodee, U lazye, function<T(T, T)> nodef, function<U(U, U)> lazyf, function<T(int, T, U)> updf) : nodee(nodee), lazye(lazye), nodef(nodef), lazyf(lazyf), updf(updf) { delete[] node; delete[] lazy; while (n < m) n *= 2; node = new T[2 * n], lazy = new U[2 * n], lazyflag = new bool[2 * n]; rep(i, 2 * n) { node[i] = init; lazy[i] = lazye; lazyflag[i] = false; } } ~SegTree() { delete[] node; delete[] lazy; } void update(int a, int b, U x, int k = 0, int l = 0, int r = -1) { if (r == -1) r = n; eval(k, l, r); if (b <= l || r <= a) return; if (a <= l && r <= b) { lazyflag[k] = true; lazy[k] = x; eval(k, l, r); } else { update(a, b, x, 2 * k + 1, l, (l + r) / 2); update(a, b, x, 2 * k + 2, (l + r) / 2, r); node[k] = nodef(node[2 * k + 1], node[2 * k + 2]); } } T query(int a, int b, int k = 0, int l = 0, int r = -1) { if (r == -1) r = n; eval(k, l, r); if (b <= l || r <= a) return nodee; if (a <= l && r <= b) return node[k]; T vl = query(a, b, 2 * k + 1, l, (l + r) / 2); T vr = query(a, b, 2 * k + 2, (l + r) / 2, r); return nodef(vl, vr); } }; class Matrix { int n; vector<vector<int>> vec; void Measure() { rep(i, n) { rep(j, n) { if (i != j) vec[i][j] = 0; else vec[i][j] = 1; } } } public: Matrix(int n) { this->n = n; vec.resize(n, vector<int>(n)); } Matrix(int n, vector<int> vec) { if (vec.size() != n * n) { cerr << "Invalid construct of matrix" << endl; exit(1); } this->n = n; this->vec.resize(n, vector<int>(n)); rep(i, n) { rep(j, n) this->vec[i][j] = vec[i * n + j]; } } int operator[](int a) { return vec[a / n][a % n]; } unsigned int size() { return n; } Matrix operator*(const Matrix a) { if (this->n != a.n) { cerr << "Invalid maltiply of matrix" << endl; exit(1); } vector<int> memo(n); rep(i, n) { rep(j, n) { rep(k, n) { memo[j] += vec[i][k] * a.vec[k][j]; } } vec[i] = memo; memo.clear(); memo.resize(n); } return *this; } Matrix letmod(int m = mod) { rep(i, n) { rep(j, n) vec[i][j] %= m; } return *this; } static Matrix measure(int n) { Matrix res(n); res.Measure(); return res; } static Matrix mypow(Matrix a, int b, int m = mod) { a.letmod(m); if (!b) return Matrix::measure(a.size()); if (b % 2) return (mypow(a, b - 1, m) * a).letmod(m); Matrix memo = mypow(a, b / 2, m); return (memo * memo).letmod(m); } }; class mycomplex { double realvalue, imagvalue; public: mycomplex() : realvalue(0), imagvalue(0) {} mycomplex(double realvalue, double imagvalue) : realvalue(realvalue), imagvalue(imagvalue) {} mycomplex(double realvalue) : realvalue(realvalue), imagvalue(0) {} mycomplex(complex<double> c) : realvalue(c.real()), imagvalue(c.imag()) {} mycomplex(const mycomplex &rhs) : realvalue(rhs.realvalue), imagvalue(rhs.imagvalue) {} double real() const { return this->realvalue; } double imag() const { return this->imagvalue; } double abs() { return hypot(realvalue, imagvalue); } mycomplex &operator=(const mycomplex &obj) { if (this != &obj) { this->realvalue = obj.realvalue; this->imagvalue = obj.imagvalue; } return *this; } mycomplex &operator=(mycomplex &&obj) noexcept { if (this != &obj) { this->realvalue = exchange(obj.realvalue, 0); this->imagvalue = exchange(obj.imagvalue, 0); } return *this; } mycomplex &operator+=(const mycomplex &rhs) { this->realvalue += rhs.realvalue; this->imagvalue += rhs.imagvalue; return *this; } friend mycomplex operator+(mycomplex lhs, const mycomplex &rhs) { lhs += rhs; return lhs; } mycomplex &operator-=(const mycomplex &rhs) { this->realvalue -= rhs.realvalue; this->imagvalue -= rhs.imagvalue; return *this; } mycomplex &operator-=(const double &rhs) { this->realvalue -= rhs; return *this; } friend mycomplex operator-(mycomplex lhs, const mycomplex &rhs) { lhs -= rhs; return lhs; } mycomplex &operator*=(const mycomplex &rhs) { double pastreal = this->realvalue; this->realvalue = this->realvalue * rhs.realvalue - this->imagvalue * rhs.imagvalue; this->imagvalue = pastreal * rhs.imagvalue + rhs.realvalue * this->imagvalue; return *this; } friend mycomplex operator*(mycomplex lhs, const mycomplex &rhs) { lhs *= rhs; return lhs; } mycomplex &operator/=(const mycomplex &rhs) { *this *= mycomplex(rhs.real(), -rhs.imag()); double dnm = rhs.real() * rhs.real() - rhs.imag() * rhs.imag(); this->realvalue /= dnm; this->imagvalue /= dnm; return *this; } friend mycomplex operator/(mycomplex lhs, const mycomplex &rhs) { lhs /= rhs; return lhs; } }; class FastFourierTransform { private: static void dft(vector<mycomplex> &func, int inverse) { int sz = func.size(); if (sz == 1) return; vector<mycomplex> veca, vecb; rep(i, sz / 2) { veca.push_back(func[2 * i]); vecb.push_back(func[2 * i + 1]); } dft(veca, inverse); dft(vecb, inverse); mycomplex now = 1, zeta = polar(1.0, inverse * 2.0 * acos(-1) / sz); rep(i, sz) { func[i] = veca[i % (sz / 2)] + now * vecb[i % (sz / 2)]; now *= zeta; } } public: template <typename T> static vector<double> multiply(vector<T> f, vector<T> g) { vector<mycomplex> nf, ng; int sz = 1; while (sz < f.size() + g.size()) sz *= 2; nf.resize(sz); ng.resize(sz); rep(i, f.size()) { nf[i] = f[i]; ng[i] = g[i]; } dft(nf, 1); dft(ng, 1); rep(i, sz) nf[i] *= ng[i]; dft(nf, -1); vector<double> res; rep(i, sz) res.push_back(nf[i].real() / sz); return res; } }; int n, a[200010], b[200010]; signed main() { scanf("%lld", &n); rep(i, n) scanf("%lld", a + i); prique<P> que; rep(i, n) { scanf("%lld", b + i); if (a[i] != b[i]) que.push(make_pair(b[i], i)); } int ans = 0; while (!que.empty()) { P p = que.top(); que.pop(); int x = p.second - 1, y = p.second + 1; if (x < 0) x += n; if (n <= y) y -= n; if (b[x] + b[y] >= b[p.second] - a[p.second]) { printf("-1\n"); return 0; } ans += (b[p.second] - a[p.second]) / (b[x] + b[y]); b[p.second] -= (b[p.second] - a[p.second]) / (b[x] + b[y]) * (b[x] + b[y]); if (a[p.second] != b[p.second]) { que.push(make_pair(b[p.second], p.second)); } } printf("%lld\n", ans); return 0; }
#include <algorithm> #include <assert.h> #include <bitset> #include <cfloat> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <queue> #include <random> #include <set> #include <stack> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, n) for (int i = 1; i <= n; i++) #define int long long #define ll long long #define eps LDBL_EPSILON #define mod (int)1000000007 #define INF INT_MAX / 10 #define P pair<int, int> #define prique priority_queue using namespace std; int gcd(int a, int b) { if (!b) return a; return gcd(b, a % b); } int lcm(int a, int b) { return a / gcd(a, b) * b; } bool isprime(int n) { if (n == 1) return false; for (int i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } int mypow(int a, int b) { if (!b) return 1; if (b % 2) return mypow(a, b - 1) * a; int memo = mypow(a, b / 2); return memo * memo; } int modpow(int a, int b, int m = mod) { if (!b) return 1; if (b % 2) return modpow(a, b - 1, m) * a % m; int memo = modpow(a, b / 2, m); return memo * memo % m; } class modInt { int value, modulo; public: template <typename T> constexpr modInt(T value = 0, int modulo = mod) : value(value), modulo(modulo) { value %= T(modulo); } inline constexpr operator int() const { return value; } inline constexpr modInt &operator+=(modInt x) { value += x.value; if (value >= modulo) value -= modulo; return *this; } inline constexpr modInt &operator++() { if (value == modulo - 1) value = 0; else value++; return *this; } inline constexpr modInt &operator-() const { return modInt(0) -= *this; } inline constexpr modInt &operator-=(modInt x) { value -= x.value; if (value < 0) value += modulo; return *this; } inline constexpr modInt &operator--() { if (value == 0) value = modulo - 1; else value--; return *this; } inline constexpr modInt &operator*=(modInt x) { value = value * x.value % mod; return *this; } inline modInt &operator/=(modInt x) { return operator*=(x.inv()); } modInt pow(modInt x, int y) { if (!y) return 1; if (y & 1) return pow(x, y - 1); modInt memo = pow(x, y / 2); return memo * memo; } inline modInt inv() { return pow(*this, modulo - 2); } template <typename T> modInt operator+(T x) { return modInt(*this) += x; } template <typename T> modInt &operator+=(T x) { return modInt(*this) += modInt(x); } template <typename T> modInt operator-(T x) { return modInt(*this) -= x; } template <typename T> modInt &operator-=(T x) { return modInt(*this) -= modInt(x); } template <typename T> modInt operator*(T x) { return modInt(*this) *= x; } template <typename T> modInt &operator*=(T x) { return modInt(*this) *= modInt(x); } template <typename T> modInt operator/(T x) { return modInt(*this) /= x; } template <typename T> modInt &operator/=(T x) { return modInt(*this) /= modInt(x); } }; istream &operator>>(istream ist, modInt &x) { int a; ist >> a; x = a; return ist; } class UnionFind { int *par, *rank; P *notparent; vector<P> *size; int opcount = 0; public: UnionFind(unsigned int size) { par = new int[size + 1]; rank = new int[size + 1]; this->size = new vector<P>[size + 1]; notparent = new P[size + 1]; rep(i, size + 1) { par[i] = i; rank[i] = 0; this->size[i].push_back(make_pair(-1, 1)); notparent[i] = make_pair(INF, i); } } int find(int n, int t = INF) { if (opcount <= t) { if (par[n] == n) return n; return par[n] = find(par[n]); } if (notparent[n].first <= t) return find(notparent[n].second, t); return n; } void unite(int n, int m) { n = find(n); m = find(m); if (n == m) { opcount++; return; } if (rank[n] < rank[m]) { par[n] = m; notparent[n] = make_pair(opcount, m); size[m].push_back( make_pair(opcount, size[m].back().second + size[n].back().second)); } else { par[m] = n; notparent[m] = make_pair(opcount, n); size[n].push_back( make_pair(opcount, size[n].back().second + size[m].back().second)); if (rank[n] == rank[m]) rank[n]++; } opcount++; } bool same(int n, int m, int t = INF) { return find(n, t) == find(m, t); } int getsize(int n, int t = INF) { n = find(n, t); auto ite = lower_bound(size[n].begin(), size[n].end(), make_pair(t, (int)0)); if (ite == size[n].end()) ite--; if (t < (*ite).first) ite--; return (*ite).second; } }; class RollingHash { string s; int n, m, base; deque<int> has; public: RollingHash(string s, int m, int b) : n(s.size()), m(m), base(b) { init(s, m, b); } void init(string s, int m, int b) { n = s.size(); has.resize(n); base = b; this->s = s; this->m = m; rep(i, n) { has[i] = (int)s[i]; if (i) has[i] += base * has[i - 1] % m; has[i] %= m; } } operator int() const { return has.back(); } void cut(int a, int b) { assert(!(a >= b || a < 0 || n < b)); rep(i, a) has.pop_front(); rep(i, n - b) has.pop_back(); s = s.substr(a, b); int memo = modpow(modpow(base, n - b, m), m - 2, m); rep(i, b - a) { has[i] *= memo; has[i] %= mod; } n = b - a; } int query(int a, int b) { assert(!(a >= b || a < 0 || n < b)); return (has[b - 1] - modpow(base, b - a, m) * (!a ? 0 : has[a - 1]) % m + m) % m; } int operator+(RollingHash t) { assert(m == t.m && base == t.base); return (has[n - 1] * modpow(base, t.n, m) % m + t.has[t.n - 1]) % m; } RollingHash &operator+=(string t) { s += t; has.resize(n + t.size()); for (int i = n; i < n + t.size(); i++) { has[i] = (int)t[i] * base % m; has[i] += base * has[i - 1] % m; has[i] %= m; } n += t.size(); return *this; } }; template <typename T, typename U> class SegTree { int n = 1; T *node = NULL; U *lazy = NULL; bool *lazyflag = NULL; T nodee; U lazye; function<T(T, T)> nodef; function<U(U, U)> lazyf; function<T(int, T, U)> updf; void eval(int k, int l, int r) { if (lazyflag[k]) { node[k] = updf(r - l, node[k], lazy[k]); if (r - l > 1) { lazyflag[2 * k + 1] = lazyflag[2 * k + 2] = true; lazy[2 * k + 1] = lazyf(lazy[2 * k + 1], lazy[k]); lazy[2 * k + 2] = lazyf(lazy[2 * k + 2], lazy[k]); } lazyflag[k] = false; lazy[k] = lazye; } } public: SegTree(int m, int init, T nodee, U lazye, function<T(T, T)> nodef, function<U(U, U)> lazyf, function<T(int, T, U)> updf) : nodee(nodee), lazye(lazye), nodef(nodef), lazyf(lazyf), updf(updf) { delete[] node; delete[] lazy; while (n < m) n *= 2; node = new T[2 * n], lazy = new U[2 * n], lazyflag = new bool[2 * n]; rep(i, 2 * n) { node[i] = init; lazy[i] = lazye; lazyflag[i] = false; } } ~SegTree() { delete[] node; delete[] lazy; } void update(int a, int b, U x, int k = 0, int l = 0, int r = -1) { if (r == -1) r = n; eval(k, l, r); if (b <= l || r <= a) return; if (a <= l && r <= b) { lazyflag[k] = true; lazy[k] = x; eval(k, l, r); } else { update(a, b, x, 2 * k + 1, l, (l + r) / 2); update(a, b, x, 2 * k + 2, (l + r) / 2, r); node[k] = nodef(node[2 * k + 1], node[2 * k + 2]); } } T query(int a, int b, int k = 0, int l = 0, int r = -1) { if (r == -1) r = n; eval(k, l, r); if (b <= l || r <= a) return nodee; if (a <= l && r <= b) return node[k]; T vl = query(a, b, 2 * k + 1, l, (l + r) / 2); T vr = query(a, b, 2 * k + 2, (l + r) / 2, r); return nodef(vl, vr); } }; class Matrix { int n; vector<vector<int>> vec; void Measure() { rep(i, n) { rep(j, n) { if (i != j) vec[i][j] = 0; else vec[i][j] = 1; } } } public: Matrix(int n) { this->n = n; vec.resize(n, vector<int>(n)); } Matrix(int n, vector<int> vec) { if (vec.size() != n * n) { cerr << "Invalid construct of matrix" << endl; exit(1); } this->n = n; this->vec.resize(n, vector<int>(n)); rep(i, n) { rep(j, n) this->vec[i][j] = vec[i * n + j]; } } int operator[](int a) { return vec[a / n][a % n]; } unsigned int size() { return n; } Matrix operator*(const Matrix a) { if (this->n != a.n) { cerr << "Invalid maltiply of matrix" << endl; exit(1); } vector<int> memo(n); rep(i, n) { rep(j, n) { rep(k, n) { memo[j] += vec[i][k] * a.vec[k][j]; } } vec[i] = memo; memo.clear(); memo.resize(n); } return *this; } Matrix letmod(int m = mod) { rep(i, n) { rep(j, n) vec[i][j] %= m; } return *this; } static Matrix measure(int n) { Matrix res(n); res.Measure(); return res; } static Matrix mypow(Matrix a, int b, int m = mod) { a.letmod(m); if (!b) return Matrix::measure(a.size()); if (b % 2) return (mypow(a, b - 1, m) * a).letmod(m); Matrix memo = mypow(a, b / 2, m); return (memo * memo).letmod(m); } }; class mycomplex { double realvalue, imagvalue; public: mycomplex() : realvalue(0), imagvalue(0) {} mycomplex(double realvalue, double imagvalue) : realvalue(realvalue), imagvalue(imagvalue) {} mycomplex(double realvalue) : realvalue(realvalue), imagvalue(0) {} mycomplex(complex<double> c) : realvalue(c.real()), imagvalue(c.imag()) {} mycomplex(const mycomplex &rhs) : realvalue(rhs.realvalue), imagvalue(rhs.imagvalue) {} double real() const { return this->realvalue; } double imag() const { return this->imagvalue; } double abs() { return hypot(realvalue, imagvalue); } mycomplex &operator=(const mycomplex &obj) { if (this != &obj) { this->realvalue = obj.realvalue; this->imagvalue = obj.imagvalue; } return *this; } mycomplex &operator=(mycomplex &&obj) noexcept { if (this != &obj) { this->realvalue = exchange(obj.realvalue, 0); this->imagvalue = exchange(obj.imagvalue, 0); } return *this; } mycomplex &operator+=(const mycomplex &rhs) { this->realvalue += rhs.realvalue; this->imagvalue += rhs.imagvalue; return *this; } friend mycomplex operator+(mycomplex lhs, const mycomplex &rhs) { lhs += rhs; return lhs; } mycomplex &operator-=(const mycomplex &rhs) { this->realvalue -= rhs.realvalue; this->imagvalue -= rhs.imagvalue; return *this; } mycomplex &operator-=(const double &rhs) { this->realvalue -= rhs; return *this; } friend mycomplex operator-(mycomplex lhs, const mycomplex &rhs) { lhs -= rhs; return lhs; } mycomplex &operator*=(const mycomplex &rhs) { double pastreal = this->realvalue; this->realvalue = this->realvalue * rhs.realvalue - this->imagvalue * rhs.imagvalue; this->imagvalue = pastreal * rhs.imagvalue + rhs.realvalue * this->imagvalue; return *this; } friend mycomplex operator*(mycomplex lhs, const mycomplex &rhs) { lhs *= rhs; return lhs; } mycomplex &operator/=(const mycomplex &rhs) { *this *= mycomplex(rhs.real(), -rhs.imag()); double dnm = rhs.real() * rhs.real() - rhs.imag() * rhs.imag(); this->realvalue /= dnm; this->imagvalue /= dnm; return *this; } friend mycomplex operator/(mycomplex lhs, const mycomplex &rhs) { lhs /= rhs; return lhs; } }; class FastFourierTransform { private: static void dft(vector<mycomplex> &func, int inverse) { int sz = func.size(); if (sz == 1) return; vector<mycomplex> veca, vecb; rep(i, sz / 2) { veca.push_back(func[2 * i]); vecb.push_back(func[2 * i + 1]); } dft(veca, inverse); dft(vecb, inverse); mycomplex now = 1, zeta = polar(1.0, inverse * 2.0 * acos(-1) / sz); rep(i, sz) { func[i] = veca[i % (sz / 2)] + now * vecb[i % (sz / 2)]; now *= zeta; } } public: template <typename T> static vector<double> multiply(vector<T> f, vector<T> g) { vector<mycomplex> nf, ng; int sz = 1; while (sz < f.size() + g.size()) sz *= 2; nf.resize(sz); ng.resize(sz); rep(i, f.size()) { nf[i] = f[i]; ng[i] = g[i]; } dft(nf, 1); dft(ng, 1); rep(i, sz) nf[i] *= ng[i]; dft(nf, -1); vector<double> res; rep(i, sz) res.push_back(nf[i].real() / sz); return res; } }; int n, a[200010], b[200010]; signed main() { scanf("%lld", &n); rep(i, n) scanf("%lld", a + i); prique<P> que; rep(i, n) { scanf("%lld", b + i); if (a[i] != b[i]) que.push(make_pair(b[i], i)); } int ans = 0; while (!que.empty()) { P p = que.top(); que.pop(); int x = p.second - 1, y = p.second + 1; if (x < 0) x += n; if (n <= y) y -= n; if (b[x] + b[y] > b[p.second] - a[p.second]) { printf("-1\n"); return 0; } ans += (b[p.second] - a[p.second]) / (b[x] + b[y]); b[p.second] -= (b[p.second] - a[p.second]) / (b[x] + b[y]) * (b[x] + b[y]); if (a[p.second] != b[p.second]) { que.push(make_pair(b[p.second], p.second)); } } printf("%lld\n", ans); return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
742,995
742,996
u379822620
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << max((a + b, a - b), a * b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << max(max(a + b, a - b), a * b) << endl; }
[ "call.add", "call.arguments.change" ]
743,028
743,029
u940079168
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int z = a + b; if (z > a - b) z = a - b; if (z > a * b) z = a * b; cout << z << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; int z = a + b; if (z < a - b) z = a - b; if (z < a * b) z = a * b; cout << z << endl; }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
743,072
743,073
u107406081
cpp
p02945
#include <stdio.h> int main(void) { int a, b, c, d, e, t; scanf("%d%d", &a, &b); c = a + b; d = a - b; e = a * b; if (a >= b) t = a; else t = b; if (e > t) t = e; printf("%d", t); return 0; }
#include <stdio.h> int main(void) { int a, b, c, d, e, t; scanf("%d%d", &a, &b); c = a + b; d = a - b; e = a * b; if (c >= d) t = c; else t = d; if (e > t) t = e; printf("%d", t); return 0; }
[ "identifier.change", "control_flow.branch.if.condition.change", "assignment.value.change" ]
743,086
743,087
u816631826
cpp
p02945
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; int t = a + b, h = a - b, j = a * b; if (t > h || t > j) { cout << t << endl; } else if (h > t || h > j) { cout << h << endl; } else { cout << j << endl; } return 0; }
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; int t = a + b, h = a - b, j = a * b; if (t >= h && t >= j) { cout << t << endl; } else if (h >= t && h >= j) { cout << h << endl; } else { cout << j << endl; } return 0; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "misc.opposites" ]
743,096
743,094
u025892939
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c, d, e, f; cin >> a >> b; c = a + b, d = a - b, e = a * e; if (c > d) { f = c; } else { f = d; } if (f > e) { cout << f; } else { cout << e; } }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c, d, e, f; cin >> a >> b; c = a + b, d = a - b, e = a * b; if (c > d) { f = c; } else { f = d; } if (f > e) { cout << f; } else { cout << e; } }
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
743,114
743,115
u768439523
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int N, A; cin >> N >> A; cout << max(A + N, max(N - A, A + N)) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, A; cin >> N >> A; cout << max(A * N, max(N - A, A + N)) << endl; }
[ "expression.operator.arithmetic.change", "io.output.change" ]
743,128
743,129
u977547071
cpp
p02945
#include <bits/stdc++.h> using namespace std; #include <cstdlib> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef long long ll; int main() { int a, b; cin >> a >> b; cout << max(a * b, max(a - b, a * b)); }
#include <bits/stdc++.h> using namespace std; #include <cstdlib> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef long long ll; int main() { int a, b; cin >> a >> b; cout << max(a + b, max(a - b, a * b)); }
[ "expression.operator.arithmetic.change", "io.output.change" ]
743,163
743,164
u748819456
cpp
p02945
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <utility> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) int main() { int a, b; cin >> a >> b; int ans = max(a + b, a - b); ans = max(ans, a - b); cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <utility> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) int main() { int a, b; cin >> a >> b; int ans = max(a + b, a * b); ans = max(ans, a - b); cout << ans << endl; return 0; }
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
743,177
743,178
u874815061
cpp
p02945
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, N) for (int i = 0; i < (int)(N); i++) int main() { int a, b; cin >> a >> b; int x = a + b, y = a = b, z = a * b; int s = max(x, y); int t = max(s, z); cout << t << endl; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, N) for (int i = 0; i < (int)(N); i++) int main() { int a, b; cin >> a >> b; int x = a + b, y = a - b, z = a * b; int s = max(x, y); int t = max(s, z); cout << t << endl; }
[]
743,183
743,184
u485925545
cpp
p02945
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; int main() { int a, b; cin >> a >> b; int m = a + b; m = min(m, a - b); m = min(m, a * b); cout << m << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; using ll = long long; int main() { int a, b; cin >> a >> b; int m = a + b; m = max(m, a - b); m = max(m, a * b); cout << m << endl; return 0; }
[ "misc.opposites", "assignment.value.change", "identifier.change", "call.function.change" ]
743,194
743,195
u607564800
cpp
p02945
#include <algorithm> #include <iostream> using namespace std; int main() { int A, B; std::cin >> A >> B; cout << max({A + B, A * B, A = B}) << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { int A, B; std::cin >> A >> B; cout << max({A + B, A * B, A - B}) << endl; }
[ "io.output.change" ]
743,200
743,201
u672822010
cpp
p02945
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vll; typedef vector<pair<int, int>> vp; typedef pair<int, int> pii; #define INF (int)(1e9) #define MAXX 1.1529215e+18 #define inf 999999 #define EPS (1e-7) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define FOR(i, k, n) for (int i = (k); i < (int)(n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.begin(), a.end(), greater<int>() #define ROT(a) a.begin(), a.begin() + 1, a.end() #define RROT(a) a.begin(), a.end() - 1, a.end() #define PB push_back #define MP make_pair #define PI acos(-1.0) #define sz(a) a.size() const ll MOD = 1e9 + 7; const int MAX = 10000000; template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; } template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } // cout << 'H' << endl; // next_permutation(ALL(p)); // typedef priority_queue<int> pque;//これは大きい順 // typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順 // factorizeは、素因数分解用の関数 int main() { int a, b; cin >> a >> b; int max = 0; chmax(max, a + b); chmax(max, a - b); chmax(max, a * b); cout << max << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vll; typedef vector<pair<int, int>> vp; typedef pair<int, int> pii; #define INF (int)(1e9) #define MAXX 1.1529215e+18 #define inf 999999 #define EPS (1e-7) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i <= (int)(n); i++) #define FOR(i, k, n) for (int i = (k); i < (int)(n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.begin(), a.end(), greater<int>() #define ROT(a) a.begin(), a.begin() + 1, a.end() #define RROT(a) a.begin(), a.end() - 1, a.end() #define PB push_back #define MP make_pair #define PI acos(-1.0) #define sz(a) a.size() const ll MOD = 1e9 + 7; const int MAX = 10000000; template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; } template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; } template <typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } // cout << 'H' << endl; // next_permutation(ALL(p)); // typedef priority_queue<int> pque;//これは大きい順 // typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順 // factorizeは、素因数分解用の関数 int main() { int a, b; cin >> a >> b; int max = -1 * INF; chmax(max, a + b); chmax(max, a - b); chmax(max, a * b); cout << max << endl; return 0; }
[ "literal.number.change" ]
743,209
743,210
u979966078
cpp
p02945
#include <iostream> using namespace std; int main() { int a, b; cin >> a, b; cout << max(a - b, max(a + b, a * b)); }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << max(a - b, max(a + b, a * b)); }
[]
743,211
743,212
u746310630
cpp
p02945
#pragma GCC optimize("O2") #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdarg> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define whlie while #define retunr return #define reutrn return #define reutnr return #define mp make_pair #define pb push_back #define eb emplace_back #define fi first #define se second #define inf 1001001001 #define infLL (1LL << 61) #define FOR(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); (i)++) // [a,b) #define rep(i, N) FOR((i), 0, (int)(N)) // [0,N) #define FORR(i, a, b) for (int(i) = (int)(b)-1; (i) >= (int)(a); (i)--) #define repr(i, N) FORR((i), 0, (int)(N)) #define each(x, v) for (auto &x : v) #define all(v) (v).begin(), (v).end() #define sz(v) ((int)(v).size()) #define vrep(v, it) for (auto it = v.begin(); it != v.end(); it++) #define vrepr(v, it) for (auto it = v.rbegin(); it != v.rend(); it++) #define ini(...) \ int __VA_ARGS__; \ in(__VA_ARGS__) #define inl(...) \ ll __VA_ARGS__; \ in(__VA_ARGS__) #define inc(...) \ char __VA_ARGS__; \ in(__VA_ARGS__) #define ins(...) \ string __VA_ARGS__; \ in(__VA_ARGS__) #define ind(...) \ double __VA_ARGS__; \ in(__VA_ARGS__) #define inpii(...) \ pii __VA_ARGS__; \ in(__VA_ARGS__) #ifdef LOCAL #define trc(...) \ do { \ cout << #__VA_ARGS__ << " = "; \ dbg_out(__VA_ARGS__); \ } while (0) #define stopif(val) assert(!(val)) #define trcv(v, ...) \ do { \ cout << #v << " = "; \ vector_debug(v, ##__VA_ARGS__); \ cout << endl; \ } while (0) #else #define trc(...) #define stopif(...) #define trcv(...) #endif using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vpii = vector<pii>; using vvi = vector<vector<int>>; struct IoSetupNya { IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); } } iosetupnya; int gcd(int a, int b) { if (a > b) swap(a, b); return a == 0 ? b : gcd(b % a, a); } ll gcd(ll a, ll b) { if (a > b) swap(a, b); return a == 0 ? b : gcd(b % a, a); } ll lcm(int a, int b) { return (1LL * a / gcd(a, b)) * b; } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } inline ll pow(int a, int b) { ll ans = 1; rep(i, b) ans *= a; return ans; } inline ll pow(ll a, ll b) { ll ans = 1; rep(i, b) ans *= a; return ans; } inline ll pow(int a, ll b) { ll ans = 1; rep(i, b) ans *= a; return ans; } inline ll pow(ll a, int b) { ll ans = 1; rep(i, b) ans *= a; return ans; } template <typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template <typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; } template <typename C> inline void _cin(C &c) { cin >> c; } template <typename T, typename U> inline void _cin(pair<T, U> &p) { cin >> p.fi; cin >> p.se; } template <typename C> inline void _cout(const C &c) { cout << c; } template <typename T, typename U> inline void _cout(const pair<T, U> &p) { cout << p.fi << ' ' << p.se; } void in() {} template <typename T, class... U> void in(T &t, U &...u) { _cin(t); in(u...); } void out() { cout << "\n"; } template <typename T, class... U> void out(const T &t, U... u) { _cout(t); if (sizeof...(u)) cout << ' '; out(u...); } template <typename C> inline void in(vector<C> &v, int N = -1) { if (sz(v) != 0) { int M = (N == -1) ? sz(v) : N; rep(i, M) _cin(v[i]); } else { C c; rep(i, N) v.pb((_cin(c), c)); } } template <typename C> inline void in(C v[], int N) { rep(i, N) _cin(v[i]); } template <typename C> inline void out(const vector<C> &v, int N = -1) { int M = (N == -1) ? sz(v) : N; rep(i, M) { cout << ((i) ? " " : ""); _cout(v[i]); } cout << "\n"; } template <typename C> inline void out(C v[], int N) { rep(i, N) { cout << ((i) ? " " : ""); _cout(v[i]); } cout << "\n"; } template <typename C> inline void vector_debug(const vector<C> &v, int N = -1) { cout << "{"; int M = (N == -1) ? sz(v) : N; rep(i, M) { cout << ((i) ? ", " : ""); _cout(v[i]); } cout << "}"; } template <typename C> inline void vector_debug(C v[], int N) { cout << "{"; rep(i, N) { cout << ((i) ? ", " : ""); _cout(*(v + i)); } cout << "}"; } void dbg_out() { cout << endl; } template <typename T, class... U> void dbg_out(const T &t, U... u) { _cout(t); if (sizeof...(u)) cout << ", "; dbg_out(u...); } template <typename C, class... U> void dbg_out(const vector<C> &v, U... u) { vector_debug(v); if (sizeof...(u)) cout << ", "; dbg_out(u...); } template <typename C, class... U> void dbg_out(const vector<vector<C>> &v, U... u) { cout << "{ "; rep(i, sz(v)) { if (i) cout << ", "; vector_debug(v[i]); } cout << " }"; if (sizeof...(u)) cout << ", "; dbg_out(u...); } template <typename C> inline C vmax(const vector<C> &v) { C n = v[0]; rep(i, sz(v)) amax(n, v[i]); return n; } template <typename C> inline C vmax(C v[], int N) { C n = v[0]; rep(i, N) amax(n, v[i]); return n; } template <typename C> inline C vmin(const vector<C> &v) { C n = v[0]; rep(i, sz(v)) amin(n, v[i]); return n; } template <typename C> inline C vmin(C v[], int N) { C n = v[0]; rep(i, N) amin(n, v[i]); return n; } void die(string s) { out(s); exit(0); } #define rand mtrand #define randinit() \ random_device seed_gen; \ mt19937_64 mtrand(seed_gen()) #define MOD 1000000007 //////////// /// main /// //////////// int main() { randinit(); #ifdef LOCAL auto start = clock(); #endif ini(A, B); out(max({A + B, A = B, A * B})); #ifdef LOCAL cerr << "time : " << clock() - start << " ms" << endl; #endif }
#pragma GCC optimize("O2") #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdarg> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define whlie while #define retunr return #define reutrn return #define reutnr return #define mp make_pair #define pb push_back #define eb emplace_back #define fi first #define se second #define inf 1001001001 #define infLL (1LL << 61) #define FOR(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); (i)++) // [a,b) #define rep(i, N) FOR((i), 0, (int)(N)) // [0,N) #define FORR(i, a, b) for (int(i) = (int)(b)-1; (i) >= (int)(a); (i)--) #define repr(i, N) FORR((i), 0, (int)(N)) #define each(x, v) for (auto &x : v) #define all(v) (v).begin(), (v).end() #define sz(v) ((int)(v).size()) #define vrep(v, it) for (auto it = v.begin(); it != v.end(); it++) #define vrepr(v, it) for (auto it = v.rbegin(); it != v.rend(); it++) #define ini(...) \ int __VA_ARGS__; \ in(__VA_ARGS__) #define inl(...) \ ll __VA_ARGS__; \ in(__VA_ARGS__) #define inc(...) \ char __VA_ARGS__; \ in(__VA_ARGS__) #define ins(...) \ string __VA_ARGS__; \ in(__VA_ARGS__) #define ind(...) \ double __VA_ARGS__; \ in(__VA_ARGS__) #define inpii(...) \ pii __VA_ARGS__; \ in(__VA_ARGS__) #ifdef LOCAL #define trc(...) \ do { \ cout << #__VA_ARGS__ << " = "; \ dbg_out(__VA_ARGS__); \ } while (0) #define stopif(val) assert(!(val)) #define trcv(v, ...) \ do { \ cout << #v << " = "; \ vector_debug(v, ##__VA_ARGS__); \ cout << endl; \ } while (0) #else #define trc(...) #define stopif(...) #define trcv(...) #endif using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vpii = vector<pii>; using vvi = vector<vector<int>>; struct IoSetupNya { IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); } } iosetupnya; int gcd(int a, int b) { if (a > b) swap(a, b); return a == 0 ? b : gcd(b % a, a); } ll gcd(ll a, ll b) { if (a > b) swap(a, b); return a == 0 ? b : gcd(b % a, a); } ll lcm(int a, int b) { return (1LL * a / gcd(a, b)) * b; } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } inline ll pow(int a, int b) { ll ans = 1; rep(i, b) ans *= a; return ans; } inline ll pow(ll a, ll b) { ll ans = 1; rep(i, b) ans *= a; return ans; } inline ll pow(int a, ll b) { ll ans = 1; rep(i, b) ans *= a; return ans; } inline ll pow(ll a, int b) { ll ans = 1; rep(i, b) ans *= a; return ans; } template <typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template <typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; } template <typename C> inline void _cin(C &c) { cin >> c; } template <typename T, typename U> inline void _cin(pair<T, U> &p) { cin >> p.fi; cin >> p.se; } template <typename C> inline void _cout(const C &c) { cout << c; } template <typename T, typename U> inline void _cout(const pair<T, U> &p) { cout << p.fi << ' ' << p.se; } void in() {} template <typename T, class... U> void in(T &t, U &...u) { _cin(t); in(u...); } void out() { cout << "\n"; } template <typename T, class... U> void out(const T &t, U... u) { _cout(t); if (sizeof...(u)) cout << ' '; out(u...); } template <typename C> inline void in(vector<C> &v, int N = -1) { if (sz(v) != 0) { int M = (N == -1) ? sz(v) : N; rep(i, M) _cin(v[i]); } else { C c; rep(i, N) v.pb((_cin(c), c)); } } template <typename C> inline void in(C v[], int N) { rep(i, N) _cin(v[i]); } template <typename C> inline void out(const vector<C> &v, int N = -1) { int M = (N == -1) ? sz(v) : N; rep(i, M) { cout << ((i) ? " " : ""); _cout(v[i]); } cout << "\n"; } template <typename C> inline void out(C v[], int N) { rep(i, N) { cout << ((i) ? " " : ""); _cout(v[i]); } cout << "\n"; } template <typename C> inline void vector_debug(const vector<C> &v, int N = -1) { cout << "{"; int M = (N == -1) ? sz(v) : N; rep(i, M) { cout << ((i) ? ", " : ""); _cout(v[i]); } cout << "}"; } template <typename C> inline void vector_debug(C v[], int N) { cout << "{"; rep(i, N) { cout << ((i) ? ", " : ""); _cout(*(v + i)); } cout << "}"; } void dbg_out() { cout << endl; } template <typename T, class... U> void dbg_out(const T &t, U... u) { _cout(t); if (sizeof...(u)) cout << ", "; dbg_out(u...); } template <typename C, class... U> void dbg_out(const vector<C> &v, U... u) { vector_debug(v); if (sizeof...(u)) cout << ", "; dbg_out(u...); } template <typename C, class... U> void dbg_out(const vector<vector<C>> &v, U... u) { cout << "{ "; rep(i, sz(v)) { if (i) cout << ", "; vector_debug(v[i]); } cout << " }"; if (sizeof...(u)) cout << ", "; dbg_out(u...); } template <typename C> inline C vmax(const vector<C> &v) { C n = v[0]; rep(i, sz(v)) amax(n, v[i]); return n; } template <typename C> inline C vmax(C v[], int N) { C n = v[0]; rep(i, N) amax(n, v[i]); return n; } template <typename C> inline C vmin(const vector<C> &v) { C n = v[0]; rep(i, sz(v)) amin(n, v[i]); return n; } template <typename C> inline C vmin(C v[], int N) { C n = v[0]; rep(i, N) amin(n, v[i]); return n; } void die(string s) { out(s); exit(0); } #define rand mtrand #define randinit() \ random_device seed_gen; \ mt19937_64 mtrand(seed_gen()) #define MOD 1000000007 //////////// /// main /// //////////// int main() { randinit(); #ifdef LOCAL auto start = clock(); #endif ini(A, B); out(max({A + B, A - B, A * B})); #ifdef LOCAL cerr << "time : " << clock() - start << " ms" << endl; #endif }
[ "call.arguments.change" ]
743,231
743,232
u168578024
cpp
p02945
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define INF 1LL << 60 typedef long long int LL; typedef long long int ll; #define pll pair<ll, ll> #define F first #define S second const int MOD = 1000000007; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } // sort(all(x))とするとソートできるよ // 10^x は pow(10,(x)) // 任意のlogは 対数の底の変換を使う log(N) / log(任意の底) int main() { int A, B; cin >> A >> B; int a = A + B; int b = A - B; int c = A * B; int ans = max(a, b); ans = max(b, c); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(), (x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define INF 1LL << 60 typedef long long int LL; typedef long long int ll; #define pll pair<ll, ll> #define F first #define S second const int MOD = 1000000007; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } // sort(all(x))とするとソートできるよ // 10^x は pow(10,(x)) // 任意のlogは 対数の底の変換を使う log(N) / log(任意の底) int main() { int A, B; cin >> A >> B; int a = A + B; int b = A - B; int c = A * B; int ans = max(a, b); ans = max(ans, c); cout << ans << endl; }
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
743,233
743,234
u587857074
cpp
p02945
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int a, b; cin >> a >> b; cout << max(a + b, (a - b, a * b)) << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int a, b; cin >> a >> b; cout << max({a + b, a - b, a * b}) << endl; }
[ "call.arguments.change", "io.output.change" ]
743,239
743,240
u654949547
cpp
p02945
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int c = max(a + b, a - b); cout << max(c, a + b); }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int c = max(a + b, a - b); cout << max(c, a * b); }
[ "expression.operator.arithmetic.change", "io.output.change" ]
743,241
743,242
u354391647
cpp
p02945
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) int main() { int a, b; cin >> a >> b; int maxval = 0; maxval = max(maxval, a + b); maxval = max(maxval, a - b); maxval = max(maxval, a * b); cout << maxval << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) int main() { int a, b; cin >> a >> b; int maxval = -100 * 100; maxval = max(maxval, a + b); maxval = max(maxval, a - b); maxval = max(maxval, a * b); cout << maxval << endl; return 0; }
[ "literal.number.change" ]
743,243
743,244
u685800831
cpp
p02945
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(v) v.begin(), v.end() using namespace std; int main() { int A, B; cin >> A >> B; int maximum = A + B; maximum = (A - B) > maximum ? (A - B) : maximum; maximum = (A * B) > maximum ? (A - B) : maximum; cout << maximum << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(v) v.begin(), v.end() using namespace std; int main() { int A, B; cin >> A >> B; int maximum = A + B; maximum = (A - B) > maximum ? (A - B) : maximum; maximum = (A * B) > maximum ? (A * B) : maximum; cout << maximum << endl; }
[ "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
743,247
743,248
u717265305
cpp
p02945
#include <iostream> #include <vector> using namespace std; int main() { int a, b, ans = 0; cin >> a >> b; vector<int> an(3); an[0] = a + b; an[1] = a - b; an[2] = a * b; ans = an[0]; if (an[2] > an[1] && ans < an[1]) ans = an[1]; else if (an[2] < an[1] && ans < an[2]) ans = an[2]; cout << ans << endl; }
#include <iostream> #include <vector> using namespace std; int main() { int a, b, ans = 0; cin >> a >> b; vector<int> an(3); an[0] = a + b; an[1] = a - b; an[2] = a * b; ans = an[0]; if (an[2] > an[1] && ans < an[2]) ans = an[2]; else if (an[2] < an[1] && ans < an[1]) ans = an[1]; cout << ans << endl; }
[ "control_flow.branch.if.add", "assignment.add" ]
743,264
743,265
u388372553
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (a * b > a - b && a * b > a + b) cout << a * b << endl; else if (a + b > a - b && a + b > a * b) cout << a + b << endl; else cout << a * b << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (a * b > a - b && a * b > a + b) cout << a * b << endl; else if (a + b > a - b && a + b > a * b) cout << a + b << endl; else cout << a - b << endl; }
[ "expression.operator.arithmetic.change", "io.output.change" ]
743,270
743,271
u613960672
cpp
p02945
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int a, b; int ans; cin >> a >> b; ans = max(a + b, a - b); ans = (ans, a * b); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int a, b; int ans; cin >> a >> b; ans = max(a + b, a - b); ans = max(ans, a * b); cout << ans << endl; return 0; }
[ "call.add" ]
743,283
743,284
u001327021
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << max({a + b, a - b, a + b}) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << max({a + b, a - b, a * b}) << endl; return 0; }
[ "expression.operator.arithmetic.change", "io.output.change" ]
743,288
743,289
u519194615
cpp
p02945
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define RFOR(i, a, b) for (int i = (a); i >= (b); i--) #define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++) #define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--) #define MOD 1000000007 #define INF 1000000000 // 2000000000 #define LINF 1000000000000000000 // 9000000000000000000 #define DINF 1000000000000000.0 #define PI 3.14159265358979 //.size()はunsigned int 0-1をするとオーバーフローする using namespace std; typedef long long int ll; typedef pair<long long int, long long int> P; int dy[5] = {-1, 0, 1, 0, 0}; int dx[5] = {0, -1, 0, 1, 0}; int main(void) { int a, b; cin >> a >> b; cout << min(a + b, min(a - b, a * b)) << endl; }
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define RFOR(i, a, b) for (int i = (a); i >= (b); i--) #define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++) #define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--) #define MOD 1000000007 #define INF 1000000000 // 2000000000 #define LINF 1000000000000000000 // 9000000000000000000 #define DINF 1000000000000000.0 #define PI 3.14159265358979 //.size()はunsigned int 0-1をするとオーバーフローする using namespace std; typedef long long int ll; typedef pair<long long int, long long int> P; int dy[5] = {-1, 0, 1, 0, 0}; int dx[5] = {0, -1, 0, 1, 0}; int main(void) { int a, b; cin >> a >> b; cout << max(a + b, max(a - b, a * b)) << endl; }
[ "misc.opposites", "identifier.change", "call.function.change", "io.output.change" ]
743,292
743,293
u057611820
cpp
p02945
#include <iostream> using namespace std; int main() { int A, B, l; l = 0; cin >> A >> B; l = A * B; if ((A + B) > l) l = A + B; else if ((A - B) > l) l = A - B; cout << l; return 0; }
#include <iostream> using namespace std; int main() { int A, B, l; l = 0; cin >> A >> B; l = A * B; if ((A + B) > l) l = A + B; if ((A - B) > l) l = A - B; cout << l; return 0; }
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
743,310
743,311
u105724567
cpp
p02945
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; int sum, sa, kakeru, max; sum = a + b; sa = a - b; kakeru = a * b; max = sum; if (sa >= max) max = sum; if (kakeru >= max) max = kakeru; cout << max; }
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; int sum, sa, kakeru, max; sum = a + b; sa = a - b; kakeru = a * b; max = sum; if (sa > max) max = sa; if (kakeru > max) max = kakeru; cout << max; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "assignment.value.change", "identifier.change" ]
743,312
743,313
u280286156
cpp
p02945
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; int sum, sa, kakeru, max; sum = a + b; sa = a - b; kakeru = a * b; max = sum; if (sa > max) max = sum; if (kakeru > max) max = kakeru; cout << max; }
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; int sum, sa, kakeru, max; sum = a + b; sa = a - b; kakeru = a * b; max = sum; if (sa > max) max = sa; if (kakeru > max) max = kakeru; cout << max; }
[ "assignment.value.change", "identifier.change" ]
743,314
743,313
u280286156
cpp
p02945
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int a, b; cin >> a >> b; int ans = 0; ans = max(ans, a * b); ans = max(ans, a + b); ans = max(ans, a - b); cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int a, b; cin >> a >> b; int ans = -100000; ans = max(ans, a * b); ans = max(ans, a + b); ans = max(ans, a - b); cout << ans << endl; }
[ "literal.number.change", "variable_declaration.value.change" ]
743,335
743,336
u924451152
cpp
p02945
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, d; cin >> a >> b; int sum, minus, multi; sum = a + b; minus = a - b; multi = a * b; c = max(sum, minus); d = max(sum, multi); cout << d << endl; }
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int a, b, c, d, e; cin >> a >> b; int sum, minus, multi; sum = a + b; minus = a - b; multi = a * b; c = max(sum, minus); d = max(c, multi); cout << d << endl; }
[ "variable_declaration.add", "assignment.value.change", "identifier.change", "call.arguments.change" ]
743,337
743,338
u634965946
cpp
p02945
#include <stdio.h> int main() { int M = 0; int A, B; scanf("%d%d", &A, &B); if (A + B >= M) M = A + B; if (A * B > M) M = A * B; if (A - B > M) M = A - B; printf("%d", M); return 0; }
#include <stdio.h> int main() { int M = -1000; int A, B; scanf("%d%d", &A, &B); if (A + B > M) M = A + B; if (A * B > M) M = A * B; if (A - B > M) M = A - B; printf("%d", M); return 0; }
[ "literal.number.change", "variable_declaration.value.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
743,349
743,350
u113973663
cpp
p02945
#include <stdio.h> int main() { int M = 0; int A, B; scanf("%d%d", &A, &B); if (A + B > M) M = A + B; if (A * B > M) M = A * B; if (A - B > M) M = A - B; printf("%d", M); return 0; }
#include <stdio.h> int main() { int M = -1000; int A, B; scanf("%d%d", &A, &B); if (A + B > M) M = A + B; if (A * B > M) M = A * B; if (A - B > M) M = A - B; printf("%d", M); return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
743,351
743,350
u113973663
cpp
p02945
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> using namespace std; int main() { int A, B; scanf("%d", &A, &B); int a, b, c; a = A + B; b = A - B; c = A * B; printf("%d", max(max(a, b), c)); return 0; }
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> using namespace std; int main() { int A, B; scanf("%d%d", &A, &B); int a, b, c; a = A + B; b = A - B; c = A * B; printf("%d", max(max(a, b), c)); return 0; }
[ "literal.string.change", "call.arguments.change" ]
743,360
743,361
u103357948
cpp
p02945
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define rrep(i, n) for (int(i) = (n)-1; (i) >= 0; --(i)) // Reversi rep #define nfor(i, a, b) for (int(i) = (a); (i) < (b); ++(i)) // Natural for #define rfor(i, a, b) for (int(i) = (b); (i) >= (a); --(i)) // Reversi for int main() { int a, b, ans; cin >> a >> b; ans = a + b; if (ans < a - b) { ans = a - b; } if (ans < a * b) { ans = a - b; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); ++(i)) #define rrep(i, n) for (int(i) = (n)-1; (i) >= 0; --(i)) // Reversi rep #define nfor(i, a, b) for (int(i) = (a); (i) < (b); ++(i)) // Natural for #define rfor(i, a, b) for (int(i) = (b); (i) >= (a); --(i)) // Reversi for int main() { int a, b, ans; cin >> a >> b; ans = a + b; if (ans < a - b) { ans = a - b; } if (ans < a * b) { ans = a * b; } cout << ans << endl; return 0; }
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
743,395
743,396
u801513186
cpp
p02945
// ABC137A #include <bits/stdc++.h> #include <cfloat> #include <climits> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <stdio.h> #include <string> using namespace std; int main() { int a, b; cin >> a >> b; int ans; ans = max({a + b, a - b}); cout << ans << endl; return 0; }
// ABC137A #include <bits/stdc++.h> #include <cfloat> #include <climits> #include <iomanip> #include <iostream> #include <math.h> #include <numeric> #include <stdio.h> #include <string> using namespace std; int main() { int a, b; cin >> a >> b; int ans; ans = max({a + b, a - b, a * b}); cout << ans << endl; return 0; }
[]
743,410
743,411
u733391043
cpp
p02945
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main(void) { int A, B; cin >> A >> B; int answer = A + B; chmin(answer, A - B); chmin(answer, A * B); cout << answer << endl; return 0; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main(void) { int A, B; cin >> A >> B; int answer = A + B; chmax(answer, A - B); chmax(answer, A * B); cout << answer << endl; return 0; }
[ "identifier.change", "call.function.change" ]
743,427
743,428
u644332191
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int ans = 0; ans = max(ans, A * B); ans = max(ans, A - B); ans = max(ans, A + B); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int ans = -1e9; ans = max(ans, A * B); ans = max(ans, A - B); ans = max(ans, A + B); cout << ans << endl; }
[ "literal.number.change", "variable_declaration.value.change" ]
743,441
743,442
u584139221
cpp
p02945
#include <iostream> using namespace std; int a; int b; int main() { cin >> a >> b; if (a * b > a + b) { cout << a * b << endl; } else if (a - b > a + b) { cout << a + b << endl; } else { cout << a + b << endl; } }
#include <iostream> using namespace std; int a; int b; int main() { cin >> a >> b; if (a * b > a + b) { cout << a * b << endl; } else if (a - b > a + b) { cout << a - b << endl; } else { cout << a + b << endl; } }
[ "misc.opposites", "expression.operator.arithmetic.change", "io.output.change" ]
743,448
743,449
u353748264
cpp
p02945
#include <iostream> using namespace std; int a; int b; int main() { cin >> a >> b; if (a * b > a + b) { cout << a * b << endl; } else if (a - b > a + b) { cout << a + b << endl; } else { cout << a - b << endl; } }
#include <iostream> using namespace std; int a; int b; int main() { cin >> a >> b; if (a * b > a + b) { cout << a * b << endl; } else if (a - b > a + b) { cout << a - b << endl; } else { cout << a + b << endl; } }
[ "misc.opposites", "expression.operator.arithmetic.change", "io.output.change" ]
743,450
743,449
u353748264
cpp
p02945
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int A, B; cin >> A, B; int sum, sa, mul; sum = A + B; sa = A - B; mul = A * B; if (sum >= sa && sum >= mul) cout << sum << endl; else if (sa >= mul && sa >= sum) cout << sa << endl; else cout << mul << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int A, B; cin >> A; cin >> B; int sum, sa, mul; sum = A + B; sa = A - B; mul = A * B; if (sum >= sa && sum >= mul) cout << sum << endl; else if (sa >= mul && sa >= sum) cout << sa << endl; else cout << mul << endl; }
[ "expression.operation.binary.add" ]
743,478
743,479
u108484707
cpp
p02945
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int A, B; cin >> A, B; int sum, sa, mul; sum = A + B; sa = A - B; mul = A * B; if (sum >= sa && sum >= mul) cout << sum << endl; else if (sa >= mul && sa >= mul) cout << sa << endl; else cout << mul << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; int main() { int A, B; cin >> A; cin >> B; int sum, sa, mul; sum = A + B; sa = A - B; mul = A * B; if (sum >= sa && sum >= mul) cout << sum << endl; else if (sa >= mul && sa >= sum) cout << sa << endl; else cout << mul << endl; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
743,480
743,479
u108484707
cpp
p02945
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int a, b; int main() { scanf("%d", &a, &b); int x = a + b, y = a - b, z = a * b; printf("%d\n", max(max(x, y), z)); return 0; }
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int a, b; int main() { scanf("%d%d", &a, &b); int x = a + b, y = a - b, z = a * b; printf("%d\n", max(max(x, y), z)); return 0; }
[ "literal.string.change", "call.arguments.change" ]
743,498
743,499
u635607854
cpp
p02945
#include <bits/stdc++.h> #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define rep(i, a, b) for (i = a; i < b; i++) #define endl "\n" #define ll long long int #define ld long double using namespace std; int main() { IOS; ll a, b; cin >> a >> b; ll p = max(a + b, a - b); p = max(p, a * b); return 0; }
#include <bits/stdc++.h> #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define rep(i, a, b) for (i = a; i < b; i++) #define endl "\n" #define ll long long int #define ld long double using namespace std; int main() { IOS; ll a, b; cin >> a >> b; ll p = max(a + b, a - b); p = max(p, a * b); cout << p; return 0; }
[]
743,515
743,516
u151006366
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f; cin >> a >> b; c = a + b; d = a - b; e = a * b; f = 0; if (c >= d) { f = c; } else { f = d; } if (f >= d) { cout << f << endl; } else { cout << d << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f; cin >> a >> b; c = a + b; d = a - b; e = a * b; f = 0; if (c >= d) { f = c; } else { f = d; } if (f >= e) { cout << f << endl; } else { cout << e << endl; } }
[ "identifier.change", "control_flow.branch.if.condition.change", "io.output.change" ]
743,527
743,528
u799521877
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b, m; cin >> a >> b; cout << max(m, max(a + b, a - b)); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, m; cin >> a >> b; cout << max(a * b, max(a + b, a - b)); }
[ "io.output.change" ]
743,591
743,592
u157146539
cpp
p02945
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,fma") using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int a, b; cin >> a >> b; if (a + b > a - b && a + b > a * b) cout << a + b << '\n'; if (a - b > a + b && a - b > a * b) cout << a - b << '\n'; if (a * b > a - b && a * b > a + b) cout << a * b << '\n'; else cout << a + b << '\n'; return 0; }
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,fma") using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int a, b; cin >> a >> b; if (a + b > a - b && a + b > a * b) cout << a + b << '\n'; else if (a - b > a + b && a - b > a * b) cout << a - b << '\n'; else if (a * b > a - b && a * b > a + b) cout << a * b << '\n'; else cout << a + b << '\n'; return 0; }
[ "control_flow.branch.else_if.replace.add", "control_flow.branch.if.replace.remove" ]
743,597
743,598
u709297224
cpp
p02945
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int ans = -100000000; ans = max(a + b, ans); ans = max(a - b, ans); ans = max(a + b, ans); cout << ans; }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int ans = -100000000; ans = max(a + b, ans); ans = max(a - b, ans); ans = max(a * b, ans); cout << ans; }
[ "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
743,609
743,610
u771621892
cpp
p02945
#include <stdio.h> void swap(int *a, int *b) { int c; if (b > a) { c = *a; *a = *b; *b = *a; } } int main(void) { int A, B, C, D, E, F; scanf("%d", &A); scanf("%d", &B); C = A + B; D = A - B; E = A * B; if (D > C) swap(&C, &D); if (E > D) swap(&C, &D); if (C > D) swap(&C, &D); printf("%d", C); return 0; }
#include <stdio.h> void swap(int *a, int *b) { int c; if (b > a) { c = *a; *a = *b; *b = *a; } } int main(void) { int A, B, C, D, E, F; scanf("%d", &A); scanf("%d", &B); C = A + B; D = A - B; E = A * B; if (D > C) swap(&C, &D); if (E > D) swap(&D, &E); if (D > C) swap(&C, &D); printf("%d", C); return 0; }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.remove", "control_flow.branch.if.condition.change" ]
743,611
743,612
u356314857
cpp
p02945
#include <bits/stdc++.h> #define boost \ ios::sync_with_stdio(false); \ cin.tie(nullptr); using namespace std; int main() { boost int a; int b; cin >> a >> b; int p, q, r; p = a + b; q = a - b; r = a * b; int max = -100; if (p > max) max = p; else if (q > max) max = q; else if (r > max) max = r; cout << max; return 0; }
#include <bits/stdc++.h> #define boost \ ios::sync_with_stdio(false); \ cin.tie(nullptr); using namespace std; int main() { boost int a; int b; cin >> a >> b; int p, q, r; p = a + b; q = a - b; r = a * b; int max = -100; if (p > max) max = p; if (q > max) max = q; if (r > max) max = r; cout << max; return 0; }
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
743,650
743,651
u135723726
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (a * b > a + b && a * b > a - b) { cout << a * b; } else if (a + b > a * b && a + b > a - b) { cout << a + b; } else if (a - b > a + b && a - b > a * b) { cout << a - b; } cout << a * b; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; if (a * b > a + b && a * b > a - b) { cout << a * b; } else if (a + b > a * b && a + b > a - b) { cout << a + b; } else if (a - b > a + b && a - b > a * b) { cout << a - b; } else { cout << a + b; } return 0; }
[ "control_flow.branch.else.add", "expression.operator.arithmetic.change", "io.output.change" ]
743,670
743,669
u484351040
cpp
p02945
#include <algorithm> #include <iostream> using namespace std; int main() { int a; int b; cin >> a >> b; int ans = max(a, b); ans = max(ans, a * b); cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a; int b; cin >> a >> b; int ans = max(a + b, a - b); ans = max(ans, a * b); cout << ans << endl; return 0; }
[ "assignment.change" ]
743,674
743,675
u963215078
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; if ((A * B) > (A - B) || (A * B) > (A + B)) { cout << A * B << endl; } if ((A - B) > (A * B) || (A - B) > (A + B)) { cout << A - B << endl; } else cout << A + B << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; if ((A * B) > (A - B) && (A * B) > (A + B)) { cout << A * B << endl; } else if ((A - B) > (A * B) && (A - B) > (A + B)) { cout << A - B << endl; } else cout << A + B << endl; }
[ "misc.opposites", "control_flow.branch.if.condition.change", "control_flow.branch.else_if.replace.add", "control_flow.branch.if.replace.remove" ]
743,679
743,680
u126508424
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; if ((A * B) > (A - B) || (A * B) > (A + B)) { cout << A * B << endl; } else if ((A - B) > (A * B) || (A - B) > (A + B)) { cout << A - B << endl; } else cout << A + B << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; if ((A * B) > (A - B) && (A * B) > (A + B)) { cout << A * B << endl; } else if ((A - B) > (A * B) && (A - B) > (A + B)) { cout << A - B << endl; } else cout << A + B << endl; }
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
743,681
743,680
u126508424
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; if ((A * B) >= (A - B) || (A * B) >= (A + B)) { cout << A * B << endl; } else if ((A - B) >= (A * B) || (A - B) >= (A + B)) { cout << A - B << endl; } else cout << A + B << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; if ((A * B) > (A - B) && (A * B) > (A + B)) { cout << A * B << endl; } else if ((A - B) > (A * B) && (A - B) > (A + B)) { cout << A - B << endl; } else cout << A + B << endl; }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "misc.opposites" ]
743,682
743,680
u126508424
cpp
p02945
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <sstream> #include <vector> using namespace std; int main() { int a, b; cin >> a, b; cout << max(max(a + b, a - b), a * b) << endl; return 0; }
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <sstream> #include <vector> using namespace std; int main() { int a, b; cin >> a >> b; cout << max(max(a + b, a - b), a * b) << endl; return 0; }
[]
743,685
743,686
u556273499
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A, B; int n = max(A + B, A - B); int answer = max(n, A * B); cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int n = max(A + B, A - B); int answer = max(n, A * B); cout << answer << endl; }
[]
743,698
743,699
u564060397
cpp
p02945
#include <iostream> #include <math.h> using namespace std; int main() { int A, B, sumsub, mul; cin >> A >> B; sumsub = (B > 0) ? (A + B) : (A - B); cout << ((mul > sumsub) ? mul : sumsub) << endl; return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { int A, B, sumsub, mul; cin >> A >> B; sumsub = (B > 0) ? (A + B) : (A - B); mul = A * B; cout << ((mul > sumsub) ? mul : sumsub) << endl; return 0; }
[ "assignment.add" ]
743,700
743,701
u205975249
cpp
p02945
// template #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<long long, long long> LP; #define INF 999999999 #define MOD 1000000007 #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++) #define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define ALL(v) v.begin(), v.end() #define SORT(v) sort(ALL(v)) #define UNIQUE(v) \ sort(ALL(v)); \ v.erase(unique(ALL(v)), v.end()); #define SIZE(x) ((ll)(x).size()) #define REVERSE(v) reverse(ALL(v)) // true / false #define BIN_SEARCH(v, a) binary_search(ALL(v), a) // index #define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin()) #define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin()) #define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a)) #define DEL(v, i) v.erase(v.begin() + i) #define INSERT(v, i, a) v.insert(v.begin() + i, a) 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; } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; #define out cout #define in cin template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // template end int main() { ios::sync_with_stdio(false); cin.tie(0); ll A, B; in >> A >> B; // vector<ll> X(N) if (A + B > A - B && A + B > A * B) { out << A + B << endl; } else if (A - B > A * B) { out << A * B << endl; } else { out << A - B << endl; } }
// template #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<long long, long long> LP; #define INF 999999999 #define MOD 1000000007 #define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++) #define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define ALL(v) v.begin(), v.end() #define SORT(v) sort(ALL(v)) #define UNIQUE(v) \ sort(ALL(v)); \ v.erase(unique(ALL(v)), v.end()); #define SIZE(x) ((ll)(x).size()) #define REVERSE(v) reverse(ALL(v)) // true / false #define BIN_SEARCH(v, a) binary_search(ALL(v), a) // index #define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin()) #define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin()) #define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a)) #define DEL(v, i) v.erase(v.begin() + i) #define INSERT(v, i, a) v.insert(v.begin() + i, a) 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; } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; #define out cout #define in cin template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // template end int main() { ios::sync_with_stdio(false); cin.tie(0); ll A, B; in >> A >> B; // vector<ll> X(N) if (A + B > A - B && A + B > A * B) { out << A + B << endl; } else if (A - B > A * B) { out << A - B << endl; } else { out << A * B << endl; } }
[ "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
743,710
743,711
u703877026
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; array<int, 3> p{a + b, a - b, a * b}; cout << *max(p.begin(), p.end()); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; array<int, 3> p{a + b, a - b, a * b}; cout << *max_element(p.begin(), p.end()) << endl; }
[ "identifier.change", "call.function.change", "io.output.change", "io.output.newline.add" ]
743,717
743,718
u918480160
cpp
p02945
#include <iostream> using namespace std; int main() { int a, b; cout << a << b; int max; if (a + b > a - b) max = a + b; else max = a - b; if (max < a * b) max = a * b; cout << max; return 0; }
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int max; if (a + b > a - b) max = a + b; else max = a - b; if (max < a * b) max = a * b; cout << max; return 0; }
[ "expression.operation.binary.change" ]
743,739
743,740
u234973476
cpp
p02945
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, ans; cin >> a >> b; cout << max({a + b, a - b, a * b}) << endl; cout << ans; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, ans; cin >> a >> b; cout << max({a + b, a - b, a * b}) << endl; return 0; }
[]
743,750
743,751
u443975466
cpp
p02945
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int a, b; cin >> a >> b; int ans = max(a + b, a * b); ans = (ans, a - b); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int a, b; cin >> a >> b; int ans = max(a + b, a * b); ans = max(ans, a - b); cout << ans << endl; }
[ "call.add" ]
743,786
743,787
u376859266
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A; int B; cin >> A >> B; int a = A + B; int b = A - B; int c = A * B; cout << max(a, b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A; int B; cin >> A >> B; int a = A + B; int b = A - B; int c = A * B; cout << max(max(a, b), c) << endl; }
[ "call.add", "call.arguments.add" ]
743,796
743,797
u610579155
cpp
p02945
#include <iostream> using namespace std; int main() { // スペース区切りの整数の入力 int a, b; cin >> a >> b; int x = a + b; int y = a - b; int z = a * b; if (x < y) { if (z < x) { cout << z << endl; } else { cout << x << endl; } } else { if (z < y) { cout << z << endl; } else { cout << y << endl; } } return 0; }
#include <iostream> using namespace std; int main() { // スペース区切りの整数の入力 int a, b; cin >> a >> b; int x = a + b; int y = a - b; int z = a * b; if (x < y) { if (z < y) { cout << y << endl; } else { cout << z << endl; } } else { if (z < x) { cout << x << endl; } else { cout << z << endl; } } return 0; }
[ "identifier.change", "control_flow.branch.if.condition.change", "io.output.change" ]
743,800
743,801
u188228787
cpp
p02945
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, s1, s2, s3; cin >> a >> b; s1 = a + b; s2 = a - b; s3 = a * b; cout << max(max(s1, s3), s3); return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, s1, s2, s3; cin >> a >> b; s1 = a + b; s2 = a - b; s3 = a * b; cout << max(max(s1, s2), s3); return 0; }
[ "identifier.change", "io.output.change" ]
743,816
743,817
u818261158
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << max(a + b, a * b); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << max({a + b, a * b, a - b}); }
[ "call.arguments.change" ]
743,829
743,830
u048764593
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int a, b, c; a = A + B; b = A - B; c = A * B; vector<int> vec(3); vec[0] = a; vec[1] = b; vec[2] = c; sort(vec.begin(), vec.end()); cout << vec[0] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int a, b, c; a = A + B; b = A - B; c = A * B; vector<int> vec(3); vec[0] = a; vec[1] = b; vec[2] = c; sort(vec.begin(), vec.end()); cout << vec[2] << endl; }
[ "literal.number.change", "variable_access.subscript.index.change", "io.output.change" ]
743,839
743,840
u942085302
cpp
p02945
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int a, b, c; a = A + B; b = A - B; c = A * B; vector<int> vec; vec[0] = a; vec[1] = b; vec[2] = c; sort(vec.begin(), vec.end()); cout << vec[0] << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; int a, b, c; a = A + B; b = A - B; c = A * B; vector<int> vec(3); vec[0] = a; vec[1] = b; vec[2] = c; sort(vec.begin(), vec.end()); cout << vec[2] << endl; }
[ "call.arguments.add", "literal.number.change", "variable_access.subscript.index.change", "io.output.change" ]
743,841
743,840
u942085302
cpp
p02945
#include <stdio.h> int main() { int a, b; scanf("%d%d", a, b); int c, d, e; c = a + b; d = a - b; e = a * b; if (c >= d && c >= e) { printf("%d", c); } else if (d > c && d >= e) { printf("%d", d); } else { printf("%d", e); } return 0; }
#include <stdio.h> int main() { int a, b; scanf("%d%d", &a, &b); int c, d, e; c = a + b; d = a - b; e = a * b; if (c >= d && c >= e) { printf("%d", c); } else if (d > c && d >= e) { printf("%d", d); } else { printf("%d", e); } return 0; }
[ "expression.operation.unary.reference.add" ]
743,846
743,847
u328838382
cpp
p02945
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef int ll; using namespace __gnu_pbds; using namespace std; #define pb push_back #define mp make_pair #define ff first #define ss second #define len(v) ((int)v.size()) #define all(v) v.begin(), v.end() #define oset \ tree<int, null_type, less<int>, rb_tree_tag, \ tree_order_statistics_node_update> #define orz \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define inp \ freopen("input.txt", "r", stdin); \ freopen("out.txt", "w", stdout); ll mod1 = 1e9 + 7; void io() { ios_base::sync_with_stdio(false); cin.tie(NULL); // cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } int main() { orz; inp; int a, b; cin >> a >> b; cout << max(max(a + b, a - b), a * b); }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef int ll; using namespace __gnu_pbds; using namespace std; #define pb push_back #define mp make_pair #define ff first #define ss second #define len(v) ((int)v.size()) #define all(v) v.begin(), v.end() #define oset \ tree<int, null_type, less<int>, rb_tree_tag, \ tree_order_statistics_node_update> #define orz \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define inp \ freopen("input.txt", "r", stdin); \ freopen("out.txt", "w", stdout); ll mod1 = 1e9 + 7; void io() { ios_base::sync_with_stdio(false); cin.tie(NULL); // cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } int main() { orz; // inp; int a, b; cin >> a >> b; cout << max(max(a + b, a - b), a * b); }
[]
743,868
743,869
u900937596
cpp
p02945
// include #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; // conversion inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // change template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // math template <class T> inline T sqr(T x) { return x * x; } template <class T> inline T nCr(T n, T r) { T num = 1; for (int i = 1; i <= r; ++i) { num *= (n - i + 1) / i; } return num; } template <class T> inline T nPr(T n, T r) { r = n - r; T sum = 1; int i; for (i = n; i >= r + 1; --i) sum *= i; return sum; } template <class T> inline T facctorial(T k) { T sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; } // numeric template <class T> inline T gcd(T a, T b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); } // typedef typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; // container util #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) // repetition #define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i) #define REP(i, n) FOR(i, 0, n) // constant constexpr double EPS = 1e-10; const double PI = acos(-1.0); constexpr LL INF = 1e10; // clear memory #define CLR(a) memset((a), 0, sizeof(a)) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; int main() { int a, b; cin >> a >> b; cout << min({a + b, a - b, a * b}) << endl; }
// include #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; // conversion inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // change template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } // math template <class T> inline T sqr(T x) { return x * x; } template <class T> inline T nCr(T n, T r) { T num = 1; for (int i = 1; i <= r; ++i) { num *= (n - i + 1) / i; } return num; } template <class T> inline T nPr(T n, T r) { r = n - r; T sum = 1; int i; for (i = n; i >= r + 1; --i) sum *= i; return sum; } template <class T> inline T facctorial(T k) { T sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; } // numeric template <class T> inline T gcd(T a, T b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); } // typedef typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; // container util #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) // repetition #define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i) #define REP(i, n) FOR(i, 0, n) // constant constexpr double EPS = 1e-10; const double PI = acos(-1.0); constexpr LL INF = 1e10; // clear memory #define CLR(a) memset((a), 0, sizeof(a)) // debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; int main() { int a, b; cin >> a >> b; cout << max({a + b, a - b, a * b}) << endl; }
[ "misc.opposites", "identifier.change", "call.function.change", "io.output.change" ]
743,872
743,873
u946378574
cpp
p02945
#include <iostream> using namespace std; int main() { int a; int b; cin >> a; cin >> b; if (a * b <= 0) { if (0 < b) { cout << a - b; } else { cout << a + b; } } else { if (a == 1 || b == 1) { cout << a + b; } else { cout << a * b; } } return 0; }
#include <iostream> using namespace std; int main() { int a; int b; cin >> a; cin >> b; if (a * b <= 0) { if (0 < b) { cout << a + b; } else { cout << a - b; } } else { if (a == 1 || b == 1) { cout << a + b; } else { cout << a * b; } } return 0; }
[ "misc.opposites", "expression.operator.arithmetic.change", "io.output.change" ]
743,888
743,889
u175232503
cpp