akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a), greater<int>());
  int al=0;
  int bo=0;
  REP(i,n){
    if(i%2==0) al += a[i];
    else bo += a[i];
  }
  cout << al - bo << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

bool jestj[123456];

int main(void){
	int n,i,a,ans=0;
	fill(jestj,jestj+123456,false);
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a;
		--a;
		jestj[a] = true;
	}
	for(i=0; i<100000; ++i){
		if(jestj[i]){
			++ans;
		}
	}
	if(ans%2==0){
		--ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
import bisect


N = int(input())
L = list(map(int, input().split()))

L.sort()

ans = 0
for i in range(0, N):
    for j in range(i + 1, N):
        left = bisect.bisect_right(L, L[j] - L[i])
        right = bisect.bisect_left(L, L[j] + L[i])
        res = right - left
        if left <= i and i <= right:
            res -= 1
        if left <= j and j <= right:
            res -= 1
        ans += max(0, res)

print(ans // 3)


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

void solve () {
    long long n;
    cin >> n;
    long long mn = 1e15 + 1;
    long long pos = 0;
    for (int i = 0; i < 5; i++) {
        long long x;
        cin >> x;
        if (mn > x) {
            pos = i;
            mn = x;
        }
    }
    cout << (n % mn > 0) + (n / mn) + (4ll - pos) + pos;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cstring>
#define reg register
#define IL inline
using namespace std;
char s[105];
int len;
bool flg;
int main()
{
    scanf("%s",s);
	len = strlen(s);
	for(reg int i = 0;i < len;i++)
	{
		if(s[i] == 'C')
		{
			flg = 1;
		}
		if(flg)
		{
			if(s[i] == 'F')
			{
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
    return 0;
}


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

int main() {
  string s,ans="Yes"; cin>>s;
  for(int i; i<s.size(); i++){
    if (i%2==0 && s[i]=='L') ans="No";
    if (i%2==1 && s[i]=='R') ans="No";
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n, m;
  while (cin >> n >> m, n || m) {
    vector<ll> a(m); cin >> a;
    sort(all(a));
    bool zero = false;
    if (a[0] == 0) {
      a.erase(a.begin());
      zero = true;
    }
    m = a.size();
    vector<ll> R(m+1, 0);
    R[m-1] = 1;
    rrep(i, m-1) {
      if (a[i] == a[i+1]-1) {
        R[i] = R[i+1] + 1;
      }
      else {
        R[i] = 1;
      }
    }
    vector<ll> L(m+1, 0);
    L[1] = 1;
    rep(i, 1, m) {
      if (a[i] == a[i-1]+1) {
        L[i+1] = L[i] + 1;
      }
      else {
        L[i+1] = 1;
      }
    }
    ll ans = 0;
    rep(i, m+1) {
      chmax(ans, L[i]);
    }
    if (zero) {
      ++ans;
      rep(i, 1, m) {
        if (a[i-1] + 2 == a[i]) {
          chmax(ans, L[i] + 1 + R[i]);
        }
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 4708
#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n;
	cin>>n;
	int ans=1;
	for(int i=0;i<3;i++){
		ans*=n;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pw(x) (1LL << (x))
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl

using namespace std;
typedef long long ll;
typedef double dbl;
const int INF = 1.01e9;

int sum(int x) {
    int ans = 0;
    while (x) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

int main() {
#ifdef HOME
    assert(freopen("in", "r", stdin));
#endif

    int n;
    while (cin >> n) {
        int ans = 1e9;
        for (int a = 1; a < n; a++) {
            int b = n - a;
            ans = min(ans, sum(a) + sum(b));
        }
        cout << ans << endl;
    }

#ifdef HOME
    cerr << "time = " << (clock() * 1. / CLOCKS_PER_SEC) << "\n";
#endif
    return 0;
}

Measured memory_bytes: 764
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		scan.close();
		for(int i = 0; i < n.length(); i++) {
			if(n.charAt(i) == '9') {
				System.out.print(1);
			}else if(n.charAt(i) == '1') {
				System.out.print(9);
			}else {
				System.out.print(n.charAt(i));
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 22612
#include <stdio.h>

int main()
{
	int sec;
	int total_sec=0, total_min=0;
	int i;
	for(i=0; i<4; i++){
		scanf("%d", &sec);
		total_sec += sec;
	}
	while(total_sec >= 60){
		total_min++;
		total_sec -= 60;
	}
	printf("%d\n%d\n", total_min, total_sec);
	return 0;
}

Measured memory_bytes: 596
num = int(input())

for _ in range(num):
    h, m = [int(x) for x in input().split(":")]
    
    #angle in 12 * 60 = 720 in 1/2 degree
    ha = h * 60 + m
    ma = m * 12
    da = abs(ha-ma)/2
    if da > 180:
        da = 360 - da
    
    if da >= 90:
        print("safe")
    elif da >= 30:
        print("warning")
    else:
        print("alert")


Measured memory_bytes: 5604
#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<char,int>;

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


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

    int n;
    cin >> n;

    map<int, int> mp;
    rep(i, n){
        int a;
        cin >> a;

        a /= 400;
        if(a < 8){
            mp[a]++;
        }else{
            mp[8]++;
        }
    }

    int low = mp.size();
    if(low > 1 && mp[8] > 0){
        low--;
    }
    int high = mp[8];
    if(mp.size() > 1) high += low;

    cout << low << " " << high << endl;


    return 0;
}

Measured memory_bytes: 256
from sys import stdin
def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    lo, hi = 1, 2 * n
    m = n - 1
    while lo + 1 < hi:
        mid = (lo + hi) / 2
        b = [x >= mid for x in a]
        t = b[0]
        for i in xrange(1, n):
            if b[m-i] == b[m-i+1]:
                t = b[m-i]
                break
            if b[m+i] == b[m+i-1]:
                t = b[m+i]
                break
        if t:
            lo = mid
        else:
            hi = mid
    print lo
main()

Measured memory_bytes: 19968
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n,k;
  cin>>n>>k;
  vector<pair<int,int>> p(1);
  char pre='1';
  rep(i,n){
    char c;
    cin>>c;
    if(c!=pre&&c=='1')p.push_back({0,0});
    if(c=='1')p.back().first++;
    else p.back().second++;
    pre=c;
    }
  if(p.size()<=k){
    cout<<n<<endl;
    return 0;
    
    }
  n=p.size();
  p.push_back({0,0});
  int cur=0,ans=0;
  rep(i,k)cur+=p[i].first+p[i].second;
  cur+=p[k].first;
  
  ans=cur;
  rep(i,n-k){
    cur-=p[i].first+p[i].second;
    cur+=p[i+k].second+p[i+k+1].first;
    ans=max(ans,cur);
    }
  cout<<ans<<endl;

    return 0;
}


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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

struct Edge {
    int to, a, b;
};

struct Node {
    int v, s;
    ll dist;
    bool operator<(const Node &o) const {
        return dist > o.dist;
    }
};

const int maxn = 51, maxs = 2501;
const ll inf = 1ll << 60;
ll dist[maxn][maxs];
bool vis[maxn][maxs];

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int n, m, s;
    cin >> n >> m >> s;
    if (s >= maxs) s = maxs - 1;

    vt<vt<Edge>> adj(n);
    while (m--) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--, v--;
        adj[u].push_back({v, a, b});
        adj[v].push_back({u, a, b});
    }

    vt<pii> ex(n);
    for (pii &i : ex) cin >> i.fi >> i.se;

    fill_n(*dist, maxn * maxs, inf);
    dist[0][s] = 0;
    priority_queue<Node> q;
    q.push({0, s, 0});
    while (!q.empty()) {
        Node cur = q.top();
        q.pop();

        if (cur.dist != dist[cur.v][cur.s]) continue;

        if (cur.s != maxs - 1) {
            int newS = min(maxs - 1, cur.s + ex[cur.v].fi);
            ll newDist = cur.dist + ex[cur.v].se;
            if (newDist < dist[cur.v][newS]) {
                dist[cur.v][newS] = newDist;
                q.push({cur.v, newS, newDist});
            }
        }

        for (Edge &e : adj[cur.v]) {
            int newS = cur.s - e.a;
            if (newS < 0) continue;

            ll newDist = cur.dist + e.b;
            if (newDist < dist[e.to][newS]) {
                dist[e.to][newS] = newDist;
                q.push({e.to, newS, newDist});
            }
        }
    }

    for (int i = 1; i < n; i++) {
        ll ans = inf;
        for (int j = 0; j < maxs; j++) {
            ans = min(ans, dist[i][j]);
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 6224
n,k=map(int,input().split())

ans=[1]*n
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in range(d):
        ans[a[j]-1]=0



sum=0
for i in range(n):
    sum+=ans[i]
print(sum)

Measured memory_bytes: 9192
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var a = o.l();
  var dp = Array(a[0]).fill(0);
  for(var i = a[0]; i <= k; i++){
    var t = {};
    for(var j = 0; j < n; j++){
      if(i - a[j] >= 0)t[dp[i-a[j]]] = 1;
      else break;
    }
    for(j = 0; 1; j++){
      if(t[j])continue;
      dp[i] = j;
      break;
    }
  }
  return dp[k] ? "First" : "Second";
}

Measured memory_bytes: 25036
/+ dub.sdl:
    name "A"
    dependency "dcomp" version=">=0.0.2"
+/

import std.algorithm, std.range, std.stdio, std.math, std.conv, core.bitop;

// import dcomp.scanner;
// import dcomp.algorithm;

int main() {
    import std.conv;
	auto sc = new Scanner();
    int n;
    int[] ai;
    sc.read(n, ai);

    bool solve(int md) {
        bool[] a = ai.map!(a => (md <= a)).array;
        int l = n-1;
        while (l) {
            if (a[l-1] == a[l]) break;
            l--;
        }
        int r = n-1;
        while (r < 2*n-2) {
            if (a[r] == a[r+1]) break;
            r++;
        }
        if ((n-1)-l < r-(n-1)) {
            return !a[l];
        } else {
            return !a[r];
        }
    }

    writeln(binSearch!(solve)(0, 2*n+10)-1);
	return 0;
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/scanner.d */
// module dcomp.scanner;

class Scanner {
    import std.stdio : File, readln, stdin;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeString, isDynamicArray;
    import std.algorithm : map;
    File f;
    this(File f = stdin) {
        this.f = f;
    }
    string[] buf;
    bool succ() {
        while (!buf.length) {
            if (f.eof) return false;
            buf = readln.split;
        }
        return true;
    }
    int read(Args...)(auto ref Args args) {
        foreach (i, ref v; args) {
            if (!succ()) return i;
            alias VT = typeof(v);
            static if (!isSomeString!VT && isDynamicArray!VT) {
                v = buf.map!(to!(ElementType!VT)).array;
                buf.length = 0;
            } else {
                v = buf.front.to!VT;
                buf.popFront();
            }
        }
        return args.length;
    }
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/algorithm.d */
// module dcomp.algorithm;

template binSearch(alias pred) {
    T binSearch(T)(T l, T r) {
        while (r-l > 1) {
            int md = (l+r)/2;
            if (!pred(md)) l = md;
            else r = md;
        }
        return r;
    }
}


Measured memory_bytes: 10532
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e11;
const long double PI = (acos(-1));


signed main() {
	string s;
	cin >> s;
	int C = INF, F = -INF;
	rep(i, s.size()) {
		if (C == INF && s[i] == 'C')C = i;
		if (s[i] == 'F')F = i;
	}
	if (C < F)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int t,k,n,sum=0;
   cin>>t>>k;
   int ar[t];
   for(int i=0;i<t;i++){
     cin>>ar[i];
   }
	n = sizeof(ar)/sizeof(ar[0]);
    sort(ar,ar+n);
   for(int j=0;j<k;j++){
     sum = sum + ar[j];
   }
   cout << sum <<endl;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int a,b;
	cin>>a>>b;
	if(a+b==15)cout<<'+'<<endl;
	else if(a*b==15)cout<<'*'<<endl;
	else cout<<'x'<<endl;
	return 0;
}

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

int main(){
  int n;cin>>n;
  int sum=0, M=-INF;
  for(int i=0;i<n;i++){
  	int a;cin>>a;
  	sum+=a;M=max(M, a);
  }
  cout << (M<sum-M?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int H, W;
	while (true){
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				if ( i == 0 || i == H - 1 || j == 0 || j == W-1 ){
					cout << "#";
				}
				else{
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
def main():
  s=input()
  x=s[:int((len(s)-1)/2)]
  y=s[int((len(s)+3)/2)-1:]
  flg=0
  
  if s !=s[::-1]:
    flg=1
  if x !=x[::-1]:
    flg=1
  if y !=y[::-1]:
    flg=1
  if flg==1:
    print("No")
  else:
    print("Yes")
main()

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

signed main(void)
{
	int h, w;
	cin >> h >> w;
	rep(i, h) rep(j, w) 
	{
		string s;
		cin >> s;
		if (s == "snuke")
		{
			char ans = j + 'A';
			cout << ans << i + 1 << endl;
			return 0;
		}
	}
}


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

using namespace std;

#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define INF (1<<28)
#define DEKAI 1000000007
#define FDST int hogehogehoge;cin>>hogehogehoge;

int main(){
  while(1){
    int d,w;
    cin>>d>>w;
    if(d==0&&w==0) break;
    int a[10][10];
    lp(i,d){
      lp(j,w){
	cin>>a[i][j];
      }
    }
    int ans=0;
    for(int z=3;z<=d;z++){
      for(int zz=3;zz<=w;zz++){
	for(int i=0;i<=d-z;i++){
	  for(int j=0;j<=w-zz;j++){
	    int gmin=INF,nmax=-INF;
	    for(int x=i;x<z+i;x++){
	      for(int y=j;y<zz+j;y++){
		if(x==i||y==j||x==z+i-1||y==zz+j-1){
		  gmin=min(gmin,a[x][y]);
		}
		else{
		  nmax=max(nmax,a[x][y]);
		}
	      }
	    }
	    if(gmin<=nmax) continue;
	    int sums=0;
	    for(int x=i;x<z+i;x++){
	      for(int y=j;y<zz+j;y++){
		if(x==i||y==j||x==z+i-1||y==zz+j-1){
		  continue;
		}
		else{
		  sums+=gmin-a[x][y];
		}
	      }
	    }
	    ans=max(sums,ans);
	  }
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
   int N, K;
   cin >> N >> K;
   vector<int> v(N);
   int tmp;
   for (int i = 0; i < N; i++) {
      cin >> v[i];
   }
   sort(v.begin(), v.end());
   int ans = pow(10, 9) - 1;
   for (int i = K - 1; i < N; i++) {
      int anstmp = v[i] - v[i - K + 1];
      if (anstmp < ans) ans = anstmp;
   }
   cout << ans << endl;
}

Measured memory_bytes: 640
#include <queue>
#include <string>
#include <iostream>
using namespace std;
int main() {
    string cmd;
    priority_queue<int> Q;
    while (cin >> cmd && cmd != "end") {
        if (cmd == "insert") {
            int a;
            cin>>a;
            Q.push(a);
        } else if (cmd == "extract") {
            int a=Q.top();Q.pop();
            cout<<a<<endl;
        }
    }
}

Measured memory_bytes: 7012
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int h,i,j;
  int a[100],b[100],c,m,n;
  while(cin>>n>>m&&n+m){
    memset(a,0,sizeof(a));
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	cin>>c;
	a[j]+=c;
      }
    }
    for(i=0;i<m;i++)
      b[i]=i;
    do{
      h=0;
      for(i=1;i<m;i++){
	if(a[i-1]<a[i]){
	  swap(a[i-1],a[i]);
	  swap(b[i-1],b[i]);
	  h=1;
	}
      }
    }while(h);
    for(i=0;i<m-1;i++)
      cout<<b[i]+1<<" ";
    cout<<b[i]+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 864
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  int ans = 1;
  ans *=k;
  ans *= pow(k-1, n-1);
  cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

public class Program
{
    public static void Main(string[] args)
    {
        new Program().Solve(new ConsoleInput(Console.In, ' '));
    }

    public void Solve(ConsoleInput cin)
    {
        var a = cin.ReadIntArray(3);
        if (a[0] + a[1] + a[2] >= 22)
        {
            WriteLine("bust");
        }
        else
        {
            WriteLine("win");
        }

        ReadKey();
    }
}

public class ConsoleInput
{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
    {
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read
    {
        get
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}

Measured memory_bytes: 11220
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N,A; cin >> N >> A;
    cout << N*N - A << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll a[3][3];
ll N;
ll b[11];
int main(){
    for(ll i=0;i<3;i++){
        for(ll j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    cin>>N;
    for(ll k=0;k<N;k++){
        cin>>b[k];
        for(ll i=0;i<3;i++){
            for(ll j=0;j<3;j++){
                if(a[i][j]==b[k]){
                    a[i][j]=0;
                }
            }
        }
    }
    
    for(ll i=0;i<3;i++){
        bool f=true;
        for(ll j=0;j<2;j++){
            if(a[i][j]!=a[i][j+1]){
                f=false;
            }
        }
        if(f){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    for(ll i=0;i<3;i++){
        bool f=true;
        for(ll j=0;j<2;j++){
            if(a[j][i]!=a[j+1][i]){
                f=false;
            }
        }
        if(f){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    bool f=true;
    for(ll j=0;j<2;j++){
        if(a[j][j]!=a[j+1][j+1]){
            f=false;
        }
    }
    if(f){
        cout<<"Yes"<<endl;
        return 0;
    }
    f=true;
    for(ll j=0;j<2;j++){
        if(a[j][2-j]!=a[j+1][2-(j+1)]){
            f=false;
        }
    }
    if(f){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int a[40], n;

int main()
{
	while (cin >> n, n) {
		a[0] = 1;
		for (int i = 1; i <= 32; i++) {
			a[i] = a[i - 1];
			if (i - 2 >= 0)a[i] += a[i - 2];
			if (i - 3 >= 0)a[i] += a[i - 3];
		}
		cout << ceil(a[n] / 10.0 / 365.0) << endl;
	}
	return	0;
}

Measured memory_bytes: 3248
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <bitset>
#include <string>
#include <time.h>
using namespace std;
long double esp=1e-11;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define cle(a) while(!a.empty())a.pop()
#define mem(p,c) memset(p,c,sizeof(p))
#define mp(A, B) make_pair(A, B)
#define pb push_back
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
typedef long long int LL;
const long double PI = acos((long double)-1);
const LL INF=0x3f3f3f3f3f3f3f3fll;
const int MOD =1000000007ll;
const int maxn=210100;
char s[maxn];
int main()
{
    //freopen("in9.txt", "r", stdin);
    //freopen("in9.txt", "r", stdin);
    //freopen("out9.txt", "w", stdout);
    //::iterator iter;                  %I64d
    //for(int x=1;x<=n;x++)
    //for(int y=1;y<=n;y++)
    //scanf("%d",&a);
    //printf("%d\n",ans);
    scanf("%s",s);
    int n=strlen(s);
    int f=1;
    for(int x=0;x<n-2;x++)
        if(s[x]!=s[x+2])
        {
            f=0;
            break;
        }
    if(f==1)
    {
        printf("Second\n");
        return 0;
    }
    if(s[0]==s[n-1])n--;
    if(n&1)printf("First\n");
    else printf("Second\n");
    return 0;
}


Measured memory_bytes: 384
S=input()
L=["01","02","03","04","05","06","07","08","09","10","11","12"]

if S[:2] in L:
    if S[2:] in L:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if S[2:] in L:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int maxi=0,mini=1e9;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
maxi=max(maxi,a);
mini=min(mini,a);
}
cout<<maxi-mini<<endl;
return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        String a = scanner.next();
        int ans = 0;
        if(a.equals("SUN")) {
        	ans = 7;
        }else if(a.equals("MON")) {
        	ans = 6;
        }else if(a.equals("TUE")) {
        	ans = 5;
        }else if(a.equals("WED")) {
        	ans = 4;
        }else if(a.equals("THU")) {
        	ans = 3;
        }else if(a.equals("FRI")) {
        	ans = 2;
        }else if(a.equals("SAT")) {
        	ans = 1;
        }
        System.out.println(ans);

    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 21076
import itertools
import math

N = int(input())

lloc = list()
for i in range(N):
    lloc.append(list(map(int, input().split())))

list_per = list(itertools.permutations(list(range(N))))
num = len(list_per)

llength = list()
for i in range(num):
    length = 0
    for j in range(N-1):
        length += math.sqrt((lloc[list_per[i][j]][0] - lloc[list_per[i][j+1]][0])**2 + (lloc[list_per[i][j]][1] - lloc[list_per[i][j+1]][1])**2)
    llength.append(length)

print(sum(llength)/len(llength))

Measured memory_bytes: 48876
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define N 500005

int table[N];
void makeTable(string &t) {
	int n = t.size(), pos = 1, match = 0;
	while (pos + match < n) {
		if (t[match] == t[pos + match]) {
			++match;
			table[pos + match - 1] = match;
		}
		else {
			if (match == 0) {
				++pos;
			}
			else {
				pos += match - table[match - 1];
				match = table[match - 1];
			}
		}
	}
}
bool vis[N], isMatch[N];
int dp[N];
int main(void) {
	string s, t;
	cin >> s >> t;
	makeTable(t);
	int pos = 0, match = 0;
	int n = s.size();
	while (pos < n) {
		int id = (pos + match) % n;
		if (match < t.size() && s[id] == t[match]) {
			++match;
			if (match == t.size()) {
				isMatch[pos] = true;
			}
		}
		else {
			if (match == 0) {
				++pos;
			}
			else {
				pos += match - table[match - 1];
				match = table[match - 1];
			}
		}
	}

	int ret = 0;
	for (int i = 0; i < n; ++i) {
		if (isMatch[i] && !vis[i]) {
			int cc = 0;
			bool cycleOccured = false;
			int id = i;
			while (true) {
				if (vis[id]) {
					cc += dp[id];
					if (id == i) {
						cycleOccured = true;
					}
					break;
				}
				vis[id] = true;
				++cc;
				id = (id + t.size()) % n;
				if (!isMatch[id]) {
					break;
				}
			}
			if (cycleOccured) {
				ret = -1;
				break;
			}
			dp[i] = cc;
			ret = max(ret, cc);
		}
	}
	printf("%d\n", ret);
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1;i <= N;i++){
        string s = to_string(i);
        if(s.size() % 2 ==1){
            ans += 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Bsort(a) sort(a.begin(), a.end(), greater<ll>())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  Sort(a);
  ll ans = 0;
  rep(i,n-1) ans += a[i];
  if (ans > a[n-1]) {
    cout << "Yes" << '\n';
  }
  else {
    cout << "No" << '\n';
  }
}

Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main(void) {
  int i,j;
  int a,b,c;
  string s;
  cin>>a>>b>>c;
 
  if(a<=c && c<=b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
 
 
}


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

int main () {
  int A, B;
  cin >> A >> B;
  if (A % 3 == 0 || B % 3 == 0 || (A+B) % 3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[200005],b[200005];
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	for (int i=1; i<=n; i++){
		if (b[i]==a[1]){
			cout<<a[2]<<'\n';
		}
		else{
			cout<<a[1]<<'\n';
		}
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 20
#define off 2
#define sq(x) ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define maxn 200005

vector <int> g[maxn] ;
char s[maxn] ;
int col[maxn] ;
int ad[maxn][2] ;
bool isDead[maxn] ;

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d %d",&n,&m) ;
    scanf("%s",s+1) ;

    for(i=1 ; i<=n ; i++)
    {
        if( s[i]=='A' ) col[i] = 0 ;
        else col[i] = 1 ;
    }

    queue <int> q ;

    for(i=1 ; i<=m ; i++)
    {
        int u , v ;
        scanf("%d %d",&u,&v) ;
        ad[ u ][ col[v] ]++ ;
        if(u!=v) ad[ v ][ col[u] ]++ ;
        g[u].pb(v) ;
        if(u!=v) g[v].pb(u) ;
    }

    for(i=1 ; i<=n ; i++)
    {
        if( ad[i][0]==0 || ad[i][1]==0  )
        {
            isDead[i] = 1 ;
            q.push(i) ;
        }
    }

    int dead = 0 ;

    while(!q.empty())
    {
        int u = q.front() ;
   //     printf("%d\n",u) ;
        q.pop() ;
        dead++ ;
        isDead[u] = 1 ;

        for(i=0 ; i<g[u].size() ; i++)
        {
            if( isDead[ g[u][i] ] ) continue ;
            ad[ g[u][i] ][ col[u] ]-- ;
            if( !ad[ g[u][i] ][0] || !ad[ g[u][i] ][1] )
            {
                isDead[ g[u][i] ] = 1 ;
                q.push(g[u][i]) ;
            }
        }
    }

    if( dead==n ) printf("No\n") ;
    else printf("Yes\n") ;

    return 0 ;
}


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

int main() {

  int N ,sumA,sumB;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
  	cin >> vec.at(i);	
  }
   for(int i=0;i<N;i++){
  	for(int j=i+1;j<N;j++){
    	if(vec.at(i)<vec.at(j)){
        	int T;
          T = vec.at(i);
          vec.at(i) = vec.at(j);
          vec.at(j) = T;
        }
    }
  }
 int A;
  A = N%2;
  sumA = 0;
  sumB = 0;
 // cout<<vec.at(0)<<endl;
  for(int i=0;i<N;i +=2){
  	sumA += vec.at(i);
  }
  for(int i=1;i<N;i +=2){
  	sumB += vec.at(i);
  }
  
  cout<<sumA-sumB<<endl; 
 
}

Measured memory_bytes: 256
$mod = 1_000_000_007
io = STDIN
n=io.gets.chomp.to_i
a=io.gets.chomp.split.map(&:to_i)
if n.even?
  ar=((1.step(n-1,2).to_a)*2).sort
else
  ar=((0.step(n-1,2).to_a)*2-[0]+[0]).sort
end
if ar == a.sort
  size=ar.size
  p 2**(size/2) % $mod
else
  p 0
end

Measured memory_bytes: 12280
#N = int(input())
N,M = map(int,input().split())
#A = list(map(int,input().split()))
#A = [int(input()) for i in range(N)]
#A = [list(map(int,input().split())) for i in range(N)]
if N==M:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (i=a;i<n;i++)
#define per(i,a,n) for (i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define PI acos(-1)
#define SIZE 2000001
#define ONLINE_JUDGE
#define rd
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
auto clk=clock(); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;

vector<ll> set_count;

ll overlap(int j,int k){
	ll ans=0,i;
	for(i=2*j;i<k+1;i+=j)
		if(i%j==0)
			ans+=set_count[i];
	return ans;
}

int main(){
	#ifndef rd
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(20);
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	
	//
	ll n,k,ans=0,i;
	cin>>n>>k;
	set_count.resize(k+2);
	rep(i,1,k+1) set_count[i]=powmod(k/i,n);
	per(i,1,k+1) set_count[i]=(set_count[i]-overlap(i,k))%mod;
	rep(i,1,k+1) ans=(ans%mod+((i%mod)*(set_count[i]%mod))%mod)%mod;
	cout<<ans;
	//

	#ifndef ONLINE_JUDGE
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<" sec"<<endl;
	#endif
	return 0;
}

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

#define ff first
#define endl "\n"
#define ss second
using namespace std;
#define maxn 2000006
#define pb push_back
#define ll long long
#define lll __int128
#define vll vector<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fr(i,x,n) for(ll i=x;i>=n;i--)
inline ll min(ll a, ll b, ll c) { return min(min(a, b), c);}
inline ll max(ll a, ll b, ll c) { return max(max(a, b), c);}
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

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



int main() {
	fastio();

	ll h, n; cin >> h >> n;
	ll s=0;
	ll a[n+1]; f(i,1,n) cin>>a[i],s+=a[i];
	if(s>=h) cout<<"Yes";
	else cout<<"No";

	return 0;
}

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

int main()
{
	char s[101];
	ll k;
	cin >> s >> k;
	ll n = strlen(s);
	ll i = 0;
	if (k > n)
	{
		while (i < n)
		{
			if (s[i] != '1')
			{
				cout << s[i];
				return 0;
			}
			i++;
		}
	}
	else if (k <= n)
	{
		while (i < k)
		{
			if (s[i] != '1')
			{
				cout << s[i];
				return 0;
			}
			i++;
		}
	}
	cout << '1' << endl;
	return (0);
}

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

void printv(vector<ll> v) {
  for (ll i : v)
    cout << i << endl;
}

int n, m, x;
vector<int> c;
vector<vector<int>> a;
int ans = 10000000;

void dfs(vector<int> v) {
  vector<int> u(m + 1);
  int cost = 0;
  for (int i : v) {
    if (!i)
      continue;
    cost += c[i];
    rep(j, m) { u[j + 1] += a[i][j + 1]; }
  }
  bool achieve = true;
  rep(i, m) if (u[i + 1] < x) achieve = false;
  if (achieve)
    ans = min(ans, cost);

	int size=v.size();
  if (size == n + 1)
    return;
  v.push_back(v.back() + 1);
  while (v.back() <= n) {
    dfs(v);
    v.back()++;
  }
}

int main() {
  cin >> n >> m >> x;
  // 1 base
  c = vector<int>(n + 1);
  a = vector<vector<int>>(n + 1, vector<int>(m + 1));
  rep(i, n) {
    cin >> c[i + 1];
    rep(j, m) cin >> a[i + 1][j + 1];
  }
  dfs(vector<int>(1, 0));
  cout << (ans == 10000000 ? -1 : ans) << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
	int n,d;
	cin>>n>>d;
	int r=n/(d*2+1);
	if(n%(d*2+1)>0)r++;
	cout<<r<<endl;
	return 0;
}


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

int top = 0, MAX = 101;
int S[101] = {0};

int isEmpty();
int isFull();
void push(int x);
int pop();

int main() {
    int tmp = 0, x;
    char ch[11];
    
    while (scanf("%s", ch) != EOF) {
        if (ch[0] == '+') {                 // case '+'
            tmp = pop();
            push(pop() + tmp);
        } else if (ch[0] == '-') {          // case '-'
            tmp = pop();
            push(pop() - tmp);
        } else if (ch[0] == '*') {          // case '*'
            tmp = pop();
            push(pop() * tmp);
        } else {                            // case "operand"
            x = atoi(ch);
            push(x);
        }
    }
    printf("%d\n", S[1]);
    return 0;
}

int isEmpty() {
    return (top == 0);
}

int isFull() {
    return (top >= MAX - 1);
}

void push(int x) {
    if (isFull()) {exit(1);}
    top++;
    S[top] = x;
    return;
}

int pop() {
    if (isEmpty()) {exit(1);}
    top--;
    return S[top+1];
}


Measured memory_bytes: 2100
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;
 
const int MAX = 20;
 
int main(){
    int N,M,C;
    int A[MAX][MAX];
    int B[MAX];
    int ans = 0;
 
    cin >> N >> M >> C;
    
    for(int i = 0;i < M;i++){
        cin >> B[i];
    }
    for(int i = 0;i < N;i++){
        for(int j = 0;j < M;j++){
            cin >> A[i][j];
        }
    }
 
 
 
    for(int i = 0;i < N;i++){
        int sum = C;
        for(int j = 0;j < M;j++){
            sum += A[i][j] * B[j];
        }
        if(sum > 0)ans++;
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C

#D
def root(x):
    if x == par[x]:
        return x
    par[x] = root(par[x])
    return par[x]

def same(x,y):
    return root(x) == root(y)

def unite(x,y):
    x = root(x)
    y = root(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1
n = I()
v = LIR(n)
l = defaultdict(int)
for i in range(n):
    v[i].append(i)
par = [i for i in range(n)]
rank = [0 for i in range(n)]
v.sort(key = lambda x:x[0])
for i in range(n-1):
    l[i] = [v[i][2],v[i+1][2],v[i+1][0]-v[i][0]]
v.sort(key = lambda x:x[1])
for i in range(n-1):
    l[i+n-1] = [v[i][2],v[i+1][2],v[i+1][1]-v[i][1]]
l = list(l.values())
l.sort(key = lambda x:x[2])
k = 0
ans = 0
for i in range(2*n-2):
    x,y,c = l[i]
    if not same(x,y):
        k += 1
        ans += c
        unite(x,y)
    if k == n-1:break
print(ans)
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 125096
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX = 1e5+5;
int N, M, mp[MAX];
int a, b, ans;
int cnt[MAX];

int main(int argc, char ** argv) {
	rep(i, 1, MAX) cnt[i] = 1;
	scanf("%d%d", &N, &M);
	mp[1] = 1;
	rep(i, 0, M) {
		scanf("%d%d", &a, &b);
		if(mp[a]) mp[b] = 1;
		cnt[b]++; cnt[a]--;
		if(!cnt[a]) mp[a] = 0;
	}
	REP(i, 1, N) ans += mp[i];
	printf("%d\n", ans);
	return 0;
}


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

int main()
{
  int k,s;
  cin>>k>>s;
  
  int x=0;
  int y=0;
  int z;
  int i=0;
  
  for(x=0;x<=k;x++)
  {
    for(y=0;y<=k;y++)
    {
      if(s-x-y<=k&&s-x-y>=0)
        i++;
    }
  }
  cout<<i<<endl;
}
        

Measured memory_bytes: 256