akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int k,x;
    cin>>k>>x;
    for(int i=x-k+1;i<=x+k-1;i++){
        if(i==x+k-1) cout<<i<<endl;
        else cout<<i<<" ";
    }
    //cout<<endl;
    return 0;
}

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

int main()
{
    char s[200000];
    
    scanf("%s",s);

    int len = strlen(s);
    int i,j;

    int T[200001] = {0};
    T[len] = 0;
    int count2019[2019] = {0};
    count2019[0] = 1;
    int dig = 1;
    for (i = len - 1; i >= 0; i--)
    {   
        T[i] = (T[i + 1] + dig * (s[i] - '0')) % 2019;
        count2019[T[i]]++;
        dig *= 10;
        dig %= 2019;
    }

    long long ans = 0;
    for (i = 0; i < 2019; i++)
    {
        ans += count2019[i] * (count2019[i] - 1) / 2;
    }
    
    printf("%lld",ans);
}


Measured memory_bytes: 2640
//Created by Kira

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

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
   



int main(){
   IOS

   int n; cin>>n;

   vi x(n);

   int mx = -1;
   for(int &i : x)cin>>i, mx = max(mx, i);

   ll res = 1e15;

   for(int i = 1; i <= mx; i++){
      ll s = 0;
      for(int j = 0; j < n; j++){
            s += (x[j]-i)*(x[j]-i);
         }
      res = min(res, s);
   }

   cout<<res<<"\n";




   














}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
   if(b&1)
       res = res * a % mod;
        a = a * a % mod;
   b >>= 1;
    }

    return res;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
#include<cstring>
char a[1000000];
int main()
{  int n,i;
   scanf("%s",a);
   n=strlen(a);
   int p=0,s=0;
  for(i=0;i<n;i++)
  {
  	if(a[i]=='0')
  	s++;
  	if(a[i]=='1')
  	p++;
  }
  if(s<=p)
  p=s;
  printf("%d\n",p*2);
	
	
}

Measured memory_bytes: 384
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    int n;
    cin>>n;
    ll xorsm = 0;
    vector<ll> vec(n);
    for(int i = 0; i < n; i++){
        cin>>vec[i];
        xorsm ^= vec[i];
    }
    if(xorsm == 0){
        cout<<"0";
        return ;
    }
    xorsm ^= (vec[0] ^ vec[1]);
    ll andbit = (vec[0]+vec[1]) - xorsm;
    // cout<<andbit;
    if(andbit < 0 || andbit/2 > vec[0]){    // andbit/2 the bit that should be present in both the numbers
        cout<<"-1";
        return ;
    }
    andbit /= 2;
    {
        ll fst = andbit;
        for(int i = 42; i >= 0; i--){
            if((xorsm&(1ll<<i)) && (1ll<<i) != andbit && fst + (1ll<<i) < vec[0])
                fst += (1ll<<i);
        }
        if(fst == 0 || (fst^(vec[1]+vec[0]-fst)) != xorsm){
            cout<<"-1";
            return ;
        }
        cout<<vec[0] - fst;
    }

}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	string S;
	long long K;
	cin >> S;
	cin >> K;

	long long jdg = 1;
	for (long long i = 0; i < S.length() - 1; i++) {
		if (S[i + 1] == S[i]) {
			jdg += 1;
		}
	}

	long long jdg1 = S.length();

	long long cnt = 0;
	for (long long i = 0; i < S.length() - 1; i++) {
		if (S[i + 1] == S[i]) {
			cnt += 1;
			i++;
		}
	}

	long long dcnt = 0;
	S += S;
	for (long long i = 0; i < S.length() - 1; i++) {
		if (S[i + 1] == S[i]) {
			dcnt += 1;
			i++;
		}
	}

	dcnt = dcnt - 2 * cnt;

	long long ans = K * cnt + (K - 1) * dcnt;

	if (jdg == jdg1) {
		ans = K * jdg1 / 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3636
#n = int(input())
import itertools

h,n = map(int,input().split())
a_L = list(map(int,input().split()))

# kumiawase = list(itertools.permutations(a_L,3))

# for i in kumiawase:
#     ans = h
#     #print(ans,"ans")
#     for j in i:
#         ans -= j
#         if ans == 0:
#             print("Yes")
#             exit()

# print("No")

if h-sum(a_L) <= 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14216
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
int n,k,ans=1;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
     ans+=min(ans,k);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 1e5;
int h, w, n;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w >> n;
  maxs(h, w);
  cout << (n+h-1)/h << endl;
}

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

#define tezi ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define endl "\n"
#define int long long
#define pii pair<int, int>
#define piii pair<int, pair<int, int>>
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define deb(x) cout << #x << " = " << x << endl
#define all(x) x.begin(), x.end()
#define MAX 1000000000000000001
#define MAXN 1000000
#define mod 1000000007
#define PI 3.1415926535897932384626

int mod_exp(int x, int y);

//ofstream fout("file.out");
//ifstream fin("file.in");

void solve(){
    int x, y;
    cin >> x >> y;
    if(y % 2 != 0) cout << "No" << endl;
    else{
        int m1 = x * 2, m2 = x * 4;
        if(y >= m1 && y <= m2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

int32_t main(){
    tezi;
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

int mod_exp(int x, int y){
    y %= mod;
    int res = 1;
    while(y > 0){
        if(y % 2 != 0) res = (res * x) % mod;
        x = (x * x) % mod;
        y /= 2;
    }
    return res;
}


Measured memory_bytes: 3644
#include <iostream> 

using std::cout;
using std::cin;
using std::endl;

void swap(int &a, int &b) {
    int swap = a;
    a = b;
    b = swap;
}

void sort(int a, int b, int c) {
    if (a > b) {
        swap(a,b);
    }   
    if(b > c) {
        swap(b,c);
    }   
    if (a > b) {
        swap(a,b);
    }   
    cout << a << " " << b << " " << c << endl;
}

int main(void) {
    int a;
    int b;
    int c;
    cin >> a >> b >> c;
    sort(a,b,c);
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
const long long INF = 1LL<<60;

struct UnionFind {
  vector<int> par,siz; 

  UnionFind(int N) : par(N),siz(N,1) { //最初は全てが根であるとして初期化
    for(int i=0; i<N;i++) par[i]=i;
  }
  
  void init(int N) {//再初期化
    par.resize(N);
    siz.assign(N,1);
    for (int i=0;i<N;++i) par[i]=i;
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    // merge technique（データ構造をマージするテク．小を大にくっつける）
    if(siz[rx]<siz[ry]) swap(rx, ry);
    siz[rx]+=siz[ry];
    par[ry]=rx;
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  
  int size(int x){ // 素集合のサイズ
    return siz[root(x)];
  }
  
};


int main() {
  int N,M,K; cin>>N>>M>>K;
  UnionFind tree(N);
  vector<vector<int>> S(N);
  rep(i,M){
    int a,b; cin>>a>>b;
    a--;
    b--;
    tree.unite(a,b);
    S.at(a).push_back(b);
    S.at(b).push_back(a);
  }
  rep(i,K){
    int a,b; cin>>a>>b;
    a--;
    b--;
    S.at(a).push_back(b);
    S.at(b).push_back(a);
  }
  rep(i,N){
    int t=tree.size(i)-1;
    rep(j,S.at(i).size()){
      if(tree.same(i,S.at(i).at(j))) t--;
    }
    if(i<N-1)cout<<t<<' ';
    else cout<<t;
  }
}


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

int main() {
  string s; cin >> s;
  while(1) {
    s = s.substr(0,s.size()-1);
    if ( s.size() % 2 == 0 ) {
      if ( s.substr(0,s.size()/2) == s.substr(s.size()/2)) {
	cout << s.size()<< endl;
	return 0;
      }
    }
  }
  return 0;
}


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

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

    ll ans = n*(n+1)/2 - (3+(n/3)*3)*(n/3)/2 - (5+(n/5)*5)*(n/5)/2 + (15+(n/15)*15)*(n/15)/2;

    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    int n;
    cin >> n;
    P(pow(n,3));
      
    return  0;
}


Measured memory_bytes: 384
#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() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string w, s;
    int cnt = 0;
    getline(cin, w);
    rep(i, w.size()) w[i] = tolower(w[i]);
    while (cin>>s) {
        rep(i, s.size()) s[i] = tolower(s[i]);
        if (w == s) cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3216
#include<stdio.h>
#define MAX 2000000
int suji,A[MAX+1];
void swap(int *a,int *b);
void maxheapify(int i){
  int l,r,largest;
  l=2*i;
  r=2*i+1;

  if(l<=suji  && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=suji && A[r]>A[largest])largest=r;

  if(largest!=i){
    swap(&A[i],&A[largest]);
    maxheapify(largest);
  }
}

int main()
{
  scanf("%d",&suji);
  for(int i=1;i<=suji;i++)scanf("%d",&A[i]);
  for(int i=suji/2;i>=1;i--)maxheapify(i);
  for(int i=1;i<=suji;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}
void swap(int *a,int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i <= b;i++)
#define fast_io ios_base::sync_with_stdio(false)
#define pb push_back
#define fir first
#define sec second
#define tr(it,x) for(it = x.begin();it != x.end();it++)
#define mp make_pair
#define sz(x) (ll)x.size()
#define rep(i,n) for(ll i=0;i<n;i++)
#define double long double
#define accuracy ll precision = numeric_limits<double>::digits10
#define pll pair<ll,ll>
#define N 300005

ll n,aa,bb,k;
const ll pri = 998244353;
ll fac[N],invFac[N];

ll myPow(ll a,ll b) {
	ll ret = 1;
	while(b != 0) {
		if(b % 2 != 0) {
			ret = (ret * a) % pri;
		} 
		b /= 2;
		a = (a*a) % pri;
	}
	return ret;
}

ll inv(ll a,ll b) {
	return myPow(a,b-2);
}

ll ncr(ll r,ll t) {
	if(t > r) return 0;
	ll ret = 1;
	ret *= fac[r];
	ret *= invFac[r-t]; ret %= pri;
	ret *= invFac[t]; ret %= pri;
	return ret;
}

void pre() {
	fac[0] = 1; invFac[0] = 1;
	fr(i,1,N-1) {
		fac[i] = (fac[i-1] * i) % pri;
		invFac[i] = inv(fac[i],pri);
	}	
}

int main() {
	// freopen("input.txt", "r", stdin); 
	// freopen("output.txt", "w", stdout);
	fast_io;	 
	accuracy;
	cin >> n >> aa >> bb >> k;
	pre();
	ll temp = __gcd(aa,bb);
	if(k % temp == 0) {
		ll ans = 0;
		fr(i,0,n) {
			if((k - (i*aa)) % bb == 0) {
				ll temp = (k - (i*aa)); temp /= bb;
				if(temp < 0) break;
				ans += (ncr(n,i) * ncr(n,temp)); ans %= pri; 
			} 
		}
		cout << ans << "\n";
	}
	else cout << 0 << "\n";
}

Measured memory_bytes: 4992
### constant

MAX_C = 10000

### main

while true
  n = gets.strip.to_i
  break if n == 0

  bl = gets.strip.split(' ').map{|s| s.to_i}
  bsum = bl.inject(0){|s, b| s + b }
  #p bl
  #p bsum

  goal = []
  k = 1
  sum = 0
  while sum < bsum
    sum += k
    goal << k
    k += 1
  end
  #p sum

  count = 0
  while bl != goal && count <= MAX_C
    l = bl.length
    bl = bl.map{|b| b - 1}.select{|b| b > 0}
    bl << l
    count += 1
  end

  puts (count > MAX_C ? -1 : count)
end

Measured memory_bytes: 13692
d, g = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(d)]

sums = [100*(i+1)*l[i][0]+l[i][1] for i in range(d)]

ans = 1001
for bit in range(1<<d):
    cnt = 0
    sum = 0
    nokori = []

    for i in range(d):

        if bit & (1<<i):
            sum += sums[i]
            cnt += l[i][0]
        else:
            nokori.append([100*(i+1), -(l[i][0]-1)])

    if sum < g:
        nokori.sort(reverse=True)
        for j in range(-nokori[0][1]):
            sum += nokori[0][0]
            cnt += 1
            if sum >= g:
                    break

    if sum >= g:
        ans = min(ans, cnt)

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 1145141919
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)

using namespace std;

int main(void){
  int N;
  cin >> N;
  double A[N],sum=0,ans;
  rep(i,N) cin >> A[i];
  double B[N];
  rep(i,N) B[i]=(double)1/A[i];
  rep(i,N) sum+=B[i];
  printf("%.10lf\n",1/sum);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			if (j * (N - i) + i * (M - j) == K) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a + b >= c) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll ans=100000000,temp1=0;
    for(int i=0;i<n;i++)
    {
        if(i==0)
        {
            temp1=a[n-1]-a[0];
            ans=min(ans,temp1);
        }
        else if(i==n-1)
        {
            temp1=k-a[n-1]+a[n-2];
            ans=min(ans,temp1);
        }
        else
        {
            temp1=a[n-1]-a[i];
            temp1+=k-a[n-1]+a[i-1];
            ans=min(ans,temp1);
        }
    }
    cout<<ans;
    return 0;
}







Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 998244353;

int main(){
    vector<ll> po(3003);
    po[0] = 1; po[1] = 2;

    for (ll i = 2; i < 3002; i++){
        po[i] = 2 * po[i-1] % MOD;
    }

    
    ll N, S; cin >> N >> S;
    vector<ll> A(N+1);
    for (ll i = 1; i <= N; i++) {
        cin >> A[i];
    }

    ll inv = MOD - (MOD / 2) % MOD;
    

    vector<vector<ll>> dp(N+2, vector<ll> (S+2));

    for (ll n = 0; n <= N; n++) {
        dp[n][0] = po[N];
    }
    for (ll s = 1; s <= S; s++) {
        dp[0][s] = zero;
    }

    for (int n = 1; n <= N; n++) {
        for (int s = 0; s <= S; s++) {
            if(s - A[n] < 0){
                dp[n][s] = dp[n-1][s];
            }
            else{
                dp[n][s] = (dp[n-1][s] + dp[n-1][s-A[n]] * inv % MOD) % MOD;
            }


        }
    }

    printf("%lld\n", dp[N][S]);


}


Measured memory_bytes: 73640
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x; cin >> x;
	cout << (x >= 30 ? "Yes" : "No");

	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n;
  cin>>n;
  Fr(i,3500){
    Fr(j,3500){
      if(4*i*j-n*(i+j)<=0) continue;
      if((n*i*j)%(4*i*j-n*(i+j))==0){cout<<i<<" "<<j<<" "<<(n*i*j)/(4*i*j-n*(i+j))<<endl;return 0;}
    }
  }
}

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;

namespace Atcoder2
{
    class Program
    {

        public static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            string[] tmpStr = Console.ReadLine().Split(' ');
            int[] nums = new int[num];
            for(int i = 0; i < num; i++)
            {
                nums[i] = int.Parse(tmpStr[i]);
            }

            int count = 0;
            for(int i = 0; i < num; i += 2)
            {
                if (nums[i] % 2 == 1)
                {
                    count += 1;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 27400
n=int(input())

#初期値
ma=int(input())
result=-9999999999999999999999999

for i in range(n-1):
    value=int(input())
    if result<value-ma:
        result=value-ma

    # 最小値の更新
    if value < ma:
        ma=value

print(result)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,x;
  cin>>n>>x;
  int a[n];
  rep(i,0,n){
    cin>>a[i];
  }
  ll ans=0;
  rep(i,0,n-1){
    if(a[i]>x){
      ans+=a[i]+a[i+1]-x;
      a[i+1]=0;
    }
    else if(a[i]+a[i+1]>x){
      ans+=a[i]+a[i+1]-x;
      a[i+1]=x-a[i];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iomanip>
#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() {
  string s;
  cin >> s;
  if (s[1] == 'R') cout << "ABC" << endl;
  else cout << "ARC" << endl;
  return 0;
}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int n, x;  cin >> n >> x;
  vector<int> a(n); cin >> a;
  ll ans = max(0, a[0]-x);
  for (int i = 0; i < n-1; ++i){
    ll now = max (min(a[i]+a[i+1]-x, a[i+1]), 0);
    ans += now;
    a[i+1] -= now;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main(){
    cin>>a>>b>>c;
    int arr[10] ={0};
    arr[a]++;
    arr[b]++;
    arr[c]++;
    if(arr[5]==2&&arr[7]==1){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,i,s;
	cin>>s;
	for(int i=1;i<=9;i++)
	{
		if(s%i==0) a=s/i;
		else a=-1;
		if(a>=1&&a<=9) 
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <cmath>
#include <algorithm>
#include <climits>
using namespace std;
int main(){
  int arr[3];
  for(int i=0; i<3; i++){
    cin >> arr[i];
  }
  int compare=INT_MIN;
  int index;
  for(int i=0; i<3; i++){
    for(int j=i; j<3; j++){
      if(arr[j]>compare){
        compare=arr[j];
        index=j;
      }
    }
    if(index!=i){
      swap(arr[i], arr[index]);
    }
    compare=INT_MIN;
  }
  int sum=0;
  for(int i=0; i<2; i++){
    sum+=fabs(arr[i]-arr[i+1]);
  }
  cout << sum << "\n";
  return 0;
  
}

Measured memory_bytes: 256
#include<algorithm>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<stack>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
const double PI = acos(-1);  // PI = 3.141593...

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    vector<vector<int>> l(h, vector<int>(w, 0));
    vector<vector<int>> r(h, vector<int>(w, 0));
    vector<vector<int>> u(h, vector<int>(w, 0));
    vector<vector<int>> d(h, vector<int>(w, 0));

    rep(i, h) {
        if(s[i][0] == '.') l[i][0] = 1;
        if(s[i][w-1] == '.') r[i][w-1] = 1;
        for(int j = 1; j < w; ++j) {
            if(s[i][j] == '.') l[i][j] = l[i][j-1] + 1;
            if(s[i][w-j-1] == '.') r[i][w-j-1] = r[i][w-j] + 1;
        }
    }

    rep(i, w) {
        if(s[0][i] == '.') u[0][i] = 1;
        if(s[h-1][i] == '.') d[h-1][i] = 1;
        for(int j = 1; j < h; ++j) {
            if(s[j][i] == '.') u[j][i] = u[j-1][i] + 1;
            if(s[h-j-1][i] == '.') d[h-j-1][i] = d[h-j][i] + 1;
        }
    }

    int ans = 0;
    rep(i, h) {
        rep(j, w) {
            ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 67200
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
int main(){
  int n,k;
  cin >> n >> k;
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  deque<ll> deq;

  for(int i=0;i<k;i++){
    deq.push_back(a[i]);
  }

  for(int i=k;i<n;i++){
    ll head = deq.front();
    ll back = a[i];

    if(head < back){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }

    deq.pop_front();
    deq.push_back(a[i]);
  }

}

Measured memory_bytes: 6332
#include<stdio.h>

int main(){
int i,j,a,n;
char c,s[5] = {'S','H','C','D','\0'};
static int card[4][13];

scanf("%d\n", &n);
for(i =1;i <=n;i++){
    scanf("%c %d\n",&c,&a);
    for(j=0;j<4;j++){
	if(s[j] == c) card[j][a-1]=1;
	}
    }

for(i=0;i < 4;i++){
    for(j=0; j<13;j++){
	if(card[i][j]==0) printf("%c %d\n",s[i],j+1);
	}
    }
return 0;
}





Measured memory_bytes: 2140
#include <stdio.h>

#define MAX 100005
#define R -1

typedef struct{
  int parent;
  int right; //??????
  int left;  //??????
}Node;

Node A[MAX];
int n;
int B[MAX];
int C[MAX];

void depth(int u,int p){
  B[u]=p;
  if(A[u].right!=R) depth(A[u].right,p);
  if(A[u].left!=R) depth(A[u].left,p+1);
}
void print2(int i){
  int c,j;
  c=A[i].left;
  for(j=0,c=A[i].left;c!=R;j++,c=A[c].right){
    if(j)printf(", ");
    printf("%d",c);
  }
}

void print(){
  int i;
  for(i=0;i<n;i++){
    printf("node %d: ",i);
    printf("parent = %d, ",A[i].parent);
    printf("depth = %d, ",B[i]);
    if(A[i].parent==R) printf("root, ");
    else if(A[i].left==R) printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    print2(i);
    printf("]\n");
  }
}

int main(int argc, char const *argv[]) {
  int i,j,root,cnt,r=0,c,x,s;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    A[i].parent=R;
    A[i].left=R;
    A[i].right=R;
  }
  for(i=0;i<n;i++){
    scanf("%d",&root);
    scanf("%d",&C[i]);
    for(j=0;j<C[i];j++){
      scanf("%d",&c);
      A[c].parent=root;
      if(j==0) A[root].left=c;
      else A[x].right=c;
      x=c;
    }
  }
  for(i=0;i<n;i++){
    if(A[i].parent==R) s=i;
  }
  depth(s,0);
  print();
  return 0;
}

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

namespace ALDS1_1
{
    class Program
    {
        private static string Join(int[] a)
        {
            string r = "";
            for(int i = 0; i < a.Length; i++)
            {
                r += a[i].ToString();
                if(i != a.Length - 1) r += ' ';
            }
            return r;
        }

        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            for(int i = 0; i < n; i++)
            {
                int v = a[i], j = i - 1;
                while (j >= 0 && a[j] > v)
                {
                    a[j + 1] = a[j];
                    j--;
                    a[j + 1] = v;
                }
                Console.WriteLine(Join(a));
            }
        }
    }
}

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





signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
 
   
    ll n,m,l;
    cin>>n>>m>>l;
    ll dp[n][n]={};
    ll cost[n][n]={};
    ll inf = 1e15;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i!=j) cost[i][j] = inf, dp[i][j] = inf;
        }
    }
    for(int i=0;i<m;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        if(c>l) continue;
        dp[a][b] = c;
        dp[b][a] = c;
    }
    //nは頂点の数
    for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++){
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i!=j && dp[i][j] <= l) cost[i][j] = 1;
        }
    }
    //nは頂点の数
    for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++){
        cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
    }
    
    
    int q;
    cin>>q;
    while(q--){
        int s,t;
        cin>>s>>t;
        s--,t--;
        if(cost[s][t]>=n+1){
            cout << -1 << "\n";
            continue;
        }
        cout << cost[s][t]-1 << "\n";

    }
}


Measured memory_bytes: 1920
import collections
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
K=int(input())
if K%2==0 or K%5==0:
  print(-1)
ans=7%K
for i in range(K):
  if ans==0:
    print(i+1)
    exit()
  ans=((ans*10)+7)%K

Measured memory_bytes: 9448
N,x = map(int,input().split())
a=list(map(int,input().split()))

a.sort()

ans=0
for i in range(N):
    if x == 0:
        break
    if x >= a[i]:
        ans+=1
        x-=a[i]
    else:
        x = 0
if x != 0:
    ans -= 1
print(max(0,ans))


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

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int K, A, B; cin >> K >> A >> B;
    for (int i = A; i <= B; i++)
    {
        if (i % K == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
#define mtv(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out( 
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cout << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    stringstream ss; ss << H;
    cout << args[idx] << "- " << ss.str() << ", ";
    debug_out(args, idx + 1, LINE_NUM, T...);
}

ll gcd(ll a, ll b){
    if(b == 0)return a;
    return gcd(b,a%b);
}

bool isp(ll n){
    for(ll i = 2; (i * i) <= n; i++)if(n%i == 0)return 0;
    return 1;
}

void doit(){
    ll a,b;
    cin >> a >> b;
    if(a < b)swap(a,b);
    ll g = gcd(a,b);
    ll ans = 1;
    for(ll i = 2; i*i <= g ; i++){
        if(g%i == 0){
            ans++;
            while(g%i == 0)g /= i;
        }
    }
    if(g != 1)ans++;
    cout << ans << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 3652
object Main extends App {
  var get = readLine.split(" ")
  var n = get(0).toInt
  var l = get(1).toInt
  var sum = 0
val inputs = List.tabulate(n)(i => (l + i))
  sum = inputs.sum
  if(l>0)sum = sum-inputs.min
  if(l<=0){
    if(n.abs<=l.abs)sum = sum-inputs.max
  }
  println(sum)
}

Measured memory_bytes: 27460
#include<iostream>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=50000005;
int s,len[N],p[N];
ll qpow(ll a,ll n)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=ans*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ans;
}
int main()
{
    p[0]=1;
    scanf("%d",&s);
    ll ans=0;
    int sum=0;
    for(int l=1,r=0;l<10000000;l++)
    {
        while(sum<s)
        {
            r++;
            p[r]=p[r-1];
            len[r]=len[r-1];
            if(r/p[r]!=0) p[r]*=10,len[r]++;
            sum+=len[r];
        }
        if(sum==s) ans++;
        sum-=len[l];
    }
    for(int t=1;t<=s/8;t++)
    {
        if(s%t) ans=(ans+1)%mod;
        else ans=(ans+(qpow(10,s/t)-qpow(10,s/t-1)-t+1))%mod;//input//
    }
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
}

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

int main() {
    ll N, M;
    cin >> N >> M;
    ll ans = 0;
    if (N * 2 <= M)
        ans = N + (M - N * 2) / 4;
    else
        ans = M / 2;
    cout << ans << endl;
}

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

using namespace std;
#define X first
#define Y second
#define pb push_back
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
const int MAXN=5e5+10;
int n,k,a[MAXN],bit[MAXN],tot;
ll v1[MAXN],v2[MAXN],dsp[MAXN],pre[MAXN],res;

void upd(int x,int v)
{while(x<=tot) bit[x]+=v,x+=x&(-x);}
int qry(int x)
{int ret=0;while(x) ret+=bit[x],x-=x&(-x);return ret;}

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) 
        scanf("%d",&a[i]),pre[i]=pre[i-1]+a[i];
    //由于所有值确定，可以不用平衡树，先离散化即可
    for(int i=1;i<=n;i++)
        v1[i]=pre[i-1]-1ll*k*i,dsp[++tot]=v1[i],
        v2[i]=pre[i]-1ll*i*k-k,dsp[++tot]=v2[i];
    sort(dsp+1,dsp+tot+1);tot=unique(dsp+1,dsp+tot+1)-dsp-1;
    for(int i=1;i<=n;i++)
        v1[i]=lower_bound(dsp+1,dsp+tot+1,v1[i])-dsp,
        v2[i]=lower_bound(dsp+1,dsp+tot+1,v2[i])-dsp;
    
    for(int i=1;i<=n;i++)
        upd(v1[i],1),res+=qry(v2[i]);
    printf("%lld",res);
    return 0;
}

Measured memory_bytes: 18176
#include <stdio.h>
int main(){
  int n,j,i,k,v;
  int A[1000];
  scanf("%d",&n);
  for(j=0;j<n;j++){
    scanf("%d",&A[j]);
  }
  for(i=1;i<=n-1;i++){

    for(k=0;k<n-1;k++){
      printf("%d ",A[k]);
    }
    printf("%d",A[n-1]);
    printf("\n");
    //
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      
      A[j+1]=A[j]; 
      j--;
    } 
    A[j+1]=v;
    //

  }
  for(k=0;k<n-1;k++){
    printf("%d ",A[k]);
  }
  printf("%d",A[n-1]);
  printf("\n");
  
  return 0;
}

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

int main(){
   int n;
   scanf("%d",&n);
   int temp=n%10;
   if(temp==3){
    printf("bon");
   }else if(temp==0||temp==1||temp==6||temp==8){
   printf("pon");
   }else printf("hon");
    return 0;
}


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

using namespace std;

const int N = (int)1e5 + 7;

int dp[N];
int n, k;
int a[N];

main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 2; i <= n; i++) {
		int res = 1e9;
		for (int j = max(1, i - k); j < i; j++) {
			res = min(dp[j] + abs(a[j] - a[i]), res);
		}
		dp[i] = res;
	}
	cout << dp[n];
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main(){
  ll n ;cin>>n ;
  vector<ll> A(n) ,B(n);
  ll suma=0 ;ll sumb =0 ;
  vector<ll> sa(n) ;
  rep(i,n) {
    cin>>A[i] ;
    suma+=A[i] ;
  }
  rep(i,n) {
    cin>>B[i] ;
    sumb+=B[i] ;
    sa[i]=A[i]-B[i] ;//0以上だけ
  }
   sort(sa.begin(),sa.end()) ;
   if(suma<sumb) cout<<-1<<endl ;
   else{
      ll ans=0 ;
      ll yoyu=suma-sumb ;
    rep(i,n){
      if(sa[i]<0) continue ;
      if(sa[i]<=yoyu) ans++ ;
      yoyu-=sa[i] ;
    }
   cout<<n-ans<<endl ;
   }
  return 0 ;
}

Measured memory_bytes: 2560
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

n = inp[0]
p (n-1)/2



Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    if(n % 2 == 1){
        no();
        return 0;
    }
    vi a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    n = n/2;
    cout << a[n]-a[n-1] << endl;
    return 0;
}


Measured memory_bytes: 640
X = int(input())

if X >= 1800:
    print("1")
elif X >= 1600:
    print("2")
elif X >= 1400:
    print("3")
elif X >= 1200:
    print("4")
elif X >= 1000:
    print("5")
elif X >= 800:
    print("6")
elif X >= 600:
    print("7")
else:
    print("8")


Measured memory_bytes: 9164
#include<stdio.h>
#include<string.h>
int main(){
  int n,i;
  scanf("%d",&n);
  char c[n+1];
  scanf("%*c%s",c);
  int len=strlen(c);
  int left[n],right[n];
  for(i=0;i<len;i++){
    left[i]=0;
    right[i]=0;
  }
  int num=0;
  for(i=0;i<len;i++)
    if(c[i]=='W'){
      left[num]=i+1;
      num++;
    }
  num=0;
  for(i=len-1;i>=0;i--)
    if(c[i]=='R'){
      right[num]=i+1;
      num++;
    }
  num=0;
  while(left[num]<right[num] && left[num]!=0 && right[num]!=0)
    num++;
  printf("%d\n",num);
  return 0;
}


Measured memory_bytes: 3484
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a,b,x,s=-1,t=0;
  cin >> a >> b >> x;
  if(x>=b){
    if(x==b)	t++;
    if(a==0)	t++;
    cout << t << endl;
    return 0;
  }if(a==b){
    if(a%x==0)	t++;
    if(a==0)	t++;
    cout << t << endl;
    return 0;
  }
  
  if(a==0)	s=0;
  else if(x>=a)	s=1;
  else if(x<a){
    s=a/x;
    if(a%x!=0)	s++;
  }
  t=b/x;
  if(s==-1){
    cout << 0 << endl;
    return 0;
  }
  cout << t-s+1 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      
      int a =  sc.nextInt();
      int b =  sc.nextInt();
      int h =  sc.nextInt();
      
      System.out.println((a + b)* h /2);
    }
}

Measured memory_bytes: 22612
using System;

class Program {
  enum Status {
    SAME, UP, DOWN
  }
  static void Main(string[] args)	{
    int N = int.Parse(Console.ReadLine());
    string[] val = Console.ReadLine().Split();
    int[] A = new int[N];
    for (int i = 0; i < N; ++i) {
      A[i] = int.Parse(val[i]);
    }

    Status status = Status.SAME;
    int cur = A[0];
    int count = 1;

    for (int i = 1; i < A.Length; ++i) {
      if (status == Status.SAME && cur != A[i]) {
        status = cur < A[i] ? Status.UP : Status.DOWN;
      }
      else if ((status == Status.UP && cur > A[i]) ||
      (status == Status.DOWN && cur < A[i])) {
          status = Status.SAME;
          ++count;
      }
      cur = A[i];
    }
		Console.WriteLine(count);
	}
}


Measured memory_bytes: 18528
#include <iostream>
#include <iterator>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <stack>
#include <vector>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <limits>
#include <utility>
#define EPS (1e-10)
#define REP(i,n) for(int i=0;i<n;i++)
#define equals(a,b) (fabs((a) - (b)) < EPS)
#define ll long long
using namespace std;

//typedef pair<int,int> P;
//const ll MOD = 1000000007;
//const ll INF = 100000000;

const int max_M = 10000;
int N, M, A[max_M+1];
int sum;

//stack<int> stack;
//queue<int> que;
//priority_queue<int> pque;
//set<int> s; set<int>::iterator ite;
//multiset<int> ms; multiset<int>::iterator ite;
//map<int, int> m; map<int, int>::iterator ite;
//multimap<int, int> mm; multimap<int, int>::iterator ite;

//int dp[][];
//int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, -1, 0, 1};
//int dx[8] = {1, 1, 1, 0, -1, -1, -1, 0};
//int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};

#define PI 3.14159265359
void solve() {
  if(sum > N) printf("-1");
  else printf("%d\n", N - sum);
}

int main(int argc, char const *argv[]) {

  sum=0;

  scanf("%d", &N);
  scanf("%d", &M);
  REP(i,M) {

    scanf("%d", &A[i]);
    sum += A[i];
  }

  solve();
  return 0;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

int main()
{
    fastio;
    lli n=100,n1;
    cin >> n1;
    int ans=0;
    for(int i=1;i<4000;i++)
    {
        lli inr=n/100;
        n+=inr;
        if(n>=n1)
        {
            ans=i;
            break;
        }
    }
    cout << ans << endl;
}

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

int main(){
    int n, l, i, h, a, m = 0, c = 0;
    cin >> n >> h;
    int b[n];
    for(i=0; i<n; i++){
        cin >> a >> b[i];
        m = max(m, a);
    }
    sort(b, b+n);
    l = lower_bound(b, b+n, m) - b;
    for(i=n-1; i>=l; i--){
        c++;
        h -= b[i];
        if(h <= 0){
            break;
        }
    }
    if(h>0){
        c += ceil((double)h/m);
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 640