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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll    = long long;
using pint  = pair<int, int>;
using plint = pair<ll, ll>;
#define ld long double
#define ull unsigned long long int

#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrep1(i, n) for (int i = ((int)(n)); i > 0; --i)

#define SZ(x) ((int)(x).size())
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<double>    vd;
typedef vector<long long> vll;

// template<class T>bool maxc(T &a, const T &b) { if (a<b) { a=b; return 1; } }
// template<class T>bool minc(T &a, const T &b) { if (b<a) { a=b; return 1; } }

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vi l(q), r(q);
    rep(i, q) { cin >> l[i] >> r[i]; }

    // 処理
    vi v(n);
    rep(i, n - 1) { v[i + 1] = v[i] + (s[i] == 'A' && s[i + 1] == 'C'); }
    // 出力
    rep(i, q) { cout << (v[r[i] - 1] - v[l[i] - 1]) << endl; }

    return 0;
}


Measured memory_bytes: 2176
if __name__ == '__main__':

	while True:
		try:
			line = list(input())

			ans = "d"

			if line[0] == "o" and line[4] == "o" and line[8] == "o":
				ans = "o"
			elif line[2] == "o" and line[4] == "o" and line[6] == "o":
				ans = "o"
			elif line[0] == "o" and line[3] == "o" and line[6] == "o":
				ans = "o"
			elif line[1] == "o" and line[4] == "o" and line[7] == "o":
				ans = "o"
			elif line[2] == "o" and line[5] == "o" and line[8] == "o":
				ans = "o"
			elif line[0] == "o" and line[1] == "o" and line[2] == "o":
				ans = "o"
			elif line[3] == "o" and line[4] == "o" and line[5] == "o":
				ans = "o"
			elif line[6] == "o" and line[7] == "o" and line[8] == "o":
				ans = "o"

			if line[0] == "x" and line[4] == "x" and line[8] == "x":
				ans = "x"
			elif line[2] == "x" and line[4] == "x" and line[6] == "x":
				ans = "x"
			elif line[0] == "x" and line[3] == "x" and line[6] == "x":
				ans = "x"
			elif line[1] == "x" and line[4] == "x" and line[7] == "x":
				ans = "x"
			elif line[2] == "x" and line[5] == "x" and line[8] == "x":
				ans = "x"
			elif line[0] == "x" and line[1] == "x" and line[2] == "x":
				ans = "x"
			elif line[3] == "x" and line[4] == "x" and line[5] == "x":
				ans = "x"
			elif line[6] == "x" and line[7] == "x" and line[8] == "x":
				ans = "x"

			print(ans)

		except EOFError:
			break



Measured memory_bytes: 5596
import sys
# 整数の入力
n = int(input())
t = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
y = n - 1
print(t[y])

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
#define MOD 1000000007

typedef vector<vector<long long>> Mat;

long long add(long long &a, long long b){
    a=(a+b)%MOD;
}

Mat matmul(Mat &a, Mat b){
    int N = a.size();
    Mat c(N, vector<long long>(N));
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++)
            for(int k=0; k<N; k++)
                add(c[i][k], (a[i][j] * b[j][k])%MOD);
    return c;
}

Mat bipow(Mat &a, long long K){
    int N = a.size();
    Mat b(N, vector<long long>(N));
    if(K == 0){
        for(int i=0; i<N; i++)
            b[i][i] = 1;
        return b;
    }
    if(K % 2 == 0){
        Mat b = bipow(a, K/2);
        return matmul(b, b);
    }else{
        return matmul(a, bipow(a, K-1));
    }
}


int main(){
    int N;
    long long K;
    cin >> N >> K;
    Mat a(N, vector<long long>(N));
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++)
            cin >> a[i][j];

    Mat b = bipow(a, K);

    long long ans = 0;
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++)
            add(ans, b[i][j]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2816
#include <iostream>

int main(){
   const int n = 3;
   int c[n][n];
   for(int i=0; i<n; ++i){
      for(int j=0; j<n; ++j){
	 std::cin >> c[i][j];
      }
   }
   bool flag = true;
   if(c[0][1]-c[0][0]!=c[1][1]-c[1][0]) flag = false;
   if(c[0][2]-c[0][0]!=c[1][2]-c[1][0]) flag = false;
   if(c[0][1]-c[0][0]!=c[2][1]-c[2][0]) flag = false;
   if(c[0][2]-c[0][0]!=c[2][2]-c[2][0]) flag = false;

   if(flag) std::cout << "Yes" << std::endl;
   else std::cout << "No" << std::endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  string s="MARCH";
  ll c[5]={0};
  ll n;
  cin>>n;
  rep(i,n){
    string t;
    cin>>t;
    rep(j,5){
      if(t[0]==s[j]) c[j]++;
    }
  }
  ll ans=0;
  rep(i,3){
    for(int j=i+1;j<4;j++){
      for(int k=j+1;k<5;k++){
        ans+=c[i]*c[j]*c[k];
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3640
n = int(input())
h = list(map(int,input().split()))

ans = 0

def mizu(h,l,r) :
    for i in range(l,r+1) :
        h[i] -= 1

while True :
    for i in range(n) :
        l = n + 0
        if h[i] == 0 :
            pass
        else :
            l = i + 0
            break

    for j in range(l,n) :
        r = n-1
        if h[j] == 0 :
            r = j - 1
            break
        else :
            pass

    if l==n :
        break
    else :
        mizu(h,l,r)
        ans += 1

print(ans)

Measured memory_bytes: 3064
import numpy as np

S = str(input())

if len(S)%2 == 0:
    zenhan = S[:int(len(S)/2)]
    kouhan = S[int(len(S)/2):]
else:
    zenhan = S[:int(len(S)/2)]
    kouhan = S[int(len(S)/2)+1:]
    
ans = 0
for i in range(len(zenhan)):
    if zenhan[i] != kouhan[::-1][i]:
        ans += 1

print(ans)


Measured memory_bytes: 12388
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
    int N,K,result,tmp;
    cin >> N >> K;
    result = 0;
    for(int i = 0 ; i < N; i++){
        cin >> tmp;

        if(tmp >= K){
            result++;
        }

    }

    cout << result << endl;

}


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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const float INF = INFINITY;

int main(){
    int ans = 0;
    char ch;
    for (int i = 0; i < 4; i++)
    {
        cin >> ch;
        ans += (ch == '+'? 1: -1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

#define double long double

int N;
double x[10], y[10];
double ans;

void dfs(double dist, int n, int state){
    if(state == (1 << N) - 1){
        ans += dist;
        return;
    }
    REP(i, N){
        if(state & (1 << i)) continue;
        dfs(dist + sqrtf64x((x[n] - x[i]) * (x[n] - x[i]) + (y[n] - y[i]) * (y[n] - y[i])), i, state | (1 << i));
    }
}

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

signed main(){
    cin >> N;
    REP(i, N) cin >> x[i] >> y[i];
    REP(i, N) dfs(0, i, 1 << i);
    printf("%.9Lf\n", ans / fact(N));
    return 0;
}

Measured memory_bytes: 3828
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	dy := [4]int{-1, 0, 0, 1}
	dx := [4]int{0, -1, 1, 0}
	for {
		h := getNextInt(scanner)
		w := getNextInt(scanner)
		if h == 0 {
			break
		}
		grid := makeGrid(h, w)
		a := [2]int{}
		b := [2]int{}
		for i := 0; i < h; i++ {
			s := getNextString(scanner)
			for j := 0; j < w; j++ {
				if s[j] == '#' {
					grid[i][j] = math.MaxInt32
					continue
				}
				if s[j] == 'A' {
					a[0] = i
					a[1] = j
					continue
				}
				if s[j] == 'B' {
					b[0] = i
					b[1] = j
				}
				grid[i][j] = math.MaxInt32 - 1
			}
		}
		q := make([][2]int, 0)
		q = append(q, a)
		for len(q) > 0 {
			p := q[0]
			q = q[1:]
			for i := 0; i < 4; i++ {
				yy := p[0] + dy[i]
				xx := p[1] + dx[i]
				if yy == a[0] && xx == a[1] {
					continue
				}
				if yy < 0 || yy >= h {
					continue
				}
				if xx < 0 || xx >= w {
					continue
				}
				if grid[yy][xx] == math.MaxInt32 {
					continue
				}
				if grid[yy][xx] <= grid[p[0]][p[1]]+1 {
					continue
				}
				grid[yy][xx] = grid[p[0]][p[1]] + 1
				q = append(q, [2]int{yy, xx})
			}
		}
		move := getNextString(scanner)
		i := 0
		m := len(move)
		for {
			if i > 400 {
				fmt.Fprintln(writer, "impossible")
				break
			}
			if grid[b[0]][b[1]] <= i {
				fmt.Fprintln(writer, fmt.Sprintf("%d %d %d", i, b[0], b[1]))
				break
			}
			switch move[i%m] {
			case '8':
				if b[0] > 0 {
					b[0]--
				}
			case '6':
				if b[1]+1 < w {
					b[1]++
				}
			case '4':
				if b[1] > 0 {
					b[1]--
				}
			case '2':
				if b[0]+1 < h {
					b[0]++
				}
			}
			i++
		}
	}
}
func makeGrid(h, w int) [][]int {
	index := make([][]int, h, h)
	data := make([]int, h*w, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}



Measured memory_bytes: 1520
#include<iostream>

using namespace std;

int main(){
	int input;
	int i = 0;

	while (1){
		cin >> input;

		if (input == 0){
			break;
		}

		cout << "Case " << i + 1 << ": " << input << endl;
		i++;
	}


	//system("pause");
	return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
    int H, W, N; cin >> H >> W >> N;
    map<pair<int, int>, long long> m;
    while (N--) {
        int a, b; cin >> a >> b;
        for (int i : {-1, 0, 1}) for (int j : {-1, 0, 1}) {
            if (2 <= a + i && a + i <= H - 1 &&
                2 <= b + j && b + j <= W - 1) m[{a + i, b + j}]++;
        }
    }
    vector<long long> cnt(10, 0);
    for (auto p: m) cnt[p.second]++;
    cnt[0] = 1LL * (H - 2) * (W - 2);
    for (int i = 1; i <= 9; i++) cnt[0] -= cnt[i];
    for (int i = 0; i < 10; i++) cout << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 56448
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
    cin >> n >> s;
    if(n % 2 == 0) {
        int half = n / 2;
        string t = s.substr(0, half);
        string u = s.substr(half, half);
        if(t == u) {
            cout << "Yes" << endl;
        }else {
            cout << "No" << endl;
        }
        return 0;
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import heapq

x, y, z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)

hq = []
heapq.heapify(hq)
i, j, l = 0, 0, 0

heapq.heappush(hq, [(A[i]+B[j]+C[l])*-1, i, j, l])
Used = []

for i in range(k):
    now = heapq.heappop(hq)
    print(now[0]*-1)
    i = now[1]
    j = now[2]
    l = now[3]

    if i >= x-1:
        pass
    elif [(A[i+1]+B[j]+C[l])*-1, i+1, j, l] not in Used:
        Used.append([(A[i+1]+B[j]+C[l])*-1, i+1, j, l])
        heapq.heappush(hq, [(A[i+1]+B[j]+C[l])*-1, i+1, j, l])
        
    if j >= y-1:
        pass
    elif [(A[i]+B[j+1]+C[l])*-1, i, j+1, l] not in Used:
        Used.append([(A[i]+B[j+1]+C[l])*-1, i, j+1, l])
        heapq.heappush(hq, [(A[i]+B[j+1]+C[l])*-1, i, j+1, l])
        
    if l >= z-1:
        pass
    elif [(A[i]+B[j]+C[l+1])*-1, i, j, l+1] not in Used:
        Used.append([(A[i]+B[j]+C[l+1])*-1, i, j, l+1])
        heapq.heappush(hq, [(A[i]+B[j]+C[l+1])*-1, i, j, l+1])
        
    # print(hq)

Measured memory_bytes: 5096
#!/usr/bin/perl
my ($s) = map { $_ - 0 } split(/\s+/,<STDIN>);
my $b = 10 ** 9;
my $s1 = $s % $b;
my $s2 = int(( $s - $s1 ) / $b);
if( $s1 > 0 ){
  $s2 ++;
  $s1 = $b - $s1;
}
print "0 0 $b $s1 1 $s2\n";
exit(0);


Measured memory_bytes: 512
/*
   Author : tarang
*/
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with(false); cin.tie(0);cout.tie(0);
const int MOD = 1000000007;
#define PI = acos(-1)
using namespace std ;
int a[106];
int main(){
    ll k , x ;
    cin >> k >> x ;
    if(500*k >= x){
    	cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}



Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int n,arr[100005],ans,DP[100005];
int dp(int id){
	if(id>=n-1)return 0;
	if(DP[id]!=-1) return DP[id];
	int mini1=1000000000, mini2=1000000000;
	if(id+1<=n-1) mini1 = dp(id+1) + abs(arr[id]-arr[id+1]);
	if(id+2<=n-1) mini2 = dp(id+2) + abs(arr[id]-arr[id+2]);
//	printf("%d %d = %d\n%d %d = %d\n",id,id+1,mini1,id,id+2, mini2);
	return DP[id] = min(mini1,mini2);
}

int main(){
	memset(DP,-1,sizeof(DP));
	scanf("%d",&n);
	for (int i =0;i<n;i++){
		scanf("%d",&arr[i]);
	}
	ans = dp(0);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <vector>

using namespace std;

struct xyz {
  int x;
  int y;
  int z;
};

struct tup {
  struct xyz coord;
  int ans;
};

struct tup init(int rest, int a, int b, int c, int***table)
{

  int ans = 0;
  int use500 = 0;
  int use100 = 0;
  int use50 = 0;

  int max500 = ( ((rest / 500) <= a) ? (rest/500) : a);
/*debug*/  cerr << "max500: " << max500 << endl;
  int max100 = 0;
  int max50 = 0;

  struct tup temp;
/*debug*/  cerr << "rest: " << rest << endl;
  rest -=  500 * max500 ;
/*debug*/  cerr << "rest: " << rest << endl;

  if (rest == 0) {
/*debug*/  cerr << "before table: " << endl;
    ans = table[max500][0][0] = 1;
/*debug*/  cerr << "after table: " << endl;

    temp.coord = {max500, 0, 0};
    temp.ans = 1;
    return temp;


  } else {
/*debug*/  cerr << "rest: " << rest << endl;
    max100 = ( ((rest / 100) <= b)? (rest/100) : b);
/*debug*/  cerr << "max100: " << max100 << endl;
    rest -= 100 * max100;

    if (rest == 0) {

/*debug*/  cerr << "table access: " << endl;
      table[max500][max100][0] = ans = 1;
/*debug*/  cerr << "after table access: " << endl;
      temp.coord = {max500, max100, 0};
      temp.ans = 1;
      return temp;
    } else {
      max50 = ( ((rest / 50) <= b)? (rest/50) : b);
      rest -= 50 * max100;

      if (rest == 0) {
        ans = table[max500][max100][max50] = 1;
        temp.coord = {max500, max100, max50};
        temp.ans = 1;
        return temp;
      } else {
        // return 0;
        temp.ans = 0;
        return temp;
      }
    }
  }




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

  int ans = 0;
  int rest = x;
  int secrest;
  int secrest2;
  int thirest;
  int thirest2;
  for (int i = 0; i <= a; i++) {
    rest = x - i * 500;
    secrest = rest;
    if (rest < 0) break;
    
    for (int j = 0; j <= b; j++) {
      secrest2 = secrest;
      secrest2 -= j * 100;
      thirest = secrest2;
      if (secrest < 0) break;
      for (int k = 0; k <= c; k++) {
         thirest2 = thirest;
         thirest2 -= k * 50;
        if (thirest2 < 0) break;
        if (thirest2 == 0) ans++;
      }
    }
  }
  cout << ans << endl;

  

  return 0;
}


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


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}

int main(){
    ll N,K;
    cin>>N>>K;
    v A(N);
    rep(i,0,N)cin>>A[i];

    rep(i,0,N-K){
        YN(A[i]< A[i+K]);
    }
    return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
void int_to_binary(int a,int n,vector<int>&v){//空のvectorを渡すこと
    for(int i=0;i<n;i++){
        v.push_back(a%2);
        a/=2;
    }
}
typedef long long ll;
int main(){
    string S;
    cin>>S;
    int N=pow(2,S.size()-1);
    vector<int>v;
    ll a = S[0]-'0';
    ll sub=0;
    for(int i=0;i<N;i++){//bit全探索
        v.clear();
        vector<int>v;
        int_to_binary(i,S.size()-1,v);
        for(int j=0;j<S.size()-1;j++){//何文字目か
            if(v[j]==0){
                a=a*10+(S[j+1]-'0');
            }
            else{
                sub+=a;
                a=S[j+1]-'0';
            }
        }
        sub+=a;
        a=S[0]-'0';
    }
    cout<<sub<<endl;
}

Measured memory_bytes: 256
import sys

input=sys.stdin.readline

N,Q=map(int,input().split())
kouji=[]
for i in range(0,N):
    s,t,x=map(int,input().split())
    kouji.append([x,s,t])

d=[]
for i in range(0,Q):
    d.append(int(input()))

kouji.sort(reverse=True)

# N: 処理する区間の長さ

N0 = 2**(Q-1).bit_length()
data = [None]*(2*N0)
INF = (-1,-1)
# 区間[l, r+1)の値をvに書き換える
# vは(t, value)という値にする (新しい値ほどtは大きくなる)
def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得
def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す
def query(k):
    return _query(k)[1]

time=0
for i in range(0,N):
    x,s,t=kouji[i]
    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if d[test]>=s-x:
            end=test
        else:
            start=test
    if d[start]>=s-x:
        l=start
    elif d[end]>=s-x:
        l=end
    else:
        l=Q

    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if t-x-1>=d[test]:
            start=test
        else:
            end=test
    if t-x-1>=d[end]:
        r=end
    elif t-x-1>=d[start]:
        r=start
    else:
        r=-1
    if r!=-1 and l!=Q and r>=l:
        update(l,r+1,(time,x))
    time+=1

for i in range(0,Q):
    print(query(i))


Measured memory_bytes: 106332
import sys
input = sys.stdin.readline


n, w = map(int, input().split())
info = [list(map(int, input().split())) for i in range(n)]

dp = [0]*(w + 1)
for i in range(n):
    for j in range(w + 1):
        if j - info[i][1] < 0:
            continue
        else:
            dp[j] = max(dp[j], dp[j - info[i][1]] + info[i][0])
print(dp[w])


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

using namespace std;

typedef long long int64;

int main()
{
  int64 N, M;
  cin >> N >> M;

  auto get = min(N, M / 2);

  int64 ret = get;
  N -= get;
  M -= get * 2;
  ret += M / 4;


  cout << ret << endl;

}

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


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    for(int i=0; i<n; i++){
        cin>>w[i]>>v[i];
    }
    int sum=1;
    for(int i=0; i<n; i++){
        sum+=v[i];
    }
    ll dp[sum][n+1];
    dp[0][0]=0;
    for(int i=0; i<=sum; i++){
        for(int j=0; j<=n; j++){
            if(i!=0 && j==0){
                dp[i][j]=INT_MAX;
                continue;
            }
            if(i==0){
                dp[i][j]=0;
                continue;
            }
            ll take=INT_MAX,not_take=INT_MAX;
            if(v[j-1]<=i){
                take=w[j-1]+dp[i-v[j-1]][j-1];
            }
            not_take=dp[i][j-1];
            //cout<<take<<" "<<not_take<<endl;
            dp[i][j]=min(take,not_take);
        }
    }
    int ans=0;
    for(int i=0; i<=sum; i++){
        for(int j=0; j<=n; j++){
            if(dp[i][j]<=W)ans=max(ans,i);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 82524
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = {int(input()) for i in range(N)}

for i in range(3):
    if A[i][0] in b and A[i][1] in b and A[i][2] in b:
        print('Yes')
        exit()
    elif A[0][i] in b and A[1][i] in b and A[2][i] in b:
        print('Yes')
        exit()
if (A[0][0] in b and A[1][1] in b and A[2][2] in b) or (A[0][2] in b and A[1][1] in b and A[2][0] in b):
    print('Yes')
    exit()

print('No')

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COUT(x) cout << x << endl
//#define int long long

template<typename T> constexpr auto square(T x) { return (x) * (x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	int K, X;
	cin >> K >> X;

	int black = X - K + 1;

	rep(i, 2 * K - 1) {
		cout << black << ' ';
		black++;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
long long n, m, x, t, y;
char s[200000];
long long ans[200000];
int main() {
	scanf("%lld%lld", &n, &m);
	scanf(" %s", s);
	t = n;
	while (true) {
		y = m;
		while (y > 0) {
			if (t - y < 0)y--;
			else {
				if (s[t - y] == '1')y--;
				else break;
			}
		}
		if (y == 0) {
			printf("-1\n");
			return 0;
		}
		ans[x] = y;
		x++;
		t -= y;
		if (t == 0)break;
	}
	for (int i = x - 1; i > 0; i--) {
		printf("%lld ", ans[i]);
	}
	printf("%lld\n", ans[0]);
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int ac = 0;
		int wa = 0;
		int tle = 0;


		for(int i = 0; i < N; i++) {
			String s = sc.next();
			if(s.equals("AC"))
				++ac;
			if(s.equals("WA"))
				++wa;
			if(s.equals("TLE"))
				++tle;
		}
		
		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + (N - ac - wa - tle));
		
	}

}


Measured memory_bytes: 58356
#include<stdio.h>

int A[50], n;
int solve (int i, int m)
{
	if(m == 0)
		return 1;
	if(i >= n)
		return 0;
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res; 
}
int main()
{
	int  q, k;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", &A[i]);
	scanf("%d", &q);
	for(int i = 0; i < q; i++)
	{
		scanf("%d", &k);
		if(solve(0, k))
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;
}



Measured memory_bytes: 2696
#include<iostream>
#include<string>

using namespace std;

int main(){
    int N;
    string S1,S2;
    cin>>N>>S1>>S2;

	long count=0;
	long long sum;
	int i;
	if(S1[0]==S2[0]){
		sum=3;
		i=1;
	}
	else{
		sum=6;
		i=2;
	}
	for(i=i ; i<N ; i++){
		if(S1[i]==S2[i]){
			if(S1[i-1]==S2[i-1])sum*=2;
			//else if(S1[i-1]!=S2[i-1])sum*=1;
		}
		else if(S1[i]!=S2[i]){
			if(S1[i-1]==S2[i-1])sum*=2;
			else if(S1[i-1]!=S2[i-1])sum*=3;
			i+=1;
		}
		sum=sum%1000000007;
	}
    cout<<sum<<endl;
    
    return 0;
}


Measured memory_bytes: 256
let rev_iter (f : int -> unit) (a : int array) =
  for i = Array.length a - 1 downto 0 do
    f a.(i)
  done

let counting_sort a b k =
  let c = Array.make (k + 1) 0 in
  Array.iter (fun e -> c.(e) <- c.(e) + 1) a;
  Array.iteri (fun i _ -> if i <> 0 then c.(i) <- c.(i) + c.(i-1)) c;
  rev_iter (fun e -> b.(c.(e)-1) <- e; c.(e) <- c.(e) - 1) a

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun e -> e)) in
  let b = Array.make n 0 in
  counting_sort a b 10000;
  Array.iteri (fun i e -> Printf.printf (if i <> 0 then " %d" else "%d") e) b;
  print_newline ()

Measured memory_bytes: 36216
#include <iostream>
#include <iomanip>
using namespace std;
const double PI = 3.141592653589793238460;

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    cout << setprecision(20) << 2*n*PI << "\n";

    return 0;
}

Measured memory_bytes: 3764
import sys


def solve(sx: int, sy: int, tx: int, ty: int):
    print("U"*(ty-sy)+"R"*(tx-sx)+"D"*(ty-sy)+"L"*(tx-sx)+"L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"+"R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U")
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    sx = int(next(tokens))  # type: int
    sy = int(next(tokens))  # type: int
    tx = int(next(tokens))  # type: int
    ty = int(next(tokens))  # type: int
    solve(sx, sy, tx, ty)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n,m=map(int,input().split())
l=list(map(int,input().split()))
b=True
while b:
  b1=False
  l1=list(str(n))
  for i in l1:
    if int(i) in l:
      b1=True
  if b1==False:
    b=False
    print(n)
    break
  else:
    n+=1

Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

N_MAX = 2 * 10^5
fac = Array{Int}(N_MAX+1)
inv = Array{Int}(N_MAX+1)
MOD = 10^9 + 7
#初期化
function COMINT();fac[1] = 1;for i in 1:N_MAX-1;fac[i+1] = fac[i] * (i+1) % MOD;end;for i in 1:N_MAX;inv[i] = powermod(fac[i], MOD-2, MOD);end;end;
#nCk
function Comb(n, k);if n <= 0 || k < 0;return 0;end;if k > n;return 0;end;if k == 0 || n == k;return 1;end;return ((fac[n] * inv[k]) % MOD * inv[n-k])%MOD;end;
function H(n, m);return Comb(n + m, m);end;
function main()
    COMINT()
    n,k = parseInt.(split(readline()))
    m = min(k, n-1)
    ans = 0
    for i in 0:m
        ans += (Comb(n,i) * H(n-1-i,i)) % MOD
        ans %= MOD
    end
    println(ans)
end
main()



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

int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
}

int main(){
	int a,b;
	while(cin>>a>>b){
		cout<<gcd(a,b)<<endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ll n,i,j,k,c=1,x=1,t;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++)
          if(s[i]=='7')
    {
              cout<<"Yes";return 0;
    }
   cout<<"No";
}


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

using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	vector<int> deg(n + 1);
	vector<vector<int>> nei(n + 1, vector<int>());
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		deg[x]++, deg[y]++;
		nei[x].push_back(y);
		nei[y].push_back(x);
	}
	vector<int> c;
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		c.push_back(x);
	}
	sort(c.begin(), c.end());
	// for (int i = 0; i < n; i++) {
	// 	cout << c[i] << endl;
	// }
	set<pair<int, int>> node;
	vector<int> ins(n + 1, 1);
	for (int i = 1; i <= n; i++) {
		node.insert(make_pair(deg[i], i));
	}
	vector<int> d(n + 1);
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		auto it = node.begin();
		int u = it -> second;
		// cout << u << ": " << (it -> first) << endl;
		node.erase(it);
		d[u] = c[i];
		ins[u] = 0;
		for (auto v: nei[u]) {
			if (ins[v]) {
				node.erase(make_pair(deg[v], v));
				deg[v]--;
				ans += d[u];
				node.insert(make_pair(deg[v], v));
			}
		}
	}
	printf("%lld\n", ans);
	for (int i = 1; i <= n; i++) {
		printf("%d%c", d[i], " \n"[i == n]);
	}
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define FORR(i, m, n) for (ll i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;cin >> h >> w;
    char a[h][w];
    REP(i,h){
      REP(j,w){
        cin >> a[i][j];
      }
    }
    REP(i,h-1){
      REP(j,w-1){
        if(a[i][j+1]=='#'&&a[i+1][j]=='#'){
          cout << "Impossible" << endl;
          return 0;
        }
      }
    }
    cout << "Possible" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

string s,l,r,tmp;
int main() {
    cin >> s;
    r = s;
    int q,rev = 0;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int T;
        cin >> T;
        if(T == 1){
            //reverse(s.begin(),s.end());
            rev++;
            tmp = l;
            l = r;
            r = tmp;
        }else{
            int F;
            char C;
            cin >> F >> C;
            if(F == 1){
                l += C;
            }else{
                r += C;
            }
        }
    }
    if(rev%2 == 1){
        reverse(l.begin(),l.end());
        s = l+r;
        //reverse(s.begin(),s.end());
       // reverse(r.begin(),r.end());
        //reverse(s.begin(),s.end());
        cout << s << endl;
    }else{
        //s=r+l;
        reverse(l.begin(),l.end());
        s = l+r;
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 2008
a,b=map(int,input().split())
l=list(map(int,input().split()))
lnew=sorted(l)
k=sum(l)
flag=True
for i in range(b):
    if lnew[a-1-i]<sum(l)/4/b:
        flag=False
        break
    else:
        continue
if flag==True:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int q = int.Parse(Console.ReadLine());
            int[] t = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans = 0;
            for (int i = 0; i < q; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (t[i] == s[j]) { ans++; break; }
                }
            }
            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 18316
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define nmod         -1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define xxx         exit(0);
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) 
{
    return (ll)(log(x)/log(base));
}
ll n,W,dp[100005],w[105],v[105];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS; 
    while(TESTS--)
    {
    	ll i,l,j,x1,y1,ans,x,y,q;
    	cin>>n>>W;
    	rep(i,0,n) 
		cin>>w[i]>>v[i];

		rep(i,0,100005) 
		dp[i]=mod;
		dp[0]=0;
		rep(i,0,n)
		{
			per(j,100000,0)
			{
				if(j>=v[i])
				dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
			}
		}
		per(i,100000,0)
		{
			if(dp[i]<=W)
			{
				x=i;
				break;
			}
		}
		cout<<x;
	}
	return 0;
}


Measured memory_bytes: 4480
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  string s;cin >> s;
  if((int)s.size()%2==1){
    cout << "No" << "\n";
  }
  else{
    rep(i,s.size()){
      if(i%2==0&&s[i]!='h'){
	cout << "No" << "\n";
	return 0;
      }
      if(i%2==1&&s[i]!='i'){
	cout << "No" << "\n";
	return 0;
      }      
    }
    cout << "Yes" << "\n";
  }
  return 0;
}


Measured memory_bytes: 764
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    ll d,n;cin >> d >> n;
    ll x=1;
    rep(i,d){
        x*=100;
    }
    ll ans;
    
    ans=x*n;
    if(d==0&&n==100)ans++;
    if(d==1&&n==100)ans+=100;
    if(d==2&&n==100)ans+=10000;
    cout << ans << endl;
    return 0;
}


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

using namespace std;


char  G[1050][1050];
long long dp[1050][1050];
const int mod =1e9+7;

int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)scanf("%s",G[i]+1);
	
	dp[1][1]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(G[i][j]=='.'){
				if(i<n&&G[i+1][j]=='.'){
					dp[i+1][j]+=dp[i][j];
					dp[i+1][j]%= mod;
				}
				if(j<m&&G[i][j+1]=='.'){
					dp[i][1+j]+=dp[i][j];
					dp[i][1+j]%= mod;
				}	
			}
		}
	}
	
	cout<<dp[n][m];
	return 0;
}


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

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

int main(){
  int d,t,s;
  cin >> d >> t >> s;

  if(double(d/(double)s)<=t) cout << "Yes";
  else cout << "No";
}

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

int main(){
  int N,T;
  cin >> N >> T;
  
  int min_c = 1000;
  int ans;
  bool judge = true;
  for ( int i = 0 ; i < N ; i++ ){
  	int c,t;
    cin >> c >> t;
    if ( t <= T ){
    	min_c = min( min_c , c );
      	judge = false;
    }
  }
  if(judge)
    cout << "TLE" << endl;
  else
    cout << min_c << endl;
}

Measured memory_bytes: 256
/**
 * author:    Ziel
 * created:   23.04.2020 20:19:46
**/

// ~zaletaet~

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back

using namespace std;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const double EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	while (true) {
		c -= b;
		if (c <= 0) return !(cout << "Yes");
		a -= d;
		if (a <= 0) return !(cout << "No");
	}

	return 0;
}

/*
	Raise your standard.
*/

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 H, A;
	cin >> H >> A;
	cout << (H+A-1)/A << endl;
}


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

typedef long long ll;

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

    int n; cin >> n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        if(i%3==0 || i%5==0) continue;
        else ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#!/usr/bin/env python3
import sys, math


def solve(A: int, B: int):
    print(math.ceil((B-1)/(A-1)))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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

bool solve(int h, int w, vector<string> &v){
  if(h != 0 && w != 0){
    if((v[h][w - 1] == '#' && v[h - 1][w] != '#') || (v[h][w - 1] != '#' && v[h - 1][w] == '#')){
      if(h == v.size() - 1 && w == v[0].size() - 1){
        return true;
      }
    }else{
      return false;
    }
  }

  if(v.size() - 1 == h && v[h][w + 1] == '#'){
    return solve(h, w + 1, v);
  }else if(v.size() - 1 == h && v[h][w + 1] != '#'){
    return false;
  }else if(v[0].size() - 1 == w && v[h + 1][w] == '#'){
    return solve(h + 1, w, v);
  }else if(v[0].size() - 1 == w && v[h + 1][w] != '#'){
    return false;
  }else if(v[h + 1][w] == '#' && v[h][w + 1] == '.'){
    return solve(h + 1, w, v);
  }else if(v[h][w + 1] == '#' && v[h + 1][w] == '.'){
    return solve(h, w + 1, v);
  }else{
    return false;
  }

}

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> v(h);
  for(int i = 0;i < h;i++){
    cin >> v[i];
  }
  /*for(auto i: v){
    cout << i << endl;
  }*/
  if(solve(0, 0, v)){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

int cnt[20];
LL pw[20];
LL ans;
int D,len;

void pre()
{
	for (int D_=D;D_;D_/=10,++len);
	for (int i=0;i<10;++i)
		for (int j=0;j<10;++j)
			++cnt[i-j+10];
	pw[0]=1;
	for (int i=1;i<=len<<1;++i) pw[i]=10ll*pw[i-1];
}

void dfs(int L,int idx=1,LL cur=0,LL ways=1)
{
	if ((idx<<1)>L)
	{
		if (cur==D) ans+=(L&1?10ll:1ll)*ways;
		return;
	}
	for (int d=-9;d<10;++d)
	{
		LL nxt=cur+d*(pw[L-idx]-pw[idx-1]);
		if (D%pw[idx]==((nxt%pw[idx])+pw[idx])%pw[idx]) dfs(L,idx+1,nxt,ways*(cnt[d+10]-(idx==1)));
	}
}

int main()
{
	//freopen("mirrored.in","r",stdin),freopen("mirrored.out","w",stdout);
	scanf("%d",&D),pre();
	for (int i=len;i<=len<<1;++i) dfs(i);
	printf("%lld\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>

long MAX=999999;

int main(void){
    long int s[1000000]={0},k=0,i,j,n;
    
    for(i=2;i<=MAX;i++){
        if( !s[i] ){
            k++;
            for(j=2;j*i<=MAX;j++){
                s[j*i]=-1;
            }
        }
        s[i]=k;
    }
    
    
    while(EOF != scanf("%ld",&n)){
        printf("%ld\n",s[n]);
    }
    
    
    return 0;
}

Measured memory_bytes: 8840
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    string s;
    cin >> s;
    int n = (int) s.size();
    vector<vector<int>>dp(60, vector<int>(n));
    rep(i,n){
        if(s[i] == 'L')dp[0][i] = i - 1;
        else dp[0][i] = i + 1;
    }
    for(int i = 1; i < 60; i++){
        for(int j = 0; j < n; j++){
            dp[i][j] = dp[i-1][dp[i-1][j]];
        }
    }
    vector<int>ans(n);
    rep(i,n)ans[dp[30][i]]++;
    rep(i,n){
        cout << ans[i] << " \n"[i == n - 1];
    }
}

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

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

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int h;
        cin >> h;

        if(h >= k) ans++;
    }

    cout << ans << endl;
    return 0;    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <math.h>
#include <string>
typedef long long ll;

using namespace std;

int main(){
    int N;
    ll K;
    cin >> N >> K;
    ll ab[100010] = {0};
    for (int i = 0; i < N; i++){
	ll a, b;
	cin >> a >> b;
	ab[a] += b;
    }

    ll cnt = 0;
    for (int i = 1; i <= 1e5; i++){
	if (cnt+ab[i] >= K){
	    cout << i << endl;
	    break;
	} else {
	    cnt += ab[i];
	}
    }

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
/*考察
偶数回Tした後の移動はx軸方向の移動
奇数回Tした後の移動はy軸方向の移動である
最も簡単な考えだと
(偶数回Tした後の移動の和)=x
(奇数回Tした後の移動の和)=y
だとただ近づいていくだけでゴールにたどり着ける

 */
int main(){
    string s;
    cin>>s;
    int x,y;
    cin>>x>>y;
    vector<int> ver,hor;
    int c=0,f=1;
    //最初Fだとそのときだけ前に進むしかなくて回転を選べないから旗
    bool beg=(s[0]=='T');
    for(int i=0;i<s.size()+1;i++){
        if(i<s.size()&&s[i]=='F'){
            c++;
        }    
        else{
            if(c==0){f=f*(-1);c=0;}
            else if(f>0){
                hor.push_back(c);f=f*(-1);c=0;
            } 
            else{
                ver.push_back(c);f=f*(-1);c=0;
            }
        }
    }
    //+5000
    bool dpx[hor.size()+1][10000*2+2]={};
    dpx[0][10000]=true;
    rep(i,hor.size()){
        for(int j=0;j<10000*2+2;j++){
            if(dpx[i][j]){dpx[i+1][j+hor[i]]=true;if(i!=0||beg)dpx[i+1][j-hor[i]]=true;}
        }
    }
    bool dpy[ver.size()+1][10000*2+2]={};
    dpy[0][10000]=true;
    rep(i,ver.size()){
        for(int j=0;j<10000*2+2;j++){
            if(dpy[i][j]){dpy[i+1][j+ver[i]]=true;dpy[i+1][j-ver[i]]=true;}
        }
    }
    if(dpx[hor.size()][10000+x]&&dpy[ver.size()][10000+y]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 78464
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


int gcd(int a, int b){return (b? gcd(b,a%b): a);}

int main(){
    int n,a;
    bool ok=true;
    cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    int ans=p[0];
    rep(i,n) ans=gcd(ans,p[i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640