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.*;
public class b {
public static void main(String[] args) throws Throwable {
int n = Integer.parseInt(
new BufferedReader(new InputStreamReader(System.in)).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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
template <class T>
double sqrt(T x) {
return sqrt((double)x);
}
template <class T>
T sqr(T x) {
return x * x;
}
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
void wa() {
cout << 5;
exit(0);
}
void tl() {
while (1)
;
}
void pe() {
cout << "abc abc\n 453534 wff sf sd\n";
exit(0);
}
void re() { exit(1); }
void ml() { int *b = new int[1000]; }
int main() {
double TIME_START = clock();
int n;
cin >> n;
unsigned long long ans = 1, lay;
if (n >= 2) {
lay = 12;
for (int x = 2; x <= n; x++) {
ans += lay;
lay += 12;
}
}
cout << ans;
fprintf(stderr, "\n\n%.15lf\n\n",
(double)(clock() - TIME_START) / CLOCKS_PER_SEC);
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 num;
long long result;
cin >> num;
result = 6 * num * (num - 1) + 1;
cout << result;
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.io.PrintWriter;
import java.util.StringTokenizer;
public class B{
public static void main(String[] args) {
FastScanner scan = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int[] dp = new int[100000];
dp[1] = 1;
for(int i = 2; i <= 18257; i++) dp[i] = dp[i-1]+((i-1)*12);
out.println(dp[scan.nextInt()]);
out.close();
}
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer(br.readLine());
} catch (Exception e){e.printStackTrace();}
}
public String next() {
if (st.hasMoreTokens()) return st.nextToken();
try {st = new StringTokenizer(br.readLine());}
catch (Exception e) {e.printStackTrace();}
return st.nextToken();
}
public int nextInt() {return Integer.parseInt(next());}
public long nextLong() {return Long.parseLong(next());}
public double nextDouble() {return Double.parseDouble(next());}
public String nextLine() {
String line = "";
if(st.hasMoreTokens()) line = st.nextToken();
else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
while(st.hasMoreTokens()) line += " "+st.nextToken();
return line;
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a = new long[n];
for(int i = 0; i < n; i++) a[i] = nextLong();
return a;
}
public double[] nextDoubleArray(int n){
double[] a = new double[n];
for(int i = 0; i < n; i++) a[i] = nextDouble();
return a;
}
public char[][] nextGrid(int n, int m){
char[][] grid = new char[n][m];
for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
return grid;
}
}
} | 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 Prob171B {
public static void main(String[] Args) {
Scanner in = new Scanner(System.in);
long side = in.nextInt();
long ans = (side - 1) * side * 6 + 1;
System.out.println(ans);
}
}
| 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.*;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n= Integer.parseInt(br.readLine());
long c = 0;
int i = 0 ;
while(i<n)
{
c = c+i*12;
i++;
}
System.out.println(c+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 | n=int(input())
s=1
for i in range(1,n):
s+=i*12
print(s) | 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 n;
scanf("%d", &n);
int add = 0;
long long total = 1;
for (int i = 0; i < n; i++) {
total += add;
add += 12;
}
printf("%I64d\n", total);
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;
std::cin >> n;
std::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 | #include <bits/stdc++.h>
using namespace std;
int main() {
long a, S, i;
for (cin >> a, i = 0, S = 0; i < 1;
S += (6 * a * (a - 1) + 1), cout << S, ++i)
;
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.*;
import java.io.*;
import java.math.BigInteger;
public class AprB{
static BufferedReader br;
public static void main(String args[])throws Exception{
br=new BufferedReader(new InputStreamReader(System.in));
long a=toInt();
if(a==1){
System.out.println("1");
return;
}
long res[]=new long[18258];
res[1]=0;
res[2]=7;
for(int i=3;i<res.length;i++){
res[i]=res[i-1]+a*6-6;
}
System.out.println(res[(int)a]+((a-2)*2+1)*6);
}
/****************************************************************/
public static int[] toIntArray()throws Exception{
String str[]=br.readLine().split(" ");
int k[]=new int[str.length];
for(int i=0;i<str.length;i++){
k[i]=Integer.parseInt(str[i]);
}
return k;
}
public static int toInt()throws Exception{
return Integer.parseInt(br.readLine());
}
public static long[] toLongArray()throws Exception{
String str[]=br.readLine().split(" ");
long k[]=new long[str.length];
for(int i=0;i<str.length;i++){
k[i]=Long.parseLong(str[i]);
}
return k;
}
public static long toLong()throws Exception{
return Long.parseLong(br.readLine());
}
public static double[] toDoubleArray()throws Exception{
String str[]=br.readLine().split(" ");
double k[]=new double[str.length];
for(int i=0;i<str.length;i++){
k[i]=Double.parseDouble(str[i]);
}
return k;
}
public static double toDouble()throws Exception{
return Double.parseDouble(br.readLine());
}
public static String toStr()throws Exception{
return br.readLine();
}
public static String[] toStrArray()throws Exception{
String str[]=br.readLine().split(" ");
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 | a=int(input())
s=1
for i in range(0,a):
s+=i*12
print (s) | 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;
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.io.*;
import java.math.*;
import static java.lang.Math.*;
import java.security.SecureRandom;
import static java.util.Arrays.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import sun.misc.Regexp;
import java.awt.geom.*;
import sun.net.www.content.text.plain;
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
StreamTokenizer in;
PrintWriter out;
//deb////////////////////////////////////////////////
public static void deb(String n, Object n1) {
System.out.println(n + " is : " + n1);
}
public static void deb(int[] A) {
for (Object oo : A) {
System.out.print(oo + " ");
}
System.out.println("");
}
public static void deb(long[] A) {
for (Object oo : A) {
System.out.print(oo + " ");
}
System.out.println("");
}
public static void deb(boolean[] A) {
for (Object oo : A) {
System.out.print(oo + " ");
}
System.out.println("");
}
public static void deb(double[] A) {
for (Object oo : A) {
System.out.print(oo + " ");
}
System.out.println("");
}
public static void deb(String[] A) {
for (Object oo : A) {
System.out.print(oo + " ");
}
System.out.println("");
}
public static void deb(int[][] A) {
for (int i = 0; i < A.length; i++) {
for (Object oo : A[i]) {
System.out.print(oo + " ");
}
System.out.println("");
}
}
public static void deb(double[][] A) {
for (int i = 0; i < A.length; i++) {
for (Object oo : A[i]) {
System.out.print(oo + " ");
}
System.out.println("");
}
}
public static void deb(long[][] A) {
for (int i = 0; i < A.length; i++) {
for (Object oo : A[i]) {
System.out.print(oo + " ");
}
System.out.println("");
}
}
public static void deb(String[][] A) {
for (int i = 0; i < A.length; i++) {
for (Object oo : A[i]) {
System.out.print(oo + " ");
}
System.out.println("");
}
}
/////////////////////////////////////////////////////////////
int nextInt() throws IOException {
in.nextToken();
return (int) in.nval;
}
long nextLong() throws IOException {
in.nextToken();
return (long) in.nval;
}
void run() throws IOException {
// in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));
// out = new PrintWriter(new FileWriter("output.txt"));
in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
out = new PrintWriter(new OutputStreamWriter(System.out));
solve();
out.flush();
}
//boolean inR(int x,int y){
//return (x<=0)&&(x<4)&&(y<=0)&&(y<4);
//}
@SuppressWarnings("unchecked")
void solve() throws IOException {
// BufferedReader re= new BufferedReader(new FileReader("C:\\Users\\ASELA\\Desktop\\PROBLEMSET\\input\\F\\10.in"));
// BufferedReader re = new BufferedReader(new InputStreamReader(System.in));
// Scanner sc = new Scanner(System.in);
long n=nextInt();
long ans= 12*(n*(n-1))/2+1;
System.out.println(ans);
}
}
| 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() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
long long n, ans;
while (t--) {
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 int N;
cin >> N;
cout << (N * (N - 1) * 6) + 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 MAX(long long int a, long long int b) {
if (a > b) {
return a;
} else {
return b;
}
}
int MIN(long long int a, long long int b) {
if (a < b) {
return a;
} else {
return b;
}
}
int gcd(long long int a, long long int b) {
long long int c;
while (a != 0) {
c = a;
a = b % a;
b = c;
}
return b;
}
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 | #include <bits/stdc++.h>
int main() {
unsigned long int a, sum = 1, i;
scanf("%lu", &a);
for (i = 2; i <= a; i++) {
sum += (i - 1) * 12;
}
printf("%lu", 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 a;
scanf("%I64d", &a);
if (a == 1)
puts("1");
else
printf("%I64d\n", a * (a - 1) * 6 + 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 MOD = 1e9 + 7;
long long MAX = 1e17;
int main() {
ios_base::sync_with_stdio(0);
;
int n;
cin >> n;
n = 1 + 6 * n * (n - 1);
cout << 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(1+6*(n**2-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 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B_171_Star {
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(
new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(buf.readLine());
int a = Integer.parseInt(st.nextToken());
System.out.println(6 * a * (a - 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 | import java.io.*;
import java.util.*;
public class FirstApril {
FastScanner in;
PrintWriter out;
void solve() {
int n = in.nextInt() - 1;
int ans = 1;
int add = 0;
for (int i = 0; i < n; i++) {
add += 12;
ans += add;
}
out.println(ans);
}
void run() {
try {
in = new FastScanner(new File("object.in"));
out = new PrintWriter(new File("object.out"));
solve();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
void runIO() {
in = new FastScanner(System.in);
out = new PrintWriter(System.out);
solve();
out.close();
}
class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner(File f) {
try {
br = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public FastScanner(InputStream f) {
br = new BufferedReader(new InputStreamReader(f));
}
String next() {
while (st == null || !st.hasMoreTokens()) {
String s = null;
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (s == null)
return null;
st = new StringTokenizer(s);
}
return st.nextToken();
}
boolean hasMoreTokens() {
while (st == null || !st.hasMoreTokens()) {
String s = null;
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (s == null)
return false;
st = new StringTokenizer(s);
}
return true;
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
public static void main(String[] args) {
new FirstApril().runIO();
}
} | 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 star(int n) {
if (n == 1)
return 1;
else
return 12 * n - 12 + star(n - 1);
}
int main() {
int n;
cin >> n;
cout << star(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.InputStreamReader;
public class Star {
public static void main(String[] args) {
BufferedReader br = null;
InputStreamReader is = null;
try {
is = new InputStreamReader(System.in);
br = new BufferedReader(is);
int input = Integer.valueOf(br.readLine());
if (input == 1) {
System.out.println("1");
return;
}
if (input == 2) {
System.out.println("13");
return;
}
int res = 13;
int buf = 1;
for (int index = 3; index <= input; ++ index) {
res += 6 * (3 + buf);
buf += 2;
}
System.out.println(String.valueOf(res));
return;
} catch (Exception e) {
}
}
}
| 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.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
//InputStream inputStream = new FileInputStream("bluetube.in");//System.in;
//OutputStream outputStream = new FileOutputStream("bluetube.out");//.out;
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new Solver();
solver.solve(in, out);
out.close();
}
}
class Solver {
public void solve(InputReader in, PrintWriter out) {
int n = in.nextInt();
out.println(6 * n * (n - 1) + 1);
}
}
class InputReader {
private BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
| 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 A[19000] = {0};
int main() {
int a;
cin >> a;
A[0] = 1;
for (int i = 1; i < a; i++) A[i] = A[i - 1] + 6 + 6 * (2 * i - 1);
cout << A[a - 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>
int main() {
int n;
long long int s;
scanf("%d", &n);
s = 6 * n * (n - 1) + 1;
printf("%I64d", 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 | a = int(input())
if a == 1:
print(1)
else:
print(6*(a-1) + 6*(a-1)**2 + 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;
void loadData(void);
int proc(void);
void printRes(int);
int a;
int main(int argc, char** argv) {
loadData();
printRes(proc());
return 0;
}
int proc(void) {
long long res = 0;
res += (long long)(a + a + a - 1) * (long long)a / (long long)2;
res += (long long)(a + a + a - 2) * (long long)(a - 1) / (long long)2;
res += (long long)(1 + a - 1) * (long long)(a - 1) * (long long)3;
return (int)(res % (long long)(2000000000));
}
void loadData(void) {
scanf("%d", &a);
return;
}
void printRes(int res) {
printf("%d\n", res);
return;
}
| 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 sys
inN = int(sys.stdin.readline())
out = 1
for i in range(1,inN):
out += i*12
sys.stdout.write(str(out))
| 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 argc, char** argv) {
int n;
scanf("%d", &n);
n--;
printf("%d\n", (int)(1 + (long long)(n + 1) * (long long)n * 6));
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 | num = int(input())
if num == 1:
print("1")
else:
print(int((num-1)*(num)/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 | a = int(input())
ans = 6*(a-1)*a+1
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;
long long n, s;
int main() {
cin >> n;
s = 6 * n * (n - 1) + 1;
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 | #include <bits/stdc++.h>
using namespace std;
int A[10];
int main() {
int n, m, i, s = 1;
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 |
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long a = s.nextInt();
System.out.println(a * (a - 1) / 2 * 12 + 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;
scanf("%d", &a);
printf("%d\n", 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 | a = int(raw_input())
res = 1
for i in xrange(a):
res += 12 * i
print res
| 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.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author mas1991
*/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n= in.nextInt();
int[]d= new int[n+1];
d[1]=1;
for (int i = 2; i < d.length; i++) {
int s=(4*(i-1))+1;
int tot=(3*s)-3;
d[i]=d[i-1]+tot;
}
System.out.println(d[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 java.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter("output.txt");
} catch (Exception e) {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
}
class GraphBuilder {
int n, m;
int[] x, y;
int index;
int[] size;
GraphBuilder(int n, int m) {
this.n = n;
this.m = m;
x = new int[m];
y = new int[m];
size = new int[n];
}
void add(int u, int v) {
x[index] = u;
y[index] = v;
size[u]++;
size[v]++;
index++;
}
int[][] build() {
int[][] graph = new int[n][];
for (int i = 0; i < n; i++) {
graph[i] = new int[size[i]];
}
for (int i = index - 1; i >= 0; i--) {
int u = x[i];
int v = y[i];
graph[u][--size[u]] = v;
graph[v][--size[v]] = u;
}
return graph;
}
}
String readString() throws IOException {
while (!tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(in.readLine());
} catch (Exception e) {
return null;
}
}
return tok.nextToken();
}
int readInt() throws IOException {
return Integer.parseInt(readString());
}
int[] readIntArray(int size) throws IOException {
int[] res = new int[size];
for (int i = 0; i < size; i++) {
res[i] = readInt();
}
return res;
}
long[] readLongArray(int size) throws IOException {
long[] res = new long[size];
for (int i = 0; i < size; i++) {
res[i] = readLong();
}
return res;
}
long readLong() throws IOException {
return Long.parseLong(readString());
}
double readDouble() throws IOException {
return Double.parseDouble(readString());
}
<T> List<T>[] createGraphList(int size) {
List<T>[] list = new List[size];
for (int i = 0; i < size; i++) {
list[i] = new ArrayList<>();
}
return list;
}
public static void main(String[] args) {
new Template().run();
// new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
}
long timeBegin, timeEnd;
void time() {
timeEnd = System.currentTimeMillis();
System.err.println("Time = " + (timeEnd - timeBegin));
}
long memoryTotal, memoryFree;
void memory() {
memoryFree = Runtime.getRuntime().freeMemory();
System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
+ " KB");
}
public void run() {
try {
timeBegin = System.currentTimeMillis();
memoryTotal = Runtime.getRuntime().freeMemory();
init();
solve();
out.close();
if (System.getProperty("ONLINE_JUDGE") == null) {
time();
memory();
}
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
void solve() throws IOException {
long n = readInt();
long ans = n * (n - 1) * 6 + 1;
out.println(ans);
}
} | 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(void) {
int n;
scanf("%d", &n);
n--;
long m = n * (n + 1) / 2;
m *= 12;
m++;
printf("%I32d", 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;
long long a;
int main() {
scanf("%lld", &a);
printf("%lld", 1 + 12 * (a * (a - 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 | //package codeforces;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A implements Closeable {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
A() throws IOException {
// reader = new BufferedReader(new FileReader("input.txt"));
// writer = new PrintWriter(new FileWriter("output.txt"));
}
StringTokenizer stringTokenizer;
String next() throws IOException {
while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
stringTokenizer = new StringTokenizer(reader.readLine());
}
return stringTokenizer.nextToken();
}
int nextInt() throws IOException {
return Integer.parseInt(next());
}
long nextLong() throws IOException {
return Long.parseLong(next());
}
double nextDouble() throws IOException {
return Double.parseDouble(next());
}
private int MOD = 1000 * 1000 * 1000 + 7;
int sum(int a, int b) {
a += b;
return a >= MOD ? a - MOD : a;
}
int product(int a, int b) {
return (int) (1l * a * b % MOD);
}
int pow(int x, int k) {
int result = 1;
while (k > 0) {
if (k % 2 == 1) {
result = product(result, x);
}
x = product(x, x);
k /= 2;
}
return result;
}
int inv(int x) {
return pow(x, MOD - 2);
}
void solve() throws IOException {
int a = nextInt();
writer.println(1 + 6 * a * (a - 1));
}
public static void main(String[] args) throws IOException {
try (A a = new A()) {
a.solve();
}
}
@Override
public void close() throws IOException {
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 1; i < n; i++) ans += i * 12;
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 a;
cin >> a;
if (a == 1) {
cout << 1;
return 0;
}
cout << (a - 1) * a * 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 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;
}
| 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, a = 1, b = 12;
scanf(" %d", &n);
for (int i = 0; i < n - 1; i++) {
a += b;
b += 12;
}
printf("%d", a);
}
| 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((3 * n - 1) * (3 * n - 2) - 3 * 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.Scanner;
public class Test {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int ans = 0;
for(int i=1;i<n;i++)
ans += 12*i;
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;
while (~scanf("%d", &n)) {
int res = 1;
for (int i = 1; i < n; i++) res += i * 12;
printf("%d\n", 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
cout << ((3 * n - 2) * (3 * n - 1) + 3 * (n) * (n - 1)) / 2 << 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;
ans = (2 * n - 1) * (2 * n - 1) + 4 * (n - 1) * (n) / 2;
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 << (2 * n - 1) * (2 * n - 1) + 4 * (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 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long i;
while (scanf("%I64d", &i) != EOF) {
long long ans = (3 * i - 1) * (3 * i - 2) / 2 + 3 * i * (i - 1) / 2;
printf("%I64d\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 sys
FIN = sys.stdin
FOUT = sys.stdout
a = int(FIN.readline())
ans = 1
for i in range(a):
ans += 12 * i
FOUT.write(str(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 | integer = int(input())
if integer == 1: print(1)
else:print(1+integer*(integer-1)*6) | 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 math
t=int(input())
if(t==1):
print(1)
else:
x=t-1
print(6*t*x +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 | sum = 1
n = int(input())
if n ==1:
print(sum)
else:
for i in range(1, n):
sum += 12*i
print(sum)
| 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 res = 1;
int a;
cin >> a;
for (int i = 1; i < a; i++) {
res += 12 * i;
}
cout << res << 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 | from sys import stdin, gettrace
if not gettrace():
def input():
return next(stdin)[:-1]
# def input():
# return stdin.buffer.readline()
def main():
a = int(input())
print(6*a*(a-1) + 1)
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 pray(int a) {
if (a == 1) return 1;
if (a == 2) return 13;
return ((a - 1) * 12) + pray(a - 1);
}
int main() {
ios_base::sync_with_stdio(false);
int a;
cin >> a;
cout << pray(a);
}
| 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 double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
int main() {
cout << setiosflags(ios::fixed) << setprecision(10);
int t = 13;
int n;
cin >> n;
if (n == 1)
cout << 1;
else {
int k = 24;
for (int i = 0; i < (n - 2); i++) {
t += k;
k += 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 | x=int(input())
print(x*6*(x-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(void) {
int n;
scanf("%d", &n);
printf("%d", 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 |
// ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95
// ~/sudo apt-get Accpeted
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
StringTokenizer tk;
int [] a = new int[18258];
a[0] = 1;
a[1] = 12;
for(int i=2; i<a.length; i++)
a[i] = a[i-1]+12;
int n = parseInt(in.readLine());
int sum = 0;
for(int i=0; i<n; i++)
sum += a[i];
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>
using namespace std;
int main() {
int a;
cin >> a;
if (a == 1)
cout << 1;
else
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 | import java.util.Scanner;
public class Main {
void run(){
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
long edge=12;
long sum=1;
for(int i=2;i<=n;i++){
sum+=edge;
edge+=12;
sum%=2000000000;
edge%=2000000000;
}
System.out.println(sum);
}
public static void main(String[] args) {
new 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 | import java.util.Scanner;
/**
*
* @author owner
*/
public class JavaApplication7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int n = (new Scanner(System.in)).nextInt();
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 | //package codeforce171;
import java.util.Scanner;
public class B {
public long solve(long n) {
if (n == 1)
return 1;
long sideLen = n * 3 - 2;
return sideLen * (sideLen + 1) / 2 + (n - 1) * n / 2 * 3;
}
public static void main(String[] args) {
B problem = new B();
Scanner scanner = new Scanner(System.in);
long n = scanner.nextInt();
System.out.println(problem.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;
int a;
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 | #include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
long long a = 1, b = 12;
for (int i = 0; i < n - 1; i++) {
a += b;
b += 12;
}
printf("%I64d\n", 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 | #include <bits/stdc++.h>
using namespace std;
const int maxN = 30 + 321;
int main() {
ios::sync_with_stdio(0);
int n;
cin >> n;
long long ans = 0;
if (n == 1) {
cout << '1' << endl;
return 0;
}
ans = 1;
for (int i = 2; i <= n; i++) ans += 11 * (i - 1) + i - 1;
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().split()[0])
print((2 * n - 1) * (2 * n - 1) + 4 * (n - 1) * n // 2) | 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.*;
public class B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.close();
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 main() {
ios_base::sync_with_stdio(false);
long long n;
cin >> n;
n--;
cout << ((3 * n + 1) * (3 * n + 2) / 2) + (3 * (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 |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A {
public static long Mod = 1073741824;
public static void main(String[] args) {
try {
Scanner in = new Scanner();
// PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
long result = 1;
for(int i = 1 ; i < n ; i++){
result += (i)*12;
}
out.println(result);
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static int[][] powSquareMatrix(int[][] A, long p) {
int[][] unit = new int[A.length][A.length];
for (int i = 0; i < unit.length; i++) {
unit[i][i] = 1;
}
if (p == 0) {
return unit;
}
int[][] val = powSquareMatrix(A, p / 2);
if (p % 2 == 0) {
return mulMatrix(val, val);
} else {
return mulMatrix(A, mulMatrix(val, val));
}
}
public static int[][] mulMatrix(int[][] A, int[][] B) {
int[][] result = new int[A.length][B[0].length];
for (int i = 0; i < result.length; i++) {
for (int j = 0; j < result[0].length; j++) {
long temp = 0;
for (int k = 0; k < A[0].length; k++) {
temp += ((long) A[i][k] * B[k][j] % Mod);
temp %= Mod;
}
temp %= Mod;
result[i][j] = (int) temp;
}
}
return result;
}
static double dist(Point a, Point b) {
long total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
return Math.sqrt(total);
}
static class Point implements Comparable<Point> {
int x, y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public int compareTo(Point o) {
if (x != o.x) {
return x - o.x;
}
return y - o.y;
}
}
public static boolean nextPer(int[] data) {
int i = data.length - 1;
while (i > 0 && data[i] < data[i - 1]) {
i--;
}
if (i == 0) {
return false;
}
int j = data.length - 1;
while (data[j] < data[i - 1]) {
j--;
}
int temp = data[i - 1];
data[i - 1] = data[j];
data[j] = temp;
Arrays.sort(data, i, data.length);
return true;
}
static class FT {
int[] data;
FT(int n) {
data = new int[n];
}
void update(int index, int val) {
// System.out.println("UPDATE INDEX " + index);
while (index < data.length) {
data[index] += val;
index += index & (-index);
// System.out.println("NEXT " +index);
}
}
int get(int index) {
// System.out.println("GET INDEX " + index);
int result = 0;
while (index > 0) {
result += data[index];
index -= index & (-index);
// System.out.println("BACK " + index);
}
return result;
}
}
static int gcd(int a, int b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
static int pow(int a, int b) {
if (b == 0) {
return 1;
}
if (b == 1) {
return a;
}
int val = pow(a, b / 2);
if (b % 2 == 0) {
return val * val;
} else {
return val * val * a;
}
}
// static Point intersect(Point a, Point b, Point c) {
// double D = cross(a, b);
// if (D != 0) {
// return new Point(cross(c, b) / D, cross(a, c) / D);
// }
// return null;
// }
//
// static Point convert(Point a, double angle) {
// double x = a.x * cos(angle) - a.y * sin(angle);
// double y = a.x * sin(angle) + a.y * cos(angle);
// return new Point(x, y);
// }
// static Point minus(Point a, Point b) {
// return new Point(a.x - b.x, a.y - b.y);
// }
//
// static Point add(Point a, Point b) {
// return new Point(a.x + b.x, a.y + b.y);
// }
//
// static double cross(Point a, Point b) {
// return a.x * b.y - a.y * b.x;
//
//
// }
//
// static class Point {
//
// int x, y;
//
// Point(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// @Override
// public String toString() {
// return "Point: " + x + " " + y;
// }
// }
static class Scanner {
BufferedReader br;
StringTokenizer st;
public Scanner() throws FileNotFoundException {
//System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
br = new BufferedReader(new InputStreamReader(System.in));
//br = new BufferedReader(new FileReader(new File("input.txt")));
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
throw new RuntimeException();
}
}
return st.nextToken();
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public String nextLine() {
st = null;
try {
return br.readLine();
} catch (Exception e) {
throw new RuntimeException();
}
}
public boolean endLine() {
try {
String next = br.readLine();
while (next != null && next.trim().isEmpty()) {
next = br.readLine();
}
if (next == null) {
return true;
}
st = new StringTokenizer(next);
return st.hasMoreTokens();
} catch (Exception e) {
throw new RuntimeException();
}
}
}
} | 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 static java.util.Arrays.deepToString;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class Main {
static void solve() throws IOException {
int n = nextInt();
System.out.println(6 * n * (n - 1) + 1);
}
public static void main(String[] args) throws Exception {
reader = new BufferedReader(new InputStreamReader(System.in));
writer = new PrintWriter(System.out);
// reader = new BufferedReader(new FileReader("input.txt"));
// writer = new PrintWriter("output.txt");
setTime();
solve();
printTime();
printMemory();
writer.close();
}
static BufferedReader reader;
static PrintWriter writer;
static StringTokenizer tok = new StringTokenizer("");
static long systemTime;
static void debug(Object... o) {
System.err.println(deepToString(o));
}
static void setTime() {
systemTime = System.currentTimeMillis();
}
static void printTime() {
System.err.println("Time consumed: "
+ (System.currentTimeMillis() - systemTime));
}
static void printMemory() {
System.err.println("Memory consumed: "
+ (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()
.freeMemory()) / 1000 + "kb");
}
static String next() {
while (!tok.hasMoreTokens()) {
String w = null;
try {
w = reader.readLine();
} catch (Exception e) {
e.printStackTrace();
}
if (w == null)
return null;
tok = new StringTokenizer(w);
}
return tok.nextToken();
}
static int nextInt() {
return Integer.parseInt(next());
}
static long nextLong() {
return Long.parseLong(next());
}
static double nextDouble() {
return Double.parseDouble(next());
}
static BigInteger nextBigInteger() {
return new BigInteger(next());
}
} | 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.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class FoolDay_B implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok;
public static void main(String[] args) {
new Thread(null, new FoolDay_B(), "", 256 * (1L << 20)).start();
}
@Override
public void run() {
try {
long startTime = System.currentTimeMillis();
if (ONLINE_JUDGE) {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
} else {
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter("output.txt");
}
Locale.setDefault(Locale.US);
tok = new StringTokenizer("");
solve();
in.close();
out.close();
long freeMemory = Runtime.getRuntime().freeMemory();
long totalMemory = Runtime.getRuntime().totalMemory();
long endTime = System.currentTimeMillis();
System.err.println("Time = " + (endTime - startTime));
System.err.println("Memory = " + ((totalMemory - freeMemory) >> 10));
} catch (Throwable t) {
t.printStackTrace(System.err);
System.exit(-1);
}
}
String readString() throws IOException {
while (!tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}
int readInt() throws IOException {
return Integer.parseInt(readString());
}
long readLong() throws IOException {
return Long.parseLong(readString());
}
double readDouble() throws IOException {
return Double.parseDouble(readString());
}
void debug(Object... o) {
if (!ONLINE_JUDGE) {
System.err.println(Arrays.deepToString(o));
}
}
/** http://pastebin.com/j0xdUjDn */
static class Utils {
private Utils() {}
public static void mergeSort(int[] a) {
mergeSort(a, 0, a.length - 1);
}
private static final int MAGIC_VALUE = 50;
private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
if (leftIndex < rightIndex) {
if (rightIndex - leftIndex <= MAGIC_VALUE) {
insertionSort(a, leftIndex, rightIndex);
} else {
int middleIndex = (leftIndex + rightIndex) / 2;
mergeSort(a, leftIndex, middleIndex);
mergeSort(a, middleIndex + 1, rightIndex);
merge(a, leftIndex, middleIndex, rightIndex);
}
}
}
private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
int length1 = middleIndex - leftIndex + 1;
int length2 = rightIndex - middleIndex;
int[] leftArray = new int[length1];
int[] rightArray = new int[length2];
System.arraycopy(a, leftIndex, leftArray, 0, length1);
System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
if (i == length1) {
a[k] = rightArray[j++];
} else if (j == length2) {
a[k] = leftArray[i++];
} else {
a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
}
}
}
private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
for (int i = leftIndex + 1; i <= rightIndex; i++) {
int current = a[i];
int j = i - 1;
while (j >= leftIndex && a[j] > current) {
a[j + 1] = a[j];
j--;
}
a[j + 1] = current;
}
}
}
// solution
void solve() throws IOException {
// 1, 12, 24
int n = readInt();
//for (n = 1; n <= 10; n++)
{
int a = 1;
int sum = 1;
int ans = 1;
while (true) {
if (n <= ans) {
out.println(sum);
break;
}
if (a == 1) a += 11; else a += 12;
sum += a;
ans++;
}
}
}
} | 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())
if a == 1:
print(1)
else:
print(12 * (a - 1) * a // 2 + 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 t;
scanf("%d", &t);
printf("%lld", (long long)(t * 3 - 2) * (t * 3 - 1) / 2 +
(long long)t * 3 * (t - 1) / 2);
}
| 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 = 0, output = 0, last = 1, i = 1, j = -1;
cin >> a;
for (int k = 1; k <= a; k++) {
output = last + 2 * i + 2 * j;
i += 2;
j += 4;
last = output;
}
cout << output;
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;
signed main() {
long long n, ans = 0;
cin >> n;
for (long long i = 2; i <= n; i++) ans += (i * 2 - 1) * 6 - 6;
cout << ans + 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 N;
int main() {
scanf("%d", &N);
printf("%d", (N - 1) * N * 6 + 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 sys
n = int(sys.stdin.readline()) # get the number of test cases
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(input())
print(1 + (a * (a - 1) // 2) * 12) | 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;
cout << (n * n * 6) - 6 * (n - 1) - 5 << 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 << 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 | import java.util.Scanner;
public class B171 {
public static void main(String[] args)
{
Scanner read = new Scanner(System.in);
short input = read.nextShort();
read.close();
System.out.println((6*input*(input-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 | n = int(input())
x = n * 3 - 2
print(x * (x + 1) - (n * (n + 1) * 3 - n * 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 | #include <bits/stdc++.h>
using namespace std;
long long xd(long long n) { return (((n - 1) * 12) * n) / 2 + 1; }
int main() {
long long n;
cin >> n;
cout << xd(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>
int main() {
int ans = 1, n;
scanf("%d", &n);
for (int i = 1; i < n; i++) ans += 12 * i;
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 | a = int(raw_input())
print 6 * a * (a - 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, t = 1, ekle = 0, x;
cin >> x;
for (i = 1; i <= x; i++) {
t += ekle;
ekle += 12;
}
cout << t << 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 mod = 1000000007;
const int maxn = 1000000 + 10;
int main() {
int n;
cin >> n;
long long int s = 1;
for (int i = 1; i < n; i++) s += i * 12;
cout << s << 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;
int a[18258];
a[0] = 1;
a[1] = 12;
a[2] = 24;
int i;
for (i = 3; i < 18257; i++) a[i] = a[i - 1] + 12;
while (cin >> n) {
long long sum = 0;
for (i = 0; i < n; i++) sum += a[i];
cout << sum << 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 << 1 + (n) * (n - 1) / 2 * 12 << 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 sc = new Scanner(System.in); int a = sc.nextInt(); System.out.println(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() {
long long N;
cin >> N;
long long res = (6 * N) * (N - 1) + 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() {
int n;
cin >> n;
int i;
int s = 1;
for (i = 2; i <= n; i++) {
s += (i - 1) * 12;
}
cout << s << endl;
return 0;
}
| CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.