buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<LL, LL> pii;
LL N, X;
LL f(LL a, LL b) {
if (a <= 0 || b <= 0)
return 0;
if (a % b == 0)
return ((a + b) / b - 1) * 2 * b;
LL c = (a + b) % b;
return (a + b) / b * b * 2 + (b - 1) / c * c + f(c - (b... | #include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<LL, LL> pii;
LL N, X;
LL f(LL a, LL b) {
if (a <= 0 || b <= 0)
return 0;
if (a % b == 0)
return ((a + b) / b - 1) * 2 * b;
LL c = (a + b) % b;
return (a + b) / b * b * 2 + (b - 1) / c * c + f(c - (b... | [["-", 3, 4, 0, 16, 31, 16, 31, 16, 31, 22], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 72], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["-", 31, 16, 12, 16, 31, 16, 12, 23, 0, 24], ["-", 1... | 1 | 230 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
// Quick Read
int Read() {
int x = 0;
bool neg = false;
char c = getchar();
while (isdigit(c) == false)
neg ^= c == '-', c = getchar();
while (isdigit(c) == true)
x = x ... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
// Quick Read
long long Read() {
long long x = 0;
bool neg = false;
char c = getchar();
while (isdigit(c) == false)
neg ^= c == '-', c = getchar();
while (isdigit(c) == true... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 37, 0, 41, 75, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35], ["-", 36, 36, 0, 30, 0, 14, 8, 9, 0, 46], ["-", 36, 36, 0, 30, ... | 1 | 233 |
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using ... | // This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using ... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["... | 1 | 456 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(I, A, B) for (in... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define FOR(I, A, B) for (in... | [["-", 0, 57, 64, 37, 0, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 17, 72], ["-", 0, 57, 64, 37, 0, 16, 12, 2, 63, 22], ["-", 64, 37, 0, 16, 12, 2, 3, 4, 0, 24], ["-", 64, 37, 0, 16, 12, 2, 3, 4, 0, 22], ["-", 64, 37, 0, 16, 12, 2, 3, 4, 0, 21], ["-", 64, 37, 0, 16, 12, 2, 3, 4, 0, 25], ["-", 0, 14, 8, 9, ... | 1 | 187 |
#include <iostream>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
int main(void) {
int n, x;
cin >> n >> x;
int gc = gcd(n - x, x);
cout << 3 * (n - gc) << endl;
return 0;
} | #include <iostream>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
int main(void) {
ll n, x;
cin >> n >> x;
ll gc = gcd(n - x, x);
cout << 3 * (n - gc) << endl;
return 0;
} | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-... | 1 | 85 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)
template <class T1, class T2> void chmin(T1 &a, T2 b) {
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)
template <class T1, class T2> void chmin(T1 &a, T2 b) {
... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 19], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 16, 31, 16, 12, 16, 31, 2, 63, 22]... | 1 | 256 |
#include <iostream>
using namespace std;
int main() {
long N, X;
cin >> N >> X;
long ans = 0, a, b;
a = N - X;
b = X;
ans += N;
while (true) {
if (a % b == 0) {
ans += a * (a / b) - b;
break;
} else if (b % a == 0) {
ans += b * (b / a) - a;
break;
} else if (a > b) {
... | #include <iostream>
using namespace std;
int main() {
long N, X;
cin >> N >> X;
long ans = 0, a, b;
a = N - X;
b = X;
ans += N;
while (true) {
if (a % b == 0) {
ans += b * ((a / b) * 2 - 1);
break;
} else if (b % a == 0) {
ans += a * ((b / a) * 2 - 1);
break;
} else if... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 48], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, ... | 1 | 164 |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
using namespace std;
typedef pair<int, int> P;
typedef pair<ll,... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
using namespace std;
typedef pair<int, int> P;
typedef pair<ll,... | [["+", 0, 57, 64, 37, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 64, 37, 0, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 17, 48], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 23, 0, 24], ["-", 8, 9, 0, 37, 0, 16, 31, 16, 17, 72], ["-", 0, 37, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 31, 16... | 1 | 167 |
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
long long n, k;
int main() {
scanf("%lld%lld", &n, &k);
if (k * 2LL == n) {
printf("%lld", 3LL * k);
} else {
long long res = n, x, y;
if (k < n - k) {
x = k;
y = n - k - k;
res += 2 * x;
while (x != ... | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
long long n, k;
int main() {
scanf("%lld%lld", &n, &k);
if (k * 2LL == n) {
printf("%lld", 3LL * k);
} else {
long long res = n, x, y;
if (k < n - k) {
x = k;
y = n - k - k;
res += 2 * x;
while (x != ... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 64, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 318 |
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long LL;
LL find(LL a, LL b) {
if (a <= b)
swap(a, b);
if (b == 0)
return 0;
return 2 * (a / b) *... | #include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long LL;
LL find(LL a, LL b) {
if (a <= b)
swap(a, b);
if (a % b == 0)
return 2 * (a / b - 1) * b +... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 64, 37, 0, 16, 31, 16, 31, 16, 31, 13], ["+", 64, 37, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 16, 31, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 23, 0, 16, 31, 16, 31, 22],... | 1 | 141 |
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def m... | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def m... | [["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["-", 36, 36, 36, 36, 0, 656, 0, 57... | 5 | 300 |
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pill pair<ll, ll>
#define f first
#define s second
#define pilc pair<ll, char>
#define all(a) (a).begin(), (a).end()
#define rep(s, e, step) for (int i = (s... | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pill pair<ll, ll>
#define f first
#define s second
#define pilc pair<ll, char>
#define all(a) (a).begin(), (a).end()
#define rep(s, e, step) for (int i = (s... | [["-", 0, 16, 12, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 16, 12, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 16, 12, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 48], ["-", 12, 16, 31, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 16, 12, 16, 31, 16, 12, 23, 0, 25], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["-", 0,... | 1 | 131 |
/*
_ _ _______ _ _
| | / / | _____| | | / /
| | / / | | | | / /
| |/ / | |_____ | |/ /
| |\ \ | _____| | |\ \
| | \ \ | | | | \ \
| | \ \ | |_____ | | \ \
|_| \_\ |_______| |_| \_\
*/
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <c... | /*
_ _ _______ _ _
| | / / | _____| | | / /
| | / / | | | | / /
| |/ / | |_____ | |/ /
| |\ \ | _____| | |\ \
| | \ \ | | | | \ \
| | \ \ | |_____ | | \ \
|_| \_\ |_______| |_| \_\
*/
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <c... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 31, 22], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 17, 85], ["-", 31, 16, 12, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 12, 22], [... | 1 | 282 |
#include <bits/stdc++.h>
int64_t f(int64_t a, int64_t b) {
if (a == b) {
return a;
}
if (a > b) {
std::swap(a, b);
}
if (b % a != 0) {
return 2 * a * (b / a) + f(a, b % a);
} else {
return 2 * a + f(a, b - a);
}
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nul... | #include <bits/stdc++.h>
int64_t f(int64_t a, int64_t b) {
if (a == b) {
return a;
}
if (a > b) {
std::swap(a, b);
}
if (b % a != 0) {
return 2 * a * (b / a) + f(a, b % a);
} else {
return 2 * a * (b / a - 1) + a;
}
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie... | [["-", 75, 76, 0, 9, 0, 37, 0, 16, 17, 72], ["-", 0, 9, 0, 37, 0, 16, 12, 2, 63, 22], ["+", 0, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["-", 0, 37, 0, 16, 12, 2, 3, 4, 0, 22], ["-", 0, 37, 0, 16, 12, 2, 3, 4, 0, 21], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 23, 0, 16, 31, 16, 17, 85], ["+", 0, 16, 31, 16, ... | 1 | 144 |
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long i64;
i64 gcd(i64, i64);
int main(void) {
i64 N, X;
cin >> N >> X;
i64 L = N;
i64 tmp;
N -= X;
while (X) {
if (N % X > 0) {
L += 2 * (N / X) * X;
} else {
L += 2 * (N / X) * X - X;
break;
}
... | #include <algorithm>
#include <iostream>
using namespace std;
typedef long long i64;
i64 gcd(i64, i64);
int main(void) {
i64 N, X;
cin >> N >> X;
i64 L = N;
i64 tmp;
N -= X;
if (X > N)
swap(N, X);
while (X) {
if (N % X > 0) {
L += 2 * (N / X) * X;
} else {
L += 2 * (N / X) * X... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 0, 57, 64... | 1 | 176 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <sy... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <sy... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64, 9,... | 1 | 360 |
#include <iostream>
using namespace std;
int calc(int width, int height) {
if (height > width) {
const int q = height / width;
const int r = height % width;
// cout << "(" << width << ", " << height << ")\n";
if (r == 0)
return 2 * q * width - width;
else
return 2 * q * width + calc(... | #include <iostream>
using namespace std;
int64_t calc(int64_t width, int64_t height) {
if (height > width) {
const int64_t q = height / width;
const int64_t r = height % width;
// cout << "(" << width << ", " << height << ")\n";
if (r == 0)
return 2 * q * width - width;
else
return 2... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["-", 75, 76, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 75, 7... | 1 | 187 |
#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>;
inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) {
while (a)
swap(a, b %= a);
return b;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int ... | #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>;
inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) {
while (a)
swap(a, b %= a);
return b;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int ... | [["-", 0, 16, 31, 16, 12, 16, 12, 2, 63, 22], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 22], ["-", 31, 16, 12, 16, 12, 2, 3, 4, 0, 21], ["+", 12, 16, 12, 23, 0, 16, 12, 2, 63, 22], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 12, 23, 0, ... | 1 | 130 |
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mod 1000000007
ll n, m, i, j, k, l, t, a, b;
int main() {
scanf("%lld %lld", &n, &m);
j = 2 * m;
if (j <= n) {
t = n + j;
a = m;
b = n - j;
while (a % b != 0) {
n = a / b;
n *= b;
t ... | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mod 1000000007
ll n, m, i, j, k, l, t, a, b;
int main() {
scanf("%lld %lld", &n, &m);
j = 2 * m;
if (j == n) {
printf("%lld\n", n + m);
return 0;
}
if (j <= n) {
t = n + j;
a = m;
b = n - j;
... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, ... | 1 | 283 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
ll f(ll a, ll b) {
if (a == 0) {
return b;
}
if (a == 1) {
return (b + 1) * a;
}
return 2 * (b / a) * a + f(b % a, a);
}
int main() {
ll n, x;
cin >> n >> x;
ll a = x, b = n - x;
if (a > b) {
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
ll f(ll a, ll b) {
if (a == 0) {
return -b;
}
if (a == 1) {
return 2 * b * a + f(0, 1);
}
return 2 * (b / a) * a + f(b % a, a);
}
int main() {
ll n, x;
cin >> n >> x;
ll a = x, b = n - x;
if (a > ... | [["+", 0, 57, 64, 9, 0, 37, 0, 91, 17, 33], ["-", 64, 9, 0, 37, 0, 16, 31, 23, 0, 24], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 64, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 64, 9, 0, 37, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 37, 0, 16, 12, 2, 63, 22], ["+", 0, 37,... | 1 | 135 |
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long int64;
inline int64 read(int64 f = 1, int x = 0, char ch = ' ') {
while (!isdigit(ch = getchar()))
if (ch == '-')
f = -1;
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
retu... | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long int64;
inline int64 read(int64 f = 1, int64 x = 0, char ch = ' ') {
while (!isdigit(ch = getchar()))
if (ch == '-')
f = -1;
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
re... | [["-", 0, 14, 49, 53, 54, 55, 0, 356, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 356, 39, 78], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 12, 23, 0, 16, 12, 2, 63, 22], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 12, 23, ... | 1 | 136 |
#include <bits/stdc++.h>
#define res register ll
#define ll long long
using namespace std;
ll n, x, ans;
inline ll read() {
ll X = 0, w = 0;
char ch = 0;
while (!isdigit(ch)) {
w |= ch == '-';
ch = getchar();
}
while (isdigit(ch))
X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
return w ? -... | #include <bits/stdc++.h>
#define res register ll
#define ll long long
using namespace std;
ll n, x, ans;
inline ll read() {
ll X = 0, w = 0;
char ch = 0;
while (!isdigit(ch)) {
w |= ch == '-';
ch = getchar();
}
while (isdigit(ch))
X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
return w ? -... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 151], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 12, 16,... | 1 | 218 |
#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP \
fprintf(stderr, "Execution time: %.3lf s.\n", ... | #include <bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP \
fprintf(stderr, "Execution time: %.3lf s.\n", ... | [["+", 0, 57, 64, 37, 0, 16, 31, 16, 17, 33], ["+", 0, 57, 64, 37, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 17, 33], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 12, 22], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 37, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 0, ... | 1 | 269 |
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll N, X;
cin >> N >> X;
ll ans = N;
N -= X;
while (true) {
if (N < X)
swap(N, X);
if (N == X) {
ans += X;
break;
}
if (N % ... | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll N, X;
cin >> N >> X;
ll ans = N;
N -= X;
while (true) {
if (N < X)
swap(N, X);
if (N % X == 0) {
ans += (2 * N / X - 1) * X;
bre... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 8, 9, 0, 57,... | 1 | 127 |
#pragma comment(linker, "/STACK:66777216")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = ... | #pragma comment(linker, "/STACK:66777216")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = ... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 31, 13], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 31, 13], ["-", 0, 57, 64, 37, 0, 16, 31, 16, 31, 13], ["+", 0, 57, 64, 37, 0, 16, 31, 16, 31, 13], ["-", 12, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", ... | 1 | 250 |
#ifdef CLION
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#define int long long
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define int ll
template <ty... | #ifdef CLION
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#define int long long
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define int ll
template <ty... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25]] | 1 | 253 |
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define int long long int
using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e1... | #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define int long long int
using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e1... | [["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 16, 31, 16, 31, 22], ["+", 12, 23, 0, 16, 31, 16, 31, 16, 17, 85], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 48], ["+", 12... | 1 | 189 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#incl... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#incl... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 3... | 1 | 1,923 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF_LL 1e18
#define INF 1e9
#define REP(i, n) for (int i =... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF_LL 1e18
#define INF 1e9
#define REP(i, n) for (int i =... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 14, 8,... | 1 | 358 |
#include <bits/stdc++.h>
typedef long long ll;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define clr(a, h) memset(a, (h), sizeof(a))
#define fore(i, b, e) for (int i = b; i < e; i++)
#define forr(i, b... | #include <bits/stdc++.h>
typedef long long ll;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define clr(a, h) memset(a, (h), sizeof(a))
#define fore(i, b, e) for (int i = b; i < e; i++)
#define forr(i, b... | [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 15, 339, 51, 16, 12, 16, 31, 23, 0, 24], ["-", 51, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 51, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-",... | 1 | 381 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL solve(LL a, LL b) {
if (a == b || a == 0)
return 0;
if (a * 2 == b)
return 2 * a;
if (a * 2 < b)
return b + solve(b - a - a, b - a);
LL d = b - a;
return 2 * a / d * d + solve(a - a / d * d, b - a / d * d);
}
int main() {
ios... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL solve(LL a, LL b) {
if (a == b || a == 0)
return 0;
if (a * 2 <= b)
return b + solve(b - a - a, b - a);
LL d = b - a;
return a / d * 2 * d + solve(a - a / d * d, b - a / d * d);
}
int main() {
ios_base::sync_with_stdio(false);
ci... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 31, 13], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 17, 48], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 12, 22], ["-", 0, 14, 8,... | 1 | 153 |
/*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <tuple>
#include <unordered_map>
#inc... | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <tuple>
#include <unordered_map>
#inc... | [["-", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-",... | 1 | 471 |
#include <stdio.h>
int main(void) {
int N, X;
scanf("%d%d", &N, &X);
if (X > N / 2) {
X = N - X;
}
int sum = 0;
int k;
sum += X + N - X;
N = N - X;
while (X != 0) {
sum += 2 * X * (N / X);
k = N % X;
N = X;
X = k;
}
sum -= N;
printf("%d", sum);
} | #include <stdio.h>
int main(void) {
long long N, X;
scanf("%lld%lld", &N, &X);
if (X > N / 2) {
X = N - X;
}
long long sum = 0;
long long k;
sum += X + N - X;
N = N - X;
while (X != 0) {
sum += 2 * X * (N / X);
k = N % X;
N = X;
X = k;
}
sum -= N;
printf("%lld", sum);
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 112 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll ans(ll n, ll x) {
if (x == 0)
return 0;
return ans(x, n % x) + n / x * x * 2;
}
ll x, n;
int main() {
scanf("%lld%lld", &n, &x);
if (n < x + x)
x = n - x;
printf("%lld\n", ans(n, x));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll ans(ll n, ll x) { return x ? (ans(x, n % x) + n / x * x * 2) : -n; }
ll x, n;
int main() {
scanf("%lld%lld", &n, &x);
if (n < x + x)
x = n - x;
printf("%lld\n", n + ans(n - x, x));
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["-", 0, 14, 8... | 1 | 103 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int(i) = (a); (i) < (int)(n); (i)++)
#define foreach(c, itr) \
for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define SZ(x) ((int)(x).size())
typedef long long ll;
l... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int(i) = (a); (i) < (int)(n); (i)++)
#define foreach(c, itr) \
for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define SZ(x) ((int)(x).size())
typedef long long ll;
l... | [["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 37, 0, 41, 15, 22], ["+", 8, 9, 0, 57, 64, 37, 0, 41, 0, 101], ["+", 0, 57, 64, 37, 0, 41, 64, 91, 17, 33], ["+", 0, 57, 64, 37, 0, 41, 64, 91, 28, 22], ["+", 8, 9, 0, 57, 64, 37, 0, 41, 0, 102], ["+", 0, 57, 64, 37, 0, 41, 75, 91, 17, 33], ["+", 0, 57, ... | 1 | 123 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, x;
ll Get(ll x, ll y) {
if (x < y)
return y + Get(y, x);
if (y == 0)
return 0;
ll d = x / y;
ll md = x % y;
return 2ll * d * y - md + Get(y, md);
}
int main() {
cin >> n >> x;
printf("%lld\n", x + Get(x, n - x));
retur... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, x;
ll Get(ll x, ll y) {
if (x < y)
return Get(y, x);
if (y == 0)
return 0;
ll d = x / y;
return 3ll * d * y + Get(y, x % y);
}
int main() {
cin >> n >> x;
printf("%lld\n", Get(x, n - x));
return 0;
}
| [["-", 8, 9, 0, 57, 64, 37, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 17, 72], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["-", 8, 9, 0, 43... | 1 | 116 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
long long int n, x, s, t, tt;
cin >> n >> x;
s = n;
t = n - x;
while (t >= x && x > 0) {
s += 2 * (t / x) * x;
tt = t % ... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
long long int n, x, s, t, tt;
cin >> n >> x;
s = n;
if (n < 2 * x) {
x = n - x;
}
t = n - x;
while (t >= x && x > 0) {
... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+... | 1 | 104 |
#include <stdio.h>
#include <stdlib.h>
typedef struct hoge {
int y;
int x;
int res;
} hoge;
int main() {
int n;
int len;
int swap;
hoge a;
scanf("%d %d", &n, &a.x);
a.y = n - a.x;
a.res = a.x + a.y;
while (a.x) {
swap = a.y;
len = a.y / a.x;
a.res += len * a.x * 2;
a.y = a.x;
... | #include <stdio.h>
#include <stdlib.h>
typedef struct hoge {
long long int y;
long long int x;
long long int res;
} hoge;
int main() {
long long int n;
long long int len;
long long int swap;
hoge a;
scanf("%lld %lld", &n, &a.x);
a.y = n - a.x;
a.res = a.x + a.y;
while (a.x) {
swap = a.y;
... | [["+", 39, 122, 8, 123, 0, 124, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 152 |
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
long int N, X;
cin >> N >> X;
if (X == 0 || X == N) {
cout << N << endl;
return 0;
}
long int ans = N;
N = N - X;
while (N % X != 0) {
int next = N % X;
ans += (N - next) * 2;
N = X;
X = next;
}
ans +=... | #include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
long int N, X;
cin >> N >> X;
long int ans = N;
N = N - X;
while (N % X != 0) {
long int next = N % X;
ans += (N - next) * 2;
N = X;
X = next;
}
ans += (N * 2 - X);
cout << ans << endl;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ... | 1 | 119 |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <typeinfo>
#include <vector>
#define syosu(x) fixed << setprecision(x)
using namespace std;
using namespace std;
typedef long lon... | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <typeinfo>
#include <vector>
#define syosu(x) fixed << setprecision(x)
using namespace std;
using namespace std;
typedef long lon... | [["-", 31, 23, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 31, 23, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 48], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 31, 13], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 17, 48], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 48]... | 1 | 287 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll n, ll x) {
ll ret, r;
if (n - x >= x) {
ret = n + 2 * ((n - x) / x) * x;
r = (n - x) % x;
if (r)
ret += f(x, x - (n - x) % x);
else
ret -= x;
} else {
return f(n, n - x);
}
return ret;
}
int main() {
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll n, ll x) {
ll ret, r;
if (n - x >= x) {
ret = n + 2 * ((n - x) / x) * x;
r = (n - x) % x;
if (r)
ret += f(x, r) - (x - r) + r;
else
ret -= x;
} else {
return f(n, n - x);
}
return ret;
}
int main() {
... | [["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 12, 16, 31, 16, 31, 2, 3, 4, 0, 22], ["+", 12, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 3, 4, 0, 16, 12, 16, 31, 23, 0, 25], ["-", 12, 2, ... | 1 | 137 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
long long ans = 0;
int gcd(int a, int b) {
if (b == 0) {
a... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long int LL;
LL ans = 0;
int gcd(LL a, LL b) {
if... | [["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 157], ["+", 36, 36, 0, 30, 0, 134, 39, 86, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], [... | 1 | 192 |
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include ... | #include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 43,... | 1 | 3,021 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#d... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define repl(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#d... | [["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20... | 1 | 200 |
#include <cstdio>
using namespace std;
int main() {
int N, X;
scanf("%d %d", &N, &X);
int ans = N;
int l_side = N - X;
int s_side = X;
while (s_side > 0) {
int num = l_side / s_side;
int tmp_s_side = s_side;
ans += (2 * num * s_side);
s_side = l_side % s_side;
l_side = tmp_s_side;
... | #include <cstdio>
using namespace std;
typedef long long ll;
int main() {
ll N, X;
scanf("%lld %lld", &N, &X);
ll ans = N;
ll l_side = N - X;
ll s_side = X;
while (s_side > 0) {
ll num = l_side / s_side;
ll tmp_s_side = s_side;
ans += (2 * num * s_side);
s_side = l_side % s_side;
... | [["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 157], ["+", 36, 36, 0, 30, 0, 134, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2... | 1 | 110 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll A, ll B) {
if (A == 0 || B == 0)
return 0;
ll ret;
if (A < B) {
ret = 2 * A * (B / A) + f(A, B % A);
} else {
ret = 2 * B * (A / B) + f(A % B, B);
}
return ret;
}
int main(void) {
ll N, X;
cin >> N >> X;
ll an... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll A, ll B) {
if (A == 0 || B == 0)
return 0;
ll ret = 0;
if (A < B) {
ret = 2 * A * (B / A) + f(A, B % A);
} else {
ret = 2 * B * (A / B) + f(A % B, B);
}
return ret;
}
int main(void) {
ll N, X;
cin >> N >> X;
l... | [["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 12, 2, 63, 22], ["+", 49, 50, 51, 16, 12, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 16, 12, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 16, 12, 2, 3, 4, 0, 21], ["+", 49, 50, 51... | 1 | 137 |
#include <algorithm>
#include <cstdio>
using namespace std;
int solve(int a, int b) {
if (a > b)
swap(a, b);
if (b % a == 0) {
return 2 * b - a;
} else {
return 2 * (b / a) * a + solve(a, b % a);
}
}
int main() {
int n, x, ans = 0;
scanf("%d%d", &n, &x);
ans += n + solve(x, n - x);
printf... | #include <algorithm>
#include <cstdio>
using namespace std;
long long solve(long long a, long long b) {
if (a > b)
swap(a, b);
if (b % a == 0) {
return 2 * b - a;
} else {
return 2 * (b / a) * a + solve(a, b % a);
}
}
int main() {
long long n, x, ans = 0;
scanf("%lld%lld", &n, &x);
ans += n... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3... | 1 | 126 |
#include <algorithm>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <sstream>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0,... | #include <algorithm>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <sstream>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0,... | [["-", 0, 37, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 0, 37, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 64, 9, 0, 37, 0, 16, 31, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 2, 3, 4, 0, 22], ["+", 0, 37, 0, 16, 31, 2, 3, 4, 0, 21], ["-", 31, 16, 31, 16, 12, 23, 0, 16, 17, 85], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 109], ["-", 64, 9, 0,... | 1 | 241 |
def f(a, b):
a, b = min(a, b), max(a, b)
return (b // a) * 2 * a + f(a, b % a) if a > 0 else 0
n, x = map(int, input().split())
print(f(x, n)) | def f(a, b):
a, b = min(a, b), max(a, b)
return (b // a) * 2 * a + (f(a, b % a) if b % a > 0 else -a)
n, x = map(int, input().split())
print(f(x, n - x) + n) | [["+", 8, 196, 0, 37, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 41, 0, 666, 0, 657, 31, 22], ["+", 12, 23, 0, 41, 0, 666, 0, 657, 17, 109], ["-", 0, 14, 8, 196, 0, 37, 0, 41, 0, 612], ["+", 0, 657, 12, 23, 0, 41, 0, 664, 17, 33], ["+", 0, 657, 12, 23, 0, 41, 0, 664, 28, 22], ["+", 8, 196, 0, 37, 0, 657, 12, 23, 0, 25], ... | 5 | 75 |
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N, X;
cin >> N >> X;
long long int A = N;
N -= X;
while (true) {
if (N > X)
swap(N, X);
if (X % N == 0) {
A += (2 * (X / N) * N - N);
break;
}
... | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
int main() {
long long int N, X;
// cin >> N >> X;
scanf("%lld%lld", &N, &X);
long long int A = N;
N -= X;
while (true) {
if (N > X)
swap(N, X);
if (X % N == 0) {
A += (2... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], [... | 1 | 116 |
#pragma comment(linker, "/STACK:102c000000,102c000000")
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// #include <conio.h>
using na... | #pragma comment(linker, "/STACK:102c000000,102c000000")
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// #include <conio.h>
using na... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", ... | 1 | 184 |
#pragma comment(linker, "/STACK:102c000000,102c000000")
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// #include <conio.h>
using na... | #pragma comment(linker, "/STACK:102c000000,102c000000")
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
// #include <conio.h>
using na... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 152], ["+... | 1 | 190 |
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctype.h>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#includ... | #include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctype.h>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#includ... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 163 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, y) for (int i = (x); i < (y); ++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif
typedef long long int ll;
typedef pair<... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, x, y) for (int i = (x); i < (y); ++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif
typedef long long int ll;
typedef pair<... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 37, 0, 16, 31, 22], [... | 1 | 317 |
#define _USE_MATH_DEFINE
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef vector<... | #define _USE_MATH_DEFINE
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef vector<... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["-", 12... | 1 | 163 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
using ull = unsigned long long;
ull f(ull a, ull b) {
if (a == b) {
return a;
}
return 2 * a + f(min(a, b - a), max(a, b - a));
}
int main() {
ull N, X;
cin >> N >> X;
ull ans = N + f(min(X, N - X), max... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
using ull = unsigned long long;
/*
ull f(ull a, ull b) {
if (a == b) {
return a;
}
return 2 * a + f(min(a, b - a), max(a, b- a));
}
*/
ull f(ull a, ull b) {
if (b % a == 0) {
... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 37, 0, 16, 31, 16, 31, 13], ["+", 64, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 64, 9, 0, 37, 0, 16, 31, 16, 12, 22], ["... | 1 | 119 |
//
/*
ID: kfoozmi1
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef kfoozminus
#define dbg(args...) \
do { \
cerr << #args << " : "; ... | //
/*
ID: kfoozmi1
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef kfoozminus
#define dbg(args...) \
do { \
cerr << #args << " : "; ... | [["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 130], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 9, 0, 1, 0, 11, ... | 1 | 646 |
#include <iostream>
using namespace std;
#define DBG(x) cout << #x << ": " << x << "\n";
#define EOL "\n"
int main(void) {
int n, x;
cin >> n >> x;
int len = 0;
len += x + (n - x);
int a, b;
a = x;
b = n - x;
if (a > b)
swap(a, b); // b > a
while (true) {
if (b % a == 0) {
len += (2 ... | #include <iostream>
using namespace std;
typedef long long LL;
#define DBG(x) cout << #x << ": " << x << "\n";
#define EOL "\n"
int main(void) {
LL n, x;
cin >> n >> x;
LL len = 0;
len += x + (n - x);
LL a, b;
a = x;
b = n - x;
if (a > b)
swap(a, b); // b > a
while (true) {
if (b % a == 0)... | [["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 157], ["+", 36, 36, 0, 30, 0, 134, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, ... | 1 | 148 |
import sys
sys.setrecursionlimit(1500)
def f(x, y):
if x == 0:
return 0
if x == y:
return x
return 2 * (y // x) * x + f(y % x, x)
N, X = list(map(int, input().split()))
print(f(X, N-X) + N)
| import sys
sys.setrecursionlimit(1500)
def f(x, y):
if x == 0:
return 0
if y % x == 0:
return 2 * (y // x) * x - x
return 2 * (y // x) * x + f(y % x, x)
N, X = list(map(int, input().split()))
print(f(X, N-X) + N)
| [["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 37, 0, 657, 31, 657, 31, 657, 31, 612], ["+", 0, 37, 0, 657, 31, 657, 31, 657, 17, 48], ["+", 0, 657, 31, 657, 31, 657, 12, ... | 5 | 81 |
#include <bits/stdc++.h>
using namespace std;
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
#define DEBUG(x) cerr << #x << " = " <... | #include <bits/stdc++.h>
using namespace std;
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
#define DEBUG(x) cerr << #x << " = " <... | [["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 31, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 31, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["-", 31, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["-", 0, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 5... | 1 | 376 |
#include <stdio.h>
#define max(a, b) a > b ? a : b
#define min(a, b) a < b ? a : b
long long int ans, n, x;
long long int f();
int main(void) {
scanf("%lld%lld", &n, &x);
ans += n;
ans += f(min(x, n - x), max(x, n - x));
printf("%lld\n", ans);
return 0;
}
long long int f(a, b) long long int a, b;
{
i... | #include <stdio.h>
#define min(a, b) a < b ? a : b
#define max(a, b) a > b ? a : b
long long int ans, n, x;
long long int f();
int main(void) {
scanf("%lld%lld", &n, &x);
ans += n;
ans += f(min(x, n - x), max(x, n - x));
printf("%lld\n", ans);
return 0;
}
long long int f(a, b) long long int a, b;
{
l... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 0 | 163 |
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#incl... | #include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#incl... | [["-", 15, 339, 51, 16, 31, 2, 63, 343, 345, 348], ["-", 15, 339, 51, 16, 31, 2, 63, 343, 0, 349], ["-", 15, 339, 51, 16, 31, 2, 63, 343, 141, 22], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 48], ["-", 31, 2, 3, 4, 0, 16, 31, 16, 17, 85... | 1 | 457 |
/*
No not today :3
*/
#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define mod 1000000007
#define ll_inf 1000000000000000
#define int_inf 1000000000
#define mp make_pair
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define eps 1e-9
#define PI acos(-1.0)
using namespace std;
ll gcd(ll... | /*
No not today :3
*/
#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define mod 1000000007
#define ll_inf 1000000000000000
#define int_inf 1000000000
#define mp make_pair
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define eps 1e-9
#define PI acos(-1.0)
using namespace std;
ll gcd(ll... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 3... | 1 | 291 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
int main() {
ll n, x;
cin >> n >> x;
ll ans = 0;
if (n == x * 2) {
ans = 3 * x;
} else {
bool f; // true: 上に上がる false:左に進む
ll a = x, b = n -... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
int main() {
ll n, x;
cin >> n >> x;
ll ans = 0;
if (n == x * 2) {
ans = 3 * x;
} else {
bool f; // true: 上に上がる false:左に進む
ll a = x, b = n -... | [["-", 0, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 8, 9, 0, ... | 1 | 205 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
int main() {
ll n, x;
cin >> n >> x;
ll ans = 0;
if (n == x * 2) {
ans = 3 * x;
} else {
bool f; // true: 上に上がる false:左に進む
ll a = x, b = n -... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
int main() {
ll n, x;
cin >> n >> x;
ll ans = 0;
if (n == x * 2) {
ans = 3 * x;
} else {
bool f; // true: 上に上がる false:左に進む
ll a = x, b = n -... | [["-", 75, 76, 0, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 51, 22], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["-", 64, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["-", 64, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["-", 0, 57, 64... | 1 | 205 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int N = stdIn.nextInt();
int X = stdIn.nextInt();
int ans = N;
if (N - X < X) {
ans += square(N - X, X);
} else {
ans += square(X, N - X);
}
System.ou... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
long N = stdIn.nextLong();
long X = stdIn.nextLong();
long ans = N;
if (N - X < X) {
ans += square(N - X, X);
} else {
ans += square(X, N - X);
}
Syst... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["-", 0, 235, 8, 498, 0, 195, 39, 506, 0, 507], ["+", 0, 235, 8, 498, 0, 195, 39, 506, 0, 96], ["-", 0, 195, 54, 495, 0, 496... | 3 | 167 |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define pf push_front
#define pb push_back
#define FST ... | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define pf push_front
#define pb push_back
#define FST ... | [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["-", 31, ... | 1 | 195 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INF 1000000000
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
long N;
long X;
long ans = 0;
void solve(long n, long x, int f) {
long d = n / x;
long m = n % x;
// printf("* %ld, %ld: "... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INF 1000000000
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
long N;
long X;
long ans = 0;
void solve(long n, long x, int f) {
long d = n / x;
long m = n % x;
if (m > 0) {
ans += ... | [["-", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["-", 0, 57, 64, 9, 0, 57, 15, 23, 0, 24], ["-", 0, 57, 64, 9, 0, 57, 15, 23, 0, 22], ["-", 0, 57, 64, 9, 0, 57, 15, 23, 0, 25], ["-", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 57, ... | 0 | 234 |
#include <iostream>
using namespace std;
int main() {
long long n, x;
cin >> n >> x;
long long ans = 0;
if (2 * x == n) {
ans = 3 * x;
} else {
ans = x + n - x + x + x;
long long d = n - 2 * x;
long long l = x;
while (true) {
long long cnt = l / d;
ans += cnt * 2 * d;
i... | #include <iostream>
using namespace std;
int main() {
long long n, x;
cin >> n >> x;
long long ans = 0;
if (2 * x == n) {
ans = 3 * x;
} else {
ans = n;
long long d = x;
long long l = n - x;
while (true) {
long long cnt = l / d;
ans += cnt * 2 * d;
if (l % d == 0) {
... | [["-", 12, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 12, 16, 31, 16, 31, 16, 31, 16, 17, 72], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 17, 33], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-... | 1 | 137 |
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) \
for (__typeof(a.begin()... | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) \
for (__typeof(a.begin()... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72], ["-", 51, 16, 31, 23, 0, 16, 12, 16, 31, 13], ["-", 51, 16, 31, 23, 0, 16, 12, 16, 17, 48], ["-", 51, 16, 31, 23, 0, 16, 12, 16, 12, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["... | 1 | 90 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <ut... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <ut... | [["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14,... | 1 | 120 |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <ss... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <ss... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96]] | 1 | 365 |
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
long long solve(int N, int X) {
if (N % X == 0) {
return X * 3 * (N / X - 1);
}
long long ans = 0;
ans += X ... | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
long long solve(long long int N, long long int X) {
if (N % X == 0) {
return X * 3 * (N / X - 1);
}
long long ... | [["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 158 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int main() {
ll n, a, sum = 0;
cin >> n >> a;
ll p = min(a, n - a), q = max(a, n - a);
sum += q;
bool flag = fal... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int main() {
ll n, a, sum = 0, cnt = 0;
cin >> n >> a;
ll p = min(a, n - a), q = max(a, n - a);
sum += q;
bool f... | [["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 52, 8, 9, 0, 5... | 1 | 177 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i, a, b)... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) \
for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i, a, b)... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 17, 72], ["-", 49, 50, 51, 16, 12, 23, ... | 1 | 300 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
long long n, x;
cin >> n >> x;
long long a = x;
long long b = n - x;
long long ans = a + b;
while (1) {
if (a > b) {
swap(b, a);
}
ans +=... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
long long n, x;
cin >> n >> x;
long long a = x;
long long b = n - x;
long long ans = a + b;
while (1) {
if (a > b) {
swap(b, a);
}
ans +=... | [["-", 12, 23, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 12, 23, 0, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 48], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+",... | 1 | 128 |
// Daniel Grzegorzewski
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;
void init_ios() {
ios_base::sync_with_stdio(0)... | // Daniel Grzegorzewski
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;
void init_ios() {
ios_base::sync_with_stdio(0)... | [["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+"... | 1 | 330 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std... | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std... | [["-", 0, 57, 75, 76, 0, 37, 0, 16, 31, 22], ["+", 0, 57, 75, 76, 0, 37, 0, 16, 31, 22], ["+", 75, 76, 0, 37, 0, 16, 12, 16, 31, 22], ["+", 75, 76, 0, 37, 0, 16, 12, 16, 17, 48], ["+", 0, 37, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 17, 85], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+",... | 1 | 142 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++i)
using namespace std;
ll n, x, ans;
void solve(ll a, ll b) {
ll tmp = 2LL * (a / b);
ans += tmp * b;
if (a % b... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++i)
using namespace std;
ll n, x, ans;
void solve(ll a, ll b) {
if (a < b)
return solve(b, a);
ll tmp = 2LL * (... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["+", 8, 9, 0,... | 1 | 152 |
#include <bits/stdc++.h>
#define FOR(type, i, a, b) for (type i = (a); i < (b); ++i)
#define RFOR(type, i, a, b) for (type i = (b)-1; i >= (a); --i)
#define REP(type, i, n) for (type i = 0; i < (n); ++i)
#define RREP(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define MIN(a, b) ... | #include <bits/stdc++.h>
#define FOR(type, i, a, b) for (type i = (a); i < (b); ++i)
#define RFOR(type, i, a, b) for (type i = (b)-1; i >= (a); --i)
#define REP(type, i, n) for (type i = 0; i < (n); ++i)
#define RREP(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define MIN(a, b) ... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 35], ["+", 0, 57, 64, 37, 0, 16, 12, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 35], ["+", 0, 30,... | 1 | 227 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define MS(m, v) memset(m, v, sizeof(m))
#define D10 fixed << setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> v... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define MS(m, v) memset(m, v, sizeof(m))
#define D10 fixed << setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> v... | [["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51,... | 1 | 253 |
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl
int main() {
l... | #include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl
int main() {
l... | [["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 75, 76, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 64, 9... | 1 | 145 |
#include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i != n; i++)
using namespace std;
pair<int, int> add(int l, int s) {
int q = l / s;
int r = l % s;
if (r == 0)
return make_pair((2 * q - 1) * s... | #include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i != n; i++)
using namespace std;
pair<long long, long long> add(long long l, long long s) {
long long q = l / s;
long long r = l % s;
if (r == 0)
... | [["-", 0, 14, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]] | 1 | 193 |
# #include <stdio.h>
# #include <string.h>
# #include <stdlib.h>
# typedef unsigned long long ull;
# typedef signed long long sll;
# int comp (const void *x, const void *y) {
# return *(int*)x - *(int*)y;
# }
# int min (int x, int y) {
# return (x < y) ? x : y;
# }
# int solve (ull x, ull y) {
# printf("%llu ... | # #include <stdio.h>
# #include <string.h>
# #include <stdlib.h>
# typedef unsigned long long ull;
# typedef signed long long sll;
# int comp (const void *x, const void *y) {
# return *(int*)x - *(int*)y;
# }
# int min (int x, int y) {
# return (x < y) ? x : y;
# }
# int solve (ull x, ull y) {
# printf("%llu ... | [["-", 0, 121, 75, 759, 75, 95, 0, 662, 31, 22], ["-", 0, 121, 75, 759, 75, 95, 0, 662, 0, 32], ["-", 75, 759, 75, 95, 0, 662, 12, 738, 31, 22], ["-", 75, 759, 75, 95, 0, 662, 12, 738, 17, 85], ["-", 75, 759, 75, 95, 0, 662, 12, 738, 12, 22], ["-", 75, 95, 0, 738, 31, 738, 31, 738, 31, 22], ["-", 75, 95, 0, 738, 31, 73... | 4 | 147 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+... | 1 | 190 |
#include <bits/stdc++.h>
#define INF 2000000010
#define mod7 1000000007
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define INF_LL 9223372036854775
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double
using nam... | #include <bits/stdc++.h>
#define INF 2000000010
#define mod7 1000000007
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define INF_LL 9223372036854775
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double
using nam... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 1, 0,... | 1 | 157 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for ((i) ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for ((i) ... | [["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 144 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define REMOVE(Itr, n) ... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define REMOVE(Itr, n) ... | [["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["+", 0, 14, 8... | 1 | 172 |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, a, n) for (int i ... | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, a, n) for (int i ... | [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["... | 1 | 356 |
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i, 1, n)
#define REP(i, n) FOR(i, 0, (int)(n)-1)
#define R(i, n) REP(i, n)
#define VI vector<int>
#define PII pair<int, ... | #include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i, 1, n)
#define REP(i, n) FOR(i, 0, (int)(n)-1)
#define R(i, n) REP(i, n)
#define VI vector<int>
#define PII pair<int, ... | [["-", 8, 9, 0, 57, 64, 37, 0, 16, 31, 13], ["-", 8, 9, 0, 57, 64, 37, 0, 16, 17, 48], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["-", 8, 9, 0, 37, 0, 16, 31, 16, 31, 13], ["-", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 0, 30, 0, ... | 1 | 429 |
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define iter(c) __typeof((c).begin())
#define tr(it, c) for (iter(c) it = (c).begin()... | #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define iter(c) __typeof((c).begin())
#define tr(it, c) for (iter(c) it = (c).begin()... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 1... | 1 | 371 |
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | #include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include ... | [["+", 0, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 0, 37, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 17, 85], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 37, 0, 16, 31, 16, 12, 23, 0, 25], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16... | 1 | 325 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
int x;
cin >> n;
cin >> x;
int sum = n;
int temp1;
int lg = x;
int sm = n - x;
if (sm > lg) {
temp1 = sm;
sm = lg;
lg = temp1;
}
while (true) {
if (lg == sm) {
sum = sum + x;
break;
}
i... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
long long n;
long long x;
cin >> n;
cin >> x;
long long sum = n;
long long temp1;
long long lg = x;
long long sm = n - x;
if (sm > lg) {
temp1 = sm;
sm = lg;
lg = temp1;
}
while (true) {
if (lg == sm) {
sum... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 157 |
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef unsigned long long ULL;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ULL n, x;
cin >> n >> x;
ULL res = n, y = n - x;
if (x > y)
swap(x, y);
while (x != 0 && y != 0) {
... |
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef unsigned long long ULL;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ULL n, x;
cin >> n >> x;
ULL res = n, y = n - x;
if (x > y)
swap(x, y);
while (x != 0 && y != 0) {
... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, ... | 1 | 123 |
#include <bits/stdc++.h>
using namespace std;
#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x, arr) for (auto &&x : arr)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep2(i, n) _rep3(i, 0, n)
#define _rep3(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, _rep3... | #include <bits/stdc++.h>
using namespace std;
#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x, arr) for (auto &&x : arr)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep2(i, n) _rep3(i, 0, n)
#define _rep3(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, _rep3... | [["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0... | 1 | 337 |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <forward_list>
#include <functional>
#include <initiali... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <forward_list>
#include <functional>
#include <initiali... | [["-", 31, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 31, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 31, 16, 31, 16, 31, 16, 12, 103, 0, 104], ["-", 31, 16, 31, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 31, 16, 31, 1... | 1 | 246 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll n, x;
cin >> n >> x;
ll ret = n; //最初の2本
ll a = x, b = n - x;
if (a > b)
swap(a, b);
while (true) {
if (b % a == 0) {
cout << ret + 1.5 * b << endl;
return 0;
} else ... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
ll n, x;
cin >> n >> x;
ll ret = n; //最初の2本
ll a = x, b = n - x;
if (a > b)
swap(a, b);
while (true) {
if (b % a == 0) {
ll l = b / a;
cout << ret + 2 * a * l - a << endl;
... | [["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 78], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 0, 35], ["-", 0, 16, 3... | 1 | 123 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include... | [["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 51, 22], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 3... | 1 | 421 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
long long ans = 0;
void dfs(long long a, long long b) {
if (b > a)
dfs(b,... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
long long ans = 0;
void dfs(long long a, long long b) {
if (b > a)
dfs(b,... | [["+", 0, 57, 64, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 16, 12, 23, 0, 24], ["+", 51, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 0, ... | 1 | 129 |
// Template {{{
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long LL;
#ifdef LOCAL
#include "contest.h"
#else
#define dump(x)
#endif
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x... | // Template {{{
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long LL;
#ifdef LOCAL
#include "contest.h"
#else
#define dump(x)
#endif
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x... | [["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+... | 1 | 215 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.