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.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
/**
* Works good for CF
* @author cykeltillsalu
*/
public class A {
//some local config
static boolean test = false;
static String testDataFile = "testdata.txt";
static String feedFile = "feed.txt";
CompetitionType type = CompetitionType.CF;
private static String ENDL = "\n";
// solution
private void solve() throws Throwable {
int n = iread();
int tot = 1;
for (int i = 1; i < n; i++) {
tot += 6*2*i;
}
System.out.println(tot);
out.flush();
}
public int iread() throws Exception {
return Integer.parseInt(wread());
}
public double dread() throws Exception {
return Double.parseDouble(wread());
}
public long lread() throws Exception {
return Long.parseLong(wread());
}
public String wread() throws IOException {
StringBuilder b = new StringBuilder();
int c;
c = in.read();
while (c >= 0 && c <= ' ')
c = in.read();
if (c < 0)
return "";
while (c > ' ') {
b.append((char) c);
c = in.read();
}
return b.toString();
}
public static void main(String[] args) throws Throwable {
if(test){ //run all cases from testfile:
BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
String readLine = testdataReader.readLine();
int casenr = 0;
out: while (true) {
BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
if(!readLine.equals("input")){
break;
}
while (true) {
readLine = testdataReader.readLine();
if(readLine.equals("output")){
break;
}
w.write(readLine + "\n");
}
w.close();
System.out.println("Answer on case "+(++casenr)+": ");
new A().solve();
System.out.println("Expected answer: ");
while (true) {
readLine = testdataReader.readLine();
if(readLine == null){
break out;
}
if(readLine.equals("input")){
break;
}
System.out.println(readLine);
}
System.out.println("----------------");
}
testdataReader.close();
} else { // run on server
new A().solve();
}
out.close();
}
public A() throws Throwable {
if (test) {
in = new BufferedReader(new FileReader(new File(feedFile)));
}
}
InputStreamReader inp = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(inp);
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
enum CompetitionType {CF, OTHER};
} | 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 susbus{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long p = n*n*6-6*n+1;
System.out.println(p);
}
} | 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 arr[18530];
arr[0] = 0;
arr[1] = 1;
arr[2] = 13;
for (int i = 3; i <= 18527; i++) arr[i] = 12 * (i - 1) + arr[i - 1];
int n;
cin >> n;
cout << arr[n] << endl;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.io.*;
public class star
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
int i,n,s;
s=0;
n=Integer.parseInt(in.readLine());
if(n>1)
{
for(i=1;i<n;i++)
s+=i;
}
s*=12;
s+=1;
System.out.println(s);
}
} | 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.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
//Scanner in=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
Integer n=Integer.parseInt(in.readLine());
long sum=1;
for(int i=2; i<=n; i++){
sum+=(i-1)*12;
}
out.println(sum);
out.close();
}
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &x) {
cin >> x;
}
template <class A>
void read(vector<A> &x) {
for (auto &a : x) read(a);
}
string to_string(bool b) { return b ? "TRUE" : "FALSE"; }
string yesno(bool b) { return b ? "YES" : "NO"; }
string to_string(char c) { return string(1, c); }
void print() { cout << "\n"; }
template <class A>
void print(vector<A> a) {
for (auto &x : a) cout << to_string(x) << " ";
print();
}
template <class A>
void print(vector<vector<A>> a) {
for (auto &x : a) print(x);
}
void solve() {
int a;
read(a);
long long ans = 1;
for (int i = 1; i < a; i++) ans += 12 * i;
cout << ans;
}
int main() {
ios::sync_with_stdio(false);
solve();
cout << "\n";
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
unsigned long long n, ans = 1;
int main() {
cin >> n;
for (unsigned long long i = 2; i <= n; i++) ans += (i - 1) * 12;
cout << ans;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | n=input()
n=n-1
if n==0:
print "1"
exit(0)
print (n*(2*12+(n-1)*12))/2+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() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
long long m = n - 1, ans = 0;
for (long long k = m; k >= 1; k--) {
long long j = 12 * k;
ans += j;
}
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 | 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.util.Scanner;
public class Main1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
System.out.println(1+6*((a-1)*a));
}
} | JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
int main() {
long long int n;
scanf("%I64d", &n);
printf("%I64d", 1 + n * (n - 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0;
scanf("%d", &n);
int s = 0, nr = 0;
s = 1;
for (int i = 2; i <= n; i++) nr += 12, s += nr;
printf("%d\n", s);
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, result = 1;
cin >> a;
for (int i = 1; i <= a; i++) {
result = result + (i - 1) * 12;
}
cout << result;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
#pragma hdrstop
using namespace std;
#pragma argsused
int main(int argc, char* argv[]) {
int a, b = 1;
cin >> a;
for (int i = 1; i < a; i++) {
b += 12 * i;
}
cout << b << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | a = int(input())
print(6 * a**2 - 6 * a + 1) | PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
int main() {
int n;
scanf("%d\n", &n);
printf("%d\n", n * 6 * (n - 1) + 1);
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int a = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = -1;
for (; isdigit(ch); ch = getchar()) a = (a << 3) + (a << 1) + ch - '0';
return a * f;
}
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
signed main() {
int n = read();
printf("%d\n", 1 + 12 * ((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 | x = int(input()) - 1
y = 6*x**2 + 6*x + 1
print(y)
| PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[21111];
a[1] = 1;
for (int i = 2; i <= n; i++) {
a[i] = a[i - 1] + ((i - 1) * 2 - 1) * 3 + i * 6 - 3;
}
cout << a[n] << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | a=int(input())
print(1+6*a*(a-1)) | PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long tr(long long x) { return x * (x + 1) / 2; }
int main() {
long long n;
cin >> n;
cout << tr(n * 2 + n - 2) + 3 * tr(n - 1) << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long long s = 0;
cin >> n;
n--;
s = 1;
for (int i = 1; i <= n; i++) {
s = s + 12 * i;
}
cout << s;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | a = int(input())
print((a-1)*(a)*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 | //package aprilfool;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int a = ni();
long s = 1;
for(int i = 2;i <= a;i++){
s += (i-1)*12;
}
out.println(s);
}
void run() throws Exception
{
is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
long s = System.currentTimeMillis();
solve();
out.flush();
tr(System.currentTimeMillis()-s+"ms");
}
public static void main(String[] args) throws Exception
{
new B().run();
}
public int ni()
{
try {
int num = 0;
boolean minus = false;
while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
if(num == '-'){
num = 0;
minus = true;
}else{
num -= '0';
}
while(true){
int b = is.read();
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
}
} catch (IOException e) {
}
return -1;
}
public long nl()
{
try {
long num = 0;
boolean minus = false;
while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
if(num == '-'){
num = 0;
minus = true;
}else{
num -= '0';
}
while(true){
int b = is.read();
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
}
} catch (IOException e) {
}
return -1;
}
public String ns()
{
try{
int b = 0;
StringBuilder sb = new StringBuilder();
while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
if(b == -1)return "";
sb.append((char)b);
while(true){
b = is.read();
if(b == -1)return sb.toString();
if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
sb.append((char)b);
}
} catch (IOException e) {
}
return "";
}
public char[] ns(int n)
{
char[] buf = new char[n];
try{
int b = 0, p = 0;
while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
if(b == -1)return null;
buf[p++] = (char)b;
while(p < n){
b = is.read();
if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
buf[p++] = (char)b;
}
return Arrays.copyOf(buf, p);
} catch (IOException e) {
}
return null;
}
double nd() { return Double.parseDouble(ns()); }
boolean oj = System.getProperty("ONLINE_JUDGE") != null;
void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}
| 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())
n=a-1
s=n*(6*n+6)
print(s+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;
const int intmax = 0x3f3f3f3f;
const long long lldmax = 0x3f3f3f3f3f3f3f3fll;
double eps = 1e-8;
template <class T>
inline void checkmin(T &a, T b) {
if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
return x * x;
}
template <class T>
inline T lowbit(T n) {
return (n ^ (n - 1)) & n;
}
template <class T>
inline int countbit(T n) {
return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
template <class T>
inline T checkmod(T n, T m) {
return (n % m + m) % m;
}
template <class T>
inline T gcd(T a, T b) {
if (a < 0) return gcd(-a, b);
if (b < 0) return gcd(a, -b);
return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T euclid(T a, T b, T &x, T &y) {
if (a < 0) {
T d = euclid(-a, b, x, y);
x = -x;
return d;
}
if (b < 0) {
T d = euclid(a, -b, x, y);
y = -y;
return d;
}
if (b == 0) {
x = 1;
y = 0;
return a;
} else {
T d = euclid(b, a % b, x, y);
T t = x;
x = y;
y = t - (a / b) * y;
return d;
}
}
template <class T>
inline int dblcmp(T a, const T b) {
a -= b;
return a > eps ? 1 : (a < -eps ? -1 : 0);
}
template <class T>
inline int sgn(T a) {
return a > eps ? 1 : (a < -eps ? -1 : 0);
}
const int N = 1100;
int main() {
long long a = 0, sum = 1;
long long n;
cin >> n;
for (int i = 1; i < n; ++i) {
a += 12;
sum += a;
}
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 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static final long MOD = (long) 1e9 + 7;
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
InputReader inputReader = new InputReader(in);
PrintWriter out = new PrintWriter(System.out);
int n = inputReader.getNextInt();
int[] sol = new int[n+1];
int x = -1;
int y = 1;
sol[1] = 1;
for (int i = 2; i <=n; i++) {
x = x + 2;
y = y + 1;
sol[i] = sol[i-1] + (y + y + x - 1) * 3;
}
out.println(sol[n]);
in.close();
out.close();
}
public static boolean isGoodNumber(int x, int a, int b) {
while (x > 0) {
int last = x % 10;
if (last != a && last != b) {
return false;
}
x = x / 10;
}
return true;
}
public static long exp(long b, long e, long mod) {
long sol = 1;
while(e > 0) {
if (e % 2 > 0) {
sol = (sol * b) % mod;
}
b = (b * b) % mod;
e = e / 2;
}
return sol;
}
public static class InputReader {
static final String SEPARATOR = " ";
String[] split;
int head = 0;
BufferedReader in;
public InputReader(BufferedReader in) {
this.in = in;
}
private void fillBuffer() throws RuntimeException {
try {
if (split == null || head >= split.length) {
head = 0;
split = in.readLine().split(SEPARATOR);
}
} catch(Exception e) {
throw new RuntimeException(e);
}
}
public String getNextToken() throws RuntimeException {
fillBuffer();
return split[head++];
}
public int getNextInt() throws RuntimeException {
return Integer.parseInt(getNextToken());
}
public long getNextLong() throws RuntimeException {
return Long.parseLong(getNextToken());
}
}
public static <T> String arrayToString(T[] arr) {
StringBuilder stringBuilder = new StringBuilder();
for(T x: arr) {
stringBuilder.append(x + " ");
}
return stringBuilder.toString();
}
} | 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())
ans = 1
z = 0
for i in range(2, a + 1):
z += 2
ans += z * 6
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>
int main(int argc, char **argv) {
long long int n;
std::cin >> n;
long long int result =
(n * 3LL - 2LL) * (n * 3LL - 1LL) / 2LL + 3LL * n * (n - 1LL) / 2LL;
std::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.*;import java.util.*;public class j{public static void main(String a[])throws IOException{Scanner b=new Scanner(System.in);double m=b.nextDouble();System.out.print((long)(6*m*(m-1)+1));}} | JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | a=input();print 6*a*~-a+1
| PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | a = input ()
b = 0
if 1 <= a <= 18257 :
while a != 0 :
c = ( a - 1 ) * 12
b += c
a -= 1
print b + 1
| PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
public class Star{
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
SolveStar solver = new SolveStar();
int testCount = 1;
for (int i = 1; i <= testCount; i++)
solver.solve(i, in, out);
out.close();
}
}
/*class Pair implements Comparable<Pair>{
private int L=0;
private int R=0;
public Pair(int l,int r){
this.L=l;
this.R=r;
}
public Pair(){}
public void setL(int l){
this.L=l;
}
public void setR(int r){
this.R=r;
}
public int getL(){
return L;
}
public int getR(){
return R;
}
public int compareTo(Pair o) {
return R < o.R ? -1 : R > o.R ? 1 : 0;
}
}*/
class SolveStar {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n=in.readInt();
long ans=6*n*(n-1)+1;
out.println(ans);
}
public static long gcd(long a,long b){
if(b==0)
return a;
else
return gcd(b,a%b);
}
public static int fastpower(int a,int b){
long res=1;
long x=(long)a;
while(b>0){
if(b%2!=0){
res=res*a;
}
a=a*a;
b=b/2;
}
return (int)(res%4);
}
}
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;
}
private int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int readInt() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public String readString() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return readString();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
| 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() {
int a[19000], b, c, n;
a[1] = 1;
int i = 2;
while (i <= 18257) {
a[i] = a[i - 1] + 12 * (i - 1);
i++;
}
while (scanf("%d", &n) != EOF) {
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;
while (cin >> n) {
int s;
s = n * (n - 1) * 6 + 1;
cout << s << endl;
}
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.util.Scanner;
public class B171 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long N = in.nextInt();
long answer = 6*N*(N-1)+1;
System.out.println(answer);
}
}
| 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())
a=6*n*(n-1)+1
print(a) | PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | x=int(raw_input())
print 1+6*x*(x-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 | number = input()
print (6 * number * (number-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.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws Exception {
int a = nextInt();
long cur = 1;
long curp = 1;
for(int i = 0; i<a-1; i++) {
cur += 6;
cur += curp*6;
curp += 2;
}
out.println(cur);
out.flush();
}
/////////////////////////////////////////////////////////////////
// IO
/////////////////////////////////////////////////////////////////
private static StreamTokenizer in;
private static PrintWriter out;
private static BufferedReader inB;
private static boolean FILE=false;
private static int nextInt() throws Exception{
in.nextToken();
return (int)in.nval;
}
private static String nextString() throws Exception{
in.nextToken();
return in.sval;
}
static{
try {
out = new PrintWriter(false ? (new FileOutputStream("out.txt")) : System.out);
inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("lvl3.txt") : System.in));
} catch(Exception e) {e.printStackTrace();}
in = new StreamTokenizer(inB);
}
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// pre - written
/////////////////////////////////////////////////////////////////
private static void println(Object o) throws Exception {
out.println(o);
out.flush();
}
private static void exit(Object o) throws Exception {
println(o);
exit();
}
private static void exit() {
System.exit(0);
}
private static final int INF = Integer.MAX_VALUE;
private static final int MINF = Integer.MIN_VALUE;
//////////////////////////////////////////////////////////////////
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | n = int(raw_input())
print 6*n*(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 | #include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
printf("%d\n", 6 * n * (n - 1) + 1);
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class star_num
{
public static void main(String args[])throws Exception
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
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 triangle(long long n) {
if (n == 1)
return 1;
else
return n + triangle(n - 1);
}
int heart(long long a) {
if (a == 1)
return 1;
else
return (6 * (a - 1)) + heart(a - 1);
}
int balls(long long a) {
if (a == 1)
return 1;
else
return heart(a) + (triangle(a - 1) * 6);
}
int main() {
long long a, b;
cin >> a;
b = balls(a);
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 | #include <bits/stdc++.h>
int main() {
int x = 0, n, ans = 1;
scanf("%d", &n);
for (int i = 1; i < n; i++) x += 12, ans += x;
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 | #include <bits/stdc++.h>
#pragma hdrstop
using namespace std;
#pragma argsused
int main(int argc, char* argv[]) {
int a, b = 1;
cin >> a;
for (int i = 1; i < a; i++) {
b += 12 * i;
}
cout << b << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | var dp = new Int32Array(18257);
dp[0] = 1;
for (var i = 1; i < 18257; i++)
dp[i] = dp[i - 1] + 12 * i;
print(dp[readline() - 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 | #!/usr/bin/env python
from sys import stdin
N = int(stdin.readline())
#N -= 1
res = 1 + 12 * (N * (N-1)) / 2
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 | a = input()
print 6 * a * a - 6 * a + 1 | PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k = 1, a[100000];
scanf("%d", &n);
a[1] = 1;
while (k < n) {
k++;
a[k] = a[k - 1] + 12 * (k - 1);
}
printf("%d\n", a[k]);
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 n;
while (cin >> n) {
int r = 1;
for (int i = 0, j = 0; i < n; i++, j += 2) r += j * 6;
cout << r << 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 CF
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int ans = 1 + 6*n*(n-1);
System.out.println(ans);
scan.close();
}
} | JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import sys
input = lambda: sys.stdin.readline().rstrip()
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>
using namespace std;
int main() {
int n;
long long result;
cin >> n;
result = 6 * n * (n - 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.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Erasyl Abenov
*
*
*/
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
try (PrintWriter out = new PrintWriter(outputStream)) {
TaskB solver = new TaskB();
solver.solve(1, in, out);
}
}
}
class TaskB {
public void solve(int testNumber, InputReader in, PrintWriter out) throws IOException{
int a = in.nextInt();
out.println(1L*6*a*(a - 1) + 1);
}
}
class InputReader {
private final BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(nextLine());
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public BigInteger nextBigInteger(){
return new BigInteger(next());
}
public long nextLong() {
return Long.parseLong(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 | import java.util.*;
public class B {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int sum = 0;
for(int i = 1; i <= n; i++) {
if(i == 1) {
sum += 1;
}
sum += 6 * 2 * (i-1);
}
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 | n = int(raw_input())
n = (6 * n - 6) * n + 1
print n
| PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.util.Scanner;
public class cfBStar {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long ret = 1;
for (int k = 1; k < n; k++) {
ret += (2*k) * 6;
}
System.out.println(ret);
}
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | print sum([12*(i-1) for i in xrange(1,int(raw_input())+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.*;
public class cf171b {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long a = in.nextInt();
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 sys
a = int( sys.stdin.readline() )
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>
int n;
int main() {
scanf("%d", &n);
printf("%d", (2 * n - 1) * (2 * n - 1) + 4 * (n - 1) * n / 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 | import java.util.*;
public class X {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long n = in.nextLong();
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;
bool cmp(const int &a, const int &b) { return a > b; }
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
cin.exceptions(cin.failbit);
long long int n;
cin >> n;
cout << (6 * (n) * (n - 1)) + 1 << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long arr[(int)1e6] = {};
int main() {
int n;
cin >> n;
arr[0] = 1, arr[1] = 13;
for (int i = 1; i <= n; i++) {
arr[i] = arr[i - 1] + (12 * i);
}
cout << arr[n - 1];
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
int nomalDay[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int leapDay[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int OHT = 100100;
const int TH = 1010;
const int FH = 510;
const int MAXINF = (2 << 26);
const int MININF = (~(2 << 26));
const double PI = 3.1415926535897932384626433832795;
struct node {
int x, y;
};
inline bool upcmp(int a, int b) { return a < b; }
inline bool downcmp(int a, int b) { return a > b; }
inline int getbits(int n) { return n == 0 ? 1 : (int)log10(n) + 1; }
int num[100000];
int main() {
long long a, res;
cin >> a;
res = 12 * (a - 1) + ((a - 1) * (a - 2) * 12) / 2;
cout << res + 1 << endl;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | import java.io.*;
import java.util.*;
public class p171b
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long count = 6*a*(a-1)+1;
System.out.println(count);
}
} | 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 star{
public static void main(String args[])throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int c = 0;
int p = Integer.parseInt(in.readLine());
int count=-1;
for(int i=0;i<p;i++){
c+=i;
count++;
}
int x = 2*p-1;
int y = x;
while (count>0){
y--;
int z=y*2;
x+=z;
count--;
}
c=c*6;
System.out.println(x+c);
}
} | 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 m, s = 1;
cin >> m;
for (long int i = 0; i < m; i++) {
s = s + 12 * i;
}
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 | n = input()
n = int(n)
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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solution {
//<editor-fold desc="input parse" defaultstate="collapsed">
private static StringTokenizer st;
private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
private static long nextLong() {
return Long.parseLong(st.nextToken());
}
private static int nextInt() {
return Integer.parseInt(st.nextToken());
}
private static double nextDouble() {
return Double.parseDouble(st.nextToken());
}
private static short nextShort() {
return Short.parseShort(st.nextToken());
}
private static byte nextByte() {
return Byte.parseByte(st.nextToken());
}
private static void initTokenizer() throws Exception {
st = new StringTokenizer(reader.readLine());
}
//</editor-fold>
public static void main(String[] args) throws Exception {
initTokenizer();
int a = nextInt();
if (a == 1) {
System.out.print(1);
return;
}
int sum = 1;
int cur = 12;
for (int i = 1; i < a; i++) {
sum += cur;
cur += 12;
}
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 | def hex(n):
return 3 * n * (n+1) + 1
def tri(n):
return n * (n+1) / 2
import sys
n = int(sys.stdin.readline())
print 2 * tri(3 * n - 2) - hex(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>
FILE *in, *out;
int main() {
int i, a, b, c = 1, say = 0, q;
long long n = 1;
char dixi[100000];
scanf("%d", &a);
if (a == 1) {
printf("1");
return 0;
}
for (i = 1; i < a; i++) n += 12 * i;
printf("%I64d", 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 | k = int(raw_input())
print sum((i + 1) * 6 + (i - 1) * 6 for i in xrange(k)) + 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 | n = int(input())
m = n-1
n = 1+3*m
print(n*(n+1)//2 + 3*(m*(m+1)//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 | x=int(input())
if(x==1):
print(1)
elif(x==0):
print(0)
else:
u=1
plus=0
for i in range(x-1):
plus+=2
u+=6*plus
print(u) | 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 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
a1: do {
st= new StringTokenizer(br.readLine());
long x=Long.parseLong(st.nextToken());
long res = (6*x*x)-(6*x)+1;
System.out.println(res);
}while (br.ready());
}// End of main method
}// End of class | 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;
signed main() {
long long int n;
cin >> n;
cout << 6 * (n) * (n - 1) + 1 << "\n";
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
long long a;
string b;
int main() {
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 | #include <bits/stdc++.h>
using namespace std;
int toInt(string s) {
int r = 0;
istringstream sin(s);
sin >> r;
return r;
}
long long toInt64(string s) {
long long r = 0;
istringstream sin(s);
sin >> r;
return r;
}
double toDouble(string s) {
double r = 0;
istringstream sin(s);
sin >> r;
return r;
}
string toString(long long n) {
string s, s1;
while (n / 10 > 0) {
s += (char)((n % 10) + 48);
n /= 10;
}
s += (char)((n % 10) + 48);
n /= 10;
s1 = s;
for (long long i = 0; i < s.length(); i++) s1[(s.length() - 1) - i] = s[i];
return s1;
}
bool isUpperCase(char c) { return c >= 'A' && c <= 'Z'; }
bool isLowerCase(char c) { return c >= 'a' && c <= 'z'; }
bool isLetter(char c) { return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'; }
bool isDigit(char c) { return c >= '0' && c <= '9'; }
char toLowerCase(char c) { return (isUpperCase(c)) ? (c + 32) : c; }
char toUpperCase(char c) { return (isLowerCase(c)) ? (c - 32) : c; }
int main() {
ios::sync_with_stdio(0);
int n;
cin >> n;
long long count = 1;
int a = 12;
for (long long i = 0; i < n - 1; i++) {
count += a;
a += 12;
}
cout << count << endl;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int v = 6 * n * (n - 1);
cout << v + 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 Star {
Scanner in =new Scanner(System.in);
public static void main(String args[]){
new Star().go();
}
public void go(){
int count=1;
int prev=0;
int a=in.nextInt();
for(int i=1;i<= a-1;i++){
//int t=count;
count+=12*i;
//prev=t;
}
System.out.println(count);
}
}
| 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())
print(a*(a-1)*6+1) | PYTHON3 |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int s[18257 + 1];
int main() {
memset(s, 0, sizeof(s));
s[1] = 1;
for (int i = 2; i <= 18257; i++) {
s[i] = (2 * i - 3) * 6 + 6;
}
int a;
scanf("%d", &a);
if (a == 1) {
cout << s[1] << endl;
} else {
int sum = 0;
for (int i = 1; i <= a; i++) {
sum += s[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 | n=int(input())
a=[0]*n
a[0]=1
for i in range(1,n):
a[i]=a[i-1]+(6*(i*2))
print(a[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>
int main() {
int a, b, c, d, sum = 1;
scanf("%d", &a);
if (a == 1)
printf("1");
else {
for (b = 1; b < a; b++) sum += (b * 12);
printf("%d", 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>
using namespace std;
int main(void) {
int A, R;
cin >> A;
R = (6 * A) * (A - 1) + 1;
cout << R << 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.*;
import java.io.*;
public class j {
public static void main(String[] args) throws Exception
{
Scanner input = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt();
out.println((long)6*n*n-6*n+1);
out.close();
}
}
| JAVA |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
while (scanf("%d", &a) != EOF) {
long long ans(1), dx(3);
for (int i = 2; i <= a; ++i) {
ans += 6 * dx - 6;
dx += 2;
}
printf("%I64d\n", 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 | n = input()
print n*(n-1)*6+1 | PYTHON |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
int ret = n * (n - 1) / 2;
ret = 1 + 12 * ret;
printf("%d\n", ret);
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 = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long amount[18258];
amount[1] = 1;
for (int i = 2; i < 18258; i++) {
amount[i] = amount[i - 1] + (i - 1) * 12;
}
int n;
while (cin >> n) {
cout << amount[n] << endl;
}
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * n - 6 * n + 1;
return 0;
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int star(long long int n);
int main() {
long long int n;
cin >> n;
cout << star(n) << endl;
return 0;
}
int star(long long int n) {
if (n == 1) return 1;
return ((n * 12) - 12) + star(n - 1);
}
| CPP |
171_B. Star | <image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13 | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(0);
;
int i, a;
long long A[18258];
A[1] = 1;
for (i = 2; i < 18258; i++) A[i] = A[i - 1] + 12 * (i - 1);
cin >> a;
cout << A[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 | # -*- coding: utf-8 -*-
a = int(raw_input())
def f(n):
return (2*n-1)*3 + (2*n-3)*3
res = 1
for i in xrange(2, a+1):
res += f(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 | #include <bits/stdc++.h>
int main() {
int a, b;
scanf("%d", &a);
b = 1 + 6 * a * (a - 1);
printf("%d\n", b);
return 0;
}
| CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.