akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
		solveB(args);
//		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int N= nextInt();
		for(int i=1;i<=8;i++) {
			if(2000-i*200<=N && N<=2199-i*200) {
				pw.println(i);
				break;
			}
		}

	}
	public static void solveB(String[] args) throws Exception{
		int A = nextInt();
		int B = nextInt();
		int C = nextInt();
		int K = nextInt();

		for(int i=0;i<K;i++) {
			if(C<=B) {
				C*=2;
			}else if(B<=A) {
				B*=2;
			}
			if(C>B&&B>A) {
				pw.println("Yes");
				return;
			}
		}
		pw.println("No");
	}
	public static void solveC(String[] args) throws Exception{

	}

	public static void solveD(String[] args) throws Exception{

	}


	public static void solveE(String[] args) throws Exception{

	}

	public static void solveF(String[] args) throws Exception{

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 25408
object Main {
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val a = io.StdIn.readLine().split(" ").map(_.toInt)

    insertionSort(a, n)(arr => println(arr.mkString(" ")))
  }

  def insertionSort(a: Array[Int], n: Int)(peek: Array[Int] => Unit): Unit = {
    peek(a)
    (1 until n).foreach { i =>
      val v = a(i)
      var j = i - 1
      while (j >= 0 && a(j) > v) {
        a(j + 1) = a(j)
        j -= 1
      }
      a(j + 1) = v
      peek(a)
    }
  }
}

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

int findSumOfDigits(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {

  int N, A, B;
  cin >> N >> A >> B;

  int total = 0;

  for(int i = 1; i <= N; i++){
      int sum = findSumOfDigits(i);
      if (sum >= A && sum <= B) {
          total += i;
      }
  }
  cout << total << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=998244353;
inline int kpow(int a,int b)
{
	int s=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1)s=1ll*s*a%mod;
	return s;
}
int jc[500050],jcv[500050],n,k,ans;
inline int C(int a,int b)
{
	if(a<b)return 0;
	return 1ll*jc[a]*jcv[b]%mod*jcv[a-b]%mod;
}
int main()
{
	scanf("%d %d",&n,&k);
	jc[0]=1;
	for(int i=1;i<=k;++i)jc[i]=1ll*jc[i-1]*i%mod;
	jcv[k]=kpow(jc[k],mod-2);
	for(int i=k;i;--i)jcv[i-1]=1ll*jcv[i]*i%mod;
	if(!(k&1)&&(k/2-n>=0))ans=(1ll*ans+C(k-1,k/2)+mod-C(k-1,k/2+k/2-n+1))%mod;
	for(int i=k/2+1;i<=k;++i)if(i-n>=0)ans=(1ll*ans+C(k,i)+mod-C(k,i+i-n+1))%mod;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 4096
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		if (n % 2 == 0){
			System.out.println(n);
		}
		else{
			System.out.println(n * 2);
		}
	}
}

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

long long int solve(deque<long long int> d,int k, int l,int r){
	long long int sum=0;
	priority_queue<long long int,vector<long long int>,greater<long long int>> pq;
	for (int i = 0; i < l; i++) {
		sum+=d.front();
		pq.push(d.front());
		d.pop_front();
	}
	for (int i = 0; i < r; i++) {
		sum+=d.back();
		pq.push(d.back());
		d.pop_back();
	}
	k-=l+r;
	while (pq.size()>0&&k>0&&pq.top()<0) {
		sum-=pq.top();
		pq.pop();
		k--;
	}
	return sum;
}

int main(){
	int n,k;
	cin>>n>>k;
	deque<long long int> d;
	int temp;
	for (int i = 0; i < n; i++) {
		cin>>temp;
		d.push_back(temp);
	}
	long long int ans=0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if(i+j<=min(n,k)){
				ans=max(ans,solve(d,k,i,j));
			}	
		}
	}
	cout<<ans<<endl;
}

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

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

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

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

using namespace std;

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

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

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int limit = 200010;
ll n,y;
ll x[limit],csum[limit];

const ll inf = 1LL << 62;
ll mul(ll a,ll b){
	if(a > inf / b) return inf;
	return a * b;
}

ll calc(ll num){
	ll cur = 1LL * (n + num) * y;
	ll pos = n - 1;
	
	ll coef = 3LL;
	while(pos >= 0){
		ll tmp = csum[pos];
		if (pos - num >= 0) tmp -= csum[pos - num];
		if (pos == n - 1) cur += 2LL * tmp;
		//cout << num << " " << coef <<  " " << tmp << endl;
		cur += mul(coef, tmp);
		pos -= num;
		coef += 2LL;
	}
	return cur;
}



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

	rep(i,n) csum[i] = x[i];
	rep(i,1,n) csum[i] += csum[i-1];

	ll ans = 1LL << 60;
	rep(i,1,n+1) chmin(ans,calc(i));
	cout << u_long(ans) << endl;

	return 0;
}

Measured memory_bytes: 6528
import java.util.*;

class Main{

  public static void main(String args[]){

    Scanner s=new Scanner(System.in);
    int N=s.nextInt();
	int flag=N%10;
    
    if(flag==3) System.out.println("bon");
    else if (flag==0||flag==1||flag==6||flag==8) System.out.println("pon");
    else System.out.println("hon");
  }  
}

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

int main(){

    //入力
    int n, q; cin >> n >> q;
    vector<long long> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    for(int j = 0; j < q; j++){

        //各クエリx
        long long x; cin >> x;

        //合計値
        long long res = 0;

        //区間の左端で場合分け
        int right = 0;              //毎回rightを使いまわす
        long long sum = 0;          //sumも使いまわす

        for(int left = 0; left < n; left++){


            //sumにa[right]を加えてもいいなら,rightを動かす
            while(right < n && sum + a[right] <= x){
                sum += a[right];
                right++;
            }

            //whileを抜けた時点でrightは条件を満たす最大に
            res += (right - left);


            //leftをインクリメントする準備
            if(right == left) right++;
            else sum -= a[left];
        }

        cout << res << endl;
    }

    return 0;
}


Measured memory_bytes: 3608
#[allow(unused_imports)] use proconio::{input, marker::{Bytes, Chars, Usize1, Isize1}};
#[allow(unused_imports)] use std::cmp::{min, max};
#[allow(unused_imports)] use superslice::Ext as _;

#[proconio::fastout]
fn main() {
	input! {
		s: Chars,
		k: Usize1,
	}

	let mut v: Vec<&[char]> = vec![];
	for i in 0..s.len() {
		for j in i+1..=min(s.len(), i+6) {
			v.push(&s[i..j]);
		}
	}

	v.sort();
	v.dedup();
	//println!("{:?}", v[k]);
	for i in 0..v[k].len() {
		print!("{}", v[k][i]);
	}
	println!("");
}


Measured memory_bytes: 2676
#include <stdio.h>

int abs(int i){
	if(i >= 0){
		return i;
	}else{
		return -i;
	}
}

long long int  max(long long int i){
	if(i > 0){
		return i;
	}else{
		return 0;
	}
}

int main(void)
{
	int n;
	scanf("%d",&n);
	int x[n],y[n],i;
	long long int h[n];
	
	for(i = 0; i < n; i++){
		scanf("%d %d %lld",&x[i],&y[i],&h[i]);
	}
	
	int cx,cy;
	
	for(cx = 0; cx < 101; cx++){
		for(cy = 0; cy < 101; cy++){
			long long int geth;
			for(i = 0; i < n; i++){
				if(h[i]!=0){
					geth = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
					break;
				}
			}
			bool flag=true;
			for(i=0;i<n;i++){
				if(h[i]!=max(geth-abs(x[i]-cx)-abs(y[i]-cy)))flag=false;
			}
			if(flag)
			{
				printf("%d %d %lld\n",cx,cy,geth);
				return 0;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


signed main(void){
    int N,T[100];
    string X,S[100];
    cin >> N;
    REP(i,N){
        cin >> S[i] >> T[i];
    }
    cin >> X;
    int Ans=0;
    bool sle=false;
    REP(i,N){
        if(sle){
            Ans+=T[i];
        }
        if(X==S[i]){
            sle=true;
        }
    }
    cout << Ans << endl;
    
    return 0;
}



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

function main()
	h,w = readline() |> split |> parseMap
	s = String["" for i in 1:h]
	for i in 1:h
		s[i]=readline() |> chomp
	end
	k = 0
	for i in 1:h
		for j in 1:w
			if s[i][j]=='.'
				g = -ones(Int,h,w)
				vst = zeros(Int,h,w)
				g[i,j] = 0
				vst[i,j] = 1
				stack = Tuple{Int,Int}[(i,j)]
				while !isempty(stack)
					now = shift!(stack)
					x = now[1]
					y = now[2]
					if x>1
						if s[x-1][y]=='.'&&vst[x-1,y]==0
							vst[x-1,y]=1
							g[x-1,y]=g[x,y]+1
							push!(stack,(x-1,y))
						end
					end
					if x<h
						if s[x+1][y]=='.'&&vst[x+1,y]==0
							vst[x+1,y]=1
							g[x+1,y]=g[x,y]+1
							push!(stack,(x+1,y))
						end
					end
					if y>1
						if s[x][y-1]=='.'&&vst[x,y-1]==0
							vst[x,y-1]=1
							g[x,y-1]=g[x,y]+1
							push!(stack,(x,y-1))
						end
					end
					if y<w
						if s[x][y+1]=='.'&&vst[x,y+1]==0
							vst[x,y+1]=1
							g[x,y+1]=g[x,y]+1
							push!(stack,(x,y+1))
						end
					end
				end
				k = max(k,maximum(g))
			end
		end
	end
	println(k)
end

main()

Measured memory_bytes: 173420
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long ll;

const double INF = 1000000000000;

double u[3], d[3], r[3], l[3];

double area(double t){
    double um = max(u[1], max(u[0] + t, u[2] - t));
    double dm = min(d[1], min(d[0] - t, d[2] + t));
    double rm = max(r[1], max(r[0] + t, r[2] - t));
    double lm = min(l[1], min(l[0] - t, l[2] + t));
    return (um - dm) * (rm - lm);
}

double coner(double a, double b, int p, int q){
    return (a - b) / (q - p);
}

int main()
{
    int n;
    cin >> n;
    double x[100002], y[100002];
    char c[100002];
    fill(u, u + 3, -INF);
    fill(d, d + 3, INF);
    fill(r, r + 3, -INF);
    fill(l, l + 3, INF);
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i] >> c[i];
        if(c[i] == 'U'){
            u[0] = max(u[0], y[i]);
            d[2] = min(d[2], y[i]);
            r[1] = max(r[1], x[i]);
            l[1] = min(l[1], x[i]);
        }
        if(c[i] == 'D'){
            u[2] = max(u[2], y[i]);
            d[0] = min(d[0], y[i]);
            r[1] = max(r[1], x[i]);
            l[1] = min(l[1], x[i]);
        }
        if(c[i] == 'R'){
            u[1] = max(u[1], y[i]);
            d[1] = min(d[1], y[i]);
            r[0] = max(r[0], x[i]);
            l[2] = min(l[2], x[i]);
        }
        if(c[i] == 'L'){
            u[1] = max(u[1], y[i]);
            d[1] = min(d[1], y[i]);
            r[2] = max(r[2], x[i]);
            l[0] = min(l[0], x[i]);
        }
    }
    double ans = area(0);
    double t;
    t = u[1] - u[0];
    if(t > 0) ans = min(ans, area(t));
    t = (u[2] - u[0]) / 2;
    if(t > 0) ans = min(ans, area(t));
    t = u[2] - u[1];
    if(t > 0) ans = min(ans, area(t));
    t = d[0] - d[1];
    if(t > 0) ans = min(ans, area(t));
    t = (d[0] - d[2]) / 2;
    if(t > 0) ans = min(ans, area(t));
    t = d[1] - d[2];
    if(t > 0) ans = min(ans, area(t));
    t = r[1] - r[0];
    if(t > 0) ans = min(ans, area(t));
    t = (r[2] - r[0]) / 2;
    if(t > 0) ans = min(ans, area(t));
    t = r[2] - r[1];
    if(t > 0) ans = min(ans, area(t));
    t = l[0] - l[1];
    if(t > 0) ans = min(ans, area(t));
    t = (l[0] - l[2]) / 2;
    if(t > 0) ans = min(ans, area(t));
    t = l[1] - l[2];
    if(t > 0) ans = min(ans, area(t));
    cout << fixed << setprecision(15) << ans << endl;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
        
int main() {
    int h,w;
  cin>>h>>w;
  char A[110][110];
  
   for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
  cin>>A[i][j];
    }
   }
    
  for(int i=0;i<=h+1;i++){
    for(int j=0;j<=w+1;j++){
    if(i==0 ||j==0|| i==h+1||j==w+1)A[i][j]='#';
      cout<<A[i][j];
      if(j==w+1)cout<<endl;
    }
  }
     
}

Measured memory_bytes: 256
x,y,a,b,c=map(int,input().split())
arr1=list(map(int,input().split()))
arr1=sorted(arr1,reverse=True)
arr1=arr1[:x]
arr2=list(map(int,input().split()))
arr2=sorted(arr2,reverse=True)
arr2=arr2[:y]
arr3=list(map(int,input().split()))
ans=arr1+arr2+arr3
ans=sorted(ans,reverse=True)
print(sum(ans[:x+y]))

Measured memory_bytes: 22504
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
	re int t=0;
	re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0'){
		t=(t<<3)+(t<<1)+v-48;
		v=getchar();
	}
	return t;
}
long long n,m,a[32]={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};
int main(){
	n=read();m=read();
	if(n>1&&m>1)
	printf("%lld",(n*m+1)/2);
	else puts("1");
}



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

using namespace std;

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << "[";
  for (T &i: v) os << i << ",";
  os << "]";
  return os;
}

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

#ifdef __DJKIM613
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#endif

int N;
int main(void){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);

  cin >> N;
  cout << (N - 2) * 180;
  return 0;
}

Measured memory_bytes: 892
#include <math.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <ostream>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _lcint;
#define REP(i, n) for (_lcint i = 0; i < n; i++)
#define FOR(i, a, b) for (_lcint i = (_lcint)(a); i < (_lcint)(b); i++)
#define FORREV(i, a, b) for (_lcint i = (_lcint)(b)-1; i >= (_lcint)(a); i--)
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)  \
  cout << #v << ": "; \
  REP(i, v.size()) cout << " " << v[i] << endl;

#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = max((a), (b))

// permutation
ll mPn(ll m, ll n) {
  ll a = 1;
  REP(i, n) { a *= m - i; }
  return a;
}

// excrametion
ll exc(ll m) {
  ll a = 1;
  FOR(i, 1, m) { a *= i + 1; }
  return a;
}

// combination
ll mCn(ll m, ll n) {
  ll a = 1, b = 1;
  REP(i, n) {
    a *= m - i;
    b *= n - i;
  }
  return a / b;
}

// 最大公約数を求める 条件(a > b)
ll eculidean(ll a, ll b) {
  ll c = a % b;
  if (c == 0) {
    return b;
  }
  return eculidean(b, c);
}

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

  cout << floor((double)T / (double)A) * B << endl;
  return 0;
}

Measured memory_bytes: 888
#include <iostream>
using namespace std;
long long dp[101][21];
int main() {
  int n;
  int data[100];
  
  cin >> n;
  for(int i=0; i<n-1; i++) {
    cin >> data[i];
  }

  dp[0][data[0]] = 1;
  for(int i=1; i<n-1; i++) {
    for(int j=0; j<=20; j++) {
      if(j+data[i]<=20) dp[i][j+data[i]] += dp[i-1][j];
      if(j-data[i]>=0)  dp[i][j-data[i]] += dp[i-1][j];
    }
  }

  int s; cin >> s;
  cout << dp[n-2][s] << endl;
  return 0;
}

Measured memory_bytes: 1172
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int A, B, C, K;

int main() {

	cin >> A >> B >> C >> K;

	int k = 0;

	while (A >= B) {
		B *= 2;
		k++;
	}
	while (B >= C) {
		C *= 2;
		k++;
	}

	if (k <= K) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3632
var lines = [];

var readline = require('readline')
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});


rl.on('line', (x) => {
    lines.push(x)
});

rl.on('close', () => {
    var A = Number(lines[0].split(" ")[0])
    var B = Number(lines[0].split(" ")[1])

    if (13 <= A) { console.log(B) }
    else if (6 <= A && A <= 12) { console.log(B / 2) }
    else{console.log(0)}
});

Measured memory_bytes: 22332
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
*/

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

	int R, G, B, n;
	cin >> R >> G >> B >> n;

	int ans = 0;

	for (int i = 0; i * R <= n; i++) {
		for (int j = 0; j * G <= n; j++) {
			if (i * R + j * G > n) continue;
			if ((n - (i * R + j * G)) % B == 0) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


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

n = int(input())
vn = list(map(int,input().split()))
vo={}
ve={}
for i in range(n//2):
  if vn[2*i] not in vo:
    vo[vn[2*i]]=0
  vo[vn[2*i]]+=1
  if vn[2*i+1] not in ve:
    ve[vn[2*i+1]]=0
  ve[vn[2*i+1]]+=1
volist = sorted(vo.items(), key=lambda x:x[1], reverse=True)
velist = sorted(ve.items(), key=lambda x:x[1], reverse=True)

if volist[0][0] != velist[0][0]:
  print(n-volist[0][1]-velist[0][1])
elif len(volist) > 1 and len(velist) > 1:
  if volist[1][1] > velist[1][1]:
    print(n-volist[1][1]-velist[0][1])
  else:
    print(n-volist[0][1]-velist[1][1])
else:
  if len(volist) == 1 and len(velist) == 1:
    print(n//2)
  elif len(volist) == 1:
    print(n-volist[0][1]-velist[1][1])
  else:
    print(n-volist[1][1]-velist[0][1])

Measured memory_bytes: 21988
using System;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');

		int n = int.Parse(input[0]);
		int a = int.Parse(input[1]);
		int b = int.Parse(input[2]);

		int count = 0;

		for (int i = 1; i <= n; i++)
		{
			string str = i.ToString();
			int sum = 0;

			foreach (char c in str)
			{
				sum += int.Parse(c.ToString());
			}

			if (a <= sum && sum <= b)
			{
				count += i;
			}
		}

		Console.WriteLine(count.ToString());
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

  vector<int> h(n);

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

  int ans = 0;

  for(int i = 0;i < n;i++){
    if(h[i] >= k) ans++;
  }

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int a[3]; rep(i,3) cin>>a[i];
    sort(a,a+3);
    if(a[0]+a[1] == a[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys


def main():
    read = sys.stdin.buffer.read

    k, n, *A = map(int, read().split())
    A += [A[0] + k]
    far = max(y - x for x, y in zip(A, A[1:]))
    print(k - far)


if __name__ == "__main__":
    main()

Measured memory_bytes: 27808
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

int main(){
    IOS;
    ll a,b,c;cin>>a>>b>>c;
    if((a==b || b==c || c==a) && !(a==b && b==c))cout<<"Yes";
    else cout<<"No";
    return 0;  
} 

Measured memory_bytes: 256
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[allow(dead_code)]
const MOD: usize = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        N: usize,
    }
    println!("{}", (1..N+1).fold(1, |acc, i| acc * i % MOD));
}

Measured memory_bytes: 4352
K = int(input())
if K%2 == 0 or K%5 ==0:
    print(-1)
else:
    a = 0
    L = [0] * 2000000
    L[0] = 7%K
    for i in range(1,2000000):
        L[i] = L[i - 1] * 10 %K
    for i in range(2000000):
        a = (a + L[i])%K
        if a == 0:
            ans = i + 1
            break
    print(ans)

Measured memory_bytes: 88104
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<pair <ll,ll> >p(n);
    REP(i,n){
        ll a,b;
        cin >> a >> b;
        p[i].first = a;
        p[i].second = b;
    }
    sort(p.begin(),p.end());
    //REP(i,n){
        //cout << p[i].first << " " << p[i].second << endl;
    //}
    int i = 0;
    while(k >= 0){
        if(p[i].second < k){
            k-=p[i].second;
            i++;
        }
        else{
            break;
        }
    }
    cout << p[i].first << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

// long version
long long int GCD(long long int x, long long int y){
    if(x>y){
        long long int swap = x;
        x = y;
        y = swap;
    }
    while(true){
        if(y%x==0){
            return x;
        }else{
            long long int amari = y%x;
            y = x;
            x = amari;
        }
    }
}

int main() {
    int n;
    cin >> n;
    ll m;
    cin >> m;
    ll a[n];
    int two[100] = {};
    rep(i,n){
        cin >> a[i];
        a[i] /= 2;
        int cnt = 0;
        int aa = a[i];
        while(aa % 2 == 0){
            cnt++;
            aa /= 2;
        }
        two[cnt] = 1;
    }

    int cnt = 0;
    rep(i,100)cnt += two[i];

    if(cnt >= 2){
        cout << 0 << endl;
        return 0;
    }

    ll now = 1;
    ll ans = 0;

    rep(i,n){
        now = now * a[i] / GCD(now, a[i]);
        if(now > m){
            cout << ans << endl;
            return 0;
        }
    }

    ans = (m / now + 1) / 2;

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


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int h,r;
    scanf("%d %d",&h,&r);
    if( ( h+r ) == 0 )
    {
        printf("0\n");
    }
    else if( ( h+r ) > 0 )
    {
        printf("1\n");
    }
    else
    {
        printf("-1\n");
    }
    return 0;
}


Measured memory_bytes: 2112
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int H,W;
		while(true){
			H= sc.nextInt();
			W = sc.nextInt();
			
			if(H == 0 && W == 0)
				break;
			
			for(int i = 1;i <= H;i++){
				if(i % 2 == 1){
					for(int j = 1;j <= W;j++){
						if(j % 2 == 1)
							System.out.print("#");
						else
							System.out.print(".");
					}
				}else{
					for(int j = 1;j <= W;j++){
						if(j % 2 == 1)
							System.out.print(".");
						else
							System.out.print("#");
					}
				}
				System.out.print("\n");
			}
			System.out.print("\n");
		}
	}
}

Measured memory_bytes: 31972
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
const ll mod = 998244353 ;
const double pi = acos(-1);
ll fastpow(ll b, ll e) {
    if (!e)
        return 1;
    ll ret = fastpow(b, e / 2);
    ret = (ret * ret) % mod;
    if (e % 2)
        ret = (ret * b) % mod;
    return ret;
}
ll modinv(ll x) {
    return fastpow(x, mod - 2);
}
double torad(double ang) {
    return ang * pi / 180.0;
}
int prime[N];
void sieve() {
    prime[0] = prime[1] = 1;
    for (int i = 2; i < N; i++) {
        if (!prime[i]) {
            for (int j = i; j < N; j += i)
                prime[j] = i;
        }
    }
}

int main()
{
    ///smallest/largest case
    ///initialize
    int n, k;
    scanf("%d%d", &n, &k);
    int a[N];
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    int dp[N] = {0};
    for (int i = 0; i < n - 1; i++)
        dp[i] = 1e9 + 5;
    for (int i = n - 2; i >= 0; i--) {
        for (int j = 1; j <= k; j++) {
            if (i + j < n)
                dp[i] = min(dp[i], dp[i + j] + abs(a[i] - a[i + j]));
        }
    }
    printf("%d\n", dp[0]);
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

int main(){
  int a,b,c,d,e,ans;
  cin>>a>>b;
  c=a+b;
  d=a*b;
  e=a-b;
  ans=max(c,d);
  ans=max(ans,e);
  cout<<ans<<endl;
}

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

#define db(x) cerr << #x ": " << (x) << '\n';

#define int long long

using namespace std;

typedef long long ll;

typedef long double ld;

const int oo = 1e18;

const int MAXN = 2010;

int N, X, Y;

int T[MAXN];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> N >> X >> Y;

    for(int i = 1 ; i <= N ; i++)
    {
        for(int j = i+1 ; j <= N ; j++)
        {
            int men = oo;
            men = min(men,abs(i-j));
            men = min(men,abs(i-X)+1+abs(j-Y));
            men = min(men,abs(i-Y)+1+abs(j-X));
            T[men]++;
        }
    }

    for(int i = 1 ; i <= N-1 ; i++)cout << T[i] << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<char> ans;
  bool ok = true;
  auto simulate = [&](string s) {
    if (s == "AB") {
      if (a == 0 && b == 0) ok = false;
      else if (a == 0) ans.emplace_back('A'), a++, b--;
      else if (b == 0) ans.emplace_back('B'), b++, a--;
      else {
        if (b > a) ans.emplace_back('A'), a++, b--;
        else ans.emplace_back('B'), b++, a--;
      }
    }
    else if (s == "BC") {
      if (b == 0 && c == 0) ok = false;
      else if (c == 0) ans.emplace_back('C'), c++, b--;
      else if (b == 0) ans.emplace_back('B'), b++, c--;
      else {
        if (b > c) ans.emplace_back('C'), c++, b--;
        else ans.emplace_back('B'), b++, c--;
      }
    }
    else {
      if (c == 0 && a == 0) ok = false;
      else if (a == 0) ans.emplace_back('A'), a++, c--;
      else if (c == 0) ans.emplace_back('C'), c++, a--;
      else {
        if (a > c) ans.emplace_back('C'), c++, a--;
        else ans.emplace_back('A'), a++, c--;
      }
    }
    debug(a, b, c);
  };
  
  if (a+b+c == 1 || a+b+c >= 3) {
    rep(i,n) {
      string s;
      cin >> s;
      simulate(s);
    }
  }
  else { //a+b+c = 2
    vector<string> S(n);
    rep(i,n) cin >> S[i];
    rep(i,n-1) {
      if (S[i] == "AB" && (a == 1 && b == 1)) { 
        if (S[i+1] == "BC") ans.emplace_back('B'), b++, a--;
        else ans.emplace_back('A'), a++, b--;
      }
      else if (S[i] == "BC" && (c == 1 && b == 1)) {
        if (S[i+1] == "AC") ans.emplace_back('C'), c++, b--;
        else ans.emplace_back('B'), b++, c--;
      }
      else if (S[i] == "AC" && (a == 1 && c == 1)){
        if (S[i+1] == "AB") ans.emplace_back('A'), a++, c--;
        else ans.emplace_back('C'), c++, a--;
      }
      else simulate(S[i]);
    }
    simulate(S[n-1]);
  }
  if (ok) {
    cout << "Yes" << endl;
    rep(i,n) cout << ans[i] << "\n";
  }
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 6624
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    string s;
    cin >> s;
    int ans = 1;
    string pre;
    pre += s[0];
    for(int i = 1;i < s.size();i++)
    {
        string t = s.substr(i,1);
        if(pre == t && i == s.size() - 1)
        {
            break;
        }
        else if(pre == t)
        {
            pre = s.substr(i,2);
            i++;
        }
        else
        {
            pre = t;
        }
        ans++;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 640
// Here is the top-down approach of 
#include <bits/stdc++.h>
#define int int64_t 
using namespace std; 

int dp[100001][101];
int vis[100001][101]={0};
vector<int> v,w;


int solve(int W,int n){
    int &ans = dp[W][n];
    if(W ==0 or n == 0 )
        return 0;
    
    if(w[n-1] > W)
        return solve(W,n-1);
    if(vis[W][n]) return ans;
    vis[W][n] = 1;
    ans = max(v[n-1]+solve(W-w[n-1],n-1) , solve(W,n-1));
    
    return ans;
  
}
signed main() 
{ 
    int n,W;
    cin>>n>>W;
    int x,y;
    
    for(int i=0;i<n;i++){
        cin>>x>>y;
        w.push_back(x);
        v.push_back(y);
    }
    
    cout<<solve(W,n);
    
} 


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

int main(void)
{
	long int i, j;
	long int h, n;
	long int work;
	long int count = 0;
	char str[200];
	
	scanf("%s", str);
	
	
	for(i = 0; i < strlen(str); i++) {
		printf("x");
	}
	
	return 0;
}


Measured memory_bytes: 128
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    it = map(int, sys.stdin.read().split())
    N = next(it)

    cnt = 0
    for d1, d2 in zip(it, it):
        if d1 != d2:
            cnt = 0
        else:
            cnt += 1
            if cnt == 3:
                print("Yes")
                break
    else:
        print("No")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 61776
#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[i];
  map<int,int>mp;
  for(int i=0;i<n;i++){
    if(mp.count(a[i]))mp.at(a[i])++;
    else mp[a[i]]=1;
    if(mp.count(a[i]-1))mp.at(a[i]-1)++;
    else mp[a[i]-1]=1;
    if(mp.count(a[i]+1))mp.at(a[i]+1)++;
    else mp[a[i]+1]=1;
  }
  int saidai=0;
  auto begin=mp.begin(),end=mp.end();
  for(auto iter=begin;iter!=end;iter++){
    int tmp=iter->second;
    //cout<<tmp<<endl;
    saidai=max(saidai,tmp);
  }
  cout<<saidai<<endl;
  return 0;
}


Measured memory_bytes: 5120
/// 1行の文字を空白で分割してVec<T>にする。
fn read_split<T : std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

fn main() {
    let input : Vec<i32> = read_split();
    let water = input[1] + input[2];
    let answer : i32;
    if water < input[0] {
        answer = 0;
    } else {
        answer = water - input[0];
    }
    println!("{}", answer);
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,t;
	cin>>a>>b>>t;
	int m=(t+0.5)/a;
	int k;
	if(m>0){
		k=m*b;
	}
	else{
		k=0;
	}
	printf("%d",k);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
total = 0
for i in range(1,n+1):
    if i % 2 ==0:continue
    count = 0
    for j in range(1,n+1):
        if count >8:
            total -= 1
            continue
        if i % j == 0:
            count +=1
    if count == 8 :
        total += 1
print(total)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define N 110
using namespace std;

int main(){
  int n;
  cin>>n;
  int A[N],cnt=0;
  for(int i=0;i<n;i++)cin>>A[i];

  for(int i=0;i<n-1;i++)
    for(int j=n-1;j>=i+1;j--)
      if(A[j] < A[j-1]) swap(A[j],A[j-1]),cnt++;

  for(int i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<A[i];
  }
  cout<<endl;
  cout<<cnt<<endl;

  return 0;
}

Measured memory_bytes: 3072
import java.util.Arrays;
import java.util.Scanner;

public class Main {



    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        int heights[] = new int[i];
        for (int j = 0; j < heights.length; j++) {
            heights[j] = scanner.nextInt();
        }
        long numOfWays = getNumOfWays(heights);
        System.out.println(numOfWays);
    }

    private static long getNumOfWays(int hei[]) {
        int dp[] = new int[hei.length];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[dp.length - 1] = 0;
        for (int i = dp.length - 2; i >= 0; i--) {
            if (i + 1 < dp.length)
                dp[i] = Math.min(dp[i], Math.abs(hei[i] - hei[i + 1]) + dp[i + 1]);
            if (i + 2 < dp.length) {
                dp[i] = Math.min(dp[i], Math.abs(hei[i] - hei[i + 2]) + dp[i + 2]);
            }
        }
        return dp[0];
    }
    

}


Measured memory_bytes: 59548
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<string>
#include<map>
#include<queue>

using namespace std;

int main(void){

    int a, b;
    cin >> a >> b;

    if(a > 8 || b > 8) cout << ":(" << endl;
    else cout << "Yay!" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d))
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int N,X,D=0;
  scanf("%d %d",&N,&X);
  int L;
  for(int  i=0;i<N;i++){
    scanf("%d",&L);
    D += L;
    if(D > X ){
      printf("%d",i+1);
      return  0;
    }
  }
  printf("%d",N+1);
  return 0;
}
  

Measured memory_bytes: 128
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const adjLists = Array.from(Array(n), () => []);
  lines.forEach((l, i) => l.split(' ').splice(2).forEach(e => adjLists[i].push(e-1)));

  const d = [], f = [];
  dfs(adjLists, d, f);
  for (let i = 0; i < n; i++) {
    console.log(i + 1, d[i], f[i]);
  }
})();

function dfs(adjLists, d, f) {
  const WHITE = 0, GRAY = 1, BLACK = 2;
  const size = adjLists.length;
  const color = Array.from(adjLists, () => WHITE);

  let time = 0;
  function visit(u) {
    color[u] = GRAY;
    d[u] = ++time;
    adjLists[u].forEach(v => {
      if (color[v] === WHITE) {
        visit(v);
      }
    });
    color[u] = BLACK;
    f[u] = ++time;
  }
  adjLists.forEach((e, u) => {
    if (color[u] === WHITE) visit(u);
  });
}



Measured memory_bytes: 17416
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

long long calc(long long x,long long y,long long int& count){

	int tmp_count = 0,tmp;

	while(y != 0){
		tmp = y;
		y = x%y;
		x = tmp;
		tmp_count++;
	}

	count = tmp_count;
	return x;
}

int main(){

	long long a,b,count,number;

	while(true){
		scanf("%lld %lld",&a,&b);
		if(a == 0 && b == 0)break;

		if(a > b){
			number = calc(a,b,count);
		}else{
			number = calc(b,a,count);
		}

		printf("%lld %lld\n",number,count);

	}

    return 0;
}



Measured memory_bytes: 2728
#include<bits/stdc++.h>
using namespace std;
int main(){
	
		long int n,k,sum=0,c;
		cin>>n>>k;
		long int g[n];
		for(int i=0;i<n;i++){
		    cin>>g[i];
		}
		sort(g,g+n);
		for(int i=0;i<n-k;i++){
		    sum+=g[i];
		}
		cout<<sum;
		return 0;
}

Measured memory_bytes: 5172
#include <iostream>
using namespace std;
int main(){
	int a,b,c,t;
	cin >> a >> b >> c;
	for (int i = a; i <= b; ++i)
	{
		if (c % i == 0)
		{
			t = t+1;
		}
	}
	cout << t << endl;
}


Measured memory_bytes: 3100
#include<stdio.h>
#include<string.h>
char s[30];
int main(){
	gets(s);
	int len=strlen(s);
	int isok,temp;
	if(strcmp(s,"zyxwvutsrqponmlkjihgfedcba")==0){
		printf("-1");
		return 0;
	}
	
	if(len!=26){//在不加新数的情况下已经达到最大值；需要在后面加一个尽可能小的新数 
		for(int j='a';j<='z';j++){
			isok=1;
			for(int k=0;k<len;k++){
				if(s[k]==j){
					isok=0;
					break;
				}
			}
			if(isok){
				printf("%s%c\n",s,j);
				return 0;
			}
		}	
	}
	
	else{//重新排序 
		int j=25;
		int k;
		while(s[j-1]>s[j]){
			j--;
		}
		//前面的数字比他小，这时候就要尽可能小的扩大他前面的数字
		for(k=s[j-1]+1;k<='z';k++){
			isok=1;
			for(int l=0;l<j-1;l++){
				if(s[l]==k){
					isok=0;
					break;
				}
			}
			if(isok)break;
		}
		s[j]='\0';
		s[j-1]=k;
		puts(s);
		return 0;	
	} 
}

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

int main() {
  
  int a, b;
  
  cin >> a >> b;
  
  if (a*b%2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
typedef long long ll;

const int INF = 1e9;
const long long LLINF = 1e18;

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

    int cnt=0;
    REP(i, 0, a+1){
        REP(j, 0, b+1){
            REP(k, 0, c+1){
                if(500*i+100*j+50*k==x) cnt++;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000


int main() {
	int a, p;
	cin >> a >> p;
	cout << (a * 3+p) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let n: usize = get_vec_input()[0];
    let count = (1..n + 1)
        .filter(|x| x % 2 != 0)
        .map(|x| count_div(x))
        .filter(|x| *x == 8)
        .collect::<Vec<_>>()
        .len();

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

#[allow(dead_code)]
fn count_div(value: usize) -> usize {
    (1..200 + 1)
        .filter(|x| value % x == 0)
        .collect::<Vec<_>>()
        .len()
}

#[allow(dead_code)]
fn get_digit(value: i64) -> i64 {
    let mut digit = 0i64;
    let mut value = value;
    while value != 0 {
        value /= 10;
        digit += 1;
    }
    digit
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}

#[allow(dead_code)]
fn get_string_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.trim().to_string()
}


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

int main()
{
    int num;
    cin >> num;
    bool judge[10];
    int current,K;
    cin >> K;
    for(int i=0;i<10;i++){
        judge[i]=true;
    }
    for(int i=0;i<K;i++){
        cin >> current;
        judge[current]=false;
    }

    int ten = 1;
    while(num>=ten){
        if(judge[(num/ten)%10]){
            ten *= 10;
        }else{
            num /= ten;
            while(judge[num%10]==false){
                num ++;
            }
            num *= ten;
            ten = 1;
        }
    }

    cout << num << endl;

    return 0;
}

Measured memory_bytes: 888
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

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

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

    // vector<bool> a(N + 1, false);

    int count = 0;
    for (int i = 0; i <= 25; i++) {
        for (int j = 0; j <= 14; j++) {
            int x = i * 4 + j * 7;
            if (x == N) {
                count++;
            }
        }
    }

    if (count > 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256