akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
#define sp << " " <<
#define mod 1000000007
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
bool sortfirst(pii &a,pii &b){
    return a.first<b.first;
}
int main(){
    int h,w,k;
    std::cin>>h>>w>>k;
    char a[h][w];
    string b[h][w];
    int i,j;
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            std::cin>>a[i][j];
        }
    }
    int cakein=1,q;
    for(i=0;i<h;i++){
        int cakerow=0;
        for(j=0;j<w;j++){
            if(a[i][j]=='#'){
                cakerow++;
                
                
                if(cakerow>1){
                    cakein++;
                }
                b[i][j]=std::to_string(cakein);
                
                
            }
            else{
                b[i][j]=std::to_string(cakein);
            }
        }
        
        
        if(cakerow==0&&cakein!=1){
            for(j=0;j<w;j++){
                b[i][j]=b[i-1][j];
            }
        }
        if(cakerow>0){
        cakein++;
        }
        if(i>0&&b[i][0]=="1"&&b[i][w-1]!="1"){
            for(j=i-1;j>=0;j--){
                for(q=0;q<w;q++){
                    b[j][q]=b[j+1][q];
                }
            }
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            std::cout<<b[i][j]<<" ";
        }
        std::cout<<'\n';
    }
    
    return 0;
}

Measured memory_bytes: 5760
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    a = LI()
    a.sort()
    print(sum(a[:k]))
    return

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


Measured memory_bytes: 67236
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <math.h>

using namespace std;
int main()
{
	string S;
	string s;
	string temp;
	string T;
	bool f = false;
	cin >> S;
	cin >> T;

	int l = S.size();

	for (int i = 0; i < l; i++) {
		temp = S.at(l-1);
		S = S.insert(0, temp);
		S.erase(l , 1);
		if (S == T) {
			f = true;
		}

	}
	
	if (f) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int a,b,c;
        scanf("%d %d %d",&a,&b,&c);
        if(a<b && b<c){
                printf("Yes\n");
        }else{
                printf("No\n");
        }
        return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  int result = 4000000;
  for (int i = -100; i <= 100; i++) {
    int adder = 0;
    for (int j = 0; j < N; j++) {
      int tmp = (a.at(j) - i) * (a.at(j) - i);
      adder += tmp;
    }
    result = min(adder, result);
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
#define trace3(x, y, z) cerr << #x << ": " << x << ", " << #y < ": " << y << ", " << #z << ": " << z << endl;
#define all(v) v.begin(), v.end()

bool is_pal(string &s, int l, int r) {
	while(l < r) {
		if(s[l] != s[r]) {
			return 0;
		}
		l++;
		r--;
	}
	return 1;
}

int main() {
	int n;
	cin >> n;
	vll a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	map<ll, int> cnt;
	for(int i = 0; i < n; i++) {
		cnt[a[i]]++;
	}
	ll sum = 0;
	for(auto it : cnt) {
		ll x = it.second;
		sum += x * (x - 1) / 2;
	}
	for(int i = 0; i < n; i++) {
		cout << sum - cnt[a[i]] + 1 << endl;
	}
}

Measured memory_bytes: 12288
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll R,C,r,c;
    cin>>R>>C;
    if(R==C) cout<<R+C<<endl;
    else if(R>C)
    cout<<(R-1)+R<<endl;
    else if(R<C)
    cout<<(C-1)+C<<endl;
    return 0;
}



Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int a = rint, b = rint;
	
	if(a >= 1 && a <= 9 && b >= 1 && b <= 9) (a * b).writeln;
	else "-1".writeln;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 110
#define MAX_W 100010

ll N, W;
vector< pair<ll, ll> > item;
ll dp[MAX_N][MAX_W];

// i 番目の商品を見ていて、現在の重さが cur の時の最大値
ll dfs(ll i = 0, ll cur = 0) {
    if(i >= N) { return 0; }

    ll& ret = dp[i][cur];
    if(~ret) { return ret; }

    // この商品を入れない
    ret = dfs(i + 1, cur);
    // この商品を入れる
    if(cur + item[i].first <= W) {
        ret = max(ret, dfs(i + 1, cur + item[i].first) + item[i].second);
    }

    return ret;
}

signed main()
{
    cin >> N >> W;
    item.assign(N, make_pair(0, 0));
    REP(i, N) {
        cin >> item[i].first >> item[i].second;
    }
    MINUS(dp);
    printf("%lld\n", dfs());
    return 0;
}


Measured memory_bytes: 86272
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int fib[1256], num;

	fib[0] = 1; fib[1] = 1;

	for(int i = 2; i < 128; i++)
	{
		fib[i] = fib[i-1] + fib[i-2];
	}
	cin >> num;

	cout << fib[num] << endl;
}

Measured memory_bytes: 1164
#include <iostream>
#include <algorithm>
#include <vector>
#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;
typedef long long ll;
int main()
{
  ll a,b,k;
  cin >> a >> b >> k;
  if(a<=k){
    k -= a;
    a = 0;
    b = max((ll)0,b-k);
  }
  else a -= k;
  cout << a << " " << b << "\n";
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<map>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<climits>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long int
#define vll vector<ll>
#define mii map<ll, ll>
#define debug(x) cerr << #x << " is " << x << "\n";
#define debug1(x, y) cerr << #x << " is " << x << "\n" << #y << " is " << y << "\n";
#define w(x) ll x; cin >> x; while(x--)
#define endl "\n"
#define f first 
#define s second 
#define fo(n) for(ll i = 0LL; i < n; ++i) 
#define setbits(n) __builtin_popcount(n)
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(x.begin(), x.end())
#define pb push_back
#define mk make_pair
#define PERMUTE next_permutation
#define RESET(a, b) memset(a, b, sizeof(a))
#define MOD 1000000007
using namespace std;
 
int main(){
    fast
    string a, b;
    cin >> a >> b;
    fo(a.size()) {
        if(a[i] != b[i]) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define fi first
#define se second
#define pii pair<int,int>

const int maxn=1e5+5;
int n,a,b,c,ok=0;
string s[maxn];
vector<char> ret;
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>a>>b>>c;
    forinc(i,1,n) cin>>s[i];
    forinc(i,1,n){
        if(s[i]=="AB"){
            if(a+b==0){
                ///return cout<<"NO",0;
                ok=1;
                break;
            }
            else{
                if(a>b) {ret.push_back('B');b++;a--;}
                else if(b>a) {ret.push_back('A');b--;a++;}
                else if(s[i+1]=="BC"){ ret.push_back('B');b++;a--;}
                else{
                        ret.push_back('A');b--;a++;
                }
            }
        }
        else if(s[i]=="AC"){
             if(a+c==0){
                ok=1;
                break;
             }
            else{
                if(a>c) {ret.push_back('C');c++,a--;}
                else if(c>a) {ret.push_back('A');c--,a++;}
                else if(s[i+1]=="AB"){ ret.push_back('A');c--;a++;}
                else{
                        ret.push_back('C');a--;c++;
                }
            }
        }
        else{
                ///BC
              if(b+c==0){
                ok=1;
                break;
              }
            else{
                if(b>c) {ret.push_back('C');c++;b--;}
                else if(c>b) {ret.push_back('B');c--;b++;}
                else if(s[i+1]=="AB"){ ret.push_back('B');c--;b++;}
                else{
                        ret.push_back('C');b--;c++;
                }
            }
        }
      //  cout<<a<<" "<<b<<" "<<c<<"\n";
    }
    if(ok) cout<<"No";
    else{
    cout<<"Yes"<<"\n";
    for(auto &v:ret) cout<<v<<"\n";
    }
}


Measured memory_bytes: 6928
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const itemNum = Number(inputs[0].split(' ')[0]);
  const selectNum = Number(inputs[0].split(' ')[1]);
  const itemList = inputs[1].split(' ')
                   .map(Number)
                   .sort((x, y) => (x < y ? 1 : -1));
  const totalVotes = itemList.reduce((acc, cur) => acc + cur);

  if (itemList[selectNum - 1] * 4 * selectNum < totalVotes) {
    console.log('No');
  } else {
    console.log('Yes');
  }
}


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

int main(){
  int64_t N, P;
  cin >> N >> P;
  int64_t odd=0;
  int64_t A;
  for(int64_t i=0LL; i<N; i++){
    cin >> A;
    odd+=A%2;
  }
  if(odd==0 && P==1){
    cout << 0 << endl;
  }
  else if(odd==0 && P==0){
    cout << (int64_t)pow(2, N) << endl;
  }
  else{
    cout << (int64_t)pow(2, N-1) << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int k;
    string s;
    cin >> k >> s;
    if(s.length() <= k) {
        cout << s << '\n';
    } else {
        for(int i = 1; i <= k; ++i) cout << s[i-1];
        cout << "...\n";
    }
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;
    int icchi = 0;
    REP_REV(i, min(s.size(), t.size()) + 1) {
        string tmp = s.substr(0, s.size()-i) + t;
        //cout << tmp << endl;
        if(tmp.substr(0, s.size()) == s) {
            if(tmp.substr(tmp.size() - t.size(), t.size()) == t) {
                cout << tmp.size() << endl;
                return 0;
            } 
        }
    }

    return 0;
}

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

int main() {
    
    int a,b;
    cin >> a >> b;
    int ans = 0;

    for(int i = a;i <= b;i++){
        string tester = to_string(i);
        if(tester[0] == tester[4] && tester[1] == tester[3]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(a)-1;i>=n;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define sn st.nd 
ll dx[4]={0,-1,0,1};
ll dy[4]={1,0,-1,0};
/****************************/
int main()
{
	ios::sync_with_stdio(0);
	ll n,a,b,c;
	cin>>a>>b>>c>>n;
	if(n<=a)
	{
		cout<<n;
		return 0;
	}
	if(n<=a+b)
	{
		cout<<a;
		return 0;
	}
	cout<<a-(n-a-b);
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>	
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

// random_device rd; mt19937 g(rd());    
                                        	
using namespace std;
using namespace __gnu_pbds;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}

template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; 
 
const int mod = (int)1e9 + 7;
const int N = (int)2e3 + 123;

int a[N], b[N]; 
int dp[N][N];
int sum[N][N];
int n, m;

int add(int a, int b)
{
	a += b;
	if(a >= mod) a %= mod;
	if(a < 0) a += mod;
	return a;
}

int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();   
	cin >> n >> m;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int j = 1; j <= m; j++) cin >> b[j];
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			if(a[i] != b[j]) dp[i][j] = 0;
			else dp[i][j] = add(sum[i - 1][j - 1], 1);
			sum[i][j] = add(sum[i - 1][j], sum[i][j - 1]);
			sum[i][j] = add(sum[i][j], -sum[i - 1][j - 1]);
			sum[i][j] = add(sum[i][j], dp[i][j]);
		}
	sum[n][m] = add(sum[n][m], 1);
	cout << sum[n][m];
}                                

Measured memory_bytes: 35072
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define printjudge(cond) {if(cond) printf("Yes\n"); else printf("No\n");}

int main(){
    int N, judge = 0;
    scanf("%d", &N);
    if(N>=4*7) judge = 1;
    else{
        for(; N>=0; N-=4){
            if(N%7==0) {judge = 1; break;}
        }
    }
    printjudge(judge);
    return 0;
}

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

using namespace std;

vector <int> d;
map<int, int> k;

int main()
{
    int n;
    scanf("%d", &n);
    d.resize(n);
    for (int i = 0; i < n; i++){
        scanf("%d", &d[i]);
    }
    sort(d.begin(), d.end());
    int a1 = 0, a2 = 0;
    for (int i = n - 1; i >= 1; i--){
        if (d[i] == d[i - 1]){
            a1 = d[i];
            d[i] = -1;
            d[i - 1] = -1;
            break;
        }
    }
    sort(d.begin(), d.end());
    for (int i = n - 1; i >= 3; i--){
        if (d[i] == d[i - 1]){
            a2 = d[i];
            break;
        }
    }
    cout << 1ll * a1 * a2;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
// #define fore(i, b, e) for (int i = (int)(b); i <= (int)(e); ++i)
// #define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long i64;
typedef unsigned long long u64;
typedef long double ld;
typedef long long ll;

const int maxn = 505;

int n, m;
int a[maxn][maxn], b[maxn][maxn], c[maxn][maxn];

void scan() {
    char buf[maxn];
    scanf("%d%d", &n, &m);
    forn(i, n) {
        scanf("%s", buf);
        forn(j, m) if (buf[j] == '#') a[i][j] = 1;
    }
}

void fill() {
    forn(i, n) forn(j, m) {
        if (j == 0) b[i][j] = 1;
        else if (j+1 == m) c[i][j] = 1;
        else if (i%2 == 0) b[i][j] = 1;
        else c[i][j] = 1;
        if (a[i][j]) b[i][j] = c[i][j] = 1;
    }
    forn(i, n) {
        forn(j, m) putchar(".#"[b[i][j]]);
        putchar('\n');
    }
    putchar('\n');
    forn(i, n) {
        forn(j, m) putchar(".#"[c[i][j]]);
        putchar('\n');
    }
}

int main() {
#ifdef LOCAL
    freopen("c.in", "r", stdin);
#endif

    scan();
    fill();

#ifdef LOCAL
    cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
#endif
    return 0;
}


Measured memory_bytes: 3712
import numpy as np
def resolve():
	# N: 品物の個数、W: 容量の上限
	N, W = map(int, input().split())
	# DP配列の宣言: あるナップサック内の体積における価値の最大値
	dp = np.zeros(W+1, dtype=np.int64)
	# 商品数繰り返す
	for _ in range(N):
		# 各商品の重さwと価値vを読み込み
		w, v = map(int, input().split())
		# 商品の重さ以上のテーブルを更新
		# 入れない時（そのまま）と、
		# 入れた時（入れる前の価値＋この商品の価値）の
		# 価値の最大値にテーブルを更新
		dp[w:] = np.maximum(dp[w:], dp[:W+1-w] + v)
	print(dp[W])
resolve()

Measured memory_bytes: 21632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String data = sc.nextLine();
        
        String[] array = data.split(" ");
        int a = Integer.parseInt(array[0]);
        int b = Integer.parseInt(array[1]);
        int c = Integer.parseInt(array[2]);
        int d = Integer.parseInt(array[3]);
        
        String result = "No";
        
        int count_a = 0;
        int count_c = 0;
        while(a > 0)
        {
            a -= d;
            count_a++;
        }
        while(c > 0)
        {
            c -= b;
            count_c++;
        }
        
        if(count_a >= count_c)
        {
            result = "Yes";
        }
        
        System.out.println(result);
    }
}


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

int main()
{
	int n,x,t=0;
	cin>>n;
	
	int a[100+1];
	for(int i=1;i<=100;i++) a[i]=0;
	for(int i=1;i<=n;i++){
		cin>>x;
		if (a[x]==0){
			t++;
			a[x]=1;
		}
	}
	cout<<t<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

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 (a>b) { a=b; return 1; } return 0; }
const ll LINF = 1e18;

int main()
{
  ll N; string S; cin >> N >> S;
  ll ans = 1;
  for (int i = 0; i < S.size()-1; ++i) {
    if (S[i] != S[i+1]) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

const int N = 1e5 + 100 ;
const ll inf = 1e14;
int n;
ll a[N] , mem[N];

ll dp(int i){
	if(i == n-1) return 0;
	if(i == n) return inf;
	ll &ret = mem[i];
	if(ret != -1)
		return ret;
	return ret = min( abs(a[i] - a[i+1]) + dp(i+1) , abs(a[i] - a[i+2]) + dp(i+2) );
}

int main(){
	memset(mem , -1 , sizeof mem);
	scanf("%d"  ,&n);
	for(int i=0 ; i<n ; i++)
		scanf("%lld"  ,a+i);
	printf("%lld" , dp(0));
}


Measured memory_bytes: 3328
#include <stdio.h>
int main(void) {
	
	int imput[5];
	int i, j, box;
	
	for( i = 0; i < 5; i++ ) {
		scanf("%d",&imput[i]);
	}
	
/* ???????????????????????????*/
	for( i = 0; i < 4; i++) {
		for( j = 4 ; j > i; j-- ) {
			if( imput[j] > imput[j-1] ) {
				box = imput[j] ;
				imput[j] = imput[j - 1] ;
				imput[j - 1] = box ;
			}
		}
	}
	
/* ????§???? */
	for( i = 0; i < 4; i++ ) {
		printf("%d ",imput[i]) ;
	}
	printf("%d\n",imput[4]);
	return(0);
}

Measured memory_bytes: 596
N = int(input())
W = list(map(int,input().split()))
ruiseki = [W[0]]
for i in range(1, N):
    ruiseki.append(ruiseki[i-1]+W[i])
ans = 100000
for i in range(N):
    if abs(ruiseki[-1]-ruiseki[i]-ruiseki[i]) < ans:
        ans = abs(ruiseki[-1]-ruiseki[i]-ruiseki[i])
print(str(ans))

Measured memory_bytes: 38256
/*
[tenka1-2019] C - Stones
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 2e5;
const int INF = 1e8;

int N;
string S;
int dp[MAX_N][2];

ll solve() {
    dp[0][0] = (S[0] == '.') ? 0 : 1;
    dp[0][1] = (S[0] == '#') ? 0 : 1;

    for (int i = 1; i < N; i++) {
        int c = (S[i] == '.') ? 0 : 1;
        for (int k = 0; k < 2; k++) {
            dp[i][k] = INF;
            for (int j = 0; j < 2; j++) {
                if (j == 1 && k == 0) {
                    continue;
                }
                dp[i][k] = min(dp[i][k], dp[i - 1][j] + (k == c ? 0 : 1));
            }
        }
    }

    return min(dp[N - 1][0], dp[N - 1][1]);
}

int main() {
    cin >> N;
    cin >> S;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 2180
/*
        Author: Prokash
                CSE48, JU

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
    FAST;
    vector<int>v;
    int sum=0;
    for(int i=1;i<=3;i++)
    {
        int in;
        cin>>in;
        v.push_back(in);
        sum+=in;
    }
    sort(v.begin(),v.end());
    int large=v[2];
    if((large%2)==(sum%2))
    {
        cout<<((3*large)-sum)/2<<endl;
    }
    else
    {
        cout<<((3*(large+1))-sum)/2<<endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n;
	cin >> n;

	int x[n];
	int y[n];
	rep(i,n){
		cin >> x[i];
		y[i] = x[i];
	} 

	sort(y,y+n);

	rep(i,n){
		cout << (x[i] < y[n/2] ? y[n/2] : y[n/2-1]) << endl;
	}
}

Measured memory_bytes: 3712
function main(input){
	input=input.split('\n');
  var result=0;
  for(i=0;i<input[0].length;i++){
    if(input[0].slice(i,i+1)!=input[1].slice(i,i+1)){result=result+1}
  
  }
  console.log(result)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int h,w; cin>>h>>w;
	string s;
	for (int i=0; i<h; i++)
		cin>>s, cout << s << endl << s << endl;
	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.algorithm, std.range, std.conv;
void main()
{
    // ①入力
    auto N = readln.chomp.to!int;
    auto A = readln.chomp.to!int;
    
    // ②処理
    int res = N^^2-A;
    
    // ③出力
    writeln(res);
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int m, n;
	int[] a, b;

	void run(){
		for(;;){
			m=sc.nextInt();
			n=sc.nextInt();
			if((m|n)==0){
				break;
			}
			a=new int[m];
			b=new int[n];
			for(int i=0; i<m; i++){
				a[i]=sc.nextInt();
			}
			for(int i=0; i<n; i++){
				b[i]=sc.nextInt();
			}
			solve();
		}
	}

	void solve(){
		int sum1=0, sum2=0;
		for(int i=0; i<m; i++){
			sum1+=a[i];
		}
		for(int i=0; i<n; i++){
			sum2+=b[i];
		}

		int p=200, q=200;
		for(int j=0; j<n; j++){
			for(int i=0; i<m; i++){
				if(sum1-a[i]+b[j]==sum2-b[j]+a[i]){
					if(a[i]+b[j]<p+q){
						p=a[i];
						q=b[j];
					}
				}
			}
		}
		if(p<200){
			println(p+" "+q);
		}else{
			println("-1");
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
import java.io.*;
import java.util.*;
 
public class Main {
  private static boolean debug = false;
  private static boolean elapsed = false;
 
  private static PrintWriter _err = new PrintWriter(System.err);
 
  private int minLen = Integer.MAX_VALUE;
  private boolean isFirst = false;
  private void solve(Scanner sc, PrintWriter out) {
    String s = sc.nextLine();
 
    int r = s.length() % 2;
 
    StringBuilder sb = new StringBuilder(s);
    boolean found = false;
    do {
      found = false;
      for (int i = 1; i < sb.length() - 1; ++i) {
        if (sb.charAt(i - 1) == sb.charAt(i + 1)) {
          continue;
        }
        sb.deleteCharAt(i);
        found = true;
        break;
      }
    } while (found);
 
    if (sb.charAt(0) == sb.charAt(sb.length() - 1)) {
      isFirst = (r == 0);
    } else {
      isFirst = (r != 0);
    }
 
    out.println(isFirst ? "First" : "Second");
  }
  private long P(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    return res;
  }
  /*
   * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
   * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
   */
  public static void main(String[] args) {
    long S = System.currentTimeMillis();
 
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(sc, out);
    out.flush();
 
    long G = System.currentTimeMillis();
    if (elapsed) {
      _err.println((G - S) + "ms");
    }
    _err.flush();
  }
}

Measured memory_bytes: 28220
str = "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"
input_field = [int(i) for i in str.split(", ")]
print(input_field[int(input()) - 1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        if(s.length() % 2 == 1)
            ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

public void solve(int testNumber, Scanner in, PrintWriter out) {
        int N = in.nextInt();
        memo = new int[N+1];
        Arrays.fill(memo, -1);
        int M = in.nextInt();
        int match[] = {-100, 2, 5, 5, 4, 5, 6, 3, 7, 6};
        Arrays.fill(use, 1<<29);
        for (int i=0; i<M; i++) {
            int cu = in.nextInt();
            use[cu] = match[cu];
        }
        StringBuilder ans = new StringBuilder();
        while(N > 0){
            for (int i=9; i>0; i--) {
                if(mdfs(N) == mdfs(N - use[i]) + 1){
                    ans.append(i);
                    N -= use[i];
                    break;
                }
            }
        }
        out.println(ans);
    }

int mdfs(int n) {
        if (n < 0) return -2; 
        if (n == 0) return 0; 
        if (memo[n] != -1) return memo[n]; 

        for (int i = 1; i < 10; i++) {
            
            memo[n] = Math.max(memo[n], mdfs(n - use[i]) + 1);
        }
        return memo[n];
    }

}
}



Measured memory_bytes: 23376
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let a: i64 = iterator.next().unwrap().parse().unwrap();
    let b: i64 = iterator.next().unwrap().parse().unwrap();
    let k: i64 = iterator.next().unwrap().parse().unwrap();

    if k >= a + b {
        return String::from("0 0")
    } else if k > a {
        return format!("{} {}", 0, b - (k - a))
    } else {
        return format!("{} {}", a - k, b)
    }
}

#[test]
fn test() {
    assert_eq!(
        solve(
            r"2 3 3"
        ),
        "0 2"
    );
    assert_eq!(
        solve(
            r"500000000000 500000000000 1000000000000"
        ),
        "0 0"
    );
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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(int n, int 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() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
   
    
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    
    COMinit();
    
    ll sum = 0;
    rep(i, w - b) {
        int h1, w1, h2, w2;
        h1 = h - a - 1;
        w1 = b + i;
        h2 = a - 1;
        w2 = w - b - 1 - i;
        // out(h1 << " " << w1 << " " << h2 << " " << w2);
        (sum += COM(h1 + w1, h1) * COM(h2 + w2, h2)) %= MOD;
    }
    out(sum);
}




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

int main(){
    ll A , B;
    cin >> A >> B;
    ll K;
    cin>> K;
    if(K < A)cout << A - K << " " << B;
    else if(K >= B + A)cout << 0 << " " << 0;
    else cout << 0 << " " << B - K + A;
}


Measured memory_bytes: 256
P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3+1):
    for j in range(i*i,10**6,i):
        P[j]=0
X = int(input())
for i in range(X,10**6):
    if P[i]==1:
        print(i)
        break

Measured memory_bytes: 141196
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> A = new ArrayList<Integer>();

        int n = sc.nextInt();

        int[][] B = new int[4][13];
        for (int i=0; i<4; i++) {
            Arrays.fill(B[i], 0);
        }

        for (int i=0; i<n; i++) {
            String TM = sc.next();
            int TN = sc.nextInt();
            switch (TM) {
                case "S":  {
                    B[0][TN-1] = 1;
                    break;
                }
                case "H": {
                    B[1][TN-1] = 1;
                    break;
                }
                case "C": {
                    B[2][TN-1] = 1;
                    break;
                }
                case "D": {
                    B[3][TN-1] = 1;
                    break;
                }
            }
        }

        for (int i=0; i<4; i++) {
            for (int j=0; j<13; j++) {
                if (B[i][j] == 0) {
                    switch (i) {
                        case 0: {
                            System.out.printf("S %d\n", j+1);
                            break;
                        }
                        case 1: {
                            System.out.printf("H %d\n", j+1);
                            break;
                        }
                        case 2: {
                            System.out.printf("C %d\n", j+1);
                            break;
                        }
                        case 3: {
                            System.out.printf("D %d\n", j+1);
                            break;
                        }
                    }

                }
            }
        }




    }
}


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

int N, A, B, C;
vector<int> l;

int cost(int target, int s) {
  if(s == 0) return 4000;

  int ans = 4000;
  rep(i,(1<<N)) {
    int n = 0;
    int sum = 0;
    rep(j,N) {
      if((s >> j) & (i >> j) & 1) {
        sum += l[j];
        n += 1;
      }
    }
    if(n != 0) ans = min(ans, (n-1)*10 + abs(target - sum));
  }
  return ans;
}

int solve(int d, int a, int b, int c) {
  if(d == N) return cost(A, a) + cost(B, b) + cost(C, c);
  int k = (1 << d);
  return min(solve(d+1, a | k, b, c), min(solve(d+1, a, b|k, c), solve(d+1, a, b, c|k)));
}

int main () {
  cin >> N >> A >> B >> C;
  l = vector<int>(N);
  rep(i,N) cin >> l[i];

  cout << solve(0, 0, 0, 0) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 2000
#define TRUE 1
#define FALSE 0

int n1,a[N];

int search(int cnt,int s){
  int ans;
  
  if(s==0) return TRUE;
  if(cnt>=n1) return FALSE;

  return ans=search(cnt+1,s)+search(cnt+1,s-a[cnt]);
  
  }

int main(){
  int i,n2,s;

  scanf("%d",&n1);
  for(i=0;i<n1;i++) scanf("%d",&a[i]);

  scanf("%d",&n2);
  for(i=0;i<n2;i++){
    scanf("%d",&s);
    if(search(0,s)>=1) printf("yes\n");
    else printf("no\n");
  }
}



Measured memory_bytes: 2048
public class Main {

	public static void main(String[] args) {

		java.util.Scanner sc = new java.util.Scanner(System.in);

		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();

		if (x - r < 0 || x + r > W || y - r < 0 || y + r > H){
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 26028
#include <bits/stdc++.h>
using namespace std;
// type
#define int long long
typedef long long ll;
typedef long double ld;
// loop
//#define For(i, l, r, x)     for (int i = l; i < r; i+=x)
//#define ForE(i, l, r, x)    for (int i = l; i <= r; i+=x)
//#define Ford(i, r, l)       for (int i = r; i > l; i--)
//#define FordE(i, r, l)      for (int i = r; i >= l; i--)
//#define Fora(i, a)          for (auto i : a)
// I/O 
#define openfile(file)      freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
#define testinput(file)     freopen(file".txt", "r", stdin); 
#define FAST_IO             std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//#define PrintV(a)           Fora(ii, a) cout << ii << ' '; cout << rl;
//#define PrintVl(a)          Fora(ii, a) cout << ii << rl;
//#define PrintA(a, l, r)     for (int ii = l; ii <= r; ii++) cout << a[ii] << ' '; cout << rl;
//#define PrintAl(a, l, r)    for (int ii = l; ii <= r; ii++) cout << a[ii] << rl;
//#define Ptest(x)            return cout << x, 0;
#define setpre(n)           fixed << setprecision(n)
// pair
#define F                   first
#define S                   second
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pdd                 pair<ld, ld>
// vector & !!?(string)
#define eb                  emplace_back
#define pb                  push_back
#define all(a)              a.begin(), a.end()
#define rall(a)             a.rbegin(), a.rend()
#define sz(a)               a.size()
#define len(a)              a.length()
// geometry calc    
#define pi                  acos(-1.0)
#define g_sin(a)            sin(a*pi/180)
#define g_cos(a)            cos(a*pi/180)
#define g_tan(a)            tan(a*pi/180)
// set val
#define ms0(a)              memset(a,        0, sizeof(a));
#define ms1(a)              memset(a,        1, sizeof(a));
#define msn1(a)             memset(a,       -1, sizeof(a));
#define msinf(a)            memset(a, 0x3f3f3f, sizeof(a));
// constant
const int mod1 = 998244353, mod = 1e9+7;
const int MAXN = 1000005, MAXM = 200010;
// code
int a;

void Solve() {
  cin >> a;
  cout << a + a*a + a*a*a;
}

signed main(){
    FAST_IO;
    int TC = 1;
	//cin >> TC;
    while(TC--) Solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

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

using namespace std;
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>


string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int D;
    int N;
    
    cin >> N;
    cin >> D;

    int X[N][D];

    rep(ni,N){
        rep(di,D){
            cin >> X[ni][di];
        }
    }

    int count = 0;
    double dist;
    int tmp;
    rep(n1,N-1){
        for( int n2 = n1+1 ; n2 < N ; n2++ ){
            dist = 0;
            rep(di,D){
                dist+=(X[n1][di]-X[n2][di])*(X[n1][di]-X[n2][di]);
            }
            tmp = sqrt(dist);
            if(tmp == sqrt(dist)) count++;
            
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main() {
    long long A = 0,B=0,C=0,D=0;
    char szBuf[10000] = { 0 };
    cin >> A;
    cin >> B;
    cin >> C;
    cin >> D;
    for (;;) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    return 0;
}

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

int n, m, a, p, q;

int main()
{
	cin >> n;

	while (n > 0) {
		m = 0;
		p = -200000;
		q = 0;

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

			m += a;
			p = max(p, m - q);
			q = min(q, m);
		}

		cout << p << endl;
		cin >> n;
	}
}



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


int main(){
  ll N;cin>>N;
  vector<ll>A(N);
  vector<ll>B(N);
  rep(i,N){cin>>A[i]>>B[i];}
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  ll ma=0,mi=0;
  if(N%2==0){
  	ll g=N/2;
    mi=A[g-1]+A[g];
    ma=B[g-1]+B[g];
  }
  else{
  	ll g=(N+1)/2ll;
    mi=A[g-1];
    ma=B[g-1];
  }
  cout<<ma-mi+1ll;
}

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

int main() {
  int A;
  int B;
  int Sa;
  cin >> A >> B;
  
  Sa = A-(2*B);
  
  if(Sa>0){
    cout << Sa << endl;
  }
  
  else{
    cout << 0 << endl;
  }  

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I=ll(A);I<ll(B);++I)

const int Xx = 'x'-'X';
const int xX = 'X'-'x';

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

	string s;
	getline(cin,s);
	for(auto &c:s){
		if(c<='Z'&&c>='A'){
			c += Xx;
		}else if(c<='z'&&c>='a'){
			c += xX;
		}
	}
	cout << s << "\n";
}


Measured memory_bytes: 3232
#include <algorithm>
#include <iostream>
#include <string>

int main() {
    int N, Y;
    std::cin >> N >> Y;

    const int max_10000 = Y / 10000;
    const int max_5000 = Y / 5000;
    
    std::string ret = "-1 -1 -1";
    for (int i = 0; i <= max_10000; ++i) {
        for (int j = 0; j <= max_5000; ++j) {
            const int k = N - (i + j);
            if (k < 0) {
                continue;
            }

            if (10000*i + 5000*j + 1000*k == Y) {
                ret = std::to_string(i) + " "
                    + std::to_string(j) + " "
                    + std::to_string(k);
                break;
            }
        }
    }

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

int n;
int a[200000];

int main(){
    cin>>n;
    rep(i,n) cin>>a[i];

    deque<int> q;
    rep(i,n){
        if(i%2==0) q.push_back(a[i]);
        else q.push_front(a[i]);
    }

    if(n%2==0) while(!q.empty()){
        cout<<q.front()<<' '; q.pop_front();
    }else while(!q.empty()){
        cout<<q.back()<<' '; q.pop_back();
    }
    cout<<endl;
}

Measured memory_bytes: 5236
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
using P = pair<int, int>;

signed main(){

  int h, w; cin >> h >> w;
  priority_queue<P,vector<P>,greater<P>> q; //最小値
  for(int i = 0; i < h; i++){
    int p; cin >> p;
    q.push({p, 0});
  }
  for(int i = 0; i < w; i++){
    int p; cin >> p;
    q.push({p, 1});
  }

  int ans = 0, x = w+1, y = h+1;
  while(!q.empty()){
    auto p = q.top(); q.pop();
    if(p.second == 0){
      ans += x * p.first;
      y--;
    }else {
      ans += y * p.first;
      x--;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6000
N,X,Y=map(int,input().split())

ans = [0 for i in range(N+1)]

for i in range(1,N+1):
  for j in range(i+1,N+1):
    if i < X :
      if j < X:
        a = j - i
        ans[a] += 1
      elif j >= X and j < Y:
        a = j - i
        b = (X-i) + 1 + (Y-j)
        c = min(a,b)
        ans[c] += 1
      else:
        a =  (X-i)+ 1 + (j - Y)
        ans[a] += 1
        
    elif i >= X and i < Y:
      if j < Y:
        a = j - i
        b = (i-X) + 1 + (Y-j)
        c = min(a,b)
        ans[c] += 1
      else:
        a = j -i
        b =  (i-X) + 1 + (j - Y)
        c = min(a,b)
        ans[c] += 1
        
    else:
      a = j - i
      ans[a] += 1
        
for i in range(1,N):
  print(int(ans[i]))

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;


int score[100010];
int tim[100010];

int main(){
	int N,R,L;
	while(cin >> N >> R >> L && N){
		priority_queue< pair<int,int> > Q;
		for(int i = 0 ; i < N ; i++){
			Q.push(make_pair(0,-i));
		}
		int prev = 0;
		for(int i = 0 ; i < R ; i++){
			int d,t,x;
			scanf("%d%d%d",&d,&t,&x);
			while( score[-Q.top().second] != Q.top().first ){
				int id = -Q.top().second;
				Q.pop();
				Q.push(make_pair(score[id],-id));
			}
			//cout << -Q.top().second << " " << Q.top().first << endl;
			tim[-Q.top().second] += t - prev;
			score[d-1] += x;
			Q.push(make_pair(score[d-1],-(d-1)));
			prev = t;
			//cout << 1 + (max_element(tim,tim+N) - tim) << ' ' << *max_element(tim,tim+N)  << endl;
		}
		while( score[-Q.top().second] != Q.top().first ){
			int id = -Q.top().second;
			Q.pop();
			Q.push(make_pair(score[id],-id));
		}
		tim[-Q.top().second] += L - prev;
		cout << 1 + (max_element(tim,tim+N) - tim) << endl;
	}
}

Measured memory_bytes: 10980
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[100001],ans=0,x;
  cin>>n;
  for(int i=1; i<=n; i++){
    cin>>x;
    if(a[x]==i)ans++;
    a[i]=x;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

long long n, a, b, c, d;

int main() {
    cin >> n >> a >> b;
    for (int i = 1; i < n; ++i) {
        cin >> c >> d;
        long long k = max((a + c - 1) / c, (b + d - 1) / d);
        a = k * c;
        b = k * d;
    }
    cout << a + b << '\n';
}


Measured memory_bytes: 256