akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vi ar(n);
	rep(i, n) cin >> ar[i];
	vi cnt(100005, 0), cnt1(100005, 0);
	for(int i = 0; i < n; i += 2) cnt[ar[i]]++;
	for(int i = 1; i < n; i += 2) cnt1[ar[i]]++;
	vector<pi> a;
	rep(i, 100005) a.pb({cnt[i], i});
	sort(all(a));
	reverse(all(a));
	vector<pi> b;
	rep(i, 100005) b.pb({cnt1[i], i});
	sort(all(b));
	reverse(all(b));
	int ans = n - b[0].fi - a[0].fi;
	if(a[0].se != b[0].se) cout << ans << endl;
	else{
		int ans = n - a[0].fi;
		if(b.size() > 1) ans -= b[1].fi;
		int ans1 = n - b[0].fi;
		if(a.size() > 1) ans1 -= a[1].fi;
		cout << min(ans, ans1) << endl;
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
ll gcd(ll a,ll b){
  if(!b) return a;
  return gcd(b,a%b);
}
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<(b-a+1)-(b/c+b/d-b/((c*d)/gcd(c,d))-((a-1)/c+(a-1)/d-(a-1)/((c*d)/gcd(c,d))));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = s.size();
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    if (s.size() == n) cout << "yes" << endl;
    else cout << "no" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T>
T pow_ (T x, T n, T M){
    uint64_t u = 1, xx = x;
    while (n > 0){
        if (n&1) u = u * xx % M;
        xx = xx * xx % M;
        n >>= 1;
    }
    return static_cast<T>(u);
};

template <class T> class Factorial {
    T mod;
    vector<uint64_t> facts, factinv;

public:
    Factorial(int n, T mod) : facts(static_cast<u32>(n+1)), factinv(static_cast<u32>(n+1)), mod(mod) {
        facts[0] = 1;
        for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1]*i % mod;
        factinv[n] = pow_(facts[n], static_cast<uint64_t>(mod - 2), static_cast<uint64_t>(mod));
        for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * (i+1) % mod;
    }

    T fact(int k) const {
        if(k >= 0) return static_cast<T>(facts[k]);
        else return static_cast<T>(factinv[-k]);
    }

    T operator[](const int &k) const {
        if(k >= 0) return static_cast<T>(facts[k]);
        else return static_cast<T>(factinv[-k]);
    }

    T C(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return static_cast<T>(facts[p]*  factinv[q] % mod * factinv[p-q] % mod);
    }

    T P(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return static_cast<T>((facts[p] * factinv[p-q]) % mod);
    }

    T H(int p, int q) const {
        if(p < 0 || q < 0) return 0;
        return static_cast<T>(q == 0 ? 1 : C(p+q-1, q));
    }
};

int main() {
    ll h, w, k;
    cin >> h >> w >> k;
    ll ans = 0;
    ll v = h*h%MOD;
    for (ll i = 0; i < w; ++i) {
        ll u = (w-i-1)*(w-i)%MOD*500000004%MOD;
        (ans += v*u%MOD) %= MOD;
    }
    Factorial<ll> f(h*w, MOD);
    v = w*w%MOD;
    for (int i = 0; i < h; ++i) {
        ll u = (h-i-1)*(h-i)%MOD*500000004%MOD;
        (ans += v*u%MOD) %= MOD;
    }
    cout << ans*f.C(h*w-2, k-2)%MOD << "\n";
    return 0;
}

Measured memory_bytes: 3456
//12, 01, 2019, 10:42:24 Rafaelcs cpp
#include <bits/stdc++.h>

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

const int N = int(1e5 + 100);
ll a[N];
ll pref[N], pref_i[N], pref_p[N];
int n, q;
ll resp[N];
pii qu[N];

int m_lower_bound(ll val){
    int r = 1;
    int lo = 1, hi = n;

    while(lo <= hi){
        int mid = (lo + hi) >> 1;

        if(a[mid] > val){
            hi = mid - 1;
        }else{
            lo = mid + 1;
            r = mid;
        }
    }

    return r;
}

int m_upper_bound(ll val){
    int r = n;
    int lo = 1, hi = n;
    // cout << "searching for " << val << endl;

    while(lo <= hi){
        int mid = (lo + hi) >> 1;

        if(a[mid] < val){
            lo = mid + 1;
        }else{
            r = mid;
            hi = mid - 1;
        }
    }

    return r;
}

bool can(int lo, int hi, ll val){
    int loo = 1;
    int hii = lo;
    int l_taked = n - hi;
    int r = lo + 1;
    ll mdif = abs(a[hi] - val);

    while(loo <= hii){
        int mid = (loo + hii) >> 1;

        ll diff = abs(a[mid] - val);

        if(diff <= mdif){
            r = mid;
            hii = mid - 1;
        }else{
            loo = mid + 1;
        }
    }

    int have = lo - r + 1 + hi - lo;

    return have <= l_taked;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> n >> q;

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

        pref[i] = pref[i - 1] + a[i];
        pref_i[i] = pref_i[i - 1];
        pref_p[i] = pref_p[i - 1];

        if(i & 1){
            pref_i[i] += a[i];
        }else{
            pref_p[i] += a[i];
        }
    }

    for(int i = 0 ; i < q ; i++){
        cin >> qu[i].first;
        qu[i].second = i;
    }

    sort(qu, qu + q);

    int hi = n;
    // cout << "aqui!" << endl;
    for(int i = q - 1 ; i >= 0 ; i--){
        ll xi;

        xi = qu[i].first;
        // cout << "processando " << xi << endl;
        if(xi <= a[1]){
            resp[qu[i].second] = pref[n] - pref[n / 2];

            continue;
        }else if(xi >= a[n]){
            if(n & 1){
                resp[qu[i].second] = pref[n] - pref_p[n];
            }else{
                resp[qu[i].second] = pref[n] - pref_i[n];
            }

            continue;
        }

        int lo = m_lower_bound(xi);
        // cout << "Lo = " << lo << endl;
        while(lo < hi && !can(lo, hi, xi)){
            // cout << "hi= " << hi << endl;
            hi--;
        }
        
        int have = n - hi;
        ll sum = 0LL;

        sum = pref[hi] - pref[hi - have];

        int idx = hi - have;

        if(idx & 1){
            sum += pref_p[idx];
        }else{
            sum += pref_i[idx];
        }

        resp[qu[i].second] = pref[n] - sum;
    }

    for(int i = 0 ; i < q; i++){
        cout << resp[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 7168
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("000");
            //1
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("10010010");
            //3
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("0");
            //0
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        char[] ColorArr = InputList[0].ToCharArray();

        //白始まりの場合
        int CntWhite = 0;
        for (int I = 0; I <= ColorArr.GetUpperBound(0); I++) {
            if (I % 2 == 0) {
                if (ColorArr[I] == '0') {
                    CntWhite++;
                }
            }
            else {
                if (ColorArr[I] == '1') {
                    CntWhite++;
                }
            }
        }


        //黒始まりの場合
        int CntBlack = 0;
        for (int I = 0; I <= ColorArr.GetUpperBound(0); I++) {
            if (I % 2 == 0) {
                if (ColorArr[I] == '1') {
                    CntBlack++;
                }
            }
            else {
                if (ColorArr[I] == '0') {
                    CntBlack++;
                }
            }
        }
        Console.WriteLine(Math.Min(CntWhite, CntBlack));
    }
}


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

// #define ONLINE_JUDGE

#define V vector
#define P pair

using LL = long long;
#define FOR(i, x, y) \
    for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) \
    for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
    do {                                      \
        cerr << "\033[32;1m" << #x << " -> "; \
        err(x);                               \
    } while (0)
void err() { cerr << "\033[39;0m" << endl; }
template <template <typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) {
    for (auto v : a) cerr << v << ' ';
    err(x...);
}
template <typename T, typename... A>
void err(T a, A... x) {
    cerr << a << ' ';
    err(x...);
}
#else
#define dbg(...)
#endif
#define sz(x) (int)x.size()

LL bin(LL a, LL b, LL p) {
    LL res = 1;
    a = (a % p + p) % p;
    for (; b; b >>= 1, a = a * a % p)
        if (b & 1) res = res * a % p;

    return res;
}
const int N = 1e2+50;

int a[N];

void solve() {
    LL x, k, d;
    scanf("%lld%lld%lld", &x, &k, &d);
    LL px = (x % d + d) % d, nx = px - d;
    LL tp = llabs((x - px) / d);
    LL ans = 1e18;
    if (tp <= k && ((tp & 1) == (k & 1))) {
        ans = min(ans, px);
    }
    tp = llabs((x - nx) / d);
    if (tp <= k && ((tp & 1) == (k & 1))) {
        ans = min(ans, -nx);
    }
    double dxx = 1.0 * x - 1.0 * k * d;
    if (fabs(dxx) < 1e16) {
        LL xx = (x - k * d);
        ans = min(ans, llabs(xx));
    }

    dxx = 1.0 * x + 1.0 * k * d;
    if (fabs(dxx < 1e16)) {
        LL xx = (x + k * d);
        ans = min(ans, llabs(xx));
    }
    printf("%lld\n", ans);
}

int main() {

    // int t;
    // cin >> t;
    // while (t--) solve();

    solve();

    return 0;
}

Measured memory_bytes: 3824
#include<iostream>

using namespace std;

int main(){

	int x, y;

	while(1){

		cin >> x >> y;

		if( x == 0 && y == 0) break;

		if( x < y){

			cout << x << " " << y << endl;

		}

		else{

			cout << y << " " << x << endl;

		}

	}

	return 0;

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
 
 
string str;
 
void solve() {
	cin >> str;
	int a[3] = {0};
	for (int i = 0; i < str.length(); i++) {
		a[str[i] - 'a']++;
	}
 
	if ((*max_element(a, a + 3) - *min_element(a, a + 3)) <= 1) {
		puts("YES");
	} else {
		puts("NO");
	}
}
 
int main() {

	solve();
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int main(void){
	int N,A,B;
	cin >> N >> A >> B;
	cout << min((N*A),B) << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

	int ans = 0;

	ans += 1000 * (N / 500);
	N %= 500;
	ans += 5 * (N / 5);

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <queue>
#include <functional>
const int INF =1e5;
const int MOD = 1e9 + 7;
using namespace std;
typedef pair<int,int> P;
typedef long long lint;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int H,W;
    cin>>H>>W;
    int d[H][W];
    int n;
    cin>>n;
    int a[n];
    int x=0;
    int y=0;
    int dx=1;
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        rep(j,a[i]){
            if(0<=x && x<W){
                d[y][x]=i+1;
                x=x+dx;
            }else{
                y++;
                dx*=(-1);
                x=x+dx;
                d[y][x]=i+1;
                x=x+dx;
            }
        }   
    }
    rep(i,H){
        rep(j,W-1){
            cout<<d[i][j]<<" ";
        }
        cout<<d[i][W-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* 最大公約数 */
ll gcdx(ll a, ll b) {
    return b ? gcdx(b, a%b) : a;
}

/* 最小公倍数 */
ll lcmx(ll a, ll b) {
    return a / gcdx(a, b) * b;
}

/* modつき二分累乗法 */
ll modpow(ll a, ll b) {
    ll res = 1;
    for (a = a; b; a = a * a , b >>= 1){
        if (b & 1) res = res * a;
    }
    return res;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N = in<ll>(),M = in<ll>();
    ll lcms = 1;
    ll answer = 1;
    ll twoc = 0;
    REP(i,N){
        ll cmp = in<ll>()/2;
        if(i != 0 && cmp % modpow(2,twoc) != 0){
            answer = 0;
            break;
        }else if(i != 0 && (cmp /modpow(2,twoc))%2 == 0){
            answer = 0;
            break;
        }
        lcms = lcmx(lcms,cmp);
        if(lcms > M){
            answer = 0;
            break;
        }
        if(i == 0){
            ll tmp = lcms;
            while(tmp %2 == 0){
                tmp/=2;
                twoc++;
            }
        }
    }
    answer *= M / (lcms * 2)+ (M / lcms) % 2;
    cout << answer<< "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int A,B,C;
    scanf("%d%d%d",&A,&B,&C);
    if ((A==5&B==5&C==7)||(A==5&B==7&C==5)||(A==7&B==5&C==5))
    {
		printf("YES\n");
    }
    else
    {
		printf("NO\n");
    }
    
    return 0;
}



Measured memory_bytes: 128
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		StringBuilder s = new StringBuilder(sc.next());
		String p = sc.next();
		s = s.append(s);
		if(s.toString().contains(p)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

	}
}




Measured memory_bytes: 26272
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define maxn 100005
#define ll long long

void DBG() {
    cerr << "]\n";
}
template <class H, class... T> void DBG(H h, T... t) {
    cerr << h;
    if (sizeof...(t)) {
        cerr << ", ";
    }
    DBG(t...);
}
#define _DEBUG
#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

int tt, n, k;
map<string, int> mp;

int main() {

    cin >> tt;
    while (tt--) {
        string s;
        cin >> s;
        mp[s]++;
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d", mp["AC"], mp["WA"], mp["TLE"], mp["RE"]);
    return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <stdlib.h>

int main(){
	char str[11];
	int mlen = 0;
	int nowlen = 0;
	fgets(str,11,stdin);
	for(int i = 0;i < 11;i++){
		if(str[i] == 'A' || str[i] == 'C' || str[i] == 'G' || str[i] == 'T'){
		nowlen++;
		}else{
			nowlen = 0;
		}
		if(nowlen >= mlen){
			mlen = nowlen;
		}
	}
	printf("%d\n",mlen);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  vector<string> a(h);
  for(int i = 0;i<h;i++){
    cin >> a.at(i);
  }
  vector<bool> H(h,false);
  vector<bool> W(w,false);
  for(int i = 0;i<h;i++){
    for(int j = 0;j<w;j++){
      if( a.at(i).at(j) == '#'){
        H.at(i) = true;
        W.at(j) = true;
      }
    }
  }
  for(int i=0;i<h;i++){
    if(H.at(i) == true){
      for(int j=0;j<w;j++){
        if( W.at(j) == true){
          cout << a.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}

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

using namespace std;

#define ll long long
#define mx 0
#define mn 1e9
#define v(dt) vector<dt>
#define pr(x, y) pair<x,y>
#define loop(x,s,n) for(int x = s; x < n; ++x)
#define in_arr(n) loop(i,0,n){cin>>a[i];}
#define out_arr(n) loop(i,0,n){cout<<a[i];}

const int N = 1e5 + 7;

inline void boost() {
    cin.tie(0), cout.tie(0), cin.sync_with_stdio(0), cout.sync_with_stdio(0);
}
bool vis[26];
int main() {
    boost();
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll cnt = 1;
    vis[s[0]-97] = true;
    loop(i,1,n)
    {
        if ( !vis[s[i]-97] || (s[i] != s[i-1]))
        {
            ++cnt;
            vis[s[i]-97] = true;
        }
    }
    cout<<cnt;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef pair<int, bool> ib;

#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define RFOR(a, b, c) for(int a = b; a >= c; --a)
#define mp(a, b) make_pair(a, b)
#define all(v) v.begin(), v.end()

#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vb vector<bool>
#define fst first
#define snd second
#define MAXN 310
#define MAXM 44100
#define LOGMAXN 20
#define INF 1e9+7
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007LL

int n, k;
ll a, b;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	while(cin >> a >> b)
	{
		ll gcd = __gcd(a, b);
		ll ans = 1LL;
		for(long long i = 2; i*i <= gcd; ++i)
		{
			if(gcd%i == 0)
			{
				while(gcd%i == 0) gcd = gcd/i;
				ans++;
			}
		}
		if(gcd > 1) ans++;
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())

dp = [float('inf')]* 100001

SIXL = [ 6**i for i in range(0,7)]
NINEL = [9**i for i in range(0,6)]
X = sorted(SIXL + NINEL)
dp = [float('inf')]*(N+1)
dp[0] = 0
for i in range(1,N+1):
  for j in X:
    if i-j >= 0:
      dp[i] = min(dp[i],dp[i-j] + 1)
print(dp[-1])

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

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int N=Integer.parseInt(in.next()),W=Integer.parseInt(in.next());
		List<mono> A=new ArrayList<>();

		int Lim=0;
		for(int i=0;i<N;i++) {
			mono m=new mono();
			m.v=Integer.parseInt(in.next()); m.w=Integer.parseInt(in.next());
			A.add(m);
		}


		int DP[]=new int[W+1];
		for(int i=0;i<N;i++) {
			mono m=A.get(i);
			for(int j=m.w;j<=W;j++) {
				DP[j]=Math.max(DP[j], DP[j-m.w]+m.v);
			}
		}

		int res=-1;
		for(int i=1;i<=W;i++)res=Math.max(res, DP[i]);
		System.out.println(res);
	}

}

class mono{
	int v=0,w=0;
}


Measured memory_bytes: 26888
n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
p = [0 for i in range(4)]
buf = 0
for i in range(n):
    buf = abs(x[i]-y[i])
    p[0] += buf
    p[1] += buf ** 2
    p[2] += buf ** 3
    if p[3] <= buf:
        p[3] = buf
p[1] = p[1] ** (1/2)
p[2] = p[2] ** (1/3)
for i in range(4):
    print('{:.8f}'.format(p[i]))


Measured memory_bytes: 5668
fn main() {
    proconio::input! {
        n:usize
    }
    let mut ans = 0;
    //    let mut i = 1;
    //let s = (n as f64).sqrt() as usize;
    let mut i = 1;
    while i * i <= n {
        let c = n / i;
        ans += i * c * (c + 1) / 2;
        // さらに、c について、いくつかまとめて計算。
        if c > i {
            let d = n / (i + 1);
            ans += (c * (c + 1) - d * (d + 1)) * i * (i + 1) / 4;
        }
        i += 1;
    }
    println!("{}", ans);
}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> cnt(M,0);
  for(int i=0;i<N;i++){
    int K;
    cin >> K;//K個いれる
    for(int j=0;j<K;j++){
      int A;
      cin >> A;
      A--;
      cnt.at(A)++;
    }
  }
  
  int ans = 0;
  for(int i=0;i<M;i++){
    if(cnt.at(i) == N){
      ans++;
    }
  }
  cout << ans << endl;
}

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

using ll = long long;
using ull = unsigned long long;

const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for(int i = 0; i < n; ++i) {
		cin >> h[i];
	}
	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for(int i = 2; i < n; i++) {
		int x = INF;
		for(int j = 1; j <= k && i >= j; ++j) {
			x = min(dp[i - j] + abs(h[i] - h[i - j]), x);
		}
		dp[i] = x;
	}
	cout << dp[n - 1] << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	solve();
	
	return 0;
}


Measured memory_bytes: 3968
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n: usize = input.next();
    let m: usize = input.next();
    let mut x = vec![0;m];
    let mut y = vec![0;m];
    let mut c = vec![1;n];
    let mut b = vec![false;n];
    b[0] = true;
    for i in 0..m {
        x[i] = input.next::<usize>() - 1;
        y[i] = input.next::<usize>() - 1;
        c[x[i]] -= 1;
        c[y[i]] += 1;
        b[y[i]] |= b[x[i]];
        if c[x[i]] == 0 {
            b[x[i]] = false;
        }
    }
    let mut a = 0;
    for i in 0..n {
        if b[i] && c[i] > 0 {
            a += 1;
        }
    }
    println!("{}", a);
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



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

#A
def A():
    n = II()
    k = II()
    x = II()
    y = II()
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return

#B
def B():
    w = S()
    d = defaultdict(int)
    for s in w:
        d[s] += 1
    for di in d.values():
        if di % 2:
            print("No")
            return
    print("Yes")
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

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


Measured memory_bytes: 38512
d, b, t = [int(x) for x in input().split()]

w = 7 * d + b

c = 0
c += (t // w) * 7
t %= w

if t >= 7*d:
    c +=7
    t = 0
else:
    c += t//d
    t %= d
    if t > 0:
        c += 1

print(c)



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

#ifdef DEBUG
    #include "debug.h"
    #define DEB
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define DEB if (false)
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

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

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)


void solve(){
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> A(N), B(M);
    rep(i,N) cin >> A[i];
    rep(i,M) cin >> B[i];
    vector<int> sumA(N+1,0), sumB(M+1,0);
    rep(i,N) sumA[i+1] = sumA[i] + A[i];
    rep(i,M) sumB[i+1] = sumB[i] + B[i];

    int ans = 0;
    rep(i,N+1){
        // i冊
        int n = sumA[i];
        int rem = K-n;
        if(rem<0) continue;

        // sumBからrem以下で
        int ng = M+1, ok = 0;
        while(abs(ok-ng)>1){
            int mid = (ok + ng) / 2;

            if (sumB[mid] <= rem) ok = mid;
            else ng = mid;
        }
        
        chmax(ans, i+ok);
    }

    /*
    dump(sumA,sumB);
    int ans = 0;
    rep(i,N+1){
        // i冊
        int n = sumA[i];
        int rem = K-n;
        int t = lower_bound(sumB.rbegin(), sumB.rend(), rem, greater<>())
                    - sumB.rbegin();
        t = M-t;
        dump(i,n, rem, t);
        if(t>=0)
            ans = max(ans, i+t);
    }*/
     
    cout << ans << endl;
}



signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if (b <= c)
  {
    cout << 0 << endl;
    return 0;
  }
  else if (d <= a)
  {
    cout << 0 << endl;
    return 0;
  }

  if (a <= c && b <= d)
  {
    cout << b - c << endl;
  }
  else if (c <= a && d <= b)
  {
    cout << d - a << endl;
  }
  else if (a <= c && d <= b)
  {
    cout << d - c << endl;
  }
  else if (c <= a && b <= d)
  {
    cout << b - a << endl;
  }
}


Measured memory_bytes: 3644
n,l = map(int,input().split())
V = []
W = []
INF = float("inf")
for _ in range(n):
    v,w = map(int,input().split())
    V.append(v)
    W.append(w)
dp = [[0]*(l+1) for _ in range(n+1)]
for i in range(n):
    for j in range(l+1):
        if j>=W[i]:
            dp[i+1][j] = max(dp[i][j],dp[i][j-W[i]]+V[i])
        else:
            dp[i+1][j] = dp[i][j]
print(max(dp[n]))


Measured memory_bytes: 25500
//copied
#include<cstdio>
int n,d,ans,x[210],y[210],p[210];
int main(){
	scanf("%d",&n);
	int M=998244353;
	p[0]=1;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x[i],&y[i]);
		p[i]=1ll*p[i-1]*2%M;
	}
	ans=p[n]-n-1;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			d=0;
			for(int k=j+1;k<=n;k++)d+=(y[i]-y[j])*(x[i]-x[k])==(y[i]-y[k])*(x[i]-x[j]);
			ans=(ans+M-p[d])%M;
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 1700
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, a, N) for(int i = a; i < N; i++)

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

    int a;
    rep(i, 0, N) cin >> a;
    if ((N - 1) % (K - 1) == 0) cout << (N - 1) / (K - 1) << endl;
    else cout << (N - 1) / (K - 1) + 1 << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T & a, const T & b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, MAX = LLONG_MAX;

map<string, lint> mp, mp2;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s, l, r;
	lint N;
	cin >> N;
	cin >> s;
	l = s.substr(0, N);
	r = s.substr(N, N);
	reverse(r.begin(), r.end());
	REP(i, 1 << N) {
		string red = "", blue = "";
		REP(j, N) {
			if ((i >> j) % 2 == 1) {
				red += l[j];
			}
			else {
				blue += l[j];
			}
		}
		mp[red + " " + blue]++;

		red = "", blue = "";
		REP(j, N) {
			if ((i >> j) % 2 == 1) {
				red += r[j];
			}
			else {
				blue += r[j];
			}
		}
		mp2[red + " " + blue]++;
	}

	lint cnt = 0;
	for (auto itr : mp) {
		if (mp2.find(itr.first) != mp2.end()) {
			cnt += itr.second * mp2[itr.first];
		}
	}
	cout << cnt << endl;
}


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

int main() {
  string s;
  cin >> s;
  if(s == "Sunny") {
    cout << "Cloudy";
  } else if(s == "Cloudy") {
    cout << "Rainy";
  } else {
    cout << "Sunny";
  }
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var X = int.Parse(ss[0]);
            var t = int.Parse(ss[1]);

            Console.WriteLine(Math.Max(X - t, 0));
        }
    }
}

Measured memory_bytes: 11092
import Data.List
import qualified Data.ByteString.Char8 as B
import Control.Monad

main :: IO ()
main = breads >>= main'
    where
        main' [q, h, s, d] = readLn >>= print . solve q h s d
        solve q h s d n
            | even n = v * m
            | otherwise = v * m + u
            where
                m = n `div` 2
                u = minimum [q * 4, h * 2, s]
                v = minimum [q * 8, h * 4, s * 2, d]

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)


Measured memory_bytes: 508
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;


ll n, c;


int main() {
	cin >> n >> c;
	vector< vector<int> >v(c, vector<int>(c, 0));
	rep(i, 0, c) {
		rep(j, 0, c) {
			cin >> v[i][j];
		}
	}



	vector< vector<int> >mod(3,vector<int>(c,0));

	rep(i, 0, n) {
		rep(j, 0, n) {
			int x;
			cin >> x;
			x--;
			mod[(i+1+j+1)%3][x]++;
		}
	}

	ll ans = inf;
 	rep(i, 0, c) {
		rep(j, 0, c) {
			rep(k, 0, c) {
				if (i != j && j != k && k != i) {
					ll temp = 0;
					rep(s, 0, 3) {
						rep(t, 0, c){
							if (s == 0) {
								temp += mod[s][t] * v[t][i];
							}
							else if (s == 1) {
								temp += mod[s][t] * v[t][j];
							}
							else {
								temp += mod[s][t] * v[t][k];
							}
						}
					}
					ans = min(ans, temp);
				}
			}
		}
	}

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

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

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


Measured memory_bytes: 14024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define sc(x) scanf("%d", &x)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define ALL(x) x.begin(), x.end()
#define SZ(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define ABS(x) ((x)>=0?(x):(-(x)))
#define fastio ios::sync_with_stdio(0),cin.tie(0)
template<class T>T gcd(T a, T b){return b?gcd(b, a%b):a;}

int main()
{
    int n; sc(n);
    int ans = 0;
    for(int i = 1; i <= n; i += 2){
        int cnt = 0;
        for(int j = 1; j <= i; j++){
            if(i%j == 0)cnt++;
        }
        if(cnt == 8)ans++;
    }
    printf("%d\n", ans);
    return 0;
}




Measured memory_bytes: 256
open System

let flip f a b = f b a

[<EntryPoint>]
let main _ =
    Console.ReadLine()
    |> int
    |> flip (%) 10
    |> fun n ->
        match n with
        | 0 | 1 | 6 | 8 -> "pon"
        | 3 -> "bon"
        | _ -> "hon"
    |> printfn "%s"
        
    0 


Measured memory_bytes: 29652
"""
Segment-Tree
    maxval:入力されるデータ以上の値
    offset:根と枝の数(n=1のときは根1つ葉2つの木)
    init_array(array):配列で初期化
    update(k,x):k番目をxに変更
    min_query(p,q):[p,q)の範囲の最小値
"""
class SegmentTree():
    def __init__(self,n):
        self.offset=self.setOffset(n)
        self.segTree=[0]*(2*self.offset+1)

    def init_array(self,array):
        for i in range(len(array)):
            self.segTree[i+self.offset]=array[i]
        for i in range(offset-1,-1,-1):
            self.segTree[i]=self.sumChild(i)

    def setOffset(self,n):
        if n==1:
            return 1
        else:
            return 2**(n-1).bit_length()-1

    def update(self,k,x):
        k+=self.offset
        self.segTree[k]+=x
        while k:
            k=(k-1)//2
            self.segTree[k]+=x

    def sum_query(self,p,q):
        if p>=q:
            return

        p+=self.offset
        q+=self.offset-1
        segsum=0

        while q-p>1:
            #p%2==0
            if not p&1:
                segsum+=self.segTree[p]
            #q%2==1
            if q&1:
                segsum+=self.segTree[q]
                q-=1
            p=p//2
            q=(q-1)//2

        if p==q:
            return segsum+self.segTree[p]
        else:
            return segsum+self.segTree[p]+self.segTree[q]

    def sumChild(self,n):
        return self.segTree[2*n+1]+self.segTree[2*n+2]

    def show(self):
        print(self.segTree)

n,q=map(int,input().split())
ST=SegmentTree(n)
for i in range(q):
    qry=list(map(int,input().split()))
    if qry[0]==0:
        ST.update(qry[1]-1,qry[2])
    else:
        print(ST.sum_query(qry[1]-1,qry[2]))


Measured memory_bytes: 10752
/*
 * atcoder/abc139/e.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }

template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAXN = 1005;
const int MAXV = MAXN*MAXN/2;
int n, m;
vector<int> G[MAXV];
vector<int> dp(MAXV, -1);
vector<bool> visited(MAXV, false);

int ids[MAXN][MAXN];

int dfs(int v) {
  int &cc = dp[v];
  if (visited[v] && cc == -1) {
    // loop
    return -1;
  }
  if (~cc) return cc;
  visited[v] = true;
  int res = 1;
  for (auto&& u: G[v]) {
    int ret = dfs(u);
    if (ret == -1) return -1;
    chmax(res, ret + 1);
  }

  return cc = res;
}


void solve() {
  cin >> n;

  m = 0;
  loop(i,0,n-1) {
    loop(j,i+1,n) {
      // cout << m << ": " << i << " " << j << endl;;
      ids[i][j] = ids[j][i] = m++;
    }
  }

  int a;
  loop(i,0,n) {
    int prev_id = -1;
    loop(j,1,n) {
      cin >> a;
      a--;
      int id = ids[i][a];
      if (prev_id == -1) {
        prev_id = id;
        continue;
      }
      G[prev_id].push_back(id);
      prev_id = id;
    }
  }

  int ans = 0;
  loop(i,0,m) {
    int ret = dfs(i);
    if (ret == -1) { cout << -1 << endl; return; }
    chmax(ans, ret);
  }

  cout << ans << endl;
}


Measured memory_bytes: 33792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

ll rui(ll a,ll n){
  ll ans=1;
  while(n>0){
    if(n&1) ans=ans*a%mod;
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

int main(){
  int n,m; cin >> n >> m;
  int x=1900*m+100*(n-m);
  int y=rui(2,m);
  cout << x*y << endl;
}
  

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

using namespace std;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX = 1e9 + 5;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i=0; i<k; i++) ans += a[i];
    cout << ans << "\n";
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int x;
int f;
int main()
{
	cin>>x;
	int t = x;
	while(t) {
		f += t%10;
		t /= 10;
	}
	if(x%f==0)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
flag = 0
for i in range(0, N+1):
    for j in range(0, N - i + 1):
        k = N - i - j
        if 10000 * i + 5000 * j + 1000 * k == Y:
            flag = 1
            print(i, j, k)
            break
    if flag == 1:
        break
if flag == 0:
    print('-1 -1 -1')

Measured memory_bytes: 40684
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int L[110];

signed main(void) {
    int N; cin >> N;
    rep(i, N) {
        cin >> L[i];
    }
    bool flag = true;
    rep(i, N) {
        int sum = 0;
        rep(j, N) {
            if (i != j) sum += L[j];
        }
        if (L[i] >= sum) flag = false;
    }
    cout << ((flag) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

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

    ll x=pow(2,n),y;
   multiset<ll> s;

    for(ll i=0;i<x;i++)
    	{cin>>y;
    		s.insert(y);
    	}

    bool f=1;

    auto it=s.end();
    it--;

   multiset<ll> check;
    check.insert(*it);
    s.erase(it);

    while(!s.empty() and f!=0)
    {
    	multiset<ll> temp;
    	for(auto j:check)
    	{
    		auto itr=s.lower_bound(j);
    		if(itr==s.begin())
    			{
    				f=0;
    				break;
    			}
    		else
    		{
    			itr--;
    			temp.insert(*itr);
    			s.erase(itr);
    		}
    	}

    	if(f)
    	{
    		for(auto j:temp)
    			check.insert(j);
    	}
    	else break;
    }

    if(f)
    	cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 18688
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////

void solve(){
  inl(Q,H,S,D);
  inl(N);
  H = min(H , Q * 2);
  S = min(S , H * 2);
  D = min(D , S * 2);
  out( (N / 2) * D + (N & 1) * S);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W,N;
  cin >> H>>W>>N;
  int num;
  if(N%max(H,W)!=0){
    num=N/max(H,W)+1;
  }
  else{
    num=N/max(H,W);
  }
  cout << num <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k;scanf("%d",&k);
    int sum=0;
    for(int i=1;i<=k;i++)
    {
        sum=(sum*10+7)%k;
        if(sum==0)
        {
            printf("%d\n",i);
            return 0;
        }
    }
    printf("-1\n");
}


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

int main() {
  string S;
  int K;
  cin >> S >> K;

  int64_t min = 0;

  if (S.size() == 1) {
    min += K / 2;
  }

  if (S.size() > 1) {
    map<int64_t, int64_t> a;
    int64_t seqence_counter = 0;
    a[seqence_counter] = 1;
    for (int i = 1; i < S.size(); i++) {
      if (S[i - 1] == S[i]) {
        a[seqence_counter]++;
      }
      else {
        seqence_counter++;
        a[seqence_counter] = 1;
      }
    }

    if (seqence_counter > 1) {
      min += a[0] / 2;
      min += a[seqence_counter] / 2;

      for (int i = 1; i < seqence_counter; i++) {
        min += (a[i] / 2) * K;
      }

      if (K > 1) {
        if (S[S.size() - 1] == S[0]) min += ((a[0] + a[seqence_counter]) / 2) * (K - 1);
        else {
          min += (a[0] / 2) * (K - 1);
          min += (a[seqence_counter] / 2) * (K - 1);
          }
        }
      }

      else if (seqence_counter == 1) {
        min += (a[0] / 2 + a[1] / 2) * K;
      }
      else if (seqence_counter == 0) {
        min += (S.size() * K) / 2;
      }
    }

    cout << min << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = sc.nextLine().toCharArray().map { it.toString().toInt() - 1 }
    var parity = 0
    for (i in 0 until n) {
        if (n - 1 == (i or (n - 1 - i))) {
            parity += a[i]
        }
    }
    if (parity % 2 == 1) {
        println(1)
        return
    }
    if (a.contains(1)) {
        println(0)
        return
    }
    val b = a.map { it / 2 }
    parity = 0
    for (i in 0 until n) {
        if (n - 1 == (i or (n - 1 - i))) {
            parity += b[i]
        }
    }
    if (parity % 2 == 1) {
        println(2)
    } else {
        println(0)
    }
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 56656