akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
#define SIZE 1000000
ll kaijo[SIZE];
void init() {
	kaijo[0] = 1;
	for (ll i = 1;i < SIZE;i++)kaijo[i] = (kaijo[i - 1] * i) % N;
}

ll inv(ll x) {
	ll res = 1;
	ll k = N - 2;
	ll y = x%N;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N)*(y%N) % N;
		k /= 2;
	}
	return res;
}

ll Comb(ll n, ll k) {
	if (n < 0 || k < 0 || (n - k) < 0)return 0;
	ll b = kaijo[n];
	ll c = kaijo[n - k];
	ll d = kaijo[k];
	ll cd = (c*d) % N;
	return ((b%N)*(inv(cd)) % N) % N;
}

int main(void){
    init();
    ll n,m,k;
    cin>>n>>m>>k;
    ll ans = Comb(n*m-2,k-2)%N;
    ll tmp1 = 0;
    for(ll d=1;d<n;d++){
        ll x = (m*m)%N;
        x = (x*(n-d))%N;
        x =(x*d)%N;
        tmp1 =(tmp1+x)%N;
        tmp1 = (tmp1+N)%N;
    }
    ll tmp2 = 0;
    for(ll d=1;d<m;d++){
        ll y = (n*n)%N;
        y = (y*(m-d))%N;
        y =(y*d)%N;
        tmp2 =(tmp2+y)%N;
        tmp2 = (tmp2+N)%N;
    }
    ll tmp = (tmp1+tmp2)%N;
    ans = (ans*tmp)%N;
    cout<<(ans+N)%N<<endl;
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long num,solve;
    while(cin>>num)
    {
        int count=0;
        solve=100;
        while(num>solve)
        {
            solve=solve+(solve/100);
            count++;
        }
        cout<<count<<endl;
        break;
    }
}

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

int g[8][8];
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
void dfs(int x, int y) {
	g[x][y] = 0;
	rep(i, 4) {
		int nx = x, ny = y;
		rep(j, 3) {
			nx += dx[i]; ny += dy[i];
			if (0 <= nx&&nx < 8 && 0 <= ny&&ny < 8 && g[nx][ny])
				dfs(nx, ny);
		}
	}
}
int main() {
	string buf;
	int n; cin >> n;
	rep(t, n) {
		rep(i, 8)rep(j, 8)scanf("%1d", &g[j][i]);
		int x, y; cin >> x >> y; x--; y--;
		dfs(x, y);
		printf("Data %d:\n", t + 1);
		rep(i, 8) {
			rep(j, 8)printf("%d", g[j][i]);
			printf("\n");
		}
	}
}

Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const ll INF = LLONG_MAX/3;

/*-----Library-----*/

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

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

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

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
//コンビネーション
/*
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 */
/*-----Library-----*/
const int MOD=1234567;
signed main(){
	int a,b;
	cin>>a>>b;
	if(a==1&&b==2)cout<<3<<endl;
	else if(a==1&&b==3)cout<<2<<endl;
	else if(a==2&&b==3)cout<<1<<endl;
	else if(a==2&&b==1)cout<<3<<endl;
	else if(a==3&&b==2)cout<<1<<endl;
	else if(a==3&&b==1)cout<<2<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void outputArray(int *arr, int n);

int main() {
    int n, t;
    int array[100];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> array[i];
    outputArray(array, n);
    for (int i = 1; i < n; i++) {
        int j = i - 1;
        int v = array[i];
        while (j >= 0 && v < array[j]) {
            array[j + 1] = array[j];
            j--;
        }
        array[j + 1] = v;
        outputArray(array, n);
    }
    return 0;
}

void outputArray(int *arr, int n) {
    for (int i = 0; i < n; i++)
        if (i == n - 1) {
            cout << arr[i] << endl;
        } else {
            cout << arr[i] << " ";
        }
}


Measured memory_bytes: 3100
#include <assert.h>
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
#define K 100001
using namespace std;
using I = long long int;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    I h; cin >> h;
    I attack = 0; I n = 1;
    while (h >=1) {
        h = h/2; attack += n; n *= 2;
    }
    cout << attack;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, ans = 0; cin>>n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	for(int i =0 ; i<n - 1; i++){
		for(int j = i + 1; j < n; j++){
			ans += (a[i] * a[j]);
		}
	}
	cout<<ans<<endl; 
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::size_t;

int main(){

    string s;

    cin >> s;

    if(s.size() == 3){
        for(int i(2);i > -1;i--){
            cout << s[i];
        }
    }
    else if(s.size() == 2){
        for(int i(0);i < s.size();i++){
            cout << s[i];
        }
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC04_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = scan;
            long[] a = { t[0] * t[1], t[0] * t[2], t[1]* t[2] };
            if (t.Any(i => i % 2 ==0)) Console.WriteLine(0);
            else Console.WriteLine(a.Min());
        }

        static long[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), long.Parse); } }
    }
}


Measured memory_bytes: 2776
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	int n;
	cin >> n;
	for (int i = 9; i >= 1; i--){
		if (!(n%i) && n/i < 10){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, W, M;
    cin >> H >> W >> M;
    vector<vector<ll>> rows(H), cols(W);
    set<pair<ll, ll>> bomb;
    ll hmax = 0, wmax = 0;
    vector<ll> hh, ww;
    rep(i, M) {
        ll h, w;
        cin >> h >> w;
        h--; w--;
        rows[h].push_back(w);
        cols[w].push_back(h);
        bomb.emplace(h, w);
    }
    rep(i, H) hmax = max(hmax, (ll)rows[i].size());
    rep(i, W) wmax = max(wmax, (ll)cols[i].size());
    rep(i, H) {
        if(hmax == rows[i].size()) hh.push_back(i);
    }
    rep(i, W) {
        if(wmax == cols[i].size()) ww.push_back(i);
    }
    ll ans = hmax + wmax - 1;
    iter(h, hh) {
        iter(w, ww) {
            if(bomb.find({h, w}) == bomb.end()) {
                cout << ans + 1 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 63148
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,int k){
    Mint num(1),dom(1);
    for(int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}


template<typename M>
class Enumeration{
private:
  static vector<M> fact,finv,invs;
public:
  static void init(int n){
    n=min<decltype(M::mod)>(n,M::mod-1);

    int m=fact.size();
    if(n<m) return;

    fact.resize(n+1,1);
    finv.resize(n+1,1);
    invs.resize(n+1,1);

    if(m==0) m=1;
    for(int i=m;i<=n;i++) fact[i]=fact[i-1]*M(i);
    finv[n]=M(1)/fact[n];
    for(int i=n;i>=m;i--) finv[i-1]=finv[i]*M(i);
    for(int i=m;i<=n;i++) invs[i]=finv[i]*fact[i-1];
  }

  static M Fact(int n){
    init(n);
    return fact[n];
  }
  static M Finv(int n){
    init(n);
    return finv[n];
  }
  static M Invs(int n){
    init(n);
    return invs[n];
  }

  static M C(int n,int k){
    if(n<k||k<0) return M(0);
    init(n);
    return fact[n]*finv[n-k]*finv[k];
  }

  static M P(int n,int k){
    if(n<k||k<0) return M(0);
    init(n);
    return fact[n]*finv[n-k];
  }

  // put n identical balls into k distinct boxes
  static M H(int n,int k){
    if(n<0||k<0) return M(0);
    if(!n&&!k) return M(1);
    init(n+k);
    return C(n+k-1,n);
  }
};
template<typename M>
vector<M> Enumeration<M>::fact=vector<M>();
template<typename M>
vector<M> Enumeration<M>::finv=vector<M>();
template<typename M>
vector<M> Enumeration<M>::invs=vector<M>();

//INSERT ABOVE HERE
signed main(){
  using M = Mint<int>;
  using E = Enumeration<M>;
  E::init(1e6);

  int n,k;
  cin>>n>>k;
  M ans{0};
  for(int i=0;i<=min(n,k);i++)
    ans+=E::C(n,i)*E::H(i,n-i);

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


Measured memory_bytes: 12032
def b160(x):

    ans = 0

    ans += (x // 500) * 500 * 2
    nokori = x % 500
    ans += (nokori // 5) * 5

    return ans

def main():
    x = int(input())
    print(b160(x))

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int N = 100010, K = 1010;

inline void Cmax(int &a, int b) {
    if (a < b) a = b;
    return;
}

int n, k;
int cnt[K * 2][K * 2], sum[K * 2][K * 2];

int Sum(int i, int l, int r) {
    if (l > r) return 0;
    return sum[i][r] - sum[i][l - 1];
}

int main() {
    scanf("%d%d", &n, &k);
    int m = k * 2, res = 0;
    for (int i = 1; i <= n; ++i) {
	int x, y;
	char c;
	scanf("%d%d", &x, &y);
	cin >> c;
	x %= m;
	y %= m;
	if (c != 'B') {
	    if (x < k) x += k;
	    else x -= k;
	}
	++cnt[x][y];
	if (!((x < k) ^ (y < k))) ++res;
    }
    for (int i = 0; i < m; ++i) {
	sum[i][0] = cnt[i][0];
	for (int j = 1; j < m; ++j)
	    sum[i][j] = sum[i][j - 1] + cnt[i][j];
    }
    int Max = 0;
    for (int j = 0; j < k; ++j) {
	Cmax(Max, max(res, n - res));
	int tmp = res;
	for (int i = 1; i < k; ++i) {
	    tmp += Sum(k - i, k - j, m - j - 1) - sum[k - i][k - j - 1] - Sum(k - i, m - j, m - 1) - Sum(m - i, k - j, m - j - 1) + sum[m - i][k - j - 1] + Sum(m - i, m - j, m - 1);
	    Cmax(Max, max(tmp, n - tmp));
	}
	for (int i = 0; i < k; ++i)
	    res += cnt[i][m - j - 1] - cnt[i][k - j - 1] + cnt[k + i][k - j - 1] - cnt[k + i][m - j - 1];
    }
    printf("%d\n", Max);
    return 0;
}

Measured memory_bytes: 32000
import scala.io.StdIn._

object Main extends App {
  def start(inputs: Array[String]): Int = {
    val nums: Array[Int] = inputs(0).split(" ").map(_.toInt)
    val T = nums(0)
    val X = nums(1)
    println(T.toFloat / X.toFloat)
    T / X
  }

  val inputs = Array(readLine())

  start(inputs)
}

Measured memory_bytes: 25528
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
 
int main() {
	fastio;
	string str;
	cin>>str;
	if(str[2]==str[3] && str[4]==str[5]){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
	
}

Measured memory_bytes: 384
from math import sqrt
n = int(input())
xy = [[int(i) for i in input().split()] for _ in range(n)]

def d(x, y):
    return sqrt((x[0] - y[0]) ** 2 + (x[1] - y[1])** 2)
    

def nai(x, y, z):
    c,b,a = sorted([d(x, y),d(y, z),d(z, x)])
    co = (b ** 2 + c ** 2 - a ** 2) / (2 * b * c)
    if co < 0:
        return a/2
    si = sqrt(1 - co ** 2)
    return a / si / 2

if n == 2:
    print(d(xy[0],xy[1])/2)
else:
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                ans = max(ans, nai(xy[i], xy[j], xy[k]))
    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

int main(){
    ll n , k ; cin >> n >> k;
    vector<bool> s(n,false);
    rep(i,k){
        ll d; cin >> d;
        rep(j,d){
            ll a; cin >> a; a--;
            s.at(a) = true;
        }
    }
    ll ans = 0;
    rep(i,n){
        if(!s.at(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<(a+b)%24<<endl;
	return 0;
}


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;
using ld = long double;
using P = pair<int, int>;

int main() {
	int x, a;
	cin >> x >> a;
	cout << ((x < a) ? 0 : 10) << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    map<int,int> m;
    for(int i = 0; i<N; i++){
        cin >> a[i];
        m[a[i]]++;
    }
    int max;
    max = *max_element(a.begin(), a.end());

    if(m[max] == 1){
        for(int i=0; i<N; i++){
            if(a[i] == max){
                a[i] = 0;
                int max_second;
                max_second = *max_element(a.begin(), a.end());
                cout << max_second << endl;
            }else{
                cout << max << endl;
            }
        }
    }else{
        for(int i=0; i<N; i++)
            cout << max << endl;
    }
    return 0;
}

Measured memory_bytes: 7936
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int H1 = sc.nextInt();
        int M1 = sc.nextInt();
        int H2 = sc.nextInt();
        int M2 = sc.nextInt();
        int K = sc.nextInt();
        int result = (H2 - H1)*60 + (M2 - M1);
        System.out.println(result - K);
    }
}


Measured memory_bytes: 35572
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a)+min(b)

for i in range(M):
    x,y,c = map(int,input().split())
    ans = min(ans , a[x-1]+b[y-1]-c)
print(ans)

Measured memory_bytes: 18736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)

int h,w;
string a,x;
int main(){
    cin >> h >> w;
    rep(i, w+2) x += '#';
    cout << x << endl;
    while(h--) cin >> a, cout << '#' << a << '#' << endl;
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
 
using namespace std;
using vecint = vector<int>;

int main(){
    int n,Y;
    cin >> n >> Y;
    if(n*10000 < Y) {
        cout <<"-1 -1 -1" << endl;
       return 0;
    }
    for(int i = 0;i<= n;i++){
        for(int j =0;j<=n-i;j++){
            int k = n - i- j;
            if(10000*i + 5000*j + 1000*k == Y){
                cout << i <<' '<<j<<' '<<k<<endl;
                return 0;
            }
        }
    }
   cout <<"-1 -1 -1" << endl;
   return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define For(i,a,b) for(long long i=a;i<b;i++)
#define pb push_back
using namespace std;
typedef long long ll;
ll power(ll x,ll y,ll p){
ll res = 1;x = x % p;
while (y > 0){
if (y & 1){res = (res*x) % p;}
y = y>>1;
x = (x*x) % p;}
return res;}
ll mcd(ll a,ll b){
    if(b>a)swap(a,b);
    if(b==0)return a;
    else return mcd(b,a%b);
}
ll n,m,k;
bool esprimo(ll n){
ll s=0;
for(ll i=1;i*i<=n;i++){
    if(n%i==0){s++;}}
if(s>=2){return false;}
return true;
}
int main(){
    //    cout<<fixed<<setprecision(2);
//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
string s,t;
cin>>s>>t;
n=s.size();
m=t.size();
int ans=m;
for(int i=0;i<n;i++){
    if(i+m==n+1){break;}
    int c=0;
    for(int j=i;j<i+m;j++){
        if(s[j]!=t[j-i]){
            c++;
        }
    }
    ans=min(ans,c);

}
cout<<ans<<endl;
}



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

using namespace std;

int main(void) {
  long N;cin>>N;
  long A;cin>>A;
  long B;cin>>B;
  long wari = N/(A+B);
  long bsum = wari*A;
  bsum += min(N%(A+B),A);
  cout<<bsum<<endl;
    return 0;
}
 


Measured memory_bytes: 256
// Try NIKKEI Programming Contest 2019
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let mut va = vec![];
    let mut vb = vec![];
    // let mut ds = vec![];
    let mut sum_a = 0;
    let mut sum_b = 0;
    for i in 0..n {
        let a = get!();
        let b = get!();
        sum_a += a;
        sum_b += b;
        va.push((a + b, a, b, i));
        vb.push((a + b, b, a, i));
        // ds.push((a, b));
    }
    va.sort();
    vb.sort();
    let mut flag = vec![false; n];
    let mut ans = 0;
    for _ in 0..n {
        while let Some((_, a,b,i)) = va.pop() {
	        if !flag[i] {
    	    	flag[i] = true;
        		sum_a -= a;
        		sum_b -= b;
        		ans += a;
        		break;
            }
        }
        while let Some((_, b,a,i)) = vb.pop() {
        	if !flag[i] {
            	flag[i] = true;
                sum_a -= a;
                sum_b -= b;
                ans -= b;
                break;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 17124
# -*- coding: utf-8 -*-
import sys,datetime
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = lines.pop(0)
    front = int(S[:2])
    back  = int(S[2:])

    try:
        datetime.date(2000 + front, back, 1)
        datetime.date(2000 + back, front, 1)
        print('AMBIGUOUS')
        sys.exit(0)
    except ValueError:
        pass

    try:
        datetime.date(2000 + front, back, 1)
        print('YYMM')
        sys.exit(0)
    except ValueError:
        pass

    try:
        datetime.date(2000 + back, front, 1)
        print('MMYY')
        sys.exit(0)
    except ValueError:
        pass

    print('NA')

#
# main
#
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 3312
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	string s;
	cin>>s;
	char last = s[0];
	int cnt=1;
	REP(i,1,s.length()-1) {
		if(last==s[i])cnt++;
		else {
			cnt=1;
			last =s[i];
		}
		if(cnt==3){
			cout<<"Yes";
			return;
		}
		}
	cout<<"No";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3524
#include <iostream>
#define N 10
using namespace std;
int main(){
	int field[N][N] = {0};
	int x1[4] = {1, 0, -1, 0};
	int y1[4] = {0, 1, 0, -1};
	int x2[8] = {1, 1, 0, -1, -1, -1, 0, 1};
	int y2[8] = {0, 1, 1, 1, 0, -1, -1, -1};
	//3 is twice of 1 and 2
	int x, y, size;
	char c;
	while(cin >> x >> c >> y >> c >> size){
		field[y][x]++;
		if(size == 1){
			for(int i = 0; i < 4; i++){
				if(0 <= x+x1[i] && x+x1[i] < 10 && 0 <= y+y1[i] && y+y1[i] < 10) field[y+y1[i]][x+x1[i]]++;
			}
		}else{//2 3
			for(int i = 0; i < 8; i++){
				if(0 <= x+x2[i] && x+x2[i] < 10 && 0 <= y+y2[i] && y+y2[i] < 10) field[y+y2[i]][x+x2[i]]++;
			}
			if(size == 3){
				for(int i = 0; i < 4; i++){
					if(0 <= x+x1[i]*2 && x+x1[i]*2 < 10 && 0 <= y+y1[i]*2 && y+y1[i]*2 < 10) field[y+y1[i]*2][x+x1[i]*2]++;
				}
			}
		}
	}
	int white = 0, maxp = 0;
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(field[i][j] == 0) white ++;
			if(field[i][j] > maxp) maxp = field[i][j];
		}
	}
	cout << white << endl << maxp << endl;
	return 0;
}

Measured memory_bytes: 1160
#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 ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

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

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int n; cin >> n;
    cout << n*(n+1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
	// input = input.split("\n");
	// square = input[0].split(" ");
	var val = ["A", "C", "G", "T"];
	var f = false;
	var counts = [];
	var tmp;
	for (var i = 0; i < input.length; i++) {
		if (val.indexOf(input[i]) > -1 && !f) {
			tmp = i;
			f = true;
		} else if (val.indexOf(input[i]) < 0 && f) {
			counts.push(i - tmp);
			f = false;
		}
	}
	if (f) {
		counts.push(input.length - tmp);
	}
	console.log(counts.length != 0 ? Math.max.apply(null, counts) : 0);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    e = collections.defaultdict(set)
    for _ in range(m):
        x,y = LI()
        e[y].add(x)

    fm = {}
    def f(i):
        if i in fm:
            return fm[i]
        if len(e[i]) == 0:
            fm[i] = 0
            return 0
        r = 0
        for c in e[i]:
            t = f(c)
            if r < t:
                r = t
        fm[i] = r + 1
        return r + 1

    r = 0
    for i in range(1,n+1):
        t = f(i)
        if r < t:
            r = t

    return r


print(main())


Measured memory_bytes: 155852
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args) throws IOException {
	  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    Deque<Integer> dq = new ArrayDeque<Integer>();

    int n = Integer.parseInt(br.readLine());
    Set<String> dic = new HashSet<String>();

    for(int i = 0;i < n;i++){
      String com = br.readLine();
      String cmd[] = com.split(" ");
      if(cmd[0].equals("insert")) dic.add(cmd[1]);
      else {
        if(dic.contains(cmd[1])) System.out.println("yes");
        else System.out.println("no");
      }
    }
    /*for(int i = 0; i < dq.length();i++){
      System.out.println(dq);
      //if()
    }*/
  }
}



Measured memory_bytes: 190988
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <queue>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int dp[100005][3];
int main(){
    int n; cin >> n;
    rep(i,100005) rep(j,3) dp[i][j] = 0;
    vector<int> a(n),b(n),c(n); rep(i,n) cin >> a[i] >> b[i] >> c[i];
    for(int i=0;i<n;i++){
        dp[i+1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i]);
        dp[i+1][1] = max(dp[i][2] + b[i], dp[i][0] + b[i]);
        dp[i+1][2] = max(dp[i][1] + c[i], dp[i][0] + c[i]);
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
    return 0;
}

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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    auto it = unique(ALL(A));
    A.erase(it, A.end());

    FOR(i, 0, A.size()){
        if(i){
            cout << ' ';
        }
        cout << A[i];
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 3548
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <map>
#include <cstring>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
const long long MAX=200005;
typedef long long ll;
const int INF=0x3f3f3f3f;
//int d[8][2]={-1,0,0,-1,0,1,1,0,1,1,-1,-1,-1,1,1,-1};
int main()
{
    int n,a[105];
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    int x=0,y=0;
    for(int i=n;i>0;i--)
    {
        x+=a[i];
        i--;
        if(i==0)break;
        y+=a[i];
    }
    printf("%d\n",x-y);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    double a = 3.1415926535897979323;
    double r;
    cin >> r;
    printf("%.10lf" ,r * a * 2);
}


Measured memory_bytes: 3804
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  vector<bool> a_vec(1000000000, false);
  int ans = 0;
  rep(i, n){
    int a;
    cin >> a;
    if (a_vec[a]){
      ans--;
    }else{
      ans++;
    }
    a_vec[a] = !a_vec[a];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 122368
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    int ans = a + b + c - max({a, b, c});
    cout << ans << endl;
}

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

public class Hello
{
    public static void Main()
    {
        
        
        double[] a = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
        double T = a[0];
        double X = a[1];
        
        Console.WriteLine(T / X);
        
    }
}


Measured memory_bytes: 13268
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;


int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
ll Max(ll a, ll b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int n;
	scanf("%d", &n);
	int a[100];
	int max = 0;
	REP(i, n) {
		scanf("%d", &a[i]);
		REP(j, i) {
			if (max < abs(a[i] - a[j]))max = abs(a[i] - a[j]);
		}
	}
	PRINTD(max);
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
maxl = len(bin(max(A))[2:])
ans = [['0'] * N for _ in range(maxl)]
for n in range(N):
    for d, a in enumerate(bin(A[n])[2:].zfill(maxl)):
        ans[d][n] = a

for dn in range(maxl):
    n1 = sum([1 for d in ans[dn] if d == '1'])
    if n1 % 2 == 1:
        for n in range(N):
            ans[dn][n] = '0' if ans[dn][n] == '1' else '1'

prt = [int(''.join([ans[d][n] for d in range(maxl)]), 2) for n in range(N)]
print(' '.join(map(str, prt)))


Measured memory_bytes: 354920
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, k; cin >> n >> k;
  vector<int> h(n); REP(i, n) cin >> h[i];
  if (k >= n) {
    cout << "0\n";
    return 0;
  }
  sort(ALL(h));
  h.resize(n - k);
  cout << accumulate(ALL(h), 0LL) << '\n';
  return 0;
}


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

int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];

  int cnt_5 = 0, cnt_7 = 0;
  for(int i = 0; i < 3; i++) {
    if(a[i] == 5) cnt_5++;
    if(a[i] == 7) cnt_7++;
  }

  if(cnt_5 == 2 && cnt_7 == 1) cout << "YES";
  else cout << "NO";
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n;
	int a[100+1];
	int max = 0;
	for(int i = 0; i < 101; i++){
		a[i] = 0;
	}
	while(scanf("%d",&n) != EOF){
		a[n]++;
	}
	for(int i = 0; i < 101; i++){
		if(max < a[i]){
			max = a[i];
		}
	}
	for(int i = 0; i < 101; i++){
		if(max == a[i]){
			printf("%d\n",i);
		}
	}
	return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(n*a,b)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

void warshall_floyd(vector<vector<int>> &_Date){
    for(int k = 0; k < _Date.size(); k++){        //経由頂点
        for(int i = 0; i < _Date.size(); i++){    //始点
            for(int j = 0; j < _Date.size(); j++){//終点
                _Date[i][j] = min(_Date[i][j], _Date[i][k] + _Date[k][j]);
            }
        }
    }
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N, vector<int>(N, INF));
    vector<vector<int>> C(N, vector<int>(N, INF));
    for(int i = 0; i < M; i++){
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        G[a][b] = c;
        G[b][a] = c;
        C[a][b] = c;
        C[b][a] = c;
    }
    
    warshall_floyd(G);
    int cnt = 0;
    for(int i = 0; i < N - 1; i++){
        for(int j = i + 1; j < N; j++){
            if(C[i][j] == INF)continue;
            if(G[i][j] != C[i][j])cnt++;
        }
    }
    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 384
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

int solve(){
	int n;
	scanf("%d", &n);
	vector<LL> as(n), bs(n);
	for(int i = 0; i < n; ++i){ scanf("%lld", &as[i]); }
	for(int i = 0; i < n; ++i){ scanf("%lld", &bs[i]); }

	if(accumulate(ALL(as), 0LL) < accumulate(ALL(bs), 0LL)){ return -1; }

	vector<LL> plus;
	LL minus = 0;
	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(as[i] > bs[i]){
			plus.push_back(as[i] - bs[i]);
		}
		else if(as[i] < bs[i]){
			minus += bs[i] - as[i];
			++ans;
		}
	}

	sort(ALL(plus));
	while(minus > 0){
		minus -= plus.back();
		plus.pop_back();
		++ans;
	}
	return ans;
}

void mainmain(){
	cout << solve() << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 2428
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repk(i,k, n) for (int i = k; i < (int)(n); ++i)
#define MAX 500010
typedef long long int ll;

using namespace std;

ll A[MAX];

int main() {
	ll N, K, Q;
	cin >> N >> K >> Q;
	
	for (ll i = 1; i <= Q; i++) {
		ll a;
		cin >> a;
		A[a]++;
	}

	for (ll i = 1; i <= N; i++) {
		A[i] = K - Q + A[i];
		if (A[i] > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	

	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int N = S.size();
  int ans = 0;
  for (int i = 1; i < N; i++){
    if (S[i] != S[i - 1]){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();

            AtCoderMain at = new AtCoderMain();
            Console.WriteLine(at.abc131_bRun(s1));
            Console.ReadKey();

        }
    }

    public partial class AtCoderMain
    {
        /// <summary>
        /// abc131_b - B - Bite Eating
        /// https://atcoder.jp/contests/abc131/tasks/abc131_b
        /// 
        /// </summary>
        /// <param name="p1"></param>
        /// <returns></returns>
        public string abc131_bRun(string p1)
        {
            int[] tmp = p1.Split(' ').Select(x => int.Parse(x)).ToArray();

            int num = tmp[0];
            List<int> tastes = new List<int>();

            for (int i = 0; i < num; i++)
            {
                tastes.Add(tmp[1] + i);
            }
            int total = Math.Abs(tastes.Sum());

            int? minabs = null;
            int eatTotal = 0;
            for (int i = 0; i < num; i++)
            {
                List<int> eatTastes = new List<int>(tastes);
                eatTastes.RemoveAt(i);

                int et = eatTastes.Sum();
                int abs = Math.Abs(Math.Abs(total) - Math.Abs(et));
                if (minabs == null || minabs.Value > abs)
                {
                    minabs = abs;
                    eatTotal = et;
                }
            }

            return eatTotal.ToString();

        }
    }
}


Measured memory_bytes: 13396
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b = map(int, input().split())
    if a+b == 15:
        print('+')
    elif a*b == 15:
        print('*')
    else:
        print('x')

if __name__ == '__main__':
    main()

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

int main(){
  int N,M;
  cin>>N>>M;

  vector<int64_t> A(N);
  for(int i=0;i<N;++i) cin>>A[i];
  sort(A.begin(),A.end());

  vector<pair<int64_t,int64_t>> p(M);
  for(int i=0;i<M;++i) cin>>p[i].second>>p[i].first;
  sort(p.begin(),p.end(),greater<pair<int64_t,int64_t>>());

  int i=0,j=0;
  int64_t ans=0;
  while(i<N){
    int64_t a=A[i],b=p[j].second,c=p[j].first;
    if(a>=c || j>=M){
      ans += a;
      ++i;
    }
    else{
      int k=0;
      while(k<b && i+k<N && A[i+k]<c){
        ++k;
        ans += c;
      }
      i=i+k;
      ++j;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll n,m;
int main(void) {
    cin >> n >> m;
    vector<pair<ll,ll> > ab;
    rep(i,n){
        ll tmpa,tmpb;
        cin >> tmpa >> tmpb;
        ab.push_back(make_pair(tmpa,tmpb));
    }
    sort(ab.begin(),ab.end());
    ll cnt=0,cur=0;
    ll res=0;
    while(true){
        if(cnt+ab[cur].second>=m){
            res += ab[cur].first*(m-cnt);
            break;
        }else{
            res += ab[cur].first*ab[cur].second;
            cnt += ab[cur].second;
            cur++;
        }
    }
    cout << res << endl;
    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

char tr,suit;
vector<char> num{'2','3','4','5','6','7','8','9','T','J','Q','K','A'};

struct card{
	string s;
};

bool sorter(const card& a,const card& b){
	if((a.s[1]==tr&&b.s[1]==tr)||(a.s[1]==suit&&b.s[1]==suit)){
		return (find(all(num),a.s[0])-num.begin())>(find(all(num),b.s[0])-num.begin());
	}else{
		return ((a.s[1]==tr)||(a.s[1]==suit&&b.s[1]!=tr));
	}
}

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>tr;
		if(tr=='#')break;
		card board[4][22];
		rep(i,4)rep(j,13)cin>>board[i][j].s;
		int sum[2];
		memset(sum,0,sizeof(sum));
		int win=0;
		rep(j,13){
			suit=board[win][j].s[1];
			card cs[4];
			rep(i,4)cs[i]=board[i][j];
			sort(cs,cs+4,sorter);
			rep(i,4){
				if(cs[0].s==board[i][j].s){
					win=i;
					break;
				}
			}
			sum[win%2]++;
		}
		if(sum[0]>sum[1]){
			cout<<"NS "<<sum[0]-6<<endl;
		}else{
			cout<<"EW "<<sum[1]-6<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3060
#include "iostream"
#include "algorithm"
using namespace std;
void insertionSort(int A[], int N);
void trace(int A[], int N);
int MAX = 100;

int main(int argc, char const *argv[]) {
    int A[100], N;

    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    trace(A, N);
    insertionSort(A, N);

    return 0;
}

void insertionSort(int A[], int N){
    for (int i = 1; i < N; i++) {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
    A[j+1] = v;
    trace(A, N);
    }
}

void trace(int A[], int N){
    for (int i = 0; i < N; i++){
        if(i > 0){
            cout << ' ';
        }
        cout << A[i];
    }
    cout << endl;
}

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

import sys
import os

N = int(input())

for i in range(N):
    ax, ay, bx, by, cx, cy, dx, dy = list(map(float, input().split()))
    AB = (bx - ax, by - ay)
    CD = (dx - cx, dy - cy)
    cross = AB[0] * CD[1] - AB[1] * CD[0]
    if abs(cross) < 1e-10:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 7596