akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;

typedef pair<int ,int > P;
typedef pair<int, P> P2;

int v[30][30];
bool vb[30][30][20];
string g[30],L;
int h,w,s;
int ay,ax,by,bx;
int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

int main(){
  while(cin >> h >> w , h||w){
    for(int i=0;i<h;i++)cin >> g[i];
    cin >> L;
    s = L.size();

    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	if(g[i][j] == 'A'){
	  ay = i; ax = j;
	}
	if(g[i][j] == 'B'){
	  by = i; bx = j;
	}
	v[i][j] = -1;
	for(int k=0;k<s;k++)vb[i][j][k] = false;
      }

    queue<P2> q;
    v[ay][ax] = 0;
    q.push(P2(0,P(ay,ax)));

    while(!q.empty()){
      P2 p = q.front();q.pop();
 
      for(int i=0;i<4;i++){
	int sy = p.second.first + dy[i] , sx = p.second.second + dx[i];
	if(sy<0 || sx<0 || h<=sy || w<=sx)continue;
	if(v[sy][sx]>=0 || g[sy][sx]=='#')continue;
	v[sy][sx] = p.first+1;
	q.push(P2(p.first+1,P(sy,sx)));
      }
    }

    int t = 0;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)t = max(t,v[i][j]);

    for(int i=0;;i++){
      if(i<=t){
	if(v[by][bx]>=0 && v[by][bx]<=i){
	  cout << i << " " << by << " " << bx << endl;
	  break;
	}
      }else{
	if(v[by][bx]>=0){
	  cout << i << " " << by << " " << bx << endl;
	  break;
	}
	if(vb[by][bx][i%s]){
	  cout << "impossible\n";
	  break;
	}
      }
      vb[by][bx][i%s] = true;
      if(L[i%s] == '8' && 0<by)by--;
      if(L[i%s] == '6' && bx<w-1)bx++;
      if(L[i%s] == '2' && by<h-1)by++;
      if(L[i%s] == '4' && 0<bx)bx--;
    }
			
  }
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b >= c) {
    cout << b + c << endl;
  } else {
    cout << a + b * 2 + 1 << endl;
  }
  return 0;
}


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


// typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>  ordered_set;
#define ll long long
 
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl
 
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
ld dp[305][305][305];
ld n;
ld fn(ll a,ll b,ll c)
{
    if(a<0||b<0||c<0)
    {
        return 0;
    }
    if(dp[a][b][c]!=0)
        return dp[a][b][c];
    if(a==0&&b==0&&c==0)
    {
        return 0;
    }
    ld x=0;
    x+=(a/n)*fn(a-1,b+1,c);
    x+=(b/n)*fn(a,b-1,c+1);
    x+=(c/n)*fn(a,b,c-1);
    x++;
    x=(x*n)/(a+b+c);
    return dp[a][b][c]=x;
}
#define INF 1000000000000000000
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<setprecision(11);
    long double pi= 3.14159265358979323846;
    cin>>n;
    ll ar[(ll)n];
    ll a=0,b=0,c=0;
    rep(i,n)
    {
        cin>>ar[i+1];
        if(ar[i+1]==1)
            a++;
        else if(ar[i+1]==2)
            b++;
        else
            c++;
    }
    cout<<fn(c,b,a);
    return 0;
}

Measured memory_bytes: 436480
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] d = new int[n];

        for (int i = 0; i < n; i++) {
            d[i] = sc.nextInt();
        }

        Arrays.sort(d);
        int a = d[n/2-1];
        int b = d[n/2];

        System.out.println(b - a);
    }
}

Measured memory_bytes: 50352
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

int main() {
    char a[1000][1000];
    int H, W;
    queue<vector<int>> q;
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};

    cin >> H >> W;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            char c; cin >> c;
            a[i][j] = c;

            if(c == '#') {
                q.push({i, j, 0});
            }
        }
    }

    int d;

    while(!q.empty()) {
        vector<int> v = q.front(); q.pop();
        d = v[2];

        for(int i = 0; i < 4; ++i) {
            int ny = v[0] + dy[i];
            int nx = v[1] + dx[i];

            if(0 <= ny && ny < H && 0 <= nx && nx < W && a[ny][nx] == '.') {
                a[ny][nx] = '#';
                q.push({ny, nx, v[2]+1});
            }
        }
    }

    cout << d << endl;
}


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

int main() {
  int n, m ,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i, m) cin >> b[i];
  int cnt = 0;
  rep(i, n) {
    int sum = 0;
    rep(j, m) {
      int a;
      cin >> a;
      sum += b[j]*a;
      if(j == m-1) {
        if(sum + c > 0) cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<string.h>
#include<algorithm>
#include <math.h>
#include<iostream>
using namespace std;
typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         ld;

#define sf                  scanf
#define pf                  printf
#define srev                reverse(s.begin(),s.end())
#define gtl(x)              getline(cin, (x))
//#define gcd                 __gcd
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define PI                  acos(-1)
int main()
{
    char s[5];
    cin >> s;
    if(s[0]=='7' || s[1]=='7' || s[2]=='7')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;

}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long N,K;
  cin >> N >> K;
  vector<int> x(N);
 
  for(int i = 0; i < N; i++){
    cin >> x.at(i);
    x.at(i) = (x.at(i) + 1);
  }
 
  long m = 0;
  long tmp = 0;
 
  for(int i = 0; i < K; i++){
    tmp += (long)x.at(i);
  }
 
  m = tmp;
  for(int i = 1; i < N - K + 1; i++){
    tmp = tmp - (long)x[i-1] + (long)x[i+K-1];
    if(tmp > m){
      m = tmp;
    }
  }
 
  cout << fixed << setprecision(6) << (long double)(m) / 2.0 << endl;
 
}


Measured memory_bytes: 1024
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    plus = 0
    minus = 0
    for a, b in zip(A, B):
        if b - a > 0:
            plus += (b - a)//2
        else:
            minus += a - b
    if plus >= minus:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 40176
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete

nbsearch k (l,r,i) arr
  | l>r = i
  | otherwise = let mid = (l+r) `div` 2 in case compare (arr!mid) k of 
        EQ -> i+1
        GT -> nbsearch k (l,mid-1,i+1) arr
        LT -> nbsearch k (mid+1,r,i+1) arr

main = do
    n <- getInt
    unless (n==0) $ do
        arr <- listArray (0,n-1) <$> replicateM n getInt :: IO (Array Int Int)
        k <- getInt
        print $ nbsearch k (0,n-1,0) arr
        main


Measured memory_bytes: 4140
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int sum = 0;
        int i = 0;
        for (; sum <= n; i++, sum += i) ;
        Console.WriteLine(string.Join("\n", Enumerable.Range(1, i).Where(x => x != sum - n)));
    }
}


Measured memory_bytes: 11348
program ROT_N
  implicit none
  integer :: n, l, i
  character(10000) :: s
  read(*,*) n
  read(*,*) s
  l = len_trim(s)
  do i = 1, l
    s(i:i) = achar(mod(ichar(s(i:i))-65+n,26)+65)
  end do
  write(*,'(a)') trim(s)
end program ROT_N

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define rep(i, l, r)  for(int i = l; i <= r; i++)
#define PII pair<int,int>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const int maxn = 1000005;
inline int read(){
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
const double PI = 3.14159;

int a[maxn];
int main() {
    int n = read(), m = read();
    ll sum = 0;
    rep(i, 1, m) a[i] = read(), sum += a[i];
    if(sum <= n) cout << n-sum << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define MOD 1000000007

long mod_pow(long x, long n, long p=MOD){
  if(x==0) return 0;
  long res=1;
  x %= p;
  while(n>0){
    if(n&1) res=res*x%p;
    x=x*x%p;
    n>>=1;
  }
  return res;
}
inline long mod_inv(long x, long p=MOD){ return mod_pow(x%p, p-2, p); }

long inv2[200];

long p[1<<15];
bool g[15][15];

int innum[1<<15];
int outnum[1<<15];
int outs[1<<15];

int main(){
  int n,m;
  cin>>n>>m;
  fill(g[0], g[15], false);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a][b] = g[b][a] = true;
  }

  inv2[0] = 1;
  inv2[1] = mod_inv(2);
  rep(i,2,200) inv2[i] = inv2[i-1] * inv2[1] %MOD;

  rep(mask,1<<n){
    innum[mask] = 0;
    rep(i,n) rep(j,i) if(g[i][j] && (mask>>i)%2 && (mask>>j)%2) innum[mask]++;
  }

  for(int ini=1; ini<=2; ini++){
    p[ini] = 1;
    rep(mask, ini+4, 1<<n) if(mask%4 == ini){
      // calc p[mask]
      p[mask] = 1;
      for(int nmask = (mask-1)&mask; nmask>0; nmask = (nmask-1)&mask) if(p[nmask]>0){
        int dmask = mask - nmask;
        int cnt = innum[mask] - innum[nmask] - innum[dmask];
        p[mask] -= p[nmask] * inv2[cnt] %MOD;
      }
      p[mask] %= MOD;
      if(p[mask] < 0) p[mask] += MOD;
    }
  }

  rep(mask, 1<<n) if(mask%4==1 || mask%4==2){
    outnum[mask] = 0;
    outs[mask] = 0;
    rep(i,n) if( (mask>>i)%2 ){
      rep(j,n) if(g[i][j] && ((mask>>j)%2 == 0)){
        outnum[mask]++;
        outs[mask] |= (1<<j);
      }
    }
  }

  long ans = 1;
  rep(maskA, 1, 1<<n) if(maskA%4 == 1 && p[maskA]>0){
    int invmask = (~maskA)&( (1<<n) - 1);
    for(int maskB = invmask; maskB>0; maskB = (maskB-1)&invmask) if(maskB%4 == 2 && p[maskB]>0){
      if(outs[maskA]&maskB) continue;
      if(outs[maskB]&maskA) continue;

      ans -= p[maskA] * p[maskB] %MOD * inv2[outnum[maskA]+outnum[maskB]] %MOD;
    }
  }

  ans %= MOD;
  if(ans < 0) ans += MOD;
  rep(i,m) ans = ans*2%MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 896
import numpy as np

N = int(input())
S = list(input())

black_stones = []
white_stones = []

black_stone_counter = 0
for stone_color in S:
    if stone_color == "#":
        black_stone_counter += 1
    black_stones.append(black_stone_counter)

white_stone_counter = 0
for stone_color in S[::-1]:
    if stone_color == ".":
        white_stone_counter += 1
    white_stones.append(white_stone_counter)

black_stones_np = np.array(black_stones)
white_stones.reverse()
white_stones_np = np.array(white_stones)

sum_stones_np = black_stones_np + white_stones_np

print(sum_stones_np.min()-1)


Measured memory_bytes: 27708
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):
    sl = set()

    for i in range(len(s)):
        for j in range(i,min(i+K,len(s))):
            sl.add(s[i:j+1])

    sl = list(sorted(sl))   
    # print(sl)
    print(sl[K-1])

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc160/abc160_d.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int N;
void dijkstra(int i, vector<vector<int>> &g, vector<vector<int>> &f,
              vector<int> &cnt) {
  priority_queue<P, vector<P>, greater<P>> que;
  vector<int> fixed(N, -1);
  for (int j : g[i]) {
    que.push(make_pair(1, j));
  }
  while (!que.empty()) {
    P top = que.top();
    que.pop();

    int nexti = top.second;
    int currentCost = top.first;

    if (fixed[nexti] != -1) continue;
    fixed[nexti] = 1;

    if (f[i][nexti] == 0) {
      // 距離の組み合わせ個数をカウント
      f[i][nexti] = 1;
      f[nexti][i] = 1;
      cnt[currentCost - 1] += 1;
    }

    // printf("i:%d next: %d cst:%d cnt:%d\n", i, nexti, currentCost,
    //        cnt[currentCost - 1]);
    for (int to : g[nexti]) {
      if (i == to) continue;
      que.push(make_pair(currentCost + 1, to));
    }
  }
  return;
}

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int X, Y;
  cin >> N >> X >> Y;

  vector<vector<int>> g(N, vector<int>(0));
  rep(i, N - 1) {
    g[i].push_back(i + 1);
    g[i + 1].push_back(i);
  }
  g[X - 1].push_back(Y - 1);
  g[Y - 1].push_back(X - 1);

  vector<vector<int>> fixed(N, vector<int>(N, 0));
  vector<int> cnt(N, 0);
  rep(i, N - 1) { dijkstra(i, g, fixed, cnt); }

  rep(i, N - 1) { cout << cnt[i] << endl; }
}

Measured memory_bytes: 18048
#include <iostream>
#include <vector>
#include <algorithm>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
using namespace std;

const int MOD=1e9+7;
const int N=1e5+7;
int lcs[3005][3005];


int main()
{
	IOS;
	string a,b;
	cin >> a >> b;
	int len1, len2;
	len1 = a.size();
	len2 = b.size();

	for (int i = 0; i <= len1; ++i)
	{
		for (int j = 0; j <= len2; ++j)
		{
			if ( i == 0 || j==0 )
				continue;
			else if(a[i-1] == b[j-1])
				lcs[i][j] = ( lcs[i-1][j-1] + 1 );
			else
				lcs[i][j] = max( lcs[i-1][j], lcs[i][j-1] );
		}
	}
	int ans = lcs[len1][len2];
	int x = len1, y = len2;
	char ch[ans+1];
	ch[ans] = '\0';
	while ( x > 0 && y > 0)
	{
		if( a[x-1] == b[y-1] )
		{
			ch[ans-1] = a[x-1];
			x--;
			y--;
			ans--;
		}
		else if(lcs[x-1][y] > lcs[x][y-1])
			x--;
		else
			y--;
	}
	cout << ch <<"\n";
	return 0;
}



Measured memory_bytes: 35456
#include <iostream>

int main(int argc, char *argv[])
{
    int n, k;
    int ans;

    std::cin >> n >> k;

    if (k == 1) {
        ans = 0;
    } else {
        ans = n - k;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<vector>
#include<stdbool.h>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<set>
#include<string>
#include<stdlib.h>
typedef long long ll;
using namespace std;

int main() {
	int X, Y, Z;
	cin >> X >> Y >> Z;
	for (int i = 0;i <= X;i++) {
		if (X < (Y + Z)*i + Z) {
			cout << i-1 << endl;
			return 0;
		}
		else if (X == (Y + Z)*i + Z) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 384
/*
 * atcoder/abc089/b.cpp
 */

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

void solve() {
  int a, b; cin >> a >> b;
  
  loop(c,1,2000) {
    if (c * 8 / 100 == a and c / 10 == b) {
      cout << c << endl;
      return;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const int MAXN = 100000;
vector<int> to[MAXN];

void dfs(int v, int pre, int dist, vector<int> &d) {
  d[v] = dist;
  for (int u : to[v]) {
    if(u == pre) continue;
    dfs(u, v, dist + 1, d);
  }
}

int main() {
  int n, u, v;
  cin >> n >> u >> v;
  --u; --v;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vector<int> du(MAXN), dv(MAXN);
  dfs(v, -1, 0, dv);
  dfs(u, -1, 0, du);
  int ans = 0;
  rep(i, n) {
    if(du[i] < dv[i]) ans = max(ans, dv[i]);
  }
  cout << ans - 1 << endl;
}

Measured memory_bytes: 11648
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <cstdio>
using namespace std;
#define mygc(c) (c)=getchar()
void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;} }for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}

int64_t A[5000];
int B[5000][200];

int main(){
    int N,M;
    reader(&N); reader(&M);
    for(int i=1;i<N;i++){
        int a;
        reader(&a);
        A[i]=(int64_t)a+A[i-1];
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
            reader(&B[i][j]);
        }
    }
    int64_t ans=0;
    for(int i=0;i<N;i++){
        int32_t T[200] = {};
        for(int j=i;j<N;j++){
            int64_t temp=A[i]-A[j];
            for(int k=M-1;k>=0;k--){
                T[k]=max(T[k],B[j][k]);
            }
            for(int k=M-1;k>=0;k--){
                temp+=T[k];
            }
            ans=max(ans,temp);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

bool isPrime(int n){
    if (n == 1) return false;
    
    for (int i = 2; i * i <= n; i++){
        if (n % i == 0) return false;
    }
    
    return true;
}

int main(void){
   int x;
   cin >> x;
   
   for (int i = x; i <= 100003; i++){
       if (isPrime(i)){
           cout << i << endl;
           return 0;
       }
   }
    
}


Measured memory_bytes: 256
#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>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

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 = 100010;

vi a[1005];
int idx[1005];

int main() {
	int n;
	cin >> n;
	rep1(i, n) rep(j, n - 1) {
		int t;
		cin >> t;
		a[i].push_back(t);
	}
	rep1(i, n) idx[i] = 0;
	bool update = true;
	vector<bool> played(n + 1, false);
	int day = 0;
	int games = 0;
	vector<int> v[2];
	rep1(i, n) v[0].push_back(i);
	while(update) {
		update = false;
		fill(played.begin(), played.end(), false);
		v[(day + 1) % 2].clear();
		for(int i : v[day % 2]) {
			if(played[i]) continue;
			if(idx[i] == n - 1) continue;
			int oppo = a[i][idx[i]];
			if(played[oppo]) continue;
			if(a[oppo][idx[oppo]] == i) {
//				cout << day << ' ' << i << ' ' << oppo << endl;
				idx[i]++;
				idx[oppo]++;
				played[i] = true;
				played[oppo] = true;
				games++;
				update = true;
				v[(day + 1) % 2].push_back(i);
				v[(day + 1) % 2].push_back(oppo);
			}
		}
		if(update) day++;
	}
	if(games < n * (n - 1) / 2) {
		cout << -1 << endl;
		return 0;
	}
	cout << day << endl;
}


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

int main() {
  int N;
  string S, T, sum = "";
  cin >> N >> S >> T;
  
  for (int i = 0; i < N; i++) {
    sum += S.at(i);
    sum += T.at(i);
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
N = int(input())
hist = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0 }
for i in range(N):
  tc = input()
  hist[tc] += 1

for k in ['AC', 'WA', 'TLE', 'RE']:
  print(f'{k} x {hist[k]}', flush=True)



Measured memory_bytes: 9092
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in sm=0;
const in mdl=1000000007;
const in bpw=16;
VI pw;
in n;
VVI impl;
in p2(in a){
  return 1LL<<a;
}
VVI rcup1(20,VI(20));
VVI rcup2(20,VI(20));
void gen(in s, in rmsk, in wy){
  if(s+2<n){
    VI& cup=rcup1[s];
    in nt;
    in msk;
    in timp;
    in fsf;
    forn(i,s+1)
      cup[i]=0;
    msk=rmsk;
    nt=n-1;
    timp=0;
    forn(zz,s){
      if(impl[n-s-1][nt]){
	++timp;
	++cup[msk%bpw];
      }
      msk/=bpw;
      --nt;
    }
    msk=rmsk;
    fsf=1;
    for(in gn=0;gn<=s;++gn){
      timp-=cup[gn];
      gen(s+1,msk+pw[s]*gn,wy*fsf%mdl*p2(timp)%mdl);
      if(cup[gn]==0)
	break;
      fsf*=p2(cup[gn])-1;
      fsf%=mdl;
    }
  }
  else{
    VI& cup1=rcup1[s];
    VI& cup2=rcup2[s];
    in nt;
    in msk;
    in timp;
    in fsf;
    in ssf;
    forn(i,s+1)
      cup1[i]=cup2[i]=0;
    msk=rmsk;
    nt=n-1;
    timp=0;
    forn(zz,s){
      if(impl[0][nt]){
	++timp;
	++cup1[msk%bpw];
      }
      if(impl[1][nt]){
	++timp;
	++cup2[msk%bpw];
      }
      msk/=bpw;
      --nt;
    }
    msk=rmsk;
    fsf=1;
    ssf=0;
    for(in gn=0;gn<=s;++gn){
      timp-=cup1[gn];
      timp-=cup2[gn];
      ssf+=fsf*p2(timp)%mdl;
      if(cup1[gn]==0 || cup2[gn]==0)
	break;
      fsf*=p2(cup1[gn])-1;
      fsf*=p2(cup2[gn])-1;
      fsf%=mdl;
    }
    ssf%=mdl;
    sm+=ssf*wy;
    sm%=mdl;
    
  }
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in m;
  cin>>n>>m;
  if(n==2){
    cout<<1<<endl;
    return 0;
  }
  impl.resize(n,VI(n));
  forn(z,m){
    in x,y;
    cin>>x>>y;
    if(x==1 && y==2)
      continue;
    impl[x-1][y-1]=1;
  }
  in tn=1;
  forn(z,m)
    tn=2*tn%mdl;
  pw.PB(1);
  forn(i,15)
    pw.PB(pw[i]*bpw);
  gen(1,0,1);
  tn-=sm;
  tn%=mdl;
  if(tn<0)
    tn+=mdl;
  cout<<tn<<endl;
  return 0;
}


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

int h;

int parent(int i){
  return i / 2;
}

int left(int i){
  return 2 * i;
}

int right(int i){
  return 2 * i + 1;
}

void maxHeapify(int *A, int i){
  int l, r, largest;

  l = left(i);
  r = right(i);

  if(l <= h && A[l] > A[i]) largest = l;
  else largest = i;

  if(r <= h && A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(A[i], A[largest]);
    maxHeapify(A, largest);
  }
}

int heapExtractMax(int *A){
  if(h < 1) return -1;

  int max = A[1];
  A[1] = A[h];
  h--;
  maxHeapify(A, 1); //rebuilding a max-Heap

  return max;
}

void heapIncreaseKey(int *A, int i, int key){
  if(key < A[i]) return ;

  //inset new value into the poper place
  A[i] = key;
  while(i > 1 && A[parent(i)] < A[i]){
    swap(A[i], A[parent(i)]);
    i = parent(i);
  }
}

void maxHeapInsert(int *A, int key){
  h++; //size up
  A[h] = -1;
  heapIncreaseKey(A, h, key);
}

int main(){

  int k, a[2000010];
  string command;

  //input
  while(cin >> command, command != "end"){
    if(command == "insert"){
      cin >> k;
      maxHeapInsert(a, k);
    }else if(command == "extract"){
      cout << heapExtractMax(a) << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 7076
h, w = gets.split.map(&:to_i)

queue = []
arr = Array.new(h) { Array.new(w) { -1 } }
arr << Array.new(w) { 0 }
(h + 1).times { |idx| arr[idx] << 0 }

h.times do |i|
  gets.chomp.each_char.with_index do |c, j|
    if c == '#'
      queue << [i, j]
      arr[i][j] = 0
    end
  end
end

move = [[0, 1], [1, 0], [-1, 0], [0, -1]]
count = h * w - queue.size
turn = 0

while count != 0
  queue.size.times do
    x, y = queue.shift

    move.each do |u, v|
      next if arr[x + u][y + v].zero?

      arr[x + u][y + v] = 0
      queue << [x + u, y + v]
    end
  end

  count -= queue.size
  turn += 1
end

puts turn

Measured memory_bytes: 93060
N, M = map(int, input().split())

INF = float("inf")
dp = [INF for i in range(2**N)]
dp[0] = 0
for i in range(M):
    a, b = map(int, input().split())
    C = list(map(int, input().split()))
    key = 0
    for c in C:
        key += 2**(c-1)
    for j in range(len(dp)-1, -1, -1):
        if dp[j] == INF:
            continue
        if dp[j | key] > dp[j] + a:
            dp[j | key] = dp[j] + a
            
if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])


Measured memory_bytes: 71124
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[200010];

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

	cin >> N;
	rep(i, 0, N)
	{
		cin >> A[i];
	}

	int p = 1;
	int ans = 0;
	rep(i, 0, N)
	{
		if (p != A[i])
		{
			ans++;
		}
		else
		{
			p++;
		}
	}

	if (p == 1)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <vector>
#include <algorithm>

int main()
{
  int n,v,p;
  long long m;
  scanf("%d%lld%d%d",&n,&m,&v,&p);
  std::vector<long long> A(n);
  for(int i=0;i<n;i++){
    scanf("%lld",&A[i]);
  }
  std::sort(A.begin(),A.end());
  int l=-1,r=n-p;
  while(l+1<r){
    int d=(l+r)/2;
    bool F=true;
    if(A[d]+m<A[n-p]){
      F=false;
    }
    else{
      long long S=0ll;
      for(int i=d+1;i<=n-p;i++){
	S+=A[d]+m-A[i];
      }
      if(S>=std::max(v-p-d,0)*m){
	F=true;
      }
      else{
	F=false;
      }
    }
    if(F){
      r=d;
    }
    else{
      l=d;
    }
  }
  printf("%d\n",n-r);
  return 0;
}


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

int main() {
  int N, A;
  cin >> N >> A;
  int M,rest;
  M = floor(N/500.0);
  rest = N - 500*M;
  if (A < rest){
    cout << "No" << endl;
  }
  else{
  cout << "Yes" << endl;
  }
  
}


Measured memory_bytes: 384
n, m, s, t = map(int,input().split())
s -= 1
t -= 1
# 円だけのグラフ
ad1 = [[] for _ in range(n)]
# スヌークだけのグラフ
ad2 = [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = map(int,input().split())
    u -= 1
    v -= 1
    ad1[u].append((v, a))
    ad1[v].append((u, a))
    ad2[u].append((v, b))
    ad2[v].append((u, b))

from heapq import heappush, heappop
inf = float('inf')

# 計算量O((E+V)logV)
# 引数(始点,隣接リスト)
def dijkstra(start,ad):
    #global cnt
    N = len(ad)
    dist = [inf] * N
    dist[start] = 0
    #cnt = [0] * N
    #cnt[start] = 1
    pq = [(dist[start], start)]
    while pq:
        dist_v, v = heappop(pq)
        for nv, nw in ad[v]:
            if dist[nv] > dist_v + nw:
                dist[nv] = dist_v + nw
                heappush(pq,(dist[nv], nv))
            #if dist[nv] == dist_v + nw:
                #cnt[nv] += cnt[v]
                #cnt[nv] %= mod
    return dist

dist1 = dijkstra(s, ad1)
dist2 = dijkstra(t, ad2)

ans_list = [inf]

for i in range(n)[::-1]:
    ans = min(ans_list[-1], dist1[i] + dist2[i])
    ans_list.append(ans)

ans_list.pop(0)
for ans in ans_list[::-1]:
    print(10**15-ans)

Measured memory_bytes: 81552
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {
  //static Action yes = Yes;
  //static Action no = No;
  
  public static void Main (string[] args) {
    //var temp = Console.ReadLine().Split(' ').Select(int.Parse);
    var N = long.Parse(Console.ReadLine());
    var K = Console.ReadLine().Split(' ').Select(long.Parse);
    var ans = (long)0;
 
    ans = K.Select(x => x - 1).Sum();
    
    Console.WriteLine(ans);

  }
  private static void Yes(){
    Console.WriteLine("Yes");
  }
  private static void No(){
    Console.WriteLine("No");
  }
}

Measured memory_bytes: 13340
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, k;
	cin >> n >> k;

	int ans = n - k + 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/* Author: Mrigank
Science is what we understand well enough to explain to a computer, 
    Art is everything else we do - Donald E. Knuth */

#include <bits/stdc++.h>
#include <iostream>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <string> 
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair < ll , ll > PLL;
typedef pair<int, int> PII;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < pair < ll , ll > > vpl;
typedef vector < pair < ll , bool > > vpb;
typedef vector < vector < int > > vvi;
typedef vector < vector < ll > > vvl;


#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x , val) memset(x , val , sizeof(x))
#define deb(x) cout<<#x<<" :: "<<x<<"\n"
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define all(x) x.begin() , x.end()
#define alls(x , y) x.begin() , x.end() , y
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl "\n"

const ll mxsize = 3e5 + 10;
const ll linf = 1e9;
const ld inf = 10000000000.0;
const ll mod = 1e9 + 7;
 
/******************************************** CODE STARTS FROM HERE *************************************************/ 

int main()
{
    fastIO;
    ll s , w;
    cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3656
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


mod = 10 ** 9 + 7
N, K = list(map(int, input().split()))
# N個のぼーる、K個の青いボール


def nck(n, k, mod):
    bunbo = bunshi = 1
    for i in range(k):
        bunshi = (bunshi * (n-i)) % mod
        bunbo = (bunbo * (i+1)) % mod
    return (bunshi * pow(bunbo, mod-2, mod)) % mod


ans = [0]*K
for i in range(1, K + 1):
    # i回の操作で取り除く

    # i回ってことは、i個の塊ではないとだめ
    # バラバラの場合はK個の塊がある
    # k-i個の青いボールが隣り合っている必要がある
    # print(N - K + i, i)
    # 青いボールの組の作り方
    # print("blue_set", blue_set)
    ans[i-1] = (nck(N-K+1, i, mod)*nck(K-1, i-1, mod)) % mod

for a in ans:
    print(a)


Measured memory_bytes: 14420
#include<bits/stdc++.h>
using namespace std;
using ll = unsigned long long;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(1000005);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  if (b[1] != 0) {
    if (b[1] == 1) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
  }
  int ans = n;
  for (int i = 0; i < n; i++) {
    if (b[a[i]] != 1) {
      ans--;
      continue;
    }
    for (int j = 2; j * j <= a[i]; j++) {
      if (a[i] % j != 0) continue;
      if (b[j] != 0 || b[a[i] / j] != 0) {
        //cout << a[i] << " " << j << " " << a[i] / j << endl;
        ans--;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
 
int main() {
  string a,b,c;
  cin >> a>>b>>c;
  char turn='a';
  int na=a.size(),nb=b.size(),nc=c.size();
  for(int i=0;i<300;i++){
    if(turn == 'a'){
      if(a.size()==0) break;
      turn = a.at(0);
      a.erase(0,1);
    }else if(turn == 'b'){
      if(b.size()==0) break;
      turn = b.at(0);
      b.erase(0,1);
    }else if(turn == 'c'){
      if(c.size()==0) break;
      turn = c.at(0);
      c.erase(0,1);
    }
  }
  turn -= 32;
  cout << turn <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    vector<ll> b(n-k+1);
    rep(i,k) b[0]+=a[i];
    rep(i,n-k) {
        b[i+1]=b[i]+a[k+i]-a[i];
    }
    sort(b.begin(),b.end(),greater<>());
    double ans=1.0*(b[0]+k)/2;
    cout << fixed << setprecision(20) << ans << endl;

    
    return 0;   
}

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

int main(){

    int H,N,T=0,B;
    cin >> H >> N;
    
    rep(i,N){
        cin >> B;
        T += B;
    }
    if(T >= H){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python

ar = []

while True:
  a = [int(i) for i in input().split()]
  if a != [0,0]:
    ar.append(a)
  else:
    break

for i in range(len(ar)):
  for j in range(len(ar[i])):
    print(sorted(ar[i])[j], end = ' ' if j != len(ar[i])-1 else '\n')

Measured memory_bytes: 8276
n,m = gets.split.map(&:to_i)
a = n.times.map{gets.split.map(&:to_i)}

min = n
del = Array.new(m, false)
(m-1).times{
  cnt = Array.new(m, 0)
  n.times{|i|
    m.times{|j|
      if !del[a[i][j]-1]
        cnt[a[i][j]-1]+=1
        break
      end
    }
  }
  t = cnt.max
  min = t if min > t
  del[cnt.index(t)] = true
}

p min

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


ll N, a[100005], ans=0;
ll cnt[100005]={};

int main(){
	ios_base::sync_with_stdio(false);

	cin >> N;
	rep(i,N) cin >> a[i];

	rep(i,N){
		if( a[i] > 100000 ) ans++;
		else cnt[a[i]]++;
	}

	rep(i,100005){
		if( cnt[i] < i ) ans += cnt[i];
		else ans += cnt[i] - i;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long k = sc.NextLong();
        long[] a = sc.LongArray();

        for (int i = 0; i < n - k; i++)
        {
            if (a[i + k] > a[i])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 47232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
const ll INF = 1LL << 60;
//cout << fixed << setprecision(10);

int main(){
    int n;
    cin>>n;
    if (n%1000==0){
        cout << 0 <<endl;
        return 0;
    }
    cout << 1000 - (n % 1000) <<endl;
}

Measured memory_bytes: 3636
# include "algorithm"
# include "iostream"
# include "cstdio"

using namespace std;

const int maxm=1e5+10;

int N;
long long M;

struct thing{
	long long A;
	long long B;
	# define A(x) Thing[x].A
	# define B(x) Thing[x].B
}Thing[maxm];

inline bool Comp(thing x,thing y){
	return x.A<y.A;
}

int main(){
	register int i;
	register long long Ans=0;
	scanf("%d%lld",&N,&M);
	for(i=1;i<=N;i++) scanf("%lld%lld",&A(i),&B(i));
	sort(Thing+1,Thing+1+N,Comp);
	for(i=1;i<=N && M;i++){
		Ans+=min(M,B(i))*A(i);
		M-=min(M,B(i));
	}
	printf("%lld",Ans);
	return 0;
}

Measured memory_bytes: 1792
//https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0593?year=2014

#include <bits/stdc++.h>

using namespace std;

int main() {
    unsigned int n, m;
    cin >> n >> m;

    vector<int> a(n + 1);//費用
    for (int i = 1; i < a.size(); ++i) {
        cin >> a[i];
    }

    vector<int> b(m + 1);//審査基準
    for (int i = 1; i < b.size(); ++i) {
        cin >> b[i];
    }

    vector<int> cnt(n + 1);
    for (int i = 1; i < b.size(); ++i) {//委員
        for (int j = 1; j < a.size(); ++j) {//競技
            if (a[j] <= b[i]) {
                cnt[j]++;
                break;
            }
        }
    }
    auto ans = distance(cnt.begin(), max_element(cnt.begin(), cnt.end()));
    cout << ans << endl;
    return 0;
}

/*
 *
 */


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


#define int long long 

const int N = 4e5 + 7, mod = 998244353;

int dp[N], cum[N], L[N], R[N];

int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	for(int i = 1; i <= k; ++i) cin >> L[i] >> R[i];

	dp[n] = 1;
	for(int i = n - 1; i >= 1; i--) {
		for(int j = 1; j <= k; j++) {
			int l = L[j], r = R[j];
			if(i + l <= n) {
				dp[i] += dp[i + l] + mod - dp[i + r + 1] % mod;
				dp[i] %= mod;
			}
		}
		dp[i] = (dp[i] + dp[i + 1]) % mod;
	}
	cout << (dp[1] + mod - dp[2]) % mod;
}


Measured memory_bytes: 5168
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
   int n;
   cin >> n;
   vector<int> a(n);
    vector<int> t(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        t[a[i] - 1] = i + 1;
    }
    for(int i = 0;i < n;i++){
        cout << t[i] << " ";
    }
   
}


Measured memory_bytes: 1536
#include <cstdio>
using namespace std;

int main()
{
	char s[100];
	int ss=0,yarim;
	bool cevap=true;

	for (int i = 0; i < 100; i++)
	{
		scanf("%c",&s[i]);
		if (s[i] == '\n')
		{
			break;
		}
		ss++;
	}
	yarim = (ss/2);

	for (int i = 0; i <yarim; i++)
	{
		if (s[i] != s[i+yarim+1])
		{
			cevap=false;
			break;
		}
	}

	for(int i=0;i<(yarim+1)/2;i++)
	{
		if(s[i]!=s[(yarim-1)-i])
		{
			cevap=false;
		}
	}

	if(cevap==true)
	{
		printf("Yes");
		return 0;
	}
	printf("No");
}

Measured memory_bytes: 256