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 B implements Runnable { private MyScanner in; private PrintWriter out; private int f(int n) { return 1 + 6 * n * (n - 1); } private void solve() { int a = in.nextInt(); out.println(f(a)); } @Override public void run() { in = new MyScanner(); out = new PrintWriter(System.out); solve(); in.close(); out.close(); } public static void main(String[] args) { new B().run(); } static class MyScanner { private BufferedReader br; private StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } public void close() { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } public String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); return null; } } return st.nextToken(); } public String nextLine() { try { st = null; return br.readLine(); } catch (IOException e) { e.printStackTrace(); return null; } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public boolean hasNext() { if (st != null && st.hasMoreTokens()) { return true; } try { while (br.ready()) { st = new StringTokenizer(br.readLine()); if (st != null && st.hasMoreTokens()) { return true; } } } catch (IOException e) { e.printStackTrace(); } return false; } } }
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(void) { int a; cin >> a; cout << 6 * a * (a - 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
def c(n): r = 1 while n > 1: n -= 1 r += n * 12 return r print c(int(raw_input()))
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() { long a, b = 1, i; cin >> a; for (i = 2; i <= a; i++) { b += 6 * 2 * (i - 1); } cout << b << 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()) c=(6*n)*(n-1)+1 print(c)
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 n; cin >> n; long long ans = 1; for (int i = 0; i < n; i++) ans += 12 * i; 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
n = input() print 1+6*n*(n-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
#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; }
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 Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); System.out.print(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 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; }
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; 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"; }
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 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long ans = 0; for(int a=1;a<N;a++){ ans+=a; } System.out.println(((ans*6)<<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
a = int(input()) res = 1 for i in range(2, a + 1): res += (i - 1) * 12 print(res)
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
Q = int I = input B = print n = Q(I()) B(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
#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; }
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; 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 = 1e9; const long long INFLL = 1e15; struct node_t {}; int main() { long long n, m = 0; cin >> n; n--; m = 1; long long t = 1; while (n > 0) { m += t * 12; t++; n--; } cout << m; 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 x; cin >> x; cout << 6 * x * (x - 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
"""==================================================================================== ==================================================================================== ___ _______ ___ _______ ___ ___ | /\ | | \ | | / | | | | |\ /| | / \ | | \ | | / | | | | | \ / | |___ /____\ | | \ | |/ |___| | | | \/ | | / \ | | / | |\ |\ | | | | | / \ | | / | | \ | \ | | | | ___|/ \___|___ |___/ ___|___ | \ | \ |___| | | ==================================================================================== ==================================================================================== """ # ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ n = int(input()) a = 1 s = 12 for i in range(n-1): a += s s += 12 print(a) # ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ """==================================================================================== ==================================================================================== ___ _______ ___ _______ ___ ___ | /\ | | \ | | / | | | | |\ /| | / \ | | \ | | / | | | | | \ / | |___ /____\ | | \ | |/ |___| | | | \/ | | / \ | | / | |\ |\ | | | | | / \ | | / | | \ | \ | | | | ___|/ \___|___ |___/ ___|___ | \ | \ |___| | | ==================================================================================== ==================================================================================== """
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.io.*; import java.util.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { public void solve () throws Exception { int n = nextInt(); int cur = 0; int sum = 1; for (int i = 1; i <= n; i++) { sum += cur; cur = cur + 12; } out.println(sum); } final String fname = ""; long stime = 0; BufferedReader in; PrintWriter out; StringTokenizer st; private String nextToken () throws Exception { if (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(in.readLine()); } return st.nextToken(); } private int nextInt () throws Exception { return Integer.parseInt(nextToken()); } private long nextLong () throws Exception { return Long.parseLong(nextToken()); } private double nextDouble () throws Exception { return Double.parseDouble(nextToken()); } @Override public void run() { try { //in = new BufferedReader(new FileReader("input.txt")); //out = new PrintWriter(new FileWriter("output.txt")); in = new BufferedReader (new InputStreamReader(System.in)); out = new PrintWriter (System.out); solve (); } catch (Exception e) { throw new RuntimeException(e); } finally { out.close(); } } public static void main(String[] args) { new Thread(null, new Solution(), "", 1<<25).start(); } }
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
k=int(input()) print((6*k*(k-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.io.*; import java.util.*; public class Main{ static int mod = (int)(Math.pow(10, 9) + 7); public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); out.println(6 * n * (n-1) + 1); out.close(); } static void mergeSort(int[] A){ // low to hi sort, single array only int n = A.length; if (n < 2) return; int[] l = new int[n/2]; int[] r = new int[n - n/2]; for (int i = 0; i < n/2; i++){ l[i] = A[i]; } for (int j = n/2; j < n; j++){ r[j-n/2] = A[j]; } mergeSort(l); mergeSort(r); merge(l, r, A); } static void merge(int[] l, int[] r, int[] a){ int i = 0, j = 0, k = 0; while (i < l.length && j < r.length && k < a.length){ if (l[i] < r[j]){ a[k] = l[i]; i++; } else{ a[k] = r[j]; j++; } k++; } while (i < l.length){ a[k] = l[i]; i++; k++; } while (j < r.length){ a[k] = r[j]; j++; k++; } } //-----------PrintWriter for faster output--------------------------------- public static PrintWriter out; //-----------MyScanner class for faster input---------- public static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { 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
#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; }
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(int((n - 1) * n / 2 * 12 + 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.Scanner; public class Aprel2012_B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = 0; for (int i = 1; i <= n; i++) { ans += 12 * (i-1); } 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; 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
a = int(input()) res = (a * 6 * ( a - 1)) + 1 print(res)
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
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
a = int(raw_input()) sum = 1 for i in range(a): sum += 12 * i print sum
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
ans = 1 for i in range(int(raw_input())): ans += i * 12 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
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); if(n==1){ System.out.println("1"); } else{ int ant=1; int j=1; int res=0; for(int i=1;i<n;++i){ res=ant+6+6*j; j+=2; ant=res; } System.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 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; i--) { ans -= i + n - 1; } 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; 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; }
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 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]; } printf("%d\n", sol); 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; 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; }
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()) i = 1 c = 1 while (i < a): c += 2*i*6 i += 1 print(c)
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 Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int temp1 = p6(a); int temp2 = p3(a*3-2); System.out.println(temp2 * 2 - temp1); } static int p6(int n) { return p3(n) * 6 - n * 6 + 1; } static int p3(int n) { return n * (n + 1) / 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
#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; }
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.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.*; public class Main { public static void main(String arg[]) { InputReader in = new InputReader(System.in); OutputWriter out = new OutputWriter(System.out); int n = in.readInt();System.out.println((6*n*(n-1))+1); out.printLine(); out.flush(); out.close(); } } class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) return -1; } return buf[curChar++]; } public int readInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public String readString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public String next() { return readString(); } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.writer = new PrintWriter(writer); } public void print(Object... objects) { for (int i = 0; i < objects.length; i++) { if (i != 0) writer.print(' '); writer.print(objects[i]); } } public void printLine(Object... objects) { print(objects); writer.println(); } public void close() { writer.close(); } public void flush() { writer.flush(); } } class IOUtils { public static int[] readIntArray(InputReader in, int size) { int[] array = new int[size]; for (int i = 0; i < size; i++) array[i] = in.readInt(); return array; } }
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 n; int main() { scanf("%d", &n); printf("%d\n", 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
#include <bits/stdc++.h> int main() { int n; scanf("%d", &n); printf("%d", n * (n - 1) * 6 + 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 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; }
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 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; }
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; import java.util.StringTokenizer; public class Solution { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; private void solve() throws IOException { int n = nextInt(); long a[] = new long[n + 1]; a[1] = 1; int kk = 2; for(int i = 2; i <= n; i++) { a[i] = a[i - 1] + 6 * kk; kk += 2; } System.out.println(a[n]); } String nextToken() throws IOException { if (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(bf.readLine()); } return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } public static void main(String args[]) throws IOException { new Solution().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
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Bunyod Xalilov */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskB solver = new TaskB(); solver.solve(1, in, out); out.close(); } } class TaskB { public void solve(int testNumber, Scanner in, PrintWriter out) { Integer a = in.nextInt(); int rez = 1; for(int i=1; i<a;i++){ rez += 12 * i; } out.println(rez); } }
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 n; int main() { cin >> n; cout << (n * (n - 1) / 2) * 12 + 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; 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; }
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); 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) { if (p1.first < p2.first) return 1; if (p1.first == p2.first) if (p1.second < p2.second) return 1; return 0; } int main() { cin >> a; long long ans = 0; for (long long i = 1; i < a + 1; ++i) { ans += 12 * (i - 1); } ++ans; 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; int main() { int a; cin >> a; cout << 6 * a * (a - 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 n, ans; int main() { cin >> n; for (int i = 1; i < n; i++) { ans += 12 * i; } cout << ans + 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 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; }
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() { 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; }
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, i, z = 12, t = 1; cin >> n; for (i = 1; i < n; i++) { t += z; z += 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
a = lambda n: 6*n*(n-1)+1 print a(int(raw_input()))
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; long long res = 1; for (int i = 2; i <= n; ++i) res = res + 12 * (i - 1); 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
import java.io.InputStreamReader; import java.io.IOException; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author niyaznigmatul */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner in = new FastScanner(inputStream); FastPrinter out = new FastPrinter(outputStream); TaskB solver = new TaskB(); solver.solve(1, in, out); out.close(); } } class TaskB { public void solve(int testNumber, FastScanner in, FastPrinter out) { int n = in.nextInt(); if (n == 1) { out.println(1); return; } long ans = 1; for (int i = 2; i <= n; i++) { ans += 12 * (i - 1); } out.println(ans); } } class FastScanner extends BufferedReader { boolean isEOF; public FastScanner(InputStream is) { super(new InputStreamReader(is)); } public int read() { try { int ret = super.read(); if (isEOF && ret < 0) { throw new InputMismatchException(); } isEOF = ret == -1; return ret; } catch (IOException e) { throw new InputMismatchException(); } } static boolean isWhiteSpace(int c) { return c >= -1 && c <= 32; } public int nextInt() { int c = read(); while (isWhiteSpace(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int ret = 0; while (!isWhiteSpace(c)) { if (c < '0' || c > '9') { throw new NumberFormatException("digit expected " + (char) c + " found"); } ret = ret * 10 + c - '0'; c = read(); } return ret * sgn; } } class FastPrinter extends PrintWriter { public FastPrinter(OutputStream out) { super(out); } public FastPrinter(Writer out) { super(out); } }
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 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) { if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) return true; return false; } bool isPrime(int x) { if (x == 1) return false; else if (x == 2) return true; for (int i = 2; i <= sqrt(x * 1.0); ++i) { if (x % i == 0) return false; } return true; } int sqr(int x) { return x * x; } int main() { int n; while (~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> 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; }
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
s=input().split() print(int(s[0])*(int(s[0])-1)*6+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
n = int(input()) print((2*n-2)*n*3+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
a = int(input()) print(6 * (a**2) - 6 * a + 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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Problem2_Star { public static void star(){ MyScanner sc = new MyScanner(); int n = sc.nextInt(); if(n==1){ System.out.println("1"); return; } long total = 13; long side = 3; for(int i=2;i<n;i++){ total += 6 * side + 6; side += 2; } System.out.println(total); } public static void main(String[] args){ star(); } /* How to read from Scanner MyScanner sc = new MyScanner(); int n = sc.nextInt(); // read input as integer long k = sc.nextLong(); // read input as long double d = sc.nextDouble(); // read input as double String str = sc.next(); // read input as String String s = sc.nextLine(); // read whole line as String */ public static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { 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
#include <bits/stdc++.h> using namespace std; long long n; int main() { cin >> n; cout << 1 + 12 * (n * (n - 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() { long long 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
a = input() print 2 * a * a + 4 * a * (a - 1) - 2 * a + 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
import java.io.*; import java.util.*; import java.math.*; public class star { public static void main (String [] args) throws Exception { Scanner sc = new Scanner(System.in); int l = Integer.parseInt(sc.nextLine()); long sum = 1; sum+=6*(l)*(l+1); sum-=12*(l); System.out.println(sum); } }
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 n; int main() { scanf("%d", &n); printf("%d", 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> 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]); }
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(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; }
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 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; }
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; 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; }
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 static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; public class B { Scanner sc = new Scanner(System.in); void run() { long a = sc.nextLong(); long res = 1; for (long i = 2; i <= a; i++) { res += (i * 2 - 2) * 6; } System.out.println(res); } void debug(Object...os) { System.err.println(deepToString(os)); } public static void main(String[] args) { new B().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(raw_input()) print 6 * n ** 2 - 6 *n + 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
#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); }
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 math import itertools import collections def getdict(n): d = {} if type(n) is list: for i in n: if i in d: d[i] += 1 else: d[i] = 1 else: for i in range(n): t = ii() if t in d: d[t] += 1 else: d[t] = 1 return d def cdiv(n, k): return n // k + (n % k != 0) def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(map(int, input().split())) def lcm(a, b): return abs(a*b) // math.gcd(a, b) def sumc(t): s = 0 while t > 0: s += t % 10 t //= 10 return s a = ii() print(6 * a * a - 6 * a + 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
#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; } }
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; 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 / gcd(a, b)); } template <class T> inline T sqr(T x) { return x * x; } template <class T> T power(T N, T P) { return (P == 0) ? 1 : N * power(N, P - 1); } template <class T> bool inside(T a, T b, T c) { return (b >= a && b <= c); } const long long INF64 = (long long)1E16; int distsq2d(int x1, int y1, int x2, int y2) { return sqr(x1 - x2) + sqr(y1 - y2); } double dist2d(double x1, double y1, double x2, double y2) { return sqrt(sqr(x1 - x2) + sqr(y1 - y2)); } double dist3d(double x1, double y1, double z1, double x2, double y2, double z2) { return sqrt(sqr(x1 - x2) + sqr(y1 - y2) + sqr(z1 - z2)); } long long toInt64(string s) { long long r = 0; istringstream sin(s); sin >> r; return r; } double LOG(long long N, long long B) { return (log10l(N)) / (log10l(B)); } string itoa(long long a) { if (a == 0) return "0"; string ret; for (long long i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48); reverse(ret.begin(), ret.end()); return ret; } vector<string> token(string a, string b) { const char *q = a.c_str(); while (count(b.begin(), b.end(), *q)) q++; vector<string> oot; while (*q) { const char *e = q; while (*e && !count(b.begin(), b.end(), *e)) e++; oot.push_back(string(q, e)); q = e; while (count(b.begin(), b.end(), *q)) q++; } return oot; } int isvowel(char s) { s = tolower(s); if (s == 'a' || s == 'e' || s == 'i' || s == 'o' || s == 'u') return 1; return 0; } int isupper(char s) { if (s >= 'A' and s <= 'Z') return 1; return 0; } int Set(int N, int pos) { return N = N | (1 << pos); } int reset(int N, int pos) { return N = N & ~(1 << pos); } int check(int N, int pos) { return (N & (1 << pos)); } int toggle(int N, int pos) { if (check(N, pos)) return N = reset(N, pos); return N = Set(N, pos); } void pbit(int N) { printf("("); for (int i = 10; i >= 0; i--) { bool x = check(N, i); cout << x; } puts(")"); } 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; long long ans = 1; cin >> n; for (int i = 1; i < n; i++) ans += i * 12; 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
# solution nim = int(input()) print(6 * nim * (nim - 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.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> t = new Hashtable<BigInteger, BigInteger>(); t.put(new BigInteger("1"), new BigInteger("1")); t.put(new BigInteger("2"), new BigInteger("13")); for (int i = 3; i <= 18257; i++) { BigInteger a=t.get(new BigInteger(String.valueOf(i-1))); BigInteger f=new BigInteger("12").multiply(new BigInteger((i-1)+"")); t.put(new BigInteger(String.valueOf(i)),a.add(f)); } int n = scan.nextInt(); System.out.println(t.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
n, ans = int(input()), 1 for i in range(1, n): ans += i * 12 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
# -*- coding: utf-8 -*- import sys if __name__ == '__main__': num = map(int,sys.stdin.readline().split()) n = num[0] print 6 * n ** 2 - 6 * n + 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
#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; }
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
/** * Created with IntelliJ IDEA. * User: alexey * Date: 21.03.13 * Time: 22:13 * To change this template use File | Settings | File Templates. */ import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.*; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class davay { public static void main(String... args)throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); int n = nextInt(); int res=1,pr =12; for (int i =1;i<n;i++){ res+=pr; pr+=12; } out.print(res); out.close(); } public static StringTokenizer st; public static BufferedReader br; public static PrintWriter out; public static String nextToken() throws IOException { while ( st == null || !st.hasMoreTokens() ) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } public static int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(nextToken()); } public static double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(nextToken()); } public static long nextLong() throws NumberFormatException, IOException { return Long.parseLong(nextToken()); } public static int[] ReadIntArray(int n) throws IOException { int[] a = new int[n]; for ( int i = 0; i < n; i++ ) { a[i] = nextInt(); } return a; } public static void PrintArray(int[] arr) throws IOException{ for ( int i = 0; i < arr.length; i++ ) out.print(arr[i] + " "); } public static long[] ShuffleArray(long [] arr) { Random rnd = new Random(); int n = arr.length; long temp; int ind; while (n > 1) { ind = rnd.nextInt(n--); temp = arr[ind]; arr[ind] = arr[n]; arr[n] = temp; } return arr; } }
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
a = input() c = 1 for x in range(2,a+1): c += x + 10*(x-1) + x-2 print c
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() { 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; }
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, 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; } cout << a[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
#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; }
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 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; for (int i = 2; i < Maxn; i++) f[i] = 12 * (i - 1) + f[i - 1]; while (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
import java.util.Scanner; public class Star { /** * @param args */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); long res = 1; long x = 12; for (int i = 1 ; i < a; i++){ res += x; x+=12; } System.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
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { int N = nextInt(); int result = 1; for(int i = 2; i <= N; i++){ result += 12 * (i - 1); } System.out.println(result); } //----------------------------------------------------------- public static void main(String[] args) { new Main().run(); } public void run() { try { in = new BufferedReader(new InputStreamReader(System.in)); tok = null; solve(); in.close(); } catch (IOException e) { System.exit(0); } } public String nextToken() throws IOException { while (tok == null || !tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); } return tok.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(nextToken()); } public long nextLong() throws IOException { return Long.parseLong(nextToken()); } public double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } BufferedReader in; StringTokenizer tok; }
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 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; }
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", (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; 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 vector<pair<int, int> > ReadVII(int count) { vector<pair<int, int> > arrayname(count); for (int i = 0; i < int(count); i++) { cin >> arrayname[i].first; arrayname[i].second = i; } return arrayname; }; const int MOD = 1000000007; const int MAXVALUE = 100001; int main() { int n; cin >> n; vector<int> a(n + 1); a[0] = 0; a[1] = 1; if (n == 1) return cout << 1, 0; for (int i = 2; i <= n; i++) { a[i] = 12 * (i - 1); } int sum = 0; for (int i = 0; i <= n; i++) { sum += a[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
#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; }
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; long long m = n * (n - 1) * 6; if (n >= 1) { if (n == 1) cout << 1; else cout << m + 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
x=input() print x*(x-1)*6+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
#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(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } long long pows(long long b, long long e) { if (e == 0) return 1; else if (e % 2 == 0) { long long a = pow(b, e / 2); return a * a; } else { long long a = pow(b, e / 2); return b * a * a; } } long long powm(long long x, long long y, long long m) { x = x % m; long long res = 1; while (y) { if (y & 1) res = res * x; res %= m; y = y >> 1; x = x * x; x %= m; } return res; } long long modInverse(long long a, long long m = 1000000007) { if (m == 1) return 0; long long m0 = m, y = 0, x = 1; while (a > 1) { long long q = a / m, t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m, i, j, k, x, y, z, e, f, p, q, g, l, r, w, h, count1 = 0, prod = 1, a, b, c, d, index, x1, x2, diff, ans = 0, sum = 0, sum1 = 0, sum2 = 0, flag = 0, flag1 = 0, flag2 = 0; string s, s1, s2; cin >> n; if (n == 1) { cout << "1"; return 0; } else { ans = 1; k = 3; for (i = 2; i <= n; i++) { ans += k * 4; k += 3; } 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
a = int(raw_input()) ans = 1 for i in range(1, a): ans = ans+i*12 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
#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; }
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 Stars { public static void main (String [] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int starSequence = 6*n *(n-1) + 1; System.out.println(starSequence); } }
JAVA