akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7)


par  =[]
N = int(input())

graph = []

for i in range(N):
    x, y = [int(s) for s in input().split()]
    graph.append((i, x, y))

sort_x = sorted(graph, key=lambda x: x[1])
sort_y = sorted(graph, key=lambda x: x[2])

edges = []

for i in range(len(sort_x)-1):
    i1, a, b = sort_x[i]
    i2, c, d = sort_x[i+1]
    w = min(abs(a-c), abs(b-d))
    edges.append((i1, i2, w))
    i1, a, b = sort_y[i]
    i2, c, d = sort_y[i+1]
    w = min(abs(a-c), abs(b-d))
    edges.append((i1, i2, w))


for i in range(N+1):
    par.append(i)



def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x,y):
    return find(x) == find(y)

def union(x,y):
    x = find(x)
    y = find(y)
    if x != y:
        par[x] = y

ans = 0
edges = sorted(edges, key=lambda x: x[2])
for edge in edges:
    if not same(edge[0], edge[1]):
        union(edge[0], edge[1])
        ans += edge[2]
print(ans)





Measured memory_bytes: 85884
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int H, W, K;
  char S[7][7];

  cin >> H >> W >> K;

  for (int i = 0; i < H; i++) {
    scanf("%s", S[i]);
  }

  int ans = 0;

  for (int i = 0; i < (1 << H); i++) {
    for (int j = 0; j < (1 << W); j++) {
      int counter = 0;
      for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
          if (i & (1 << y) || j & (1 << x)) continue;
          counter += S[y][x] == '#';
        }
      }

      ans += counter == K;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <array>
#include <vector>
#include <cmath>

using namespace std;

static void printArray(int A[], int N) {
  for (int i = 0; i < N; i++) {
    cout << A[i] << endl;
  }
}

static void inputArray(int A[], int N) {
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
}

static int insersionSort(int A[], int N, int g) {
  int v, j, count = 0;
  for (int i = g; i < N; i++) {
    v = A[i];
    j = i - g;
    while (j >= 0 && A[j] > v) {
      A[j + g] = A[j];
      j = j - g;
      count++;
    }
    A[j + g] = v;
  }
  return count;
}

static int shellSort(array<int, 1000000>& A,  int N) {
//  array<int, 1000000> sortArray(A);
  int g = 1, startedIndex = 0, count = 0;
  vector<int> G = { 1 };
  for (; g < N; ) {
    G.push_back(g);
    g *= 5;
  }
  for (g = G.size() - 1;  g >= 0; g--) {
    if (G[g] * 2 > N) {
      continue;
    }
    if (startedIndex == 0) {
      startedIndex = g;
    }
//    count += insersionSort(sortArray.data(), N, G[g]);
    count += insersionSort(A.data(), N, G[g]);

    // ★ここは不要？？
/*
    if (count > pow(N, 1.5f)) {
      sortArray = A;
      continue;
    } 
    */
  }

  cout << startedIndex + 1 << endl;
  for (int i = startedIndex; i >= 0; i--) {
    cout << G[i];
    cout << ' ';
  }
  cout << endl;
  cout << count << endl;
//  A = sortArray;
  return count;
}
  
int main() {
  int N;
  cin >> N;

  array<int, 1000000> A;
  inputArray(A.data(), N);

  shellSort(A, N);

  printArray(A.data(), N);
  
  return 0;
}



Measured memory_bytes: 7084
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n, k;
	vector<int> minus;
	vector<int> plus;
	minus.push_back(0);
	plus.push_back(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++){
		int x;
		cin >> x;
		if (x < 0) minus.push_back(-x);
		if (x > 0) plus.push_back(x);
		if (x == 0) k--;
	}
	sort(minus.begin(), minus.end());
	sort(plus.begin(), plus.end());

	int ans = MOD;
	for (int i = 0; i <= min((int)minus.size()-1, k); i++){
		if (k-i < (int)plus.size()) ans = min(ans, minus[i] + plus[k-i] + min(minus[i], plus[k-i]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1020
#include <algorithm>
#include <cstdio>
#include <functional> 
#include <iostream>
#include <vector>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
inline char gc() {
//	return getchar();
	static char buf[100000],*l=buf,*r=buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void rd(T &x) {
	x=0; int f=1,ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=gc();}
	x*=f;
}
template<class T> inline bool Cmin(T &x,T y) {return x>y?x=y,1:0;}
const int inf=1e9;
const int maxn=1e5+50;
const int maxm=1e5+50;
int n,m,a[maxm],b[maxm],c[maxm];
int deg[maxn];
bool good[maxn];
vector<int> Y,Z; 
namespace us {
	int fa[maxn],siz[maxn];
	void init(int n) {
		for(int i=1;i<=n;++i) fa[i]=i,siz[i]=1;
	}
	int find(int a) {return a==fa[a]?a:fa[a]=find(fa[a]);}
	inline bool merge(int a,int b) {
		a=find(a),b=find(b);
		if(a==b) return 0;
		fa[a]=b,siz[b]+=siz[a];
		return 1;
	}
}
inline void addedge(int u,int v) {
	us::merge(u,v);
	++deg[u],++deg[v];
}
int main() {
	rd(n),rd(m);
	us::init(n);
	for(int i=1;i<=m;++i) {
		rd(a[i]),rd(b[i]),rd(c[i]),--c[i];
		addedge(a[i],b[i]);
	}
	for(int i=1;i<=n;++i) if(deg[i]>2) good[us::find(i)]=1;
	int X=0;
	for(int i=1;i<=n;++i) if(us::find(i)==i) {
		if(!good[i]&&us::siz[i]>=2) ++X;
	}
	int now=0; bool flag=0;
	for(int i=1;i<=m;++i) if(c[i]) {
		if(good[us::find(a[i])]) {
			if(a[i]==b[i]) Z.push_back(c[i]);
			else flag=1,now+=c[i];
		}
		else {
			if(a[i]==b[i]) Y.push_back(c[i]-1);
			else now+=c[i];
		}
	}
	if(Y.size()) sort(Y.begin(),Y.end(),greater<int>());
	if(Z.size()) sort(Z.begin(),Z.end(),greater<int>());
	for(int i=0;i<Y.size();++i) now+=Y[i];
	int an=inf;
	for(int i=0,j=Y.size()-1;i<=Z.size();++i) {
		while(j>=0&&now-Y[j]>=X) now-=Y[j--];
		if((flag||i||X==0)&&now>=X) Cmin(an,i+2*(j+1));
		if(i<Z.size()) now+=Z[i];
	}
	if(an==inf) puts("-1");
	else {
		for(int i=1;i<=m;++i) if(a[i]!=b[i]) ++an;
		an+=X;
		printf("%d\n",an);
	}
	return 0;
}

Measured memory_bytes: 5860
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        for (int i = x - k + 1 ; i <= x + k - 1; i++) {
            System.out.print(i + " ");            
        }

    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

vvl G;

ll dfs(ll v) {
    vl a;
    for(auto u : G[v]) {
        a.pb(dfs(u));
    }
    sort(all(a));
    ll x = 0;
    rep(i, a.size()) {
        chmax(x, a[i]) + 1;
    }
    return x;
}

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

    G.resize(n);
    exrep(i, 1, n-1) {
        ll v;
        cin >> v;
        v--;
        G[v].pb(i);
    }
    
    out(dfs(0));
    re0;
}

Measured memory_bytes: 13568
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, M = map(int, input().split())
    A = []
    for i in list(map(int, input().split())):
        A.append((i, 1))
    for i in range(M):
        b, c = map(int, input().split())
        A.append((c, b))

    A = sorted(A)
    # print(A)
    cnt = 1
    ans = 0
    while cnt <= N:
        b, c = A.pop()
        ans += b
        if c > 1:
            c -= 1
            A.append((b, c))
        cnt += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 29576
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    int A = scanner.nextInt();
		    String a = scanner.next();
		    int B = scanner.nextInt();
		    
		    if( a.equals("+") ) 
		    {
		    	System.out.println(A + B);
		    }
		    else 
		    {
		    	System.out.println(A - B);
		    }
		    scanner.close(); }
		  }

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll A, B;
  cin >> A >> B;

  cout << max({2 * A - 1, 2 * B - 1, A + B}) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>

using namespace std;

int read()
{
	int x = 0, f = 1; char c = getchar();
	while(!isdigit(c)) { if(c == '-') f = 0; c = getchar(); }
	while(isdigit(c)) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); }
	return f ? x : -x;
}

const int maxn = 5e5 + 10, maxm = maxn << 2;
int e, n, K;
int to[maxm], nxt[maxm], head[maxn], d[maxn];
int Nxt[maxn], pre[maxn], p[maxn], q[maxn], Ans[maxn];

void add(int x, int y)
{
	to[++e] = y; nxt[e] = head[x]; head[x] = e;
	++d[y];
}

void topsort()
{
	priority_queue<int, vector<int>, greater<int> > Q;
	for(int i = 1; i <= n; ++i) if(!d[i]) Q.push(i);

	int tot = 0;
	while(!Q.empty())
	{
		int u = Q.top(); Q.pop();
		Ans[u] = ++tot;
		for(int i = head[u]; i; i = nxt[i])
		{
			int v = to[i]; --d[v];
			if(!d[v]) Q.push(v);
		}
	}

	for(int i = 1; i <= tot; ++i) printf("%d\n", Ans[i]);
	cout << endl;
}

int main()
{
	
	n = read(), K = read();
	for(int i = 1; i <= n; ++i) p[i] = read(), q[p[i]] = i;

#define nxt Nxt
	memset(nxt, 0x3f, sizeof(nxt));

	set<int> S;
	for(int i = 1; i <= n; ++i)
	{
		if(i >= K + 1) S.erase(S.lower_bound(p[i - K]));
		set<int>::iterator it = S.lower_bound(p[i]);
		//if(it != S.begin()) pre[i] = max(pre[i], *(--it)), ++it;
		//if(it != S.end()) nxt[i] = min(nxt[i], *it); /**/
		if(it != S.begin()) add(q[*(--it)], i), ++it;
		if(it != S.end()) add(i, q[*it]);//nxt[i] = min(nxt[i], *it); /**/
		S.insert(p[i]);
	}

	S.clear();
	for(int i = n; i >= 1; --i)
	{
		if(n - i >= K) S.erase(S.lower_bound(p[i + K]));
		set<int>::iterator it = S.lower_bound(p[i]);
		//if(it != S.begin()) pre[i] = max(pre[i], *(--it)), ++it;
		//if(it != S.end()) nxt[i] = min(nxt[i], *it);
		if(it != S.begin()) add(q[*(--it)], i), ++it;
		if(it != S.end()) add(i, q[*it]);//nxt[i] = min(nxt[i], *it); /**/
		S.insert(p[i]);
	}

	for(int i = 1; i <= n; ++i)
	{
		//if(pre[i] != 0) add(q[pre[i]], i), cout << q[pre[i]] << ' ' << i << endl;
		//if(nxt[i] != 0x3f3f3f3f) add(i, q[nxt[i]]), cout << i << ' ' << q[nxt[i]] << endl;;
	}

	topsort();

	return 0;
}

Measured memory_bytes: 56320
A, B, C = map(int, input().split())
if A%2 == B%2 == C%2:
    nums = sorted([A, B, C])
    print((nums[2]*2 - (nums[0]+nums[1]))//2)
else:
    if A%2 == B%2:
        A += 1
        B += 1
    elif A%2 == C%2:
        A += 1
        C += 1
    else:
        B += 1
        C += 1
    nums = sorted([A, B, C])
    print((nums[2]*2 - (nums[0]+nums[1]))//2 + 1)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=998244353;
const long long int INF=99999999999999999;

long long int n,m,sum,res=0;

int main() {
	cout << fixed << setprecision(10);
    cin>>n>>m;
    if(n<=9&&m<=9){cout<<n*m;}
    else{cout<<-1<<endl;}
    
} 


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a,b,c,ans;
int main(){
    scanf("%lld %lld",&a,&b);
    c=__gcd(a,b); ans=1;
    for(ll i=2;i*i<=c;++i){
        if(c%i==0){
            while(c%i==0) c/=i;
            ans++;
        }
    }
    if(c!=1) ans++;
    printf("%lld\n",ans);
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N - 1);
    rep(i, N)
    {
        cin >> A.at(i);
    }
    rep(i, N)
    {
        cin >> B.at(i);
    }
    rep(i, N - 1)
    {
        cin >> C.at(i);
    }
    int ans = 0;
    rep(i, N)
    {
        ans += B.at(i);
        if (i < N - 1 && (A.at(i) == A.at(i + 1) - 1))
        {
            ans += C.at(A.at(i) - 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;

int main() {

	long N; cin >> N;
	long A[200009] = {};

	for (int i = 1; i <= N; i++) cin >> A[i];
    long B[200009] = {}; for(int i = 1; i <= N;i++) B[i] = A[i];
        
	sort(A + 1, A + N + 1);

    if (A[N] == A[N - 1]) for(int i = 1; i <= N; i++) cout << A[N] << endl;
    else for(int i = 1; i <= N; i++) if(B[i] == A[N]) cout << A[N - 1] << endl; else cout << A[N] << endl;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sum_up(x)  (x*(x+1))/2
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define BSv(v,a) binary_search(v.begin(),v.end(), a)
#define BSa(v,n,a) binary_search(v,v+n, a)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
unsigned int N=1000000;
bool prime[100001];
void sieve(int n)
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
int power(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x*x;
    }
    return res;
}

int nxt()
{
    int x;
    cin >> x;
    return x;
}

bool comp(const pair<pair<int,int>,pair<int,int>>&a,
          const pair<pair<int,int>,pair<int,int>>&b)
{
    if(a.second.first==b.second.first)
        return a.first.first<b.first.first;
    return a.second.first>b.second.first;
}

int32_t main()
{
    base;
    int n=nxt();
    cout<<sp(9)<<2*PI*n;
    return 0;
}


Measured memory_bytes: 3804
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;
use std::collections::HashSet;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn string() -> String {
    read()
}
fn int() -> i64 {
    read()
}
fn char() -> char {
    read::<String>().pop().unwrap()
}
fn vecchar() -> Vec<char> {
    string().chars().collect()
}
fn vecint(n: i64) -> Vec<i64> {
    let mut vec = Vec::new();
    for i in 0..n {
        vec.push(int())
    }
    vec
}

fn main() {
    let a = int();
    let b = int();
    let c = int();
    let mut set = HashSet::new();
    set.insert(a);
    set.insert(b);
    set.insert(c);
    println!("{}", set.len())
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
#define debug(y) cout<<#y<<y<<endl;
int main()
{   long long int n;
   cin>>n;
   vector<long long int>h(n);
   for(auto &x:h)
   {
       cin>>x;
   }
    vector<long long int> dp(n,INF);
    dp[0]=0;
    for(long long int i=0;i<n;i++)
    {

    for(long long int j:{i+1,i+2})
        {
           if(j<n)
           {
               dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
           }

        }
    }

   cout<<dp[n-1];

}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <tuple>
#include <cassert>

const int wmax=4;
const int hmax=4;
const int rmax=5;

const int vx[]={0,1,0,-1};
const int vy[]={-1,0,1,0};

bool simul(std::vector<std::vector<int>> &m,int h,int w){//ある盤面で(h,w)をクリックした結果を上書きし、全消ししているかを返す
    std::queue<std::tuple<int,int,int,int>> drops;
    if(m[h][w]==4){
        m[h][w]=0;
        for (int d = 0; d < 4; ++d) {
            drops.push(std::make_tuple(h,w,d,0));
        }
    }
    else{
        ++m[h][w];
        return false;
    }
    int maxt=0;
    bool needupd=false;
    while(!drops.empty()|| needupd){
        if(needupd){
            needupd=false;
            ++maxt;
            for (int i = 0; i < hmax; ++i) {
                for (int j = 0; j < wmax; ++j) {
                    if(m[i][j]>=5){
                        for (int d = 0; d < 4; ++d) {
                            drops.push(std::make_tuple(i,j,d,maxt));
                        }
                        m[i][j]=0;
                    }
                }
            }
            continue;
        }
        auto t=drops.front();
        int& nh=std::get<0>(t);
        int& nw=std::get<1>(t);
        int& nd=std::get<2>(t);
        int& nt=std::get<3>(t);
        //assert(nd>=0&&nd<4);
        if(maxt<nt){
            ++maxt;
            needupd=true;
            continue;
        }
        drops.pop();
        if(drops.empty())needupd=true;
        nh+=vy[nd];
        nw+=vx[nd];
        if(nh<0||nh>=hmax||nw<0||nw>=wmax)continue;//外に出る
        assert(nh>=0);
        if(m[nh][nw]==0){//通り過ぎる
            drops.push(std::make_tuple(nh,nw,nd,maxt+1));
        }
        else{//ぶつかる
            ++m[nh][nw];

        }
    }
    for (int i = 0; i < hmax; ++i) {
        for (int j = 0; j < wmax; ++j) {
            if(m[i][j]!=0)return false;
        }
    }
    return true;
}

int dfs(std::vector<std::vector<int>> &m,int r){//r回クリックした状態と盤面mから消すまでの最小回数
    if(r>rmax)return rmax+1;
    int ans=rmax+1;
    for (int h = 0; h < hmax; ++h) {
        for (int w = 0; w < wmax; ++w) {
            //if(m[h][w]<r)continue;
            auto tm=m;
            if(simul(tm,h,w))ans=std::min(ans,r);
            else ans=std::min(ans,dfs(tm,r+1));
        }
    }
    return ans;
}

int main(){
    std::vector<std::vector<int>> m(hmax,std::vector<int>(wmax));
    for (int i = 0; i < hmax; ++i) {
        for (int j = 0; j < wmax; ++j) {
            std::cin>>m[i][j];
        }
    }
    for (int i = 0; i < hmax; ++i) {
        for (int j = 0; j < wmax; ++j) {
            if(m[i][j]!=0){
                goto e;
            }
        }
    }
    std::cout<<0<<std::endl;
    return 0;
    e:;
    int ans=dfs(m,1);
    std::cout<<(ans==rmax+1?-1:ans)<<std::endl;

    return 0;
}


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


int main()
{
char s[4];int cnt=0;
scanf("%s",&s);
for(int i=0;i<3;i++){
    if(s[i]==s[i+1])
   { printf("Bad");cnt++;
   break;}
   
}
if(cnt!=1) printf("Good");

return 0;

}
 

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b, m;
  cin >> a >> b >> m;
  vector<int> va(a);
  vector<int> vb(b);
  for (int i = 0; i < a; i++) cin >> va.at(i);
  for (int i = 0; i < b; i++) cin >> vb.at(i);
  int ans = 2000001;
  for (int i = 0; i < m; i++)
  {
    int m1, m2, m3;
    cin >> m1 >> m2 >> m3;
    ans = min(ans, va.at(m1-1) + vb.at(m2-1) - m3);
  }
  sort(va.begin(), va.end());
  sort(vb.begin(), vb.end());
  ans = min(ans, va.at(0) + vb.at(0));
  cout << ans << endl;
  return 0;
}

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

int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  long long int N,S=0,O=0;
  cin >> N;
  long long int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
    O=O+S*A[i];
    O=O%1000000007;
    S=S+A[i];
    S=S%1000000007;
  }
  cout << O <<endl;
}


int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


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

int main() {
    int N, M; cin >> N >> M;
    int i = 1, j = (N + 1) / 2;
    int D = j - i - 1;
    vector<pair<int, int>> ans;
    while(i < j) ans.emplace_back(i++, j--);
    i = N - D, j = N;
    while(ans.size() < M) ans.emplace_back(i++, j--);
    while(ans.size() > M) ans.pop_back();
    assert(ans.size() == M);
    for(auto &[a, b] : ans) cout << a << " " << b << '\n';
    return 0;
}


Measured memory_bytes: 4260
import numpy as np

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
ans = []

for i, v in enumerate(a):
    for _ in range(v):
        ans.append(i+1)
ans = np.array(ans).reshape(H, W)

for i in range(H):
    if i%2 == 1:
        ans[i] = ans[i][::-1]

for j in ans:
    print(*list(j))

Measured memory_bytes: 17988
#include <stdio.h>

int fibonacci(int);

int main()
{
  int n;

  scanf("%d", &n);

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


/* フィボナッチ数列の第n項の値を求めて、返す関数 */
int fibonacci(int n)
{
  int i, fbn[44] = {1,1,};

  for( i = 2; i<=n; i++ )
    fbn[i] = fbn[i-1] + fbn[i-2];

  return fbn[n];
}



Measured memory_bytes: 2108
w = int(input())

result = []
chars = '0+-'
n = 0
while w > (3 ** n - 1) // 2:
    result.append(chars[(w + (3 ** n - 1) // 2) // (3 ** n) % 3])
    n += 1

result.reverse()
print(''.join(result))

Measured memory_bytes: 7672
a = list(input())
if a[0] == a[1] and a[2] == a[3] and a[1] != a[2]:
  print('Yes')
elif a[0] == a[2] and a[1] == a[3] and a[2] != a[1]:
  print('Yes')
elif a[0] == a[3] and a[1] == a[2] and a[3] != a[1]:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <cctype>
#include <iostream>

int main()
{
  std::string S;
  int N, K;
  
  std::cin >> N >> K;
  std::getline(std::cin, S);
  std::getline(std::cin, S);
  
  S[K - 1] = std::tolower(S[K - 1]);
  std::cout << S << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ull unsigned long long 
#define int long long 
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define MAX 1e18
#define PI 3.14159265
const int mod = 1e9 + 7;



int power(int x, int y) 
{ 
   int res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  
 
        y = y>>1; 
 
        if (x<=100000000)
        x = (long long)(x*x);
 
        //cout<<x<<'\n'; 
    } 
    return res; 
} 

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






void solve()
{
    int a;
    cin>>a;

    int ans=a+power(a,2)+power(a,3);


    cout<<ans<<endl;


    return;
}




int32_t main()
{
    IOS;

    solve();
    return 0;
}

Measured memory_bytes: 3644
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <string.h>
#include <sstream>
#include <cctype>
#include <climits>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <vector>
#include <iterator>
#include <algorithm>
#include <stack>
#define _clr(x,y) memset(x,y,sizeof(x))
#define _inf(x) memset(x,0x3f,sizeof(x))
#define pb push_back
#define mp make_pair
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
typedef long long LL;
const LL mo=1000000000+7;
int isprime(int x)
{
	for(int i=2;i*i<=x;i++) if(x%i==0)return 0;return 1;
}
int main()
{
	//ios_base::sync_with_stdio(false);cin.tie(0);
	#ifndef ONLINE_JUDGE
		//freopen("in.txt","r",stdin);
		//freopen("out.txt","w",stdout);
	#endif
	
	LL ans=1;
	int n;
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		if(!isprime(i)) continue;
		LL tmp=n,cnt=1;
		while(tmp)
		{
			cnt+=tmp/i;
			tmp/=i;
		}
		ans=(ans*cnt)%mo;
	}
	cout<<ans<<endl;
	
    return 0;
}

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

#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 3000;

double dp[N][N];
double p[N];
int n;

void solve()
{
  cin >> n;
    
  f(i,n) cin >> p[i+1];
    
  dp[0][0] = 1.00000;  
    
  for(int i=1;i<=n;i++)
  {
    dp[i][0] = dp[i-1][0]*(1-p[i]);  
      
    for(int j=1;j<=i;j++)
        dp[i][j] = (dp[i-1][j]*(1-p[i])) + (dp[i-1][j-1]*p[i]);
  }
    
    
  double ans = 0.00000;
    
  for(int j=(n+1)/2;j<=n;j++) ans+=dp[n][j];
    
  cout << fixed << setprecision(10)<<ans;
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 68992
//
//  main.cpp
//  Making Triangle
//
//  Created by Bryan on 15/08/20.
//  Copyright © 2020 mac. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    long long N;
    scanf ("%lld",&N);
    long long arr[N+2];
    for (long long f = 0; f<N;f++)
        scanf ("%lld",&arr[f]);
    sort(arr,arr+N);
    long long ans = 0;
    for (long long f = 0; f<N;f++)
    {
        for (long long g = f+1; g<N;g++)
        {
            for (long long h = g+1;h<N;h++)
            {
                if (arr[f]+arr[g]>arr[h] && arr[f]!= arr[g] && arr[g]!=arr[h])
                {
                    
                
                    ans++;
                }
                    
            }
        }
    }
    printf ("%lld\n",ans);
}


Measured memory_bytes: 3812
s = input()
total = 0

for bit in range(1 << len(s)-1):
  lis = s[0]
  for i in range(len(s)-1):
    if ((bit>>i) & 1):
      lis += "+"
    lis += s[i+1]
  total += sum(map(int, lis.split("+")))

print(total)

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

using namespace std;

bool find(string s, string p)
{
    for(int i = 0; i < s.size(); ++i){
        for(int j = 0; j < p.size(); ++j){
            if(i+j >= s.size() || s[i+j] != p[j]) break;
            if(j == p.size() - 1) return true;
        }
    }
    return false;
}
int main()
{
    string s;
    string p;
    cin >> s >> p;
    
    s += s;
    // if(s.find(p,0) == string::npos){
    if(find(s, p) == false){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

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

int main () {
    int n; cin >> n;
    vector<int> p(n);

    for(int i = 0; i < n; ++i){
        cin >> p[i];
    }

    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(p[i] != i+1){
            cnt++;
        }
    }

    if(cnt <= 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

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

int main() {
    int64_t L;
    cin >> L;
    cout << fixed << setprecision(8) << (double)L/3 * L/3 * L/3 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,n=0;
  std::cin >> x>>y;
  int w[110],v[110];
  rep(i,x){
    std::cin >> w[i]>>v[i];
  }
  int dp[x+10][y+100]={0};
  rep(i,x){
    Rep(j,y+1){
      if(j-w[i]>=0)dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
    }
  }
  std::cout << dp[x][y] << '\n';
}


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

namespace AtCoder {
    class XorBattle {
        static bool can(long X, List<long> A) {
            if (X == 0) {
                return true;
            }

            int oddPos = -1;
            for (int i = 0; i < A.Count; i++) {
                if (A[i] % 2 == 1) {
                    oddPos = i;
                    break;
                }
            }

            if (oddPos == -1) {
                if (X % 2 == 1) {
                    return false;
                }

                var B = new List<long>();
                foreach (var a in A) {
                    B.Add(a / 2);
                }

                return can(X / 2, B);
            } else {
                var B = new List<long>();
                for (int i = 0; i < A.Count; i++) {
                    if (i != oddPos) {
                        B.Add(A[i] % 2 == 0 ? A[i] : (A[i] ^ A[oddPos]));
                    }
                }

                return can(X % 2 == 0 ? X : (X ^ A[oddPos]), B);
            }
        }

        static void Main(string[] args) {
            var T = int.Parse(Console.ReadLine());
            for (int t = 0; t < T; t++) {
                int N = int.Parse(Console.ReadLine());
                long[] A = new long[N];
                var parts = Console.ReadLine().Split(' ');
                for (int i = 0; i < N; i++) {
                    A[i] = long.Parse(parts[i]);
                }
                string S = Console.ReadLine();

                var X = new List<long>();

                bool canWin = true;

                for (int i = N - 1; i >= 0; i--) {
                    if (S[i] == '0') {
                        if (!can(A[i], X)) {
                            X.Add(A[i]);
                        }
                    } else {
                        if (!can(A[i], X)) {
                            canWin = false;
                            break;
                        }
                    }
                }

                Console.WriteLine(canWin ? "0" : "1");
            }
        }
    }
}


Measured memory_bytes: 22640
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let mut v: Vec<usize> = vec(n, |_| scan(tokens));
    v.sort();
    let mut ans = v[0] as f64;
    for i in 1..n {
        ans = (ans + v[i] as f64) / 2.0;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
// import kotlin.math.*

fun main(args: Array<String>) {
    val n : Int = readLine()!!.toInt()
    val v = readLine()!!.split(" ").map(String::toInt)
    val c = readLine()!!.split(" ").map(String::toInt)

    var ans : Int = 0
    for (i in v.indices) {
        ans += if(v[i] - c[i] > 0) v[i] - c[i] else 0
        // ans += max(v[i] - c[i], 0)
        // ans += listOf(v[i] - c[i], 0L)!!.max()
    }

    println(ans)
}

Measured memory_bytes: 38032
function Main(input) {
  input = input.trim()
  for(var i=0;i<3;i++) input = input.replace( "9","#" )
  for(var j=0;j<3;j++) input = input.replace( "1","9" )
  for(var k=0;k<3;k++) input = input.replace( "#","1" )
  console.log(input)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  vector<string> T(H);
  vector<string> S(H+2);
  for (int i = 0; i < H; i++){
    cin >> T.at(i);
  }
  
  //S.at[0]:0をW+2個
  S.at(0) = "";
  for (int i = 0; i < W + 2; i++){
    S.at(0) = S.at(0) + "0";
  }
  
  //S.at[1]~S.at[H]:0+(世界)+0
  for (int i = 1; i <= H; i++){
    S.at(i) = "0" + T.at(i - 1) + "0";
  }
  
  //S.at[H+1]:0をW+2個
  S.at(H+1) = "";
  for (int i = 0; i < W + 2; i++){
    S.at(H+1) = S.at(H+1) + "0";
  }
  
  
  //Sで周囲の爆弾の個数を数え、Tに入力していく
  for (int i = 1; i <= H; i++){
    for (int j = 1; j <= W; j++){
      if (S.at(i).at(j) == '.'){
        T.at(i-1).at(j-1) = '0';
        int n = 0;
        for (int k = i - 1; k <= i + 1; k++){
          for (int l = j - 1; l <= j + 1; l++){
            if (S.at(k).at(l) == '#'){
              //T.at(i-1).at(j-1) += 1;
              n += 1;
            }
          }
        }
        T.at(i-1).at(j-1) = '0' + n;
      }
    }
  }
  
  for (int i = 0; i < H; i++){
    cout << T.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>

using namespace std;

int two(int n){
  return n*n;
}

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

int main(void){
  int N;
  cin >> N;
  int x[N], y[N], arr[N];
  int i, j;
  for(i=1; i<=N; i++){
    cin >> x[i] >> y[i];
    arr[i] = i;
  }

  //M = N!
  int M = fact(N);
  double dist[M+1] = {0};
  int count = 1;
  i = 1;
  do{
    /* for(int k=1; k<=N; k++)
      cout << arr[k] <<" ";
      cout <<endl;*/
    for(j=1; j<=N-1; j++){
      //町sから町gに行く．start, goalの意
      int s = arr[j];
      int g = arr[j+1];
      //町sから町gへの距離を加算していく
      dist[i] += sqrt( two(x[s]-x[g]) + two(y[s]-y[g]) );
      //    cout << s<<" to "<<g<<" : "<<dist[i] <<endl;
    }
    i++;
  }while(next_permutation(arr+1, arr+N+1) );

  //cout << "M="<<M<<endl;
  double sum = 0.0;
  for(i=1; i<=M; i++){
    //cout <<"dist["<<i<<"] = "<<dist[i]<<endl;
    sum += dist[i];
    //cout <<sum <<endl;
  }
  
  cout <<fixed<<sum/M<<endl;

  return 0;
}


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

int main(){
  int n;
  cin>> n;
  vector<int> p(n);
  for(int i=0; i<n; i++) cin>> p[i];
  
  int lowest=p[0],ans=0;
  for(int i=0; i<n; i++){
    if(lowest>=p[i]){ lowest=p[i]; ans++;}
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4044
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  char c;cin>>c;
  string s="aiueo";

  rep(i,0,s.size()){
    if(s[i]==c){out("vowel");return 0;}
  }
  out("consonant");


  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char S[8];
	int seisu = 0;
	int i;
	if (scanf("%7s", S) != 1) return 1;
	for (i = 0; S[i] != '\0'; i++) {
		if (S[i] == '+') seisu++;
		else if (S[i] == '-') seisu--;
	}
	printf("%d\n", seisu);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
//string b="12345";
//a = int(b[4]-48);
using namespace std;
int main()
{
	char C;
	vector<char> A;
	cin >> C;
	A.push_back('a');
	A.push_back('b');
	A.push_back('c');
	A.push_back('d');
	A.push_back('e');
	A.push_back('f');
	A.push_back('g');
	A.push_back('h');
	A.push_back('i');
	A.push_back('j');
	A.push_back('k');
	A.push_back('l');
	A.push_back('m');
	A.push_back('n');
	A.push_back('o');
	A.push_back('p');
	A.push_back('q');
	A.push_back('r');
	A.push_back('s');
	A.push_back('t');
	A.push_back('u');
	A.push_back('v');
	A.push_back('w');
	A.push_back('x');
	A.push_back('y');
	A.push_back('z');
	
	for (int i = 0; i < 25; i++) {
		if (C == A[i]) {
			cout << A[i + 1] << endl;
		}
	}


}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_N = 100000;
static const int MAX_M = 20;

int N, M;
int K[MAX_N];
int sum[MAX_M][MAX_N + 1];
int dp[1 << MAX_M], dp2[1 << MAX_M];

int main(){
	cin >> N >> M;
	for(int i = 0; i < N; i++) cin >> K[i];
	fill(sum[0], sum[M], 0);
	for(int i = 0; i < N; i++) sum[K[i] - 1][i + 1]++;
	for(int i = 0; i < M; i++){
		for(int j = 1; j <= N; j++){
			sum[i][j] += sum[i][j - 1];
		}
	}
	fill(dp, dp + (1 << M), 0);
	fill(dp2, dp2 + (1 << M), 0);
	for(int i = 1; i < (1 << M); i++){
		int minimum_num = MAX_N + 1;
		for(int j = 0; j < M; j++){
			if(!(i & (1 << j))) continue;
			dp2[i] = dp2[i - (1 << j)] + sum[j][N];
			minimum_num = min(minimum_num, dp[i - (1 << j)] + sum[j][N] - (sum[j][dp2[i - (1 << j)] + sum[j][N]] - sum[j][dp2[i - (1 << j)]]));
		}
		dp[i] = minimum_num;
	}
	cout << dp[(1 << M) - 1] << endl;
	return 0;
}


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


int ASC(const void *a, const void *b) {
	return *(int *)b - *(int *)a;//降順
}
int GCD(int a, int b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main(void)
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	int ahp = a / d;
	int chp = c / b;
	if (a%d > 0)	ahp++;
	if (c%b > 0)	chp++;
	if (ahp < chp)
		printf("No");
	else
		printf("Yes");
	return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;++x)
#define Red(x,y,z) for(int x=y;x>=z;--x)
using namespace std;
const int MAXN=5e4+5,Mod=998244353,G=3;
char buf[1<<12],*p1=buf,*p2=buf,nc;int ny;
inline char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
	x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}int n,m,l,r[MAXN],wi[MAXN],Fac[MAXN],iFac[MAXN],inv[MAXN];
inline int C(int n,int m){if(n<0||m<0||n<m)return 0;return 1ll*Fac[n]*iFac[m]%Mod*iFac[n-m]%Mod;}
inline int Fp(int x,int k){int ans=1;for(;k;k>>=1,x=1ll*x*x%Mod)if(k&1)ans=1ll*ans*x%Mod;return ans;}
inline int Trans(int n){
	int N,c;
	for(N=1,c=0;N<n;N<<=1,c++);
	for(int i=0;i<N;i++)r[i]=(r[i>>1]>>1)|((i&1)<<(c-1));
	return N;
}inline void NTT(int*F,int len,int opt){
	for(int i=0;i<len;i++)if(i<r[i])swap(F[i],F[r[i]]);
	for(int i=1;i<len;i<<=1){
		int w=Fp(G,(Mod-1)+opt*(Mod-1)/(i<<1));wi[0]=1;
		Rep(j,1,i)wi[j]=1ll*wi[j-1]*w%Mod;
		for(int j=0;j<len;j+=i<<1){
			for(int k=0;k<i;k++){
				int x=1ll*F[i+j+k]*wi[k]%Mod,y=F[j+k];
				F[i+j+k]=(y-x+Mod)%Mod,F[j+k]=(x+y)%Mod;
			}
		}
	}if(opt==-1){int Inv=Fp(len,Mod-2);for(int i=0;i<len;i++)F[i]=1ll*F[i]*Inv%Mod;}
}int F[205][8005],A[MAXN],B[MAXN];
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	inv[1]=1;Rep(i,2,MAXN-1)inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
	Fac[0]=iFac[0]=1;Rep(i,1,MAXN-1)Fac[i]=1ll*Fac[i-1]*i%Mod,iFac[i]=1ll*inv[i]*iFac[i-1]%Mod;
	n=read(),m=read(),l=Trans(2*(n+2));
	Rep(i,0,n)F[m][i]=C(n,i);
	Rep(i,0,n)A[i]=10;NTT(A,l,1),NTT(A,l,-1);
	Red(i,m-1,0){
		Rep(j,0,n)F[i][j]=(F[i][j]+1ll*F[i+1][j]*(C(j+1,2)+1))%Mod;
		memset(A,0,sizeof(A)),memset(B,0,sizeof(B));
		Rep(j,0,n)B[j+2]=1ll*F[i+1][j]*Fac[j+2]%Mod;
		Rep(j,3,n+2)A[j]=iFac[j];reverse(A,A+n+3);
		NTT(A,l,1),NTT(B,l,1);Rep(j,0,l)A[j]=1ll*A[j]*B[j]%Mod;NTT(A,l,-1);
		Rep(j,0,n)F[i][j]=(F[i][j]+1ll*A[j+n+2]*iFac[j])%Mod;
	}cout<<F[0][0]<<"\n";
	return 0;
}



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

size_t num_factor(size_t N) {
  size_t ans = 0;
  for (size_t i=1; i<std::sqrt(N)+1; i++) {
    if (N % i == 0) {
      if (N / i == i)
        ans += 1;
      else
        ans += 2;
    }
  }
  return ans;
}

int main() {
  size_t N;
  std::cin >> N;

  size_t ans = 0;

  for (size_t i=1; i<N+1; i+=2)
    if (num_factor(i) == 8) ans ++;

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
int main() {

  ll N, T;
  cin >> N >> T;
  ll t[N];
  rep(i, N) cin >> t[i];

  ll res = 0;

  rep(i, N-1) {
    if(t[i+1]-t[i]==T) {
      res += T;
    }else if(t[i+1]-t[i]<T) {
      res += t[i+1]-t[i];
    }else {
      res += T;
    }
  }

  cout << res + T << endl;

  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
multiset<double> S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>x;
		S.insert(x);
	}
	while(S.size()>1) {
		double a=*S.begin();
		S.erase(S.begin());
		double b=*S.begin();
		S.erase(S.begin());
		S.insert((a+b)/2);
		
	}
	_P("%.12lf\n",*S.begin());
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
class UnionFind():
  def __init__(self, n):
    # 初期状態は親は自分自身
    self.parents = list(range(n))
  
  def find(self,x):
    if self.parents[x] == x:
      return x
    else:
      self.parents[x] =  self.find(self.parents[x])
      return self.parents[x]
  
  def union(self,x,y):
    x = self.find(x)
    y = self.find(y)
    if x != y:
      self.parents[y] = x

import sys
input = sys.stdin.readline
n, q = map(int,input().split())
uf = UnionFind(n)

for i in range(q):
  com, x, y = map(int, input().split())
  if com:# same
    print(int(uf.find(x) == uf.find(y)))
  else:# unite
    uf.union(x,y)
    



Measured memory_bytes: 6676
n,m=input().split()
n,m=[int(n),int(m)]
a=list(map(int, input().strip().split()))
sum=0
for i in range(len(a)):
    sum=sum+a[i]

b=sorted(a)

if b[n-m]>=sum/4/m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	V a(n);
	SCAN(a);
	ll MAX = 1000100;
	int ok[MAX] = {};
	for(ll x: a) ok[x]++;

	V ans;
	REP(i, 0, MAX) if(ok[i]) {
		if(ok[i]==1) ans.push_back(i);
		for(ll j=i+i; j<MAX; j+=i){
			ok[j] = false;
		}
	}

	printf("%ld\n", ans.size());
	return 0;
}



Measured memory_bytes: 10844
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int L, N, M;
int D[100010];

int main() {
  while (true) {
    cin >> L;
    if (L == 0) break;
    cin >> N >> M;
    D[0] = 0;
    for (int i=1; i<N; i++) cin >> D[i];
    D[N] = L;
    int ans = 0;
    sort(D, D+N+1);
    for (int i=0; i<M; i++) {
      int k;
      cin >> k;
      int h = lower_bound(D, D+N+1, k) - D;
      ans += min(k - D[h-1], D[h] - k);
    }
    cout << ans << "\n";
  }
  return 0;
}

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

void out(int d, int w)
{
	switch(d%2) {
	case 0:
		for ( int i = 0; i < w ; i++) {
			switch(i%2) {
			case 0:
				cout << '#';
				break;
			case 1:
				cout << '.';
			}
		}
		break;
	case 1:
		for ( int i = 0; i < w ; i++) {
			switch(i%2) {
			case 0:
				cout << '.';
				break;
			case 1:
				cout << '#';
			}
		}
	}		
}

int main()
{
	int h, w;
	
	cin >> h >> w;
	
	while ((h!=0)&&(w!=0)) {
		for (int i=0; i < h; i++) {
			out(i,w);
			cout << endl;
		}
		cout << endl;
		cin >> h >> w;
	}
	return 0;
}

Measured memory_bytes: 3020