akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let u = read_vec::<i64>();
    let (a, v) = (u[0], u[1]);
    let u = read_vec::<i64>();
    let (b, w) = (u[0], u[1]);
    let t = read::<i64>();

    if (a - b).abs() <= t * (v - w) {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2128
#include<iostream>
using namespace std;
int main(){
	int c[13]={0,1,3,1,2,1,2,1,1,2,1,2,1};

	int x,y;
	cin>>x>>y;
	if(c[x]==c[y])cout<<"Yes"<<endl;
	else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
const int MAX_N=200001;
int bit[MAX_N+1]={0},n;
int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}
void add(int i,int x){
    while(i<=n+1){
        bit[i]+=x;
        i+=i&-i;
    }
}
int main(){
    int k;
    cin>>n>>k;
    ll ans=0;
    vec A(n),B(n+1,0);
    rep(i,n) cin>>A[i],A[i]-=k,B[i+1]=B[i]+A[i];
    vector<P> C;
    rep(i,n+1) C.push_back(P(B[i],i));
    sort(all(C));
    int a=1;
    rep(i,n+1){
        if(i&&C[i-1].first!=C[i].first) a++;
        B[C[i].second]=a;
    }
    for(int i=n;i>=0;i--){
        ans+=sum(n+1)-sum(B[i]-1);
        add(B[i],1);
    }
    cout<<ans<<"\n";
}

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

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

  int n;
  cin >> n;
  int count = 0;
  if (n == 1 || n == 2) {
    cout << 4 << '\n';
    return 0;
  }
  while (1) {
    if (n == 1){
      break;
    }
    if (n % 2 == 0) {
      n /= 2;
    }
    else {
      n = n * 3 + 1;
    }
    count++;
  }
  cout << count + 2 << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
    int X;
    char A[101];
    gets(A);
    X = strlen(A);
    for(int i = 0; i < X; i++){
        if((i+1)%2==1){
            if(A[i]=='L'){
                printf("%s\n","No");
                return 0;
            }
        }else{
            if(A[i]=='R'){
                printf("%s\n","No");
                return 0;
            }
        }
    }
    printf("%s\n","Yes");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n, k;
	cin >> n >> k;
	vi h(n);
	rep(i, n) cin >> h[i];
	sort(all(h));

	int t = INF;
	rep(i, n-k+1) {
		//cout << h[i + k - 1] << " " << h[i] << endl;
		t = min(t, h[i + k - 1] - h[i]);
	}
	cout << t << endl;
	/*
	vi sum(n);
	sum[0] = 0;
	repr(i, 1, n) {
		sum[i] = h[i] + sum[i - 1];
	}
	rep(i, n) {
		cout << sum[i] << endl;
	}
	*/


	return 0;
}



Measured memory_bytes: 640
N, K = map(int, input().split())

if K > N:
    print(1)
    exit()

s = [0] * (N + 1)
for i in range(1, N + 1):
    s[i] += s[i - 1] + i

res = 0
for i in range(K, N + 1):
    res += s[N] - s[N - i] - s[i - 1] + 1

# 全部取るときも足す
res = (res + 1) % (10 ** 9 + 7)

print(res)


Measured memory_bytes: 19252
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

bool prime[1001];

void sieve(){

    memset(prime,false,sizeof(prime));
    for(int i=2;i<=1000;i++){
        if(!prime[i]){
            for(int j=i*i;j<=1000;j=j+i){
                prime[j]=true;
            }
        }
    }
}

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

    vi v(1000,0);
    for(int k=2;k<=n;k++){
        for(int i=2;i<=n;i++){
            if(!prime[i]){
                int cnt=0,val=k;
                while(val%i==0){
                    v[i]++;
                    val=val/i;
                }
                // cout<<"I inserted something"<<endl;
            }
        }
    }

    int ans=1;
    for(auto x:v){
        ans*=(x+1);
        ans%=mod;
    }
    cout<<endl;
    cout<<ans%mod<<endl;
    return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    for(int i=0; i<N; i++) cin >> H.at(i);
    vector<int> A(M), B(M);
    for(int i=0; i<M; i++) cin >> A.at(i) >> B.at(i);
    vector<set<int>> vec(N);
    int Ai, Bi;
    for(int i=0; i<M; i++){
        Ai = A.at(i) - 1;
        Bi = B.at(i) - 1;
        vec.at(Ai).insert(Bi);
        vec.at(Bi).insert(Ai);
    }
    int comp;
    bool flag;
    int count = 0;
    for(int i=0; i<N; i++){
        comp = H.at(i);
        flag = true;
        for(auto j=vec.at(i).begin();j!=vec.at(i).end(); j++){
            if(H.at(*j) >= comp) flag = false;
        }
        if(flag) count++;
    }
    cout << count << endl;
}

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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

ll n;
unsigned ll s=0;

int main(){
  cin >> n;
  for(int i=1;i<=n;++i){
    if((i%3) && (i%5)){s+=i;}
  }
  cout << s;
  return 0;
}


Measured memory_bytes: 3624
N,Q = map(int,input().split())
S = input()
tmp = 0
ruiseki = [0]

for i in range(1,len(S)):
    if S[i-1] == 'A' and S[i] == 'C':
        tmp += 1
    ruiseki.append(tmp)

for i in range(Q):
    l,r = map(int,input().split())
    print(ruiseki[r-1] - ruiseki[l-1])

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

int main(){
	int n,l;
	cin >> n >> l;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	sort(s.begin(),s.end());
	string ans = "";
	rep(i,n){
		ans += s[i];
	}
	cout << ans << endl;
	return 0;
}



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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn dfs(number:usize, n:usize) -> usize {
    let target = number.to_string();
    let mut ret = if target.find('7')!=None && target.find('5')!=None && target.find('3')!=None {1} else {0};
    if number > n {
        return 0;
    }
    for i in vec![7,5,3] {
        ret += dfs(number*10+i, n);
    }
    ret
}
fn main() {
    input!{
        n:usize,
    }
    println!("{}", dfs(0, n));
}

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

using namespace std;


typedef long long ll;

int main() {
	ll x ,k , d;
	cin >> x >> k >> d;
	ll t = - x / d , f = k % 2 , ans = 1e18;
	ll mi , ma;
	mi = -k , ma = k;
	if(abs(t) <= k) {
		if(mi > ma)swap(mi , ma);
		ll l = max(mi , t - 10) , r = min(ma , t + 10);
		for(ll i = l ; i <= r ; i ++) {
			if(abs(i % 2) == f) {
				ans = min(ans , abs(x + i * d) );
			}		
		}
	}
	else {
		ans = min(abs(x + mi * d) , abs(x + ma * d));
	}
	cout << ans << "\n";
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  a.emplace_back(2e9);
  sort(a.begin(), a.end());
  vector<int> p;
  int prev = 0;
  for (int i = 0; i <= n; i++) {
    if (a[prev] != a[i]) {
      p.emplace_back(i - prev);
      prev = i;
    }
  }
  sort(p.begin(), p.end());
  int sz = p.size();
  if (p.size() <= k) cout << 0 << endl;
  else cout << accumulate(p.begin(), p.begin() + sz - k, 0) << endl;
  return 0;
} 

Measured memory_bytes: 2800
def main():
    import sys
    import copy
    from bisect import bisect_right
    from collections import defaultdict
    input = sys.stdin.readline
    s, t = input().strip(), input().strip()
    lens = len(s)
    index_list = defaultdict(list)
    leng = defaultdict(int)
    for i, ss in enumerate(s):
        index_list[ss].append(i)

    for s, i in index_list.items():
        if i:
            leng[s] = len(index_list[s])

    prev = -1
    ans = 0
    for tt in t:
        if tt not in leng:
            print(-1)
            return False
        p = bisect_right(index_list[tt], prev)
        # print('tt={}, prev={}, p={}, ans={}'.format(tt, prev, p, ans))
        if p < leng[tt]:
            prev = index_list[tt][p]
        else:
            prev = index_list[tt][0]
            ans += lens

    print(ans+prev+1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 13948
#include<stdio.h>

int main(void){
	
	int x,y,z;
	
	scanf("%d %d",&x,&y);
	
	for(;;){
		z=x%y;
		if(z==0){
			break;
		}
		
		x=y;
		y=z;
	}
	
	printf("%d\n",y);
	
  return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a > b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a < b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////


int main() {
	int N;
	string S;
	cin >> N;
	cin >> S;
	bool dp[11][11][11];
	memset(dp, false, sizeof(dp));
	for (int i = 0; i < S.size(); ++i) {
		for (int j = 0; j < 10; ++j) {
			for (int k = 0; k < 10; ++k) {
				if (dp[j][k][10]) {
					dp[j][k][S[i] - '0'] = true;
				}
			}
		}
		for (int j = 0; j < 10; ++j) {
			if (dp[j][10][10]) {
				dp[j][S[i] - '0'][10] = true;
			}
		}
		dp[S[i] - '0'][10][10] = true;
	}
	int ans = 0;
	for (int i = 0; i < 10;++i) {
		for (int j = 0; j < 10; ++j) {
			for (int k = 0; k < 10; ++k) {
				if (dp[i][j][k])ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;

/*
int ml[300000],mr[300000];
int pos[300000];*/

int n,q;
string s;
char t[300000][2],d[300000][2];

bool Cl(int pos){
	rep(i,q){
		if(s[pos]==t[i][0]){
			if(d[i][0]=='L')pos--;
			else pos++;
		}
		if(pos<0)return true;
		if(pos>=n)return false;
	}
	return false;
}
bool Cr(int pos){
	rep(i,q){
		if(s[pos]==t[i][0]){
			if(d[i][0]=='L')pos--;
			else pos++;
		}
		if(pos<0)return false;
		if(pos>=n)return true;
	}
	return false;
}

int main(){
	cin>>n>>q;
	cin>>s;
	rep(i,q){
		scanf("%s%s",t[i],d[i]);
	}
	int l1=-1,r1=n;
	while(r1-l1>1){
		int t=(l1+r1)/2;
		if(Cl(t))l1=t;
		else r1=t;
	}
	int l2=n,r2=-1;
	while(l2-r2>1){
		int t=(l2+r2)/2;
		if(Cr(t))l2=t;
		else r2=t;
	}
	//~ cout<<l1<<' '<<l2<<endl;
	cout<<l2-l1-1<<endl;
	/*rep(i,q){
		scanf("%s%s",t,d);
		if(d[0]=='L'){
			pos[t[0]-'a']--;
		}
		else{
			pos[t[0]-'a']++;
		}
		int e=t[0]-'a';
		ml[e]=min(ml[e],pos[e]);
		mr[e]=max(mr[e],pos[e]);
	}*/
	/*
	int cnt=0;
	rep(i,s.size()){
		int e=s[i]-'a';
		if(i+ml[e]<0||i+mr[e]>=s.size()){
			continue;
		}
		else cnt++;
	}
	cout<<cnt<<endl;*/
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
const int maxn=105;
int sum[maxn];


int main(int argc, char const *argv[])
{
	int n;
	while(~scanf("%d",&n)){
		int ans=1;
		while(ans*2<=n){
			ans<<=1;
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

int main()
{
    double a, b, c, c_rad, s, l, h;
    
    cin >> a >> b >> c;

    c_rad = c / 360 * 2 * M_PI;
    h = b * sin(c_rad);
    s = h * a / 2;
    l = a + b + sqrt(pow(h,2) + pow(a-b*cos(c_rad),2));
    cout << fixed << setprecision(5);
    cout << s << endl;
    cout << l << endl;
    cout << h << endl;
    
    return 0;
}



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


public class Main{

     public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     }
}

Measured memory_bytes: 35564
#include<stdio.h>
int main(void)
{
    int i,n,a;
	a=0;
	
	for(i=1;i<10;i++){
	    for(n=1;n<10;n++){
		    a=i*n;
			printf("%dx%d=%d\n",i,n,a);
		}
	}
	return 0;
}

Measured memory_bytes: 2496
#include <iostream>
#include <vector>
#define eol '\n';
using namespace std;

class Node {
public:
  int k;
  Node* p;
  Node* l;
  Node* r;
  Node(): k(-1),p(nullptr),l(nullptr),r(nullptr){};
};

Node* root;

void insert(int k) {
  Node* y = nullptr;
  Node* x = root;
  while (x != nullptr) {
    y = x;
    if (k < x->k) {
      x = x->l;
    } else {
      x = x->r;
    }
  }

  Node* z = new Node();
  z->k = k;
  z->p = y;

  if (y == nullptr) {
    root = z;
  } else if (k < y->k){
    y->l = z;
  } else {
    y->r = z;
  }
}

bool find(int k) {
  Node* x = root;
  while (x != nullptr) {
    if (x->k == k) {
      return true;
    } else if(k < x->k) {
      x = x->l;
    } else {
      x = x->r;
    }
  }
  return false;
}

void remove(int k) {
  Node* z = nullptr;
  Node* x = root;
  while (x != nullptr) {
    if (x->k == k) {
      z = x;
      break;
    } else if(k < x->k) {
      x = x->l;
    } else {
      x = x->r;
    }
  }
  
  if (z->l == nullptr && z->r == nullptr) {
    // has not child
    if (z->p->l != nullptr && z->p->l->k == z->k) {
      z->p->l = nullptr;
    } else {
      z->p->r = nullptr;
    }
  } else if (z->l == nullptr) {
    // has one child
    if (z->p->l != nullptr && z->p->l->k == z->k) {
      z->p->l = z->r;
      z->r->p = z->p;
    } else {
      z->p->r = z->r;
      z->r->p = z->p;
    }
  } else if (z->r == nullptr) {
    if (z->p->l != nullptr && z->p->l->k == z->k) {
      z->p->l = z->l;
      z->l->p = z->p;
    } else {
      z->p->r = z->l;
      z->l->p = z->p;
    }
  } else {
    Node* w = z->r;
    while (w->l != nullptr) {
      w = w->l;
    }

    // まずwを取り除く
    remove(w->k);

    // 次にzの親の子をwに更新する
    if (z->p->l != nullptr && z->p->l->k == z->k) {
      z->p->l = w;
    } else {
      z->p->r = w;
    }
    // wの親をzの親に
    w->p = z->p;
    // wの子をzの子に
    w->l = z->l;
    w->r = z->r;
    // zの子の親をwに(ただし、w自身の場合は更新せず)
    z->l->p = w;
    if (z->r != nullptr)
      z->r->p = w;
  }
}

void inorder(Node* x) {
  if (x == nullptr) return;
    
  inorder(x->l);
  cout << " " << x->k;
  inorder(x->r);
  if (x->k == root->k)
    cout << eol;
}

void preorder(Node* x) {
  if (x == nullptr) return;
  cout << " " << x->k;
  preorder(x->l);
  preorder(x->r);
  if (x->k == root->k)
    cout << eol;
}

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

  int m,k;
  string cmd;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> cmd;
    if (cmd == "insert") {
      cin >> k;
      insert(k);
    } else if (cmd == "find") {
      cin >> k;
      if (find(k)) {
        cout << "yes" << eol;
      } else {
        cout << "no" << eol;
      }
    } else if (cmd == "print") {
      inorder(root);
      preorder(root);
    } else if (cmd == "delete") {
      cin >> k;
      remove(k);
    }
  }

  return 0;
}

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

const int maxn = 100009;
int a[maxn], b[maxn];
int n; char ch;
bool flag;

int main(){
	scanf("%d", &n); getchar();
	for (int i=1; i<=n; i++){
		ch = getchar();
		a[i] = (ch == 'x');
	}
	for (b[1]=0; b[1]<=1; b[1]++)
		for (b[2]=0; b[2]<=1; b[2]++){
			for (int k=3; k<=n; k++) 
				b[k] = b[k-1] ^ a[k-1] ^ b[k-2];
			if (b[1] ^ a[1] ^ b[2] ^ b[n]) continue;
			if (b[n] ^ a[n] ^ b[1] ^ b[n-1]) continue;
			for (int i=1; i<=n; i++)
				putchar(b[i] ? 'W' : 'S');
			return 0;
		}
	puts("-1");
	return 0;
}

Measured memory_bytes: 1152
n, k = map(int, input().split())
hL = list(map(int, input().split()))

dp = [10**10]*(n)
dp[0] = 0
for i in range(0,n):
    if i+k<=n-1:
        for j in range(1,k+1):
            dp[i+j] = min(dp[i+j], dp[i]+abs(hL[i+j]-hL[i]))
    else:
        for j in range(1, n-i):
            dp[i+j] = min(dp[i+j], dp[i]+abs(hL[i+j]-hL[i]))

print(dp[n-1])


Measured memory_bytes: 52448
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

vector<int> G[205];
int color[205];
bool biparate(int v = 0, int c = 0){
  bool res = true;
  if(color[v] < 0){
    color[v] = c;
  }else{
    if(c != color[v]){
      res = false;
      return res;
    }
    return res;
  }
  for(int nv: G[v]) res = res && biparate(nv, (c + 1) % 2);
  return res;
}

int main(){
  using namespace std;
  int n;
  cin>>n;
  vector<string> s(n);
  REP(i, n) cin>>s[i];
  REP(i, n) REP(j, n) if(s[i][j] == '1') G[i].push_back(j);
  
  REP(i, n) color[i] = -1;
  bool possible = biparate();
  if(!possible){
    cout << -1 << endl;
    return 0;
  }
  
  int dist[n][n];
  REP(i, n) REP(j, n) dist[i][j] = 1'000'000;
  REP(i, n) dist[i][i] = 0;
  REP(i, n) REP(j, n) if(s[i][j] == '1') dist[i][j] = 1;
  REP(k, n) REP(i, n) REP(j, n) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
  int ans = 0;
  REP(i, n) REP(j, n) ans = max(ans, dist[i][j]);
  ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4000
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    n = list(map(int,S()))
    l = len(n)
    dp = [[[0 for k in range(16)] for j in range(2)] for i in range(l+1)]
    dp[0][0][0] = 1
    for i in range(l):
        for j in range(2):
            for k in range(9):
                x = 9 if j else n[i]
                for d in range(x+1):
                    if d == 3:
                        f = 1
                    elif d == 5:
                        f = 2
                    elif d == 7:
                        f = 4
                    else:
                        if k == 0 and d == 0:
                            f = 0
                        else:
                            f = 8
                    dp[i+1][j or d < n[i]][k|f] += dp[i][j][k]
    ans = 0
    for i in range(2):
        ans += dp[l][i][7]
    print(ans)
#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 39792
from sys import stdin
n,W=map(int,input().split())
k=[[0 for i in range(W+1)] for i in range(2)]
for i in range(1,n+1):
    w,v=map(int,stdin.readline().split())
    for j in range(1,W+1):
        if w<=j:
            k[1][j]=max(v+k[0][j-w],k[0][j])
        else:
            k[1][j]=k[0][j]
    k[0]=[i for i in k[1]]
    k[1]=[0]*(W+1)
print(k[0][-1])

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

using namespace std;

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

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;
const ll MOD=1e9+7;

int main() {
    int n;
    cin>>n;
    ll a[n];
    rep(i,n){
        cin>>a[i];
    }
    vll gcdl,gcdr;
    gcdl.push_back(a[0]);
    gcdr.push_back(a[n-1]);
    rep(i,n-1){
        ll num=__gcd(gcdl[i],a[i+1]);
        ll num2=__gcd(gcdr[i],a[n-2-i]);
        gcdl.push_back(num);
        gcdr.push_back(num2);
    }
    reverse(all(gcdr));
    ll ans=1;
    rep(i,n){
        if (i==0){
            ans=max(ans,gcdr[i+1]);
        }
        else if (i==n-1){
            ans=max(ans,gcdl[i-1]);
        }
        else{
            ans=max(ans,__gcd(gcdl[i-1],gcdr[i+1]));
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 2804
def calc_divisor_num(a, b, c):
    count = 0

    for num in range(1, c + 1):
        if (c % num == 0) and (a <= num <= b) :
            count += 1

    print(str(count))

if __name__ == "__main__":

    param = input()
    param = param.split(" ")

    a = int(param[0])
    b = int(param[1])
    c = int(param[2])

    calc_divisor_num(a, b, c)


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

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* main */
void Main(void)
{
    int a, b;
    cin >> a >> b;
    cout << a * b << " " << 2 * (a + b) << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



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

int main(){
    using ll = long long;
    string s; cin >> s;
    int N = s.size();
    vector<int> C(N+1, 0), D(N+1, 0);
    C[0] = s[N-1] - '0'; //ちょうど
    D[0] = 10 - (s[N-1] - '0'); //お釣り
    for (int i = 1; i < N; i++)
    {
        C[i] = min(C[i-1] + s[N-1-i] - '0', D[i-1] + s[N-1-i] - '0' + 1);
        D[i] = min(C[i-1] + 10 - (s[N-1-i] - '0'), D[i-1] + 10 - (s[N-1-i] - '0')-1);
    }
    cout << min(C[N-1], D[N-1]+1) << endl;
}


Measured memory_bytes: 9220
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int A,B;
    cin>>A>>B;
    if(A>=13){
        cout<<B<<endl;
    }else if(A>=6){

        cout<<B/2<<endl;
    }else{
        cout<<"0"<<endl;}
    return 0;
}

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

#define FREP(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) FREP(i,0,n)
#define PB push_back
#define mod 1000000007
#define endl "\n"
#define ll long long
#define MP make_pair
#define vi vector<ll>
#define si set<ll>
#define mi map<ll, ll>
#define pri(a,n) REP(i,n)cout<<a[i]<<" ";
#define sa(a,n) sort(a,a+n)
#define sra(a,n) sort(a, a + n, greater<ll>())
#define sv(v) sort(v.begin(),v.end())
#define srv(v) sort(v.rbegin(),v.rend())
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll bin(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
		return bin((a * a) % mod , b / 2) % mod;
	return ((a % mod) * (bin((a * a) % mod , b / 2) % mod)) % mod;
}

void g_o_a_l()
{
	ll x, n, q,p;
	cin >> x >> n;
	vi v(n);
	REP(i, n)
	cin >> v[i];
	q=x;
	p=x;
	while(1)
	{
		auto it = find(v.begin(), v.end(), x);
		if (it == v.end())
		{
			
			break;
		}
		else
			--x;
	}
	while(1)
	{
		auto it = find(v.begin(), v.end(), q);
		if (it == v.end())
		{
			break;
		}
		else
			++q;
	}
	if(q-p>=p-x)
	cout<<x;
	else
	cout<<q;
// 	cout<<x;

}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	FASTIO;

	ll t = 1;
	// cin >> t;
	while (t--)
	{
		g_o_a_l();
	}

}

Measured memory_bytes: 3644
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Text.RegularExpressions;
    using System.Text;
     
    public class Program
    {
        public void Proc() {
            Reader.IsDebug = false;
            string inpt = Reader.ReadLine();
            bool isMirror = true;
            if(inpt.Length % 2 != 0) {
                isMirror = false;
            } else {
                for(int i=0; i<inpt.Length/2; i++) {
                    if(!IsMirrorChar(inpt[i], inpt[inpt.Length-1-i])) {
                        isMirror = false;
                         break;
                    }
                }
            }
            Console.WriteLine(isMirror?"Yes":"No");
       }

       private bool IsMirrorChar(char c1, char c2) {
           if(c1 == 'p') {
               if(c2 == 'q') {
                   return true;
               }
           } else if(c1 == 'q') {
               if(c2 == 'p') {
                   return true;
               }
           } else if(c1 == 'b') {
               if(c2 == 'd') {
                   return true;
               }
           } else if(c1 == 'd') {
               if(c2 == 'b') {
                   return true;
               }
           }
           return false;
       }


        public class Reader {
            public static bool IsDebug = true;
            private static System.IO.StringReader SReader;
            private static string InitText = @"



pdbq


";
            public static string ReadLine() {
                if(IsDebug) {
                    if(SReader == null) {
                        SReader = new System.IO.StringReader(InitText.Trim());
                    }
                    return SReader.ReadLine();
                } else {
                    return Console.ReadLine();
                }
            }
        }
        public static void Main(string[] args)
        {
            Program prg = new Program();
            prg.Proc();
        }
    }

Measured memory_bytes: 3032
package main

import (
	"fmt"
)

// Edge desu
type Edge struct {
	from  int
	to    int
	index int
}

var color []int
var edge [][]Edge
var K int

func main() {
	var N int
	fmt.Scan(&N)
	var deg []int
	var av, bv int
	var i = 0
	for i < N {
		var array []Edge
		edge = append(edge, array)
		deg = append(deg, 0)
		i++
	}
	i = 0
	for i < N-1 {
		fmt.Scan(&av, &bv)
		av--
		bv--
		color = append(color, -1)
		edge[av] = append(edge[av], Edge{av, bv, i})
		edge[bv] = append(edge[bv], Edge{bv, av, i})
		deg[av]++
		deg[bv]++
		i++
	}
	start := 0
	i = 0
	for i < N {
		if deg[i] == 1 {
			start = i
			break
		}
		i++
	}
	K = 0
	dfs(-1, 0, start)
	fmt.Println(K)
	for _, c := range color {
		fmt.Println(c)
	}
}

func dfs(from int, beforeColor int, at int) {
	edges := edge[at]
	var useColor = 1
	for _, e := range edges {
		to := e.to
		if to == from {
			continue
		}
		if useColor == beforeColor {
			useColor++
		}
		color[e.index] = useColor //色確定
		dfs(at, useColor, to)
		K = max(K, useColor)
		useColor++
	}
}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}


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

int main(int H, int M) {
    while (true) {
        cin >> H >> M;
        if (H == 0 && M == 0){
            break;
        }
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < M; j++) {
                if ((i+j)%2 == 0) {
                    cout << "#";
                }
                else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


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

int main(){
  int n; cin >> n;
  vector<int> p;
  p.push_back(2);
  int cnt[5];
  for(int i=3; i<=55555; i+=2){
    bool flag = false;
    for(int j=3; j*j<=i; j+=2){
      if(i%j == 0){
        flag = true;
        break;
      }
    }
    if(!flag && i%5==2) p.push_back(i);
  }
  rep(i, n) cout << p[i] << " ";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int H, W;
string S[1010];
int d[1010][1010];
int vx[] = { 0,1,0,-1 };
int vy[] = { 1,0,-1,0 };
struct point {
	int x, y;
};
queue<point> que;
void bfs() {
	while (!que.empty()) {
		point now = que.front();
		que.pop();
		for (int i = 0; i < 4; i++) {
			int nx = now.x + vx[i];
			int ny = now.y + vy[i];
			if (nx < 0 || nx >= W || ny < 0 || ny >= H ||
				d[ny][nx] != mod || S[ny][nx] == '#') continue;
			d[ny][nx] = d[now.y][now.x] + 1;
			que.push({ nx,ny });
		}
	}
}
int main()
{
	cin >> H >> W;
	for (int i = 0; i < H; i++) cin >> S[i];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				que.push({ j,i });
				d[i][j] = 0;
			}
			else d[i][j] = mod;
		}
	}
	bfs();
	int ans = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			ans = max(ans, d[i][j]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 13456
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        int money = int.Parse(ReadLine());
        int checker = money/100;
        int max = 5*checker;
        if(money % 100 <= max){
            WriteLine(1);
        }else{
            WriteLine(0);
        }
    }
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

int main() {
  vector<vector<char>> grid(3, vector<char> (3));
  rep(i, 0, 3) {
    rep(j, 0, 3) {
      cin >> grid[i][j];
    }
  }

  rep(i, 0, 3) {
    cout << grid[i][i];
  }

  cout << endl;
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int,pair<int,char>>
#define sorted(a_1) sort(a_1.begin(),a_1.end())
#define rsorted(a_1) sort(a_1.rbegin(),a_1.rend())
#define t1(a_1) cout<<a_1<<endl;
#define t2(a_1) for(auto it_test : a_1) cout<<it_test<<" ";
#define MOD 1000000007

// int dfs(char **adj,int n, int m, int x, int y){
	
// 	int a[2] = {1,0};
// 	int b[2] = {0,1};
// 	for(int i=0;i<2;i++){
// 		int x1 = x + a[i];
// 		int y1 = y + b[i];
// 		if(x1<n && y1<m){

// 		}
// 	}
// }
void solve(){
    int n,m;
    cin>>n>>m;
    char **arr = new char*[n];
    for(int i=0;i<n;i++){
    	arr[i] = new char[m];
    	for(int j=0;j<m;j++){
    		cin>>arr[i][j];
    	}
    }
    vector<vector<ll>>dp(n,vector<ll>(m,0LL));
    for(int i=0;i<n;i++){
    	for(int j=0;j<m;j++){
    		if(i==0 && j==0) dp[i][j] = 1;
    		else if(i==0 && arr[i][j]!='#') dp[i][j] += dp[i][j-1];
    		else if(j==0 && arr[i][j]!='#') dp[i][j] += dp[i-1][j];
    		else if(arr[i][j]=='.'){
    			dp[i][j] = (dp[i][j-1]%MOD + dp[i-1][j]%MOD)%MOD;
    		}
    	}
    }
    // dfs(arr,n,m,0,0);
    cout<<dp[n-1][m-1];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    while(t--){
        solve();
    }

return 0;
}

Measured memory_bytes: 12080
N = int(input())
L = [int(i)for i in input().split()]
ans = 0
L.sort(reverse=True)
for i,l in enumerate(L[:-2]):
    for j,l2 in enumerate(L[i+1:N-1]):
        for l3 in L[i+j+2:]:
            if l < l2 + l3:
                if l > l2 > l3:
                    ans += 1
            else:
                break
print(ans)

Measured memory_bytes: 73584
from collections import deque

n = int(input())
matches = []
for _ in range(n):
    matches.append(list(map(lambda x: int(x)-1, input().split())))

q = deque(range(n))

days = [0]*n  # 各選手の現在の日付
pairs = [-1]*n  # 次の対戦相手を管理(wait的な)

while q:
    x = q.popleft()  # 試合する人
    if len(matches[x]) == 0:  # 試合が全て終わってる?
        continue
    y = matches[x].pop(0)  # xの次の対戦相手
    if pairs[y] == x:
        day = max(days[x], days[y])+1
        days[x] = day
        days[y] = day
        q.append(x)
        q.append(y)
    else:
        pairs[x] = y

if not any(matches):  # 全ての試合をしょうか
    print(max(days))
else:
    print(-1)


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

int main() {
	int a, b, c;
	while (cin >> a >> b) {
		int d = 1;
		c = a + b;
		while (c/ 10 >= 1) {
			c /= 10;
			d++;
		}
	cout << d << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, W = getNM()
query = [getList() for i in range(N)]
wei = []
val = []
for i in range(N):
    w, v = query[i]
    wei.append(w)
    val.append(v)

wei_min = min(wei)
for i in range(N):
    wei[i] -= wei_min

def part_sum_5(n, k, limit, wei, val):
    dp = [[[0] * (limit + 1) for i in range(k + 1)] for i in range(n + 1)]

    for i in range(1, n + 1):
        for j in range(1, k + 1):
            for l in range(limit + 1):
                dp[i][j][l] = dp[i - 1][j][l]
                if l - wei[i - 1] >= 0:
                    dp[i][j][l] = max(dp[i - 1][j][l], dp[i - 1][j - 1][l - wei[i - 1]] + val[i - 1])

    res = 0
    for i in range(n + 1):
        for j in range(limit + 1):
            if i * wei_min <= (W - j):
                res = max(res, dp[N][i][j])

    return res

print(part_sum_5(N, N, 301, wei, val))

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;


void solve(){
	int h,n;
	cin>>h>>n;
	int sm=0,k;
	rep(i,n){
		cin>>k;
		sm+=k;
	}
	if(sm>=h) cout<<"Yes";
	else cout<<"No";

}

int main(){
	fast_io
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

	while ( true )
	{
		int n, m, p;
		cin >> n >> m >> p;

		if ( !( n | m | p ) )
		{
			break;
		}

		VI xs( n );
		FOR( x, xs )
		{
			cin >> x;
		}

		int total = accumulate( ALL( xs ), 0 ) * 100;
		double rest = 1. * total * ( 100 - p ) / 100;

		if ( xs[ m - 1 ] == 0 )
		{
			cout << 0 << endl;
		}
		else
		{
			cout << (int)( rest / xs[ m - 1 ] ) << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;


int main() {
  int num[3];
  REP(i,3) {
    cin >> num[i];
  }
  int temp = 0;
  while(num[0] > num[1] || num[1] > num[2])
    REP(i,2) {
      if(num[i] > num[i+1]) {
        temp = num[i+1];
        num[i+1] = num[i];
        num[i] = temp;
        }
  }

  cout << num[0] << " " << num[1] << " " << num[2] << endl;
  return 0;
}



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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

ll gcd(ll a, int b)
{
    if (a < b)
        gcd(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

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

    bool f = false;
    for (int i = 1; i <= b; i++)
    {
        if ((a * i) % b == c)
            f = true;
    }

    if (f)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  for(int i = 0; i <= 100000; ++i){
    int a = i*8/100, b = i*10/100;
    if(a == A and b == B){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v <= w:
    print('NO')
    exit()
else:
    that = abs(b-a)/(v-w)
    if 0 <= that <= t:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 9184
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
string A, B, C;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> A >> B >> C;

    cout << (A[A.size()-1]==B[0]&&B[B.size()-1]==C[0] ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int main()
{
	int flag=0,i;
	char a[10];
	scanf("%s",a);
	if(a[0]!='A'||(a[1]>='A'&&a[1]<='Z')||(a[strlen(a)-1]>='A'&&a[strlen(a)-1]<='Z'))
	{
		printf("WA");
		return 0;
	}
	for(i=2;i<strlen(a)-1;i++)
	{
		if((a[i]>='A'&&a[i]<='Z')&&a[i]!='C')
		{
			printf("WA");
			return 0;
		}
		if(flag&&a[i]=='C')
		{
			printf("WA");
			return 0;
		}
		if(a[i]=='C')
			flag=1;
	}
	if(!flag)
	{
		printf("WA");
		return 0;
	}
	printf("AC");
	return 0;
}

Measured memory_bytes: 256