akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

ll N, K;
ll a[101000];
int x[64];
vector<P> p;

bool comp(P x, P y){
    if(x.first > y.first){
        return true;
    }
    else if(x.first == y.first && x.second < y.second){
        return true;
    }
    else{
        return false;
    }
}

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

    fill(x, x+64, 0);
    for(int i = 0; i < 42; i++){
        for(int j = 0; j < N; j++){
            x[i] += 1 - (a[j] >> i) % 2;
        }
    }
    ll res = 0;

    for(int i = 0; i < 42; i++){
        if(x[i] * 2 > N) {
            ll y = x[i] * (1LL << i);
            p.emplace_back(P(y, i));
        }
        else{
            res += (N-x[i]) * (1LL << i);
        }
    }

    sort(p.begin(), p.end(), comp);

    ll res_x = 0;
    for(int i = 0; i < p.size(); i++){
        if(res_x + (1LL << p[i].second) <= K){
            res += p[i].first;
            res_x += (1LL << p[i].second);
        }
        else{
            res += (N-x[p[i].second]) * (1LL << p[i].second);
        }

    }

    cout << res << endl;


    return 0;

}


Measured memory_bytes: 1024
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <bitset>
#include <vector>
using namespace std;

#define LL long long

#define fi first
#define se second
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(a,b) (((a)+(b))>>1)
#define maxx(a,b) ((a)<(b)?(b):(a))
#define minx(a,b) ((a)<(b)?(a):(b))
#define absx(a) ((a)<0?-(a):(a))
#define mk(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define itr iterator
#define lowbit(x) ((x)&-(x))

typedef unsigned LL ULL;
typedef unsigned uint;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;

template< typename T > inline void read(T &x) {
    static bool fr_f; static char fr_ch;
    fr_f=0; x=0; fr_ch=getchar();
    while(fr_ch<'0' || '9'<fr_ch) {if(fr_ch=='-') fr_f=1; fr_ch=getchar();}
    while('0'<=fr_ch && fr_ch<='9') {x=(x<<1)+(x<<3)+fr_ch-'0'; fr_ch=getchar();}
    if(fr_f) x=-x;
}

template< typename T > inline void Max (T &a, T b) {if(a<b) a=b;}
template< typename T > inline void Min (T &a, T b) {if(b<a) a=b;}
template< typename T > inline void Swap(T &a, T &b) {T c=a;a=b;b=c;}
template< typename T > inline T Abs(T a) {if(a<0) return -a; else return a;}

const double   pi = acos(-1.0) ;
const int     MOD = (int)1e9+7 ;
const int     INF = (int)0x3f3f3f3f ;
const LL     LINF = (LL)INF<<32|INF ;
const int    SINF = (uint)(-1)>>1 ;
const LL    SLINF = (ULL)(-1)>>1 ;
const double DINF = 1e50 ;
const double  eps = 1e-5 ;
const int    maxn = (int) 1e5+20 ;
const int    maxm = (int) 1e6+20 ;
const int    maxk = (int) 1000+20 ;

inline int sig(double x) {return x<-eps?-1:x>eps;}
inline LL fp(LL a,LL n,LL p) {LL res=1; for(;n;n>>=1,a=a*a%p) if(n&1) res=res*a%p; return res;}
template<typename T>inline T gcd(T a,T b) {for(T c;b;c=a%b,a=b,b=c); return a;}

//--------------------start--------------------

int n;
int a[maxn];

void work()
{
    read(n);
    for(int i = 0; i < n; i++) read(a[i]);
    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        while((a[i] & 1) == 0)
        {
            a[i] >>= 1;
            cnt++;
        }
    }

    cout <<cnt <<endl;
}

//---------------------end---------------------

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // yukihana0416
    work();
    return 0;
}


Measured memory_bytes: 892
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toInt).toIndexedSeq)
  val A = ls(0).tail.toSeq
  val L = ls.tail.map(e => e(0)).toSeq
  //println(A, L)
  
  @scala.annotation.tailrec
  private def pat(i: Int, r:Seq[Int]):Seq[Int] = {
    if(i<=0) r else pat(i/4, r :+ i%4)
  }
  //println(pat(27,Seq()))
  
  private def eval(pat:Seq[Int]):Int = {
	//if(pat.size <= 0) return Int.MaxValue
    val s = Array(Array[Int](), Array[Int](), Array[Int](), Array[Int]())  
    (0 until L.size).map{ i =>
      val pos = if(pat.size > i) pat(i) else 0
      s(pos) = s(pos) ++ Array(L(i))
    }
    val s0 = s(0).toSeq
    val s1 = s(1).toSeq
    val s2 = s(2).toSeq
    //println(s0, s1, s2)
    if(s0.size <= 0 || s1.size <= 0 || s2.size <= 0) return Int.MaxValue
    
    val mp0 = Math.abs(s0.sum - A(0))
    val mp1 = Math.abs(s1.sum - A(1))
    val mp2 = Math.abs(s2.sum - A(2))
    val mpa = (s0.size-1 + s1.size-1 + s2.size-1) * 10
    mpa + mp0 + mp1 + mp2
  }
  
  val perm = Math.pow(4, L.size).toInt
  val ret = (0 to perm).foldLeft(Int.MaxValue){ (a,i) =>
    Math.min(a, eval(pat(i, Seq())) )
  }
  //val ret = 8*7*6*5*4*3*2*1
  println(ret)
}


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

double dp[305][305][305];
double ev[305][305][305];

int main()
{
vector<int>cnt(4,0);
int n;
cin>>n;
for(int i=0;i<n;i++){
int x;
cin>>x;
cnt[x]++;
}
dp[cnt[1]][cnt[2]][cnt[3]]=1;
for(int k=n;k>=0;k--){
    for(int j=n;j>=0;j--){
          for(int i=n;i>=0;i--)  { if(i+j+k>n)continue;
     double p_waste=(double)(n-(i+j+k))/n,evwaste;
if(p_waste==1)continue;
evwaste=p_waste/(1-p_waste)+1;
     ev[i][j][k]+=dp[i][j][k]*evwaste;
     if(i>0){double p_go=((double)(i))/(i+j+k);dp[i-1][j][k]+=dp[i][j][k]*p_go;ev[i-1][j][k]+=ev[i][j][k]*p_go;}
     if(j>0){double p_go=((double)(j))/(i+j+k);dp[i+1][j-1][k]+=dp[i][j][k]*p_go;ev[i+1][j-1][k]+=ev[i][j][k]*p_go;}
     if(k>0){double p_go=((double)(k))/(i+j+k);dp[i][j+1][k-1]+=dp[i][j][k]*p_go;ev[i][j+1][k-1]+=ev[i][j][k]*p_go;}
     }
  }
}
cout<<setprecision(20)<<fixed<<ev[0][0][0];//+cnt[1]+2*cnt[2]+3*cnt[3];
}

Measured memory_bytes: 438528
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, a[N], dur, ans;

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d",&n);
	for(int i = 1; i <= n; i++)
		scanf("%d",a + i);
	for(int i = 2; i <= n; i++){
		if(a[i] > a[i - 1]){
			if(dur == 0){
				ans++;
				dur = 1;
			}
			if(dur == 2){
				dur = 0;
			}

		}
		if(a[i] < a[i - 1]){
			if(dur == 0){
				ans++;
				dur = 2;
			}
			if(dur == 1){
				dur = 0;
			}

		}
		// cout << i << " " << dur << endl;
	}
	if(!dur)
		ans++;
	// b[1] = 123;
	// for(int i = 2; i <= n; i++){
	// 	cout << b[i] << " ";
	// 	if(b[i] != b[i - 1])
	// 		ans++;
	// }
	printf("%d\n", ans);
	return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ; 
  cin >> n ; 
  vector<int> d(n) ;
  rep(i,n) cin >> d.at(i) ;
  sort(all(d)) ;
  int ans = 0 ;
  
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(d.at(i) != d.at(j) && d.at(j)!=d.at(k)){
          if(d.at(k) < d.at(i) + d.at(j) ) ans ++ ;
        }
      }
    }
  }
  
  cout <<ans ;
  
}


Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

signed main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    int a, b;
    rep(i, m) {
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i, n) cout << g[i].size() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)

void printVec(std::vector<int> &vec) {
//    std::cout << "";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        std::cout << *it << " ";
    }
    cout << '\n';
}

void printVec1(std::vector<string> &vec) {
//    std::cout << "";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        std::cout << *it << " ";
    }
    cout << '\n';
}

void printVec2(std::vector<Int> &vec) {
//    std::cout << "";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        std::cout << *it << " ";
    }
    cout << '\n';
}

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;
    //a*bは64bit integer overflow
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

void y() {
    cout << "Yes" << endl;
    exit(0);
}

void n() {
    cout << "No" << endl;
    exit(0);
}

void Y() {
    cout << "YES" << endl;
    exit(0);
}

void N() {
    cout << "NO" << endl;
    exit(0);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}

/*   kokomade  */

int cnt = 0;

int main() {
    IOS;
    int n,x;
    cin>>n>>x;
    vector<int> d(n);
    int sum=0;
    for (int i = 0; i < n; ++i) {
        cin>>d[i];
        sum+=d[i];
    }
    ssort(d);
    cout<<n+(x-sum)/d[0];


    cout << endl;

    return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int X = scanner.nextInt();
    int Y = scanner.nextInt();
    int Z = scanner.nextInt();
    System.out.printf("%d %d %d\n", Z, X, Y);
  }
}


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

using namespace std;



int main()
{
    int n;
    cin>>n;
    vector<int> vec(n);
    for(auto&v : vec)
        cin>>v;

    int next = 1;
    int ans = 0;

    while(true){
        next = vec[next-1];
        ans++;
        if(next == 1 || ans>n) {
            cout << -1 << endl;
            return 0;
        }

        if(next == 2){
            cout<<ans<<endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 640
# -*- coding: utf-8

h, w = map(int, input().split())
c = []
for n in range(h):
    c.append(list(input()))

for i in range(1, h * 2 + 1):
    for j in range(1, w + 1):
        print(c[(i + 1) // 2 - 1][j - 1], end='')
    print()

Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	scanf("%d",&n);
	for(int i=0;i<=n;i++) {
		for(int j=0;j<=n;j++) {
			if(i*4 + j*7 == n ){
				printf("Yes");
				return 0;
			}
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<pair<int,int>> ps(N);
  F0R(i, N) {
    cin >> ps[i].first;
    ps[i].second = i;
  }
  sort(rrng(ps), [](const pair<int, int>& l, const pair<int, int>& r) {
    return l.first < r.first;
    });

  i64 result = 0;

  vector<int> is;

  F0R(i, N) {

    int n = lower_bound(rng(is), ps[i].second) - is.begin();
    //debug(n);

    // 自分より大きい数がない最大の区間
    int l = n > 0 ? ps[i].second - is[n - 1] : ps[i].second + 1;
    int r = n < is.size() ? is[n] - ps[i].second : N - ps[i].second;

    // 自分より大きい数が0～1個ある最大の区間
    int l2 = n > 1 ? ps[i].second - is[n - 2] : ps[i].second + 1;
    int r2 = n < (int)is.size() - 1 ? is[n + 1] - ps[i].second : N - ps[i].second;
    //cout << l << ',' << r << " " << l2 << "," << r2 << newl;

    result += (i64)ps[i].first * (l * (r2 - r) + r * (l2 - l));
    //debug(result);

    is.insert(is.begin() + n, ps[i].second);
    //Print(is);
  }
  cout << result;
}
#endif


Measured memory_bytes: 1660
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int n;
    cin>>n;
    int k;
    cin>>k;
    int ami[n+1];
    for(int i=0;i<n+1;i++){
        ami[i]=i;
    }
    for(int i=0;i<k;i++){
        int a,b;
        char c;
        cin>>a>>c>>b;
        swap(ami[a],ami[b]);
    }
    
    for(int i=1;i<n+1;i++){
        
        
        cout<<ami[i]<<endl;
    }
    
}



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

using namespace std;

#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)

typedef long long ll;
typedef pair<int, int> pii;

const int N = 200200;
const int mod = 1e9 + 7;

int h, w, n, a[N], col[202][202];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> h >> w;
	cin >> n;
	fo(i, n)
		cin >> a[i];
	int curh = 1, curw = 1, dir = 1;
	fo(i, n)
	{
		while(a[i])
		{
			col[curh][curw] = i;
			a[i]--;
			if(dir == 1)
			{
				if(curw == w)
				{
					dir ^= 1;
					curh++;
				}
				else
					curw++;
			}
			else
			{
				if(curw == 1)
				{
					dir ^= 1;
					curh++;
				}
				else
					curw--;
			}
		}
	}
	fo(i, h)
	{
		fo(j, w)
			cout << col[i][j] << ' ';
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 384
import std.algorithm,
       std.string,
       std.array,
       std.stdio,
       std.range,
       std.conv;

void main() {
  int[] AB = readln.chomp.split.to!(int[]);
  int A = AB[0],
      B = AB[1];

  writeln([(A % 3), (B % 3), ((A + B) % 3)].any!(x => x == 0) ? "Possible" : "Impossible");
}


Measured memory_bytes: 256
using System;

class ABC_141_C
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);
        int Q = int.Parse(input[2]);

        int[] P = new int[N];
        for (int i = 0; i < Q; i++)
        {
            int a = int.Parse(Console.ReadLine());
            P[a-1]++;
        }

        for (int i = 0; i < N; i++)
        {
            if (K - (Q - P[i]) > 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 17600
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define LL long long

bool isPrime(LL a) {
    for (LL i=2; i <= sqrt(a); i++){
        if (a % i == 0) return false;
    }
    return true;
}

LL ipow(LL base, LL exp) {
    LL result = 1;
    while(true) {
        if (exp & 1) result *= base;
        exp >>= 1;
        if (!exp) break;
        base *= base;
    }

    return result;
}

int nDividable(LL &a, LL b) {
    if (b == 1) return 0;
    int divided = 0;
    while (a % b == 0) {
        //cout << b << endl;
        divided++;
        a /= b;
    }
    return divided;
}

int main() {
    LL n, p;
    cin >> n >> p;

    LL gcd = 1;
    for (LL i=1; i <= sqrt(p); i++){
        LL q = p;

        int d1 = 0, d2 = 0;
        if (isPrime(i)) d1 = nDividable(q, i);
        if (p % i == 0 && isPrime(p / i)) d2 = nDividable(q, p / i);
 
        if (d1 != 0) gcd *= ipow(i, d1 / n);
        if (d2 != 0) gcd *= ipow(p / i, d2 / n);

        //cout << i << endl;
        p = q;
    }

    cout << gcd << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a*d, b*d), max(a*c, b*c)) << '\n';
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

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

int main() {
  int N, K, L=1;
  cin >> N >> K;
  
  while(N >> 0){
  if(L < K){
  L += L;
  }
  else{
  L += K;
  }
  N--;
  }
  cout << L << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<list>


using namespace std;


int main()
{
	int n, num;


	ios::sync_with_stdio(false);

	cin >> n;

	for (int i = 0; i != n; ++i)
	{
		cin >> num;
		cout << "Case " << i + 1 << ":" << endl;
		for (int j = 0; j != 10; ++j)
		{
			num = (num*num)%1000000/100;
			cout << num << endl;
		}
	}



	return 0;

}


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

void swap(int* x, int* y) {
	int tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
}

int main() {
	int x[10010], y[10010];
	int n = 0;

	while (1) {
		cin >> x[n] >> y[n];
		if (!x[n] && !y[n]) break;
		if (x[n] > y[n]) swap(&x[n], &y[n]);
		++n;
	}

	for (int i = 0; i < n; ++i) printf("%d %d\n", x[i], y[i]);
}


Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;

signed main() {
  int Q, H, S, D, N; cin >> Q >> H >> S >> D >> N;
  int ans = (N/2) * min({8*Q, 4*H, 2*S, D}) + (N%2) * min({4*Q, 2*H, S});
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

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

	var s, t string
	for i := 0; i < b; i++ {
		s += strconv.Itoa(a)
	}
	for i := 0; i < a; i++ {
		t += strconv.Itoa(b)
	}
	if s < t {
		fmt.Println(s)
	} else {
		fmt.Println(t)
	}
}


Measured memory_bytes: 512
S=input()
TL=len(S)
SL=list(S[i] for i in range(TL))#床の情報
BL=[0]*TL
ans=[0]*TL #子供の座標
cnt=0
for j in range(2):
  for i in range(TL):
    
    if SL[i]=="R":
      cnt=cnt+1
    else:
      ans[i]=ans[i]+cnt//2
      ans[i-1]=ans[i-1]+(cnt+1)//2
      cnt=0
    
  SL.reverse()
  ans.reverse()
  for i in range(TL):
    if SL[i]=="R":
      SL[i]="L"
    else:
      SL[i]="R" 
for i in range(TL):
  print(ans[i])

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

typedef long long int ll ;

string check(int a,int b)
{
    ll prod = a*b ;
    return (prod&1) ? "Odd" : "Even";
}
int main()
{
    int a,b ;
    cin >> a >> b ;
    cout << check(a,b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;

using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int c = 0, mn = 0;
	ff(i, 0, n) {
		if (s[i] == '(')c++;
		else c--;
		mn = min(mn, c);
	}
	mn *= -1;
	ff(i, 0, mn) {
		cout << "(";
	}
	c = 0;
	mn = 0;
	ff(i, 0, n) {
		if (s[n-i-1] == ')')c++;
		else c--;
		mn = min(mn, c);
	}
	cout << s;
	mn *= -1;
	ff(i, 0, mn) {
		cout << ")";
	}
	cout << endl;
	return 0;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define I(x, a) for(auto x : a)
#define F(i, l, r) for(auto i = l; i < r; ++i)
#define E(i, l, r) for(auto i = l; i <= r; ++i)
#define DF(i, l, r) for(auto i = l; i >= r; --i)
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define sz(a) ((int)(a).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair <int, int> pii;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)1e9 + 7;
const dbl eps = (dbl)1e-8;
const int maxn = (int)1e5 + 5;
const dbl pi = acos(-1);

int main() {
//	fin("t.in");
//	fout("t.out");
	sync;
	int T;
	cin >> T;
	F(numt, 0, T) {
		ll a, b, c, d, ans = 1;
		cin >> a >> b >> c >> d;
		if (d < b || a < b)
			ans = 0;
		ll g = __gcd(b, d);
		ll z = a % g;
		ll k, l;
		if (z > c)
			ans = 0;
		else {
			k = (c - z) / g;
			++k;
			l = k * g + z;
			if (l < b)
				ans = 0;
		}
		cout << (ans ? "Yes" : "No") << "\n";
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int a,b,c,x,y; cin>>a>>b>>c>>x>>y;

	int ans=0;
	if(x>0 && y>0 && 2*c<a+b){
		int z=min(x,y);
		x-=z;
		y-=z;
		ans+=2*c*z;
	}
	ans+=min(a,2*c)*x;
	ans+=min(b,2*c)*y;
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

int main(){
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	int ans = 0;
	for(int r=0;r*R<=N;r++){
		for(int g=0;r*R + g*G <= N;g++){
			if(!((N - r*R - g*G) % B))ans++;
		}
	}
	cout << ans << endl;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int n;
	cin>>n;
	vector<vector<ll>> dp(n+1,vector<ll>(n+1));
	vector<ll> a(n+1);
	for1(i,n){
		cin>>a[i];
		dp[i][i]=a[i];
	}
	for(int i=2;i<=n;i++){
		for(int j=1;i+j-1<=n;j++){
			dp[j][j+i-1]=max(a[j+i-1]-dp[j][j+i-2],a[j]-dp[j+1][j+i-1]);
		}
	}
	cout<<dp[1][n];
    return 0;
}



Measured memory_bytes: 70784
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

vector<int> rs[502];

int a[502][502];
int sum[502][502];

int main(){
	int N,M,Q;
	cin>>N>>M>>Q;
	rep(i,M){
		int l,r;
		cin>>l>>r;
		a[l][r]++;
	}
	rep(j,N+1)sum[0][j]=0;
	rep1(i,N){
		sum[i][0]=0;
		rep1(j,N){
			sum[i][j]=sum[i-1][j]+sum[i][j-1]+a[i][j]-sum[i-1][j-1];
		}
	}
	
	rep(i,Q){
		int p,q;
		cin>>p>>q;
		cout<<sum[q][q]-sum[p-1][q]-sum[q][p-1]+sum[p-1][p-1]<<endl;
	}
}

Measured memory_bytes: 2944
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

for i in range(n - 2):
    if d[i][0]==d[i][1] and d[i+1][0]==d[i+1][1] and d[i+2][0]==d[i+2][1]:
        print('Yes')
        exit()
print('No')

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

const long long MOD = 1'000'000'007;
const int MAXN = 2'000;

int arr[MAXN];
int kek[MAXN];

int dp1[MAXN + 1][MAXN + 1];
int dp2[MAXN + 1][MAXN + 1];
int ok1[MAXN + 1][MAXN + 1];
int ok2[MAXN + 1][MAXN + 1];

int rec2(int n, int m)
{
    if (ok2[n][m])
        return dp2[n][m];
    ok2[n][m] = 1;
    
    if (n * m == 0)
        dp2[n][m] = 1;
    else
        dp2[n][m] = (MOD + rec2(n, m - 1) + rec2(n - 1, m) - rec2(n - 1, m - 1) + dp1[n][m]) % MOD;
    
    return dp2[n][m];
}

int rec1(int n, int m)
{
    if (ok1[n][m])
        return dp1[n][m];
    ok1[n][m] = 1;
    
    if (arr[n - 1] == kek[m - 1])
        dp1[n][m] = rec2(n - 1, m - 1);
    
    return dp1[n][m];
}

int main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i != n; ++i)
        cin >> arr[i];
    for (int i = 0; i != m; ++i)
        cin >> kek[i];
    dp1[0][0] = 1;
    dp2[0][0] = 1;
    ok1[0][0] = 1;
    ok2[0][0] = 1;
    int ans = 1;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            rec1(i, j);
    cout << rec2(n, m) << '\n';
}

Measured memory_bytes: 62848
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        double N=cin.nextDouble();
        double K=cin.nextDouble();
        int ans=0;
        if(N==1){ans=1;goto end;}
        for(int i=30;i>=0;i--)
        {
          if(N/Math.Pow(K,(double)i)>=1){ans=i+1;break;}
        }
        end:
      Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {

   ll n;
   cin>>n;

   vector<ll> x(3*n+1);
   for(int i=1;i<=3*n;i++)
    cin>>x[i];

   multiset<ll> s1;
   ll sum1=0;
   for(int i=1;i<=n;i++)
        {
            sum1+=x[i];
            s1.insert(x[i]);
        }
    //cout<<sum1<<endl;
    vector<ll> z;
    z.push_back(sum1);

    for(int i=n+1;i<=2*n;i++)
    {
        sum1+=x[i];
        s1.insert(x[i]);
        sum1-=*s1.begin();
      //  cout<<sum1<<endl;
        z.push_back(sum1);
        multiset<ll>::iterator itr=s1.find(*s1.begin());
        s1.erase(itr);
    }
    ll sum2=0;
    multiset<ll> s2;
    for(int i=3*n;i>=2*n+1;i--)
    {
        sum2+=x[i];
        s2.insert(x[i]);
    }
    //cout<<sum2<<endl;
    ll ans=-999999999999999;
    int k=z.size()-1;
    if(z[k]-sum2>ans)
        ans=z[k]-sum2;
    k--;
    for(int i=2*n;i>=n+1;i--)
    {
        sum2+=x[i];
        s2.insert(x[i]);
        sum2-=*s2.rbegin();
        //cout<<sum2<<endl;
         if(z[k]-sum2>ans)
            ans=z[k]-sum2;
        k--;
        multiset<ll>::iterator itr=s2.find(*s2.rbegin());

        s2.erase(itr);



    }
    cout<<ans<<endl;
















}


Measured memory_bytes: 12792
# h, w, a, b = map(int, input().split())
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y and (n-i-j) >= 0:
            print(i, j, n-i-j)
            exit()
print("-1 -1 -1")


Measured memory_bytes: 41324
from collections import deque
Q=deque()
n=int(input())
graph={}
d=[0 for i in range(n+1)]

for i in range(n):
    tmp=list(map(int,input().split()))
    graph[tmp[0]]=[0 for j in range(n+1)]
    for j in range(tmp[1]):
        graph[tmp[0]][tmp[2+j]]=1

Q.append(1)
while len(Q) is not 0:
    number=Q[0]
    if 1 in graph[number]:
        for i in range(graph[number].count(1)):
            Q.append(graph[number].index(1))
            if d[graph[number].index(1)] is 0:
                d[graph[number].index(1)]=d[number]+1
            graph[number][graph[number].index(1)]=0
        
    Q.popleft()

for i in range(n):
    if i==0:
        print(i+1,0)
    else:
        if d[i+1]==0:
            print(i+1,-1)
        else:
            print(i+1,d[i+1])


Measured memory_bytes: 6112
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

int main()
{

	int a = 0, b = 0, c = 0, d = 0, e = 0, maxy = 0, max = -1, ans = 1, count = 0, min = 0;

	int yoko = 0, tate = 0;
	std::string output, output2, output3, input = {};
	bool okada = false;
	int array[30][30],array2[30][30];
	int nearbydis;


	cin >> a>>b ;
	for (int i = 1; i <= a; i++) {
		for (int j = 1; j <= b; j++) {
             cin >> array[i][j];
		}
		
	}
	for (int i = 1; i <= a; i++) {
		for (int j = 1; j <= b; j++) {
			
			//
			for (int k = 1; k <= a; k++) {
				for (int l = 1; l <= b; l++) {
					//幹線道路はi,j
					//町の決定はk,l
					
						nearbydis = std::min(std::abs(k - i),std::abs(l-j));
						count += array[k][l] * nearbydis;

						nearbydis = 0;
				}
			}
			//
			if (i == 1 && j == 1) {
				min = count;
			}
			else if(count<min){
				min = count;
			}
			count = 0;
		}
		
	}
	cout << min << endl;
	
}








Measured memory_bytes: 3076
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入

int main(){
    int N,Q;
    cin>>N>>Q;
    priority_queue<tuple<ll,ll,ll>,vector<tuple<ll,ll,ll>>,greater<tuple<ll,ll,ll>>> XST;
    int s,t,x;
    REP(i,N){
        cin >>s>>t>>x;
        XST.push(make_tuple(x,s,t));
    }
    ll d;
    map<ll,int> D;
    REP(i,Q){
        cin >>d;
        D[d]=i;
    }
    tuple<ll,ll,ll> tmp;
    int cnt=0;
    vector<ll> ans(Q,-1);
    while(!XST.empty()){
        tmp=XST.top();
        XST.pop();
        x=get<0>(tmp);
        s=get<1>(tmp);
        t=get<2>(tmp);
        auto first=D.lower_bound(s-x);
        auto last=D.lower_bound(t-x);
        for(auto itr=first;itr!=last;itr++){
            ans[itr->second]=x;
        }
        D.erase(first,last);
    }
    REP(i,Q){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 21740
#include<bits/stdc++.h>
using namespace std;
#define INF 10000000000

int main(){

    int n; cin >> n;
    set<int> s;
    for(int i = 0; i < n; i++){
        int input; cin >> input;
        s.insert(input);
    }
    cout << s.size() << endl;
    return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()

int main() {
	int n;
	cin >> n;
	vector<int> a(21);
	vector<int> b(21);
	vector<int> c(20);
	int sum = 0;
	FOR(i, 1, n) {
		cin >> a[i];
	}
	FOR(i, 1, n) {
		cin >> b[i];
		sum += b[i];
	}
	FOR(i, 1, n-1) {
		cin >> c[i];
	}
	FOR(i, 1, n - 1) {
		if (a[i + 1] - a[i] == 1) {
			sum += c[a[i]];
		}
	}
	pv(sum)
	return(0);
}

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

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

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

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

    int ans = 0;
    for(int i = 0;i < n;i++){
        if(a[i] > b[i]){
            ans += a[i]-b[i];
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string S;
  cin >> S;
  set<string> s;
  int n = S.length();
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  if (n == 2) {
    if (S[0] == S[1]) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
    return 0;
  }
 
  int dp[n]{};
  // 1文字目
  dp[0] = 1;
  // 2文字目
  if (S[0] == S[1]) {
    dp[1] = 1; // aa -> a, a
  } else {
    dp[1] = 2; // ab -> a, b
  }
  // 3文字目
  if (S[0] != S[1] && S[1] != S[2]) {
      dp[2] = 3; // aba -> a, b, a
  } else {
      dp[2] = 2; // ?aa -> ?a, a
  }
  for (int i = 3; i < n; i++) {
      if (S[i - 1] == S[i]) {
          dp[i] = dp[i - 3] + 2; // ??aa -> ?, ?a, a or ?, ?, aa
      } else {
          dp[i] = dp[i - 1] + 1; // ?ab -> ?, a, b or ?a, b
      }
  }
  cout << dp[n - 1] << "\n";
  return 0;
}


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

int main()
{
       string s;
       ll n; cin>>n;
       cin>>s;
       ll r=0,cnt=0;
       for(ll i=2; i<s.size(); i++){
        if(s[i]=='C' && s[i-1]=='B' && s[i-2]=='A')cnt++;
       }
       cout<<cnt<<endl;


}

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

int main() {
	int minute,hour,second;
	cin >> second;
	minute = second / 60;
	second = second % 60;
	hour = minute / 60;
	minute = minute % 60;
	hour = hour % 24;

	cout << hour << ":" << minute << ":" << second << endl;
	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1

struct Node {int p, l, r;};
Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {

    if (u == NIL) return;
    D[u] = d;
    setDepth(T[u].l, d+1);
    setDepth(T[u].r, d+1);
}

int setHeight(int u) {

    int h1 = 0, h2 = 0;
    if (T[u].l != NIL)
        h1 = setHeight(T[u].l) + 1;
    if (T[u].r != NIL)
        h2 = setHeight(T[u].r) + 1;

    return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u) {

    if (T[u].p == NIL) return NIL;

    if (T[T[u].p].l != u && T[T[u].p].l != NIL)
        return T[T[u].p].l;
    
    if (T[T[u].p].r != u && T[T[u].p].r != NIL)
        return T[T[u].p].r;
    
    return NIL;
}

void print(int u) {

    int deg = 0;
    
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "sibling = " << getSibling(u) << ", ";
    if (T[u].l != NIL) deg++;
    if (T[u].r != NIL) deg++;
    cout << "degree = " << deg << ", ";
    cout << "depth = " << D[u] << ", ";
    cout << "height = " << H[u] << ", ";

    if (T[u].p == NIL)
        cout << "root" << endl;
    else if (T[u].l == NIL && T[u].r == NIL)
        cout << "leaf" << endl;
    else
        cout << "internal node" << endl;
}

int main() {

    int v, l, r, root = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        T[i].p = NIL;
    }

    for (int i = 0; i < n; i++) {
        cin >> v >> l >> r;
        T[v].l = l;
        T[v].r = r;
        if (l != NIL) T[l].p = v;
        if (r != NIL) T[r].p = v;
    }

    for (int i = 0; i < n; i++) {
        if (T[i].p == NIL) root = i;
    }

    setDepth(root, 0);
    setHeight(root);

    for (int i = 0; i < n; i++) {
        print(i);
    }
    
    return 0;

}


Measured memory_bytes: 3104
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
int a[N],f[N];
int ans;
int main()
{
    int n;
    cin>>n;
    for(int i=n;i>=1;i--)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        if(f[ans]<=a[i])
        {
            f[++ans]=a[i];
        }
        else
        {
            f[upper_bound(f+1,f+1+ans,a[i])-f]=a[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4268
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main()
{
	fast;
	ll n,sum=0;
	cin>>n;
	ll v[n],c[n];
	for(int i=0;i<n;i++)
		cin>>v[i];
	for(int i=0;i<n;i++)
		cin>>c[i];
	for(int i=0;i<n;i++)
		sum+=max(0ll,v[i]-c[i]);
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
int ans[530][530];
int N,k=1;
int line(int u,int v,int color){
  u%=k;v%=k;
  if(u>v)swap(u,v);
  if(ans[u][v])return -1;
  ans[u][v]=color;return 0;
}
void f(int s,int M,int d,int cnt){
  for(int j=1;j<=M/2;j+=2){
    for(int i=0;i<k;i+=d){
      if(j==M/2&&i==k/2)break;
      if(line(s+i,s+i+j*d,cnt)<0)return;
    }
  }
  if(M==2){
    line(s+d/2,s+3*d/2,cnt);
    return;
  }
  for(int i=0;i<2;i++)f(s+i*d,M/2,d*2,cnt+1);
}
//main
signed main(){
  cin>>N;
  while(k<N)k<<=1;
  f(0,k,1,1);
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++)cout<<ans[i][j]<<" ";cout<<endl;
  }
}


Measured memory_bytes: 2560
a, b = map(int,input().split())
count = 0

for i in range(a, b+1):
  digit1 = i % 10
  i = i // 10
  digit2 = i % 10
  i = i // 10
  digit3 = i % 10
  i = i // 10
  digit4 = i % 10
  i = i // 10
  digit5 = i % 10
  
  if digit1 == digit5 and digit2 == digit4:
    count +=1

print(count)
 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	if(a+b==15)
	{
		cout<<"+";
		return 0;
	}
	if(a*b==15)
	{
		cout<<"*";
		return 0;
	}
	cout<<"x";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back

using namespace std;
using ll=long long;
// using ll=int;

const ll mod = (ll)(1e9+7);

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

bool ispalin(string s){
    ll n = s.size();
    bool flag = 1;
    for(ll i = 0; i < n; i++){
        // cerr << s[i] << ' ' << s[n-i-1] << endl;
        if(s[i] == s[n-i-1]) flag = 1;
        else {flag = 0; break;};
    }
    if(flag) return 1;
    else return 0;
}

int main(){

    /*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("myoutput.txt", "w", stdout);
    #endif
    */

    fast;
    ll t = 1;
    // cin >> t;
    while(t--){
        string s; cin >> s;
        ll n = s.size();
        if(!ispalin(s)) {cout << "No" << endl; return 0;}
        string ss = s.substr(0, (n-1)/2);
        // cerr << ss << endl;
        if(!ispalin(ss)) {cout << "No" << endl; return 0;}
        string _s = s.substr((n+3)/2-1, n-(n+3/2));
        if(!ispalin(_s)) {cout << "No" << endl; return 0;}

        cout << "Yes" << endl;
        
    }
    // cerr << (double)clock()/CLOCKS_PER_SEC << endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

int main(){

    
    int a,b;
    cin>>a>>b;

    int sockets = 1;
    int cnt = 0;

    while(sockets < b) {
        cnt++;
        sockets = (a-1)*(cnt-1) + a;
    }

    cout<<cnt<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    #include<stdlib.h>
    using namespace std;
     
    int main(){
      long long n,a,b;
      cin>>n>>a>>b;
      if(a>b || (n==1 and a!=b)){
        cout<<0<<endl; return 0;
      }
      /*else if(n!=1 and a==b) {
        cout<<0<<endl; return 0;
      }
      */
      else cout<<a+b*(n-1)-a*(n-1)-b+1<<endl; return 0;
    }


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



const int MAX_C = 100;
long long Com[MAX_C][MAX_C];

void calc_com() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < MAX_C; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_C; ++j) {
            Com[i][j] = (Com[i-1][j-1] + Com[i-1][j]);
        }
    }
}


string str;

int main() {
    calc_com();
    while (cin >> str) {
        int res = 0;
        for (int i = 0; i < 10; ++i) res += (str[i] - '0') * Com[9][i];
        cout << res % 10 << endl;
    }
    return 0;
}


Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;

int main(){
    int n;
    string s;
    cin >> n >> s;
    string t = s.substr(0, n / 2);
    if (n % 2 == 0 && s == t + t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0 ;
}


Measured memory_bytes: 256
numbers = input()
string = str(numbers)
# print(string)
length = len(string)

lastNumber = int(string[length-1])
# print(lastNumber)
if lastNumber == 3:
    print('bon')
elif lastNumber == 0 or lastNumber == 1 or lastNumber == 6 or lastNumber == 8:
    print('pon')
else:
    print('hon')


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

class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        int N = sc.nextInt();
        int ans = (int)Math.pow(N, 3);
        System.out.println(ans);

    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21844