akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
long long p = 1000003;
long long rui(long long xx, long long y) {
	if (y == 0)return 1;
	if (y == 1)return xx;
	if (y == 2)return xx * xx % p;
	if (y % 2)return rui(rui(xx, y / 2), 2) * xx % p;
	else return rui(rui(xx, y / 2), 2);
}
long long inv(long long xx) {
	return rui(xx, p - 2);
}
long long kai[1000005];
long long q, x, d, n, m, l;
int main() {
	kai[0] = 1;
	for (int i = 1; i < 1000005; i++) {
		kai[i] = i * kai[i - 1] % p;
	}
	scanf("%lld", &q);
	for (int i = 0; i < q; i++) {
		scanf("%lld%lld%lld", &x, &d, &n);
		if (d == 0) {
			printf("%ld\n", rui(x, n));
		}
		else {
			if (n >= p)printf("0\n");
			else {
				m = x * inv(d) % p;
				if (m == 0)printf("0\n");
				else {
					l = m + n - 1; l %= p;
					if (m > l)printf("0\n");
					else {
						printf("%lld\n", rui(d, n) * kai[l] % p * inv(kai[m - 1]) % p);
					}
				}
			}
		}
	}
}

Measured memory_bytes: 8576
f [x,y] = (x,y)

btoy b = b * 380000
toy :: (String,String) -> Float
toy (y,"JPY") = read y
toy (b,"BTC") = btoy $ read b

main = do
  getLine
  ys <- map (f.words) . lines <$> getContents
  print $ sum $ map toy ys


Measured memory_bytes: 636
import java.util.*

fun main(vararg args: String) {
    val scanner = Scanner(System.`in`)
    val num = scanner.nextInt()
    val list = mutableListOf<Int>()
    for (i in 0 until num) {
        list.add(scanner.nextInt())
    }

    val max = list.max() ?: 0
    val canWrite = max < list.reduce { x1, x2 -> x1 + x2} - max

    println(if (canWrite) "Yes" else "No")
}

Measured memory_bytes: 29604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

int main(){
    int N,W; cin >> N >> W;
    int w[101],v[101];
    for(int i = 1; i <= N; i++){
        cin >> w[i] >> v[i];
    }
    int dp[101][100100] = {0};
    for(int i = 1; i <= 1e5; i++) dp[0][i] = MOD;

    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= 100000; j++){
            dp[i][j] = dp[i-1][j];
            if(j >= v[i]){
                dp[i][j] = min(dp[i][j], w[i] + dp[i-1][j-v[i]]);
            }
        }
    }
    ll ans = 0;
    for(ll i = 1e5; i >= 0; i--){
        if(dp[N][i] <= W){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 39680
package main

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

var stdin = bufio.NewScanner(os.Stdin)
var wtr = bufio.NewWriter(os.Stdin)

func main() {
	l := strings.Split(readline(), " ")
	a, _ := strconv.Atoi(l[0])
	b, _ := strconv.Atoi(l[1])

	times := a * b

	s := "Odd"

	if times%2 == 0 {
		s = "Even"
	}

	fmt.Println(s)

	_ = wtr.Flush()
}

func readline() string {
	stdin.Scan()
	return stdin.Text()
}


Measured memory_bytes: 640
import scala.io.Source.stdin

object Main {
  def find(s:Double,i:Int,l:IndexedSeq[Double],d:Double):Int =
    if( s >= d ) i else find(s+l(i),i+1,l,d)

  def main(args:Array[String]) = {
    for(l<-stdin.getLines.map(s=>s.split(",").map(_.toDouble))) {
      val sum = l.take(10).sum
      val d = sum*l(10)/(l(10)+l(11))
      println(find(0D,0,l,d))
    }
  }
}

Measured memory_bytes: 43728
#include <bits/stdc++.h>
using namespace std;
#define	rep(i,n)	for(int i=0;i<n;i++)
int main(){
  int n;	cin >> n;
  vector<pair<long long,long long>>	ab(n);
  rep(i,n)	cin >> ab[i].second >> ab[i].first;
  sort(ab.begin(),ab.end());
  
  long long time=0;
  rep(i,n){
    time+=ab[i].second;
    if(ab[i].first<time){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}

Measured memory_bytes: 6368
#![allow(non_snake_case)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        s: chars
    );
    let mut array: [i32; 26] = [0; 26];
    for c in s {
        array[(c as usize) - 65] += 1;
    }
    // for (i, num) in array.iter().enumerate() {
    //     println!("{}: {}", ((i + 65) as u8) as char, num);
    // }
    for &num in array.iter() {
        // 1,3,4 がアウト
        if (num != 0) && (num != 2) {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  int N;
  cin >> N;

  map<ll,ll> m;
  m[0] = 1;

  ll sum = 0;
  for(int i = 0; i < N; i++){
    ll tmp;
    cin >> tmp;
    sum += tmp;
    m[sum]++;
  }

  ll ans = 0;
  for(auto x: m){
    ans += x.second * (x.second-1) / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 12800
using System;
class Program {
  static void Main(string[] args) {
    int[,] g = new int[3,3];

    for (int i = 0; i < 3; ++i) {
      string[] val = Console.ReadLine().Split();
      for (int j = 0; j < 3; ++j) {
        g[i,j] = int.Parse(val[j]);
      }
    }

    int a1max = Math.Min(g[0,0], Math.Min(g[0,1], g[0,2]));

    int[] A = new int[3];
    int[] B = new int[3];
    bool ok = false;
    while (A[0] <= a1max) {
      for (int i = 0; i < 3; ++i) {
        B[i] = g[0,i] - A[0];
      }
      A[1] = g[1,0] - B[0];
      A[2] = g[2,0] - B[0];
      if (A[1] >= 0 && A[2] >= 0) {
        ok = true;
        for (int i = 1; i < 3; ++i) {
          for (int j = 1; j < 3; ++j) {
            if (A[i] + B[j] != g[i, j]) ok = false;
          }
        }
        if (ok) break;
      }
      ++A[0];
    }

    if (ok) {
      Console.WriteLine("Yes");
    } else {
      Console.WriteLine("No");
    }
  }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n,m;
  cin >> n >> m;
  vector<vector<int>> a(n);
  vector<int> inDegree(n,0);
  for(int i=0;i<m;i++) {
    int u,v; 
    cin >> u >> v;
    u--; v--;
    a[u].push_back(v);
    inDegree[v]++;
  }
  vector<int> dist(n,0);
  queue<int> q;
  for(int i=0;i<n;i++) {
    if (inDegree[i] == 0)
      q.push(i);
  }
  while(!q.empty()) {
    auto u = q.front();
    q.pop();
    for(auto child: a[u]) {
      inDegree[child]--;
      if (inDegree[child] == 0) {
        q.push(child);
        dist[child] = dist[u] + 1;
      }
    }
  }
  int ans = *max_element(dist.begin(),dist.end());
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;

void ansYes(bool flag){
    if (flag) cout << "Yes" << endl; else  cout << "No" << endl;
}

void ansYES(bool flag){
    if (flag) cout << "YES" << endl; else  cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

struct datas{
    Int max;
    Int size;
};


int main(void) {
    Int a, b , m;
    cin >> a  >> b >> m;
    vector<Int> rei(a);
    vector<Int> ren(b);
    Int minirei = 1000000;
    Int miniren = 1100000;
    REP(a,i) {
        cin >> rei.at(i);
        minirei = min(rei.at(i),minirei);

    }
    REP(b,i){
        cin >> ren.at(i);
        miniren = min(ren.at(i),miniren);
    }
    Int Mini = minirei + miniren;
    REP(m,i){
        Int x , y , c;
        cin >> x >> y >> c;
        x--;
        y--;
        Mini = min(rei.at(x) + ren.at(y) - c,Mini);
    }
    cout << Mini << endl;
}




Measured memory_bytes: 1792
function main(input) {                                                                           
    const args = input.split(' ');                                                               
    const x = parseInt(args[0], 10);                                                             
    const a = parseInt(args[1], 10);                                                             
                                                                                                 
    if (x < a) {                                                                                 
        console.log('0');                                                                        
    } else {                                                                                     
        console.log('10');                                                                       
    }                                                                                            
}                                                                                                
                                                                                                 
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define SANKOU(n, a, b) cout << ((n) ? (#a) : (#b)) << endl
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>

int N, A, B, C, D;
string S;
int s[200010];
bool flag = true, f = true;
void solve()
{
    for (int i = 0; i < N; i++) {
        if (S[i] == '#') {
            s[i + 1]++;
        }
    }
    if (C < B) {
        FOR(i, A, C)
        {
            if (s[i] && s[i + 1]) {
                flag = false;
                break;
            }
        }
        FOR(i, C, D)
        {
            if (s[i] && s[i + 1]) {
                flag = false;
                break;
            }
        }


    } else if (C < D) {
        FOR(i, A, D)
        {
            if (s[i] && s[i + 1]) {
                flag = false;
                break;
            }
        }
    } else {

        FOR(i, A, C)
        {
            if (s[i] && s[i + 1]) {
                flag = false;
                break;
            }
        }
        f = false;
        FOR(i, B - 1, D)
        {
            if (!(s[i] + s[i + 1] + s[i + 2])) {
                f = true;
                break;
            }
        }
    }
    if (f && flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main()
{
    cin >> N >> A >> B >> C >> D >> S;
    solve();
    return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MAX 1000000007
#define MAXN 100005
bool sortby1column(vector<ll> &v1,vector<ll> &v2){
 return v1[0]<v2[0];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //cin>>t;
    for(int cc=1;cc<=t;cc++){
        //cout<<"Case #"<<cc<<":\n";
        ll ans=0,n;
        cin>>n;
        for(int i=1;i<=n;i++){
            if(i%3!=0&&i%5!=0)
                ans+=i;
        }
        cout<<ans<<endl;                
    }
}

Measured memory_bytes: 3652
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    long[] a = new long[n];
    for (int i = 0; i < n; i++) {
      a[i] = Long.parseLong(sc.next());
    }
    long[][] dp = new long[n + 1][2];
    dp[0][0] = 0;
    dp[0][1] = Integer.MIN_VALUE;

    for (int i = 0; i < n; i++) {
      dp[i + 1][0] = Math.max(dp[i][0] + a[i], dp[i][1] - a[i]);
      dp[i + 1][1] = Math.max(dp[i][0] - a[i], dp[i][1] + a[i]);
    }
    pw.println(dp[n][0]);
  }
}


Measured memory_bytes: 48136
import java.util.*;
class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        /*try {
            while(true){*/
                int N = sc.nextInt();
                System.out.println(fact(N));
            /*}
        //}catch(InputMismatchException e){}*/
    }

    /*public static long fact(long N){
        if(N==1) return 1;
        else {
            long r = (N * fact(N-1)) % ((long)Math.pow(10,9)+7);
            return r ;
        }
    }*/
    public static long fact(int N){
        long res = 1;
        for(int i = 1; i<=N; i++){
            res = (res * i) % ((int)Math.pow(10, 9) + 7);
        }
        return res;
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

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

const int INF = 100000002;

int main(){
	int n, m; cin >> n >> m;
	vi a(m);
	ll day = 0; 
	rep(i,m){
		int a; cin >> a;
		day += a;
	}
	cout << ((n - day)>=0 ?(n-day): -1) << endl;
}

Measured memory_bytes: 3672
///
//AOJのの回答プログラム
// create:20180908
//


#include <iostream>
using namespace std;
int main(void)
{
	int a,b = 0;

	cin >> a>>b;
	cout << a * b << " " << 2 * a + 2 * b << "\n";
	return 0;
}





Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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 Clear(a) a = decltype(a)();
typedef long long ll;
typedef pair<int,int> p;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
const ll big=998244353;
const ll bbig=1000000007;
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (exp(x,y-1)*x)%bbig;
    ll t=exp(x,y/2);
    return (t*t)%bbig;
}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll in(ll x){
    return exp(x,bbig-2);
}
/*ll com(ll x,ll y){
    ll ans=1;
    rep(i,y){ans*=x-i;ans%=bbig;}
    rep(i,y){ans*=in(i+1);ans%=bbig;}
    return ans;
}*/

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(0);
    /*--------------------------------*/
    
    int a;cin >> a;
    cout << a+a*a+a*a*a << endl;
}

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

using ll = long long;

int main() {
    //dp[i][j] i番目のコインまででj円を払うときの枚数の最小値
    int n, m;
    cin >> n >> m;
    vector<int> c(m);
    rep(i, m) cin >> c[i];
    vector<vector<int>> dp(m + 1, vector<int>(n + 1, 1e9));
    dp[0][0] = 0;
    rep(i, m) {
        rep(j, n + 1) {
            dp[i + 1][j] = dp[i][j];
            if (j >= c[i]) dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - c[i]] + 1);
        }
    }
    cout << dp[m][n] << "\n";
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    int n = s.length();

    vector<int> v;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'A') {
            v.push_back(1);
        } else if (i < n - 1 && s[i] == 'B' && s[i + 1] == 'C') {
            v.push_back(0); i++;
        } else {
            v.push_back(inf);
        }
    }
    int m = v.size();

    ll ans = 0;
    int zero = 0;
    int i = 0;
    while (i < m) {
        int j = i;
        while (j < m && v[j] < inf) j++;
        for (int k = i; k < j; k++) {
            if (v[k] == 0) zero++;
        }
        for (int k = i; k < j; k++) {
            if (v[k] == 1) ans += zero;
            if (v[k] == 0) zero--;
        }
        i = j + 1;
    }
    cout << ans << endl;
    return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 200000 + 10;

ll modFact[MAX];
ll modInv[MAX];
ll modFactInv[MAX];

// calc nCr % mod
ll comb(int n, int r) {
  return modFact[n] * (modFactInv[r] * modFactInv[n - r] % MOD) % MOD;
}

void init() {
  modFact[0] = modFact[1] = 1;
  modFactInv[0] = modFactInv[1] = 1;
  modInv[1] = 1;

  REP (i, 2, MAX) {
    modFact[i] = modFact[i - 1] * i % MOD;
    modInv[i] = MOD - modInv[MOD % i] * (MOD / i) % MOD;
    modFactInv[i] = modFactInv[i - 1] * modInv[i] % MOD;
  }
}

int main() {
  init();

  int N, M, K;
  cin >> N >> M >> K;

  ll ans = 0;

  rep (i, N) {
    ans = (ans + 1LL * i * (N - i) % MOD * M % MOD * M % MOD) % MOD;
  }

  rep (i, M) {
    ans = (ans + 1LL * i * (M - i) % MOD * N % MOD * N % MOD) % MOD;
  }

  ans = ans * comb(N * M - 2, K - 2) % MOD;

  cout << ans << endl;
}


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


using namespace std;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

template<class T> inline bool chmin(T& a, T b) {
  //aの方が大きければbに値を更新、そうでなければ何もしない
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
bool compare_a_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが小さい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second < r.second;
  }
}
bool compare_a_b_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが大きい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second > r.second;
  }
}
bool compare_b_small(pair<int,int> l,pair<int,int> r){
  //secondが小さい方からソート、firstが同じならfirstが小さい方から
  if(l.second != r.second){
    return l.second<r.second;
  }
  else{
    return l.first < r.first;
  }
}
const int INF = 1e9;
const int M = 1000000007;


typedef long long int ll;
vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算、a,b<=300000でないと使えない
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}



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

  int sum = 0;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    sum +=a;
  }

  if(h<=sum) printf("Yes\n");
  else printf("No\n");



}


Measured memory_bytes: 4992
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		while(sc.hasNext()){
			int N = sc.nextInt();
			int[] arr = new int[N];
			for(int i=0;i<arr.length;i++){
				arr[i] = sc.nextInt();
			}
			int q = sc.nextInt();
			int[] target = new int[q];
			for(int i=0;i<q;i++){
				target[i] = sc.nextInt();
			}
			for(int i=0;i<q;i++){
				List<Integer> path = new ArrayList<Integer>();
				List<List<Integer>> res = new ArrayList<List<Integer>>();
				dfs(arr,target[i],path,res,0);
				if(res.size()>0){
					System.out.println("yes");
				}else{
					System.out.println("no");
				}
			}
		}
	}
	public static void dfs(int[] nums,int target,List<Integer> path,List<List<Integer>> res,int index){
		if(res.size()>0) return;
		if(target==0){
			res.add(new ArrayList<Integer>(path));
		}
		if(target<0 || index>=nums.length){
			return ;
		}
		for(int i=index;i<nums.length;i++){
			path.add(nums[i]);
			dfs(nums,target-nums[i],path,res,i+1);
			path.remove(path.size()-1);
		}
	}
}

Measured memory_bytes: 29272
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	b%=MOD;
	int ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int dp[310][310];

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n,k; cin>>n>>k;
	vector<int> v(n+1);
	v[0]=0;
	For(i,1,n) cin>>v[i];
	For(i,0,n) dp[i][1]=v[i],dp[i][0]=0;
	For(i,1,n) dp[0][i]=INF;
	For(i,1,n) For(j,2,n){
		dp[i][j]=INF;
		For(l,0,i-1) dp[i][j]=min(dp[i][j],dp[l][j-1]+max(0ll,v[i]-v[l]));
		cerr<<dp[i][j]<<"\t\n"[j==n];
	}
	int ans=INF;
	For(i,0,n) ans=min(ans,dp[i][n-k]);
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, i, j;
    vector <int> v;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        v.push_back(x);
    }
    
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    
    if (v[0] != v[1] || v.back() <= (v[0] - 1) / 2) {
        puts("Impossible");
        
        return 0;
    }
    
    if (v[0] == 1) {
        if (n == 2) {
            puts("Possible");
        } else {
            puts("Impossible");
        }
        
        return 0;
    }
    
    for (i = 1; i < v[0]; i++) {
        for (j = 0; j < n; j++) {
            if (v[j] == v[0] - (i + 1) / 2) {
                v[j] = -1;
                
                break;
            }
        }
        
        if (j == n) {
            puts("Impossible");
            
            return 0;
        }
    }
    
    for (i = 0; i < n; i++) {
        if (v[i] == v[0] - v[0] / 2) {
            puts("Impossible");
            
            return 0;
        }
    }
    
    puts("Possible");
    
    return 0;
}


Measured memory_bytes: 256
/*２つの整数 a, b を読み込んで、a と b の大小関係を出力するプログラム*/

#include <stdio.h>

int main(){
    
    int a,b;
    
    do{
        scanf("%d %d",&a, &b);
    }while(a<-1000 || a>1000 || b<-1000 || b>1000); /*-1,000 ≤ a, b ≤ 1,000を満たすまで繰り返される*/
    
    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    
    return 0;
}


Measured memory_bytes: 2036
package main

import "fmt"

func main() {

	var a1, a2, a3 int
	fmt.Scan(&a1, &a2, &a3)
	
	result := a1 + a2 + a3
	
	if result >= 22 {
		fmt.Println("bust")
	} else if result < 22 {
		fmt.Println("win")
	}

}

Measured memory_bytes: 512
using System;
class Program{
	static void Main(){
		int s=int.Parse(Console.ReadLine());
		string a="No";
		for(int i=0;i<=100;i+=4){
			for(int j=0;j<=100;j+=7){if(i+j==s){a="Yes";break;}}
		}
		Console.WriteLine("{0}",a);
	}
}

Measured memory_bytes: 13140
//#include"bits/stdc++.h"
#include<iostream>
#include<ostream>
#include<vector>
#include<string>
#include<algorithm>

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)



using namespace std;
using ll = long long;



void solve();

int main() {

   solve();
   return 0;

}

void solve() {

	ll w, h, l;
	vector<pair<ll, pair<ll, ll>>> v;

	FOR(h_, 1, 200) {
		FOR(w_, h_ + 1, 200) {
			v.push_back(make_pair(h_*h_ + w_*w_, make_pair(h_, w_)));
		}
	}
	sort(v.begin(), v.end());

	while (cin >> h>>w,h) {
		l = h*h + w*w;
		for (vector<pair<ll, pair<ll, ll>>>::iterator it = v.begin(); it < v.end(); it++) {
			if (it->first == l && it->second.first == h) {
				cout << (it+1)->second.first << ' ' << (it+1)->second.second << endl;
				break;
			}
		}

	}
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <math.h>

int main(void){
	char ball='A',c1,c2;
	while(scanf(" %c,%c",&c1,&c2)!=EOF){
		if(c1==ball)ball=c2;
		else if(c2==ball)ball=c1;
	}
	printf("%c\n",ball);
	return 0;
}

Measured memory_bytes: 540
#include<bits/stdc++.h>
typedef long long ll;
#define iof ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pi 3.1415926535897
const ll mod =1000000007;
#define inf 100000
using namespace std;
int main()
{
    string s;
     cin>>s;
     ll n=s.size();
    ll dp[13][n];
    for(ll i=0;i<13;i++)
    {
        for(ll j=0;j<n;j++)
            dp[i][j]=0;
    }
    //dp[0][0]=1;
    if(s[0]=='?')
    {
        for(ll i=0;i<10;i++)
        {
            dp[i][0]++;
        }
    }
    else
    {
        dp[s[0]-'0'][0]++;
    }
    for(ll i=1;i<n;i++)
    {
        if(s[i]=='?')
        {
            for(ll k=0;k<10;k++)
            {
                for(ll j=0;j<13;j++)
                {
                    ll x= (j*10+k)%13;
                    dp[x][i]= (dp[x][i]+dp[j][i-1])%mod;
                }
            }
        }
        else
        {
            ll y= s[i]-'0';
            for(ll j=0;j<13;j++)
            {
               ll x= (y+j*10)%13;
                dp[x][i]= (dp[x][i]+dp[j][i-1])%mod;
            }
        }
    }
    cout<<dp[5][n-1];
}




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

typedef pair<int,int> P;
const int HMAX = 1005, WMAX = 1005;
int W, H;
P par[HMAX][WMAX];
int lank[HMAX][WMAX];
char field[HMAX][WMAX];
const int DX[4] = {0, 1, 0, -1}, DY[4] = {1, 0, -1, 0};

void init() {
  REP(y, H) REP(x, W) {
    par[y][x] = make_pair(y, x);
    lank[y][x] = 0;
  }
}

P find(P p) {
  if (par[p.first][p.second] == p) {
    return p;
  } else {
    return par[p.first][p.second] = find(par[p.first][p.second]);
  }
}

void unite(P i, P j) {
  i = find(i);
  j = find(j);
  if (i == j) return;
  int li = lank[i.first][i.second], lj = lank[j.first][j.second];
  if (li < lj) {
    par[i.first][i.second] = j;
    return;
  } else {
    par[j.first][j.second] = i;
    if (li == lj)
      lank[i.first][i.second]++;
    return;
  }
}

bool same(P i, P j) {
  return find(i) == find(j);
}

bool islegal(P p) {
  int y = p.first, x = p.second;
  return 0 <= x and x <= W and 0 <= y and y < H;
}

bool is_floor(int y, int x, char c) {
  return islegal(P(y, x)) && field[y][x] == c;
}

int main() {
  cin >> W >> H;
  P start = P(0, 0), tr;
  REP(y, H) {
    string row;
    cin >> row;
    REP(x, W) {
      field[y][x] = row[x];
    }
  }
  init();
  REP(y, H) REP(x, W) {
    P p(y, x);
    if (field[y][x] == '#') continue;
    if (field[y][x] == 't') {
      tr = p;
      field[y][x] = '.';
    }
    REP(i, 4) {
      P n(y + DY[i], x + DX[i]);
      if (is_floor(n.first, n.second, '.')) unite(p, n);
    }
  }
  int t;
  cin >> t;
    if (same(tr, start)) {
      cout << 0 << endl;
      return 0;
    }
  for (int i = 1; i <= t; i++) {
    int x, y;
    cin >> x >> y;
    field[y][x] = '.';
    REP(dir, 4) {
      int ny = y + DY[dir], nx = x + DX[dir];
      if (is_floor(ny, nx, '.')) unite(P(ny,nx),P(y,x));
    }
    if (same(tr, start)) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 14032
from sys import exit
# A,B,C = [int(n) for n in input().split()]
N = int(input())
b = [int(n) for n in input().split()]
test = [i for i in range(1,N+1)]
ans = []
i = N
while(i != 0):#for i in range(N,0,-1)
    # print(i)
    if b[i-1] == i:
        ans.append(b[i-1])
        del b[i-1]
        i = len(b)
    else:
        i-=1
    if len(b) == 0:
        for l in range(len(ans)-1,-1,-1):
            print(ans[l])
        exit()

print(-1)

# S = str(input())
# L = len(S)
# T = str(input())
exit()


Measured memory_bytes: 3064
# AOJ 0029 English Sentence
# Python3 2018.6.12 bal4u

import collections
from operator import itemgetter

a = list(input().split())
maxlen = 0
for i in a:
	if len(i) > maxlen:
		maxlen = len(i)
		ans_max_len = i

dict = collections.Counter(a)
print(max(dict.most_common(), key=itemgetter(1))[0], ans_max_len)


Measured memory_bytes: 5968
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (i * j + (n - i) * (m - j) == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main() {
	
    long long  n,i,j,k,sum=0,count=0,ans=0,l,r,x,y,x1,x2;
	cin>>n;
	string s;
	cin>>s;
	vector<long long >v[3];
	for(i=0;i<n;i++)
	{
	    if(s[i]=='R')
	    v[0].push_back(i);
	    else if(s[i]=='G')
	    v[1].push_back(i);
	    else
	    v[2].push_back(i);
	}
	
	for(l=0;l<3;l++)
	{
	    x1,x2;
	    if(l==0)
	    {
	        x1=1;
	        x2=2;
	        
	    }
	    else if(l==1)
	    {
	        x1=0;
	        x2=2;
	    }
	    else
	    {
	        x1=0;
	        x2=1;
	    }
	    
	    count=0;
	  while(count<2)
	  {
	      swap(x1,x2);
   	    for(i=0;i<v[l].size();i++)
	    {
	    j=upper_bound(v[x1].begin(),v[x1].end(),v[l][i])-v[x1].begin();
	    if(j==v[x1].size())
	    break;
	    for(x=j;x<v[x1].size();x++)
	    {
	        k=v[x1][x]-v[l][i];
	        y=upper_bound(v[x2].begin(),v[x2].end(),v[x1][x])-v[x2].begin();
	        if(y==v[x2].size())
	        break;
	        ans+=v[x2].size()-y;
	        y=lower_bound(v[x2].begin(),v[x2].end(),v[x1][x]+k)-v[x2].begin();
	        if(v[x2][y]==(v[x1][x]+k))
	        ans--;
	    }
	    }
	    count++;
	  }
	}
	cout<<ans;
	return 0;
}

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

int main(){
  long long n,k,cnt=0,cnt1=0;
  cin >> n >> k;
  for(int i=1;i<=n;i++){
    if(i%k==0) cnt++; 
    if(k%2==0&&i%k==k/2) cnt1++;
  }
  if(k%2) cout << cnt*cnt*cnt << endl;
  else cout << cnt*cnt*cnt + cnt1*cnt1*cnt1 << endl;
}


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

string s;
int K;
set<string> subs;

int main () {
  cin >> s >> K;
  int N = s.size();

  for(int i = 0; i < N; i++) {
    for(int j = 1; j <= K && i + j - 1 < N; j++) {
      subs.insert(s.substr(i, j));
      while(subs.size() > K) subs.erase(prev(subs.end()));
    }
  }

  cout << *(subs.rbegin()) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N
#define ll long long
#define db double
#define dbg1(x) cerr<<#x<<"="<<x<<" "
#define dbg2(x) cerr<<#x<<"="<<x<<"\n"
int T;ll a,b,c,d;
int main()
{
	for(scanf("%d",&T);T--;)
	{
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if(a<b) {puts("No");continue;}
		if(b>d) {puts("No");continue;}
		if(c>=b) {puts("Yes");continue;}
		a%=b,d%=b;
		if(a>c) {puts("No");continue;}
		ll g=std::__gcd(b,d);
		ll tmp=(b-a-1)/g;
		if(a+tmp*g>c) {puts("No");continue;}
		puts("Yes");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
using namespace std;
int main(void){
    // Your code here!
    int n,k;
    cin>>n>>k;
    
    vector<int> vec(n+1,0);
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        vec[a]++;
        
    }
    
    vector<int> nv;
     for(int i=0;i<=n;i++){
        if(vec[i]!=0)
            nv.push_back(vec[i]);
        
    }
    
    sort(nv.begin(), nv.end());

int count=0;
    if(nv.size()>k){
        int diff= nv.size()-k;
        int i=0;
        while(diff--){
            count+=nv[i];
            i++;
        }
        cout<<count;
    }else{
        cout<<0;
    } 

}


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

#define each(i, c) for (auto& i : c)

typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }

  ll prev = a[0];
  ll pos = 0;
  for (ll i = 1; i < n; ++i) {
    if (a[i] < prev) {
      pos = i;
      prev = a[i];
    }
  }
  
  ll ans = 0;
  ll base = pos;
  ll d = k - 1;
  ll c = 1;
  bool r = true;
  while (c < n) {
    ++ans;
    for (ll i = 0; i < d; ++i) {
      pos += r ? 1 : -1;
      if (pos == n) {
        pos = base;
        r = false;
      }
      ++c;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
 
using namespace std;
 
int main(){
    long long N,H;
    cin>>N>>H;
    vector <long long>a(N);
    vector <long long>b(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
        cin>>b[i];
    }
    long long ans=0;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    for(long long i=N-1 ; i>=0 ; i--){
        if(a[N-1]<=b[i] && H>0){
           H-=b[i];
           ans+=1;
        }
    }
    if(H>0){
        ans+=H/a[N-1];
        if(H%a[N-1]!=0)ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define REP(i,n) for (int i=0;i<(n);++i)

using namespace std;

int main() {
    constexpr int N_MAX = 100;
    constexpr int C_MAX = 1000;
    constexpr int INF = N_MAX * C_MAX;

    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M), c(M);
    vector<vector<int>> dp(N, vector<int>(N, INF));
    REP(i, M) {
        cin >> a[i] >> b[i] >> c[i];
        --a[i];
        --b[i];
        dp[a[i]][b[i]] = c[i];
        dp[b[i]][a[i]] = c[i];
    }

    REP(k, N) REP(i, N) REP(j, N) {
        if (dp[i][j] > dp[i][k] + dp[k][j]) {
            dp[i][j] = dp[i][k] + dp[k][j];
        }
    }

    int result = 0;
    REP(i, M) {
        if (dp[a[i]][b[i]] < c[i]) {
            ++result;
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::Ordering;

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get {
    ([$t: ty]) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

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

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (a, b, c, d) = get!(usize, usize, usize, usize);
    let t1 = (c + b - 1) / b;
    let t2 = (a + d - 1) / d;
    if t1 > t2 {
        println!("No");
    } else {
        println!("Yes");
    }
}


Measured memory_bytes: 2264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int MAX=100003,INF=1<<30;
ll mod;

typedef vector<vector<ll>> mat;

mat mul(mat &A, mat&B){
    mat C(A.size(),vector<ll>(B[0].size()));
    for(int i=0;i<A.size();i++){
        for(int k=0;k<B.size();k++){
            for(int j=0;j<B[0].size();j++){
                C[i][j]=(C[i][j]+A[i][k]*B[k][j])%mod;
            }
        }
    }
    return C;
}

mat pow(mat A,ll n){
    mat B(A.size(),vector<ll>(A.size()));
    for(int i=0;i<A.size();i++){
        B[i][i]=1;
    }
    
    while(n>0){
        if(n&1) B=mul(B,A);
        A=mul(A,A);
        n/=2;
    }
    return B;
}

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}

int main(){
    
    ll L,X,Y;cin>>L>>X>>Y>>mod;
    
    ll sum=0;
    
    mat ans(3,vector<ll>(1,0));
    ans[0][0]=0;ans[1][0]=(X-(Y%mod)+mod)%mod;ans[2][0]=1;
    
    for(int d=1;d<=18;d++){
        ll a=1,cnt;
        for(int j=1;j<=d;j++) a*=10;
        
        if(a-1<X) continue;
        if(a/10-1<X&&X<=a-1){
            cnt=(a-1-X)/Y+1;
        }else{
            cnt=(a-1-X)/Y-(a/10-1-X)/Y;
        }
        
        if(sum+cnt>L) cnt=L-sum;
        
        mat A(3,vector<ll>(3,0)),B(2,vector<ll>(1,0));
        
        A[0][0]=a%mod;
        A[0][1]=A[1][1]=A[2][2]=1;
        A[0][2]=A[1][2]=Y%mod;
        
        A=pow(A,cnt);
        
        A=mul(A,ans);
        
        for(int i=0;i<3;i++) ans[i][0]=A[i][0];
        
        sum+=cnt;
        if(sum==L) break;
        
        //cout<<ans[0][0]<<endl;
    }
    
    cout<<ans[0][0]<<endl;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string s,t;cin>>s>>t;
	string s2 = s + s;//sを繰り返すと折返しが考えやすいってエラい人が言ってた
	vector<vector<ll>> a(26);

	for(int i = 0; i < s2.size(); i++) {
		a[s2[i] - 'a'].pb(i);
	}

	if (a[t[0] - 'a'].size() == 0){
			cout << -1 << endl;
			return 0;
		}
	ll tmp = a[t[0] - 'a'][0];//最初の一文字
	ll ans = tmp + 1;//0オリを考慮しますた
	for(int i = 1; i < t.size(); i++) {
		if (a[t[i] - 'a'].size() == 0){
			cout << -1 << endl;
			return 0;
		}
		auto ite = upper_bound(ALL(a[t[i] - 'a']),tmp);
		ans += (*(ite) - tmp);
		if (*(ite) < s.size()){//折返しがない時
			tmp = *(ite);
		}
		else{//折返しのときはインデックスをリセット
			tmp = a[t[i] - 'a'][0];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3000
(X,N) = map(int,input().split())
if N == 0:
    print(X)
else:
    p = list(map(int,input().split()))
    for i in range(N+1):
        if (X - i) not in p:
            print(X-i)
            break
        elif(X+i) not in p:
            print(X+i)
            break


Measured memory_bytes: 9176
from collections import defaultdict
dd = defaultdict(int)
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
for i in range(N):
    dd[S[i]] += 1
for i in range(M):
    dd[T[i]] += -1
ans = max(dd.values())
print(max(0,ans))

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

int main()
{
 	long long n;
    cin>>n;
  	long long a[n+1]={0};
  long long ans[n+1]={0};
  	for(long long i = 2; i <= n; i++)
    {
      cin>>a[i];
      ans[a[i]]+=1;
    }
  	for(long long i = 1; i <= n; i++)
    {
      	cout<<ans[i]<<'\n';
    }
}


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

using namespace std;

class Z_Algo {
	int len;
	string S;
	vector<int> Z;
	
public:
	Z_Algo(const string s) {
		len = s.length();
		S = s;
		Z = vector<int>(len);
		build();
	}
	
	void build() {
		Z[0] = len;
		int i = 1, j = 0;
		while(i < len) {
			while(i + j < len && S[j] == S[i + j]) ++j;
			Z[i] = j;
			if (j == 0) {
				++i; continue;
			}
			int k = 1;
			while (i + k < S.length() && k + Z[k] < j) Z[i + k] = Z[k], ++k;
			i += k;
			j -= k;
		}
	}
	
	vector<int> get_Z() { return Z; }
};

int main()
{
	int n; string s;
	cin >> n >> s;
	
	int max = 0;
	for(int i = 0; i < n - 1; i++) {
		Z_Algo C(s.substr(i));
		
		vector<int> Z = C.get_Z();
		
		for(int j = 0; j < n - i; j++) {
			if (Z[j] > j) Z[j] = j;
			if (Z[j] > max) max = Z[j];
		}
	}
	 
	if (max == 1) cout << 0;
	else cout << max;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int MAXN=5010,P=131,M=10000000,M2=10000019;
int n,l,r,qp[MAXN],qp2[MAXN],hs[MAXN],hs2[MAXN],vis[M+10],vis2[M2+10];
char c[MAXN];
int hhs (int l,int r) {return (hs[r]-(1ll*hs[l-1]*qp[r-l+1])%M+M)%M;}
int hhs2 (int l,int r) {return (hs2[r]-(1ll*hs2[l-1]*qp2[r-l+1])%M2+M2)%M2;}
bool chk (int x) {
	memset(vis,0,sizeof(vis));
	memset(vis2,0,sizeof(vis2));
	for (int i=1;i<=n-x+1;i++) {
		if (i>x) {vis[hhs(i-x,i-1)]=vis2[hhs2(i-x,i-1)]=1;}
		if (vis[hhs(i,i+x-1)]&&vis2[hhs2(i,i+x-1)]) {return 1;}
	}
	return 0;
}
int main () {
	scanf("%d%s",&n,c+1);
	qp[0]=qp2[0]=1;
	for (int i=1;i<=n;i++) {
		hs[i]=((hs[i-1]*P)%M+c[i]-'a'+1)%M;
		qp[i]=(qp[i-1]*P)%M;
		hs2[i]=((hs2[i-1]*P)%M2+c[i]-'a'+1)%M2;
		qp2[i]=(qp2[i-1]*P)%M2;
	}
	int l=1,r=n;
	if (!chk(1)) {printf("0\n");return 0;}
	while (l<r) {
		int mid=(l+r+1)>>1;
		if (chk(mid)) {l=mid;}
		else {r=mid-1;}
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 78592
let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let rec repl () =
  let l = read_line () in
  match split l ' ' with
  | [] | [_] | _::_::[] -> exit 1
  | a :: op :: b :: _ ->
      let a = int_of_string a in
      let b = int_of_string b in
      match op with
      | "?" -> ()
      | "+" -> Printf.printf "%d\n" (a + b); repl ()
      | "-" -> Printf.printf "%d\n" (a - b); repl ()
      | "*" -> Printf.printf "%d\n" (a * b); repl ()
      | "/" -> Printf.printf "%d\n" (a / b); repl ()
      | _ -> exit 1

let () =
  try repl () with End_of_file -> ()

Measured memory_bytes: 2320
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    long double A, B;

    cin >> A >> B;

    ll C = A*B;

    cout << C << endl;

    return 0;
    
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
	int n,flag=0;
  	cin >> n;
  	int a[n];
  	for(int i=0;i<n;i++)
      cin >> a[i];
  	for(int i=0;i<n;i++)
      if(a[i]%2==0){
        if((a[i]%3==0) || (a[i]%5==0))
           flag = 0;
        else{
           flag = 1;
           break;}}
    if(flag==0)
    	cout << "APPROVED";
    else
       	cout << "DENIED";
    return 0;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i) 
S = gets.chomp
T = gets.chomp
L = N.lcm(M)
n = L/N
m = L/M
i = 0
loop do
  s = i * n.lcm(m) / n
  t = i * n.lcm(m) / m
  break if s >= N || t >= M
  if S[s] != T[t]
    p -1; exit
  end
  i += 1
end
p L


Measured memory_bytes: 2044