akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int na;
int a[2000];

int check (int target, int getI,int diff) {
  if (target == diff) {
    return 1;
  }else if (getI >= na) {
    return 0;
  }
  int res=check(target,getI+1,diff+a[getI]) || check(target,getI+1,diff);
  return res;
}

int main () {
  int n;
  int pre;
  scanf("%d",&na);
  for (pre=0;pre<na;pre++) {
    scanf("%d",&a[pre]);
  }
  scanf("%d",&n);
  int target[n];
  for (pre=0;pre<n;pre++) {
    scanf("%d",&target[pre]);
  }
  for (pre=0;pre<n;pre++) {
    int result = check(target[pre],0,0);
    if (result) {
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <string>

typedef long long ll;

// 通り数 <= i番目の袋、食べた個数j
const ll MAX_N = 50;
const ll MAX_A = 100;
ll dp[MAX_N+1][MAX_N * MAX_A + 1];

int main(int argc, char* argv[])
{
  ll N, P;
  std::cin >> N >> P;
  std::vector< ll > va(N+1, 0);

  for (ll i = 0; i < N; i++) {
    std::cin >> va[i];
  }

  dp[0][0] = 1;
  for (ll i = 1; i <= N; i++) {
    for (ll j = 0; j < N*MAX_A+1; j++) {
      dp[i][j] = dp[i-1][j];
      if (j - va[i-1] >= 0) {
	dp[i][j] += dp[i-1][j-va[i-1]];
      }
      //std::cout << i << " " << j << " " << dp[i][j] << std::endl;
    }
  }

  ll ans = 0;
  for (ll j = 0; j < MAX_N*MAX_A+1; j++) {
    if (j % 2 == P) {
      //std::cout << dp[N][j] << std::endl;
      ans += dp[N][j];
    }
  }

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


Measured memory_bytes: 2176
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

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

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
constexpr const int INF=1<<30,MOD=1000000007;constexpr const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<(const T&t){return*this;}template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>n;
    vp a(n);
    REP(i,n){
        cin>a[i].S>a[i].F;
    }
    sort(all(a));
    ll t=0;
    REP(i,n){
        t+=a[i].S;
        if(t>a[i].F){
            Yes(0);
            return 0;
        }
    }
    Yes(1);
    return 0;
}


Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  ll n;
  cin >> n;
  int m = floor(sqrt(n));
  int mx;
  for (int i = m; i > 0; i--) {
    if (n%i == 0) {
      mx = i;
      break;
    }
  }
  cout << mx + n/mx - 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define pi 3.14159265358979323846264338
using namespace std;

int main() {
	string s;
	cin >> s;
	int a, z;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			a = i;
			break;
		}
	}
	for (int i = s.size(); i>0; i--) {
		if (s[i] == 'Z') {
			z = i + 1;
			break;
		}
	}
	cout << z - a << endl;
	return 0;
}

Measured memory_bytes: 640
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    A, B, C = i2nn()
    n = min(B // A, C)
    print(n)

main()


Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int h=0,w=0;
    while(true){
      h = sc.nextInt();
      w = sc.nextInt();
      if(h==0&&w==0){
        break;
      }
      for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
          if(i%2==0){
            if(j%2==0){
          System.out.print("#");
          }else{
            System.out.print(".");
          }
        }else{
          if(j%2==0){
            System.out.print(".");
          }else{
            System.out.print("#");
          }
        }
      }
      System.out.println(); 
    }
    System.out.println();
  }
  sc.close();
 }
}


Measured memory_bytes: 34808
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
ll n;
vector< pair<ll,ll> > adj[N];
vector< pair< pair<ll,ll> , ll > >wt;
bool cmp( pair< pair<ll,ll> , ll > a,pair< pair<ll,ll> ,ll >b){
    return a.second<b.second;
}
ll par[N],sz[N];
void init(){
    for(ll i=0;i<N;i++)par[i]=i,sz[i]=1;
}
ll dsu_parent(ll node){
    if(node==par[node])return node;
    return par[node]=dsu_parent(par[node]);
}
void dsu_union(ll a,ll b){
    a=dsu_parent(a);
    b=dsu_parent(b);
    if(a==b)return;
    if(sz[a]<sz[b])swap(a,b);
    sz[a]+=sz[b];
    par[b]=a;
}
ll func(){
    ll ans = 0;
    for(ll i=1;i<=n;i++)for(auto &ele:adj[i])wt.push_back( { {i,ele.second} , ele.first} );
    sort(wt.begin(),wt.end(),cmp);
    init();
    for(auto &edges:wt){
       // cout<<edges.first.first<<" "<<edges.first.second<<" "<<edges.second<<endl;
        ll u=edges.first.first,v=edges.first.second,w=edges.second;
        if(dsu_parent(u)==dsu_parent(v))continue;
        ans+=w;
        dsu_union(u,v);
    }
    return ans;
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    cin>>n;
    pair<ll,ll> x[n],y[n];
    for(ll i=0;i<n;i++)cin>>x[i].first>>y[i].first,x[i].second=y[i].second=i+1;
    sort(x,x+n);
    sort(y,y+n);
    for(ll i=1;i<n;i++){
        adj[x[i].second].push_back({x[i].first-x[i-1].first , x[i-1].second});
        adj[x[i-1].second].push_back({x[i].first-x[i-1].first , x[i].second});

        adj[y[i].second].push_back({y[i].first-y[i-1].first , y[i-1].second});
        adj[y[i-1].second].push_back({y[i].first-y[i-1].first , y[i].second});
    }
    cout<<func();
}




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

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

Measured memory_bytes: 256
import scala.io.Source.stdin

object Main {
  def topHillsCheck(l: List[Int], n: Int): List[Int] = l.sortWith(_>_).take(n)

  def main(args: Array[String]): Unit = {
    val hillsList = stdin.getLines.toList.map(_.toInt)
    val topNum = 3
    topHillsCheck(hillsList, topNum).foreach(println)
  }
}

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

using namespace std;

typedef long long ll;

const int MX = 105;

template <typename T> void cmin(T &x, const T &y)
{
	if(y < x) x = y;
}

template <typename T> void cmax(T &x, const T &y)
{
	if(y > x) x = y;
}

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

int n;
int fst[MX], nxt[MX*2], u[MX*2], v[MX*2], lnum;

void addeg(int nu, int nv)
{
	nxt[++lnum] = fst[nu];
	fst[nu] = lnum;
	u[lnum] = nu;
	v[lnum] = nv;
}

void input()
{
	read(n);
	for(int i=1; i<n; i++)
	{
		int a, b;
		read(a), read(b);
		addeg(a, b);
		addeg(b, a);
	}
}

int dis[MX], mxdeg[MX];
int mxp;
vector<int> cur, dia;

void dfs(int x, int f, int d)
{
	cur.push_back(x);
	if(d > dis[mxp]) mxp = x, dia = cur;
	dis[x] = d;
	for(int i=fst[x]; i; i=nxt[i])
		if(v[i] != f)
			dfs(v[i], x, d+1);
	cur.pop_back();
};

ll calc(int x, int y)
{
	mxp = 0;
	dfs(x, y, 1);
	dfs(y, x, 1);
	ll leaf = 1;
	memset(mxdeg, 0, sizeof(mxdeg));
	for(int x=1; x<=n; x++)
	{
		int deg = 0;
		for(int i=fst[x]; i; i=nxt[i])
		{
			int y = v[i];
			if(dis[y] == dis[x]+1) deg++;
		}
		cmax(mxdeg[dis[x]], deg);
	}
	for(int i=1; i<=n; i++)
		if(mxdeg[i])
			leaf *= mxdeg[i];
	if(x != y) leaf *= 2;
	return leaf;
}

void work()
{
	ll ans_len = n+1, ans_leaf = 0;
	for(int i=1; i<=n; i++)
	{
		ll cur_leaf = calc(i, i);
		if(dis[mxp] < ans_len) ans_len = dis[mxp], ans_leaf = cur_leaf;
		else if(dis[mxp] == ans_len) cmin(ans_leaf, cur_leaf);
	}
	for(int i=1; i<=lnum; i+=2)
	{
		ll cur_leaf = calc(u[i], v[i]);
		if(dis[mxp] < ans_len) ans_len = dis[mxp], ans_leaf = cur_leaf;
		else if(dis[mxp] == ans_len) cmin(ans_leaf, cur_leaf);
	}
	printf("%d %lld\n", ans_len, ans_leaf);
}

int main()
{
	input();
	work();
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> march(5, 0);
  string st;
  for (int i = 0; i < n; ++i) {
    cin >> st;
    if (st[0] == 'M') ++march[0];
    if (st[0] == 'A') ++march[1];
    if (st[0] == 'R') ++march[2];
    if (st[0] == 'C') ++march[3];
    if (st[0] == 'H') ++march[4];
  }

  ll ans = 0;
  for (int i = 0; i < 5; ++i) {
    for (int j = i + 1; j < 5; ++j) {
      for (int k = j + 1; k < 5; ++k) {
        if (march[i] != 0 && march[j] != 0 && march[k] != 0) {
          ans += march[i] * march[j] * march[k];
          // cout << i << " " << j << " "<< k << endl;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3576
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define rep(i,a,b)      for(int i=a;i<b;i++)
#define rfor(i,a,b)     for(int i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define endl            '\n'
#define SIZE            1000005
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const ll lul2 = 998244353;
const ll lul = 1000000007;

void mod(ll &x)
{
    if(x>=lul) x-=lul;
    if(x<0) x+=lul;
}

ll _gcd(ll a, ll b)
{
    if(b == 0) return a;
    return _gcd(b,a%b);
}

ll expo(ll n, ll p)
{
    if(p == 0) return 1;
    ll x = expo((n*n)%lul, p/2)%lul;
    if(p&1) return (x*n)%lul;
    return x;
}
//---------------------------------------------------------------------

int n,m,ans = 0;
vector<int> p, adj[100005];
int vis[100005] = {0};
unordered_map<int,int> ma;

void dfs(int node)
{
    vis[node] = 1;
    for(int i:adj[node])
    {
        if(!vis[i]) dfs(i);
    }
    ma[node]++;
    ma[p[node]]++;
}
void solve()
{
    cin>>n>>m;
    p.resize(n+1);
    rep(i,1,n+1) cin>>p[i];
    rep(i,0,m)
    {
        int x,y; cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    rep(i,1,n+1)
    {
        if(!vis[i])
        {
            dfs(i);
            for(auto i:ma)
            {
                if(i.S == 2) ans++;
            }
            ma.clear();
        }
    }
    cout<<ans;
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; /*cin>>t;*/ t=1;
    rep(i,1,t+1){
        solve();
    }
    return 0;
}

Measured memory_bytes: 13604
def main2
  n = gets.chomp.to_i
  map = { }
  (1..n).each do |ca|
    command, str = gets.chomp.split(/\s/)
    map[str] = 1 if command == "insert"
    if command == "find"
      flag = map[str]
      puts "yes"  if not flag.nil?
      puts "no" if flag.nil?
    end
  end

end

main2

Measured memory_bytes: 139420
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

vector<vector<string>> lun(12);
ll ans = 0;
bool ok=false;
ll K;

void solve(ll N){
    rep(i,0,10){
    rep(j,0,lun[N-1].size()){
        if(abs(char(lun[N-1][j][0])-'0'-i) <= 1){
            lun[N].PB(to_string(i)+lun[N-1][j]);
            if(i!=0)ans++;
            if(ans == K){
                cout<<to_string(i)+lun[N-1][j];
                ok = true;
            }
        }
    }
}
}

int main(){
    rep(i,0,10)lun[1].PB(to_string(i));
    cin>>K;
    if(K <= 9){
        cout<<K;
        return 0;
    }
    else ans = 9;
    rep(i,2,11){
        solve(i);
        if(ok)return 0;
    }


}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

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

int W, H;
int road[20][20], dp[20][20];

int main() {
	int W, H;
	while(scanf("%d %d", &W, &H), W || H) {
		memset(dp, 0, sizeof(dp));
		memset(road, 0, sizeof(road));
		int N;
		scanf("%d", &N);
		rep(i, N) {
			int y, x;
			scanf("%d %d", &x, &y);
			road[y][x] = -1;
		}
		dp[1][1] = 1;
		FOR(i, 1, H + 1) FOR(j, 1, W + 1) {
			if(road[i][j - 1] != -1 && j != 1) {
				dp[i][j] += dp[i][j - 1];
			}
			if(road[i - 1][j] != -1 && i != 1) {
				dp[i][j] += dp[i - 1][j];
			}
		}
		/*FOR(i, 1, H + 1) {
			FOR(j, 1, W + 1) printf("%3d", dp[i][j]);
			puts("\n");
		}
		FOR(i, 1, H + 1) {
			FOR(j, 1, W + 1) printf("%3d", road[i][j]);
			puts("\n");
		}*/
		printf("%d\n", dp[H][W]);
	}
	return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll N,H,W;
	cin>>N>>H>>W;
	cout<<(N-H+1)*(N-W+1)<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------　
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a <= c && c <= b || b <= c && c < a) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

Measured memory_bytes: 256
# 5:48
n = gets.to_s.to_i
edges = Array.new(n-1){ gets.to_s.split.map{|t|t.to_i} }

g = Array.new(n+1){ [] }
edges.each do |u, v, c|
  g[u] << [v, c]
  g[v] << [u, c]
end

ans = Array.new(n+1){ 0 }
used = Array.new(n+1){ false }

q = [[1, 0]]
used[1] = true

while q.any?
  
  v, d = q.shift
  g[v].each do |(u, c)|
    next if used[u]
    used[u] = true
    # p [d, v, u, c]
    d_n = d + c
    ans[u] = d_n % 2
    q.push [u, d_n]
  end
end

puts ans[1, n]

Measured memory_bytes: 29436
#include<stdio.h>
int main()
{
	int a,b,i,i2,min=2000,min2=2000,g;
	for(i=0;i<3;i++){
		scanf("%d",&a);
		if(a<min)
			min=a;
	}
	for(i2=0;i2<2;i2++){
		scanf("%d",&b);
		if(b<min2)
			min2=b;
	}
	g=min+min2-50;
	printf("%d\n",g);

return 0;
}

Measured memory_bytes: 592
def split(n, a, b, remain, ai, ans, width, l=None):
    # print(n, a, b, remain, ai, ans, width)
    # print(*(f'{c:5d}' for c in ans))
    # print(*(f'{c:05b}' for c in ans))
    if width == 2:
        ans[ai] = a
        ans[ai + 1] = b
        return
    if l is None:
        x = a ^ b
        y = x & -x  # Rightmost Bit at which is different for a and b
        l = y.bit_length() - 1
    else:
        y = 1 << l
    remain.remove(l)
    i = next(iter(remain))
    lb = a ^ (1 << i)
    ra = lb ^ y
    width >>= 1
    split(n, a, a ^ (1 << i), remain, ai, ans, width, i)
    split(n, ra, b, remain, ai + width, ans, width)
    remain.add(l)


def solve(n, a, b):
    if bin(a).count('1') % 2 == bin(b).count('1') % 2:
        print('NO')
        return
    remain = set(range(n))
    ans = [0] * (1 << n)
    split(n, a, b, remain, 0, ans, 1 << n)
    print('YES')
    print(*ans)


n, a, b = list(map(int, input().split()))
solve(n, a, b)


Measured memory_bytes: 11276
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

char ch[15][1005];
int n,m,k,ed,ans,tmp[15];

inline int gs(int sta)
{
	int z=0;
	while(sta)
	{
		if(sta%2==1) z++;
		sta>>=1;
	}
	return z;
}

int main()
{
	n=read(); m=read(); k=read(); ans=inf;
	for(int i=1;i<=n;i++) scanf("%s",ch[i]+1);
	ed=(1<<(n-1))-1;
	for(int s=0;s<=ed;s++)
	{
		vector <int> v; v.clear(); v.push_back(0);
		for(int i=1;i<n;i++) if((1<<(i-1))&s) v.push_back(i); v.push_back(n);
		for(int i=0;i<=n;i++) tmp[i]=0;
		
		//cout<<s<<endl;
		//for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout<<endl;
		int p=0,f=0;
		for(int j=1;j<=m;j++)
		{
			f=0;
			for(int i=0;i<v.size()-1;i++) 
			{
				for(int k=v[i]+1;k<=v[i+1];k++)
				{
					if(ch[k][j]=='1') tmp[i]++;
				}
			}
			for(int i=0;i<v.size()-1;i++) if(tmp[i]>k) f=1;
			if(f==1)
			{
				for(int i=0;i<v.size()-1;i++) 
				{
					for(int k=v[i]+1;k<=v[i+1];k++)
					{
						if(ch[k][j]=='1') tmp[i]--;
					}
				}
				for(int i=0;i<v.size()-1;i++) tmp[i]=max(0,tmp[i]-k);
				for(int i=0;i<v.size()-1;i++) 
				{
					for(int k=v[i]+1;k<=v[i+1];k++)
					{
						if(ch[k][j]=='1') tmp[i]++;
					}
				}
				p++;
			}
			for(int i=0;i<v.size()-1;i++) if(tmp[i]>k) {f=2; break;}
			//for(int i=0;i<v.size()-1;i++) cout<<tmp[i]<<" "; cout<<endl;
		}
		//cout<<endl<<endl;
		//cout<<s<<endl;
		//for(int i=0;i<v.size()-1;i++) cout<<tmp[i]<<" "; cout<<endl;
		
		if(f!=2) ans=min(ans,gs(s)+p);
		
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import math

a,b,C = map(float, input().split())

radian = math.radians(C)
height = b * math.sin(radian)
c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(radian))
print((a*height)/2, a+b+c, height, sep='\n')


Measured memory_bytes: 5700
#include<bits/stdc++.h>
using namespace std;
struct edge{int to,cost;};
typedef pair<int,int> P;
typedef long long ll;
const ll INF=1000000000LL;
const ll MOD=1000000007LL;
int main(){
	int n;
	cin>>n;
	vector<int> ans;
	int tw[10]={2,10,3,9,4,8,6,12};
	int on[10]={6,2,10,3,9,4,8,12};
	if(n>3){
		int co=0;
		if(n%2){
			while(n){
				for(int i=0;i<8;i++){
					ans.push_back(on[i]+co*12);
					n--;
					if(!n){
						break;
					}
				}
				co++;
			}
		}else{
			while(n){
				for(int i=0;i<8;i++){
					ans.push_back(tw[i]+co*12);
					n--;
					if(!n){
						break;
					}
				}
				co++;
			}
		}
	}else{
		ans.push_back(2);
		ans.push_back(5);
		ans.push_back(63);
	}
	for(const auto &e:ans){
		cout<<e<<endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
	int n, countABC;
	char s[51];
	int i;
	
	scanf("%d", &n);
	scanf("%s", s);
	
	countABC = 0;

	/* n文字目にCが入る場合までを調べるので、ループはn-2回 */
	for (i = 0; i < n - 2; i++)
	{
		if ((s[i] == 'A') && (s[i + 1] == 'B') && (s[i + 2] == 'C'))
		{
			countABC++;
		}
	}

	printf("%d", countABC);

	return 0;
}

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



int main(void) {
    int N, X, Y;
    cin >> N >> X >> Y;

    int d[2010] = {0};

    for (int i=1; i<N; i++) {
        for (int j=i+1; j<=N; j++) {
            int s = j - i;
            d[s]++;
#if 1

            int x_i = i - X;
            if (0 > x_i) x_i *= (-1);

            int tmp_i = Y;
            int tmp_s = j - tmp_i;
            if (tmp_s < 0) tmp_s *= (-1);
            tmp_s = tmp_s + 1 + x_i;
            if (s > tmp_s) {
                d[s]--;
                d[tmp_s]++;
            }
#endif
        }
    }

    for (int i = 1; i < N; i++) {
        cout << d[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int maxn = 1e5 + 5 ;
int n , a[maxn] ;
char s[maxn] ;
int main()
{
	bool flag = 0 ;
	scanf("%d" , &n) ;
	for(int i = 1 ; i <= n ; i ++)
	{
		int x ;
		scanf("%d" , &x) ;
		if(x % 2 == 0 && x % 3 != 0 && x % 5 != 0)  flag = 1 ;
	}
	if(flag)  printf("DENIED\n") ;
	else  printf("APPROVED\n") ;
    return 0 ;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <stack>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
#include <bitset>
#include <unordered_map>
using namespace std;
typedef long long ll;

int to_int(string s) {
    stringstream ss(s);
    int ret;
    ss >> ret;
    return ret;
}

bool is_int(string s) {
    if (s == "+" || s == "-" || s == "*") {
        return false;
    }
    return true;
}

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

    stack<int> num;
    string input;
    while (cin >> input) {
        if (is_int(input)) {
            num.push(to_int(input));
            continue;
        }
        int a = num.top();
        num.pop();
        int b = num.top();
        num.pop();
        if (input == "+") {
            num.push(b + a);
        } else if (input == "-") {
            num.push(b - a);
        } else if (input == "*") {
            num.push(b * a);
        }
    }
    cout << num.top() << endl;

    return 0;
}

Measured memory_bytes: 1228
class WeightedUF:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.weight = [0] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    def unite(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)

        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        else:
            self.par[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]

n,m=map(int,input().split())
wuf=WeightedUF(n)
for i in range(m):
    l,r,d=map(int,input().split())
    l-=1
    r-=1
    if wuf.same(l,r):
        if wuf.diff(l,r)!=d:
            print("No")
            exit()
    else:
        wuf.unite(l,r,d)
print("Yes")

Measured memory_bytes: 15956
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
    int h, w;
    while(true) {
        cin >> h >> w;
        if(h == 0 && w == 0) {
            break;
        }
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;

}


Measured memory_bytes: 3076
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll K;
    cin >> K;
    K--;
    char c = S[K];
    for (int i = 0; i < N; ++i) {
        if(c != S[i]){
            S[i] = '*';
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;

int main(void){
 int a,k,n;
 long long int sum=0;
 vector<int> A;

 cin>>n;
 for(int i=0; i<n; i++){
  cin>>a;
  A.push_back(a);
 }

 for(int i=0; i<n; i++){
  sum+=(A[i]-1);
 }

 std::cout<<sum<<std::endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;

int main(){
  string s;
  cin>>s;
  ll i=0;
  ll count=0;
  if(s.size()==1){
    cout<<0<<endl;
    return 0;
  }
  while(true){
    if(s.at(i)!=s.at(i+1)) count++;
    if(i+2==s.size()) break;
    i++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=998244353;
	static long[] s,r;
	static long ans=0;
	static void Main(){
		Sc sc=new Sc();
		s=sc.La;
		r=new long[s[0]+1];
		r[0]=1;
		for(int i = 1;i<=s[0];i++) {r[i]=(r[i-1]*i)%mod;}
		for(int i = 0;i<=s[0];i++) {
			if(s[1]*i<=s[3]&&(s[3]-s[1]*i)%s[2]==0&&(s[3]-s[1]*i)/s[2]<=s[0]){
				int q=(int)((s[3]-s[1]*i)/s[2]);
				ans=(ans+((r[s[0]]*Mi(r[i]*r[s[0]-i]))%mod)*((r[s[0]]*Mi(r[q]*r[s[0]-q]))%mod))%mod;
			}
		}
		Console.WriteLine(ans);
	}
	static long Mi(long a){
		long b=mod,u=1,v=0;
		while(b>0){
			long t=a/b;
			a-=t*b;a^=b;b^=a;a^=b;
			u-=t*v;u^=v;v^=u;u^=v;
		}
		u%=mod;
		if(u<0){u+=mod;}
		return u%mod;
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll((Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 15572
#include <bits/stdc++.h>
 
using namespace std;
const int N = 2e5 + 5;
typedef long long ll;
const ll inf=1e15;
#define pb push_back
const int INF=(0x3f3f3f3f);

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);
  
  ll A,B,K;
  cin>>A>>B>>K;
  ll tmp=A;
  A-=min(tmp,K);
  K-=min(tmp,K);
  tmp=B;
  B-=min(tmp,K);
  cout<<A<<' '<<B<<'\n';
 
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <complex>

using namespace std;





int main(){
    //入力 
    int N;
    cin >> N;
    int W[N];
    for(int i=0; i<N; i++) {
        cin >> W[i];
    }

    int sum, min=INT_MAX;


    for(int t=0; t<N-1; t++) {
        int i;
        sum=0;
        for(i=0; i<=t; i++) {
            sum += W[i];
            //cout << "plus" << W[i] << "\t" << "total" << sum << endl;
        }
        for(; i<N; i++) {
            sum -= W[i];
            //cout << "minus" << W[i] << "\t" << "total" << sum << endl;
        }
        if(abs(sum) <min) {
            min = abs(sum);
        }
    }




    cout << min << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
      int k;
      cin>>k;
      cout<<a[k-1]<<endl;
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,m;
    priority_queue<ll>pq;

    cin>>n>>m;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        pq.push(a*-1);
    }
    vector<pair<int,int> >v;
  for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        v.push_back({b,a});
    }
    sort(all(v));
    reverse(all(v));
    for(int i=0;i<m;i++){
        int a=v[i].second,b=v[i].first;
        while(a && (pq.top()*-1)<b){
            pq.pop();
            a--;
            pq.push(b*-1);
        }
    }
    ll sum=0;
    while(!pq.empty()){
        sum+=(pq.top())*-1;
        pq.pop();
    }
    cout<<sum<<endl;



    return 0;
}


Measured memory_bytes: 5556
#include <iostream>
int main(){
    int n;
    std::cin >> n;
    int dp[n + 1];
    if(n == 0 || n == 1){
        std::cout << 1 << std::endl;
        return 0;
    }
    dp[0] = 1;
    dp[1] = 1;
    for(int i = 2; i < n + 1; i++){
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    std::cout << dp[n] << std::endl;
}


Measured memory_bytes: 3084
import java.util.*;

public class Main {
  static Scanner in = new Scanner(System.in);
  static List<Integer> list = new ArrayList<>();
  static int[] dp;
  static int[] sum;
  static int n;
  static int m;
  static int[] le;
  static int[] ri;
  static final int mod = 998244353;
  public static void main(String[] args) {
    n = in.nextInt();
    m = in.nextInt();
    le = new int[m];
    ri = new int[m];
    for (int i = 0; i < m; i++) {
      le[i] = in.nextInt();
      ri[i] = in.nextInt();
    }

    dp = new int[n + 1];
    Arrays.fill(dp, 0);
    sum = new int[n + 1];
    Arrays.fill(sum, 0);
    dp[1] = sum [1] = 1;
    for (int i = 2; i <=n; i++) {
      for (int k = 0; k < m; k++) {
        dp[i] = (dp[i] + get(i - ri[k], i - le[k])) % mod;
      }
      sum[i] = (sum[i-1] + dp[i]) % mod;
    }
    System.out.println(dp[n]);
  }

  private static int get(int x, int y) {
    if (y < 0) {
      y = 0;
    }
    if (x <= 0) {
      x = 1;
    }
    return ((sum[y] - sum[x - 1]) % mod + mod) % mod;
  }
}


Measured memory_bytes: 38356
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main() {
	char a[3];
	cin >> a;
	if (a[0] == '7'){
		cout << "Yes";
	}
	else if (a[1] == '7') {
		cout << "Yes";
	}
	else if (a[2] == '7') {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

int main(){
	int a,n;	cin >> a >> n;
  	int sum = 0;
    while(n--){
      int x;	cin >> x;
      sum += x;

    }
	if(sum >= a){
		puts("Yes");
    }else{
		puts("No");
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int N, M;
    while (cin >> N >> M, 0 < N + M) {
        int res = 0;
        vector<int> h(N+1,0);
        int ht = 0;
        for (int i=1; i<=N; ++i) {
            cin >> ht;
            h[i] = h[i-1] + ht;
        }

        vector<int> w(M+1,0);
        int wt = 0;
        for (int i=1; i<=M; ++i) {
            cin >> wt;
            w[i] = w[i-1] + wt;
        }

        vector<int> tate;
        for (int i=0; i<N+1; ++i) {
            for (int j=i+1; j<N+1; ++j) {
                tate.push_back(abs(h[i] - h[j]));
            }
        }

        vector<int> yoko;
        for (int i=0; i<=M; ++i) {
            for (int j=i+1; j<=M; ++j) {
                yoko.push_back(abs(w[i] - w[j]));
            }
        }
        sort(yoko.begin(), yoko.end());

        for (int i=0; i<(int)tate.size(); ++i) {
            res += upper_bound(yoko.begin(), yoko.end(), tate[i]) - lower_bound(yoko.begin(), yoko.end(), tate[i]);
        }
        cout << res << endl;
    }
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

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

using namespace std;
using tii=tuple<int,int,int>;

const int limit=2500;
int t[55];
int dp[2][limit+10][limit+10];

int main(void){
	int n;
	cin >> n;
	rep(i,n) cin >> t[i];

	clr(dp,-1); dp[0][0][0]=0;
	rep(i,n){
		rep(j,limit+1)rep(k,limit+1){
			if(dp[0][j][k]==-1) continue;
			int cur=dp[0][j][k];
			dp[1][j+t[i]][k]=cur;
			dp[1][j][k+t[i]]=cur;
			dp[1][j][k]=cur+t[i];
		}
		rep(j,limit+1)rep(k,limit+1) dp[0][j][k]=dp[1][j][k];
		clr(dp[1],-1);
	}
	
	int ans=limit;
	rep(j,limit+1)rep(k,limit+1){
		if(dp[0][j][k]==-1) continue;
		int cmax=max({j,k,dp[0][j][k]});
		chmin(ans,cmax);
	}
	cout << ans << endl;
	return 0;
}

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

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

    int ans = 0;
    for (size_t i = 0; i < s.size()/2; i++) {
        if (s[i] != s[s.size()-i-1]) ans++;
    }

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


Measured memory_bytes: 3592
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll i,j,k,l,m,n;
		cin>>n>>k;
		vi v(n+1);
		rep(i,1,n+1)
		{
			cin>>v[i];
		}
		vi cost(n+1,0);
		cost[0]=0;
		cost[1]=0;
		
		for(i=2;i<=n;i++)
		{
		    cost[i]=cost[i-1]+abs(v[i]-v[i-1]);
		    for(j=i-1;j>=i-k;j--)
		    {
               cost[i]=min(cost[i],cost[j]+abs(v[i]-v[j]));
               if(j==1)
               {
               	break;
               }
		    }
		}
		cout<<cost[n];
	}
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    string ss;
    int q;
    cin >> ss >> q;

    bool flipped = false;
    deque<char> s;
    for (char c : ss) s.push_back(c);

    for (int i=0; i<q; i++) {
        int x;
        cin >> x;
        if (x == 1) flipped = !flipped;
        else {
            char c;
            cin >> x >> c;
            if (flipped == x-1) s.push_front(c);
            else s.push_back(c);
        }
    }
    if (flipped) {
        while (!s.empty()) {
            cout << s.back();
            s.pop_back();
        }
    } else {
        while (!s.empty()) {
            cout << s.front();
            s.pop_front();
        }
    }
    cout << "\n";
}


Measured memory_bytes: 4084
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (p, q, r) = (v[0], v[1], v[2]);
    let mut ans = min(p + q, q + r);
    ans = min(ans, p + r);
    println!("{:?}", ans);
}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]

s_dict = {}

for s_word in s:
    if s_word in s_dict:
        s_dict[s_word] += 1
    else:
        s_dict[s_word] = 1
        if s_word in t:
            s_dict[s_word] -= t.count(s_word)

max_count = max(s_dict.values())
if max_count < 0:
    max_count = 0
print(max_count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double eps = 0.00000001;
    if (x > a * a * b / 2)
    {
        double l = 0;
        double r = b;
        double mx = a*a*b;
        while(r-l>eps){
            double m = (r+l)/2;
            if(mx- a*a*m/2>x){
                l = m;
            }
            else{
                r=m;
            }
        }
        double ans = atan((r + l) / (2 * a));             
        printf("%.8lf\n",ans/M_PI*180);
    }
    else{
        double l = 0;
        double r = a;
        while(r-l>eps*2){
            double m = (r+l)/2;
            if(b*a*m/2>x){
                r = m;
            }
            else{
                l = m+eps;
            }
        }
        printf("%.8lf\n", 90 - atan((r + l) / (2 * b)) / M_PI * 180);
    }
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

int check_mine(std::vector<std::vector<char>> grid, int p, int q){
    int mine = 0;
    for (int i = p; i < p + 3; ++i){
        for (int j = q; j < q + 3; ++j){
            if (grid[i][j] == '#'){
                ++mine;
            }
        }
    }
    return mine;
}

int main(void){
    int H, W;
    std::cin >> H >> W;
    std::vector<std::vector<char>> grid(H + 2, std::vector<char>(W + 2, '*'));
    for (int i = 0; i < H; ++i){
        std::string S;
        std::cin >> S;
        for (int j = 0; j < W; ++j){
            grid[i + 1][j + 1] = S[j];
        }
    }

    for (int i = 0; i < H; ++i){
        for (int j = 0; j < W; ++j){
            if (grid[i + 1][j + 1] == '.'){
                grid[i + 1][j + 1] = '0'+ check_mine(grid, i, j);
            }
        }
    }

    for (int i = 0; i < H; ++i){
        for (int j = 0; j < W; ++j){
            std::cout << grid[i + 1][j + 1];
        }
        std::cout << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3644
import Control.Monad
import Control.Applicative

main :: IO ()
main = do
  n <- readLn
  mapM_ print $ destr n $ po n 10000000 0

po :: Integer -> Integer -> Integer -> Integer
po x y z
  | y == z+1 = y
  | otherwise = let
      m = (y+z)`div`2
      u = m*(m+1)`div`2
    in if u >= x
      then po x m z
      else po x y m

destr :: Integer -> Integer -> [Integer]
destr 0 _ = []
destr target from
  | target >= from = from : destr (target-from) (from-1)
  | otherwise = destr target (from-1)

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){


ll a;
while(cin>>a){
ll n,k,i=0,j=0;
n=a;
while(n){
          j+=(n%10);
          n/=10;
}
if(a%j==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;


}





return 0;}



Measured memory_bytes: 3636