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
#define MAX 100005
#define ll long long
#define slld(t) scanf("%lld", &t)
#define sd(t) scanf("%d", &t)
#define pd(t) printf("%d\n", t)
#define plld(t) printf("%lld\n", t)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define tr(container, it) ... | #include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 100005
#define ll long long
#define slld(t) scanf("%lld", &t)
#define sd(t) scanf("%d", &t)
#define pd(t) printf("%d\n", t)
#define plld(t) printf("%lld\n", t)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define tr(container, it) ... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 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, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 64... | 1 | 191 |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pi... | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pi... | [["-", 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 | 288 |
#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long f(long long n, long long x) {
if (n % x == 0)
return (n << 1) - x;
return 2 * ((n - x) / x) * x + f(x, n % x);
}
int main() {
cin >> a >> b;
cout << f(a, b) + a << endl;
} | #include <bits/stdc++.h>
using namespace std;
long long a, b;
long long f(long long n, long long x) {
if (n % x == 0)
return (n << 1) - x;
return 2 * (n / x) * x + f(x, n % x);
}
int main() {
cin >> a >> b;
cout << f(b, a - b) + a << endl;
} | [["-", 31, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["-", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 12, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["-", 31, 16, 12, 23, 0, 16, 31, 23, 0, 25], ["-", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["+", 12, ... | 1 | 92 |
#include <iostream>
using namespace std;
long long int n, x, cvp;
pair<long long int, long long int> paralel;
int main() {
cin >> n >> x;
cvp = n;
paralel = make_pair(max(n - x, x), min(n - x, x));
while (paralel.second != paralel.first && paralel.second != 0) {
cvp += 2 * (paralel.first / paralel.second)... | #include <iostream>
using namespace std;
long long int n, x, cvp;
pair<long long int, long long int> paralel;
int main() {
cin >> n >> x;
cvp = n;
paralel = make_pair(max(n - x, x), min(n - x, x));
while (paralel.second != paralel.first && paralel.second != 0) {
cvp += 2 * (paralel.first / paralel.second)... | [["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 16, 31, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 15, 339, 51, 16, 31, 16, 12, 11... | 1 | 198 |
#include <bits/stdc++.h>
using namespace std;
#define FS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long ... | #include <bits/stdc++.h>
using namespace std;
#define FS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long ... | [["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72], ["-", 49, 50, 51, 16, 31, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 49, 50, 51, 16, 31, 16, 12, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 51, 16, 12, 23, 0, 16, 12, 2, 63, 22], ... | 1 | 1,324 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll ans = 0;
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else {
ans += b * (a / b);
return gcd(b, a % b);
... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll ans = 0;
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else {
ans += b * 2 * (a / b);
return gcd(b, a % b... | [["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1,... | 1 | 126 |
/* おまじない */
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD = pow(10, 9) + 7;
const ll INF = (1LL << 62);
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int ddx[8] = {1, 0, -1, -1, -1, 0, 1, 1};
const int ddy... | /* おまじない */
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD = pow(10, 9) + 7;
const ll INF = (1LL << 62);
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int ddx[8] = {1, 0, -1, -1, -1, 0, 1, 1};
const int ddy... | [["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 30, 0... | 1 | 247 |
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD =... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD =... | [["+", 64, 9, 0, 57, 64, 37, 0, 16, 31, 22], ["+", 64, 9, 0, 57, 64, 37, 0, 16, 17, 48], ["+", 0, 57, 64, 37, 0, 16, 12, 23, 0, 24], ["+", 0, 57, 64, 37, 0, 16, 12, 23, 0, 25]] | 1 | 201 |
#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__, __j__;
#define printLine(l) \
for (__i__ = 0; __i__ < l; __i__++) { \
cout << "-"; ... | #define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__, __j__;
#define printLine(l) \
for (__i__ = 0; __i__ < l; __i__++) { \
cout << "-"; ... | [["+", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 0, 37, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 31, 22], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16, 12, 23, 0, 16, 31, 23, 0, 25], ["+", 0... | 1 | 346 |
def run():
N, X = map(int, input().split())
y = N-X
ans = N
while True:
y, X = max(y, X), min(y, X)
a = y//X
ans += a*X*2
if y%X == 0:
break
y, X = X, a
print(ans-X)
if __name__ == '__main__':
run() | def run():
N, X = map(int, input().split())
y = N-X
ans = N
while True:
y, X = max(y, X), min(y, X)
a = y//X
b = y%X
ans += a*X*2
if b == 0:
break
y, X = X, b
print(ans-X)
if __name__ == '__main__':
run() | [["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109]... | 5 | 92 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = n; i <= (int)(m); i++)
#define RFOR(i, n, m) for (int i = (int)(n); i >= m; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#d... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = n; i <= (int)(m); i++)
#define RFOR(i, n, m) for (int i = (int)(n); i >= m; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#d... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 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... | 1 | 403 |
#include <bits/stdc++.h>
#pragma optimizer(O2)
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<LL, LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x) * (x))
#define pdd pair<double, d... | #include <bits/stdc++.h>
#pragma optimizer(O2)
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<LL, LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x) * (x))
#define pdd pair<double, d... | [["+", 0, 43, 49, 50, 51, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 12, 23, 0, 16, 31, 16, 31, 23, 0, 25], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 17, 72], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 12, 13], ["... | 1 | 195 |
/*
When you walk through a storm
Hold your head up high
And don't be afraid of the dark
At the end of the storm
There's a golden sky
And the sweet silver song
of the lark
Walk on, through the wind
Walk on, through the rain
Though your dreams be tossed
and blown
Walk on, walk on
With hope in your heart
And you'll never ... | /*
When you walk through a storm
Hold your head up high
And don't be afraid of the dark
At the end of the storm
There's a golden sky
And the sweet silver song
of the lark
Walk on, through the wind
Walk on, through the rain
Though your dreams be tossed
and blown
Walk on, walk on
With hope in your heart
And you'll never ... | [["-", 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 | 927 |
#include <bits/stdc++.h>
#define ll long long
#define X first
#define Y second
#define MP make_pair
#define ld long double
using namespace std;
const int N = 1e5 + 12;
const ll mod = 1e9 + 7;
int dp[N], a[N], n;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, x;
cin >> n >> x;
ll ... | #include <bits/stdc++.h>
#define ll long long
#define X first
#define Y second
#define MP make_pair
#define ld long double
using namespace std;
const int N = 1e5 + 12;
const ll mod = 1e9 + 7;
int dp[N], a[N], n;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, x;
cin >> n >> x;
ll ... | [["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72], ["-", 49, 50, 51, 16, 31, 16, 12, 16, 31, 13], ["-", 49, 50, 51, 16, 31, 16, 12, 16, 17, 48], ["-", 49, 50, 51, 16, 31, 16, 12, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 49, 50, 51, 16, 12, 16, 31, 23, 0, 2... | 1 | 109 |
#include <array>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;
ULL solve2(ULL a, ULL b, ULL c, ULL d, ULL e, ULL f) {
if (a == 0 || f == 0)
return 0;
if (b != 0)
return solve2(f, e, d, c, b, a);
if (c >... | #include <array>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;
ULL solve2(ULL a, ULL b, ULL c, ULL d, ULL e, ULL f) {
if (a == 0 || f == 0)
return 0;
if (c >= a) {
if (f > a) {
ULL t = min(c, f) / a... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 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], ["-", 8, 9, 0, 57, 64, 37, 0, 2, 63, 22], ["-", 0, 57, 64, 37, 0, 2, 3, 4, 0, 24], ["-", 0, 57, 64,... | 1 | 247 |
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for... | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for... | [["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 109], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 33], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["... | 1 | 309 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n, x, ans;
int main() {
cin >> n >> x;
ans = n;
LL a = x, b = n - x, t; // a存长边,b存短边
while (true) {
if (a < b)
swap(a, b);
// cout << a << " " << b << endl;
if (b == 0)
break;
ans += 2 * b * (a / b);
t =... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n, x, ans;
int main() {
cin >> n >> x;
ans = n;
LL a = x, b = n - x, t; // a存长边,b存短边
while (true) {
if (a < b)
swap(a, b);
// cout << a << " " << b << endl;
if (b == 0)
break;
ans += 2 * b * (a / b);
if (... | [["+", 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 | 111 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#define rep(x, a, b) for (int x = (a); x <= (b); ++x)
#define rop(x, a, b) for (int x = (a); x < (b); ++x)
#define per(x, a, b) for (int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
LL... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#define rep(x, a, b) for (int x = (a); x <= (b); ++x)
#define rop(x, a, b) for (int x = (a); x < (b); ++x)
#define per(x, a, b) for (int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
LL... | [["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 37, 0, 16, 31, 16, 12, 16, 17, 48], ["+", 0, 37, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 33], ["+", 8, 9, 0, 37, 0, 16, 12, 16, 31, 22], ["+", 0, 37, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12... | 1 | 147 |
#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>
using namespace __gnu_pbds;
#if !ONLINE_JUDGE
#define debug
#endif
using namespace std;
/******* All Required define Pre-Processors and typedef Constants *******/... | #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>
using namespace __gnu_pbds;
#if !ONLINE_JUDGE
#define debug
#endif
using namespace std;
/******* All Required define Pre-Processors and typedef Constants *******/... | [["+", 0, 11, 12, 16, 31, 16, 31, 23, 0, 24], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 17, 72], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 85], ["+", 0, 11, 12, 16, 31, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, ... | 1 | 779 |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
long long mod = 1000000000 + 7;
vector<vector<int>> g;
// int n,m;
vector<vector<int>> grid(501, vector<int>(501, INF));
vector<vector<int>> x(501, vector<int>(501, -1));
long long pow(long long a, long long b, long long ... | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
long long mod = 1000000000 + 7;
vector<vector<int>> g;
// int n,m;
vector<vector<int>> grid(501, vector<int>(501, INF));
vector<vector<int>> x(501, vector<int>(501, -1));
long long pow(long long a, long long b, long long ... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 16, 12, 23, 0, 16, 12, 2, 63, 22], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 12, 23, 0, 16, 12, 2, 3, 4, 0, 21], ["-", 12, ... | 1 | 256 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
ll ans = 0;
ll gcd(ll a, ll b) {
if (!b)
return ans;
ans += a / b * b * 2;
gcd(b, a % b);
}
int main() {
ll n, x;
cin >> n >> x;
cout << gcd(n, x);
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
ll ans = 0;
ll gcd(ll a, ll b) {
if (!b)
return ans = ans - a;
ans += a / b * b * 2;
gcd(b, a % b);
}
int main() {
ll n, x;
cin >> n >> x;
cout << gcd(n - x, x) + n;
} | [["+", 8, 9, 0, 57, 64, 37, 0, 11, 17, 32], ["+", 0, 57, 64, 37, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 37, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 37, 0, 11, 12, 16, 12, 22], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 72], ["+", 8, 9, 0... | 1 | 88 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.setf(ios::fixed);
cout.precision(20);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll n, x;
cin >> n... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.setf(ios::fixed);
cout.precision(20);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll n, x;
cin >> n... | [["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 13],... | 1 | 147 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repa(i, a, n) for (int i = (a); i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrepa(i, a, n) for (int i = (n)-1; i >= (a); i--)
#define all(a) (a).begin(), (a).end()
#define MOD 1000000007... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repa(i, a, n) for (int i = (a); i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrepa(i, a, n) for (int i = (n)-1; i >= (a); i--)
#define all(a) (a).begin(), (a).end()
#define MOD 1000000007... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 85], ["+", 12, 23, 0, 16, 31, 16, 31, 23, 0, 25], ["+", 12, 16, 1... | 1 | 185 |
# -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a... | [["-", 0, 656, 0, 14, 8, 196, 0, 57, 0, 121], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 656, 0, 14, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 31, 684, 0, 22], ["... | 5 | 343 |
n, x = map(int, input().split())
ans = n
wall_side = n - x
light_length = n - (n - x)
while True:
if wall_side % light_length == 0:
ans += (wall_side // light_length - 1) * 2 + 1
break
else:
ans += 2 * (wall_side // light_length) * light_length
wall_side, light_length = light_l... | n, x = map(int, input().split())
ans = n
wall_side = n - x
light_length = n - (n - x)
while True:
if wall_side % light_length == 0:
ans += (2 * (wall_side // light_length - 1) + 1) * light_length
break
else:
ans += 2 * (wall_side // light_length) * light_length
wall_side, light... | [["+", 12, 657, 31, 23, 0, 657, 31, 657, 31, 612], ["+", 12, 657, 31, 23, 0, 657, 31, 657, 17, 48], ["+", 31, 23, 0, 657, 31, 657, 12, 23, 0, 24], ["-", 0, 1, 0, 677, 12, 657, 31, 657, 17, 48], ["-", 0, 1, 0, 677, 12, 657, 31, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 25], ["+", 64, 196, 0, 1, 0, 677, 12, ... | 5 | 83 |
#include <bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mod 1000000007
ll power(ll a, ll b) {
ll res = 1;
while (b > 0) {
if (b % 2 != 0)
res = (res * a);
a = (a * a);
b... | #include <bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mod 1000000007
ll power(ll a, ll b) {
ll res = 1;
while (b > 0) {
if (b % 2 != 0)
res = (res * a);
a = (a * a);
b... | [["+", 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], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 17, 33], ["+"... | 1 | 338 |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define cmp_all(X) (X).begin(), (X).end(), cmp
#define B begin()
#define E end()
#define sz size()
#define skip continue
#define ppi pair<pair<int, int>, int>
#define pii pair<int, int>
#def... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define cmp_all(X) (X).begin(), (X).end(), cmp
#define B begin()
#define E end()
#define sz size()
#define skip continue
#define ppi pair<pair<int, int>, int>
#define pii pair<int, int>
#def... | [["-", 64, 9, 0, 37, 0, 16, 31, 16, 31, 22], ["-", 64, 9, 0, 37, 0, 16, 31, 16, 17, 72], ["+", 0, 37, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 85], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 31, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 0... | 1 | 210 |
#include "bits/stdc++.h"
using namespace std;
int reflect(int a, int b) {
if (a % b == 0) {
return ((a / b) * 2 - 1) * b;
} else {
return reflect(b, a % b) + ((a / b) * 2) * b;
}
}
int main() {
int n, x;
cin >> n >> x;
if (n - x >= x) {
cout << n + reflect(n - x, x) << endl;
} else {
cou... | #include "bits/stdc++.h"
using namespace std;
long long reflect(long long a, long long b) {
if (a % b == 0) {
return ((a / b) * 2 - 1) * b;
} else {
return reflect(b, a % b) + ((a / b) * 2) * b;
}
}
int main() {
long long n, x;
cin >> n >> x;
if (n - x >= x) {
cout << n + reflect(n - x, x) << ... | [["-", 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 | 132 |
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define mper make_pair
#define PI 3.14159
#define F first
#define S second
#define ll long long
//#define forik(i, a, b) for(ll i = a; i <= b; ++i)
#define vl vector<ll>
#define pll pair<ll, ll>
//#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cou... | #include <bits/stdc++.h>
#define sz size
#define pb push_back
#define mper make_pair
#define PI 3.14159
#define F first
#define S second
#define ll long long
//#define forik(i, a, b) for(ll i = a; i <= b; ++i)
#define vl vector<ll>
#define pll pair<ll, ll>
//#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cou... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["+", 0, 57, 64, 9, 0, 37, 0, 16, 17, 33], ["+", 0, 57, 64, 9, 0, 37, 0, 16, 12, 22], ["-", 0, 37, 0, 16, 31, 16, 31, 2, 63, 22], ["-", 0, 16, 31, 16, 31, 2, 3, 4, 0, 21], ["-", 0, 16, ... | 1 | 138 |
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define mper make_pair
#define PI 3.14159
#define F first
#define S second
#define ll int
//#define forik(i, a, b) for(ll i = a; i <= b; ++i)
#define vl vector<ll>
#define pll pair<ll, ll>
#define mal ... | #include <bits/stdc++.h>
#define sz size
#define pb push_back
#define mper make_pair
#define PI 3.14159
#define F first
#define S second
#define ll long long
//#define forik(i, a, b) for(ll i = a; i <= b; ++i)
#define vl vector<ll>
#define pll pair<ll, ll>
using namespace std;
ll f(ll n, ll x) {
if (n % x == 0) {
... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 36, 36, 0, 30, 0, 58], ["-", 36, 36, 0, 30, 0, 58, 141, 22, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 35], ["... | 1 | 126 |
#include <iostream>
using namespace std;
int gcd(int a, int b) {
int c;
if (a < b) {
a += b;
b = a - b;
a -= b;
}
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
int main() {
long int N, X;
cin >> N >> X;
cout << (N / gcd(N, X) - 1) * 3 * gcd(N, X) << endl;
} | #include <iostream>
using namespace std;
long long int gcd(long long int a, long long int b) {
long long int c;
if (a < b) {
a += b;
b = a - b;
a -= b;
}
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
int main() {
long long int N, X;
cin >> N >> X;
cout << (N / gcd(N... | [["+", 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 | 111 |
#include <bits/stdc++.h>
using namespace std;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll inf = 1 << 30;
const ll LINF = LONG_MAX;
const ll INF = 1LL <<... | #include <bits/stdc++.h>
using namespace std;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll inf = 1 << 30;
const ll LINF = LONG_MAX;
const ll INF = 1LL <<... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 49, 50, 51, 2, 3, ... | 1 | 1,008 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, a, n) for (int i = (a); i < (n); ++i)
using namespace std;
typedef long long ll;
ll solve(ll a, ll b) {
if (b % a == 0)
return 2 * b - a;
return 2 * b + solve(b % a, a);
}
void Main() {
ll N, X;
cin >> N >> X;
ll a =... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, a, n) for (int i = (a); i < (n); ++i)
using namespace std;
typedef long long ll;
ll solve(ll a, ll b) {
if (b % a == 0)
return 2 * b - a;
return b / a * a * 2 + solve(b % a, a);
}
void Main() {
ll N, X;
cin >> N >> X;
... | [["-", 8, 9, 0, 37, 0, 16, 31, 16, 31, 13], ["-", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 17, 85], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 8,... | 1 | 157 |
#include <bits/stdc++.h>
using namespace std;
typedef long long llint;
const int MAXN = 205;
llint n, x;
llint f(int a, int b) {
if (a < b)
swap(a, b);
if (a % b == 0)
return (a / b * 2 - 1) * b;
return a / b * b * 2 + f(a % b, b);
}
int main() {
cin >> n >> x;
cout << n + f(n - x, x);
return ... | #include <bits/stdc++.h>
using namespace std;
typedef long long llint;
llint n, x;
llint f(llint a, llint b) {
if (a < b)
swap(a, b);
if (a % b == 0)
return (a / b * 2 - 1) * b;
return a / b * b * 2 + f(a % b, b);
}
int main() {
cin >> n >> x;
cout << n + f(n - x, x);
return 0;
}
| [["-", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", ... | 1 | 113 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep_down(i, n) for (int i = n - 1;... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep_down(i, n) for (int i = n - 1;... | [["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 48], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 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, 110], ["+", 0, 57, ... | 1 | 223 |
#include <bits/stdc++.h>
#define st first
#define nd second
using namespace std;
void debug_out() { cerr << endl; }
template <class T> ostream &prnt(ostream &out, T v) {
out << v.size() << '\n';
for (auto e : v)
out << e << ' ';
return out;
}
template <class T> ostream &operator<<(ostream &out, vector<T> v)... | #include <bits/stdc++.h>
#define st first
#define nd second
using namespace std;
void debug_out() { cerr << endl; }
template <class T> ostream &prnt(ostream &out, T v) {
out << v.size() << '\n';
for (auto e : v)
out << e << ' ';
return out;
}
template <class T> ostream &operator<<(ostream &out, vector<T> v)... | [["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 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, 49, 50, 51, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 14, 8, 9,... | 1 | 399 |
// by Balloons
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
LL ans = 0;
LL gd(LL x, LL y) {
// if(... | // by Balloons
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
LL ans = 0;
LL gd(LL x, LL y) {
// if(... | [["+", 0, 57, 64, 37, 0, 34, 31, 11, 31, 22], ["+", 0, 57, 64, 37, 0, 34, 31, 11, 17, 110], ["+", 0, 57, 64, 37, 0, 34, 31, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 37, 0, 34, 0, 21], ["+", 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,... | 1 | 147 |
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template... | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template... | [["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["+", 36, 36, 0, 30, 0, 14, 49, 53, 49, 22], ["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 24], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 25], ["+", 3... | 1 | 226 |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
// const int MOD = 998244353;
// const int MOD = ;
int mod(int A, int M) { return (A % M + M) % M; }
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvw... | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
// const int MOD = 998244353;
// const int MOD = ;
int mod(int A, int M) { return (A % M + M) % M; }
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvw... | [["+", 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, 5, 0, 62], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, ... | 1 | 293 |
#include <bits/stdc++.h>
using namespace std;
// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
typedef unsigned long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
ll gcd(const ll a, const ll b) {
if (b == 0)
return a;
else
return gc... | #include <bits/stdc++.h>
using namespace std;
// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
typedef unsigned long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;
ll gcd(const ll a, const ll b) {
if (b == 0)
return a;
else
return gc... | [["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 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], ["-", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["-", 0, 52, 8, ... | 1 | 196 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, X, ans = 0;
ll f(ll a, ll b) {
if (!a || !b)
return 0;
if (a <= b)
return f(a, b % a) + b / a * a * 2ll;
else
return f(a % b, b) + a / b * b * 2ll;
}
int main() {
cin >> N >> X;
cout << f(X, N - X) + X * 2ll << endl;
ret... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, X, ans = 0;
ll f(ll a, ll b) {
if (!a)
return -b;
if (!b)
return -a;
if (a < b)
return f(a, b % a) + b / a * a * 2ll;
else
return f(a % b, b) + a / b * b * 2ll;
}
int main() {
cin >> N >> X;
cout << f(X, N - X) + N <<... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 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, 91, 17, 33], ["+", 8, 9, 0, 57, 64, 37, 0, 91, 28, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9,... | 1 | 117 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
int para(int a, int b) {
if (a % b == 0)
return b * (a / b * 2 - 1);
else
return 2 * b + para(b, a % b);
}
signed main() {
int n, x;
cin >> n >> x;
int ret = 0;
int y = n - x;
if (... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
int para(int a, int b) {
if (a % b == 0)
return 2 * a - b;
else
return a / b * 2 * b + para(b, a % b);
}
signed main() {
int n, x;
cin >> n >> x;
int ret = 0;
int y = n - x;
if (y ... | [["-", 8, 9, 0, 57, 64, 37, 0, 16, 31, 22], ["+", 0, 57, 64, 37, 0, 16, 31, 16, 31, 13], ["-", 0, 57, 64, 37, 0, 16, 12, 23, 0, 24], ["-", 12, 23, 0, 16, 31, 16, 31, 16, 17, 85], ["-", 12, 23, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 17, 48], ["-", 0, 16, 12, 23, 0, 16, 31, 16, 12, 13], ["-",... | 1 | 123 |
#include <bits/stdc++.h>
using namespace std;
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a =... | #include <bits/stdc++.h>
using namespace std;
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a =... | [["-", 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], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 16,... | 1 | 217 |
#include <stdio.h>
int mod(int a, int b) {
int i, sum = 0, syou;
while (1) {
i = a % b;
syou = a / b;
sum += syou * b;
a = b;
b = i;
if (i == 0) {
return sum;
}
}
}
int main() {
int n, x, i;
scanf("%d %d", &n, &x);
if (2 * x < n)
i = mod(n - x, x);
else
i =... | #include <stdio.h>
long long mod(long long a, long long b) {
long long i, sum = 0, syou;
while (1) {
i = a % b;
syou = a / b;
sum += syou * b;
a = b;
b = i;
if (i == 0) {
return sum;
}
}
}
int main() {
long long n, x, i;
scanf("%lld %lld", &n, &x);
if (2 * x < 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... | 0 | 136 |
#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> pii;
typedef long long ll;
const int MOD = 1000000007;
const int BASE = 27;
const int oo = 1e9;
const double EPS = 1e-9;
const int MX = 1e5 + 1;
ll f(ll a, ll b) {
if (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> pii;
typedef long long ll;
const int MOD = 1000000007;
const int BASE = 27;
const int oo = 1e9;
const double EPS = 1e-9;
const int MX = 1e5 + 1;
ll f(ll a, ll b) {
if (a > b... | [["+", 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, 85], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 37, ... | 1 | 149 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 5;
ll solve(ll x, ll y) {
if (x < y)
return solve(y, x);
if (x == y)
return x;
return 2 * y + solve(y, x - y);
}
int main() {
ll n, x, y;
scanf("%lld%lld", &n, &x);
printf("%lld\n", n + solve(x, n - x));
return ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 5;
ll solve(ll x, ll y) {
// printf("x:%lld y:%lld\n",x,y);
if (x < y)
return solve(y, x);
if (y == 0)
return x;
return 2 * ((x - 1) / y) * y + solve(y, x % y);
}
int main() {
ll n, x, y;
scanf("%lld%lld", &n, &x)... | [["-", 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, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 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, 23, 0, 24], ["+"... | 1 | 113 |
def calc(a,b,ans):
if b==0:
return ans
else:
if b!=1:
return calc(b,a%b,ans+b*3)
else:
return calc(b,a%b,ans+a*3)
n,x=map(int,input().split())
n=n-x
n,x=max(n,x),min(n,x)
print(calc(n,x,0)) | def calc(a,b,ans):
if b==0:
return ans
else:
return calc(b,a%b,ans+b*(a//b)*3)
n,x=map(int,input().split())
n=n-x
n,x=max(n,x),min(n,x)
print(calc(n,x,0)) | [["-", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 79], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 57, 75, 76, 8, 196, 0, 57, 0, 102], ["-", 0, 652, 3, 4, 0, 657, 12, 657, 12, 612], ["-", 64, 196, 0, 37, 0, 652, 3, 4, 0, 25... | 5 | 105 |
#include <bits/stdc++.h>
using namespace std;
#define IL inline
#define rep(i, j, k) for (int i = j; i <= k; ++i)
#define repd(i, j, k) for (int i = j; i >= k; --i)
#define pb push_back
#define db double
#define mp make_pair
#define mp3(a, b, c) mp(mp(a, b), c)
#define pii pair<int, int>
#define piii pair<pii, int>
#de... | #include <bits/stdc++.h>
using namespace std;
#define IL inline
#define rep(i, j, k) for (int i = j; i <= k; ++i)
#define repd(i, j, k) for (int i = j; i >= k; --i)
#define pb push_back
#define db double
#define mp make_pair
#define mp3(a, b, c) mp(mp(a, b), c)
#define pii pair<int, int>
#define piii pair<pii, int>
#de... | [["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 2, 3... | 1 | 583 |
#pragma GCC optimize("O3")
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using QWORD = uint64_t;
using SQWORD... | #pragma GCC optimize("O3")
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using QWORD = uint64_t;
using SQWORD... | [["+", 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, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 109], ["+... | 1 | 910 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, X;
cin >> N >> X;
if (N == X) {
cout << 3 * N << endl;
return 0;
}
int ans = N;
int l = min(X, N - X);
int L = N - 2 * l;
ans += l;
while (L % l != 0) {
ans += (L / l) * l * 2;
ans += l + L % l;
int LL = L;
L... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, X;
cin >> N >> X;
if (N == X) {
cout << 3 * N << endl;
return 0;
}
long long ans = N;
long long l = min(X, N - X);
long long L = N - 2 * l;
ans += l;
while (L % l != 0) {
ans += (L / l) * l * 2;
ans += l + L % l... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 136 |
#include <algorithm>
#include <iostream>
using namespace std;
using int64 = long long;
#define int int64
int solve(int p, int q) {
int mx = max(p, q);
int mn = min(p, q);
if (mx % mn != 0) {
return solve(mn, mx % mn) + 2 * mn;
} else {
return 3 * mn;
}
}
signed main() {
int n, x;
cin >> n >> x;
... | #include <algorithm>
#include <iostream>
using namespace std;
using int64 = long long;
#define int int64
int solve(int p, int q) {
int mx = max(p, q);
int mn = min(p, q);
if (mx % mn != 0) {
return solve(mn, mx % mn) + (mx / mn) * 2 * mn;
} else {
return (mx / mn) * 2 * mn - mn;
}
}
signed main() {
... | [["+", 0, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 31, 22], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 85], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 12, 16, 31, 16, 31, 23, 0, 25], ["+", 0, 37, 0, 16, 12, 16, 31, 16, 17, 48], ["-", 75, 76, 0, 9, 0, 37, 0, 16, 31, 13], ["+... | 1 | 121 |
#include <iostream>
using namespace std;
using int64 = int64_t;
int f(int x, int y) {
int mx = max(x, y);
int mn = min(x, y);
if (mx % mn == 0)
return (mx / mn) * (2 * mn) - mn;
return f(mn, mx % mn) + (mx / mn) * (2 * mn);
}
int main() {
int n, x;
cin >> n >> x;
int ans = x + (n - x) + f(x, n - x);... | #include <iostream>
using namespace std;
using int64 = int64_t;
int64 f(int64 x, int64 y) {
int64 mx = max(x, y);
int64 mn = min(x, y);
if (mx % mn == 0)
return (mx / mn) * (2L * mn) - mn;
return f(mn, mx % mn) + (mx / mn) * (2L * mn);
}
int main() {
int64 n, x;
cin >> n >> x;
int64 ans = x + (n - x... | [["-", 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], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 31, 13], ["+", 0, 1... | 1 | 133 |
#include <iostream>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0)
return (b);
else
return (gcd(b, a % b));
}
int main() {
int N, K;
cin >> N >> K;
cout << ((N / gcd(N, K)) * 3 - 3) * gcd(N, K) << endl;
} | #include <iostream>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (a % b == 0)
return (b);
else
return (gcd(b, a % b));
}
int main() {
long long int N, K;
cin >> N >> K;
cout << ((N / gcd(N, K)) * 3 - 3) * gcd(N, K) << endl;
} | [["+", 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 | 88 |
#include <bits/stdc++.h>
using namespace std;
typedef int64_t Int;
#define dump(x) cout << (x) << '\n'
Int mod = 1e9 + 7;
Int gcd(Int n, Int m) {
Int a = max(n, m);
Int b = min(n, m);
return a % b == 0 ? b : gcd(b, a % b);
}
int main() {
Int n, x;
cin >> n >> x;
if (n % x == 0) {
dump((n - x) * 3LL);
... | #include <bits/stdc++.h>
using namespace std;
typedef int64_t Int;
#define dump(x) cout << (x) << '\n'
Int mod = 1e9 + 7;
Int gcd(Int n, Int m) {
Int a = max(n, m);
Int b = min(n, m);
return a % b == 0 ? b : gcd(b, a % b);
}
int main() {
Int n, x;
cin >> n >> x;
if (n % x == 0) {
dump((n - x) * 3LL);
... | [["+", 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 | 224 |
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#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--)
#define ALL(x) x.begin(), x.end()
... | #include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#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--)
#define ALL(x) x.begin(), x.end()
... | [["-", 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, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0... | 1 | 357 |
#include <bits/stdc++.h>
using namespace std;
long long int gcm(long long a, long long b) {
long long r, tmp;
if (a < b) {
tmp = a;
a = b;
b = tmp;
}
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
int main() {
long long N, X, ans;
cin >> N >> X;
if (X ... | #include <bits/stdc++.h>
using namespace std;
long long int gcm(long long a, long long b) {
long long r, tmp;
if (a < b) {
tmp = a;
a = b;
b = tmp;
}
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
int main() {
long long N, X, ans;
cin >> N >> X;
if (X ... | [["-", 31, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["-", 31, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["-", 31, 16, 31, 16, 31, 23, 0, 16, 17, 85], ["-", 31, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], [... | 1 | 164 |
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < ... |
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < ... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]] | 1 | 252 |
#include <bits/stdc++.h>
using namespace std;
long dist(long a, long b) {
long m = min(a, b), M = max(a, b);
if (m == 0) {
return -1;
} else {
return 2 * (M / m) * m + dist(m, M % m);
}
}
int main() {
long N, X;
cin >> N >> X;
cout << N + dist(X, N - X) << endl;
} | #include <bits/stdc++.h>
using namespace std;
long dist(long a, long b) {
long m = min(a, b), M = max(a, b);
if (m == M) {
return m;
} else {
return 2 * ((M - 1) / m) * m + dist(m, (M - 1) % m + 1);
}
}
int main() {
long N, X;
cin >> N >> X;
cout << N + dist(X, N - X) << endl;
}
| [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 22], ["+", 31, 16, 12, 23, 0, 16, 31, 23, 0, 24], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 16... | 1 | 102 |
#include <cmath>
#include <iostream>
int parallelogram_len(unsigned long long A, unsigned long long B);
int parallelogram_len(unsigned long long A, unsigned long long B) {
unsigned long long a, b, y;
if (A < B) {
a = A;
b = B;
} else {
a = B;
b = A;
}
if (b % a == 0) {
y = 2 * std::floo... | #include <iostream>#include <iostream>
#include <cmath>
long long parallelogram_len(long long A, long long B);
long long parallelogram_len(long long A, long long B) {
long long a, b, y;
if (A < B) {
a = A;
b = B;
} else {
a = B;
b = A;
}
if (b % a == 0) {
y = 2 * std::floor(b / a) * a ... | [["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 49, 53, 54, 55, 0, 56, 39, 86, 0, 87], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40]... | 1 | 170 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long f(long long A, long long B) {
if (A > B)
return f(B, A);
if (A == B)
return A;
return 2 * A + f(A, B - A);
}
int main() {
long long N, X;
c... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long f(long long A, long long B) {
if (A > B)
return f(B, A);
if (A == 0)
return -B;
return 2 * A * (B / A) + f(B % A, A);
}
int main() {
long lon... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22], ["+", 8, 9, 0, 57, 64, 37, 0, 91, 17, 33], ["+", 8, 9, 0, 57, 64, 37, 0, 91, 28, 22], ["+", 8, 9, 0, 37, 0, 16, 31, 16, 17, 48], ["+", 0, 37, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 0, 16, 3... | 1 | 108 |
/*
String[]の初期化、整数の型がlongになっているか
関数(splitとかcontainsとか)内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した?????
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
ArrayDequeではpopとpushはStackと同じ操作になる
*/
//入力終了→Ctrl+D
import sta... | /*
String[]の初期化、整数の型がlongになっているか
関数(splitとかcontainsとか)内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した?????
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
ArrayDequeではpopとpushはStackと同じ操作になる
*/
//入力終了→Ctrl+D
import sta... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["-", 0, 57, 15, 15, 0, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 12, 22], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 31, 22], [... | 3 | 179 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef unsigned long long Long;
Long f(Long n, Long x) {
if (x > n) {
swap(x, n);
}
if (n == x)
return x;
return 2 * x + f(x, n - x);
}
int ma... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef unsigned long long Long;
Long f(Long n, Long x) {
if (n == x)
return x;
Long k = (n + x - 1) / x - 1;
return 2 * x * k + f(x, n - k * x);
}
i... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 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], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 64, 9, 0, 1, 0... | 1 | 144 |
/// awoooooo
#include <bits/stdc++.h>
#define sz(x) (int)((x).size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;
ll f(ll a, ll b) {
if (a > b)
swap(a, b);
if (a == b)
return a;
return 2 * a ... | /// awoooooo
#include <bits/stdc++.h>
#define sz(x) (int)((x).size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;
ll f(ll a, ll b) {
if (a > b)
swap(a, b);
if (b % a == 0) {
return 2 * (b / a) ... | [["+", 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], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 37, 0, 16, 31, 16, 31, 16, 17, 48], ["+... | 1 | 147 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL ans = 0;
void Saiki(LL a, LL b) {
if (b == 0)
return;
ans ... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL ans = 0;
void Saiki(LL a, LL b) {
if (b == 0)
return;
ans ... | [["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85]] | 1 | 118 |
/* I love Cara Delevingne */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int... | /* I love Cara Delevingne */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int... | [["+", 8, 9, 0, 1, 0, 41, 15, 23, 0, 24], ["+", 0, 1, 0, 41, 15, 23, 0, 16, 31, 22], ["+", 0, 1, 0, 41, 15, 23, 0, 16, 17, 79], ["+", 0, 1, 0, 41, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 41, 15, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 41, 0, 101], ["+", 0, 14, 8, 9, 0, 1, 0, 41, 0, 102], ["+", 8, 9, 0, 1, 0, 41, 7... | 1 | 528 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) :... | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) :... | [["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 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], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 64, 9, 0, 1, 0, 2, 3,... | 1 | 468 |
#include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
... | #include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
... | [["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 123, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, ... | 1 | 699 |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> E;
int N, K;
int d[2000], d2[2000];
void dfs(int pos, int parent) {
for (int i = 0; i < E[pos].size(); i++) {
int nxt = E[pos][i];
if (nxt == parent)
continue;
d[nxt] = d[pos] + 1;
dfs(nxt, p... | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> E;
int N, K;
int d[2000];
void dfs(int pos, int parent) {
for (int i = 0; i < E[pos].size(); i++) {
int nxt = E[pos][i];
if (nxt == parent)
continue;
d[nxt] = d[pos] + 1;
dfs(nxt, pos);
}
}... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 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], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 9, 0,... | 1 | 384 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include ... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include ... | [["+", 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], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0,... | 1 | 566 |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
const long long inf = 1e15;
const int mod = 1e6;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
void faster() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const long long N = 4000 * 100 + 10;
vector<int> adj... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
const long long inf = 1e15;
const int mod = 1e6;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
void faster() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const long long N = 4000 * 100 + 10;
vector<int> adj... | [["-", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 90], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 23, 0, 24], ["+", 51, 16, 12, 16, 31, 23, 0, 1... | 1 | 635 |
// minamoto
#include <bits/stdc++.h>
#define R register
#define fp(i, a, b) for (R int i = (a), I = (b) + 1; i < I; ++i)
#define fd(i, a, b) for (R int i = (a), I = (b)-1; i > I; --i)
#define go(u) for (int i = head[u], v = e[i].v; i; i = e[i].nx, v = e[i].v)
template <class T> inline bool cmin(T &a, const T &b) {
re... | // minamoto
#include <bits/stdc++.h>
#define R register
#define fp(i, a, b) for (R int i = (a), I = (b) + 1; i < I; ++i)
#define fd(i, a, b) for (R int i = (a), I = (b)-1; i > I; --i)
#define go(u) for (int i = head[u], v = e[i].v; i; i = e[i].nx, v = e[i].v)
template <class T> inline bool cmin(T &a, const T &b) {
re... | [["+", 0, 16, 31, 23, 0, 16, 31, 2, 63, 22], ["+", 31, 23, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 31, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 31, 23, 0, 16, 31, 2, 3, 4, 0, 21], ["+", 31, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["+", 3, 4, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 3, 4, 0, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 16, 3... | 1 | 500 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define sqr(x) ((x) * (x))
#define fz1(i, n) for ((i) = 1; (i) <= (n); (i)++)
#define fd... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define sqr(x) ((x) * (x))
#define fz1(i, n) for ((i) = 1; (i) <= (n); (i)++)
#define fd... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 13], ["+", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22]... | 1 | 510 |
// by Balloons
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const int maxn = 4005;
... | // by Balloons
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const int maxn = 4005;
... | [["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 105, 0, 150], ["+", 0, 1, 0, 2, 3, 4, 0, 105, 51, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 64... | 1 | 495 |
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
#define ll long long
#define inf int(1e9 + 7)
#define pb push_back
#define mp make_pair
int n, k;
vector<int> g[2005];
int dfs(int x, int p, int deepth, int mx) {
int ans = 1;
if... | #include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
#define ll long long
#define inf int(1e9 + 7)
#define pb push_back
#define mp make_pair
int n, k;
vector<int> g[2005];
int dfs(int x, int p, int deepth, int mx) {
int s = 1;
if... | [["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 15, 339, 51, 16, 31, 69, 28, 69, 28, 22], ["+", 51, 16, 31, 69, 28, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+",... | 1 | 357 |
#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
vector<int> e[N];
int dep[N] = {-1}, n, k, sum, b1, b2, ans = 2000;
void dfs(int u, int f) {
dep[u] = dep[f] + 1;
if (dep[u] > k / 2)
sum++;
for (int i = 0; i < e[u].size(); i++)
if (e[u][i] != f)
dfs(e[u][i], u);
}
void dfs2(int u, i... | #include <bits/stdc++.h>
using namespace std;
const int N = 2005;
vector<int> e[N];
int dep[N] = {-1}, n, k, sum, b1, b2, ans = 2000;
void dfs(int u, int f) {
dep[u] = dep[f] + 1;
if (dep[u] > k / 2)
sum++;
for (int i = 0; i < e[u].size(); i++)
if (e[u][i] != f)
dfs(e[u][i], u);
}
void dfs2(int u, 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, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], [... | 1 | 466 |
#include <cstdio>
#include <iostream>
#define M 2010
using namespace std;
int n, num, L, R, ans, tot, k;
int head[M], U[M], V[M];
struct edge {
int next, to;
} e[M << 1];
void add(int from, int to) {
e[++num] = (edge){head[from], to};
head[from] = num;
}
void dfs(int x, int fa, int dep) {
if (dep > k / 2)
t... | #include <cstdio>
#include <iostream>
#define M 2010
using namespace std;
int n, num, L, R, ans, tot, k;
int head[M], U[M], V[M];
struct edge {
int next, to;
} e[M << 1];
void add(int from, int to) {
e[++num] = (edge){head[from], to};
head[from] = num;
}
void dfs(int x, int fa, int dep) {
if (dep > k / 2)
t... | [["-", 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], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, ... | 1 | 380 |
#include <bits/stdc++.h>
#define intt long long
using namespace std;
int i, j;
vector<int> g[2050];
bool used[2050];
int level[2050];
vector<pair<int, int>> e;
int n, k, res = 0;
void dfs(int node) {
used[node] = true;
for (int i : g[node]) {
if (!used[i]) {
level[i] = level[node] + 1;
if (level[i] ... | #include <bits/stdc++.h>
#define intt long long
using namespace std;
int i, j;
vector<int> g[2050];
bool used[2050];
int level[2050];
vector<pair<int, int>> e;
int n, k, res = 0;
void dfs(int node) {
used[node] = true;
for (int i : g[node]) {
if (!used[i]) {
level[i] = level[node] + 1;
if (level[i] ... | [["+", 0, 338, 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, 118, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 17, 131], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 64, 9, 0, 338, 8, 9, 0, 1, 0, 35]] | 1 | 360 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;
int dfs(int cur, int tmp, vector<vector<int>> &G, int d, vector<bool> &used,
int u, int v) {
used[cur] = true;
int ret = 0;
for (auto nxt : G[cur]) {
if (!used[nxt]) {
i... | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;
int dfs(int cur, int tmp, vector<vector<int>> &G, int d, vector<bool> &used,
int u, int v) {
used[cur] = true;
int ret = 0;
for (auto nxt : G[cur]) {
if (!used[nxt]) {
i... | [["+", 0, 1, 0, 2, 63, 118, 28, 69, 28, 22], ["+", 0, 2, 63, 118, 28, 69, 341, 342, 0, 70], ["+", 0, 2, 63, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 2, 63, 118, 28, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 3, ... | 1 | 404 |
#include <bits/stdc++.h>
#define INF 9999
using namespace std;
int n, k, pre, ans;
vector<vector<int>> G(2002);
int d[2002];
void search(int p, int s, int sum) {
if (sum > k / 2)
pre++;
d[s] = sum;
for (int i = 0; i < (int)G[s].size(); i++)
if (G[s][i] != p)
search(s, G[s][i], sum + 1);
}
void sea... | #include <bits/stdc++.h>
#define INF 9999
using namespace std;
int n, k, pre, ans;
vector<vector<int>> G(2002);
int d[2002];
void search(int p, int s, int sum) {
if (sum > k / 2)
pre++;
d[s] = sum;
for (int i = 0; i < (int)G[s].size(); i++)
if (G[s][i] != p)
search(s, G[s][i], sum + 1);
}
void se... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 7, 8, 9, 0, 1, 0, 1... | 1 | 443 |
// Phoenix
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n, k) (((n) >> (k)) & 1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxn = 2010, inf = 1e9 + 10;
vector<int> v[maxn];
... | // Phoenix
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n, k) (((n) >> (k)) & 1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxn = 2010, inf = 1e9 + 10;
vector<int> v[maxn];
... | [["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 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, 11,... | 1 | 473 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
typedef long long ll;
typedef unsigned int uint;
using namespace std;
int N, K;
vector<int> G[2005];
int visited[2005];
void dfs(int x, int c) {
if (visited[x] > 0 && visited[x] < c) {
return;
} else... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
typedef long long ll;
typedef unsigned int uint;
using namespace std;
int N, K;
vector<int> G[2005];
int visited[2005];
void dfs(int x, int c) {
if (visited[x] > 0 && visited[x] < c) {
return;
} else... | [["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-", 31, 69, 341, 342, 0, 69, 28, 69, 28, 22], ["-", 341, 342, 0, 69, 28, 69, 341, 342, 0, 70], ["-", 341, 342, 0, 69, 28, 69, 341, 342, 0, ... | 1 | 446 |
#include <cstdio>
#include <cstring>
#include <iostream>
const int N = 5005;
int n, q;
template <class T> inline void apn(T &x, const T y) {
if (x > y)
x = y;
}
inline int nxi() {
int x = 0;
char c;
while ((c = getchar()) > '9' || c < '0')
;
while (x = x * 10 - 48 + c, (c = getchar()) >= '0' && c <=... | #include <cstdio>
#include <cstring>
#include <iostream>
const int N = 5005;
int n, q;
template <class T> inline void apn(T &x, const T y) {
if (x > y)
x = y;
}
inline int nxi() {
int x = 0;
char c;
while ((c = getchar()) > '9' || c < '0')
;
while (x = x * 10 - 48 + c, (c = getchar()) >= '0' && c <=... | [["-", 0, 11, 12, 16, 12, 16, 31, 23, 0, 24], ["-", 12, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 12, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 11, 12, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 201, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 559 |
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr << #x << ":" << x ... | #include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr << #x << ":" << x ... | [["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 85], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["+", 0, 1, 0, 2, 3, 4, 0, ... | 1 | 388 |
#include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define ... | #include <bits/stdc++.h>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define ... | [["-", 0, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 0, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 9, 0, 1, 0... | 1 | 852 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
#define REP(i, n) for (int i = 0; i < n; ++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
#define REP(i, n) for (int i = 0; i < n; ++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
... | [["-", 0, 9, 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], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 9, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["+", 0, 338, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 338, 8, 9, 0, 4... | 1 | 1,289 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
#define int long long int
#define rep(i, n) for (int i = 0; i < (n)... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
#define int long long int
#define rep(i, n) for (int i = 0; i < (n)... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 2, 63, 346, 141, 22], ["-", 0, 11, 12, 2, 63, 346, 3, 347, 0, 18], ["-", 12, 2, 63, 346, 3, 347, 0, 77, 39, 40], ["-", 0, 11, 12, 2, 63, 346, 3, 347, 0, 47], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 11, 12,... | 1 | 734 |
#include <algorithm>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define re register
using namespace std;
inline int gi() {
int f = 1, sum = 0;
char ch = getchar();
while (ch > '9' || ch < '0') {
if (ch == '-')
f = -1;
ch = getch... | #include <algorithm>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define re register
using namespace std;
inline int gi() {
int f = 1, sum = 0;
char ch = getchar();
while (ch > '9' || ch < '0') {
if (ch == '-')
f = -1;
ch = getch... | [["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 43, 49, 50, 51, 118, 28, 69, 28, 22], ["-", 49, 50, 51, 118, 28, 69, 341, 342, 0, 70], ["-", 49, 50, 51, 118, 28, 69, 341, 342, 0, 22], ["-", 49, 50, 51, 118, 28, 69, 341, 342, 0, 73], ["... | 1 | 599 |
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;
int n, m, bul, ans = 1e9, a[N];
vector<int> g[N];
int dfs(int node, int par, int der, int bul) {
// cout << par << " -> " << node << " " << der << " " << bul << endl;
int sa... | #include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;
int n, m, bul, ans = 1e9, a[N];
vector<int> g[N];
int dfs(int node, int par, int der, int bul) {
// cout << par << " -> " << node << " " << der << " " << bul << endl;
int sa... | [["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 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, ... | 1 | 404 |
// It is coded by ning-mew on 9.28
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 7;
int n, K, ans = maxn;
int head[maxn], cnt = 0, depth[maxn];
int siz[maxn], root = 0, root2 = 0, maxx[maxn];
struct Edge {
int nxt, to, from;
} edge[maxn * 2];
void add(int from, int to) {
edge[++cnt].nxt =... | // It is coded by ning-mew on 9.28
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 7;
int n, K, ans = maxn;
int head[maxn], cnt = 0, depth[maxn];
int siz[maxn], root = 0, root2 = 0, maxx[maxn];
struct Edge {
int nxt, to, from;
} edge[maxn * 2];
void add(int from, int to) {
edge[++cnt].nxt =... | [["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 105, 0, 150], ["+", 0, 2, 3, 4, 0, 105, 51, 23, 0, 24], ["+", 0, 2, 3, 4, 0, 105, 51, 23, 0, 22], ["+... | 1 | 577 |
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
using namespace std;
#define INF 1000000005
int counter = 0;
int ... | #include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
using namespace std;
#define INF 1000000005
int counter = 0;
int ... | [["+", 3, 4, 0, 16, 12, 16, 12, 69, 28, 22], ["+", 0, 16, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 31, 13], ["+", 12, 69, 341, 342, 0, 16, 31, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 341, 342, 0, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 7... | 1 | 503 |
#include <bits/stdc++.h>
using namespace std;
#ifdef Lin1043
#define DEBUG(msg, ...) \
printf("(%s #%d) " msg, __FUNCTION__, __LINE__, __VA_ARGS__)
#define massert(...) assert(...)
#else
#define DEBUG(...)
#define massert(...)
#endif
#define rep(i, l, r) for (... | #include <bits/stdc++.h>
using namespace std;
#ifdef Lin1043
#define DEBUG(msg, ...) \
printf("(%s #%d) " msg, __FUNCTION__, __LINE__, __VA_ARGS__)
#define massert(...) assert(...)
#else
#define DEBUG(...)
#define massert(...)
#endif
#define rep(i, l, r) for (... | [["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 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, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["-", 0, 7, 8, 9,... | 1 | 816 |
#include <bits/stdc++.h>
#define maxn 4002
using namespace std;
inline int read() {
char x = getchar();
int lin = 0, f = 1;
while (x < '0' || x > '9') {
if (x == '-')
f = -1;
x = getchar();
}
while (x >= '0' && x <= '9') {
lin = lin * 10 + x - '0';
x = getchar();
}
return lin * f;
}
... | #include <bits/stdc++.h>
#define maxn 4002
using namespace std;
inline int read() {
char x = getchar();
int lin = 0, f = 1;
while (x < '0' || x > '9') {
if (x == '-')
f = -1;
x = getchar();
}
while (x >= '0' && x <= '9') {
lin = lin * 10 + x - '0';
x = getchar();
}
return lin * f;
}
... | [["+", 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, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 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, 30, 0,... | 1 | 615 |
// 2018.9.14 by ljz
#include <bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read() {
res s = 0;
bool w = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
w = 1;
ch = getchar();
}
while ... | // 2018.9.14 by ljz
#include <bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read() {
res s = 0;
bool w = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
w = 1;
ch = getchar();
}
while ... | [["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 34, 12, 34, 31, 2, 3, 4, 0, 13], ["+", 0, 34, 12, 34, 31, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 639 |
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def... | import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196... | 5 | 499 |
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ROF(i, a, b) for (int i = b - 1; i >= a; i--)
#define YES(i) cout << (i ? "YES" : "NO") << endl
#define Yes(i) cout << (i ? "Yes" : "No") << endl
#define co(i) c... | #include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ROF(i, a, b) for (int i = b - 1; i >= a; i--)
#define YES(i) cout << (i ? "YES" : "NO") << endl
#define Yes(i) cout << (i ? "Yes" : "No") << endl
#define co(i) c... | [["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 0, 73], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 70], ["+",... | 1 | 407 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define mod 998244353
#define pb push_back
#define ll long long
using namespace std;
int main() {
int n, k, dist[2018], ans = 10000, a[2018], b[2018];
vector<int> pat[2018... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define mod 998244353
#define pb push_back
#define ll long long
using namespace std;
int main() {
int n, k, dist[2018], ans = 10000, a[2018], b[2018];
vector<int> pat[2018... | [["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118,... | 1 | 596 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
#define ll long long
#define MAX 2002
inline int read() {
int x = 0;
bool t = false;
char ch = getchar();
while ((ch < '0' || ch > '9') && ch != '-')
ch = g... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
#define ll long long
#define MAX 2002
inline int read() {
int x = 0;
bool t = false;
char ch = getchar();
while ((ch < '0' || ch > '9') && ch != '-')
ch = g... | [["+", 12, 34, 12, 34, 31, 11, 31, 69, 28, 22], ["+", 12, 34, 31, 11, 31, 69, 341, 342, 0, 70], ["+", 12, 34, 31, 11, 31, 69, 341, 342, 0, 22], ["+", 12, 34, 31, 11, 31, 69, 341, 342, 0, 73], ["+", 12, 34, 12, 34, 12, 34, 31, 11, 17, 32], ["+", 12, 34, 12, 34, 12, 34, 31, 11, 12, 13], ["+", 0, 34, 12, 34, 12, 34, 12, 3... | 1 | 488 |
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (a); i >= (b); i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout << #x << " = " << x << endl;
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x = min(x, y)
#define fi first
#... | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (a); i >= (b); i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout << #x << " = " << x << endl;
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x = min(x, y)
#define fi first
#... | [["-", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 338, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 338, 8, 9, 0, 1, 0, 11, 12, 147], ["-", 8, 9, 0, 338, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1,... | 1 | 783 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a) for (int i = 0; i < (a); i++)
const ll MOD = 1000000007;
int N, K;
const int INF = 1e9;
vector<vector<int>> G(2020);
vector<pair<int, int>> E;
int d[2020];
int bfs(int v, int u) {
int res = 0;
rep(i, N) d[i] = INF;
queue<int> ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a) for (int i = 0; i < (a); i++)
const ll MOD = 1000000007;
int N, K;
const int INF = 1e9;
vector<vector<int>> G(2020);
vector<pair<int, int>> E;
int d[2020];
int bfs(int v, int u) {
int res = 0;
rep(i, N) d[i] = INF;
queue<int> ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["-", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["-", 75, 76, 0, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 43, 49, 50, 51, 2, 63, 118, 28, 22], ["-", 0, 43, 49, 50, 51,... | 1 | 409 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)), UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a + mod - b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i, m, n) for (int i = m; i < n; i+... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)), UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a + mod - b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i, m, n) for (int i = m; i < n; i+... | [["-", 0, 14, 8, 9, 0, 37, 0, 118, 119, 120], ["+", 0, 14, 8, 9, 0, 37, 0, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 3, 4, 0, 69, 341, 342, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 37, 0, 69, 28, 22], ["+", 8, 9, 0, 37, 0, 69, 341, 342, 0, 70], ["+", 8, 9, ... | 1 | 1,460 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.