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 |
|---|---|---|---|---|---|---|---|
p03186 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c <= a + b - 1) {
cout << b + c << endl;
} else {
cout << b * 2 + a + 1 << endl;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c <= a + b + 1) {
cout << b + c << endl;
} else {
cout << b * 2 + a + 1 << endl;
}
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 988,001 | 988,002 | u234413973 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c <= a + b - 1) {
cout << a + b + c << endl;
} else {
cout << b * 2 + a + 1 << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c <= a + b + 1) {
cout << b + c << endl;
} else {
cout << b * 2 + a + 1 << endl;
}
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 988,003 | 988,002 | u234413973 | cpp |
p03186 | #include <bits/stdc++.h>
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
c = std::min(c, a + b);
printf("%d\n", c + b);
return 0;
}
| #include <bits/stdc++.h>
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
c = std::min(c, a + b + 1);
printf("%d\n", c + b);
return 0;
}
| [
"assignment.change"
] | 988,011 | 988,012 | u190597469 | cpp |
p03186 | #include <algorithm>
#include <cstdio>
using namespace std;
long long a, b, c;
int main() {
scanf("%lld%lld%lld", &a, &b, &c);
c = min(c, a + b);
printf("%lld\n", c + b);
return 0;
} | #include <algorithm>
#include <cstdio>
using namespace std;
long long a, b, c;
int main() {
scanf("%lld%lld%lld", &a, &b, &c);
c = min(c, a + b + 1);
printf("%lld\n", c + b);
return 0;
} | [
"assignment.change"
] | 988,016 | 988,017 | u955769217 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(a + b, c);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(a + b + 1, c);
return 0;
} | [
"expression.operation.binary.add"
] | 988,020 | 988,021 | u167330161 | cpp |
p03186 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define ll long long
#define pb(a) push_back(a)
#define pf(a) push_flont(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b - 1 >= c) {
cout << b + c << endl;
} else {
cout << b + (c - (c - (b + a)) + 1) << endl;
}
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define ll long long
#define pb(a) push_back(a)
#define pf(a) push_flont(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c - 1) {
cout << b + c << endl;
} else {
cout << b + (c - (c - (b + a)) + 1) << endl;
}
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 988,047 | 988,048 | u675512317 | cpp |
p03186 | #include <iostream>
using namespace std;
int main(void) {
int r, a, b, c;
cin >> a >> b >> c;
if (a + b < r)
r = a + b + 1;
else
r = c;
cout << b + r << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main(void) {
int r, a, b, c;
cin >> a >> b >> c;
if (a + b < c)
r = a + b + 1;
else
r = c;
cout << b + r << endl;
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 988,052 | 988,053 | u787420015 | cpp |
p03186 | #include <iostream>
using namespace std;
int main(void) {
int r, a, b, c;
cin >> a >> b >> c;
if (a + b < r)
r = a + b + 1;
else
r = a + b;
cout << b + r << endl;
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
int r, a, b, c;
cin >> a >> b >> c;
if (a + b < c)
r = a + b + 1;
else
r = c;
cout << b + r << endl;
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 988,054 | 988,053 | u787420015 | cpp |
p03186 | /*~~~~~~~~~~~~~~~~~ K++ code ~~~~~~~~~~~~~~~~~~~
in(a, b, c)
if(a+b+1 >= c) out(a+b)
else out(a+2*b+1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
;
;
;
;
int main() {
;
;
;
int a, b, c;
cin >> a >> b >> c;
;
if (a + b + 1 >= c) {
;
;
cout << (a + b) << endl;
;
;
} else {
;
;
cout << (a + 2 * b + 1) << endl;
;
;
};
;
} | /*~~~~~~~~~~~~~~~~~ K++ code ~~~~~~~~~~~~~~~~~~~
in(a, b, c)
if(a+b+1 >= c) out(b+c)
else out(a+2*b+1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
;
;
;
;
int main() {
;
;
;
int a, b, c;
cin >> a >> b >> c;
;
if (a + b + 1 >= c) {
;
;
cout << (b + c) << endl;
;
;
} else {
;
;
cout << (a + 2 * b + 1) << endl;
;
;
};
;
} | [
"expression.operation.binary.remove"
] | 988,057 | 988,058 | u657901243 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c, ans;
cin >> a >> b >> c;
ans = b;
if (a + b + 1 < c)
ans += b + 1;
else
ans += c;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c, ans;
cin >> a >> b >> c;
ans = b;
if (a + b + 1 < c)
ans += b + a + 1;
else
ans += c;
cout << ans << endl;
}
| [
"assignment.change"
] | 988,059 | 988,060 | u438621426 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (T &x : vec)
is >> x;
return is;
}
ll gcd(ll m, ll n) {
if ((0 == m) || (0 == n))
return 0;
while (m != n) {
if (m > n)
m = m - n;
else
n = n - m;
}
return m;
}
ll lcm(ll m, ll n) {
if ((0 == m) || (0 == n))
return 0;
return ((m / gcd(m, n)) * n);
}
int ctoi(const char c) {
if ('0' <= c && c <= '9')
return (c - '0');
return -1;
}
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b > c) {
cout << b + c << endl;
} else {
cout << b + (a + b + 1) << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (T &x : vec)
is >> x;
return is;
}
ll gcd(ll m, ll n) {
if ((0 == m) || (0 == n))
return 0;
while (m != n) {
if (m > n)
m = m - n;
else
n = n - m;
}
return m;
}
ll lcm(ll m, ll n) {
if ((0 == m) || (0 == n))
return 0;
return ((m / gcd(m, n)) * n);
}
int ctoi(const char c) {
if ('0' <= c && c <= '9')
return (c - '0');
return -1;
}
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c) {
cout << b + c << endl;
} else {
cout << b + (a + b + 1) << endl;
}
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,077 | 988,078 | u811528179 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c > a + b)
cout << a + b + b << endl;
else
cout << b + c << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c > a + b)
cout << a + b + b + 1 << endl;
else
cout << b + c << endl;
return 0;
}
| [
"expression.operation.binary.add"
] | 988,079 | 988,080 | u617525345 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
if (a + b >= c) {
printf("%lld", b + c);
} else if (a + b < c) {
printf("%lld", a + b + 3);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
if (a + b >= c) {
printf("%lld", b + c);
} else if (a + b < c) {
printf("%lld", a + b + b + 1);
}
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 988,083 | 988,084 | u858741867 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
if (a + b >= c) {
printf("%lld", b + c);
} else if (a + b < c) {
printf("%lld", a + b + 2);
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
if (a + b >= c) {
printf("%lld", b + c);
} else if (a + b < c) {
printf("%lld", a + b + b + 1);
}
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 988,085 | 988,084 | u858741867 | cpp |
p03186 | // g++ -std=c++11 a.cpp
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v) \
{ \
rep(_, v.size()) cout << " " << v[_]; \
cout << endl; \
}
#define show2d(v) \
{ rep(__, v.size()) show1d(v[__]); }
using namespace std;
// kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
#define mt make_tuple
typedef tuple<int, int, int, int> tp;
typedef vector<tp> vt;
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
// template<class C>constexpr int size(const C &c){return (int)c.size();}
// template<class T,size_t N> constexpr int size(const T
// (&xs)[N])noexcept{return (int)N;}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0}; // RDLU
signed main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b) << endl;
}
| // g++ -std=c++11 a.cpp
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v) \
{ \
rep(_, v.size()) cout << " " << v[_]; \
cout << endl; \
}
#define show2d(v) \
{ rep(__, v.size()) show1d(v[__]); }
using namespace std;
// kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
#define mt make_tuple
typedef tuple<int, int, int, int> tp;
typedef vector<tp> vt;
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
// template<class C>constexpr int size(const C &c){return (int)c.size();}
// template<class T,size_t N> constexpr int size(const T
// (&xs)[N])noexcept{return (int)N;}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0}; // RDLU
signed main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b + 1) << endl;
}
| [
"expression.operation.binary.add"
] | 988,088 | 988,089 | u010004797 | cpp |
p03186 | // g++ -std=c++11 a.cpp
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v) \
{ \
rep(_, v.size()) cout << " " << v[_]; \
cout << endl; \
}
#define show2d(v) \
{ rep(__, v.size()) show1d(v[__]); }
using namespace std;
// kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
#define mt make_tuple
typedef tuple<int, int, int, int> tp;
typedef vector<tp> vt;
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
// template<class C>constexpr int size(const C &c){return (int)c.size();}
// template<class T,size_t N> constexpr int size(const T
// (&xs)[N])noexcept{return (int)N;}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0}; // RDLU
signed main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b - 1) << endl;
}
| // g++ -std=c++11 a.cpp
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v) \
{ \
rep(_, v.size()) cout << " " << v[_]; \
cout << endl; \
}
#define show2d(v) \
{ rep(__, v.size()) show1d(v[__]); }
using namespace std;
// kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
#define mt make_tuple
typedef tuple<int, int, int, int> tp;
typedef vector<tp> vt;
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
// template<class C>constexpr int size(const C &c){return (int)c.size();}
// template<class T,size_t N> constexpr int size(const T
// (&xs)[N])noexcept{return (int)N;}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0}; // RDLU
signed main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b + 1) << endl;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change"
] | 988,090 | 988,089 | u010004797 | cpp |
p03186 | #include <algorithm>
#include <iostream>
int main(void) {
int a, b, c;
std::cin >> a >> b >> c;
std::cout << (a + b >= c ? b + c : a + 2 * b);
} | #include <algorithm>
#include <iostream>
int main(void) {
int a, b, c;
std::cin >> a >> b >> c;
std::cout << (a + b >= c ? b + c : a + 2 * b + 1);
} | [
"expression.operation.binary.add"
] | 988,091 | 988,092 | u343074849 | cpp |
p03186 | #include <bits/stdc++.h>
#define IL __inline__ __attribute__((always_inline))
#define For(i, a, b) for (int i = a, i##end = b; i <= i##end; ++i)
#define FOR(i, a, b) for (int i = a, i##end = b; i < i##end; ++i)
#define Rep(i, a, b) for (int i = a, i##end = b; i >= i##end; --i)
#define REP(i, a, b) for (int i = (a)-1, i##end = b; i >= i##end; --i)
typedef long long LL;
template <class T> IL bool chkmax(T &a, const T &b) {
return a < b ? ((a = b), 1) : 0;
}
template <class T> IL bool chkmin(T &a, const T &b) {
return a > b ? ((a = b), 1) : 0;
}
template <class T> IL T mymax(const T &a, const T &b) { return a > b ? a : b; }
template <class T> IL T mymin(const T &a, const T &b) { return a < b ? a : b; }
template <class T> IL T myabs(const T &a) { return a > 0 ? a : -a; }
const int INF = 0X3F3F3F3F;
const double EPS = 1E-10, PI = acos(-1.0);
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define OK DEBUG("Passing [%s] in LINE %d...\n", __FUNCTION__, __LINE__)
/*------------------------------header------------------------------*/
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
printf("%d\n", a + b >= c ? b + c : a + (b << 1));
return 0;
} | #include <bits/stdc++.h>
#define IL __inline__ __attribute__((always_inline))
#define For(i, a, b) for (int i = a, i##end = b; i <= i##end; ++i)
#define FOR(i, a, b) for (int i = a, i##end = b; i < i##end; ++i)
#define Rep(i, a, b) for (int i = a, i##end = b; i >= i##end; --i)
#define REP(i, a, b) for (int i = (a)-1, i##end = b; i >= i##end; --i)
typedef long long LL;
template <class T> IL bool chkmax(T &a, const T &b) {
return a < b ? ((a = b), 1) : 0;
}
template <class T> IL bool chkmin(T &a, const T &b) {
return a > b ? ((a = b), 1) : 0;
}
template <class T> IL T mymax(const T &a, const T &b) { return a > b ? a : b; }
template <class T> IL T mymin(const T &a, const T &b) { return a < b ? a : b; }
template <class T> IL T myabs(const T &a) { return a > 0 ? a : -a; }
const int INF = 0X3F3F3F3F;
const double EPS = 1E-10, PI = acos(-1.0);
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define OK DEBUG("Passing [%s] in LINE %d...\n", __FUNCTION__, __LINE__)
/*------------------------------header------------------------------*/
int main() {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
printf("%d\n", a + b >= c ? b + c : a + (b << 1) + 1);
return 0;
} | [
"expression.operation.binary.add"
] | 988,093 | 988,094 | u657272655 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
if (C <= A + B) {
cout << C + B << endl;
} else {
cout << A + B + B << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
if (C <= A + B) {
cout << C + B << endl;
} else {
cout << A + B + B + 1 << endl;
}
return 0;
} | [
"expression.operation.binary.add"
] | 988,097 | 988,098 | u449922162 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C, sum = 0;
cin >> A >> B >> C;
if (A + B > C - 1) {
sum = B + C;
} else {
sum = A + 2 * B;
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C, sum = 0;
cin >> A >> B >> C;
if (A + B > C - 1) {
sum = B + C;
} else {
sum = A + 2 * B + 1;
}
cout << sum << endl;
} | [
"assignment.change"
] | 988,101 | 988,102 | u216525464 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C, sum = 0;
cin >> A >> B >> C;
if (A + B > C) {
sum = B + C;
} else {
sum = A + 2 * B;
}
cout << sum << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C, sum = 0;
cin >> A >> B >> C;
if (A + B > C - 1) {
sum = B + C;
} else {
sum = A + 2 * B + 1;
}
cout << sum << endl;
} | [
"control_flow.branch.if.condition.change",
"assignment.change"
] | 988,103 | 988,102 | u216525464 | cpp |
p03186 | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main(void) {
int a, b, c;
cin >> a >> b >> c;
if (c >= a + b)
cout << b + min(a + b + 1, c) << "a\n";
else
cout << c + b << "b\n";
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main(void) {
int a, b, c;
cin >> a >> b >> c;
if (c >= a + b)
cout << b + min(a + b + 1, c) << "\n";
else
cout << c + b << "\n";
return 0;
} | [
"literal.string.change",
"io.output.change"
] | 988,104 | 988,105 | u217596176 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b <= c)
cout << a + b + 1 + b;
else
cout << c + b;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b < c)
cout << a + b + 1 + b;
else
cout << c + b;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,115 | 988,116 | u662665711 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
if (a + b > c) {
cout << b + c << endl;
} else {
cout << a + b + b + 1 << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
if (a + b + 1 >= c) {
cout << b + c << endl;
} else {
cout << a + b + b + 1 << endl;
}
} | [
"control_flow.branch.if.condition.change"
] | 988,125 | 988,126 | u952437626 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
if (a + b > c) {
cout << b + c << endl;
} else {
cout << a + b + b + 1 << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
if (a + b >= c) {
cout << b + c << endl;
} else {
cout << a + b + b + 1 << endl;
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,125 | 988,127 | u952437626 | cpp |
p03186 | /*
Converted by scratch2cpp (https://github.com/yos1up/scratch2cpp).
*/
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
#define debug \
cerr << "--" << __LINE__ << "--" \
<< "\n"
using namespace std;
const double EPS = 1e-8;
static int roundToInt(double x) {
return (x < 0) ? -(int)(-x + 0.5) : (int)(x + 0.5);
}
class Var { // NOTE: immutable
public:
string sval;
double dval;
enum VarType { STRING = 0, NUMBER = 1 };
VarType type;
enum NumericState { UNKNOWN = -1, STRINGY = 0, NUMERIC = 1 };
mutable NumericState numericState;
Var() {
sval = "";
type = STRING;
numericState = STRINGY;
} // represent null?
Var(string s) {
sval = s;
type = STRING;
numericState = UNKNOWN;
}
Var(double d) {
dval = d;
type = NUMBER;
numericState = NUMERIC;
}
Var(const Var &v) {
sval = string(v.sval);
dval = v.dval;
type = v.type;
numericState = v.numericState;
}
static bool isNumericString(const string &s) {
char *ep;
strtod(s.c_str(), &ep);
return !ep || !*ep;
// TODO: In Scratch '000' is regarded as non-numeric (but here regarded as
// numeric)
}
bool isNumeric() const {
if (type == NUMBER)
return true;
if (numericState != UNKNOWN)
return numericState == NUMERIC;
bool numeric = isNumericString(sval);
numericState = (numeric) ? NUMERIC : STRINGY;
return numeric;
}
double asNumber() const {
if (type == NUMBER)
return dval;
return (isNumeric()) ? atof(sval.c_str()) : 0.0;
}
static bool isNearInteger(const double &x) {
return fabs(round(x) - x) < EPS;
// TODO: allow integer type in Var class
}
static bool isNearNumber(const double &x, const double &y) {
return fabs(x - y) < EPS;
}
string asString() const {
if (type == STRING)
return sval;
if (isNearInteger(dval))
return to_string(roundToInt(dval));
return to_string(dval);
}
Var operator+(const Var &y) const {
return Var(this->asNumber() + y.asNumber());
}
Var operator+=(const Var &y) {
*this = *this + y;
return *this;
}
Var operator-(const Var &y) const {
return Var(this->asNumber() - y.asNumber());
}
Var operator*(const Var &y) const {
return Var(this->asNumber() * y.asNumber());
}
Var operator/(const Var &y) const {
return Var(this->asNumber() / y.asNumber());
}
Var operator%(const Var &y) const {
return Var(fmod(this->asNumber(), y.asNumber()));
}
bool operator<(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() < y.asNumber();
} // compare as number if both can be interpreted as numeric
return this->asString() < y.asString();
}
bool operator>(const Var &y) const { return y < *this; }
bool operator==(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() == y.asNumber();
} // compare as numeric if both are numeric
return this->asString() == y.asString();
}
friend ostream &operator<<(ostream &os, const Var &p);
friend istream &operator>>(istream &is, const Var &p);
};
ostream &operator<<(ostream &os, const Var &p) {
os << p.asString();
return os;
}
istream &operator>>(istream &is, Var &p) {
string s;
is >> s;
p = Var(s);
return is;
}
Var letterOf(Var index, Var sourceString) {
/* index: 1-origined */
string str = sourceString.asString();
int idx = (int)(index.asNumber() - 1);
// seem to be dirty but Scratch seems to do like this.
// ex. letterOf(0.01, "world") == "w", letterOf(1.99, "world") == "w",
// letterOf(5.99, "world") == "d"
if (0 <= idx && idx < str.size())
return Var(str.substr(idx, 1));
return Var();
}
class VarList {
public:
vector<Var> data;
VarList(const vector<Var> &x) { data = x; }
void push_back(const Var &x) { data.push_back(x); }
void pop_back() { data.pop_back(); }
void clear() { data.clear(); }
int size() { return (int)data.size(); }
Var getLineOfList(const Var &index) const {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
// (unlike 'letterOf', index==0.9 does not work.)
if (0 <= idx && idx < data.size())
return data[idx];
return Var();
}
void setLineOfListTo(const Var &index, const Var &v) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data[idx] = v;
}
void deleteLineOfList(const Var &index) {
/* index: 1-origined */
string kwd = index.asString();
if (kwd == "all") {
data.clear();
} else if (kwd == "last") {
data.pop_back();
} else {
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data.erase(data.begin() + idx);
}
}
void insertAtIndexOfList(const Var &item, const Var &index) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx <= data.size())
data.insert(data.begin() + idx, item);
}
void insertAtRandomOfList(const Var &item) {
int idx = rand() % (data.size() + 1);
data.insert(data.begin() + idx, item);
}
string asString() const {
/* concatenate elements of list with space */
// TODO: concatenated without spaces only if all elements are single
// characters. (Is it an official bug? (or feature?))
string ret;
for (int i = 0; i < data.size(); i++) {
if (i > 0)
ret += ' ';
ret += data[i].asString();
}
return ret;
}
int itemNumOfList(const Var &item) const {
auto itr = find(data.begin(), data.end(), item);
if (itr == data.end())
return 0;
return 1 + (int)(itr - data.begin());
/* index: 1-origined */
}
friend ostream &operator<<(ostream &os, const VarList &p);
};
ostream &operator<<(ostream &os, const VarList &p) {
os << p.asString();
return os;
}
double randUniform(double x, double y) {
if (x > y)
return randUniform(y, x);
if (Var::isNearInteger(x) && Var::isNearInteger(y)) {
int xi = roundToInt(x), yi = roundToInt(y);
return xi + rand() % (yi - xi + 1);
} else {
return x + (y - x) * (0.0 + rand()) / RAND_MAX;
}
}
Var buf_answer; // for "answer"
// ============================= Scripts =============================
// variable declaration
Var var_A(8);
Var var_B(8);
Var var_C(1);
// list declaration
// prototype declaration of functions
int main();
int func_init();
int func_main();
// contents of functions
int main() {
func_init();
cin >> buf_answer;
var_A = buf_answer;
cin >> buf_answer;
var_B = buf_answer;
cin >> buf_answer;
var_C = buf_answer;
func_main();
return 0;
}
int func_init() { return 0; }
int func_main() {
if (((var_A + var_B) > var_C)) {
cout << (var_A + var_C) << endl;
return 0;
}
if (((var_A + var_B) == var_C)) {
cout << ((Var(2) * var_B) + var_A) << endl;
return 0;
}
cout << (((Var(2) * var_B) + var_A) + Var(1)) << endl;
return 0;
return 0;
}
| /*
Converted by scratch2cpp (https://github.com/yos1up/scratch2cpp).
*/
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
#define debug \
cerr << "--" << __LINE__ << "--" \
<< "\n"
using namespace std;
const double EPS = 1e-8;
static int roundToInt(double x) {
return (x < 0) ? -(int)(-x + 0.5) : (int)(x + 0.5);
}
class Var { // NOTE: immutable
public:
string sval;
double dval;
enum VarType { STRING = 0, NUMBER = 1 };
VarType type;
enum NumericState { UNKNOWN = -1, STRINGY = 0, NUMERIC = 1 };
mutable NumericState numericState;
Var() {
sval = "";
type = STRING;
numericState = STRINGY;
} // represent null?
Var(string s) {
sval = s;
type = STRING;
numericState = UNKNOWN;
}
Var(double d) {
dval = d;
type = NUMBER;
numericState = NUMERIC;
}
Var(const Var &v) {
sval = string(v.sval);
dval = v.dval;
type = v.type;
numericState = v.numericState;
}
static bool isNumericString(const string &s) {
char *ep;
strtod(s.c_str(), &ep);
return !ep || !*ep;
// TODO: In Scratch '000' is regarded as non-numeric (but here regarded as
// numeric)
}
bool isNumeric() const {
if (type == NUMBER)
return true;
if (numericState != UNKNOWN)
return numericState == NUMERIC;
bool numeric = isNumericString(sval);
numericState = (numeric) ? NUMERIC : STRINGY;
return numeric;
}
double asNumber() const {
if (type == NUMBER)
return dval;
return (isNumeric()) ? atof(sval.c_str()) : 0.0;
}
static bool isNearInteger(const double &x) {
return fabs(round(x) - x) < EPS;
// TODO: allow integer type in Var class
}
static bool isNearNumber(const double &x, const double &y) {
return fabs(x - y) < EPS;
}
string asString() const {
if (type == STRING)
return sval;
if (isNearInteger(dval))
return to_string(roundToInt(dval));
return to_string(dval);
}
Var operator+(const Var &y) const {
return Var(this->asNumber() + y.asNumber());
}
Var operator+=(const Var &y) {
*this = *this + y;
return *this;
}
Var operator-(const Var &y) const {
return Var(this->asNumber() - y.asNumber());
}
Var operator*(const Var &y) const {
return Var(this->asNumber() * y.asNumber());
}
Var operator/(const Var &y) const {
return Var(this->asNumber() / y.asNumber());
}
Var operator%(const Var &y) const {
return Var(fmod(this->asNumber(), y.asNumber()));
}
bool operator<(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() < y.asNumber();
} // compare as number if both can be interpreted as numeric
return this->asString() < y.asString();
}
bool operator>(const Var &y) const { return y < *this; }
bool operator==(const Var &y) const {
if (this->isNumeric() && y.isNumeric()) {
return this->asNumber() == y.asNumber();
} // compare as numeric if both are numeric
return this->asString() == y.asString();
}
friend ostream &operator<<(ostream &os, const Var &p);
friend istream &operator>>(istream &is, const Var &p);
};
ostream &operator<<(ostream &os, const Var &p) {
os << p.asString();
return os;
}
istream &operator>>(istream &is, Var &p) {
string s;
is >> s;
p = Var(s);
return is;
}
Var letterOf(Var index, Var sourceString) {
/* index: 1-origined */
string str = sourceString.asString();
int idx = (int)(index.asNumber() - 1);
// seem to be dirty but Scratch seems to do like this.
// ex. letterOf(0.01, "world") == "w", letterOf(1.99, "world") == "w",
// letterOf(5.99, "world") == "d"
if (0 <= idx && idx < str.size())
return Var(str.substr(idx, 1));
return Var();
}
class VarList {
public:
vector<Var> data;
VarList(const vector<Var> &x) { data = x; }
void push_back(const Var &x) { data.push_back(x); }
void pop_back() { data.pop_back(); }
void clear() { data.clear(); }
int size() { return (int)data.size(); }
Var getLineOfList(const Var &index) const {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
// (unlike 'letterOf', index==0.9 does not work.)
if (0 <= idx && idx < data.size())
return data[idx];
return Var();
}
void setLineOfListTo(const Var &index, const Var &v) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data[idx] = v;
}
void deleteLineOfList(const Var &index) {
/* index: 1-origined */
string kwd = index.asString();
if (kwd == "all") {
data.clear();
} else if (kwd == "last") {
data.pop_back();
} else {
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx < data.size())
data.erase(data.begin() + idx);
}
}
void insertAtIndexOfList(const Var &item, const Var &index) {
/* index: 1-origined */
int idx = (int)index.asNumber() - 1;
if (0 <= idx && idx <= data.size())
data.insert(data.begin() + idx, item);
}
void insertAtRandomOfList(const Var &item) {
int idx = rand() % (data.size() + 1);
data.insert(data.begin() + idx, item);
}
string asString() const {
/* concatenate elements of list with space */
// TODO: concatenated without spaces only if all elements are single
// characters. (Is it an official bug? (or feature?))
string ret;
for (int i = 0; i < data.size(); i++) {
if (i > 0)
ret += ' ';
ret += data[i].asString();
}
return ret;
}
int itemNumOfList(const Var &item) const {
auto itr = find(data.begin(), data.end(), item);
if (itr == data.end())
return 0;
return 1 + (int)(itr - data.begin());
/* index: 1-origined */
}
friend ostream &operator<<(ostream &os, const VarList &p);
};
ostream &operator<<(ostream &os, const VarList &p) {
os << p.asString();
return os;
}
double randUniform(double x, double y) {
if (x > y)
return randUniform(y, x);
if (Var::isNearInteger(x) && Var::isNearInteger(y)) {
int xi = roundToInt(x), yi = roundToInt(y);
return xi + rand() % (yi - xi + 1);
} else {
return x + (y - x) * (0.0 + rand()) / RAND_MAX;
}
}
Var buf_answer; // for "answer"
// ============================= Scripts =============================
// variable declaration
Var var_A(8);
Var var_B(8);
Var var_C(1);
// list declaration
// prototype declaration of functions
int main();
int func_init();
int func_main();
// contents of functions
int main() {
func_init();
cin >> buf_answer;
var_A = buf_answer;
cin >> buf_answer;
var_B = buf_answer;
cin >> buf_answer;
var_C = buf_answer;
func_main();
return 0;
}
int func_init() { return 0; }
int func_main() {
if (((var_A + var_B) > var_C)) {
cout << (var_B + var_C) << endl;
return 0;
}
if (((var_A + var_B) == var_C)) {
cout << ((Var(2) * var_B) + var_A) << endl;
return 0;
}
cout << (((Var(2) * var_B) + var_A) + Var(1)) << endl;
return 0;
return 0;
}
| [
"identifier.change",
"io.output.change"
] | 988,128 | 988,129 | u451598761 | cpp |
p03186 | #include <bits/stdc++.h>
int main(void) {
int a, b, c;
std::cin >> a >> b >> c;
std::cout << (c <= a + b ? b + c : a + 2 * b) << std::endl;
return 0;
} | #include <bits/stdc++.h>
int main(void) {
int a, b, c;
std::cin >> a >> b >> c;
std::cout << (c <= a + b ? b + c : a + 2 * b + 1) << std::endl;
return 0;
} | [
"expression.operation.binary.add"
] | 988,132 | 988,133 | u617380180 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
if (b + a < c)
cout << 2 * b + a;
else
cout << b + c;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
if (b + a < c)
cout << 2 * b + a + 1;
else
cout << b + c;
} | [
"expression.operation.binary.add"
] | 988,145 | 988,146 | u511401499 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
LL A, B, C;
cin >> A >> B >> C;
if (A + B >= C)
cout << B + C << endl;
else
cout << A + 2 * B << endl;
} | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
LL A, B, C;
cin >> A >> B >> C;
if (A + B >= C)
cout << B + C << endl;
else
cout << A + 2 * B + 1 << endl;
} | [
"expression.operation.binary.add"
] | 988,156 | 988,157 | u149468221 | cpp |
p03186 | #include <iostream>
typedef long long ll;
int main() {
ll A, B, C;
std::cin >> A >> B >> C;
std::cout << B + (A + B > C ? C : A + B + 1) << std::endl;
return 0;
}
| #include <iostream>
typedef long long ll;
int main() {
ll A, B, C;
std::cin >> A >> B >> C;
std::cout << B + (A + B >= C ? C : A + B + 1) << std::endl;
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 988,158 | 988,159 | u047150897 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
int ans = 0;
if (A + B > C) {
ans = B + C;
} else {
ans = (A + B + 1) + B;
}
cout << ans << endl;
} | #include <iostream>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
int ans = 0;
if (A + B >= C - 1) {
ans = B + C;
} else {
ans = (A + B + 1) + B;
}
cout << ans << endl;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,160 | 988,161 | u128142352 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
if (A + B + 1 <= C)
cout << (B + C) << endl;
else
cout << B + (A + B) + 1 << endl;
return 0;
} | #include <iostream>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
if (A + B + 1 >= C)
cout << (B + C) << endl;
else
cout << B + (A + B) + 1 << endl;
return 0;
} | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,169 | 988,170 | u973997867 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c;
else
cout << a + b + 1;
return 0;
} | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c;
else
cout << a + b + 1 + b;
return 0;
} | [
"expression.operation.binary.add"
] | 988,171 | 988,172 | u863104798 | cpp |
p03186 | #include <iostream>
int main() {
int A, B, C;
std::cin >> A >> B >> C;
if (A + B > C) {
std::cout << (B + C);
} else {
std::cout << (A + 2 * B);
}
return 0;
}
| #include <iostream>
int main() {
int A, B, C;
std::cin >> A >> B >> C;
if (A + B >= C) {
std::cout << (B + C);
} else {
std::cout << (A + 2 * B + 1);
}
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,175 | 988,176 | u261279477 | cpp |
p03186 | #include <iostream>
int main() {
int A, B, C;
std::cin >> A >> B >> C;
if (A + B >= C) {
std::cout << (B + C);
} else {
std::cout << 2 * B;
}
return 0;
}
| #include <iostream>
int main() {
int A, B, C;
std::cin >> A >> B >> C;
if (A + B >= C) {
std::cout << (B + C);
} else {
std::cout << (A + 2 * B + 1);
}
return 0;
}
| [] | 988,177 | 988,176 | u261279477 | cpp |
p03186 | #include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <random>
#include <thread>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#define MAY_RUN_TESTCASE
#else
#define dump(x)
#endif
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin())
os << ",";
os << *it;
}
return os << "}";
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &v) {
os << "{";
os << v.first << ", " << v.second;
return os << "}";
}
// ---------------------------------------------------------------------------
using point = complex<double>;
using ll = int64_t;
int my_main(int argc, char **argv) {
ios::sync_with_stdio(false);
cin.tie(0);
ll a, b, c;
cin >> a >> b >> c;
cout << b + max(c, a + b + 1) << std::endl;
return 0;
}
// ----------------------------------------------------------------------------
// Test driver
#ifdef MAY_RUN_TESTCASE
#include <filesystem>
#include <fstream>
#include <io.h>
#endif
int main(int argc, char **argv) {
#ifndef MAY_RUN_TESTCASE
return my_main(argc, argv);
#else
if (argc == 1) {
return my_main(argc, argv);
} else if (argc == 2) {
char *stdin_file = argv[1];
freopen(stdin_file, "r", stdin);
return my_main(argc, argv);
} else if (argc == 5) {
std::string stdin_file = argv[1];
std::string expected_file = argv[2];
std::string stdout_file = argv[3];
std::string stderr_file = argv[4];
if (!std::filesystem::exists(stdin_file)) {
std::cerr << stdin_file << " not found" << std::endl;
return 3;
}
if (!std::filesystem::exists(expected_file)) {
std::cerr << expected_file << " not found" << std::endl;
return 3;
}
int original_stdin = _dup(_fileno(stdin));
int original_stdout = _dup(_fileno(stdout));
int original_stderr = _dup(_fileno(stderr));
freopen(stdin_file.c_str(), "r", stdin);
freopen(stdout_file.c_str(), "w", stdout);
freopen(stderr_file.c_str(), "w", stderr);
int ret = my_main(argc, argv);
fflush(stdout);
fflush(stderr);
_dup2(original_stderr, _fileno(stderr));
_dup2(original_stdout, _fileno(stdout));
_dup2(original_stdin, _fileno(stdin));
if (ret != 0) {
std::cerr << "main returns " << ret << std::endl;
return ret;
}
std::ifstream inp(stdin_file);
std::ifstream out(stdout_file);
std::ifstream err(stderr_file);
std::ifstream exp(expected_file);
// Clear is needed if the file is empty.
std::cout << "----- input -----" << std::endl;
std::cout << inp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- output ----" << std::endl;
std::cout << out.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "---- expected ---" << std::endl;
std::cout << exp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- stderr ----" << std::endl;
std::cout << err.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
inp.seekg(0);
out.seekg(0);
exp.seekg(0);
err.seekg(0);
std::string output_str, expected_str;
{
std::stringstream output_ss;
output_ss << out.rdbuf();
output_str = output_ss.str();
std::stringstream expected_ss;
expected_ss << exp.rdbuf();
expected_str = expected_ss.str();
}
// Remove trailing spaces
output_str.erase(output_str.find_last_not_of(" \n\r\t") + 1);
expected_str.erase(expected_str.find_last_not_of(" \n\r\t") + 1);
if (output_str == expected_str) {
std::cerr << "OK" << std::endl;
return 0;
} else {
std::cerr << "Fail" << std::endl;
return 1;
}
}
return 1;
#endif
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <random>
#include <thread>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#define MAY_RUN_TESTCASE
#else
#define dump(x)
#endif
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin())
os << ",";
os << *it;
}
return os << "}";
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &v) {
os << "{";
os << v.first << ", " << v.second;
return os << "}";
}
// ---------------------------------------------------------------------------
using point = complex<double>;
using ll = int64_t;
int my_main(int argc, char **argv) {
ios::sync_with_stdio(false);
cin.tie(0);
ll a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b + 1) << std::endl;
return 0;
}
// ----------------------------------------------------------------------------
// Test driver
#ifdef MAY_RUN_TESTCASE
#include <filesystem>
#include <fstream>
#include <io.h>
#endif
int main(int argc, char **argv) {
#ifndef MAY_RUN_TESTCASE
return my_main(argc, argv);
#else
if (argc == 1) {
return my_main(argc, argv);
} else if (argc == 2) {
char *stdin_file = argv[1];
freopen(stdin_file, "r", stdin);
return my_main(argc, argv);
} else if (argc == 5) {
std::string stdin_file = argv[1];
std::string expected_file = argv[2];
std::string stdout_file = argv[3];
std::string stderr_file = argv[4];
if (!std::filesystem::exists(stdin_file)) {
std::cerr << stdin_file << " not found" << std::endl;
return 3;
}
if (!std::filesystem::exists(expected_file)) {
std::cerr << expected_file << " not found" << std::endl;
return 3;
}
int original_stdin = _dup(_fileno(stdin));
int original_stdout = _dup(_fileno(stdout));
int original_stderr = _dup(_fileno(stderr));
freopen(stdin_file.c_str(), "r", stdin);
freopen(stdout_file.c_str(), "w", stdout);
freopen(stderr_file.c_str(), "w", stderr);
int ret = my_main(argc, argv);
fflush(stdout);
fflush(stderr);
_dup2(original_stderr, _fileno(stderr));
_dup2(original_stdout, _fileno(stdout));
_dup2(original_stdin, _fileno(stdin));
if (ret != 0) {
std::cerr << "main returns " << ret << std::endl;
return ret;
}
std::ifstream inp(stdin_file);
std::ifstream out(stdout_file);
std::ifstream err(stderr_file);
std::ifstream exp(expected_file);
// Clear is needed if the file is empty.
std::cout << "----- input -----" << std::endl;
std::cout << inp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- output ----" << std::endl;
std::cout << out.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "---- expected ---" << std::endl;
std::cout << exp.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
std::cout << "----- stderr ----" << std::endl;
std::cout << err.rdbuf() << std::endl;
std::cout.clear();
std::cout << "-----------------" << std::endl << std::endl;
inp.seekg(0);
out.seekg(0);
exp.seekg(0);
err.seekg(0);
std::string output_str, expected_str;
{
std::stringstream output_ss;
output_ss << out.rdbuf();
output_str = output_ss.str();
std::stringstream expected_ss;
expected_ss << exp.rdbuf();
expected_str = expected_ss.str();
}
// Remove trailing spaces
output_str.erase(output_str.find_last_not_of(" \n\r\t") + 1);
expected_str.erase(expected_str.find_last_not_of(" \n\r\t") + 1);
if (output_str == expected_str) {
std::cerr << "OK" << std::endl;
return 0;
} else {
std::cerr << "Fail" << std::endl;
return 1;
}
}
return 1;
#endif
}
| [
"misc.opposites",
"identifier.change",
"call.function.change",
"io.output.change"
] | 988,181 | 988,182 | u419874471 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
template <typename A, typename B> inline void chmin(A &a, B b) {
if (a > b)
a = b;
}
template <typename A, typename B> inline void chmax(A &a, B b) {
if (a < b)
a = b;
}
signed main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c << endl;
else
cout << 2 * b + a << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
template <typename A, typename B> inline void chmin(A &a, B b) {
if (a > b)
a = b;
}
template <typename A, typename B> inline void chmax(A &a, B b) {
if (a < b)
a = b;
}
signed main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c << endl;
else
cout << 2 * b + a + 1 << endl;
return 0;
}
| [
"expression.operation.binary.add"
] | 988,183 | 988,184 | u685892567 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
template <typename A, typename B> inline void chmin(A &a, B b) {
if (a > b)
a = b;
}
template <typename A, typename B> inline void chmax(A &a, B b) {
if (a < b)
a = b;
}
signed main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c << endl;
else
cout << a + b << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
template <typename A, typename B> inline void chmin(A &a, B b) {
if (a > b)
a = b;
}
template <typename A, typename B> inline void chmax(A &a, B b) {
if (a < b)
a = b;
}
signed main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c << endl;
else
cout << 2 * b + a + 1 << endl;
return 0;
}
| [
"identifier.replace.remove",
"literal.replace.add",
"io.output.change"
] | 988,185 | 988,184 | u685892567 | cpp |
p03186 | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if ((a + b) >= c) {
printf("%d", b + c);
} else
printf("%d", a + b + 1);
return 0;
} | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if ((a + b) >= c) {
printf("%d", b + c);
} else
printf("%d", a + (2 * b) + 1);
return 0;
} | [
"call.arguments.change"
] | 988,188 | 988,189 | u234221995 | cpp |
p03186 | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if ((a + b) >= c) {
printf("%d", a + c);
} else
printf("%d", a + b + 1);
return 0;
} | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if ((a + b) >= c) {
printf("%d", b + c);
} else
printf("%d", a + (2 * b) + 1);
return 0;
} | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 988,190 | 988,189 | u234221995 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
cout << min(c, a + b) + b << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b, c;
cin >> a >> b >> c;
cout << min(c, a + b + 1) + b << endl;
return 0;
} | [
"expression.operation.binary.add",
"control_flow.return.add",
"control_flow.return.0.add"
] | 988,191 | 988,192 | u304382419 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#define ll long long
#define rint register int
using namespace std;
inline char get() {
const int TOP = 1000000;
static char T[TOP], *x = T, *y = T;
return x == y && (y = (x = T) + fread(T, 1, TOP, stdin), x == y) ? EOF : *x++;
}
inline int read() {
register int num, sign = 1;
register char c;
while (((c = get()) < '0' || c > '9') && c != '-')
;
c == '-' ? num = sign = 0 : num = c - 48;
while ((c = get()) >= '0' && c <= '9')
num = (num << 3) + (num << 1) + (c - 48);
return sign ? num : -num;
}
int a, b, c;
int main() {
a = read();
b = read();
c = read();
printf("%d\n", min(a + b, c) + b);
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#define ll long long
#define rint register int
using namespace std;
inline char get() {
const int TOP = 1000000;
static char T[TOP], *x = T, *y = T;
return x == y && (y = (x = T) + fread(T, 1, TOP, stdin), x == y) ? EOF : *x++;
}
inline int read() {
register int num, sign = 1;
register char c;
while (((c = get()) < '0' || c > '9') && c != '-')
;
c == '-' ? num = sign = 0 : num = c - 48;
while ((c = get()) >= '0' && c <= '9')
num = (num << 3) + (num << 1) + (c - 48);
return sign ? num : -num;
}
int a, b, c;
int main() {
a = read();
b = read();
c = read();
printf("%d\n", min(a + b + 1, c) + b);
} | [
"expression.operation.binary.add"
] | 988,193 | 988,194 | u737715937 | cpp |
p03186 | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int a, b, c;
scanf("%d%d%d", &b, &a, &c);
cout << a + min(a + b, c);
} | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int a, b, c;
scanf("%d%d%d", &b, &a, &c);
cout << a + min(a + b + 1, c);
} | [
"expression.operation.binary.add"
] | 988,195 | 988,196 | u076546810 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int d = min(c, a + b + 1);
cout << d + c << endl;
} | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int d = min(c, a + b + 1);
cout << b + d << endl;
} | [
"identifier.change",
"io.output.change"
] | 988,199 | 988,200 | u838457874 | cpp |
p03186 | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b - 1 >= c) {
printf("%d\n", b + c);
} else {
printf("%d\n", b * 2 + a + 1);
}
return 0;
}
| #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b >= c) {
printf("%d\n", b + c);
} else {
printf("%d\n", b * 2 + a + 1);
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 988,201 | 988,202 | u375132909 | cpp |
p03186 | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b - 1 >= c) {
printf("%d", b + c);
} else {
printf("%d\n", b * 2 + a + 1);
}
return 0;
}
| #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b >= c) {
printf("%d\n", b + c);
} else {
printf("%d\n", b * 2 + a + 1);
}
return 0;
}
| [
"expression.operation.binary.remove",
"literal.string.change",
"call.arguments.change",
"io.output.change",
"io.output.newline.add"
] | 988,203 | 988,202 | u375132909 | cpp |
p03186 | #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b - 1 >= c) {
printf("%d", a + c);
} else {
printf("%d\n", a * 2 + b + 1);
}
return 0;
}
| #include <stdio.h>
int main(void) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b >= c) {
printf("%d\n", b + c);
} else {
printf("%d\n", b * 2 + a + 1);
}
return 0;
}
| [
"expression.operation.binary.remove",
"literal.string.change",
"call.arguments.change",
"io.output.change",
"io.output.newline.add",
"identifier.change",
"expression.operation.binary.change"
] | 988,204 | 988,202 | u375132909 | cpp |
p03186 | #include <iostream>
#include <string>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int tmp = 2 * (a + b) + 1;
if (tmp > c)
cout << b + c << endl;
else
cout << a + 2 * b + 1 << endl;
} | #include <iostream>
#include <string>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int tmp = (a + b) + 1;
if (tmp > c)
cout << b + c << endl;
else
cout << a + 2 * b + 1 << endl;
} | [
"expression.operation.binary.remove"
] | 988,211 | 988,212 | u949755084 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define MOD 1e9 + 7
ll INF = 1e15;
#define lb lower_bound
#define ub upper_bound
#define SZ(x) (ll) x.size()
#define ALL(x) x.begin(), x.end()
ll a, b, c;
int main() {
cin >> a >> b >> c;
cout << b + min(a + 1, c);
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define MOD 1e9 + 7
ll INF = 1e15;
#define lb lower_bound
#define ub upper_bound
#define SZ(x) (ll) x.size()
#define ALL(x) x.begin(), x.end()
ll a, b, c;
int main() {
cin >> a >> b >> c;
cout << b + min(a + b + 1, c);
} | [
"expression.operation.binary.add"
] | 988,218 | 988,219 | u938024002 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if ((a + b) < c) {
cout << a + (2 * b) << endl;
} else
cout << b + c << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if ((a + b) < c) {
cout << a + (2 * b) + 1 << endl;
} else
cout << b + c << endl;
}
| [
"expression.operation.binary.add"
] | 988,220 | 988,221 | u020296964 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b < c) {
cout << a + 2 * b << endl;
} else
cout << b + c << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if ((a + b) < c) {
cout << a + (2 * b) + 1 << endl;
} else
cout << b + c << endl;
}
| [
"control_flow.branch.if.condition.change"
] | 988,222 | 988,221 | u020296964 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int s;
if (c > a + b) {
s = b + a + b + 1;
} else if (c = a + b) {
s = a + 2 * b;
} else {
s = c + b;
}
cout << s << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int s;
if (c > a + b) {
s = b + a + b + 1;
} else if (c == a + b) {
s = a + 2 * b;
} else {
s = c + b;
}
cout << s << endl;
} | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 988,225 | 988,226 | u319783732 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c - 1)
cout << b + c;
else
cout << a + b + 1;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c - 1)
cout << b + c;
else
cout << a + 2 * b + 1;
} | [
"expression.operation.binary.add"
] | 988,241 | 988,242 | u005899600 | cpp |
p03186 | #include <algorithm>
#include <assert.h>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = min(c, a + b);
ans += b;
cout << ans;
} | #include <algorithm>
#include <assert.h>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = min(c, a + b + 1);
ans += b;
cout << ans;
} | [
"assignment.change"
] | 988,251 | 988,252 | u937608388 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
cout << min(B + C, B + A + 1) << '\n';
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
cout << B + min(C, B + A + 1) << '\n';
return 0;
}
| [
"call.remove",
"call.add"
] | 988,253 | 988,254 | u570944601 | cpp |
p03186 | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long long int a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
long long int ans = b;
if (c >= a + b + 1)
ans += a + b + 1;
else
ans += c;
printf("%lld\n", c);
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long long int a, b, c;
scanf("%lld %lld %lld", &a, &b, &c);
long long int ans = b;
if (c >= a + b + 1)
ans += a + b + 1;
else
ans += c;
printf("%lld\n", ans);
return 0;
} | [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 988,255 | 988,256 | u092002408 | cpp |
p03186 | #define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include <bits/stdc++.h>
using namespace std;
#define hi cerr << "hi" << endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v, n) (v).count(n) ? v[n]++ : v[n] = 1
#define sysp system("pause")
#define PI acos(-1)
//{
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class... A> inline void dump() { cout << endl; }
template <class... A> inline void dump_rest() { cout << endl; }
template <class T, class... A>
inline void dump_rest(const T &first, const A &...rest) {
cout << dump_interval << first;
dump_rest(rest...);
}
template <class T, class... A>
inline void dump(const T &first, const A &...rest) {
cout << first;
dump_rest(rest...);
}
template <class... A> inline void debug() { cerr << endl; }
template <class... A> inline void debug_rest() { cerr << endl; }
template <class T, class... A>
inline void debug_rest(const T &first, const A &...rest) {
cerr << debug_interval << first;
debug_rest(rest...);
}
template <class T, class... A>
inline void debug(const T &first, const A &...rest) {
if (debug_toggle)
cerr << first, debug_rest(rest...);
}
//}
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
template <typename A, typename B> inline void chmin(A &a, B b) {
if (a > b)
a = b;
}
template <typename A, typename B> inline void chmax(A &a, B b) {
if (a < b)
a = b;
}
template <int m> class mint {
private:
int i;
public:
mint() : i(0) {}
mint(int i) : i((i % m + m) % m) {}
mint operator+(const mint &o) { return o.i + i; }
mint operator*(const mint &o) { return o.i * i; }
mint operator-() { return -i; }
operator int() { return i; }
};
int a, b, c;
int ans;
main() {
cin >> a >> b >> c;
int m = a + b;
debug(min(m + b + 1, b + c));
}
| #define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include <bits/stdc++.h>
using namespace std;
#define hi cerr << "hi" << endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v, n) (v).count(n) ? v[n]++ : v[n] = 1
#define sysp system("pause")
#define PI acos(-1)
//{
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
template <class... A> inline void dump() { cout << endl; }
template <class... A> inline void dump_rest() { cout << endl; }
template <class T, class... A>
inline void dump_rest(const T &first, const A &...rest) {
cout << dump_interval << first;
dump_rest(rest...);
}
template <class T, class... A>
inline void dump(const T &first, const A &...rest) {
cout << first;
dump_rest(rest...);
}
template <class... A> inline void debug() { cerr << endl; }
template <class... A> inline void debug_rest() { cerr << endl; }
template <class T, class... A>
inline void debug_rest(const T &first, const A &...rest) {
cerr << debug_interval << first;
debug_rest(rest...);
}
template <class T, class... A>
inline void debug(const T &first, const A &...rest) {
if (debug_toggle)
cerr << first, debug_rest(rest...);
}
//}
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<pint> vpint;
template <typename A, typename B> inline void chmin(A &a, B b) {
if (a > b)
a = b;
}
template <typename A, typename B> inline void chmax(A &a, B b) {
if (a < b)
a = b;
}
template <int m> class mint {
private:
int i;
public:
mint() : i(0) {}
mint(int i) : i((i % m + m) % m) {}
mint operator+(const mint &o) { return o.i + i; }
mint operator*(const mint &o) { return o.i * i; }
mint operator-() { return -i; }
operator int() { return i; }
};
int a, b, c;
int ans;
main() {
cin >> a >> b >> c;
int m = a + b;
dump(min(m + b + 1, b + c));
}
| [
"identifier.change",
"call.function.change"
] | 988,257 | 988,258 | u130196064 | cpp |
p03186 | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x, 0, sizeof(x))
#define fill(x, y) memset(x, y, sizeof(x))
#define p(x) cout << x << endl;
#define pe(x) cout << x << " ";
//#define int long long
using namespace std;
int dy[4] = {0, 0, 1, -1};
int dx[4] = {1, -1, 0, 0};
int dxx[8] = {0, 0, 1, 1, 1, -1, -1, -1};
int dyy[8] = {1, -1, 0, 1, -1, 0, 1, -1};
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m % n == 0)
return n;
else
return gcd(m % n, n);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) { // aのn乗を計算します。
ll x = 1;
while (n > 0) { //全てのbitが捨てられるまで。
if (n & 1) { // 1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1; // bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2)
r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MOD = 1000000007;
bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
ll N = 1050000;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (int i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (int j = 0; i * (j + 2) < N; j++) {
arr[i * (j + 2)] = 0;
}
}
}
for (int i = 2; i < N; i++) {
if (arr[i]) {
sosuu[c] = i;
// cout << sosuu[c] << " ";
c++;
}
}
// cout << endl;
// cout << c << endl;
}
ll cum[100010];
ll Mcum[100010];
int a[100010];
int main() {
int A, B, C;
cin >> A >> B >> C;
if (A + B >= C - 1) {
cout << B + C << endl;
return 0;
} else {
cout << C - (A + B) + 1 + B << endl;
return 0;
}
}
| #include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x, 0, sizeof(x))
#define fill(x, y) memset(x, y, sizeof(x))
#define p(x) cout << x << endl;
#define pe(x) cout << x << " ";
//#define int long long
using namespace std;
int dy[4] = {0, 0, 1, -1};
int dx[4] = {1, -1, 0, 0};
int dxx[8] = {0, 0, 1, 1, 1, -1, -1, -1};
int dyy[8] = {1, -1, 0, 1, -1, 0, 1, -1};
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m % n == 0)
return n;
else
return gcd(m % n, n);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) { // aのn乗を計算します。
ll x = 1;
while (n > 0) { //全てのbitが捨てられるまで。
if (n & 1) { // 1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1; // bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2)
r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MOD = 1000000007;
bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
ll N = 1050000;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (int i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (int j = 0; i * (j + 2) < N; j++) {
arr[i * (j + 2)] = 0;
}
}
}
for (int i = 2; i < N; i++) {
if (arr[i]) {
sosuu[c] = i;
// cout << sosuu[c] << " ";
c++;
}
}
// cout << endl;
// cout << c << endl;
}
ll cum[100010];
ll Mcum[100010];
int a[100010];
int main() {
int A, B, C;
cin >> A >> B >> C;
if (A + B >= C - 1) {
cout << B + C << endl;
return 0;
} else {
cout << C - (C - (A + B)) + 1 + B << endl;
return 0;
}
}
| [
"expression.operation.binary.add"
] | 988,259 | 988,260 | u859396346 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << b + min(c, a + b + 1) << endl;
return 0;
} | [
"expression.operation.binary.add"
] | 988,261 | 988,262 | u036561304 | cpp |
p03186 | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int MAX = 2e5 + 5;
const int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%d", max(a + b + 1, c) + b);
return 0;
} | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int MAX = 2e5 + 5;
const int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%d", min(a + b + 1, c) + b);
return 0;
} | [
"misc.opposites",
"identifier.change",
"call.function.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 988,263 | 988,264 | u382864097 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> matrix;
void solve() {
ll a, b, c;
cin >> a >> b >> c;
cout << min(b + c, 2 * a + 1) << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cerr.tie(NULL);
solve();
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> matrix;
void solve() {
ll a, b, c;
cin >> a >> b >> c;
cout << min(b + c, a + 2 * b + 1) << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cerr.tie(NULL);
solve();
}
| [
"identifier.change",
"io.output.change"
] | 988,265 | 988,266 | u109256064 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> matrix;
void solve() {
ll a, b, c;
cin >> a >> b >> c;
cout << min(b + c, 2 * a) << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cerr.tie(NULL);
solve();
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> matrix;
void solve() {
ll a, b, c;
cin >> a >> b >> c;
cout << min(b + c, a + 2 * b + 1) << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cerr.tie(NULL);
solve();
}
| [
"identifier.change",
"io.output.change"
] | 988,267 | 988,266 | u109256064 | cpp |
p03186 | #include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
typedef long long int ll;
const ll N = 1e6 + 3, inf = 998244353;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll a, b, c;
cin >> a >> b >> c;
ll p = a + b;
ll res = 0;
if (p >= c - 1)
res += (b + c);
else
res += (c - 1 + b);
cout << res << "\n";
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
typedef long long int ll;
const ll N = 1e6 + 3, inf = 998244353;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll a, b, c;
cin >> a >> b >> c;
ll p = a + b;
ll res = 0;
if (p >= c - 1)
res += (b + c);
else
res += (a + 1 + 2 * b);
cout << res << "\n";
return 0;
}
| [
"assignment.change"
] | 988,270 | 988,271 | u800823145 | cpp |
p03186 | //#include <bits/stdc++.h>
//#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <vector>
//#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string.h>
#include <string>
#include <utility>
using namespace std;
using ll = long long;
#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
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(int a, int b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ll A, B, C;
cin >> A >> B >> C;
// ll a[N];
ll ans = 0;
// ll sum=0;
// FOR(i,0,N-1){
// cin>>a[i];
//}
if (A + B + 1 >= C) {
ans = B + C;
} else {
ans = A * 2 + B * 2 + 1;
}
cout << ans << endl;
return 0;
}
| //#include <bits/stdc++.h>
//#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <vector>
//#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string.h>
#include <string>
#include <utility>
using namespace std;
using ll = long long;
#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
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(int a, int b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ll A, B, C;
cin >> A >> B >> C;
// ll a[N];
ll ans = 0;
// ll sum=0;
// FOR(i,0,N-1){
// cin>>a[i];
//}
if (A + B + 1 >= C) {
ans = B + C;
} else {
ans = A + B * 2 + 1;
}
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 988,278 | 988,279 | u043443359 | cpp |
p03186 | //#include <bits/stdc++.h>
//#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <vector>
//#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string.h>
#include <string>
#include <utility>
using namespace std;
using ll = long long;
#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
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(int a, int b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ll A, B, C;
cin >> A >> B >> C;
// ll a[N];
ll ans = 0;
// ll sum=0;
// FOR(i,0,N-1){
// cin>>a[i];
//}
if (A + B + 1 >= C) {
ans = B + C;
} else {
ans = B * 2 + 1;
}
cout << ans << endl;
return 0;
}
| //#include <bits/stdc++.h>
//#include <stdio.h>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <vector>
//#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string.h>
#include <string>
#include <utility>
using namespace std;
using ll = long long;
#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
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(int a, int b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ll A, B, C;
cin >> A >> B >> C;
// ll a[N];
ll ans = 0;
// ll sum=0;
// FOR(i,0,N-1){
// cin>>a[i];
//}
if (A + B + 1 >= C) {
ans = B + C;
} else {
ans = A + B * 2 + 1;
}
cout << ans << endl;
return 0;
}
| [
"assignment.change"
] | 988,280 | 988,279 | u043443359 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
long A, B, C, re;
cin >> A >> B >> C;
if (A + B >= C) {
re = B + C;
} else {
re = 2 * B + A;
}
cout << re;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
long A, B, C, re;
cin >> A >> B >> C;
if (A + B >= C) {
re = B + C;
} else {
re = 2 * B + A + 1;
}
cout << re;
return 0;
}
| [
"assignment.change"
] | 988,281 | 988,282 | u809278162 | cpp |
p03186 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (c >= a + b)
cout << a + 2 * b + 1;
else
cout << b + c << endl;
} | #include <iostream>
using namespace std;
int main() {
long int a, b, c;
cin >> a >> b >> c;
if (c > a + b)
cout << a + 2 * b + 1;
else
cout << b + c << endl;
} | [
"variable_declaration.type.widen.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,287 | 988,288 | u843842420 | cpp |
p03186 | #include <iostream>
using namespace std;
int main(void) {
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if (c >= (a + b)) {
cout << a + 2 * b + 1;
} else {
cout << b + c;
}
} | #include <iostream>
using namespace std;
int main(void) {
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if (c > (a + b)) {
cout << a + 2 * b + 1;
} else {
cout << b + c;
}
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,289 | 988,290 | u019356802 | cpp |
p03186 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {
long long int a, b, c;
long long int ans = 0;
cin >> a >> b >> c;
if (a + b >= c)
ans = b + c;
else
ans = min(a + b + 3, b + c);
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {
long long int a, b, c;
long long int ans = 0;
cin >> a >> b >> c;
if (a + b >= c)
ans = b + c;
else
ans = min(a + 2 * b + 1, b + c);
cout << ans << endl;
return 0;
} | [
"assignment.change",
"literal.number.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 988,296 | 988,297 | u147325103 | cpp |
p03186 | #include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout << a << "\n";
#define debug3(a, b, c) cout << a << " " << b << " " << c << "\n";
#define debug2(a, b) cout << a << " " << b << "\n";
#define debug4(a, b, c, d) \
cout << a << " " << b << " " << c << " " << d << "\n";
ll mod = 1000000007;
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int sum = a + b;
int diff = c - sum;
if (diff <= 0) {
cout << b + c << "\n";
} else {
cout << b + c - diff << "\n";
}
return 0;
}
| #include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout << a << "\n";
#define debug3(a, b, c) cout << a << " " << b << " " << c << "\n";
#define debug2(a, b) cout << a << " " << b << "\n";
#define debug4(a, b, c, d) \
cout << a << " " << b << " " << c << " " << d << "\n";
ll mod = 1000000007;
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int sum = a + b;
int diff = c - sum;
if (diff <= 0) {
cout << b + c << "\n";
} else {
cout << b + c - diff + 1 << "\n";
}
return 0;
}
| [
"expression.operation.binary.add"
] | 988,300 | 988,301 | u757055962 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << ", " << p.second << ")";
return os;
}
void solve() {
ll A, B, C;
cin >> A >> B >> C;
cout << min(C, B + A + 1) + min(A, B) << endl;
}
int main() {
std::cin.tie(0);
std::ios::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(16);
solve();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << ", " << p.second << ")";
return os;
}
void solve() {
ll A, B, C;
cin >> A >> B >> C;
cout << min(C, B + A + 1) + B << endl;
}
int main() {
std::cin.tie(0);
std::ios::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(16);
solve();
return 0;
} | [
"call.remove",
"call.arguments.change"
] | 988,304 | 988,305 | u745250049 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, S;
cin >> N >> M >> S;
int count = 0;
if (N + M > S) {
count = S + M;
} else {
count = (N + M) * 2 - N + 1;
}
cout << count << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, S;
cin >> N >> M >> S;
int count = 0;
if (N + M >= S) {
count = S + M;
} else {
count = (N + M) * 2 - N + 1;
}
cout << count << endl;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 988,310 | 988,311 | u989696545 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (long long i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(i, a, b) for (long long i = (a); i >= (b); --i)
#define REPR(i, n) FORR(i, n, 0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b < c) {
cout << a + b + b - 1 << endl;
} else {
cout << b + c << endl;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (long long i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(i, a, b) for (long long i = (a); i >= (b); --i)
#define REPR(i, n) FORR(i, n, 0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b < c) {
cout << a + b + b + 1 << endl;
} else {
cout << b + c << endl;
}
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change"
] | 988,314 | 988,315 | u128676584 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (long long i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(i, a, b) for (long long i = (a); i >= (b); --i)
#define REPR(i, n) FORR(i, n, 0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b < c) {
cout << b + b - 1 << endl;
} else {
cout << b + c << endl;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (long long i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(i, a, b) for (long long i = (a); i >= (b); --i)
#define REPR(i, n) FORR(i, n, 0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b < c) {
cout << a + b + b + 1 << endl;
} else {
cout << b + c << endl;
}
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change"
] | 988,316 | 988,315 | u128676584 | cpp |
p03186 | #include <algorithm>
#include <complex>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
long long int ans = 0;
if (a + b >= c) {
ans = b + c;
} else {
ans = a + b + 1 - b;
}
cout << ans << endl;
}
| #include <algorithm>
#include <complex>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b >> c;
long long int ans = 0;
if (a + b >= c) {
ans = b + c;
} else {
ans = a + b + 1 + b;
}
cout << ans << endl;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 988,319 | 988,320 | u536712674 | cpp |
p03186 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
long A, B, C;
cin >> A >> B >> C;
if (A + B >= C)
cout << B + C << endl;
else
cout << A + B + B << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
long A, B, C;
cin >> A >> B >> C;
if (A + B >= C)
cout << B + C << endl;
else
cout << A + B + B + 1 << endl;
return 0;
}
| [
"expression.operation.binary.add"
] | 988,321 | 988,322 | u382513779 | cpp |
p03186 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define FOR(i, b, e) for (ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for (ll i = (ll)(e - 1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x, c) for (const auto &x : (c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define PAIR pair<ll, ll>
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using ll = long long;
constexpr ll MOD = 1000000007;
// constexpr ll MOD = 998244353;
using std::cin;
using std::cout;
using std::endl;
using std::list;
using std::map;
using std::multimap;
using std::multiset;
using std::pair;
using std::queue;
using std::set;
using std::sort;
using std::stack;
using std::string;
using std::unordered_map;
using std::unordered_multimap;
using std::unordered_set;
using std::vector;
// ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// ll pow(ll a, ll b) { ll ans = 1; while (b > 0) { if (b % 2 == 1) { ans *= a;
// ans %= MOD; }b /= 2; a *= a; a %= MOD; }return ans; } ll comb(ll a, ll b) {
// static constexpr ll size = 1e6; static VL fac(size); static VL finv(size);
// static VL inv(size); static ll n = 0; if (n > a) { return fac[a] * (finv[b] *
// finv[a - b] % MOD) % MOD; }fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1]
// = 1; FOR(i, 2, a + 1) { inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; fac[i] =
// fac[i - 1] * (ll)i%MOD; finv[i] = finv[i - 1] * inv[i] % MOD; }n = a + 1;
// return comb(a, b); } multiset<ll> prime_decomposition(ll n) { ll i = 2;
// multiset<ll> table{}; while (i * i <= n) { while (n % i == 0) { n /= i;
// table.emplace(i); }++i; }if (n > 1) { table.emplace(n); return table; }return
// table; }
//-- bit -- REP(i, (1 << n)) {REP(j, n) {cout << (1 & (i >> j));}cout << endl;}
//==============================================================================================
int main() {
ll n, m, k;
cin >> n >> m >> k;
ll tmp = n + m;
cout << m + std::min(tmp, k) << endl;
}
| #include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define FOR(i, b, e) for (ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for (ll i = (ll)(e - 1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x, c) for (const auto &x : (c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define PAIR pair<ll, ll>
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using ll = long long;
constexpr ll MOD = 1000000007;
// constexpr ll MOD = 998244353;
using std::cin;
using std::cout;
using std::endl;
using std::list;
using std::map;
using std::multimap;
using std::multiset;
using std::pair;
using std::queue;
using std::set;
using std::sort;
using std::stack;
using std::string;
using std::unordered_map;
using std::unordered_multimap;
using std::unordered_set;
using std::vector;
// ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// ll pow(ll a, ll b) { ll ans = 1; while (b > 0) { if (b % 2 == 1) { ans *= a;
// ans %= MOD; }b /= 2; a *= a; a %= MOD; }return ans; } ll comb(ll a, ll b) {
// static constexpr ll size = 1e6; static VL fac(size); static VL finv(size);
// static VL inv(size); static ll n = 0; if (n > a) { return fac[a] * (finv[b] *
// finv[a - b] % MOD) % MOD; }fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1]
// = 1; FOR(i, 2, a + 1) { inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; fac[i] =
// fac[i - 1] * (ll)i%MOD; finv[i] = finv[i - 1] * inv[i] % MOD; }n = a + 1;
// return comb(a, b); } multiset<ll> prime_decomposition(ll n) { ll i = 2;
// multiset<ll> table{}; while (i * i <= n) { while (n % i == 0) { n /= i;
// table.emplace(i); }++i; }if (n > 1) { table.emplace(n); return table; }return
// table; }
//-- bit -- REP(i, (1 << n)) {REP(j, n) {cout << (1 & (i >> j));}cout << endl;}
//==============================================================================================
int main() {
ll n, m, k;
cin >> n >> m >> k;
ll tmp = n + m;
cout << m + std::min(tmp + 1, k) << endl;
}
| [
"expression.operation.binary.add"
] | 988,324 | 988,325 | u715750943 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; i++)
#define why(n, x) \
int n; \
while (cin >> n, n != x)
#define iFOR(i, x, n) for (int i = x; i < n; i++)
#define unless(flg) if (!(flg))
#define read cin <<
#define echo cout <<
#define fin << '\n'
#define __ << " " <<
#define bash push_back
#define alles(x) x.begin(), x.end()
#define SWAP(a, b) ((a != b) && (a += b, b = a - b, a -= b))
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
bool inside(int x, int y, int w, int h) {
return (x >= 0 && y >= 0 && x < w && y < h);
}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vit;
typedef map<string, int> mstit;
typedef vector<pii> vpi;
typedef greater<pii> gpi;
typedef priority_queue<pii, vpi, gpi> dijk;
int main() {
cin.tie(0), ios::sync_with_stdio(false);
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c - 1)
cout << b + c fin;
else
cout << a + b + 2 fin;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; i++)
#define why(n, x) \
int n; \
while (cin >> n, n != x)
#define iFOR(i, x, n) for (int i = x; i < n; i++)
#define unless(flg) if (!(flg))
#define read cin <<
#define echo cout <<
#define fin << '\n'
#define __ << " " <<
#define bash push_back
#define alles(x) x.begin(), x.end()
#define SWAP(a, b) ((a != b) && (a += b, b = a - b, a -= b))
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
bool inside(int x, int y, int w, int h) {
return (x >= 0 && y >= 0 && x < w && y < h);
}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vit;
typedef map<string, int> mstit;
typedef vector<pii> vpi;
typedef greater<pii> gpi;
typedef priority_queue<pii, vpi, gpi> dijk;
int main() {
cin.tie(0), ios::sync_with_stdio(false);
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c - 1)
cout << b + c fin;
else
cout << a + b + b + 1 fin;
return 0;
} | [
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 988,326 | 988,327 | u678146855 | cpp |
p03186 | #include <stdio.h>
int main() {
int a, b, c, ans = 0;
scanf("%d %d %d", &a, &b, &c);
if (a + b - 1 <= c)
ans = (a + b + 1) + b;
else
ans = c + b;
printf("%d", ans);
} | #include <stdio.h>
int main() {
int a, b, c, ans = 0;
scanf("%d %d %d", &a, &b, &c);
if (a + b + 1 <= c)
ans = (a + b + 1) + b;
else
ans = c + b;
printf("%d", ans);
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 988,334 | 988,335 | u857348954 | cpp |
p03186 | #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
int main(void) {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c << endl;
else if (b < c)
cout << b * 2 + a << 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
int main(void) {
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c)
cout << b + c << endl;
else if (a + b < c)
cout << b * 2 + a + 1 << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 988,340 | 988,341 | u154672915 | cpp |
p03186 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
long long a, b, c;
int main() {
cin >> a >> b >> c;
cout << ((a + b >= c) ? (c + b) : (b));
} | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
long long a, b, c;
int main() {
cin >> a >> b >> c;
cout << ((a + b >= c) ? (c + b) : (2 * b + 1 + a));
} | [
"expression.operation.binary.add"
] | 988,347 | 988,348 | u950603962 | cpp |
p03186 | // Created by sz
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef LOCAL
freopen("./input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
if (a + b >= c + 1)
cout << b + c;
else
cout << a + 2 * b + 1;
cout << endl;
return 0;
}
| // Created by sz
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef LOCAL
freopen("./input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
if (a + b + 1 >= c)
cout << b + c;
else
cout << a + 2 * b + 1;
cout << endl;
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 988,349 | 988,350 | u041075929 | cpp |
p03186 | #include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a, b, c;
int main() {
scanf("%d%d%d", &a, &b, &c);
if (a + b >= c)
printf("%d", b + c);
else {
printf("%d", a + b + b);
}
} | #include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a, b, c;
int main() {
scanf("%d%d%d", &a, &b, &c);
if (a + b >= c)
printf("%d", b + c);
else
printf("%d", a + b + b + 1);
} | [
"expression.operation.binary.add"
] | 988,357 | 988,358 | u059124369 | cpp |
p03186 | #include <bits/stdc++.h>
#define rep(i, x, y) for (register int i = x; i <= y; ++i)
#define repd(i, x, y) for (register int i = x; i >= y; --i)
typedef long long ll;
using namespace std;
template <typename T> inline bool chkmax(T &x, T y) {
return x < y ? x = y, 1 : 0;
}
template <typename T> inline bool chkmin(T &x, T y) {
return x > y ? x = y, 1 : 0;
}
template <typename T> inline void read(T &x) {
char c;
int sign = 1;
x = 0;
do {
c = getchar();
if (c == '-')
sign = -1;
} while (!isdigit(c));
do {
x = x * 10 + c - '0';
c = getchar();
} while (isdigit(c));
x *= sign;
}
ll a, b, c;
int main() {
read(a);
read(b);
read(c);
cout << b + min(a + b, c);
return 0;
} | #include <bits/stdc++.h>
#define rep(i, x, y) for (register int i = x; i <= y; ++i)
#define repd(i, x, y) for (register int i = x; i >= y; --i)
typedef long long ll;
using namespace std;
template <typename T> inline bool chkmax(T &x, T y) {
return x < y ? x = y, 1 : 0;
}
template <typename T> inline bool chkmin(T &x, T y) {
return x > y ? x = y, 1 : 0;
}
template <typename T> inline void read(T &x) {
char c;
int sign = 1;
x = 0;
do {
c = getchar();
if (c == '-')
sign = -1;
} while (!isdigit(c));
do {
x = x * 10 + c - '0';
c = getchar();
} while (isdigit(c));
x *= sign;
}
ll a, b, c;
int main() {
read(a);
read(b);
read(c);
cout << b + min(a + b + 1, c);
return 0;
} | [
"expression.operation.binary.add"
] | 988,362 | 988,363 | u084247138 | cpp |
p03186 | // Code by 27.
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <memory.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
const unsigned long long BIGEST = 1000000000000000000 + 1000000000000000000;
const long long BIGER = 1000000000000000000;
const int BIG = 1000000000;
const int MOD = 1000000007;
long long a, b, c;
int main() {
cin >> a >> b >> c;
cout << min(c, a + b) + b;
return 0;
} | // Code by 27.
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <memory.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
const unsigned long long BIGEST = 1000000000000000000 + 1000000000000000000;
const long long BIGER = 1000000000000000000;
const int BIG = 1000000000;
const int MOD = 1000000007;
long long a, b, c;
int main() {
cin >> a >> b >> c;
cout << min(c, a + b + 1) + b;
return 0;
} | [
"expression.operation.binary.add"
] | 988,366 | 988,367 | u147008092 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
cin >> a >> b >> c;
long long ans = 0;
ans += min(a + b, c) + b;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
cin >> a >> b >> c;
long long ans = 0;
ans += min(a + b + 1, c) + b;
cout << ans << endl;
return 0;
} | [
"assignment.change"
] | 988,512 | 988,513 | u212904724 | cpp |
p03186 | #include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
cin >> a >> b >> c;
cout << min(a + b, c) + b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
cin >> a >> b >> c;
cout << min(a + b + 1, c) + b << endl;
return 0;
} | [
"expression.operation.binary.add"
] | 988,516 | 988,517 | u032327689 | cpp |
p03186 | #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
c = min(c, a + b + 1);
cout << a + b + c;
}
| #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
c = min(c, a + b + 1);
cout << b + c;
}
| [
"expression.operation.binary.remove"
] | 988,518 | 988,519 | u562319622 | cpp |
p03187 | #include <bits/stdc++.h>
#define Tp template <typename Ty>
#define Ts template <typename Ty, typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int &
#define I inline
#define W while
#define N 200000
#define LL long long
#define Gmax(x, y) (x < (y) && (x = (y)))
using namespace std;
int n, m, a[N + 5];
LL pre[N + 5], suf[N + 5];
int main() {
RI i, x, t;
LL ans = 0;
for (scanf("%d%d", &m, &n), i = 1; i <= n; ++i)
scanf("%d", a + i);
for (i = 1; i <= n; ++i)
pre[i] = pre[i - 1] + a[i];
for (i = n; i; --i)
suf[i] = suf[i + 1] + m - a[i];
for (i = 1; i ^ n; ++i)
x = (i - 1) + (n - i + 2 >> 1),
Gmax(ans, 2 * (pre[x] - pre[i - 1] + suf[x + 1]) -
(n - i + 1 & 1 ? a[x] : m - a[x + 1]));
for (i = n; i ^ 1; --i)
x = (i >> 1) + 1, Gmax(ans, 2 * (suf[x] - suf[i + 1] + pre[x - 1]) -
(i & 1 ? m - a[x] : a[x - 1]));
return printf("%lld\n", ans), 0;
} | #include <bits/stdc++.h>
#define Tp template <typename Ty>
#define Ts template <typename Ty, typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int &
#define I inline
#define W while
#define N 200000
#define LL long long
#define Gmax(x, y) (x < (y) && (x = (y)))
using namespace std;
int n, m, a[N + 5];
LL pre[N + 5], suf[N + 5];
int main() {
RI i, x, t;
LL ans = 0;
for (scanf("%d%d", &m, &n), i = 1; i <= n; ++i)
scanf("%d", a + i);
for (i = 1; i <= n; ++i)
pre[i] = pre[i - 1] + a[i];
for (i = n; i; --i)
suf[i] = suf[i + 1] + m - a[i];
for (i = 1; i <= n; ++i)
x = (i - 1) + (n - i + 2 >> 1),
Gmax(ans, 2 * (pre[x] - pre[i - 1] + suf[x + 1]) -
(n - i + 1 & 1 ? a[x] : m - a[x + 1]));
for (i = n; i >= 1; --i)
x = (i >> 1) + 1, Gmax(ans, 2 * (suf[x] - suf[i + 1] + pre[x - 1]) -
(i & 1 ? m - a[x] : a[x - 1]));
return printf("%lld\n", ans), 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 988,524 | 988,525 | u752711517 | cpp |
p03187 | // base: https://atcoder.jp/contests/agc030/submissions/7566849#
// cf. https://ferin-tech.hatenablog.com/entry/2019/01/04/052343
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <unordered_map>
#include <vector>
using namespace std;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
const ll INF = 1e9;
const ll MOD = 1000000007; // 1e9 + 7
ll powmod(ll x, ll n) { // like pow(x, n)
ll r = 1;
while (n) {
if (n & 1) {
r = r * x % MOD;
}
x = x * x % MOD;
n >>= 1;
}
return r;
}
ll N, L;
ll solve(const vector<ll> &x) {
vector<ll> sumx(x);
for (int i = 1; i < N; i++) {
sumx[i] += sumx[i - 1];
}
ll res = 0;
for (int i = 0; i < N - 1; ++i) { // i: starting point of turn.
int mid =
i +
(N - i) / 2; // The last index. e.g. If N = 10 and i = 0, then mid = 5.
if ((N - i) % 2 ==
0) { // The number of remaining is odd. e.g. 0, 1, ... 9 exist, and i =
// 0. remaining is 1, 2, ... 9. mid is 5.
// The result is (X[i]) + (X[i] + revX[N-1]) + (revX[N-1] + X[i+1]) + ...
// + (X[mid-1] + revX[mid]) = (X[i]*2 + X[i+1]*2 + ... X[mid-1]*2) +
// ((L-X[mid+1])*2 + (L-X[mid+2])*2 + ... + (L-X[N-1])*2) + (L - X[mid])
// = (X[i] + X[i+1] + ... + X[mid-1])*2 + (L-X[mid]) + (L-X[mid+1] +
// L-X[mid+2] + ... + L-X[N-1])*2
ll val = 2 * (sumx[mid] - sumx[i] - x[mid] + x[i]) - x[mid] -
2 * (sumx[N - 1] - sumx[mid]) + (N - 1 - i) * L;
res = max(res, val);
} else { // The number of remaining is even. e.g. 0, 1, ... 8 exist, and i =
// 0. remaining is 1, 2, ... 8. mid is 4.
// (X[i] + X[i+1] + ... + X[mid-1])*2 + X[mid] + (L-X[mid+1] + L-X[mid+2]
// + ... + L-X[N-1])*2
ll val = 2 * (sumx[mid] - sumx[i] - x[mid] + x[i]) + x[mid] -
2 * (sumx[N - 1] - sumx[mid]) + (N - 1 - i) * L;
res = max(res, val);
}
}
return res;
}
int main(int argc, char **argv) {
cin >> L >> N;
vector<ll> X(N);
rep(i, N) { cin >> X[i]; }
// Try anti-clock order at first.
ll ans = 0;
ans = max(ans, solve(X));
// Calculate reversed.
reverse(all(X));
rep(i, N) { X[i] = L - X[i]; }
ans = max(ans, solve(X));
cout << ans << endl;
}
| // base: https://atcoder.jp/contests/agc030/submissions/7566849#
// cf. https://ferin-tech.hatenablog.com/entry/2019/01/04/052343
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <unordered_map>
#include <vector>
using namespace std;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
const ll INF = 1e9;
const ll MOD = 1000000007; // 1e9 + 7
ll powmod(ll x, ll n) { // like pow(x, n)
ll r = 1;
while (n) {
if (n & 1) {
r = r * x % MOD;
}
x = x * x % MOD;
n >>= 1;
}
return r;
}
ll N, L;
ll solve(const vector<ll> &x) {
vector<ll> sumx(x);
for (int i = 1; i < N; i++) {
sumx[i] += sumx[i - 1];
}
ll res = 0;
for (int i = 0; i < N; ++i) { // i: starting point of turn.
int mid =
i +
(N - i) / 2; // The last index. e.g. If N = 10 and i = 0, then mid = 5.
if ((N - i) % 2 ==
0) { // The number of remaining is odd. e.g. 0, 1, ... 9 exist, and i =
// 0. remaining is 1, 2, ... 9. mid is 5.
// The result is (X[i]) + (X[i] + revX[N-1]) + (revX[N-1] + X[i+1]) + ...
// + (X[mid-1] + revX[mid]) = (X[i]*2 + X[i+1]*2 + ... X[mid-1]*2) +
// ((L-X[mid+1])*2 + (L-X[mid+2])*2 + ... + (L-X[N-1])*2) + (L - X[mid])
// = (X[i] + X[i+1] + ... + X[mid-1])*2 + (L-X[mid]) + (L-X[mid+1] +
// L-X[mid+2] + ... + L-X[N-1])*2
ll val = 2 * (sumx[mid] - sumx[i] - x[mid] + x[i]) - x[mid] -
2 * (sumx[N - 1] - sumx[mid]) + (N - 1 - i) * L;
res = max(res, val);
} else { // The number of remaining is even. e.g. 0, 1, ... 8 exist, and i =
// 0. remaining is 1, 2, ... 8. mid is 4.
// (X[i] + X[i+1] + ... + X[mid-1])*2 + X[mid] + (L-X[mid+1] + L-X[mid+2]
// + ... + L-X[N-1])*2
ll val = 2 * (sumx[mid] - sumx[i] - x[mid] + x[i]) + x[mid] -
2 * (sumx[N - 1] - sumx[mid]) + (N - 1 - i) * L;
res = max(res, val);
}
}
return res;
}
int main(int argc, char **argv) {
cin >> L >> N;
vector<ll> X(N);
rep(i, N) { cin >> X[i]; }
// Try anti-clock order at first.
ll ans = 0;
ans = max(ans, solve(X));
// Calculate reversed.
reverse(all(X));
rep(i, N) { X[i] = L - X[i]; }
ans = max(ans, solve(X));
cout << ans << endl;
}
| [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 988,533 | 988,534 | u328294851 | cpp |
p03187 | #include <bits/stdc++.h>
#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back
#define DEBUG(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
template <typename T> inline int Chkmax(T &a, T b) {
return a < b ? a = b, 1 : 0;
}
template <typename T> inline int Chkmin(T &a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T> inline T read() {
T sum = 0, fl = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fl = -1;
for (; isdigit(ch); ch = getchar())
sum = (sum << 3) + (sum << 1) + ch - '0';
return sum * fl;
}
inline void proc_status() {
ifstream t("/proc/self/status");
cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
<< endl;
}
const int Maxn = 2e5 + 100;
int L, N, X[Maxn];
LL Pre[Maxn], Suf[Maxn];
LL ans;
inline void work() {
// for (int i = 1; i <= N; ++i) cout << X[i] << ' ' ; puts("");
for (int i = 1; i <= N; ++i)
Pre[i] = Pre[i - 1] + X[i];
for (int i = N; i >= 1; --i)
Suf[i] = Suf[i + 1] + L - X[i];
for (int i = 1; i < N; ++i) {
int pos = (i + N) / 2;
// cout << i << ' ' << pos << endl;
// cout << X[i] << ' ' << Pre[pos] - Pre[i - 1] << " " << Suf[pos + 1] <<
//' ' << L - X[N] << endl;
int tmp = ((N - i + 1) & 1) ? X[pos] : (L - X[pos + 1]);
Chkmax(ans, 2ll * (Pre[pos] - Pre[i - 1]) + 2ll * Suf[pos + 1] - tmp);
// DEBUG (ans);
}
}
inline void Solve() {
work();
for (int i = 1; i <= N; ++i)
X[i] = L - X[i];
reverse(X + 1, X + N + 1);
work();
cout << ans << endl;
}
inline void Input() {
L = read<int>();
N = read<int>();
for (int i = 1; i <= N; ++i)
X[i] = read<int>();
}
int main() {
#ifdef hk_cnyali
freopen("B.in", "r", stdin);
freopen("B.out", "w", stdout);
#endif
Input();
Solve();
return 0;
}
| #include <bits/stdc++.h>
#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back
#define DEBUG(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
template <typename T> inline int Chkmax(T &a, T b) {
return a < b ? a = b, 1 : 0;
}
template <typename T> inline int Chkmin(T &a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T> inline T read() {
T sum = 0, fl = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-')
fl = -1;
for (; isdigit(ch); ch = getchar())
sum = (sum << 3) + (sum << 1) + ch - '0';
return sum * fl;
}
inline void proc_status() {
ifstream t("/proc/self/status");
cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
<< endl;
}
const int Maxn = 2e5 + 100;
int L, N, X[Maxn];
LL Pre[Maxn], Suf[Maxn];
LL ans;
inline void work() {
// for (int i = 1; i <= N; ++i) cout << X[i] << ' ' ; puts("");
for (int i = 1; i <= N; ++i)
Pre[i] = Pre[i - 1] + X[i];
for (int i = N; i >= 1; --i)
Suf[i] = Suf[i + 1] + L - X[i];
for (int i = 1; i <= N; ++i) {
int pos = (i + N) / 2;
// cout << i << ' ' << pos << endl;
// cout << X[i] << ' ' << Pre[pos] - Pre[i - 1] << " " << Suf[pos + 1] <<
//' ' << L - X[N] << endl;
int tmp = ((N - i + 1) & 1) ? X[pos] : (L - X[pos + 1]);
Chkmax(ans, 2ll * (Pre[pos] - Pre[i - 1]) + 2ll * Suf[pos + 1] - tmp);
// DEBUG (ans);
}
}
inline void Solve() {
work();
for (int i = 1; i <= N; ++i)
X[i] = L - X[i];
reverse(X + 1, X + N + 1);
work();
cout << ans << endl;
}
inline void Input() {
L = read<int>();
N = read<int>();
for (int i = 1; i <= N; ++i)
X[i] = read<int>();
}
int main() {
#ifdef hk_cnyali
freopen("B.in", "r", stdin);
freopen("B.out", "w", stdout);
#endif
Input();
Solve();
return 0;
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 988,537 | 988,538 | u530846427 | cpp |
p03181 | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
const lli N = 1e5 + 5;
vector<lli> v[N];
lli ans[N], dp[N], M;
void dfs1(lli x, lli par) {
dp[x] = 1LL;
for (auto j : v[x]) {
if (j == par)
continue;
dfs1(j, x);
dp[x] *= dp[j];
dp[x] %= M;
}
dp[x]++;
dp[x] %= M;
}
void dfs2(lli x, lli par, lli uper) {
vector<lli> p, s;
p.push_back(1LL);
for (auto j : v[x]) {
if (j == par)
continue;
p.push_back(dp[j]);
s.push_back(dp[j]);
}
s.push_back(1LL);
for (int i = 1; i < p.size(); i++)
p[i] = (p[i] * p[i - 1]) % M;
for (int i = s.size() - 2; i >= 0; i--)
s[i] = (s[i] * s[i + 1]) % M;
ans[x] = (p.back() * uper) % M;
int i = 0;
for (auto j : v[x]) {
if (j == par)
continue;
dfs2(j, x, ((p[i] * s[i + 1]) % M * uper + 1) % M);
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
lli n;
cin >> n >> M;
lli i, x, y;
for (i = 0; i < n - 1; i++) {
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
dfs1(1, 1); // bottom-up
dfs2(1, 1, 1); // top-down
for (i = 1; i <= n; i++)
cout << ans[i] << endl;
return 0;
} | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
const lli N = 1e5 + 5;
vector<lli> v[N];
lli ans[N], dp[N], M;
void dfs1(lli x, lli par) {
dp[x] = 1LL;
for (auto j : v[x]) {
if (j == par)
continue;
dfs1(j, x);
dp[x] *= dp[j];
dp[x] %= M;
}
dp[x]++;
dp[x] %= M;
}
void dfs2(lli x, lli par, lli uper) {
vector<lli> p, s;
p.push_back(1LL);
for (auto j : v[x]) {
if (j == par)
continue;
p.push_back(dp[j]);
s.push_back(dp[j]);
}
s.push_back(1LL);
for (int i = 1; i < p.size(); i++)
p[i] = (p[i] * p[i - 1]) % M;
for (int i = s.size() - 2; i >= 0; i--)
s[i] = (s[i] * s[i + 1]) % M;
ans[x] = (p.back() * uper) % M;
int i = 0;
for (auto j : v[x]) {
if (j == par)
continue;
dfs2(j, x, ((p[i] * s[i + 1]) % M * uper + 1) % M);
i++;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
lli n;
cin >> n >> M;
lli i, x, y;
for (i = 0; i < n - 1; i++) {
cin >> x >> y;
v[x].push_back(y);
v[y].push_back(x);
}
dfs1(1, 1); // bottom-up
dfs2(1, 1, 1); // top-down
for (i = 1; i <= n; i++)
cout << ans[i] << endl;
return 0;
} | [
"expression.unary.arithmetic.add"
] | 988,368 | 988,369 | u618540713 | cpp |
p03181 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1 << 30) - 1;
const long long LINF = (1LL << 62) - 1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> class ReRooting {
vector<T> res;
public:
ReRooting(int n, vector<vector<int>> &_to, T identity,
function<T(T, int)> trans, function<T(T, T)> merge) {
res.resize(n);
if (n == 1) {
res[0] = trans(identity, 0);
return;
}
vector<vector<int>> to(n), idx(n);
for (int x = 0; x < n; x++) {
for (int i = 0; i < _to[x].size(); i++) {
int y = _to[x][i];
if (x >= y)
continue;
idx[x].push_back(to[y].size());
idx[y].push_back(to[x].size());
to[x].push_back(y);
to[y].push_back(x);
}
}
vector<vector<T>> dp(n);
for (int i = 0; i < n; i++)
dp[i].resize(to[i].size());
vector<int> ord = {0}, par(n);
par[0] = -1;
stack<int> st;
st.push(0);
while (!st.empty()) {
int cur = st.top();
st.pop();
for (auto next : to[cur]) {
if (next == par[cur])
continue;
par[next] = cur;
ord.push_back(next);
st.push(next);
}
}
for (int i = n - 1; i > 0; i--) {
int cur = ord[i], par_idx;
T accum = identity;
for (int j = 0; j < to[cur].size(); j++) {
if (to[cur][j] == par[cur])
par_idx = j;
else
accum = merge(accum, dp[cur][j]);
}
dp[par[cur]][idx[cur][par_idx]] = trans(accum, cur);
}
for (int i = 0; i < n; i++) {
int cur = ord[i];
vector<T> r_accum(to[cur].size());
r_accum.back() = identity;
for (int j = (int)r_accum.size() - 1; j > 0; j--)
r_accum[j - 1] = merge(r_accum[j], dp[cur][j]);
T l_accum = identity;
for (int j = 0; j < r_accum.size(); j++) {
T accum = merge(l_accum, r_accum[j]);
dp[to[cur][j]][idx[cur][j]] = trans(accum, cur);
l_accum = merge(l_accum, dp[cur][j]);
}
res[cur] = l_accum;
}
}
T query(int root) { return res[root]; }
};
struct Data {
ll num;
int mod;
};
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<vector<int>> to(n);
rep(i, n - 1) {
int a, b;
cin >> a >> b;
--a, --b;
to[a].push_back(b);
to[b].push_back(a);
}
ReRooting<Data> dp(
n, to, Data({1, m}),
[](auto x, auto y) {
x.num++;
return x;
},
[](auto x, auto y) {
ll a = x.num, b = y.num;
int mod = x.mod;
return Data({a * b % mod, mod});
});
rep(i, n) cout << dp.query(i).num << '\n';
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1 << 30) - 1;
const long long LINF = (1LL << 62) - 1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> class ReRooting {
vector<T> res;
public:
ReRooting(int n, vector<vector<int>> &_to, T identity,
function<T(T, int)> trans, function<T(T, T)> merge) {
res.resize(n);
if (n == 1) {
res[0] = identity;
return;
}
vector<vector<int>> to(n), idx(n);
for (int x = 0; x < n; x++) {
for (int i = 0; i < _to[x].size(); i++) {
int y = _to[x][i];
if (x >= y)
continue;
idx[x].push_back(to[y].size());
idx[y].push_back(to[x].size());
to[x].push_back(y);
to[y].push_back(x);
}
}
vector<vector<T>> dp(n);
for (int i = 0; i < n; i++)
dp[i].resize(to[i].size());
vector<int> ord = {0}, par(n);
par[0] = -1;
stack<int> st;
st.push(0);
while (!st.empty()) {
int cur = st.top();
st.pop();
for (auto next : to[cur]) {
if (next == par[cur])
continue;
par[next] = cur;
ord.push_back(next);
st.push(next);
}
}
for (int i = n - 1; i > 0; i--) {
int cur = ord[i], par_idx;
T accum = identity;
for (int j = 0; j < to[cur].size(); j++) {
if (to[cur][j] == par[cur])
par_idx = j;
else
accum = merge(accum, dp[cur][j]);
}
dp[par[cur]][idx[cur][par_idx]] = trans(accum, cur);
}
for (int i = 0; i < n; i++) {
int cur = ord[i];
vector<T> r_accum(to[cur].size());
r_accum.back() = identity;
for (int j = (int)r_accum.size() - 1; j > 0; j--)
r_accum[j - 1] = merge(r_accum[j], dp[cur][j]);
T l_accum = identity;
for (int j = 0; j < r_accum.size(); j++) {
T accum = merge(l_accum, r_accum[j]);
dp[to[cur][j]][idx[cur][j]] = trans(accum, cur);
l_accum = merge(l_accum, dp[cur][j]);
}
res[cur] = l_accum;
}
}
T query(int root) { return res[root]; }
};
struct Data {
ll num;
int mod;
};
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<vector<int>> to(n);
rep(i, n - 1) {
int a, b;
cin >> a >> b;
--a, --b;
to[a].push_back(b);
to[b].push_back(a);
}
ReRooting<Data> dp(
n, to, Data({1, m}),
[](auto x, auto y) {
x.num++;
return x;
},
[](auto x, auto y) {
ll a = x.num, b = y.num;
int mod = x.mod;
return Data({a * b % mod, mod});
});
rep(i, n) cout << dp.query(i).num << '\n';
return 0;
} | [
"call.remove",
"call.arguments.change"
] | 988,380 | 988,381 | u608258653 | cpp |
p03181 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> G(n), x(n);
vector<int> dp(n, 1), par(n);
for (int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v;
u--;
v--;
G[u].push_back(v);
G[v].push_back(u);
}
function<void(int, int)> dfs1 = [&](int u, int p) {
for (int v : G[u]) {
if (v == p) {
par[u] = x[u].size();
x[u].push_back(-1);
} else {
dfs1(v, u);
x[u].push_back((dp[v] + 1) % m);
dp[u] = 1LL * dp[u] * x[u].back() % m;
}
}
};
dfs1(0, -1);
function<void(int, int, int)> dfs2 = [&](int u, int p, int y) {
if (p != -1) {
x[u][par[u]] = y;
dp[u] = 1LL * dp[u] * y % m;
}
vector<int> s = x[u];
for (int i = 0; i + 1 < s.size(); i++)
s[i + 1] = 1LL * s[i + 1] * s[i] % m;
for (int i = s.size() - 1; i; i--)
x[u][i - 1] = 1LL * x[u][i - 1] * x[u][i] % m;
for (int i = 0; i < s.size(); i++) {
if (G[u][i] != p) {
int a = (i ? s[i - 1] : 1);
int b = (i + 1 < s.size() ? x[u][i + 1] : 1);
dfs2(G[u][i], u, (1LL * a * b + 1) % m);
}
}
};
dfs2(0, -1, 1);
for (int i = 0; i < n; i++)
cout << dp[i] << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> G(n), x(n);
vector<int> dp(n, 1), par(n);
for (int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v;
u--;
v--;
G[u].push_back(v);
G[v].push_back(u);
}
function<void(int, int)> dfs1 = [&](int u, int p) {
for (int v : G[u]) {
if (v == p) {
par[u] = x[u].size();
x[u].push_back(-1);
} else {
dfs1(v, u);
x[u].push_back((dp[v] + 1) % m);
dp[u] = 1LL * dp[u] * x[u].back() % m;
}
}
};
dfs1(0, -1);
function<void(int, int, int)> dfs2 = [&](int u, int p, int y) {
if (p != -1) {
x[u][par[u]] = y;
dp[u] = 1LL * dp[u] * y % m;
}
vector<int> s = x[u];
for (int i = 0; i + 1 < s.size(); i++)
s[i + 1] = 1LL * s[i + 1] * s[i] % m;
for (int i = s.size() - 1; i > 0; i--)
x[u][i - 1] = 1LL * x[u][i - 1] * x[u][i] % m;
for (int i = 0; i < s.size(); i++) {
if (G[u][i] != p) {
int a = (i ? s[i - 1] : 1);
int b = (i + 1 < s.size() ? x[u][i + 1] : 1);
dfs2(G[u][i], u, (1LL * a * b + 1) % m);
}
}
};
dfs2(0, -1, 1);
for (int i = 0; i < n; i++)
cout << dp[i] << endl;
} | [
"control_flow.loop.for.condition.change"
] | 988,382 | 988,383 | u047554023 | cpp |
p03181 | #include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const int MX = 1e5 + 10;
vector<int> adj[MX];
int ans[MX];
lli mod;
struct node {
node *left, *right;
short int height;
int size;
int value, prod;
node(int value = 1)
: left(NULL), right(NULL), value(value), prod(value), height(1), size(1) {
}
inline short int balance() {
return (right ? right->height : 0) - (left ? left->height : 0);
}
node *maxLeftChild() {
node *ret = this;
while (ret->left)
ret = ret->left;
return ret;
}
};
struct Tree {
node *root;
Tree() : root(NULL) {}
inline int nodeSize(node *&pos) { return pos ? pos->size : 0; }
inline int nodeHeight(node *&pos) { return pos ? pos->height : 0; }
inline int nodeProd(node *&pos) { return pos ? pos->prod : 1; }
inline void update(node *&pos) {
if (!pos)
return;
pos->height = 1 + max(nodeHeight(pos->left), nodeHeight(pos->right));
pos->size = 1 + nodeSize(pos->left) + nodeSize(pos->right);
pos->prod = (lli)pos->value * nodeProd(pos->left) % mod *
nodeProd(pos->right) % mod;
}
void leftRotate(node *&x) {
node *y = x->right, *t = y->left;
y->left = x, x->right = t;
update(x), update(y);
x = y;
}
void rightRotate(node *&y) {
node *x = y->left, *t = x->right;
x->right = y, y->left = t;
update(y), update(x);
y = x;
}
void updateBalance(node *&pos) {
if (!pos)
return;
short int bal = pos->balance();
if (bal > 1) {
if (pos->right->balance() < 0)
rightRotate(pos->right);
leftRotate(pos);
} else if (bal < -1) {
if (pos->left->balance() > 0)
leftRotate(pos->left);
rightRotate(pos);
}
}
void insert(node *&pos, int value) {
if (pos) {
value < pos->value ? insert(pos->left, value) : insert(pos->right, value);
update(pos), updateBalance(pos);
} else {
pos = new node(value);
}
}
void erase(node *&pos, int value) {
if (!pos)
return;
if (value < pos->value)
erase(pos->left, value);
else if (value > pos->value)
erase(pos->right, value);
else {
if (!pos->left)
pos = pos->right;
else if (!pos->right)
pos = pos->left;
else {
pos->value = pos->right->maxLeftChild()->value;
erase(pos->right, pos->value);
}
}
update(pos), updateBalance(pos);
}
void multiply(int value) { insert(root, value); }
void divide(int value) { erase(root, value); }
int get() { return nodeProd(root); }
};
Tree mem[MX];
inline int g(int x) { return 1 + x; }
Tree dfs(int u, int p) {
for (int v : adj[u]) {
if (v == p)
continue;
mem[u].multiply(g(dfs(v, u).get()));
}
return mem[u];
}
void dfs2(int u, int p) {
ans[u] = mem[u].get();
for (int v : adj[u]) {
if (v == p)
continue;
int old_u = mem[u].get(), old_v = mem[v].get();
int div_u = g(old_v);
mem[u].divide(div_u);
int mult_v = g(mem[u].get());
mem[v].multiply(mult_v);
dfs2(v, u);
mem[v].divide(mult_v);
mem[u].multiply(div_u);
}
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
cin >> n >> mod;
for (int i = 1; i <= n - 1; ++i) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs(1, 0);
dfs2(1, 0);
for (int v = 1; v <= n; ++v) {
cout << ans[v] << "\n";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const int MX = 1e5 + 10;
vector<int> adj[MX];
int ans[MX];
lli mod;
struct node {
node *left, *right;
short int height;
int size;
int value, prod;
node(int value = 1)
: left(NULL), right(NULL), value(value), prod(value), height(1), size(1) {
}
inline short int balance() {
return (right ? right->height : 0) - (left ? left->height : 0);
}
node *maxLeftChild() {
node *ret = this;
while (ret->left)
ret = ret->left;
return ret;
}
};
struct Tree {
node *root;
Tree() : root(NULL) {}
inline int nodeSize(node *&pos) { return pos ? pos->size : 0; }
inline int nodeHeight(node *&pos) { return pos ? pos->height : 0; }
inline int nodeProd(node *&pos) { return pos ? pos->prod : 1; }
inline void update(node *&pos) {
if (!pos)
return;
pos->height = 1 + max(nodeHeight(pos->left), nodeHeight(pos->right));
pos->size = 1 + nodeSize(pos->left) + nodeSize(pos->right);
pos->prod = (lli)pos->value * nodeProd(pos->left) % mod *
nodeProd(pos->right) % mod;
}
void leftRotate(node *&x) {
node *y = x->right, *t = y->left;
y->left = x, x->right = t;
update(x), update(y);
x = y;
}
void rightRotate(node *&y) {
node *x = y->left, *t = x->right;
x->right = y, y->left = t;
update(y), update(x);
y = x;
}
void updateBalance(node *&pos) {
if (!pos)
return;
short int bal = pos->balance();
if (bal > 1) {
if (pos->right->balance() < 0)
rightRotate(pos->right);
leftRotate(pos);
} else if (bal < -1) {
if (pos->left->balance() > 0)
leftRotate(pos->left);
rightRotate(pos);
}
}
void insert(node *&pos, int value) {
if (pos) {
value < pos->value ? insert(pos->left, value) : insert(pos->right, value);
update(pos), updateBalance(pos);
} else {
pos = new node(value);
}
}
void erase(node *&pos, int value) {
if (!pos)
return;
if (value < pos->value)
erase(pos->left, value);
else if (value > pos->value)
erase(pos->right, value);
else {
if (!pos->left)
pos = pos->right;
else if (!pos->right)
pos = pos->left;
else {
pos->value = pos->right->maxLeftChild()->value;
erase(pos->right, pos->value);
}
}
update(pos), updateBalance(pos);
}
void multiply(int value) { insert(root, value); }
void divide(int value) { erase(root, value); }
int get() { return nodeProd(root); }
};
Tree mem[MX];
inline int g(int x) { return (1 + x) % mod; }
Tree dfs(int u, int p) {
for (int v : adj[u]) {
if (v == p)
continue;
mem[u].multiply(g(dfs(v, u).get()));
}
return mem[u];
}
void dfs2(int u, int p) {
ans[u] = mem[u].get();
for (int v : adj[u]) {
if (v == p)
continue;
int old_u = mem[u].get(), old_v = mem[v].get();
int div_u = g(old_v);
mem[u].divide(div_u);
int mult_v = g(mem[u].get());
mem[v].multiply(mult_v);
dfs2(v, u);
mem[v].divide(mult_v);
mem[u].multiply(div_u);
}
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
cin >> n >> mod;
for (int i = 1; i <= n - 1; ++i) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs(1, 0);
dfs2(1, 0);
for (int v = 1; v <= n; ++v) {
cout << ans[v] << "\n";
}
return 0;
} | [
"function.return_value.change"
] | 988,396 | 988,397 | u442895299 | cpp |
p03181 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e5 + 50;
ll dp[M], dp1[M], mod, n;
vector<ll> graph[M], pre[M], post[M];
void read_graph() {
for (int i = 0; i < n - 1; i++) {
int a, b;
cin >> a >> b;
a--, b--;
graph[a].push_back(b);
graph[b].push_back(a);
}
}
void dfs(ll node, ll par) {
dp[node] = 1;
for (auto child : graph[node]) {
if (child != par) {
dfs(child, node);
dp[node] *= (dp[child] + 1LL);
dp[node] %= mod;
}
}
if (par != -1)
pre[par].push_back(dp[node] + 1);
}
void dfs2(ll node, ll par) {
int c = 0;
for (auto child : graph[node]) {
if (child != par) {
dp1[child] = (dp1[node] + 1) % mod;
if (c > 0)
dp1[child] = (dp1[child] * pre[node][c - 1]) % mod;
if (post[node].size() - 1LL - c > 0)
dp1[child] = (dp1[child] * post[node][post[node].size() - 1 - c]) % mod;
dp[child] *= (dp1[child] + 1) % mod, dp[child] %= mod;
dfs2(child, node);
c++;
}
}
}
int main() {
cin >> n >> mod;
read_graph();
dfs(0LL, -1LL);
for (ll i = 0; i < n; i++) {
if (pre[i].size() != 0) {
for (ll j = pre[i].size() - 1; j >= 0; j--)
post[i].push_back(pre[i][j]);
for (int j = 1; j < pre[i].size(); j++) {
pre[i][j] = (pre[i][j] * pre[i][j - 1]) % mod;
post[i][j] = (post[i][j] * post[i][j - 1]) % mod;
}
}
}
dfs2(0LL, -1LL);
for (int i = 0; i < n; i++)
cout << dp[i] << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e5 + 50;
ll dp[M], dp1[M], mod, n;
vector<ll> graph[M], pre[M], post[M];
void read_graph() {
for (int i = 0; i < n - 1; i++) {
int a, b;
cin >> a >> b;
a--, b--;
graph[a].push_back(b);
graph[b].push_back(a);
}
}
void dfs(ll node, ll par) {
dp[node] = 1;
for (auto child : graph[node]) {
if (child != par) {
dfs(child, node);
dp[node] *= (dp[child] + 1LL);
dp[node] %= mod;
}
}
if (par != -1)
pre[par].push_back(dp[node] + 1);
}
void dfs2(ll node, ll par) {
int c = 0;
for (auto child : graph[node]) {
if (child != par) {
dp1[child] = (dp1[node] + 1) % mod;
if (c > 0)
dp1[child] = (dp1[child] * pre[node][c - 1]) % mod;
if (post[node].size() - 1LL != c)
dp1[child] = (dp1[child] * post[node][post[node].size() - 2 - c]) % mod;
dp[child] *= (dp1[child] + 1) % mod, dp[child] %= mod;
dfs2(child, node);
c++;
}
}
}
int main() {
cin >> n >> mod;
read_graph();
dfs(0LL, -1LL);
for (ll i = 0; i < n; i++) {
if (pre[i].size() != 0) {
for (ll j = pre[i].size() - 1; j >= 0; j--)
post[i].push_back(pre[i][j]);
for (int j = 1; j < pre[i].size(); j++) {
pre[i][j] = (pre[i][j] * pre[i][j - 1]) % mod;
post[i][j] = (post[i][j] * post[i][j - 1]) % mod;
}
}
}
dfs2(0LL, -1LL);
for (int i = 0; i < n; i++)
cout << dp[i] << endl;
} | [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 988,398 | 988,399 | u202796595 | cpp |
p03181 | #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// setbase - cout << setbase (16); cout << 100 << endl; Prints 64
// setfill - cout << setfill ('x') << setw (5); cout << 77 << endl; prints
// xxx77 setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
// cout.precision(x) cout<<fixed<<val; // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;
#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue<ll>
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout << "Case #" << x << ": ";
#define debug(x) cout << #x << " :" << x << endl;
#define rep(i, n) for (long long i = 0; i < n; i++)
#define f(i, a, b) for (long long i = a; i < b; i++)
#define fd(i, a, b) for (long long i = a; i >= b; i--)
#define sync \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<string> vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// Handle:cyber_rajat
vector<int> adj[100005];
vector<int> ad[100005];
ll dpup[100005] = {0}; // ways to color ith node black in downwards direction
ll dpdown[100005] = {0}; // ways to color ith node black in upwards direction
int n, m;
ll pre[100005], suf[100005];
void dfs1(int curr, int par) {
dpdown[curr] = 1;
for (auto x : adj[curr]) {
if (x == par)
continue;
dfs1(x, curr);
ad[curr].pb(x);
dpdown[curr] = (dpdown[curr] * ((dpdown[x] + 1) % m)) % m;
}
}
void dfs2(int curr) {
int len = ad[curr].size();
pre[0] = 1;
suf[len + 1] = 1;
for (int i = 0; i < len; i++) {
int x = ad[curr][i];
pre[i + 1] = (pre[i] * ((dpdown[x] + 1) % m)) % m;
}
for (int i = len - 1; i >= 0; i--) {
int x = ad[curr][i];
suf[i + 1] = (suf[i + 2] * ((dpdown[x] + 1) % m)) % m;
}
for (int i = 0; i < len; i++) {
int x = ad[curr][i];
dpup[x] = (pre[i] * suf[i + 2]) % m;
dpup[x] = (dpup[x] * ((dpup[curr] + 1) % m)) % m;
}
for (auto x : ad[curr]) {
dfs2(x);
}
}
int main(int argc, char const *argv[]) {
sync;
cin >> n >> m;
rep(i, n - 1) {
int a, b;
cin >> a >> b;
a--, b--;
adj[a].pb(b);
adj[b].pb(a);
}
dfs1(1, -1);
dfs2(1);
rep(i, n) cout << (dpdown[i] * ((dpup[i] + 1) % m)) % m << endl;
return 0;
}
| #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// setbase - cout << setbase (16); cout << 100 << endl; Prints 64
// setfill - cout << setfill ('x') << setw (5); cout << 77 << endl; prints
// xxx77 setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
// cout.precision(x) cout<<fixed<<val; // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;
#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue<ll>
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout << "Case #" << x << ": ";
#define debug(x) cout << #x << " :" << x << endl;
#define rep(i, n) for (long long i = 0; i < n; i++)
#define f(i, a, b) for (long long i = a; i < b; i++)
#define fd(i, a, b) for (long long i = a; i >= b; i--)
#define sync \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<string> vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// Handle:cyber_rajat
vector<int> adj[100005];
vector<int> ad[100005];
ll dpup[100005] = {0}; // ways to color ith node black in downwards direction
ll dpdown[100005] = {0}; // ways to color ith node black in upwards direction
int n, m;
ll pre[100005], suf[100005];
void dfs1(int curr, int par) {
dpdown[curr] = 1;
for (auto x : adj[curr]) {
if (x == par)
continue;
dfs1(x, curr);
ad[curr].pb(x);
dpdown[curr] = (dpdown[curr] * ((dpdown[x] + 1) % m)) % m;
}
}
void dfs2(int curr) {
int len = ad[curr].size();
pre[0] = 1;
suf[len + 1] = 1;
for (int i = 0; i < len; i++) {
int x = ad[curr][i];
pre[i + 1] = (pre[i] * ((dpdown[x] + 1) % m)) % m;
}
for (int i = len - 1; i >= 0; i--) {
int x = ad[curr][i];
suf[i + 1] = (suf[i + 2] * ((dpdown[x] + 1) % m)) % m;
}
for (int i = 0; i < len; i++) {
int x = ad[curr][i];
dpup[x] = (pre[i] * suf[i + 2]) % m;
dpup[x] = (dpup[x] * ((dpup[curr] + 1) % m)) % m;
}
for (auto x : ad[curr]) {
dfs2(x);
}
}
int main(int argc, char const *argv[]) {
sync;
cin >> n >> m;
rep(i, n - 1) {
int a, b;
cin >> a >> b;
a--, b--;
adj[a].pb(b);
adj[b].pb(a);
}
dfs1(0, -1);
dfs2(0);
rep(i, n) cout << (dpdown[i] * ((dpup[i] + 1) % m)) % m << endl;
return 0;
}
| [
"literal.number.change",
"call.arguments.change"
] | 988,406 | 988,407 | u431173823 | cpp |
p03181 | //#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
};
using LL = int_fast64_t;
const int MAXN = 1e5 + 7;
int n;
LL m, dp[MAXN], f[MAXN];
vector<int> G[MAXN];
vector<LL> pre[MAXN], suf[MAXN];
LL dfs(int u, int par) {
dp[u] = 1;
for (int v : G[u])
if (v != par)
dp[u] = (dp[u] * dfs(v, u)) % m;
return dp[u] + 1;
}
void solve(int u, int par, int pos) {
LL fp = (pos ? pre[par][pos - 1] : 1) *
(pos == (int)suf[par].size() - 1 ? 1 : suf[par][pos + 1]) % m;
f[u] = dp[u] * (fp + 1) % m;
for (int i = 0; i < (int)G[u].size(); i++) {
if (G[u][i] == par) {
pre[u].emplace_back(1);
suf[u].emplace_back(1);
continue;
}
pre[u].emplace_back(dp[G[u][i]] + 1);
suf[u].emplace_back(dp[G[u][i]] + 1);
}
pre[u].emplace_back(fp + 1);
suf[u].emplace_back(fp + 1);
for (int i = 1; i < (int)G[u].size(); i++)
pre[u][i] = pre[u][i] * pre[u][i - 1] % m;
for (int i = G[u].size() - 2; i >= 0; i--)
suf[u][i] = suf[u][i] * suf[u][i + 1] % m;
for (int i = 0; i < (int)G[u].size(); i++)
if (G[u][i] != par)
solve(G[u][i], u, i);
}
int main() {
____();
cin >> n >> m;
for (int i = 1; i < n; i++) {
int u, v;
cin >> u >> v;
G[u].emplace_back(v);
G[v].emplace_back(u);
}
dfs(1, 0);
f[1] = dp[1];
for (int i = 0; i < (int)G[1].size(); i++) {
pre[1].emplace_back(dp[G[1][i]] + 1);
suf[1].emplace_back(dp[G[1][i]] + 1);
}
for (int i = 1; i < (int)G[1].size(); i++)
pre[1][i] = pre[1][i] * pre[1][i - 1] % m;
for (int i = G[1].size() - 2; i >= 0; i--)
suf[1][i] = suf[1][i] * suf[1][i + 1] % m;
for (int i = 0; i < (int)G[1].size(); i++)
solve(G[1][i], 1, i);
for (int i = 1; i <= n; i++)
cout << f[i] << endl;
return 0;
} | //#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
};
using LL = int_fast64_t;
const int MAXN = 1e5 + 7;
int n;
LL m, dp[MAXN], f[MAXN];
vector<int> G[MAXN];
vector<LL> pre[MAXN], suf[MAXN];
LL dfs(int u, int par) {
dp[u] = 1;
for (int v : G[u])
if (v != par)
dp[u] = (dp[u] * dfs(v, u)) % m;
return dp[u] + 1;
}
void solve(int u, int par, int pos) {
LL fp = (pos ? pre[par][pos - 1] : 1) *
(pos == (int)suf[par].size() - 1 ? 1 : suf[par][pos + 1]) % m;
f[u] = dp[u] * (fp + 1) % m;
for (int i = 0; i < (int)G[u].size(); i++) {
if (G[u][i] == par) {
pre[u].emplace_back(1);
suf[u].emplace_back(1);
continue;
}
pre[u].emplace_back(dp[G[u][i]] + 1);
suf[u].emplace_back(dp[G[u][i]] + 1);
}
pre[u].emplace_back(fp + 1);
suf[u].emplace_back(fp + 1);
for (int i = 1; i < (int)pre[u].size(); i++)
pre[u][i] = pre[u][i] * pre[u][i - 1] % m;
for (int i = suf[u].size() - 2; i >= 0; i--)
suf[u][i] = suf[u][i] * suf[u][i + 1] % m;
for (int i = 0; i < (int)G[u].size(); i++)
if (G[u][i] != par)
solve(G[u][i], u, i);
}
int main() {
____();
cin >> n >> m;
for (int i = 1; i < n; i++) {
int u, v;
cin >> u >> v;
G[u].emplace_back(v);
G[v].emplace_back(u);
}
dfs(1, 0);
f[1] = dp[1];
for (int i = 0; i < (int)G[1].size(); i++) {
pre[1].emplace_back(dp[G[1][i]] + 1);
suf[1].emplace_back(dp[G[1][i]] + 1);
}
for (int i = 1; i < (int)G[1].size(); i++)
pre[1][i] = pre[1][i] * pre[1][i - 1] % m;
for (int i = G[1].size() - 2; i >= 0; i--)
suf[1][i] = suf[1][i] * suf[1][i + 1] % m;
for (int i = 0; i < (int)G[1].size(); i++)
solve(G[1][i], 1, i);
for (int i = 1; i <= n; i++)
cout << f[i] << endl;
return 0;
} | [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"control_flow.loop.for.initializer.change"
] | 988,408 | 988,409 | u231378282 | cpp |
p03181 | // header
#ifdef LOCAL
#include "cxx-prettyprint-master/prettyprint.hpp"
#define print(x) cout << x << endl
#else
#define print(...) 42
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
// types
using namespace std;
using ll = long long;
typedef pair<ll, ll> Pl;
typedef pair<int, int> Pi;
typedef vector<ll> vl;
typedef vector<int> vi;
template <typename T> using mat = vector<vector<T>>;
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
// abreviations
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rev(i, n) for (int i = n - 1; i >= 0; i--)
#define SZ(x) ((ll)(x).size())
#define pb(x) push_back(x)
#define ff first
#define ss second
#define mp make_pair
// functions
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <typename T> T mypow(T x, ll n) {
T ret = 1;
while (n > 0) {
if (n & 1)
(ret *= x);
(x *= x);
n >>= 1;
}
return ret;
}
uint64_t my_rand(void) {
static uint64_t x = 88172645463325252ULL;
x = x ^ (x << 13);
x = x ^ (x >> 7);
return x = x ^ (x << 17);
}
// graph template
template <typename T> struct edge {
int src, to;
T cost;
edge(int to, T cost) : src(-1), to(to), cost(cost) {}
edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
// constant
#define INF 1'010'000'000'000'000'017LL
#define mod 1000000007LL
// typedef modint<mod> mint;
#define eps 0.000001
const double PI = M_PI;
// library
UnWeightedGraph g;
vl cnt;
ll m;
void dfs1(int v, int p) {
ll res = 1;
for (auto e : g[v]) {
if (e == p)
continue;
dfs1(e, v);
res *= (cnt[e] + 1);
res %= m;
}
cnt[v] = res;
}
vl ans;
void dfs2(int v, int p, ll s) {
vl cumprod = {s + 1}, cumprod_back = {1};
int l = SZ(g[v]);
rep(i, l) {
auto e = g[v][i];
if (e == p)
continue;
cumprod.pb(cumprod.back() * (cnt[e] + 1) % m);
}
rev(i, l) {
auto e = g[v][i];
if (e == p)
continue;
cumprod_back.pb(cumprod_back.back() * (cnt[e] + 1) % m);
}
l = SZ(cumprod);
int i = 0;
for (auto e : g[v]) {
if (e == p)
continue;
dfs2(e, v, cumprod[i] * cumprod_back[l - i - 2] % m);
i++;
}
ans[v] = cumprod.back();
}
// main
int main() {
ll n;
cin >> n >> m;
g.resize(n);
cnt.resize(n);
ans.resize(n);
rep(i, n - 1) {
int x, y;
cin >> x >> y;
g[x - 1].pb(y - 1);
g[y - 1].pb(x - 1);
}
dfs1(0, -1);
dfs2(0, -1, 0);
rep(i, n) cout << ans[i] << endl;
}
| // header
#ifdef LOCAL
#include "cxx-prettyprint-master/prettyprint.hpp"
#define print(x) cout << x << endl
#else
#define print(...) 42
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
// types
using namespace std;
using ll = long long;
typedef pair<ll, ll> Pl;
typedef pair<int, int> Pi;
typedef vector<ll> vl;
typedef vector<int> vi;
template <typename T> using mat = vector<vector<T>>;
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
// abreviations
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rev(i, n) for (int i = n - 1; i >= 0; i--)
#define SZ(x) ((ll)(x).size())
#define pb(x) push_back(x)
#define ff first
#define ss second
#define mp make_pair
// functions
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <typename T> T mypow(T x, ll n) {
T ret = 1;
while (n > 0) {
if (n & 1)
(ret *= x);
(x *= x);
n >>= 1;
}
return ret;
}
uint64_t my_rand(void) {
static uint64_t x = 88172645463325252ULL;
x = x ^ (x << 13);
x = x ^ (x >> 7);
return x = x ^ (x << 17);
}
// graph template
template <typename T> struct edge {
int src, to;
T cost;
edge(int to, T cost) : src(-1), to(to), cost(cost) {}
edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
// constant
#define INF 1'010'000'000'000'000'017LL
#define mod 1000000007LL
// typedef modint<mod> mint;
#define eps 0.000001
const double PI = M_PI;
// library
UnWeightedGraph g;
vl cnt;
ll m;
void dfs1(int v, int p) {
ll res = 1;
for (auto e : g[v]) {
if (e == p)
continue;
dfs1(e, v);
res *= (cnt[e] + 1);
res %= m;
}
cnt[v] = res;
}
vl ans;
void dfs2(int v, int p, ll s) {
vl cumprod = {s + 1}, cumprod_back = {1};
int l = SZ(g[v]);
rep(i, l) {
auto e = g[v][i];
if (e == p)
continue;
cumprod.pb(cumprod.back() * (cnt[e] + 1) % m);
}
rev(i, l) {
auto e = g[v][i];
if (e == p)
continue;
cumprod_back.pb(cumprod_back.back() * (cnt[e] + 1) % m);
}
l = SZ(cumprod);
int i = 0;
for (auto e : g[v]) {
if (e == p)
continue;
dfs2(e, v, cumprod[i] * cumprod_back[l - i - 2] % m);
i++;
}
ans[v] = cumprod.back() % m;
}
// main
int main() {
ll n;
cin >> n >> m;
g.resize(n);
cnt.resize(n);
ans.resize(n);
rep(i, n - 1) {
int x, y;
cin >> x >> y;
g[x - 1].pb(y - 1);
g[y - 1].pb(x - 1);
}
dfs1(0, -1);
dfs2(0, -1, 0);
rep(i, n) cout << ans[i] << endl;
}
| [
"assignment.change"
] | 988,412 | 988,413 | u310678820 | cpp |
p03181 | #include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const long long MOD = 1e9 + 7;
int n, now[N];
int v[N], nxt[N], head[N];
long long m, dp[N], l[N], r[N], ans[N];
void dfs(int x, int fa) {
dp[x] = 1;
for (int i = head[x]; i > 0; i = nxt[i]) {
if (v[i] == fa)
continue;
dfs(v[i], x), dp[x] = dp[x] * (dp[v[i]] + 1) % m;
}
int cnt = 0;
for (int i = head[x]; i > 0; i = nxt[i]) {
if (v[i] != fa)
now[++cnt] = v[i];
}
if (!cnt)
return;
l[now[1]] = r[now[cnt]] = 1;
for (int i = 2; i <= cnt; i++)
l[now[i]] = l[now[i - 1]] * (dp[now[i]] + 1) % m;
for (int i = cnt - 1; i >= 1; i--)
r[now[i]] = r[now[i + 1]] * (dp[now[i]] + 1) % m;
}
void dfs2(int x, int fa, long long val) {
ans[x] = dp[x] * (val + 1) % m;
for (int i = head[x]; i > 0; i = nxt[i]) {
if (v[i] == fa)
continue;
dfs2(v[i], x, (val + 1) * l[v[i]] % m * r[v[i]] % m);
}
}
int main() {
scanf("%d%lld", &n, &m);
for (int i = 1; i < n; i++) {
scanf("%d%d", &v[i], &v[i + n]);
nxt[i] = head[v[i + n]], head[v[i + n]] = i;
nxt[i + n] = head[v[i]], head[v[i]] = i + n;
}
dfs(1, 0);
dfs2(1, 0, 0);
for (int i = 1; i <= n; i++)
printf("%lld\n", ans[i]);
} | #include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const long long MOD = 1e9 + 7;
int n, now[N];
int v[N], nxt[N], head[N];
long long m, dp[N], l[N], r[N], ans[N];
void dfs(int x, int fa) {
dp[x] = 1;
for (int i = head[x]; i > 0; i = nxt[i]) {
if (v[i] == fa)
continue;
dfs(v[i], x), dp[x] = dp[x] * (dp[v[i]] + 1) % m;
}
int cnt = 0;
for (int i = head[x]; i > 0; i = nxt[i]) {
if (v[i] != fa)
now[++cnt] = v[i];
}
if (!cnt)
return;
l[now[1]] = r[now[cnt]] = 1;
for (int i = 2; i <= cnt; i++)
l[now[i]] = l[now[i - 1]] * (dp[now[i - 1]] + 1) % m;
for (int i = cnt - 1; i >= 1; i--)
r[now[i]] = r[now[i + 1]] * (dp[now[i + 1]] + 1) % m;
}
void dfs2(int x, int fa, long long val) {
ans[x] = dp[x] * (val + 1) % m;
for (int i = head[x]; i > 0; i = nxt[i]) {
if (v[i] == fa)
continue;
dfs2(v[i], x, (val + 1) * l[v[i]] % m * r[v[i]] % m);
}
}
int main() {
scanf("%d%lld", &n, &m);
for (int i = 1; i < n; i++) {
scanf("%d%d", &v[i], &v[i + n]);
nxt[i] = head[v[i + n]], head[v[i + n]] = i;
nxt[i + n] = head[v[i]], head[v[i]] = i + n;
}
dfs(1, 0);
dfs2(1, 0, 0);
for (int i = 1; i <= n; i++)
printf("%lld\n", ans[i]);
} | [
"assignment.change"
] | 988,414 | 988,415 | u541361127 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.