akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

signed main() {
    int n;
    cin>>n;
    vector<i64> a(n);
    REP(i,n){
        cin>>a.at(i);
    }

    i64 bitsum;
    REP(i,n){
        if(i==0){
             bitsum = a.at(i);
             continue;
        }

        bitsum = bitsum ^ a.at(i);
    }

    if(bitsum == 0){
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }

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

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n, m;
    cin >> n >> m;
    VI r(n, 0), w(n, 1);
    r[0]++, w[0]--;
    int x, y;
    FOR(i, 0, m) {
        cin >> x >> y;
        x--, y--;
        if (r[x]) {
            r[x]--, r[y]++;
            if (w[y]) {
                r[y] += w[y];
                w[y] = 0;
            }
        }
        else if (w[x]) {
            w[x]--, w[y]++;
            if (r[y]) {
                r[y] += w[y];
                w[y] = 0;
            }
        }
    }

    SORT(r);
    cout << n - (upper_bound(all(r), 0) - r.begin()) << "\n";
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        ll X;
        cin>>X;
        X-=400;
        ll val=X/100;
        val/=2;
        cout<<8-val<<endl;
    }
    return 0;

}


Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>

int main(){
int n,m;
  char S[10],T[10],U[10];
 scanf("%s %s",T,U);
  scanf("%d %d",&n,&m);
  scanf("%s",S);
   if(strcmp(S,T)==0){
   n=n-1;
   }else{
   m=m-1;
   }
  printf("%d",n);
  printf(" ");
  printf("%d",m);

  
  return 0;
}


Measured memory_bytes: 128
import math
a, b, x = map(int, input().split())
if x <= 0.5 * a*a*b:
    ans = math.pi / 2 - math.atan(2*x / (b*b*a))
    print(ans / (math.pi/ 4) * 45)
elif x == a * a *b:
    print(0)
else:
    ans = math.atan(a*a*a / (2*a*a*b - 2*x))
    print(90 - ans / (math.pi/ 4) * 45)

Measured memory_bytes: 3064
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
   long long int n,k,c=0;
   cin>>n>>k;
   long long int h[n];
   long long int sum=0;
  for(long long int i=0;i<n;i++)
  {
      cin>>h[i];
      sum=sum+h[i];
  }
  if(k>=n)
  {
    cout<<0;
    return 0;
  }
  if(k==0)
  {
     cout<<sum;
     return 0;
  }
    sort(h,h+n);
    long long int s=0;
    for(long long int i=0;i<=n-k-1;i++)
    {
       
       s=s+h[i];
    }
    cout<<s;
  
    return 0;
}


Measured memory_bytes: 1792
//============================================================================
// Name        : abcD70series.cpp
// Author      : sep
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>

using namespace std;

using edge = struct
{
	unsigned long long int to;
	unsigned long long int cost;
};

vector<edge> *tree;
unsigned long long int *depth;

void dfs070D(unsigned long long int v, unsigned long long int p,
		unsigned long long int d) {

	depth[v] = d;

	for (edge & e : tree[v]) {

		if (e.to == p)
			continue;

		dfs070D(e.to, v, d + e.cost);

	}

}

inline void main070D() {

	unsigned long long int n;
	unsigned long long int a, b, c;
	unsigned long long int q, k;
	unsigned long long int x, y;
	unsigned long long int i;

	cin >> n;
	tree = new vector<edge> [n];
	depth = new unsigned long long int[n];

	for (i = 0; i < n - 1; i++) {

		cin >> a >> b >> c;
		a--, b--;
		tree[a].push_back( { b, c });
		tree[b].push_back( { a, c });
	}

	cin >> q >> k;

	k--;

	dfs070D(k, -1, 0);
	for (i = 0; i < q; i++) {
		cin >> x >> y;
		x--, y--;
		cout << depth[x] + depth[y] << endl;
	}

}

int main() {

#ifdef TEST
	struct timespec startTime, endTime;
	while (1) {
		clock_gettime(CLOCK_REALTIME, &startTime);
#endif

		main070D();

#ifdef TEST
		cout << flush;
		cerr << flush;
		cerr << endl << "Elapsed Time:";
		clock_gettime(CLOCK_REALTIME, &endTime);
		if (endTime.tv_nsec < startTime.tv_nsec) {
			cerr << endTime.tv_sec - startTime.tv_sec - 1 << "."
					<< endTime.tv_nsec + 1000000000 - startTime.tv_nsec << "s"
					<< endl;
		} else {
			cerr << endTime.tv_sec - startTime.tv_sec << "."
					<< endTime.tv_nsec - startTime.tv_nsec << "s" << endl;
		}

		cerr << endl;
	}
#endif

	return 0;
}


Measured memory_bytes: 14336
#coding: utf-8
#ALDS1_2A

def pnt(s):
 for i in xrange(len(s)):
  print s[i],
 print

n=int(raw_input())
a=map(int,raw_input().split())

sw=0
flag=True
while flag:
 flag=False
 for j in xrange(n-1,0,-1):
  if a[j]<a[j-1]:
   a[j],a[j-1]=a[j-1],a[j]
   flag=True
   sw+=1

pnt(a)
print sw

Measured memory_bytes: 6444
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {
  int N;
  long long a[10001];
  int counter = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    while(a[i] % 2 == 0) {
      a[i] /= 2;
      counter += 1;
    }
  }
  cout << counter << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cstdlib>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    float d,t,s;
    cin>>d>>t>>s;
    if(d/s<=t){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}

Measured memory_bytes: 3708
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.HCPC2019_15
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int m = ReadInt();
            List<int[]> res = new List<int[]>();
            while (m > 0)
            {
                int[][] scores = new int[m][];
                for(int i = 0; i < m; i++)
                {
                    int[] score = ReadInts();
                    int now = 0;
                    int turnNow = 1;
                    for(int j = 1; j < score.Length; j++)
                    {
                        if (turnNow == 10)
                        {
                            while (j < score.Length)
                            {
                                now += score[j];
                                j++;
                            }
                        }
                        else
                        {
                            now += score[j];
                            if (score[j] == 10)
                            {
                                now += score[j + 1] + score[j + 2];
                            }
                            if (score[j] < 10)
                            {
                                j++;
                                now += score[j];
                                if (score[j - 1] + score[j] == 10)
                                {
                                    now += score[j + 1];
                                }
                            }
                            turnNow++;
                        }
                    }

                    scores[i] = new int[2] { score[0], now };
                }
                scores = scores.OrderBy(a => a[0]).ToArray();
                res.AddRange(scores.OrderBy(a => -a[1]));
                m = ReadInt();
            }

            for(int i = 0; i < res.Count; i++)
            {
                WriteLine(res[i][0] + " " + res[i][1]);
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 16248
S = input()

a = ['dream','dreamer','erase','eraser']
for i,ch in enumerate(a):
  a[i] = ch[::-1]

S = S[::-1]

flag = True
while flag:
  if len(S)==0:
    ans  = 'YES'
    flag = False
  elif S[:5] in a:
    S = S[5:]
  elif S[:6] in a:
    S = S[6:]
  elif S[:7] in a:
    S = S[7:]
  else:
    ans  = 'NO'
    flag = False
  
print(ans)

Measured memory_bytes: 3316
//https://atcoder.jp/contests/caddi2018/tasks/caddi2018_b
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll N; cin>>N;
    bool allev=true;
    REP(i,N){ //全部偶数だったらsecond
        ll a; cin>>a;
        if(a%2!=0)allev=false;
    }
    cout<<(allev?"second":"first")<<endl;
    return 0;
}

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

int main(){
	int N;
	scanf("%d",&N);
	int d[N];
	int num[110] = {0}; /* バケット */

	for(int i=0; i<N; i++){
		scanf("%d",&d[i]);
	}

	for(int i=0; i<N; i++){
		num[d[i]]++; /* d[i]が１増える */
	}

	int ans = 0; /* 解答 */

	for(int i=1; i<= 100; i++){
		if(num[i]){	//num[i]が0より大きいなら 
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

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

const int mod = 1e9+7;
const int Max = 2e8;
const double eps = 1e-4;

int main(){
    int n;
    scanf("%d",&n);
    int t = ceil(n/1000.0);
    int ans = (t*1000)-n;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3840
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FS r = new FS();
		String s = r.next();
		int c = 0;
		for(int i=0; i<s.length(); i++) {
			if(s.charAt(i) == 'p') c++;
		}
		System.out.println((s.length()-c*2)/2);
	}

	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}

		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}

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

const ll mod = 1e9 + 7;
ll n, dp[777][2020], s[777][2020], ans;


int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;

	dp[0][0] = s[0][0] = 1;

	for(int i=1;i<=n/3+1;i++){
		for(int j=1;j<=n;j++){
			if(j >= 3) (dp[i][j] += s[i-1][j-3]) %= mod;
			s[i][j] = (s[i][j-1] + dp[i][j]) % mod;
		}
	}

	for(int i=1;i<=n/3+1;i++) ans = (ans + s[i][n]) % mod;

	cout << ans;
}

Measured memory_bytes: 24632
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <functional>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(a)					(a).begin(),(a).end()
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(1000 * 1000 * 1000 * 2)
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int N;
	cin >> N;	
	vector<int> s(N);
	REP(i, N) cin >> s[i];
	sort(ALL(s));
	int sum = accumulate(ALL(s), 0);

	if (sum % 10 == 0) {
		REP(i, N) {
			if (s[i] % 10 != 0) {
				sum -= s[i];
				break;
			}
		}
	}

	if (sum % 10 == 0) {
		cout << 0 << endl;
	} else {
		cout << sum << endl;
	}

	return 0;
}



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

int n, q;
const int N = 1 << 17;
const int INF = (1LL << 31LL) - 1;
int dat[2 * N - 1];

void init(int n_)
{
	n = 1;
	while(n_ > n)
		n *= 2;
	for(int i = 0; i < n * 2 - 1; ++i)
		dat[i] = INF;
}

void update(int k, int a)
{
	k += n - 1;
	dat[k] = a;
	
	while(k > 0){
		k = (k - 1) / 2;
		dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r)
{
	if(r <=  a || b <= l)
		return INF;
	
	if(a <= l && r <= b)
		return dat[k];
	
	int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
	int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
	
	return min(vl, vr);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n >> q;
	init(n);
	
	int c, x, y;
	for(int i = 0; i < q; ++i){
		cin >> c >> x >> y;
		if(c == 0)
			update(x, y);
		else {
			y++;
			cout << query(x, y, 0, 0, n) << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 2220
GC.disable

n = gets.to_i

a = gets.split.map(&:to_i)
a1 = a.count(1)
a2 = a.count(2)
a3 = a.count(3)

m = a2 + a3
d = Array.new(m+1) {Array.new(n+1, 0.0)}
u = Array.new(m+1) {Array.new(n+1, 0.0)}

(a3+1).times do |c3|
    (m-c3+1).times do |c2|
        (n-c2-c3+1).times do |c1|
            t = c1 + c2 + c3
            next if t == 0
            s = n.to_f
            s += u[c2][c1-1] * c1 if c1 > 0
            s += u[c2-1][c1+1] * c2 if c2 > 0
            s += d[c2+1][c1] * c3 if c3 > 0
            u[c2][c1] = s / t
        end
    end
    d, u = u, d
end

p d[a2][a1]


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

int main()
{
    long N = 0;
    long b = 0;
    long a = 0;
    cin >> N >> a >> b;
    long n = N / (a + b);
    long m = N % (a + b);
    if (m > a) { m = a; }
    long result = n * a + m;
    cout << result << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

#define mod 1000000007

int main() {
    ll n = 0;
    cin >> n;
    vector<int> prime;
    for (int i=2; i<1000; i++) {
        bool flag = true;
        for (int j=2; j<i; j++) {
            if (i%j == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            prime.push_back(i);
        }
    }
    ll ans = 1;
    for (int pri : prime) {
        ll buf = 0;
        ll cur = pri;
        while (cur <= n) {
            buf += n/cur;
            cur *= pri;
        }
        ans *= buf+1;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())
am, bm, cm = a%2, b%2, c%2
ans = 1

if am == bm and bm == cm:
    ans -= 1
elif am == bm and bm != cm:
    a += 1
    b += 1
elif bm == cm and cm != am:
    b += 1
    c += 1
elif cm == am and am != bm:
    c += 1
    a += 1

m = max(a, b, c)
ans += int((m-a)/2+(m-b)/2+(m-c)/2)
print(ans)

Measured memory_bytes: 3064
n = gets.chomp.to_i
arr = Array.new(n)
n.times do |i|
	arr[i] = gets.chomp.split.map(&:to_i)
end

arr = arr.sort{|a,b| a[1] <=> b[1]}

elapsed = 0

n.times do |i|
	elapsed += arr[i][0]
	if elapsed > arr[i][1]
		puts "No"
		exit
	end
end
puts "Yes"



Measured memory_bytes: 31776
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static final int SIZE = 200000;
    static boolean[] isNotPrime = new boolean[SIZE];

    public static void main(String[] args) {
        sieve();
        int x = sc.nextInt();
        for(int i = x; i < SIZE; i += (i % 2 == 0) ? 1 : 2) {
            if(!isNotPrime[i]) {
                System.out.println(i);
                return;
            }
        }
    }

    static void sieve() {
        double ub = Math.sqrt(SIZE);

        for(int i = 0; i <= ub; ++i) {
            if(i < 2) {
                isNotPrime[i] = true;
            } else if(!isNotPrime[i]) {
                for(int j = i * i; j < SIZE; j += i) isNotPrime[j] = true;
            }
        }
    }
}

Measured memory_bytes: 23892
def main():
    _ = int(input())
    a = list(map(int,input().split()))
    count = 0
    for i in a:
        while True:
            if i%2 == 0:
                i = i//2
                count += 1
            else:
                break
    print(count)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 40432
import datetime

while True:
    y1,m1,d1,y2,m2,d2=[int(i) for i in input().split(" ")]
    if y1==-1:
        break
    d1=datetime.datetime(y1,m1,d1)
    d2=datetime.datetime(y2,m2,d2)
    print((d2-d1).days)



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

#define int long long
typedef pair<int,int> PII;

signed main(){
	int n;
	string s1,s2,s3;
	cin>>n>>s1>>s2>>s3;

	long long cnt=0;
	for (int i = 0; i < n; ++i){
		if(s1[i]==s2[i]&&s2[i]==s3[i])continue;
		if(s1[i]==s2[i]||s2[i]==s3[i]||s1[i]==s3[i])cnt++;
		else cnt+=2;
	}

	cout<<cnt<<endl;

}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)




int main(int argc, char const *argv[]) {
    long long n,x;cin>>n>>x;
    vector<long long> a(n);
    vector<long long> b(n+1,0);
    long long su = 0;
    for(int i=0;i<n;++i){
        cin>>a[i];
        su += a[i];
        b[i+1] = su;
    }
    long long res = 1ll<<62;
    for(long long k=n;k>0;--k){
        long long tmp = (n+k)*x;
        if(tmp>res)continue;
        long long i = 0;
        while(true){
            long long r = n - i*k, l = n - (i+1)*k;
            if(l<0)l=0;
            long long f = 2*i + 3;
            if(i==0)f = 5;
            tmp += f*(b[r]-b[l]);
            if(l==0)break;
            i++;
            if(tmp>res)break;
        }
        res = min(res,tmp);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3328
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[[0] * m for _ in range(n)]
for i in range(n):
        a[i]=list(map(int,input().split()))
count=0

for i in range(n):
#     print(sum(list(map(lambda a,b:a*b,a[i],b))))
   if sum(list(map(lambda a,b:a*b,a[i],b)))+c > 0:
       count+=1
print(count)

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

int sum(int n) {
	int x=0;
	while (n > 0) {
		x += n % 10;
		n /= 10;
	}
	return x;
}
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	for (int i = 1; i <= N; ++i) {
		if (A <= sum(i) && sum(i) <= B) {
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string num;
    while(true){
        cin >> num;
        int sum = 0;
        if(num[0] == '0') break;
        for(int i = 0; i < num.size(); i++){
            sum += (int)(num[i] - '0');
        }
        cout << sum << endl;
    }
}



Measured memory_bytes: 3184
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> bit(50);
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> s(n + 1);
  for (int i = 0; i < n; i++) {
    s[i + 1] = s[i] + a[i];
  }
  vector<long long> v;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      long long b = s[j] - s[i];
      v.push_back(b);
      int c = 0;
      while (b > 0) {
        if (b % 2 == 1)
          bit[c]++;
        c++;
        b >>= 1;
      }
    }

  long long ans = 0;
  long long mask = 0;
  int top = 0;
  for (int i = 49; i >= 0; i--) {
    if (bit[i] >= k) {
      ans = 1LL << i;
      mask = 1LL << i;
      top = i;
      break;
    }
  }

  for (int i = top - 1; i >= 0; i--) {
    int cnt = 0;
    for (int j = 0; j < v.size(); j++) {
      if ((v[j] & mask) == 0 || ((v[j] & mask) ^ mask) > 0)
        continue;
      if ((v[j] & (1LL << i)) > 0)
        cnt++;
    }
    if (cnt >= k) {
      mask |= (1LL << i);
      ans |= (1LL << i);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6516
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n, m, p[100010];
int root(int x){
	return x == p[x] ? x : (p[x] = root(p[x]));
}
void merge(int a, int b){
	a = root(a); b = root(b);
	if(a != b) p[b] = a;
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	cin >> n >> m;
	rep(i, m) p[i] = i;
	vi cnt(m);
	rep(i, n){
		int k; cin >> k;
		vi v(k);
		rep(j, k) cin >> v[j], cnt[--v[j]]++;
		rep(j, k - 1) merge(v[j], v[j + 1]);
	}
	set<int> r;
	rep(i, m) if(cnt[i]) r.insert(root(i));
	cout << (r.size() == 1 ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 1024
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("");
    let iter = buf.split_whitespace();
    let mut v: Vec<T> = Vec::new();
    for i in iter {
        v.push(i.parse().ok().unwrap());
    }
    v
}

fn main() {
    let n:u32 = procon_read()[0];
    if n%1000 == 0 {
        println!("{}", n%1000);
    }else{
        println!("{}", 1000_u32 - n%1000);
    }
}

Measured memory_bytes: 2128
#include <iostream>
#include <cstring>
#include <string>    
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n;

int digit_sum(ll arg){
	int r = 0;
	while(arg){
		r += arg%10;
		arg /= 10;
	}
	return r;
}

int main(){
	cin >> n;
	int digit = to_string(n).size();
	
	int ans = digit_sum(n);
	for(int i = 0; i <= digit-1; i++){
		ll buf = n;
		for(int j = 1; j <= i; j++){buf /= 10;}
		//cout << i << " " << buf << endl;
		buf--;
		ans = max(digit_sum(buf)+9*i, ans);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void branch(int a, int b, int c) {
    if (a < b && b < c) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}

int main(void) {
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);
    branch(a, b, c);
    
    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b>>c;
    if(a>=c){
        cout<<a-c<<" "<<b;
    }else{
        c-=a;
        a=0;
        if(b>=c){
            cout<<a<<" "<<b-c;
        }else{
            cout<<"0 0";
        }
    }
    return 0;
}

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

int main()
{
    string S, T, SS;
    cin >> S >> T;
    SS = S + S;
    for (int i = 1; i < SS.size(); i++)
    {
        if (SS.substr(i, S.size()) == T)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

#define M_PI 3.14159265358979323846
 
 
int main(void){
    double PI=M_PI;
    double p=PI*2/1000000;

    int N;
    double x[100],y[100];
    int kakuritu[100] ={};

    scanf("%d",&N);
    for(int i=0; i<N; i++)
        scanf("%lf %lf",&x[i],&y[i]);

    for(int i=0; i<1000000; i++) {
        double max = cos(i*p)*x[0]+sin(i*p)*y[0];
        int maxj=0;
        for(int j=0; j<N; j++) {
            if(max < cos(i*p)*x[j]+sin(i*p)*y[j]) {
                max = cos(i*p)*x[j] + sin(i*p)*y[j];
                maxj=j;
            }
        }
        kakuritu[maxj]++;
    }
    for(int i=0;i<N;i++){
        printf("%.10f\n",(double)kakuritu[i]/1000000.0f);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define MOD 1e9+7;

using namespace std;

int main(){
    string S;
    cin>>S;
    int ca=0,cb=0;
    for(int i=0;i<S.length();i++){
        if(S[i]=='A'){ca++;}
        else{
            cb++;
        }
    }
    if(ca==0||cb==0){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 150000;
typedef pair<int, int> pii;
typedef long long ll;
vector<pii>f[N], t1, t2;
int n, L[N], R[N];
ll l, r, mid, dep[N];

struct Edge {
	int to, w;
	Edge *next;
	Edge () {}
	Edge (int to, int w, Edge *next) : to(to), w(w), next(next) {}
}*head[N], pool[N << 1], *pis = pool;

bool cmp2 (const pii &A, const pii &B) { return dep[A.first] < dep[B.first]; }
bool cmp (const pii &A, const pii &B) { return dep[A.second] < dep[B.second]; }

void Dfs (int u, int fa) {
	for (Edge *now = head[u]; now; now = now -> next) if (now -> to != fa) {
		if (!L[u]) L[u] = now -> to;
		else R[u] = now -> to;
	}
	for (Edge *now = head[u]; now; now = now -> next) if (now -> to != fa) dep[now -> to] = dep[u] + now -> w, Dfs(now -> to, u);
	if (!L[u]) return f[u].push_back(pii(u, u));
	vector<pii>&tl = f[L[u]], &tr = f[R[u]], &tx = f[u];
	int lenl = tl.size(), lenr = tr.size();
	sort(tr.begin(), tr.end(), cmp2);
	sort(tl.begin(), tl.end(), cmp);
	t1.clear(); t2.clear();
	int now = -1;
	for (int i = lenl - 1, j = 0; ~i; --i) {
		bool o = 0;
		for (; j < lenr && dep[tl[i].second] + dep[tr[j].first] - dep[u] * 2 <= mid; ++j) {
			if (now == -1 || dep[tr[j].second] < dep[now]) now = tr[j].second, o = 1;
		}
		if (o) t1.push_back(pii(tl[i].first, now));
		else if (now != -1) if (dep[tl[i].first] < dep[t1.back().first]) t1.back().first = tl[i].first;
	}
	sort(tl.begin(), tl.end(), cmp2);
	sort(tr.begin(), tr.end(), cmp);
	now = -1;
	for (int i = lenr - 1, j = 0; ~i; --i) {
		bool o = 0;
		for (; j < lenl && dep[tl[j].first] + dep[tr[i].second] - dep[u] * 2 <= mid; ++j) {
			if (now == -1 || dep[tl[j].second] < dep[now]) now = tl[j].second, o = 1;
		}
		if (o) t2.push_back(pii(tr[i].first, now));
		else if (now != -1) if (dep[tr[i].first] < dep[t2.back().first]) t2.back().first = tr[i].first;
	}
	if (t1.size() > t2.size()) {
		swap(t1, tx);
		for (int i = t2.size() - 1; ~i; --i) tx.push_back(t2[i]);
	} else {
		swap(t2, tx);
		for (int i = t1.size() - 1; ~i; --i) tx.push_back(t1[i]);
	}
}

bool Judge () {
	Dfs(1, 0);
	return f[1].size();
}

int main () {
	scanf("%d", &n);
	for (int i = 2, j, k; i <= n; ++i) {
		scanf("%d%d", &j, &k);
		head[i] = new (pis++) Edge(j, k, head[i]);
		head[j] = new (pis++) Edge(i, k, head[j]);
	}
	l = 0, r = 2e10;
	while (l <= r) {
		mid = (l + r) >> 1;
		if (Judge()) r = mid - 1;
		else l = mid + 1;
	}
	printf("%lld\n", l);
	return 0;
}

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


void solve(long long H, long long W, long long N, std::vector<long long> a)
{
    vector<vector<ll>> ans(H, vector<ll>(W));
    ll color_no = 1;
    ll color_count = a[0];
    for (ll i = 0; i < H; ++i) {
        for (ll j = 0; j < W; ++ j) {
            auto jj = ((i % 2) == 0 ? j : W - j - 1);
            ans[i][jj] = color_no;
            color_count--;
            if (color_count == 0) {
                color_no++;
                color_count = a[color_no - 1];
            }
        }
    }

    for (auto&& a : ans){
        copy(begin(a), end(a), ostream_iterator<ll>(cout, " "));
        cout << "\n";
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    cin.tie(nullptr);
    cout.tie(nullptr);
	ios_base::sync_with_stdio(false);
    solve(H, W, N, std::move(a));
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std ;
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int N = 3e5+7 ;
//const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;

void solve(){
	int n , m , k ;
	cin >> n >> m >> k ;
	vi a(n) , b(m) ;
	vi p0(n+1) , p1(m+1) ; 
	for(int i = 0 ; i <n  ; i++){
		cin >> a[i] ;
		p0[i+1] = p0[i]+a[i] ;
	}
	for(int i = 0 ; i < m ; i++){
		cin >> b[i] ;
		p1[i+1] = p1[i]+b[i] ;
	}
	int ans = 0 ;
	for(int i = 0 ; i <= n ; i++){
		int cur = p0[i] ;
		int rem = k-cur ;
		if(cur > k || rem < 0) break ;
		auto it = upper_bound(all(p1), rem) ;
		if(it != p1.begin()) it-- ;
		int pos = it - begin(p1) ;
		ans = max(ans, i+pos) ;
	}
	cout << ans << endl ;
}

int32_t main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	FAST_IO ;
	int tt = 1;
//	cin >> tt ;
	while(tt--){
		solve() ;
	}
	return 0 ;
}


Measured memory_bytes: 9508
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=3000000000;
const int MOD=1000000007;

int main()
{
 int h,w,k;
 cin >> h >> w >> k;
 int c[h][w],ans[h][w],cur=0;
 for(int i=0;i<h;i++){
   for(int j=0;j<w;j++){
     char s;
     cin >> s;
     if(s=='#') c[i][j]=1;
     else if(s=='.') c[i][j]=0;
   }
 }
 int s[w];
 for(int i=0;i<w;i++){
   s[i]=0;
   for(int j=0;j<h;j++) if(c[j][i]==1) s[i]=1;
 }
 int firsts=0;
 for(int i=0;i<w;i++){
   if(s[i]==0) firsts++;
   else break;
 }
 for(int i=firsts;i<w;i++){
  if(s[i]==1){
    int firstl=0;
    for(int j=0;j<h;j++){
      if(c[j][i]==0) firstl++;
      else break;
    }
//    cout << i << " " << firstl << endl;
    for(int j=firstl;j<h;j++){
      if(c[j][i]==1) cur++;
        ans[j][i]=cur;
    }
    for(int j=0;j<firstl;j++){
      ans[j][i]=ans[firstl][i];
    }
  }else{
    for(int j=0;j<h;j++){
    ans[j][i]=ans[j][i-1];
    }
  }
 }
 for(int i=0;i<firsts;i++){
   for(int j=0;j<w;j++) ans[j][i]=ans[j][firsts];
 //  cout << "called2";
 }
 for(int i=0;i<h;i++){
   for(int j=0;j<w;j++){
     cout << ans[i][j] << " ";
   }
   cout << endl;
 }
  return 0;
}

Measured memory_bytes: 1408
using System;
using System.Linq;

public class Hello{
    public static void Main(){
        
        double[] x = Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); 
        
        //題意よりN,K（x[0],x[1]）は整数である。
        long ans = (long)(x[1] * Math.Pow(x[1]-1, x[0]-1));

        System.Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11348
data = [input() for x in range(0, 2, 1)]

cards = [int(x) for x in data[1].split(" ")]

#バブルソート
for i in range(0, len(cards), 1):
  
  for j in range(i + 1, len(cards), 1):
    
    if cards[i] < cards[j]:
      tmp1 = cards[i]
      tmp2 = cards[j]
      
      cards[i] = tmp2
      cards[j] = tmp1
      
alice = 0
bob = 0

#cardsをソート

for i, v in enumerate(cards):
  
  if i %2 == 0:
    alice += v
  else:
    bob += v
    
print(alice - bob)


Measured memory_bytes: 3064
#include <stdio.h>

#define N 200000

int main() {
	static int link1[N], link2[N];
	int n, m, i, k;

	scanf("%d%d", &n, &m);
	k = 0;
	while (m--) {
		int a, b;

		scanf("%d%d", &a, &b), a--, b--;
		if (a == 0)
			link1[b] = 1;
		if (b == n - 1)
			link2[a] = 1;
	}
	for (i = 1; i < n - 1; i++)
		if (link1[i] && link2[i]) {
			printf("POSSIBLE\n");
			return 0;
		}
	printf("IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAX = 310000;
const ll MOD = 1e9+7;

ll 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;
  }
}

// 二項係数計算
ll 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(nullptr);
	int n,k;
	cin >> n >> k;
	COMinit();
	//ll ans = (k%2==0 ? 1 : 0);
	ll ans = 0;
	FOR(i,0,min(n, k+1)){
		ll tmp = COM(n,i) * COM(n-1, i) % MOD;
		ans += tmp;
		ans %= MOD;
	}
	cout << ans << '\n';
	return 0;
}



Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int aux = A;
  A = B;
  B = aux;
  aux = A;
  A = C;
  C = aux;
  
  cout << A; 
  cout << " ";
  cout << B;
  cout << " ";
  cout << C;
}

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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    string prev = "";
    string cur = "";
    for(int i = 0; i < s.size(); i++){
        cur += s[i];
        if(cur != prev){
            ans++;
            prev = cur;
            cur = "";
        }
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 998244353;

int main(){
    string S; cin >> S;
    int ans = 0;
    FOR(i, 1, S.size()){
        if (S[i] == S[i-1]){
            ans++;
            S[i] = S[i] == '0' ? '1' : '0';
        }
    }
    if (ans <= S.size() / 2){
        cout << ans << endl;    
    }else{
        cout << (S.size() - ans) << endl;
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    vector<int>x(m);
    for(int i = 0; i < m; i++) cin >> x[i];
    sort(x.begin(), x.end());
    vector<int> d(m-1);
    for(int i = 0; i < m-1; i++) d[i] = x[i+1] - x[i];
    sort(d.begin(), d.end());
    for(int i = 0; i < n-1; i++) d.pop_back();
    int ans = 0;
    for(int i = 0; i < m-n; i++) ans += d[i];
    cout << ans;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

ll NMAX = 1000000000;
ll num;

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  num = h * w;
  ll l = 1;
  ll r = 1000000001;
  ll center;
  while (r - l > 1) {
    ll mid = (l + r) / 2;
    center = mid * (num-1) + 1;
    if (center <= NMAX) {
      l = mid;
    } else {
      r = mid;
    }
  }
  center = l * (num-1) + 1;
  ll sum = 0;
  int num_block = (H / h) * (W / w);
  sum -= num_block;
  sum += l * (H * W - num_block * h * w);
  if (sum > 0) {
    printf("Yes\n");
    rep (i, H) {
      rep (j, W) {
        printf("%lld ", ((i+1) % h == 0 && (j+1) % w == 0) ? -center : l);
      }
      printf("\n");
    }
  } else {
    printf("No\n");
  }
   
  return 0;
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

int main() {
  ll d[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};
  ll k;
  cin >> k;
  cout << d[k - 1] << endl;
  return 0;
}

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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define rep2(i, m, n) for(int i=m;i<(n);i++)
#define rrep(i, n, m) for(int i=n;i>=(m);i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll S;
    cin >> S;
    // 1000000000000000000
    ll y2 = (S + 1000000000 - 1) / 1000000000;
    ll y1 = ( 1000000000 * y2 -S) ;
    cout << "0" << " " << "0" << " " << "1000000000" << " " << y1 << " " << "1" << " " << y2 << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
mlmis = lambda: [-int(x) for x in input().split()]
INF = float('inf')
#

def main():
    X,Y=mis()
    ans = 0
    if X == 1:
        ans += 300000
    elif X == 2:
        ans += 200000
    elif X == 3:
        ans += 100000
    if Y == 1:
        ans += 300000
    elif Y == 2:
        ans += 200000
    elif Y == 3:
        ans += 100000
    if X==Y==1:
        ans += 400000
    print(ans)



main()


Measured memory_bytes: 3064
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = IR(3)
    a -= b
    print(a % c)
    return

#B
def B():
    a, b, c, x, ans = II(), II(), II(), II(), 0
    for i in range(a + 1):
        for j in range(b + 1):
            for k in range(c + 1):
                if i * 500 + j * 100 + k * 50 == x:
                    ans += 1
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 39152