akhauriyash/Code-Regression huggingface dataset:
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#else
#define debug(args...) // Just strip off all debug tokens
#endif

struct debugger
{
    template <typename T>
    debugger &operator,(const T &v)
    {
        cerr << v << " ";
        return *this;
    }
} dbg;
#define MAXN 100000

struct Edge
{
    int to, next;
} e[2 * MAXN + 10];
int head[MAXN + 10];
void addEdge(int a, int b)
{
    static int c = 0;
    e[++c] = (Edge){ b, head[a] };
    head[a] = c;
    e[++c] = (Edge){ a, head[b] };
    head[b] = c;
}

bool f[MAXN + 10][30];
int l[MAXN + 10];
int m;
void dfs(int now, int fa)
{
    int t[30];
    memset(t, 0, sizeof(t));
    for (int i = head[now]; i != 0; i = e[i].next) {
        int v = e[i].to;
        if (v == fa)
            continue;
        dfs(v, now);
        f[now][l[v]] = true;
        for (int j = l[v] + 1; j <= m; ++j) {
            if (f[v][j])
                f[now][j] = true;
        }
        for (int j = l[v]; j <= m; ++j) {
            if (f[v][j])
                ++t[j];
        }
    }
    int Min = 999;
    for (int j = 0; j <= m; ++j) {
        if (t[j] == 0) {
			if (Min>j)
            Min = j;
        } else if (t[j] > 1) {
            Min = 999;
        }
    }
    l[now] = Min;
	f[now][l[now]]=true;
}
void solve(long long N, vector<long long> a, vector<long long> b) {
	m=log(N)/log(2)+1;
	for(int i=0; i<N; ++i) {
		addEdge(a[i],b[i]);
	}
	dfs(1,0);
	int ans=0;
	for(int i=1; i<=N; ++i) {
		debug(l[i]);
		ans=max(ans,l[i]);
	}
	cout<<ans<<endl;
}

int main()
{
#ifdef WAAUTOMATON
     freopen("in.txt","r",stdin);
#endif
    long long N;
    scanf("%lld", &N);
    vector<long long> b((N - 1) - 1 + 1);
    vector<long long> a((N - 1) - 1 + 1);
    for (int i = 0; i <= (N - 1) - 1; i++) {
        scanf("%lld", &a[i]);
        scanf("%lld", &b[i]);
    }
    solve(N, a, b);
    return 0;
}


Measured memory_bytes: 23424
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int c = 0;

		String s = sc.next();

		for(int i = 0; i < s.length() / 2; i++) {
			if(s.charAt(i) != s.charAt(s.length()-1-i)) c++;
		}

		System.out.println(c);
	}
}

Measured memory_bytes: 35552
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		V = sc.nextInt();
		E = sc.nextInt();
		g = new ArrayList[V];
		for (int i = 0; i < V; ++i)
			g[i] = new ArrayList<>();

		for (int i = 0; i < E; ++i) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			g[s].add(t);
		}

		vis = new boolean[V];
		ord = new int[V];
		pending = new boolean[V];

		topologialSort();

		for (int i = V - 1; i >= 0; --i) {
			System.out.println(ord[i]);
		}

	}

	static ArrayList<Integer>[] g;
	static boolean[] vis;
	static boolean[] pending;
	static int V, E;
	static int[] ord;
	static int now = 0;

	static void topologialSort() {
		for (int i = 0; i < V; ++i) {
			if (!vis[i])
				dfs(i, -1);
		}
	}

	static void dfs(int cur, int pre) {
		pending[cur]=true;
		for (int to : g[cur]) {
			if (!vis[to] && pre != cur){
				if(pending[to])throw new AssertionError();
				dfs(to, cur);
			}
		}
		vis[cur] = true;
		ord[now++] = cur;
	}
}

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

struct point{
  int x,y;
};

int main(int argc, char *argv[]){
  int n, w, h;
  cin >> n;
  for (int r = 0; r < n; r++) {
    point p[7][2];//min, max
    map<char, int> matrial;
    cin >> h >> w;

    char grid[h][w];
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        cin >> grid[i][j];
        if(grid[i][j] != '.' &&
           matrial.find(grid[i][j]) == matrial.end()){
          matrial[grid[i][j]] = matrial.size() - 1;
        }
      }
    }

    vector<int> perm(matrial.size());
    for (int i = 0; i < matrial.size(); i++) {
      p[i][0].x = 1e9, p[i][0].y = 1e9;
      p[i][1].x =  -1, p[i][1].y =  -1;
      perm[i] = i;
    }

    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if(matrial.find(grid[i][j]) != matrial.end()){
          int tmp = matrial[grid[i][j]];
          p[tmp][0].x  = min(p[tmp][0].x, j);
          p[tmp][0].y  = min(p[tmp][0].y, i);
          p[tmp][1].x  = max(p[tmp][1].x, j);
          p[tmp][1].y  = max(p[tmp][1].y, i);
        }
      }
    }
    bool flag;
    do{
      flag = true;
      for (int i = 0; i < matrial.size(); i++) {
        for (int j = p[i][0].y; j <= p[i][1].y; j++) {
          for (int k = p[i][0].x; k <= p[i][1].x; k++) {
            if(grid[j][k] == '.'){
              i = 10;
              j = p[i][1].y + 10;
              k = p[i][1].x + 10;
              flag  = false;
              break;
            }
            if(perm[matrial[grid[j][k]]] > perm[i]){
              flag = false;
              i = 10;
              j = p[i][1].y + 10;
              k = p[i][1].x + 10;
            }
          }
        }
      }
    
    }while(next_permutation(perm.begin(), perm.end()) &&
           flag == false);
    if(flag){
      std::cout << "SAFE" << std::endl;
    }else{
      std::cout << "SUSPICIOUS" << std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1192
require 'pp'

N,K = readline.chomp.split.map(&:to_i)
S = readline.chomp

idx_10 = []
S.each_char.with_index do |c,idx|
  idx_10 << idx if c == '1' and S[idx+1] == '0'
end
idx_10 << S.size-1 # if S[-1] == '0'

# pp idx_10

idx_01 = []
idx_01 << 0
S.each_char.with_index do |c,idx|
  next if idx == 0
  idx_01 << idx if c == '1' and S[idx-1] == '0'
end

# pp idx_01

offset = (S[0]=='0' ? K-1 : K)
max = 0
idx_01.each_with_index do |b,idx|
  e = (idx_10[idx+offset] or idx_10.last)
  l = e-b+1
  max = l if l > max
end
  
puts max


Measured memory_bytes: 3380
h,w = map(int, input().split())

A = [input() for _ in range(h)]

flag = True

#初期位置
x,y=0,0
for _ in range(h+w-2):
    #枠内にいることと現在位置の右隣が'#'であることを確認する
    if x+1 < h and A[x+1][y] == '#':
        #進む
        x += 1
        continue
    #枠内にいることと現在位置の直下が'#'であることを確認する
    if y+1 < w and A[x][y+1] == '#':
        #進む
        y += 1
        continue
    #一度でも上に引っかからなかったら
    flag = False
    break

flag = flag and (sum(x.count('#') for x in A) == h+w-1)
ans = 'Possible' if flag else 'Impossible'
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int W, a, b;
  cin >> W >> a >> b;
  int ans = 0;
  if (a + W < b)
    ans = b - (a + W);
  else if (b + W < a)
    ans = a - (b + W);

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string a[N];

  int acnt = 0;
  int wcnt = 0;
  int tcnt = 0;
  int rcnt = 0;

  for(int i=0;i<N;i++){
    cin>>a[i];
    if(a[i]=="AC"){
      acnt++;
    }else if(a[i]=="WA"){
      wcnt++;
    }else if(a[i]=="TLE"){
      tcnt++;
    }else if(a[i]=="RE"){
      rcnt++;
    }
  }
  cout << "AC x " << acnt << endl;
  cout << "WA x " << wcnt << endl;
  cout << "TLE x " << tcnt << endl;
  cout << "RE x " << rcnt << endl;


}

Measured memory_bytes: 6756
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    map<int,int> dic;
    rep(i,N){
        int a; cin>>a;
        if(a<400) dic[0]++;
        else if(a<800) dic[1]++;
        else if(a<1200) dic[2]++;
        else if(a<1600) dic[3]++;
        else if(a<2000) dic[4]++;
        else if(a<2400) dic[5]++;
        else if(a<2800) dic[6]++;
        else if(a<3200) dic[7]++;
        else dic[8]++;
    }
    int mx,mn=dic.size();
    if(dic[8]==0) mx=mn;
    else{
        mx=mn+dic[8]-1;
        mn-=1;
        if(mn<=0) mn=1;
    }
    cout2(mn,mx)
}

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

using namespace std;

#define inf 1<<30
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;


int main(){
	int N;
	vector<llong> A(100000), B(100000), dis;
	llong sum = 0;
	cin >> N;
	int ans = 0;
	for(int i = 0; i < N; i++)
		cin >> A[i];
	for(int i = 0; i < N; i++){
		cin >> B[i];
		llong ab = A[i] - B[i];
		if(ab < 0){
			sum -= ab;
			ans++;
		}else
			dis.pb(ab);
	}
	sort(dis.begin(), dis.end());

	for(int i = dis.size()-1; i >= 0 && sum > 0; i--){
		ans++;
		sum -= dis[i];
	}

	if(sum > 0)
		cout << -1 << endl;
	else
		cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2936
import sys

def solve():
    n, q = map(int, sys.stdin.readline().split())
    ds = [[i] for i in range(n)]
    n2s = [i for i in range(n)]
    ans = []

    for lp in range(q):
        c, x, y = map(int, sys.stdin.readline().split())

        if c == 0:
            merge(ds, n2s, x, y)
        else:
            ans.append(1 if n2s[x] == n2s[y] else 0)

    print(*ans, sep='\n')

def merge(ds, n2s, x, y):
    u = n2s[x]
    v = n2s[y]

    if u == v:
        return None

    ds[v].extend(ds[u])
    for w in ds[u]:
        n2s[w] = v
    del ds[u][:]

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

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

int main() {
    int x[5];
    rep(i, 5) cin >> x[i];
    rep(i, 5){
        if(i+1 != x[i]){
            cout << i+1 << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 300000;

int main() {
	int n;string s;cin>>n>>s;
	int cw[N+2],ce[N+2];
	cw[0]=0;
	for(int i=1;i<=n;i++){
		if(s[i-1]=='W') cw[i]=cw[i-1]+1;
		else cw[i]=cw[i-1];
	}
	ce[n+1]=0;
	for(int i=n;i>=1;i--){
		if(s[i-1]=='E') ce[i]=ce[i+1]+1;
		else ce[i]=ce[i+1];
	}
	int ans=INF;
	for(int i=1;i<=n;i++){
		int tmp=0;
		if(i>1) tmp+=cw[i-1];
		if(i<n) tmp+=ce[i+1];
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
}


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

ll keta( ll num ){
  if( num/10 == 0 ) return 1;
  return 1 + keta(num/10);
}

ll rui( ll n,ll k ){
  if( k == 0 ) return 1;
  return n*rui(n,k-1);
}

ll func( ll num ){
  if( num/10 == 0 ) return num%10;
  return num%10 + func(num/10);
}

int main(){
  ll n;
  cin >> n;
  ll k = keta(n);
  for(ll i=1;i<=k-1;i++){
    ll j = n%(rui(10,i))/rui(10,i-1);
    if( j != 9 ){
      n -= (j+1)*rui(10,i-1);
    }
  }
  cout << func(n) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007

int main(){
  ll n,m;
  cin >> n >> m;
  ll x[m],sa[m-1];
  rep(i,m){
    cin >> x[i];
  }
  sort(x,x+m);
  rep(i,m-1){
    sa[i]=x[i+1]-x[i];
    //cout << sa[i] <<endl;
  }
  ll ans =0,res=0;
  sort(sa,sa+m-1);
  rep(i,m-n)ans+=sa[i];
  cout << ans <<endl;
}




Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
using namespace std;

int main(){
	int hand[5];
	char s[4];
	while(cin >> hand[0] >> s[0] >> hand[1] >> s[1] >> hand[2] >> s[2] >> hand[3] >> s[3] >> hand[4]){
		int trump[14] = {};
		for(int i = 0; i < 5; i++)trump[hand[i]]++;
		for(int i = 1; i <= 10; i++){
			for(int j = 0; j < 5; j++){
				int k = i + j;
				if(k == 14)k = 1;
				if(trump[k] != 1)goto no;
			}
			cout << "straight" << endl;
			goto fin;
			no:;
		}
		sort(trump, trump + 14, greater<int>());
		if(trump[0] == 4){
			cout << "four card" << endl;
			goto fin;
		}else if(trump[0] == 3 && trump[1] == 2){
			cout << "full house" << endl;
			goto fin;
		}else if(trump[0] == 3){
			cout << "three card" << endl;
			goto fin;
		}else if(trump[0] == 2 && trump[1] == 2){
			cout << "two pair" << endl;
			goto fin;
		}else if(trump[0] == 2){
			cout << "one pair" << endl;
			goto fin;
		}
		cout << "null" << endl;
		fin:;
	}
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define int long long
using namespace std;
signed main(){
    int N, K; cin >> N >> K;
    vector<long long> a(N), S1(N+1, 0), S2(N+1, 0);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        S1[i+1] = S1[i] + a[i];
        S2[i+1] = S2[i] + (a[i] >= 0 ? a[i] : 0);
    }
    long long res = -(1LL<<60);
    for (int i = 0; i + K <= N; ++i) {
        int left = i, right = i + K;
        long long tmp=(S2[left]-S2[0])+max(0LL, S1[right]-S1[left])+(S2[N]-S2[right]);
        res = max(res, tmp);
    }
    cout << res << endl;
}

Measured memory_bytes: 2560
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

# ----- heapq ここから-----
import heapq
class Reverse:
    def __init__(self, val):
        self.val = val
        
    def __lt__(self, other):
        return self.val > other.val
        
    def __repr__(self):
        return repr(self.val)
    
class Heapq:
    def __init__(self, arr, desc = False):
        if desc:
            for i in range(len(arr)):
                arr[i] = Reverse(arr[i])
        self.desc = desc
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        if self.desc: return heapq.heappop(self.hq).val
        else: return heapq.heappop(self.hq)
 
    def push(self, a):
        if self.desc: heapq.heappush(self.hq, Reverse(a))
        else: heapq.heappush(self.hq, a)
 
    def top(self):
        if self.desc: self.hq[0].val
        else: return self.hq[0]
# ----- heapq ここまで-----

n,m = myinput()
a = list(myinput())

hq = Heapq(a,desc=True)

for i in range(m):
    M = hq.pop()
    hq.push(M//2)

ans = 0
for i in range(n):
    ans += hq.pop()
    
print(ans)

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n, r;
  std::cin >> n >> r;
  if (n < 10) {
    r += 100 * (10 - n);
  }
  std::cout << r << std::endl;
  return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right; from collections import Counter, defaultdict, deque, OrderedDict; from copy import deepcopy; from fractions import gcd; from functools import lru_cache, reduce; from math import ceil, floor; from sys import stdin, setrecursionlimit
import heapq as hq; import itertools as its; import operator as op


# globals
inf = float('inf')
input = stdin.readline


def main():
    a, b = get_li()
    if abs(a - b) % 2 == 0:
        print((a + b) // 2)
    else:
        print('IMPOSSIBLE')
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def gets(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    setrecursionlimit(4100000)
    main()


Measured memory_bytes: 65516
var
	ans,a,b,I,cnt:int64;
	j:Longint;
begin
	read(a,b);
	if((b-a+1)div 2+(a mod 2)*(b mod 2))mod 2=1 then ans:=1;
	I:=1;
	for j:=1 to 59 do begin
		I:=I*2;
		cnt:=0;
		if(a and I)<>0 then begin
			inc(cnt,I-a mod I);
		end;
		if(b and I)<>0 then begin
			inc(cnt,b mod I+1);
		end;
		if(cnt mod 2)=1 then begin
			inc(ans,I);
		end;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
S = input()
N = len(S)
L = S
ans = 10000000
for c in set(S):
    S = L
    next = []
    while S.count(c) < len(S):
        for i in range(len(S)-1):
            if S[i+1] == c:
                next.append(S[i+1])
            else:
                next.append(S[i])
        S = next
        next = []
    ans = min(ans,N-len(S))
print(ans)

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

int main(){
  int N;
  cin>>N;
  
  int sum=0;
  
  for(int i=0;i<N;i++){
    int a=N/pow(10,i);
    
    if(a==0){
      break;
    }

      sum+=a%10;  
  }
    
    
    
    if(N%sum==0){
      cout<<"Yes"<<endl;
    }
    
    else{
      cout<<"No"<<endl;
    }
  }
    
    


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  	int N, a;
  	cin >> N;
 	for(int i = N; i > 0; ){
      	a += i % 10;
      	i /= 10;
    }
  	if(N % a == 0){
      	cout << "Yes";
    }else{
      	cout << "No";
    }
  	return 0;
}

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

int main(){
	int n;cin>>n;
	cout<<0<<endl;
	string s;cin>>s;
	if(s=="Vacant"){
		return 0;
	}
	int l=0,r=n-1;
	while(l!=r){
		int t=(l+r)/2;
		if(r-l==1)t=r;
		cout<<t<<endl;
		string res;cin>>res;
		if(res=="Vacant"){
			return 0;
		}
		if(t%2==0){
			if(s==res)l=t;
			else r=t-1;
		}
		else{
			if(s!=res)l=t;
			else r=t-1;
		}
	}
	cout<<l+1<<endl;
}

Measured memory_bytes: 852
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

vector<int> tree;
int size = 1;

void init(int n) {
  while (size < n) size *= 2;
  tree.assign(size * 2, 2147483647);
}

void update(int i, int x) {
  tree[i += size] = x;
  while (i /= 2) tree[i] = min(tree[i * 2], tree[i * 2 + 1]);
  ;
}

int find(int l, int r) {
  int accl = 2147483647, accr = 2147483647;
  for (l += size, r += size; l < r; l /= 2, r /= 2) {
    if (l & 1) accl = min(accl, tree[l++]);
    if (r & 1) accr = min(tree[--r], accr);
  }
  return min(accl, accr);
}

int main() {
  int n, q;
  cin >> n >> q;
  init(n);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com) {
      cout << find(x, y + 1) << endl;
    } else {
      update(x, y);
    }
  }
}

Measured memory_bytes: 3796
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	while(true)
	    {
		int n=scan.nextInt();
		if(n==0)break;
		int num[]=new int[n];
		int sum[]=new int[n];
		for(int i=0;i<n;i++)
		    {
			num[i]=scan.nextInt();
			for(int j=0;j<8;j++)
			    {
				if(j%2==0)sum[i]+=60*(scan.nextInt());
				else sum[i]+=scan.nextInt();
			    }
		    }
		
		for(int i=0;i<n;i++)
		    {
			int min=sum[i],x=i;
			for(int j=i;j<n;j++)
			    {
				if(min>sum[j])
				    {
					min=sum[j];
					x=j;
					
				    }
			    }
			int tmp=num[i];
			num[i]=num[x];
			num[x]=tmp;
			int tmp2=sum[i];
			sum[i]=sum[x];
			sum[x]=tmp2;
		    }
		
		System.out.println(num[0]);
		System.out.println(num[1]);
		System.out.println(num[n-2]);
	    }
    }
}

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

int ctoi(char c) {
    int n = c - '0';
    return n;
}

int pow_int(int x, int n) {
    if (n == 0) {
        return 1;
    }else {
        int y = x;
        for (int i = 0; i < n-1; i++) {
            x *= y;
        }
        return x;
    }
}


int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    vector<int> b(n);
    rep(i, n) b[i] = a[i+1] - a[i];
    b[n-1] = a[0] + (k - a[n-1]);
    sort(b.begin(), b.end());
    cout << k - b[n-1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int MAX=3e5+1;
int tree[2*MAX];
void update(int p, int val){
	p+=MAX;
	tree[p]=val;
	for(p/=2; p>=1; p/=2){
		tree[p]=max(tree[p*2], tree[p*2+1]);
	}
}
int get(int l, int r){
	int res=0;
	l+=MAX, r+=MAX;
	while(l<=r){
		if(!(r&1)) res=max(res, tree[r--]);
		if(l&1) res=max(res, tree[l++]);
		r=(r>>1), l=(l>>1);
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, k;
	cin >> n >> k;
	int a[n];
	int res=0;
	for(int i=0; i<n; i++){
		cin >> a[i];
		int temp=get(max(0, a[i]-k), min(a[i]+k, MAX-1));
		res=max(res, temp+1);
		update(a[i], temp+1);
	} 
	cout << res;
}

Measured memory_bytes: 7172
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n,a,b,c;
	scanf("%d",&n);
	a=n%10;
	n=n/10;
	b=n%10;
	n=n/10;
	c=n;
	if(c==7||b==7||a==7){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

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


int main() {
    ll n,d,ans=0;
    cin>>n>>d;
    ll a[n][d];
    for(int i=0;i<n;i++){
    	for(int j=0;j<d;j++){
    		cin>>a[i][j];
    	}
    }
    for(int i=0;i<n-1;i++){
    	for(int j=i+1;j<n;j++){
    		ll x=0;
    		for(int k=0;k<d;k++){
    			x+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
    		}
    	ll z=sqrt(x);
    	if(z*z==x){
    		ans++;
    	}
    	}

    }
    cout <<ans;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import collections
import heapq


AdjacentVertex = collections.namedtuple("AdjacentVertex", "vertex cost")
DIV = 100
INF = 2 ** 31 - 1


def compute_mst_prim(max_v, adj_list):
    key = collections.defaultdict(lambda: INF)
    key[0] = 0
    pq = [(key[v], v) for v in range(max_v)]
    heapq.heapify(pq)
    in_pq = array.array("B", (True for _ in range(max_v)))
    while pq:
        _, u = heapq.heappop(pq)
        in_pq[u] = False
        for v, v_cost in adj_list[u]:
            if in_pq[v]:
                w = v_cost
                if w < key[v]:
                    key[v] = w
                    heapq.heappush(pq, (w, v))
                    in_pq[v] = True
    return key


def compute_number_of_lanterns(max_v, adj_list):
    key = compute_mst_prim(max_v, adj_list)
    return sum(x - 1 for x in key.values() if x > 0)


def main():
    while True:
        n = int(input())
        if n == 0:
            break
        m = int(input())
        adj_list = collections.defaultdict(set)
        for _ in range(m):
            a, b, w = map(int, input().split(","))
            adj_list[a].add((b, w // DIV))
            adj_list[b].add((a, w // DIV))
        print(compute_number_of_lanterns(n, adj_list))


if __name__ == '__main__':
    main()

Measured memory_bytes: 9440
A=input()
B=input()
ans=float("inf")
for i in range(len(A)-len(B)+1):
   C=A[i:i+len(B)]
   tmp=0
   for j in range(len(B)):
      if C[j] != B[j]:
         tmp+=1
   ans=min(tmp,ans)
print(ans)

Measured memory_bytes: 9080
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

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

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

vector<ll> A;
vector<ll> B;

ll x = 0; // 現在地
ll L, N;

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

    // input
    cin >> L >> N;

    A.resize(N);
    B.resize(N);

    FOR(i, 0, N){
        ll x;
        cin >> x;
        A[i] = x;
        B[N-i-1] = L-x;
    }

    ll max_array[2];

    FOR(turn, 0, 2){
        if(turn==1){
            // p("後半戦");
            A.swap(B);
        }

        // 累積和
        ll AcA[N];
        AcA[0] = A[0];
        FOR(i, 1, N){
            AcA[i] = AcA[i-1] + A[i];
        }

        ll AcB[N];
        AcB[0] = B[0];
        FOR(i, 1, N){
            AcB[i] = AcB[i-1] + B[i];
        }

        // 反時計回り (数直線上では右) にi回動く
        ll max_d = A.back();
        FOR(i, 0, N-1){
            // p("");
            // pn(i);

            ll chokusin_suu = i;
            ll N2 = N - chokusin_suu;
            ll a_len = N2 / 2;
            ll b_len;
            if(N2%2==0){
                b_len = a_len - 1;  
            }else{
                b_len = a_len;
            }
            // pn(a_len);
            // pn(b_len);
            
            ll a_sum;
            if(a_len == 0){
                a_sum = 0;
            }
            else if(a_len==1){
                a_sum = A[i];
            }else{
                if(i==0){
                    a_sum = AcA[a_len-1+i];
                }else{
                    a_sum = AcA[a_len-1+i] - AcA[i-1];
                }
            }

            ll b_sum;
            if(b_len == 0){
                b_sum = 0;
            }else if(b_len == 1){
                b_sum = B[0];
            }else{
                b_sum = AcB[b_len-1];
            }

            // pn(a_sum);
            // pn(b_sum);
            
            ll last;
            if(N2%2==0){
                last = B[b_len];
            }else{
                last = A[a_len+i];
            }

            // pn(last);

            ll d = 2 * (a_sum + b_sum) + last;
            //cout << "i " << i << " d " << d << endl;
            max_d = max(max_d, d);
        }

        // p("answer");
        // p(max_d);
        max_array[turn] = max_d;

    }

    p(max(max_array[0], max_array[1]));

    
    return 0;
}

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

//#define int long long
#define ll long long
#define F first 
#define S second 
#define pb push_back
#define ld long double

using namespace std ; 

const int MAXN = 201 * 1001 , MOD =  1e9 + 7 , L = 18 ;

int n , x , y ;

int fact[MAXN] , inv[MAXN] ; 

int tv(int x , int y)
{
	if(!y) return 1 ; 
	ll ans = tv(x,y/2) ; 
	ans *= ans , ans %= MOD ; 
	if(y&1) ans *= x ;
	return ans % MOD ; 
}


int c[MAXN] , w[MAXN] ; 

priority_queue<pair<int,int>> s[40] ;

unordered_map<int,int> cnt[MAXN] ; 

set<int> S[MAXN] ; 
/*
inline void erase(int c , int w )
{
	S[c].erase(w) ; 
	for(int i = 0 ; i < L ; i ++ ) {
		if(c&(1<<i))
			s[i].erase({w,c}) ; 
		else
			s[i+L].erase({w,c});
	}
	
}
*/
vector<pair<int,int>> v; 

void dfs(int C , int W )
{
//	cout << '*' << C << ' ' << W << endl ; 
	v.pb({C,cnt[C][W]}) ; 
	S[C].erase(W) ; 	
//	erase(C,W) ;
	
	if(!cnt[C][W]) return ;

	cnt[C][W] = 0 ;
	
//	v.pb({C,W}) ; 
	int w = y - W ; 
	//cout << w << endl ; 
	for(int i = 0 ; i < 2 * L ; i ++ ) 
	{
		if(C&(1<<i)&&i<L) continue ; 
		if(!(C&(1<<(i-L)))&&i>=L) continue ; 
	//	if(C==3&&W==2)cout << i << endl ;
	//	if(i==20) cout << ' ' << s[i].size() << (s[i].begin()->F) << endl ;
		while(s[i].size())
		{
			pair<int,int> p = s[i].top() ; 
			p.F *= -1 ; 
			if(p.F>w) break ;
			s[i].pop()  ; 
			dfs(p.S,p.F) ;  
		}
	}

	w = x - W ;
	while(S[C].size()&&*S[C].begin()<=w)
	{
		dfs(C,*S[C].begin()) ; 
	}
}

int32_t main()
{
//	ios::sync_with_stdio(0) ;
	fact[0] = inv[0] = 1 ;
	for(int i = 1 ; i < MAXN ; i ++ ) fact[i]  = 1LL * i * fact[i-1] % MOD , inv[i] = tv(fact[i],MOD-2); 
//	s[0].push({1,2}) ; 
//	s[0].push({2,3}) ; 
//	cout << s[0].top().F << endl ; 
	//	cin >> n >> x >> y ; 
	scanf("%d%d%d",&n,&x,&y) ; 
	for(int i = 0 ; i < n ; i ++ ) 
	{
		//cin >> c[i] >> w[i] ; 
		scanf("%d%d",&c[i],&w[i]) ;
		cnt[c[i]][w[i]] ++ ;
		for(int j = 0 ; j < L ; j ++ ) 
		{
			if(c[i]&(1<<j))
				s[j].push({-w[i],c[i]}) ; 
			else{
	//			if(c[i]==2) cout << '&' << j << endl ; 
				s[j+L].push({-w[i],c[i]}) ; 
			}
		}
		S[c[i]].insert(w[i]) ; 
	}
	ll ans = 1 ; 
	for(int i = 0 ; i < n ; i ++ ) 
	{
		if(!cnt[c[i]][w[i]]) continue ; 
		v.clear() ; 
		dfs(c[i],w[i]) ; 
		int C = 0 ; 
		sort(v.begin(),v.end()) ; 
		int prv = -1 , x = 0 ; 
		for(auto u : v)
		{
	//		cout << u.F << ' ' << u.S << endl ;
			C += u.S ; 
			if(u.F==prv) x += u.S ; 
			else ans *= inv[x] , ans %= MOD , prv = u.F , x = u.S ; 
		}
	//	cout << endl << endl ; 
		ans *= inv[x] ; ans %= MOD ; 
		ans *= fact[C] ; ans %= MOD ;
	//	cout << C << endl ;
	}
	cout << ans << endl ; 
}


Measured memory_bytes: 123012
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int ceil(int a, int b) {

	if (a % b == 0) {
		return a / b;
	}
	else {
		return a / b + 1;
	}
}

int main() {

	//input
	int N, K;
	cin >> N >> K;

	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	cout << ceil(N - 1, K - 1);
	return 0;
}

Measured memory_bytes: 640
N = int(input())
s = input()
t = input()
for i in range(N):
    tmp_s = ''
    tmp_t = ''
    for k in range(i,N):
        tmp_s += s[k]
    for k in range(0,N-i):
        tmp_t += t[k]
    if tmp_s == tmp_t:
        print(2*N-len(tmp_s))
        exit()
print(2*N)

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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,string>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c, n, sum, A[500010], B[500000], rui[500000], dp[5000];
str S; bool check = true;	vector<ll> v;
P test[500000];


int main() {
	//Code Line
	cin >> a >> n;
	for (int i = 0; i < n; i++) {
		cin >> test[i].first >> test[i].second;
	}

	for (int i = 0; i < n; i++) {
		ll t = test[i].first; string s = test[i].second;
		if (!A[t]) {
			if (s == "WA")B[t]++;
			else A[t] = 1;
		}

	}
	for (int i = 0; i <= a; i++) {

		if (A[i]) {
			sum += B[i];
			c++;
		}

	}
	cout << c << " " << sum << endl;


	return 0;
}


Measured memory_bytes: 21248
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
long long a[100010];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int p=n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]>0 && p==n)p=i-1;
	}
	long long ans=0x3f3f3f3f;
	for(int i=1;i<=n;i++)
	{
		if(p-i+1>=k || i-p>=k)ans=min(ans,abs(a[i]));
		else 
		{
			if(i+k-1<=n)ans=min(ans,abs(a[i])+a[i+k-1]-a[i]);
			if(i-k+1>=1)ans=min(ans,abs(a[i])+a[i]-a[i-k+1]);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 896
/*
 * 16-11-12_AGC007_B.cpp
 *
 *  Created on: 2016/11/12
 *      Author: ryoma
 */
#include<iostream>

using namespace std;

int N,p[20001],a[20001],b[20001];
bool check[20001];
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> p[i];
		p[i]--;
		a[i] = N*i+1;
		b[i] = N*N-N*i;
	}
	for(int i=0;i<N;i++){
		check[p[i]] = true;
		for(int j=0;j<N;j++)
		if(!check[j])
		{
			if(j<p[i])
				b[j]++;
			else if(j>p[i])
				a[j]++;
		}
	}
	for(int i=0;i<N;i++){
		cout << a[i];
		if(i<N-1)
			cout << " ";
		else
			cout<<endl;
	}

	for(int i=0;i<N;i++){
		cout << b[i];
		if(i<N-1)
			cout << " ";
		else
			cout<<endl;
	}

	return 0;
}





Measured memory_bytes: 896
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int k = sc.nextInt();
		int x = sc.nextInt();

		boolean flag = false;
		for (int i = x - k + 1; i <= x + k- 1; i++) {
			if (!flag) {
				flag = true;
			} else {
				pr.print(" ");
			}
			pr.print(i);
		}
		pr.println();
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


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

int main() {
  string s, t;
  cin >> s;

  for (int i = 0; i < s.size(); i += 2) {
    t += s[i];
  }
  cout << t << endl;

  return 0;
}


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

int main() {
  int N; cin >> N;
  vector<int> lst = {
    1, 2, 3, 4, 5, 6, 7, 8, 9,
    2, 4, 6, 8, 10, 12, 14, 16, 18,
    3, 6, 9, 12, 15, 18, 21, 24, 27,
    4, 8, 12, 16, 20, 24, 28, 32, 36,
    5, 10, 15, 20, 25, 30, 35, 40, 45,
    6, 12, 18, 24, 30, 36, 42, 48, 54,
    7, 14, 21, 28, 35, 42, 49, 56, 63,
    8, 16, 24, 32, 40, 48, 56, 64, 72,
    9, 18, 27, 36, 45, 54, 63, 72, 81
  };
  bool flag = false;
  for (int i = 0; i < 81; i++) {
    if (lst.at(i) == N) flag = true;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
a = list(input())
b = list(input())
min_k = len(b)
for i in range(len(a)-len(b)+1):
  c = a[i:i+len(b)]
  count=0
  for k,j in enumerate(c):
    if b[k]==j:
      count+=1
        
  min_k = min(min_k,len(b)-count)

print(min_k)

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

main() {
    int N; cin >> N;
    if(N%2==0) cout << N << endl;
    else cout << N*2 << endl;

    return 0;
}

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

int main(){
  int N;
  bool f=true;
  cin>>N;
  int t[N],x[N],y[N];
  for(int i=0;i<N;i++) cin>>t[i]>>x[i]>>y[i];
  if(t[0]-(x[0]+y[0])<0) f=false;
  else if(t[0]%2!=(x[0]+y[0])%2) f=false; 
  for(int i=0;i<N-1;i++){
    int dt=t[i+1]-t[i],dx=fabs(x[i+1]-x[i]),dy=fabs(y[i+1]-y[i]);
    int a=dt-(dx+dy);
    if(a<0) f=false;
    else if(dt%2!=(dx+dy)%2) f=false;
  }
  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

int main(){
    int l,r,d; cin >> l >> r >> d;
    int ans = 0;
    FOR(i,l,r+1){
        if(i % d == 0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <algorithm>
#define int long long
using namespace std;

int n,s=0,ans=1;

signed main(void){
	scanf("%lld",&n);
	while(n>1){
		n/=2;
		s++;
//		printf("%lld\n",n);
	}
	for(int i=1;i<=s+1;i++)
	ans*=2;
	ans--;
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ff first
#define ss second
const ll mod = 1e9 + 7 ;
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
///////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////
void solve( ){
    ll h , n ;
    cin >> h >> n ;
    vector < ll > a(n);
    ll sum = 0 ;
    for( int i = 0 ; i < n ; i++) cin >> a[i] , sum+=a[i];
    if(sum>=h){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test_case=1 ;
    //cin >> test_case ;
    for( int i = 1 ; i <= test_case ; i++){
        solve( );
    }
}


Measured memory_bytes: 1024
n=int(input())
alis=[]
blis=[]
for i in range(n):
  a,b=map(int,input().split())
  alis.append(a)
  blis.append(b)
  
  
alis=sorted(alis)
blis=sorted(blis)
if n%2!=0:
  print(blis[int((n-1)/2)]-alis[int((n-1)/2)]+1)
else:
  bb=(blis[int(n/2)-1]+blis[int(n/2)])
  aa=(alis[int(n/2)-1]+alis[int(n/2)])
  print(bb-aa+1)

Measured memory_bytes: 102092
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(3).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,e,t){function n(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var o=t(2);r.exports=function(r){for(var e=o(1e5),t=new Array(100001).fill(0),u=3;u<1e5;u++)t[u]=t[u-1],1==e[u]&&1==e[(u+1)/2]&&(t[u]+=1);for(var i=Number(r[0]),f=0;f<i;f++){var l=n(r[f+1].split(" ").map(function(r){return Number(r)}),2),a=l[0],c=t[l[1]]-t[a-1];console.log(c)}}},function(r,e,t){"use strict";r.exports=function(r){var e=new Array(r+1).fill(1);e[0]=0,e[1]=0;for(var t=Math.ceil(Math.sqrt(r)),n=2;n<t;n++)if(0!=e[n])for(var o=n;o<=r;)e[o+=n]=0;return e}},function(r,e){r.exports=require("fs")}]);

Measured memory_bytes: 34396
from collections import deque
h,w=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())

maze = [list(input()) for i in range(h)]
ans = [[-1]*w for i in range(h)]

dx=[0,1,0,-1]
dy=[1,0,-1,0]

ans[ch-1][cw-1]=0
def bfs(ans):
  qu = deque([])
  qu.append([cw-1,ch-1])
  while qu:
    zahyou=qu.popleft()
    x=zahyou[0]
    y=zahyou[1]
    for i in range(4):
      if 0 <= x+dx[i] < w and 0 <= y+dy[i] < h:
        if maze[y+dy[i]][x+dx[i]]=="." and (ans[y+dy[i]][x+dx[i]]>ans[y][x] or ans[y+dy[i]][x+dx[i]]==-1):
          qu.appendleft([x+dx[i],y+dy[i]])
          ans[y+dy[i]][x+dx[i]] = ans[y][x]
    for i in range(x-2,x+3):
      for j in range(y-2,y+3):
        if 0<=i<w and 0<=j<h:
          if maze[j][i]=="." and (ans[j][i]>ans[y][x]+1 or ans[j][i]==-1):
            ans[j][i]=(ans[y][x]+1)
            qu.append([i,j])

bfs(ans)
print(ans[dh-1][dw-1])
  



Measured memory_bytes: 136724
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> btnTarget(N);
    for(int i=0;i<N;++i){
        int target;
        cin>>target;
        btnTarget[i]=target-1;
    }
    
    vector<bool> btnReached(N,false);
    btnReached[0]=true;
    int cur=0;
    int elapsed=0;
    while(true){
        cur=btnTarget[cur];
        ++elapsed;
        
        if(cur==1)break;
        if(btnReached[cur])break;
        
        btnReached[cur]=true;
    }
    cout<<(cur==1?elapsed:-1)<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std; 
#define ll long long
#define ld long double
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i) 
#define FOr(i,x,y)  for(ll i=x;i>=y;--i) 
#define pi acos(-1)
#define pa pair<ll,ll>
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)		(x)*(x)
#define Mul(x,y)    x=x*(y)%mod
#define Add(x,y)    x=(x+(y))%mod
#define Max(x,y)	x=x<(y)?(y):x
#define Min(x,y)	x=x>(y)?(y):x
#define E(x) 		return writeln(x),0
#define p(x)		printf("~%d~\n",x)
#define pp(x,y)		printf("~~%d %d~~\n",x,y)
#define ppp(x,y,z)	printf("~~~%d %d %d~~~\n",x,y,z)
#define f_in(x)		freopen(x".in","r",stdin)
#define f_out(x) 	freopen(x".out","w",stdout)
#define open(x)		f_in(x),f_out(x)
#define fi first
#define se second
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif 
#define NEG 1
    const int L=2333333;
    char SZB[L],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,L,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }
}using namespace SHENZHEBEI;
ll q[100000][3],a[310][310],mark[310][310],all_sz,A,B,top;
int main(){
	A=read(),B=read();
	For(i,1,A)For(j,1,B)a[i][j]=read();
	For(i,1,A)For(j,1,B)if (a[i][j]<a[i-1][j]||a[i][j]<a[i][j-1])	return puts("Impossible"),0;all_sz=202;
	For(cho_a,0,100)For(cho_b,0,100)For(cho_z,0,100)if (cho_a+cho_b+cho_z<=100){
		bool fl=1;
		For(i,1,A)For(j,1,B)if (a[i][j]>cho_a*i+cho_b*j+cho_z)	fl=0;
		if (!fl)	continue;
		fl=0;
		For(i,1,A)For(j,1,B)if (!mark[i][j]&&(a[i][j]==cho_a*i+cho_b*j+cho_z))	mark[i][j]=1,fl=1;
		if (fl){
			q[++top][0]=cho_a+1;
			q[top][1]=all_sz-cho_b;
			q[top][2]=cho_z;
		}
		break;
	}
	For(i,1,A)For(j,1,B)if (!mark[i][j])	return puts("Impossible"),0;
	ll node=1;
	For(i,1,100)	q[++top][0]=node,q[top][1]=++node,q[top][2]=-1;
	q[++top][0]=node;	q[top][1]=all_sz;	q[top][2]=-1;
	For(i,1,100)	q[++top][0]=(i==1)?1:node,q[top][1]=++node,q[top][2]=-2;
	q[++top][0]=node;	q[top][1]=all_sz;	q[top][2]=-2;
	puts("Possible");
	printf("%d %d\n",all_sz,top);
	For(i,1,top){
		if (q[i][2]>=0)	printf("%d %d %d\n",q[i][0],q[i][1],q[i][2]);
		if (q[i][2]==-1)printf("%d %d X\n",q[i][0],q[i][1]);
		if (q[i][2]==-2)printf("%d %d Y\n",q[i][0],q[i][1]);
	}printf("%d %d\n",1,all_sz);
}

Measured memory_bytes: 2304
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        
       	Scanner sc=new Scanner(System.in);
		char c = sc.next().charAt(0); 
   
		if(Character.isUpperCase(c))
		{
		    System.out.println("A");
		}
		else if(Character.isLowerCase(c))
		{
		    System.out.println("a");
		}
    }
}

Measured memory_bytes: 35420
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,j,k,l,c=0;
    double m,res=0.0,x,mx=0.0;
    cin>>n>>k;
    long long int ar[n];
    for(i=0; i<n; i++)
        cin>>ar[i];
    double br[n];
    for(i=0; i<n; i++)
    {
        x=ar[i];
        m=((x+1)*x)/2;
        m=m/x;
        br[i]=m;
    }
    for(i=0; i<k; i++)
    {
        res=res+br[i];
    }
    mx=max(res,mx);
    for(i=k,j=0; i<n; i++,j++)
    {
        res=res+br[i]-br[j];
        mx=max(res,mx);
    }
    cout<<fixed<<setprecision(12)<<mx<<endl;


}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
const ll MAX_N=2e5;
ll N,A[MAX_N],K;
bool vis[MAX_N];
ll tim[MAX_N];
int main(){
	cin>>N>>K;
	REP(i,N){
		cin>>A[i];
		A[i]--;
	}
	vis[0]=true;
	tim[0]=0;
	ll v=0,cnt=0;
	while(K>0){
		K--;
		cnt++;
		v=A[v];
		if(vis[v]){
			K%=cnt-tim[v];
			break;
		}else{
			vis[v]=true;
			tim[v]=cnt;
		}
	}
	while(K>0){
		K--;
		v=A[v];
	}
	cout<<v+1<<endl;
}


Measured memory_bytes: 6936