akhauriyash/Code-Regression huggingface dataset:
#include <math.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <ostream>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _lcint;
#define REP(i, n) for (_lcint i = 0; i < n; i++)
#define FOR(i, a, b) for (_lcint i = (_lcint)(a); i < (_lcint)(b); i++)
#define FORREV(i, a, b) for (_lcint i = (_lcint)(b)-1; i >= (_lcint)(a); i--)
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)  \
  cout << #v << ": "; \
  REP(i, v.size()) cout << " " << v[i] << endl;

#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = max((a), (b))

// permutation
ll mPn(ll m, ll n) {
  ll a = 1;
  REP(i, n) { a *= m - i; }
  return a;
}

// excrametion
ll exc(ll m) {
  ll a = 1;
  FOR(i, 1, m) { a *= i + 1; }
  return a;
}

// combination
ll mCn(ll m, ll n) {
  ll a = 1, b = 1;
  REP(i, n) {
    a *= m - i;
    b *= n - i;
  }
  return a / b;
}

// 最大公約数を求める 条件
ll eculidean(ll a, ll b) {
  ll tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }

  return b;
}

int main() {
  int N, M;
  cin >> N >> M;

  int LL = 0, RR = N;

  REP(i, M) {
    int L, R;
    cin >> L >> R;
    LL = max(L, LL);
    RR = min(R, RR);
  }

  if (LL > RR) {
    cout << 0 << endl;
  } else {
    cout << (RR - LL + 1) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
fn main() {
    let n = read::<u32>();
    let mut max = 0;
    let mut maxi = 0;
    for i in 1..n + 1 {
        let mut a = i;
        let mut count = 0;
        while a > 0 && a % 2 == 0 {
            count += 1;
            a /= 2;
        }
        if count >= max {
            max = count;
            maxi = i;
        }
    }
    println!("{}", maxi);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){
  int a[4],b[4];
  int hit,blow,i,j;
  while(1){
    if(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]) == EOF)break;
    if(scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]) == EOF)break;
    hit=0,blow=0;
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(a[i] == b[j] && i == j){
	  hit++;
	}
	else if(a[i] == b[j] && i != j){
	  blow++;
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }
  return 0;
}

Measured memory_bytes: 596
#include <iostream>

using namespace std;

int main() {
	int n, m;
	cin >> n;
	cin >> m;
	int a[m];
	int b[m];
	//m付きはメモ
	int bm[n];
	bool find = false;
	for (int i = 0;i < m;i++) {
		bm[i] = 1919810;
	}
	for (int i = 0;i < m;i++) {
		cin >> a[i];
		cin >> b[i];
		if (b[i] == n) {
			bm[a[i] - 1] = 1;
		} 
	}
	for (int i = 0;i < m;i++) {
		if (a[i] == 1) {
			if (bm[b[i] - 1] == 1) {
				find = true;
			}
		}	
	}
	if (find) {
		cout << "POSSIBLE" <<endl;
	}
	else {
		cout << "IMPOSSIBLE" <<endl;
	}
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

using namespace std;
int main()
{
  int N;
  cin >> N;
  int A[2][3];
  cin >> A[0][0] >> A[0][1] >> A[0][2];
  cin >> A[1][0] >> A[1][1] >> A[1][2];
  {
    long long n = N;
    {
      vector<long long> dp(n+1);
      for (int i=0;i<=n;i++)
        dp[i] = i;
      for (int j=0;j<3;j++) {
        if (A[0][j] > A[1][j]) continue;
        bool changed = false;
        for (long long i=1;i<=n;i++) {
          if (i >= A[0][j]) {
            int v = dp[i-A[0][j]]+A[1][j];
            if (dp[i] < v) {
              dp[i] = v;
              changed = true;
            }
          } else if (changed) {
            if (dp[i] < dp[i-1]+1) dp[i] = dp[i-1]+1;
            else changed = false;
          }
        }
      }
      n = dp[n];
    }
    {
      vector<long long> dp(n+1);
      for (long long i=0;i<=n;i++)
        dp[i] = i;
      for (int j=0;j<3;j++) {
        if (A[0][j] < A[1][j]) continue;
        bool changed = false;
        for (long long i=1;i<=n;i++) {
          if (i >= A[1][j]) {
            long long v = dp[i-A[1][j]]+A[0][j];
            if (dp[i] < v) {
              dp[i] = v;
              changed = true;
            }
          } else if (changed) {
            if (dp[i] < dp[i-1]+1) dp[i] = dp[i-1]+1;
            else changed = false;
          }
        }
      }
      n = dp[n];
    }
    cout << n << endl;
  }
  return 0;
}


Measured memory_bytes: 195584
#include <stdio.h>
int main()
{
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 
	int k;
	scanf("%d",&k);
	printf("%d",a[k-1]);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int isprime(int num)
{
	int i = 2, count=0;
	while(i<num)
	{
		if(num % i == 0)
		    count++;
		
		i++;
	}
	if(count > 1)
	return 0;
	else
		return 1;
}
int main()
{
	int num, i;
	scanf("%d", &num);
	i = num;
	for(i = num; ; i++)
	{
		if(isprime(i))
		break;
	}
	printf("%d\n", i);
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int h1,h2,m1,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    if(m1 != 0 ) cout << (h2-h1-1)*60+(60-m1)+m2 - k << endl;
    else cout << (h2-h1)*60+m2 - k << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using ll = long long;

int main() {
    int n;
    cin >> n;

    string s;
    map<string, int> mp;

    rep(i,n) {
        cin >> s;
        mp[s]++;
    }

    printf("AC x %d\n", mp["AC"]);
    printf("WA x %d\n", mp["WA"]);
    printf("TLE x %d\n", mp["TLE"]);
    printf("RE x %d\n", mp["RE"]);
    return 0;
}

Measured memory_bytes: 3692
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
int main()
{
    int n, x;
    long ans;
    vector<int> a;
    cin >> n >> x;
    ans = 0;
    a.resize(n);
    for (int i=0; i<n; ++i){
        cin >> a[i];
    }
    for (int i=0; i<n-1; ++i){
        if(a[i] + a[i+1] > x && a[i] > x){
            ans += (a[i] - x) + a[i+1];
            a[i] = x;
            a[i+1] = 0;
            //cout << i << ":" << a[i] - x << " a[i]:" << a[i] << endl;
        }
        else if(a[i] + a[i+1] > x){
            ans += a[i+1] - (x - a[i]);
            a[i+1] = x - a[i];
            //cout << i << ":" << a[i+1] - (x - a[i]) << " a[i+1]:" << a[i+1] << endl;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    int *a = new int[n];
    for(int i=0; i<n; i++) {
	cin >> a[i];
    }

    for(int i=n-1; i>0; i--) {
	cout << a[i] << " ";
    }
    cout << a[0] << endl;
}

Measured memory_bytes: 1192
#include <cstdio>

#define INLINE static inline

const int MAX_N = 300;
int matr[MAX_N][MAX_N];

bool deleted[MAX_N];
int fr[MAX_N], cursor[MAX_N];

void debug(int m) {
  for(int i = 0; i < m; ++i)
    printf("%d ", fr[i]);
  printf("\n");
}

INLINE bool isok(int n, int m, int x) {
  int remain = m;
  bool ok = true;

  for(int i = 0; i < m; ++i) {
    deleted[i] = false;
    fr[i] = 0;
  }
  for(int i = 0; i < n; ++i) {
    cursor[i] = 0;
    fr[matr[i][0]]++;
    if(fr[matr[i][0]] > x)
      ok = false;
  }


  while(!ok && remain > 1) {
    --remain;
    int mustdelete = 0;
    for(int i = 0; i < m; ++i)
      if(fr[i] > x) //trebuie sters
        mustdelete = i;
    deleted[mustdelete] = true;
    ok = true;
    for(int i = 0; i < n; ++i) {
      --fr[matr[i][cursor[i]]];
      while(deleted[matr[i][cursor[i]]])
        ++cursor[i];
      fr[matr[i][cursor[i]]]++;
    }
    for(int i = 0; i < m; ++i)
      if(fr[i] > x)
        ok = false;
  }
  return ok;
}

int main() {
  int n, m, st, dr;
  scanf("%d%d", &n, &m);
  for(int l = 0; l < n; ++l)
    for(int c = 0; c < m; ++c) {
      scanf("%d", &matr[l][c]);
      matr[l][c]--;
    }
  st = 0;
  dr = n + 1;
  while(dr - st > 1) {
    int mid = (st + dr) / 2;
    if(isok(n, m, mid))
      dr = mid;
    else
      st = mid;
  }
  printf("%d", dr);
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.lang.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    if(n%1000 == 0) System.out.println('0');
    else System.out.println(1000 - (n%1000));
  }
}


Measured memory_bytes: 35616
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<ll> p(n);
  rep(i,n) cin >> p[i];
  vector<ll> mx(n);
  ll tmp=INF;
  rep(i,n){
    if(p[i]<tmp){
      tmp=p[i];
    }
    mx[i]=tmp;
  }
  //rep(i,n) cout << mx[i] << endl;
  ll ans=0;
  rep(i,n){
    if(mx[i]>=p[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
//organize and stay in moment - Abhinav IIIT-A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,x,n) for(int i=x;i<n;++i)
#define ar array
#define MAXN (int)2e5+5
#define pb push_back
int mod= 998244353;
int arr[MAXN];
void solve(){
    int k; cin>>k;
    queue<int> q;
    for(int i=1;i<10;++i) 
    q.push(i);
    int ans=-1;
    while(k--){
      int pp=q.front();
      ans=pp;
      q.pop();
      int r=pp%10;
      int it=0;
      if(r!=0){
        it=10*pp+r-1;
        q.push(it);
      }
       it= 10*pp+r;
       q.push(it);
       if(r!=9){
         it=10*pp+r+1;
         q.push(it);
       }
    }
    cout<<ans<<"\n";
}
int32_t main()
{
  int t; t=1; //cin>>t;
  while(t--) solve();
  return 0;
}


Measured memory_bytes: 1792
from math import gcd

K = int(input())

ij = [[0] * (K + 1) for _ in range(K + 1)]

ans = 0
for i in range(1, K + 1):
  for j in range(1, K + 1):
    ij[i][j] = gcd(i, j)

for i in range(1, K + 1):
  for j in range(1, K + 1):
    for k in range(1, K + 1):
      ans += ij[ij[i][j]][k]

print(ans)

Measured memory_bytes: 9396
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n) cin >> h[i];

	int ans = 0;

	while (1) {
		if (*max_element(all(h)) == 0) break;

		int i = 0;
		while (i < n) {
			if (h[i] == 0) i++;
			else {
				ans++;
				while (i < n && h[i] > 0) {
					h[i]--;
					i++;
				}
			}
		}
	}

	out(ans);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

//#define debug(...)   printf( __VA_ARGS__ )
#define debug(...)   /****nothing****/

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define mp make_pair
#define pii pair<int,int>
#define F first
#define S second
#define sz(x) (int)(x).size()
#define nopos string::npos
#define fr(i,a,b) for(i=a;i<=b;i++)
#define frn(i,a,b) for(i=a;i>=b;i--)

ll x,ans=2147483647,t,i,j,a1,a2;
int main()
{
//    debug("%d\n",ans);
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    cin>>x;
    ll lft=0,rgt=x;

    while(lft<rgt)
    {
        ll mid=(lft+rgt)>>1LL;
        ll tot=1LL*mid*(mid+1)/2;

        if(tot>=x)
            rgt=mid , ans=min(ans,mid);
        else
            lft=mid+1;
    }

    if(ans==2147483647)
    cout<<x<<'\n';
    else
     cout<<lft<<'\n';

    return 0;
}

/*

If 1 + 2 + ... + t <X then you can not reach coordinate X at time t. Conversely, if 1 + 2 + ... + t ≥ X
You can show that you can reach coordinate X at time t. Indeed, let's take a subset of {1, 2, .., t} whose sum becomes X
Then, if you do so, you jump right to the subset only when it is the chosen length, otherwise do not jump
You can arrive at the coordinates X by abbreviation. Therefore, you can find such a minimum t later. This is
That one + √
8X + 1
Since it becomes 2, it can be obtained by O (1) when calculated by this function. Even if we do not do that, the answer
O (
√
X), try t in order from the front, t (t + 1)
2 ≥ Even if you only judge X every time, the time calculation amount O (
√
X)
You can ask for an answer.
*/




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >>n >>m;

    vector<int>x(n+1);
    vector<int>y(m+1);
    cin >>x[0] >>y[0];

    for (int i=1;i<=n;i++) {
        cin >>x[i];
    }
    sort(x.begin(),x.end());


    for (int i=1;i<=m;i++) {
        cin >>y[i];
    }
    sort(y.begin(),y.end());

    if(x[n]<y[0]){
        cout <<"No War" <<endl;
    }

    else{
        cout <<"War" <<endl;
    }
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;


int main() {
int N;
cin >> N;
vector<int64_t> vec(N);
for (int i = 0; i < N;i++) {
    cin >> vec.at(i);
}

int count = 0;
bool ans =true;

for (int i = 0; i < 10000;i++) {
  for(int j = 0;j < N;j++) {
   if (vec.at(j) % 2 == 0) {
     vec.at(j) /= 2;
    } else {
        ans = false;
        break;

    }
   }
   if (ans == false) break;
   count++;
}

cout << count << endl;

return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ahed93
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int area = (int)((r * r * 3.14159) / 3.14159);
        System.out.println(area);

    }
    
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>
#define ll long long int
int main(void) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    char c1, c2, c3;
    c1 = toupper(s1[0]);
    c2 = toupper(s2[0]);
    c3 = toupper(s3[0]);
    cout << c1 << c2 << c3 << endl;                                                                                           
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e+9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
    int n,m; cin >> n >> m;
    int count = (n*(n-1)+m*(m-1))/2;

    cout << count << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K, L = 0;
  cin >> N >> K;
 
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    if(x * 2 < (K -x) *2){
      L += x * 2;
      }
    else{
      L += (K - x)*2;
    }
  }
  cout << L << endl;
}

Measured memory_bytes: 256
n = [int(e) for e in input().split(" ")]
if(n[0] == 1 or n[1] == 1):
    print("1")
else:
    a = n[0] * n[1]
    if(a % 2 == 0):
        print(a // 2)
    else:
        print(a // 2 + 1)

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main()
{
    int n,k,a[200001],i,j,kind = 1,num[200001] = {0},ans = 0;

    scanf("%d %d",&n,&k);
    for (i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
    }
    qsort(a,n,sizeof(int),asc);

    num[0]++;
    for (i = 1; i < n; i++)
    {
        if(a[i] != a[i - 1])
        {
            kind++;
        }
        num[kind - 1]++;
    }
    qsort(num,kind,sizeof(int),asc);

    for (i = 0; i < kind - k; i++)
    {
        ans += num[i];
    }
    
    printf("%d\n",ans);
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    vector<int> A(3);
    int B[3] = {0,0,0};
    REP(i,3)cin >> A[i];
    sort(A.begin(),A.end());
    int n = 0;
    REP(i,3){
        if(i>0&&A[i]!=A[i-1])n++;
        B[n] ++;
    }
    if(B[0]==2||B[1]==2)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
M = 10**9+7

def factorial(n):
    f = 1
    for i in range(1,n+1):
        f = f*i%M
    return f

def comb(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    return perm(n,k)*inverse(factorial(k))%M

def mcomb(n,k):
    return comb(n+k-1,k)

def perm(n,k):
    if n==0 or k == 0:
        return 1
    if n<k:
        return 0

    p = 1
    for i in range(n-k+1,n+1):
        p = p*i%M

    return p

def inverse(a):
    return pow(a,M-2,M)

def main():
    n = int(input())
    a = tuple([int(t)for t in input().split()])

    s = sum(a)

    ans = 0

    for a_i in a:
        ans += s*a_i
        ans -= a_i**2

        ans %= M

    ans *= inverse(2)

    ans %= M

    print(ans)
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 31580
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
//	mahakal();fast;
	char ch ;
	cin>>ch ;
	ch+=1;
	cout<<ch;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main
{

	static Scanner sc;

	public static void main( String[] args ) throws IOException
	{
		sc = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );
	    int x = sc.nextInt();
	    System.out.println(x * x * x);
	}
}


Measured memory_bytes: 26148
#include <stdio.h>
int main(void){
    int N, i, n = 0, ans = 0;
    scanf("%d", &N);
    int H[N];
    for (i = 0; i < N; i++) {
        scanf("%d", &H[i]);
    }
  	for (i = 0; i < N; i++) {
      if (H[i] >= n) {
            n = H[i];
            ans++;
      }
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

ll n;
vector<vector<pair<ll,ll>>> G;
vector<ll> color;

void dfs(ll cur, ll from) {
    ll c = 1;
    for(auto g : G[cur]) {
        if(g.second == from) continue;
        while(c == color[from]) c++;
        color[g.second] = c++;
        dfs(g.first, g.second);
    }
}

int main(){
    cin >> n;
    G.resize(n);
    color.resize(n-1);
    rep(i, 0, n-1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back({b, i});
        G[b].push_back({a, i});
    }
    dfs(0, -1);
    cout << *max_element(color.begin(), color.end()) << endl;
    rep(i, 0, n-1) cout << color[i] << "\n";
    return 0;
}

Measured memory_bytes: 11332
n=int(input())
n2=str(n)
def factorint(N):
    i=2
    fct=[]
    while i**2<=N:
        if N%i!=0:
            i+=1
        else:
            N//=i
            fct.append(i)
    if N>1:
        fct.append(N)
    return fct

print(n2+":"," ".join(map(str,factorint(n))))


Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

//map
int main()
{
    double r;
    cin >> r;
    double area = r * r * M_PI;
    double circum = 2 * r * M_PI;

    //面積と円周
    printf("%.6f %.6f\n", area, circum);
    //cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 3208
#include<iostream>
#include<queue>
using namespace std;

int main(){
 queue<long> q;
 long K;
 long x;
 cin>>K;
 for(int i=1;i<=9;i++) q.push(i);
 for(int i=1;i<K;i++){
    x=q.front();
    if(x%10!=0){
        q.push(x*10+(x%10)-1);
    }
    q.push(x*10+(x%10));
    if(x%10!=9){
        q.push(x*10+(x%10)+1);
    }
    q.pop();
 }
 x=q.front();
 cout<<x<<endl;
}


Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vishal Burman
 */
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);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String str = in.readLine();
            int a[] = new int[str.length()];
            int b[] = new int[str.length()];
            int init = 0;
            for (int i = 0; i < a.length; i++) {
                if (init == 0) {
                    a[i] = init;
                    b[i] = 1;
                    init = 1;
                } else {
                    a[i] = init;
                    b[i] = 0;
                    init = 0;
                }
            }
            int count_1 = 0;
            int count_2 = 0;
            for (int i = 0; i < str.length(); i++) {
                if (!Character.toString(str.charAt(i)).equals(Integer.toString(a[i]))) {
                    count_1++;
                }
                if (!Character.toString(str.charAt(i)).equals(Integer.toString(b[i]))) {
                    count_2++;
                }
            }
            out.println(Math.min(count_1, count_2));
        }

    }

    static 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++];
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r') {
                    buf.appendCodePoint(c);
                }
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0) {
                s = readLine0();
            }
            return s;
        }

    }
}



Measured memory_bytes: 41812
#include <iostream>
#include <cmath>
#include <map>
using namespace std;

int r,n,L,R,h,i,x;

int main(){
	
	while(cin>>r>>n,r){

		
		map<int,int> A,B;
		for(i=0;i<n;i++){
			cin>>L>>R>>h;
			for(x=L;x<=R;x++){
				if(x!=R)A[x]=max(A[x],h);
				if(x!=L)B[x]=max(B[x],h);
			}	
		}
		double res=99;
		for(i=-r;i<=r-1;i++){
			res=min(res,min(r-sqrt(r*r-i*i)+A[i],r-sqrt(r*r-(i+1)*(i+1))+B[i+1]));
		}
		cout<<res<<"\n";
		
	}
}

Measured memory_bytes: 1272
#include <iostream>

using namespace std;

int main(void) {
	int i, j;
	
	for (i = 1; i < 10; i++) {
		for (j = 1; j < 10; j++) {
			cout << i << 'x' << j << '=' << i * j << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3060
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

//#define int ll

using namespace std;


signed main(void)
{
	//変数の宣言
	int n,m;
	int h,w;
	int a[100010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int temp3=0;
	static int vec[100010];
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	static char stemp[100010];
	
	//データの読み込み


	scanf("%d",&n);
//	scanf_s("%d",&n);


//	scanf("%s",&s);
//	scanf_s("%s",&s,1000010);


	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
//		scanf_s("%d",&a[i]);
	}


/*	//scanf("%c",&dummy);
	scanf_s("%c",&dummy);
	for(i=0;i<n;i++){
//		scanf("%c",&s[i]);
		scanf_s("%c",&s[i]);
	}*/


/*	for(i=0;i<3;i++){
//		scanf("%s",&s);
		scanf_s("%s",&s[i],100010);
	}*/


	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

//	clock_t start=clock();

	temp=0;
	for(i=0;i<n;i++){
		if(a[i]>a[temp]){
			temp=i;
		}
	}
	max=temp;

	if(max!=0){
		temp=0;
	}else{
		temp=1;
	}
	for(i=0;i<n;i++){
		if(i==max) continue;
		if(abs(2*a[i]-a[max])<abs(2*a[temp]-a[max])){
			temp=i;
		}
	}

	printf("%d %d",a[max],a[temp]);




//	clock_t end=clock();

	//	printf("計算部分終了\n");

	//出力
	
	//printf("%d",(d[i-1][j-1]+1)/2);

//	printf("time=%lf",(double)(end-start)/CLOCKS_PER_SEC);
	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>

#define int long long
#define vec vector
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sq(x) (x)*(x)
#define fast_io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

using namespace std;
typedef pair<long long, long long> PII;
typedef long double ld;

signed main()
{
    int n, m;
    cin >> n >> m;
    vec < int > q(n, -1);
    int s, c;
    for(int i = 0; i < m; ++i){
        cin >> s >> c;
        s--;
        if(q[s] != -1 && q[s] != c) return cout << "-1", 0;
        q[s] = c;
    }
    if(q[0] == -1 && q.size() == 1) return cout << "0", 0;
    if(q[0] == -1) q[0] = 1;
    if(q[0] == 0 && q.size() == 1) return cout << "0", 0;
    if(q[0] == 0) return cout << "-1", 0;
    for(auto &i: q) if(i == -1) i = 0;
    for(auto &i:q) cout << i;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N; cin >> N;
  bool ans = false;
  for (int i = 0; i < N; i++) {
    char S; cin >> S;
    if (S == 'Y') ans = true;
  }
  cout << (ans ? "Four" : "Three") << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,sum=0;
	cin >> n;
	for(int i=1;i<=n;i++){
		m=log10(i)+1;
		if(m%2==1) sum++;
	} 
	cout << sum ;
	return 0;
}

Measured memory_bytes: 512
A,B,K=map(int,input().split())

abset=set()
for i in range(K):
  abset.add(A+i)
  abset.add(B-i)
  
ablist=[]
for x in abset:
  if A<=x and x<=B:
    ablist.append(x)
ablist.sort()

for ab in ablist:
  print(ab)

Measured memory_bytes: 3060
n=int(input())
s=input()

r,g,b=s.count('R'),s.count('G'),s.count('B')

cnt=0

for i in range(n):
  d=0
  while 1:
    d+=1
    j=i+d
    k=j+d
    if not k<n:
      break
    if not (s[i]==s[j] or s[j]==s[k] or s[k]==s[i]):
      cnt+=1
print(r*g*b-cnt)

Measured memory_bytes: 67732
#include <iostream>
#define ll long long
using namespace std;

int main(){
  string s,out; out="Yes"; cin >> s;
  
  for(int i=0; i<s.size(); i++){
    if(i%2==0){
      if(s[i]=='L'){out="No";}
    }
    else{
      if(s[i]=='R'){out="No";}
    }
  }
  
  cout << out;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string S;
  cin >> S;

  string ans = "";
  for (const char &c : S) {
    if (c == '0') {
      ans += "0";
    } else if (c == '1') {
      ans += "1";
    } else if (c == 'B') {
      if (ans.length() > 0) {
        ans.pop_back();
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
####################################################################
import sys
def _p(*_a):
  #return
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
####################################################################
def _pa(_aa):
  #return
  for _a in _aa: _p(_a)
####################################################################

HH,WW,MM = map(int, input().split())

H=[0] * HH
W=[0] * WW

from collections import defaultdict
d = defaultdict(int)

for _ in range(MM):
  nh,nw = map(int, input().split())
  h = nh - 1
  w = nw - 1
  d[h * 1000000 + w] = 1
  H[h] += 1
  W[w] += 1

hm = max(H)
wm = max(W)

# _p(hm,wm)
# _pa(M)

HI = [i for i, x in enumerate(H) if x == hm]
WI = [i for i, x in enumerate(W) if x == wm]

# _p(HI)
# _p(WI)

ans = hm + wm
for h in HI:
  for w in WI:
    if d[h * 1000000 + w] == 0:
      print(ans)
      exit()

print(ans-1)


Measured memory_bytes: 63896
N = int(input())
A = list(map(int, input().split()))
cnt = 0
flag = True
while flag:
    flag = False
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            (A[j], A[j-1]) = (A[j-1], A[j])
            cnt += 1
            flag = True
print(" ".join(list(map(str, A))))
print(cnt)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  int N = S.size();
  set<char> s;
  rep(i,N)
  {
    s.insert(S[i]);
  }
  if(s.size()==N)
  {
    cout << "yes" << endl;
  }
  else
  {
    cout << "no" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

int d(string s, string t){
    int cnt = 0;
    rep(i, s.size()){
        if(s[i] == t[i]) cnt++;
    }    
    return cnt;
}

void Main(){
    string s, t; cin >> s >> t;
    int ss = s.size();
    int ts = t.size();
    int mx = 0;
    rep(i, ss-ts+1){
        mx = max(mx, d(s.substr(i, ts), t));
        // cout << s.substr(i, ts) << " " << mx << endl;
    }    
    cout << ts - mx << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;cin>>x;
    vector<int> dp(x+1);
    dp[0]=true;
    for(int i=1; i<=x; i++){
        if(i>=100)dp[i]|=dp[i-100];
        if(i>=101)dp[i]|=dp[i-101];
        if(i>=102)dp[i]|=dp[i-102];
        if(i>=103)dp[i]|=dp[i-103];
        if(i>=104)dp[i]|=dp[i-104];
        if(i>=105)dp[i]|=dp[i-105];
    }
    if(dp[x])cout<<1;
    else cout<<0;
    return 0;
}

Measured memory_bytes: 640
import sys
n = int(input())
D = list(map(int, input().split()))
m = int(input())
T = list(map(int, input().split()))

max_diff = max(D)
difficulty = {}
for d in D:
    try:
        difficulty[d] += 1
    except:
        difficulty[d] = 1

for t in T:
    try:
        difficulty[t] -= 1
    except:
        print('NO')
        sys.exit()
    if difficulty[t] < 0:
        print('NO')
        sys.exit()
print('YES')


Measured memory_bytes: 127700
#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define P pair<ll,ll>

const ll INF = 10000000000;
struct edge{ll to,cost;};

int v;
vector<edge> g[100000];
ll d[100000];

void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P> > que;
    fill(d,d+v,INF);
    d[s] = 0;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        ll k = p.second;
        if(d[k] < p.first){
            continue;
        }
        for(int i=0; i < g[k].size(); i++){
            edge e = g[k][i];
            if(d[e.to] > d[k] + e.cost){
                d[e.to] = d[k] + e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main() {

    int e,r,s,t,l;

    cin >> v >> e >> r;

    for(int i=0; i<e; i++){
        cin >> s >> t >> l;
        edge ed;
        ed.to = t;
        ed.cost = l;
        g[s].push_back(ed);
    }

    dijkstra(r);

    for(int i=0; i<v; i++){
        if(d[i] != INF) {
            cout << d[i] << endl;
        }
        else{
            cout << "INF" << endl;
        }
    }



    return 0;
}

Measured memory_bytes: 19408
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */

string s;
vec<string> arr = {"dream", "dreamer", "erase", "eraser"};
void in(){
    cin >> s;
}

int dp[101010];
bool dfs(int i){

    if(dp[i] > -1) return dp[i];

    bool isok = false;
    if(i == sz(s)) return true;
    rep(j,0,4){
        int len = sz(arr[j]);
        string tmp = cut(s, i, i + len);
        if(tmp == arr[j] && dfs(i + len)) isok = true;
    }

    return dp[i] = isok;

}

void solve(){
    memset(dp, -1, sizeof(dp));
    cout << (dfs(0) ? "YES" : "NO") << endl;


}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define mp make_pair
int main()
{
	int n,W;
	cin>>n>>W;
	int val[n], wt[n];
	for(int i=0;i<n;i++)
	{
		cin>>wt[i]>>val[i];
	}
	long long  dp[n+1][W+1]={0};
	for(int i=0;i<W+1;i++)
	dp[0][i]=0;
	for(int i=0;i<n+1;i++)
	dp[i][0]=0;
	for(int i=1;i<n+1;i++)
	{
		for(int w=1;w<=W;w++)
		{
			if(wt[i-1]<=w)
			dp[i][w]=(long long)max(dp[i-1][w],(long long)dp[i-1][w-wt[i-1]]+val[i-1]);
			else
			dp[i][w]=(long long)dp[i-1][w];
		}
	}
	cout<<dp[n][W]<<endl;
	
	
}
  


Measured memory_bytes: 79104
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int N;
	std::cin >> N;
	std::vector<std::int64_t> vec(N);
	bool flag = false;
	for (auto& v : vec)
	{
		std::cin >> v;
		if (v == 0)
		{
			flag = true;
		}
	}
	if (flag)
	{
		std::cout << 0 << std::endl;
		return;
	}
	std::int64_t mul = 1;
	for (auto&& v : vec)
	{
		auto prev = mul;
		mul *= v;
		if (100'0000'0000'0000'0000 < mul || mul < prev)
		{
			std::cout << -1 << std::endl;
			return;
		}
	}
	std::cout << mul << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N; cin >> N;
    vei L(2*N); rep(i,2*N) cin >> L[i];
    sort(all(L));
    int ans = 0;
    rep(i,2*N) {
        if(i % 2 == 0) ans += L[i];
    }
    cout << ans  << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(a)-1;i>=n;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define sn st.nd 
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
/****************************/
ll n,m,k;
string s;
unsigned long long ans=1;
int main()
{
	cin>>n;
	ll ans=0;
	if(n==1)
	{
		cout<<"0";
		return 0;
	}
	ll x=n;
	for(ll i=2;i*i<=x;i++)
	{
		int sum=0;
		while(n%i==0)
		{
			n/=i;
			sum++;
		}
		int now=0;
		while(sum>0)
		{
			now++;
			sum-=now;
		}
		if(sum<0)
		{
			now--;
		}
		ans+=now;
	}
	if(n!=1) ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3628
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c, d, e int
	fmt.Scan(&a, &b, &c, &d, &e)

	arr := selection([]int{a, b, c, d, e})

	sum := 0
	for i := 0; i < len(arr)-1; i++ {
		sum += arr[i]
	}
	fmt.Println(a + b + c + d + e + sum)
}

func selection(args []int) []int {
	arr := []int{}
	for _, num := range args {
		if num%10 != 0 {
			arr = append(arr, 10-num%10)
		}
	}
	sort.Sort(sort.IntSlice(arr))
	return arr
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

int main() {
  string N; cin >> N;
  ll res = 0;
  REP(i, N.size()) {
    res += char_to_int(N[i]);
  }
  if(res % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> x(N),y(N),h(N);
  int xx,yy,hh;
  for (int i = 0; i < N; i++) {
    cin >> x.at(i) >> y.at(i) >> h.at(i); 
    if (h.at(i) > 0) { 
      xx = x.at(i);
      yy = y.at(i);
      hh = h.at(i);
    }
  }
  int ansx,ansy,ansh;
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 100; j++) {
      int H = hh + abs(xx-j) + abs(yy-i); 
      int HH = -1;
      bool can = true;
      for (int k = 0; k < N; k++) {
        if (abs(x.at(k)-j) + abs(y.at(k)-i) >= H) {
          if (h.at(k) != 0) {
            can = false;
            break;
          }
        }
        else {
          HH = h.at(k) + abs(x.at(k)-j) + abs(y.at(k)-i);
          if (HH != H) {
            can = false;
            break;
          }
        }
      }
      if (!can) continue;
      else {
        ansx = j;
        ansy = i;
        ansh = H;
      }
    }
  }
  
  cout << ansx << " " << ansy << " " << ansh <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long

int gcd(int n, int m){
    if(n < m) swap(n, m);
    if(m == 0) return n;
    else return gcd(m, n%m);
}

int lcm(int n, int m){
    return n/gcd(n, m)*m;
}

int aho(int n, vector<int> a){
    int ans = 0;
    for(int i=0; i<n; i++){
        int j;
        for(j=0; j<n; j++){
            if(i == j) continue;
            if(a[i] % a[j] == 0) break;
        }
        if(j == n) ans++;
    }
    return ans;
}

int solve(int n, vector<int> a){
    int max = 1000001;
    vector<int> sieve(max, 0);
    for(int i=0; i<n; i++){
        sieve[a[i]]++;
    }

    for(int i=1; i<max; i++){
        if(sieve[i] >= 1){
            for(int j=2*i; j<max; j+=i){
                sieve[j] = -1;
            }
        }
        if(sieve[i] > 1) sieve[i] = -1;
    }

    int ans = 0;
    for(int i=0; i<n; i++){
        if(sieve[a[i]] != -1) ans++;
    }
    return ans;
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    cout << solve(n, a) << endl;

    return 0;
}

Measured memory_bytes: 14316