akhauriyash/Code-Regression huggingface dataset:
N,T=map(int,input().split())
c=[0]*N
t=[0]*N
for i in range(N):
  c[i],t[i]=map(int,input().split())
li=[]
for i in range(N):
  if t[i]<=T:
    li.append(c[i])
if len(li)==0:
  print('TLE')
else:
  print(min(li))

Measured memory_bytes: 3064
n = int(input())

"""親情報を入れる'p'、左の子を入れる'l'、右の子を入れる'r'の辞書を作成"""
p, l, r = {}, {}, {}

for i in range(n):
    num, left, right = input().split()
    l[num] = left
    r[num] = right
    if left != '-1':
        p[left] = num
    if right != '-1':
        p[right] = num

root = (set(l) - set(p)).pop()

def preorder(num):
    if num == '-1':
        return
    print(' ' + num, end='')
    preorder(l[num])
    preorder(r[num])

def inorder(num):
    if num == '-1':
        return
    inorder(l[num])
    print(' ' + num, end='')
    inorder(r[num])

def postorder(num):
    if num == '-1':
        return
    postorder(l[num])
    postorder(r[num])
    print(' ' + num, end='')

print('Preorder')
preorder(root)
print()
print('Inorder')
inorder(root)
print()
print('Postorder')
postorder(root)
print()


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
 
int main () {
    int n, q, l, r, ans = 0;
    string s;
    vector <int> nac;
	cin >> n >> q;
	cin >> s;
	nac.resize(n);
	for(int i = 1; i < n; i++) {
	    if (s[i] == 'C' && s[i - 1] == 'A') {
	        ans++;
	    }
	    nac[i] = ans;
	}
	while (q--) {
		cin >> l >> r;
		printf("%d\n", nac[r - 1] - nac[l - 1]);
	}
    return 0;
}

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

const double PI = 3.14159;

int main(){
	int n;
	cin >> n;
	int boss[n+1];
	memset(boss,0,sizeof(boss));
	for(int i =1;i<n;i++){
		int a;
		cin >> a;
		boss[a]++;
	}

	for(int i =1;i<=n;i++){
		cout << boss[i] << endl;
	}
}

Measured memory_bytes: 4404
#include<cstdio>

char s[300000];
int b[300000];
int w[300000];

int main(void) {
    int n;
    int m=300000;

    scanf("%d",&n);
    scanf("%s",s);

    w[0] = s[0] == '#';
    for(int i=0; i<n; i++)
        w[i+1] = w[i] + (s[i+1] == '#');

    for(int i=n-1; i>0; i--)
        b[i-1] = b[i] + (s[i] == '.');

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

    if(m > b[0]+(s[0]=='.')) m = b[0]+(s[0]=='.');

    printf("%d\n", m);
}


Measured memory_bytes: 1920
#カツサンドくんはオムライスが好きです。
#他にも明太子や寿司、クリームブリュレやテンダーロインステーキなどが好きで、これらの食べ物は全て、誰もが好きだと信じています。
#その仮説を証明するために、N 人の人に M 種類の食べ物について好きか嫌いかの調査を行いました。
#調査の結果、i 番目の人は Ai1 番目, Ai2 番目, ..., AiKi 番目の食べ物だけ好きだと答えました。N 人全ての人が好きだと答えた食べ物の種類数を求めてください。
N, M = map(int, input().split())

l = []

for i in range(N):
    A = [int(x) for x in input().split()] 
    
    for j in range(1, A[0] + 1):
        l.append(A[j])
        
ans = 0

for i in range(M + 1):
    if l.count(i) == N:
        ans += 1

print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007, mod998 = 998244353;

string w;
int alp[26];

int main() {
	cin >> w;
	for (int i = 0; i != w.size(); ++i) {
		++alp[w[i] - 'a'];
	}
	for (int i = 0; i != 26; ++i) {
		if (alp[i] % 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

int main(void){
  int N,M;
  cin>>N>>M;
  vector<int> s(M);
  vector<int> c(M);
  for(int i=0;i<M;i++){
    cin>>s[i]>>c[i];
  }
  for(int i=0;i<1000;i++){
    string x=to_string(i);
    bool flag=false;
    if(x.size()==N){
      flag=true;
      for(int j=0;j<M;j++){
        if(x[s[j]-1]!=c[j]+'0') flag=false;
      }
    }
    if(flag){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}


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

namespace AtCoder.Beginner162
{
    public class ABC162A
    {
        public static void Main(string[] args)
        {
            string N = Console.ReadLine();

            Console.WriteLine(N.Contains("7") ? "Yes" : "No");
        }
    }
}

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

bool check(vector<int> &v,int x)
{
    int n=v.size();
    int f=1;
    for(int i=0;i<n;i++)
    {
        // cout<<v[i]<<" "<<x<<endl;
        if(v[i]<x)f=0;
    }
    if(f==0) return false;
    return true;
}
int find(int table[100][100],int x,int n,int m,int t,vector<int> &v)
{
    if(t==n){
        if(check(v,x)) return 0;
        return 1000000007;
    }




    for(int i=1;i<=m;i++)
    {
        
        v[i-1]+=(table[t][i]);
    }
    int ans1= table[t][0]+find(table,x,n,m,t+1,v);
    for(int i=1;i<=m;i++)
    {
        
       v[i-1]-=(table[t][i]);
    }
    int ans2=find(table,x,n,m,t+1,v);
    // cout<<ans1<<" "<<ans2<<endl;
    return min(ans1,ans2);
}
int main()
{
    int n,m,x;
    cin>>n>>m>>x;
    int table[100][100];
    long long int sum=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            cin>>table[i][j];
        }
    }
    for(int i=0;i<n;i++) sum+=table[i][0];
vector<int> v;
    for(int i=0;i<m;i++) v.push_back(0);
    long long int ans=find(table,x,n,m,0,v);
    if(ans>sum) cout<<"-1";
    else cout<<ans<<endl;

}

Measured memory_bytes: 3652
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;

	private void mainrun() {
		scan = new Scanner(System.in);

		for(String s = scan.nextLine();!s.equals("0");s = scan.nextLine()){
			looprun(s);
		}
	}

	private void looprun(String s) {

		int Ans = 0;

		Set<String> history = new HashSet<String>();
		history.add(s);

		Set<String> step = new HashSet<String>();
		step.add(s);

		while(!step.isEmpty()) {
			Set<String> nstep = new HashSet<String>();

			for(String str : step) {
				String[] warm = str.split("");

				if(CheckColor(warm)) {
					System.out.println(Ans);
					return;
				}

				for(int i = 0;i < warm.length -1;i++) {
					if(!warm[i].equals(warm[i+1])) {
						String color = ChangeColor(warm[i],warm[i+1]);
						String[] cwarm = str.split("");
						cwarm[i] = cwarm[i+1] = color;

						String Cwarm = String.join("", cwarm);

						if(!history.contains(Cwarm)) {
							history.add(Cwarm);
							nstep.add(Cwarm);
						}
					}
				}
			}
			Ans++;
			step = nstep;
		}

		System.out.println("NA");
	}

	private String ChangeColor(String color1,String color2) {
		if(!color1.equals("r") && !color2.equals("r")) {
			return "r";
		}else if(!color1.equals("g") && !color2.equals("g")) {
			return "g";
		}else {
			return "b";
		}
	}

	Set<String> check = new HashSet<String>();

	private boolean CheckColor(String[] str) {
		check.clear();
		for(String S : str) { check.add(S); }
		return check.size() == 1;
	}
}


Measured memory_bytes: 300624
#include <iostream>
#include <vector>

int main()
{
  std::string s;
  std::cin >> s;
  if (s == "ABC")
  {
    std::cout << "ARC" << std::endl;
  }
  else
  {
    std::cout << "ABC" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 3596
def main():
    N, T = map(int, input().split())
    l = []
    for _ in range(N):
        a, b = map(int, input().split())
        l.append((a,b))
    l.sort(key=lambda x: x[0])
    m = [[0] * T for _ in range(N)]
    m[0] = [0 if t < l[0][0] else l[0][1] for t in range(T)]
    for i in range(1, N):
        t, v = l[i]
        for j in range(min(t, T)):
            m[i][j] = m[i-1][j]
        for j in range(t, T):
            m[i][j] = max(l[i][1] + m[i-1][j-t], m[i-1][j])
    return max(l[i][1] + m[i-1][-1] if i > 0 else l[i][1] for i in range(N))

print(main())


Measured memory_bytes: 117848
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(c >= a && c <= b){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define inf INT_MAX
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

lint dx[8] = { 0,1,1,1,0,-1,-1,-1 },
dy[8] = { 1,1,0,-1,-1,-1,0,1 };

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


#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

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

	vector<string> s;
	string in;
	lint a, b; cin >> a >> b;
	rep(i, a) {
		cin >> in;
		s.push_back(in);
	}
	vsort(s);
	rep(i, a)cout << s[i];
	gc();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
 
int main(void) {
    int n,d;
    cin >> n>>d;
    int a;
    bool p2[100000]={};
    rep(i,300)p2[i*i]=true;
    int x[n][d];
    int res=0;
    rep(i,n)rep(j,d)cin>>x[i][j];
    rep(i,n)for(int j=i+1;j<n;j++){
        a=0;
        rep(k,d){
            a+=abs(x[i][k]-x[j][k])*abs(x[i][k]-x[j][k]);
        }
        DEBUG{cout << a<< endl;}
        if (p2[a])res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
module Main where

import Control.Monad
import Control.Applicative
import Data.List

showingList :: [Int] -> String
showingList (x:[]) = show x
showingList (x:xs) = (show x) ++ " " ++ (showingList xs)

solve :: Int -> String
solve x
    | x == 3 = "bon"
    | x == 0 || x == 1 || x == 6 || x == 8 = "pon"
    | otherwise = "hon" 

main :: IO ()
main = do
    n <- readLn
    putStrLn $ solve (n `mod` 10)


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

int main(){
    int h, w;
    while( cin >> h >> w && !(h==0 && w==0) ){
        for (int i=0; i < h; ++i){
            cout << string(w, '#') << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3156
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;
using System.Numerics;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var nm = Reads();
            var n = Math.Min(nm[0],nm[1]);
            var m = Math.Max(nm[0],nm[1]);
            if (n == 1)
            {
                if (m == 1) WriteLine(1);
                else WriteLine(m - 2);
            }
            else WriteLine((n - 2) * (m - 2));



          
            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 18944
n, q = map(int, input().split(' '))

uf = list(range(n))
import sys
sys.setrecursionlimit(30000)
def find_root(x):
    global uf
    if uf[x] == x:
        return x
    else:
        uf[x] = find_root(uf[x])
        return uf[x]

for _ in range(q):
    c, x, y = map(int, input().split(' '))
    if c == 0:
        # unite
        uf[find_root(x)] = find_root(y)
    else:
        # same
        print(int(find_root(x) == find_root(y)))




Measured memory_bytes: 13120
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}




int main() {
	int n;
	cin >> n;
	vector<vector<int>> h(n);
	rep(i,n){
		int a, b, c;
		cin >> a >> b >> c;
		h[i] = {a, b, c};
	}
	vector<vector<ll>> dp(n, vector<ll>(3,0));
	rep(i,3){
		dp[0][i] = h[0][i];
	}
	
	rep(i, n-1)
	{
		rep(j,3){
			rep(k,3){
				if(j==k)
					continue;
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + h[i + 1][j]);
			}
		}
	}
	ll ans = 0;
	rep(i, 3)
	{
		ans = max(ans, dp[n - 1][i]);
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
    string s;
    cin>>s;
    ll ans=0;
    int n=s.size();
    s+='E';
    vector<int> v;
    for(int i=0;i<n;i++){
        while(s[i]=='A'||(s[i]=='B'&&s[i+1]=='C')){
            if(s[i]=='A'){
                v.push_back(0);
                i++;
            }else{
                v.push_back(1);
                i+=2;
            }
        }
        int cnt=0;//bc
        for(int j:v){
            if(j)cnt++;
        }
        for(int j=0;j<cnt;j++){
            if(v[j]==0)ans+=cnt-j;
        }
        for(int j=cnt;j<v.size();j++){
            if(v[j]==1)ans+=j-cnt;
        }
        v.clear();
    }
    cout<<ans<<endl;
}


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

#define print(x) cout << #x << '=' << x << endl


int main()
{
	int n,f=1;
	string s;
	cin >> n >> s;

	if(n%2!=0)
		cout << "No" << endl;
	else{
		int mid=n/2;
		for( int i=0 ; i<mid ; i++ )
		{
			if(s[i]!=s[mid+i])
				f = 0;
		}
		if(f)
			cout << "Yes" << endl;
		else
		cout << "No" << endl;
	}

	return 0;
}


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

int min(int a, int b) {
    if (a < b) {
        return a;
    }
    return b;
}

int main(int argc, char const *argv[])
{
    int n, k;
    scanf("%d %d", &n, &k);

    int dist = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        scanf("%d", &x);
        dist += min(x, abs(k-x)) * 2;
    }
    printf("%d\n", dist);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
	cin>>n;
	cout<<a[n-1];
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    int n,m;cin>>n>>m;
    int ans=0;
    ans+=n*(n-1)/2+m*(m-1)/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long 
#define mp make_pair
#define pb push_back
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)  ((a)*((b)/gcd(a,b)))
#define pi 3.14159265358979323846
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	reus;
	
//	#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//	#endif
	
	double a,b,c;
	cin>>a>>b>>c;
	if(a/c<=b)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}

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

int main(){
    ll T,X;
    cin>>T>>X;
    cout<<double (T)/X<<endl;
}

Measured memory_bytes: 256
/* Sriram S. Nair */
/* MNNIT Allahabad */

#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
#define mod 1000000007
char grid[1005][1005];
long long dp[1005][1005];
int h, w;
long long solve(int i, int j){
	if(i==h && j==w)
		return 1;
	if(i>h || j>w)
		return 0;
	if(grid[i][j]=='#')
		return 0;
	if(dp[i][j]!=-1)
		return dp[i][j];
	long long ans=0;
	ans += solve(i+1, j);
	ans%=mod;
	ans += solve(i, j+1);
	ans%=mod;
	return dp[i][j] = ans;
}
int main(){
	fast
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>grid[i][j];
		}
	}
	memset(dp, -1, sizeof(dp));
	cout<<solve(1, 1);
	return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

double p;

double E(int d){
    if(d % 2 == 1) return 1 + p*E(d-1) + (1-p)*E(d+1);
    else return 1/p * d/2;
}

int main(){
    int x, t;
    scanf("%d%d", &x, &t);
    p = 1.0*t / 100;
    printf("%.20lf\n", E(x));
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

int prime[101];


void deposite(int num){
    _for(i,2,100){
        while(num%i == 0){
            prime[i]++;
            num/=i;
        }
    }
}


int main()
{
    int N;cin >> N;
    _rep(i,2,N){
        deposite(i);
    }
    int ans = 0;
    _for(i,0,100){
        _for(j,i+1,100){
            if(prime[i] >= 4 && prime[j] >= 4){
                _for(k,0,100){
                    if(k != i && k != j && prime[k] >= 2){
                        ans++;
                    }
                }
            }
        }
    }

    _for(i,0,100){
        _for(j,0,100){
            if(i!=j && prime[i]>=24 && prime[j] >=2 ) ans++;
            if(i!=j && prime[i]>=14 && prime[j] >=4 ) ans++;
        }
    }

    _for(i,0,100){
        if(prime[i] >= 74) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<math.h>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(),(x).end()

using namespace std;

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


template<typename T>
void dump(T *arr, int h, int w){
	rep(i,h){
		rep(j,w) cout << arr[i][j] << "\t";
		cout << "\n";
	}
}

template<typename T>
void dump(T *arr, int a){
	rep(i,a) cout << arr[i] << "\t";
	cout << "\n";
}

template<typename T>
void dump(vector<T> arr, int a){
	rep(i,a) cout << arr[i] << "\t";
	cout << "\n";
}

const int INF = 1e9;
const int MOD = 1e9+7;

bool compare(P a, P b){
	if(a.second != b.second) return a.second > b.second;
	else	return a.first > b.first;
}


int digits(ll num){
	ll d=0;
	while(num >= 1){
		num/= 10;
		d++;
	}
	return d;
}

ll pow_kai(ll a, int n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

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

	ll n;
	cin >> n;
	
	int n_keta=0;
	int tmp=n;
	while(tmp >= 1){
		tmp/=10;
		n_keta++;
	}

	ll c[9][9] = {};
	repi(i, 1, 10){
		repi(j, 1, 10){
			if(i==j && i<=n) c[i-1][j-1] += 1; //1けた作れる
			repi(t, 2, n_keta){ //nより桁数が少ないやつ
				c[i-1][j-1] += pow(10, t-2);
			}

			//nと桁数が同じ
			if(n_keta==2){
				if(j*10 + i <= n) c[i-1][j-1]+=1;
			}else if(n_keta > 2){ //間に挟む
				int x = (n - j*pow(10, n_keta-1) - i);
				if (x<0) continue;
				x /= 10;
	//			cout << "x : " << x << "\n";
				if(x == 0){
					c[i-1][j-1]++;
					continue;
				} 

				int x_keta=0;
				tmp = x;
				while(tmp >= 1){
					tmp /= 10;
					x_keta++;
				}
				if(x_keta <= n_keta-2) c[i-1][j-1] += x+1;
				else if(x_keta > n_keta-2) c[i-1][j-1] += pow(10, n_keta-2);
			}
		}
	}
	ll ans=0;
	rep(i,9){
		rep(j,9){
			ans += c[i][j] * c[j][i];
		}
	}
	cout << ans << "\n";
		
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		double pi = Math.PI;
		Scanner sc = new Scanner(System.in);
		int a =sc.nextInt();
		
		double ans= a*2*pi;
		
		System.out.print(ans);
	}

}

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

int main(){
    int A[3];
    for(int i = 0; i < 3;i++){
        cin >> A[i];
    }
    sort(A, A + 3);
    cout << A[2] * 10 + A[1] + A[0] << endl;
    return 0;
}

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

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

	vector<int> L;
	for (int i = 0; i < N; i++) {
		int l;
		cin >> l;
		L.push_back(l);
	}

	sort(L.begin(), L.end());
	reverse(L.begin(), L.end());

	int total = 0;
	for (int i = 0; i < K; i++) {
		total += L[i];
	}

	cout << total << endl;
}






Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int ans=0,mx=0;
	cin>>s;
	for(int i=0;i<3;i++){
		if(s[i]=='S'){
			mx=max(mx,ans);
			ans=0;
		}
		else ans++;
	}
	cout<<max(mx,ans)<<endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define in insert
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)
    cin>>a[i];
    ll dp[n]={0};
    dp[0]=0,dp[1]=abs(a[0]-a[1]);
    for(ll i=2;i<n;i++)
    {
        ll x=0;dp[i]=INT_MAX;
        for(ll j=i-1;j>=0&&x<k;j--,x++)
        {
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 5064
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  int A{}, B{}, C{}; cin >> A >> B >> C;
  auto res = C >= A;
  res &= C <= B;
  
  cout << (res ? "Yes" : "No") << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 55) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int N;
  cin >> N;
  vector< int64 > A(N);
  cin >> A;

  vector< int > pre(N), nxt(N);
  priority_queue< pair< int64, int > > que;
  for(int i = 0; i < N; i++) {
    pre[i] = i - 1;
    nxt[i] = i + 1;
    que.emplace(A[i], i);
  }

  int64 ret = 0;
  for(int t = 1; t <= N / 2; t++) {
    while(que.size() && A[que.top().second] != que.top().first) {
      que.pop();
    }
    auto top = que.top();
    que.pop();
    ret += top.first;
    A[top.second] *= -1;
    bool ok = true;
    if(pre[top.second] >= 0) {
      ok = true;
      A[top.second] += A[pre[top.second]];
      A[pre[top.second]] = -infll;
      pre[top.second] = pre[pre[top.second]];
      if(pre[top.second] >= 0) nxt[pre[top.second]] = top.second;
    } else {
      ok = false;
    }
    if(nxt[top.second] < N) {
      A[top.second] += A[nxt[top.second]];
      A[nxt[top.second]] = -infll;
      nxt[top.second] = nxt[nxt[top.second]];
      if(nxt[top.second] < N) pre[nxt[top.second]] = top.second;
    } else {
      ok = false;
    }
    if(ok) que.emplace(A[top.second], top.second);
    else A[top.second] = -infll;
  }
  cout << ret << endl;
}


Measured memory_bytes: 10560
N, M = map(int, input().split())

s = [0] * M
c = [0] * M

for i in range(M):
    s[i], c[i] = map(int, input().split())

# print(10 ** N)
if N == 1:
    for i in range(10):
        tmp = 0
        x = str(i)
        for j in range(M):
            if x[s[j] - 1] == str(c[j]):
                tmp += 1
        if tmp == M:
            print(i)
            break
    else:
        print(-1)

else:
    for i in range(10**(N-1), 10**N  ):
        tmp = 0
        x = str(i)
        for j in range( M ):
            if x[(s[j] - 1)] == str(c[j]):
                tmp += 1
        if tmp == M:
            print(i)
            break
    else:
        print(-1)


Measured memory_bytes: 3064
#!/usr/bin/ruby
Z=10**9+7
def d(x,y) x.zip(y).reduce(0){|s,(a,b)|s+a*b} end
def mul(x,y)
	y=y.transpose
	[[d(x[0],y[0])%Z,d(x[0],y[1])%Z],[d(x[1],y[0])%Z,d(x[1],y[1])%Z]]
end
def pow(x,y)
	z=1
	while y>0
		z=z*x%Z if y%2>0
		x=x*x%Z
		y/=2
	end
	z
end
H,W,K=gets.split.map(&:to_i)
K-=1
M=$<.map{|e|e.chomp.chars}
c=M.count{|s|s[0]=='#'&&s[-1]=='#'}
d=M.transpose.count{|s|s[0]=='#'&&s[-1]=='#'}
if c>0&&d>0
	p 1
	exit
end
if d>0
	c,d=d,c
	M=M.transpose
H,W=W,H
end
a=b=0
M.each{|s|W.times{|i|
	a+=1 if s[i]=='#'
	b+=1 if i<W-1&&s[i]=='#'&&s[i+1]=='#'
}}
if c==0&&d==0
	p pow(a,K)
	exit
end
 
e=[[1,0],[0,1]]
m=[[a,-b],[0,c]]
k=K
while k>0
	e=mul(e,m) if k%2>0
	m=mul(m,m)
	k/=2
end
p (e[0][0]+e[0][1])%Z

Measured memory_bytes: 97148
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll INF=1e18;

int main(){
    ll n;
    cin >> n;
    vector<vector<ll>> a(n,vector<ll>(n)),used(n,vector<ll>(n));
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    bool good=true;
    rep(k,n){
        rep(i,n){
            if(i==k) continue;
            rep(j,n){
                if(j==k) continue;
                if(a[i][k]+a[k][j]<a[i][j]) good=false;
                if(a[i][k]+a[k][j]==a[i][j]) used[i][j]=1;
            }
        }
    }
    ll ans=0;
    rep(i,n){
        rep(j,n){
            if(used[i][j]) continue;
            ans+=a[i][j];
        }
    }
    ans/=2;
    if(good==false){
        cout << -1 << endl;
    }
    else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 5056
sent = list(input())

q = int(input())

for i in range(q):
  order = input().split()
  a = int(order[1])
  b = int(order[2])

  if order[0] == "print":
    output = [0 for j in range(b-a+1)]
    for j in range(b-a+1):
      output[j] = sent[a+j]
    print("".join(output))

  elif order[0] == "reverse":
    rev = [0 for j in range(b-a+1)]
    for k in range(b-a+1):
      rev[k] = sent[b-k]

    for l in range(b-a+1):
      sent[a+l] = rev[l]

  else:
    p = order[3]
    for j in range(b-a+1):
      sent[a+j] = p[j]


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

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion



int main() {
	string s; put s;
	int havc = 0;
	int havf = 0;
	int ci = 0;
	int fi = 0;
	rep(i, s.size()) {
		if (s[i] == 'C') {
			havc++;
			ci = i + 1;
			break;
		}
	}
	rep(i, s.size()) {
		if (s[i] == 'F') {
			havf++;
			fi = i + 1;
		}
	}
	putans((( (havc > 0 && havf > 0) && (  ci < fi )) ? "Yes" : "No" ));
END: 
	return 0;
}



//
//vi v;
//vi w; ;
//ll nz1() {
//	return 0;
//}
//
//ll nz2() {
//	ll dp[201][1000*200+1];
//
//}
//
//ll nz3() {
//
//}
//	int n, wkazu; put n >> wkazu;
//	v.resize(200); 
//	w.resize(200);
//	rep(i, n) {
//		put v[i] >> w[i];
//	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 100005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int N,K;
int A[MAXN],B[MAXN];
int64 ans;
int lowbit(int x) {
	return x & (-x);
}
void Calc(int v) {
	int64 res = 0;
	for(int i = 1 ; i <= N ; ++i) {
		if((v & A[i]) == A[i]) res += B[i];
	}
	ans = max(ans,res);
}
void Solve() {
	read(N);read(K);
	for(int i = 1 ; i <= N ; ++i) {
		read(A[i]);read(B[i]);
	}
	Calc(K);
	while(K) {
		int t = lowbit(K);
		int h = K - 1;
		K -= t;
		Calc(h);
	}
	out(ans);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N, K; cin >> N >> K;
    vector<int> x(N), y(N);
    vector<int> xarray, yarray;

    for(int i=0; i<N; i++){
        cin >> x[i] >> y[i];
        xarray.push_back(x[i]);
        yarray.push_back(y[i]);
    }

    sort(xarray.begin(), xarray.end());
    sort(yarray.begin(), yarray.end());

    ll ans = 1LL<<62;

    for(int xi=0; xi<N; xi++){
        for(int xj=xi+1; xj<N; xj++){
            for(int yi=0; yi<N; yi++){
                for(int yj=yi+1; yj<N; yj++){

                    int num = 0;
                    ll lx = xarray[xi];
                    ll rx = xarray[xj];
                    ll by = yarray[yi];
                    ll uy = yarray[yj];

                    for(int i=0; i<N; i++){
                        if(lx <= x[i] && x[i] <= rx && by <= y[i] && y[i] <= uy) num++;
                    }

                    if(num >= K) ans = min(ans, (rx - lx)*(uy - by));
                }
            }
        }
    }

    cout << ans << endl;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left!=NIL) x=x->left;

  return x;

}
Node treeMaximum(Node x){

  while(x->right!=NIL) x=x->right;

  return x;

}

Node treeSearch(Node u, int k){

  if(u==NIL||k==u->key)
    return u;
  if(k<u->key)
    return treeSearch(u->left,k);
  else
    return treeSearch(u->right,k);

}

Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL) return treeMinimum(x->right);//case 1                       

  y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;//case 2                                                             

}
void treeDelete(Node z){
  Node y; // node to be deleted                                                 
  Node x; // child of y                                                         

  if(z->left==NIL||z->right==NIL) y=z;
  else y=treeSuccessor(z);

  if(y->left!=NIL) x=y->left;
  else x=y->right;

  if(x!=NIL) x->parent=y->parent;
  if(y->parent==NIL)
    y=x;
  else if(y==y->parent->left)
    y->parent->left=x;
  else
    y->parent->right=x;

  if(y!=z)
    z->key=y->key;
}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key)
      x=x->left;
    else
      x=x->right;
  }
  z->parent=y;

  if(y==NIL)//Tree is empty                                                     
    root=z;
  else if(z->key<y->key)
    y->left=z;
  else
    y->right=z;

}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
  
}
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}



Measured memory_bytes: 25236
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let n: usize = sc.next();
    let mut v = sc.vec::<u32>(n);
    v.reverse();

    for (&x, i) in v.iter().zip(0..n) {
        print!("{}{}", x, if i == n - 1 { '\n' } else { ' ' });
    }
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }
}



Measured memory_bytes: 5040
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int a,b;

int main(){
	cin>>a>>b;
	if(a+b>=10) cout<<"error"<<endl;
	else cout<<a+b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC159C()
{
	ll L;
	cin >> L;
	double x = (double)L / 3.0;
	cout << std::fixed << std::setprecision(15) << x * x * x << endl;
}

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


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();

    let mut v = line.split_whitespace().map(|d| d.parse::<i32>().unwrap()).collect::<Vec<_>>();
    v.reverse();

    let (last, elements) = v.split_last().unwrap();
    for a in elements {
        print!("{} ", a);
    }
    println!("{}", last);
}



Measured memory_bytes: 5040
N,K,Q = map(int,input().split())
A = {}
for i in range(1,N+1):
    A[i] = 0
for i in range(Q):
    item = int(input())
    A[item] += 1
for i in range(N):
    if Q - A[i+1] >= K:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 19296
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#define N 20100
#define M 50010
#define rg register
using namespace std;
typedef long long ll;
typedef double db;
int n,m,tot=0;
int dis[N],head[N],vis[N];
int nxt[M],to[M],w[M],c[M];
void link(int x,int y,int z,int v){
	nxt[tot]=head[x],to[tot]=y,w[tot]=z,c[tot]=v,head[x]=tot++;
}
void spfa(){
	queue <int> q;
	memset(dis,0x3f,sizeof(dis));
	memset(vis,0,sizeof(vis));
	q.push(1),dis[1]=0,vis[1]=1;
	while (!q.empty()){
		int x=q.front();q.pop();
		for (int i=head[x];i!=-1;i=nxt[i]){
			int v=to[i];
			if (dis[v]<=dis[x]+w[i]) continue;
			dis[v]=dis[x]+w[i];
			if (!vis[v]) vis[v]=1,q.push(v);
		}
		vis[x]=0;
	}
}
int main(){
//	freopen ("2249.in","r",stdin);
//	freopen ("2249.out","w",stdout);
	while (scanf ("%d%d",&n,&m)&&(n||m)){
		memset(head,-1,sizeof(head));
		tot=0;int x,y,z,v;
		for (int i=1;i<=m;++i){
			scanf ("%d%d%d%d",&x,&y,&z,&v);
			link(x,y,z,v),link(y,x,z,v);
		}
		spfa();
		int ans=0;
		for (int i=2;i<=n;++i){
			int mx=2000;
			for (int j=head[i];j!=-1;j=nxt[j]){
				v=to[j];
				if (dis[i]==dis[v]+w[j]) mx=min(mx,c[j]);
			}
			ans+=mx;
		}
		printf ("%d\n",ans);
	
	}
	return 0;
}

Measured memory_bytes: 4104
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define se second
#define fi first
#define rep(i, l, r) for (ll i = (ll)(l); i < (ll)(r); i++)
#define print(v) for (const auto itr : v){cout << itr << ' ';} cout << endl;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define inf 1e18
using namespace std;
const ll INF = 1e18L + 5;
const ll maxn = 1e5+5, maxn1=202;
ll ceel(ll a, ll b)
{
   if (a % b == 0)
       return a / b;
   return a / b + 1;
}
ll modneg(ll a,ll m)
{
    a = a % m;
    if(a<0)
        a=a+m;
    return a;
}
ll powermod(ll x, unsigned ll y, ll p){ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); };
ll csb(ll n){ ll count = 0;while (n){ count += n & 1; n >>= 1; } return count;}


int main()
{

ll test,n,k,i,j,a,b,m,c,d;
string s;
cin>>s;
if(s[2]==s[3] and s[4]==s[5])
    cout<<"Yes\n";
else
{
    cout<<"No\n";
}

return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int A,B,C;
	std::cin >> A;
	std::cin >> B;
	std::cin >> C;

	int ans;

	if (A + B > C - 1) {
		ans = B + C;
	}
	else if (A + B == C) {
		ans = B + C;
	}
	else if (A + B < C) {
		ans = B + (A + B + 1);
	}

	std::cout << ans;
}

Measured memory_bytes: 256
N = int(input())
monsters = list(map(int, input().split()))

monsters.sort()  # 昇順
minnum = monsters[0]

cnt = len(monsters)
minidx = 0
while cnt > 1:
    for i in range(cnt - 1, 0, -1):
        monsters[i] = monsters[i] % monsters[0]

        if monsters[i] == 0:
            del monsters[i]

        elif monsters[i] == 1:
            print('1')
            quit()

    workmin = min(monsters)
    minidx = monsters.index(min(monsters))
    monsters[minidx] = monsters[0]
    monsters[0] = workmin

    cnt = len(monsters)

print(monsters[0])

Measured memory_bytes: 14252
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int d = a/b;
		
		int r=a-b*d;
		double f=1.0 * a/b;
		
		System.out.println(d+" "+r+" "+(String.format("%.8f", f)));
	}

}



Measured memory_bytes: 26444
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;
const ll inf = 1000000000000000000;
const ll mod = 1000000007;

ll n, ans = 1, p = 1, p2 = 1;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (ll i = 1; i <= n; ++i) {
        ans = (ans * 10) % mod;
    }
    for (ll i = 1; i <= n; ++i)
        p = (p * 8) % mod;
    for (ll i = 1; i <= n; ++i)
        p2 = (p2 * 9) % mod;
    ans = (ans - 2 * p2 + p + 8 * mod) % mod;
    cout << ans;
    return 0;
}


Measured memory_bytes: 3620