akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

void	ft_swap(long *a, long *b)
{
	long tmp;

	tmp = *a;
	*a = *b;
	*b = tmp;
}

int	main(void)
{
	long N;
	scanf("%ld", &N);
	long x[N];
	long sum = 0;
	long i = 0;
	while (i < N)
	{
		scanf("%ld", &x[i]);
		i++;
	}
	i = 0;
	long j;
	while (i < N - 1)
	{
		j = i + 1;
		while (j < N)
		{
			if (x[i] < x[j])
				ft_swap(&x[i], &x[j]);
			j++;
		}
		i++;
	}
	long MIN = 100000000;
	i = 0;
	// printf("%ld\n", x[N - 1]);
	while (i <= 100)
	{
		j = 0;
		sum = 0;
		while (j < N)
		{
			sum += (x[j] - i)*(x[j] - i);
			j++;
		}
		// printf("i=%ldの時 sum=%ld\n",i, sum);
		if (MIN > sum)
			MIN = sum;
		i++;
	}
	printf("%ld", MIN);
}


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

#define sd(mark) scanf("%d",&mark)
#define s2d(mark,marx) scanf("%d%d",&mark,&marx)
#define s3d(mark,marx,marz) scanf("%d%d%d",&mark,&marx,&marz)
#define sf(mark) scanf("%f",&mark)
#define slf(mark) scanf("%lf",&mark)
#define sst(mark) scanf("%s",&mark)
#define sld(mark) scanf("%lld",&mark)
#define s2ld(mark,marx) scanf("%lld%lld",&mark,&marx)
#define s3ld(mark,marx,marz) scanf("%lld%lld%lld",&mark,&marx,&marz)
#define sline(mline) scanf("%[^\n]%*c",&mline)

#define pi(n) printf("%d\n",n)
#define pf(n) printf("%f\n",n)
#define plf(n) printf("%lf\n",n)
#define pst(n) printf("%s\n",n)
#define pl(n) printf("%lld\n",n)

#define pis(n) printf("%d ",n)
#define pfs(n) printf("%f ",n)
#define plfs(n) printf("%lf ",n)
#define pss(n) printf("%s ",n)
#define pls(n) printf("%lld ",n)

#define sff fflush(stdout)
#define decimal(n) cout.precision(n)
#define fix cout<<fixed
#define debug(mark) printf("check%d\n",mark)
#define in(a) cin>>a
#define out(a) cout<<a<<'\n'
#define clr(mark) memset(mark,0,sizeof(mark))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ll long long int
#define mod 1000000007ll
#define llu unsigned long long int
#define endl '\n'
#define INF 1123456789
#define eps 1e-9
#define fo(i,a,b) for(int i=a;i<b;++i)
#define foll(i,a,b) for(ll i=a;i<b;++i)
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)

#define UL 100000		//5
#define MAXN 1000000	//6
#define MAXL 10000000	//7

typedef vector< vector<int> > vvi;
typedef vector< vector<ll> > vvl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< pair<ll,ll> > vll;
typedef pair<char,char> pcc;
typedef vector< pair<int, int> > vii;


// bool mark[MAXN+5];

// int sieve()
// {
// 	int ULL = MAXN;
// 	for(int i=0;i<=ULL;i++) mark[i]=true;
// 	for(int i=2;i*i<=ULL;i++) if(mark[i]) for(int j=i*i;j<=ULL;j+=i) mark[j]=false;
// 	for(int i=2;i<=ULL;i++) if(mark[i]) p.pb(i);
// 	return p.size();
// }


ll gcd(ll a, ll b) {if(!b) return a; return gcd(b,a%b);}

ll modexp(ll a,ll b)
{
	if(b==0) return 1;
	if(b==1) return a;
	ll temp = modexp(a,(b>>1));
	temp = (temp*temp);
	return (temp*modexp(a,b&1));
}

ll modexp(ll a,ll b, ll m)
{
	if(b==0) return 1;
	if(b==1) return a%m;
	ll temp = modexp(a,(b>>1),m);
	temp = (temp*temp)%m;
	return (temp*modexp(a,b&1,m))%m;
}

ll modinv(ll a, ll p)
{
	return modexp(a,p-2,p);
}

int main()
{
	ll n,k; s2ld(n,k);
	ll pp = n/k,qq;
	ll ans = modexp(pp,3ll);
	//pl(ans);
	if(k%2==0)
	{
		if(n%k >= (k/2)) qq = pp+1;
		else qq = pp;
		ans += modexp(qq,3ll);
	}
	pl(ans);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n, m;
int a[1005];

int main(void)
{
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0) break;
		for(int i = 0; i < n; i++) cin >> a[i];
		
		int ans = -1;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i >= j) continue;
				if(a[i] + a[j] > m) continue;
				ans = max(ans, a[i]+a[j]);
			}
		}
		if(ans == -1) cout << "NONE" << endl;
		else cout << ans << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3064
inputbox1 = input()
inputbox2= input()
N = int(inputbox1)
box = inputbox2.split()

d = [int(s) for s in box]

s=0
ans=0
for i in range(N):
    s = s + 1
    for j in range(s,N):
        ans = ans + d[i]*d[j]
print (ans)

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

const int N = 2e5 + 10, mod = 1e9 + 7;

int n, pref[N][3];
char s[N];

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    //scanf("%d", &tc);
    while(tc--) {
        scanf("%d%s", &n, s + 1);
        for(int i = 1; i <= n; i++) {
            for(int j = 0; j < 3; j++) pref[i][j] = pref[i - 1][j];
            if(s[i] == 'R') s[i] = 0;
            else if(s[i] == 'G') s[i] = 1;
            else s[i] = 2;
            pref[i][s[i]]++;
        }
        long long res = 0;
        for(int i = 1; i <= n; i++) {
            int j = !s[i], k;
            if(!s[i] || s[i] == 1) k = 2;
            else k = 1;
            res += 1ll * pref[i - 1][j] * (pref[n][k] - pref[i][k]);
            res += 1ll * pref[i - 1][k] * (pref[n][j] - pref[i][j]);
        }
        for(int i = 2; i < n; i += 2) {
            for(int l = 1, r = 1 + i; r <= n; l++, r++) {
                int mid  = (l + r) >> 1;
                if(s[l] != s[r] && s[l] != s[mid] && s[mid] != s[r]) res--;
            }
        }
        cout << res;
    }    
    return 0;
}

Measured memory_bytes: 3768
#include<iostream>
#include<string>
#include<algorithm>

typedef long long ll;
using namespace std;
int main()
{
	string a;
	cin >> a;
	if (a[0] == '9' && a[1] == '9') {
		cout << "Yes" << endl;
	}
	else if (a[0] == '9' || a[1] == '9') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

ll gcd(ll x,ll y){
  if(x>y) swap(x,y);
  if(y%x==0) return x;
  else return gcd(y%x,x);
}

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = b - a + 1;
	ll ck,dk,cdk;
  ll cd=c*d/gcd(c,d);
	ck = b / c - (a - 1) / c;
	dk = b / d - (a - 1) / d;
	cdk = b / cd - (a - 1) / cd;
	ans -= ck + dk - cdk;
	cout << ans << endl;
}

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

using namespace std;

int main() {
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << setprecision(10) << h * w / 2.0;
  if(w / 2.0 == x && h / 2.0 == y)
    cout << " 1" << endl;
  else
    cout << " 0" << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long

// abどちらが大きくてもいけるよ
signed gcd(int a,int b){
    return b ? gcd(b, a % b) : a;
}

// 使う時はgcdも呼び出してあげよう
int lcm(int a,int b){
    return a * b / gcd(a,b);
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int a,b; cin >> a >> b;
    cout << lcm(a,b) << endl;
}







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

int main() {
    int a ,b;
    cin >> a >> b;
    if (a + b == 15)
        cout << "+" << endl;
    else if (a * b == 15)
        cout << "*" << endl;
    else 
        cout << "x" << endl;
    return 0;
}

Measured memory_bytes: 256
// C - Splitting Pile

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll a[200000];
ll cum_a[200000];

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

	ll tot = 0;
	for (int i=0; i<N; i++) {
		cin >> a[i];
		tot += a[i];
	}

	cum_a[0] = a[0];
	for (int i=1; i<N; i++) {
		cum_a[i] = cum_a[i-1] + a[i];
	}

	ll ans = INF;
	for (int i=0; i<N-1; i++) {
		ans = min(ans, abs(cum_a[i] - (tot - cum_a[i])));
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3328
use std::io;

fn gcd(a: u32, b: u32) -> u32 {
    match a % b {
	0 => b,
	r => gcd(b, r),
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Failed to read line.");
    let input: u32 = input.trim().parse().expect("Expect an int.");
    println!("{}", 360 / gcd(360, input));
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, shoot;
  cin >> n >> shoot;
  vector<long long> acm(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> acm[i];
    acm[i] += acm[i - 1];
  }
  long long minv = 9e18;
  for (int k = 1; k <= n; k++) {
    long long ret = (long long)(k + n) * shoot;
    long long coef = 3;
    for (int i = n; i > 0 && ret < minv; i -= k, coef += 2) {
      ret += (acm[i] - acm[max(0, i - k)]) * max(coef, 5LL);
    }
    minv = min(minv, ret);
  }
  cout << minv << '\n';
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,C;
int a[101],b[101],c[101];
int dp[2][105][10005];

int main(void){
	scanf("%d%d",&n,&C);
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	int now=1,prev=0;
	memset(dp,-1,sizeof(dp));
	dp[0][0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=C;j++){
			for(int k=0;k<=i*100;k++){
				if(dp[prev][j][k]==-1)continue;
				dp[now][j][k]=max(dp[now][j][k],dp[prev][j][k]);
				if(j+c[i]<=C){
					int va=k+a[i];
					int vb=dp[prev][j][k]+b[i];
					dp[now][j+c[i]][min(va,vb)]=max(dp[now][j+c[i]][min(va,vb)],max(va,vb));
					va=k+b[i];
					vb=dp[prev][j][k]+a[i];
					dp[now][j+c[i]][min(va,vb)]=max(dp[now][j+c[i]][min(va,vb)],max(va,vb));
				}
			}
		}
		swap(now,prev);
		memset(dp[now],-1,sizeof(dp[now]));
	}
	int res=0;
	for(int i=0;i<=C;i++){
		for(int j=0;j<=10000;j++){
			res=max(res,min(j,dp[prev][i][j]));
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 11420
x = int(input())
#6,5,6,5...で何回加算されていくか。
#余りの部分は後で処理
ans = x // 11 * 2

if x % 11 > 6:
    print(ans + 2)
elif x % 11 > 0:
    print(ans + 1)
else:
    print(ans)#余りなし=割り切れる時


Measured memory_bytes: 2940
import java.util.*;
public class Main {
	Scanner sc;
	
	boolean judge(int[] x) {
		if (x[0]*x[0]+x[1]*x[1]==x[2]*x[2]) return true;
		else return false;
	}
	
	void run () {
		sc = new Scanner(System.in);
		int rec = 0,loz = 0;
		while (sc.hasNext()) {
			String[] s = sc.next().split(",");
			int[] x = new int[3];
			for (int i=0;i<3;i++) x[i] = Integer.parseInt(s[i]);
			if (x[0] == x[1] ) loz++;
			if (judge(x)) rec++;
		}
		System.out.println(rec);
		System.out.println(loz);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
package main

import "fmt"

func main() {
	var A, B int
	res := 0
	fmt.Scan(&A, &B)
	if A <= B {
		res += B
		B -= 1
	} else {
		res += A
		A -= 1
	}

	if A <= B {
		res += B
		B -= 1
	} else {
		res += A
		A -= 1
	}

	fmt.Println(res)
}


Measured memory_bytes: 512
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

struct LCA {
private:
	int n;
	vector<vector<int>>g;
	int root;
	vector<int>depth;
	vector<vector<int>>par;
public:

	void dfs(int v, int p, int d) {
		par[v][0] = p;
		depth[v] = d;
		for (int i = 0; i<g[v].size(); i++) {
			if (g[v][i] == p)continue;
			dfs(g[v][i], v, d + 1);
		}
	}

	LCA(int N,vector<int>* G,int Root) {
		n = N;
		g.resize(N);
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < G[i].size(); j++) {
				g[i].emplace_back(G[i][j]);
			}
		}
		depth.resize(N);
		par.resize(N);
		for (int i = 0; i < N; i++)par[i].resize(31);
		root = Root;
		dfs(root, -1, 0);
		for (int i = 0; i < 30; i++) {
			for (int j = 0; j < N; j++) {
				if (par[j][i] == -1)par[j][i + 1] = -1;
				else par[j][i + 1] = par[par[j][i]][i];
			}
		}
	}

	int get(int u, int v) {
		if (depth[u] > depth[v])swap(u, v);
		for (int i = 30; i >= 0; i--) {
			if (((depth[v] - depth[u]) >> i) & 1) {
				v = par[v][i];
			}
		}
		if (u == v)return u;

		for (int i = 30; i >= 0; i--) {
			if (par[u][i] != par[v][i]) {
				u = par[u][i];
				v = par[v][i];
			}
		}
		return par[u][0];
	}
};

int n;
vector<int> g[101010];

int main() {
	cin >> n;
	REP(i, n) {
		int k;
		cin >> k;
		REP(j, k) {
			int c;
			cin >> c;
			g[i].emplace_back(c);
			g[c].emplace_back(i);
		}
	}
	LCA lca(n, g, 0);
	int q;
	cin >> q;
	REP(qqq, q) {
		int u, v;
		cin >> u >> v;
		cout << lca.get(u, v) << endl;
	}
}


Measured memory_bytes: 33320
def solve():
    from collections import namedtuple
    import sys

    input = sys.stdin.readline
    Dish = namedtuple('Dish', 'idx cost pt')

    n, t = map(int, input().split())
    dishes = []
    for idx in range(1, n + 1):
        cost, pt = map(int, input().split())
        dishes.append(Dish(idx=idx, cost=cost, pt=pt))

    dp_ht = [[0] * t for _ in range(n + 2)]  # head->tail
    dp_th = [[0] * t for _ in range(n + 2)]  # tail->head
    # dp[注文可能な範囲の端][完食にかかる総時間]:= 美味しさの最大値

    for dish in dishes:
        for cost_ in range(t):
            if cost_ >= dish.cost:
                dp_ht[dish.idx][cost_] = max(dp_ht[dish.idx - 1][cost_],
                                             dp_ht[dish.idx - 1][cost_ - dish.cost] + dish.pt)
            else:
                dp_ht[dish.idx][cost_] = dp_ht[dish.idx - 1][cost_]

    for dish in reversed(dishes):
        for cost_ in range(t):
            if cost_ >= dish.cost:
                dp_th[dish.idx][cost_] = max(dp_th[dish.idx + 1][cost_],
                                             dp_th[dish.idx + 1][cost_ - dish.cost] + dish.pt)
            else:
                dp_th[dish.idx][cost_] = dp_th[dish.idx + 1][cost_]

    ret = 0
    for last_dish in dishes:
        for cost_ in range(t):
            ret = max(ret, dp_ht[last_dish.idx - 1][cost_] + dp_th[last_dish.idx + 1][t - 1 - cost_] + last_dish.pt)
    return ret


print(solve())


Measured memory_bytes: 179208
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll 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;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

int main(){
    ll n;
    string s;
    cin >> n >> s;
    
    ll ans = 0;
    rep(i, n){
        if(s[i] == 'A'
           && s[i+1] == 'B'
           && s[i+2] == 'C'){
            ans ++;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc070_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetInt();
            var TL = new List<long>();

            for(int i = 0; i < N; i++) 
                TL.Add(GetLong());

            if (N == 1) Console.WriteLine(TL[0]);
            else
            {
                var r = Lcm(TL[0], TL[1]);

                for (int i = 2; i < N; i++)
                    r = Lcm(r, TL[i]);

                Console.WriteLine(r);
            }
        }

        public static string GetStr() => Console.ReadLine();
        public static int GetInt() => int.Parse(Console.ReadLine());
        public static long GetLong() => long.Parse(Console.ReadLine());
        public static double GetDouble() => double.Parse(Console.ReadLine());
        public static decimal GetDecimal() => decimal.Parse(Console.ReadLine());

        public static List<string> GetStrList() => Console.ReadLine().Split(' ').ToList();
        public static List<int> GetIntList() => Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        public static List<long> GetLongList() => Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
        public static List<double> GetDoubleList() => Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToList();
        public static List<decimal> GetDecimalList() => Console.ReadLine().Split(' ').Select(x => decimal.Parse(x)).ToList();

        /// <summary>
        /// 最小公倍数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }

        /// <summary>
        /// 互いに素
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static bool Coprime(long a, long b)
        {
            return Gcd(a, b) == 1;
        }

        /// <summary>
        /// 最小公約数：ユークリッドの互除法 
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Gcd(long a, long b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
}


Measured memory_bytes: 13140
#include <set>
#include <cstdio>
#include <algorithm>
#include <queue>

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

#define f first
#define s second
#define mp make_pair

using namespace std;

int b[200][20];
const int unknown = 1000000;

int main(){
  int p, s;
  int m = 0;
  while(~scanf("%d%d ", &p, &s) && p != 0){
    vector<pair<int,int> > up;

    if(m++ != 0) puts("");

    REP(i, p+1) REP(j, s+1){
      char buff[32];
      scanf("%s ", buff);
      if(buff[0] == '?'){
        b[i][j] = unknown;
        up.push_back(mp(i, j));
      }else{
        b[i][j] = atoi(buff);
      }
    }

    bool ok = true;
    bool change = true;

    while(change){
      int cc = 0;
      change = false;

      REP(i,p){
        int cnt = 0;
        int sum = 0;
        pair<int,int> pos;

        REP(j,s){
          if(b[i][j] == unknown){
            cnt++;
            pos = mp(i,j);
          }else{
            sum += b[i][j];
          }
        }
        cc += cnt;

        if(cnt == 1){
          int y = pos.f;
          int x = pos.s;

          change = true;
          b[y][x] = b[i][s] - sum;

          sum = 0;
          REP(j, p){
            if(b[j][x] == unknown)
              goto end;
            else
              sum += b[j][x];
          }

          if(sum != b[p][x]){
            ok = false;
            goto end2;
          }

        end:;
        }

      }
      REP(j,s){
        int cnt = 0;
        int sum = 0;
        pair<int,int> pos;

        REP(i,p){
          if(b[i][j] == unknown){
            cnt++;
            pos = mp(i,j);
          }else{
            sum += b[i][j];
          }
        }

        if(cnt == 1){
          int y = pos.f;
          int x = pos.s;

          change = true;
          b[y][x] = b[p][j] - sum;

          sum = 0;
          REP(i, s){
            if(b[y][i] == unknown)
              goto end3;
            else
              sum += b[y][i];
          }

          if(sum != b[y][s]){
            ok = false;
            goto end2;
          }

        end3:;
        }

      }

      if(cc != 0 && change == false)
        ok = false;
    }
  end2:;

    if(ok){
      FOR(it, up){
        int y = it->f;
        int x = it->s;

        printf("%d\n", b[y][x]);
      }
    }else{
      puts("NO");
    }
  }
  return 0;
}

Measured memory_bytes: 0
fun main(args: Array<String>) {
    val (h, w) = readLine()!!.split(' ').map(String::toInt)
    val aMap = Array(h) { readLine()!!.split(' ').map(String::toLong).toLongArray() }
    val bMap = Array(h) { readLine()!!.split(' ').map(String::toLong).toLongArray() }
    val diffMap = Array(h) { IntArray(w) }
    for (r in 0 until h) {
        for (c in 0 until w) {
            diffMap[r][c] = Math.abs(aMap[r][c] - bMap[r][c]).toInt()
        }
    }

    val size = (h + w) * 80 / 2 + 80
    val dp =
            Array(h) {
                Array(w) {
                    BooleanArray(size) { false }
                }
            }
    dp[0][0][Math.abs(aMap[0][0] - bMap[0][0]).toInt()] = true
    for (r in 0 until h) {
        for (c in 0 until w) {
            val diff = diffMap[r][c]
            for (i in 0 until size) {
                val minus = Math.abs(i - diff)
                val plus = i + diff
                if (r - 1 >= 0 && dp[r - 1][c][i]) {
                    if (dp[r][c].size > plus) dp[r][c][plus] = true
                    dp[r][c][minus] = true
                } else if (c - 1 >= 0 && dp[r][c - 1][i]) {
                    if (dp[r][c].size > plus) dp[r][c][plus] = true
                    dp[r][c][minus] = true
                }
            }
        }
    }

    val min = dp[h - 1][w - 1].indexOfFirst { it }
    println(min)
}


Measured memory_bytes: 86548
n, k = gets.chomp.split.map(&:to_i)

# k = 0 の場合、 a = 0 の場合を含めて数えてしまってめんどくさいので、別に処理する
if k == 0
  puts n ** 2
  exit 0
end

def possible_a_count(n, k, b)
  div, mod = n.divmod(b)
  (b - k) * div + [mod - k + 1, 0].max
end

puts ((k + 1)..n).reduce(0) { |sum, b| sum + possible_a_count(n, k, b) }


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <queue>
#include <utility>

int h, w;
bool s[410][410];
bool v[410][410];
constexpr int di[] = { 1,0,-1,0 };
constexpr int dj[] = { 0,1,0,-1 };

int main() {
	std::cin >> h >> w;

	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			char in;
			std::cin >> in;
			s[i][j] = (in == '#');
		}

	long long ans = 0;
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			if (v[i][j])
				continue;
			long long b = 0, w2 = 0;
			std::queue<std::pair<int, int>> que;
			v[i][j] = true;
			que.emplace(i, j);
			while (!que.empty()) {
				auto p = que.front();
				que.pop();
				auto ci = p.first, cj = p.second;
				if (s[ci][cj])
					++b;
				else
					++w2;
				for (int d = 0; d < 4; ++d) {
					int ni = ci + di[d], nj = cj + dj[d];
					if (ni < 0 || ni >= h || nj < 0 || nj >= w || s[ci][cj] == s[ni][nj] || v[ni][nj])
						continue;
					v[ni][nj] = true;
					que.emplace(ni, nj);
				}
			}
			ans += b * w2;
		}

	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
    static int H,W,A,B;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] a = new int[N];
        for(int i = 0; i < N; i++)
            a[i] = sc.nextInt();

        for(int i = 0; i < N; i++){
            if(a[i]%2 != 0){
                System.out.println("first");
                return;
            }
        }
        System.out.println("second");
    }
}

Measured memory_bytes: 50744
#include<bits/stdc++.h>
#define int long long

using namespace std;
int32_t main()
{
    unsigned int a, b, c=1;
    double l;
    cin >> a;
    while(a--)
    {
      cin >> b;
      c *= b;
      if(b==0) cout<<0<<endl,exit(0);
      l += log10((double) b); 
    }
    if(l>18.00 || c > 1000000000000000000L) cout<<-1<<endl, exit(0);
    cout<<c<<endl;
}

Measured memory_bytes: 4004
N, K = gets.split.map(&:to_i)
p = gets.split.map(&:to_i)

kitai = p.map{|i| (1 + i).to_f / 2 }

ans = (0...K).map{|i| kitai[i]}.sum
k = ans
(1..N-K).each do |i|
  k = k - kitai[i-1] + kitai[i+K-1]
  ans = [ans, k].max
end
p ans

Measured memory_bytes: 30232
#include <iostream>

using namespace std;
using LL = long long;

int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

int gcd3(int a, int b, int c) {
    return gcd(gcd(a, b), c);
}

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

    LL ans = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                ans += gcd3(i, j, k);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3176
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	sliceS := strings.Split(s, "")
	m := make(map[string]int)
	for _, val := range sliceS {
		m[val]++
	}

	flag := 0
	if len(m) == 2 {
		for _, val := range m {
			if val != 2 {
				flag = 1
			}
		}

		if flag == 0 {
			fmt.Println("Yes")
		}
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    xs = list(map(int, input().split()))
    min_score = 10000000000000000000000000000
    for p in range(1, 101):
        score = 0
        for x in xs:
            score += (x - p)**2
        min_score = min(score, min_score)

    print(min_score)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38896
#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define all(x) x.begin(),x.end()
#define puts(x) cout << x << "\n"
using namespace std;
int input() { int r; cin >> r; return r; }
vector<int>v[123456]; int n;
int f(int i) {
	vector<int>v1;
	for (int t : v[i])v1.push_back(f(t));
	sort(all(v1), greater<int>());
	int r = 0;
	for0(j, v1.size())r = max(r, v1[j] + j+1);
	return r;
}
signed main() {
	n = input(); for1(i, n)if (i != 1)v[input()].push_back(i); puts(f(1));
}

Measured memory_bytes: 14080
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  int n,m;
  while(cin>>n>>m,n){
    int nsize = n*(n+1)/2;
    int msize = m*(m+1)/2;
    vector<int> rrr(nsize);
    vector<int> ccc(msize);
    int tmp;


    int k = n;
    REP(i,n){
      cin >> tmp;
      rrr[i] = tmp;
      int wa = tmp;
      for(int j = i-1;j>=0;j--){
	wa += rrr[j];
	rrr[k] = wa;
	k++;
      }
    }
    k = m;
    REP(i,m){
      cin >> tmp;
      ccc[i] = tmp;
      int wa = tmp;
      for(int j = i-1;j>=0;j--){
	wa += ccc[j];
	ccc[k] = wa;
	k++;
      }
    }
    sort(rrr.begin(),rrr.end());
    sort(ccc.begin(),ccc.end());
    rrr.push_back(-1);ccc.push_back(-1);
    int ri = 0, ci = 0;
    int ans = 0;
    int cct = 1, rct = 1;
    
    bool is_r = true, is_c = true;
    while(true){
      while(is_r && rrr[ri] == rrr[ri+1]){
	rct++;
	ri++;
      }
      while(is_c && ccc[ci] == ccc[ci+1]){
	cct++;
	ci++;
      }
      if(rrr[ri] == ccc[ci]){
	ans += rct * cct;
	//	cout << rrr[ri] << " " << ccc[ci] << endl;
	is_c = true;
	is_r = true;
	rct = 1;
	cct = 1;
	ri++;
	ci++;
      }
      else if(rrr[ri] > ccc[ci]){
	ci++;
	is_c = true;
	is_r = false;
	cct = 1;
      }else{
	ri++;
	is_r = true;
	is_c = false;
	rct = 1;
      }
      if(ri > nsize-1 || ci > msize-1)break;
    }
    cout << ans << "\n";
  }
  return 0;
}

Measured memory_bytes: 20540
#include <stdio.h>
int main(){
    int n, cont, cont2=0;
    scanf("%d", &n);
    for (int i=0;(2*i)+1<=n;i++){
        cont =0;
        for(int a=0;(2*a)+1<=(2*i)+1;a++){
            if((((2*i)+1)%((2*a)+1))==0){
                cont++;
            }
        }
        if(cont==8){
            cont2++;
        }
    }
    printf("%d\n", cont2);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	for(int i = 1;i <= 9;i++)
	{
		for(int j = 1;j <= 9;j++)
		{
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	return 0;
 } 

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false)
#define pdl cout << "*" << endl
#define MOD 1000000007
#define INF 1000000000
#define INFLL 1000000000000000000ll
#define ff first
#define ss second
#define long int64_t
using namespace std;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<> dis(0, INF<<1);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args)
{ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma+1, args...); }

const int N = 3;
const int M = 5000 * 5000 + 1;

long dp[N+1][M];
int a[N], b[N];

long solve(int i, int n)
{
	for(int i=0; i<=n; i++)
		dp[N][i] = i;
	for(int i=N-1; i>=0; i--)
	{
		int x = min(n, a[i]-1);
		for(int k=0; k<=x; k++)
			dp[i][k] = dp[i+1][k];
		for(int k=x+1; k<=n; k++)
			dp[i][k] = max(dp[i+1][k], b[i] + dp[i][k - a[i]]);
	}
	return dp[0][n];
}

int main()
{
	fio;
	long n;
	cin >> n;
	for(int i=0; i<N; i++)
		cin >> a[i];
	for(int i=0; i<N; i++)
		cin >> b[i];
	n = solve(0, n);
	for(int i=0; i<N; i++)
		swap(a[i], b[i]);
	n = solve(0, n);
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 781568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;
using ping = pair<ll, ll>;

int main() {
  string S, T;
  cin >> S >> T;
  bool check = true;
  if (S.size() + 1 != T.size()) check = false;
  for (int i = 0; i < S.size(); i++){
    if (S[i] != T[i]) check = false;
  }
  if(check){
    cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<list>
#include<string>
#include<algorithm>
 
using namespace std;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
}

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

using namespace std;
int main(void){
    int N;
    cin >> N;
    if(N%10 == 3){
        cout << "bon" << endl;
    }else if(N%10 == 0 || N%10 == 1 || N%10 == 6 || N%10 == 8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
}


Measured memory_bytes: 3628
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


//#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define repB(i, z, n) for(int i = n - 1; i >= z; i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
//const int INF = 1 << 29;
//const int64_t MOD = 1000000007;
//const int64_t INF = 998244353;
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; }
using namespace std;
//#define P pair<int, int>
typedef pair<int, int> P;
using namespace std;

int main(){
    int X, N;
    cin >> X >> N;
    vector<int> p(N);
    set<int> s;
    rep(i, 0, N){
        cin >> p.at(i);
        s.insert(p.at(i));
    }
    int count = -1;
    int sa = 1;
    if(!s.count(X)){
        cout << X << endl;
        return 0;
    }
    while(true){
        int A = X + sa * count;
        if(!s.count(A)){
            cout << A << endl;
            return 0;
        }
        else{
            if(count == -1){
                count = 1;
            }
            else{
                count = -1;
                sa++;
            }
        }
    }
}

Measured memory_bytes: 3628
#include<iostream>

using namespace std;

int main()
{
	int A,B,C,D;
 	cin >> A >> B >> C >> D;
  
  	int s = max(A,C);
  	int e = min(B,D);
  
  	cout << max(0,e-s) << endl;
  
	return 0;
}

Measured memory_bytes: 256
x=int(input())

if 400<=x<=599:
    print(8)
elif 600<=x<=799:
    print(7)
elif 800<=x<=999:
    print(6)
elif 1000<=x<=1199:
    print(5)
elif 1200<=x<=1399:
    print(4)
elif 1400<=x<=1599:
    print(3)
elif 1600<=x<=1799:
    print(2)
else:
    print(1)

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

#define ll long long
#define mod 1000000007
#define f(i, a, b) for (long long i = a; i < b; i++)
#define fm(i, a, b, c) for (long long i = a; i > b; i--)
#define vi vector<i>
#define vl vector<long long>
#define vs vector<string>
#define t     \
    ll t;     \
    cin >> t; \
    while (t--)
#define pb(i) push_back(i)
#define mp(i, j) make_pair(i, j)
#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL)
int main()
{
    double l;
    cout << fixed << setprecision(10);
    cin >> l;

    l /= 3;

    cout << (l * l * l) << endl;
    return 0;
}

Measured memory_bytes: 256
/* ABC134_B
    Stuartyg */

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

int main(void){
        int tree_num,see_num; /*n,dのこと*/
        scanf("%d %d",&tree_num,&see_num); /*標準入力から受け取る*/

        /*かぶりがないように監視させるのが良い
        だから、d+1，3d+2、…と2d+1おき(一人が監視できる最大の木の数)に配置したい*/
        int ans = tree_num / (2*see_num +1);
        if (tree_num % (2*see_num +1) == 0){
                printf("%d\n",ans);
        }
        else{
                printf("%d\n",ans+1);
                /*余りが0でなければ端の方の木は監視できていないのでもう一人いる*/
        }
        return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin>>n;

  int ans = n * n * n;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 892
N, Y = map(int,input().split())
a_max = min(N, Y // 10000)
flg = False
for a in range(a_max+1):
    if flg: 
        break
    for b in range(N+1):
        if flg:
            break 
        c = N - a - b
        if a*10000+b*5000+c*1000 == Y and c >= 0:
            print(a,b,c)
            flg = True
if not flg:
    print(-1,-1,-1)

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    while(true){
        int n;
        cin >> n;
        if(n==0) break;

        vector<string> words(n);
        for(auto& w:words) cin >> w;
        for(auto it=words.begin(); it!=words.end();){
            if(![&]{
                for(auto it2=words.begin();it2!=words.end(); ++it2) if(it2!=it and it2->find(*it)!=string::npos){
                    it=words.erase(it);
                    return true;
                }
                return false;
            }()) ++it;
        }

        vector<vector<int>> graph(words.size(),vector<int>(words.size()));
        for(int i=0; i<words.size(); ++i) for(int j=0; j<words.size(); ++j){
            const string& w1=words[i],w2=words[j];
            int same=0;
            for(int len=0; len<=min(w1.size(),w2.size()); ++len) if(w1.substr(w1.size()-len,len)==w2.substr(0,len)) same=len;
            graph[i][j]=w2.size()-same;
        }

        int dp[1<<10][10];
        string str[1<<10][10];
        fill_n((int*)dp,(1<<10)*10,inf);
        for(int i=0; i<words.size(); ++i){
            dp[1<<i][i]=words[i].size();
            str[1<<i][i]=words[i];
        }
        function<int(int,int)> rec=[&](int state,int v){
            int& res=dp[state][v];
            if(res!=inf) return res;
            for(int u=0; u<words.size(); ++u) if(u!=v and (state>>u)&1){
                int len=rec(state&~(1<<v),u)+graph[u][v];
                const string& tmp=str[state&~(1<<v)][u]+words[v].substr(words[v].size()-graph[u][v]);
                if(len<res){
                    res=len;
                    str[state][v]=tmp;
                }else if(len==res) str[state][v]=min(str[state][v],tmp);
            }
            return res;
        };

        int mini=inf;
        string ans;
        for(int i=0; i<words.size(); ++i){
            int len=rec((1<<words.size())-1,i);
            const string& tmp=str[(1<<words.size())-1][i];
            if(len<mini){
                mini=len;
                ans=tmp;
            }else if(len==mini) ans=min(ans,tmp);
        }
        cout << ans << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

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

ll mod=1e9+7;
int main() {
  int n;
  cin>>n;

  string s;
  cin>>s;

  ll out=1;
  int opened=0;
  int closed=0;
  bool inv;
  if(s[0]=='W'){
    cout<<0<<endl;
    return 0;
  }
  out*=n;
  opened++;
  inv=false;
  rep_in(i,1,2*n){
    if((s[i-1]!=s[i])!=inv){
      out=out*(n-opened-closed)%mod;
      opened++;
      inv=false;
    }else{
      out=out*opened%mod;
      opened--;
      if(opened<0){
        cout<<0<<endl;
        return 0;
      }
      closed++;
      inv=true;
    }
    //cout<<out<<endl;
  }

  cout<<out<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
char a[50];
int b[27];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>a;

    for(int i=0;i<4;i++)
    {

        int x=(a[i]-'A'+1);
        b[x]++;
    }
    int flag=0;
    for(int i=1;i<=26;i++)
    {
        if(b[i]==2)
        {
            flag++;
        }
    }
    if(flag==2)
    {
        cout<<"Yes"<<'\n';
    }
    else
        cout<<"No"<<'\n';






}


Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

constexpr int dx[] = {-1, 0, 1, 0};
constexpr int dy[] = {0, -1, 0, 1};

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	VI c(n);
	VI2D a(n, VI(m));
	REP(i, n) {
		cin >> c[i];
		REP(j, m) { cin >> a[i][j]; }
	}

	ll bf = 0;
	ll bf_max = (1 << n);
	int result = INF;
	while(bf < bf_max) {
		int cost = 0;
		VI u(m, 0);
		REP(i, n) {
			if(bf & (1 << i)) {
				cost += c[i];
				REP(j, m) { u[j] += a[i][j]; }
			}
		}
		bool is_all = true;
		REP(i, m) {
			if(u[i] < x) {
				is_all = false;
				break;
			}
		}
		if(is_all) {
			chmin(result, cost);
		}
		bf++;
	}
	cout << (result == INF ? -1 : result) << endl;
	return 0;
}


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

using namespace std;

int h1, m1, h2, m2, k;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = h1 * 60 + m1, t2 = h2 * 60 + m2;
    cout << max(0, t2 - t1 - k) << endl;
    return 0;
}


Measured memory_bytes: 3636