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 |
|---|---|---|---|---|---|---|---|
p03112 | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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 <class T> int former(const vector<T> &v, T x) {
return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T> int latter(const vector<T> &v, T x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1 << 0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1 << 1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1 << 2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1 << 3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1 << 4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1 << 5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1 << 6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1 << 7) // 0000 0000 1000 0000
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const ll LLINF = 1LL << 60;
const int INTINF = 1 << 29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) {}
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n = G.size();
vector<T> d(n, INF);
vector<int> b(n, -1);
priority_queue<P, vector<P>, greater<P>> q;
d[s] = 0;
q.emplace(d[s], s);
while (!q.empty()) {
P p = q.top();
q.pop();
int v = p.second;
if (d[v] < p.first)
continue;
for (auto &e : G[v]) {
int u = e.first;
T c = e.second;
if (d[u] > d[v] + c) {
d[u] = d[v] + c;
b[u] = v;
q.emplace(d[u], u);
}
}
}
return d;
}
vector<vector<int>> bfs(vector<string> &s, int sy, int sx, char wall, int dir) {
int h = s.size(), w = s.front().size();
vector<vector<int>> dp(h, vector<int>(w, -1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx] = 0;
q.emplace(sy, sx);
int dy[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
auto in = [&](int y, int x) { return 0 <= y && y < h && 0 <= x && x < w; };
while (!q.empty()) {
int y, x;
tie(y, x) = q.front();
q.pop();
for (int k = 0; k < dir; k++) {
int ny = y + dy[k], nx = x + dx[k];
if (!in(ny, nx) || s[ny][nx] == wall)
continue;
if (~dp[ny][nx])
continue;
dp[ny][nx] = dp[y][x] + 1;
q.emplace(ny, nx);
}
}
return dp;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int main(void) {
ll A, B, Q;
cin >> A >> B >> Q;
vector<ll> s(A);
vector<ll> t(B);
ll x;
rep(i, A) { cin >> s[i]; }
rep(i, B) cin >> t[i];
s.push_back(LLINF);
s.push_back(-LLINF);
t.push_back(LLINF);
t.push_back(-LLINF);
sort(all(s));
sort(all(t));
rep(i, Q) {
cin >> x;
ll res = LLINF;
for (int j = 0; j < 2; ++j) {
ll first = (i ? s[former(s, x)] : s[latter(s, x)]);
for (int k = 0; k < 2; ++k) {
ll second = (j ? t[former(t, first)] : t[latter(t, first)]);
chmin(res, abs(x - first) + abs(first - second));
}
}
for (int j = 0; j < 2; ++j) {
ll first = (i ? t[former(t, x)] : t[latter(t, x)]);
for (int k = 0; k < 2; ++k) {
ll second = (j ? s[former(s, first)] : s[latter(s, first)]);
chmin(res, abs(x - first) + abs(first - second));
}
}
cout << res << endl;
}
}
| #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, num, n) for (ll i = num, i##_len = (n); i < i##_len; ++i)
#define repprev(i, a, b) for (ll i = b - 1; i >= a; i--)
#define reprev(i, n) repprev(i, 0, n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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 <class T> int former(const vector<T> &v, T x) {
return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T> int latter(const vector<T> &v, T x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1 << 0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1 << 1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1 << 2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1 << 3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1 << 4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1 << 5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1 << 6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1 << 7) // 0000 0000 1000 0000
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const ll LLINF = 1LL << 60;
const int INTINF = 1 << 29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) {}
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n = G.size();
vector<T> d(n, INF);
vector<int> b(n, -1);
priority_queue<P, vector<P>, greater<P>> q;
d[s] = 0;
q.emplace(d[s], s);
while (!q.empty()) {
P p = q.top();
q.pop();
int v = p.second;
if (d[v] < p.first)
continue;
for (auto &e : G[v]) {
int u = e.first;
T c = e.second;
if (d[u] > d[v] + c) {
d[u] = d[v] + c;
b[u] = v;
q.emplace(d[u], u);
}
}
}
return d;
}
vector<vector<int>> bfs(vector<string> &s, int sy, int sx, char wall, int dir) {
int h = s.size(), w = s.front().size();
vector<vector<int>> dp(h, vector<int>(w, -1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx] = 0;
q.emplace(sy, sx);
int dy[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
auto in = [&](int y, int x) { return 0 <= y && y < h && 0 <= x && x < w; };
while (!q.empty()) {
int y, x;
tie(y, x) = q.front();
q.pop();
for (int k = 0; k < dir; k++) {
int ny = y + dy[k], nx = x + dx[k];
if (!in(ny, nx) || s[ny][nx] == wall)
continue;
if (~dp[ny][nx])
continue;
dp[ny][nx] = dp[y][x] + 1;
q.emplace(ny, nx);
}
}
return dp;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int main(void) {
ll A, B, Q;
cin >> A >> B >> Q;
vector<ll> s(A);
vector<ll> t(B);
ll x;
rep(i, A) { cin >> s[i]; }
rep(i, B) cin >> t[i];
s.push_back(LLINF);
s.push_back(-LLINF);
t.push_back(LLINF);
t.push_back(-LLINF);
sort(all(s));
sort(all(t));
rep(i, Q) {
cin >> x;
ll res = LLINF;
for (int j = 0; j < 2; ++j) {
ll first = (j ? s[former(s, x)] : s[latter(s, x)]);
for (int k = 0; k < 2; ++k) {
ll second = (k ? t[former(t, first)] : t[latter(t, first)]);
chmin(res, abs(x - first) + abs(first - second));
}
}
for (int j = 0; j < 2; ++j) {
ll first = (j ? t[former(t, x)] : t[latter(t, x)]);
for (int k = 0; k < 2; ++k) {
ll second = (k ? s[former(s, first)] : s[latter(s, first)]);
chmin(res, abs(x - first) + abs(first - second));
}
}
cout << res << endl;
}
}
| [
"identifier.change",
"control_flow.loop.for.condition.change"
] | 925,008 | 925,009 | u135572611 | cpp |
p03112 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
static const ll INF = (int)1e18;
int main() {
vector<ll> s, t;
ll A, B, Q;
scanf("%lld %lld %lld", &A, &B, &Q);
s.push_back(-INF);
t.push_back(-INF);
ll s_, t_;
for (int i = 0; i < A; i++) {
scanf("%lld", &s_);
s.push_back(s_);
}
for (int i = 0; i < B; i++) {
scanf("%lld", &t_);
t.push_back(t_);
}
s.push_back(INF);
t.push_back(INF);
ll x;
vector<ll>::iterator it_s, it_t;
vector<ll> ans;
ll s_near2[2];
ll t_near2[2];
for (int i = 0; i < Q; i++) {
scanf("%lld", &x);
it_s = lower_bound(s.begin(), s.end(), x);
it_t = lower_bound(t.begin(), t.end(), x);
s_near2[0] = *it_s;
it_s--;
s_near2[1] = *it_s;
t_near2[0] = *it_t;
it_t--;
t_near2[1] = *it_t;
vector<ll> dist;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
dist.push_back(abs(x - s_near2[i]) + abs(s_near2[i] - t_near2[j]));
dist.push_back(abs(x - t_near2[i]) + abs(t_near2[i] - s_near2[j]));
}
}
ans.push_back(*min_element(dist.begin(), dist.end()));
}
for (int i = 0; i < Q; i++) {
printf("%lld\n", ans[i]);
}
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;
static const ll INF = 1e18;
int main() {
vector<ll> s, t;
ll A, B, Q;
scanf("%lld %lld %lld", &A, &B, &Q);
s.push_back(-INF);
t.push_back(-INF);
ll s_, t_;
for (int i = 0; i < A; i++) {
scanf("%lld", &s_);
s.push_back(s_);
}
for (int i = 0; i < B; i++) {
scanf("%lld", &t_);
t.push_back(t_);
}
s.push_back(INF);
t.push_back(INF);
ll x;
vector<ll>::iterator it_s, it_t;
vector<ll> ans;
ll s_near2[2];
ll t_near2[2];
for (int i = 0; i < Q; i++) {
scanf("%lld", &x);
it_s = lower_bound(s.begin(), s.end(), x);
it_t = lower_bound(t.begin(), t.end(), x);
s_near2[0] = *it_s;
it_s--;
s_near2[1] = *it_s;
t_near2[0] = *it_t;
it_t--;
t_near2[1] = *it_t;
vector<ll> dist;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
dist.push_back(abs(x - s_near2[i]) + abs(s_near2[i] - t_near2[j]));
dist.push_back(abs(x - t_near2[i]) + abs(t_near2[i] - s_near2[j]));
}
}
ans.push_back(*min_element(dist.begin(), dist.end()));
}
for (int i = 0; i < Q; i++) {
printf("%lld\n", ans[i]);
}
}
| [] | 925,020 | 925,021 | u603234915 | cpp |
p03112 | #include <algorithm>
#include <array>
#include <iostream>
using namespace std;
using int64 = long long int;
constexpr int MaxAB = 100000 + 10;
int64 P[2][MaxAB];
int L[2];
pair<int, int> LeftRight(int64 position, int type) {
if (L[type] == 1) {
return make_pair(0, 0);
}
auto where = upper_bound(P[type], P[type] + L[type], position);
if (where > P[type] + L[type]) {
where--;
}
int index = static_cast<int>(where - P[type]);
if (index == 0)
return make_pair(0, 1);
else if (index == L[type])
return make_pair(L[type] - 2, L[type] - 1);
else
return make_pair(index - 1, index);
}
int64 Query(int64 position) {
auto shrine = LeftRight(position, 0);
auto temple = LeftRight(position, 1);
array<int64, 4> dests = {P[0][shrine.first], P[0][shrine.second],
-P[1][shrine.first], -P[1][shrine.second]};
sort(dests.begin(), dests.end());
int64 answer = 1LL << 50;
do {
int64 current = position;
int64 cost = 0;
bool positive = false, negative = false;
for (auto next : dests) {
cost += abs(current - abs(next));
current = abs(next);
if (next > 0)
positive = true;
else
negative = true;
if (positive && negative)
break;
}
answer = min(answer, cost);
} while (next_permutation(dests.begin(), dests.end()));
return answer;
}
int main() {
int a, b, q;
cin >> a >> b >> q;
L[0] = a;
L[1] = b;
int index = 0;
for (int i = 0; i < a; i++) {
cin >> P[0][i];
}
for (int i = 0; i < b; i++) {
cin >> P[1][i];
}
for (int i = 0; i < q; i++) {
int64 x;
cin >> x;
cout << Query(x) << endl;
}
} | #include <algorithm>
#include <array>
#include <iostream>
using namespace std;
using int64 = long long int;
constexpr int MaxAB = 100000 + 10;
int64 P[2][MaxAB];
int L[2];
pair<int, int> LeftRight(int64 position, int type) {
if (L[type] == 1) {
return make_pair(0, 0);
}
auto where = upper_bound(P[type], P[type] + L[type], position);
if (where > P[type] + L[type]) {
where--;
}
int index = static_cast<int>(where - P[type]);
if (index == 0)
return make_pair(0, 1);
else if (index == L[type])
return make_pair(L[type] - 2, L[type] - 1);
else
return make_pair(index - 1, index);
}
int64 Query(int64 position) {
auto shrine = LeftRight(position, 0);
auto temple = LeftRight(position, 1);
array<int64, 4> dests = {P[0][shrine.first], P[0][shrine.second],
-P[1][temple.first], -P[1][temple.second]};
sort(dests.begin(), dests.end());
int64 answer = 1LL << 50;
do {
int64 current = position;
int64 cost = 0;
bool positive = false, negative = false;
for (auto next : dests) {
cost += abs(current - abs(next));
current = abs(next);
if (next > 0)
positive = true;
else
negative = true;
if (positive && negative)
break;
}
answer = min(answer, cost);
} while (next_permutation(dests.begin(), dests.end()));
return answer;
}
int main() {
int a, b, q;
cin >> a >> b >> q;
L[0] = a;
L[1] = b;
int index = 0;
for (int i = 0; i < a; i++) {
cin >> P[0][i];
}
for (int i = 0; i < b; i++) {
cin >> P[1][i];
}
for (int i = 0; i < q; i++) {
int64 x;
cin >> x;
cout << Query(x) << endl;
}
} | [
"identifier.change",
"variable_access.subscript.index.change"
] | 925,029 | 925,030 | u636614373 | cpp |
p03112 | #include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define pb push_back
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
int main() {
int A, B, Q;
cin >> A >> B >> Q;
vector<ll> s, t;
s.pb(-1e18);
t.pb(-1e18);
FOR(i, 0, A) {
ll x;
cin >> x;
s.pb(x);
}
s.pb(-s[0]);
FOR(i, 0, B) {
ll x;
cin >> x;
t.pb(x);
}
t.pb(-t[0]);
FOR(i, 0, Q) {
int d;
cin >> d;
int r = lower_bound(s.begin(), s.end(), d) - s.begin();
int l = lower_bound(t.begin(), t.end(), d) - t.begin();
ll ans = 1e18;
ans = min(ans, max(s[r], t[l]) - d);
ans = min(ans, d - min(s[r - 1], t[l - 1]));
ans = min(ans, 2 * s[r] - t[l - 1] - d);
ans = min(ans, 2 * t[l] - s[r - 1] - d);
ans = min(ans, -2 * s[r - 1] + t[l] + d);
ans = min(ans, -2 * t[l - 1] + s[r] + d);
printf("%lld\n", ans);
}
} | #include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define pb push_back
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
int main() {
int A, B, Q;
cin >> A >> B >> Q;
vector<ll> s, t;
s.pb(-1e18);
t.pb(-1e18);
FOR(i, 0, A) {
ll x;
cin >> x;
s.pb(x);
}
s.pb(-s[0]);
FOR(i, 0, B) {
ll x;
cin >> x;
t.pb(x);
}
t.pb(-t[0]);
FOR(i, 0, Q) {
ll d;
cin >> d;
int r = lower_bound(s.begin(), s.end(), d) - s.begin();
int l = lower_bound(t.begin(), t.end(), d) - t.begin();
ll ans = 1e18;
ans = min(ans, max(s[r], t[l]) - d);
ans = min(ans, d - min(s[r - 1], t[l - 1]));
ans = min(ans, 2 * s[r] - t[l - 1] - d);
ans = min(ans, 2 * t[l] - s[r - 1] - d);
ans = min(ans, -2 * s[r - 1] + t[l] + d);
ans = min(ans, -2 * t[l - 1] + s[r] + d);
printf("%lld\n", ans);
}
} | [
"variable_declaration.type.change"
] | 925,031 | 925,032 | u508571192 | cpp |
p03112 | #include <bits/stdc++.h>
using namespace std;
#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
using ll = long long;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define MOD 1000000007
const ll INF = 1e9;
int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> int former(const vector<T> &v, T x) {
return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T> int latter(const vector<T> &v, T x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}
int main(int argc, char const *argv[]) {
int A, B, Q;
std::cin >> A >> B >> Q;
std::vector<ll> s(A), t(B);
rep(i, A) std::cin >> s[i];
rep(i, B) std::cin >> t[i];
s.pb(INF);
s.pb(-INF);
sort(s.begin(), s.end());
t.pb(INF);
t.pb(-INF);
sort(t.begin(), t.end());
for (int p = 0; p < Q;
p++) { //右左,左右,左左,右右の4通りをs,tの順序2通りで計8通り
ll x;
std::cin >> x;
ll ans = INF;
for (int i = 0; i < 2; i++) {
ll first;
if (i)
first = s[former(s, x)];
else
first = s[latter(s, x)];
for (int j = 0; j < 2; j++) {
ll second;
if (j)
second = t[former(t, first)];
else
second = t[latter(t, first)];
chmin(ans, abs(x - first) + abs(first - second));
}
}
for (int i = 0; i < 2; i++) {
ll first;
if (i)
first = t[former(t, x)];
else
first = t[latter(t, x)];
for (int j = 0; j < 2; j++) {
ll second;
if (j)
second = s[former(s, first)];
else
second = s[latter(s, first)];
chmin(ans, abs(x - first) + abs(first - second));
}
}
std::cout << ans << '\n';
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#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
using ll = long long;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define MOD 1000000007
const ll INF = 1e18;
int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> int former(const vector<T> &v, T x) {
return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T> int latter(const vector<T> &v, T x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}
int main(int argc, char const *argv[]) {
int A, B, Q;
std::cin >> A >> B >> Q;
std::vector<ll> s(A), t(B);
rep(i, A) std::cin >> s[i];
rep(i, B) std::cin >> t[i];
s.pb(INF);
s.pb(-INF);
sort(s.begin(), s.end());
t.pb(INF);
t.pb(-INF);
sort(t.begin(), t.end());
for (int p = 0; p < Q;
p++) { //右左,左右,左左,右右の4通りをs,tの順序2通りで計8通り
ll x;
std::cin >> x;
ll ans = INF;
for (int i = 0; i < 2; i++) {
ll first;
if (i)
first = s[former(s, x)];
else
first = s[latter(s, x)];
for (int j = 0; j < 2; j++) {
ll second;
if (j)
second = t[former(t, first)];
else
second = t[latter(t, first)];
chmin(ans, abs(x - first) + abs(first - second));
}
}
for (int i = 0; i < 2; i++) {
ll first;
if (i)
first = t[former(t, x)];
else
first = t[latter(t, x)];
for (int j = 0; j < 2; j++) {
ll second;
if (j)
second = s[former(s, first)];
else
second = s[latter(s, first)];
chmin(ans, abs(x - first) + abs(first - second));
}
}
std::cout << ans << '\n';
}
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 925,037 | 925,038 | u863279562 | cpp |
p03112 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main() {
int A, B, Q;
cin >> A >> B >> Q;
vll s, t, x;
for (int i = 0; i < A; ++i) {
ll s_;
cin >> s_;
s.push_back(s_);
}
for (int i = 0; i < B; ++i) {
ll t_;
cin >> t_;
t.push_back(t_);
}
for (int i = 0; i < Q; ++i) {
ll x_;
cin >> x_;
x.push_back(x_);
}
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < Q; ++i) {
ll ans = 10000000000;
int j = lower_bound(s.begin(), s.end(), x[i]) - s.begin();
int k = lower_bound(t.begin(), t.end(), x[i]) - t.begin();
if (j < A && k < B) {
ll sp = s[j];
ll tp = t[k];
ans = min(ans, max(sp, tp) - x[i]);
}
if (j < A && k > 0) {
ll sp = s[j];
ll tm = t[k - 1];
ans = min(ans, min(2 * sp - tm - x[i], sp - 2 * tm + x[i]));
}
if (j > 0 && k < B) {
ll sm = s[j - 1];
ll tp = t[k];
ans = min(ans, min(2 * tp - sm - x[i], tp - 2 * sm + x[i]));
}
if (j > 0 && k > 0) {
ll sm = s[j - 1];
ll tm = t[k - 1];
ans = min(ans, x[i] - min(sm, tm));
}
cout << ans << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main() {
int A, B, Q;
cin >> A >> B >> Q;
vll s, t, x;
for (int i = 0; i < A; ++i) {
ll s_;
cin >> s_;
s.push_back(s_);
}
for (int i = 0; i < B; ++i) {
ll t_;
cin >> t_;
t.push_back(t_);
}
for (int i = 0; i < Q; ++i) {
ll x_;
cin >> x_;
x.push_back(x_);
}
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < Q; ++i) {
ll ans = 1000000000000;
int j = lower_bound(s.begin(), s.end(), x[i]) - s.begin();
int k = lower_bound(t.begin(), t.end(), x[i]) - t.begin();
if (j < A && k < B) {
ll sp = s[j];
ll tp = t[k];
ans = min(ans, max(sp, tp) - x[i]);
}
if (j < A && k > 0) {
ll sp = s[j];
ll tm = t[k - 1];
ans = min(ans, min(2 * sp - tm - x[i], sp - 2 * tm + x[i]));
}
if (j > 0 && k < B) {
ll sm = s[j - 1];
ll tp = t[k];
ans = min(ans, min(2 * tp - sm - x[i], tp - 2 * sm + x[i]));
}
if (j > 0 && k > 0) {
ll sm = s[j - 1];
ll tm = t[k - 1];
ans = min(ans, x[i] - min(sm, tm));
}
cout << ans << endl;
}
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change"
] | 925,041 | 925,042 | u826487371 | cpp |
p03112 | #include <algorithm>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int A, B, Q;
cin >> A >> B >> Q;
vector<long long> s(A);
vector<long long> t(B);
vector<long long> x(Q);
for (int i = 0; i < A; i++) {
cin >> s[i];
}
for (int i = 0; i < B; i++) {
cin >> t[i];
}
for (int i = 0; i < Q; i++) {
cin >> x[i];
}
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < Q; i++) {
long long ans = INT64_MAX;
vector<long long>::iterator it_s = upper_bound(s.begin(), s.end(), x[i]);
int index_s = it_s - s.begin();
for (int k = -1; k < 1; k++) {
if (index_s + k <= -1 || index_s + k >= A) {
continue;
}
long long point_s = s[index_s + k];
vector<long long>::iterator it_st =
upper_bound(t.begin(), t.end(), point_s);
int index_st = it_st - t.begin();
for (int l = -1; l < 1; l++) {
if (index_st + l <= -1 || index_st >= B) {
continue;
}
long long point_st = t[index_st + l];
ans = min(ans, abs(x[i] - point_s) + abs(point_s - point_st));
}
}
vector<long long>::iterator it_t = upper_bound(t.begin(), t.end(), x[i]);
int index_t = it_t - t.begin();
for (int k = -1; k < 1; k++) {
if (index_t + k <= -1 || index_t + k >= B) {
continue;
}
long long point_t = t[index_t + k];
vector<long long>::iterator it_ts =
upper_bound(s.begin(), s.end(), point_t);
int index_ts = it_ts - s.begin();
for (int l = -1; l < 1; l++) {
if (index_ts + l <= -1 || index_ts + l >= A) {
continue;
}
long long point_ts = s[index_ts + l];
ans = min(ans, abs(x[i] - point_t) + abs(point_t - point_ts));
}
}
cout << ans << endl;
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int A, B, Q;
cin >> A >> B >> Q;
vector<long long> s(A);
vector<long long> t(B);
vector<long long> x(Q);
for (int i = 0; i < A; i++) {
cin >> s[i];
}
for (int i = 0; i < B; i++) {
cin >> t[i];
}
for (int i = 0; i < Q; i++) {
cin >> x[i];
}
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < Q; i++) {
long long ans = INT64_MAX;
vector<long long>::iterator it_s = upper_bound(s.begin(), s.end(), x[i]);
int index_s = it_s - s.begin();
for (int k = -1; k < 1; k++) {
if (index_s + k <= -1 || index_s + k >= A) {
continue;
}
long long point_s = s[index_s + k];
vector<long long>::iterator it_st =
upper_bound(t.begin(), t.end(), point_s);
int index_st = it_st - t.begin();
for (int l = -1; l < 1; l++) {
if (index_st + l <= -1 || index_st + l >= B) {
continue;
}
long long point_st = t[index_st + l];
ans = min(ans, abs(x[i] - point_s) + abs(point_s - point_st));
}
}
vector<long long>::iterator it_t = upper_bound(t.begin(), t.end(), x[i]);
int index_t = it_t - t.begin();
for (int k = -1; k < 1; k++) {
if (index_t + k <= -1 || index_t + k >= B) {
continue;
}
long long point_t = t[index_t + k];
vector<long long>::iterator it_ts =
upper_bound(s.begin(), s.end(), point_t);
int index_ts = it_ts - s.begin();
for (int l = -1; l < 1; l++) {
if (index_ts + l <= -1 || index_ts + l >= A) {
continue;
}
long long point_ts = s[index_ts + l];
ans = min(ans, abs(x[i] - point_t) + abs(point_t - point_ts));
}
}
cout << ans << endl;
}
return 0;
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 925,050 | 925,051 | u494037974 | cpp |
p03112 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
const ll INF = 1e15;
int main() {
int A, B, Q;
ll x;
cin >> A >> B >> Q;
ll s[A], t[B], ans[Q];
rep(i, A) cin >> s[i];
rep(i, B) cin >> t[i];
rep(i, Q) {
cin >> x;
int su = lower_bound(s, s + A, x) - s;
int tu = lower_bound(t, s + B, x) - t;
ll d[4];
rep(i, 4) d[i] = INF;
if (su < A && tu < B)
d[0] = max(s[su] - x, t[tu] - x);
if (su < A && tu > 0)
d[1] =
min(s[su] - x + 2 * (x - t[tu - 1]), 2 * (s[su] - x) + x - t[tu - 1]);
if (su > 0 && tu < B)
d[2] =
min(x - s[su - 1] + 2 * (t[tu] - x), 2 * (x - s[su - 1]) + t[tu] - x);
if (su > 0 && tu > 0)
d[3] = max(x - s[su - 1], x - t[tu - 1]);
sort(d, d + 4);
ans[i] = d[0];
}
rep(i, Q) cout << ans[i] << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
typedef long long ll;
const ll INF = 1e15;
int main() {
int A, B, Q;
ll x;
cin >> A >> B >> Q;
ll s[A], t[B], ans[Q];
rep(i, A) cin >> s[i];
rep(i, B) cin >> t[i];
rep(i, Q) {
cin >> x;
int su = lower_bound(s, s + A, x) - s;
int tu = lower_bound(t, t + B, x) - t;
ll d[4];
rep(i, 4) d[i] = INF;
if (su < A && tu < B)
d[0] = max(s[su] - x, t[tu] - x);
if (su < A && tu > 0)
d[1] =
min(s[su] - x + 2 * (x - t[tu - 1]), 2 * (s[su] - x) + x - t[tu - 1]);
if (su > 0 && tu < B)
d[2] =
min(x - s[su - 1] + 2 * (t[tu] - x), 2 * (x - s[su - 1]) + t[tu] - x);
if (su > 0 && tu > 0)
d[3] = max(x - s[su - 1], x - t[tu - 1]);
sort(d, d + 4);
ans[i] = d[0];
}
rep(i, Q) cout << ans[i] << endl;
return 0;
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 925,052 | 925,053 | u970690920 | cpp |
p03112 | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int A, B, Q;
ll s[100000], t[100000];
ll solve(ll a) {
ll ans = 1e18;
if (lower_bound(s, s + A, a) != s) {
//左の神社
ll tmp = 0;
ll pos = *(lower_bound(s, s + A, a) - 1);
tmp += (a - *(lower_bound(s, s + A, a) - 1));
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
}
if (lower_bound(t, t + A, a) != t) {
//左の寺
ll tmp = 0;
ll pos = *(lower_bound(t, t + B, a) - 1);
tmp += (a - *(lower_bound(t, t + B, a) - 1));
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
}
//右の神社
ll tmp = 0;
ll pos = *lower_bound(s, s + A, a);
tmp += abs(*lower_bound(s, s + A, a) - a);
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
tmp = 0, pos = 0;
//右の寺
pos = *lower_bound(t, t + B, a);
tmp += abs(*lower_bound(t, t + B, a) - a);
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
return ans;
}
int main() {
cin >> A >> B >> Q;
for (int i = 0; i < A; i++)
cin >> s[i];
for (int i = 0; i < B; i++)
cin >> t[i];
for (int i = 0; i < Q; i++) {
ll tmp;
cin >> tmp;
cout << solve(tmp) << endl;
}
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int A, B, Q;
ll s[100000], t[100000];
ll solve(ll a) {
ll ans = 1e18;
if (lower_bound(s, s + A, a) != s) {
//左の神社
ll tmp = 0;
ll pos = *(lower_bound(s, s + A, a) - 1);
tmp += (a - *(lower_bound(s, s + A, a) - 1));
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
}
if (lower_bound(t, t + B, a) != t) {
//左の寺
ll tmp = 0;
ll pos = *(lower_bound(t, t + B, a) - 1);
tmp += (a - *(lower_bound(t, t + B, a) - 1));
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
}
//右の神社
ll tmp = 0;
ll pos = *lower_bound(s, s + A, a);
tmp += abs(*lower_bound(s, s + A, a) - a);
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
tmp = 0, pos = 0;
//右の寺
pos = *lower_bound(t, t + B, a);
tmp += abs(*lower_bound(t, t + B, a) - a);
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
return ans;
}
int main() {
cin >> A >> B >> Q;
for (int i = 0; i < A; i++)
cin >> s[i];
for (int i = 0; i < B; i++)
cin >> t[i];
for (int i = 0; i < Q; i++) {
ll tmp;
cin >> tmp;
cout << solve(tmp) << endl;
}
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 925,058 | 925,059 | u107077805 | cpp |
p03112 | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int A, B, Q;
ll s[100000], t[100000];
ll solve(ll a) {
ll ans = 1145141919810893;
if (lower_bound(s, s + A, a) != s) {
//左の神社
ll tmp = 0;
ll pos = *(lower_bound(s, s + A, a) - 1);
tmp += (a - *(lower_bound(s, s + A, a) - 1));
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
}
if (lower_bound(t, t + A, a) != t) {
//左の寺
ll tmp = 0;
ll pos = *(lower_bound(t, t + B, a) - 1);
tmp += (a - *(lower_bound(t, t + B, a) - 1));
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
}
//右の神社
ll tmp = 0;
ll pos = *lower_bound(s, s + A, a);
tmp += abs(*lower_bound(s, s + A, a) - a);
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
tmp = 0, pos = 0;
//右の寺
pos = *lower_bound(t, t + B, a);
tmp += abs(*lower_bound(t, t + B, a) - a);
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
return ans;
}
int main() {
cin >> A >> B >> Q;
for (int i = 0; i < A; i++)
cin >> s[i];
for (int i = 0; i < B; i++)
cin >> t[i];
for (int i = 0; i < Q; i++) {
ll tmp;
cin >> tmp;
cout << solve(tmp) << endl;
}
return 0;
} | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int A, B, Q;
ll s[100000], t[100000];
ll solve(ll a) {
ll ans = 1e18;
if (lower_bound(s, s + A, a) != s) {
//左の神社
ll tmp = 0;
ll pos = *(lower_bound(s, s + A, a) - 1);
tmp += (a - *(lower_bound(s, s + A, a) - 1));
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
}
if (lower_bound(t, t + B, a) != t) {
//左の寺
ll tmp = 0;
ll pos = *(lower_bound(t, t + B, a) - 1);
tmp += (a - *(lower_bound(t, t + B, a) - 1));
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
}
//右の神社
ll tmp = 0;
ll pos = *lower_bound(s, s + A, a);
tmp += abs(*lower_bound(s, s + A, a) - a);
if (lower_bound(t, t + B, pos) != t) {
tmp = min(tmp + abs(*lower_bound(t, t + B, pos) - pos),
tmp + abs(*(lower_bound(t, t + B, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(t, t + B, pos) - pos);
}
ans = min(ans, tmp);
tmp = 0, pos = 0;
//右の寺
pos = *lower_bound(t, t + B, a);
tmp += abs(*lower_bound(t, t + B, a) - a);
if (lower_bound(s, s + A, pos) != t) {
tmp = min(tmp + abs(*lower_bound(s, s + A, pos) - pos),
tmp + abs(*(lower_bound(s, s + A, pos) - 1) - pos));
} else {
tmp += abs(*lower_bound(s, s + A, pos) - pos);
}
ans = min(ans, tmp);
return ans;
}
int main() {
cin >> A >> B >> Q;
for (int i = 0; i < A; i++)
cin >> s[i];
for (int i = 0; i < B; i++)
cin >> t[i];
for (int i = 0; i < Q; i++) {
ll tmp;
cin >> tmp;
cout << solve(tmp) << endl;
}
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 925,060 | 925,059 | u107077805 | cpp |
p03112 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int A, B, Q;
vector<long long> s;
vector<long long> t;
vector<long long> x;
void chmin(long long &a, long long b) {
if (a > b)
a = b;
}
template <class T> int former(const vector<T> &v, T x) {
return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T> int latter(const vector<T> &v, T x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}
const long long INF = 1LL << 58;
int main() {
cin >> A >> B >> Q;
s.resize(A);
t.resize(B);
x.resize(Q);
for (int i = 0; i < A; i++) {
cin >> s[i];
}
for (int i = 0; i < B; i++) {
cin >> t[i];
}
for (int i = 0; i < Q; i++) {
cin >> x[i];
}
s.push_back(INF);
s.push_back(-INF);
t.push_back(INF);
t.push_back(-INF);
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < Q; i++) {
long long pos = x[i];
long long res = INF;
for (int j = 0; j < 2; j++) {
long long first = (j ? s[former(s, pos)] : s[latter(s, pos)]);
for (int k = 0; k < 2; k++) {
long long second = (k ? t[former(t, first)] : t[latter(t, first)]);
chmin(res, abs(pos - first) + abs(first - second));
}
}
for (int j = 0; j < 2; j++) {
long long first = (j ? t[former(s, pos)] : t[latter(s, pos)]);
for (int k = 0; k < 2; k++) {
long long second = (k ? s[former(s, first)] : s[latter(s, first)]);
chmin(res, abs(pos - first) + abs(first - second));
}
}
cout << res << endl;
}
}
| #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int A, B, Q;
vector<long long> s;
vector<long long> t;
vector<long long> x;
void chmin(long long &a, long long b) {
if (a > b)
a = b;
}
template <class T> int former(const vector<T> &v, T x) {
return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <class T> int latter(const vector<T> &v, T x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}
const long long INF = 1LL << 58;
int main() {
cin >> A >> B >> Q;
s.resize(A);
t.resize(B);
x.resize(Q);
for (int i = 0; i < A; i++) {
cin >> s[i];
}
for (int i = 0; i < B; i++) {
cin >> t[i];
}
for (int i = 0; i < Q; i++) {
cin >> x[i];
}
s.push_back(INF);
s.push_back(-INF);
t.push_back(INF);
t.push_back(-INF);
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i = 0; i < Q; i++) {
long long pos = x[i];
long long res = INF;
for (int j = 0; j < 2; j++) {
long long first = (j ? s[former(s, pos)] : s[latter(s, pos)]);
for (int k = 0; k < 2; k++) {
long long second = (k ? t[former(t, first)] : t[latter(t, first)]);
chmin(res, abs(pos - first) + abs(first - second));
}
}
for (int j = 0; j < 2; j++) {
long long first = (j ? t[former(t, pos)] : t[latter(t, pos)]);
for (int k = 0; k < 2; k++) {
long long second = (k ? s[former(s, first)] : s[latter(s, first)]);
chmin(res, abs(pos - first) + abs(first - second));
}
}
cout << res << endl;
}
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 925,063 | 925,064 | u193690465 | cpp |
p03112 | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
ll a, b, q;
cin >> a >> b >> q;
ll s[a + 2], t[b + 2], x[q];
for (int i = 1; i < a + 1; i++) {
cin >> s[i];
}
for (int i = 1; i < b + 1; i++) {
cin >> t[i];
}
for (int i = 0; i < q; i++) {
cin >> x[i];
}
s[0] = -1e15;
s[a + 1] = 1e15;
t[0] = -1e15;
t[b + 1] = 1e15;
for (int i = 0; i < q; i++) {
ll lb = 0, ub = a + 1;
while (ub - lb > 1) {
ll mid = (lb + ub) / 2;
if (s[mid] >= x[i]) {
// これが条件を満たせば、解の存在範囲は(lb,mid]
ub = mid;
} else {
// これが条件を満たせば、解の存在範囲は(mid,ub]
lb = mid;
}
}
// この時点でlb+1=ub
ll lb_t = 0, ub_t = b + 1;
while (ub_t - lb_t > 1) {
ll mid = (lb_t + ub_t) / 2;
if (t[mid] >= s[lb]) {
ub_t = mid;
} else {
lb_t = mid;
}
}
ll ans = min({abs(s[lb] - x[i]) + abs(t[lb_t] - s[lb]),
abs(s[lb] - x[i]) + abs(t[ub_t] - s[lb]),
abs(s[ub] - x[i]) + abs(t[lb_t] - s[ub]),
abs(s[ub] - x[i]) + abs(t[ub_t] - s[ub]),
abs(t[lb_t] - x[i]) + abs(s[lb] - t[lb_t]),
abs(t[lb_t] - x[i]) + abs(s[ub] - t[lb_t]),
abs(t[ub_t] - x[i]) + abs(s[lb] - t[ub_t]),
abs(t[ub_t] - x[i]) + abs(s[ub] - t[ub_t])});
cout << ans << endl;
}
}
| #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
ll a, b, q;
cin >> a >> b >> q;
ll s[a + 2], t[b + 2], x[q];
for (int i = 1; i < a + 1; i++) {
cin >> s[i];
}
for (int i = 1; i < b + 1; i++) {
cin >> t[i];
}
for (int i = 0; i < q; i++) {
cin >> x[i];
}
s[0] = -1e15;
s[a + 1] = 1e15;
t[0] = -1e15;
t[b + 1] = 1e15;
for (int i = 0; i < q; i++) {
ll lb = 0, ub = a + 1;
while (ub - lb > 1) {
ll mid = (lb + ub) / 2;
if (s[mid] >= x[i]) {
// これが条件を満たせば、解の存在範囲は(lb,mid]
ub = mid;
} else {
// これが条件を満たせば、解の存在範囲は(mid,ub]
lb = mid;
}
}
// この時点でlb+1=ub
ll lb_t = 0, ub_t = b + 1;
while (ub_t - lb_t > 1) {
ll mid = (lb_t + ub_t) / 2;
if (t[mid] >= x[i]) {
ub_t = mid;
} else {
lb_t = mid;
}
}
ll ans = min({abs(s[lb] - x[i]) + abs(t[lb_t] - s[lb]),
abs(s[lb] - x[i]) + abs(t[ub_t] - s[lb]),
abs(s[ub] - x[i]) + abs(t[lb_t] - s[ub]),
abs(s[ub] - x[i]) + abs(t[ub_t] - s[ub]),
abs(t[lb_t] - x[i]) + abs(s[lb] - t[lb_t]),
abs(t[lb_t] - x[i]) + abs(s[ub] - t[lb_t]),
abs(t[ub_t] - x[i]) + abs(s[lb] - t[ub_t]),
abs(t[ub_t] - x[i]) + abs(s[ub] - t[ub_t])});
cout << ans << endl;
}
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"variable_access.subscript.index.change"
] | 925,065 | 925,066 | u179970156 | cpp |
p03112 | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
ll a, b, q;
cin >> a >> b >> q;
ll s[a + 2], t[b + 2], x[q];
for (int i = 1; i < a + 1; i++) {
cin >> s[i];
}
for (int i = 1; i < b + 1; i++) {
cin >> t[i];
}
for (int i = 0; i < q; i++) {
cin >> x[i];
}
s[0] = -1e15;
s[a + 1] = 1e15;
t[0] = -1e15;
t[b + 1] = 1e15;
for (int i = 0; i < q; i++) {
ll lb = -2, ub = a + 1;
while (ub - lb > 1) {
ll mid = (lb + ub) / 2;
if (s[mid] >= x[i]) {
// これが条件を満たせば、解の存在範囲は(lb,mid]
ub = mid;
} else {
// これが条件を満たさなければ、解の存在範囲は(mid,ub]
lb = mid;
}
}
// この時点でlb+1=ub
ll lb_t = -2, ub_t = b + 1;
while (ub_t - lb_t > 1) {
ll mid = (lb_t + ub_t) / 2;
if (t[mid] >= s[lb]) {
ub_t = mid;
} else {
lb_t = mid;
}
}
ll ans = min({abs(s[lb] - x[i]) + abs(t[lb_t] - s[lb]),
abs(s[lb] - x[i]) + abs(t[ub_t] - s[lb]),
abs(s[ub] - x[i]) + abs(t[lb_t] - s[ub]),
abs(s[ub] - x[i]) + abs(t[ub_t] - s[ub]),
abs(t[lb_t] - x[i]) + abs(s[lb] - t[lb_t]),
abs(t[lb_t] - x[i]) + abs(s[ub] - t[lb_t]),
abs(t[ub_t] - x[i]) + abs(s[lb] - t[ub_t]),
abs(t[ub_t] - x[i]) + abs(s[ub] - t[ub_t])});
cout << ans << endl;
}
} | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
ll a, b, q;
cin >> a >> b >> q;
ll s[a + 2], t[b + 2], x[q];
for (int i = 1; i < a + 1; i++) {
cin >> s[i];
}
for (int i = 1; i < b + 1; i++) {
cin >> t[i];
}
for (int i = 0; i < q; i++) {
cin >> x[i];
}
s[0] = -1e15;
s[a + 1] = 1e15;
t[0] = -1e15;
t[b + 1] = 1e15;
for (int i = 0; i < q; i++) {
ll lb = 0, ub = a + 1;
while (ub - lb > 1) {
ll mid = (lb + ub) / 2;
if (s[mid] >= x[i]) {
// これが条件を満たせば、解の存在範囲は(lb,mid]
ub = mid;
} else {
// これが条件を満たせば、解の存在範囲は(mid,ub]
lb = mid;
}
}
// この時点でlb+1=ub
ll lb_t = 0, ub_t = b + 1;
while (ub_t - lb_t > 1) {
ll mid = (lb_t + ub_t) / 2;
if (t[mid] >= x[i]) {
ub_t = mid;
} else {
lb_t = mid;
}
}
ll ans = min({abs(s[lb] - x[i]) + abs(t[lb_t] - s[lb]),
abs(s[lb] - x[i]) + abs(t[ub_t] - s[lb]),
abs(s[ub] - x[i]) + abs(t[lb_t] - s[ub]),
abs(s[ub] - x[i]) + abs(t[ub_t] - s[ub]),
abs(t[lb_t] - x[i]) + abs(s[lb] - t[lb_t]),
abs(t[lb_t] - x[i]) + abs(s[ub] - t[lb_t]),
abs(t[ub_t] - x[i]) + abs(s[lb] - t[ub_t]),
abs(t[ub_t] - x[i]) + abs(s[ub] - t[ub_t])});
cout << ans << endl;
}
}
| [
"literal.number.change",
"variable_declaration.value.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"variable_access.subscript.index.change"
] | 925,067 | 925,066 | u179970156 | cpp |
p03112 | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define OREP(i, n) for (int i = 1; i <= (n); ++i)
#define ORREP(i, n) for (int i = (n); i >= 1; --i)
#define ZREP(i, n) for (int i = 1; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define rollcall cout << "I'm Sucu." << endl;
#define YES(s) s ? cout << "YES" << endl : cout << "NO" << endl
#define Yes(s) s ? cout << "Yes" << endl : cout << "No" << endl
#define Taka(s) s ? cout << "Takahashi" << endl : cout << "Aoki" << endl
#define out(s, t, u) s ? cout << t << endl : cout << u << endl
#define int ll
#define Endl endl
signed main() {
int A, B, Q;
int s[114514], t[114514], x[114514];
cin >> A >> B >> Q;
REP(i, A) { cin >> s[i + 1]; }
s[0] = -INF;
s[A + 1] = INF;
REP(i, B) { cin >> t[i + 1]; }
t[0] = -INF;
t[A + 1] = INF;
REP(i, Q) { cin >> x[i]; }
int ok, ng, mid1, mid2;
A += 2;
B += 2;
int Ans;
REP(i, Q) {
ok = A, ng = 0;
while (abs(ok - ng) > 1) {
mid1 = (ok + ng) / 2;
if (x[i] < s[mid1]) {
ok = mid1;
} else {
ng = mid1;
}
}
ok = B, ng = 0;
while (abs(ok - ng) > 1) {
mid2 = (ok + ng) / 2;
if (x[i] < t[mid2]) {
ok = mid2;
} else {
ng = mid2;
}
}
Ans = INF;
for (int j = -1; j <= 1; j++) {
for (int k = -1; k <= 1; k++) {
int X = x[i], S = s[mid1 - j], T = t[mid2 - k];
Ans = min(Ans, abs(X - S) + abs(S - T));
Ans = min(Ans, abs(X - T) + abs(S - T));
}
}
cout << Ans << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define OREP(i, n) for (int i = 1; i <= (n); ++i)
#define ORREP(i, n) for (int i = (n); i >= 1; --i)
#define ZREP(i, n) for (int i = 1; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define rollcall cout << "I'm Sucu." << endl;
#define YES(s) s ? cout << "YES" << endl : cout << "NO" << endl
#define Yes(s) s ? cout << "Yes" << endl : cout << "No" << endl
#define Taka(s) s ? cout << "Takahashi" << endl : cout << "Aoki" << endl
#define out(s, t, u) s ? cout << t << endl : cout << u << endl
#define int ll
#define Endl endl
signed main() {
int A, B, Q;
int s[114514], t[114514], x[114514];
cin >> A >> B >> Q;
REP(i, A) { cin >> s[i + 1]; }
s[0] = -INF;
s[A + 1] = INF;
REP(i, B) { cin >> t[i + 1]; }
t[0] = -INF;
t[B + 1] = INF;
REP(i, Q) { cin >> x[i]; }
int ok, ng, mid1, mid2;
A += 2;
B += 2;
int Ans;
REP(i, Q) {
ok = A, ng = 0;
while (abs(ok - ng) > 1) {
mid1 = (ok + ng) / 2;
if (x[i] < s[mid1]) {
ok = mid1;
} else {
ng = mid1;
}
}
ok = B, ng = 0;
while (abs(ok - ng) > 1) {
mid2 = (ok + ng) / 2;
if (x[i] < t[mid2]) {
ok = mid2;
} else {
ng = mid2;
}
}
Ans = INF;
for (int j = -1; j <= 1; j++) {
for (int k = -1; k <= 1; k++) {
int X = x[i], S = s[mid1 - j], T = t[mid2 - k];
Ans = min(Ans, abs(X - S) + abs(S - T));
Ans = min(Ans, abs(X - T) + abs(S - T));
}
}
cout << Ans << endl;
}
return 0;
}
| [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 925,068 | 925,069 | u554953477 | cpp |
p03112 | #include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 2e5 + 50;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
int dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int a, b, q;
cin >> a >> b >> q;
vector<int> tem(a, 0), shr(b, 0);
for (int i = 0; i < a; i++) {
cin >> tem[i];
}
for (int i = 0; i < b; i++) {
cin >> shr[i];
}
while (q--) {
int s;
cin >> s;
int ans = 1e17;
int in1 = lower_bound(tem.begin(), tem.end(), s) - tem.begin();
int in2 = in1 - 1;
int in3 = lower_bound(shr.begin(), shr.end(), s) - shr.begin();
int in4 = in3 - 1;
if (in1 < a && in3 < b) {
ans = min(min(shr[in1], tem[in3]) - s + abs(shr[in1] - tem[in3]), ans);
}
if (in2 >= 0 && in3 < b) {
int d1 = abs(shr[in3] - s);
int d2 = abs(s - tem[in2]);
int temp1 = 2LL * d1 + d2;
int temp2 = 2LL * d2 + d1;
ans = min(ans, min(temp1, temp2));
}
if (in2 >= 0 && in4 >= 0) {
ans = min(s - max(shr[in4], tem[in2]) + abs(shr[in4] - tem[in2]), ans);
}
if (in4 >= 0 && in1 < a) {
int d1 = abs(s - shr[in4]);
int d2 = abs(tem[in1] - s);
int temp1 = 2LL * d1 + d2;
int temp2 = 2LL * d2 + d1;
ans = min(ans, min(temp1, temp2));
}
cout << ans << endl;
}
} | #include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 2e5 + 50;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
int dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int a, b, q;
cin >> a >> b >> q;
vector<int> tem(a, 0), shr(b, 0);
for (int i = 0; i < a; i++) {
cin >> tem[i];
}
for (int i = 0; i < b; i++) {
cin >> shr[i];
}
while (q--) {
int s;
cin >> s;
int ans = 1e17;
int in1 = lower_bound(tem.begin(), tem.end(), s) - tem.begin();
int in2 = in1 - 1;
int in3 = lower_bound(shr.begin(), shr.end(), s) - shr.begin();
int in4 = in3 - 1;
if (in1 < a && in3 < b) {
ans = min(min(shr[in3], tem[in1]) - s + abs(shr[in3] - tem[in1]), ans);
}
if (in2 >= 0 && in3 < b) {
int d1 = abs(shr[in3] - s);
int d2 = abs(s - tem[in2]);
int temp1 = 2LL * d1 + d2;
int temp2 = 2LL * d2 + d1;
ans = min(ans, min(temp1, temp2));
}
if (in2 >= 0 && in4 >= 0) {
ans = min(s - max(shr[in4], tem[in2]) + abs(shr[in4] - tem[in2]), ans);
}
if (in4 >= 0 && in1 < a) {
int d1 = abs(s - shr[in4]);
int d2 = abs(tem[in1] - s);
int temp1 = 2LL * d1 + d2;
int temp2 = 2LL * d2 + d1;
ans = min(ans, min(temp1, temp2));
}
cout << ans << endl;
}
} | [
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 925,070 | 925,071 | u715191077 | cpp |
p03112 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define INF 1e9 + 7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 + 7;
int main() {
ll A, B, Q, s[100010], t[100010], x[100010], sh, sl, th, tl, ans;
cin >> A >> B >> Q;
for (int i = 1; i < A + 1; i++)
cin >> s[i];
for (int i = 1; i < B + 1; i++)
cin >> t[i];
rep(i, Q) cin >> x[i];
s[0] = (-LLINF);
s[A + 1] = LLINF;
t[0] = (-LLINF);
t[B + 1] = LLINF;
rep(i, Q) {
sh = *lower_bound(s, s + A + 2, x[i]);
sl = *(lower_bound(s, s + A + 2, x[i]) - 1);
th = *lower_bound(t, t + B + 2, x[i]);
tl = *(lower_bound(t, t + B + 2, x[i]) - 1);
ll ans0 = min(sh - x[i] + abs(-x[i] + th), sh - x[i] + abs(sh - tl));
ll ans1 = min(x[i] - sl + abs(th - sl), x[i] - sl + abs(sl - tl));
ll ans2 = min(th - x[i] + abs(sh - th), th - x[i] + abs(sl - th));
ll ans3 = min(x[i] - tl + abs(tl - sh), x[i] - tl + abs(tl - sl));
ans = min(min(ans0, ans1), min(ans2, ans3));
cout << ans << endl;
}
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define INF 1e9 + 7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 + 7;
int main() {
ll A, B, Q, s[100010], t[100010], x[100010], sh, sl, th, tl, ans;
cin >> A >> B >> Q;
for (int i = 1; i < A + 1; i++)
cin >> s[i];
for (int i = 1; i < B + 1; i++)
cin >> t[i];
rep(i, Q) cin >> x[i];
s[0] = (-LLINF);
s[A + 1] = LLINF;
t[0] = (-LLINF);
t[B + 1] = LLINF;
rep(i, Q) {
sh = *lower_bound(s, s + A + 2, x[i]);
sl = *(lower_bound(s, s + A + 2, x[i]) - 1);
th = *lower_bound(t, t + B + 2, x[i]);
tl = *(lower_bound(t, t + B + 2, x[i]) - 1);
ll ans0 = min(sh - x[i] + abs(sh - th), sh - x[i] + abs(sh - tl));
ll ans1 = min(x[i] - sl + abs(th - sl), x[i] - sl + abs(sl - tl));
ll ans2 = min(th - x[i] + abs(sh - th), th - x[i] + abs(sl - th));
ll ans3 = min(x[i] - tl + abs(tl - sh), x[i] - tl + abs(tl - sl));
ans = min(min(ans0, ans1), min(ans2, ans3));
cout << ans << endl;
}
return 0;
} | [
"call.arguments.change",
"expression.operation.binary.remove"
] | 925,076 | 925,077 | u241367243 | cpp |
p03112 | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#define INF 10000000000
using namespace std;
int A, B, Q;
int main(void) {
scanf("%d %d %d", &A, &B, &Q);
vector<long long int> s, t, x;
int i = 0, j = 0, k = 0;
long long int input;
for (i = 1; i <= A; i++) {
cin >> input;
s.push_back(input);
}
s.push_back(INF);
s.push_back(-INF);
i = 0;
for (i = 1; i <= B; i++) {
cin >> input;
t.push_back(input);
}
t.push_back(INF);
t.push_back(-INF);
sort(s.begin(), s.end());
sort(t.begin(), t.end());
i = 0;
for (i = 0; i < Q; i++) {
cin >> input;
x.push_back(input);
}
for (i = 0; i < Q; i++) {
long long int ans = INF, d[4];
int sleft =
distance(s.begin(), lower_bound(s.begin(), s.end() - 1, x[i])) - 1;
int tleft =
distance(t.begin(), lower_bound(t.begin(), t.end() - 1, x[i])) - 1;
j = k = 0;
for (j = sleft; j < sleft + 2; j++) {
for (k = tleft; k < tleft + 2; k++) {
d[0] = abs(x[i] - s[j]) + abs(t[k] - s[j]);
d[1] = abs(x[i] - t[k]) + abs(t[k] - s[j]);
ans = min(ans, (min(d[0], d[1])));
}
}
printf("%lld\n", ans);
}
return 0;
}
| #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#define INF 1000000000000000
using namespace std;
int A, B, Q;
int main(void) {
scanf("%d %d %d", &A, &B, &Q);
vector<long long int> s, t, x;
int i = 0, j = 0, k = 0;
long long int input;
for (i = 1; i <= A; i++) {
cin >> input;
s.push_back(input);
}
s.push_back(INF);
s.push_back(-INF);
i = 0;
for (i = 1; i <= B; i++) {
cin >> input;
t.push_back(input);
}
t.push_back(INF);
t.push_back(-INF);
sort(s.begin(), s.end());
sort(t.begin(), t.end());
i = 0;
for (i = 0; i < Q; i++) {
cin >> input;
x.push_back(input);
}
for (i = 0; i < Q; i++) {
long long int ans = INF, d[4];
int sleft =
distance(s.begin(), lower_bound(s.begin(), s.end() - 1, x[i])) - 1;
int tleft =
distance(t.begin(), lower_bound(t.begin(), t.end() - 1, x[i])) - 1;
j = k = 0;
for (j = sleft; j < sleft + 2; j++) {
for (k = tleft; k < tleft + 2; k++) {
d[0] = abs(x[i] - s[j]) + abs(t[k] - s[j]);
d[1] = abs(x[i] - t[k]) + abs(t[k] - s[j]);
ans = min(ans, (min(d[0], d[1])));
}
}
printf("%lld\n", ans);
}
return 0;
}
| [
"preprocessor.define.value.change",
"literal.integer.change"
] | 925,088 | 925,089 | u692704469 | cpp |
p03112 | // All Library
// #include <bits/stdc++.h> //
// https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/precompiled/stdc%2B%2B.h
// C Library
// #include <cassert> // (assert.h) C Diagnostics Library (header)
// #include <cctype> // (ctype.h) Character handling functions (header)
// #include <cerrno> // (errno.h) C Errors (header)
// #include <cfloat> // (float.h) Characteristics of floating-point types
// (header) #include <ciso646> // (iso646.h) ISO 646 Alternative operator
// spellings (header)
#include <climits> // (limits.h) Sizes of integral types (header)
// #include <clocale> // (locale.h) C localization library (header)
#include <cmath> // (math.h) C numerics library (header)
// #include <csetjmp> // (setjmp.h) Non local jumps (header)
// #include <csignal> // (signal.h) C library to handle signals (header)
// #include <cstdarg> // (stdarg.h) Variable arguments handling (header)
// #include <cstdbool> // (stdbool.h) Boolean type (header)
// #include <cstddef> // (stddef.h) C Standard definitions (header)
// #include <cstdint> // (stdint.h) Integer types (header)
#include <cstdio> // (stdio.h) C library to perform Input/Output operations (header)
// #include <cstdlib> // (stdlib.h) C Standard General Utilities Library
// (header) #include <cstring> // (string.h) C Strings (header) #include <ctime>
// // (time.h) C Time Library (header) #include <cuchar> // (uchar.h) Unicode
// characters (header) #include <cwchar> // (wchar.h) Wide characters (header)
// #include <cwctype> // (wctype.h) Wide character type (header)
// Containers
// #include <array> // Array header (header)
// #include <bitset> // Bitset header (header)
#include <deque> // Deque header (header)
// #include <forward_list> // Forward list (header)
// #include <list> // List header (header)
#include <map> // Map header (header)
// #include <queue> // Queue header (header)
#include <set> // Set header (header)
// #include <stack> // Stack header (header)
// #include <unordered_map> //Unordered map header (header)
// #include <unordered_set> // Unordered set header (header)
#include <vector> // Vector header (header)
// Input/Output Stream Library
#include <iostream> // The class relies on a single streambuf object for both the input and output operations.
// #include <fstream> // Input/output stream class to operate on files.
// #include <sstream> //
// Miscellaneous headers
#include <algorithm> // Standard Template Library: Algorithms (library )
// #include <chrono> // Time library (header)
// #include <codecvt> // Unicode conversion facets (header)
// #include <complex> // Complex numbers library (header)
// #include <exception> // Standard exceptions (header)
// #include <functional> // Function objects (header)
// #include <initializer_list> // Initializer list (header)
// #include <iterator> // Iterator definitions (header)
// #include <limits> // Numeric limits (header)
// #include <locale> // Localization library (header)
// #include <memory> //Memory elements (header)
// #include <new> // Dynamic memory (header)
// #include <numeric> // Generalized numeric operations (header)
// #include <random> // Random (header)
// #include <ratio> // Ratio header (header)
// #include <regex> // Regular Expressions (header)
// #include <stdexcept> // Exception classes (header)
#include <string> // Strings (header)
// #include <system_error> // System errors (header)
#include <tuple> // Tuple library (header)
// #include <typeinfo> // Type information (header)
// #include <type_traits> //type_traits (header)
// #include <utility> // Utility components (header)
// #include <valarray> // Library for arrays of numeric values (header)
// Boost
// #include <boost/multiprecision/cpp_int.hpp> //
// https://boostjp.github.io/tips/multiprec-int.html
using namespace std;
// using namespace boost::multiprecision;
#define BEGIN \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I, N) for ((I) = 0; (I) < (N); (I)++)
#define up(I, A, B) for ((I) = (A); (I) <= (B); (I)++)
#define dw(I, A, B) for ((I) = (A); (I) >= (B); (I)--)
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
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> inline void in(T &p) { cin >> p; }
template <class T1, class T2> inline void in(T1 &p1, T2 &p2) {
cin >> p1 >> p2;
}
template <class T1, class T2, class T3> inline void in(T1 &p1, T2 &p2, T3 &p3) {
cin >> p1 >> p2 >> p3;
}
template <class T1, class T2, class T3, class T4>
inline void in(T1 &p1, T2 &p2, T3 &p3, T4 &p4) {
cin >> p1 >> p2 >> p3 >> p4;
}
template <class T> inline void ins(T &p) {
for_each(all(p), in<decltype(p[0])>);
}
template <class T> inline void out(T p) { cout << p << endl; }
template <class T1, class T2> inline void out(T1 p1, T2 p2) {
cout << p1 << " " << p2 << endl;
}
template <class T1, class T2, class T3> inline void out(T1 p1, T2 p2, T3 p3) {
cout << p1 << " " << p2 << " " << p3 << endl;
}
template <class T1, class T2, class T3, class T4>
inline void out(T1 p1, T2 p2, T3 p3, T4 p4) {
cout << p1 << " " << p2 << " " << p3 << " " << p4 << endl;
}
template <class T> inline void outs(T p) {
for_each(all(p), out<decltype(p[0])>);
}
long a, b, q, i, s[1 << 17], t[1 << 17], INF = (long)1e18, x, c, d, j, k, ans;
inline void solve(void) {
in(a, b, q);
up(i, 1, a) in(s[i]);
s[0] = -INF;
s[a + 1] = INF;
up(i, 1, b) in(t[i]);
t[0] = -INF;
t[b + 1] = INF;
rep(i, q) {
in(x);
c = lb(s, s + a + 2, x) - s;
d = lb(t, t + b + 2, x) - t;
ans = INF;
for (j = c - 1; j < c + 1; j++) {
for (k = d - 1; k < d + 1; k++) {
chmin(ans, abs(x - s[j]) + abs(s[j] - t[k]));
chmin(ans, abs(x - t[j]) + abs(t[j] - s[j]));
}
}
out(ans);
}
}
int main(int argc, char **argv) {
BEGIN;
solve();
END;
}
| // All Library
// #include <bits/stdc++.h> //
// https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/precompiled/stdc%2B%2B.h
// C Library
// #include <cassert> // (assert.h) C Diagnostics Library (header)
// #include <cctype> // (ctype.h) Character handling functions (header)
// #include <cerrno> // (errno.h) C Errors (header)
// #include <cfloat> // (float.h) Characteristics of floating-point types
// (header) #include <ciso646> // (iso646.h) ISO 646 Alternative operator
// spellings (header)
#include <climits> // (limits.h) Sizes of integral types (header)
// #include <clocale> // (locale.h) C localization library (header)
#include <cmath> // (math.h) C numerics library (header)
// #include <csetjmp> // (setjmp.h) Non local jumps (header)
// #include <csignal> // (signal.h) C library to handle signals (header)
// #include <cstdarg> // (stdarg.h) Variable arguments handling (header)
// #include <cstdbool> // (stdbool.h) Boolean type (header)
// #include <cstddef> // (stddef.h) C Standard definitions (header)
// #include <cstdint> // (stdint.h) Integer types (header)
#include <cstdio> // (stdio.h) C library to perform Input/Output operations (header)
// #include <cstdlib> // (stdlib.h) C Standard General Utilities Library
// (header) #include <cstring> // (string.h) C Strings (header) #include <ctime>
// // (time.h) C Time Library (header) #include <cuchar> // (uchar.h) Unicode
// characters (header) #include <cwchar> // (wchar.h) Wide characters (header)
// #include <cwctype> // (wctype.h) Wide character type (header)
// Containers
// #include <array> // Array header (header)
// #include <bitset> // Bitset header (header)
#include <deque> // Deque header (header)
// #include <forward_list> // Forward list (header)
// #include <list> // List header (header)
#include <map> // Map header (header)
// #include <queue> // Queue header (header)
#include <set> // Set header (header)
// #include <stack> // Stack header (header)
// #include <unordered_map> //Unordered map header (header)
// #include <unordered_set> // Unordered set header (header)
#include <vector> // Vector header (header)
// Input/Output Stream Library
#include <iostream> // The class relies on a single streambuf object for both the input and output operations.
// #include <fstream> // Input/output stream class to operate on files.
// #include <sstream> //
// Miscellaneous headers
#include <algorithm> // Standard Template Library: Algorithms (library )
// #include <chrono> // Time library (header)
// #include <codecvt> // Unicode conversion facets (header)
// #include <complex> // Complex numbers library (header)
// #include <exception> // Standard exceptions (header)
// #include <functional> // Function objects (header)
// #include <initializer_list> // Initializer list (header)
// #include <iterator> // Iterator definitions (header)
// #include <limits> // Numeric limits (header)
// #include <locale> // Localization library (header)
// #include <memory> //Memory elements (header)
// #include <new> // Dynamic memory (header)
// #include <numeric> // Generalized numeric operations (header)
// #include <random> // Random (header)
// #include <ratio> // Ratio header (header)
// #include <regex> // Regular Expressions (header)
// #include <stdexcept> // Exception classes (header)
#include <string> // Strings (header)
// #include <system_error> // System errors (header)
#include <tuple> // Tuple library (header)
// #include <typeinfo> // Type information (header)
// #include <type_traits> //type_traits (header)
// #include <utility> // Utility components (header)
// #include <valarray> // Library for arrays of numeric values (header)
// Boost
// #include <boost/multiprecision/cpp_int.hpp> //
// https://boostjp.github.io/tips/multiprec-int.html
using namespace std;
// using namespace boost::multiprecision;
#define BEGIN \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I, N) for ((I) = 0; (I) < (N); (I)++)
#define up(I, A, B) for ((I) = (A); (I) <= (B); (I)++)
#define dw(I, A, B) for ((I) = (A); (I) >= (B); (I)--)
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define lb lower_bound
#define ub upper_bound
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> inline void in(T &p) { cin >> p; }
template <class T1, class T2> inline void in(T1 &p1, T2 &p2) {
cin >> p1 >> p2;
}
template <class T1, class T2, class T3> inline void in(T1 &p1, T2 &p2, T3 &p3) {
cin >> p1 >> p2 >> p3;
}
template <class T1, class T2, class T3, class T4>
inline void in(T1 &p1, T2 &p2, T3 &p3, T4 &p4) {
cin >> p1 >> p2 >> p3 >> p4;
}
template <class T> inline void ins(T &p) {
for_each(all(p), in<decltype(p[0])>);
}
template <class T> inline void out(T p) { cout << p << endl; }
template <class T1, class T2> inline void out(T1 p1, T2 p2) {
cout << p1 << " " << p2 << endl;
}
template <class T1, class T2, class T3> inline void out(T1 p1, T2 p2, T3 p3) {
cout << p1 << " " << p2 << " " << p3 << endl;
}
template <class T1, class T2, class T3, class T4>
inline void out(T1 p1, T2 p2, T3 p3, T4 p4) {
cout << p1 << " " << p2 << " " << p3 << " " << p4 << endl;
}
template <class T> inline void outs(T p) {
for_each(all(p), out<decltype(p[0])>);
}
long a, b, q, i, s[1 << 17], t[1 << 17], INF = 1e18, x, c, d, j, k, ans;
inline void solve(void) {
in(a, b, q);
up(i, 1, a) in(s[i]);
s[0] = -INF;
s[a + 1] = INF;
up(i, 1, b) in(t[i]);
t[0] = -INF;
t[b + 1] = INF;
rep(i, q) {
in(x);
c = lb(s, s + a + 2, x) - s;
d = lb(t, t + b + 2, x) - t;
ans = INF;
for (j = c - 1; j < c + 1; j++) {
for (k = d - 1; k < d + 1; k++) {
chmin(ans, abs(x - s[j]) + abs(s[j] - t[k]));
chmin(ans, abs(x - t[k]) + abs(t[k] - s[j]));
}
}
out(ans);
}
}
int main(int argc, char **argv) {
BEGIN;
solve();
END;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 925,094 | 925,095 | u743561048 | cpp |
p03112 | #include <bits/stdc++.h>
using namespace std;
long a, b, q, s[100002], t[100002], ans, i, j, k, x, c, d;
int main() {
scanf("%ld%ld%ld", &a, &b, &q);
for (i = 1; i <= a; i++)
scanf("%ld", &s[i]);
s[a + 1] = 1e18;
s[0] = -1e18;
sort(s, s + a + 2);
for (i = 1; i <= b; i++)
scanf("%ld", &t[i]);
t[b + 1] = 1e18;
t[0] = -1e18;
sort(t, t + b + 2);
for (i = 1; i <= q; i++) {
scanf("%ld", &x);
b = lower_bound(s, s + a + 2, x) - s;
d = lower_bound(t, t + b + 2, x) - t;
ans = 1e18;
for (j = b - 1; j < b + 1; j++) {
for (k = d - 1; k < d + 1; k++) {
ans = min(ans, abs(x - s[j]) + abs(s[j] - t[k]));
ans = min(ans, abs(x - t[k]) + abs(t[k] - s[j]));
}
}
printf("%ld\n", ans);
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
long a, b, q, s[100002], t[100002], ans, i, j, k, x, c, d;
int main() {
scanf("%ld%ld%ld", &a, &b, &q);
for (i = 1; i <= a; i++)
scanf("%ld", &s[i]);
s[a + 1] = 1e18;
s[0] = -1e18;
sort(s, s + a + 2);
for (i = 1; i <= b; i++)
scanf("%ld", &t[i]);
t[b + 1] = 1e18;
t[0] = -1e18;
sort(t, t + b + 2);
for (i = 1; i <= q; i++) {
scanf("%ld", &x);
c = lower_bound(s, s + a + 2, x) - s;
d = lower_bound(t, t + b + 2, x) - t;
ans = 1e18;
for (j = c - 1; j < c + 1; j++) {
for (k = d - 1; k < d + 1; k++) {
ans = min(ans, abs(x - s[j]) + abs(s[j] - t[k]));
ans = min(ans, abs(x - t[k]) + abs(t[k] - s[j]));
}
}
printf("%ld\n", ans);
}
return 0;
}
| [
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change"
] | 925,096 | 925,097 | u743561048 | cpp |
p03112 | #define rep(i, x) for (int i = 0; i < x; i++)
#define mod 1000000007
#define MOD 998244353
#define inf 1e18
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
int main() {
int a, b, q;
cin >> a >> b >> q;
vector<ll> s(a), t(b), ans(q);
rep(i, a) { cin >> s[i]; }
rep(i, b) { cin >> t[i]; }
ll s1, s2, t1, t2;
rep(i, q) {
ll p;
cin >> p;
ans[i] = inf;
s1 = lower_bound(s.begin(), s.end(), p) - s.begin();
t1 = lower_bound(t.begin(), t.end(), p) - t.begin();
s2 = s1 - 1;
t2 = t1 - 1;
if (s1 < a) {
if (t1 < a) {
ans[i] = min(ans[i], min(s[s1], t[t1]) - p + abs(s[s1] - t[t1]));
}
if (t2 >= 0) {
ans[i] = min(ans[i], min(s[s1] - p, p - t[t2]) + s[s1] - t[t2]);
}
}
if (s2 >= 0) {
if (t1 < a) {
ans[i] = min(ans[i], min(p - s[s2], t[t1] - p) + t[t1] - s[s2]);
}
if (t2 >= 0) {
ans[i] = min(ans[i], min(p - s[s2], p - t[t2]) + abs(s[s2] - t[t2]));
}
}
}
rep(i, q) { cout << ans[i] << endl; }
return 0;
} | #define rep(i, x) for (int i = 0; i < x; i++)
#define mod 1000000007
#define MOD 998244353
#define inf 1e18
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
int main() {
int a, b, q;
cin >> a >> b >> q;
vector<ll> s(a), t(b), ans(q);
rep(i, a) { cin >> s[i]; }
rep(i, b) { cin >> t[i]; }
ll s1, s2, t1, t2;
rep(i, q) {
ll p;
cin >> p;
ans[i] = inf;
s1 = lower_bound(s.begin(), s.end(), p) - s.begin();
t1 = lower_bound(t.begin(), t.end(), p) - t.begin();
s2 = s1 - 1;
t2 = t1 - 1;
if (s1 < a) {
if (t1 < b) {
ans[i] = min(ans[i], min(s[s1], t[t1]) - p + abs(s[s1] - t[t1]));
}
if (t2 >= 0) {
ans[i] = min(ans[i], min(s[s1] - p, p - t[t2]) + s[s1] - t[t2]);
}
}
if (s2 >= 0) {
if (t1 < b) {
ans[i] = min(ans[i], min(p - s[s2], t[t1] - p) + t[t1] - s[s2]);
}
if (t2 >= 0) {
ans[i] = min(ans[i], min(p - s[s2], p - t[t2]) + abs(s[s2] - t[t2]));
}
}
}
rep(i, q) { cout << ans[i] << endl; }
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 925,098 | 925,099 | u407614884 | cpp |
p03112 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1000000000000;
const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int a, b, q;
cin >> a >> b >> q;
vector<ll> s(a), t(b);
for (int i = 0; i < a; i++)
cin >> s[i];
for (int i = 0; i < b; i++)
cin >> t[i];
for (int i = 0; i < q; i++) {
ll x;
cin >> x;
auto sr = lower_bound(s.begin(), s.end(), x);
ll psl = -INF, psr = INF;
if (sr == s.begin())
psr = *sr;
else if (sr == s.end())
psl = *(--sr);
else {
psr = *sr;
psl = *(--sr);
}
auto tr = lower_bound(t.begin(), t.end(), x);
ll ptl = -INF, ptr = INF;
if (tr == t.begin())
ptr = *tr;
else if (tr == t.end())
ptl = *(--tr);
else {
ptr = *tr;
ptl = *(--tr);
}
// cout << psl << " " << psr << endl;
// cout << ptl << " " << ptr << endl;
// (s, t) = (l, l), (l, r), (r, l), (r, r)
ll ans = INF;
ll dll = max(x - psl, x - ptl);
ans = min(ans, dll);
ll dlr = min(2 * (x - psl) + (ptr - x), (x - psl) + 2 * (ptr - x));
ans = min(ans, dlr);
ll drl = min(2 * (psr - x) + (x - psl), (psr - x) + 2 * (x - psl));
ans = min(ans, drl);
ll drr = max(psr - x, ptr - x);
ans = min(ans, drr);
cout << ans << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1000000000000;
const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int a, b, q;
cin >> a >> b >> q;
vector<ll> s(a), t(b);
for (int i = 0; i < a; i++)
cin >> s[i];
for (int i = 0; i < b; i++)
cin >> t[i];
for (int i = 0; i < q; i++) {
ll x;
cin >> x;
auto sr = lower_bound(s.begin(), s.end(), x);
ll psl = -INF, psr = INF;
if (sr == s.begin())
psr = *sr;
else if (sr == s.end())
psl = *(--sr);
else {
psr = *sr;
psl = *(--sr);
}
auto tr = lower_bound(t.begin(), t.end(), x);
ll ptl = -INF, ptr = INF;
if (tr == t.begin())
ptr = *tr;
else if (tr == t.end())
ptl = *(--tr);
else {
ptr = *tr;
ptl = *(--tr);
}
// cout << psl << " " << psr << endl;
// cout << ptl << " " << ptr << endl;
// (s, t) = (l, l), (l, r), (r, l), (r, r)
ll ans = INF;
ll dll = max(x - psl, x - ptl);
ans = min(ans, dll);
ll dlr = min(2 * (x - psl) + (ptr - x), (x - psl) + 2 * (ptr - x));
ans = min(ans, dlr);
ll drl = min(2 * (psr - x) + (x - ptl), (psr - x) + 2 * (x - ptl));
ans = min(ans, drl);
ll drr = max(psr - x, ptr - x);
ans = min(ans, drr);
cout << ans << endl;
}
} | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 925,105 | 925,106 | u637771514 | cpp |
p03125 | #include <iostream>
using namespace std;
int a, b;
int main() {
cin >> a >> b;
if (!b % a)
cout << a + b;
else
cout << b - a;
return 0;
} | #include <iostream>
using namespace std;
int a, b;
int main() {
cin >> a >> b;
if (!(b % a))
cout << a + b;
else
cout << b - a;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 925,109 | 925,110 | u411546337 | cpp |
p03125 | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << (a + b);
else
cout << (a - b);
} | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << (a + b);
else
cout << (b - a);
}
| [
"expression.operation.binary.remove"
] | 925,115 | 925,116 | u795955612 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B & A == 0) {
cout << A + B << endl;
} else if (B & A != 0) {
cout << B - A << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else if (B % A != 0) {
cout << B - A << endl;
}
}
| [
"control_flow.branch.if.condition.change"
] | 925,117 | 925,118 | u834753207 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (A % B == 0) {
cout << A + B << endl;
return 0;
}
cout << B - A << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
return 0;
}
cout << B - A << endl;
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,119 | 925,120 | u884776614 | cpp |
p03125 | #include <iostream>
using namespace std;
int main(int argc, char **argv) {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b;
else
cout << a - b;
return 0;
} | #include <iostream>
using namespace std;
int main(int argc, char **argv) {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b;
else
cout << b - a;
return 0;
} | [
"expression.operation.binary.remove"
] | 925,123 | 925,124 | u141633429 | cpp |
p03125 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0) {
cout << a + b;
} else {
cout << b - a;
}
cout << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << b - a;
}
cout << endl;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,125 | 925,126 | u614159574 | cpp |
p03125 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << a - b;
}
cout << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << b - a;
}
cout << endl;
}
| [
"expression.operation.binary.remove"
] | 925,127 | 925,126 | u614159574 | cpp |
p03125 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << a - b;
}
cout << endl;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << b - a;
}
cout << endl;
}
| [
"expression.operation.binary.remove"
] | 925,127 | 925,128 | u614159574 | cpp |
p03125 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,129 | 925,130 | u186506670 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << "A + B" << endl;
} else {
cout << "B - A" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
}
| [] | 925,141 | 925,142 | u039537827 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> pll;
const ll mod = 1e9 + 7;
// const ll mod=998244353;
const ll inf = 5e18;
int main() {
ll a, b;
cin >> a >> b;
ll ans;
if (a % b)
ans = b - a;
else
ans = a + b;
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> pll;
const ll mod = 1e9 + 7;
// const ll mod=998244353;
const ll inf = 5e18;
int main() {
ll a, b;
cin >> a >> b;
ll ans;
if (b % a)
ans = b - a;
else
ans = a + b;
cout << ans << endl;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,143 | 925,144 | u718758485 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0);
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ((n) ? "Yes" : "No") << '\n';
#define CFYN(n) cout << ((n) ? "YES" : "NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
IOS int A, B;
cin >> A >> B;
if (A % B == 0)
OUT(A + B)
else
OUT(B - A)
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0);
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ((n) ? "Yes" : "No") << '\n';
#define CFYN(n) cout << ((n) ? "YES" : "NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
IOS int A, B;
cin >> A >> B;
if (B % A == 0)
OUT(A + B)
else
OUT(B - A)
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,149 | 925,150 | u330661451 | cpp |
p03125 | #include <algorithm>
#include <iomanip>
#include <iostream>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
int a, b;
cin >> a >> b;
if (b & a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
} | #include <algorithm>
#include <iomanip>
#include <iostream>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
} | [
"control_flow.branch.if.condition.change"
] | 925,151 | 925,152 | u037675438 | cpp |
p03125 | #include <iostream>
int main() {
int A, B;
std::cin >> A >> B;
int ans = B % A == 0 ? (A + B) : (A - B);
std::cout << ans << std::endl;
return 0;
}
| #include <iostream>
int main() {
int A, B;
std::cin >> A >> B;
int ans = B % A == 0 ? (A + B) : (B - A);
std::cout << ans << std::endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,155 | 925,156 | u059605263 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << A - B << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
} | [
"expression.operation.binary.remove"
] | 925,161 | 925,162 | u164730704 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
const int INF = 1001001001;
/*
*
* */
int main() {
int A, B;
cin >> A >> B;
int ans = 0;
if (A % B == 0) {
ans = A + B;
} else {
ans = B - A;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
const int INF = 1001001001;
/*
*
* */
int main() {
int A, B;
cin >> A >> B;
int ans = 0;
if (B % A == 0) {
ans = A + B;
} else {
ans = B - A;
}
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,163 | 925,164 | u067267880 | cpp |
p03125 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;
int main(void) {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;
int main(void) {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,176 | 925,177 | u835805357 | cpp |
p03125 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;
void P(int x) { cout << x << endl; }
void P(long x) { cout << x << endl; }
void P(double x) { cout << x << endl; }
void P(ll x) { cout << x << endl; }
void P(string x) { cout << x << endl; }
void P(char x) { cout << x << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0)
P(a + b);
else
P(b - a);
return 0;
} | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;
void P(int x) { cout << x << endl; }
void P(long x) { cout << x << endl; }
void P(double x) { cout << x << endl; }
void P(ll x) { cout << x << endl; }
void P(string x) { cout << x << endl; }
void P(char x) { cout << x << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
P(a + b);
else
P(b - a);
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,182 | 925,183 | u152335469 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0);
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << a - b << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0);
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,184 | 925,185 | u856877925 | cpp |
p03125 | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << b - a;
else
cout << b - a << endl;
}
| #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << b + a << endl;
else
cout << b - a << endl;
} | [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change",
"io.output.newline.add"
] | 925,193 | 925,194 | u120050685 | cpp |
p03125 | #include <iostream>
int main() {
int a, b;
std::cin >> a >> b;
if (b % a == 0)
std::cout << a + b << '\n';
else {
std::cout << a - b << '\n';
}
return 0;
}
| #include <iostream>
int main() {
int a, b;
std::cin >> a >> b;
if (b % a == 0)
std::cout << a + b << '\n';
else {
std::cout << b - a << '\n';
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,195 | 925,196 | u203979694 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << a - b << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
} | [
"expression.operation.binary.remove"
] | 925,197 | 925,198 | u593934357 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << a - b << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
} | [
"expression.operation.binary.remove"
] | 925,199 | 925,200 | u201928947 | cpp |
p03125 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
using ll = long long;
using P = pair<int, int>;
int main(void) {
int a, b;
cin >> a >> b;
if (a % b == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
} | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
using ll = long long;
using P = pair<int, int>;
int main(void) {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,201 | 925,202 | u276969395 | cpp |
p03125 | #include <bits/stdc++.h>
#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#else
#define DBG(X)
#define SAY(X)
#endif
#ifdef __LOCAL
#include <filesystem>
namespace fs = std::filesystem;
#endif
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INT_INF = (int)(2e9);
const ll LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
inline ll randint(ll a, ll b) {
ll w = (_g() << 31LL) ^ _g();
return a + w % (b - a + 1);
}
inline void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
};
template <typename T, typename S>
inline ostream &operator<<(ostream &os, const pair<T, S> p) {
cout << "[" << p.first << ";" << p.second << "]";
return os;
}
template <typename T, typename S>
inline ostream &operator<<(ostream &os, const map<T, S> p) {
for (auto el : p)
cout << "[" << el.first << ";" << el.second << "]";
return os;
}
template <typename T>
inline ostream &operator<<(ostream &os, const vector<T> &v) {
for (auto el : v)
cout << el << " ";
return os;
}
template <typename T> inline vector<T> fetch_vec(int sz) {
vector<T> ret(sz);
for (auto &elem : ret)
cin >> elem;
return ret;
}
int A, B;
void input() {
fast_io();
#ifdef __LOCAL
fs::path p = __FILE__;
fs::path input, output;
input = output = p.parent_path();
input += string("/input/") + string(p.stem()) + string(".txt");
output += string("/output/") + string(p.stem()) + string(".txt");
freopen(input.c_str(), "r", stdin);
freopen(output.c_str(), "w", stdout);
#endif
cin >> A >> B;
}
int solve() {
if (B % A == 0)
cout << A + B << endl;
else
cout << A - B << endl;
return 0;
}
int main() {
input();
solve();
return 0;
}
| #include <bits/stdc++.h>
#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#else
#define DBG(X)
#define SAY(X)
#endif
#ifdef __LOCAL
#include <filesystem>
namespace fs = std::filesystem;
#endif
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INT_INF = (int)(2e9);
const ll LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
inline ll randint(ll a, ll b) {
ll w = (_g() << 31LL) ^ _g();
return a + w % (b - a + 1);
}
inline void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
};
template <typename T, typename S>
inline ostream &operator<<(ostream &os, const pair<T, S> p) {
cout << "[" << p.first << ";" << p.second << "]";
return os;
}
template <typename T, typename S>
inline ostream &operator<<(ostream &os, const map<T, S> p) {
for (auto el : p)
cout << "[" << el.first << ";" << el.second << "]";
return os;
}
template <typename T>
inline ostream &operator<<(ostream &os, const vector<T> &v) {
for (auto el : v)
cout << el << " ";
return os;
}
template <typename T> inline vector<T> fetch_vec(int sz) {
vector<T> ret(sz);
for (auto &elem : ret)
cin >> elem;
return ret;
}
int A, B;
void input() {
fast_io();
#ifdef __LOCAL
fs::path p = __FILE__;
fs::path input, output;
input = output = p.parent_path();
input += string("/input/") + string(p.stem()) + string(".txt");
output += string("/output/") + string(p.stem()) + string(".txt");
freopen(input.c_str(), "r", stdin);
freopen(output.c_str(), "w", stdout);
#endif
cin >> A >> B;
}
int solve() {
if (B % A == 0)
cout << A + B << endl;
else
cout << B - A << endl;
return 0;
}
int main() {
input();
solve();
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,210 | 925,211 | u858670323 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
cout << (A % B == 0 ? A + B : B - A) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
cout << (B % A == 0 ? A + B : B - A) << endl;
return 0;
} | [
"expression.operation.binary.remove"
] | 925,226 | 925,227 | u303453927 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < c; ++i)
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << a * b << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < c; ++i)
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
} | [
"expression.operation.binary.remove"
] | 925,228 | 925,229 | u717762991 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < c; ++i)
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a * b << endl;
} else {
cout << a + b << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < c; ++i)
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
} | [
"expression.operator.arithmetic.change",
"io.output.change",
"expression.operation.binary.remove"
] | 925,230 | 925,229 | u717762991 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | [
"expression.operation.binary.remove"
] | 925,231 | 925,232 | u823722490 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int ans = b - a;
if (b % a == 0)
ans = a - b;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int ans = b - a;
if (b % a == 0)
ans = a + b;
cout << ans << endl;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 925,239 | 925,240 | u578871832 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int ans = b - a;
if (a % b == 0)
ans = a - b;
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int ans = b - a;
if (b % a == 0)
ans = a + b;
cout << ans << endl;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 925,241 | 925,240 | u578871832 | cpp |
p03125 | #include <cstdio>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (a % b == 0) {
printf("%d", a + b);
}
else
printf("%d", b - a);
}
| #include <cstdio>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d", a + b);
}
else {
printf("%d", b - a);
}
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,244 | 925,245 | u928286472 | cpp |
p03125 | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a % b)
cout << a - b << endl;
else
cout << a + b << endl;
} | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> b >> a;
if (a % b)
cout << a - b << endl;
else
cout << a + b << endl;
} | [
"expression.operation.binary.remove"
] | 925,247 | 925,248 | u802434195 | cpp |
p03125 | #include <algorithm>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i, a, N) for ((i) = (a); (i) < (N); (i)++)
#define rrp(i, N, a) for ((i) = (N)-1; (i) >= (a); (i)--)
#define llfor ll i, j, k
#define sc(a) cin >> a
#define pr(a) cout << a << endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(), a.end())
#define push(a, b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a, b) (a, vector<ll>(b))
#define llpvec vector<pair<ll, ll>>
/*繰り上げ除算*/ ll cei(ll x, ll y) {
ll ans = x / y;
if (x % y != 0)
ans++;
return ans;
}
/*最大公約数*/ ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
/*最小公倍数*/ ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
/*n乗*/ ll llpow(ll x, ll n) {
ll i, ans = 1;
rep(i, 0, n) ans *= x;
return ans;
}
/*階乗*/ ll fact(ll x) {
ll i, ans = 1;
rep(i, 0, x) ans *= (x - i);
return ans;
}
/*nCr*/ ll ncr(ll n, ll r) { return fact(n) / fact(r) / fact(n - r); }
/*nPr*/ ll npr(ll n, ll r) { return fact(n) / fact(n - r); }
/*primejudge*/ bool prime(ll a) {
if (a <= 1)
return false;
ll i;
for (i = 2; i * i <= a; i++) {
if (a % i == 0)
return false;
}
return true;
}
ll ans = 0;
llfor; ///////////////////////////////////////////////////////////
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0)
cout << B - A;
else
cout << A + B;
return 0;
}
| #include <algorithm>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i, a, N) for ((i) = (a); (i) < (N); (i)++)
#define rrp(i, N, a) for ((i) = (N)-1; (i) >= (a); (i)--)
#define llfor ll i, j, k
#define sc(a) cin >> a
#define pr(a) cout << a << endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(), a.end())
#define push(a, b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a, b) (a, vector<ll>(b))
#define llpvec vector<pair<ll, ll>>
/*繰り上げ除算*/ ll cei(ll x, ll y) {
ll ans = x / y;
if (x % y != 0)
ans++;
return ans;
}
/*最大公約数*/ ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
/*最小公倍数*/ ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
/*n乗*/ ll llpow(ll x, ll n) {
ll i, ans = 1;
rep(i, 0, n) ans *= x;
return ans;
}
/*階乗*/ ll fact(ll x) {
ll i, ans = 1;
rep(i, 0, x) ans *= (x - i);
return ans;
}
/*nCr*/ ll ncr(ll n, ll r) { return fact(n) / fact(r) / fact(n - r); }
/*nPr*/ ll npr(ll n, ll r) { return fact(n) / fact(n - r); }
/*primejudge*/ bool prime(ll a) {
if (a <= 1)
return false;
ll i;
for (i = 2; i * i <= a; i++) {
if (a % i == 0)
return false;
}
return true;
}
ll ans = 0;
llfor; ///////////////////////////////////////////////////////////
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0)
cout << B + A;
else
cout << -A + B;
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change",
"expression.operation.unary.add"
] | 925,249 | 925,250 | u125669112 | cpp |
p03125 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a - b << endl;
else
cout << b - a << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
}
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change"
] | 925,256 | 925,257 | u534923072 | cpp |
p03125 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0)
cout << a - b << endl;
else
cout << b - a << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"io.output.change"
] | 925,258 | 925,257 | u534923072 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0)
cout << a + b << endl;
else
cout << b - a << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,263 | 925,264 | u071304940 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
return 0;
}
cout << a - b << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
return 0;
}
cout << b - a << endl;
}
| [
"expression.operation.binary.remove"
] | 925,271 | 925,272 | u188588273 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
}
else {
cout << a - b << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
}
else {
cout << b - a << endl;
}
}
| [
"expression.operation.binary.remove"
] | 925,275 | 925,276 | u751515087 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (A % B) {
cout << B - A << endl;
} else {
cout << A + B << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A) {
cout << B - A << endl;
} else {
cout << A + B << endl;
}
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,279 | 925,280 | u538808095 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B;
} else {
cout << A - B;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B;
} else {
cout << B - A;
}
} | [
"expression.operation.binary.remove"
] | 925,281 | 925,282 | u659267170 | cpp |
p03125 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
int A, B;
cin >> A >> B;
if (A % B == 0) {
cout << A + B << endl;
} else {
cout << B - A << 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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,287 | 925,288 | u423665486 | cpp |
p03125 | #include <iostream>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << a - b << endl;
}
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
} | [
"expression.operation.binary.remove"
] | 925,289 | 925,290 | u437095746 | cpp |
p03125 | #include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a;
cin >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - 1 << endl;
}
} | #include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int a, b;
cin >> a;
cin >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
} | [
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 925,291 | 925,292 | u583963729 | cpp |
p03125 | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
class Stream {
public:
Stream() {}
//配列以外の入力を受け取る
void read() {}
template <typename First, typename... Rest>
void read(First &first, Rest &...rest) {
cin >> first;
read(rest...);
}
//配列を区切って出力する
template <typename T> void write_vec(vector<T> &v, char divider) {
for (size_t i = 0; i < v.size(); i++) {
cout << v[i] << divider;
}
}
};
int main() {
Stream io;
int A, B;
io.read(A, B);
if (B % A == 0)
cout << A + B;
else
cout << A - B;
return 0;
} | #include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
class Stream {
public:
Stream() {}
//配列以外の入力を受け取る
void read() {}
template <typename First, typename... Rest>
void read(First &first, Rest &...rest) {
cin >> first;
read(rest...);
}
//配列を区切って出力する
template <typename T> void write_vec(vector<T> &v, char divider) {
for (size_t i = 0; i < v.size(); i++) {
cout << v[i] << divider;
}
}
};
int main() {
Stream io;
int A, B;
io.read(A, B);
if (B % A == 0)
cout << A + B;
else
cout << B - A;
return 0;
} | [
"expression.operation.binary.remove"
] | 925,301 | 925,302 | u269291896 | cpp |
p03125 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007LL;
// constexpr long long MOD = 998244353LL;
template <class T, class U> inline bool chmax(T &a, U b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T, class U> inline bool chmin(T &a, U b) {
if (a > b) {
a = b;
return true;
}
return false;
}
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
cin >> a >> b;
if (b / a == 0)
cout << a + b << ln;
else
cout << b - a << ln;
return 0;
} | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007LL;
// constexpr long long MOD = 998244353LL;
template <class T, class U> inline bool chmax(T &a, U b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T, class U> inline bool chmin(T &a, U b) {
if (a > b) {
a = b;
return true;
}
return false;
}
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << ln;
else
cout << b - a << ln;
return 0;
} | [
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 925,303 | 925,304 | u486105630 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << a - b << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
}
| [
"expression.operation.binary.remove"
] | 925,309 | 925,310 | u296989351 | cpp |
p03125 | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0)
cout << a + b;
else
cout << b - a;
} | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b;
else
cout << b - a;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,315 | 925,316 | u387692529 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9 + 7;
int main() {
int a, b;
cin >> a >> b;
if (!b % a)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9 + 7;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | [
"expression.operation.unary.logical.remove",
"control_flow.branch.if.condition.change"
] | 925,320 | 925,321 | u191484928 | cpp |
p03125 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int main() {
int a, b;
cin >> a >> b;
cout << (b % a == 0 ? a + b : a - b) << endl;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int main() {
int a, b;
cin >> a >> b;
cout << (b % a == 0 ? a + b : b - a) << endl;
} | [
"expression.operation.binary.remove"
] | 925,322 | 925,323 | u233586402 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
cout << ((B % A == 0) ? A + B : A - B) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
cout << ((B % A == 0) ? A + B : B - A) << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,324 | 925,325 | u568877271 | cpp |
p03125 | /* ______
_______ /\ |``\ | | /
| / \ |__/ |____ |/
| / _ _\ | \ | |\
| / \ | \ |______ | \
Dept. of CSE
Comilla University
*/
#include <bits/stdc++.h>
#define pi 2 * acos(0.0)
#define ll long long
#define FIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define Node struct node
#define spc " "
#define E 2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx, ny) nx >= 0 && nx < n &&ny >= 0 && ny < m
#define ee endl
#define pii pair<int, int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[] = {0, 0, +1, -1};
int fy[] = {+1, -1, 0, 0};
using namespace std;
/// check n=1;
/// check corner case;
const int maX = 1e5 + 1;
vector<ll> Graph[maX], cost[maX];
ll visit[maX];
ll x[10];
ll y[10];
int main() {
ll a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
}
| /* ______
_______ /\ |``\ | | /
| / \ |__/ |____ |/
| / _ _\ | \ | |\
| / \ | \ |______ | \
Dept. of CSE
Comilla University
*/
#include <bits/stdc++.h>
#define pi 2 * acos(0.0)
#define ll long long
#define FIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define Node struct node
#define spc " "
#define E 2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx, ny) nx >= 0 && nx < n &&ny >= 0 && ny < m
#define ee endl
#define pii pair<int, int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[] = {0, 0, +1, -1};
int fy[] = {+1, -1, 0, 0};
using namespace std;
/// check n=1;
/// check corner case;
const int maX = 1e5 + 1;
vector<ll> Graph[maX], cost[maX];
ll visit[maX];
ll x[10];
ll y[10];
int main() {
ll a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,326 | 925,327 | u164081575 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A != 0)
cout << A + B;
else
cout << B - A;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0)
cout << A + B;
else
cout << B - A;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 925,328 | 925,329 | u884647366 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A != 0)
cout << A - B;
else
cout << A + B;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0)
cout << A + B;
else
cout << B - A;
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.branch.else.remove",
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add"
] | 925,331 | 925,329 | u884647366 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(a, b) \
if ((a) > (b)) \
(a) = (b);
#define chmax(a, b) \
if ((a) < (b)) \
(a) = (b);
#define vi vector<int>
#define pii pair<int, int>
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define pb push_back
#define pf push_front
int gcd(int a, int b) { /*a>=0,b>=0,¬(a=b=0)*/
while (min(a, b) > 0) {
if (a < b)
swap(a, b);
a %= b;
}
return max(a, b);
}
int dx[] = {0, 1, 0, -1, 1, -1, -1, 1};
int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int MOD = 1e9 + 7;
const int INF = 1e18 + 10;
/*----------------------------------------------*/
signed main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(a, b) \
if ((a) > (b)) \
(a) = (b);
#define chmax(a, b) \
if ((a) < (b)) \
(a) = (b);
#define vi vector<int>
#define pii pair<int, int>
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define pb push_back
#define pf push_front
int gcd(int a, int b) { /*a>=0,b>=0,¬(a=b=0)*/
while (min(a, b) > 0) {
if (a < b)
swap(a, b);
a %= b;
}
return max(a, b);
}
int dx[] = {0, 1, 0, -1, 1, -1, -1, 1};
int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int MOD = 1e9 + 7;
const int INF = 1e18 + 10;
/*----------------------------------------------*/
signed main() {
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,335 | 925,336 | u552847961 | cpp |
p03125 | #include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int a, b;
cin >> a >> b;
cout << (a % b == 0 ? a + b : b - a) << endl;
}
| #include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int a, b;
cin >> a >> b;
cout << (b % a == 0 ? a + b : b - a) << endl;
}
| [
"expression.operation.binary.remove"
] | 925,344 | 925,345 | u519759783 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0) {
cout << a + b;
} else
cout << b - a;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else
cout << b - a;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,370 | 925,371 | u478705580 | cpp |
p03125 | #include <algorithm>
#include <cmath>
#include <complex>
#include <functional>
#include <iostream>
#include <limits>
#include <numeric>
#include <sstream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int A, B;
cin >> A >> B;
if (A % B == 0) {
cout << A + B;
} else {
cout << B - A;
}
return 0;
}
| #include <algorithm>
#include <cmath>
#include <complex>
#include <functional>
#include <iostream>
#include <limits>
#include <numeric>
#include <sstream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B;
} else {
cout << B - A;
}
return 0;
}
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,372 | 925,373 | u557207741 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll, ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll, ll>>>
#define PL pair<ll, ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};
int main() {
ll a, b;
cin >> a >> b;
if (b % a)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll, ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll, ll>>>
#define PL pair<ll, ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};
int main() {
ll a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 925,374 | 925,375 | u893584578 | cpp |
p03125 | #include <stdio.h>
int main() {
int A, B;
scanf("%d %D", &A, &B);
if (B % A == 0) {
printf("%d", A + B);
} else {
printf("%d", B - A);
}
return 0;
} | #include <stdio.h>
int main() {
int A, B;
scanf("%d %d", &A, &B);
if (B % A == 0) {
printf("%d\n", A + B);
} else {
printf("%d\n", B - A);
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change",
"io.output.newline.add"
] | 925,388 | 925,389 | u089230684 | cpp |
p03125 | #include <stdio.h>
int main() {
int A, B;
scanf("%d %D", &A, &B);
if (B % A == 0) {
printf("%d", A + B);
} else {
printf("%d", B - A);
}
return 0;
} | #include <stdio.h>
int main() {
int A, B;
scanf(" %d %d", &A, &B);
if (B % A == 0) {
printf("%d", A + B);
} else {
printf("%d", B - A);
}
return 0;
} | [
"literal.string.change",
"call.arguments.change"
] | 925,388 | 925,390 | u089230684 | cpp |
p03125 | #include <stdio.h>
int main() {
int A, B;
scanf("%d %d", &A, &B);
if (A % B == 0)
printf("%d", A + B);
else
printf("%d", B - A);
return 0;
} | #include <stdio.h>
int main() {
int A, B;
scanf("%d %d", &A, &B);
if (B % A == 0)
printf("%d", A + B);
else
printf("%d", B - A);
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,391 | 925,392 | u089230684 | cpp |
p03125 | #include <stdio.h>
int main() {
int A, B;
scanf("%d %D", &A, &B);
if (B % A == 0) {
printf("%d", A + B);
} else {
printf("%d", B - A);
}
return 0;
} | #include <stdio.h>
int main() {
int A, B;
scanf("%d %d", &A, &B);
if (B % A == 0)
printf("%d", A + B);
else
printf("%d", B - A);
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 925,388 | 925,392 | u089230684 | cpp |
p03125 | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (A % B == 0)
cout << B + A;
else
cout << B - A;
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0)
cout << B + A;
else
cout << B - A;
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,397 | 925,398 | u337949146 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
vector<pair<int64_t, int64_t>> p;
for (int64_t i = 2; i * i <= x; i++) {
int cnt = 0;
if (x % i == 0) {
while (x % i == 0) {
cnt++;
x /= i;
}
p.push_back(make_pair(i, cnt));
}
}
if (x != 1) {
p.push_back(make_pair(x, 1));
}
return p;
}
int main() {
int A, B;
cin >> A >> B;
if (A % B == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
vector<pair<int64_t, int64_t>> p;
for (int64_t i = 2; i * i <= x; i++) {
int cnt = 0;
if (x % i == 0) {
while (x % i == 0) {
cnt++;
x /= i;
}
p.push_back(make_pair(i, cnt));
}
}
if (x != 1) {
p.push_back(make_pair(x, 1));
}
return p;
}
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,399 | 925,400 | u209457657 | cpp |
p03125 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
int main(int argc, const char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << a - b << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
int main(int argc, const char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int a, b;
cin >> a >> b;
if (b % a == 0)
cout << a + b << endl;
else
cout << b - a << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,403 | 925,404 | u843929518 | cpp |
p03125 | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b & a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
}
| #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 925,405 | 925,406 | u353919145 | cpp |
p03125 | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b & a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
}
| #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 925,405 | 925,407 | u353919145 | cpp |
p03125 | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b & a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
}
| #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 925,405 | 925,408 | u353919145 | cpp |
p03125 | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b & a == 0) {
printf("%d", a + b);
} else {
printf("%d", b - a);
}
return 0;
}
| #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d\n", a + b);
} else {
printf("%d\n", b - a);
}
return 0;
}
| [
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change",
"io.output.change",
"io.output.newline.add"
] | 925,405 | 925,409 | u353919145 | cpp |
p03125 | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b;
c = b % a;
if (c == 0) {
cout << a + b << endl;
} else {
cout << a - b << endl;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b;
c = b % a;
if (c == 0) {
cout << a + b << endl;
} else {
cout << b - a << endl;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,410 | 925,411 | u353919145 | cpp |
p03125 | #include <stdio.h>
int main() {
int A, B;
scanf("%d %d", &A, &B);
if (B % A == 0) {
printf("%d", A + B);
} else {
printf("%d", A - B);
}
return 0;
} | #include <stdio.h>
int main() {
int A, B;
scanf("%d %d", &A, &B);
if (B % A == 0) {
printf("%d", A + B);
} else {
printf("%d", B - A);
}
return 0;
} | [
"expression.operation.binary.remove"
] | 925,412 | 925,413 | u018679195 | cpp |
p03125 | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
b % a == 0 ? printf("%d\n", a + b) : printf("%d\n", a - b);
return 0;
}
| #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
b % a == 0 ? printf("%d\n", a + b) : printf("%d\n", b - a);
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,414 | 925,415 | u567412106 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << (b % a == 0 ? a + b : a - b) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << (b % a == 0 ? a + b : b - a) << endl;
}
| [
"expression.operation.binary.remove"
] | 925,416 | 925,417 | u317830102 | cpp |
p03125 | #include <stdio.h>
int main() {
int a, b;
scanf("%d%d", &a, &b);
if (a % b == 0) {
printf("%d\n", a + b);
} else {
printf("%d\n", b - a);
}
return 0;
}
| #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
if (b % a == 0) {
printf("%d\n", a + b);
} else {
printf("%d\n", b - a);
}
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,418 | 925,419 | u863370423 | cpp |
p03125 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define debug(x...)
#endif
void solve() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << a - b;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
// pre();
while (t--)
solve();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V> void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T> void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x)
cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V> void _print(T t, V... v) {
__print(t);
if (sizeof...(v))
cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
#else
#define debug(x...)
#endif
void solve() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << b - a;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
// pre();
while (t--)
solve();
return 0;
} | [
"expression.operation.binary.remove"
] | 925,442 | 925,443 | u459759631 | cpp |
p03125 | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << a - b;
}
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (b % a == 0) {
cout << a + b;
} else {
cout << b - a;
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 925,444 | 925,445 | u746613804 | cpp |
p03125 | #include <iostream>
#include <string>
using namespace std;
int main(void) {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << A - B << endl;
}
}
| #include <iostream>
#include <string>
using namespace std;
int main(void) {
int A, B;
cin >> A >> B;
if (B % A == 0) {
cout << A + B << endl;
} else {
cout << B - A << endl;
}
}
| [
"expression.operation.binary.remove"
] | 925,446 | 925,447 | u963353562 | cpp |
p03125 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int A, B;
cin >> A >> B;
if (A % B == 0)
cout << A + B << endl;
else
cout << B - A << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int A, B;
cin >> A >> B;
if (B % A == 0)
cout << A + B << endl;
else
cout << B - A << endl;
return 0;
} | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 925,452 | 925,453 | u530957410 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.