akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, rt<<1
#define Rson mid+1, R, rt<<1|1
const int maxn = 1e5 + 10;
using namespace std;
int n, m, k, t, h[maxn], tot, ans[maxn];
set<int>comp[maxn];
struct node
{
        int to, nxt, com;
} e[maxn << 2];
void add(int x, int y, int z)
{
        tot++;
        e[tot].to = y;
        e[tot].com = z;
        e[tot].nxt = h[x];
        h[x] = tot;
}
priority_queue<pair<int, int> >p;
int main()
{
        int i, j;
        while (scanf("%d %d", &n, &m) == 2)
        {
                //cout << n << " " << m << endl;
                for (int i = 1; i <= n; i++)
                {
                        h[i] = 0;
                        ans[i] = inf;
                        comp[i].clear();
                }
                tot = 0;
                while (m--)
                {
                        int a, b, c;
                        scanf("%d%d%d", &a, &b, &c);
                        add(a, b, c);
                        add(b, a, c);
                }
                p.push({0, 1});
                ans[1] = 0;
                while (!p.empty())
                {
                        int now = p.top().se, ca = -p.top().fi;
                        p.pop();
                        if (ans[now] < ca)
                        {
                                continue;
                        }
                        for (i = h[now]; i; i = e[i].nxt)
                        {
                                int to = e[i].to, to_com = e[i].com;
                                int to_ca = ca + (!comp[now].count(to_com));
                                if (ans[to] > to_ca)
                                {
                                        ans[to] = to_ca;
                                        p.push({ -to_ca, to});
                                        comp[to].clear();
                                        comp[to].insert(to_com);
                                }
                                else if (ans[to] == to_ca)
                                {
                                        comp[to].insert(to_com);
                                }
                        }
                }
                printf("%d\n", ans[n] == inf ? -1 : ans[n]);
        }
        return 0;
}

Measured memory_bytes: 20216
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	ll a[6],i,j,k;
	for(i=0;i<5;i++)
	cin>>a[i];
	cin>>k;
	ll flag=0;
	for(i=0;i<5;i++){
	    for(j=i+1;j<5;j++)
	    {
	        if(a[j]-a[i] > k)
	        {
	            cout<<":(";
	            flag=1;
	            break;
	        }
	    }
	    if(flag)
	    break;
	    
	}
	if(!flag)
	cout<<"Yay!";
    return 0;
}























Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll A[N], sumA[N+1];
  for(int i=0;i<N;++i) {
    cin>>A[i];
    sumA[i+1] = A[i];
  }
  for(int i=1;i<=N;++i) {
    sumA[i] += sumA[i-1];
    sumA[i] %= mod;
  }
  ll ans = 0;
  for(int i=0;i<N;++i) {
    ans += A[i]*(sumA[N]-sumA[i+1]+mod)%mod;
    ans %= mod;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 6728
import java.util.*;

class Main{

    int N;
    ArrayList<Integer> numList;

    void solve(){
	Scanner sc = new Scanner(System.in);
	while(true){
	    N = sc.nextInt();
	    if(N==0) break;

	    numList = new ArrayList<Integer>();
	    for(int i=1; i*i<=N && i<N; i++){
		if(N%i==0){
		    if(!numList.contains(i)) numList.add(i);
		    if(N/i!=N && !numList.contains(N/i)) numList.add(N/i);
		}
	    }

	    long sum = 0;
	    for(int i=0; i<numList.size(); i++)sum += numList.get(i);

	    String ans = "perfect number";
	    if(sum>N){
		ans = "abundant number";
	    }else if(sum<N){
		ans = "deficient number";
	    }

	    System.out.println(ans);
	}
    }

    public static void main(String[] args){
	new Main().solve();
    }
}

Measured memory_bytes: 12000
import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main {

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }
 
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }
 
        public int nextInt() {return Integer.parseInt(next());}
 
        public long nextLong() {return Long.parseLong(next());}
 
        public double nextDouble() {return Double.parseDouble(next());}
 
        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }
 
    public static void main(String[] args) throws IOException {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int cnt = 0;
        for(int i=0;i<n;i++) {
            int t = sc.nextInt();
            if(t < a || t >= b) cnt++;
        }

        pw.println(cnt);
        pw.close();
    }
}   



Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <set>
#include <list>
#include <queue>
#include <utility>
#include <algorithm>
#include <functional>
#include <bitset>
#include <array>
#include <stdlib.h>
#include <thread>
#include <chrono>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <fenv.h>
using namespace std;


long long cal(int w, int h, int* p, int *q)
{
    std::sort(p, p+w);
    std::sort(q, q+h);
    long long mulq = w +1;
    long long mulp = h+ 1;
    int pi = 0;
    int qi = 0;
    long long res = 0;
    while (pi < w && qi < h) {
        if (p[pi] < q[qi]) {
            res += p[pi] * mulp;
            mulq--;
            pi++;
        } else {
            res += q[qi] * mulq;
            mulp--;
            qi++;
        }
    }
    
    while (qi < h) {
            res += q[qi] * mulq;
            mulp--;
            qi++;
    }
    
    while (pi < w) {
            res += p[pi] * mulp;
            mulq--;
            pi++;
    }
    return res;
}


int main()
{
    int w, h;
    std::cin>>w>>h;
    int *p = new int[w];
    int *q = new int[h];
    for(int i=0; i<w; ++i)
        cin>>p[i];
    for(int i=0; i<h; ++i)
        cin>>q[i];
    long long res = cal(w, h, p, q);
    delete []p;
    delete []q;
    std::cout << res << std::endl;
    
    return 0;
}


Measured memory_bytes: 1024
X, N = map(int, input().split())
p = list(map(int, input().split()))
q = set(range(-1, 102))
r = list(q - set(p))
r.sort()
max = 1000
ans = X

if N == 0:
    print(X)
else:
    for i in r:
        if abs(X - i) < max:
            max = abs(X - i)
            ans = i

    print(ans)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,M;
  cin>>N>>M;
  
  vector<vector<int>> num(M,vector<int>(2));
  for(int i=0;i<M;i++){
    cin>>num[i][0]>>num[i][1];
  }
  
  vector<int> check(N);
  
  
  for(int i=0;i<M;i++){
    check[num[i][0]-1]++;
    check[num[i][1]-1]++;
  }
  
  
  for(int i=0;i<N;i++){
    cout<<check[i]<<endl;
  }
}

Measured memory_bytes: 3588
#include<stdio.h>
int main()
{
	int n,k,x,y;
	scanf("%d%d",&n,&k);
	while(k--)
	{
		scanf("%d%d",&x,&y);
		if(x*2>=n)x=n-x+1;
		if(y*2>=n)y=n-y+1;
		printf("%d\n",(x<y?x-1:y-1)%3+1);
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
S = [input() for i in range(n)]
ans = ""
for i in range(97,123):
    min_count = 51
    for e in S:
        if e.count(chr(i)) < min_count:
            min_count = e.count(chr(i))
    ans += chr(i) * min_count
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long N,A,B,C,D,E,m;
  cin >> N >> A >> B >> C >> D >> E;
  m=min(N,min(A,min(B,min(C,min(D,E)))));
  if(N%m==0)
    cout << 4+N/m << endl;
  else
    cout << 5+N/m << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	std::string S;
	in >> S;
	out << (S <= "2019/04/30" ? "Heisei" : "TBD") << std::endl;
}


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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define endl "\n"
#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

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

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

  ll n,a,b;
  cin >> n >> a >> b;

  ll min = a*(n-1) + b;
  ll max_val = b*(n-1) + a;

  cout << max(max_val-min +1,0LL) << endl;

  return 0;
}


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

xl = [0]*n
yl = [0]*n
hl = [0]*n


for i in range(n):
    xl[i], yl[i], hl[i] = map(int, input().split())
    if hl[i] >= 1:
        si = i

ansx, ansy, ansh = -1, -1, -1

for cx in range(101):
    for cy in range(101):
        H = hl[si]+abs(xl[si]-cx)+abs(yl[si]-cy)
        flag = True
        for i in range(n):
            hi = max(H-abs(xl[i]-cx)-abs(yl[i]-cy), 0)
            if hi != hl[i]:
                flag = False
                break
        if flag:
            ansx, ansy, ansh = cx, cy, H
print(ansx, ansy, ansh)


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    ll a,b,ans;
    cin >> a >> b;
    if(a+b<24) ans = a+b;
    else ans = a+b-24;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  ll n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

  ll ans = 0;

  while (1) {
    int cnt = 0;
    while (cnt < n) {
      int start = cnt;
      while (h[cnt] != 0 && cnt < n) {
        h[cnt]--;
        cnt++;
      }

      if (cnt-start > 0) {
        ans++;
      }
      cnt++;
    }

    bool flag = 0;
    rep(i, n) {
      if (h[i] != 0) {
        flag = 1;
      }
    }
    if (flag == 0) break;
  }

  cout << ans << endl;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const int MAX = 510000;
const static ll MOD = 1e9 + 7;

ll fac[MAX], finv[MAX], inv[MAX];

void com_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll com(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    ll blue = k;
    ll red = n - k;

    com_init();

    for (ll i = 1; i <= k; ++i) {
        MSG(com(red + 1, i) * com(blue - 1, i - 1) % MOD)
    }

    return 0;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,j,k=0;
  vector<int> p={2};
  cin>>n;
  for(i=3;i<=55555;i+=2){
    for(j=0;j<p.size();j++) if(i%p.at(j)==0) break;
    if(j==p.size()) p.push_back(i);
  }
  for(i=0;i<p.size();i++){
    if(p.at(i)%5==1){
      k++;
      cout<<p.at(i);
      if(k<n) cout<<' ';
      else if(k==n){
        cout<<endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 3564
#include <stdio.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

struct MaxFlow {
    static const int N = 512;
    int n, flow[N][N], capa[N][N], prev[N];
    void init(int _n) {
        n = _n;
        memset(flow, 0, sizeof(flow));
        memset(capa, 0, sizeof(capa));
    }
    void add_edge(int u, int v, int ca) { capa[u][v] = ca; }
    int pour(int s, int t, int F=1<<30) {
        int total = 0;
        while(total < F) {
            memset(prev, -1, sizeof(prev));
            queue<int> q;
            prev[s] = s;
            q.push(s);
            while(!q.empty() && prev[t]<0) {
                const int u = q.front();
                q.pop();
                rep(i, n) if(prev[i]<0 && flow[u][i]<capa[u][i]) {
                    prev[i] = u;
                    q.push(i);
                }
            }
            if(prev[t]<0) return total;
            int inc = F-total;
            for(int j=t; prev[j]!=j; j=prev[j]) {
                inc = min(inc, capa[prev[j]][j]-flow[prev[j]][j]);
            }
            for(int j=t; prev[j]!=j; j=prev[j]) {
                flow[prev[j]][j] += inc;
                flow[j][prev[j]] -= inc;
            }
            total += inc;
        }
        return total;
    }
} mf;

int N, E, Q;

int main() {
    scanf("%d%d%d", &N, &E, &Q);
    mf.init(N);
    rep(_, E) {
        int F, T;
        scanf("%d%d", &F, &T);
        F--, T--;
        mf.add_edge(F, T, 1);
        mf.add_edge(T, F, 1);
    }
    int cur = mf.pour(0, N-1);
    rep(_, Q) {
        int M, A, B;
        scanf("%d%d%d", &M, &A, &B);
        A--, B--;
        if(M==1) {
            mf.add_edge(A, B, 1);
            mf.add_edge(B, A, 1);
            cur += mf.pour(0, N-1, 1);
        }
        else {
            if(mf.flow[A][B]==-1) swap(A, B);
            if(mf.flow[A][B] && !mf.pour(A, B, 1)) {
                cur--;
                mf.pour(N-1, B, 1);
                mf.pour(A, 0, 1);
            }
            mf.flow[A][B] = mf.flow[B][A] = 0;
            mf.capa[A][B] = mf.capa[B][A] = 0;
        }
        printf("%d\n", cur);
    }
    return 0;
}

Measured memory_bytes: 2876
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.OutputStream;
public class Main {
    public static void main(String args[]) {
        Sc sc = new Sc(System.in);
        int N = sc.nI();
        long T = sc.nI();
        long A = sc.nI();
        for(int i = 1; i<N; i++) {
            long Ti = sc.nI();
            long Ai = sc.nI();
            double diff = T;
            diff = diff*Ai - (Ti+0.0)*A;
            if(diff+0.01<0) {
                if(A%Ai != 0) {
                    A = ((A + Ai - 1)/Ai)*Ai;
                }
                T = A/Ai*Ti;
            } else if(diff - 0.01>0) {
                if(T%Ti != 0) {
                    T = ((T + Ti - 1)/Ti)*Ti;
                }
                A = T/Ti*Ai;
            }
        }
        System.out.println(A + T);
    }
}
class Sc {
    public Sc(InputStream i) {
        r = new BufferedReader(new InputStreamReader(i));
    }

    public boolean hasM() {
        return peekToken() != null;
    }

    public int nI() {
        return Integer.parseInt(nextToken());
    }

    public double nD() { 
        return Double.parseDouble(nextToken());
    }

    public long nL() {
        return Long.parseLong(nextToken());
    }

    public String n() {
        return nextToken();
    }

    private BufferedReader r;
    private String line;
    private StringTokenizer st;
    private String token;

    private String peekToken() {
        if (token == null) 
            try {
                while (st == null || !st.hasMoreTokens()) {
                    line = r.readLine();
                    if (line == null) return null;
                    st = new StringTokenizer(line);
                }
                token = st.nextToken();
            } catch (IOException e) { }
        return token;
    }

    private String nextToken() {
        String ans = peekToken();
        token = null;
        return ans;
    }
}

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

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

    if( a + 2 * sqrt(a) * sqrt(b) + b < c){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  long n,tmp,c,i;
  char name[11];
  
  scanf("%ld",&n);
  tmp=n;
  i=0;
  
  while(tmp>0){
    c=(tmp-1)%26;
    name[i]='a'+c;
    tmp=(tmp-1)/26;
    i++;
  }
  tmp=i;
  
  for(i=tmp-1;0<=i;i--){
    printf("%c",name[i]);
  }
  
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	std::string s; cin >> s;
	
	printf("%d\n", 700 + 100 * ((s[0] == 'o') + (s[1] == 'o') + (s[2] == 'o')));
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll A[100100];
ll ASUM[100100];
int main(){
    int N,K;
    cin >> N >> K;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
    }

    ASUM[0] = A[0] > 0 ? A[0] : 0;
    REP(i,N-1) {
        ASUM[i+1] = ASUM[i];
        if(A[i+1] > 0) ASUM[i+1] += A[i+1];
    }

    ll ans = 0;
    ll ansmax = LLONG_MIN;
    ll sum = 0;
    int maxindex = -1;
    REP(i,N){
        ans = 0;
        sum += A[i];
        if(i < K-1) continue;

        if(sum > 0) ans += sum;

        //REP(k, i-K+1){
        //    if(A[k] > 0) ans += A[k];
        //}

        //for(int k = i+1; k < N; k++){
        //    if(A[k] > 0) ans += A[k];
        //}
        ans += ASUM[i-K];
        ans += ASUM[N-1] - ASUM[i];

        ansmax = max(ansmax, ans);

        sum -= A[i+1-K];
    }


    cout << ansmax << endl;
    return 0;
}


Measured memory_bytes: 1792
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
//#define sz(x) (int)(x.size())
#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e17;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N=1000005;
void solve()
{
    int h,n;
    cin>>h>>n;int x,s=0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        s+=x;
    }
    if(s>=h)
    {
        cout<<"Yes";
    }
    else
        cout<<"No";
    cout<<endl;
}
int32_t main()
{
   
    IOS;
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vvll = vector<vector<long long>>;
using vll = vector<long long>;


long long find_min_total_dist(int N, const vvll & dist){
    vvll ans = dist;
    for (int k = 0; k < N; ++k){
        for (int i = 0; i < N; ++i){
            if (i == k) continue;
            for (int j = 0; j < N; ++j){
                if (j == k) continue;
                if (dist[i][j] > dist[i][k] + dist[k][j]) return -1;
                if (dist[i][j] == dist[i][k] + dist[k][j]){
                    ans[i][j] = 0;
                }
            }
        }
    }
    long long total_dist = 0;
    for (int i = 1; i < N; ++i){
        for (int j = 0; j < i; ++j){
            total_dist += ans[i][j];
        }
    }
    return total_dist;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vvll dist(N, vll(N, 0LL));
    for (auto & row : dist){
        for (auto & cell : row){
            cin >> cell;
        }
    }
    cout << find_min_total_dist(N, dist) << endl;
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a;
	b=a-(a/60*60);
		
	c=a/60;
		if(c>=60){
		c=c-(a/3600*60);
		} 
		
	d=a/3600;
		
	cout<<d<<":"<<c<<":"<<b<<endl;;
	return 0;
}

Measured memory_bytes: 1164
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a, b;
    cin >> a >> b;
    if((a > 0 && b < 0) || (a < 0 && b > 0)){
        cout << abs(abs(a) - abs(b)) + 1;
    }else{
        if(a == 0 || b == 0){
            if(a <= b){
                cout << b - a;
            }else{
                cout << a - b + 1;
            }
        }else if(a > b)
            cout << abs(a - b) + 2;
        else{
            cout << b - a;
        }
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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

using namespace std;

int main() {
    string str;
    cin >> str;
    int A[4][2];
    
    for (int i =0;  i<4;  i++) {
        A[i][0] = str[i] - '0';
        A[i][1] = -A[i][0];
    }
    
    int result;
    string PM = "+-";
    string op[4] = {""};
    
    for (int j=0; j <2; j++) {
        for (int k=0; k <2; k++) {
            for (int l=0; l<2; l++) {
                    
                result = A[0][0]+A[1][j]+A[2][k]+A[3][l];
                    
                if(result == 7) {
                        op[1]=PM[j];
                        op[2]=PM[k];
                        op[3]=PM[l];
                        break;
                }
            }
        }
    }
    
    cout << A[0][0] << op[1] <<A[1][0] << op[2] <<A[2][0] << op[3] <<A[3][0] << "=" << 7 <<endl;
    
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
l = gets.split(" ").map(&:to_i)
l = l.combination(3).to_a
i = 0
sum = 0

while i < l.length do
  m = l[i]
  if m[0] != m[1] && m[1] != m[2] && m[0] != m[2] && m[0] < m[1] + m[2] && m[1] < m[0] + m[2] && m[2] < m[0] + m[1]
    sum += 1
  end
  i += 1
end

puts sum


Measured memory_bytes: 22748
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

const ll INF = LONG_MAX;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("b.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;

    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n-1);

    int ans = 0;
    rep(i, n) { cin >> a[i]; a[i] -= 1;}
    rep(i, n) { cin >> b[i];}
    rep(i, n-1) { cin >> c[i];}

    rep(i, n)
    {
        ans += b[a[i]];
    }

    //cout << ans << endl;

    rep(i, n-1)
    {
        if (a[i]+1 == (a[i+1]))
        {
            ans += c[a[i]];
        }
    }

    cout << ans;


    return 0;
}

/*
  - 1e9 : 10^9
  - vector
    vector<int> A(N);
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()

void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/

void Calc() {
  int n, k;
  in, n, k;
  std::map<char, int> m;
  rep(i, n) {
    string s = in;
    m[s[0]]++;
  }
  std::priority_queue<int> q;
  for (auto& i : m) {
    q.push(i.second);
  }
  vector<int> v(k);
  err(m);
  int ans = 0;
  while (q.size() >= k) {
    for (auto& i : v) {
      i = q.top(); q.pop();
      err(i, q.size());
    }
    for (auto& i : v) {
      if (i - 1 != 0) {
        q.push(i - 1);
      }
    }
    ans++;
  }
  err(q.size());
  cout << (ans) << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        long N = Reader.Int(), A = Reader.Int(), B = Reader.Int();
        long min = A * (N - 1) + B;
        long max = A + (N - 1) * B;
        Console.WriteLine(Math.Max(0, max - min + 1));
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	string S;
	cin >> S;

	int N = S.size();

	int kotae = 0;
	rep(i, 8) {
		string S1 = S.substr(0, i);
		string S2 = S.substr(i + N - 7, 7 - i);
		if (S1 + S2 == "keyence") kotae = 1;
	}

	if (kotae) co("YES");
	else co("NO");

	Would you please return 0;
}

Measured memory_bytes: 256
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		int n=Integer.parseInt(scan.next());
    		if (n==1) {
    			System.out.print("Hello World");
    		}else {
    			int a=Integer.parseInt(scan.next());
    			int b=Integer.parseInt(scan.next());
    			System.out.print(a+b);
    		}
    }
    }
// end 

Measured memory_bytes: 21716
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>
#include <bitset>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		const int INF = 1 << 30;
		int n = -1, ans = INF;
		cin >> n;
		if (n < 0) return 0;
		string s;
		cin >> s;
		vector<int> r(n + 1), w(n + 1);
		for (int i = 0; i < n; ++i) {
			r[i + 1] = r[i] + (s[i] == 'R');
			w[i + 1] = w[i] + (s[i] == 'W');
		}
		for (int i = 0; i <= n; ++i) {
			int lr = r[i], rr = r[n] - r[i];
			int lw = w[i], rw = w[n] - w[i];
			int cost = min(lw, rr);
			cost += lw + rr - 2 * cost;
			ans = min(ans, cost);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 5240
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial
from heapq import heappop, heappush, heappushpop
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    from collections import Counter
    N, K = MI()
    A = LI()
    c = Counter(A).most_common()
    c = [j for i, j in c]
    ans=0
    for val in c[K:]:
        ans += val
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 111176
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N; cin>>N;
    vec A(3*N); REP(i,3*N) cin>>A[i];
    Sort(A);
    Reverse(A);
    int ans = 0;
    for(int j=1; j<=2*N; j+=2){
        ans += A[j];
    }
    Out(ans);
}

Measured memory_bytes: 2560
N, M = list(map(int,input().split()))
graph = [[-1 for i in range(N)] for i in range(N)]
in_list = []
for i in range(M):
    a, b = list(map(int,input().split()))
    in_list.append([a, b])
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1
    
# 頂点 node を含む連結成分が木なら 1 を返す
def dfs(node, parent):
    ret = 1
    global seen
    if seen[node]:  return 0
    seen[node] = True
    for i in range(N):
        if graph[node][i] == 1 and i != parent:
            ret = min(dfs(i, node), ret)
    return ret

ans = 0

for i in range(M):
    
    graph[in_list[i][0] - 1][in_list[i][1] - 1] = -1
    graph[in_list[i][1] - 1][in_list[i][0] - 1] = -1
    
    seen = [False for _ in range(N)]
    link = 0 # 連結成分
    wood = 0 # 木の個数
    
    for j in range(N):
        if seen[j] == False:
            link += 1
            wood += dfs(j, 0)
            seen[j] = True
            
    ans += (link != 1)
    
    graph[in_list[i][0] - 1][in_list[i][1] - 1] = 1
    graph[in_list[i][1] - 1][in_list[i][0] - 1] = 1
    
print(ans)

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

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vc<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 1;
    rep(i,n-1){
        if(a[i]*2 >= a[i+1]) ans++;
        else ans = 1;
        a[i+1] += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int K = stdIn.nextInt();
		int S = stdIn.nextInt();
		int count = 0;
		for(int X = 0; X <= K; X++) {
			for(int Y = 0; Y <= K; Y++) {
				if(S-X-Y <= K && S-X-Y >= 0) count++;
			}
		}
		System.out.println(count);

	}

}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <regex>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

const ll MOD = 1e9+7;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

//seiki
//#include <regex>
/*bubun*/
//regex_search("u32", regex("[0-9]"));      // true
/*kanzen*/
//regex_match("u32", regex("(i|u)\\d+"));   // true

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {

    int H,W,N,coc=0,cocj=1,cd=0;
    cin >>H>>W>>N;
    vi a(N+1);
    vvi c(H,vi(W,0));
    pii poi=mp(0,0);
    FOR(i,1,N){
        cin >>a[i];
    }
    FOR(i,0,H*W-1){
        c[poi.fi][poi.se]=cocj;
        coc++;
        if(coc>=a[cocj]){
            cocj++;
            coc=0;
        }
        cd=0;
//        cout <<poi.fi<<" "<<poi.se<<endl;
        if(poi.fi%2==0) {
            if(poi.se<=W-2){
                if(cd==0) poi.se++;
                cd=1;
            }
            if(poi.se==W-1){
                if(cd==0) poi.fi++;
                cd=1;
            }
        }
        if(poi.fi%2==1) {
            if(poi.se>=1){
                if(cd==0) poi.se--;
                cd=1;
            }
            if(poi.se==0){
                if(cd==0) poi.fi++;
                cd=1;
            }
        }
    }
    FOR(h,0,H-1){
        FOR(w,0,W-1){
            cout <<c[h][w];
            if(w!=W-1) cout <<" ";
            if(w==W-1) cout <<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
constexpr int DEBUG = 0;
using namespace std;

int main() {
  int n, k, s;
  cin >> n >> k >> s;
  
  int d = (s == 1000000000) ? 999999999 : 1000000000;
  
  for (int i = 0; i < n; i++) {
      if (i < k)
          cout << s << " ";
      else
          cout << d << " ";
  }
  
  return 0;
}

Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
void me()
{
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
typedef long long ll;
#define bay_bay return 0;
#define forn for(int i=0;i<n;++i)
#define forsz for(int i=0;i<s.size();++i)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) v.size()
void stop() {
#ifndef ONLINE_JUDGE
system("pause");
#endif
}
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll arr[1000009];
int main()
{
me();
ll a,b;
cin>>a>>b;
if(a<0&&b>=0||a==0)
    cout<<"Zero"<<endl;
    else if(a>0&&b>0)
        cout<<"Positive"<<endl;
else if(a<0&&b<0)
{
    if(abs(a-b)%2==0)
        cout<<"Negative"<<endl;
    else
            cout<<"Positive"<<endl;

}

}


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

int main(){
  string s; int m;
  while(true){
    cin >> s;
    if(s == "-") break;
    cin >> m;
    for(int i = 0; i < m; i++){
      int h; cin >> h;
      string s1 = s.substr(0, h);
      string s2 = s.substr(h, (int)s.size() - h);
      s = s2 + s1;
    }
    cout << s << endl;
  }
}



Measured memory_bytes: 3136