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 | a=int(input())
print(6*a*(a-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 work(string s) {
reverse((s).begin(), (s).end());
int ans = 0, p = 1;
for (int i = s.length() - 1; i >= 0; i--) {
ans += (s[i] - '0') * p;
p *= 10;
}
return ans;
}
int main() {
int a;
cin >> a;
long long ans = 1;
for (int i = 2; i <= a; i++) {
ans += (i - 1) * 2 * 6;
}
cout << ans << endl;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long 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.util.*;
public class A {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int a = sc.nextInt();
int ans = 1;
for(int i = 2; i <= a; ++i)
ans += 6 * (i * 2 - 2);
out.println(ans);
out.close();
}
static class Scanner
{
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}
public Scanner(FileReader s) throws FileNotFoundException { br = new BufferedReader(s);}
public String next() throws IOException
{
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {return Integer.parseInt(next());}
public long nextLong() throws IOException {return Long.parseLong(next());}
public String nextLine() throws IOException {return br.readLine();}
public double nextDouble() throws IOException { return Double.parseDouble(next()); }
public boolean ready() throws IOException {return br.ready();}
}
} | JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long n = 2000000000;
int main() {
long long a;
cin >> a;
long long res = 1, deg = 2;
for (long long i = 1; i < a; ++i) {
res = (res + 6 * deg) % n;
deg = (deg + 2) % n;
}
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 |
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner s = new Scanner (System.in);
int n= s.nextInt();int ans=0;
n --;
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 n;
long long f[100005];
int main() {
scanf("%d", &n);
f[1] = 1;
for (int i = 2; i <= n; i++) f[i] = (i * 2 - 1) * 6 + f[i - 1] - 6;
printf("%lld\n", 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 | #include <bits/stdc++.h>
using namespace std;
int n, m, k, a[18257 + 7];
int main() {
cin >> n;
a[1] = 1;
k = 12;
for (int i = 2; i <= n; i++, k += 12) a[i] = a[i - 1] + k;
cout << a[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.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception{
new Main().run();
}
private void run() throws Exception{
Scanner input = new Scanner(System.in);
int num = input.nextInt();
System.out.println(6*(num-1)*(num)+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, s = 1;
cin >> a;
for (int i = 1; i < a; i++) 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long num, x = 1, i;
cin >> num;
for (i = 1; i < num; i++) x = x + (12 * i);
cout << x << 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())
s = 1
for i in range(1,n):
s += 12*i
# print(s)
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() {
long long int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long mod(long long x) {
return ((x % 1000000009 + 1000000009) % 1000000009);
}
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long mult(long long a, long long b) { return mod(mod(a) * mod(b)); }
long long modPow(long long a, long long b) {
if (b == 0) return 1LL;
if (b == 1) return a % 1000000009;
long long res = 1;
while (b) {
if (b % 2 == 1) res = mult(res, a);
a = mult(a, a);
b = b / 2;
}
return res;
}
vector<long long> v(1000000);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
long long n;
cin >> n;
v[1] = 1;
long long count = 1;
for (long long i = 2; i <= n; i++) {
v[i] = v[i - 1] + 6 + 6 * count;
count += 2;
}
cout << v[n] << "\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 | n=input()
print (6*n*(n-1))+1,"\n" | PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | n = int(input())
if n == 1:
print(1)
exit(0)
k = 12
ans = k
for i in range(n - 2):
k = k + 12
ans += k
print(ans + 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 Star{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long ans = 1;
long g = 0;
for( int i = 2; i <= n; i++){
g += 12;
ans += g;
}
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() {
int n, a = 12, b = 1;
cin >> n;
for (int i = 1; i < n; i++) {
b += a;
a += 12;
}
cout << b << endl;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int a, ans = 1, p = 0;
cin >> a;
if (a == 1) ans = 1;
for (int i = 1; i < a; ++i) {
p += 12;
ans += p;
}
cout << ans << '\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.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
(new Main()).solve();
}
public Main() {
}
MyReader in = new MyReader();
PrintWriter out = new PrintWriter(System.out);
void solve() throws IOException {
//BufferedReader in = new BufferedReader(new
//InputStreamReader(System.in));
//Scanner in = new Scanner(System.in);
//Scanner in = new Scanner(new FileReader("forbidden-triples.in"));
//PrintWriter out = new PrintWriter("forbidden-triples.out");
int n = in.nextInt();
int d = 12;
int res = 1;
for (int i = 2; i <= n; i++) {
res += d;
d += 12;
}
out.println(res);
out.close();
}
int reverse(int a) {
int res = 0;
while (a > 0) {
res = res * 10 + a % 10;
a /= 10;
}
return res;
}
};
class MyReader {
private BufferedReader in;
String[] parsed;
int index = 0;
public MyReader() {
in = new BufferedReader(new InputStreamReader(System.in));
}
public int nextInt() throws NumberFormatException, IOException {
if (parsed == null || parsed.length == index) {
read();
}
return Integer.parseInt(parsed[index++]);
}
public long nextLong() throws NumberFormatException, IOException {
if (parsed == null || parsed.length == index) {
read();
}
return Long.parseLong(parsed[index++]);
}
public String nextString() throws IOException {
if (parsed == null || parsed.length == index) {
read();
}
return parsed[index++];
}
private void read() throws IOException {
parsed = in.readLine().split(" ");
index = 0;
}
public String readLine() throws IOException {
return in.readLine();
}
}; | JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a;
cin >> a;
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>
using namespace std;
int main() {
long long 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 | import java.util.Scanner;
public class C_171_b {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sum = 1 ;
for (int i = 1; i <= n-1; i++) {
sum +=2*i*6;
}
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;
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 | def calc(n):
return (1+n)*n/2
n=int(raw_input())
p=1
q=0
for i in range(n-1):
p+=3
q+=1
print calc(p)+calc(q)*3 | 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 | x = int(input())
print(6*x*(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 | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Alex
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
TaskB solver = new TaskB();
solver.solve(1, in, out);
out.close();
}
}
class TaskB {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.ri();
out.printLine(6 * n * (n - 1) + 1);
}
}
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 ri(){
return readInt();
}
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 boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
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 void close() {
writer.close();
}
public void printLine(int i) {
writer.println(i);
}
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
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 n;
cin >> n;
cout << (1ll + ((n - 1ll) * n * 6ll)) << 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())
sum = 1
if(n==1):
print(sum)
else:
for i in range(n-1):
sum += 12*(n-1)
n=n-1
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 a[200000];
int main() {
int n, m, i;
a[1] = 1;
for (i = 2; i <= 18257; i++) a[i] = a[i - 1] + 12 * (i - 1);
while (~scanf("%d", &n)) {
printf("%d\n", a[n]);
}
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int res = 0;
for (int i = 1; i < n; i++) res += i;
int x = 2 * n - 1;
for (int i = 1; i < n; i++) res += x + i;
res *= 2;
res += x;
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.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class Task {
private static final boolean readFromFile = false;
public static void main(String args[]){
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
FileOutputStream fileOutputStream;
FileInputStream fileInputStream;
if (readFromFile){
try{
fileInputStream = new FileInputStream(new File("input.txt"));
fileOutputStream = new FileOutputStream(new File("output.txt"));
}catch (FileNotFoundException e){
throw new RuntimeException(e);
}
}
PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);
InputReader in = new InputReader((readFromFile)?fileInputStream:inputStream);
Solver s = new Solver(in,out);
s.solve();
out.close();
}
}
class Solver{
InputReader in;
PrintWriter out;
public void solve(){
int n = in.nextInt(),
razn = 12,
ans = 1;
for (int i=1;i<n;i++){
ans += razn;
razn += 12;
}
out.println(ans);
}
Solver(InputReader in, PrintWriter out){
this.in=in;
this.out=out;
}
}
class InputReader{
private BufferedReader buf;
private StringTokenizer tok;
InputReader(InputStream in){
tok = null;
buf = new BufferedReader(new InputStreamReader(in));
}
InputReader(FileInputStream in){
tok = null;
buf = new BufferedReader(new InputStreamReader(in));
}
public String next(){
while (tok==null || !tok.hasMoreTokens()){
try{
tok = new StringTokenizer(buf.readLine());
}catch (IOException e){
throw new RuntimeException(e);
}
}
return tok.nextToken();
}
public int nextInt(){
return Integer.parseInt(next());
}
public long nextLong(){
return Long.parseLong(next());
}
public double nextDouble(){
return Double.parseDouble(next());
}
public float nextFloat(){
return Float.parseFloat(next());
}
public String nextLine(){
try{
return buf.readLine();
}catch (IOException e){
return null;
}
}
} | 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.*;
public class B
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int rtn = 1;
for(int i=2;i <= n;i++)
rtn += (i-1)*12;
System.out.println(rtn);
}
} | 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())
b = (6*n*(n - 1)) + 1
print(b) | 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())
accu = 0
cur = 1
for i in range(a):
cur += accu
accu += 12
print(cur) | 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 | #!/usr/bin/python
import sys
import math
def num(x):
return (x - 1) * 2 * 6
n = int((sys.stdin.readline()).strip())
if n <= 0:
print "Error n=%d" % n
quit(-1)
if n == 1:
print "1"
quit()
result = 1
for i in range(2, n+1):
result += num(i)
print result
quit()
| PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, ans = 1;
int main() {
cin >> n;
for (int i = 2; i <= n; ++i) ans += (i - 1) * 12;
cout << ans;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int number = 0;
cin >> number;
long long int answer = 1;
for (int i = 2; i <= number; i++) answer = answer + 12 * (i - 1);
cout << answer << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.io.*;
import java.util.*;
import java.math.*;
//4/1/12 7:38 PM
//by Abrackadabra
public class B {
public static void main(String[] args) throws IOException {
if (args.length > 0 && args[0].equals("Abra")) debugMode = true;
new B().run();
}
int IOMode = 0; //0 - consoleIO, 1 - <taskName>.in/out, 2 - input.txt/output.txt, 3 - test case generator
String taskName = "";
void solve() throws IOException {
int n = nextInt();
int res = 0;
for (int i = n; i >= 1; i--) {
if (i == 1) {
res++;
break;
}
res += i * 12 - 12;
}
out.println(res);
}
int calc(int x) {
if (x == 1) return 1;
return x * 12 - 12 + calc(x - 1);
}
long startTime = System.nanoTime(), tempTime = startTime, finishTime = startTime;
long startMem = Runtime.getRuntime().totalMemory(), finishMem = startMem;
void run() throws IOException {
init();
if (debugMode) {
con.println("Start");
con.println("Console:");
}
solve();
finishTime = System.nanoTime();
finishMem = Runtime.getRuntime().totalMemory();
out.flush();
if (debugMode) {
int maxSymbols = 1000;
BufferedReader tbr = new BufferedReader(new FileReader("input.txt"));
char[] a = new char[maxSymbols];
tbr.read(a);
if (a[0] != 0) {
con.println("File input");
con.println(a);
if (a[maxSymbols - 1] != 0) con.println("...");
}
tbr = new BufferedReader(new FileReader("output.txt"));
a = new char[maxSymbols];
tbr.read(a);
if (a[0] != 0) {
con.println("File output");
con.println(a);
if (a[maxSymbols - 1] != 0) con.println("...");
}
con.println("Execution time: " + (finishTime - startTime) / 1000000000.0 + " sec");
con.println("Used memory: " + (finishMem - startMem) + " bytes");
con.println("Total memory: " + Runtime.getRuntime().totalMemory() + " bytes");
}
}
boolean tick(double x) {
if (System.nanoTime() - tempTime > x * 1e9) {
tempTime = System.nanoTime();
con.println("Tick at " + (tempTime - startTime) / 1000000000 + " sec");
con.print(" ");
return true;
}
return false;
}
static boolean debugMode = false;
PrintStream con = System.out;
void init() throws IOException {
if (debugMode && IOMode != 3) {
br = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(new FileWriter("output.txt"));
} else
switch (IOMode) {
case 0:
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
break;
case 1:
br = new BufferedReader(new FileReader(taskName + ".in"));
out = new PrintWriter(new FileWriter(taskName + ".out"));
break;
case 2:
br = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(new FileWriter("output.txt"));
break;
case 3:
out = new PrintWriter(new FileWriter("input.txt"));
break;
}
}
BufferedReader br;
PrintWriter out;
StringTokenizer in;
boolean hasMoreTokens() throws IOException {
while (in == null || !in.hasMoreTokens()) {
String line = br.readLine();
if (line == null) return false;
in = new StringTokenizer(line);
}
return true;
}
String nextString() throws IOException {
return hasMoreTokens() ? in.nextToken() : null;
}
int nextInt() throws IOException {
return Integer.parseInt(nextString());
}
long nextLong() throws IOException {
return Long.parseLong(nextString());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextString());
}
} | 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=[0]*18258
a[1]=1
n=int(input())
for i in range (2,n+1):
a[i]=a[i-1] + ((i*2 - 2)*6)
print(a[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.*;
import java.util.*;
public class B implements Runnable {
public static void main(String[] args) {
new Thread(new B()).run();
}
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer in;
PrintWriter out = new PrintWriter(System.out);
public String nextToken() throws IOException {
while (in == null || !in.hasMoreTokens()) {
in = new StringTokenizer(br.readLine());
}
return in.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
public double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
public void solve() throws IOException {
int a = nextInt();
int ans = 1;
for (int i = 2; i <= a; i++) {
ans += 6 * (2 * i - 2);
}
out.println(ans);
}
public void run() {
try {
solve();
out.close();
} catch (IOException e) {
e.printStackTrace();
System.exit(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::sync_with_stdio(0);
cin.tie(0);
long long int i, n, sum = 1;
cin >> n;
for (i = 1; i < n; i++) sum += 12 * 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;
void solve(void) {
int N;
long int s = 0;
cin >> N;
for (int i = 2; i <= N; i++) s += i - 1;
cout << s * 6 * 2 + 1 << endl;
}
int main(int argc, char const *argv[]) {
solve();
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | n = int(input())
print((6*n*(n-1))+1)
| PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
int in() {
int r = 0, c;
for (c = getchar(); c <= 32; c = getchar())
;
if (c == '-') return -in();
for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
;
return r;
}
int main() {
int N = in();
long long res = 1;
for (int i = 2; i <= N; i++) {
res = res + ((i * 2 - 1) * 6) - 6;
if (res > 2000000000) {
res = 2000000000;
break;
}
}
printf("%d\n", res);
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.io.*;
import java.util.*;
import java.text.DecimalFormat;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solution.solve(in, out);
out.close();
}
static final Random random=new Random();
static void ruffleSort(int[] a) {
int n=a.length;//shuffle, then sort
for (int i=0; i<n; i++) {
int oi=random.nextInt(n), temp=a[oi];
a[oi]=a[i]; a[i]=temp;
}
Arrays.sort(a);
}
static long gcd(long x, long y){
if(x==0)
return y;
if(y==0)
return x;
long r=0, a, b;
a = Math.max(x, y);
b = Math.min(x, y);
r = b;
while(a % b != 0){
r = a % b;
a = b;
b = r;
}
return r;
}
static long modulo(long a,long b,long c){
long x=1,y=a%c;
while(b > 0){
if(b%2 == 1)
x=(x*y)%c;
y = (y*y)%c;
b = b>>1;
}
return x%c;
}
public static void debug(Object... o){
System.err.println(Arrays.deepToString(o));
}
static String printPrecision(double d){
DecimalFormat ft = new DecimalFormat("0.00000000000");
return String.valueOf(ft.format(d));
}
static int countBit(long mask){
int ans=0;
while(mask!=0){
mask&=(mask-1);
ans++;
}
return ans;
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
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 int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] readArray(int n)
{
int[] arr=new int[n];
for(int i=0;i<n;i++) arr[i]=nextInt();
return arr;
}
}
}
class Solution
{
static long mod=(long)1e9+7;
static long mod1=998244353;
public static void solve(Main.InputReader in, PrintWriter out)
{
long n=in.nextLong();
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>
int main() {
unsigned long long n, star_n;
scanf("%I64u", &n);
star_n = 6LL * n * (n - 1) + 1;
printf("%I64u", 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 | n=int(input())
if n==1:
print(1)
else:
print(1+((n-1)*(12*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 | n = int(input())
x = int(12*n*(n-1)/2 + 1)
print(x)
| 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(raw_input())
ans = 1
for i in range(1,n):
ans += 12*i
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;
static const double EPS = 1e-5;
int num = 0;
void star(int n) {
if (n == 1) num++;
if (n > 1) {
num += 12 * (n - 1);
star(n - 1);
}
}
int main(int argc, const char* argv[]) {
int a;
cin >> a;
star(a);
cout << num;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | N = input()
print 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;
int N;
int main(void) {
scanf("%d", &N);
printf("%d\n", 6 * N * (N - 1) + 1);
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b = 1, x = 0;
cin >> a;
a--;
for (int k = 1; k <= a; k++) {
x += 2;
b += 6 * x;
}
cout << 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 | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int ans = 1;
for (int i = 2; i <= a; i++) {
ans += 12*(i-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.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
*/
public class Main {
private static BufferedReader br;
private static StringTokenizer st;
private static PrintWriter pw;
static int[][] dp;
static LinkedList<Integer>[] edges;
static int[] dist;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = readInt();
long ret = 1;
for(int i = 2; i <= n; i++) {
ret += 12*(i-1);
}
pw.println(ret);
pw.close();
}
/* NOTEBOOK CODE */
public static void loadArray(int[][] grid) throws IOException {
for(int[] a: grid)
loadArray(a);
}
public static void loadArray(int[] in) throws IOException {
for(int i = 0; i < in.length; i++)
in[i] = readInt();
}
public static void loadArray(long[] in) throws IOException {
for(int i = 0; i < in.length; i++)
in[i] = readLong();
}
private static long readLong() throws IOException {
return Long.parseLong(nextToken());
}
private static double readDouble() throws IOException {
return Double.parseDouble(nextToken());
}
private static int readInt() throws IOException {
return Integer.parseInt(nextToken());
}
private static String nextToken() throws IOException {
while(st == null || !st.hasMoreTokens()) {
if(!br.ready()) {
pw.close();
System.exit(0);
}
st = new StringTokenizer(br.readLine().trim());
}
return st.nextToken();
}
} | JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | n = int(input())
otv = 1
for i in range(1, n):
otv += 12 * i
print(otv) | 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>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, res = 1, s = 0;
cin >> a;
for (int i = 1; i < a; i++) {
s += 12;
res += s;
}
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m = 1;
cin >> n;
for (int i = 1; i < n; i++) {
m += (12 * i);
}
cout << m << 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, output = 1;
cin >> n;
if (n == 1) {
cout << n;
return 0;
} else
while (n > 1) {
output += (n - 1) * 12;
n--;
}
cout << output << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.util.*;
public class CodeForces{
public static int findIt(int m){
if(m<=1)
return 1;
else
return ((m-1)*12)+findIt(m-1);
}
public static void main(String[] arg){
Scanner sc = new Scanner(System.in);
System.out.print(findIt(sc.nextInt()));
}
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | def star(n):
f = 1
while n:
n -=1
f += n*12
return f
print(star(int(input()))) | PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
int main() {
long long a, b, c, sum;
while (scanf("%I64d", &a) != EOF) {
sum = 1;
c = 12;
for (b = 1; b < a; b++) {
sum += c;
c = c + 12;
}
printf("%I64d\n", 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 a;
scanf("%d", &a);
printf("%d", 1 + 6 * (a - 1) * 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;
int main() {
unsigned long long int a, s = 0, i;
cin >> a;
for (i = 1; i <= a; i++) {
s = s + i - 1;
}
cout << s * 12 + 1 << endl;
;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.util.*;
public class P171B {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int A = in.nextInt();
int ans = 1;
for (int i = 1; i < A; ++i)
ans += 12*i;
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() {
int a;
scanf("%d", &a);
printf("%I64d\n", 1 + (long long)a * (long long)(a - 1) * 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 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt()-1;
int a[]=new int[18258];
a[0]=1;
a[1]=13;
for (int i=2; i<=n; i++) {
a[i]=12*i+a[i-1];
}
System.out.println(a[n]);
}
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
long long int ans = 6 * a * (a - 1) + 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 | // package mainpackage;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String... args) throws Exception {
out = new PrintWriter(System.out);
new Main().solve();
out.close();
}
private static PrintWriter out;
private BufferedReader reader;
private int a;
private void solve() throws Exception {
reader = new BufferedReader(new InputStreamReader(System.in));
a = Integer.parseInt(reader.readLine());
out.println(6 * a * (a - 1) + 1);
reader.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 | n=int(input())
if n==1:
print(1)
else:
s=0
for i in range(n):
s+=12*i
s+=1
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>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
int a;
int main() {
cin >> a;
int ans = 1;
for (int i = 2; i <= a; i++) {
ans += (2 * i - 2) * 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>
inline int getInt() {
int s;
scanf("%d", &s);
return s;
}
using namespace std;
int main() {
int ans = 1;
int n = getInt();
for (int i = 0; i < (int)(n - 1); i++) {
ans += ((i + 1) * 2 + 1) * 3;
ans += ((i + 1) * 2 - 1) * 3;
}
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 | from __future__ import division
def read(func=None):
return func(raw_input()) if func else raw_input()
################################
a = read(int)
def solve(a):
if a == 1:
return 1
if a == 2:
return 13
prev1 = 3
prev2 = 1
total = 13
for i in xrange(3, a + 1):
prev1 += 2
prev2 += 2
total += (prev1 + prev2) * 3
return total
print solve(a) | PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | def f(x):
return 6 + 6*(2*x + 1)
a = int(raw_input())
sum = 1
for x in xrange(a-1):
sum += f(x)
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 | n = input()
print 1+sum([12*(i-1) for i in range(2,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 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long n = s.nextLong();
long res = 6*n*(n-1)+1;
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 | n=int(input())
print(6*n*n-6*n+1)
| PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long i, j, k, l, n, m, p;
while (cin >> n) {
k = 0;
for (i = 1; i <= n - 1; i++) {
k += 12 * i;
}
k++;
printf("%lld\n", k);
}
}
| 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 res = 1;
int main() {
int n;
cin >> n;
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int A;
cin >> A;
cout << 6 * A * (A - 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 | n = int(input())
print(1+6*n*(n-1)) | PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.util.Scanner;
public class Star {
public static void main(String[] args) {
new Star().solve();
}
public void solve(){
Scanner in = new Scanner(System.in);
int input = in.nextInt();
int ans = recurse(input);
System.out.println(ans);
}
public int recurse(int input){
if(input == 1){
return 1;
}
int ans =(input -1)*12;
return recurse(input-1)+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() {
int n, s, i;
cin >> n;
s = 1;
for (i = 2; i <= n; i++) s += (2 * i - 1) * 6 - 6;
cout << s;
cin.get();
cin.get();
}
| 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.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class CF_C {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int[] vals=new int[18258];
vals[1]=1;
for(int i=2;i<vals.length;i++)
vals[i]=vals[i-1]+6*((i-2)*2+1)+6;
System.out.println(vals[sc.nextInt()]);
}
}
| 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 int a = 0;
cin >> a;
cout << 6 * a * (a - 1) + 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
n--;
int sum = 1;
for (int i = 1; i <= n; i++) sum += 12 * i;
cout << sum;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int num = in.nextInt();
int sum = (num-1)*(num) / 2;
System.out.println(12*sum + 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 int n, ans = 1, k;
cin >> n;
ans = 3 * n - 2;
ans = (ans * (ans + 1)) / 2;
k = 3 * (n * (n - 1)) / 2;
cout << k + 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;
int main() {
long long n;
cin >> n;
cout << 1 + 6 * n * (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() {
int a;
int x;
cin >> a;
x = 6 * a * (a - 1) + 1;
cout << x << 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;
cin >> a;
int output = 0;
int an = 12 * (a - 1);
output = an / 2 * a;
cout << output + 1;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | n = int(raw_input())
c = 1
for i in xrange(n):
c += 12 * i
print c
#print (12 ** (n + 1) - 1) / (12 ** 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>
int main() {
int n;
while (scanf("%d", &n) != EOF) {
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 | n = int(raw_input())
ans = 3 * (n * (n-1) >> 1)
ans += ((3*n-2) * (3*n-1) >> 1)
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 | n = int(raw_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 | import java.util.Scanner;
public class Star {
public static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
int numLayers = in.nextInt();
int total = 0;
int odd = 3;
for (int i = 0; i < numLayers; i ++) {
if (i == 0)
total += 1;
else {
total += odd * 6 - 6;
odd += 2;
}
}
System.out.println(total);
}
}
| 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;
cout << (long long)(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.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Egor Kulikov ([email protected])
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
TaskB solver = new TaskB();
solver.solve(1, in, out);
out.close();
}
}
class TaskB {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int n = in.readInt();
long answer = 1;
for (int i = 1; i < n; i++)
answer += 12 * i;
out.printLine(answer);
}
}
class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
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 static boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(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();
}
}
| JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.