akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
 int i, c;
 printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

 if(T[u].p==NIL) printf("root, ");
 else if(T[u].l==NIL) printf("leaf, ");
 else printf("internal node, ");

 printf("[");
 for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
   if(i) printf(", ");
   printf("%d", c);
 }
 printf("]\n");

}

void calcDepth(int u, int p){
 D[u] = p;
 if(T[u].r!=NIL) calcDepth(T[u].r,p);
 if(T[u].l!=NIL) calcDepth(T[u].l,p+1);
}

int main(){
 int i, j, k;
 int n;
 int id, sib, child;
 int root = NIL;
 scanf("%d", &n);
 for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;

 for(i=0; i<n; i++){
   scanf("%d %d", &id, &k);
   for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
     scanf("%d", &child);
     T[child].p = id;
     if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
     else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
     sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
   }
 }

 //根を求める (find the root)
 for(i=0; i<n; i++){
   if(T[i].p == -1) root = i;
 }

 //それぞれのノードの深さを求める (find depth of each node)
 calcDepth(root, 0);

 //出力 (output)
 for(i=0; i<n; i++) print(i);

 return 0;
}


Measured memory_bytes: 6380
#include<stdio.h>
int main()
{
int i,n,b=0,f=0;
scanf("%d",&n);
long int a[n];
for(i=0;i<n;i++)
scanf("%ld",&a[i]);
while(1)
{
for(i=0;i<n;i++)
{
if (a[i]%2!=0)
{
f=1;
break;
}
a[i]=a[i]/2;
}
if (f==1)
break;
b=b+1;
}
printf("%d",b);
return 0;
}

Measured memory_bytes: 128
ret = []
while True:
   n, x = map(int, raw_input().split())
   num_arr = [i for i in range(1, n+1)]
   if (n, x) == (0, 0):
       break

   cnt = 0
   for i in range(len(num_arr)):
       for j in range(i + 1, len(num_arr)):
           k_flg = False
           for k in range(j + 1, len(num_arr)):
               work = num_arr[i] + num_arr[j] + num_arr[k]
               if x == work:
                   cnt += 1
                   k_flg = True
                   break
   ret += [cnt]
for i in ret:
    print i

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

using namespace std;




int a[200005];
string b[200005];
int tr, n, cur;
string s[200005], t;
int main() {
	cur = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	sort(s, s + n);
	long long ma = 0, cur = 0;
	for (int i = 0; i < n; i++) {
		if (i == 0 || s[i] == s[i - 1]) {
			cur++;
		}
		else {
			cur = 1;
		}
		if (cur > ma) ma = cur;
	}
	cur = 0;
	for (int i = 0; i < n; i++) {
		if (i == 0 || s[i] == s[i - 1]) {
			cur++;
		}
		else {
			cur = 1;
		}
		if (cur == ma) cout << s[i] << endl;
	}
	return 0;
}

/*
string s;
int main() {
	cin >> s;
	long long a = s.size(), b = 0;
	for(int i = 0; i < a; i++) {
		if ((s[i] - '0') <= 5) {
			b += (s[i] - '0');
		}
		else {
			b += (11 + '0' - s[i]);
		}
	}
	cout << b;
	return 0;
}
*/

Measured memory_bytes: 15872
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

int n;
vector<int> a;
vector<int> b;

int main() {
	cin >> n;
	a.resize(n);
	b.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[a[i]]++;
	}
	if (n % 2 == 0) {
		for (int i = 0; i < n; i++) {
			if (b[i] != 2) {
				if (i % 2 == 1) {
					cout << "0" << endl;
					return 0;
				}
			}
			else {
				if (i % 2 == 0) {
					cout << "0" << endl;
					return 0;
				}
			}
		}
	}
	else {
		for (int i = 0; i < n; i++) {
			if (i == 0 && b[i] == 1) {
				continue;
			}
			if (b[i] != 2) {
				if (i % 2 == 0) {
					cout << "0" << endl;
					return 0;
				}
			}
			else {
				if (i % 2 == 1) {
					cout << "0" << endl;
					return 0;
				}
			}
		}
	}
	Counting c(n, 1000000007);
	cout << c.power(2, n / 2) << endl;
//	cin >> n;

	return 0;
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

//constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	vector<vector<int>>v(N,vector<int>(3));
	for(auto &i:v)for(auto &j:i)cin>>j;
	vector<int>ans(N);
	for(int i=0;i<N;i++){
		for(int j=0;j<3;j++){
			int num=0;
			for(int k=0;k<N;k++)num+=v[i][j]==v[k][j];
			if(num==1)ans[i]+=v[i][j];
		}
	}
	for(auto i:ans)cout<<i<<endl;
	return 0;
}


Measured memory_bytes: 3156
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=(ll)1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll H;
    cin >> H;
    ll W;
    cin >> W;
    if(H==1||W==1)prt(1);
    else if(H*W%2==0)prt(H*W/2);
    else prt(H*W/2+1);
    return 0;
}



Measured memory_bytes: 3636
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut a: [i64; n],
    }
    let mut sgn = vec![-1, 1];
    let mut v = vec![];

    for mut sign in sgn {
        let mut cnt = 0;
        let mut sum = 0;
        for i in 0..n {
            sum += a[i];
            if sum * sign <= 0 {
                cnt += (sum - sign).abs();
                sum = sign;
            }
            sign *= -1;
        }
        v.push(cnt);
    }

    println!("{}", min(v[0], v[1]));
}


Measured memory_bytes: 4352
N,L = map(int, input().split())

ans = 0
jogai = 500
fugo = 0
for i in range(1, N+1):
    aji = L+i-1
    ans += aji
    if aji < 0:
        if -aji < jogai:
            jogai = -aji
            fugo = -1
    else:
        if aji < jogai:
            jogai = aji
            fugo = 1

print(ans-fugo*jogai)

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

namespace AtCoder.Contests.ABC169
{
    /// <summary>
    /// 
    /// </summary>
    static class D
    {
        static void Main(string[] args)
        {
            var n = NextLong();

            var count = 0;

            var f = Math.Floor(Math.Sqrt((double)n));

            for (int i = 2; i <= f+1; i++)
            {
                if (n % i != 0)
                {
                    continue;
                }

                var p = i;
                while (n % p == 0)
                {
                    count++;
                    n = n / p;
                    p *= i;
                }

                while (n % i == 0)
                {
                    n = n / i;
                }
            }

            if (n > 1)
            {
                count++;
            }

            Console.WriteLine(count);
        }

        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


Measured memory_bytes: 27540
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{

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

  if (a == b && b == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
int scmpr(const void* a,const void* b){return strcmp(*(char**)b,*(char**)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

int main(){
  LL A,B,C,i,ans=0;
  scanf("%lld%lld%lld",&A,&B,&C);
  if((A==B&&B==C)||(A!=B&&B!=C&&C!=A))YN(0);
  else YN(1);

  //printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int T = Integer.parseInt(br.readLine());
        for(int t=0;t<T;t++){
        	String[] line = br.readLine().split(" ");
        	int machine = Integer.parseInt(line[0]) - 1;
        	int firstCookie = Integer.parseInt(line[1]);
        	// one of the best way is to continue making 127-yum cookie?
        	if(machine%2==0) System.out.println(firstCookie + 127*machine);
        	else System.out.println((127-firstCookie) + 127*machine);
        }
    }
}

Measured memory_bytes: 10064
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long int
#define mod 1000000007
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
main()
{
	int n;
	cin>>n;
	int a[n+5];
	for(int i=1;i<=n;i++)cin>>a[i];
	int sum=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			sum+=(a[i]*a[j]);
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
const int N = 50;
ll C[N+1][N+1];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    for(int n = 0; n <= N; n++) {
        for(int k = 0; k <= n; k++) {
            C[n][k] = k == 0 or k == n ? 1 : C[n-1][k-1] + C[n-1][k];
        }
    }
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    cin >> v;
    sort(v.begin(), v.end(), greater<ll>());
    ld max_mean = accumulate(v.begin(), v.begin() + a, 0.0l) / a;
    cout << fixed << setprecision(6) << max_mean << endl;
    ll ways = 0;
    for(int k = a; k <= b; k++) {
        if(accumulate(v.begin(), v.begin() + k, 0.0l) / k == max_mean) {
            ways += C[count(v.begin(), v.end(), v[k - 1])][count(v.begin(), v.begin() + k, v[k - 1])];
        }
    }
    cout << ways << endl;
    return 0;
}

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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define vec vector
#define countSetBits(x) __builtin_popcountll(x)
#define trailingz(x) __builtinctzll(x)
#define leadingz(x) __builtinclzll(x)
#define maxbit(x) __lg(x)
#define minbit(x) __builtin_ffs(x) //lsb index+1
#define debug(args...) cerr << "["#args"] = ["; dbg,args; cerr << "]" << endl;
struct debugger {
    template<typename T> debugger& operator , (const T& v) {    
        cerr<<v<<" ";    
        return *this;
    }
} dbg;
//debug(n, x, s, c);

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll i,j,k,n,m,mx,mn,flag,sum=0;
    cin>>n;
    ll a[n],h[n];
    for(i=0;i<n;i++)
        cin>>h[i];
    a[0]=0;
    a[1]=abs(h[0]-h[1]);
    for(i=2;i<n;i++)
    {
        j=abs(h[i]-h[i-2])+a[i-2];
        k=abs(h[i]-h[i-1])+a[i-1];
        a[i]=min(j,k);
    }
    cout<<a[n-1];

    return 0;
       
}

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

int main() {
  int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
  string S; cin >> S;
  bool can = true;
  for (int i = A-1; i < max(C, D)-1; i++) {
    if (S.at(i) == '#' && S.at(i+1) == '#') can = false;
  }
  if (C > D) {
    bool flag = false;
    for (int i = B-1; i < min(C, D); i++) {
      if (S.at(i-1) == '.' && S.at(i) == '.' && S.at(i+1) == '.') flag = true;
    }
    if (!flag) can = false;
  }
  if (can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		Scanner1 sc = new Scanner1();
		
		int  n=sc.nextInt(), x=sc.nextInt(), t=sc.nextInt();
		System.out.println((n+x-1)/x*t);
	}

	static final Random random = new Random();

	static void ruffleSort(int[] a) {
		int n = a.length;//shuffle, then sort 
		for (int i = 0; i < n; i++) {
			int oi = random.nextInt(n), temp = a[oi];
			a[oi] = a[i];
			a[i] = temp;
		}
		Arrays.sort(a);
	}

	static class Scanner1 {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}

Measured memory_bytes: 32740
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
}Node;

Node *root;
Node *NIL;



void insert(int k){

  Node *x, *y, *z;
  z = (Node *)malloc(sizeof(Node));
  
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  y = NIL;
  x = root;
  
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
    z->parent = y;
  }
  
  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else{
    y->right = z;
  }
  
}

void inorderTreewwalk( Node *x ){
  if(x != NIL){
    inorderTreewwalk( x->left );
    printf(" %d", x->key);
    inorderTreewwalk( x->right );
  }
}

int PreParse( Node *u ){
  if(u == NIL){
    return 0;
  }
  printf(" %d",u->key);
  PreParse(u->left);
  PreParse(u->right);
}

Node * iterativeTreeSearch(Node *x, int k){
  while(x != NIL && k != x->key){
    if(k < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  return x;
}

int main(){
  char meirei[50];
  int m,i,a,k,b;

  scanf("%d", &m);

  for(i = 0; i < m; i++){
    scanf("%s", meirei);
    if(strcmp(meirei, "insert") == 0){
      scanf("%d",&k);
      insert(k);
    }else if(strcmp(meirei, "print") == 0){
      inorderTreewwalk( root );
      printf("\n");
  
      a = PreParse( root );
      printf("\n");
    }else if(strcmp(meirei, "find") == 0){
      scanf("%d",&k);
      b = iterativeTreeSearch(root, k);
      if(b == NIL){
	printf("no\n");
      }
      else{
	printf("yes\n");
      }
      
    }
  }

  return 0;
}

Measured memory_bytes: 19360
#include<stdio.h>

int main ()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(c>=a && c<=b){
        printf("Yes");
    }
    else if(a==b==c){
        printf("Yes");
    }
    else{
        printf("No");
    }


    return 0;
}

Measured memory_bytes: 128
/**
 * File    : D2.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-8-6 21:43:08
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
const ll M = 1000000007;

string S;
int N;
ll DP[100010][4];

void calc(int i, char x)
{
  int l = x - 'A';
  for (auto k = 0; k <= 3; k++)
  {
    DP[i][k] += DP[i - 1][k];
    DP[i][k] %= M;
  }
  DP[i][l + 1] += DP[i - 1][l];
  DP[i][l + 1] %= M;
}

void calc(int i)
{
  char x = S[i - 1];
  if (x == '?')
  {
    calc(i, 'A');
    calc(i, 'B');
    calc(i, 'C');
  }
  else
  {
    calc(i, x);
  }
}

int main()
{
  cin >> S;
  N = S.size();
  fill(&DP[0][0], &DP[0][0] + 100010 * 4, 0);
  DP[0][0] = 1;
  for (auto i = 1; i <= N; i++)
  {
    calc(i);
  }
  cout << DP[N][3] << endl;
}

Measured memory_bytes: 3584
S = str(input())
pri = ["YYMM","MMYY","AMBIGUOUS","NA"]
nt = ["01","10","11","00"]
Sz = S[0]+S[1]
Sa = S[2]+S[3]
flag = ""
Sz = int(Sz)
Sa = int(Sa)
if Sz > 0 and Sz <= 12:
 flag += "1"
else:
 flag += "0"
if Sa > 0 and Sa <= 12:
 flag += "1"
else:
 flag += "0"
print (pri[nt.index(flag)])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
int n,k,a[20];
signed main(){
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	int ans=INF;
	rep(i,((ll)1<<n)){
		int count=0;
		rep(j,n){
			if((i>>j)&1)count++;
		}
		if(count!=k)continue;
		int cnt=0,now=-1,ma=0;
		rep(j,n){
			if((i>>j)&1){
				if(now!=-1){
					cnt+=max((ll)0,now+1-a[j]);
					now=max(now+1,a[j]);
				}
				else now=a[j];
			}
			now=max(now,a[j]);
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	ggr;
}

Measured memory_bytes: 256
/*
	0031:Weight
*/
#include	<iostream>
#include	<cmath>

using namespace std;

int main(void) {
	while(1) {
		int w;
		int bundo[2][10] = { 0 };
		
		cin >> w;
		if( cin.eof() ) { break; }
		
		for(int i = 0; i < 10; i++) {
			bundo[0][i] = pow(2, i);
		}
		
		for(int i = 0; i < 10; i++) {
			if(w >= bundo[0][9 - i]) {
				w -= bundo[0][9 - i];
				bundo[1][9 - i] = 1;
			}
		}
		
		for(int i = 0; i < 9; i++) {
			if(bundo[1][i] == 1) {
				cout << bundo[0][i];
				for(int j = i + 1; j < 10; j++) {
					if(bundo[1][j] == 1) {
						cout << ' ';
						break;
					}
				}
			}
		}
		if(bundo[1][9] == 1) {
			cout << bundo[0][9];
		}
		cout << endl;
	}
	return 0;
}

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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    string S;
    cin >> S;
    cout << (S == "ARC" ? "ABC" : "ARC") << endl;
    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#define white 0
#define grey 1
#define black -1
using namespace std;

int a[110][110],n;
int color[110];
int t;
int ts[110],te[110];
int nt[110];

void dfsinit()
{
    for(int i=1;i<=n;i++)
        {
            color[i]=white;
            nt[i]=1;
        }
}

int next(int i)
{
    for(int j=nt[i];j<=n;j++)
    {
        nt[i]=j+1;
        if(a[i][j]) return j;
    }
    return -1;
}

void dfsvisit(int u)
{
    for(int i=1;i<=n;i++)
        nt[i]=1;
    stack<int>s;
    s.push(u);
    ts[u]=++t;
    color[u]=grey;
    while(!s.empty())
    {
       int r=s.top();
       int v=next(r);
       if(v!=-1)
       {
          if(color[v]==white)
          {
              color[v]=grey;
              ts[v]=++t;
              s.push(v);
          }
       }
       else
       {
           color[r]=black;
           te[r]=++t;
           s.pop();
       }
    }
}

void dfs()
{
    dfsinit();

    for(int i=1;i<=n;i++)
    {
        if(color[i]==white)
        {
            dfsvisit(i);
        }
    }
}

int main()
{
   int key,d,x;
   t=0;
   memset(a,0,sizeof(a));
   scanf("%d",&n);
   for(int i=1;i<=n;i++)
   {
       scanf("%d%d",&key,&d);
       for(int j=1;j<=d;j++)
       {
        scanf("%d",&x);
        a[key][x]=1;
       }
   }

   dfs();
   for(int i=1;i<=n;i++)
   {
       printf("%d %d %d\n",i,ts[i],te[i]);
   }
   return 0;
}

Measured memory_bytes: 3276
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
 size_t strlen(const char *s);
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=100010;
const int P=1000000007;
int compare_int(const void *a, const void *b)
{
    return *(long long int*)a - *(long long int*)b;//a-b昇順
}
//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ
//	cout<<(n-2)*180<<endl;
//	string s="hoge";
//	cout<<ans<<endl;
//	int  n  ,a  ,b  ,c  ,d  ,e  ,f  ;
//	cin  >>n  >>a  >>b  >>c  >>d  >>e  >>f  ;

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	len = strlen(s);
文字列長さ*/


/*
	string s;
	s.size()
*/


/*ソート
	qsort(b, 10, sizeof(int), compare_int);
*/


/*
	char s[N];
	strlen(s)
/*
	if(  <  )puts("YES");
	else puts("NO");
*/
/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/

int main(){
	char s[10];
	char a[]="Sunny";
	char b[]="Cloudy";
	char c[]="Rainy";
//	memset(s, '\0', sizeof(s));
	cin>>s;
//	puts(a);
//	puts(s);

	if(s[0]==a[0])puts(b);
	if(s[0]==b[0])puts(c);
	if(s[0]==c[0])puts(a);
}
/*int main()
{
    char str1[] = "Kyoto";
    char str2[] = "Sangyo";
	char str3[22] "aaa";
	if(1){
	 str3 = "University";
	}
    printf("%s %s %s\n", str1, str2, str3);
    return 0;
}*/

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define all(x) x.begin(), v.end()
#define rall(x) x.rbegin(), x.rend()
#define PB push_back
#define F first
#define S second

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

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

	int n; cin >> n;
	vi v(n);
	for(auto& p: v) cin >> p;

	sort(all(v));
	v.erase(unique(all(v)), v.end());

	if(n == (int) v.size())
		cout << "YES\n";
	else
		cout << "NO\n";

	return 0;
}


Measured memory_bytes: 1024
void main()
{
    long n = rdElem;
    long[] b = rdRow;

    long[] lists = new long[n];
    long idx = n;
    foreach (i; 0 .. n)
    {
        foreach_reverse (j; 0 .. idx)
        {
            if (j + 1 == b[j])
            {
                --idx;
                lists[idx] = b[j];
                b = b[0..j] ~ b[j+1..$];
                break;
            }

            if (j == 0)
            {
                writeln(-1);
                return;
            }
        }
    }

    foreach (x; lists)
    {
        x.writeln;
    }
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 380
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons, std.math;

void main() {
  ulong N = readln.chomp.to!ulong;
  ulong res = ulong.max;

  ulong m = 1 + cast(ulong)ceil(sqrt(cast(double)N));
  foreach(i; 1..m) {
    if(N % i == 0) {
      ulong j = N / i;
      res = min(res, i+j-2);
    }
  }
  res.writeln;
}


Measured memory_bytes: 256
from itertools import combinations

h, w, K = list(map(int, input().split()))
H = [i for i in range(h)]
W = [i for i in range(w)]
grid = [list(input()) for _ in range(h)]
ans = 0
for i in range(h+1):
    for hv in combinations(H, i):
        for j in range(w+1):
            for wv in combinations(W, j):
                cnt = 0
                for k in hv:
                    for l in wv:
                        if grid[k][l] == "#":
                            cnt += 1
                if cnt == K:
                    ans += 1
print(ans)


Measured memory_bytes: 9124
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int n, r;
	cin >> n >> r;
	int i;
	if (n >= 10)i = r;
	else i = r + 100 * (10 - n);
	cout << i;*/


	int n, k;
	cin >> n >> k;
	int ans = 0;
	while (n > 0) {
		n /= k;
		ans++;
	}
	cout << ans;
	return 0;
}

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

int main(){
	int a[10];
	for(int i=0;i<10;i++) cin>>a[i];
	sort(a,a+10);
	cout<<a[9]<<endl<<a[8]<<endl<<a[7]<<endl;
	return 0;
}

Measured memory_bytes: 3156
#include <cstring>
#include <cstdint>
#include <iostream>
#include <string>
#include <memory>
#include <queue>
#include <limits>
#include <list>
#include <set>
#include <utility>
#include <sstream>
#include <random>
#include <functional>
#include<algorithm>
using namespace std;

int main() {
	string S;
	cin >> S;
	for (size_t i = 0; i < S.size() - 8; i++)
	{
		cout << S[i];
	}

	return 0;
}

Measured memory_bytes: 256
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    a = list(map(int, input().split()))
    tmp = 0
    for j in range(m):
        tmp += a[j] * b[j]
    ans += 1 if tmp > -c else 0

print(ans)


Measured memory_bytes: 3060
from collections import Counter
n,m = map(int,input().split())
h = list(map(int,input().split()))
judge = [0]*n
t = [0]*n
for _ in range(m):
    a,b = map(int,input().split())
    t[a-1] = max(t[a-1],max(h[a-1],h[b-1]))
    t[b-1] = max(t[b-1],max(h[a-1],h[b-1]))
    if h[a-1] == h[b-1]:
        judge[a-1] = 1
        judge[b-1] = 1

ans = 0
for i in range(n):
    if t[i] <= h[i] and judge[i] == 0:
        ans += 1
        
print(ans)

Measured memory_bytes: 20524
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
int MOD;

bool DEBUG = 0;
const int MAXN = 200005;

ll add(ll a,ll b)
{
	a+=b; a%=MOD;
	if(a<0) a+=MOD;
	return a;
}
ll mult(ll a, ll b)
{
	if(a>MOD) a%=MOD;
	if(b>MOD) b%=MOD;
	ll ans=(a*b)%MOD;
	if(ans<0) ans+=MOD;
	return ans;
}
ll pw(ll a, ll b)
{
	ll r=1;
	while(b){
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}

int n;
string s;
ll dp[MAXN];

ll dfs(int i){
	if(dp[i]!=-1) return dp[i];
	
	return (dp[i]=dfs(i%__builtin_popcount(i))+1);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n>>s;
	
	mset(dp,-1);
	dp[0]=0;
	
	for(int i=2e5;i>=0;i--){
		if(dp[i]==-1) dfs(i);
	}
	
	int tot=0;
	forn(i,0,n){
		if(s[i]=='1') tot++;
	}
	
	ll val[3]{};
	for(int i=tot-1;i<=tot+1;i++){
		MOD=i;
		if(i<=0) continue;
		forn(j,0,n){
			if(s[j]=='1') val[i-(tot-1)]=add(val[i-(tot-1)], pw(2,(n-1-j)));
		}
	}
	
	for(int i=0;i<n;i++){
		if(s[i]=='0'){
			MOD=tot+1;
			cout<<dp[add(val[2], pw(2,(n-1-i)))]+1<<'\n';
		}
		else{
			MOD=tot-1;
			if(MOD==0) cout<<0<<'\n';
			else cout<<dp[add(val[0],-pw(2,(n-1-i)))]+1<<'\n';
		}
	}
	
	return 0;
}


Measured memory_bytes: 5328
#include <algorithm>   
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 100000;
const int MOD = 998244353;
const ll BASE = 1000000000000000000LL;
void inc(int &a, int b) { if ((a += b) >= MOD) a -= MOD; }

struct G {
	int n;
	vector<int> adj[MAXN];
	int level[MAXN];
	int seenby[MAXN];

	void init(int _n) { n = _n; REP(i, n) adj[i].clear(); }
	void calc() {
		REP(i, n) seenby[i] = -1;
		for (int at = n - 1; at >= 0; --at) {
			REPSZ(i, adj[at]) {
				int to = adj[at][i]; if (to <= at) continue;
				seenby[level[to]] = at;
			}
			level[at] = 0; while (seenby[level[at]] == at) ++level[at];
		}
		//printf("level:"); REP(i, n) printf(" %d", level[i]); puts("");
	}
};


int n;
G g[3];
int basepw[MAXN + 1];

int solve() {
	REP(i, 3) g[i].calc();
	int mxlevel = 0; REP(i, 3) REP(j, n) mxlevel = max(mxlevel, g[i].level[j]);
	int mxbit = 0; while (mxlevel >= (2 << mxbit)) ++mxbit;
	vector<int> ways(2 << mxbit, 0);
	inc(ways[0], 1);
	basepw[0] = 1; basepw[1] = BASE%MOD; FORE(i, 2, n) basepw[i] = (ll)basepw[i - 1] * basepw[1] % MOD;
	REP(i, 3) {
		vector<int> nways(2 << mxbit, 0);
		vector<int> sum(mxlevel + 1, 0); REP(j, n) inc(sum[g[i].level[j]], basepw[j + 1]);
		REPSZ(a, ways) REPSZ(b, sum) nways[a^b] = (nways[a^b] + (ll)ways[a] * sum[b]) % MOD;
		ways = nways;
	}
	return ways[0];
}

void run() {
	scanf("%d", &n);
	REP(i, 3) {
		int m; scanf("%d", &m);
		g[i].init(n);
		REP(j, m) { int a, b; scanf("%d%d", &a, &b); --a, --b; g[i].adj[a].PB(b); g[i].adj[b].PB(a); }
	}
	printf("%d\n", solve());
}


int main() {
	run();
	return 0;
}


Measured memory_bytes: 18432
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)

using namespace std;
typedef long long int ll;
typedef pair<int,int> PI;

int N, M;
int a[100001];
int dp[100001];
int main(void){
    cin >> N >> M;
    int t;
    REP(i,M){
        scanf("%d",&t);
        a[t] = 1;
    }
    
    dp[0] = 1;
    if(a[1]==0) dp[1]=1;
    for(int i=2;i<=N;i++){
        if(a[i] == 0) dp[i] = dp[i-1]+dp[i-2];
        dp[i] %= 1000000007;
    }
    cout << dp[N] << endl;

    return 0;
}



Measured memory_bytes: 1024
import java.util.*;

public class Main {
public static void main(String[] args){

Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans = 0;
if(n % 2 == 0){
ans = n * n / 4;
}else{
ans = (n + 1) * (n - 1) /4;
}
System.out.println(ans);


}
}

Measured memory_bytes: 23764
def recClr(v,d,c):
#    print "recClr",v,d,c
    if visited[v-1] >= d:
        return
    else:
        visited[v-1]=d
    if clr[v-1]==0:
        clr[v-1]=c
    if d>0:
        if v in ab:
            for b in ab[v]:
                recClr(b,d-1,c)


N,M=map(int,raw_input().split())
ab={}
for i in xrange(M):
    a,b=map(int,raw_input().split())
    if a in ab:
        ab[a].append(b)
    else:
        ab[a]=[b]
    if b in ab:
        ab[b].append(a)
    else:
        ab[b]=[a]
#print ab


clr=[0]*N
visited=[-1]*N

Q=input()
op=[]
for i in xrange(Q):
    v,d,c=map(int,raw_input().split())
    op.append((v,d,c))
op.reverse()
for v,d,c in op:
    recClr(v,d,c)
#print clr   

for i in clr:
    print i

Measured memory_bytes: 39364
#include <bits/stdc++.h>
using namespace std;
int  huru(string x,int d1,int d2,int d3,int d4,int d5,int d6){
	int a,b;
	for(int i = 0;i<x.size();i++){
		if(x.at(i) == 'E'){
			a = d3;
			d3 = d1;
			d1 = d4;
			d4 = d6;
			d6 = a;
		}
		if(x.at(i) == 'S'){
			a = d2;
			d2 = d1;
			d1 = d5;
			d5 = d6; 
			d6 = a;
		}
		if(x.at(i) == 'W'){
			a = d4;
			d4 = d1;
			d1 = d3;
			d3 = d6;
			d6 = a;
		}
		if(x.at(i) == 'N'){
			a = d5;
			d5 = d1;
			b = d6;
			d6 = a;
			a = d2;
			d2 = b;
			d1  =  a;
		}
		a = 0;
	}
		return d1;
	}
int main(){
	int s1,s2,s3,s4,s5,s6;
	cin>>s1>>s2>>s3>>s4>>s5>>s6;
	string x;
	cin>>x;
	
	cout<<huru(x,s1,s2,s3,s4,s5,s6)<<endl;
	return 0;
}


Measured memory_bytes: 3192
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
//#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ull gcd(ull a,ull b){return b?gcd(b,a%b):a;}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

struct edge{int to ,cost;};
typedef pair<int,int> P;
int V;
vector<edge> G[100005];
ll d[100005];

void di(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d,d+V,linf);
    d[s] = 0;
    que.push(P(0,s));
    
    while(!que.empty()){
        P p = que.top();que.pop();
        int v = p.sd;
        if(d[v] < p.ft)continue;
        rep(i,0,sz(G[v])){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                 d[e.to]=d[v] + e.cost;
                 que.push(P(d[e.to],e.to));
            }
        }
    }
}
int main(){
    int n,Q,K;
    cin >> n;
    V = n+1;
    rep(i,0,n-1){
        int a,b,c;
        cin >> a >> b >>c;
        edge e;
        e.to = b;
        e.cost = c;
        G[a].pb(e);

        e.to = a;
        e.cost = c;
        G[b].pb(e);
    }

    cin >> Q >> K;
    di(K);

    rep(i,0,Q){
        int x,y;
        cin >> x >> y;

        cout << d[x] + d[y] << endl;
    }
}

Measured memory_bytes: 8820
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int dp[110][3][2];
int num[110];

signed main(){
	int n,k;
	cin>>n>>k;
	memset(num,-1,sizeof(num));
	rep(i,0,k){
		int a,b;
		cin>>a>>b;
		a--; b--;
		num[a]=b;
	}
	if(num[0]==-1) rep(i,0,3) dp[0][i][0]=1;
	else dp[0][num[0]][0]=1;

	rep(i,1,n){
		rep(j,0,3){
			if(!(num[i]==-1||num[i]==j)) continue;
			dp[i][j][1]=(dp[i][j][1]+dp[i-1][j][0])%10000;
			rep(k,0,3){
				if(j==k) continue;
				dp[i][j][0]=(dp[i][j][0]+dp[i-1][k][0]+dp[i-1][k][1])%10000;
			}
		}
	}
	int ans=0;
	rep(i,0,3) rep(j,0,2) ans+=dp[n-1][i][j];
	o(ans%10000);
}

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

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

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	string s;
	cin >> s;

	int front = 0;
	while(s[front] != 'A') front++;
	reverse(all(s));
	int back = 0;
	while(s[back] != 'Z') back++;
	int ans = s.length() - front - back;

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

Measured memory_bytes: 720
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {

	string S;

	cin >> S;

	int max = 0;
	int current = 0;

	for (int i = 0; i < 3; i++) {
		if (S.at(i) == 'R') {
			current++;
		}
		else {
			if (current > max) {
				max = current;
				current = 0;
			}
		}
	}

	if (current > max) {
		max = current;
	}

	cout << max << endl;
}

Measured memory_bytes: 3624