akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL9_MOD = 1000000009;
static constexpr ll LL7_MOD = 1000000007;
static constexpr ll INF = 1LL << 60;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = {
  { typeid(int), "%d" }, { typeid(ll), "%lld" }, { typeid(double), "%lf" }, { typeid(char), "%c" }};

template <class T> static void scan(vector<T>& v);
static void scan(vector<string>& v, bool isWord = true);
template <class A, size_t N, class T> void Fill(A (&arr)[N], const T &val);
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 A, size_t N, class T> void Fill(A (&arr)[N], const T &val){ std::fill((T*)arr, (T*)(arr + N), val); }

ll dp[3001][3001];

int main(int argc, char *argv[]) {
  //INFILE();

  string s, t;
  cin >> s >> t;

  int sl = s.size(), tl = t.size();

  REP(i, 1, sl + 1) {
    REP(j, 1, tl + 1) {
      chmax(dp[i][j], dp[i][j - 1]);
      chmax(dp[i][j], dp[i - 1][j]);
      chmax(dp[i][j], dp[i - 1][j - 1] + ll(s[i - 1] == t[j - 1]));
    }
  }

  string result;
  while (dp[sl][tl] != 0) {
    if (s[sl - 1] == t[tl - 1] && dp[sl - 1][tl - 1] == dp[sl][tl] - 1) {
      result.push_back(s[sl - 1]);
      sl--;
      tl--;
      continue;
    }

    dp[sl - 1][tl] == dp[sl][tl] ? sl-- : tl--;
  }

  reverse(ALL(result));
  cout << result << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}



Measured memory_bytes: 70656
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    long long int n , a ; 
    cin >> n ;
    a = n ;
    int keta =0;
    while(n > 0){
         keta += n % 10 ;
         n = n / 10 ;
    }

    if(a % keta == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main() {
    int k;
    string s;
    cin >> k >> s;

    int l;
    l = s.size();
    string ans;
    if (k < l) {
        for (int i = 0; i < k; i++) {
            ans += s[i];
        }
        ans += "...";
        cout << ans << endl;
    } else {
        cout << s << endl;
    }

    return 0;
}

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

signed main () {
	string s;
	cin >> s;
	bool y = 0;
	for (int i = 0; i < int(s.size()) - 1; ++i) {
		if (s[i] != s[i + 1])
			y = 1;
	}
	if (y)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       char[] c = S.toCharArray();
       
       int i=c.length-1;
       boolean flg=true;
       while(i>0) {
    	   if(c[i-2]=='s') {
    		   if(c[i]=='r' && c[i-1]=='e' && c[i-3]=='a' && c[i-4]=='r' && c[i-5]=='e') {
    			   i=i-6;
    		   } else {
    			   flg=false;
    			   break;
    		   }
    	   } else if(c[i]=='r') {
    		   if(c[i-1]=='e' && c[i-2]=='m' && c[i-3]=='a' && c[i-4]=='e' && c[i-5]=='r' &&  c[i-6]=='d') {
    			   i=i-7;
    		   } else {
    			   flg=false;
    			   break;
    		   }
		   } else if(c[i]=='e') {
    		   if(c[i-1]=='s' && c[i-2]=='a' && c[i-3]=='r' && c[i-4]=='e') {
    			   i=i-5;
    		   } else {
    			   flg=false;
    			   break;
    		   }
			   
		   } else if(c[i]=='m') {
    		   if(c[i-1]=='a' && c[i-2]=='e' && c[i-3]=='r' && c[i-4]=='d') {
    			   i=i-5;
    		   } else {
    			   flg=false;
    			   break;
    		   }
		   } else {
			   flg=false;
			   break;			   
		   }
    		   
    	   
       }
       String ans;
       if(flg==true) {
    	   ans="YES";
       } else {
    	   ans="NO";    	   
       }
	   System.out.println(ans);
   }
}

Measured memory_bytes: 26068
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define UNIQUE(a) unique(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>
#include <sstream>
#include <map>

using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

const ll mod = 1e9 + 7;

int main() {
	int n, m;
	cin >> n >> m;

	int sw[10][10];
	int p[10];
	int k,s;

	REP(i, 10) {
		p[i] = 0;
		REP(j, 10) {
			sw[i][j] = 0;
		}
	}

	REP(i, m) {
		cin >> k;
		REP(j, k) {
			cin >> s;
			s--;
			sw[i][s] = 1;
		}
	}


	REP(i, m) {
		cin >> p[i];
	}

	int ans = 0;
	REP(i, pow(2,n)) {
		bool flag = true;
		REP(j, m) {
			int on = 0;
			REP(l, 10) {
				if (sw[j][l] == 1) {
					on += floor(i / pow(2, l));
				}
			}
			if (on % 2 != p[j]) {
				flag = false;
				break;
			}
		}
		if(flag==true){
			ans++;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 512
/*input
5
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)xize()
const ll maxn=2e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int main(){
    int n;
    cin>>n;
    cout<<(n+1)/2;
}

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

int main(){
	ll x,y;
	cin >> x >> y;
	ll ans = 0;
	for (ll i = x; i <= y ; i*=2) {
		ans++;
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

n,k=map(int,input().split())
A=list(map(int,input().split()))
c=collections.Counter(A)
s=sorted(c.values())
for i in range(max(0,len(s)-k)):
    # print(i)
    count+=s[i]
print(count)
# print(s)


Measured memory_bytes: 32100
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,m,dp[100100];
vector<int> sq[100100];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int dfs(int u)
{
	if (dp[u]!=-1) return dp[u];
	int len=sq[u].size();dp[u]=0;
	rep(i,0,len-1)
	{
		int v=sq[u][i];
		dp[u]=max(dp[u],dfs(v)+1);
	}
	return dp[u];
}

int main()
{
	n=read();m=read();
	rep(i,1,m)
	{
		int u=read(),v=read();
		sq[u].pb(v);
	}
	memset(dp,-1,sizeof(dp));
	rep(i,1,n)
		if (dp[i]==-1) dfs(i);
	int ans=0;
	rep(i,1,n) ans=max(ans,dp[i]);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 8192
#include <cstdio>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

#define modp(x, y) (((y) + (x) % (y)) % (y))

bool t[26];
char S[100010];

int main(int argc, char* argv[])
{
	scanf("%s", S);
	int L = strlen(S);

	for(int i = 0; i < L; i++)
	{
		t[S[i] - 'a'] = true;
	}
	for(int i = 0; i < 26; i++)
	{
		if(!t[i])
		{
			printf("%c\n", i + 'a');
			return 0;
		}
	}
	printf("None\n");

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long n,a,b,more;
int main(){
	cin >> n >> a >> b;
	long long h[n];
	for(int i=0;i<n;i++){
		cin >> h[i];
		more=max(more,h[i]);
	}
	long long lo=0,hi=more,mid;
	for(;;){
		if(lo>hi){
			hi++;
			break;
		}
		long long j=0;
		mid=(lo+hi)/2;
  		for(int i=0;i<n;i++){
    		long long c=h[i]-b*mid;
    		long long d=(c+a-b-1)/(a-b);
    		if(d>0)j+=d;
    	}
    	if(j>mid)lo=mid+1;
    	else hi=mid-1;
	}
	cout << hi;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define MOD 998244353
using namespace std;

int main() {
    int n, paper[100005] = {};
    cin >> n;
    for (int i = 0; i < n; i++) {
        int t;
        cin >> paper[i];
    }
    sort(paper, paper + n);
    int pos = 0, ans = 0;
    while (pos < n) {
        int t = paper[pos], tt = 0;
        while (pos < n&&paper[pos] == t) {
            tt++;
            pos++;
        }
        ans += tt % 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;



int N;
int p[101];

void factoring(int n){
	for(int i=2;i<100;){
		if(n%i == 0){
			p[i]++;
			n /= i;
		}else{
			i++;
		}
	}
	p[n]++;
}


void solve(){
	int ans=0;

	for(int i=1;i<N+1;i++){
		factoring(i);
	}

	int S[5];
	for(int i=0;i<5;i++) S[i]=0;

	for(int i=2;i<N+1;i++){
		if(p[i]+1 >= 3) S[0]++;
	}
	for(int i=2;i<N+1;i++){
		if(p[i]+1 >= 5) S[1]++;
	}
	for(int i=2;i<N+1;i++){
		if(p[i]+1 >= 15) S[2]++;
	}
	for(int i=2;i<N+1;i++){
		if(p[i]+1 >= 25) S[3]++;
	}
	for(int i=2;i<N+1;i++){
		if(p[i]+1 >= 75) S[4]++;
	}

	ans += S[4];
	ans += S[3]*(S[3]-1);
	ans += S[3]*(S[0]-S[3]);
	ans += S[2]*(S[2]-1);
	ans += S[2]*(S[1]-S[2]);
	ans += S[1]*(S[1]-1)*(S[1]-2)/2;
	ans += S[1]*(S[1]-1)/2 * (S[0]-S[1]);

	cout << ans << endl;


}

int main(){
	for(int i=0;i<101;i++){
		p[i] = 0;
	}

	cin >> N;
	solve();

	return 0;

}

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

int main()
{
  int N;
  cin >> N;
  int d = N % 10;
  if (d == 3)
  {
    cout << "bon" << endl;
  }
  else if (d == 0 || d == 1 || d == 6 || d == 8)
  {
    cout << "pon" << endl;
  }
  else
  {
    cout << "hon" << endl;
  }
}


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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<double> v(N);
    for(int i=0; i<N; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    for(int i=1; i<N; i++) {
        v[i] = (v[i-1] + v[i]) /2.0;
    }
    cout << v[N-1] << endl;
    return 0;
}

Measured memory_bytes: 384
while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    if m==-1 or f==-1:
        print('F')
    elif m+f>=80:
        print('A')
    elif 65<=m+f<80:
        print('B')
    elif 50<=m+f<65:
        print('C')
    elif 30<=m+f<50:
        if r>=50:
            print('C')
        else:
            print('D')
    elif m+f<30:
        print('F')


Measured memory_bytes: 5592
#include <stdio.h>

int main(void){
  int p, q, r;
  int x, y, z;
  int min = 0;
  
  scanf("%d %d %d", &p, &q, &r);
  
  x = p + q;
  y = q + r;
  z = r + p;
  
  if(x < y){
    min = x;
  }else{
    min = y;
  }
  
  if(min > z){
    min = z;
  }
  
  printf("%d\n",min);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a>>b>>c;
  int count=3;
  if(a==b &&a==c){
    cout << 1;
  }else if (a==b || a==c || b==c){
    cout << 2;
  }else{
    cout << 3;
  }
}
  
  


Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = a[0] ^ a[1]
    for i in range(2,n):
        b = b ^ a[i]
    ans = []
    for i in range(n):
        ans.append(b ^ a[i])
    ans = list(map(str,ans))
    print(' '.join(ans))

if __name__ == "__main__":
    main()


Measured memory_bytes: 39448
#include <stdio.h>

int main(void) {
 int a,b,c;
 if(scanf("%d %d %d",&a,&b,&c)!=3) return 1;
 if((a<1 || a>9)||(b<1 || b>9)||(c<1 || c>9))return 1;

 if(a>=c && a>=b)
 {
   printf("%d\n",10*a+b+c);
 }
 else if(b>=a && b>=c)
 {printf("%d\n",10*b+a+c);
 }
 else{
	 printf("%d\n",10*c+a+b);
 }
  return 0;
}

Measured memory_bytes: 128
n = int(input())
w = [int(i) for i in input().split()]
diff = float('inf')
for i in range(1,n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    s = abs(s2-s1)
    if diff > s:
        diff = s
print(diff)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-


def main():
    from string import ascii_uppercase

    n = int(input())
    s = input()
    alpha = ascii_uppercase
    ans = ''

    for si in s:
        for index, a in enumerate(alpha):
            if si == a:
                next_index = (index + n) % 26
                ans += alpha[next_index]

    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  vector<int> a;

  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }

  sort(a.begin(), a.end(), greater<int>());

  int alice = 0, bob = 0;

  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }
  cout << alice - bob << endl;
  return 0;
}

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

/* clang-format off */
#define int long long
struct Fast {Fast() {cin.tie(0); ios::sync_with_stdio(false);}} fast;

#define reps(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) reps(i, 1, n+1)
#define deps(i, a, n) for (int i = (a); i >= (int)(n); --i)
#define dep(i, n) deps(i, n, 0)
#define each(i, n) for (auto&& i : n)

template <typename T> inline size_t maxElement(T beginIt, T endIt) { return max_element(beginIt, endIt); }
template <typename T> inline size_t minElement(T beginIt, T endIt) { return min_element(beginIt, endIt); }
template <typename T> inline size_t maxIndex(T beginIt, T endIt) { return distance(beginIt, *max_element(beginIt, endIt)); }
template <typename T> inline size_t minIndex(T beginIt, T endIt) { return distance(beginIt, *min_element(beginIt, endIt)); }
template <typename T> inline int sum(T beginIt, T endIt) { return accumulate(beginIt, endIt, 0); }
template <typename T> inline int mean(T beginIt, T endIt) { return sum(beginIt, endIt) / distance(beginIt, endIt); }
template <typename T> inline void debug(T x) { cerr << x << " " << "(L:" << __LINE__ << ")" << endl; }
/* clang-format on */

signed main(void) {
  /* */
  int num;
  num = 0; // counter
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  int N;
  // array<int, 200000> A;
  // string S;
  /* */

  int a, b;

  cin >> a >> b;

  if (a * b == 15) cout << "*" << endl;
  else if (a + b == 15) cout << "+" << endl;
  else cout << "x" << endl;


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


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

#[allow(dead_code)]
const MOD: u64 = 1000000007;


fn main() {
    input!{
        A: isize, B: isize, C: isize,
    }
    println!("{}", if (A <= C && C <= B) || (B <= C && C <= A) { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int A,B;
	cin >> A >> B;
	int i;
	bool flag = 0;
		for ( i = max(A, B); i <= 2e3; ++i)
		{
			int x = i * 0.08, y = i * 0.1;
			if (x == A && y == B)
			{
				flag = true;
				break;
			}
		}
		if (flag)
		{
			cout << i;
		}
		else
		{
			cout << -1;
		}
		cout <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n; cin>>n;
    if(n==0){
        cout<<0<<endl;
        return 0;
    }    
    vector<int> ans;
    while(n){
        if(n>0){
            ans.push_back(n%(-2));
            n/=(-2);
        }
        else{
            int m=abs(n);
            if(m%2==1){
                m++; n=m/2; ans.push_back(1);
            }
            else{
                n=m/2; ans.push_back(0);
            }
        }
        //cout<<n<<" ";
    }
    reverse(btoe(ans));
    for(auto& v: ans) cout<<v;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <time.h>

#define loop(i, num)  for (int i = 0; i < num; i++)

using namespace std;

int n, h, a, sum, ans;

vector<int> b;

int main() {
    
    cin >> n >> h;
    
    loop (i, n) {
        
        int ai, bi;
        
        cin >> ai >> bi;
        
        a = max(a, ai);
        
        b.push_back(bi);
        
        sum += bi;
        
    }
        
    loop (i, b.size()) {
        
        if (b[i] <= a) {
            
            b.erase(b.begin() + i);
            
//            cout << i << endl;
            
            --i;
            
        }
        
    }
    
//    b.erase(b.begin() + tmp);
    
    sort(b.begin(), b.end());
    
    reverse(b.begin(), b.end());
    
    loop (i, b.size()) {
        
        h -= b[i];
        
        ++ans;
        
        if (h <= 0) {
            
            cout << ans << endl;
            
            return 0;
            
        }
        
    }
    
//    cout << h << endl;
    
    ans += h / a + (h % a ? 1 : 0);
    
    cout << ans << endl;
    
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, k;
  cin >> n >> k;

  vll BIT(n + 2, 0);  // 1-indexed

  auto badd = [&](ll i, ll x) {
    while (i <= n + 1) {
      BIT[i] += x;
      i += i & -i;
    }
  };
  auto bget = [&](ll i) {
    ll ret = 0;
    while (i > 0) {
      ret += BIT[i];
      i -= i & -i;
    }
    return ret;
  };

  vll csum(n + 1, 0), bs(n + 1);
  bs[0] = 0;
  rep(i, n) {
    ll a;
    cin >> a;
    csum[i + 1] = csum[i] + a;
    bs[i+1] = csum[i+1] - k*(i+1);
  }

  {  // compress x
    map<ll, ll> mp;
    rep(i, n+1) mp[bs[i]] = 0;
    ll j = 1;
    for (auto& x : mp) x.second = j++;
    rep(i, n+1) bs[i] = mp[bs[i]];
  }

  ll ans = 0;
  rep(i, n+1){
    ans += bget(bs[i]);
    badd(bs[i], 1);
  }

  cout << ans << endl;

  return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N, 0);
    vector<ll> B(N, 0);
    REP(i, N)
    {
        cin >> A[i];
        B[i] = A[i] - (i + 1);
    }
    
    sort(B.begin(), B.end());
    ll median = N % 2 == 0 ? (B[N / 2] + B[N / 2 - 1]) / 2 : B[N / 2];
    ll ans = 0;
    REP(i, N)
    {
        ans += abs(B[i] - median);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	int n = N.size();
	vector<vector<int>> dp(n + 1, vector<int>(2, 0));
	for (int i = 0; i < n; ++i) {
		int x = N[i] - '0';
		dp[i + 1][0] = x + min(dp[i][0], dp[i][1]);
		dp[i + 1][1] = dp[i][0] + 11 - x;
		if (i > 0) {
			dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + 9 - x);
		}
	}
	cout << min(dp[n][0], dp[n][1]) << endl;

	return 0;
}


Measured memory_bytes: 55940
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str_array = in.readLine().split(" ");
    String a = str_array[0];
    String b = str_array[1];
    String a_result = a;
    String b_result = b;
    for(int cnt = 1; cnt<Integer.parseInt(b); cnt++){
      a_result = a_result + a;
    }
    for(int cnt = 1; cnt<Integer.parseInt(a); cnt++){
      b_result = b_result + b;
    }
    System.out.println(Integer.parseInt(a)<Integer.parseInt(b)?a_result:b_result);
  }
}

Measured memory_bytes: 20564
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define vi vector<int>
#define pii pair<int,int>
#define se second
using namespace std;
int n,t,a,b,c,x,y;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	char c;
	cin >> c;
	if (c <= 'Z' && c >='A') cout <<'A';
	else cout <<'a';
	
	
}

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

int main(){
    int n , d ;
    cin >> n >> d ;
    if( n%500 <= d ){
        cout << "Yes" <<endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

using ll = long long;

int main() {
	ll a, b, k;
	cin >> a >> b >> k;

	a -= k;
	if (a > 0) {
		cout << a << " " << b << endl;
		return 0;
	}
	k = -a;
	a = 0;

	b -= k;
	if (b <= 0) {
		cout << "0 0" << endl;
		return 0;
	}

	cout << "0 " << b << endl;
}

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

int main(){
    int n;
    cin >> n;
    double bunbo = 0;
    rep(i,n){
        double a;
        cin >> a;
        bunbo += 1/a;
    }
    printf("%.10f\n",1/bunbo);
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std ; 
#define ll long long
#define flp(i ,a ,b) for(int  i = a ; i<b ; i++)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{	ios ; 
	ll n ; 
	cin>>n ; 
	int a[n] ; 
	flp(i,0,n)
	{
		cin>>a[i] ; 
	}
	int dp[n] ;
	dp[0] = 0  ; 
	flp(i,1 , n)
	{
		dp[i]= dp[i-1] + abs(a[i]-a[i-1]);
		if(i>1)
		{
			dp[i] =min(dp[i] ,dp[i-2] + abs(a[i]-a[i-2]));
		}
 
 
	} 
	cout<<dp[n-1]<<"\n" ; 
}

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

int isprime[1000001] = { 0 };

int main() {

  isprime[1]=1;
  for(int i=4; i<1000001; i+=2)
    isprime[i] = 1;

  for(int i=3; i<1000001; i++) {
    if(isprime[i] == 0)
      for(int j=2; i*j<1000001; j++)
	isprime[i*j] = 1;
  }

  int n;

  while(true) {
    cin>>n;
    if(!n) break;

    int res=0;
    for(int i=2; i<n/2+1; i++)
      if( (isprime[i] == 0) && (isprime[n-i] == 0) ) {
	//cout<<i<<"+"<<n-i<<"="<<n<<endl;
	res++;
      }

    cout<<res<<endl;
  }
}

Measured memory_bytes: 4768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  string s,t,u;
  int a,b;
  cin >> s >> t >> a >> b >> u;
  if(s==u) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    long long int N;
    int K;
    cin >> N >> K;
    int i, c;
    c = 1;
    for(i=K; i<=N; i*=K) {
        c++;
    }
    
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)

const int INF  = 1<<30;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"

void Main()
{
	ll N;
	ld result=0;
	cin>>N;
	FOR(i,1,N){
		if(i%2==1)
			result+=(1.0/(ld)N);
	}
	cout << result << "\n";
	return;
}

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


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

const int MAX_N = 350;
double dp[MAX_N][MAX_N][MAX_N];
double N;

double ans(int a, int b, int c){
  if(dp[a][b][c] >= 0){
    return dp[a][b][c];
  }
  if(a == 0 && b == 0 && c == 0){
    return 0;
  }
  
  double ret = 0;
  if(a > 0){
    ret += (ans(a-1,b,c) * a)/N;
  }
  if(b > 0){
    ret += (ans(a+1,b-1,c) * b)/N;
  }
  if(c > 0){
    ret += (ans(a,b+1,c-1) * c)/N;
  }
  ret += 1.0;
  ret *= N;
  ret /= a+b+c;
  
  dp[a][b][c] = ret;
  
  return ret;
}
  


int main(){
  cin >> N;
  int one = 0;
  int two = 0;
  int three = 0;
  for(int i=0; i<N; i++){
    int x;
    cin >> x;
    if(x == 1){
      one++;
    }
    else if(x == 2){
      two++;
    }
    else{
      three++;
    }
  }
  
  for(int i=0; i<MAX_N; i++){
    for(int j=0; j<MAX_N; j++){
      for(int k=0; k<MAX_N; k++){
        dp[i][j][k] = -1;
      }
    }
  }
  
  //cout << one << " " << two << " " << three << endl;
  
  cout << setprecision(20) << ans(one,two,three) << endl;
}

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

int main(){
    string s, t;
    cin >> s >> t;

    auto n = s.length();
    ll cnt = 0;
    rep(i, n) {
        if (s[i] != t[i]) {
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3928
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defparameter colors (split " " (read-line)))
(defparameter balls (cons (read) (read)))
(defparameter choice (read-line))

(if (equal choice (car colors))
    (format t "~A ~A"  (1- (car balls)) (cdr balls))
    (format t "~A ~A" (car balls) (1- (cdr balls))))


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

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
int n;
int m;
bool f[10];
bool check(int t){
	while(t){
		if(f[t%10])return 0;
		t/=10;
	}
	return 1;
}
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n>>m;
	rep(i,m){
		int t;
		cin>>t;
		f[t]=1;
	}
	do{
		int t=n;
		if(check(t)){
			cout<<n;
			break;
		}
		n++;
	}while(1);
	return 0;
}

Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
int x[] = {
	1, 8, 6, 3,
	2, 0, 7, 4,
	3, 1, 8, 5,
	4, 2, 0, 6,
	5, 3, 1, 7,
	6, 4, 2, 8,
	7, 5, 3, 0,
	8, 6, 4, 1,
	0, 7, 5, 2
};
vector<int> a[362889]; int p[11], cnt, fact[11]; bool used[11];
void build(int pos) {
	if (pos == 9) {
		a[cnt].resize(9);
		for (int i = 0; i < 9; i++) a[cnt][i] = p[i];
		cnt++;
		return;
	}
	for (int i = 0; i < 9; i++) {
		if (!used[i]) {
			used[i] = true; p[pos] = i;
			build(pos + 1);
			used[i] = false;
		}
	}
}
int perm(vector<int> v) {
	int ret = 0;
	for (int i = 0; i < 9; i++) {
		for (int j = i + 1; j < 9; j++) {
			if (v[i] > v[j]) ret += fact[8 - i];
		}
	}
	return ret;
}
struct state {
	int pos, cost;
};
bool operator<(const state& s1, const state& s2) {
	return s1.cost < s2.cost;
}
int c[2], dist[362889], g[1451529];
int main() {
	build(0); fact[0] = 1;
	for (int i = 1; i <= 9; i++) fact[i] = fact[i - 1] * i;
	for (int i = 0; i < 362880; i++) {
		int ptr = -1;
		for (int j = 0; j < 9; j++) {
			if (a[i][j] == 0) ptr = j;
		}
		vector<int> t = a[i];
		for (int j = 0; j < 4; j++) {
			swap(t[ptr], t[x[ptr * 4 + j]]);
			g[i * 4 + j] = perm(t);
			swap(t[ptr], t[x[ptr * 4 + j]]);
		}
	}
	while (cin >> c[0] >> c[1], c[0] | c[1]) {
		vector<int> d(9), e(9);
		for (int i = 0; i < 9; i++) cin >> d[i];
		for (int i = 0; i < 9; i++) cin >> e[i];
		int fd = perm(d), fe = perm(e);
		fill(dist, dist + 362880, 999999999); dist[fd] = 0;
		priority_queue<state> que; que.push(state{ fd, 0 });
		while (!que.empty()) {
			int u = que.top().pos; que.pop();
			for (int i = u * 4; i < u * 4 + 4; i++) {
				int z = g[i], cost = c[(i & 2) >> 1];
				if (dist[z] > dist[u] + cost) {
					dist[z] = dist[u] + cost;
					que.push(state{ z, -dist[z] });
				}
			}
		}
		cout << dist[fe] << endl;
	}
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    bool flag = true;
    if (S.size() % 2 == 0)
    {
        for (int i = 0; i < N / 2; i++)
        {
            if (S.at(i) != S.at(i + N / 2))
            {
                flag = false;
                break;
            }
        }
    }
    else
    {
        flag = false;
    }
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
n=int(input())
s=input()

ans=s.count("R")*s.count("B")*s.count("G")
for i in range(n):
    for j in range(i+1,n):
        k=2*j-i
        if k>=n:break
        if s[i]!=s[j] and s[j]!=s[k] and s[i]!=s[k]:
            ans -=1

print(ans)

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  vb flg(n);
  vll cnt(n);
  rep(i,m){
    ll p; string s; cin>>p>>s; p--;
    if(s=="AC"){
      flg[p]=true;
    }else{
      if(!flg[p]) cnt[p]++;
    }
  }
  
  ll ok=0;
  ll ng=0;
  rep(i,n){
    if(flg[i]){
      ok++;
      ng+=cnt[i];
    }
  }
  cout<<ok<<" "<<ng<<endl;
  
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	vector< pair<ll,ll> > vc;
	for(i=1;i<=n;i++){
		cin>>k>>l;
		vc.ps({l,k});
	}
	sort(all(vc));

	ll t=0,fl=1;
	for(i=0;i<n;i++){
		if(vc[i].fs>=t+vc[i].sc){
			t+=vc[i].sc;
		}
		else{
			fl=0;
			break;
		}
	}
	if(fl){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 6384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t,n,a,b,c,i,j,m,x,mn = LLONG_MAX;
//    map<ll,ll>mp;
//    stack<ll>st;
//    deque<ll>dq;
//    queue<ll>q;
//    set<ll>s;
//    string str,str1;
//    cin>>str>>str1;
//    cin>>n>>m>>x;
//     vector<ll>v[n],coin;
//    for(i = 0;i < n;i++)
//    {
//        cin>>a;
//        coin.push_back(a);
//        for(j = 0;j < m;j++)
//        {
//            cin>>b;
//            v[i].push_back(b);
//        }
//    }
     cin>>a>>b>>c>>n;
     if(a>=n)
        cout<<n<<endl;
     else if(a+b>=n)
     {
         cout<<a<<endl;
     }
     else
        cout<<a-(n-(a+b))<<endl;
    return 0;
}


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

int main() {
  int N,num;
  cin >> N;
  num=0;
  for(int i=0; i<N; i++){
      int a,b;
      cin >> a >> b;
      num+=b-a+1;
  }
  cout << num << endl;
}


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

int main(){
	int n;
	string s;
	map<string, int> mp = {};
	cin >> n ;
	for (int i = 0; i < n; i++){
		cin >> s;
		mp[s]++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
	return 0;
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]

A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        if A[n][-1] != -1:
            cand1.add(A[n][-1])
    return len(can_use),cand1

answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

print(answer)



Measured memory_bytes: 38388
#include<iostream>
using namespace std;
int main(){
  int a[5];
  int min = 9;
  int pnt;
  for (int i = 0; i < 5; i++){
    cin >> a[i];
    if (min > a[i]%10 && a[i]%10 != 0){
      min = a[i] % 10;
      pnt = i;
    }    
  }
  int ans = 0;
  for (int i = 0; i < 5; i++){
    if (i == pnt)
      ans += a[i];
    else if (a[i]%10 != 0)
      ans += ((a[i] / 10) + 1 ) * 10;
    else
      ans += a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
static long factMax = 200000;//nCkにおけるnの最大値
static long[] factorials = new long[factMax+1];//i!(mod p)をO(n)で先にメモ。
static long[] factorialRs = new long[factMax+1];//i!^-1(mod p), pは素数でO(n)。

	static void Main()
	{
    string[] input = Console.ReadLine().Split(' ');
    long n = long.Parse(input[0]);
    long m = long.Parse(input[1]);
    long p = 1000000007;
  
    factorials[0] = 1;
    factorialRs[factMax] = DivideModFactorial(factMax,p);
    for(long i = 1; i <= factMax; i++)
    {
      factorials[i] = (factorials[i-1]*i)%p;//i!(mod p)
      factorialRs[factMax-i] = (factorialRs[factMax+1-i]*(factMax+1-i))%p;//逆元も先にメモ
    }

    Console.WriteLine(BallBoxDistinction(n,m,p));
	}

  static long BallBoxDistinction(long n, long m, long mod)
  {//区別するn個の玉をm個の箱に少なくとも1個入れる方法の個数(mod)をO(mlogn)で返す。
  //求める方法は、m^n通りから、(一番左の箱に1個もいれない)または…で包除原理。
    long answer = DivideMod(m,n,mod);

    for(int i = 1; i <= m; i++)
    {
      if(i % 2 == 1)
      {
        answer -= Comb(m,i,mod)*DivideMod(m-i,n,mod);
      }else
      {
        answer += Comb(m,i,mod)*DivideMod(m-i,n,mod);
      }
      answer %= mod;
      if(answer < 0) answer += mod;
    }

    return answer;
  }

  static long MathPow(long x, long a)//戻り値はx^a。O(loga)
  {
    long num = 2;
    long answer = 1;
    long check = a;
    long memo = x;
  
    while(check > 0)
    {
      if(check % num == num / 2)
      {
        check -= num / 2;
        answer *= memo;
      }
    memo *= memo;
    num *= 2;
    }
    return answer;
  }

  static long DivideMod(long x, long a, long p)//戻り値はx^a(mod p)。O(loga)
  {
    long num = 2;
    long answer = 1;
    long check = a;
    long memo = x%p;
    
    while(check > 0)
    {
      if(check % num == num / 2)
      {
        check -= num / 2;
        answer *= memo;
        answer %= p;
      }
    memo *= memo;
    memo %= p;
    num *= 2;
    }
    return answer;
  }

  static long DivideModReverse(long x, long p)//戻り値はx^-1(mod p), pは素数。O(logp)
  {
    long answer = DivideMod(x, p-2, p);
    return answer;
  }

  static long ModFactorial(long x, long p)//戻り値はx!(mod p)
  {
    long answer = 1;
    for(int i = 2; i <= x; i++)
    {
      answer *= i;
      answer %= p;
    }
    return answer;
  }

  static long DivideModFactorial(long x, long p)//戻り値はx!^-1(mod p), pは素数
  {
    long answer = 1;
    for(long i = x; i >= 2; i--)
    {
      answer *= DivideModReverse(i, p);
      answer %= p;
    }
    return answer;
  }

  static long Comb(long a, long b, long p)//組み合わせC(a,b)(mod p)をO(1)で返す
  {
    if(a-b < 0) return 0;//引数a-bが負なら0を返す
    long answer = 1;
    answer *= factorials[a];
    answer %= p;
    answer *= factorialRs[a-b];
    answer %= p;
    answer *= factorialRs[b];
    answer %= p;
    return answer;
  }
  
}



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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

struct gcd_segment_tree {
 private:
  int n;
  vector<int> node;

 public:
  gcd_segment_tree(const vector<int>& v) {
    n = 1;
    while (n < v.size()) n *= 2;
    node.resize(2 * n - 1);
    for (int i = 0; i < v.size(); i++) node[i + n - 1] = v[i];
    for (int i = n - 2; i >= 0; i--) node[i] = gcd(node[2 * i + 1], node[2 * i + 2]);
  }

  int get(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return node[k];
    int vl = get(a, b, 2 * k + 1, l, (l + r) / 2);
    int vr = get(a, b, 2 * k + 2, (l + r) / 2, r);
    return gcd(vl, vr);
  }
};

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& e : a) cin >> e;

  gcd_segment_tree s(a);
  int r = 0;
  for (int i = 0; i < n; i++) r = max(r, gcd(s.get(0, i), s.get(i + 1, n)));
  cout << r << endl;
}


Measured memory_bytes: 1664
A = list(map(int,input().split()))
A.sort()
ans = 0
while A[0] != A[1] or A[1] != A[2]:
  ans += 1
  if A[2] - A[0] > 1:
    A[0] += 2
  else:
    A[0] += 1
    A[1] += 1
  A.sort()
print(ans)

Measured memory_bytes: 9188
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
const int MOD=1e9+7;
const int INF=1<<29;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
void solve(){
  int A[2],B[2];
  for(auto& it:A)cin>>it;
  for(auto& it:B)cin>>it;
  if(A[1]<B[0]){cout<<0;return;}
  int ans=min(A[1],B[1]);
  ans-=max(A[0],B[0]);
  cout<<max(ans,0ll)<<endl;	
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int k = sc.nextInt();
      int s = sc.nextInt();
      int count = 0;
      int z = 0;
      for(int i = 0;i <= k && i <= s;i++){
      	for(int j = 0;j <= k && j <= s-i;j++){
        	z = s-i-j;
          if(z >= 0&&z <= k)count++;
        }
      }
      System.out.println(count);
    }
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s ,t;
  cin >> s >> t;
  
 
  int a = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != t.at(i)) {
      a++;
    }
  }
 
  cout << a << endl;
}

Measured memory_bytes: 3916
n=int(input())
A=list(map(int,input().split()))
q=int(input())
m=list(map(int,input().split()))

def solve(i,num):
    if num==0:
        return True
    if i>=n:
        return False
    res=solve(i+1,num) or solve(i+1,num-A[i])
    return res




for num in m:
    if sum(A)<num or not solve(0,num):
        print("no")
    else:
        print("yes")


Measured memory_bytes: 5624