akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int64_t> a(n);
	for (int i = 0; i < n; i++) cin >> a.at(i);
	int64_t ans = 0;
	bool out = true;
	while (out) {
		for (int i = 0; i < n; i++) {
			if (a.at(i) % 2 == 0) a.at(i) /= 2;
			else {
				out = false;
			}
		}
		ans++;
	}
	cout << ans - 1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    double a, b, c, d, e, f;
    double x, y;
    while (scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF) {
    	y = (c*d-f*a) / (b*d-e*a);
    	if (isnan(y)) y=0; 
    	x = (c-b*y) / a;
    	if (isnan(x)) x=0;
    	
    	printf("%.3f %.3f\n", x, y);
    }
}

Measured memory_bytes: 1080
use std::collections::HashSet;

fn main() {
    let n = read::<usize>();
    let mut set: HashSet<u32> = HashSet::new();

    for _ in 0..n {
        let d = read::<u32>();
        set.insert(d);
    }

    println!("{}", set.len());
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  ll n, m; cin >> n >> m;
  vector<ll> x(n);
  for(int i=0;i<n;++i) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  vector<ll> v(m), odd(m);
  ll now = x[0];
  ll cnt = 1;
  for(int i=1;i<n;++i) {
    if(x[i] == x[i-1]) {
      cnt++;
    } else {
      v[now%m] += cnt;
      odd[now%m] += cnt % 2;
      now = x[i];
      cnt = 1;
    }
  }
  v[now%m] += cnt;
  odd[now%m] += cnt % 2;
  ll ans = n;
  ans -= odd[0]%2;
  for(int i=1;i<=m/2;++i) {
    if(i * 2 == m) {
      ans -= odd[i]%2;
    } else {
      if(odd[i] > odd[m-i]) {
        odd[i] -= odd[m-i];
        ans -= odd[i] % 2;
        odd[i] -= odd[i] % 2;
        ans -= max(0ll, odd[i] - (v[m-i] - odd[m-i]));
      } else if(odd[m-i] > odd[i]) {
        odd[m-i] -= odd[i];
        ans -= odd[m-i] % 2;
        odd[m-i] -= odd[m-i] % 2;
        ans -= max(0ll, odd[m-i] - (v[i] - odd[i]));
      }
    }
  }
  cout << ans / 2 << endl;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
  int a, b;
  cin >> a >> b;
  cout << max(0, a-2*b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>

using namespace std;

#define f first
#define s second

const int MAXN = 3e3 + 3;
const long long MOD = 998244353;

long long dp[MAXN][MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (long long i = a; i <= c; i++) {
        if (i != a)
            dp[i][b] = (dp[i - 1][b] * b) % MOD;
        for (long long j = b + 1; j <= d; j++) {
            dp[i][j] = (dp[i - 1][j] * j + dp[i][j - 1] * i - dp[i - 1][j - 1] * ((i - 1) * (j - 1) % MOD)) % MOD;
            dp[i][j] = (dp[i][j] + MOD * MOD) % MOD;
        }
    }
    cout << dp[c][d];
    return 0;
}


Measured memory_bytes: 73952
#include <queue>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

const int vec[] = {1, -1, 4, -4};

map<string, int> visited;
typedef pair<string, int> node;
// 何度も探索したら間に合わないので，完成形から逆にたどって全ての手数を列挙する
int solve() {
	queue<node> que;
	que.push(node("01234567", 0));
	visited["01234567"] = 0;
	while (!que.empty()) {
		node current = que.front();
		que.pop();
		int zero = current.first.find("0");
		for (int i = 0; i < 4; i++) {
			int next_z = zero + vec[i];
			if(0 <= next_z && next_z <= 7
					&& !((zero == 3 && next_z == 4)	// 3で右は無理
						|| (zero == 4 && next_z == 3))) // 4で左は無理
			{
				string next = current.first;
				swap(next[zero], next[next_z]);
				if(visited.find(next) == visited.end()) {
					visited[next] = current.second + 1;
					que.push(node(next, current.second + 1));
				}
			}
		}
	}
	return -1;
}

int main () {
	solve();
	while (true) {
		string str;
		getline(cin, str);
		if (cin.eof()) break;
		string::iterator end_it = remove(str.begin(), str.end(), ' ');
		str.erase(end_it, str.end());
		// 列挙したのを返すだけ
		cout << visited[str] << endl;
	}
	return 0;
}

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

int main() {

	int r[3] = {0, 0, 0};
	int h;

	for(int i = 0; i < 10; i++){
		cin >> h;
		if(h > r[0]){
			r[2] = r[1];
			r[1] = r[0];
			r[0] = h;
		}else if(h > r[1]){
			r[2] = r[1];
			r[1] = h;
		}else if(h > r[2]){
			r[2] = h;
		}
	}

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

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define MOD  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
#define all(x) x.begin(),x.end()
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    int n,m;cin>>n>>m;
    int a[1111],b[1111];
    vector<int>v;
    rep(i,0,n){
        cin>>a[i];
        v.ps(a[i]);
    }sort(all(v));
    rep(i,0,m)cin>>b[i];
    int acnt=0,bcnt=0;
    vector<int>c;
    rep(i,0,n)c.ps(a[i]);
    rep(i,0,m)c.ps(b[i]);
    sort(all(c));
    sort(a,a+n);sort(b,b+m);
    reverse(a,a+n);reverse(b,b+m);
    //rep(i,0,n)cout<<a[i]<<" ";cout<<endl;
    //rep(i,0,m)cout<<b[i]<<" ";cout<<endl;
    int ai=0,bi=0;
    int ans=1,cnt=0;
    int k=0;
    for(int i=n*m;i>0;i--){
        while(a[ai]>=i&&ai<n){
            acnt++;ai++;
        }
        while(b[bi]>=i&&bi<m){
            bcnt++;bi++;
        }
        cnt=acnt*bcnt;
        //cout<<cnt<<endl;
        int ju=upper_bound(all(c),i)-lower_bound(all(c),i);
        int au=upper_bound(all(v),i)-lower_bound(all(v),i);
        if(ju>=3||au>=2||(ju-au)>=2){
            cout<<0<<endl;return 0;
        }
        else if(ju==2)ans*=1;
        else if(ju==1){
            if(au)(ans*=bcnt)%=mod;
            else (ans*=acnt)%=mod;
        }
        else (ans*=cnt-(n*m-i))%=mod;
       //cout<<i<<" "<<ans<<endl;
    }
    cout<<ans<<endl;return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

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

		int d = a / b;
		int r = a % b;
		double f = (double) a / b;
		BigDecimal src = BigDecimal.valueOf(f);
		src = src.setScale(6, BigDecimal.ROUND_DOWN);

		System.out.println(d + " " + r + " " + src);

	}

}



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

int main(void) {
  ios::sync_with_stdio(false);
  unordered_map<int, int> problems;
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int D;
    cin >> D;
    ++problems[D];
  }

  bool OK = true;
  int M;
  cin >> M;
  for (int i = 0; i < M; ++i) {
    int T;
    cin >> T;
    if (problems[T] == 0) OK = false;
    --problems[T];
  }
  cout << (OK ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 8520
//    https://youtu.be/zRIbf6JqkNc

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

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))

#define mx 300000

struct info {
    ll prop, sum;
} tree[mx * 3];

void init(ll node, ll b, ll e)
{
    if (b == e) {
        tree[node].sum = tree[node].prop= 0;
        return;
    }
    ll Left = node * 2;
    ll Right = node * 2 + 1;
    ll mid = (b + e) / 2;
    init(Left, b, mid);
    init(Right, mid + 1, e);
    tree[node].sum = 0;
    tree[node].prop =0;
}


void update(ll node, ll b, ll e, ll i, ll j, ll x)
{
    if (i > e || j < b)
        return;
    if (b >= i && e <= j)
    {
        tree[node].sum += ((e - b + 1) * x);
        tree[node].prop += x;
        return;
    }
    ll Left = node * 2;
    ll Right = (node * 2) + 1;
    ll mid = (b + e) / 2;
    update(Left, b, mid, i, j, x);
    update(Right, mid + 1, e, i, j, x);
    tree[node].sum = tree[Left].sum + tree[Right].sum + (e - b + 1) * tree[node].prop;
}

ll query(ll node, ll b, ll e, ll i, ll j, ll carry )
{
    if (i > e || j < b)
        return 0;

    if (b >= i and e <= j)
        return tree[node].sum + carry * (e - b + 1);

    ll Left = node << 1;
    ll Right = (node << 1) + 1;
    ll mid = (b + e) >> 1;

    ll p1 = query(Left, b, mid, i, j, carry + tree[node].prop);
    ll p2 = query(Right, mid + 1, e, i, j, carry + tree[node].prop);

    return p1 + p2;
}


int main(){
    fast;
    ll t,n,m,i,j,k,temp,flag,ans,d,a,bal;
    cin>>n>>d>>a;
    init(1,1,n);
    vector<pair<ll,ll> >v(n+1);
    for(i=1;i<=n;i++){
        cin>>v[i].ff>>v[i].ss;
    }
    auto it=v.begin();
    it++;
    sort(it,v.end());
    for(i=1,ans=0;i<=n;i++){
        bal=query(1,1,n,i,i,0);
        bal=v[i].ss-(bal*a);
        if(bal<=0){
            continue;
        }
        pair<ll,ll> p = {(v[i].ff+(2*d)),100000000000};
        temp=upper_bound(it,v.end(),p)-v.begin();
        temp--;
        update(1,1,n,i,temp,(bal+a-1)/a);
        ans+=((bal+a-1)/a);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 13568
#include<cstring>
#include<algorithm>
#include<cstdio>
#define N 100005
long long int a[N];
int n;
long long int ans=0;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
}
for(int i=1;i<=n;i++){
if(i%2)ans+=a[i];
else ans-=a[i];
}

for(int i=1;i<=n;i++){
long long int x=2*a[i]-ans;
printf("%lld ",ans);
ans=x;
}

}

Measured memory_bytes: 2488
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    FOR(i, 1, 1e8){
        if ((N - i) % i == 0 && (N - i) / i > i) {
            ans += (N - i) / i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Author: Arham_doshi
@quote "Code like there's no tommorow!"
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
#include <bits/stdc++.h>

#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define piii           pair<int,pair<int,int> >
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define ef else if



using namespace std;

int gcd(int a, int b) {  if (a == 0)  return b; return gcd(b % a, a); }  
bool mod(double a,double b) {return a/b - floor(a/b);}

int occurs(vi v,int n){
auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}

int logb(int base, int x) {
    return (log(x) / log(base));
}



signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int i,j,x,a,b,c;
    cin>>a;
    b=0;
    fo(i,1,a+1){
        if(i<10||(i>99&&i<1000)||(i>9999&&i<100000))b++;
    }
    cout<<b;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int N;
    string A, B, C;
    char target[N];
    int answer = 0;
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++)
    {
        if(B[i] == C[i])
        {
            target[i] = B[i];
        }
        else
        {
            target[i] = A[i];
        }
    }
    for(int i = 0; i < N; i++)
    {
        if(A[i] != target[i])
        {
            answer++;
        }
        if(B[i] != target[i])
        {
            answer++;
        }
        if(C[i] != target[i])
        {
            answer++;
        }
    }
    cout << answer;
    
    return 0;
}

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


int main(void){
    // Your code here!
    ll N,c=0;
    cin>>N;
    ll H[N];
    rep(0,i,N)cin>>H[i];
    rep(0,i,N-1){
        if(H[N-i-1]-H[N-i-2]<-1){
            cout<<"No"<<endl;
            return 0;
        }else if(H[N-i-1]-H[N-i-2]==-1){
            --H[N-i-2];
        }
    }
    rep(0,i,N-1){
        if(H[i+1]-H[i]<0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0; i<N; i++)

using namespace std;

int main(){
  int n; cin >> n;
  vector<int> b(n-1);
  rep(i,n-1) cin >> b[i];

  int ans = 0;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
      if(i == 0) a[i] = b[i];
      else if(i == n-1) a[i] = b[i-1];
      else a[i] = min(b[i],b[i-1]);
//      cout << a[i] << endl;
      ans += a[i];
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            :oyhhhhhhyo:    
#define next         .sdNNNmNNNNNNNmds. 
#define y0          -hNNNNy`yNNNNNN`/Nh-
#define y1          mNNNNNd+dNNNNNN+sNNm
#define yn          mNNNNNNNNy--:smNNNms
#define tm          .+oooooosyysooooo+- 
#define read               :yhy/        
#define rank              :mNmo         
#define index              ... 
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 111;
int a[N];
int n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    double sum = 0;
    rep(i, 1, n) {
        cin >> a[i];
        sum += 1. / a[i];
    }
    double ans = 1. / sum;
    cout << fixed << setprecision(13) << ans << endl;
    return 0;
}


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

int main(int argc, char const *argv[])
{
    int A;
    int B;
    cin >> A >> B;

    if (A == 1)
    {
        A = 14;
    }

    if (B == 1)
    {
        B = 14;
    }
    if (A == B)
    {
        cout << "Draw";
    }
    else

        if (A > B)
    {
        cout << "Alice";
    }
    else
    {
        cout << "Bob";
    }

    return 0;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int>v(n);
  rep(i,n) v.at(i) = s.at(i)-'0';
  vector<int>cntv(10,0);
  rep(i,n) cntv.at(v.at(i))++;
  int cnt = 0;
  rep(i,10){
      if(cntv.at(i) == 0) continue;
      rep(j,10){
          if(cntv.at(j) == 0) continue;
          rep(k,10){
              if(cntv.at(k) == 0) continue;
              int a = -1;
              int b = -1;
              int c = -1;
              rep(l1,n){
                  if(v.at(l1) == i){
                      a = l1;
                      break;
                  }
              }
              if(a == -1) continue;
              for(int l2 = a+1; l2 < n; l2++){
                  if(v.at(l2) == j){
                      b = l2;
                      break;
                  }
              }
              if(b == -1) continue;
              for(int l3 = b+1; l3 < n; l3++){
                  if(v.at(l3) == k){
                      c = l3;
                      break;
                  }
              }
              if(c == -1) continue;
              cnt++;
          }
      }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

int main()
{
    int n, q;
    std::cin >> n >> q;

    std::vector<std::vector<int>> edges(n);

    for (int i = 0; i < n - 1; i++) {
        int a, b;
        std::cin >> a >> b;
        a--;
        b--;

        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    std::vector<long long> values(n, 0);

    for (int i = 0; i < q; i++) {
        int p, x;
        std::cin >> p >> x;
        p--;

        values[p] += x;
    }

    auto dfs = [&](auto f, int idx, int parent) -> void {
        for (auto edge : edges[idx]) {
            if (edge == parent) {
                continue;
            }

            values[edge] += values[idx];
            f(f, edge, idx);
        }
    };

    dfs(dfs, 0, -1);

    for (auto value : values) {
        std::cout << value << std::endl;
    }
}


Measured memory_bytes: 21888
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    int[] n = new int[s.length()];
    for (int i = 0; i <s.length(); i++) {
      n[i] = (int) (s.charAt(i) - 'a');
    }
    int[] m = new int[26];
    for (int i = 0; i < s.length(); i++) {
      m[n[i]]++;
    }
    for (int i =0; i < m.length; i++) {
      if (m[i] == 0) {
        System.out.println((char) (i + 'a'));
        return;
      }
    }
    System.out.println("None");
  }
}

Measured memory_bytes: 26132
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int a,b,c,d=0,e=0;
signed main(){
	cin>>a>>b;
	if(a%b==0){
		cout<<0;
	}else{
		cout<<1;
	}
}

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

#define endl "\n"
#define ioss ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
//#define int long long

typedef  long long ll;

using namespace std;


int main()
{
	ioss	
	int h,n;cin>>h>>n;
  vector<int>v(n);ll sum=0;
  for(int i=0;i<n;i++)
  {
    cin>>v[i];sum=sum+v[i];
  }
  if(sum>=h)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
	return 0;
}














Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;
	if ((c >= a) && (c <= b)) cout << "Yes";
	else cout << "No";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#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<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

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

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

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

int x,y,z,t1,t2,t3;

int num(string t)
{
	return t[0]*100+t[1]*10+t[2];
}

int main()
{
	FAST;

	string s,t;
	cin >> s;
	int ans = INT_MAX;
	rep(i,s.length()-2) 
	{
		t = s.substr(i,3);
		int u = atoi(t.c_str());
		int diff = abs(753-u);
		if (diff < ans) ans = diff;
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
use proconio::*;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    };
    let f = |n: usize| -> usize {
        let mut res = 0;
        for &v in &a {
            res += (v - 1) / n;
        }

        res
    };
    let mut l = 1;
    let mut r = 1 << 50;
    let mut ans = 0;

    while l < r {
        let m = (r - l) / 2 + l;
        let t = f(m);

        if k < t {
            l = m + 1;
        } else {
            r = m;
        }

        ans = l;
    }

    println!("{}", ans);
}


Measured memory_bytes: 5384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int a = in.nextInt();
			int b = in.nextInt();
			int c = in.nextInt();
			int d = in.nextInt();

			int[] imos = new int[110];
			imos[a]++;
			imos[b+1]--;
			imos[c]++;
			imos[d+1]--;

			for (int i = 1; i < 101; i++) {
				imos[i] += imos[i-1];
			}

			int ans = 0;
			for (int l : imos) {
				if (l > 1) ans++;
			}

			out.println(Math.max(ans-1, 0));

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

int main() {
	string str;
	int ans = 0;
	cin >> str;
	int n = str.size();
	vector<int> s(n);
	rep(i,n) {
		if (str[i] == 'A' || str[i] == 'C' || str[i] == 'G' || str[i] == 'T') s[i] = 1;
		else s[i] = 0;
	}
	if (n == 1) {
		if (s[0]) cout << 1;
		else cout << 0;
		return 0;
	}
	int count = 0;
	rep(i,n-1) {
		if (s[i] && s[i+1]) count++;
		if (s[i] && !s[i+1]) {
			count++;
			if (ans < count) ans = count;
			count = 0;
		}
		if (i == n - 2 && s[i+1]) {
			count++;
			if (ans < count) ans = count;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,m,n) for(ll i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

    int n,x,t;
    cin>>n>>x>>t;

    cout<<t*((n+x-1)/x)<<endl;

    

    



    

}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<sstream>
typedef long long LL;
using namespace std;

LL a[3010];
int main()
{
    int n;
    scanf("%d",&n);
    int s=0;
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]),s+=a[i]-1;

    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define Sort(v) sort(v.begin(), v.end())
#define INF 0x3f3f3f3f
#define For(m) for (auto it = m.begin(); it != m.end(); it++)
#define mod 1000000007
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
using namespace std;


int main()
{
    fast
  ll n;
  cin >> n;
  ll arr[3][n];
  fr(i,0,n)
  {
      cin >> arr[0][i];
      cin >> arr[1][i];
      cin >> arr[2][i];
  }
  ll dp[n][3];
  dp[0][0]=arr[0][0];
  dp[1][0]=arr[1][0];
  dp[2][0]=arr[2][0];
  fr(i,1,n)
  {
      dp[0][i]=max(dp[1][i-1]+arr[0][i],dp[2][i-1]+arr[0][i]);
      dp[1][i]=max(dp[0][i-1]+arr[1][i],dp[2][i-1]+arr[1][i]);
      dp[2][i]=max(dp[0][i-1]+arr[2][i],dp[1][i-1]+arr[2][i]);
  }
 // n=1;
  cout << max(max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]);
  return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> wa(n+1);
    vector<bool> ac(n+1, false);
    int ans_wa = 0, ans_ac = 0;
    rep(i,m){
        int p;
        string s;
        cin >> p >> s;
        if(s == "WA") wa[p]++;
        else{
            if(!ac[p]){
                ans_wa += wa[p];
                ac[p] = true;
                ans_ac++;
            }
        }
    }
    cout << ans_ac << ' ' << ans_wa << endl;
}

Measured memory_bytes: 3760
#import<bits/stdc++.h>
int m,a,b['   '],i,j,r;int main(){for(;~scanf("%d%d",&a,b+i);++i)i?a<m?:m=a:r=*b;for(std::sort(b+1,b+ ++i);--i;r=fmin(r,fmax(j,++j+(m-1+*b)/m)))*b-=b[i];printf("%d\n",r);}

Measured memory_bytes: 640
n = int(input())
def check(i):
    sqrt = round(i ** 0.5 + 0.5)
    for j in range(2, sqrt + 1):
        if not i % j:
            return False
    return True
while True:
    if n == 2:
        print(2)
        break
    if check(n):
        print(n)
        break
    n += 1

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define N 510
#define int long long
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const int INF = 1LL<<55;
int n;
vector<P> G[N];
int A,B,C;

int dijkstra(int start,int goal,int v0,int flg = 1){
  vector<vector<int> > D(n,vector<int>(C,INF));
  priority_queue<PP,vector<PP>,greater<PP> >Q;
  D[start][v0] = 0;
  Q.push(PP(0,P(start,v0)));

  int res = INF;
  while(!Q.empty()){
    PP t = Q.top();Q.pop();
    int cost = t.first;
    int pos = t.second.first;
    int v = t.second.second;
    //cout<<flg<<" " <<pos<<" "<<cost<<" "<<v<<endl;
    if(D[pos][v] < cost) continue;
    
    if(pos == goal){
      if(flg == 1) res = min(res, cost + dijkstra(goal,start,v,0));
      if(flg == 0) return cost;
    }
    
    for(int i=0;i<G[pos].size();i++){
      int npos = G[pos][i].first;
      int ncost = cost + v * G[pos][i].second;
      int nv = (A*v+B)%C;
      if(D[npos][nv]<=ncost) continue;
      Q.push(PP(ncost,P(npos,nv)));
      D[npos][nv] = ncost;
    }
  }
  return res;
}


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

  for(int i=0;i<m;i++){
    int a,b,t;
    cin>>a>>b>>t;a--,b--;
    G[a].push_back(P(b,t));
    G[b].push_back(P(a,t));
  }
  int v0;
  cin>>v0;
  cin>>A>>B>>C;
  cout<<dijkstra(0,n-1,v0)<<endl;
}

Measured memory_bytes: 11508
fn main() {
    let n = {
        let mut inputline = String::new();
        std::io::stdin().read_line(&mut inputline).ok();
        inputline.trim().parse::<usize>().unwrap()
    };
    let sortedd:Vec<usize> = {
        let mut inputline=String::new();
        std::io::stdin().read_line(&mut inputline).ok();
        let mut d:Vec<usize> = inputline.split_whitespace().map(|x|x.parse::<usize>().unwrap()).collect();
        d.sort();
        d
    };
    let count =  sortedd[n/2]  - sortedd[n/2 -1];
    println!("{}",count);
}


Measured memory_bytes: 6396
#include<iostream>
using namespace std;
int main()
{
    int n,m,i,j,h;
    cin>>n>>m;
    char a[101][101];
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            h=0;
            if(a[i][j]=='#') cout<<"#";
            else if(a[i][j]=='.')
            {
                if(a[i-1][j]=='#') h++;
                if(a[i+1][j]=='#') h++;
                if(a[i][j-1]=='#') h++;
                if(a[i][j+1]=='#') h++;
                if(a[i-1][j-1]=='#') h++;
                if(a[i-1][j+1]=='#') h++;
                if(a[i+1][j-1]=='#') h++;
                if(a[i+1][j+1]=='#') h++;
                cout<<h;
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
#define SIZE 200000
class unionfind
{
public:
	int par[SIZE];
	int ran[SIZE];
	int ren[SIZE];
	void init()
	{
		for(int i=0;i<SIZE;i++)
		{
			par[i]=i;
			ran[i]=0;
			ren[i]=1;
		}
	}
	int find(int a)
	{
		if(a==par[a])return a;
		else return par[a]=find(par[a]);
	}
	void unite(int a,int b)
	{
		a=find(a);
		b=find(b);
		if(a==b)return;
		if(ran[a]>ran[b])
		{
			par[b]=a;
			ren[a]+=ren[b];
		}
		else
		{
			par[a]=b;
			ren[b]+=ren[a];
		}
		if(ran[a]==ran[b])ran[b]++;
	}
};
unionfind uf;
typedef long long ll;
typedef pair<ll,ll>pii;
map<ll,vector<pii> >ma;
int main()
{
	uf.init();
	int num,query;
	scanf("%d%d",&num,&query);
	for(int i=0;i<query;i++)
	{
		int za,zb,zc;
		scanf("%d%d%d",&za,&zb,&zc);
		ma[zc].push_back(make_pair(za,zb));
		ma[zc+1].push_back(make_pair((za+1)%num,zb));
		ma[zc+2].push_back(make_pair((za+1)%num,(zb+1)%num));
		ma[zc+3].push_back(make_pair((za+2)%num,(zb+1)%num));
	}
	map<ll,vector<pii> >::iterator it=ma.begin();
	ll ret=0;
	for(;;)
	{
		if(it==ma.end())break;
		pair<ll,vector<pii> >z=*it;
		it++;
		for(int i=0;i<z.second.size();i++)
		{
			if(uf.find(z.second[i].first)!=uf.find(z.second[i].second))
			{
				uf.unite(z.second[i].first,z.second[i].second);
				ma[z.first+2].push_back(make_pair((z.second[i].first+1)%num,(z.second[i].second+1)%num));
				ma[z.first+4].push_back(make_pair((z.second[i].first+2)%num,(z.second[i].second+2)%num));
				ret+=z.first;
			}
		}
	}
	printf("%lld\n",ret);
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back


int main()
{
    ll N, M, L;
    cin >> N >> M >> L;
    mat D(N, vec(N, INF));
    REP(i,0,M) {
        ll a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        D[a][b] = c;
        D[b][a] = c;
    }
    REP(i,0,N) D[i][i] = 0;
    ll Q;
    cin >> Q;
    vec s(Q), t(Q);
    REP(i,0,Q) {
        cin >> s[i] >> t[i];
        --s[i]; --t[i];
    }

    REP(k,0,N) {
        REP(i,0,N) {
            REP(j,0,N) {
                D[i][j] = MIN(D[i][j],D[i][k]+D[k][j]);
            }
        }
    }

    mat C(N, vec(N, INF));
    REP(i,0,N) {
        REP(j,0,N) {
            if(D[i][j] <= L) C[i][j] = 1;
        }
    }

    REP(k,0,N) {
        REP(i,0,N) {
            REP(j,0,N) {
                C[i][j] = MIN(C[i][j],C[i][k]+C[k][j]);
            }
        }
    }

    REP(i,0,Q) {
        if(C[s[i]][t[i]] < INF) PR(C[s[i]][t[i]]-1);
        else PR(-1);
    }

    return 0;
}

/*



*/

Measured memory_bytes: 6056
#include <bits/stdc++.h>
	typedef long long ll;
	using namespace std;
	int main(){
	
		int a[5];
        for(int i = 0 ; i < 5 ; i++)
          cin >> a[i];
        int k;
        cin >> k;
        for(int i = 0 ; i < 5 ; i++){
            for(int j = i + 1 ; j < 5 ; j++){
                if(abs(a[j] - a[i]) > k)
                {
                    cout << ":(" << endl;
                    return 0;
                }
            }
        }
        cout << "Yay!" << endl;
        return 0; 
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--) 

int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}   
 
signed main(){
    fast;
    int n,a,b;
    cin >> a>>b>>n;
    int i=min(n,b-1);
    cout << floor(a*i/b)-a*floor(i/b);
}

Measured memory_bytes: 3796
#include<stdio.h>

int main()
{
        char str[6];
        int i;
        int cnt;

        scanf("%s", str);

        cnt = 0;
        for(i=0; i<6; i++)
        {
                if(str[i]=='1')
                {
                        cnt++;
                }
        }

        printf("%d", cnt);

        return 0;
}




Measured memory_bytes: 128
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

const int MOD = 998244353;

void Main() {
    int n, s;
    cin >> n >> s;
    vi a(n);
    rep(i, n) cin >> a[i];
    
    vi dp(s+1);
    dp[0] = 1;

    rep(i, n){
        vi p(s+1);
        swap(p, dp);
        // p = old dp table
        // dp = new dp table
        rep(j, s+1){
            // T に選ばれない場合, U に選ばれない場合
            dp[j] = (dp[j] + (p[j]*2) % MOD) % MOD;
            // U に選ばれる場合
            if(j + a[i] <= s) dp[j + a[i]] = (dp[j + a[i]] + p[j]) % MOD;
        }
    }    
    cout << dp[s] << endl;
    return;
}

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


Measured memory_bytes: 3680
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>

using namespace std;

#define maxn 300010
#define abs(i) ((i)>=0?(i):-(i))
typedef long long ll;
ll n,ai[maxn],sum[maxn];

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

void solve1(int l,int r,ll &s1,ll &s2,ll s,int &md){
	int i;
	ll sum=ai[l];
	for(i=l+1;i<r;++i){
		if(sum+ai[i]>s)break;
		sum+=ai[i];
	}
	if(i==l+1){
		s1=sum+ai[i];s2=s-s1;md=i;
		return;
	}
	if(i+1==r){
		s1=sum-ai[i],s2=ai[r]+ai[i];md=r-2;
		return;
	}
	if(abs((s-sum))>abs((sum+ai[i]-s))){
		s1=sum+ai[i];md=i;
		s2=s-s1;
		return;
	}
	else{
		s1=sum;md=i-1;
		s2=s-sum;
		return;
	}
}

void solve2(int l,int r,ll &s1,ll &s2,ll s){
	int i;
	ll sum=0;
	for(i=l;i<=r;++i){
		if(sum+ai[i]>s)break;
		sum+=ai[i];
	}
	if(i==r){
		s1=sum-ai[i];s2=s-s1;return;
	}
	if(abs((sum-s))>abs((sum+ai[i]-s))){
		s1=sum+ai[i];s2=s-s1;
		return;
	}
	else{
		s1=sum;s2=s-s1;
		return;
	}
}

void bs(int l,int r,ll &s1,ll &s2,ll s){
	ll t1,t2;
	int mid,lp=l,rp=r;
	while(l<r){
		mid=(l+r)>>1;
		if(sum[mid]-sum[lp-1]<=s){
			if(l==mid)break;
			l=mid;
		}
		else r=mid;
	}
	t1=sum[l]-sum[lp-1];
	t2=sum[rp]-sum[l];
	if(l==rp-1){
		s1=t1;s2=t2;return;
	}
	if(abs((t1-t2))>abs((t2-ai[l+1]-t1-ai[l+1]))){
		s1=t1+ai[l+1];
		s2=t2-ai[l+1];
		return;
	}
	else{
		s1=t1;
		s2=t2;
		return;
	}
}


int main(){
#ifdef DEBUG
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	ll t1,t2,t3,t4,mx,mn,ans=0x7fffffffffff;
	n=readin();
	for(int i=1;i<=n;++i)ai[i]=readin(),sum[i]=sum[i-1]+ai[i];
	for(int i=2;i<n-1;++i){
		bs(1,i,t1,t2,sum[i]>>1);
		mx=max(t1,t2);
		mn=min(t1,t2);
		bs(i+1,n,t3,t4,(sum[n]-sum[i])>>1);
		mx=max(mx,max(t3,t4));
		mn=min(mn,min(t3,t4));
		ans=min(ans,mx-mn);
	}
	cout<<ans<<endl;
#ifdef DEBUG
	fclose(stdin);
	fclose(stdout);
#endif
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
void solve()
{
    int a,b;cin>>a>>b;
    if(a*b%2)cout<<"Odd"<<endl;
    else cout<<"Even"<<endl;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+10;
const ll inf = 1e9+7;
string s;
pair<int,int>p[maxn];
vector<char>ans;
int main() {
    ios::sync_with_stdio(0);
    int n,a[5];
    cin>>n>>a[0]>>a[1]>>a[2];
    for(int i=1; i<=n; i++) {
        cin>>s;
        p[i]= {s[0]-'A',s[1]-'A'};
    }
    for(int i=1; i<=n; i++) {
        int x = p[i].first;
        int y = p[i].second;
        if(a[x]==0&&a[y]==0) {
            cout<<"No"<<endl;
            return 0;
        }
        int d = x;
        if(a[x]==1&&a[y]==1) {
            if(i<n&&p[i+1].first==y||p[i+1].second==y)
                d =y;
        } else if(a[x]>=a[y])
            d=y;
        ans.push_back(d+'A');
        if(d==x)
            a[x]++,a[y]--;
        else
            a[y]++,a[x]--;
    }
    cout<<"Yes"<<endl;
    for(auto j:ans)
        cout<<j<<endl;
    return 0;
}


Measured memory_bytes: 4584
#include <stdio.h>

typedef struct { char suit, value; } Card;

void bubble(Card A[], int N) {
  int i,j;
  Card t;
  for(i = 0; i<N; i++) {
    for(j = N-1; j >= i; j--) {
      if(A[j].value < A[j-1].value) {
        t = A[j]; A[j] = A[j-1]; A[j-1] = t;
      }
    }
  }
}

void selection(Card A[], int N) {
  int i,j,minj;
  Card t;
  for(i=0;i<N;i++) {
    minj = i;
    for(j=i; j<N; j++) {
      if(A[j].value < A[minj].value) minj = j;
    }
    t = A[i]; A[i] = A[minj]; A[minj] = t;
  }
}

void print(Card A[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(i>0) printf(" ");
      printf("%c%d",A[i].suit,A[i].value);
  }
  printf("\n");
}

int isStable(Card C1[], Card C2[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
}

/* オリジナル関数を追加 */
void str2Card(Card *t,char str[]) {
    t->suit  = str[0];
    t->value = str[1] - '0';
}

int main(void) {
  Card C1[100], C2[100];
  int N,i;
  char str[3];

  scanf("%d",&N);
  for(i=0;i<N; i++) {
    scanf("%s",str);
    str2Card(&C1[i],str);
  }

  for(i=0; i<N; i++) C2[i] = C1[i];

  bubble(C1,N);
  selection(C2,N);

  print(C1,N);
  printf("Stable\n");
  print(C2,N);
  if(isStable(C1,C2,N)) {
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }

  return 0;
}


Measured memory_bytes: 2104
def main():
    import sys
    import collections
    input = sys.stdin.readline
    N = int(input())
    S = [input() for i in range(N)]
    c = collections.Counter(S)
    max_num = c.most_common(1)[0][1]
    c_most = list(c.most_common())
    ss = [cc[0] for cc in c_most if cc[1] == max_num]
    ss.sort()
    print("".join(ss))

if __name__ == "__main__":
    main()

Measured memory_bytes: 120360
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
const ll MOD=1e9+7;
using namespace std;

int main(){
  char s;
  cin >> s;
    if(s=='A') cout << "T" << endl;
    if(s=='T') cout << "A" << endl;
    if(s=='C') cout << "G" << endl;
    if(s=='G') cout << "C" << endl;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

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

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

    string s;
    cin >> s;
    if(s == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }

    vector<char> v(26);
    rep(i, 26){
        v[i] = 'a' + i;
    }

    rep(i, s.size()){
        auto result = find(all(v), s[i]);
        v.erase(result);
    }

    if(s.size() == 26){
      for (int i = 24; i >= 0; i--) {
      if (s[i] < s[i + 1]) {
        for (int j = s.size() - 1; j > i; j--) {
          if (s[i] < s[j]) {
            swap(s[i], s[j]);
            cout << s.substr(0, i + 1) << endl;
            return 0;
          }
        }
      }
      }
    }else{
        s.push_back(v[0]);
        cout << s << endl;
    }

    return 0;
}


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

public class Main {

    static class Question {
        String str;
        int[] arr;
        
        public String solve() {
            int len = str.length();
            String first = str.charAt(0)+"";
            String last = str.charAt(len-1)+"";
            return first+(len-2)+last;
        }
        
        public void main(FastScanner in, PrintWriter out) {
            str = in.next();
            out.println( solve() );
        }
        
        public void p(Object o) { System.out.print(o); }
        public void pl(Object o) { System.out.println(o); }
        public void arp(int[] o) { pl( Arrays.toString(o) ); }
        public void arpp(int[][] o) { 
            for (int i = 0; i < o.length; i++) {
                for (int j = 0; j < o[0].length; j++) { p( o[i][j] + " " ); } pl("");
            }
        }
    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Question q = new Question();
        q.main(in, out);
        out.close();
        in.close();
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try { st = new StringTokenizer(br.readLine()); } 
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        public void close() throws IOException { br.close(); }
    }
}

Measured memory_bytes: 21332
import math

x, k, d = map(int, input().split())
left = 0
right =k
x = abs(x)
while(left<right):
    mid = (left+right)//2
    if(x-(d*mid)<0):
        right = mid
    else:
        left = mid+1
low= int(left)
high = int(left-1)
v1 = abs(x-(low*d))
v2 = abs(x-(high*d))
if(k%2==0):
    if(v1<=v2):
        if(low%2==0):
            print(v1)
        else:
            print(v2)
    else:
        if(high%2==0):
            print(v2)
        else:
            print(v1)
else:
    if(v1<=v2):
        if(low%2==1):
            print(v1)
        else:
            print(v2)
    else:
        if(high%2==1):
            print(v2)
        else:
            print(v1) 

Measured memory_bytes: 62224