output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; int main() { long long i, n, sum = 1; cin >> n; for (i = 1; i < n; i++) sum = sum + (12 * i); cout << sum; return 0; }
### Prompt Create a solution in cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long lo...
#include <bits/stdc++.h> using namespace std; int n; long long s, x; int main() { srand(time(NULL)); cin >> n; n--; s = 1; x = 12; while (n) { s += x; x += 12; n--; } cout << s << endl; return 0; }
### Prompt Please create a solution in Cpp to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n; long long...
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; { long long int ...
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC o...
#include <bits/stdc++.h> int main(void) { int n; scanf("%d", &n); printf("%d\n", (6 * n * (n - 1) + 1)); return 0; }
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main(void) { int n; scanf("%d", ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << (n * 6) * (n - 1) + 1; }
### Prompt Please formulate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << 1; exit(0); } if (n == 2) { cout << 13; exit(0); } int d = 24; int ops = 12; int ans = 13; for (int i = 0; i < n - 2; i++) { ans += d; d += ops; } cout << ans; }
### Prompt Generate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long f = 0, ans = 1; for (int i = 2; i <= n; ++i) { f += 12; ans += f; } cout << ans << endl; return 0; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << (6 * n * (n - 1)) + 1 << endl; return 0; }
### Prompt Please formulate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6; long long t; long long a; void solve() { cin >> a; long long ans = 1; for (int i = 1; i <= a - 1; i++) { ans = ans + i * 12; } cout << ans << endl; } int main() { ios::sync_with_stdio(0), cin.tie(0); solve(); return 0; }
### Prompt Please create a solution in Cpp to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const long long ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; cout << (((3 * n) - 2) * ((2 * n) - 1)) + n - 1; return 0; }
### Prompt Please create a solution in cpp to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { l...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << (6 * n * (n - 1) + 1) << "\n"; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; int main() { int n, sum, i; cin >> n; cout << (12 * ((n * (n + 1)) / 2 - n)) + 1; return 0; }
### Prompt Create a solution in CPP for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 6 * n * (n - 1) + 1; return 0; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, Output, i, k, j; while (cin >> a) { i = 0; j = 0; Output = 1; for (k = 1; k <= a; k++) { i++; Output += j; j = 12 * i; } cout << Output << endl; } return 0; }
### Prompt Your challenge is to write a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; int main() { int n, sn; 1 <= n <= 18257; 1 <= sn <= 2000000000; cin >> n; if (n == 1) cout << 1; if (n != 1) cout << 6 * n * (n - 1) + 1; return 0; }
### Prompt Create a solution in cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int res = 1; for (int i = 1; i < n; ++i) { res += i * 12; } cout << res; }
### Prompt Create a solution in Cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; int f(int n) { if (n == 1) return 1; return (n * 2 - 1) * 6 - 6 + f(n - 1); } int main() { int n; cin >> n; cout << f(n) << endl; return 0; }
### Prompt In Cpp, your task is to solve the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int f(int n) { if (...
#include <bits/stdc++.h> using namespace std; void timo() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); } int main() { timo(); long long n, ans = 1, arr[18258]; arr[0] = 1, arr[1] = 12; cin >> n; for (int i = 1; i < n; i++) { if (i > 1) arr[i] = arr[i - 1] + 12; ...
### Prompt Your challenge is to write a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; void t...
#include <bits/stdc++.h> using namespace std; const double PI = 2 * asin(1.0); const int INF = 1000000000; const double EPS = 1e-10; inline int cmp(double x, double y = 0, double tol = EPS) { return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1; } inline long long gcd(long long n1, long long n2) { return n2 == 0 ? ab...
### Prompt Your task is to create a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const doub...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 6 * n * (n - 1) + 1; return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int x; cin >> x; cout << 1 + x * (x - 1) * 6 << "\n"; }
### Prompt In Cpp, your task is to solve the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { ios::s...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int inf = (int)1e9; int main() { int a; cin >> a; --a; long long int res = (24 + 12 * (a - 1)) / 2 * a; res++; cout << res; return 0; }
### Prompt Please formulate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const double pi ...
#include <bits/stdc++.h> using namespace std; int n; int main() { scanf("%d", &n); printf("%lld", (long long)6 * (n - 1) * n + 1); return 0; }
### Prompt Construct a CPP code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n; int main() {...
#include <bits/stdc++.h> using namespace std; const long long int inf = 1LL << 62; const long long int nlyinf = 1LL << 60; template <class P, class Q> ostream &operator<<(ostream &out, const pair<P, Q> &p); template <class T> ostream &operator<<(ostream &out, const vector<T> &V); template <> ostream &operator<<<long lo...
### Prompt Create a solution in cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const long long int in...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LLINF = 0x3f3f3f3f3f3f3f3f; const int MOD = 1000000007; const double EPS = 1e-8; const long double EULER = 2.71828182845904523536; const long double PI = 3.14159265358979323846; int main() { ios_base::sync_with_stdio(0); cin.t...
### Prompt In CPP, your task is to solve the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const int INF = 0x3f3...
#include <bits/stdc++.h> using namespace std; long long S(long long n) { return (n * (n + 1)) / 2; } long long A(long long n) { return S(3 * n + 1) + 3 * S(n); } int main() { long long n; cin >> n; cout << A(--n); }
### Prompt Your challenge is to write a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long l...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int i; int answer = 1; for (i = 2; i <= n; i++) { answer += (6 * (2 * i - 2)); } cout << answer << endl; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); cout << (6 * n * (n - 1)) + 1; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a; if (a == 1) { cout << '1'; return 0; } if (a == 2) { cout << "13"; return 0; } long long sol = 1; sol += 1LL * 6 * a * (a + 1) / 2; sol += 1LL * 6 * ((a - 2) * (a - 1) / 2 - 1); cout << sol << '\n'; retu...
### Prompt Generate a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int a, b;...
#include <bits/stdc++.h> using namespace std; int n; int main() { scanf("%d", &n); printf("%d\n", 6 * n * (n - 1) + 1); return 0; }
### Prompt Please create a solution in cpp to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n; int main(...
#include <bits/stdc++.h> using namespace std; int n, ans; int main() { scanf("%d", &n); ans = 1; for (int i = 2; i <= n; i++) { ans += 6 * (2 * i - 2); } printf("%d\n", ans); return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n,...
#include <bits/stdc++.h> using namespace std; int n, m; long long p[20000], ans = 1; int main() { scanf("%d", &n); if (n == 1) { puts("1"); return 0; } p[0] = 0; for (int i = (1); i <= (n); i++) p[i] = p[i - 1] + i; ans = 13; for (int i = (3); i <= (n); i++) { ans += 6 + 6 * (p[i - 1] - p[i - ...
### Prompt Please provide a CPP coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n,...
#include <bits/stdc++.h> using namespace std; int main(void) { int a; cin >> a; cout << 6 * a * (a - 1) + 1; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(void) { ...
#include <bits/stdc++.h> using namespace std; int main() { long a, b = 1, i; cin >> a; for (i = 2; i <= a; i++) { b += 6 * 2 * (i - 1); } cout << b << endl; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { l...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long ans = 1; for (int i = 0; i < n; i++) ans += 12 * i; cout << ans << endl; }
### Prompt Your challenge is to write a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; long long mod = pow(10, 9) + 7; int main() { long long x; cin >> x; long long ans = 0; for (long long i = 1; i <= x; i++) { if (i == 1) { ans++; continue; } ans += (2 * i - 1) * 4; ans += 4 * (i - 2); } cout << ans; return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int res = 0; for (int i = (1); i <= ((n)); i++) { if (i == 1) res++; else { res += 6 * (2 * i - 1) - 6; } } cout << res << endl; return 0; }
### Prompt Please formulate a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; long long MOD = 1791791791; double eps = 1e-12; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n; cin >> n; cout << fixed << setprecision(0) << 12 * (n * (n - 1) * 0.5) + 1 << "\n"; }
### Prompt Please formulate a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long MOD = ...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; int ans(1); for (int i = 2; i <= a; ++i) ans += 12 * (i - 1); cout << ans; }
### Prompt Generate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int a; ...
#include <bits/stdc++.h> using namespace std; inline double sqr(double a) { return a * a; } template <typename T> inline void alert(T const &t) { cout << t; exit(0); } template <typename T> inline void alert(vector<T> &t, char delim = ' ') { for (T const &ti : t) cout << ti << delim; exit(0); } const int INF = ...
### Prompt Create a solution in cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; inline double sqr(doub...
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; cout << 6 * x * (x - 1) + 1; }
### Prompt Please provide a cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; int n, h[20003]; int main() { cin >> n; h[1] = 1; for (int i = 2; i <= n; ++i) h[i] = h[i - 1] + 12 * (i - 1); cout << h[n] << endl; return 0; }
### Prompt Create a solution in Cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n, h[20003]; int m...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 6 * n * (n - 1) + 1; }
### Prompt Your challenge is to write a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << "1"; return 0; } long long cd = n * 3 - 2, ans = 0; for (int i = 1; i <= cd; i++) { ans += i; } ans *= 2; for (int i = 1; i <= n; i++) { ans -= i + n - 1; } for (int i = n - 1; i >= 1;...
### Prompt Construct a CPP code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int ...
#include <bits/stdc++.h> using namespace std; unsigned long long int n, i, ans; int main() { cin >> n; if (n == 1) { cout << 1; return 0; } for (i = 2; i <= n; i++) { ans = ans + 3 * i + 6 * (i - 1) + 3 * (i - 2); } cout << ans + 1; return 0; }
### Prompt Your task is to create a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; unsigned l...
#include <bits/stdc++.h> int l[20000]; int s[20000]; int i; int a; int main() { scanf("%d", &a); l[1] = 1; s[1] = 1; l[2] = 12; s[2] = 4; for (i = 3; i <= a; i++) { s[i] = s[i - 1] + 3; l[i] = 2 * (s[i] * 3 - 3) - (i - 2) * 6 - 6; } int sol = 0; for (i = 1; i <= a; i++) { sol += l[i]; } ...
### Prompt Your task is to create a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int l[20000]; int s[20000]; int...
#include <bits/stdc++.h> using namespace std; long long n, i, j, t, s = 1, k, e, l; int main() { cin >> k; for (i = 1; i < k; i++) s = s + i * 12; cout << s; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long n, i, j, t, s ...
#include <bits/stdc++.h> using namespace std; const int oo = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int res = 1; for (int i = 1; i < n; i++) res += i * 12; cout << res; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const ...
#include <bits/stdc++.h> int n; int main() { scanf("%d", &n); printf("%d\n", 6 * n * (n - 1) + 1); }
### Prompt Please provide a CPP coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int n; int main() { scanf...
#include <bits/stdc++.h> int main() { int n; scanf("%d", &n); printf("%d", n * (n - 1) * 6 + 1); }
### Prompt Your challenge is to write a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main() { int n; sca...
#include <bits/stdc++.h> using namespace std; int main() { int long long ans = 1; int long long part = 1; int n; cin >> n; for (int i = 2; i <= n; i++) { part = part + 2; ans += part * 6 - 6; } cout << ans << endl; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int ...
#include <bits/stdc++.h> int main() { int F[18258]; F[1] = 1; int n; scanf("%d", &n); for (int i = 2; i <= n; i++) F[i] = F[i - 1] + (i - 1) * 12; printf("%d", F[n]); return 0; }
### Prompt Develop a solution in cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main() { int F[18258]; F[1] =...
#include <bits/stdc++.h> using namespace std; long long n; int main() { cin >> n; cout << (n * (n - 1) / 2) * 12 + 1; return 0; }
### Prompt Create a solution in CPP for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long n; int main(...
#include <bits/stdc++.h> using namespace std; long long int ans = 1; int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { ans = ans + 12 * (i - 1); if (ans > 2000000000) ans = ans % 2000000000; } printf("%I64d", ans); return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long l...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); long long n, a, b, tmp = 0, x = 0, y, c; vector<pair<int, int> > vp; bool first, firs, g, prev; char ch; vector<char> used; vector<int> v; string second, t; char d[10]; map<string, long long> ma; bool cmpvp(pair<int, int> p1, pair<int, int> p2) {...
### Prompt Develop a solution in CPP to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const double pi ...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; cout << 6 * a * (a - 1) + 1 << endl; }
### Prompt Construct a CPP code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int ...
#include <bits/stdc++.h> using namespace std; int n, ans; int main() { cin >> n; for (int i = 1; i < n; i++) { ans += 12 * i; } cout << ans + 1; return 0; }
### Prompt Please formulate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n, ans; int ...
#include <bits/stdc++.h> using namespace std; int main() { int star, sum = 0; cin >> star; for (int i = 1; i <= star; i++) { if (i == 1) sum++; else sum = sum + 12 * (i - 1); } cout << sum; return 0; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int star,...
#include <bits/stdc++.h> int main() { long long int a, b = 1, i; scanf("%I64d", &a); for (i = 1; i <= a; i++) { b += 12 * (1 + i - 2); } if (a == 1) printf("1"); else printf("%I64d", b); return 0; }
### Prompt Develop a solution in cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main() { long long int a, b = 1...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, z = 12, t = 1; cin >> n; for (i = 1; i < n; i++) { t += z; z += 12; } cout << t; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long res = 1; for (int i = 2; i <= n; ++i) res = res + 12 * (i - 1); cout << res; return 0; }
### Prompt Generate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; int dir1[8][2] = {1, 2, 2, 1, 2, -1, 1, -2, -1, 2, -2, 1, -1, -2, -2, -1}; int dir2[4][2] = {1, 0, 0, 1, -1, 0, 0, -1}; int dir3[8][2] = {1, 0, 0, 1, -1, 0, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1}; int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); } bool Isleap(int year...
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int dir1[8][2] = {1...
#include <bits/stdc++.h> int main() { int n; while (~scanf("%d", &n)) { int f = 1; for (int i = 2; i <= n; i++) { f = f + (i - 1) * 12; } printf("%d\n", f); } return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main() { int n; whi...
#include <bits/stdc++.h> using namespace std; long long n; int main() { cin >> n; cout << 1 + 12 * (n * (n - 1) / 2) << endl; return 0; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long n; int main() ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; cout << ((6 * (n) * (n - 1)) + 1) << endl; return 0; }
### Prompt Please formulate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { l...
#include <bits/stdc++.h> int n; int main() { scanf("%d", &n); printf("%d", 6 * (n - 1) * n + 1); return 0; }
### Prompt Please formulate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int n; int main() { scanf("%d", &n)...
#include <bits/stdc++.h> int f[18257] = {1}; int main() { int i; for (i = 1; i < 18257; ++i) f[i] = f[i - 1] + 12 * i; int n; while (scanf("%d", &n) != EOF) printf("%d\n", f[n - 1]); }
### Prompt Create a solution in Cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int f[18257] = {1}; int main() { int i; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); unsigned long long layers, bowls; cin >> layers; bowls = 1; for (int i = 2; i <= layers; i++) { bowls += 6 + ((i - 1) * 2 - 1) * 6; } cout << bowls << endl; return 0; }
### Prompt Please formulate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; const long long AV = 1e16; const long long AB = 1e9 + 7; const long long AC = 1e6 + 1; const long long AN = 1e5 + 1; const long long AP = 1e4 + 1; long long n; int main() { cin >> n; cout << n * 6 * (n - 1) + 1; return 0; }
### Prompt Please formulate a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const long long ...
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(T a) { return a * a; } int main() { long long n; scanf("%I64d", &n); printf("%I64d", 6 * n * (n - 1) + 1); return 0; }
### Prompt Develop a solution in cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; template <class ...
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, cnt = 0, snt = 0, f; string s, n, s1; vector<int> v; char u; int main() { cin >> a; cout << (6 * a * (a - 1) + 1); }
### Prompt Generate a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int a, b, c, d, e, cnt =...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { int ans = 1; int doce = 0; while (--n) { doce += 12; ans += doce; } cout << ans << endl; } }
### Prompt Please create a solution in Cpp to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { i...
#include <bits/stdc++.h> using namespace std; template <class T> inline T gcd(T a, T b) { if (a < 0) return gcd(-a, b); if (b < 0) return gcd(a, -b); return (b == 0) ? a : gcd(b, a % b); } template <class T> inline T lcm(T a, T b) { if (a < 0) return lcm(-a, b); if (b < 0) return lcm(a, -b); return a * (b /...
### Prompt Please provide a CPP coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; templa...
#include <bits/stdc++.h> using namespace std; int main() { int n; long long ans = 1; cin >> n; for (int i = 1; i < n; i++) ans += i * 12; cout << ans << endl; }
### Prompt Generate a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e5 + 6; int main() { ios_base::sync_with_stdio(0); long long n; cin >> n; long long temp = 1 + (n - 1) * 3; cout << (temp * (temp + 1)) / 2 + 3 * ((n - 1) * n) / 2; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long m = n - 1, ans = 0; ans = (n * m * 6); cout << ans + 1; return 0; }
### Prompt In cpp, your task is to solve the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { ios_ba...
#include <bits/stdc++.h> using namespace std; int main() { long long n, a[50000] = {}, j = 2; cin >> n; a[1] = 1; for (int i = 2; i <= n; i++) { a[i] = a[i] + j + (j + 1) + (j + 2); a[i] += a[i - 1]; a[i] = a[i] + (3 * (i - 1) * i / 2); a[i] = a[i] - (3 * (i - 2) * (i - 1) / 2); j += 3; } ...
### Prompt Create a solution in CPP for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long lo...
#include <bits/stdc++.h> using namespace std; int main() { int a, ans = 1; cin >> a; for (int i = 1; i < a; i++) { ans += i * 12; } cout << ans << endl; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> using namespace std; const int maxint = -1u >> 1; template <class T> bool get_max(T& a, const T& b) { return b > a ? a = b, 1 : 0; } template <class T> bool get_min(T& a, const T& b) { return b < a ? a = b, 1 : 0; } const int Maxn = 18259; long long f[Maxn]; int main() { f[1] = 1; int n...
### Prompt Generate a cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const int maxint = -1u >...
#include <bits/stdc++.h> using namespace std; long long shar(long long a) { long long ans = (a + 1) * a / 2; return ans; } int main() { long long a; cin >> a; long long h = shar(3 * a - 2) + 3 * shar(a - 1); cout << h; return 0; }
### Prompt Develop a solution in CPP to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long shar(l...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); printf("%d", (6 * n * (n - 1) + 1)); return 0; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; const double PI = 3.14159265358979; const double PI2 = 6.28318530717958; const double PId2 = 1.570796326794895; inline vector<int> ReadVI(int count) { vector<int> arrayname(count); for (int i = 0; i < int(count); i++) cin >> arrayname[i]; return arrayname; }; inline v...
### Prompt Develop a solution in Cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const double PI ...
#include <bits/stdc++.h> int main() { int n; int sum; scanf("%d", &n); sum = ((n - 1) * n) / 2; printf("%d", sum * 12 + 1); return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main() { int n; int...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long m = n * (n - 1) * 6; if (n >= 1) { if (n == 1) cout << 1; else cout << m + 1; } return 0; }
### Prompt Construct a cpp code solution to the problem outlined: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << '\n'; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cout.write(nam...
### Prompt Develop a solution in Cpp to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; template <typena...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; --n; cout << 6 * n * (n + 1) + 1; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int ma...
#include <bits/stdc++.h> int main() { int a; scanf("%d", &a); long long ans = 1; for (int i = 1; i < a; ++i) ans += 12LL * i; printf("%I64d\n", ans); return 0; }
### Prompt Please create a solution in CPP to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> int main() { int a; scanf("%d", &...
#include <bits/stdc++.h> using namespace std; int a; int main() { cin >> a; cout << 6 * a * (a - 1) + 1 << endl; return 0; }
### Prompt Create a solution in Cpp for the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int a; int main() { ...
#include <bits/stdc++.h> using namespace std; long long val[18260]; void preproce() { val[1] = 1; for (int i = int(2); i < int(18258); i++) val[i] = val[i - 1] + 9 * (i - 1) + 3 * (i - 1); } int main() { preproce(); int n; scanf("%d", &n); cout << val[n] << endl; }
### Prompt Your challenge is to write a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long l...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long int dp[20000] = {0}; dp[1] = 1; for (int i = 2; i <= 18257; i++) dp[i] = dp[i - 1] + 12 * (i - 1); cout << dp[n] << endl; return 0; }
### Prompt Generate a Cpp solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n; ...
#include <bits/stdc++.h> using namespace std; template <typename Tp> inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") { for (Tp current = _begin; current != _end; ++current) { std::cout << *current << _delim; } std::cout << '\n'; } using ll = int64_t; using pii = std::pair<int, int>; constexpr...
### Prompt Your task is to create a CPP solution to the following problem: <image> Input The input contains a single integer a (1 ≤ a ≤ 18257). Output Print a single integer output (1 ≤ output ≤ 2·109). Examples Input 2 Output 13 ### Response ```cpp #include <bits/stdc++.h> using namespace std; template <...
#include <bits/stdc++.h> using namespace std; const int maxn = 5 * 1e5 + 1000; vector<int> G[maxn], ans[maxn]; set<int> s; set<int>::iterator ite; int num[maxn], cnt, res; void bfs(int x) { s.erase(x); queue<int> que; ans[res].push_back(x); que.push(x); cnt = 0; while (que.size()) { int cur = que.front(...
### Prompt Please create a solution in cpp to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if...
#include <bits/stdc++.h> using namespace std; vector<int> graph[500005]; set<int> all; int vis[500005]; vector<int> ans[500005]; vector<pair<int, int> > sequence; int n, m, x, y, i, cnt, k = 0; void graph_in() { scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d %d", &x, &y); graph[x].push_back(y);...
### Prompt Your challenge is to write a cpp solution to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between...
#include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long ret = 1; for (; e >...
### Prompt Please formulate a CPP solution to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if...
#include <bits/stdc++.h> using namespace std; int i, j, n, m; int ind[500010], last[1000100 * 2], e[1000100 * 2], t; void adde(int a, int b) { t++; e[t] = b; last[t] = ind[a]; ind[a] = t; } vector<int> nxt[2]; vector<int> pp; int ha[500010]; int que[500010], qt; int nt; struct Myset { int ind[500010]; int l...
### Prompt Your challenge is to write a cpp solution to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; vector<int> graf[maxn], pos[maxn]; int main() { int n, m; scanf("%d %d", &n, &m); while (m--) { int a, b; scanf("%d %d", &a, &b); graf[a].push_back(b); graf[b].push_back(a); } for (int i = 1; i <= n; ++i) sort(graf[i].begi...
### Prompt Develop a solution in Cpp to the problem described below: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if...
#include <bits/stdc++.h> using namespace std; const int maxn = 500010; int pa[maxn], sz[maxn]; vector<int> e[maxn]; set<int> grp, tmp; map<int, int> lft; int getpa(int u) { return u == pa[u] ? u : (pa[u] = getpa(pa[u])); } int main() { int n, m; while (~scanf("%d%d", &n, &m)) { grp.clear(); for (int i = 0; ...
### Prompt Please create a solution in CPP to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if...
#include <bits/stdc++.h> using namespace std; long long modpow(long long a, long long b, long long mod = (long long)(1e9 + 7)) { if (!b) return 1; a %= mod; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const...
### Prompt Please provide a cpp coded solution to the problem described below: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnt = 1.2e6 + 10; const int maxn3 = 1e3 + 10; const long long mod = 1e9 + 7; const long long inf = 2e18; int st, cmp[maxn5], nxt[maxn5], pre[maxn5]; vector<int> adj[maxn5], ver[maxn5]; bool mark[maxn5]; void...
### Prompt Please create a solution in Cpp to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if...
#include <bits/stdc++.h> using namespace std; vector<int> graph[500005]; set<int> all; int vis[500005]; vector<int> ans[500005]; vector<pair<int, int> > sequence; int n, m, x, y, i, cnt, k = 0; void graph_in() { scanf("%d %d", &n, &m); for (i = 0; i < m; i++) { scanf("%d %d", &x, &y); graph[x].push_back(y);...
### Prompt Your challenge is to write a Cpp solution to the following problem: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between...