akhauriyash/Code-Regression huggingface dataset:
import itertools

abcd = input()
for op in itertools.product(['+', '-'], repeat=3):
    formula = abcd[0] + op[0] + abcd[1] + op[1] + abcd[2] + op[2] + abcd[3]
    if eval(formula) == 7:
        print(formula + "=7")
        exit()


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

int main(){
  int num = 10;
  int height[num];

  for(int i=0; i<num; i++)
    cin >> height[i];

  int top3[3]={0,0,0};
  for(int i=0; i<num; i++) {
    for(int j=0; j<3; j++) {
      if(height[i] > top3[j]) {
        for(int k=2; k>j; k--)
          top3[k] = top3[k-1];
        top3[j] = height[i];
        break;
      }
    }
  }

  for(int i=0; i<3; i++)
    cout << top3[i] << endl;

  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n); for(ll i = 0; i < (ll)n; i++)
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() {
  ll k,x;
  cin >> k >> x;
  
  for(ll i=x-(k-1); i<x; i++)
    cout << i << " ";
  for(ll i=x; i<x+k; i++)
    cout << i << " ";
  cout << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;
typedef long long ll;

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

    ll k;
    cin >> k;

    ll q;
    cin >> q;

    ll a[q];

    ll b[n];

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

    for (int i = 0; i < n; i++)
    {
        b[i] = 0;
    }

    for (int i = 0; i < q; i++)
    {
        b[a[i] - 1] += 1;
    }

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

        if(k - q + b[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    // cout << fixed;
    // cout << setprecision(10);

    // if (x >= a * a * b / 2)
    // {

    //     cout << atan(2 * (pow(a, 2) * b - x) / pow(a, 3) )* 180 / M_PI << endl;
    // }
    // else
    // {
    //     cout << atan(a * b * b / (2 * x)) * 180 / M_PI << endl;
    // }

    // ll answer = 1;

    // ll last = n;

    // for (ll i = 1; i < n; i++)
    // {
    //     if (i > last || i * i > n)
    //     {
    //         break;
    //     }

    //     if (n % i == 0)
    //     {
    //         if (i < n - i)
    //         {
    //             answer = (i - 1) + (n / i - 1);
    //             last = n / i;
    //         }
    //         else
    //         {
    //             break;
    //         }
    //     }
    // }

    // cout << answer << endl;

    // bool flg = false;

    // for (int i = 1; i <= 9; i++)
    // {
    //     if (n % i == 0)
    //     {
    //         if ((n / i) >= 1 && (n / i) <= 9)
    //         {
    //             flg = true;
    //             break;
    //         }
    //     }
    // }

    // if (!flg)
    // {
    //     cout << "No" << endl;
    // }
    // else
    // {
    //     cout << "Yes" << endl;
    // }

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

    // vector<ll> a;
    // for (int i = 0; i < n; i++)
    // {
    //     int j;
    //     cin >> j;
    //     a.push_back(j);
    // }

    //sort(a,a+n); ソート
}


Measured memory_bytes: 2176
#include <cstdio>
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>

using namespace std;

const int MAXN = (int) 1e5 + 10;

int n, t[4*MAXN];

void build(vector<int> &a, int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = __gcd(t[v*2], t[v*2+1]);
    }
}

int get(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return __gcd(get(v*2, tl, tm, l, min(r, tm)), get(v*2+1, tm+1, tr, max(l, tm+1), r));
}

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

		cin >> n;
		vector<int> a(n);
		for (int i = 0; i < n; i++)
			cin >> a[i];
		build(a, 1, 0, n - 1);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (i == 0) {
				ans = max(ans, get(1, 0, n - 1, i + 1, n - 1));
			} else if (i == n - 1) {
				ans = max(ans, get(1, 0, n - 1, 0, n - 2));
			} else {
				ans = max(ans, __gcd(get(1, 0, n - 1, 0, i - 1), get(1, 0, n - 1, i + 1, n - 1)));
			}
		}
		cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1664
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

    int n; cin >> n;
    vector<int> h(n); rep(i,n) cin >> h[i];
    
    h[0]--;

    for(int i=1; i<n; i++){
        if(h[i-1]>h[i]){
            cout << "No" <<ln;
            return 0;
        }
        else if(h[i-1]<h[i]){
            h[i]--;
        }
    }

    cout << "Yes" << ln;
    return 0;
}

Measured memory_bytes: 640
S = input()
T = input()
s = len(S)
t = len(T)
ans = t
for i in range(s-t+1):
    cnt = 0
    tmp = S[i:t+i]
#    print(tmp)
    for j in range(t):
        if T[j] == tmp[j]:
            cnt += 1
        ans = min(ans, (t-cnt))
print(ans)    


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

int main(void){
	int n;
	cin >> n;
	vector<pair<int, int>> v;
	int a, b;
	for(int i = 0; i < n; ++i){
		cin >> a >> b;
		v.emplace_back(b, a);
	}
	sort(v.begin(), v.end());
	ll time = 0;
	bool f = false;
	for(int i = 0; i < n; ++i){
		time += v[i].second;
		if(time > v[i].first) f = true;
	}
	string ans = "Yes";
	if(f) ans = "No";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	string s;
	cin>>s;
	n=s.size()-1;
	int ok=1;
	for(int i=0,j=n;i<j&&ok==1;i++,j--){
		if(s[i]!=s[j]) ok=0;
	}
	for(int i=0,j=n;i<j&&ok==1;i++,j--){
		if(s[i]!=s[j]) ok=0;
	}
	for(int i=(n+4)/2-1,j=n;i<j&&ok==1;i++,j--){
		if(s[i]!=s[j]) ok=0;
	}
	cout<<(ok?"Yes\n":"No\n");
	return 0;
}


Measured memory_bytes: 256
n, k, q = gets.split(" ").map(&:to_i)

seikai = []
q.times do
  seikai << gets.chomp.to_i
end

score = Array.new(n, k-q)

seikai.each do |i|
    score[(i-1)] += 1
end

h = 1

score.each do |i|
    if i > 0
        puts "Yes"
    else
        puts "No"
    end
    h += 1
end


Measured memory_bytes: 3836
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

li init(li n){
  li f=n<0,b=1;
  if(f){
    n*=-1; b=2;
  }
  li s=b;
  while(s<n){
    b*=4;
    s+=b;
    if(df)print(s);
  }
  return b*(f?-1:1);
}

int main(){
  li n; cin >>n;
  vector<li> v;
  if(n==0){ print(0); return 0; }
  while(n){
    li c=init(n);
    if(df)print(c);
    v.push_back(c);
    n-=c;
  }
  
  li b=v[0],i=0;
  while(b){
    if(b==v[i]){
      printf("1");
      i++;
    }else{
      printf("0");
    }
    b/=-2;
  }
  printf("\n");
}


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

int main(){
	string s;
	cin >> s;
	while(1){
		s.erase(--s.end());
		string a,b;
		if(s.size()%2==1);
		else{
			for(int i=0;i<s.size()/2;i++)
				a+=s[i];
			for(int i=s.size()/2;i<s.size();i++)
				b+=s[i];
			if(a==b){
				cout << s.size() << endl;
				break;
			}
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
using namespace std;
int main()
{
	string s,t;
	int n;
	cin>>n>>s>>t;
	int co=0;
	int i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n-i;j++)
		{
			if(s[i+j]!=t[j])
			{
				co=max(co,j);
				break;
			}
		}
		if(j==n-i)co=max(co,j);
	}
	cout<<2*n-co<<endl;
	return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    char a; cin >> a;

    if('a' <= a && a <= 'z') cout << 'a' << endl;
    else cout << 'A' << endl;

    return 0;
}


Measured memory_bytes: 3620
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        int x = sc.nextInt();
        int a = sc.nextInt();

        if (x < a) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}

Measured memory_bytes: 23764
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    h = I()
    k = h.bit_length()
    print((1 << k) - 1)
    return


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


Measured memory_bytes: 38384
using System;

public class dice
{
    private int[] data;
    public dice(string s = "1,5,6,4,2,3")
    {
        data = new int[6];
        string[] line = s.Split(',');
        for (int i = 0; i < 6; i++)
            data[i] = int.Parse(line[i]);

        // 0: ceilling 1: front 2: floor 3:right:4:back:5:left
    }
    public void roll(char c)
    {
        var w = new int[6];
        Array.Copy(data, w, 6);
        if (c == 'U' | c == 'N') { data[4] = w[0]; data[0] = w[1]; data[1] = w[2]; data[2] = w[4]; }
        else if (c == 'D' | c == 'S') { data[1] = w[0]; data[2] = w[1]; data[4] = w[2]; data[0] = w[4]; }
        else if (c == 'R' | c == 'E') { data[3] = w[0]; data[5] = w[2]; data[2] = w[3]; data[0] = w[5]; }
        else { data[5] = w[0]; data[3] = w[2]; data[0] = w[3]; data[2] = w[5]; }
    }
    public int peek(int n) => data[n];
}

public class hello
{
    public static void Main()
    {
        var b0 = "013542";
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var b = new int[6];
        for (int i = 0; i < 6; i++)
            b[b0[i] - '0'] = a[i];
        var d = new dice(string.Join(",", b));
        var s = Console.ReadLine().Trim();
        for (int i = 0; i < s.Length; i++)
            d.roll(s[i]);
        var ans = d.peek(0);
        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 19980
#include <bits/stdc++.h>
using namespace std;
 
typedef long double LD;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define REP(i,n) for (ll i = 0; i < n; i++)
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REPD(i,n) for (ll i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (ll i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
typedef map<ll,ll> mll;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
#define F first
#define S second
#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type,vector<type>,greater<type> >
#define ITR :: iterator it
#define WL(t) while(t--)
#define SZ(x) ((int)(x).size())
#define TR(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define inrange(i,a,b) ((i>=min(a,b)) && (i<=max(a,b)))
#define i1(x) cin>>x
#define i2(x,n) cin>>x>>n
#define o1(x) cout<<x
#define o2(x,n) cout<<x<<n
int main(){
    ll n,k;
    i2(n,k);
    ll temp,prev;
    ll M=-1;
    ll first;
    REP(i,k){
        i1(temp);
        if(i){
            M=max(M,temp-prev);
        }
        else 
            first=temp;
        prev=temp;
    }
    M=max(M,first+n-prev);
    o1(n-M);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x[1000001];
int main(){
	int n,a,b,i,t=0;
	scanf("%d%d%d",&n,&a,&b);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&x[i]);
		if(x[i]<a||x[i]>=b)t++;
	}
	printf("%d\n",t);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;

typedef struct{
	int x;
	int y;
}point;

int main(){
	while(1){
		int f[101][101];
		int w, h, n;
		point s, g;
		
		memset(f, 0, sizeof(f));
		
		//入力
		scanf(" %d %d", &w, &h);
		if(w==0) break;
		
		scanf(" %d %d %d %d", &s.x, &s.y, &g.x, &g.y);
		scanf(" %d", &n);
		for(int i=0; i<n; ++i){
			int c, d, bx, by;
			scanf(" %d %d %d %d", &c, &d, &bx, &by);
			
			if(d==0){
				for(int j=0; j<2; ++j){
					for(int k=0; k<4; ++k){
						f[by+j][bx+k]=c;		
					}
				}
			}
			else {
				for(int j=0; j<4; ++j){
					for(int k=0; k<2; ++k){
						f[by+j][bx+k]=c;		
					}
				}
			}
		}
		
		//bfs
		int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
		int color=f[s.y][s.x]; //スタート地点のブロックの色
		queue<point> que;
		f[s.y][s.x]=6; //訪問済み
		que.push(s);
		
		while( !que.empty() ){
			point v=que.front();
			que.pop();
			for(int i=0; i<4; ++i){
				int nx=v.x+dx[i], ny=v.y+dy[i];
				
				if(nx>0 && nx<=w && ny>0 && ny<=h && f[ny][nx]==color){
					f[ny][nx]=6;
					point tmp;
					tmp.x=nx; tmp.y=ny;
					que.push(tmp);
				}
			}	
		}

		//ゴールにたどり着いているか判定
		if(f[g.y][g.x]==6) printf("OK\n");
		else printf("NG\n");	
	}	
}

Measured memory_bytes: 1228
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <functional>
#include <string>
#include <stack>
#include <queue>
#include <map>

typedef long long ll;
ll mod = 1e9 + 7;
  
using namespace std;

int main()
{
	int max = 0;
    int n;
    int s = 0;

    for(int i = 0; i < 3; ++i)
    {
        cin >> n;
        s += n;
        if(max < n)
            max = n;
    }

    cout << s - max << endl;
    
	return 0;
}

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

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

int main(void) {
	int r;
	cin >> r;
	cout << 3 * r * r;
	return 0;
}

Measured memory_bytes: 256
N[]={ 6, 14, 18, 10,  2,  9, 22, 15,  1, 17, 23,  7,  3,  5, 21, 19,  0, 13, 20, 11,  4,  8, 16, 12};
E[]={13, 17,  9,  5,  8, 21, 14,  1, 16, 22,  6,  0,  4, 20, 18,  2, 12, 23, 10,  3, 11, 19, 15,  7};
R_[]={ 3,  0,  1,  2,  7,  4,  5,  6, 11,  8,  9, 10, 15, 12, 13, 14, 19, 16, 17, 18, 23, 20, 21, 22};
a;
d;
T,F,R,t;
char s[9];
main(c)
{
	for(;c-48&&scanf("%s",s);a+=d/4+1)
	{
		c=*s;
		if(c<60)a&&printf("%d\n",a),a=d=0,T=1,F=2,R=3;
		if(c==78)t=T,T=F,F=7-t,d=N[d];
		if(c==83)t=F,F=T,T=7-t,d=N[N[N[d]]];
		if(c==69)t=R,R=T,T=7-t,d=E[d];
		if(c==87)t=T,T=R,R=7-t,d=E[E[E[d]]];
		if(c==82)t=F,F=R,R=7-t,d=R_[d];
		if(c==76)t=R,R=F,F=7-t,d=R_[R_[R_[d]]];

		if ( T != d/4+1 );
	}
}

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


int main(){
   ll n;
   cin >> n;
   ll ans=0;
   rep(i,n){
      ll y = n/(i+1);
      ans += (i+1)*(y+1)*y/2;
   }
   cout << ans << endl;
   return 0;  
}

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

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

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

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

signed main()
{
    int a, b;
    cin >> a >> b;
    if((a * b) % 2 == 0) { printf("Even\n"); }
    else { printf("Odd\n"); }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int mypow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a;
		a *= a;
		n >>= 1;
	}
	return res;
}

int solve(int N) {

	int bit_used = 0, range = 9, res = 0;
	int tmp, ternary, n753;

	for (int digit = 3; digit <= 9; digit++) {

		range *= 3;

		for (int i = 0; i <= range; i++) {

			bit_used = 0;
			ternary = i;
			n753 = 0;

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

				tmp = ternary % 3;
				ternary /= 3;
				
				if (tmp == 0) {
					n753 += 3 * mypow(10,j);
					bit_used |= 1;
				}				
				if (tmp == 1) {
					n753 += 5 * mypow(10, j);
					bit_used |= 2;
				}
				if (tmp == 2) {
					n753 += 7 * mypow(10, j);
					bit_used |= 4;
				}

			}

			if (n753 > N) break;
			if (!(bit_used ^ 7)) res++;

		}

	}

	return res;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	cout << solve(N) << "\n";

	return 0;

}

Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n,m=map(int,input().split())
if n>=m//2:
    print(m//2)
else:
    ans=n+(m-2*n)//4
    print(ans)

Measured memory_bytes: 10296
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(4, n + 1, 2):
        sieve[i] = 2
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i * 2):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


def f(X):
    t = []
    a = X
    while a != 1:
        if len(t) != 0 and t[-1][0] == prime_table[a]:
            t[-1][1] += 1
        else:
            t.append([prime_table[a], 1])
        a //= prime_table[a]
    result = 1
    for _, n in t:
        result *= n + 1
    return result


N = int(input())

prime_table = make_prime_table(N)
result = 0
for K in range(1, N + 1):
    result += K * f(K)
print(result)


Measured memory_bytes: 153124
#include <iostream>
using namespace std;
#define MAX 100000


int parent(int i){return i / 2;}
int left(int i){ return 2 * i; }
int right(int i){ return 2 * i + 1;}

int main(){
    int A[MAX + 1];
    int H,i;

    cin>>H;
    for(i=1; i<=H; i++) cin>>A[i];

    for(i=1; i<=H; i++){
        cout << "node " << i <<": key = "<<A[i]<<", ";
        if(parent(i) >= 1) cout<<"parent key = "<< A[parent(i)] <<", ";
        if(left(i) <= H) cout <<"left key = "<<A[left(i)]<<", ";
        if(right(i) <= H) cout << "right key = "<<A[right(i)]<<", ";
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3092
// abc130b.cpp : Bounding
#include <bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<(n);i++)
#define ote(x) cout<<(x)<<endl

int main(){
	int c = 1, d = 0, n, x; cin>>n>>x;
	rp(i,n){
		int l; cin>>l;
		d += l;
		if(d<=x) c++;
	}
	ote(c);
}

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

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef complex<ld> PT;
typedef pair<PT, PT> LS;
#define F first
#define S second
#define X real()
#define Y imag()

inline int in(){int x, y; y = scanf("%d", &x); return x; }

const int N = -1;
const ld EPS = 1e-12;

bool eq(ld a, ld b){
	return abs(a-b) < EPS;
}

istream& operator>> (istream& is, complex<ld>& p){
	ld val;
	is >> val;
	p.real(val);
	is >> val;
	p.imag(val);
	return is;
}

PT proj(PT a, PT b, PT c){
	b -= a, c -= a;
	return a + b*real(c/b);
}

PT reflect(PT a, PT b, PT c){
	b -= a, c -= a;
	return a + conj(c/b)*b;
}

string pos(PT a, PT b, PT c){
	b -= a, c -= a;
	c /= b;
	if (c.imag() > EPS)
		return "COUNTER_CLOCKWISE";
	if (c.imag() + EPS < 0)
		return "CLOCKWISE";
	if (c.real() + EPS < 0)
		return "ONLINE_BACK";
	if (c.real() > 1 + EPS)
		return "ONLINE_FRONT";
	return "ON_SEGMENT";
}

int main(){	
	for (int i = in(); i; i--){
		PT a, b, c, d;
		cin >> a >> b >> c >> d;
		b -= a, d -= c;
		b /= d;
		if (eq(b.Y, 0))
			cout << 2 << endl;
		else if (eq(b.X, 0))
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}


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

int main(){
  string S,T;
  cin >> S >> T;
  vector<int> p(26,0),q(26,0);
  rep(i,S.size()){
    p[S[i]-'a']++;
    q[T[i]-'a']++;
  }
  sort(p.begin(),p.end());
  sort(q.begin(),q.end());
  bool flag = true;
  rep(i,26) if(p[i]!=q[i]) flag=false;
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 776
#include <stdio.h>

int main(void)
{
    int N, i, L;
    int max = 0 , sum = 0;

    scanf("%d", &N);

    for(i=0; i<N; i++)
    {
        scanf("%d", &L);
        if(max < L) max = L;
        sum += L;
    }

    max < (sum - max) ?   printf("Yes") :
                        printf("No");

    return 0;
}

Measured memory_bytes: 128
from collections import *
N = int(input())
V = list(map(int,input().split()))
C1 = Counter(V[0::2]).most_common()
C2 = Counter(V[1::2]).most_common()

if len(set(V))==1:
  ans = N//2
else:
  if C1[0][0]==C2[0][0]:
    ans = min(N-C1[0][1]-C2[1][1],N-C1[1][1]-C2[0][1])
  else:
    ans = N-C1[0][1]-C2[0][1]

print(ans)

Measured memory_bytes: 29336
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

  lint ans = 1e18;
  for(lint i=0; i<100; i++) {
    if(1000*i - N < 0) continue;
    ans = min(ans, 1000*i - N);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
program interval_game
  implicit none
  integer :: n, i
  integer(8) :: l(100001), r(100001)
  l = 0_8
  r = 0_8
  read(*,*) n
  do i = 1, n
    read(*,*) l(i), r(i)
  end do
  call bitonic_sort(l(1:n+1),.false.)
  call bitonic_sort(r(1:n+1),.true.)
  write(*,'(i0)') 2_8*sum(l(1:n+1)-r(1:n+1),l(1:n+1)-r(1:n+1).gt.0_8)
  stop
contains
  recursive subroutine bitonic_sort(a,ascend)
    implicit none
    integer(8), intent(inout) :: a(:)
    logical, intent(in) :: ascend
    integer :: n
    n = size(a)
    if (n.eq.1) return
    call bitonic_sort(a(1:n/2),.not.ascend)
    call bitonic_sort(a(n/2+1:n),ascend)
    call bitonic_merge(a,ascend)
    return
  end subroutine bitonic_sort
  recursive subroutine bitonic_merge(a,ascend)
    implicit none
    integer(8), intent(inout) :: a(:)
    logical, intent(in) :: ascend
    integer :: n, m, i, b
    n = size(a)
    if (n.eq.1) return
    m = 1
    do while (2*m.lt.n)
      m = 2*m
    end do
    do i = 1, n-m
      if ((a(i).gt.a(i+m)).eqv.ascend) then
        b = a(i)
        a(i) = a(i+m)
        a(i+m) = b
      end if
    end do
    call bitonic_merge(a(1:m),ascend)
    call bitonic_merge(a(m+1:n),ascend)
    return
  end subroutine bitonic_merge
end program interval_game

Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
	char s[3];
	int i,sum;
	sum=0;
	scanf("%s",s);
	for(i=0;i<=2;i++){
		if(s[i]=='1'){
			sum++;
		}
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int K = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N+1];
        int maxLength = 0;

        for(int i = 1; i <= N; i++){
            A[i] = sc.nextInt();
            // if(i != 1){
                if(maxLength < A[i]-A[i-1]){
                    maxLength =  A[i]-A[i-1];
                }
            // }
        }
        if(maxLength < A[1]+K-A[N]){
            maxLength =  A[1]+K-A[N];
        }

        System.out.println(K-maxLength);    
    }
}

Measured memory_bytes: 78016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T> using Graph = vector<vector<T>>;

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define endl '\n'

const int inf = 1e8;
int N, S;
int a[100005];

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

  cin >> N >> S;
  rep(i, N) cin >> a[i];

  int t = 0;
  int i = 0;
  int ans = inf;
  for (int j = 0; j < N; j++) {
    t += a[j];
    while (t >= S) {
      ans = min(ans, j - i + 1);
      t -= a[i];
      i += 1;
    } 
  }

  cout << (ans < inf ? ans:0) << endl;

  return 0;
}

Measured memory_bytes: 3544
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int a, b, c;

string solve() {
  if (c >= a && c <= b) return "Yes";
  else return "No";
}

int main() {
  while (cin >> a >> b >> c) {
    cout << solve() << endl;
  }
}







Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int num;
	string ch;
	long long ans1=0,ans2=0;
	cin>>ch>>num;
	if (ch == string(ch.length(), ch[0])) {
    	cout <<  ch.length()* num / 2 << '\n';
  	}
  	else {
  		for(int i=0;i<ch.length();i++){
			if(ch[i]==ch[i+1]){
				ans1++;
				i++;
			}
		}
		for(int i=0;i+1<ch.length()*2;i++){
			if(ch[i%ch.length()]==ch[(i+1)%ch.length()]){
				ans2++;
				i++;
			}
		}
		long long ans=0;
		cout<<ans1+(ans2-ans1)*(num-1)<<endl;
	}
	
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split(' ')]

num_of_equal = sum([1 for i, j in zip(a[:-1], a[1:]) if i == j]) + 1

if num_of_equal == len(a): print(0)
else:
    answer = []
    for y in range(min(a), max(a)+1):
        answer.append(sum([(x - y)**2 for x in a]))

    print(min(answer))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n, c=0, nc=0;
ll k;
vector<vector<int> > adj;
vector<int> level, visited, d;

void dfs(int i, int p){
    visited[i]=1;
    level[i]=level[p]+1;
    d.push_back(i);
    for(int j=0; j<adj[i].size(); j++){
        if(!visited[adj[i][j]])
            dfs(adj[i][j], i);
        else{
            c=level[i]-level[adj[i][j]]+1;
            nc=d.size()-c;
        }
    }
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n >> k;
	adj=vector<vector<int> >(n+1);
	visited=level=vector<int>(n+1, 0);
	for(int i=1, a; i<=n; i++){
        cin >> a;
        adj[i].push_back(a);
	}
	dfs(1, 0);

    if(k<(ll)d.size())
        cout << d[k] << endl;
    else{
        k-=(ll)nc;
        k=k%(ll)c;
        cout << d[nc+k] << endl;
    }

	return 0;
}


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

int main(){

    int n,m;
    cin >> n >> m;

    set<int> a;
    rep(i,m){
        int t;
        cin >> t;
        a.insert(t);
    }
    int mod=1000000007;
    vector<int> dp(n+1,0);
    dp[0]=1;
    if(a.find(1)==a.end()){
        dp[1]=1;
    }
    for(int i=2;i<=n;i++){
        if(a.find(i-2)==a.end()){
            dp[i]+=dp[i-2];
            dp[i]%=mod;    
        }
        if(a.find(i-1)==a.end()){
            dp[i]+=dp[i-1];
            dp[i]%=mod;    
        }
    }

    /*rep(i,dp.size()){
        cout << dp[i] <<" ";
    }cout << endl;*/

    cout << dp.back() << endl;

    return 0;
}

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

const int maxn=2e5+10;

int n,p[maxn];

struct SegTree{
	int op,pos[maxn<<2];
#define lc (nd<<1)
#define rc (nd<<1|1)
#define mid ((s+t)>>1)

	void init(int _op) {op=_op;}

	void build(int nd,int s,int t)
	{
		if (s==t)
		{
			pos[nd]=(s&1)==op?s:0;
			return;
		}
		build(lc,s,mid);
		build(rc,mid+1,t);
		pos[nd]=p[pos[lc]]<p[pos[rc]]?pos[lc]:pos[rc];
	}

	int query(int nd,int s,int t,int l,int r)
	{
		if (l<=s&&t<=r) return pos[nd];
		int Ans=0,tmp;
		if (l<=mid) tmp=query(lc,s,mid,l,r),Ans=p[Ans]<p[tmp]?Ans:tmp;
		if (r> mid) tmp=query(rc,mid+1,t,l,r),Ans=p[Ans]<p[tmp]?Ans:tmp;
		return Ans;
	}
#undef lc
#undef rc
#undef mid
}S[2];

struct Interval{
	int l,r,u,v;
	Interval() {}
	Interval(int l,int r):l(l),r(r)
	{
		u=S[l&1].query(1,1,n,l,r);
		v=S[(l&1)^1].query(1,1,n,u+1,r);
	}
	bool operator < (const Interval &i) const {return p[u]>p[i.u];}
};

priority_queue<Interval> q;

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&p[i]);
	p[0]=0x7fffffff;
	S[0].init(0); S[0].build(1,1,n);
	S[1].init(1); S[1].build(1,1,n);
	q.push(Interval(1,n));
	while (!q.empty())
	{
		Interval t=q.top(); q.pop();
		printf("%d %d ",p[t.u],p[t.v]);
		if (t.l<t.u-1)
			q.push(Interval(t.l,t.u-1));
		if (t.u+1<t.v-1)
			q.push(Interval(t.u+1,t.v-1));
		if (t.v+1<t.r)
			q.push(Interval(t.v+1,t.r));
	}
}


Measured memory_bytes: 9204
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
 
int main(){
    ll n;
    cin >> n;

    vector<ll> a;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    ll count=0;
    for(int i=0; i<n; i=i+2){
        if(a[i]%2==1){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	int a, b;
	cin >> a >> b;
	if(a + b >= 10)cout << "error";
	else cout << a + b;
	cout << endl;
	return 0;
}


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

int main(){
    int a,b;
    -1000 <= a,b <= 1000;
    cin >> a >> b;
    if(a<b){
        cout << "a < b" << endl;
    }else if(a > b){
        cout << "a > b" << endl;
    }else{
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define N 300005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int n;
ll a[100];
ll buy[100];
ll sell[100];
main()
{
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i];
    for(int i=n-1; i>=0; i--)
    {
        for(int j=i+1; j<n; j++)
        {
            if(a[j]>=a[i])
                buy[i]=max(buy[i],a[j]-a[i]+sell[j]);
            if(a[i]>=a[j])
                sell[i]=max(sell[i],a[i]-a[j]+buy[j]);
        }
    }
    ll now=1000,ans=1000,st=0;
    for(int i=0; i<n; i++)
    {

        ans=max(ans,now+st*a[i]);

        if(buy[i]>sell[i])
        {
            ll ex=now/a[i];
            st+=ex;
            now-=ex*a[i];
        }
        else
        {
            now+=st*a[i];
            st=0;
        }
        //ans=max(ans,now+st*a[i]);
        //cout<<i<<' '<<now<<' '<<st<<endl;
        ans=max(ans,now);
    }
    cout<<ans;


}


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

set<int> x[100005],y[100005],p,q;
set<pair<int,int>> memo;
long long ans=0LL;

void dfs(int nx,int ny)
{
	while (x[nx].size()>0)
	{
		auto i=x[nx].begin();
		int ty=*i;
		x[nx].erase(i);
		if (memo.count(make_pair(nx,ty))==0)
		{
			q.insert(ty);
			memo.insert(make_pair(nx,ty));
			y[ty].erase(nx);
			dfs(nx,ty);
		}
	}
	while (y[ny].size()>0)
	{
		auto i = y[ny].begin();
		int tx=*i;
		y[ny].erase(i);
		if (memo.count(make_pair(tx,ny))==0)
		{
			p.insert(tx);
			memo.insert(make_pair(tx,ny));
			x[tx].erase(ny);
			dfs(tx,ny);
		}
	}
}

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n],b[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i];
		x[a[i]].insert(b[i]);
		y[b[i]].insert(a[i]);
	}
	for (int i = 0; i < n; ++i)
	{
		if (memo.count(make_pair(a[i],b[i]))==0)
		{
			memo.insert(make_pair(a[i],b[i]));
			p.insert(a[i]);
			q.insert(b[i]);
			dfs(a[i],b[i]);
			ans+=(long long)p.size()*q.size();
			p={};q={};
		}
	}
	cout<<(long long)ans-n<<endl;
	return 0;
}


Measured memory_bytes: 25984
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      w: usize,
      wvs: [(usize, usize); n],
    }
    const V: usize = 100*1000 + 1;
    const INF: usize = 1 << 32;
    debug!(n, w, wvs);
    let mut dp = vec![vec![INF; V]; n];

    dp[0][0] = 0;
    dp[0][wvs[0].1] = wvs[0].0;

    for i in 1..n {
        let &(wi, vi) = &wvs[i];
        for v in 0..V {
            if v >= vi {
                dp[i][v] = dp[i-1][v-vi] + wi;
            }
            dp[i][v] = min(dp[i][v], dp[i-1][v]);
        }
    }
    let mut ans = INF;
    for v in (0..V).rev() {
        if dp[n-1][v] <= w {
            return println!("{}", v);
        }
    }
}


Measured memory_bytes: 106748
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;

int cnt;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int g)
{
    for(int i = g; i < n; i++)
    {
        int v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v)
        {
            A[j + g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j + g] = v;
    }
}

void shellSort(void)
{
    for(int h = 1;;)
    {
        if(h > n)
            break;
        G.push_back(h);
        h = 3 * h + 1;
    }
    for(long i = G.size() - 1; i >= 0; i--)
    {
        insertionSort(G.at(i));
    }
}

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &A[i]);
    }
    cnt = 0;
    shellSort();
    
    cout << G.size() << endl;
    for(long i = G.size() - 1; i >= 0; i--)
    {
        cout << G.at(i);
        if(i)
            cout << " ";
    }
    cout << endl;
    cout << cnt << endl;
    for(int i = 0; i < n; i++)
    {
        cout << A[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 7128
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
Pi ba[200100];

int main(){
	cin>>n;
	REP(i,n){
		ll a,b;
		cin>>a>>b;
		ba[i]=Pi(b,a);
	}
	sort(ba,ba+n);
	int flag=1;
	ll time=0;
	REP(i,n){
		time+=ba[i].second;
		if(ba[i].first<time){
			flag=0;
			break;
		}
	}
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}
		

Measured memory_bytes: 3328
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())

is_prime = [1] * (10**6+1)

for a in range(2,10**6+1):
        for v in range(a,10**6+1,a):
            is_prime[v] += 1
# print(is_prime[:10])

n = I()
ans = 0
for c in range(1,n):
    nc = n-c
    ans += is_prime[nc]
print(ans)


Measured memory_bytes: 81016
#define  _CRT_SECURE_NO_WARNINGS
	#include <algorithm>
	#include <iostream>
	#include <iterator>
	#include <numeric>
	#include <sstream>
	#include <fstream>
	#include <cassert>
	#include <climits>
	#include <cstdlib>
	#include <cstring>
	#include <string>
	#include <cstdio>
#include<algorithm>
	#include <vector>
	#include <math.h>
	#include <queue>
	#include<memory>
	#include <deque>
	#include <stack>
	#include <list>
	#include <map>
	#include <set>
	#include <cmath>
	#include <bitset>
	#include<list>
	#include <iomanip>
	using namespace std;
	typedef long long ll;
	const int N = 3005;
	int dp[N][N], p[N];
	int n;
	

	int solve(string a, string b)
	{
		for (int i = 0; i < a.size(); i++)
		{
			for (int j = 0; j < b.size(); j++)
			{
				if (i == 0 || j == 0)dp[i][j] = 0;
				else if (a[i] == b[j])dp[i][j] = dp[i - 1][j - 1] + 1;
				else dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
			}
		}
		return 0;
	}
	vector<char> print(string a,string b)
	{
		vector<char>x;
		int n = a.size()-1, m = b.size() - 1;
		while (n != 0 && m != 0)
		{
			if (a[n] == b[m]) {
				x.push_back(a[n]);
				n--;
				m--;
			}
			else if (dp[n - 1][m] > dp[n][m - 1])n--;
			else m--;

		}
		return x;
	}
	int main()
	{
		string a, b;
		cin >> a >> b;
		a = " " + a;
		b = " " + b;
		solve(a, b);
		vector<char>k = print(a, b);
		for (int i = k.size() - 1; i >= 0; i--)
			cout << k[i];
		cout << endl;
		return 0;
	}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
//Rohit Sharma, jammu. make aarsh proud.
#define int long long int
#define pb push_back
#define M 1000000007
#define gcd(a,b)  __gcd(a,b)
#define rep(k,n) for(int i=k;i<n;i++)
#define lcm(a,b) ((a)*((b)/gcd(a,b)))
#define MOD 1000000007
using namespace std;
using std::numeric_limits;
//cout.precision(numeric_limits<double>::digits10 + 1);
const int N= 1e5+1;
int n,m,k,p,l,q,r,t,cnt=1,ans=1,x,y,c=0,z;
//---------------------------------------
int a[N];
int32_t main()
{
	//https://codeforces.com/contest/1099/problem/F
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n;
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	int dp[N];
	dp[0]=0,dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<N;i++)
		dp[i]=1e12;
	for(int i=2;i<n;i++)
		for(int j=1;j<=k;j++)
		if(j>i)continue;
		else dp[i]=min(dp[i],dp[i-j]+ abs(a[i]-a[i-j]));
	cout<<dp[n-1];

return 0;
}

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

int main(){
  int b1,b2,b3;
  cin>>b1>>b2>>b3;
  if(b1==1){
    if(b2==0){
      cout<<"Close"<<"\n";
    }
    else{
      cout<<"Open"<<"\n";
    }
  }
  else{
    if(b3==1){
      cout<<"Open"<<"\n";
    }
    else{
      cout<<"Close"<<"\n";
    }
  }
  return 0;
}



Measured memory_bytes: 3056
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;

int main(){
	while(1){
		int a, b, d;
		cin >> a >> b >> d;
		if(a==0) break;
		
		bool swap = false;
		if(a<b){
			int tmp=a; a=b; b=tmp;
			swap = true;
		}
		for(int i=d/a; i<inf; i++){
			if((d-b*i)%(a-b) == 0){
				int x=(d-b*i)/(a-b);
				if(swap) x=i-x;
				if(0<=x && x<=i){
					cout << x << " " << i-x << endl;
					break;
				}
			}
			if((b*i-d)%(a+b) == 0){
				int x = (b*i-d)/(a+b);
				if(swap) x=i-x;
				if(0<=x && x<=i){
					cout << x << " " << i-x << endl;
					break;
				}
			}
			if((b*i+d)%(a+b) == 0){
				int x = (b*i+d)/(a+b);
				if(swap) x=i-x;
				if(0<=x && x<=i){
					cout << x << " " << i-x << endl;
					break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer buffer = new StringTokenizer(br.readLine());
		
		int a =Integer.parseInt(buffer.nextToken());
		int b = Integer.parseInt(buffer.nextToken());
		
		System.out.println(a / b + " " + a % b + " " + String.format("%.8f", (double) a / b));
	}
}


Measured memory_bytes: 24732
import java.util.Scanner;

public class Main {

    private void execute() throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");
        String[] b = sc.nextLine().split(" ");
        String[] c = sc.nextLine().split(" ");
        int totalScore = 0;
        for (int idx = 0; idx < n; idx++) {
            int valA = Integer.parseInt(a[idx]);
            totalScore += Integer.parseInt(b[valA - 1]);
            if (idx > 0 && ((valA - 1) == Integer.parseInt(a[idx - 1]))) {
                totalScore += Integer.parseInt(c[valA - 2]);
            }
        }
        System.out.println(totalScore);
    }

    public static void main(String[] args) {
        try {
            new Main().execute();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

}

Measured memory_bytes: 21844
# abc121 B
n, m, c = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

A = n.times.map do
  gets.split.map(&:to_i)
end

p A.count { |as|
  r = as.map.with_index { |a, i|
    a * b[i]
  }.inject(:+) + c
  r > 0
}


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N,P;
int A[2];
LL b[55];

int main(){
	scanf("%d%d" , &N , &P);
	b[0] = 1;
	repp(i,0,N){
		int x;
		scanf("%d" , &x);
		++A[x%2];
		b[i+1] = b[i] * 2;
	}
	if(P == 1 && A[1] == 0) printf("0\n");
	else printf("%lld\n" , b[A[0]]*b[A[1]==0?1:A[1]]/2);
	return 0;
}


Measured memory_bytes: 256