problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k ⌀ | fixed_code stringlengths 12 526k ⌀ | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M ⌀ | fixed_submission_id int64 2 1.54M ⌀ | user_id stringlengths 10 10 ⌀ | language stringclasses 9
values |
|---|---|---|---|---|---|---|---|
p03131 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll k, a, b;
cin >> k >> a >> b;
//ビスケットを一枚増やす
// A枚を1円に換金
// 1円をB枚に交換
if (a + 1 >= b) {
cout << k + 1 << endl;
return 0;
}
ll n = k - a + 1; //残りn回操作できる
ll ans = 0;
if (n % 2 == 0)
ans += n / 2 * (b - a) + a;
else
ans += n / 2 * (b - a) + 2 * a;
cout << ans << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll k, a, b;
cin >> k >> a >> b;
//ビスケットを一枚増やす
// A枚を1円に換金
// 1円をB枚に交換
if (a + 1 >= b) {
cout << k + 1 << endl;
return 0;
}
ll n = k - a + 1; //残りn回操作できる
ll ans = 0;
if (n % 2 == 0)
ans += n / 2 * (b - a) + a;
else
ans += n / 2 * (b - a) + a + 1;
cout << ans << endl;
}
| [
"expression.operation.binary.remove",
"assignment.change"
] | 932,998 | 932,999 | u862412671 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
int k, a, b;
long int out;
cin >> k >> a >> b;
if (b - a < 2) {
out = k + 1;
} else if (k - 1 < a) {
out = k + 1;
} else if ((k - a + 1) % 2 == 0) {
out = a + ((k - a + 1) / 2) * (b - a);
} else {
out = a + 1 + ((k - a + 1) / 2) * (b - a);
}
cout << out;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long int k, a, b;
long int out;
cin >> k >> a >> b;
if (b - a < 2) {
out = k + 1;
} else if (k - 1 < a) {
out = k + 1;
} else if ((k - a + 1) % 2 == 0) {
out = a + ((k - a + 1) / 2) * (b - a);
} else {
out = a + 1 + ((k - a + 1) / 2) * (b - a);
}
cout << out;
}
| [
"variable_declaration.type.widen.change"
] | 933,003 | 933,004 | u431602218 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define INF ((1 << 30) - 1) // int32_t
#define MOD 1000000007
#define MOD2
#define all(a) (a).begin(), (a).end()
#define mkp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
bool flag = false;
ll ans = 0, sum = 0;
int k, a, b;
cin >> k >> a >> b;
if (b - a > 2) {
k -= a - 1;
ans = a;
ans += (b - a) * max(0, (k / 2));
if (k % 2 == 1)
++ans;
} else {
ans = k + 1;
}
// cout <<fixed<<setprecision(16)<< << endl;
cout << ans << endl;
// if(flag)cout << "Yes" <<endl;
// else cout << "No" <<endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define INF ((1 << 30) - 1) // int32_t
#define MOD 1000000007
#define MOD2
#define all(a) (a).begin(), (a).end()
#define mkp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
bool flag = false;
ll ans = 0, sum = 0;
ll k, a, b;
cin >> k >> a >> b;
if (b - a > 2) {
k -= a - 1;
ans = a;
ans += (b - a) * max(0LL, (k / 2));
if (k % 2 == 1)
++ans;
} else {
ans = k + 1;
}
// cout <<fixed<<setprecision(16)<< << endl;
cout << ans << endl;
// if(flag)cout << "Yes" <<endl;
// else cout << "No" <<endl;
return 0;
}
| [
"variable_declaration.type.change",
"literal.number.type.widen.change"
] | 933,013 | 933,014 | u355424600 | cpp |
p03131 | #include <iostream>
#define ll unsigned long long
using namespace std;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ret = 0;
if (b - a <= 2) {
ret = k + 1;
} else {
ll surplusOperation = k - (a - 1);
if (surplusOperation < 0) {
ret = k + 1;
} else {
if (surplusOperation % 2 == 1) {
ret = 1;
}
ret += (surplusOperation / 2) * (b - a) + a;
}
}
cout << ret << endl;
return 0;
} | #include <iostream>
#define ll long long
using namespace std;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ret = 0;
if (b - a <= 2) {
ret = k + 1;
} else {
ll surplusOperation = k - (a - 1);
if (surplusOperation < 0) {
ret = k + 1;
} else {
if (surplusOperation % 2 == 1) {
ret = 1;
}
ret += (surplusOperation / 2) * (b - a) + a;
}
}
cout << ret << endl;
return 0;
} | [] | 933,018 | 933,019 | u611571299 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (b - a > 2) {
if (a - 1 > k - 2) {
cout << k << endl;
} else {
cout << (k - a + 1) / 2 * (b - a) + a - 1 + (k - a + 1) % 2 + 1 << endl;
}
} else {
cout << k + 1 << endl;
}
} | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (b - a > 2) {
if (a - 1 > k - 2) {
cout << k + 1 << endl;
} else {
cout << (k - a + 1) / 2 * (b - a) + a - 1 + (k - a + 1) % 2 + 1 << endl;
}
} else {
cout << k + 1 << endl;
}
}
| [
"expression.operation.binary.add"
] | 933,050 | 933,051 | u401900157 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#define int long long
#define endre \
getchar(); \
getchar(); \
return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define P pair<int, int>
#define all(v) v.begin(), v.end()
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define vecunique(vec) \
sort(vec.begin(), vec.end()); \
decltype(vec)::iterator result = std::unique(vec.begin(), vec.end()); \
vec.erase(result, vec.end())
using namespace std;
bool prime(int n) {
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
int gcd(int x, int y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int lcm(int x, int y) { return x * y / gcd(x, y); }
int mod_pow(int x, int y, int mod) {
int res = 1;
while (y > 0) {
if (y & 1) {
res = res * x % mod;
}
x = x * x % mod;
y >>= 1;
}
return res;
}
int kai(int x) {
if (x == 0)
return 1;
return (kai(x - 1) * x) % moder;
}
int comb(int x, int y) {
return kai(x) * mod_pow(kai(x - y), moder - 2, moder) % moder *
mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge {
int to, cost;
};
int dx[5] = {0, 1, 0, -1}, dy[5] = {1, 0, -1, 0};
map<int, int> factor(int x) {
map<int, int> res;
for (int i = 2; i * i <= x; i++) {
while (x % i == 0) {
x /= i;
res[i]++;
}
}
if (x != 1)
res[x]++;
return res;
}
/*--------Library Zone!--------*/
signed main() {
int k, a, b;
cin >> k >> a >> b;
if (a >= b)
cout << 1 + k << endl;
else {
if ((k - a) % 2 == 0)
cout << max(a + (k - a) / 2 * (b - a) + 1, 1 + k) << endl;
else
cout << max(a + (k - a) / 2 * (b - a), 1 + k) << endl;
}
endre;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#define int long long
#define endre \
getchar(); \
getchar(); \
return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define P pair<int, int>
#define all(v) v.begin(), v.end()
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define vecunique(vec) \
sort(vec.begin(), vec.end()); \
decltype(vec)::iterator result = std::unique(vec.begin(), vec.end()); \
vec.erase(result, vec.end())
using namespace std;
bool prime(int n) {
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
int gcd(int x, int y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int lcm(int x, int y) { return x * y / gcd(x, y); }
int mod_pow(int x, int y, int mod) {
int res = 1;
while (y > 0) {
if (y & 1) {
res = res * x % mod;
}
x = x * x % mod;
y >>= 1;
}
return res;
}
int kai(int x) {
if (x == 0)
return 1;
return (kai(x - 1) * x) % moder;
}
int comb(int x, int y) {
return kai(x) * mod_pow(kai(x - y), moder - 2, moder) % moder *
mod_pow(kai(y), moder - 2, moder) % moder;
}
struct edge {
int to, cost;
};
int dx[5] = {0, 1, 0, -1}, dy[5] = {1, 0, -1, 0};
map<int, int> factor(int x) {
map<int, int> res;
for (int i = 2; i * i <= x; i++) {
while (x % i == 0) {
x /= i;
res[i]++;
}
}
if (x != 1)
res[x]++;
return res;
}
/*--------Library Zone!--------*/
signed main() {
int k, a, b;
cin >> k >> a >> b;
if (a >= b)
cout << 1 + k << endl;
else {
if ((k - a) % 2 == 0)
cout << max(a + (k - a) / 2 * (b - a) + 1, 1 + k) << endl;
else
cout << max(a + ((k - a) / 2 + 1) * (b - a), 1 + k) << endl;
}
endre;
}
| [
"call.arguments.change"
] | 933,055 | 933,056 | u147049801 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (b <= a + 1)
cout << k + 1 << endl;
else {
int cnt = a;
k -= (a - 1);
cnt = cnt + (b - a) * (k / 2);
k %= 2;
cnt += k;
cout << cnt << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (b <= a + 1)
cout << k + 1 << endl;
else {
ll cnt = a;
k -= (a - 1);
cnt = cnt + (b - a) * (k / 2);
k %= 2;
cnt += k;
cout << cnt << endl;
}
}
| [
"variable_declaration.type.change"
] | 933,061 | 933,062 | u710135612 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
const int mod = 1000000007, MAX = 100003;
int main() {
ll K, A, B;
cin >> K >> A >> B;
if (A + 1 < B) {
K++;
if (K >= A + 2) {
K -= (A + 2);
ll now = B;
now += (B - A) * (K / 2);
K -= (K / 2) * 2;
if (K == 1)
now++;
cout << now << endl;
} else
cout << K + 1 << endl;
} else {
cout << K + 1 << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
const int mod = 1000000007, MAX = 100003;
int main() {
ll K, A, B;
cin >> K >> A >> B;
if (A + 1 < B) {
K++;
if (K >= A + 2) {
K -= (A + 2);
ll now = B;
now += (B - A) * (K / 2);
K -= (K / 2) * 2;
if (K == 1)
now++;
cout << now << endl;
} else
cout << K << endl;
} else {
cout << K + 1 << endl;
}
}
| [
"expression.operation.binary.remove"
] | 933,063 | 933,064 | u133391510 | cpp |
p03131 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, n) for (int i = 1; i <= n; i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF = (long long)1E17;
#define i_7 (long long)(1E9 + 7)
long mod(long a) {
long long c = a % i_7;
if (c >= 0)
return c;
return c + i_7;
}
using namespace std;
bool prime(int n) {
if (n == 1) {
return false;
} else if (n == 2) {
return true;
} else {
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b) {
if (a < b) {
swap(a, b);
}
if (a % b == 0) {
return b;
} else {
return gcd(b, a % b);
}
}
long long lcm(long long x, long long y) { return (x / gcd(x, y)) * y; }
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //先祖をrootで取っておきたい。
}
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans;
if (b <= a) {
cout << k + 1 << endl;
} else if (a + 1 > k) {
cout << k + 1 << endl;
} else {
if ((k - a - 1) % 2 == 0) {
ans = b + (b - a) * ((k - a - 1) / 2);
} else {
ans = b + (b - a) * ((k - a - 1) / 2) + 1;
}
cout << ans << endl;
}
return 0;
}
| #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, n) for (int i = 1; i <= n; i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF = (long long)1E17;
#define i_7 (long long)(1E9 + 7)
long mod(long a) {
long long c = a % i_7;
if (c >= 0)
return c;
return c + i_7;
}
using namespace std;
bool prime(int n) {
if (n == 1) {
return false;
} else if (n == 2) {
return true;
} else {
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b) {
if (a < b) {
swap(a, b);
}
if (a % b == 0) {
return b;
} else {
return gcd(b, a % b);
}
}
long long lcm(long long x, long long y) { return (x / gcd(x, y)) * y; }
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //先祖をrootで取っておきたい。
}
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans;
if (b <= a + 1) {
cout << k + 1 << endl;
} else if (a + 1 > k) {
cout << k + 1 << endl;
} else {
if ((k - a - 1) % 2 == 0) {
ans = b + (b - a) * ((k - a - 1) / 2);
} else {
ans = b + (b - a) * ((k - a - 1) / 2) + 1;
}
cout << ans << endl;
}
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 933,065 | 933,066 | u222293734 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll A, B, K;
cin >> A >> B >> K;
if ((B - A) <= 2) {
cout << K + 1 << endl;
return 0;
} else {
if (K <= (A - 1)) {
cout << K + 1 << endl;
return 0;
} else {
ll U = K - (A - 1);
ll biscket = A;
for (ll i = 0; i < U / 2; i++) {
biscket += (B - A);
}
if (U % 2 == 0) {
cout << biscket << endl;
return 0;
} else {
cout << biscket + 1 << endl;
return 0;
}
}
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll A, B, K;
cin >> K >> A >> B;
if ((B - A) <= 2) {
cout << K + 1 << endl;
return 0;
} else {
if (K <= (A - 1)) {
cout << K + 1 << endl;
return 0;
} else {
ll U = K - (A - 1);
ll biscket = A;
for (ll i = 0; i < U / 2; i++) {
biscket += (B - A);
}
if (U % 2 == 0) {
cout << biscket << endl;
return 0;
} else {
cout << biscket + 1 << endl;
return 0;
}
}
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 933,070 | 933,071 | u904123392 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define vl vector<long long>
long long INF = 1e10;
#define pii pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
/******************************define**********************************/
/*****************************functions********************************/
/****************************main function*****************************/
int main(void) {
int k, a, b;
cin >> k >> a >> b;
if (b - a <= 2) {
cout << k + 1 << endl;
return 0;
}
k -= a - 1;
if (k % 2 == 0) {
cout << a + (b - a) * k / 2 << endl;
} else {
cout << a + 1 + (b - a) * (k - 1) / 2 << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define vl vector<long long>
long long INF = 1e10;
#define pii pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
/******************************define**********************************/
/*****************************functions********************************/
/****************************main function*****************************/
int main(void) {
long long k, a, b;
cin >> k >> a >> b;
if (b - a <= 2) {
cout << k + 1 << endl;
return 0;
}
k -= a - 1;
if (k % 2 == 0) {
cout << a + (b - a) * k / 2 << endl;
} else {
cout << a + 1 + (b - a) * (k - 1) / 2 << endl;
}
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 933,076 | 933,077 | u426397594 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int ans = 0;
if (b - a < 2 || n + 1 - 2 < a)
ans = n + 1;
else {
int m = n - (a - 1);
ans = a + (b - a) * (m / 2) + m % 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n, a, b;
cin >> n >> a >> b;
int ans = 0;
if (b - a <= 2 || n + 1 - 2 < a)
ans = n + 1;
else {
int m = n - (a - 1);
ans = a + (b - a) * (m / 2) + m % 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.widen.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 933,080 | 933,081 | u731175398 | cpp |
p03131 | #include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i < n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define pb(a) push_back(a)
ll k, a, b;
int main() {
ll ans = 0;
cin >> k >> a >> b;
if (b - a > 2) {
ll t = b - a; // 2回で増やせるビスケット数
ll x = k - a + 1;
if (x <= 0) {
ans = a + 1;
cout << ans << endl;
return 0;
}
ans = a + (x / 2) * t;
if (x % 2 == 1)
ans++;
cout << ans << endl;
return 0;
} else {
ans = a + 1;
cout << ans << endl;
return 0;
}
return 0;
} | #include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i < n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define pb(a) push_back(a)
ll k, a, b;
int main() {
ll ans = 0;
cin >> k >> a >> b;
if (b - a > 2) {
ll t = b - a; // 2回で増やせるビスケット数
ll x = k - a + 1;
if (x <= 0) {
ans = k + 1;
cout << ans << endl;
return 0;
}
ans = a + (x / 2) * t;
if (x % 2 == 1)
ans++;
cout << ans << endl;
return 0;
} else {
ans = k + 1;
cout << ans << endl;
return 0;
}
return 0;
} | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 933,082 | 933,083 | u837951457 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
template <Z A> void pr(A a) {
cout << a;
ln;
}
template <Z A, Z B> void pr(A a, B b) {
cout << a << ' ';
pr(b);
}
template <Z A, Z B, Z C> void pr(A a, B b, C c) {
cout << a << ' ';
pr(b, c);
}
template <Z A, Z B, Z C, Z D> void pr(A a, B b, C c, D d) {
cout << a << ' ';
pr(b, c, d);
}
template <Z A> void PR(A a, ll n) {
rep(i, n) {
if (i)
cout << ' ';
cout << a[i];
}
ln;
}
ll check(ll n, ll m, ll x, ll y) { return x >= 0 && x < n && y >= 0 && y < m; }
const ll MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
dy[4] = {0, 1, 0, -1};
typedef pair<ll, ll> P;
ll solve(ll n, ll x, ll y, ll m) {
ll ans = 1;
ans -= m * x;
ans += m * y;
n -= m * 2;
if (!m || x - 1 <= n)
return ans + n;
return 0;
}
void Main() {
ll n, x, y;
cin >> n >> x >> y;
ll l = 0, r = n + 1;
rep(t, 500) {
ll m1 = (l * 2 + r) / 3, m2 = (l + r * 2) / 3;
ll d1 = solve(n, x, y, m1), d2 = solve(n, x, y, m2);
if (d1 < d2)
l = m1;
else
r = m2;
}
ll ans = 0;
REP(i, -5, 5) {
ll m = l + i;
if (m < 0)
continue;
ans = max(ans, solve(n, x, y, m));
}
pr(ans);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
template <Z A> void pr(A a) {
cout << a;
ln;
}
template <Z A, Z B> void pr(A a, B b) {
cout << a << ' ';
pr(b);
}
template <Z A, Z B, Z C> void pr(A a, B b, C c) {
cout << a << ' ';
pr(b, c);
}
template <Z A, Z B, Z C, Z D> void pr(A a, B b, C c, D d) {
cout << a << ' ';
pr(b, c, d);
}
template <Z A> void PR(A a, ll n) {
rep(i, n) {
if (i)
cout << ' ';
cout << a[i];
}
ln;
}
ll check(ll n, ll m, ll x, ll y) { return x >= 0 && x < n && y >= 0 && y < m; }
const ll MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
dy[4] = {0, 1, 0, -1};
typedef pair<ll, ll> P;
ll solve(ll n, ll x, ll y, ll m) {
ll ans = 1;
ans -= m * x;
ans += m * y;
n -= m * 2;
if (x - 1 <= n)
return ans + n;
return 0;
}
void Main() {
ll n, x, y;
cin >> n >> x >> y;
ll l = 0, r = n + 1;
rep(t, 500) {
ll m1 = (l * 2 + r) / 3, m2 = (l + r * 2) / 3;
ll d1 = solve(n, x, y, m1), d2 = solve(n, x, y, m2);
if (d1 < d2)
l = m1;
else
r = m2;
}
ll ans = 1 + n;
REP(i, -5, 5) {
ll m = l + i;
if (m < 0)
continue;
ans = max(ans, solve(n, x, y, m));
}
pr(ans);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
Main();
return 0;
}
| [
"expression.operation.binary.remove",
"literal.number.change"
] | 933,090 | 933,091 | u287015418 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
template <Z A> void pr(A a) {
cout << a;
ln;
}
template <Z A, Z B> void pr(A a, B b) {
cout << a << ' ';
pr(b);
}
template <Z A, Z B, Z C> void pr(A a, B b, C c) {
cout << a << ' ';
pr(b, c);
}
template <Z A, Z B, Z C, Z D> void pr(A a, B b, C c, D d) {
cout << a << ' ';
pr(b, c, d);
}
template <Z A> void PR(A a, ll n) {
rep(i, n) {
if (i)
cout << ' ';
cout << a[i];
}
ln;
}
ll check(ll n, ll m, ll x, ll y) { return x >= 0 && x < n && y >= 0 && y < m; }
const ll MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
dy[4] = {0, 1, 0, -1};
typedef pair<ll, ll> P;
ll solve(ll n, ll x, ll y, ll m) {
ll ans = 1;
ans -= m * x;
ans += m * y;
n -= m * 2;
if (x - 1 <= n)
return ans + n;
return 0;
}
void Main() {
ll n, x, y;
cin >> n >> x >> y;
ll l = 0, r = n + 1;
rep(t, 500) {
ll m1 = (l * 2 + r) / 3, m2 = (l + r * 2) / 3;
ll d1 = solve(n, x, y, m1), d2 = solve(n, x, y, m2);
if (d1 < d2)
l = m1;
else
r = m2;
}
ll ans = 1;
REP(i, -5, 5) {
ll m = l + i;
if (m < 0)
continue;
ans = max(ans, solve(n, x, y, m));
}
pr(ans);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
template <Z A> void pr(A a) {
cout << a;
ln;
}
template <Z A, Z B> void pr(A a, B b) {
cout << a << ' ';
pr(b);
}
template <Z A, Z B, Z C> void pr(A a, B b, C c) {
cout << a << ' ';
pr(b, c);
}
template <Z A, Z B, Z C, Z D> void pr(A a, B b, C c, D d) {
cout << a << ' ';
pr(b, c, d);
}
template <Z A> void PR(A a, ll n) {
rep(i, n) {
if (i)
cout << ' ';
cout << a[i];
}
ln;
}
ll check(ll n, ll m, ll x, ll y) { return x >= 0 && x < n && y >= 0 && y < m; }
const ll MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
dy[4] = {0, 1, 0, -1};
typedef pair<ll, ll> P;
ll solve(ll n, ll x, ll y, ll m) {
ll ans = 1;
ans -= m * x;
ans += m * y;
n -= m * 2;
if (x - 1 <= n)
return ans + n;
return 0;
}
void Main() {
ll n, x, y;
cin >> n >> x >> y;
ll l = 0, r = n + 1;
rep(t, 500) {
ll m1 = (l * 2 + r) / 3, m2 = (l + r * 2) / 3;
ll d1 = solve(n, x, y, m1), d2 = solve(n, x, y, m2);
if (d1 < d2)
l = m1;
else
r = m2;
}
ll ans = 1 + n;
REP(i, -5, 5) {
ll m = l + i;
if (m < 0)
continue;
ans = max(ans, solve(n, x, y, m));
}
pr(ans);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
Main();
return 0;
}
| [
"assignment.change"
] | 933,092 | 933,091 | u287015418 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
template <Z A> void pr(A a) {
cout << a;
ln;
}
template <Z A, Z B> void pr(A a, B b) {
cout << a << ' ';
pr(b);
}
template <Z A, Z B, Z C> void pr(A a, B b, C c) {
cout << a << ' ';
pr(b, c);
}
template <Z A, Z B, Z C, Z D> void pr(A a, B b, C c, D d) {
cout << a << ' ';
pr(b, c, d);
}
template <Z A> void PR(A a, ll n) {
rep(i, n) {
if (i)
cout << ' ';
cout << a[i];
}
ln;
}
ll check(ll n, ll m, ll x, ll y) { return x >= 0 && x < n && y >= 0 && y < m; }
const ll MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
dy[4] = {0, 1, 0, -1};
typedef pair<ll, ll> P;
ll solve(ll n, ll x, ll y, ll m) {
ll ans = 1;
ans -= m * x;
ans += m * y;
n -= m * 2;
if (x - 1 <= n)
return ans + n;
return 0;
}
void Main() {
ll n, x, y;
cin >> n >> x >> y;
ll l = 0, r = n + 1;
rep(t, 200) {
ll m1 = (l * 2 + r) / 3, m2 = (l + r * 2) / 3;
ll d1 = solve(n, x, y, m1), d2 = solve(n, x, y, m2);
if (d1 < d2)
l = m1;
else
r = m2;
}
ll ans = 0;
REP(i, -5, 5) {
ll m = l + i;
if (m < 0)
continue;
ans = max(ans, solve(n, x, y, m));
}
pr(ans);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin >>
#define Z class
#define ll long long
#define ln cout << '\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n", a)
#define mem(a) memset(a, 0, sizeof(a))
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define tr(it, c) for (iter(c) it = (c).begin(); it != (c).end(); it++)
template <Z A> void pr(A a) {
cout << a;
ln;
}
template <Z A, Z B> void pr(A a, B b) {
cout << a << ' ';
pr(b);
}
template <Z A, Z B, Z C> void pr(A a, B b, C c) {
cout << a << ' ';
pr(b, c);
}
template <Z A, Z B, Z C, Z D> void pr(A a, B b, C c, D d) {
cout << a << ' ';
pr(b, c, d);
}
template <Z A> void PR(A a, ll n) {
rep(i, n) {
if (i)
cout << ' ';
cout << a[i];
}
ln;
}
ll check(ll n, ll m, ll x, ll y) { return x >= 0 && x < n && y >= 0 && y < m; }
const ll MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
dy[4] = {0, 1, 0, -1};
typedef pair<ll, ll> P;
ll solve(ll n, ll x, ll y, ll m) {
ll ans = 1;
ans -= m * x;
ans += m * y;
n -= m * 2;
if (x - 1 <= n)
return ans + n;
return 0;
}
void Main() {
ll n, x, y;
cin >> n >> x >> y;
ll l = 0, r = n + 1;
rep(t, 500) {
ll m1 = (l * 2 + r) / 3, m2 = (l + r * 2) / 3;
ll d1 = solve(n, x, y, m1), d2 = solve(n, x, y, m2);
if (d1 < d2)
l = m1;
else
r = m2;
}
ll ans = 1 + n;
REP(i, -5, 5) {
ll m = l + i;
if (m < 0)
continue;
ans = max(ans, solve(n, x, y, m));
}
pr(ans);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
Main();
return 0;
}
| [
"literal.number.change",
"call.arguments.change"
] | 933,093 | 933,091 | u287015418 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define MOD 1000000007
typedef long long ll;
using namespace std;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
if (k <= a || b <= a) {
cout << ans << endl;
return 0;
}
ll cnt = a;
ll times = a - 1;
times += 2;
cnt = b;
if ((k - times) % 2) {
cnt = cnt + (b - a) * (k - times) / 2 + 1;
} else {
cnt = cnt + (b - a) * (k - times) / 2;
}
ans = max(ans, cnt);
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define MOD 1000000007
typedef long long ll;
using namespace std;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
if (k <= a || b <= a) {
cout << ans << endl;
return 0;
}
ll cnt = a;
ll times = a - 1;
times += 2;
cnt = b;
if ((k - times) % 2) {
cnt = cnt + (b - a) * ((k - times) / 2) + 1;
} else {
cnt = cnt + (b - a) * ((k - times) / 2);
}
ans = max(ans, cnt);
cout << ans << endl;
return 0;
}
| [] | 933,094 | 933,095 | u646339490 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iomanip> // << fixed << precision(10)
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) \
for_each(begin(A), end(A), [&](T i) { cout << i << " "; }); \
cout << "\n"
#define MOD 1000000007
typedef long long lint;
typedef pair<lint, lint> P;
bool lessPair(const P &l, const P &r) { return l.second < r.second; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
lint K;
cin >> K;
lint A;
cin >> A;
lint B;
cin >> B;
if (B - A <= 2) {
PRINT(1 + K);
return 0;
}
if (K <= A) {
PRINT(1 + K);
}
K = K - (A - 1);
lint res = 0;
if (K % 2 == 1) {
res = A + (B - A) * (K / 2);
res += 1;
} else {
res = A + (B - A) * (K / 2);
}
cout << res << "\n";
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iomanip> // << fixed << precision(10)
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, s, t) for (int i = s; i < t; i++)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) \
for_each(begin(A), end(A), [&](T i) { cout << i << " "; }); \
cout << "\n"
#define MOD 1000000007
typedef long lint;
typedef pair<lint, lint> P;
bool lessPair(const P &l, const P &r) { return l.second < r.second; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
lint K;
cin >> K;
lint A;
cin >> A;
lint B;
cin >> B;
if (B - A <= 2) {
PRINT(1 + K);
return 0;
}
if (K <= A) {
PRINT(1 + K);
return 0;
}
K = K - (A - 1);
lint res = 0;
if (K % 2 == 1) {
res = A + (B - A) * (K / 2);
res += 1;
} else {
res = A + (B - A) * (K / 2);
}
cout << res << "\n";
return 0;
}
| [
"variable_declaration.type.narrow.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 933,096 | 933,097 | u291278680 | cpp |
p03131 | #include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ans = 1;
if (A + 2 < B) {
ans += min(K, A - 1);
if (K > A) {
ans += (K - A + 1) / 2 * (B - A);
ans += (K - A + 1) % 2;
}
} else {
ans += K;
}
cout << ans << endl;
} | #include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ans = 1;
if (A + 2 < B) {
ans += min(K, A - 1);
if (K > A - 1) {
ans += (K - A + 1) / 2 * (B - A);
ans += (K - A + 1) % 2;
}
} else {
ans += K;
}
cout << ans << endl;
} | [
"control_flow.branch.if.condition.change"
] | 933,098 | 933,099 | u658993896 | cpp |
p03131 | #include <bits/stdc++.h>
#define r(i, n) for (int i = 0; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
#define fi first
#define se second
int c[5];
signed main() {
int k, a, b, p = 0, ans = 0;
cin >> k >> a >> b;
if (b - a > 1) {
if (a >= k)
cout << k << endl;
else {
p = k - a + 1;
if (p % 2)
p--, ans++;
if (p >= 2)
ans += a;
// cout<<p<<endl;
cout << (b - a) * p / 2 + ans << endl;
}
} else
cout << k + 1 << endl;
} | #include <bits/stdc++.h>
#define r(i, n) for (int i = 0; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
#define fi first
#define se second
int c[5];
signed main() {
int k, a, b, p = 0, ans = 0;
cin >> k >> a >> b;
if (b - a > 1) {
if (a >= k)
cout << k + 1 << endl;
else {
p = k - a + 1;
if (p % 2)
p--, ans++;
if (p >= 2)
ans += a;
// cout<<p<<endl;
cout << (b - a) * p / 2 + ans << endl;
}
} else
cout << k + 1 << endl;
} | [
"expression.operation.binary.add"
] | 933,102 | 933,103 | u777468981 | cpp |
p03131 | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v = (i)
#define FORE(i, c) for (VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(), (v).end()
#define PII pair<int, int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>
#define debug(x) \
{ cout << #x << " = " << x << endl; }
#define debug2(x, y) \
{ cerr << #x << " = " << x << ", " << #y << " = " << y << endl; }
#define debug3(x, y, z) \
{ \
cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z \
<< " = " << z << endl; \
}
#define debugv(x) \
{ \
{ \
cout << #x << " = "; \
FORE(itt, (x)) cerr << *itt << ", "; \
cerr << endl; \
} \
}
#define debugt(t, n) \
{ \
{ \
cerr << #t << " = "; \
FOR(it, 0, (n)) cerr << t[it] << ", "; \
cerr << endl; \
} \
}
#define make(x) \
int(x); \
scanf("%d", &(x));
#define make2(x, y) \
int(x), (y); \
scanf("%d%d", &(x), &(y));
#define make3(x, y, z) \
int(x), (y), (z); \
scanf("%d%d%d", &(x), &(y), &(z));
#define make4(x, y, z, t) \
int(x), (y), (z), (t); \
scanf("%d%d%d%d", &(x), &(y), &(z), &(t));
#define makev(v, n) \
VI(v); \
FOR(i, 0, (n)) { \
make(a); \
(v).pb(a); \
}
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue
#define read(x) scanf("%d", &(x));
#define read2(x, y) scanf("%d%d", &(x), &(y));
#define read3(x, y, z) scanf("%d%d%d", &(x), &(y), &(z));
#define read4(x, y, z, t) scanf("%d%d%d%d", &(x), &(y), &(z), &(t));
#define readv(v, n) \
FOR(i, 0, (n)) { \
make(a); \
(v).pb(a); \
}
#define jeb() fflush(stdout);
using namespace std;
const int max_n = 1e6 + 5;
int deg[25];
int main() {
make3(k, a, b);
if (b <= a + 2 || k <= a) {
printf("%d\n", k);
} else {
k -= a;
lint mam = a;
int dupa = k / 2;
int kupa = k % 2;
mam += kupa;
mam += (dupa * 1LL * (b - a));
printf("%lld\n", mam);
}
}
| #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v = (i)
#define FORE(i, c) for (VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(), (v).end()
#define PII pair<int, int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>
#define debug(x) \
{ cout << #x << " = " << x << endl; }
#define debug2(x, y) \
{ cerr << #x << " = " << x << ", " << #y << " = " << y << endl; }
#define debug3(x, y, z) \
{ \
cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z \
<< " = " << z << endl; \
}
#define debugv(x) \
{ \
{ \
cout << #x << " = "; \
FORE(itt, (x)) cerr << *itt << ", "; \
cerr << endl; \
} \
}
#define debugt(t, n) \
{ \
{ \
cerr << #t << " = "; \
FOR(it, 0, (n)) cerr << t[it] << ", "; \
cerr << endl; \
} \
}
#define make(x) \
int(x); \
scanf("%d", &(x));
#define make2(x, y) \
int(x), (y); \
scanf("%d%d", &(x), &(y));
#define make3(x, y, z) \
int(x), (y), (z); \
scanf("%d%d%d", &(x), &(y), &(z));
#define make4(x, y, z, t) \
int(x), (y), (z), (t); \
scanf("%d%d%d%d", &(x), &(y), &(z), &(t));
#define makev(v, n) \
VI(v); \
FOR(i, 0, (n)) { \
make(a); \
(v).pb(a); \
}
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue
#define read(x) scanf("%d", &(x));
#define read2(x, y) scanf("%d%d", &(x), &(y));
#define read3(x, y, z) scanf("%d%d%d", &(x), &(y), &(z));
#define read4(x, y, z, t) scanf("%d%d%d%d", &(x), &(y), &(z), &(t));
#define readv(v, n) \
FOR(i, 0, (n)) { \
make(a); \
(v).pb(a); \
}
#define jeb() fflush(stdout);
using namespace std;
const int max_n = 1e6 + 5;
int deg[25];
int main() {
make3(k, a, b);
if (b <= a + 2 || k <= a - 1) {
printf("%d\n", k + 1);
} else {
k -= a - 1;
lint mam = a;
int dupa = k / 2;
int kupa = k % 2;
mam += kupa;
mam += (dupa * 1LL * (b - a));
printf("%lld\n", mam);
}
}
| [
"control_flow.branch.if.condition.change",
"assignment.change"
] | 933,106 | 933,107 | u684583379 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repp(i, s, e) for (int i = (s); i < (e); i++)
#define all(x) x.begin(), x.end()
#define endl "\n"
void use_cio() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
return os << "(" << P.first << "," << P.second << ")";
}
template <class T> ostream &operator<<(ostream &os, vector<T> V) {
os << "[";
for (auto x : V)
os << x << ", ";
return os << "]";
}
//--------------------------------------------------//
ll k, a, b;
int main() {
use_cio();
cin >> k >> a >> b;
if (b + 2 <= a)
return !(cout << k + 1 << endl);
else {
if (k + 1 <= a)
cout << k + 1 << endl;
else {
k -= a - 1;
cout << a + (b - a) * (k / 2) + (k % 2) << endl;
}
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repp(i, s, e) for (int i = (s); i < (e); i++)
#define all(x) x.begin(), x.end()
#define endl "\n"
void use_cio() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
return os << "(" << P.first << "," << P.second << ")";
}
template <class T> ostream &operator<<(ostream &os, vector<T> V) {
os << "[";
for (auto x : V)
os << x << ", ";
return os << "]";
}
//--------------------------------------------------//
ll k, a, b;
int main() {
use_cio();
cin >> k >> a >> b;
if (b <= a + 2)
return !(cout << k + 1 << endl);
else {
if (k + 1 <= a)
cout << k + 1 << endl;
else {
k -= a - 1;
cout << a + (b - a) * (k / 2) + (k % 2) << endl;
}
}
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 933,110 | 933,111 | u847501264 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
template <class T, class U> using P = pair<T, U>;
template <class S, class T, class U> using TUP = tuple<S, T, U>;
using ll = long long;
using ull = unsigned long long;
using dbl = double;
using str = string;
using vll = V<ll>;
using vll2 = VV<ll>;
using vll3 = VVV<ll>;
using pll = P<ll, ll>;
using tll = TUP<ll, ll, ll>;
using vpll = V<pll>;
using tpll = V<tll>;
using vs = V<str>;
using vvs = V<vs>;
using vd = V<dbl>;
using vvd = V<vd>;
using qll = queue<ll>;
using qpll = queue<pll>;
using mapll = map<ll, ll>;
using setll = set<ll>;
#define int ll
#define fst first
#define snd second
#define PQ priority_queue
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define popb pop_back()
#define sz size()
#define bn begin()
#define ed end()
#define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++)
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define REP1(i, n) FOR(i, 1, (n))
#define VFOR(i, v) for (auto &(i) : v)
#define IOTA(a, n) \
vll(a)((n)); \
iota((a).bn, (a).ed, (0));
#define SORT_ASC(a) sort((a).bn, (a).ed)
#define SORT_DESC(a) sort((a).rbegin(), (a).rend())
#define UNIQUE(a) (a).erase(unique((a).bn, (b).ed), (a).ed)
#define PREVP(a) prev_permutation((a).bn, (a).ed)
#define NEXTP(a) next_permutation((a).bn, (a).ed)
#define BINS(a, target) binary_search((a).bn, (a).ed, target)
#define LB(a, target) lower_bound((a).bn, (a).ed, target)
#define FIND(a, target) find((a).bn, (a).ed, target)
#define UB(a, target) upper_bound((a).bn, (a).ed, target)
#define CNT(a, target) count((a).bn, (a).ed, target)
#define SUM(a) accumulate((a).bn, (a).ed, 0)
#define DEBUG(...) \
dal(#__VA_ARGS__); \
dal(__VA_ARGS__)
#define Dig2(a, b) ((a) >> (b)&1)
#define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (dbl)(b))))) % 10)
#define DigN2(a) ((llabs(a) == 0) ? 1 : ((ll)log2((dbl)llabs(a)) + 1))
#define DigN10(a) ((llabs(a) == 0) ? 1 : ((ll)log10((dbl)llabs(a)) + 1))
#define Pow2(a) ((ll)(1) << (a))
#define Pow10(a) ((ll)(pow(10.0, double(a))))
#define LSB(a) ((a) & -(a))
#define llin(n) \
ll n; \
cin >> n;
#define strin(n) \
str n; \
cin >> n;
#define vin(v) \
VFOR(i, v) { cin >> (i); };
#define vllin(v, N) \
vll(v)((N)); \
vin(v);
#define vl4in(v1, v2, N) \
vll(v1)(N), (v2)(N); \
REP(i, N) { cin >> (v1)[i] >> (v2)[i]; };
#define vl6in(v1, v2, v3, N) \
vll(v1)(N), (v2)(N), (v3)(N); \
REP(i, N) { cin >> (v1)[i] >> (v2)[i] >> (v3)[i]; };
#define vsin(v, N) \
vs(v)((N)); \
vin(v);
#define min(...) Min(__VA_ARGS__)
#define max(...) Max(__VA_ARGS__)
#define emin(a, ...) ((a) = Min((a), __VA_ARGS__))
#define emax(a, ...) ((a) = Max((a), __VA_ARGS__))
#define egcd(a, ...) ((a) = gcd((a), __VA_ARGS__))
#define elcm(a, ...) ((a) = lcm((a), __VA_ARGS__))
#define tf(cond, t, f) \
if (cond) { \
echo(t); \
} else { \
echo(f); \
}
#define yn(cond) tf(cond, "yes", "no")
#define Yn(cond) tf(cond, "Yes", "No")
#define YN(cond) tf(cond, "YES", "NO")
static const ll MOD = (ll)1e9 + 7;
static const ll INF = (1LL << 62) - 1; // 4.611E+18
static const dbl PI = acos(-1.0);
void Input(){};
template <class T, class... Args> void Input(T &t, Args &...args) {
cin >> t;
Input(args...);
}
void vInit(ll size) {}
template <class T, class... Args> void vInit(ll size, V<T> &v, Args &...args) {
v.resize(size);
vInit(size, args...);
}
void vInputNum(ll num) {}
template <class T, class... Args>
void vInputNum(ll num, V<T> &v, Args &...args) {
cin >> v[num];
vInputNum(num, args...);
}
void vInput(ll size) {}
template <class... Args> void vInput(ll size, Args &...args) {
vInit(size);
REP(i, size) { vInputNum(i, args...); }
}
template <class S, class T> ostream &operator<<(ostream &o, const P<S, T> &p) {
return o << "(" << p.first << ", " << p.second << ")";
}
template <class T> ostream &operator<<(ostream &o, const V<T> &v) {
if (v.empty()) {
return o << "[]";
} else {
auto itr = v.bn;
o << "[" << *itr;
itr++;
while (itr != v.ed) {
o << ", " << *itr;
itr++;
}
o << "]";
return o;
}
}
template <class T> ostream &operator<<(ostream &o, queue<T> q) {
if (q.empty()) {
return o << "| |";
} else {
while (!q.empty()) {
o << "| " << q.front() << " ";
q.pop();
}
o << "|";
return o;
}
}
template <class S, class T>
ostream &operator<<(ostream &o, const map<S, T> &m) {
if (m.empty()) {
return o << "[]";
} else {
auto itr = m.bn;
o << "{" << itr->first << ": " << itr->second;
itr++;
while (itr != m.ed) {
o << "} {" << itr->first << ": " << itr->second;
itr++;
}
o << "}";
return o;
}
}
template <class T> ostream &operator<<(ostream &o, const set<T> &s) {
if (s.empty()) {
return o << "<>";
} else {
auto itr = s.bn;
o << "<" << *itr;
itr++;
while (itr != s.ed) {
o << ", " << *itr;
itr++;
}
o << ">";
return o;
}
}
void say() {}
template <class T> void say(T t) { cout << t; }
template <class Head, class... Body> void say(Head h, Body... b) {
cout << h;
say(b...);
}
void echo() { cout << "\n"; }
template <class... Args> void echo(Args... args) {
say(args...);
cout << "\n";
}
void dbgsay() {}
template <class T> void dbgsay(T t) { cout << t; }
template <class Head, class... Body> void dbgsay(Head h, Body... b) {
cerr << h << " ";
dbgsay(b...);
}
void dbgecho() { cout << "\n"; }
template <class... Args> void dbgecho(Args... args) {
dbgsay(args...);
cerr << "\n";
}
void echovv() {}
template <class T> void echovv(VV<T> v) {
if (v.empty()) {
echo();
} else {
VFOR(i, v)
echo(v);
}
}
template <class T, class... Args> void echovv(VV<T> v, Args... args) {
echovv(v);
echovv(args...);
}
template <class Head> Head Min(Head head) { return head; }
template <class Head, class... Body> Head Min(Head h, Body... b) {
auto t = Min(b...);
return (h < t) ? h : t;
}
template <class Head> Head Max(Head head) { return head; }
template <class Head, class... Body> Head Max(Head h, Body... b) {
auto t = Max(b...);
return (h > t) ? h : t;
}
ll gcd(ll a, ll b) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
}
return b ? gcd(b, a % b) : a;
}
template <class... Body> ll gcd(ll h, Body... b) { return gcd(h, gcd(b...)); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <class... Body> ll lcm(ll h, Body... b) { return lcm(h, lcm(b...)); }
ll Bset(ll a, ll b, ll c) {
if (c)
a |= b;
else
a &= ~b;
return a;
}
struct UF {
public:
ll tsize;
ll mode;
vll par;
vll rank;
UF(){};
UF(const UF &uf) {}
UF(ll _size, ll _mode = 0) {
tsize = _size;
mode = _mode;
par.assign(tsize, -1);
if (!mode)
rank.resize(tsize, 0);
}
ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
bool isRoot(ll x) { return root(x) == x; }
void unite(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return;
if (mode) {
par[x] += par[y];
par[y] += x;
} else {
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = y;
} else {
par[x] += par[y];
par[y] = x;
if (rank[x] == rank[y])
rank[x]++;
}
}
}
bool same(ll x, ll y) { return root(x) == root(y); }
ll size(ll x) { return -par[root(x)]; }
};
class Vertex {
public:
ll idx;
ll param = -1;
ll dist = INF;
vector<pair<Vertex *, ll> /**/> e;
ll size() { return e.size(); }
bool operator==(const Vertex *o) { return dist == o->dist; }
bool operator!=(const Vertex *o) { return dist != o->dist; }
bool operator>(const Vertex *o) { return dist > o->dist; }
bool operator<(const Vertex *o) { return dist < o->dist; }
bool operator>=(const Vertex *o) { return dist >= o->dist; }
bool operator<=(const Vertex *o) { return dist <= o->dist; }
};
class Graph {
public:
vector<Vertex *> V;
vll order;
typedef tuple<Vertex *, Vertex *, ll> Edge;
vector<Edge> E;
Graph(ll siz) {
REP(i, siz) {
auto v = new Vertex();
v->idx = i;
V.pb(v);
}
}
static bool comp(const Edge &e1, const Edge &e2) {
return get<2>(e1) < get<2>(e2);
}
Vertex *getVertex(ll idx) { return V[idx]; }
void unite(ll from, ll to, ll w = 1, bool digraph = true) {
E.push_back(make_tuple(V[from], V[to], w));
V[from]->e.pb(make_pair(V[to], w));
if (!digraph) {
E.push_back(make_tuple(V[to], V[from], w));
V[to]->e.pb(make_pair(V[from], w));
}
}
void dijkstra(ll start) {
PQ<Vertex *, vector<Vertex *>, greater<Vertex *> /**/> pq;
Vertex *s = getVertex(start);
s->dist = 0;
pq.push(s);
while (!pq.empty()) {
Vertex *v = pq.top();
pq.pop();
for (auto &u : v->e) {
if (u.first->dist > v->dist + u.second) {
u.first->dist = v->dist + u.second;
pq.push(u.first);
}
}
}
}
bool sort() {
for (auto &v : V) {
if (v->param == -1 && !sort_visit(v->idx)) {
return false;
}
}
reverse(order.bn, order.ed);
return true;
}
bool sort_visit(int v) {
Vertex *_v = getVertex(v);
_v->param = 1;
if (!_v->e.empty()) {
for (auto &u : _v->e) {
if (u.first->param == 2)
continue;
if (u.first->param == 1)
return false;
if (!sort_visit(u.first->idx))
return false;
}
}
order.push_back(v);
_v->param = 2;
return true;
}
};
ll isPrime(ll n) {
if (n <= 1)
return 0;
FOR(i, 2, (ll)sqrt(n)) {
if (n % i == 0)
return 0;
}
return 1;
}
ll DigS10(ll n) {
ll m = 0;
REP(i, DigN10(n)) { m += (ll)((llabs(n) % Pow10(i + 1))) / Pow10(i); }
return m;
}
ll PowMod(ll a, ll b) {
ll ans = 1, x = a % MOD;
REP(i, DigN2(b)) {
if (Dig2(b, i) == 1) {
ans = (ans * x) % MOD;
}
if (i != (DigN2(b) - 1)) {
x = (x * x) % MOD;
}
}
return ans;
}
vll FactMod(1, 1);
vll FactModInv(1, 1);
ll Mod(ll n) {
n %= MOD;
n = (n + MOD) % MOD;
return n;
}
ll InvM(ll n) {
n = Mod(n);
n = PowMod(n, MOD - 2);
return n;
}
void CFactMod(ll n) {
if (FactMod.size() <= n) {
FOR(i, FactMod.size(), n) {
FactMod.pb((FactMod[i - 1] * (i % MOD)) % MOD);
}
}
}
void CFactModInv(ll n) {
CFactMod(n);
if (FactModInv.size() < (n + 1)) {
FactModInv.resize(n + 1, -1);
}
if (FactModInv[n] == -1) {
FactModInv[n] = PowMod(FactMod[n], MOD - 2);
}
for (int i = n - 1; i >= 1; i--) {
if (FactModInv[i] != -1)
break;
FactModInv[i] = ((FactModInv[i + 1] * ((i + 1) % MOD)) % MOD);
}
}
ll CombMod(ll n, ll k) {
if (n < 0 || k < 0 || n < k)
return 0;
if (n + 1 > FactModInv.size())
CFactModInv(n);
return ((((FactModInv[k] * FactModInv[n - k]) % MOD) * FactMod[n]) % MOD);
}
pll factor_sub(ll n, ll m) {
ll i = 0;
while (n % m == 0) {
i++;
n /= m;
}
return mp(i, n);
}
vpll factrization(ll n) {
vpll a;
ll c, m;
tie(c, m) = factor_sub(n, 2);
if (c > 0)
a.pb(mp(2, c));
for (ll i = 3; m >= i * i; i += 2) {
tie(c, m) = factor_sub(m, i);
if (c > 0)
a.pb(mp(i, c));
}
if (m > 1)
a.pb(mp(m, 1));
return a;
}
signed main() {
llin(K);
llin(A);
llin(B);
if (K <= A) {
echo(K);
return 0;
}
ll ans;
ll cond = K - A + 1;
if (cond % 2 == 0) {
ll m = max(2, -A + B);
ans = A + m * (cond) / 2;
} else {
ll m = max(2, -A + B);
ans = A + m * (cond - 1) / 2 + 1;
}
echo(ans);
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
template <class T, class U> using P = pair<T, U>;
template <class S, class T, class U> using TUP = tuple<S, T, U>;
using ll = long long;
using ull = unsigned long long;
using dbl = double;
using str = string;
using vll = V<ll>;
using vll2 = VV<ll>;
using vll3 = VVV<ll>;
using pll = P<ll, ll>;
using tll = TUP<ll, ll, ll>;
using vpll = V<pll>;
using tpll = V<tll>;
using vs = V<str>;
using vvs = V<vs>;
using vd = V<dbl>;
using vvd = V<vd>;
using qll = queue<ll>;
using qpll = queue<pll>;
using mapll = map<ll, ll>;
using setll = set<ll>;
#define int ll
#define fst first
#define snd second
#define PQ priority_queue
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define popb pop_back()
#define sz size()
#define bn begin()
#define ed end()
#define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++)
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define REP1(i, n) FOR(i, 1, (n))
#define VFOR(i, v) for (auto &(i) : v)
#define IOTA(a, n) \
vll(a)((n)); \
iota((a).bn, (a).ed, (0));
#define SORT_ASC(a) sort((a).bn, (a).ed)
#define SORT_DESC(a) sort((a).rbegin(), (a).rend())
#define UNIQUE(a) (a).erase(unique((a).bn, (b).ed), (a).ed)
#define PREVP(a) prev_permutation((a).bn, (a).ed)
#define NEXTP(a) next_permutation((a).bn, (a).ed)
#define BINS(a, target) binary_search((a).bn, (a).ed, target)
#define LB(a, target) lower_bound((a).bn, (a).ed, target)
#define FIND(a, target) find((a).bn, (a).ed, target)
#define UB(a, target) upper_bound((a).bn, (a).ed, target)
#define CNT(a, target) count((a).bn, (a).ed, target)
#define SUM(a) accumulate((a).bn, (a).ed, 0)
#define DEBUG(...) \
dal(#__VA_ARGS__); \
dal(__VA_ARGS__)
#define Dig2(a, b) ((a) >> (b)&1)
#define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (dbl)(b))))) % 10)
#define DigN2(a) ((llabs(a) == 0) ? 1 : ((ll)log2((dbl)llabs(a)) + 1))
#define DigN10(a) ((llabs(a) == 0) ? 1 : ((ll)log10((dbl)llabs(a)) + 1))
#define Pow2(a) ((ll)(1) << (a))
#define Pow10(a) ((ll)(pow(10.0, double(a))))
#define LSB(a) ((a) & -(a))
#define llin(n) \
ll n; \
cin >> n;
#define strin(n) \
str n; \
cin >> n;
#define vin(v) \
VFOR(i, v) { cin >> (i); };
#define vllin(v, N) \
vll(v)((N)); \
vin(v);
#define vl4in(v1, v2, N) \
vll(v1)(N), (v2)(N); \
REP(i, N) { cin >> (v1)[i] >> (v2)[i]; };
#define vl6in(v1, v2, v3, N) \
vll(v1)(N), (v2)(N), (v3)(N); \
REP(i, N) { cin >> (v1)[i] >> (v2)[i] >> (v3)[i]; };
#define vsin(v, N) \
vs(v)((N)); \
vin(v);
#define min(...) Min(__VA_ARGS__)
#define max(...) Max(__VA_ARGS__)
#define emin(a, ...) ((a) = Min((a), __VA_ARGS__))
#define emax(a, ...) ((a) = Max((a), __VA_ARGS__))
#define egcd(a, ...) ((a) = gcd((a), __VA_ARGS__))
#define elcm(a, ...) ((a) = lcm((a), __VA_ARGS__))
#define tf(cond, t, f) \
if (cond) { \
echo(t); \
} else { \
echo(f); \
}
#define yn(cond) tf(cond, "yes", "no")
#define Yn(cond) tf(cond, "Yes", "No")
#define YN(cond) tf(cond, "YES", "NO")
static const ll MOD = (ll)1e9 + 7;
static const ll INF = (1LL << 62) - 1; // 4.611E+18
static const dbl PI = acos(-1.0);
void Input(){};
template <class T, class... Args> void Input(T &t, Args &...args) {
cin >> t;
Input(args...);
}
void vInit(ll size) {}
template <class T, class... Args> void vInit(ll size, V<T> &v, Args &...args) {
v.resize(size);
vInit(size, args...);
}
void vInputNum(ll num) {}
template <class T, class... Args>
void vInputNum(ll num, V<T> &v, Args &...args) {
cin >> v[num];
vInputNum(num, args...);
}
void vInput(ll size) {}
template <class... Args> void vInput(ll size, Args &...args) {
vInit(size);
REP(i, size) { vInputNum(i, args...); }
}
template <class S, class T> ostream &operator<<(ostream &o, const P<S, T> &p) {
return o << "(" << p.first << ", " << p.second << ")";
}
template <class T> ostream &operator<<(ostream &o, const V<T> &v) {
if (v.empty()) {
return o << "[]";
} else {
auto itr = v.bn;
o << "[" << *itr;
itr++;
while (itr != v.ed) {
o << ", " << *itr;
itr++;
}
o << "]";
return o;
}
}
template <class T> ostream &operator<<(ostream &o, queue<T> q) {
if (q.empty()) {
return o << "| |";
} else {
while (!q.empty()) {
o << "| " << q.front() << " ";
q.pop();
}
o << "|";
return o;
}
}
template <class S, class T>
ostream &operator<<(ostream &o, const map<S, T> &m) {
if (m.empty()) {
return o << "[]";
} else {
auto itr = m.bn;
o << "{" << itr->first << ": " << itr->second;
itr++;
while (itr != m.ed) {
o << "} {" << itr->first << ": " << itr->second;
itr++;
}
o << "}";
return o;
}
}
template <class T> ostream &operator<<(ostream &o, const set<T> &s) {
if (s.empty()) {
return o << "<>";
} else {
auto itr = s.bn;
o << "<" << *itr;
itr++;
while (itr != s.ed) {
o << ", " << *itr;
itr++;
}
o << ">";
return o;
}
}
void say() {}
template <class T> void say(T t) { cout << t; }
template <class Head, class... Body> void say(Head h, Body... b) {
cout << h;
say(b...);
}
void echo() { cout << "\n"; }
template <class... Args> void echo(Args... args) {
say(args...);
cout << "\n";
}
void dbgsay() {}
template <class T> void dbgsay(T t) { cout << t; }
template <class Head, class... Body> void dbgsay(Head h, Body... b) {
cerr << h << " ";
dbgsay(b...);
}
void dbgecho() { cout << "\n"; }
template <class... Args> void dbgecho(Args... args) {
dbgsay(args...);
cerr << "\n";
}
void echovv() {}
template <class T> void echovv(VV<T> v) {
if (v.empty()) {
echo();
} else {
VFOR(i, v)
echo(v);
}
}
template <class T, class... Args> void echovv(VV<T> v, Args... args) {
echovv(v);
echovv(args...);
}
template <class Head> Head Min(Head head) { return head; }
template <class Head, class... Body> Head Min(Head h, Body... b) {
auto t = Min(b...);
return (h < t) ? h : t;
}
template <class Head> Head Max(Head head) { return head; }
template <class Head, class... Body> Head Max(Head h, Body... b) {
auto t = Max(b...);
return (h > t) ? h : t;
}
ll gcd(ll a, ll b) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
}
return b ? gcd(b, a % b) : a;
}
template <class... Body> ll gcd(ll h, Body... b) { return gcd(h, gcd(b...)); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <class... Body> ll lcm(ll h, Body... b) { return lcm(h, lcm(b...)); }
ll Bset(ll a, ll b, ll c) {
if (c)
a |= b;
else
a &= ~b;
return a;
}
struct UF {
public:
ll tsize;
ll mode;
vll par;
vll rank;
UF(){};
UF(const UF &uf) {}
UF(ll _size, ll _mode = 0) {
tsize = _size;
mode = _mode;
par.assign(tsize, -1);
if (!mode)
rank.resize(tsize, 0);
}
ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
bool isRoot(ll x) { return root(x) == x; }
void unite(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return;
if (mode) {
par[x] += par[y];
par[y] += x;
} else {
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = y;
} else {
par[x] += par[y];
par[y] = x;
if (rank[x] == rank[y])
rank[x]++;
}
}
}
bool same(ll x, ll y) { return root(x) == root(y); }
ll size(ll x) { return -par[root(x)]; }
};
class Vertex {
public:
ll idx;
ll param = -1;
ll dist = INF;
vector<pair<Vertex *, ll> /**/> e;
ll size() { return e.size(); }
bool operator==(const Vertex *o) { return dist == o->dist; }
bool operator!=(const Vertex *o) { return dist != o->dist; }
bool operator>(const Vertex *o) { return dist > o->dist; }
bool operator<(const Vertex *o) { return dist < o->dist; }
bool operator>=(const Vertex *o) { return dist >= o->dist; }
bool operator<=(const Vertex *o) { return dist <= o->dist; }
};
class Graph {
public:
vector<Vertex *> V;
vll order;
typedef tuple<Vertex *, Vertex *, ll> Edge;
vector<Edge> E;
Graph(ll siz) {
REP(i, siz) {
auto v = new Vertex();
v->idx = i;
V.pb(v);
}
}
static bool comp(const Edge &e1, const Edge &e2) {
return get<2>(e1) < get<2>(e2);
}
Vertex *getVertex(ll idx) { return V[idx]; }
void unite(ll from, ll to, ll w = 1, bool digraph = true) {
E.push_back(make_tuple(V[from], V[to], w));
V[from]->e.pb(make_pair(V[to], w));
if (!digraph) {
E.push_back(make_tuple(V[to], V[from], w));
V[to]->e.pb(make_pair(V[from], w));
}
}
void dijkstra(ll start) {
PQ<Vertex *, vector<Vertex *>, greater<Vertex *> /**/> pq;
Vertex *s = getVertex(start);
s->dist = 0;
pq.push(s);
while (!pq.empty()) {
Vertex *v = pq.top();
pq.pop();
for (auto &u : v->e) {
if (u.first->dist > v->dist + u.second) {
u.first->dist = v->dist + u.second;
pq.push(u.first);
}
}
}
}
bool sort() {
for (auto &v : V) {
if (v->param == -1 && !sort_visit(v->idx)) {
return false;
}
}
reverse(order.bn, order.ed);
return true;
}
bool sort_visit(int v) {
Vertex *_v = getVertex(v);
_v->param = 1;
if (!_v->e.empty()) {
for (auto &u : _v->e) {
if (u.first->param == 2)
continue;
if (u.first->param == 1)
return false;
if (!sort_visit(u.first->idx))
return false;
}
}
order.push_back(v);
_v->param = 2;
return true;
}
};
ll isPrime(ll n) {
if (n <= 1)
return 0;
FOR(i, 2, (ll)sqrt(n)) {
if (n % i == 0)
return 0;
}
return 1;
}
ll DigS10(ll n) {
ll m = 0;
REP(i, DigN10(n)) { m += (ll)((llabs(n) % Pow10(i + 1))) / Pow10(i); }
return m;
}
ll PowMod(ll a, ll b) {
ll ans = 1, x = a % MOD;
REP(i, DigN2(b)) {
if (Dig2(b, i) == 1) {
ans = (ans * x) % MOD;
}
if (i != (DigN2(b) - 1)) {
x = (x * x) % MOD;
}
}
return ans;
}
vll FactMod(1, 1);
vll FactModInv(1, 1);
ll Mod(ll n) {
n %= MOD;
n = (n + MOD) % MOD;
return n;
}
ll InvM(ll n) {
n = Mod(n);
n = PowMod(n, MOD - 2);
return n;
}
void CFactMod(ll n) {
if (FactMod.size() <= n) {
FOR(i, FactMod.size(), n) {
FactMod.pb((FactMod[i - 1] * (i % MOD)) % MOD);
}
}
}
void CFactModInv(ll n) {
CFactMod(n);
if (FactModInv.size() < (n + 1)) {
FactModInv.resize(n + 1, -1);
}
if (FactModInv[n] == -1) {
FactModInv[n] = PowMod(FactMod[n], MOD - 2);
}
for (int i = n - 1; i >= 1; i--) {
if (FactModInv[i] != -1)
break;
FactModInv[i] = ((FactModInv[i + 1] * ((i + 1) % MOD)) % MOD);
}
}
ll CombMod(ll n, ll k) {
if (n < 0 || k < 0 || n < k)
return 0;
if (n + 1 > FactModInv.size())
CFactModInv(n);
return ((((FactModInv[k] * FactModInv[n - k]) % MOD) * FactMod[n]) % MOD);
}
pll factor_sub(ll n, ll m) {
ll i = 0;
while (n % m == 0) {
i++;
n /= m;
}
return mp(i, n);
}
vpll factrization(ll n) {
vpll a;
ll c, m;
tie(c, m) = factor_sub(n, 2);
if (c > 0)
a.pb(mp(2, c));
for (ll i = 3; m >= i * i; i += 2) {
tie(c, m) = factor_sub(m, i);
if (c > 0)
a.pb(mp(i, c));
}
if (m > 1)
a.pb(mp(m, 1));
return a;
}
signed main() {
llin(K);
llin(A);
llin(B);
if (K <= A) {
echo(K + 1);
return 0;
}
ll ans;
ll cond = K - A + 1;
if (cond % 2 == 0) {
ll m = max(2, -A + B);
ans = A + m * (cond) / 2;
} else {
ll m = max(2, -A + B);
ans = A + m * (cond - 1) / 2 + 1;
}
echo(ans);
} | [
"expression.operation.binary.add"
] | 933,112 | 933,113 | u127844950 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll result = 1;
if (b - a > 2) {
ll x = (k - (a - 1)) / 2;
result += x * (b - a);
result += k - (x * 2);
} else {
result = k;
}
cout << result << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
using ll = long long int;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll result = 1;
if (b - a > 2) {
ll x = (k - (a - 1)) / 2;
result += x * (b - a);
result += k - (x * 2);
} else {
result += k;
}
cout << result << endl;
}
| [
"assignment.value.change"
] | 933,122 | 933,123 | u432897824 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define pb push_back
#define mp make_pair
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
ll bis = 1;
if (b > a) {
if (a + 1 < k) {
bis = b;
k -= a + 1;
}
if (k % 2)
bis++;
ll z = k / 2;
bis += z * (b - a);
ans = max(ans, bis);
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
ll bis = 1;
if (b > a) {
if (a + 1 <= k) {
bis = b;
k -= a + 1;
if (k % 2)
bis++;
ll z = k / 2;
bis += z * (b - a);
ans = max(ans, bis);
}
}
cout << ans << "\n";
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 933,128 | 933,129 | u335839000 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
ll bis = 1;
if (b > a) {
if (a + 1 < k) {
bis = b;
k -= a + 1;
}
if (k % 2)
bis++;
ll z = k / 2;
bis += z * (b - a);
ans = max(ans, bis);
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
ll bis = 1;
if (b > a) {
if (a + 1 <= k) {
bis = b;
k -= a + 1;
if (k % 2)
bis++;
ll z = k / 2;
bis += z * (b - a);
ans = max(ans, bis);
}
}
cout << ans << "\n";
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 933,130 | 933,129 | u335839000 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
long long k, a, b;
int main() {
cin >> k >> a >> b;
k -= a;
if (a > b)
return cout << b, 0;
long long cnt = (k + 1) / 2;
if (k % 2)
cout << max(cnt * b - (cnt - 1) * a, k + a + 1);
else
cout << max(cnt * b - (cnt - 1) * a, k + a) + 1;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
long long k, a, b;
int main() {
cin >> k >> a >> b;
k -= a;
if (a > b)
return cout << k + a + 1, 0;
long long cnt = (k + 1) / 2;
if (k % 2)
cout << max(cnt * b - (cnt - 1) * a, k + a + 1);
else
cout << max(cnt * b - (cnt - 1) * a, k + a) + 1;
return 0;
}
| [
"identifier.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 933,132 | 933,133 | u218863644 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using cint = cpp_int;
*/
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
const ll inf = 1 << 30;
// const ll INF = LONG_MAX;
const ll INF = 1LL << 60;
const ull MAX = ULONG_MAX;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run(a) __attribute__((constructor)) def _##a()
#define all(v) begin(v), end(v)
#define input(a) scanf("%lld", &(a))
#define print(a) printf("%lld\n", (a))
#define fi first
#define se second
#define ok(a, b) (0 <= (a) && (a) < (b))
template <class T> using vvector = vector<vector<T>>;
template <class T>
using rpriority_queue = priority_queue<T, vector<T>, greater<T>>;
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) \
cerr << "[" << X << "] "; \
cerr << endl; \
}
#define dump(a, h, w) \
{ \
cerr << __LINE__ << ": " << #a << " = [" << endl; \
rep(__i, h) { \
rep(__j, w) cerr << a[__i][__j] << space; \
cerr << endl; \
} \
cerr << "]" << endl; \
}
#define vdump(a, n) \
{ \
cerr << __LINE__ << ": " << #a << " = ["; \
rep(__i, n) if (__i) cerr << space << a[__i]; \
else cerr << a[__i]; \
cerr << "]" << endl; \
}
struct edge {
ll to, cost;
edge(ll a, ll b) : to(a), cost(b) {}
};
struct position {
ll x, y;
position() {}
position(ll a, ll b) : x(a), y(b) {}
position next(ll i) { return {x + dx[i], y + dy[i]}; }
ll mdist() { return abs(x) + abs(y); }
double dist() { return sqrt(x * x + y * y); }
double norm(ll d) {
if (d == inf)
return max(x, y);
if (d == 1)
return mdist();
if (d == 2)
return dist();
return 0;
}
ll num(ll width) { return abs(x) * width + abs(y); }
bool operator==(position a) { return x == a.x && y == a.y; }
bool operator!=(position a) { return x != a.x || y != a.y; }
bool operator<(position a) { return x < a.x && y < a.y; }
bool operator>(position a) { return x > a.x && y > a.y; }
bool operator<=(position a) { return x <= a.x && y <= a.y; }
bool operator>=(position a) { return x >= a.x && y >= a.y; }
position operator+(position a) { return position(x + a.x, y + a.y); }
position operator-(position a) { return position(x - a.x, y - a.y); }
position operator*(position a) { return position(x * a.x, y * a.y); }
position operator/(position a) { return position(x / a.x, y / a.y); }
position operator%(position a) { return position(x % a.x, y % a.y); }
position complex(position a) {
return position(x * a.x - y * a.y, x * a.y + y * a.x);
}
/*
// for sort:
bool operator<(position a) { return x ^ a.x ? x < a.x : y < a.y; }
bool operator>(position a) { return x ^ a.x ? x > a.x : y > a.y; }
bool operator<=(position a) { return x ^ a.x ? x < a.x : y <= a.y; }
bool operator>=(position a) { return x ^ a.x ? x > a.x : y >= a.y; }
*/
};
position Origin = position(0, 0);
using pos = position;
using vec = position;
struct Range {
ll left, right;
Range() {}
Range(ll l, ll r) : left(l), right(r) {}
ll length() { return right - left; }
bool operator==(Range A) { return left == A.left && right == A.right; }
bool operator!=(Range A) { return !(Range(left, right) == A); }
bool operator>(Range A) { return left < A.left && right > A.right; }
bool operator<(Range A) { return left > A.left && right < A.right; }
bool operator>=(Range A) { return left <= A.left && right >= A.right; }
bool operator<=(Range A) { return left >= A.left && right <= A.right; }
};
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i)
#define each(i, a) for (auto &&i : a)
#define loop() for (;;)
// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)
// Speed
run(0) { fasten, fout(10); }
#pragma GCC optimize("O3")
#pragma GCC target("avx")
// Math
//#define gcd __gcd
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }
func sign(ll a) { return a ? abs(a) / a : 0; }
template <class T> def in() {
T A;
cin >> A;
return A;
}
template <class T>
def out(vector<vector<T>> A, ll H, ll W, char divc = space, char endc = endl) {
rep(i, H) {
rep(j, W) {
if (j)
cout << divc << A[i][j];
else
cout << A[i][j];
}
cout << endc;
}
}
signed main() {
ll K, A, B;
cin >> K >> A >> B;
if (A >= B || K <= A) {
cout << K + 1 << endl;
} else {
K -= A + 1;
if (K == -1) {
cout << max(K + A + 2, B) << endl;
} else if (K & 1) {
cout << max(K + A + 2, (K / 2) * (B - A) + B) << endl;
} else {
cout << max(K + A + 2, (K / 2) * (B - A) + B + 1) << endl;
}
}
}
// for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17
| #include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using cint = cpp_int;
*/
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
const ll inf = 1 << 30;
// const ll INF = LONG_MAX;
const ll INF = 1LL << 60;
const ull MAX = ULONG_MAX;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run(a) __attribute__((constructor)) def _##a()
#define all(v) begin(v), end(v)
#define input(a) scanf("%lld", &(a))
#define print(a) printf("%lld\n", (a))
#define fi first
#define se second
#define ok(a, b) (0 <= (a) && (a) < (b))
template <class T> using vvector = vector<vector<T>>;
template <class T>
using rpriority_queue = priority_queue<T, vector<T>, greater<T>>;
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) \
cerr << "[" << X << "] "; \
cerr << endl; \
}
#define dump(a, h, w) \
{ \
cerr << __LINE__ << ": " << #a << " = [" << endl; \
rep(__i, h) { \
rep(__j, w) cerr << a[__i][__j] << space; \
cerr << endl; \
} \
cerr << "]" << endl; \
}
#define vdump(a, n) \
{ \
cerr << __LINE__ << ": " << #a << " = ["; \
rep(__i, n) if (__i) cerr << space << a[__i]; \
else cerr << a[__i]; \
cerr << "]" << endl; \
}
struct edge {
ll to, cost;
edge(ll a, ll b) : to(a), cost(b) {}
};
struct position {
ll x, y;
position() {}
position(ll a, ll b) : x(a), y(b) {}
position next(ll i) { return {x + dx[i], y + dy[i]}; }
ll mdist() { return abs(x) + abs(y); }
double dist() { return sqrt(x * x + y * y); }
double norm(ll d) {
if (d == inf)
return max(x, y);
if (d == 1)
return mdist();
if (d == 2)
return dist();
return 0;
}
ll num(ll width) { return abs(x) * width + abs(y); }
bool operator==(position a) { return x == a.x && y == a.y; }
bool operator!=(position a) { return x != a.x || y != a.y; }
bool operator<(position a) { return x < a.x && y < a.y; }
bool operator>(position a) { return x > a.x && y > a.y; }
bool operator<=(position a) { return x <= a.x && y <= a.y; }
bool operator>=(position a) { return x >= a.x && y >= a.y; }
position operator+(position a) { return position(x + a.x, y + a.y); }
position operator-(position a) { return position(x - a.x, y - a.y); }
position operator*(position a) { return position(x * a.x, y * a.y); }
position operator/(position a) { return position(x / a.x, y / a.y); }
position operator%(position a) { return position(x % a.x, y % a.y); }
position complex(position a) {
return position(x * a.x - y * a.y, x * a.y + y * a.x);
}
/*
// for sort:
bool operator<(position a) { return x ^ a.x ? x < a.x : y < a.y; }
bool operator>(position a) { return x ^ a.x ? x > a.x : y > a.y; }
bool operator<=(position a) { return x ^ a.x ? x < a.x : y <= a.y; }
bool operator>=(position a) { return x ^ a.x ? x > a.x : y >= a.y; }
*/
};
position Origin = position(0, 0);
using pos = position;
using vec = position;
struct Range {
ll left, right;
Range() {}
Range(ll l, ll r) : left(l), right(r) {}
ll length() { return right - left; }
bool operator==(Range A) { return left == A.left && right == A.right; }
bool operator!=(Range A) { return !(Range(left, right) == A); }
bool operator>(Range A) { return left < A.left && right > A.right; }
bool operator<(Range A) { return left > A.left && right < A.right; }
bool operator>=(Range A) { return left <= A.left && right >= A.right; }
bool operator<=(Range A) { return left >= A.left && right <= A.right; }
};
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i)
#define each(i, a) for (auto &&i : a)
#define loop() for (;;)
// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)
// Speed
run(0) { fasten, fout(10); }
#pragma GCC optimize("O3")
#pragma GCC target("avx")
// Math
//#define gcd __gcd
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }
func sign(ll a) { return a ? abs(a) / a : 0; }
template <class T> def in() {
T A;
cin >> A;
return A;
}
template <class T>
def out(vector<vector<T>> A, ll H, ll W, char divc = space, char endc = endl) {
rep(i, H) {
rep(j, W) {
if (j)
cout << divc << A[i][j];
else
cout << A[i][j];
}
cout << endc;
}
}
signed main() {
ll K, A, B;
cin >> K >> A >> B;
if (A >= B || K <= A) {
cout << K + 1 << endl;
} else {
K -= A + 1;
if (K == -1) {
cout << max(K + A + 2, B) << endl;
} else if (K & 1) {
cout << max(K + A + 2, (K / 2) * (B - A) + B + 1) << endl;
} else {
cout << max(K + A + 2, (K / 2) * (B - A) + B) << endl;
}
}
}
// for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17
| [
"expression.operation.binary.remove"
] | 933,134 | 933,135 | u398942100 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
K -= A - 1;
long long S = A;
if (2 < B) {
if (K % 2)
S++;
S += K / 2 * (B - A);
} else {
S += K;
}
cout << S;
return 0;
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
K -= A - 1;
long long S = A;
if (2 < B - A) {
if (K % 2 != 0)
S++;
S += K / 2 * (B - A);
} else {
S += K;
}
cout << S;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 933,140 | 933,141 | u957204897 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
K -= A - 1;
long long S = A;
if (A < B) {
if (K % 2)
S++;
S += K / 2 * (B - A);
} else {
S += K;
}
cout << S;
return 0;
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
K -= A - 1;
long long S = A;
if (2 < B - A) {
if (K % 2 != 0)
S++;
S += K / 2 * (B - A);
} else {
S += K;
}
cout << S;
return 0;
} | [
"identifier.replace.remove",
"literal.replace.add",
"control_flow.branch.if.condition.change"
] | 933,142 | 933,141 | u957204897 | cpp |
p03131 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll K, A, B;
cin >> K >> A >> B;
if (A + 2 <= B) {
K -= A - 1; // A
K--; // 1yen
K--; // B
if (K < 0) {
cout << K + 1 << endl;
exit(0);
}
ll ans = B;
ans += (K / 2) * (B - A) + K % 2;
cout << ans << endl;
} else {
cout << K + 1 << endl;
}
} | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll K, A, B;
cin >> K >> A >> B;
ll KK = K;
if (A + 2 <= B) {
K -= A - 1; // A
K--; // 1yen
K--; // B
if (K < 0) {
cout << KK + 1 << endl;
exit(0);
}
ll ans = B;
ans += (K / 2) * (B - A) + K % 2;
cout << ans << endl;
} else {
cout << K + 1 << endl;
}
} | [
"variable_declaration.add",
"identifier.change",
"io.output.change"
] | 933,149 | 933,150 | u310790595 | cpp |
p03131 | #include <algorithm>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
using namespace std;
int main() {
uint64_t k, a, b;
cin >> k >> a >> b;
if (b - a > 2) {
if (k <= (a - 1)) {
cout << 1 + k << endl;
} else {
k = k - (a - 1);
uint64_t sum = a;
uint64_t kaisu = k / 2;
sum = sum + kaisu * (b - a);
if (k % 2 == 1) {
sum += 1;
}
cout << sum << endl;
}
} else {
cout << 1 + k << endl;
}
return 0;
}
|
#include <algorithm>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
using namespace std;
int main() {
int64_t k, a, b;
cin >> k >> a >> b;
if ((b - a) > 2) {
if (k <= (a - 1)) {
cout << 1 + k << endl;
} else {
k = k - (a - 1);
int64_t sum = a;
int64_t kaisu = k / 2;
sum = sum + kaisu * (b - a);
if (k % 2 == 1) {
sum += 1;
}
cout << sum << endl;
}
} else {
cout << 1 + k << endl;
}
return 0;
}
| [
"variable_declaration.type.primitive.change",
"control_flow.branch.if.condition.change"
] | 933,153 | 933,154 | u279976468 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
typedef pair<ll, ll> P;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 1 >= b) {
cout << k + 1;
return 0;
}
if (k + 1 <= a) {
cout << k + 1;
return 0;
}
ll c = 0;
k -= a - 1;
c += b;
k -= 2;
c += k / 2 * (b - a);
if (k % 2 == 1)
c++;
cout << c;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
typedef pair<ll, ll> P;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 1 >= b) {
cout << k + 1;
return 0;
}
if (k <= a) {
cout << k + 1;
return 0;
}
ll c = 0;
k -= a - 1;
c += b;
k -= 2;
c += k / 2 * (b - a);
if (k % 2 == 1)
c++;
cout << c;
} | [
"expression.operation.binary.remove"
] | 933,163 | 933,164 | u987476436 | cpp |
p03131 | #include <bits/stdc++.h>
#define STIZE(x) fprintf(stderr, "STIZE%d\n", x);
#define PRINT(x) fprintf(stderr, "%s = %d\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#define mid (l + r) / 2
#define endl '\n'
#define all(a) begin(a), end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
lld K, A, B;
cin >> K >> A >> B;
lld rez = K + 1;
lld preostalo = K - A + 1;
if (K >= A - 1) {
if (B >= A)
rez = max(K, preostalo / 2 * (B - A) + preostalo % 2 + A);
}
cout << rez;
return 0;
}
| #include <bits/stdc++.h>
#define STIZE(x) fprintf(stderr, "STIZE%d\n", x);
#define PRINT(x) fprintf(stderr, "%s = %d\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#define mid (l + r) / 2
#define endl '\n'
#define all(a) begin(a), end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
lld K, A, B;
cin >> K >> A >> B;
lld rez = K + 1;
lld preostalo = K - A + 1;
if (K >= A - 1) {
if (B >= A)
rez = max(K + 1, preostalo / 2 * (B - A) + preostalo % 2 + A);
}
cout << rez;
return 0;
}
| [
"assignment.change"
] | 933,173 | 933,174 | u405004435 | cpp |
p03131 | #include <bits/stdc++.h>
using i64 = long long;
using std::cin;
using std::cout;
using std::endl;
int main() {
i64 k, a, b;
scanf("%lld%lld%lld", &k, &a, &b);
if (b <= a + 1)
printf("%lld\n", k + 1);
else {
if (k < a - 1) {
printf("%lld\n", k + 1);
return 0;
} else {
i64 ans = 0;
k -= a + 1;
ans += b + (b - a) * (k / 2) + k % 2;
printf("%lld\n", std::max(k + a + 2, ans));
}
}
return 0;
}
| #include <bits/stdc++.h>
using i64 = long long;
using std::cin;
using std::cout;
using std::endl;
int main() {
i64 k, a, b;
scanf("%lld%lld%lld", &k, &a, &b);
if (b <= a + 1)
printf("%lld\n", k + 1);
else {
if (k < a + 1) {
printf("%lld\n", k + 1);
return 0;
} else {
i64 ans = 0;
k -= a + 1;
ans += b + (b - a) * (k / 2) + k % 2;
printf("%lld\n", std::max(k + a + 2, ans));
}
}
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 933,183 | 933,184 | u424655672 | cpp |
p03131 | #include <bits/stdc++.h>
using i64 = long long;
using std::cin;
using std::cout;
using std::endl;
int main() {
i64 k, a, b;
scanf("%lld%lld%lld", &k, &a, &b);
if (b <= a + 1)
printf("%lld\n", k + 1);
else {
if (k < a - 1) {
printf("%lld\n", k);
return 0;
} else {
i64 ans = 0;
k -= a + 1;
ans += b + (b - a) * (k / 2) + k % 2;
printf("%lld\n", std::max(k + a + 1, ans));
}
}
return 0;
}
| #include <bits/stdc++.h>
using i64 = long long;
using std::cin;
using std::cout;
using std::endl;
int main() {
i64 k, a, b;
scanf("%lld%lld%lld", &k, &a, &b);
if (b <= a + 1)
printf("%lld\n", k + 1);
else {
if (k < a + 1) {
printf("%lld\n", k + 1);
return 0;
} else {
i64 ans = 0;
k -= a + 1;
ans += b + (b - a) * (k / 2) + k % 2;
printf("%lld\n", std::max(k + a + 2, ans));
}
}
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change",
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 933,185 | 933,184 | u424655672 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i, a, b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i, a, b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i, n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar, val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout << #x << ": " << x << endl
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000000000000
#define PI 3.14159265358979323846L
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll k, a, b;
cin >> k >> a >> b;
if (b - 1 <= a) {
cout << k + 1 << endl;
} else {
if (k > a) {
k = k - a;
ll bis = b;
k--;
if (k % 2 == 0) {
k = k / 2;
bis = bis + (b - a) * k;
} else {
k = k / 2;
bis = bis + (b - 1) * k;
bis++;
}
cout << bis << endl;
} else {
cout << k + 1 << endl;
}
}
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i, a, b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i, a, b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i, n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar, val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout << #x << ": " << x << endl
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000000000000
#define PI 3.14159265358979323846L
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll k, a, b;
cin >> k >> a >> b;
if (b - 1 <= a) {
cout << k + 1 << endl;
} else {
if (k > a) {
k = k - a;
ll bis = b;
k--;
if (k % 2 == 0) {
k = k / 2;
bis = bis + (b - a) * k;
} else {
k = k / 2;
bis = bis + (b - a) * k;
bis++;
}
cout << bis << endl;
} else {
cout << k + 1 << endl;
}
}
}
| [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove",
"expression.operation.binary.change"
] | 933,192 | 933,193 | u774986209 | cpp |
p03131 | #define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for (ll i = a; i < n; i++)
#include <algorithm>
#include <cassert>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <unordered_map>
#include <vector>
#pragma comment(linker, "/STACK:8809999999")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef pair<ld, ld> pld;
typedef pair<pll, ll> ppll;
typedef pair<pll, pll> ppp;
typedef vector<vector<vector<ll>>> vvv;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;
const ll settled = 400007;
int main() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
#ifndef overlord
/*freopen("capitals.in", "r", stdin);
freopen("capitals.out", "w", stdout);*/
#else
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll k, a, b;
cin >> k >> a >> b;
if (a >= b || k <= a) {
cout << k + 1;
return 0;
}
ll sum = 1;
k -= a - 1;
sum = a;
sum += (b - a) * (k / 2);
sum += k % 2;
cout << sum;
return 0;
} | #define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for (ll i = a; i < n; i++)
#include <algorithm>
#include <cassert>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <unordered_map>
#include <vector>
#pragma comment(linker, "/STACK:8809999999")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef pair<ld, ld> pld;
typedef pair<pll, ll> ppll;
typedef pair<pll, pll> ppp;
typedef vector<vector<vector<ll>>> vvv;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;
const ll settled = 400007;
int main() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
#ifndef overlord
/*freopen("capitals.in", "r", stdin);
freopen("capitals.out", "w", stdout);*/
#else
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll k, a, b;
cin >> k >> a >> b;
if (a >= b - 2 || k <= a) {
cout << k + 1;
return 0;
}
ll sum = 1;
k -= a - 1;
sum = a;
sum += (b - a) * (k / 2);
sum += k % 2;
cout << sum;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 933,194 | 933,195 | u560651538 | cpp |
p03131 | #include <bits/stdc++.h>
#define Set(a, b) memset(a, b, sizeof(a))
using namespace std;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
template <typename T> inline void init(T &x) {
x = 0;
char ch = getchar();
bool t = 0;
for (; ch > '9' || ch < '0'; ch = getchar())
if (ch == '-')
t = 1;
for (; ch >= '0' && ch <= '9'; ch = getchar())
x = (x << 1) + (x << 3) + (ch - 48);
if (t)
x = -x;
return;
}
typedef long long ll;
typedef unsigned long long ull;
typedef __uint128_t uLL;
typedef double db;
typedef long double ldb;
template <typename T> inline void Inc(T &x, int y) {
x += y;
if (x >= mod)
x -= mod;
return;
}
template <typename T> inline void Dec(T &x, int y) {
x -= y;
if (x < 0)
x += mod;
return;
}
template <typename T> inline int fpow(int x, T k) {
int ret = 1;
for (; k; k >>= 1, x = (ll)x * x % mod)
if (k & 1)
ret = (ll)ret * x % mod;
return ret;
}
ll k, A, B;
ll ans = 0;
int main() {
init(k), init(A), init(B);
if (A >= B)
printf("%lld\n", k);
else {
ll K = k;
ll now = A;
k -= A - 1;
if (k < 0) {
printf("%lld\n", K + 1);
return 0;
}
ll d = B - A;
if (d > 2) {
if (k & 1)
++now, --k;
now += (ll)(k >> 1) * d;
printf("%lld\n", now);
} else
printf("%lld\n", K + 1);
}
return 0;
}
| #include <bits/stdc++.h>
#define Set(a, b) memset(a, b, sizeof(a))
using namespace std;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
template <typename T> inline void init(T &x) {
x = 0;
char ch = getchar();
bool t = 0;
for (; ch > '9' || ch < '0'; ch = getchar())
if (ch == '-')
t = 1;
for (; ch >= '0' && ch <= '9'; ch = getchar())
x = (x << 1) + (x << 3) + (ch - 48);
if (t)
x = -x;
return;
}
typedef long long ll;
typedef unsigned long long ull;
typedef __uint128_t uLL;
typedef double db;
typedef long double ldb;
template <typename T> inline void Inc(T &x, int y) {
x += y;
if (x >= mod)
x -= mod;
return;
}
template <typename T> inline void Dec(T &x, int y) {
x -= y;
if (x < 0)
x += mod;
return;
}
template <typename T> inline int fpow(int x, T k) {
int ret = 1;
for (; k; k >>= 1, x = (ll)x * x % mod)
if (k & 1)
ret = (ll)ret * x % mod;
return ret;
}
ll k, A, B;
ll ans = 0;
int main() {
init(k), init(A), init(B);
if (A >= B)
printf("%lld\n", k + 1);
else {
ll K = k;
ll now = A;
k -= A - 1;
if (k < 0) {
printf("%lld\n", K + 1);
return 0;
}
ll d = B - A;
if (d > 2) {
if (k & 1)
++now, --k;
now += (ll)(k >> 1) * d;
printf("%lld\n", now);
} else
printf("%lld\n", K + 1);
}
return 0;
}
| [
"expression.operation.binary.add"
] | 933,196 | 933,197 | u142717651 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
long long int a, b, k;
cin >> k >> a >> b;
if (a + 2 >= b) {
cout << 1 + k;
return 0;
}
k -= a - 1;
if (k <= 2) {
cout << 1 + a + k;
return 0;
}
cout << a + k + k / 2 * (b - a - 2);
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
long long int a, b, k;
cin >> k >> a >> b;
if (a + 2 >= b) {
cout << 1 + k;
return 0;
}
k -= a - 1;
if (k < 2) {
cout << a + k;
return 0;
}
cout << a + k + k / 2 * (b - a - 2);
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 933,212 | 933,211 | u495704746 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long k, a, b;
cin >> k >> a >> b;
if (b <= a + 2) {
cout << k + 1 << '\n';
} else {
cout << max(0LL, (k - a + 1) / 2) * (b - a) + ((k - a + 1) % 2) + a - 1
<< '\n';
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long k, a, b;
cin >> k >> a >> b;
if (b <= a + 2) {
cout << k + 1 << '\n';
} else {
cout << max(0LL, (k - a + 1) / 2) * (b - a) + ((k - a + 1) % 2) + a << '\n';
}
return 0;
} | [
"expression.operation.binary.remove"
] | 933,215 | 933,216 | u153798346 | cpp |
p03131 | #include "bits/stdc++.h"
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ans = 1;
if (A + 1 >= B) {
cout << K + 1 << endl;
} else {
if (K < A + 1)
cout << K + 1 << endl;
else {
K -= A + 1;
ans = B;
if (K % 2 == 0) {
ans += (B - A) * (K / 2);
} else {
ans += (B - A) * (K / 2) + 1;
}
}
cout << ans << endl;
}
} | #include "bits/stdc++.h"
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ans = 1;
if (A + 1 >= B) {
cout << K + 1 << endl;
} else {
if (K < A + 1)
cout << K + 1 << endl;
else {
K -= A + 1;
ans = B;
if (K % 2 == 0) {
ans += (B - A) * (K / 2);
} else {
ans += (B - A) * (K / 2) + 1;
}
cout << ans << endl;
}
}
} | [] | 933,217 | 933,218 | u365956698 | cpp |
p03131 | #include <cinttypes>
#include <iostream>
int main() {
int k, a, b;
scanf("%d%d%d", &k, &a, &b);
k++;
int64_t res;
if (b - a > 2) {
if (k <= a)
res = k;
else
res = a + (k - a) * (int64_t)(b - a) / 2 + (k - a) % 2;
} else
res = k;
std::cout << res << std::endl;
return 0;
}
| #include <cinttypes>
#include <iostream>
int main() {
int k, a, b;
scanf("%d%d%d", &k, &a, &b);
k++;
int64_t res;
if (b - a > 2) {
if (k <= a)
res = k;
else
res = a + (k - a) / 2 * (int64_t)(b - a) + (k - a) % 2;
} else
res = k;
std::cout << res << std::endl;
return 0;
}
| [
"assignment.change",
"expression.operation.binary.remove"
] | 933,219 | 933,220 | u040490988 | cpp |
p03131 | //#include <bits/stdc++.h>
//#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#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 LLINF 1000000000000000000 // 9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000
using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;
int dy[5] = {0, 0, 1, -1, 0};
int dx[5] = {1, -1, 0, 0, 0};
int main(void) {
long long int k, a, b;
long long int p;
long long int total = 1;
cin >> k >> a >> b;
if (a + 2 >= b) {
total += k;
} else {
if (k - 1 < a) {
total += k;
} else {
p = k - (a - 1);
total = a;
if (p % 2 == 0) {
total += (p / 2) * (b - a);
} else {
total = (p / 2) * (b - a) + 1;
}
}
}
cout << total << endl;
return 0;
} | //#include <bits/stdc++.h>
//#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#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 LLINF 1000000000000000000 // 9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000
using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;
int dy[5] = {0, 0, 1, -1, 0};
int dx[5] = {1, -1, 0, 0, 0};
int main(void) {
long long int k, a, b;
long long int p;
long long int total = 1;
cin >> k >> a >> b;
if (a + 2 >= b) {
total += k;
} else {
if (k - 1 < a) {
total += k;
} else {
p = k - (a - 1);
total = a;
if (p % 2 == 0) {
total += (p / 2) * (b - a);
} else {
total += (p / 2) * (b - a) + 1;
}
}
}
cout << total << endl;
return 0;
} | [
"assignment.value.change"
] | 933,229 | 933,230 | u057611820 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ans = 0;
if (B + 2 <= A || K <= A + 1) {
ans = K + 1;
} else {
K -= (A - 1);
ans += A;
ans += (K / 2) * (B - A);
ans += K % 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
long long ans = 0;
if (B <= A + 2 || K <= A) {
ans = K + 1;
} else {
K -= (A - 1);
ans += A;
ans += (K / 2) * (B - A);
ans += K % 2;
}
cout << ans << endl;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 933,245 | 933,246 | u636387751 | cpp |
p03131 | #include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
long long k, a, b;
cin >> k >> a >> b;
if (k <= a or a + 2 > b) {
cout << k;
return 0;
} else
cout << (a + ((k - a + 1) / 2) * (b - a) + 1 * (k - a + 1) % 2);
}
| #include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
long long k, a, b;
cin >> k >> a >> b;
if (k <= a or a + 2 > b) {
cout << k + 1;
return 0;
} else
cout << (a + ((k - a + 1) / 2) * (b - a) + 1 * (k - a + 1) % 2);
}
| [
"expression.operation.binary.add"
] | 933,253 | 933,254 | u834415466 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
int K, A, B;
cin >> K >> A >> B;
if (A + 2 >= B) {
cout << K + 1;
} else {
if (K <= A) {
cout << K + 1;
} else {
int m = K + 1 - A;
if (m % 2 == 0) {
cout << A + (B - A) * (m / 2);
} else {
cout << A + 1 + (B - A) * (m - 1) / 2;
}
}
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long K, A, B;
cin >> K >> A >> B;
if (A + 2 >= B) {
cout << K + 1;
} else {
if (K <= A) {
cout << K + 1;
} else {
long long m = K + 1 - A;
if (m % 2 == 0) {
cout << A + (B - A) * (m / 2);
} else {
cout << A + 1 + (B - A) * (m - 1) / 2;
}
}
}
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 933,255 | 933,256 | u823444917 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 1 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long k, a, b;
cin >> k >> a >> b;
long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 933,257 | 933,258 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long k, a, b;
cin >> k >> a >> b;
long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 933,259 | 933,258 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans += b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long k, a, b;
cin >> k >> a >> b;
long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"assignment.value.change"
] | 933,260 | 933,258 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans += b;
while (k > 1) {
k -= 2;
ans += b;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long k, a, b;
cin >> k >> a >> b;
long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"assignment.value.change",
"assignment.change"
] | 933,261 | 933,258 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 1 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 933,257 | 933,262 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 933,259 | 933,262 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
int ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans += b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans = 1;
if (a + 3 > b) {
ans += k;
} else {
if (k - 2 < a - 1) {
ans += k;
} else {
k -= a + 1;
ans = b;
while (k > 1) {
k -= 2;
ans += b - a;
}
ans += k;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"assignment.value.change"
] | 933,260 | 933,262 | u403323882 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int k, a, b;
cin >> k >> a >> b;
if (b - a > 1) {
if (k - a + 1 >= 2) {
cout << (k - a + 1) / 2 * (b - a) + (k - a + 1) % 2 + a << endl;
} else {
cout << 1 + k << endl;
}
} else {
cout << 1 + k << endl;
}
} | #include <iostream>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (b - a > 1) {
if (k - a + 1 >= 2) {
cout << (k - a + 1) / 2 * (b - a) + (k - a + 1) % 2 + a << endl;
} else {
cout << 1 + k << endl;
}
} else {
cout << 1 + k << endl;
}
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 933,265 | 933,266 | u827974318 | cpp |
p03131 | #include <iostream>
using namespace std;
int A, B, K;
int main() {
cin >> K >> A >> B;
if (B - A <= 2 || K <= A - 1)
cout << K + 1;
else if ((K - A + 1) % 2 == 1)
cout << (K - A + 1) / 2 * (B - A) + A + 1;
else
cout << (K - A + 1) / 2 * (B - A) + A;
return 0;
} | #include <iostream>
using namespace std;
typedef long long ll;
ll A, B, K;
int main() {
cin >> K >> A >> B;
if (B - A <= 2 || K <= A - 1)
cout << K + 1;
else if ((K - A + 1) % 2 == 1)
cout << (K - A + 1) / 2 * (B - A) + A + 1;
else
cout << (K - A + 1) / 2 * (B - A) + A;
return 0;
} | [] | 933,269 | 933,270 | u110996038 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
long K, A, B;
long ans = 0;
long anskari = 0;
cin >> K >> A >> B;
if (B < A + 2) {
ans = 1 + K;
} else {
if (K - A + 1 % 2 == 0) {
anskari = (((K - (A - 1)) / 2) * (B - A)) + A - 1;
} else {
anskari = ((((K - (A - 1)) / 2)) * (B - A)) + 1 + A;
}
ans = max(1 + K, anskari);
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long K, A, B;
long ans = 0;
long anskari = 0;
cin >> K >> A >> B;
if (B < A + 2) {
ans = 1 + K;
} else {
if ((K - A + 1) % 2 == 0) {
anskari = (((K - (A - 1)) / 2) * (B - A)) + A;
} else {
anskari = ((((K - (A - 1)) / 2)) * (B - A)) + 1 + A;
}
ans = max(1 + K, anskari);
}
cout << ans << endl;
} | [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 933,281 | 933,282 | u833295869 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
int K, A, B;
int ans = 0;
int anskari = 0;
cin >> K >> A >> B;
if (B < A + 2) {
ans = 1 + K;
} else {
if (K - A + 1 % 2 == 0) {
anskari = (((K - (A - 1)) / 2) * (B - A)) + A;
} else {
anskari = ((((K - (A - 1)) / 2)) * (B - A)) + 1 + A;
}
ans = max(1 + K, anskari);
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long K, A, B;
long ans = 0;
long anskari = 0;
cin >> K >> A >> B;
if (B < A + 2) {
ans = 1 + K;
} else {
if ((K - A + 1) % 2 == 0) {
anskari = (((K - (A - 1)) / 2) * (B - A)) + A;
} else {
anskari = ((((K - (A - 1)) / 2)) * (B - A)) + 1 + A;
}
ans = max(1 + K, anskari);
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"control_flow.branch.if.condition.change"
] | 933,283 | 933,282 | u833295869 | cpp |
p03131 | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n, k) for (int i = n; i < k; i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) \
for (int i = 0; i < v.size(); i++) \
P(v[i]);
#define printt(a, b) cout << a << " " << b << endl;
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int MOD = 1e9 + 7;
void solve() {
ll k, a, b;
cin >> k >> a >> b;
ll onlyinc = k + 1;
ll trade;
if (b - a <= 2) {
P(onlyinc);
return;
} else {
trade = a + (b - a) * ((k - a + 1) / 2);
if (k - a + 1 % 2 == 1) {
trade++;
}
}
P(max(onlyinc, trade));
}
int main() {
solve();
return 0;
}
| #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n, k) for (int i = n; i < k; i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) \
for (int i = 0; i < v.size(); i++) \
P(v[i]);
#define printt(a, b) cout << a << " " << b << endl;
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int MOD = 1e9 + 7;
void solve() {
ll k, a, b;
cin >> k >> a >> b;
ll onlyinc = k + 1;
ll trade;
if (b - a <= 2) {
P(onlyinc);
return;
} else {
trade = a + (b - a) * ((k - a + 1) / 2);
if ((k - a + 1) % 2 == 1) {
trade++;
}
}
P(max(onlyinc, trade));
}
int main() {
solve();
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 933,284 | 933,285 | u687470137 | cpp |
p03131 | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back
ll k, a, b;
int main() {
cin >> k >> a >> b;
if (b <= a + 2) {
cout << k + 1 << endl;
} else {
if (k < a + 1) {
cout << k + 1 << endl;
return 0;
}
if (k == a + 1) {
cout << b << endl;
return 0;
}
ll yos = k - a - 1;
if (yos % 2 == 0) {
yos /= 2;
cout << (yos + 1) * b - (yos * a) << endl;
} else {
yos /= 2;
cout << (yos)*b - (yos - 1) * (a) + 1 << endl;
}
}
// cout << 48518828981938099 << endl;
return 0;
}
| #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back
ll k, a, b;
int main() {
cin >> k >> a >> b;
if (b <= a + 2) {
cout << k + 1 << endl;
} else {
if (k < a + 1) {
cout << k + 1 << endl;
return 0;
}
if (k == a + 1) {
cout << b << endl;
return 0;
}
ll yos = k - a - 1;
if (yos % 2 == 0) {
yos /= 2;
cout << (yos + 1) * b - (yos * a) << endl;
} else {
yos /= 2;
cout << (yos + 1) * b - (yos) * (a) + 1 << endl;
}
}
// cout << 48518828981938099 << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 933,288 | 933,289 | u116436282 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int K, A, B;
int ans = 1;
cin >> K >> A >> B;
double per = (double)B / A;
bool flg;
if (per >= 2) {
flg = true;
} else {
flg = false;
}
if (flg) {
if (K < A - 1) {
ans = K + 1;
} else {
K -= (A - 1);
ans += (A - 1);
ans += (B - A) * (K / 2) + (K % 2);
}
} else {
ans = K + 1;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int K, A, B;
int ans = 1;
cin >> K >> A >> B;
double per = (double)B - A;
bool flg;
if (per >= 2) {
flg = true;
} else {
flg = false;
}
if (flg) {
if (K < A - 1) {
ans = K + 1;
} else {
K -= (A - 1);
ans += (A - 1);
ans += (B - A) * (K / 2) + (K % 2);
}
} else {
ans = K + 1;
}
cout << ans << endl;
return 0;
}
| [
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 933,290 | 933,291 | u461044076 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void solve() {
long long int K, A, B;
cin >> K >> A >> B;
if (A + 2 >= B) {
cout << K + 1 << endl;
return;
}
long long int has = 1;
if (K - has >= A + 2) {
K -= A - has;
has = A;
} else {
has += K;
K = 0;
}
if (has >= A) {
if (K >= 2) {
has -= A;
has += B;
K -= 2;
} else if (K == 1) {
has++;
K--;
}
}
has += (B - A) * (K / 2);
if (K % 2 == 1) {
has++;
}
cout << has << endl;
}
int main() {
solve();
return (0);
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void solve() {
long long int K, A, B;
cin >> K >> A >> B;
if (A + 2 >= B) {
cout << K + 1 << endl;
return;
}
long long int has = 1;
if (K - has >= A) {
K -= A - has;
has = A;
} else {
has += K;
K = 0;
}
if (has >= A) {
if (K >= 2) {
has -= A;
has += B;
K -= 2;
} else if (K == 1) {
has++;
K--;
}
}
has += (B - A) * (K / 2);
if (K % 2 == 1) {
has++;
}
cout << has << endl;
}
int main() {
solve();
return (0);
} | [
"expression.operation.binary.remove"
] | 933,292 | 933,293 | u057619905 | cpp |
p03131 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
void solve() {
long long k, a, b;
cin >> k >> a >> b;
long long ret = 0;
if ((b - a <= 2) || a > k) {
ret = k + 1;
} else {
ret = a + ((k - a - 1) / 2) * (b - a) + ((k - a - 1) % 2);
}
std::cout << ret << std::endl;
}
int main(int argc, char *argv[]) {
solve();
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
void solve() {
long long k, a, b;
cin >> k >> a >> b;
long long ret = 0;
if ((b - a <= 2) || a > k) {
ret = k + 1;
} else {
ret = a + ((k - a + 1) / 2) * (b - a) + ((k - a + 1) % 2);
}
std::cout << ret << std::endl;
}
int main(int argc, char *argv[]) {
solve();
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 933,296 | 933,297 | u576524226 | cpp |
p03131 | #include <iostream>
using namespace std;
int main(void) {
long long K, A, B;
cin >> K >> A >> B;
if ((B - A) <= 2) {
cout << 1 + K << endl;
return 0;
}
if (K == 1) {
cout << 1 + K << endl;
return 0;
}
if ((A - 1 + 1) > K) {
cout << 1 + K << endl;
return 0;
}
long long ans = 0;
long long k = K - (A - 1) - 2;
ans = B;
ans += (k / 2) * (B - A);
if ((k % 2) == 1) {
ans++;
}
cout << ans << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main(void) {
long long K, A, B;
cin >> K >> A >> B;
if ((B - A) <= 2) {
cout << 1 + K << endl;
return 0;
}
if (K == 1) {
cout << 1 + K << endl;
return 0;
}
if ((A - 1) > (K - 2)) {
cout << 1 + K << endl;
return 0;
}
long long ans = 0;
long long k = K - (A - 1) - 2;
ans = B;
ans += (k / 2) * (B - A);
if ((k % 2) == 1) {
ans++;
}
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 933,298 | 933,299 | u016119075 | cpp |
p03131 | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define INF 10000000000
#define MOD 1000000007
using namespace std;
using ll = long long;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = 0;
if (a + 1 < b) {
if (k >= a + 1) {
k -= a + 1;
ans = b;
while (k >= 2) {
ans += b - a;
k -= 2;
}
ans += k;
} else {
ans += k;
}
} else {
ans = k + 1;
}
cout << ans << endl;
}
| #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define INF 10000000000
#define MOD 1000000007
using namespace std;
using ll = long long;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = 0;
if (a + 1 < b) {
if (k >= a + 1) {
k -= a + 1;
ans = b;
while (k >= 2) {
ans += b - a;
k -= 2;
}
ans += k;
} else {
ans = k + 1;
}
} else {
ans = k + 1;
}
cout << ans << endl;
} | [
"assignment.value.change",
"assignment.change"
] | 933,304 | 933,305 | u907049739 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <vector>
#define ll long long
using namespace std;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll biscuits;
if (b - a <= 2) {
biscuits = k + 1;
} else {
biscuits = 2 + (b - a) * (k - a + 1) / 2 + (k + 1) % 2;
}
cout << biscuits << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <vector>
#define ll long long
using namespace std;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll biscuits;
if (b - a < 2) {
biscuits = k + 1;
} else {
biscuits = a + (b - a) * ((k - a + 1) / 2) + (k - a + 1) % 2;
}
cout << biscuits << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove",
"expression.operation.binary.change",
"assignment.change"
] | 933,323 | 933,324 | u170650966 | cpp |
p03131 |
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ull K, A, B;
cin >> K >> A >> B;
ull ans;
if (B - A <= 2 || K <= A - 1) {
ans = K + 1;
} else {
ull turn = K - (A - 1);
ans = A + (turn / 2) * (B - A) + (turn % 2);
}
cout << ans << endl;
}
|
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll K, A, B;
cin >> K >> A >> B;
ll ans;
if (B - A <= 2 || K <= A - 1) {
ans = K + 1;
} else {
ll turn = K - (A - 1);
ans = A + (turn / 2) * (B - A) + (turn % 2);
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 933,331 | 933,332 | u377777817 | cpp |
p03131 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
using namespace std;
using ll = long long int;
using vv = vector<vector<ll>>;
using edge = struct {
int to;
int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()
typedef pair<ll, ll> Pair;
bool pairCompare(const Pair &firstElof, const Pair &secondElof) {
return firstElof.second > secondElof.second;
}
vector<ll> divisor(ll n) {
vector<ll> ret;
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
map<ll, int> prime_factor(ll n) {
map<ll, int> ret;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
ll factorial(int n) {
ll ans = 1;
for (int i = 2; i <= n; i++) {
ans *= i;
ans %= MOD;
}
return ans;
}
ll P(int n, int m) {
ll ans = 1;
for (int i = m + 1; i <= n; i++) {
ans *= i;
ans %= MOD;
}
return ans;
}
ll power(int n, int m) {
if (m == 0) {
return 1;
} else if (m % 2 == 0) {
ll tmp = power(n, m / 2);
return (tmp * tmp) % MOD;
} else {
return (n * power(n, m - 1)) % MOD;
}
}
ll C(int n, int m) {
return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ll K, A, B;
cin >> K >> A >> B;
if (B - A < 1 || K - A < 1) {
cout << (ll)1 + K << endl;
} else if ((K - A + (ll)1) % 2 == 0) {
cout << A + ((B - A) * ((K - A + (ll)1) / (ll)2)) << endl;
} else {
cout << (ll)1 + A + ((B - A) * ((K - A) / (ll)2)) << endl;
}
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
using namespace std;
using ll = long long int;
using vv = vector<vector<ll>>;
using edge = struct {
int to;
int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()
typedef pair<ll, ll> Pair;
bool pairCompare(const Pair &firstElof, const Pair &secondElof) {
return firstElof.second > secondElof.second;
}
vector<ll> divisor(ll n) {
vector<ll> ret;
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
map<ll, int> prime_factor(ll n) {
map<ll, int> ret;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
ll factorial(int n) {
ll ans = 1;
for (int i = 2; i <= n; i++) {
ans *= i;
ans %= MOD;
}
return ans;
}
ll P(int n, int m) {
ll ans = 1;
for (int i = m + 1; i <= n; i++) {
ans *= i;
ans %= MOD;
}
return ans;
}
ll power(int n, int m) {
if (m == 0) {
return 1;
} else if (m % 2 == 0) {
ll tmp = power(n, m / 2);
return (tmp * tmp) % MOD;
} else {
return (n * power(n, m - 1)) % MOD;
}
}
ll C(int n, int m) {
return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ll K, A, B;
cin >> K >> A >> B;
if (B - A <= 2 || K - A < 1) {
cout << (ll)1 + K << endl;
} else if ((K - A + (ll)1) % 2 == 0) {
cout << A + ((B - A) * ((K - A + (ll)1) / (ll)2)) << endl;
} else {
cout << (ll)1 + A + ((B - A) * ((K - A) / (ll)2)) << endl;
}
return 0;
}
| [] | 933,333 | 933,334 | u050865477 | cpp |
p03131 | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL K, A, B;
LL f() {
if (K < A + 1) {
return K + 1;
}
K -= A + 1;
LL r = B;
r += (B - A) * (K / 2);
r += K % 2;
return r;
}
int main() {
cin >> K >> A >> B;
cout << max(K + 1, f()) << endl;
return 0;
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL K, A, B;
LL f(LL K) {
if (K < A + 1) {
return K + 1;
}
K -= A + 1;
LL r = B;
r += (B - A) * (K / 2);
r += K % 2;
return r;
}
int main() {
cin >> K >> A >> B;
cout << max(K + 1, f(K)) << endl;
return 0;
}
| [
"function.parameters.parameter.add",
"call.arguments.change"
] | 933,335 | 933,336 | u736004166 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (a >= b || k <= a) {
cout << k << endl;
return 0;
}
long long x = k - (a + 1);
long long ans = b;
long long cnt = x / 2;
ans += (b - a) * cnt;
if (x % 2 == 1) {
ans++;
}
if (ans < k) {
ans = k;
}
cout << ans << endl;
return 0;
}
// | #include <iostream>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (a >= b || k <= a) {
cout << k + 1 << endl;
return 0;
}
long long x = k - (a + 1);
long long ans = b;
long long cnt = x / 2;
ans += (b - a) * cnt;
if (x % 2 == 1) {
ans++;
}
if (ans < k + 1) {
ans = k + 1;
}
cout << ans << endl;
return 0;
}
// | [
"control_flow.branch.if.condition.change",
"assignment.change"
] | 933,341 | 933,342 | u874996917 | cpp |
p03131 | #include <iostream>
typedef unsigned long int int64;
using namespace std;
int main() {
int64 K, A, B;
cin >> K >> A >> B;
if (K - A - 1 < 0) {
cout << K + 1 << endl;
return 0;
}
if (B - A < 3) {
cout << K + 1 << endl;
return 0;
}
int64 ans = 1;
ans += A - 1;
if ((K - A + 1) % 2 == 0) {
ans += (B - A) * ((K - A + 1) / 2);
} else {
ans += (B - A) * ((K - A + 1) / 2) + 1;
}
cout << ans << endl;
return 0;
}
| #include <iostream>
typedef long long int int64;
using namespace std;
int main() {
int64 K, A, B;
cin >> K >> A >> B;
if (K - A - 1 < 0) {
cout << K + 1 << endl;
return 0;
}
if (B - A < 3) {
cout << K + 1 << endl;
return 0;
}
int64 ans = 1;
ans += A - 1;
if ((K - A + 1) % 2 == 0) {
ans += (B - A) * ((K - A + 1) / 2);
} else {
ans += (B - A) * ((K - A + 1) / 2) + 1;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 933,343 | 933,344 | u947883560 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (a >= k + 1 || b - a <= 2) {
cout << k + 1 << endl;
return 0;
}
k -= a - 1;
int ans = (b - a) * (k / 2) + (k % 2) + a;
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (a >= k || b - a <= 2) {
cout << k + 1 << endl;
return 0;
}
k -= a - 1;
long long ans = (b - a) * (k / 2) + (k % 2) + a;
cout << ans << endl;
} | [
"expression.operation.binary.remove",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 933,345 | 933,346 | u647474992 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (a >= k || b - a <= 2) {
cout << k + 1 << endl;
return 0;
}
k -= a - 1;
int ans = (b - a) * (k / 2) + (k % 2) + a;
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
if (a >= k || b - a <= 2) {
cout << k + 1 << endl;
return 0;
}
k -= a - 1;
long long ans = (b - a) * (k / 2) + (k % 2) + a;
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 933,347 | 933,346 | u647474992 | cpp |
p03131 | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long int K, A, B;
cin >> K >> A >> B;
long long int ans = 0, tmp = 0;
if (K < A || B - A <= 2)
ans = K + 1;
else {
if (K - (A - 1) % 2 == 0) {
tmp = A + (B - A) * ((K - (A - 1)) / 2);
} else {
// tmp = A+(B-A)*((K-(A-1))/2)+1; //解答見てから変えたもの
// tmp = A+(B-A)*(((K-1)-(A-1))/2)+1; //自分の最終的な解答
tmp = A + (B - A) * ((K - (A - 1)) / 2) + 1; //ぷに
}
ans = max(ans, tmp);
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long int K, A, B;
cin >> K >> A >> B;
long long int ans = K + 1, tmp = 0;
if (K < A || B - A <= 2)
ans = K + 1;
else {
if ((K - (A - 1)) % 2 == 0) {
tmp = A + (B - A) * ((K - (A - 1)) / 2);
} else {
// tmp = A+(B-A)*((K-(A-1))/2)+1; //解答見てから変えたもの
// tmp = A+(B-A)*(((K-1)-(A-1))/2)+1; //自分の最終的な解答
tmp = A + (B - A) * ((K - (A - 1)) / 2) + 1; //ぷに
}
ans = max(ans, tmp);
}
cout << ans << endl;
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 933,352 | 933,353 | u067481442 | cpp |
p03131 | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef string S;
typedef pair<int, int> P;
typedef vector<int> vi;
const int mod = 1e9 + 7;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll k, a, b;
cin >> k >> a >> b;
cout << (a + 2 <= b && k - a + 1 >= 0
? a + ((k - a + 1) / 2) * (b - a) + (k - a - 1) % 2
: k + 1)
<< endl;
return 0;
} | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef string S;
typedef pair<int, int> P;
typedef vector<int> vi;
const int mod = 1e9 + 7;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll k, a, b;
cin >> k >> a >> b;
cout << (a + 2 <= b && k - a + 1 >= 0
? a + ((k - a + 1) / 2) * (b - a) + (k - a + 1) % 2
: k + 1)
<< endl;
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change"
] | 933,356 | 933,357 | u050138914 | cpp |
p03131 | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef string S;
typedef pair<int, int> P;
typedef vector<int> vi;
const int mod = 1e9 + 7;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll k, a, b;
cin >> k >> a >> b;
cout << (a + 2 <= b && k - a - 1 >= 0
? b + ((k - a - 1) / 2) * (b - a - 2) + (k - a - 1) % 2
: k + 1)
<< endl;
return 0;
} | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef string S;
typedef pair<int, int> P;
typedef vector<int> vi;
const int mod = 1e9 + 7;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll k, a, b;
cin >> k >> a >> b;
cout << (a + 2 <= b && k - a + 1 >= 0
? a + ((k - a + 1) / 2) * (b - a) + (k - a + 1) % 2
: k + 1)
<< endl;
return 0;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.loop.for.condition.change",
"io.output.change",
"identifier.change",
"expression.operation.binary.remove"
] | 933,358 | 933,357 | u050138914 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll k, a, b;
int main() {
cin >> k >> a >> b;
if (k < a || b - a <= 2)
cout << k + 1 << endl;
cout << (a + (k + 1 - a) / 2 * (b - a) + (k + 1 - a) % 2) << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll k, a, b;
int main() {
cin >> k >> a >> b;
if (k < a || b - a <= 2)
cout << k + 1 << endl;
else
cout << (a + (k + 1 - a) / 2 * (b - a) + (k + 1 - a) % 2) << endl;
} | [
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add"
] | 933,359 | 933,360 | u089329978 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int k, a, b;
cin >> k >> a >> b;
if (b - a <= 2 || k < a + 1) {
cout << 1 + k << endl;
return 0;
}
cout << a + (b - a) * (k - a + 1) / 2 + (k - a + 1) % 2 << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int k, a, b;
cin >> k >> a >> b;
if (b - a <= 2 || k < a + 1) {
cout << 1 + k << endl;
return 0;
}
cout << a + (b - a) * ((k - a + 1) / 2) + (k - a + 1) % 2 << endl;
} | [] | 933,361 | 933,362 | u387258288 | cpp |
p03131 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define REPI(i, a, b) for (int i = a; i >= b; i--)
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
const int OO = 1e9 + 7;
const int MOD = 1e9 + 7;
const int N = 1e5 + 7;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("teleport.in","r",stdin);
// freopen("teleport.out","w",stdout);
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
k -= a + 1;
if (b - a > 0)
ans = max(b + (b - a) * (k / 2) + (k % 2), ans);
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define REPI(i, a, b) for (int i = a; i >= b; i--)
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
const int OO = 1e9 + 7;
const int MOD = 1e9 + 7;
const int N = 1e5 + 7;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("teleport.in","r",stdin);
// freopen("teleport.out","w",stdout);
ll k, a, b;
cin >> k >> a >> b;
ll ans = k + 1;
k -= a + 1;
if (b - a > 0 && k >= 0)
ans = max(b + (b - a) * (k / 2) + (k % 2), ans);
cout << ans << endl;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 933,379 | 933,378 | u216673135 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
// typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;
int main(void) {
long long int K, A, B, ans, times;
times = 0;
ans = 0;
cin >> K >> A >> B;
if (A >= K)
cout << 1 + K << endl;
else if (B - A <= 2)
cout << 1 + K << endl;
else {
times = K - (A + 1);
if (times == 0) {
ans = B + (B - A) * (times / 2);
} else {
ans = B + (B - A) * (times / 2) + 1;
}
cout << ans << endl;
}
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
// typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;
int main(void) {
long long int K, A, B, ans, times;
times = 0;
ans = 0;
cin >> K >> A >> B;
if (A >= K)
cout << 1 + K << endl;
else if (B - A <= 2)
cout << 1 + K << endl;
else {
times = K - (A + 1);
if (times % 2 == 0) {
ans = B + (B - A) * (times / 2);
} else {
ans = B + (B - A) * (times / 2) + 1;
}
cout << ans << endl;
}
}
| [
"control_flow.branch.if.condition.change"
] | 933,383 | 933,384 | u846679133 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
typedef long long ll;
typedef double db;
const int maxn = 45000 + 5;
const int mod = 1e9 + 7;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll cnt = 1, sum = 0;
if (a + 1 >= b || k < a) {
cnt += k;
} else {
k -= a;
cnt = 0;
sum++;
if (k) {
if (k & 1) {
ll p = (k + 1) / 2;
cnt = p * b;
cnt -= (p - 1) * a;
} else {
ll p = k / 2;
cnt = p * b + 1;
cnt -= (p - 1) * a;
}
}
}
printf("%lld\n", cnt);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
typedef long long ll;
typedef double db;
const int maxn = 45000 + 5;
const int mod = 1e9 + 7;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll cnt = 1, sum = 0;
if (a + 1 >= b || k <= a) {
cnt += k;
} else {
k -= a;
cnt = 0;
sum++;
if (k) {
if (k & 1) {
ll p = (k + 1) / 2;
cnt = p * b;
cnt -= (p - 1) * a;
} else {
ll p = k / 2;
cnt = p * b + 1;
cnt -= (p - 1) * a;
}
}
}
printf("%lld\n", cnt);
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 933,436 | 933,437 | u493249745 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
int K, A, B;
cin >> K >> A >> B;
int answer;
if (A + 2 >= B) {
answer = K + 1;
} else if (A + 2 < B && (K - A + 1) % 2 == 0) {
answer = A + (B - A) * (K - A + 1) / 2;
} else {
answer = A + (B - A) * ((K - A + 1) / 2) + 1;
}
cout << answer << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long K, A, B;
cin >> K >> A >> B;
long answer;
if (A + 2 >= B) {
answer = K + 1;
} else if (A + 2 < B && (K - A + 1) % 2 == 0) {
answer = A + (B - A) * (K - A + 1) / 2;
} else {
answer = A + (B - A) * ((K - A + 1) / 2) + 1;
}
cout << answer << endl;
} | [
"variable_declaration.type.primitive.change"
] | 933,440 | 933,441 | u374141734 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 1 >= b || k == 1) {
cout << k + 1 << endl;
} else {
ll sum = 0;
k -= a + 1;
sum += b;
sum += k / 2 * (b - a);
k -= k / 2 * 2;
sum += k;
cout << sum << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 1 >= b || k == 1 || k == a) {
cout << k + 1 << endl;
} else {
ll sum = 0;
k -= a + 1;
sum += b;
sum += k / 2 * (b - a);
k -= k / 2 * 2;
sum += k;
cout << sum << endl;
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 933,454 | 933,455 | u054652697 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = 0;
if (a >= b) {
ans = 1 + k;
} else if (a - 1 <= k) {
k -= (a - 1);
ll n = (k / 2);
ans = n * b - (n - 1) * a;
if (k % 2)
ans++;
}
cout << ans;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll ans = 0;
if (a + 1 >= b) {
ans = 1 + k;
} else if (a - 1 <= k) {
k -= (a - 1);
ll n = (k / 2);
ans = n * b - (n - 1) * a;
if (k % 2)
ans++;
}
cout << ans;
}
| [
"control_flow.branch.if.condition.change"
] | 933,456 | 933,457 | u244818078 | cpp |
p03131 | #include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (double i = 0; i < n; i++)
typedef int long long ll;
using namespace std;
int const INF = 1000000;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 2 >= b) {
cout << k + 1 << endl;
return 0;
}
if (k < a + 2) {
cout << k << endl;
return 0;
}
k++;
k = k - (a + 2);
ll ans = b;
ll add = b - a;
ans += (k / 2) * add;
if (k % 2 == 1) {
ans++;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (double i = 0; i < n; i++)
typedef int long long ll;
using namespace std;
int const INF = 1000000;
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 2 >= b) {
cout << k + 1 << endl;
return 0;
}
if (k < a + 1) {
cout << k + 1 << endl;
return 0;
}
k++;
k = k - (a + 2);
ll ans = b;
ll add = b - a;
ans += (k / 2) * add;
if (k % 2 == 1) {
ans++;
}
cout << ans << endl;
return 0;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 933,468 | 933,469 | u031448582 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans = 0;
if (b - a > 2) {
if (k >= a + 1) {
if ((k - a + 1) % 2 == 0) {
ans = a + (b - a) * ((k - a + 1)) / 2;
} else {
ans = a + (b - a) * ((k - a + 1)) / 2 + 1;
}
} else {
cout << k + 1 << endl;
return 0;
}
} else {
cout << k + 1 << endl;
return 0;
}
if (k + 1 >= ans)
cout << k + 1 << endl;
else
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long k, a, b;
cin >> k >> a >> b;
long long ans = 0;
if (b - a > 2) {
if (k >= a + 1) {
if ((k - a + 1) % 2 == 0) {
ans = a + (b - a) * ((k - a + 1) / 2);
} else {
ans = a + (b - a) * ((k - a + 1) / 2) + 1;
}
} else {
cout << k + 1 << endl;
return 0;
}
} else {
cout << k + 1 << endl;
return 0;
}
if (k + 1 >= ans)
cout << k + 1 << endl;
else
cout << ans << endl;
} | [] | 933,470 | 933,471 | u807998890 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
int main() {
long long int k, a, b;
long long int ans = 0;
cin >> k >> a >> b;
if (b - 1 <= a) {
cout << k + 1 << endl;
return 0;
} else {
k -= a + 1;
ans += b;
ans += k % 2;
ans += (b - a) * (k / 2);
cout << ans << endl;
}
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
int main() {
long long int k, a, b;
long long int ans = 0;
cin >> k >> a >> b;
if (b - 1 <= a || k < a + 1) {
cout << k + 1 << endl;
return 0;
} else {
k -= a + 1;
ans += b;
ans += k % 2;
ans += (b - a) * (k / 2);
cout << ans << endl;
}
} | [
"control_flow.branch.if.condition.change"
] | 933,472 | 933,473 | u458187055 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int K, A, B;
long int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * ((K - A + 1) / 2) + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main() {
long int K, A, B;
long int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * ((K - A + 1) / 2) + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 933,480 | 933,481 | u041282550 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int K, A, B;
long int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * (K - A + 1) / 2 + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main() {
long int K, A, B;
long int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * ((K - A + 1) / 2) + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 933,482 | 933,481 | u041282550 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int K, A, B;
int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * ((K - A + 1) / 2) + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main() {
long int K, A, B;
long int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * ((K - A + 1) / 2) + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 933,483 | 933,481 | u041282550 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
int K, A, B;
int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * (K - A + 1) / 2 + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main() {
long int K, A, B;
long int ans = 0;
cin >> K >> A >> B;
if (B - A >= 2 && K - A + 1 < 0)
ans = K + 1;
else if (B - A >= 2 && K - A + 1 >= 0) {
if ((K - A + 1) % 2 == 0)
ans = A + (B - A) * (K - A + 1) / 2;
else
ans = A + (B - A) * ((K - A + 1) / 2) + 1;
} else
ans = K + 1;
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 933,484 | 933,481 | u041282550 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
int a[7], b[7];
int degree[7];
int main() {
long long k, a, b;
scanf("%lld%lld%lld", &k, &a, &b);
long long ans = 0;
if (a >= b - 1) {
ans = k + 1;
} else {
long long x = k - (a - 1);
if (x > 0) {
ans += b;
k -= a + 1;
} else
ans = k + 1, k = 0;
x = 0;
x = k / 2;
long long y = k & 1;
ans += x * (b - a);
ans += y;
}
printf("%lld", ans);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int a[7], b[7];
int degree[7];
int main() {
long long k, a, b;
scanf("%lld%lld%lld", &k, &a, &b);
long long ans = 0;
if (a >= b - 1) {
ans = k + 1;
} else {
long long x = k - a;
if (x > 0) {
ans += b;
k -= a + 1;
} else
ans = k + 1, k = 0;
x = 0;
x = k / 2;
long long y = k & 1;
ans += x * (b - a);
ans += y;
}
printf("%lld", ans);
return 0;
}
| [] | 933,485 | 933,486 | u963610246 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
long long int k, a, b;
long long int ans = 0;
int main() {
cin >> k >> a >> b;
if (b - a <= 2 || k < a + 1) {
cout << k + 1 << endl;
return 0;
} else {
ans = (k - a + 1) / 2;
ans *= (b - a) + a;
}
if ((k - a + 1) % 2 == 1) {
ans++;
}
printf("%lld", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long int k, a, b;
long long int ans = 0;
int main() {
cin >> k >> a >> b;
if (b - a <= 2 || k < a + 1) {
cout << k + 1 << endl;
return 0;
} else {
ans = (k - a + 1) / 2;
ans *= (b - a);
ans += a;
}
if ((k - a + 1) % 2 == 1) {
ans++;
}
printf("%lld", ans);
return 0;
} | [
"expression.operation.binary.change",
"assignment.change"
] | 933,491 | 933,492 | u693953100 | cpp |
p03131 | #include <bits/stdc++.h>
using namespace std;
long long int k, a, b;
long long int ans = 0;
int main() {
cin >> k >> a >> b;
if (b - a <= 2 || k < a + 2) {
cout << k + 1 << endl;
return 0;
} else {
ans = (k - a + 1) / 2;
ans *= (b - a) + a;
}
if ((k - a + 1) % 2 == 1) {
ans++;
}
printf("%lld", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long int k, a, b;
long long int ans = 0;
int main() {
cin >> k >> a >> b;
if (b - a <= 2 || k < a + 1) {
cout << k + 1 << endl;
return 0;
} else {
ans = (k - a + 1) / 2;
ans *= (b - a);
ans += a;
}
if ((k - a + 1) % 2 == 1) {
ans++;
}
printf("%lld", ans);
return 0;
} | [
"literal.number.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change",
"assignment.change"
] | 933,493 | 933,492 | u693953100 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll count = 1;
ll memo = k;
if (k >= a - 1) {
if (b - a >= 2) {
if ((k - (a - 1)) % 2 == 0) {
cout << a + (k - (a - 1)) / 2 * (b - a);
} else {
cout << 1;
cout << a + (k - (a - 1)) / 2 * (b - a) + 1;
}
} else {
cout << 1 + k;
}
} else
cout << 1 + k;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll count = 1;
ll memo = k;
if (k >= a - 1) {
if (b - a >= 2) {
if ((k - (a - 1)) % 2 == 0) {
cout << a + (k - (a - 1)) / 2 * (b - a);
} else {
cout << a + (k - (a - 1)) / 2 * (b - a) + 1;
}
} else {
cout << 1 + k;
}
} else
cout << 1 + k;
return 0;
}
| [] | 933,498 | 933,499 | u536625271 | cpp |
p03131 | #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll count = 1;
ll memo = k;
if (k >= a - 1) {
if (b - a >= 2) {
if (k - (a - 1) % 2 == 0) {
cout << a + (k - (a - 1)) / 2 * (b - a);
} else {
cout << a + (k - (a - 1)) / 2 * (b - a) + 1;
}
} else {
cout << 1 + k;
}
} else
cout << 1 + k;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll k, a, b;
cin >> k >> a >> b;
ll count = 1;
ll memo = k;
if (k >= a - 1) {
if (b - a >= 2) {
if ((k - (a - 1)) % 2 == 0) {
cout << a + (k - (a - 1)) / 2 * (b - a);
} else {
cout << a + (k - (a - 1)) / 2 * (b - a) + 1;
}
} else {
cout << 1 + k;
}
} else
cout << 1 + k;
return 0;
}
| [
"control_flow.branch.if.condition.change"
] | 933,500 | 933,499 | u536625271 | cpp |
p03131 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
map<int, int> mp;
map<int, int> mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 2 > b) {
ll fc = a - 1;
ll cnt = 0;
if (fc + 2 >= k) {
cout << k + 1 << endl;
return 0;
}
cnt = b;
k -= fc + 2;
ll sum = b - a;
if (k % 2 == 0) {
cnt += sum * (k / 2);
cout << cnt << endl;
} else {
cnt += sum * (k / 2);
cout << cnt + 1 << endl;
}
} else {
cout << k + 1 << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
map<int, int> mp;
map<int, int> mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l
int main() {
ll k, a, b;
cin >> k >> a >> b;
if (a + 2 < b) {
ll fc = a - 1;
ll cnt = 0;
if (fc + 2 > k) {
cout << k + 1 << endl;
return 0;
}
cnt = b;
k -= fc + 2;
ll sum = b - a;
if (k % 2 == 0) {
cnt += sum * (k / 2);
cout << cnt << endl;
} else {
cnt += sum * (k / 2);
cout << cnt + 1 << endl;
}
} else {
cout << k + 1 << endl;
}
return 0;
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 933,503 | 933,504 | u154672915 | cpp |
p03131 | #include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;
const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int32_t main() {
// ios::sync_with_stdio(false); cin.tie(nullptr);
int k, a, b;
cin >> k >> a >> b;
if (b >= a + 2) {
k -= a;
if (k >= 1) {
int n = (k - 1) / 2;
int ans = n * (b - a);
ans += (k + 1) % 2;
cout << b + ans << "\n";
} else {
cout << 1 + k + (a + 1) << "\n";
}
} else {
cout << 1 + k << "\n";
}
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;
const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int32_t main() {
// ios::sync_with_stdio(false); cin.tie(nullptr);
int k, a, b;
cin >> k >> a >> b;
if (b >= a + 2) {
k -= a;
if (k >= 1) {
int n = (k - 1) / 2;
int ans = n * (b - a);
ans += (k + 1) % 2;
cout << b + ans << "\n";
} else {
cout << 1 + k + a << "\n";
}
} else {
cout << 1 + k << "\n";
}
return 0;
}
| [] | 933,508 | 933,509 | u192295874 | cpp |
p03131 | #include <iostream>
using namespace std;
typedef long long ll;
int main() {
ll K, A, B;
cin >> K >> A >> B;
if (K <= A) {
cout << K << endl;
return 0;
}
K++;
ll ans = A;
if (B - A > 2)
ans += (B - A) * ((K - A) / 2);
else
ans += 2 * ((K - A) / 2);
ans += (K - A) % 2;
cout << ans << endl;
return 0;
} | #include <iostream>
using namespace std;
typedef long long ll;
int main() {
ll K, A, B;
cin >> K >> A >> B;
if (K + 1 <= A) {
cout << K + 1 << endl;
return 0;
}
K++;
ll ans = A;
if (B - A > 2)
ans += (B - A) * ((K - A) / 2);
else
ans += 2 * ((K - A) / 2);
ans += (K - A) % 2;
cout << ans << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 933,510 | 933,511 | u134519179 | cpp |
p03131 | #include <iostream>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
long long int f = a - b + 1;
long long ans = 0;
if (c - b > 2) {
ans = (c - b) * (f / 2) + (f % 2);
} else {
ans = 1 + a;
}
cout << ans << endl;
}
| #include <iostream>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
long long int f = a - b + 1;
long long ans = 0;
if (c - b > 2) {
ans = (c - b) * (f / 2) + (f % 2) + b;
} else {
ans = 1 + a;
}
cout << ans << endl;
} | [
"assignment.change"
] | 933,516 | 933,517 | u179970156 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.