akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<double,int> Pdi;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
priority_queue<Pdi,vector<Pdi>,greater<Pdi>> que;
vector<Pli> v[18];
P2 xy[MAX_N]={};
ll dp[1<<18]={};
string str[100000];
int main() {
	int n;
	string str[101];
	bool ans=true;
	cin>>n>>str[0];
	for(int i=1;i<n;++i){
		cin>>str[i];
		if(str[i-1][str[i-1].size()-1]!=str[i][0])ans=false;
	}
	sort(str,str+n);
	for(int i=1;i<n;++i){
		if(str[i-1]==str[i])ans=false;
	}
	if(!ans)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}


Measured memory_bytes: 1024
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, k: usize,
        rsp: [i64; 3],
        t: chars,
    }
    let mut tot = 0;
    for rem in 0..k {
        let len = (n + k - 1 - rem) / k;
        let mut dp = vec![vec![0; 3]; len + 1];
        for i in 0..len {
            let pos = match t[i * k + rem] {
                'r' => 2,
                's' => 0,
                'p' => 1,
                _ => unreachable!(),
            };
            for j in 0..3 {
                for l in 0..3 {
                    if l == j { continue; }
                    let score = if j == pos { rsp[pos] } else { 0 };
                    dp[i + 1][j] = max(dp[i + 1][j], dp[i][l] + score);
                }
            }
        }
        let &ma = dp[len].iter().max().unwrap();
        tot += ma;
    }
    puts!("{}\n", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> c,p;

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

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

	ll n,i,m,j,k,x,y,a,b,t,d,K;
	string s;
	
	cin >> n >> k;
	c.pb(0);
	p.pb(0);
	for(i=0;i<n;i++)
	{
		cin >> x;
		p.pb(x);
	}
	for(i=0;i<n;i++)
	{
		cin >> x;
		c.pb(x);
	}
	m=-1000000000000000000;
	K=k;
	for(i=1;i<=n;i++)
	{
		k=K;
		ll m1=-1000000000000000000;
		ll cur=i;
		ll sm=0;
		for(j=0;j<k;j++)
		{
			cur=p[cur];
			sm+=c[cur];
			m1=max(m1,sm);
			if(cur==i)
				break;
		}
//		cout << "m1 " << m1 << endl;
		m=max(m,m1);
		if(sm<=0)
			continue;
		if(j<k)
		{
			ll freq=k/(j+1);
			if(freq>1)
				freq--;
			sm=sm*freq;
			m=max(m,sm);
			k=k-(j+1)*freq;
			m1=-1000000000000000000;
			cur=i;
//			cout << j << endl;
			for(j=0;j<k;j++)
			{
				cur=p[cur];
				sm+=c[cur];
				m1=max(m1,sm);
			}
			m=max(m,m1);
		}
	}
	cout << m;
	return 0;
}


Measured memory_bytes: 3772
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int n,m;

vector<bool>seend;  //探索済み頂点配列
void dfs(const vector<vector<int> >&g, int v){
    seend[v]=true;
    rep(nextv, g[v].size()){
	if(seend[g[v][nextv]])continue;
	dfs(g, g[v][nextv]);
    }
}

void init(vector<vector<int> >&g){
    rep(i, g.size()){
	g[i].clear();
    }
}

int main(){
    cin >> n >> m;
    vector<vector<int> >g(n);
    vector<vector<int> >tmpg(m, vector<int>(2));
    rep(i, m)cin >> tmpg[i][0] >> tmpg[i][1];
    //solve
    int ans = 0;
    //グラフ作成
    for(int i = 0; i < m; i++){//辺を一つ取り除いたグラフ
	init(g);
	for(int j = 0; j < m; j++){
	    if(j == i)continue;
	    g[tmpg[j][0]-1].push_back(tmpg[j][1]-1);
	    g[tmpg[j][1]-1].push_back(tmpg[j][0]-1);
	}
	bool dittached = false;
	seend.assign(n, false);
	dfs(g, 0);
	rep(i, n){
	    if(!seend[i])dittached=true;
	}
	if(dittached)ans++;
    }
    cout << ans << endl;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define rof_(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//

int N, A[200005];
lint sum[200005];

struct Divide { lint P, Q; };

lint lftEval(int x, int L) { return sum[x] - sum[L]; }
lint rgtEval(int x, int R) { return sum[R] - sum[x]; }
lint eval(int x, int L, int R) { return abs(lftEval(x, L) - rgtEval(x, R)); }

Divide getDivide(int L, int R) {
	//cerr << L << " " << R << endl;
	int lb = L+1, ub = R;
	while (ub - lb > 2)  {
		int lft = lb + (ub - lb) / 3;
		int rgt = lb + (ub - lb) * 2 / 3;
		//cerr << lft << " " << rgt << endl;
		if (eval(lft, L, R) < eval(rgt, L, R)) ub = rgt;
		else lb = lft;
	}
	
	if (eval(lb, L, R) < eval(lb+1, L, R)) {
		//cerr << lb << " " << lftEval(lb, L) << " " << rgtEval(lb, R) << endl;
		return Divide{sum[lb] - sum[L], sum[R] - sum[lb]};
	}
	//cerr << lb+1 << " " << lftEval(lb+1, L) << " " << rgtEval(lb+1, R) << endl;
	return Divide{sum[lb+1] - sum[L], sum[R] - sum[lb+1]};
}

void solve() {
	sum[0] = 0;
	for_(i,0,N) sum[i+1] += A[i] + sum[i];
	
	lint ans = 1L << 60;
	for_(c,1,N-1) {
		//cerr << "#" << c << endl;
		Divide div_x = getDivide(0, c+1), div_y = getDivide(c+1, N);
		set< lint > div = {div_x.P, div_x.Q, div_y.P, div_y.Q};
		minUpdate(ans, abs(*div.begin() - *div.rbegin()));
	}
	cout << ans << endl;
}

int main() {
	cin >> N;
	for_(i,0,N) cin >> A[i];
	solve();
}
//--------------8---------------->> coding space <<-----------------8-------------//


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int N,M;
int main()
{
	cin>>N>>M;
	if (M==1)
	{
		printf("1\n");
		return 0;
	}
	if (N==1)
	{
		printf("1\n");
		return 0;
	}
	long long Ans=0;
	int v1,v2;
	if (M&1)
	{
		v1=M/2+1;
		v2=M/2;
	}
	else
	{
		v1=v2=M/2;
	}
	if (N&1)
	{
		Ans=1LL*(N/2)*(v1+v2)+v1;
	}
	else
	{
		Ans=1LL*(N/2)*(v1+v2);
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int n; cin >> n;
	deque<int> a;
	for (int i = 0; i < n; ++i) {
		int ta; cin >> ta;
		if (i % 2 == (n - 1) % 2) {
			a.push_front(ta);
		} else {
			a.push_back(ta);
		}
	}
	for (int i = 0; i < a.size(); ++i) {
		cout << a[i] << endl;
	}
	return;
}
int main() {
	solve();
	return 0;
}

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

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
int inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int y, x;
vector<string> dat;

//inputします
void input() {
    cin >> y >> x;
    dat.resize(y);
    ff(i, 0, y) {
        cin >> dat[i];
    }
}

//ライブラリ置き場

int L[2050][2050];
int R[2050][2050];
int U[2050][2050];
int D[2050][2050];

//main
int main() {
    input();
    ff(i, 0, y) {
        int pre = 1;
        ff(j, 0, x) {
            if (dat[i][j] == '#') {
                L[i][j] = 0;
                pre = 1;
                continue;
            }
            L[i][j] = pre;
            pre++;
        }
    }
    ff(i, 0, y) {
        int pre = 1;
        ffrvs(j, x-1, 0) {
            if (dat[i][j] == '#') {
                R[i][j] = 0;
                pre = 1;
                continue;
            }
            R[i][j] = pre;
            pre++;
        }
    }
    ff(j, 0, x) {
        int pre = 1;
        ff(i, 0, y) {
            if (dat[i][j] == '#') {
                U[i][j] = 0;
                pre = 1;
                continue;
            }
            U[i][j] = pre;
            pre++;
        }
    }
    ff(j, 0, x) {
        int pre = 1;
        ff(i, 0, y) {
            if (dat[i][j] == '#') {
                U[i][j] = 0;
                pre = 1;
                continue;
            }
            U[i][j] = pre;
            pre++;
        }
    }
    ff(j, 0, x) {
        int pre = 1;
        ffrvs(i, y-1, 0) {
            if (dat[i][j] == '#') {
                D[i][j] = 0;
                pre = 1;
                continue;
            }
            D[i][j] = pre;
            pre++;
        }
    }
    int ans = 0;
    ff(i, 0, y) {
        ff(j, 0, x) {
            int pa = U[i][j] + D[i][j] + R[i][j] + L[i][j] - 3;
            ans = max(ans, pa);
        }
    }
    cout << ans << endl;
	return 0; 
}

Measured memory_bytes: 69888
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

	int count = 0;
	for (;;) {
		if (count % 2 == 0) {
			C -= B;
		}
		else {
			A -= D;
		}
		count++;

		if (A <= 0) {
			cout << "No" << endl;
			break;
		}
		if (C <= 0) {
			cout << "Yes" << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3132
#include<iostream>
using namespace std;
int main(){
    int n,m,a[100][100]={},x;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>x;
            a[i][j]=x;
        }
    }
    int y,b[100]={},z=0;
    for(int j=0;j<m;j++){
        cin>>y;
        b[j]=y;
    }
    for(int i=0;i<n;i++){
        z=0;
        for(int j=0;j<m;j++){
            z+=a[i][j]*b[j];
        }
        cout<<z<<endl;
    }
    return 0;
}



Measured memory_bytes: 3136
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var (
	writer  *bufio.Writer
	scanner *bufio.Scanner
)

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func sstring() string {
	scanner.Scan()
	return scanner.Text()
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	h := sint64()
	w := sint64()
	k := sint64()
	grid := make([][]byte, h)
	for i := range grid {
		grid[i] = []byte(sstring())
	}
	ans := int64(0)
	for maskR := 0; maskR < 1<<h; maskR++ {
		for maskC := 0; maskC < 1<<w; maskC++ {
			currCount := int64(0)
			for i := int64(0); i < h; i++ {
				rp := (maskR & (1<<i)) != 0
				for j := int64(0); j < w; j++ {
					cp := (maskC & (1<<j)) != 0
					if !rp && !cp && grid[i][j] == '#' {
						currCount++
					}
				}
			}
			if currCount == k {
				ans++
			}
		}
	}
	printf("%d\n", ans)
}


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

int main() {
  int N, A ;
  cin >> N >> A;
  int B = N - (N / 500 * 500) ;
  if (A >= B)
  cout << "Yes" << endl;
  else if (A < B)
  cout << "No"<< endl;
}

Measured memory_bytes: 3620
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  cin >> n >> m;
  vi H(100005, 0);
  vi HH(100005, 1);
  FOR(i, 0, n) {
    cin >> H[i];
    // cout << H[i] << endl;
  }
  FOR(i, 0, m) {
    int a, b;
    cin >> a >> b;
    if (H[a - 1] > H[b - 1]) {
      HH[b - 1] = 0;
    } else if (H[a - 1] < H[b - 1]) {
      HH[a - 1] = 0;
    } else {
      HH[a - 1] = 0;
      HH[b - 1] = 0;
    }
  }
  int ans = 0;
  FOR(i, 0, n) {
    if (HH[i] == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 3988
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 	
 	ll l;
 	cin >> l;
 	double length=(double)l/3;
 	double width=((double)l-length)/2;
 	double height=((double)l-length-width);
 	cout << fixed << setprecision(6) << length*width*height << "\n";
    return 0;
}



Measured memory_bytes: 256
S = gets.chomp

is_easy = true
S.length.times do |i|
  if i.odd?
    if S[i] == 'R'
      is_easy = false
      break
    end
  end

  if i.even?
    if S[i] == 'L'
      is_easy = false
      break
    end
  end
end

puts is_easy ? 'Yes' : 'No'

Measured memory_bytes: 1788
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
typedef uint_fast16_t fint16;
typedef uint_fast32_t fint32;
typedef uint_fast64_t fint64;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define exists(x,m) m.find(x) != m.end()
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

struct SegTree {
	const int n;
	vi T;

	SegTree(int size):n(size) {
		T = vi(4*n+1, 0);
	} 

	void update(int index, int val, int v, int tl, int tr) {
		if (tl == tr) {
			T[v] = val;
		} else {
			int mid = (tl + tr)/2;
			if (index <= mid) {
				update(index, val, 2*v, tl, mid);
			} else {
				update(index, val, 2*v+1, mid+1, tr);
			}	
			T[v] = max(T[2*v], T[2*v+1]);	
		}
	}

	void update(int index, int val) {
		update(index, val, 1, 0, n-1);
	}

	int get_max(int l, int r, int v, int tl, int tr) {
		if (l > tr or r < tl) return 0;
		if (l <= tl and tr <= r) return T[v];
		int mid = (tl + tr)/2;
		int L = get_max(l, r, 2*v, tl, mid);
		int R = get_max(l, r, 2*v+1, mid+1, tr);
		return max(L, R);
	}

	int get_max(int l, int r) {
		return get_max(l, r, 1, 0, n-1);
	}

};


int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int ans = 0;
	int n, k; cin >> n >> k;
	int maxx = 0;
	vi A = vi(n);
	rep(i, n) {
		int x; cin >> x;
		A[i] = x;
		maxx = max(maxx, x);
	}
	SegTree st = SegTree(maxx+1);
	rep(i, n) {
		int x = A[i];
		int top = min(x + k, maxx);
		int bot = max(0, x-k);
		int prev_max = st.get_max(bot, top);
		ans = max(ans, 1 + prev_max);
		st.update(x, 1 + prev_max);
	}
	cout << ans;
}

Measured memory_bytes: 8980
import java.util.*;

public class Main{

    public static void main(String args[]){

        Scanner scan = new Scanner(System.in);
        Integer a = scan.nextInt();
        Integer b = scan.nextInt();
        Integer x = scan.nextInt();

        if((x >= a) && (b >= x-a))
            System.out.println("YES");
        else
        System.out.println("NO");
    }

    static int factorial(int n){
        if(n == 0){
          return 1;
        }
        return n * factorial(n-1);
      }
}

Measured memory_bytes: 23380
from collections import *

def dfs(now):
    global ans
    
    if len(now)==N:
        ans_cand = 0
        
        for a, b, c, d in abcd:
            if now[b-1]-now[a-1]==c:
                ans_cand += d
        
        ans = max(ans, ans_cand)
        return
    
    last = now[-1]
    
    for i in range(last, M+1):
        now.append(i)
        dfs(now)
        now.pop()

N, M, Q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(Q)]
ans = 0

for i in range(1, M+1):
    dfs(deque([i]))

print(ans)

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

int main() {
    long long N, A, B;
    cin >> N >> A >> B;
    if ((B - A) % 2 == 0) {
        cout << (B - A) / 2 << endl;
        return 0;
    } else {
        cout << min(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<map>
#include<set>
using namespace std;
int n,a[105];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	    cin>>a[i];
	for(int i=0;i<n;i++)
	{
		cout<<a[i];
		if(i!=n-1)
		    cout<<' ';
	}	   
	cout<<endl; 
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<i;j++)
	        if(a[i]<a[j])
	        {
	        	int v=a[i];
	        	for(int l=i;l>j;l--)
	        	    a[l]=a[l-1];
	        	a[j]=v;
	        	break;
			}
		for(int j=0;j<n;j++)
		{
			printf("%d",a[j]);
			if(j!=n-1)
			    printf(" ");
		}
		cout<<endl;
	}	    
	return 0;
}


Measured memory_bytes: 3148
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
l=[0]*9
for a in A:
    if a>=3200:
        l[8]+=1
    else:
        l[int(a//400)]=1

sl=sum(l)-l[8]
print(max(sl,1),(sl+l[8]))


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int N;
	cin >> N;
	vector<int> a(N);
	rep(i, N) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	double ans = (a[0] + a[1])/2.0;
	for(int i=2; i<=N-1; i++) {
		ans = (ans + a[i]) / 2.0;
	}
	cout << fixed << setprecision(15) << ans << endl;
	

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if((a<=b&&b<=a+w)||(a<=b+w&&b<=a))cout<<"0"<<endl;
  else{
    if(b+w<a)cout<<a-b-w<<endl;
    else cout<<b-a-w<<endl;
  }
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll n,d;cin>>n>>d;
  ll x[n][d];
  for(i=0;i<n;i++){
    for(j=0;j<d;j++){
      cin>>x[i][j];
    }
  }
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      buf=0;
      for(o=0;o<d;o++){
        buf+=(x[i][o]-x[j][o])*(x[i][o]-x[j][o]);
      }
      if((ll)sqrt(buf)*(ll)sqrt(buf)==buf)res++;
      //cout<<buf spa res<<endl;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,T;
struct kkk{
	int c,t;
} a[101];
int minn=2147483647;
int main(){
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a[i].c>>a[i].t;
		if(a[i].t<=T)
			minn=min(minn,a[i].c);
	}
	if(minn!=2147483647)
		cout<<minn<<endl;
	else
		cout<<"TLE"<<endl;
}

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

using namespace std;

# define ll long long
# define pll pair<ll,ll>
# define F first
# define S second
# define pb push_back
# define ld long double
ll mod=1000000007;
ll func1(vector<vector<ll>>&dp,vector<vector<ll>>&v,int k,int a)
{
    if(a<0)
    return 0;
    if(dp[k][a]!=-1)
    return dp[k][a];
    if(k>=v[a][0])
    return dp[k][a]=max(func1(dp,v,k-v[a][0],a-1)+v[a][1],func1(dp,v,k,a-1));
    else
    return dp[k][a]=func1(dp,v,k,a-1);
}

int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        ll t=1;
        //cin>>t;
        while(t--)
        {
            ll n,i,j,k=0,W;
            cin>>n>>W;
            vector<vector<ll>>v(n,vector<ll>(2));
           for(i=0;i<n;i++)
           cin>>v[i][0]>>v[i][1];
           vector<vector<ll>>dp(W+1,vector<ll>(n,-1));
           cout<<func1(dp,v,W,n-1);
           
          
            
        }
        
    }

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

int main(){
	ll a,b;
	cin>>a>>b;

	ll sum=abs(a)+abs(b);
	if(sum%2==0){
		cout<<sum/2<<endl;
	}else{
		cout<<"IMPOSSIBLE"<<endl;
	}


	return 0;
}


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

val pw = PrintWriter(System.out)
const val YES = "Yes"
const val NO = "No"
fun solve(N: String){
    if (N.slice(0..2).toList().distinct().size == 1 || N.slice(1..3).toList().distinct().size == 1 ){
        println(YES)
    }else println(NO)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next()
    solve(N)
}



Measured memory_bytes: 31752
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

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

	if (a > 0 && b > 0) {
		cout << "Positive" << endl;
	} else if (a <= 0 && b >= 0) {
		cout << "Zero" << endl;
	} else {
		int p = abs(b) - abs(a) + 1;
		if (p & 1)
			cout << "Negative" << endl;
		else
			cout << "Positive" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cctype>
#include <cstdlib>
#include <bitset>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <ctype.h>
#include <cmath>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <complex>
#include <functional>
#include <climits>
#include <cassert>
#include <iterator>
#include <math.h>
#include <time.h>
#include <string.h>
#include <locale.h>

#define bit(n) (1<<(n))
#define inf 1000000000
#define eps 1e-9
#define PI 3.1415926535897932385
#define pb push_back
#define sz size()
#define mp make_pair
#define cl clear()
#define all(a) a.begin(),a.end()
#define fill(ar,val) memset(ar,val,sizeof(ar))
#define MIN(a,b) if(a>(b)) a=(b)
#define MAX(a,b) if(a<(b)) a=(b)
#define sqr(x) ((x)*(x))
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
//#define MOD 1000000007
#define bsize 1111


using namespace std;
 // ================================================================== //
 int a[107] = {0};
int main()
{
    // * Faster Input *//
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    // * ========================================================== * //

 int tmp,cnt=0;
 for(int i=0;i<3;i++)
 {
 	cin >> tmp;
 	 a[tmp] = 1;
 }
 for(int i=0;i<107;i++)
 {
 	if(a[i] ==1)
 	{
 		cnt++;
 	}
 }
 
cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll INM = 114514;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

ll dp[364364]  = {};
ll tmp[364364] = {};

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<P> a(2 * n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a[i] = P(x, 0);
	}
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a[i + n] = P(x, 1);
	}
	sort(a.begin(), a.end());
	ll cnt = 0;
	ll now = -1;
	ll ans = 1;
	for (int i = 0; i < 2 * n; i++) {
		if (a[i].second != now && cnt > 0) {
			ans *= cnt;
			ans %= MOD;
			cnt--;
		} else {
			cnt++;
			now = a[i].second;
		}
	}
	dump(ans);
	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main(){
    Hello
    int n, q;
    string s;
    cin >> n >> q >> s;
    int freq[s.size() + 5] = {};
    for(int i = 1; i < s.size(); i++){
        if(s[i] == 'C' && s[i - 1] == 'A') freq[i] = freq[i - 1] + 1;
        else freq[i] = freq[i - 1];
    }
    while(q--){
        int l, r;
        cin >> l >> r;
        l--; r--;
        if(l == 0) cout << freq[r] << endl;
        else cout << freq[r] - freq[l] << endl;
    }
    return 0;
}


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

int main() {
	int n,a,b,sum,t[2001];
	
	for(int i=0;i<=1000;++i)t[i]=i+1;
	for(int i=1001;i<=2000;++i)t[i]=2001-i;
	
	
	while(cin>>n){
		sum=0;
		for(int i=0;i<=2000;++i){
			for(int j=0;j<=2000;++j){
				if(i+j==n)sum += t[i] * t[j];
			}
		}
		cout<<sum<<endl;
		
		
		
		
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    int N;
    int X=0;
    bool b=1;
      cin >> N;
    int A[N];
      //A=11009,B=11332;
    for (int i = 0; i < N; i++)
      cin >> A[i];
    while (b){
      for (int i = 0; i < N; i++){
        if(A[i]%2==1){
          b=0;
          X--;
          break;
        }
        else{
           A[i]/=2;
        }
      }
      X++;
    }
     cout << X << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using LP = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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 double PI=3.14159265358979323846;

int mod = 1e9+7;
const long long INF = 1LL<<60;


ll count_pop(ll e, int keta){
  // [0, s]のketa桁目のpopulationを返す
  ll unit = (ll)pow(2, (ll)keta);

  // if(keta < 4){
  //   cout << "unit:" << unit << endl;
  // }

  ll div_cnt = e / unit;
  ll div_mod = e % unit;

  ll ans = 0;
  ans += (div_cnt/2) * unit;
  if(div_cnt%2==1){
    ans += 1 + div_mod;
  }

  return ans;
}

int main(){
  ll A, B;
  cin >> A >> B;

  vector<ll> population(64);
  rep(keta, 64){
    // if(keta < 4){
    //   cout << "===" << endl;
    //   cout << "keta:" << keta << endl;
    //   cout << "B:" << B << endl;
    //   cout << "A-1:" << A-1 << endl;
    //   cout << "cout_pop(B, keta):" << count_pop(B, keta) << endl;
    //   cout << "cout_pop(A-1, keta):" << count_pop(A-1, keta) << endl;
    // }
    population[keta] = count_pop(B, keta) - count_pop(A-1, keta);
  }

  ll ans = 0;
  rep(i, 64){
    ll tmp = 1LL<<(ll)i;
    if(population[i]%2==1){
      ans += tmp;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import math

def hoge(x, y, p):
    s = 0
    for x_i, y_i in zip(x, y):
         s += math.pow(math.fabs(x_i - y_i), p)
    return math.pow(s, 1/p)

_ = input()
x = [int(e) for e in input().split()]
y = [int(e) for e in input().split()]
print (hoge(x, y, 1))
print (hoge(x, y, 2))
print (hoge(x, y, 3))
print (max([math.fabs(x_i - y_i) for x_i, y_i in zip(x,y)]))


Measured memory_bytes: 5716
from collections import defaultdict
dd = defaultdict(int)
s=input()
for key in s:
    dd[key] += 1

keys=list(set(s))
if len(keys)!=2:
  print("No")
elif dd[keys[0]]==2 and dd[keys[1]]==2:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38384
#include <stdio.h>

int main() {
	int slot;
	scanf("%d", &slot);
	
	int rat, pul, sat;
	rat = slot/100;
	pul = (slot - rat*100)/10;
	sat = slot - (pul*10 + rat*100);
	
	if(rat == 7 || pul == 7 || sat == 7){
		printf("Yes");
	}else{
		puts("No");
	}
	
	
	return 0;
}

Measured memory_bytes: 1720
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scan_init()
	h := scanInt()
	w := scanInt()
	k := scanInt()
	c := make([][]string,h)
	count := 0
	for i:= 0; i<h; i++ {
		string := scan()
		c[i] = strings.Split(string,"")
	}
	for i:=0; i<( 1<< h); i++ {
		for j:= 0; j< (1 << w); j++ {
			black := 0
			for a := 0; a<h; a++ {
				for b := 0; b<w; b++ {
					//　計算量 2^(w+h)　このようにしても2^(w*h)にならないことを考えないと...
					if ((i>>a)&1) == 0 && ((j>>b)&1) == 0 && c[a][b] == "#"{
						//　そのマスを赤に塗ってないカツそのマスが黒である
						// ビットでの操作はそこのマスをずらすことでそのx,yを調べることができる
						// (i>>this)&1 -> iの状態の時のやつのなんばん目かが1であるものを調べる
						black ++
					}
				}
			}
			if black == k {
				count ++
			}
		}
	}
	fmt.Println(count)
}

var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}


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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;

const int N = (int) 1e5;
const int INF = (int) 1e9 + 7;

int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int n;
	sf("%d", &n);
	n %= 10;
	int a[] = {2, 4, 5, 7, 9};
	for (int i = 0; i < 5; ++i) {
		if (a[i] == n) {
			puts("hon");
			return 0;
		}
	}
	int b[] = {0, 1, 6, 8};
	for (int i = 0; i < 4; ++i) {
		if (b[i] == n) {
			puts("pon");
			return 0;
		}
	}

	puts("bon");

	return 0;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iH = int.Parse(sS[0]);
            int iW = int.Parse(sS[1]);
            List<string> lstInp = new List<string>();
            for (int i = 0; i < iH; i++)
            {
                lstInp.Add(Console.ReadLine().Trim());
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            // 出力
            for (int i = 0; i < lstInp.Count; i++)
            {
                Console.WriteLine("{0}", lstInp[i].ToString());
                Console.WriteLine("{0}", lstInp[i].ToString());
            }

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  string s;
  cin >> s;
  map<string, int> m;
  REP(i, s.size()){
    FOR(j, 1, 6){
      if(i+j <= s.size()){
        string t = s.substr(i, j);
        m[t]++;
      }
    }
  }
  int k;
  cin >> k;
  int f = 1;
  for(auto i = m.begin(); i != m.end(); ++i){
    if(f == k){
      cout << i->first << endl;
      return 0;
    }
    f++;
  }
  return 0;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define inver(a) power(a,mod-2)
using namespace std;
inline char gc() {
	return getchar();
	static char buf[100000],*l=buf,*r=buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void rd(T &x) {
	x=0; int f=1,ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=gc();}
	x*=f;
}
typedef long long ll;
const int mod=1e9+7;
const int maxn=5000+5;
int n,K,p[maxn];
int head[maxn];
int val[maxn],fac[maxn],inv[maxn];
int s[maxn],dp[maxn];
bool vis[maxn];
vector<int> vec;
inline int add(int x) {return x>=mod?x-mod:x;}
inline int sub(int x) {return x<0?x+mod:x;}
ll power(ll x,ll y) {
	ll re=1;
	while(y) {
		if(y&1) re=re*x%mod;
		x=x*x%mod;
		y>>=1; 
	}
	return re;
}
inline int binom(int x,int y) {
	return (ll)fac[x]*inv[y]%mod*inv[x-y]%mod;
}
struct edge {
	int to,nex;
	edge(int to=0,int nex=0):to(to),nex(nex){}
};
vector<edge> G;
inline void addedge(int u,int v) {
	G.push_back(edge(v,head[u])),head[u]=G.size()-1;
	G.push_back(edge(u,head[v])),head[v]=G.size()-1;
}
void travel(int u) {
	if(vis[u]) return;
	vis[u]=1;
	vec.push_back(u);
	for(int i=head[u];~i;i=G[i].nex) {
		int v=G[i].to;
		travel(v);
	}
}
void init() {
	val[0]=1;
	for(int i=1;i<=K;++i) val[i]=(ll)val[i-1]*(n-1)%mod;
	fac[0]=1;
	for(int i=1;i<=K;++i) fac[i]=(ll)fac[i-1]*i%mod;
	inv[K]=inver(fac[K]);
	for(int i=K;i>=1;--i) inv[i-1]=(ll)inv[i]*i%mod;
}
int main() {
	rd(n);
	memset(head,-1,sizeof(head));
	for(int i=1;i<=n;++i) {
		rd(p[i]);
		if(p[i]==-1) ++K;
		else addedge(i,p[i]);
	}
	init();
	int an=0;
	for(int i=1;i<=n;++i) if(!vis[i]) {
		vec.clear(),travel(i);
		int k=-1;
		for(int j=0;j<vec.size();++j) if(p[vec[j]]==-1) {
			k=vec[j]; break;
		}
		if(k==-1) an=add(an+val[K]);
		else s[k]=vec.size();
	}
	dp[0]=1;
	for(int i=1;i<=n;++i) if(p[i]==-1) {
		for(int j=K;j>0;--j) dp[j]=(dp[j]+(ll)dp[j-1]*s[i])%mod;
	}
	dp[1]=sub(dp[1]-K);
	for(int i=1;i<=K;++i) an=(an+(ll)dp[i]*fac[i-1]%mod*val[K-i])%mod;
	an=sub((ll)val[K]*n%mod-an);
	printf("%d\n",an);
	return 0;
}

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

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Reset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       (a).resize(unique(all(a)) - (a).begin())
#define bit(n, i)       (((n) >> (i)) & 1)
#define onbit(n, i)     ((n) |= (1LL << (i)))
#define offbit(n, i)    onbit((n), (i)), ((n) -= (1LL << (i)))
#define bitcount(n)     __builtin_popcountll(n)

using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const ll oo = 2e9;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline bool isPrime (ll x){ if(x <= 1) return 0; if(x <= 3) return 1; if (!(x % 2) || !(x % 3)) return 0; ll s = sqrt(1.0 * x) + EPS; for(ll i = 5; i <= s; i += 6){if (!(x % i) || !(x % (i + 2))) return 0;}return 1;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}

const int N = 3e5 + 5;

ll n, m, k;
ll a[N];

void Solve(){
    cin >> n;
    int ok = 1;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        if(x&1) continue;
        ok &= (x % 3 == 0) || (x % 5 == 0);
    }
    if(ok) cout << "APPROVED"; else cout << "DENIED"

;

}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(10);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int query = 1;
//    cin >> query;
    int start = 1000 * clock() / CLOCKS_PER_SEC;
    while(query--) Solve();
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC  - start << "ms\n";
}


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A, B, C;
    cin >> A >> B >> C;
    if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
// organize and work - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void solve(){
	int n;
	cin>>n;
	if(n&1 || n<10)
	{
		cout<<"0\n";
	}else {
		int ans=0;
		int num=10;
		while(num<=n){
			ans+=n/num;
			num*=5;
		}
		cout<<ans;
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;//cin>>t;
	t=1;
	while(t--)//
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int x[100000];
signed main(){
	int a,mi=INF;
	cin>>a;
	f(i,a){
		cin>>x[i];
		mi=min(mi,x[i]);
	}
	f(i,a){
		if(mi==x[i]){
			cout<<i+1<<endl;
			return 0;
		}
	}
}




Measured memory_bytes: 3876