akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

ll n;
const int m=62;
ll dp[m+1][3];

const ll mod=1000000007LL;

int main(void){
	cin >> n;

	dp[0][0]=1LL;

	rep(i,m)rep(j,3){
		const int cur=(n>>(m-1-i))&1;
		rep(d,3){
			const int ni=i+1;
			const int nj=min(2,2*j+cur-d);
			if(nj<0) continue;
			dp[ni][nj]+=dp[i][j];
			dp[ni][nj]%=mod;
		}
	}

	
	ll ans=0LL;
	rep(j,3) ans+=dp[m][j];
	ans%=mod;
		
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#[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 , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[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 ) * } } ; }
#[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 ) * } } ; }

fn main() {
    input! {
        n: usize,
        p_: [i32; n],
    }
    let mut p = p_.clone();
    p.sort();
    p[n - 1] /= 2;

    let ret: i32 = p.iter().sum();
    println!("{}", ret);
}


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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
// vll x(n); x[i]=a;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define INF 1e+12
#define EPS 1e-12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

// 拡張ユーグリッド互除法
ll extgcd(ll a, ll b, ll &x, ll &y){
    if (b == 0){
        x = 1;
        y = 0;
        return a;
    }
    ll g = extgcd(b, a%b, y, x);
    y -= a/b * x;
    return g;
}

ll gcd(ll a, ll b){
    ll x, y;
    return extgcd(a, b, x, y);
}

// 逆元(mod p)
ll modinv(ll a, ll p){
    ll x, y;
    extgcd(a, p, x, y);
    if (x<0) x += p;
    return x;
}

// 二項係数
#define MAX (int)1e5
ll fac[MAX+1];
ll finv[MAX+1];
void nCr_init(ll max, ll mod){
    fac[0] = 1;
    finv[0] = 1;
    REP(i, max){ // i=1->max+1 => 0->max
        fac[i+1] = fac[i] * (i+1) % mod;
        finv[i+1] = finv[i] * modinv(i+1, mod) % mod;
    }
}

ll nCr(ll n, ll r, ll mod){
    if (n < r || n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod;
}

int main(){
    const ll MOD = 1e9+7;
    ll n, k, ans = 0;
    cin >> n >> k;
    vll a(n);
    cin >> a;
    sort(all(a));

    nCr_init(n, MOD);

    REP(i,n){
        ans += a[i] * nCr(  i,   k-1, MOD);
        ans -= a[i] * nCr(n-i-1, k-1, MOD);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

struct edge {
    ll to, cost;
};
typedef pair<ll, ll> P;

vector<vector<edge>> G;
vec seen;
vec d;

ll dfs (ll v) {
    if (seen[v] == 2) return d[v];
    seen[v] = 1;
    d[v] = 1;
    for (auto e : G[v]) {
        ll f = e.to;
        ll g = e.cost;
        if (seen[f] == 1) {
            cout << -1 << endl;
            exit(0);
        }
        chmax(d[v], dfs(f) + g);
    }
    seen[v] = 2;
    return d[v];
}

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

    ll N;
    cin >> N;
    mat A(N, vec(N-1));
    Rep (i, N) {
        Rep (j, N-1) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }
    mat id(N, vec(N));


    ll v = N*(N-1)/2;
    ll tmp = 0;
    Rep (i, N) {
        for (ll j = i+1; j < N; j++) {
            id[i][j] = tmp;
            id[j][i] = tmp++;
        }
    }

    G.assign(v, vector<edge>());
    Rep (i, N) {
        Rep (j, N-2) {
            G[id[i][A[i][j]]].push_back({id[i][A[i][j+1]], 1});
        }
    }

    seen.assign(v, 0);
    d.assign(v, 0);

    ll ans = 0;
    Rep (i, v) {
        ll ret = dfs(i);
        chmax(ans, ret);
    }
    cout << ans << endl;

}

Measured memory_bytes: 60800
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

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

    ll h, n;

    cin >> h >> n;

    ll sum = 0;

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

    (sum >= h) ? (cout << "Yes" << endl) : (cout << "No" << endl);

}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
ab = [abs(A[0])] + [abs(A[i+1]-A[i]) for i in range(N-1)] + [abs(A[N-1])]
s = sum(ab)
print(s-sum(ab[:2])+abs(A[1]))
for i in range(1,N-1):
    print(s-sum(ab[i:i+2])+abs(A[i+1]-A[i-1]))
print(s-sum(ab[N-1:])+abs(A[N-2]))

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

int main()
{
	long long N;
	scanf("%lld", &N);
	
	int i, j, k, l, x[10];
	long long X, total = 0, count[10][10] = {};
	for (i = 1; i <= 9; i++) {
		for (j = 1; j <= 9; j++) {
			if (i == j && i <= N) count[i][j]++;
			for (k = 0; k < 10; k++) x[k] = -1;
			x[0] = i;
			x[1] = j;
			X = x[0] + x[1] * 10; 
			while (X <= N) {
				count[i][j]++;
				for (k = 1; x[k] == 9 && x[k+1] != -1; k++);
				if (x[k] != 9 && x[k+1] != -1) {
					for (x[k--]++; k >= 1; k--) x[k] = 0;
				} else {
					x[k+1] = j;
					for (; k >= 1; k--) x[k] = 0;
				}
				for (k = 9, X = 0; k >= 0; k--) if (x[k] >= 0) X = X * 10 + x[k];
			}
		}
	}
	
	for (i = 1; i <= 9; i++) {
		for (j = 1; j <= 9; j++) {
			total += count[i][j] * count[j][i];
		}
	}
	printf("%lld\n", total);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.ns();
            int n = s.length();
            int[] res = new int[2];
            for (int first = 0; first <= 1; first++) {
                int cur = first;
                for (int i = 0; i < n; i++) {
                    if (s.charAt(i) - '0' != cur)
                        res[first]++;
                    cur = 1 - cur;
                }
            }
            out.println(Math.min(res[0], res[1]));
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 23252
#include <stdio.h>
#include <stdlib.h>
 
typedef struct nodetag {
    unsigned int key;
    struct nodetag *next;
    struct nodetag *prev;
} Node;
 
Node *createNode(int key)
{
    Node *node = malloc(sizeof(Node));
    node->key = key;
    node->next = node->prev = NULL;
 
    return node;
}
 
void insert(Node *node, Node **head, Node **tail)
{
    if(*tail == NULL || *head == NULL) {
        node->next = node->prev = NULL;
        *head = *tail = node;
    } else {
        (*tail)->next = node;
        node->prev = *tail;
        node->next = NULL;
        *tail = node; 
    }
}
 
void delete(int key, Node **head, Node **tail)
{
    Node *node = *tail;
 
    while(node != NULL && node->key != key) {
        node = node->prev;
    }
    if(node == NULL)
        return;
    if(node->prev == NULL) {
        (node->next)->prev = NULL;
        *head = node->next;
    } else if(node->next == NULL) {
        (node->prev)->next = NULL;
        *tail = node->prev;
    } else {
        (node->prev)->next = node->next;
        (node->next)->prev = node->prev;
    }
    free(node);
}
 
void deleteFirst(Node **head, Node **tail)
{
    Node *node = *tail;
 
    if(tail == NULL)
        return;
 
    *tail = (*tail)->prev;
    if(*tail == NULL) {
        *head = NULL;
        free(node);
        return;
    }
    (*tail)->next = NULL;
    free(node);
}
 
void deleteLast(Node **head, Node **tail)
{
    Node *node = *head;
 
    if(node == NULL)
        return;
 
    *head = (*head)->next;
    if(*head == NULL) {
        *tail = NULL;
        free(node);
        return;
    }
    (*head)->prev = NULL;
    free(node);
}
 
int main(void)
{
    int i, n, key;
    char command[11];
    Node *tail = NULL, *head = NULL, *node;
 
    scanf("%d", &n);
    for(i = 0; i < n; i++) {
        scanf("%s", command); 
        if(strcmp(command, "insert") == 0) {
            scanf("%d", &key);
            node = createNode(key);
            insert(node, &head, &tail); 
        } else if(strcmp(command, "delete") == 0) {
            scanf("%d", &key);
            delete(key, &head, &tail);
        } else if(strcmp(command, "deleteFirst") == 0) {
            deleteFirst(&head, &tail);
        } else if(strcmp(command, "deleteLast") == 0){
            deleteLast(&head, &tail);
        } else {
            printf("command not found: %s\n", command);
        }
    }
    printf("%d", tail->key);
    tail = tail->prev;
    while(tail != NULL) {
        printf(" %d", tail->key);
        tail = tail->prev;
    }
    printf("\n");
 
    return 0;
}

Measured memory_bytes: 31788
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define FOR(i,s,n) for(int i=s;i<n;i++)
#define ROF(i,n,e) for(int i=n;i>e;i--)
#define Debug(x) cout<<x<<"\n";
#define Debug2(x,y) cout<<x<<" "<<y<<"\n";
#define TEST(t) while(t--)
#define mod 1e9+7
#define MAX 1000005    //10^5+5
#define MAXQ 200005    //2*10^5+5
#define pi pair<int,int>
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define ll long long
#define f first
#define s second
typedef pair<int,int> pii;
typedef pair<int,pii> node;

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a,b;
    cin>>a>>b;
    cout<<6-(a+b)<<"\n";
    return 0;    
}

Measured memory_bytes: 256
let () =
  let s = read_line () in
  let t = read_line () in
  let sort s f =
    let arr = Array.init (String.length s) (fun i -> String.make 1 s.[i]) in
    Array.sort f arr ;
    Array.fold_left (fun x y -> x ^ y) "" arr
  in
  let s = sort s compare in
  let t = sort t (fun x y -> compare y x) in
  (match s < t with true -> "Yes" | false -> "No") |> print_endline


Measured memory_bytes: 384
#import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
s=input()
if int(s[5:7])<5:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 3316
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  int ans=0;
  for(int i=1;i*i<=N*100;i++){
    if((N-i)>=0&&(N-i)%i==0&&(N-i)/i>i)ans+=(N-i)/i;
  }
  cout<<ans<<endl;
}


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

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

  cin >> A >> B >> C >> D;

  if ( (A+B)>(C+D) ) {
    cout << "Left" << endl;
  }
  else if ( (A+B)<(C+D) ) {
    cout << "Right" << endl;
  }
  else
  {
      cout << "Balanced" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Mat = vector<vector<long long>>;
long long N, K;
const int MOD = 1000000007;
Mat make_mat(int N, int init = 0)
{
    return Mat(N, vector<long long>(N, init));
}
Mat mulmod(const Mat& A, const Mat& B)
{
    Mat C = make_mat(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            long long t = 0;
            for (int k = 0; k < N; k++) {
                (t += A[i][k] * B[k][j]) %= MOD;
            }
            C[i][j] = t;
        }
    }
    return C;
}
Mat powmod(const Mat& A, long long n)
{
    if (n == 1) {
        return A;
    } else if (n % 2 == 0) {
        return powmod(mulmod(A, A), n / 2);
    } else {
        return mulmod(A, powmod(mulmod(A, A), n / 2));
    }
}
int main()
{
    cin >> N >> K;
    Mat A = make_mat(N), B = make_mat(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < N; i++) {
        B[0][i] = 1;
    }
    B = mulmod(B, powmod(A, K));
    cout << accumulate(begin(B[0]), end(B[0]), 0LL) % MOD << endl;
    return 0;
}

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

int main(){
  int N;
  int Alice=0;
  int Bob=0;
  cin >> N;
  vector<int> scores(N);
  
  for(int i=0;i<N;i++){
    cin >> scores.at(i);
  }
  
  for(int i=0;i<N;i++){
    int max=0;
    int index=0;
    
    for(int j=0;j<N;j++){
      if(scores.at(j)>max){
        max=scores.at(j);
        index=j;
      }
    }
    
    if(i%2==0){
      Alice+=max;
    }else{
      Bob+=max;
    }
    
    scores.at(index)=-1;
    
  }
  
  cout << Alice-Bob << endl;
  
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> A(5);
  REP(i, 5) cin >> A[i];
  int k;
  cin >> k;
  int b = 1;
  for(int i = 0; i < 4; i++) {
    for(int j = i + 1; j < 5; j++) {
      if(A[j] - A[i] > k) {
        b = 0;
      }
    }
  }

  if(b) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  vector<string> a(7);
  a = {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
  rep(i, 7) {
    if(s == a.at(i)) {
      cout << i + 1 << endl;
      break;
    }
  }
}


Measured memory_bytes: 256
// finish date: 2018/01/11
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

#define bigmod 1000000007
using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long

int mul(int a, int b) {
    return (int) (((ll) (a % bigmod) * (b % bigmod)) % bigmod);
}

int factorial(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans = ans * i;
    }
    return ans;
}

int main() {
    int N;
    int power = 1;
    cin >> N;
    FOR(i, 1, N + 1) {
        power = mul(power, i);
    }
    cout << power << endl;

    return 0;
}


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

int a, b, c, d;
string t;
int main()
{
	cin >> t;
	a = t[0] - '0'; b = t[1] - '0'; c = t[2] - '0'; d = t[3] - '0';
	if (a + b + c + d == 7) {printf("%d+%d+%d+%d=7", a, b, c, d); return 0;}
	if (a + b + c - d == 7) {printf("%d+%d+%d-%d=7", a, b, c, d); return 0;}
	if (a + b - c + d == 7) {printf("%d+%d-%d+%d=7", a, b, c, d); return 0;}
	if (a + b - c - d == 7) {printf("%d+%d-%d-%d=7", a, b, c, d); return 0;}
	if (a - b + c + d == 7) {printf("%d-%d+%d+%d=7", a, b, c, d); return 0;}
	if (a - b + c - d == 7) {printf("%d-%d+%d-%d=7", a, b, c, d); return 0;}
	if (a - b - c + d == 7) {printf("%d-%d-%d+%d=7", a, b, c, d); return 0;}
	if (a - b - c - d == 7) {printf("%d-%d-%d-%d=7", a, b, c, d); return 0;}
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
#define MAX 200200
inline int read()
{
    int x=0;bool t=false;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=true,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return t?-x:x;
}
int n,a[MAX],val[MAX],cnt[MAX];
char s[MAX];
struct SegmentTree
{
#define lson (now<<1)
#define rson (now<<1|1)
    int t[MAX<<2];
    void Build(int now,int l,int r)
    {
        if(l==r){t[now]=-1e9;return;}
        int mid=(l+r)>>1;
        Build(lson,l,mid);Build(rson,mid+1,r);
        t[now]=max(t[lson],t[rson]);
    }
    void Modify(int now,int l,int r,int p,int w)
    {
        if(l==r){t[now]=w;return;}
        int mid=(l+r)>>1;
        if(p<=mid)Modify(lson,l,mid,p,w);
        else Modify(rson,mid+1,r,p,w);
        t[now]=max(t[lson],t[rson]);
    }
    int Query(int now,int l,int r,int L,int R)
    {
        if(L<=l&&r<=R)return t[now];
        int mid=(l+r)>>1,ret=-1e9;
        if(L<=mid)ret=max(ret,Query(lson,l,mid,L,R));
        if(R>mid)ret=max(ret,Query(rson,mid+1,r,L,R));
        return ret;
    }
}Odd,Even;
bool check(int mx,int Q)
{
    if(Q<0)return false;
    if(Q&1)return Odd.Query(1,1,n,mx,n)>=Q;
    else return Even.Query(1,1,n,mx,n)>=Q;
}
int main()
{
    n=read();
    for(int i=1,mx=0;i<=n;++i)
    {
        a[i]=read();
        if(a[i]>mx)val[i]=2,mx=a[i];
        else val[i]=1;
    }
    Odd.Build(1,1,n);
    for(int i=n;i;--i)
    {
        int mx1=Odd.Query(1,1,n,a[i],n),mx0=Even.Query(1,1,n,a[i],n);
        if(val[i]&1)Odd.Modify(1,1,n,a[i],mx0+val[i]),Even.Modify(1,1,n,a[i],mx1+val[i]);
        else Odd.Modify(1,1,n,a[i],mx1+val[i]),Even.Modify(1,1,n,a[i],mx0+val[i]);
    }
    for(int i=n;i;--i)cnt[i]=cnt[i+1]+val[i]-1;
    int cntX=0,cntY=0,mxX=0,mxY=0;
    for(int i=1;i<=n;++i)
    {
        Odd.Modify(1,1,n,a[i],-1e9);Even.Modify(1,1,n,a[i],0);
        if(check(mxY,cntX+cnt[i+1]-cntY+(a[i]>mxX)))s[i]='0',cntX+=a[i]>mxX,mxX=max(mxX,a[i]);
        else if(check(max(mxX,a[i]),cntY+cnt[i+1]-cntX-(a[i]>mxX)))s[i]='0',cntX+=a[i]>mxX,mxX=max(mxX,a[i]);
        else s[i]='1',cntY+=a[i]>mxY,mxY=max(mxY,a[i]);
    }
    if(cntX!=cntY){puts("-1");}
    else printf("%s",s+1);
    return 0;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 100010;
int n;
int x[MAX];
int il[16];
int dp[1 << 17];
int xx[1 << 17];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n;
  R(i,n-1){
    int a,b,c;
    cin >> a >> b >> c;
    x[a]^=c;
    x[b]^=c;
  }
  R(i,n){
    il[x[i]]++;
  }
  vector<int> pom;
  int res = 0;
  R(i,16)if(i){
    if(il[i]&1){
      pom.PB(i);
    }
    res += il[i]/2;
  }
  R(i,1<<SZ(pom)){
    R(j,SZ(pom))if((i >> j)&1){
      xx[i] ^= pom[j];
    }
  }
  R(i,1<<SZ(pom)){
    debug(xx[i],i);
    if(xx[i] == 0){
      dp[i] = 1;
      for(int j = (i - 1) & i; j ; j = (j -1)&i){
        if(xx[j] == 0){
          maxi(dp[i], dp[j] + 1);
        }
      }
    }
  }
  debug(SZ(pom),res,dp[(1 << SZ(pom))-1]);
  cout << res + max(0ll, SZ(pom) - dp[(1 << SZ(pom))-1]) << "\n";
}


Measured memory_bytes: 1536
#include <stdio.h>

int main() {
	int N, A[21] = {0}, B[21] = {0}, C[21] = {0};
	int b;
	int i;
	int ans = 0;
	scanf("%d", &N);

	for(i = 1; i <= N; i++) {
		scanf("%d", &A[i]);
	}
	for(i = 1; i <= N; i++) {
		scanf("%d", &B[i]);
	}
	for(i = 1; i <= N-1; i++) {
		scanf("%d", &C[i]);
	}


	for(i = 1; i <= N; i++) {
		ans += B[A[i]];
		if(i > 1 && A[i-1] + 1 == A[i]) {
			ans += C[A[i-1]];
		}
	}

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1000000007;
/* テンプレートここまで */

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

  map<int, vector<vector<int>> > stop;

  REP(i, N){
    int s, t, x;
    cin >> s >> t >> x;

    s -= x;
    t -= x;

    stop[x].push_back({s,t});
  }

  map<int,int> query;

  REP(i, Q){
    int D;
    cin >> D;
    query[D] = i;
  }

  vector<int> ans(Q, -1);

  for(auto i = stop.begin(); i != stop.end(); i++ ){
    REP(j,i->second.size()){
      auto lb = query.lower_bound(i->second[j][0]);
      auto ub = query.lower_bound(i->second[j][1]);
      auto k = lb;
      while(k != ub){
        ans[query[k->first]] = i->first;
        query.erase(k++);
      }
    }
  }

  REP(i,Q){
    cout << ans[i] << endl;
  }
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


int main() {
    int s; cin >> s;
    map<int,int> mp;
    mp[s] = 1;
    int ans = -1;
    for (int i=2; ; ++i) {
        if (s % 2) s = 3*s + 1;
        else s /= 2;
        if (found(mp,s)) {
            ans = i; break; //
        }
        mp[s] = i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#include <vector>
#include <stdio.h>
#include <string>

#include <cassert>

#include <algorithm>

#include <functional>

#include <cmath>

#include <iomanip>

#include <limits>
#include <bits/stdc++.h>
#include<queue>
#include<type_traits>
#include<cstdint>
using namespace std;
int MOD = 1e9+7;

int main(){
   int n;
   cin >> n;
   vector<int> A(n);
   vector<int> B(n);
   vector<int> C(n);
   for(int i=0;i<n;i++){
       int a,b,c;
       cin >> a >> b >> c;
       A[i]=a;
       B[i]=b;
       C[i]=c;
   }
   vector<vector<int>> dp(n+1,vector<int>(3));
   dp[0][0]=0;
   dp[0][1]=0;
   dp[0][2]=0;
   for(int i=1;i<n+1;i++){
       dp[i][0]=max(dp[i-1][1]+A[i-1],dp[i-1][2]+A[i-1]);
       dp[i][1]=max(dp[i-1][2]+B[i-1],dp[i-1][0]+B[i-1]);
       dp[i][2]=max(dp[i-1][0]+C[i-1],dp[i-1][1]+C[i-1]);
   }
  /* for(int i=0;i<3;i++){
       cout<<dp[1][i]<<endl;
   }*/
   int x=max(dp[n][0],dp[n][1]);
   cout<<max(x,dp[n][2])<<endl;
}


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

const int MX = 1e5+1;
vector<int> adj[MX];
int p[MX];
bool vis[MX];
int lvl[MX];
int root;

int dfs(int s)
{
    vis[s] = true;
    
    int tmp = 0;
    int x = 0;
    for(int i=0;i<adj[s].size();i++)
    {
        if(!vis[adj[s][i]])
        {   
            lvl[adj[s][i]] = lvl[s]+1;
            
            int b = dfs(adj[s][i]);
            if(b>=tmp)
            {
               x = adj[s][i]; 
                tmp =b;
            }
        }
        else
        {
            if(tmp<=lvl[adj[s][i]])
            {
                tmp = lvl[adj[s][i]];
                x = adj[s][i];
            }
        }
            
    }
    lvl[s] = tmp +1;
    p[s] = x;
    return lvl[s];
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    
    
    for(int i=0;i<n+m-1;i++)
    {
        int x,y;
        cin>>x>>y;
        adj[y].push_back(x);
    }
    
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
            dfs(i);
    }
    
    for(int i=1;i<=n;i++)
        cout<<p[i]<<'\n';
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T 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;}
const int inf = 1001001001;

int main() {
    int a,b;
    cin >> a >> b;
    cout << 6-a-b << endl;
}

Measured memory_bytes: 256
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.ArrayList;

import java.util.HashMap;

import java.util.StringTokenizer;



public class Main {

  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

  static class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new
          InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String[] nextSArray() {
      String sr[] = null;
      try {
        sr = br.readLine().trim().split(" ");
      } catch (IOException e) {
        e.printStackTrace();
      }
      return sr;
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }

      return str;
    }
  }
  static long gcd(long a,long b)
  {
    if(a==0)
      return b;
    return  gcd(b%a,a);
  }

  //  static int MOD=1000000000+7;
  static BigInteger combination(long n,long k)
  {

    long kk=Math.min(n-k,k);
    BigInteger N=BigInteger.valueOf(n);
    //BigInteger K=BigInteger.valueOf(kk);
    BigInteger num=new BigInteger("1");
    BigInteger den =new BigInteger("1");
    BigInteger one =new BigInteger("1");

    for(int i=1;i<=kk;++i)
    {
     // num*=n;
      num=num.multiply(N);
      N=N.subtract(one);
      den=den.multiply(BigInteger.valueOf(i));
    }
    return num.divide(den);
  }

  static long mod=1000000007;
  public static void main(String[] args) throws Exception {
    FastReader sc = new FastReader();
   String s=sc.nextLine();
   String t=sc.nextLine();
   int n=s.length();
   int ans=0;
   for(int i=0;i<n;++i)
   {
     char ch1=s.charAt(i);
     char ch2=t.charAt(i);
     if(ch1!=ch2)
       ++ans;
   }
    System.out.println(ans);
  }
}



// out.println(al.toString().replaceAll("[\\[|\\]|,]",""));


Measured memory_bytes: 37044
n=int(input())
a=list(map(int,input().split()))
a.append(0)
a.insert(0,0)
total=0
ans=[]
for i in range(n+1):
    total+=abs(a[i]-a[i+1])
for i in range(n):
    ans.append(total-(abs(a[i+1]-a[i])+abs(a[i+2]-a[i+1]))+abs(a[i+2]-a[i]))
for j in ans:
    print(j)

Measured memory_bytes: 14176
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    int n;
    cin >> n >> s;
    for(int i=0;i<s.size();i++){
        for(int a=0;a<n;a++){
            if(s[i]=='Z'&&n!=0)s[i]='A';
            else s[i]+=1;   
        }
    }
    s+='\n';
    cout << s;
    // string ans;
    // cin >> ans;
    // ans+='\n';
    // if(s==ans) cout << "true\n";
    // else cout << "false\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  string s;
  cin >> s;
  int ai = s.size(), zi = 0;
  rep(i,s.size()){
    if(s[i]=='A') chmin(ai,i);
    if(s[i]=='Z') chmax(zi,i);
  }
  cout << zi - ai + 1 << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

const int INF = 1001001001;
vi to[100005];

int main() {
  int n, m;
  cin >> n >> m;
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  queue<int> q;
  vi dist(n, INF);
  vi pre(n, -1);
  dist[0] = 0;
  q.push(0);
  while (!q.empty()) { 
    int v = q.front(); q.pop();
    for (int u : to[v]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[u]+1;
      pre[u] = v;
      q.push(u);
    }
  }

  cout << "Yes" << endl;
  FOR(i, 1, n) {
    int ans = pre[i];
    ans++;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 10664
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;

///---program start---///

main()
{
    #ifdef Barik
        files("barik");
        freopen("debug.txt","w",stderr);
    #endif

    int a,b;
    cin>>a>>b;
    if (a<=0&&0<=b){
        cout<<"Zero"<<"\n";
    }
    elif (a>0){
        cout<<"Positive"<<"\n";
    }
    elif ((b-a+1)%2==1){
        cout<<"Negative"<<"\n";
    }
    else{
        cout<<"Positive"<<"\n";
    }
}


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

int main(){
    int n,m;
    cin >> n >> m;
    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
N, M, K = map(int, input().split())
ans = "No"
for h in range(0, N+1, 1):
    for w in range(0, M+1, 1):
        tmp = h * M + w * N - 2*h*w
        if tmp == K:
            ans = "Yes"
            print(ans)
            exit()
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-8;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=1e5+100;

void solve(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int sta=1;
	while(1){
		if(sta)c-=b;
		else a-=d;
		if(a<=0){
			printf("No");
			break;
		}
		if(c<=0){
			printf("Yes");
			break;
		}
		sta^=1;
	}
}
int main(){
    //IOS;
    //freopen("fenwick.in","r",stdin);
    //freopen("fenwick.out","w",stdout);
    solve();
    
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    return 0;
}

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

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 200005;

int n,K;
ll a[MAXN];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin>>n>>K;
	forn(i,0,n) cin>>a[i];
	
	for(ll z=0;z<K;z++){
		bool skip=1;
		forn(i,0,n){
			if(a[i]<n){ skip=0; break; }
		}
		if(skip) break;
		
		ll p[n+1]{};
		forn(i,0,n){
			p[max(0LL,i-a[i])]++;
			p[min((ll)n,i+a[i]+1)]--;
		}
		forn(i,1,n) p[i]+=p[i-1];
		forn(i,0,n) a[i]=p[i];
	}
	
	forn(i,0,n){
		cout<<a[i]<<" ";
	}
	cout<<'\n';
	
	return 0;
}


Measured memory_bytes: 6656
#include <stdio.h>
#include <algorithm>

int main(void){
    long long int n,a,b,c,d,e,m;
    scanf("%lld",&n);
    scanf("%lld",&a);
    scanf("%lld",&b);
    scanf("%lld",&c);
    scanf("%lld",&d);
    scanf("%lld",&e);
    m = std::min(std::min(std::min(a,b),std::min(c,d)),e);
    printf("%lld\n",(n-1)/m+5);
    return 0;
}


Measured memory_bytes: 128
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/11/20 21:59:34
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n,t; cin>>n>>t;
  struct Dish {
    int a,b;
  };
  vector<Dish> ds(n);
  for (int i = 0; i < n; i++) {
    cin>>ds[i].a>>ds[i].b;
  }
  sort(ds.begin(), ds.end(), [](auto l, auto r) {return l.a<r.a;});
  vector<int> dp(6000);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int s = t-1; s >= 0; s--) {
      if (dp[s] == -1) continue;
      int t = s+ds[i].a;
      dp[t] = max(dp[t], dp[s]+ds[i].b);
    }
  }
  int ans = *max_element(dp.begin(), dp.end());
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		
		int x = 0;
		
		for(int i = 0; i < 4; i++) {
			if(S.charAt(i) == '+') {
				x++;
			} else {
				x--;
			}
		}
		System.out.println(x);		
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<string> day(8);
  day = {" ","SAT","FRI","THU","WED","TUE","MON","SUN"};
  for(int i=1; i<8; i++){
    if(day[i] == s){
      cout << i << endl;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
#define ll long long
int main()
{
  double a,b,lim,max=floor(a*lim/b)-a*floor(lim/b);;
  cin>>a>>b>>lim;
  for(ll i=(ll)lim;i>=(ll)lim;i--)
  {
    ll ans=floor(a*i/b)-a*floor(i/b);
    if(ans>max)
    {  	
      max=ans;
     break;
    }
  }
  if(lim<b)
  	cout<<floor(a*(lim)/b);
  else
    cout<<floor(a*(b-1)/b);
  //cout<<max;
  return 0;
        
}


Measured memory_bytes: 3884
c = [list(map(int,input().split())) for i in range(3)]
ans = "Yes"
for i in range(3):
    for j in range(3):
        if c[i][j]==c[i-1][j]+c[i][j-1]-c[i-1][j-1]:
            continue
        ans = "No"
print(ans)

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

// template <typename T>
// map<T, T> prime_factor(T n) {
//     map<T, T> ret;
//     for (T i = 2; i * i <= n; i++) {
//         T tmp = 0;
//         while (n % i == 0) {
//             tmp++;
//             n /= i;
//         }
//         ret[i] = tmp;
//     }
//     if (n != 1) ret[n] = 1;
//     return ret;
// }
 
// /*  divisor_num(n)
//     入力：整数 n
//     出力：nの約数の個数
//     計算量：O(√n)
// */
// template <typename T>
// T divisor_num(T N) {
//     map<T, T> pf = prime_factor(N);
//     T ret = 1;
//     for (auto p : pf) {
//         ret *= (p.second + 1);
//     }
//     return ret;
// }

// int main(){
//     int n;
//     cin>>n;
//     ll ans=0;
//     for(int i=1;i<=n;i++){
//         ans+=i*divisor_num(i);
//     }
//     cout<<ans<<endl;
// }

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

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

    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<n+1;i++){
        ll m=n/i;
        ans+=m*(m+1)*i/2;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, a, b) for(int i = a; i < b; i++)


int main() {
    string s;
    string t;

    cin >> s >> t;
    int s_length;
    int t_length;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());


    if (s < t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#define rep(i,N) for(int i=0;i<(int)N;i++)
char CH()
{
  static char buf[100000],*ptr1=buf,*ptr2=buf;
  return ptr1==ptr2&&(ptr2=(ptr1=buf)+fread(buf,1,100000,stdin),ptr1==ptr2)?EOF:*ptr1++;
}
int IN(void)
{
  int x=0,f=0,c=CH();while(c<48||c>57){f^=c==45,c=CH();}
  while(c>47&&c<58){x=x*10+c-48,c=CH();}return f?-x:x;
}
void OUT(long x){if(x<0)putchar('-'),x=-x;if(x>=10)OUT(x/10);putchar(x%10+48);}
void Radix32(int A[],const int sz)
{
  static int temp[200001];const int bit=8;
  rep(k,4)
  {
    int u[256]={},v[256]={};
    rep(i,sz)u[A[i]>>bit*k&((1<<bit)-1)]++;
    rep(i,(1<<bit)-1)u[i+1]+=u[i];
    rep(i,sz){temp[--u[A[sz-1-i]>>bit*k&((1<<bit)-1)]]=A[sz-1-i];}k++;
    rep(i,sz)v[temp[i]>>bit*k&((1<<bit)-1)]++;
    rep(i,(1<<bit)-1)v[i+1]+=v[i];
    rep(i,sz)A[--v[temp[sz-1-i]>>bit*k&((1<<bit)-1)]]=temp[sz-1-i];
  }
}
int main(void)
{
  int N=IN(),c=CH(),p=0,m=0,z=0,A[200000];
  long K=0,count=0,l=-2e18,r=-l,mid,x;while(c>47&&c<58){K=K*10+c-48,c=CH();}
  rep(i,N){x=IN();if(x>0)A[m+p++]=x;else if(x<0)A[p+m++]=x;else z++;}
  Radix32(A,m+p);
  if((K>1l*m*p)&&(2*K<2l*m*p+1l*z*(N-1)))return puts("0"),0;
  if(K<=1l*m*p)r=1l;else l=-1l;x=1l*z*(p+m)+1l*z*(z-1)/2+1l*p*m;
  while(l<=r)
  {
    mid=(l+r)/2;count=0;
    if(mid>=0)
    {
      int plus=p-1,minus=m-1;count+=x;if(count>=K){r=mid-1l;continue;}
      rep(i,p){while(i<plus&&(1l*A[i]*A[plus]>mid)){plus--;}if(i==plus){break;}count+=1l*plus-i;}if(count>=K){r=mid-1l;continue;}
      rep(i,m){while(i<minus&&(1l*A[m+p-1-i]*A[m+p-1-minus]>mid)){minus--;}if(i==minus){break;}count+=1l*minus-i;}
    }
    else{int low=0;rep(i,m){while(1l*A[low]*A[p+i]>mid&&low<p){low++;}count+=1l*p-low;}}
    if(count>=K)r=mid-1l;else l=mid+1l;
  }
  return OUT(l),0;
}

Measured memory_bytes: 2984
#!/usr/bin/env python3
n = int(input())
a = list(map(int,input().split()))
bit = 0
ans = 1
i = 0
while i < n-1:
    if a[i+1] == a[i]: pass
    if bit == 0:
        bit = a[i+1]-a[i]
        #ans += 1
    else:#bit が立っているなら符号が一致するかを見て一致しないならans +=  1
        if bit * (a[i+1]-a[i]) < 0:#符号不一致
            bit = 0 
            ans += 1 
    i += 1
print(ans)
    

Measured memory_bytes: 62704
<?php

	$data = explode(" ", trim(fgets(STDIN)));
	$a = $data[0];
	$b = $data[1];
	$c = $data[2];
	
	if($a%2==0|$b%2==0|$c%2==0){
	    echo 0;
	} else {
	    $ans = $a * $b;
	    $tmp = $b * $c;
	    if($tmp<$ans) $ans = $tmp;
	    $tmp = $c * $a;
	    if($tmp<$ans) $ans = $tmp;
	    echo $ans;
	}


?>

Measured memory_bytes: 4728