akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000009;
int W, N, cnt, pre[79], dp[79], x[33], v[64][79][79]; long long H, y[33];
int main() {
	while (scanf("%d%lld%d", &W, &H, &N), W) {
		for (int i = 1; i <= N; i++) scanf("%d%lld", &x[i], &y[i]), x[i]--;
		y[0] = 1, y[N + 1] = H; x[N + 1] = 0;
		for (int i = 0; i <= N + 1; i++) {
			for (int j = i + 1; j <= N + 1; j++) {
				if (y[i] > y[j]) {
					swap(x[i], x[j]);
					swap(y[i], y[j]);
				}
			}
		}
		for (int i = 0; i < W; i++) {
			for (int j = 0; j < W; j++) {
				if (-1 <= i - j && i - j <= 1) v[0][i][j] = 1;
				else v[0][i][j] = 0;
			}
		}
		for (int i = 0; i < 60; i++) {
			for (int j = 0; j < W; j++) {
				for (int k = 0; k < W; k++) {
					v[i + 1][j][k] = 0;
					for (int l = 0; l < W; l++) {
						v[i + 1][j][k] = (v[i + 1][j][k] + 1LL * v[i][j][l] * v[i][l][k]) % mod;
					}
				}
			}
		}
		fill(pre, pre + W, 0); pre[0] = 1;
		for (int i = 1; i <= N + 1; i++) {
			long long b = y[i] - y[i - 1];
			for (int j = 0; j <= 60; j++) {
				if (b & (1LL << j)) {
					for (int k = 0; k < W; k++) {
						for (int l = 0; l < W; l++) {
							dp[l] = (dp[l] + 1LL * pre[k] * v[j][k][l]) % mod;
						}
					}
					for (int j = 0; j < W; j++) pre[j] = dp[j], dp[j] = 0;
				}
			}
			pre[x[i]] = 0;
		}
		printf("Case %d: ", ++cnt);
		if (W == 1) printf("%d\n", N == 0 ? 1 : 0);
		else printf("%d\n", pre[W - 1]);
	}
	return 0;
}

Measured memory_bytes: 4052
# ARC081D - Coloring Dominoes (ABC071D)
def main():
    N = int(input())
    S1 = input().rstrip()
    S2 = input().rstrip()
    MOD = 10 ** 9 + 7
    a, b = S1[0], S2[0]
    ans = 3 if a == b else 6
    for i, j in zip(S1[1:], S2[1:]):
        if a != i and b != j:
            if a == b:
                ans *= 2
            else:
                ans *= 1 if i == j else 3
            ans %= MOD
        a, b = i, j
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define upadj(i,adj) if (adj.size()>0) up(i,0,adj.size()-1)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << "=" <<X << endl
#define debug2(X,Y)  cerr<< #X << "=" <<X << ", " << #Y << "=" <<Y << endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar
using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
int n,k,d[2010];
V<int> a[2010];
void input()
{
    cin>>n>>k;
    up(i,1,n-1)
    {
        int u,v; cin>>u>>v;
        a[u].pb(v); a[v].pb(u);
    }
}
void dfs(int u,int p)
{
    for (auto v: a[u])
        if (v!=p)
    {
        d[v]= d[u]+1; dfs(v,u);
    }
}

void solve()
{
    int res= n;
    if (k%2==0)
    {
        up(i,1,n)
        {
            fill(d+1,d+1+n,0);
            dfs(i,-1);
            int del=0;
            up(j,1,n)
             if (d[j]>k/2) del++;
            res= min(res,del);
        }
    }
    else
    {
        up(u,1,n)
         for (auto v: a[u])
         {
            fill(d+1,d+1+n,0);
            dfs(u,v); dfs(v,u);
            int del=0;
            up(j,1,n)
             if (d[j]> (k-1)/2) del++;
            res= min(res, del);
         }
    }
    cout<<res;
}

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

    #ifdef I_Love_Pork
    #define TASK "tmp"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
    #endif

    input();
    solve();

    return 0;
}


Measured memory_bytes: 512
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;

fn main() {
    let s:Vec<char> = read::<String>().chars().collect();

    if s[0] != 'A' {
        println!("WA");
        return ();
    }
    let mut idx:u32 = s.len() as u32;
    for i in 2..s.len()-1 {
        if s[i] == 'C' {
            idx = i as u32;
            break;
        }
    }
    if idx == s.len() as u32 {
        println!("WA");
        return ();
    }
    for i in 1..s.len() {
        if i as u32 == idx {continue;}
        if 'A' <= s[i] && s[i] <= 'Z' {
            println!("WA");
            return ();
        }
    }

    println!("AC");

}


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

int main(){
    int n;
    cin >> n;
    int ans=0;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(i%2==0 && a%2==1) ans++;
    }
    cout << ans <<endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<string>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
	long long t[100001],h[100000],max=0;
	int n,i,j=0;
	cin>>n;
	for(i=0;i<=n;i++) scanf("%lld",&t[i]);
	for(i=0;i<n;i++) scanf("%lld",&h[i]);
	i=0;
	for(i=0;i<n;i++)
	{
		if(t[i]>=h[i])
		{
			max+=h[i];
		}
		else if(t[i]+t[i+1]>=h[i])
		{
			max+=h[i];
			t[i+1]=t[i]+t[i+1]-h[i];
		}
		else
		{
			max+=t[i]+t[i+1];
			t[i+1]=0;
		}
	}
	cout<<max;
	return 0;
}

Measured memory_bytes: 1792
import itertools
import math

N = int(input())
P = [[int(x) for x in input().split()] for _ in range(N)]
ans=0
for p in itertools.permutations(P):
    for (x1, y1), (x2, y2) in zip(p, p[1:]):
        ans += math.hypot(x1-x2, y1-y2)
print(ans/math.factorial(N))

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vl vector<long>
#define P pair<int,int>
using namespace std;

main()
{
        string s; cin>>s;
        int n=s.size();
        if(n<4)
        {
                cout<<"No"<<endl;
                return 0;
        }

        if(s.find("YAKI")==0)
        {
                cout<<"Yes"<<endl;
                return 0;
        }
        cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 _GLIBCXX_DEBUG
static const int MAX = 20;


int main(){
  string S;
  cin >> S;
  int count1 = 0, count2 = 0;
  rep(i, S.length()){
    if(i % 2 == 0){
      if(S[i] == '1') count1++;
      else count2++;
    }else{
      if(S[i] == '0') count1++;
      else count2++;
    }
  }
  cout << min(count1, count2) << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int X = sc.nextInt();


        int left = Math.max(X-K+1,-1000000);
        int right = Math.min(X+K-1,1000000);

        for (int i = left; i <= right ; i++) {
            System.out.println(i);
        }


    }
}


Measured memory_bytes: 23252
//DFS na neusmerenim grafovima
#include <bits/stdc++.h>
#define INF INT_MAX
#define MOD 100000007
#define MAX_V 100000
#define MAX_E 100000

using namespace std;

int V, E;
vector<int> adj[MAX_V];
int visited[MAX_V];
int parent[MAX_V];
stack<int> stk;
void DFS(int v) {
	visited[v] = 1;
	int d = adj[v].size();
	for (int i = 0; i<d; ++i) {
		if (visited[adj[v][i]] == 1) {
			cout << "IMA CIKLUS";
			exit(0);
		}
		if(visited[adj[v][i]]==0)
		DFS(adj[v][i]);
	}
	visited[v]=2;
	stk.push(v);
	return;
}

int main() {
	memset(parent, -1, sizeof(parent));
	ios::sync_with_stdio(false);
	cin >> V >> E;
	for (int i = 0; i<E; ++i) {
		int u, v;
		cin >> u >> v;
		/*u--;
		v--;*/
		adj[u].push_back(v);
	}
	for (int i = 0; i<V; ++i) {
		if (!visited[i])DFS(i);
	}
	while (!stk.empty()) {
		cout << stk.top() << " ";
		cout << endl;
		stk.pop();
	}
	return 0;
}
/*
4 4
1 2
2 3
3 4
1 4

*/





Measured memory_bytes: 6320
#include <bits/stdc++.h>
#include <vector>
using namespace std;
 
int main(){
  //入力
  int N;
  cin>>N;
  vector<unsigned long long>H(N);
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  //フラグ
  int flg=1;
  for(int i=N-1;i>0;i--){
    if(H[i-1]<=H[i]){
      continue;
    }else if(H[i-1]==H[i]+1){
      H[i-1]--;
    }else{
      flg=0;
      break;
    }
  }

  //出力
  if(flg==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int x,y;
    x=c-a,y=d-b;
    printf("%d %d %d %d\n",c-y,d+x,a-y,b+x);
}   


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
  int n,d,x;
  cin>>n>>d>>x;
  int count=0;
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    count+=(d-1)/tmp+1;
  }
  cout<<count+x<<endl;
  return 0;
}


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

using namespace std;

int main() {
    int n,i = 1,sqrt;

    while (cin >> n){
        sqrt = 0;
        i =0;
        while (i * n < 600){
            sqrt += n * pow(i*n,2);
            i++;
        }
        cout << sqrt << endl;
    }
    return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()


int main(){
  ll N,X,T;
  cin >> N >> X >> T;
  cout << ((N-1)/X+1)*T << endl;
}

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

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i=0;i<n;i++) {
      cin >> a[i];
  }
  sort(a, a+n);
  for (int i=0;i<n-1;i++) {
    if (a[i]==a[i+1]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
  

Measured memory_bytes: 1024
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();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();

		String ret = ":(";

		if(b - a > k){
			System.out.println(ret);
		}else{
			if(c - a > k){
				System.out.println(ret);
			}else{
				if(d - a > k){
					System.out.println(ret);
				}else{
					if(e - a > k){
						System.out.println(ret);
					}else{
						if(c - b > k){
							System.out.println(ret);
						}else{
							if(d - b > k){
								System.out.println(ret);
							}else{
								if(e - b > k){
									System.out.println(ret);
								}else{
									if(d - c > k){
										System.out.println(ret);
									}else{
										if(e - c > k){
											System.out.println(ret);
										}else{
											if(e - d > k){
												System.out.println(ret);
											}else{
												System.out.println("Yay!");
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int a, b, k;
  cin >> a >> b >> k;
  int n=0;
  drep(i,min(a,b)+1){
    if(a%i==0 && b%i==0){
      n++;
    }
    if(n==k){
      cout << i << endl;
      return 0;
    }
  }
  
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_c

import sys
# sys.setrecursionlimit(100000)
from collections import deque


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    A = []
    for _ in range(n):
        A.append(input_int())
    A = sorted(A)
    dq = deque(A)
    ans = 0

    # 貪欲に最も差分が大きい組み合わせを使っていく
    left = dq.popleft()
    right = dq.pop()
    ans = abs(right - left)

    while dq:
        l = dq[0]
        r = dq[-1]
        if abs(left - l) == max(abs(left - l), abs(right - l), abs(left - r), abs(right - r)):
            ans += abs(left - l)
            left = l
            dq.popleft()
        elif abs(left - r) == max(abs(left - l), abs(right - l), abs(left - r), abs(right - r)):
            ans += abs(left - r)
            left = r
            dq.pop()
        elif abs(right - l) == max(abs(left - l), abs(right - l), abs(left - r), abs(right - r)):
            ans += abs(right - l)
            right = l
            dq.popleft()
        elif abs(right - r) == max(abs(left - l), abs(right - l), abs(left - r), abs(right - r)):
            ans += abs(right - r)
            right = r
            dq.pop()

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 75320
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
#define INF 1e12
#define MOD 1e9+7
typedef long long ll;
using namespace std;


int main()
{
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();
	vector<string> ans;
	for (int i = 0; i <= n-m; i++)
	{
		string pre(i,'?');
		string suf(n-m-i, '?');
		string t_i = pre + t + suf;
		bool flag = true;
		rep(j, n)
		{
			int d = abs(s[j] - t_i[j]);
			if (1 <= d && d <= 25)
			{
				flag = false;
				break;
			}
		}
		if (flag)
		{
			string sout;
			rep(j, n)
			{
				if (s[j]==t_i[j])
				{
					if (s[j] == '?')sout.push_back('a');
					else sout.push_back(s[j]);
				}
				else
				{
					if (s[j] == '?')sout.push_back(t_i[j]);
					else sout.push_back(s[j]);
				}
			}
			ans.push_back(sout);
		}
	}
	if (ans.size() > 0)
	{
		sort(ALL(ans));
		co(ans[0]);
	}
	else
	{
		co("UNRESTORABLE");
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)

const int N=500005;

std:: vector <int> vec[N];

int max[N<<2],tag[N<<2],n,m;

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):v,ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void psuh_down(int now) {
	if (!tag[now]) return ;
	int w=tag[now]; tag[now]=0;
	tag[now<<1]+=w,tag[now<<1|1]+=w;
	max[now<<1]+=w,max[now<<1|1]+=w;
}

void modify(int now,int tl,int tr,int l,int r) {
	if (r<l) return ;
	if (tl>=l&&tr<=r) {
		max[now]++,tag[now]++;
		return ;
	}
	psuh_down(now);
	int mid=(tl+tr)>>1;
	if (l<=mid) modify(now<<1,tl,mid,l,r);
	if (mid+1<=r) modify(now<<1|1,mid+1,tr,l,r);
	max[now]=std:: max(max[now<<1],max[now<<1|1]);
}

int query(int now,int tl,int tr,int l,int r) {
	if (r<l) return 0;
	if (tl>=l&&tr<=r) return max[now];
	psuh_down(now);
	int mid=(tl+tr)>>1,qx=0,qy=0;
	if (l<=mid) qx=query(now<<1,tl,mid,l,r);
	if (mid+1<=r) qy=query(now<<1|1,mid+1,tr,l,r);
	return std:: max(qx,qy);
}

void build(int now,int tl,int tr) {
	if (tl==tr) {
		max[now]=(tl-m-1);
		return ;
	}
	int mid=(tl+tr)>>1;
	build(now<<1,tl,mid),build(now<<1|1,mid+1,tr);
	max[now]=std:: max(max[now<<1],max[now<<1|1]);
}

int main(void) {
	n=read(),m=read();
	rep(i,1,n) {
		int x=read(),y=read();
		vec[x].push_back(y);
	}
	build(1,0,m+1);
	int ans=n-m;
	rep(i,0,m-1) {
		for (int j=0;j<vec[i].size();++j) {
			modify(1,0,m+1,0,vec[i][j]);
		}
		ans=std:: max(ans,query(1,0,m+1,i+2,m+1)-i);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 25088
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=105;
const int bes=131;
int n;
ull a[maxn],b[maxn],bs[maxn];
char s[maxn];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

void pre(){
	bs[0]=1;
	go(i,maxn,1)  bs[i]=bs[i-1]*bes;
}

inline ull get(ull *f,int l,int r){
	return f[r]-f[l-1]*bs[r-l+1];
}

int main(){
	#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	#endif
	n=rd(); pre();
	scanf("%s",s+1);
	go(i,n+1,1) a[i]=a[i-1]*bes+s[i];
	scanf("%s",s+1);
	go(i,n+1,1) b[i]=b[i-1]*bes+s[i];
	int mx=0;
	go(i,n+1,1) if(get(b,1,i) == get(a,n-i+1,n)) mx=i;
	printf("%d",n*2-mx);
	return 0;
}//Faze


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ret = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500 * i + 100 * j + 50 * k == x:
                ret += 1
print(ret)

Measured memory_bytes: 3060
#include <stdio.h>

#define NMAX 10001
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
};

struct Node T[NMAX];

int n;

void preParse(int u){
  if(u == NIL){
    return;
  }
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL){
    return;
  }
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL){
    return;
  }
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(void){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    T[i].p = NIL;
  }

  for(i = 0;i < n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL){
      T[l].p = v;
    }
    if(r != NIL){
      T[r].p = v;
    }
  }
  for(i = 0;i < n;i++){
    if(T[i].p == NIL){
      root = i;
    }
  }

  printf("Preorder\n");
  preParse(root);
  printf("\nInorder\n");
  inParse(root);
  printf("\nPostorder\n");
  postParse(root);
  printf("\n");

  return 0;
}




Measured memory_bytes: 2124
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), x.end()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
const double eps = 1e-9;
int a[50][50];
ll dp[50][50][50][50];

ll dfs(int i1, int j1, int i2, int j2) {
  if (i1 > j1 || i2 > j2 || j1 >= i2 || (j1 - i1) % 2 != (j2 - i2) % 2)
    return 0;
  if (i1 == j1 && i2 == j2)
    return a[i1][j2];
  if (~dp[i1][j1][i2][j2]) 
    return dp[i1][j1][i2][j2];
  ll& ret = dp[i1][j1][i2][j2];
  ret = 0;
  if (i1 == j1) {
    for (int j = i2; j <= j2; j++) if (a[i1][j])
      ret += dfs(i2, j-1, j+1, j2);
    return ret;
  }
  if (i2 == j2) {
    for (int i = i1; i <= j1; i++) if (a[i][j2])
      ret += dfs(i1, i-1, i+1, j1);
    return ret;
  }
  for (int i = i1; i <= j1; i++) {
    for (int j = j2; j >= i2; j--) if (a[i][j]) {
      if (i == i1 && j == j2)
        ret += dfs(i1+1, j1, i2, j2-1);
      else if (i == i1) {
        for (int jj = i2; jj < j; jj++)
          ret += dfs(jj, j-1, j+1, j2) * dfs(i+1, j1, i2, jj-1);
      } else if (j == j2) {
        for (int ii = i+1; ii <= j1; ii++)
          ret += dfs(i1, i-1, i+1, ii) * dfs(ii+1, j1, i2, j-1);
      } else {
        for (int ii = i+1; ii <= j1; ii++)
          for (int jj = i2; jj < j; jj++)
            ret += dfs(i1, i-1, i+1, ii) * dfs(jj, j-1, j+1, j2) * (ii == j1 && jj == i2 ? 1ll : dfs(ii+1, j1, i2, jj-1));
      }
    }
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  for (int i = 1; i <= 2*n; i++) {
    string s; cin >> s;
    for (int j = 1; j <= 2*n; j++)
      a[i][j] = s[j-1]-'0';
  }
  if (n == 1) {
    if (a[1][2])
      cout << "1\n";
    else
      cout << "0\n";
    return 0;
  }
  ll ans = 0;
  memset(dp, -1, sizeof dp);
  for (int i = 3; i < 2*n; i++) if (a[1][i])
    ans += dfs(2, i-1, i+1, 2*n);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 52444
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int A, B;
	cin >> A >> B;
	int res;
	if (A == B) res = 2 * A;
	else if (A < B) res = 2 * B - 1;
	else res = 2 * A - 1;
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
 
using namespace std;

int main( ) {
    ll A,B;
    cin>>A>>B;
    cout<<A*B<<endl;
    }

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
	cout<<15-(a+b+c+d+e)<<"\n";
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 998244353
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pll a, pll b)//true for a before b
{
	if(a.F*b.S < b.F*a.S)
		return 1;
	if(a.F*b.S > b.F*a.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (1e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 900;
const int SQRT = BUCK+9;



void solve()
{
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	if(k % 2LL == 0LL)
		cout << (a-b) << '\n';
	else
		cout << (b-a) << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file; fffff
	// srand (time(NULL)); blake lively

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
const ll N= 1e8;
inline void fastio()
{ 
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
    int head, leg;
    bool flag = false;
    cin >> head >> leg;
    for (int i = 0; i <= head;i++)
    {
        if(2*i+4*(head-i)==leg)
            {
                flag = true;
                break;
            }
    }
    cout << (flag ? "Yes" : "No");
    return 0;
}

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

int two(int x) {
    int count = 0;
    int flag = 1;
    while(flag) {
        if(x % 2 == 0) {
            count++;
            x = x / 2;
        }
        else{
            flag = 0;
        }
    }
    return count;
}

int main(void){
    int N;
    scanf("%d", &N);
    int a;
    int tempcount;
    int i;
    int min = INT_MAX;
    for(i=0; i<N; i++) {
        scanf("%d", &a);
        tempcount = two(a);
        if(tempcount < min) {
            min = tempcount;
        }

    }

    printf("%d\n", min);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()

// T := [T][T]... | num 

int solve(string &s, int &i){
    vector<int> v;
    if(isdigit(s[i])){
        int num = 0;
        while(isdigit(s[i])){
            num = num*10 + s[i]-'0';
            i++;
        }
        return num+1;
    }
    while(s[i] == '['){
        i++; // [
        v.push_back(solve(s,i));
        i++; // ]
    }

    sort(all(v));
    int n = v.size(), sum = 0;
    rep(k,(n+1)/2){
        sum += v[k];
    }
    return sum;
}

int main(void){
    int T;
    cin>>T;
    rep(_,T){
        string s;
        cin>>s;
        int index = 0;
        cout<<(solve(s,index)+1)/2<<endl;
    }
    return 0;
}



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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

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

	int n,k;
	cin>>n>>k;


	int ans =0;
	while(n>0){
		n /=k;
		ans++;
	}
	
	writeln(ans);
}


Measured memory_bytes: 256
n = int(input())
buttons = [int(input()) for _ in range(n)]
done = [0] * (n + 1)
next_button = buttons[0]
for _ in range(n):
    buttons_status = done[next_button]
    if buttons_status != 0:
        print(-1)
        exit()
    done[next_button] = 1
    if next_button == 2:
        break
    next_button = buttons[next_button - 1]
print(done.count(1))


Measured memory_bytes: 13764
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    ans = 0

    num_list = [a,b,c,d,e]

    min_num = 10
    for i in num_list:
        if i % 10 < min_num and i % 10 != 0:
            min_num = i % 10
        if i % 10 == 0:
            ans += i
        else:
            ans += i + ( 10 - i % 10 )

    print(ans-10+min_num)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
N, M = map(int, input().split())
a = [0] * N
for _ in range(M):
    a[int(input())-1] = '!'

for i in range(N):
    if i == 0:
        if a[i] != '!':
            a[i] = 1
        else:
            a[i] = 0
    elif i == 1:
        if a[i] != '!':
            a[i] = a[i-1] + 1
        else:
            a[i] = 0
    else:
        if a[i] != '!':
            a[i] = a[i-1] + a[i-2]
        else:
            a[i] = 0

print(a[N-1] % 1000000007)


Measured memory_bytes: 460020
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long int llint;


int main(void){
  int n;
  std::cin >> n;
  std::vector<int> L(2*n);
  for(int i=0; i<2*n; i++){
    std::cin >> L[i];
  }


  std::sort(L.begin(), L.end());
  int sum = 0;
  for(int i=0; i<n; i++){
    //std::cout << L[2*i] << std::endl;
    sum += L[2*i];
  }


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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
typedef long long ll;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int t,u;
    t=a;
    a=b;
    b=t;

    u=a;
    a=c;
    c=u;

    cout<<a<<" "<<b<<" "<<c<<endl;

}

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

int main(void){
    long long int i, j, k, n, ans=0, po=0, x[5];
    char a;
    scanf("%c", &a);
    if(a<=90) printf("A");
    else printf("a");
    
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin>>n;
  bool flag=false;
  if(n/100==7)
    flag=true;
  n%=100;
  if(n/10==7)
    flag=true;
  n%=10;
  if(n==7)
    flag=true;
  if(flag)
    yes;
  else
    no;


}



Measured memory_bytes: 3636
// Problem : D - Not Divisible
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF 1e18

int vis[1000002];

int main()
{
	io;
	ll n,c=0;

	cin>>n;
	vll a(n);
	
	FOR(i,0,n)
	{
		cin>>a[i];
		vis[a[i]]++;
	}
	
	sort(all(a));
	REV(i,n-1,0)
	{
		bool no=0;
		if(vis[a[i]]>1){continue;}
		if(a[i]==1){c++;break;}
		for(ll j=1;j*j<=a[i];j++)
		{
			if(a[i]%j==0)
			{
				if(j==1)
				{
					if(vis[1]==0){continue;}
					else{no=1;break;}
				}
				if(vis[a[i]/j]||vis[j])
				{
					no=1;
					break;
				}
			}
		}
		if(!no){c++;}
	}
	
	cout<<c;
	
	return 0;
}



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

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> cnt(n+1);
    for(int i = 0; i < k; i++)
    {
        int d; cin >> d;
        for(int j = 0; j < d; j++)
        {
            int v; cin >> v;
            cnt[v]++;
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)
        if(cnt[i]==0) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
 
using namespace std;
 
typedef long long ll;
 
ll mod(ll x,ll m){
  return (m+x%m)%m;
}
 
void extgcd(ll a,ll b,ll &x,ll &y){
  x=1,y=0;
  if(b!=0)extgcd(b,a% b,y,x),y-=(a/b)*x; 
}
 
ll mod_inv(ll a,ll m){
  ll x,y;
  extgcd(a,m,x,y);
  return mod(x,m);
}
 
ll m1=999979,m2=999983;
 
ll solve(ll x,int o,ll y){
  ll a=0,b=0,p,q;
 
  if(o==1)a=x+y,b=x+y;
  if(o==2)a=x-y,b=x-y;
  if(o==3)a=x*y,b=x*y;
  if(o==4)a=x*mod_inv(y,m1),b=x*mod_inv(y,m2);
  a=mod(a,m1),b=mod(b,m2);
  extgcd(m1,m2,p,q);
   
  return (b*m1*p+a*m2*q)%(m1*m2);
}
 
int main(void){
  ll n,o,x=0,y;
 
  cin >> n;
 
  while(n--){
    cin >> o >> y;
    x=solve(x,o,y);
  }
  cout << x << endl;
  return 0;
}

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

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

    int a[n+10] = {0};
    for (int i=1; i<=n; ++i) {
        int tmp = i;
        while (tmp%2 == 0) {
            ++a[i];
            tmp /= 2;
        }
    }

    int maxv = 0;
    for (int i=0; i<=n; ++i) {
        //cout << a[i] << endl;
        maxv = max(maxv, a[i]);
    }
    
    for (int i=1; i<=n; ++i) {
        if (maxv == a[i]) cout << i << endl;
    }

    return 0;
}



Measured memory_bytes: 256
import sys
#input = sys.stdin.readline

def main():
    N,K = map(int,input().split())
    R,S,P = map(int,input().split())
    T = list(map(str,input()))
    d = {"s":R,"p":S,"r":P}
    s = {"s":"r","p":"s","r":"p"}
    ans = 0
    x = []
    for i in range(K):
        ans += d[T[i]]
        x.append(s[T[i]])

    for i in range(N-K):
        if (T[i] == T[K+i] and x[-K] == s[T[K+i]]):
            x.append(T[K+i])
        else:
            ans += d[T[K+i]]
            x.append(s[T[K+i]])
            
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 4804
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
const int N = 2e5+5;
int main()
{
	sync;
	ll arr[5];
	input(arr,5);
	for(ll i=0;i<5;i++)
	if(!arr[i]) cout<<i+1;
}

Measured memory_bytes: 3580
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Control.Monad

main = do
    n <- readLn :: IO Int
    xs <- VU.replicateM n (fst . fromJust . B.readInt <$> B.getLine)
    print $ VU.foldl1' lcm xs

Measured memory_bytes: 508
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try {
        	String[] input_string_array = br.readLine().split(" ");

        	final int ARRAY_SIZE = 5;
        	int[] input_int_array = new int[ARRAY_SIZE];

        	for (int i = 0; i < input_string_array.length; i++) {
        		input_int_array[i] = Integer.parseInt(input_string_array[i]);
        		}

        	int W = input_int_array[0];
        	int H = input_int_array[1];
        	int x = input_int_array[2];
        	int y = input_int_array[3];
        	int r = input_int_array[4];


        	if ((W - x) >= r && x >= r && (H - y) >= r && y >= r) {
        		System.out.println("Yes");
        		} else {
        		System.out.println("No");
        		}

        } catch (IOException e) {
        	e.printStackTrace();
        }
    }
}



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

using namespace std;
const long long MAXN = 2e5+5;
long long q[MAXN];
struct segtree{
    long long seg[5*MAXN];
    long long lazy[5*MAXN];
    void push(long long curr){
        if(lazy[curr]){
            seg[2*curr]+=lazy[curr];
            seg[2*curr+1]+=lazy[curr];
            lazy[2*curr] += lazy[curr];
            lazy[2*curr+1]+=lazy[curr];
            lazy[curr] = 0;
        }
    }
    void build(long long curr,long long l,long long r){
        if(l==r){
            seg[curr] = 1e18;
            lazy[curr] = 0;
            return;
        }
        long long mid = (l+r)/2;
        build(2*curr,l,mid);
        build(2*curr+1,mid+1,r);
        seg[curr] = min(seg[2*curr],seg[2*curr+1]);
    }
    void insert(long long curr,long long l,long long r,long long ind,long long val){
        if(l==r){
            seg[curr] = min(seg[curr],val);
            return;
        } 
        if(l!=r){
            push(curr);
        }
        long long mid = (l+r)/2;
        if(ind<=mid){
            insert(2*curr,l,mid,ind,val);
        }else{
            insert(2*curr+1,mid+1,r,ind,val);
        }
        seg[curr] = min(seg[2*curr],seg[2*curr+1]);
    }
    void update(long long curr,long long l,long long r,long long tl,long long tr,long long val){
        if(l>tr||r<tl){
            return;
        }
        if(l!=r){
            push(curr);
        }
        if(l>=tl && r<=tr){
            seg[curr] += val;
            lazy[curr]+=val;
            return;
        }
        long long mid = (l+r)/2;
        update(2*curr,l,mid,tl,tr,val);
        update(2*curr+1,mid+1,r,tl,tr,val);
        seg[curr] = min(seg[2*curr],seg[2*curr+1]);
    }
    long long query(long long curr,long long l,long long r,long long tl,long long tr){
        if(l>tr||r<tl){
            return 1e18;
        }
        if(l!=r){
            push(curr);
        }
        if(l>=tl && r<=tr){
            return seg[curr];
        }
        long long mid = (l+r)/2;
        return min(query(2*curr,l,mid,tl,tr),query(2*curr+1,mid+1,r,tl,tr));
    }
};
segtree seg1,seg2,seg3;
int main(){
    long long n,Q,a,b;
    cin>>n>>Q>>a>>b;
    for(long long i=1;i<=Q;i++){
        cin>>q[i];
    }
    seg1.build(1,1,n);
    seg2.build(1,1,n);
    seg3.build(1,1,n);
    seg1.insert(1,1,n,a,abs(b-q[1]));
    seg2.insert(1,1,n,a,abs(b-q[1])+a);
    seg3.insert(1,1,n,a,abs(b-q[1])-a);
    seg1.insert(1,1,n,b,abs(a-q[1]));
    seg2.insert(1,1,n,b,abs(a-q[1])+b);
    seg3.insert(1,1,n,b,abs(a-q[1])-b);
    //cout<<seg1.query(1,1,n,1,n)<<endl;
    for(long long i=2;i<=Q;i++){
        long long val = seg2.query(1,1,n,q[i],n)-q[i];
        val = min(val,seg3.query(1,1,n,1,q[i]-1)+q[i]);
        seg1.update(1,1,n,1,n,abs(q[i]-q[i-1]));
        seg2.update(1,1,n,1,n,abs(q[i]-q[i-1]));
        seg3.update(1,1,n,1,n,abs(q[i]-q[i-1]));
        seg1.insert(1,1,n,q[i-1],val);
        seg2.insert(1,1,n,q[i-1],val+q[i-1]);
        seg3.insert(1,1,n,q[i-1],val-q[i-1]);
    }
    cout<<seg1.query(1,1,n,1,n)<<endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 2010;
int a[MAX_N];

const int L = 1000 * 1000 * 4;
bitset<L> dp;

int main2() {
  int N = nextInt();
  REP(i, N) a[i] = nextInt();

  if (N == 1) {
    cout << a[0] << endl;
    return 0;
  }

  int S = accumulate(a, a+N, 0);

  dp = dp & bitset<L>(0);
  dp[0] = 1;
  REP(i, N) {
    dp = dp | (dp << a[i]);
  }

  int ans = 0;
  for (int i = 1; i < L; i++) {
    if (dp[i]) {
      chmax(ans, min(i, S-i));
    }
  }
  ans = S - ans;
  cout << ans << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <stdio.h>

using namespace std;
int a,b;
char op;
int ans;


void solve(){
    switch(op){
        case '+':
            ans = a + b;
            break;
        case '-':
            ans = a-b;
            break;
        case '*':
            ans = a*b;
            break;
        case '/':
            ans = a/b;
            break;
    }

    return;
}

int main(){
    while(1){
        cin >> a >> op >> b;
        if(op == '?'){break;}
        solve();
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <map>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

std::string S;
std::map<char, int> cnt;

int main()
{
  std::cin >> S;

  rep( i, S.size() )
    ++cnt[S[i]];

  std::cout << (cnt.size()==2&&cnt.begin()->second==2?"Yes":"No") << std::endl;

  return 0;
}

Measured memory_bytes: 256
A, B, M=map(int,input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
t=[list(map(int, input().split())) for i in range(M)]

ans=min(a)+min(b)

for k in range(M):
    i=t[k][0]
    j=t[k][1]
    
    Y=a[i-1]+b[j-1]-t[k][2]
    if Y<=ans:
        ans=Y

print(ans)

Measured memory_bytes: 80196
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 111111
int n,a[MAX_N],dp[MAX_N];

int Lis(){
  dp[0]=a[0];
  int ans=1;
  for(int i=1;i<n;i++){
    if(dp[ans-1]<a[i])dp[ans++]=a[i];
    else *lower_bound(dp,dp+ans,a[i])=a[i];
  }
  return ans;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  cout<<Lis()<<endl;
  return 0;
}



Measured memory_bytes: 3824
#include <iostream>
#include <string>
#include <sstream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
ll p[19];
ll non(ll x){
	return x-x/3-x/5+x/15;
}
ll len(ll x){
	ll ret=0,num=x-x/3-x/5+x/15;
	int i;
	for(i=1;p[i]<=x;i++){
		ret+=(non(p[i]-1)-non(p[i-1]-1))*i;
		num-=(non(p[i]-1)-non(p[i-1]-1));
	}
	ret+=x/3*4;
	ret+=x/5*4;
	ret+=num*i;
	return ret;
}
string To_string(ll a){
	ostringstream os;
	os << a;
	return os.str();
}
int main(){
	ll s;
	cin >> s;
	p[0]=1;
	rep(i,18) p[i+1]=p[i]*10;
	ll ub=p[17],lb=0;
	while(ub-lb>1){
		ll m=(ub+lb)/2;
		if(s<=len(m)) ub=m;
		else lb=m;
	}
	string st;
	for(ll i=ub;st.size()<=50;i++){
		if(i%3==0 && i%5==0) st+="FizzBuzz";
		if(i%3==0 && i%5!=0) st+="Fizz";
		if(i%3!=0 && i%5==0) st+="Buzz";
		if(i%3!=0 && i%5!=0) st+=To_string(i);
	}
	cout << st.substr(s-1-len(lb),20) << endl;
}

Measured memory_bytes: 1220
#include <iostream>
#include <cmath>

#define elif else if

using namespace std;

int a , b , c, count = 0;

int main(){
     cin >> a >> b >> c;
     if(a==b&&a==c) cout << count;
     else{
          int temp = min(min(a,b),c);
          if(temp == a){count = abs(a-min(b,c)) + abs(b-c);}
          elif(temp == b){count = abs(b-min(a,c)) + abs(a-c);}
          elif(temp == c){count = abs(c-min(a,b)) + abs(a-b);}
          cout << count;
     }
     return 0;
}

Measured memory_bytes: 256