Search is not available for this dataset
name
stringlengths 2
112
| description
stringlengths 29
13k
| source
int64 1
7
| difficulty
int64 0
25
| solution
stringlengths 7
983k
| language
stringclasses 4
values |
---|---|---|---|---|---|
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.util.*;
public class Main {
private static IO io;
public static void main(String[] args) throws IOException {
new Main().run();
}
private void run() throws IOException {
io = new IO(System.getProperty("ONLINE_JUDGE")!=null);
solve();
io.flush();
}
private void solve() throws IOException {
int n = io.nI(); long r = 0;
for(int i = 1; i<n; i++)r+=12*i;
io.wln(r+1);
}//2.2250738585072012e-308
@SuppressWarnings("unused")
private class IO{
StreamTokenizer in; PrintWriter out; BufferedReader br; Reader reader; Writer writer;
public IO(boolean oj) throws IOException{
Locale.setDefault(Locale.US);
reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");
writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");
br = new BufferedReader(reader);
in = new StreamTokenizer(br);
out = new PrintWriter(writer);
}
public void wln(){out.println();}
public void wln(int arg){out.println(arg);}
public void wln(long arg){out.println(arg);}
public void wln(double arg){out.println(arg);}
public void wln(String arg){out.println(arg);}
public void wln(boolean arg){out.println(arg);}
public void wln(char arg){out.println(arg);}
public void wln(float arg){out.println(arg);}
public void wln(Object arg){out.println(arg);}
public void w(int arg){out.print(arg);}
public void w(long arg){out.print(arg);}
public void w(double arg){out.print(arg);}
public void w(String arg){out.print(arg);}
public void w(boolean arg){out.print(arg);}
public void w(char arg){out.print(arg);}
public void w(float arg){out.print(arg);}
public void w(Object arg){out.print(arg);}
public void wf(String format, Object...args){out.printf(format, args);}
public void flush(){out.flush();}
public int nI() throws IOException {in.nextToken(); return(int)in.nval;}
public long nL() throws IOException {in.nextToken(); return(long)in.nval;}
public String nS() throws IOException {in.nextToken(); return in.sval;}
public double nD() throws IOException {in.nextToken(); return in.nval;}
public float nF() throws IOException {in.nextToken(); return (float)in.nval;}
public void wc(char...a){for(char c : a){in.ordinaryChar(c);in.wordChars(c, c);}}
public void wc(char c1, char c2){in.ordinaryChars(c1, c2); in.wordChars(c1, c2);}
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, res = 0;
cin >> n;
for (int i = n; i >= 2; i--) res += (12 * (i - 1));
res += 1;
cout << res << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int ans = ((n - 1) * (n)) / 2;
ans *= 12;
ans++;
cout << ans << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, ans = 1;
cin >> a;
for (int i = 0; i < a; i++) {
ans += i * 12;
}
cout << ans;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.util.Scanner;
public class Main {
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
while (cin.hasNext()){
long a = cin.nextLong();
long r = f(a);
System.out.println(r);
}
}
public static long f(long a){
return 6 * a * a - 6 * a + 1;
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, i, sum = 0;
cin >> a;
for (i = 1; i <= a; i++) {
if (i == 1)
sum = sum + 1;
else
sum = sum + 12 * (i - 1);
}
cout << sum;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.util.*;
import java.util.List;
public class Main2 {
private static StringTokenizer st;
private static BufferedReader br;
public static void print(Object x) {
System.out.println(x + "");
}
public static String join(List<?> x, String space) {
StringBuilder sb = new StringBuilder();
for (Object elt : x) {
sb.append(elt);
sb.append(space);
}
return sb.toString();
}
public static String nextToken() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine().trim());
}
return st.nextToken();
}
public static int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
public static String solve(long n) {
long total = 1;
long mult = 2;
for (int i = 1; i < n; i++) {
total += (6 * mult);
mult += 2;
}
return total + "";
}
public static void main(String[] args) throws Exception {
boolean debug = false;
InputStream in = System.in;
if (debug) {
in = new FileInputStream("input.in");
}
br = new BufferedReader(new InputStreamReader(in));
int n = nextInt();
print(solve(n));
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
inline bool ascending(int i, int j) { return (i < j); }
inline bool descending(int i, int j) { return (i > j); }
const int MN = (1e5) + 10;
int comp(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
bool cmp(int a, int b) { return a > b; }
int main() {
int n;
int64_t res, temp;
cin >> n;
temp = 3 * (n - 1) + 1;
cout << (temp * (temp + 1) / 2) + (3 * n * (n - 1) / 2);
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
printf("%d\n", 6 * n * (n - 1) + 1);
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1 << "\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.util.*;
public class Star {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
cin.close();
System.out.print(n * (n - 1) * 6 + 1);
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | def tri_len(n):
return 3*n-2
def triangle(n):
return (n*(n+1))//2
def star(n):
l = tri_len(n)
return triangle(n-1)*3 + triangle(l)
print(star(int(input()))) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
int main() {
int a, n = 1;
scanf("%d", &a);
for (int i = 1; i < a; i++) n += 12 * i;
printf("%d", n);
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1 + 4;
map<string, string> maap;
vector<int> circle;
bool vis[N];
int parent[N];
int chk[N];
int color[N];
int tim[2][N];
int dis[N];
int position[N];
vector<int> adj[N];
vector<int> adj1[N];
vector<int> graph[N];
bool has_cycle;
int maxdis, maxnode, Totnode, depth = 1;
bool ok;
queue<int> q;
stack<int> stk;
vector<int> solution;
int indegree[N];
int go[N];
int to[N];
map<int, int> mp1;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
int t;
int cas = 0;
int n, m, i, j, cnt1 = 0, cnt2 = 0, cnt = 0, even = 0, odd = 0, len, k, r, l,
z = 0, x = 0, y = 0, flag = 0, sum = 0;
int a = 0, b = 0, c = 0, d = 0, ans = 0LL, rem, quot, zero = 0, fst = 0,
null = 0, snd = 0, lst = 0, rone = 0, one = 0, pos = 0, neg = 0,
mn = INT_MAX, mx = INT_MIN;
char ch;
int h1, h2, m1, m2, h;
int velo1, velo2, ac1, ac2, time;
int node, edge, u, v, cost;
int best, worst;
double nd, ad, bd, xd;
string str, str1 = "", str2 = "", str3 = "", strstore1 = "", strstore2 = "";
cin >> n;
for (int i = 1; i <= n; i++) {
x += (i - 1) * 12;
}
cout << x + 1 << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b;
long long s, d, i, n, t;
cin >> n;
t = 1;
d = 12;
if (n == 1) {
cout << 1;
return 0;
}
for (i = 0; i < n - 1; i++) {
t = t + d;
d = d + 12;
}
cout << t;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int sky(int n) {
int count = 1, acount = 12;
if (n == 1) return 1;
if (n >= 2) {
count += acount;
for (int i = 2; i < n; i++) {
count += (acount * i);
}
}
return count;
}
int main() {
int n;
cin >> n;
cout << sky(n) << endl;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
int ans = a * (a - 1) / 2;
cout << ans * 12 + 1;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1) {
cout << 1 << endl;
return 0;
}
int ans = 13;
for (int i = 3; i <= n; i++) {
ans += (2 * (i - 1) - 1) * 6 + 6;
}
cout << ans << endl;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.util.Scanner;
public class Star {
private static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
int a = in.nextInt();
int ret = 6*a*a - 6*a + 1;
System.out.println(ret);
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | n = int(input())
ans = 1
for i in range(1, n):
ans += (i*12)%2000000000
print(ans) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long a, b = 1;
cin >> a;
if (a > 1) {
for (int i = 1; i < a; i++) {
b += (2 * i - 1) * 6 + 6;
}
}
cout << b << endl;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using LL = long long;
using ULL = unsigned long long;
using LLL = __int128;
using ULLL = unsigned __int128;
namespace std {
void swap(int& x, int& y) { x ^= (y ^= (x ^= y)); }
void swap(LL& x, LL& y) { x ^= (y ^= (x ^= y)); }
}; // namespace std
using std::swap;
template <typename T, typename P>
inline auto max(const T& x, const P& y) -> decltype(x < y ? y : x) {
return x < y ? y : x;
}
template <typename T, typename P>
inline auto min(const T& x, const P& y) -> decltype(x < y ? x : y) {
return x < y ? x : y;
}
template <typename T, typename... Args>
inline auto max(const T& x, const Args&... args)
-> decltype(max(x, max(args...))) {
return max(x, max(args...));
}
template <typename T, typename... Args>
inline auto min(const T& x, const Args&... args)
-> decltype(min(x, min(args...))) {
return min(x, min(args...));
}
template <typename T>
inline T max(const T& x) {
return x;
}
template <typename T>
inline T min(const T& x) {
return x;
}
template <typename T, typename... Args>
inline void chkmax(T& d, const Args&... args) {
d = max(d, args...);
}
template <typename T, typename... Args>
inline void chkmin(T& d, const Args&... args) {
d = min(d, args...);
}
class IO {
static const int MAXSIZE = 1 << 20;
char buf[MAXSIZE], *p1, *p2;
char pbuf[MAXSIZE], *pp;
long double eps = 1e-8L;
LLL pow10 = 1000000;
int precision;
FILE *infile, *outfile;
public:
IO(FILE* in = nullptr, FILE* out = nullptr)
: precision(6), infile(in), outfile(out) {
p1 = p2 = buf;
pp = pbuf;
}
~IO() { fwrite(pbuf, 1, pp - pbuf, outfile); }
inline static bool blank(char ch);
inline void flush();
inline void input(const char* str);
inline void output(const char* str);
inline void input(FILE* f);
inline void output(FILE* f);
inline int getch();
template <typename T, typename... Args>
bool read(T& x, Args&... args);
inline bool read();
template <typename T>
typename std::enable_if<
std::is_integral<T>::value || std::is_floating_point<T>::value ||
std::is_same<T, LLL>::value || std::is_same<T, ULLL>::value,
bool>::type
read(T& x);
bool read(char& ch);
bool read(char* s);
bool readline(char* s);
inline void putch(const char c);
inline void putback(const char c);
inline void setprecision(int n = 6);
template <typename T, typename... Args>
void write(const T& x, const Args&... args);
inline void write();
template <typename T>
typename std::enable_if<std::is_integral<T>::value ||
std::is_same<T, LLL>::value ||
std::is_same<T, ULLL>::value,
void>::type
write(T x);
inline void write(char c);
template <typename T>
typename std::enable_if<std::is_floating_point<T>::value, void>::type write(
T x);
inline void write(bool x);
void write(char* s);
void write(const char* s);
template <typename... Args>
void writeln(Args... x) {
write(x...), putch('\n');
}
} io(stdin, stdout), err(nullptr, stderr);
template <typename... Args>
inline void writeln(Args... x) {
io.write(x...), io.putch('\n');
}
int main() {
int n;
io.read(n);
writeln(6 * n * (n - 1) + 1);
return 0;
}
inline bool IO::blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void IO::flush() {
fwrite(pbuf, 1, pp - pbuf, outfile), pp = pbuf;
fflush(outfile);
}
inline void IO::input(const char* str) {
FILE* file = fopen(str, "rb");
infile = file;
}
inline void IO::output(const char* str) {
FILE* file = fopen(str, "wb");
outfile = file;
}
inline void IO::input(FILE* f) { infile = f; }
inline void IO::output(FILE* f) { outfile = f; }
inline int IO::getch() {
return (p1 == p2 ? (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, infile)) : 0),
(p1 == p2) ? EOF : *p1++;
}
inline void IO::putback(const char c) { *(--p1) = c; }
template <typename T, typename... Args>
bool IO::read(T& x, Args&... args) {
return read(x) && read(args...);
}
inline bool IO::read() { return true; }
template <typename T>
typename std::enable_if<
std::is_integral<T>::value || std::is_floating_point<T>::value ||
std::is_same<T, LLL>::value || std::is_same<T, ULLL>::value,
bool>::type
IO::read(T& x) {
T tmp = 1;
bool sign = false;
x = 0;
int ch = getch();
for (; !(ch >= '0' && ch <= '9') && ~ch; ch = getch())
if (ch == '-') sign = true;
if (!(~ch)) return false;
for (; (ch >= '0' && ch <= '9'); ch = getch()) x = x * 10 + (ch - '0');
if (ch == '.' && std::is_floating_point<T>::value)
for (ch = getch(); (ch >= '0' && ch <= '9'); ch = getch())
tmp /= 10.0, x += tmp * (ch - '0');
if (~ch) putback(ch);
if (sign) x = -x;
return true;
}
bool IO::read(char& ch) {
for (ch = getch(); blank(ch) && ~ch; ch = getch())
;
return ~ch;
}
bool IO::read(char* s) {
int ch = getch();
while (blank(ch)) ch = getch();
if (!(~ch)) return false;
while (!blank(ch) && ~ch) *s++ = ch, ch = getch();
*s = 0;
if (~ch) putback(ch);
return true;
}
bool IO::readline(char* s) {
int ch = getch();
while (blank(ch) && ch != '\n') ch = getch();
if (!(~ch)) return false;
while (ch != '\n' && ~ch) *s++ = ch, ch = getch();
*s = 0;
if (~ch) putback(ch);
return true;
}
inline void IO::putch(const char c) {
((pp - pbuf == MAXSIZE) ? fwrite(pbuf, 1, MAXSIZE, outfile), pp = pbuf : 0),
*pp++ = c;
}
inline void IO::setprecision(int n) {
precision = n;
eps = powl(10.0L, -precision - 2);
pow10 = powl(10.0L, precision) + eps;
}
template <typename T, typename... Args>
void IO::write(const T& x, const Args&... args) {
write(x);
write(args...);
}
inline void IO::write() {}
template <typename T>
typename std::enable_if<std::is_integral<T>::value ||
std::is_same<T, LLL>::value ||
std::is_same<T, ULLL>::value,
void>::type
IO::write(T x) {
if (x < 0) x = ~x + 1, putch('-');
static T sta[100];
int top = 0;
do sta[top++] = x % 10, x /= 10;
while (x);
while (top) putch(sta[--top] + '0');
}
inline void IO::write(bool x) { putch(x ^ 48); }
inline void IO::write(char c) { putch(c); }
template <typename T>
typename std::enable_if<std::is_floating_point<T>::value>::type IO::write(T x) {
if (x == 0) {
putch('0'), putch('.');
for (int i = 1; i <= precision; i++) putch('0');
return;
}
if (x < 0) putch('-'), x = -x;
T res = (LLL)(x * pow10 + 0.5) / (pow10 * 1.0);
LLL y = LLL(res * pow10 + eps) % pow10;
write(LLL(res + eps));
if (precision) {
putch('.');
static int sta[100], p = 0;
for (; p < precision; y /= 10) sta[++p] = y % 10;
for (int i = p; i >= 1; i--) putch(sta[i] ^ 48);
}
}
void IO::write(char* s) {
while (*s) putch(*s++);
}
void IO::write(const char* s) {
while (*s) putch(*s++);
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int ret[20000];
int main() {
int a;
ret[1] = 1;
ret[2] = 13;
for (int i = 3; i <= 18257; i++) ret[i] = ret[i - 1] + 6 * ((i - 1) * 2);
scanf("%d", &a);
printf("%d\n", ret[a]);
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | n=input()
print 6*n*(n-1)+1
| PYTHON |
171_B. Star | <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 | 2 | 8 | //referred professors code
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Star {
static int triangle(int n) {
return n*(n+1)/2;
}
static int hexagon(int n) {
return triangle(n)*6-n*6+1;
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
System.out.println(triangle(n*3-2)*2-hexagon(n));
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | import math
import queue
from itertools import permutations
n=int(input())
if n==1:
print(1)
else:
print((6*n*(n-1)+1)) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | import java.util.*;
import java.util.zip.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import static java.util.Arrays.sort;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class Main {
private void solve() throws Exception {
int n=in.nextInt();
if (n==1){
out.println(1);
} else if(n==2) {
out.println(13);
} else {
int s=13;
int d=1;
for(int i=3; i <= n; ++i) {
s += d*6 + 6 * 3;
d += 2;
}
out.println(s);
}
}
private void run() {
try {
long start = System.currentTimeMillis();
in = new FastScanner("input.txt", "output.txt");
solve();
out.flush();
System.err.print("\n\nrunning time = " + (System.currentTimeMillis() - start) * 1e-3);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Main main = new Main();
main.run();
}
FastScanner in;
static PrintWriter out;
static class FastScanner {
public BufferedReader reader;
private StringTokenizer tokenizer;
public FastScanner(String input, String output) {
try {
reader = new BufferedReader(new FileReader(new File(input)));
out = new PrintWriter(new File(output));
tokenizer = null;
} catch (Exception e) {
reader = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
tokenizer = null;
}
}
public String nextToken() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (Exception e) {
e.printStackTrace();
}
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(nextToken());
}
long nextLong() {
return Long.parseLong(nextToken());
}
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a;
cin >> a;
long long s = 1;
int i;
for (i = 1; i <= a; ++i) s += (12 * i - 12);
cout << s;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int m;
while (cin >> m)
cout << ((m * 3 - 1) * (m * 3 - 2) + 3 * m * (m - 1)) / 2 << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n;
cin >> n;
cout << 6 * n * (n - 1) + 1 << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.util.*;
public class B{
public static void main(String[] args) {
Read in = new Read();
int input;
long out;
input = in.nextInt();
out = 6*(input)*(input-1) + 1;
System.out.println(out);
}
static class Read {
BufferedReader br;
StringTokenizer st;
public Read()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int a = input.nextInt();
System.out.println((a * (a - 1) * 6) + 1);
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | def starNumber(n):
star = [0] * n
star[0] = 1
for i in range(1, n):
star[i] = star[i - 1] + 12 * (i + 1) - 12
return star[n - 1]
n = int(input())
print(starNumber(n))
| PYTHON3 |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smn(T &a, const T &b) {
if (b < a) a = b;
}
template <class T>
inline void smx(T &a, const T &b) {
if (b > a) a = b;
}
template <class T>
inline T rev(const T &a) {
T _ = a;
reverse(_.begin(), _.end());
return _;
}
const double eps = 1e-9;
const long double leps = 1e-14;
long long res, n, t;
int main(int argc, char *argv[]) {
ios_base::sync_with_stdio(false);
cin >> n;
t = 1 + (n - 1) * 3;
res = t * (t + 1);
for (int i = 0; i < n; i++)
if (i == n - 1)
res -= n + i;
else
res -= 2 * (n + i);
cout << res << '\n';
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
int main() {
int n, y;
scanf("%d", &n);
y = 6 * n * n - 6 * n + 1;
printf("%d", y);
}
| CPP |
171_B. Star | <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 | 2 | 8 | //package codeforces;//package codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class StarNumber {
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
}
return st.nextToken();
}
String nextLine() {
try {
return br.readLine();
} catch (IOException e) {
e.printStackTrace();
return "";
}
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
public static void main(String[] args) {
PrintWriter out=new PrintWriter(System.out);
FastScanner sc = new FastScanner();
long n = sc.nextLong();
out.println(6*n*(n-1)+1);
out.close();
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long tri(long long n) { return n * (n + 1) / 2; }
int main() {
long long n;
cin >> n;
cout << tri(3 * n - 2) + 3 * tri(n - 1) << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
const long long inf = 1000000000;
const long long inf64 = inf * inf;
const double pi = acos(-1.0);
long long Abs(long long x) { return (x >= 0 ? x : -x); }
using namespace std;
bool solve() {
long long a;
cin >> a;
vector<long long> dp(a + 2);
dp[1] = 1;
dp[2] = 13;
for (int i(3); i <= a; i++)
dp[i] = (2 * i - 1) * 3 + (2 * (i - 1) - 1) * 3 + dp[i - 1];
cout << dp[a] << '\n';
return true;
}
int main() {
solve();
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline int read() {
char c = getchar();
int x = 0;
bool f = 0;
for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
if (f) x = -x;
return x;
}
int n;
int main() {
n = read();
cout << ((n << 1) - 1) * ((n << 1) - 1) + (n - 1) * n * 2;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.PrintWriter;
import java.util.Scanner;
public class First {
static Scanner in; static int next() throws Exception {return in.nextInt();};
// static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
// static BufferedReader in;
static PrintWriter out;
public static void main(String[] args) throws Exception {
in = new Scanner(System.in);
// in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
// in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
int n = next();
int res = 1;
for (int i = 0;i < n;i++) res += i*12;
out.println(res);
out.println();
out.close();
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
int main() {
long long int a, i, ans = 1;
scanf("%lld", &a);
for (i = 2; i <= a; i++) {
ans += 12 * (i - 1);
}
printf("%lld\n", ans);
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | a=input()
c=0
b=1
for i in range (a-1):
b+=6*(i+2)+c
c=6*(i+1)
print b
| PYTHON |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | n=int(input())
summ=0
for i in range(n):
summ+=12*i
print(1+summ) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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 n, i;
cin >> n;
n = 6 * n * (n - 1) + 1;
cout << n;
cout << '\n';
}
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
int main(void) {
int n;
scanf("%d", &n);
printf("%d\n", (6 * n * (n - 1) + 1));
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.util.Scanner;
public class B {
public static void main(String[] args) {
long[] nums = new long[18258];
nums[1] = 1;
for(int i = 2; i < nums.length; i++)
nums[i] = 12 * (i - 1);
for(int i = 2; i < nums.length; i++)
nums[i] += nums[i-1];
Scanner in = new Scanner(System.in);
int a = in.nextInt();
System.out.println(nums[a]);
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | n = int(raw_input())
print 1+n*(n-1)*6 | PYTHON |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << (n * 6) * (n - 1) + 1;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.math.BigInteger;
import java.util.Hashtable;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Hashtable<BigInteger, BigInteger> tabla = new Hashtable<BigInteger, BigInteger>();
tabla.put(new BigInteger("1"), new BigInteger("1"));
tabla.put(new BigInteger("2"), new BigInteger("13"));
for (int i = 3; i <= 18257; i++) {
BigInteger a=tabla.get(new BigInteger(String.valueOf(i-1)));
BigInteger f=new BigInteger("12").multiply(new BigInteger((i-1)+""));
tabla.put(new BigInteger(String.valueOf(i)),a.add(f));
}
int n = scan.nextInt();
System.out.println(tabla.get(new BigInteger(n+"")));
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package codeforces;
import java.util.Scanner;
/**
*
* @author DELL
*/
public class Star {
public static void solve(){
Scanner nera = new Scanner(System.in);
int n = nera.nextInt();
if(n==1){
System.out.println("1");
}else if(n==2){
System.out.println("13");
}else{
// System.out.println(((n-1)/2)*(24+(n-2)*12)+1);
System.out.println(6*(n-1)*(1+n-1)+1);
}
}
public static void main(String[] args) {
solve();
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << (6 * n * (n - 1)) + 1 << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int f = scan.nextInt();
long ans = 0;
for (; f > 1; f--) {
ans += (f - 1) * 12;
}
System.out.println(ans + 1);
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << (6 * n * (n - 1) + 1) << "\n";
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | n = int(input())
print(6*(n-1)*n+1) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | __author__ = 'MARI'
def main():
a = int(input())
print(1 + 12*(a*(a-1)//2))
if __name__ == '__main__':
import sys
argv = sys.argv
main()
| PYTHON3 |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #!/usr/bin/env python
from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
# sys.setrecursionlimit(10**5)
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
# sys.setrecursionlimit(10**6)
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
"""Prints the values to a stream, or to sys.stdout by default."""
sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
at_start = True
for x in args:
if not at_start:
file.write(sep)
file.write(str(x))
at_start = False
file.write(kwargs.pop("end", "\n"))
if kwargs.pop("flush", False):
file.flush()
if sys.version_info[0] < 3:
sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
def inp(): return sys.stdin.readline().rstrip("\r\n") # for fast input
def out(var): sys.stdout.write(str(var)) # for fast output, always take string
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
def fsep(): return map(float, inp().split())
def inpu(): return int(inp())
# -----------------------------------------------------------------
def regularbracket(t):
p = 0
for i in t:
if i == "(":
p += 1
else:
p -= 1
if p < 0:
return False
else:
if p > 0:
return False
else:
return True
# -------------------------------------------------
def binarySearchCount(arr, n, key):
left = 0
right = n - 1
count = 0
while (left <= right):
mid = int((right + left) / 2)
# Check if middle element is
# less than or equal to key
if (arr[mid] <= key):
count = mid + 1
left = mid + 1
# If key is smaller, ignore right half
else:
right = mid - 1
return count
# ------------------------------reverse string(pallindrome)
def reverse1(string):
pp = ""
for i in string[::-1]:
pp += i
if pp == string:
return True
return False
# --------------------------------reverse list(paindrome)
def reverse2(list1):
l = []
for i in list1[::-1]:
l.append(i)
if l == list1:
return True
return False
def mex(list1):
# list1 = sorted(list1)
p = max(list1) + 1
for i in range(len(list1)):
if list1[i] != i:
p = i
break
return p
def sumofdigits(n):
n = str(n)
s1 = 0
for i in n:
s1 += int(i)
return s1
def perfect_square(n):
s = math.sqrt(n)
if s == int(s):
return True
return False
# -----------------------------roman
def roman_number(x):
if x > 15999:
return
value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
symbol = ["F", "MF", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
roman = ""
i = 0
while x > 0:
div = x // value[i]
x = x % value[i]
while div:
roman += symbol[i]
div -= 1
i += 1
return roman
def soretd(s):
for i in range(1, len(s)):
if s[i - 1] > s[i]:
return False
return True
# print(soretd("1"))
# ---------------------------
def countRhombi(h, w):
ct = 0
for i in range(2, h + 1, 2):
for j in range(2, w + 1, 2):
ct += (h - i + 1) * (w - j + 1)
return ct
def countrhombi2(h, w):
return ((h * h) // 4) * ((w * w) // 4)
# ---------------------------------
def binpow(a, b):
if b == 0:
return 1
else:
res = binpow(a, b // 2)
if b % 2 != 0:
return res * res * a
else:
return res * res
# -------------------------------------------------------
def binpowmodulus(a, b, m):
a %= m
res = 1
while (b > 0):
if (b & 1):
res = res * a % m
a = a * a % m
b >>= 1
return res
# -------------------------------------------------------------
def coprime_to_n(n):
result = n
i = 2
while (i * i <= n):
if (n % i == 0):
while (n % i == 0):
n //= i
result -= result // i
i += 1
if (n > 1):
result -= result // n
return result
# -------------------prime
def prime(x):
if x == 1:
return False
else:
for i in range(2, int(math.sqrt(x)) + 1):
if (x % i == 0):
return False
else:
return True
def luckynumwithequalnumberoffourandseven(x, n, a):
if x >= n and str(x).count("4") == str(x).count("7"):
a.append(x)
else:
if x < 1e12:
luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
return a
def luckynuber(x, n, a):
p = set(str(x))
if len(p) <= 2:
a.append(x)
if x < n:
luckynuber(x + 1, n, a)
return a
#------------------------------------------------------interactive problems
def interact(type, x):
if type == "r":
inp = input()
return inp.strip()
else:
print(x, flush=True)
#------------------------------------------------------------------zero at end of factorial of a number
def findTrailingZeros(n):
# Initialize result
count = 0
# Keep dividing n by
# 5 & update Count
while (n >= 5):
n //= 5
count += n
return count
#-----------------------------------------------merge sort
# Python program for implementation of MergeSort
def mergeSort(arr):
if len(arr) > 1:
# Finding the mid of the array
mid = len(arr) // 2
# Dividing the array elements
L = arr[:mid]
# into 2 halves
R = arr[mid:]
# Sorting the first half
mergeSort(L)
# Sorting the second half
mergeSort(R)
i = j = k = 0
# Copy data to temp arrays L[] and R[]
while i < len(L) and j < len(R):
if L[i] < R[j]:
arr[k] = L[i]
i += 1
else:
arr[k] = R[j]
j += 1
k += 1
# Checking if any element was left
while i < len(L):
arr[k] = L[i]
i += 1
k += 1
while j < len(R):
arr[k] = R[j]
j += 1
k += 1
#-----------------------------------------------lucky number with two lucky any digits
res = set()
def solve(p, l, a, b,n):#given number
if p > n or l > 10:
return
if p > 0:
res.add(p)
solve(p * 10 + a, l + 1, a, b,n)
solve(p * 10 + b, l + 1, a, b,n)
# problem
"""
n = int(input())
for a in range(0, 10):
for b in range(0, a):
solve(0, 0)
print(len(res))
"""
#-----------------------------------------------
# endregion------------------------------
"""
def main():
n = inpu()
cnt=0
c = n
if n % 7 == 0:
print("7" * (n // 7))
else:
while(c>0):
c-=4
cnt+=1
if c%7==0 and c>=0:
#print(n,n%4)
print("4"*(cnt)+"7"*(c//7))
break
else:
if n % 4 == 0:
print("4" * (n // 4))
else:
print(-1)
if __name__ == '__main__':
main()
"""
"""
def main():
n,t = sep()
arr = lis()
i=0
cnt=0
min1 = min(arr)
while(True):
if t>=arr[i]:
cnt+=1
t-=arr[i]
i+=1
else:
i+=1
if i==n:
i=0
if t<min1:
break
print(cnt)
if __name__ == '__main__':
main()
"""
# Python3 program to find all subsets
# by backtracking.
# In the array A at every step we have two
# choices for each element either we can
# ignore the element or we can include the
# element in our subset
def subsetsUtil(A, subset, index,d):
print(*subset)
s = sum(subset)
d.append(s)
for i in range(index, len(A)):
# include the A[i] in subset.
subset.append(A[i])
# move onto the next element.
subsetsUtil(A, subset, i + 1,d)
# exclude the A[i] from subset and
# triggers backtracking.
subset.pop(-1)
return d
def subsetSums(arr, l, r,d, sum=0):
if l > r:
d.append(sum)
return
subsetSums(arr, l + 1, r,d, sum + arr[l])
# Subset excluding arr[l]
subsetSums(arr, l + 1, r,d, sum)
return d
"""
def main():
t = inpu()
for _ in range(t):
n = inpu()
arr=[]
subset=[]
i=0
l=[]
for j in range(26):
arr.append(3**j)
if __name__ == '__main__':
main()
"""
def main():
n = int(input())
cnt=1
if n==1:
print(1)
else:
for i in range(1,n):
cnt+=i*12
print(cnt)
if __name__ == '__main__':
main()
| PYTHON3 |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #!/usr/bin/python2
a = int(raw_input())
ans = sum(range(a, a + a)) + sum(range(a, a + a - 1))
ans += sum(range(1, a)) * 6
print ans | PYTHON |
171_B. Star | <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 | 2 | 8 | a = input()
print 1 + 6*(a-1)*a
| PYTHON |
171_B. Star | <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 | 2 | 8 | #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;
ans += arr[i];
}
cout << ans << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | n = int(input())
ans = 1
for i in range(1, n):
ans += 12 * i
print(ans) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | #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 ? abs(n1) : gcd(n2, n1 % n2);
}
inline long long lcm(long long n1, long long n2) {
return n1 == 0 || n2 == 0 ? 0 : abs(n1 * (n2 / gcd(n1, n2)));
}
map<int, int> mapi;
bool comp(pair<int, int> p1, pair<int, int> p2) {
return p1.second > p2.second;
}
class mycomparison {
bool reverse;
public:
mycomparison(const bool& revparam = false) { reverse = revparam; }
bool operator()(const pair<int, int>& lhs, const pair<int, int>& rhs) const {
if (reverse)
return (lhs.second < rhs.second);
else
return (lhs.second > rhs.second);
}
};
int main() {
int n;
cin >> n;
cout << (6 * n * (n - 1) + 1) << endl;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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";
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | a = int(input())
x = 1
for i in xrange(1,a):
x += (i)*12
print x | PYTHON |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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 long int>(ostream &out,
const vector<long long int> &V);
void print(const vector<long long int> &V, long long int n);
template <class T>
ostream &operator<<(ostream &out, const set<T> &S);
template <class T>
ostream &operator<<(ostream &out, const unordered_set<T> &S);
template <class P, class Q>
ostream &operator<<(ostream &out, const map<P, Q> &S);
template <class P, class Q>
ostream &operator<<(ostream &out, const unordered_map<P, Q> &S);
template <class P, class Q>
ostream &operator<<(ostream &out, const pair<P, Q> &p) {
cout << "[" << p.first << "," << p.second << "]";
return out;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &V) {
for (long long int i = 0; i < V.size(); i++) {
cout << V[i] << " ";
}
return out;
}
template <>
ostream &operator<<<long long int>(ostream &out,
const vector<long long int> &V) {
for (long long int i = 0; i < V.size(); i++) {
if (V[i] >= nlyinf) {
cout << "inf ";
} else {
cout << V[i] << " ";
}
}
return out;
}
template <class T>
void print(const vector<T> &V, long long int n, bool newline = false) {
for (long long int i = 0; i < n; i++) {
cout << V[i];
if (newline) {
cout << '\n';
} else {
cout << " ";
}
}
}
void print(const vector<long long int> &V, long long int n) {
for (long long int i = 0; i < n; i++) {
if (V[i] >= nlyinf) {
cout << "inf";
} else {
cout << V[i];
}
cout << " ";
}
}
template <class T>
ostream &operator<<(ostream &out, const set<T> &S) {
cout << "{";
for (typename set<T>::const_iterator it = S.begin(); it != S.end(); ++it) {
cout << (*it);
if (next(it, 1) != S.end()) cout << ",";
}
cout << "}";
return out;
}
template <class T>
ostream &operator<<(ostream &out, const unordered_set<T> &S) {
cout << "{";
for (typename unordered_set<T>::const_iterator it = S.begin(); it != S.end();
++it) {
cout << (*it);
if (next(it, 1) != S.end()) cout << ",";
}
cout << "}";
return out;
}
template <class P, class Q>
ostream &operator<<(ostream &out, const map<P, Q> &S) {
cout << "{";
for (typename map<P, Q>::const_iterator it = S.begin(); it != S.end(); ++it) {
cout << (*it);
if (next(it, 1) != S.end()) cout << ",";
}
cout << "}";
return out;
}
template <class P, class Q>
ostream &operator<<(ostream &out, const unordered_map<P, Q> &S) {
cout << "{";
for (typename unordered_map<P, Q>::const_iterator it = S.begin();
it != S.end(); ++it) {
cout << (*it);
if (next(it, 1) != S.end()) cout << ",";
}
cout << "}";
return out;
}
int main() {
ios::sync_with_stdio(false);
long long int n, ans = 1;
cin >> n;
long long int k = 2;
for (long long int i = 2; i <= n; i++) {
ans += (k) * (6);
k += 2;
}
cout << ans;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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.tie(0);
cout.tie(0);
int n;
while (cin >> n) {
n--;
long long ans = 1 + (n * (n + 1) * 6);
cout << ans << endl;
}
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
new Main().run();
}
// BufferedReader in;
// PrintWriter out;
//
// void run() throws IOException
// {
// in = new BufferedReader(new InputStreamReader(System.in));
// out = new PrintWriter(new OutputStreamWriter(System.out));
// solve();
// out.flush();
// }
StreamTokenizer in;
PrintWriter out;
String nextString() throws IOException
{
in.nextToken();
return (String)in.sval;
}
int nextInt() throws IOException
{
in.nextToken();
return (int)in.nval;
}
void run() throws IOException
{
in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
out = new PrintWriter(new OutputStreamWriter(System.out));
solve();
out.flush();
}
//
// void solve() throws IOException
// {
// int w = nextInt();
// int h = nextInt();
// int n = nextInt();
// int mas[][] = new int[n][2];
// int mas1[][] = new int[n][3];
// int w1 = 0;
// int h1 = 0;
// int w2 = 0;
// int h2 = 0;
// boolean t = true;
// for (int i=0; i<n; i++){
// mas[i][0] = nextInt();
// mas[i][1] = nextInt();
// }
//
//// for(int i=0; i<n; i++){
//// mas1[i][0]=mas[i][0];
//// mas1[i][1]=mas[i][1];
//// }
//// for (int k=0; k<mas.length-1; k++){
//// if (mas1[k][0]<mas1[k+1][0]){
//// int t =mas1[k][0];
//// mas1[k][0]=mas1[k+1][0];
//// mas1[k][1]=mas1[k+1][1];
//// mas1[k][2]=k+1;
//// mas1[k+1][0]=t;
//// }
//// }
//// for(int i=0; i<n; i++){
//// out.println(mas1[i][0]+" "+mas1[i][1]+" "+mas1[i][2]);
//// }
// if(w>h){
// if(mas[0][0]>mas[0][1]){
// out.println(w1+" "+h1+" "+mas[0][1]+" "+mas[0][0]);
// w1 = mas[0][1];
// }else{
// out.println(w1+" "+h1+" "+mas[0][0]+" "+mas[0][1]);
// w1 = mas[0][0];
// }
// for(int i=0; i<n-1; i++){
//
// if(mas[i+1][0]>mas[i+1][1]){
// if (w1+mas[i+1][0]>=w){out.println(-1+" "+-1+" "+-1+" "+-1);} else{
// out.println(w1+" "+h1+" "+(w1+mas[i+1][0])+" "+(h1+mas[i+1][1]));
// w1 = w1+ mas[i+1][0];
// }
// }else{
// if (w1+mas[i+1][1]>=w){out.println(-1+" "+-1+" "+-1+" "+-1);}else{
// out.println(w1+" "+h1+" "+(w1+mas[i+1][1])+" "+(h1+mas[i+1][0]));
// w1 = w1+ mas[i+1][1];}
// if(h1>=h){out.println(-1+" "+-1+" "+-1+" "+-1);}
// }
// }
//
// }else{
// out.println(w1+" "+h1+" "+mas[0][0]+" "+mas[0][1]);
// w1 = mas[0][0];
// for(int i=0; i<n-1; i++){
//
// if(mas[i+1][0]>mas[i+1][1]){
// if (w1+mas[i+1][0]>=w){out.println(-1+" "+-1+" "+-1+" "+-1);} else{
// out.println(w1+" "+h1+" "+(w1+mas[i+1][0])+" "+(h1+mas[i+1][1]));
// w1 = w1+ mas[i+1][0];
// }
// }else{
// if (w1+mas[i+1][1]>=w){out.println(-1+" "+-1+" "+-1+" "+-1);}else{
// out.println(w1+" "+h1+" "+(w1+mas[i+1][1])+" "+(h1+mas[i+1][0]));
// w1 = w1+ mas[i+1][1];}
// if(h1>=h){out.println(-1+" "+-1+" "+-1+" "+-1);}
// }
//
// }
// }
//
// }
// }
// BufferedReader in;
// PrintWriter out;
//
// void run() throws IOException
// {
// in = new BufferedReader(new InputStreamReader(System.in));
// out = new PrintWriter(new OutputStreamWriter(System.out));
// solve();
// out.flush();
// }
void solve() throws IOException
{
int n = nextInt();
int k = 3;
int u = 13;
if (n==1){out.println(1);}else{
if (n==2){out.println(13);}else{
// int m = (3+(n-2)*2)*3;
// int p = (3+(n-3)*2)*3;
for(int i=3; i<n+1; i++){
u = u + (3+(i-2)*2)*3 + (3+(i-3)*2)*3;
//out.println(u);
}
out.println(u);
}}}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | def suma (i,j):
if j<i:
return 0
return ((i+j)*(j-i+1))//2
def odpowiedz(n):
return 1+12*suma(1,n-1)
txt = raw_input()
n = int(txt)
print odpowiedz(n)
| PYTHON |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.util.*;
public class Main {
public Scanner sc;
public void run() {
int n = sc.nextInt();
System.out.println(1+6*n*(n-1));
}
public static void main(String[] args) {
Main main = new Main();
try { main.sc = new Scanner(new FileInputStream("test.in")); }
catch (FileNotFoundException e) { main.sc = new Scanner(System.in); }
main.run();
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | n = int(input())
ans = 1
t = 12
for i in range(1,n):
ans += i*t
print(ans) | PYTHON3 |
171_B. Star | <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 | 2 | 8 | import java.util.Scanner;
public class fool1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n;
n = sc.nextInt();
long val = 1;
n -= 1;
while(n>0){
val += 12*n;
n--;
}
System.out.println(val);
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | #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);
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
cout << (6 * n * (n - 1)) + 1;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | #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';
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class P171B_Star {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(in.readLine());
System.out.println(1+12*sum(a-1));
}
public static int sum(int n) {
return (n+1)*n/2;
}
}
| JAVA |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.util.*;
public class Star {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(f.readLine());
System.out.println(6*n*(n-1)+1);
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
scanf("%d", &n);
printf("%d\n", 6 * n * (n - 1) + 1);
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.util.*;
public class Temp {
static BufferedReader reader;
static StringTokenizer tokenizer = null;
static PrintWriter writer;
static int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
static long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
static double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
static String nextToken() throws IOException {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
public static int f(int x){
if (x==1) return 1;
return f(x-1)+12*(x-1);
}
public static void main(String[] args) throws IOException {
reader = new BufferedReader(new InputStreamReader(System.in));
writer = new PrintWriter(new OutputStreamWriter(System.out));
int a = nextInt();
writer.println(f(a));
reader.close();
writer.close();
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] argv) {
new Main().run();
}
Scanner in;
PrintWriter out;
void run() {
in = new Scanner(System.in);
out = new PrintWriter(System.out);
try {
solve();
} finally {
out.close();
}
}
int rev(String s) {
String res = "";
for (int i = 0; i < s.length(); i++) {
res = s.charAt(i) + res;
}
return Integer.parseInt(res);
}
void solve() {
int n = in.nextInt();
int res = 0;
res += 2 * n - 1;
int add = 2 * n;
int add2 = 1;
for (int i = 1; i <= n - 1; i++) {
res += 2 * add2++;
}
for (int i = 1; i <= n - 1; i++) {
res += add++ * 2;
}
out.println(res);
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #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;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.util.Arrays;
import java.util.Scanner;
public class ap02 {
public static void debug(Object... obs)
{
System.out.println(Arrays.deepToString(obs));
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
long sf = 1;
for(int i=1;i<n;i++)
{
sf += i*12;
}
System.out.println(sf);
}
} | JAVA |
171_B. Star | <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 | 2 | 8 | #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 - 3]);
}
cout << ans << endl;
return 0;
}
| CPP |
171_B. Star | <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 | 2 | 8 | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import static java.lang.Math.abs;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.lang.Math.sqrt;
import static java.lang.Integer.signum;
@SuppressWarnings("unchecked")
public class P0171B {
public void run() throws Exception {
int n = nextInt();
println(6 * n * (n - 1) + 1);
}
public static void main(String... args) throws Exception {
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedOutputStream(System.out));
new P0171B().run();
br.close();
pw.close();
System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
}
static long startTime = System.currentTimeMillis();
static BufferedReader br;
static PrintWriter pw;
StringTokenizer stok;
String nextToken() throws IOException {
while (stok == null || !stok.hasMoreTokens()) {
String s = br.readLine();
if (s == null) { return null; }
stok = new StringTokenizer(s);
}
return stok.nextToken();
}
void print(byte b) { print("" + b); }
void print(int i) { print("" + i); }
void print(long l) { print("" + l); }
void print(double d) { print("" + d); }
void print(char c) { print("" + c); }
void print(Object o) {
if (o instanceof int[]) { print(Arrays.toString((int [])o));
} else if (o instanceof long[]) { print(Arrays.toString((long [])o));
} else if (o instanceof char[]) { print(Arrays.toString((char [])o));
} else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
} else if (o instanceof short[]) { print(Arrays.toString((short [])o));
} else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
} else if (o instanceof float[]) { print(Arrays.toString((float [])o));
} else if (o instanceof double[]) { print(Arrays.toString((double [])o));
} else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
} else { print("" + o); }
}
void print(String s) { pw.print(s); }
void println() { println(""); }
void println(byte b) { println("" + b); }
void println(int i) { println("" + i); }
void println(long l) { println("" + l); }
void println(double d) { println("" + d); }
void println(char c) { println("" + c); }
void println(Object o) { print(o); println(); }
void println(String s) { pw.println(s); }
int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
long nextLong() throws IOException { return Long.parseLong(nextToken()); }
double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
char nextChar() throws IOException { return (char) (br.read()); }
String next() throws IOException { return nextToken(); }
String nextLine() throws IOException { return br.readLine(); }
int [] readInt(int size) throws IOException {
int [] array = new int [size];
for (int i = 0; i < size; i++) { array[i] = nextInt(); }
return array;
}
long [] readLong(int size) throws IOException {
long [] array = new long [size];
for (int i = 0; i < size; i++) { array[i] = nextLong(); }
return array;
}
double [] readDouble(int size) throws IOException {
double [] array = new double [size];
for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
return array;
}
String [] readLines(int size) throws IOException {
String [] array = new String [size];
for (int i = 0; i < size; i++) { array[i] = nextLine(); }
return array;
}
int gcd(int a, int b) {
if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
a = Math.abs(a); b = Math.abs(b);
int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
a >>>= az; b >>>= bz;
while (a != b) {
if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
}
return (a << Math.min(az, bz));
}
long gcd(long a, long b) {
if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
a = Math.abs(a); b = Math.abs(b);
int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
a >>>= az; b >>>= bz;
while (a != b) {
if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
}
return (a << Math.min(az, bz));
}
void shuffle(int [] a) {
Random r = new Random();
for (int i = a.length - 1; i >= 0; i--) {
int j = r.nextInt(a.length);
int t = a[i]; a[i] = a[j]; a[j] = t;
}
}
void shuffle(long [] a) {
Random r = new Random();
for (int i = a.length - 1; i >= 0; i--) {
int j = r.nextInt(a.length);
long t = a[i]; a[i] = a[j]; a[j] = t;
}
}
void shuffle(Object [] a) {
Random r = new Random();
for (int i = a.length - 1; i >= 0; i--) {
int j = r.nextInt(a.length);
Object t = a[i]; a[i] = a[j]; a[j] = t;
}
}
void flush() {
pw.flush();
}
void pause() {
flush();
System.console().readLine();
}
} | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.