akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using P = pair<int, int>;


// ------------------------

void solve() {
    int N, M; cin >> N >> M;

    int ans = (N * (N-1))/2 + M * (M-1)/2;

    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	string S;
	cin>>S;
	sort(S.begin(),S.end());
	S.erase(unique(S.begin(), S.end()), S.end());
	rep(i,26){
		if(S[i]!=(char)('a'+i)){
			cout<<(char)('a'+i)<<endl;
			return 0;
		}
	}

	cout<<"None"<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

int n;
cin >> n;
for(int i=1;i<=9;i++){
    for(int j=1;j<=9;++j){
        if(i*j==n){
            cout << "Yes";
            return 0;
        }
    }
}
cout << "No";

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author shivam
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            ArrayList<Integer> list = new ArrayList<>(n + 1);
            list.add(0, 0);
            for (int i = 1; i <= n; i++) {
                list.add(i, in.nextInt());
            }
            Collections.sort(list);
            Collections.reverse(list);
            list.remove(n);
            list.add(0, -1);
            long ans = 0;
            for (int i = 2; i <= n; i++) {
                ans += list.get((i + 1) / 2);
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 58596
import sys
from collections import deque
n = int(input())
c=sys.stdin.readlines()
que=deque()

for i in range(n):
    com_num=c[i].split()
    if com_num[0]=="insert":
            que.appendleft(int(com_num[1]))
    elif com_num[0]=="deleteFirst":
            que.popleft()
    elif com_num[0]=="deleteLast":
            que.pop()
    elif com_num[0]=="delete":
        try:
            que.remove(int(com_num[1]))
        except:
            pass
print(" ".join(map(str,que)))


Measured memory_bytes: 188504
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    n: usize,
    mut a: [usize; n],
    }

    a.sort();
    let mut ans = a[n - 1];
    let mut cnt = 1;
    for a in a.iter().rev().skip(1) {
        let v = std::cmp::min(2, n - 1 - cnt);
        ans += *a * v;
        cnt += v;
    }
    println!("{}", ans);

}


Measured memory_bytes: 6208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()


int main(){
    ll n, k;
    cin >> n >> k;
    vector<vector<ll>> next(n, vector<ll>(61));
    REP(i, n){
        ll ai;
        cin >> ai;
        ai--;
        next.at(i).at(0) = ai;
    }

    for(ll i = 1; i <= 60; ++i){
        REP(j, n){
            const ll n1 = next.at(j).at(i - 1);
            const ll n2 = next.at(n1).at(i - 1);
            next.at(j).at(i) = n2;
        }
    }

    ll cur = 0;
    for(ll i = 60; i >= 0; --i){
        if(k >= (1LL << i)){
            cur = next.at(cur).at(i);
            k -= (1LL << i);
        }
    }
    cout << cur + 1 << endl;

    return 0;
}


Measured memory_bytes: 104900
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int main(){

	int n;
	while(cin >> n && n != 0){
		string str;
		cin >> str;
		for(int i = 0; i < n; i++){
			string nstr = "";
			int prvn = -1;
			int cnt = 0;
			for(int j = 0; j < str.size(); j++){
				if(prvn == -1){
					prvn = str[j] - '0';
					cnt++;
				}
				else if(prvn == str[j] - '0'){
					cnt++;
				}
				else if(prvn != str[j] - '0'){
					stringstream ss;
					ss << cnt;
					nstr += ss.str();
					nstr += (prvn + '0');
					prvn = str[j] - '0';
					cnt=1;
				}
			}
			stringstream ss;
			ss << cnt;
			nstr += ss.str();
			nstr += (prvn + '0');

			str = nstr;
		}
		cout << str << endl;
	}

	return 0;
}

Measured memory_bytes: 1072
#include<iostream>
#include<vector>
#include<string.h>

using namespace std;

#define REP(i, n) for(int i=0; i<n; i++)

int INF = 10e8;
int m, n;
int b[1005];
int r[1005];

vector<int> bd[1005];
vector<int> rd[1005];

struct edge{
    int to, cap, rev;
};
bool used[1005];
vector<edge> g[1005];

int s, t;

void add_edge(int from, int to, int cap){
    g[from].push_back((edge){to, cap, g[to].size()});
    g[to].push_back((edge){from, 0, g[from].size()-1});
}

int dfs(int v, int t, int f){
    if(v==t) return f;
    used[v] = true;
    REP(i, g[v].size()){
        edge &e = g[v][i];
        if(!used[e.to] && e.cap>0){
            int d = dfs(e.to, t, min(f, e.cap));
            if(d>0){
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t){
    int flow = 0;
    while(1){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if(f==0) return flow;
        flow += f;
    }
}

bool euclid(int x, int y){
    if(x<y){
        int tmp = x;
        x = y;
        y = tmp;
    }

    int r = x % y;
    while(r!=0){
        x = y;
        y = r;
        r = x % y;
    }

    if(y>1){
        return true;
    } else {
        return false;
    }
}

int main(){
    while(1){
        cin >> m >> n;

        if(m==0) break;

        REP(i, m) cin >> b[i];
        REP(i, n) cin >> r[i];

        int s = m+n, t = s+1;

        REP(i, 1005) g[i].clear();

        REP(i, m){
            REP(j, n){
                if(euclid(b[i], r[j])){
                    add_edge(i, m+j, 1);
                }
            }
        }

        REP(i, m) add_edge(s, i, 1);
        REP(i, n) add_edge(m+i, t, 1);

        int output = max_flow(s, t);
        cout << output << endl;
    }
}

Measured memory_bytes: 9348
#include <stdio.h>

int main(void){
  int n;
  
  scanf("%d",&n);
  
  double tmp;
  
  if((n%2)==0){
    tmp = 1/2.0;
  }else{
  	tmp = (n+1)/(2.0*n);
  }
  
  printf("%lf\n",tmp);
  
  return 0;
}



Measured memory_bytes: 128
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int n = io.r<int>();
        int t = 0;
        int h = 0;
        for (int i = 0; i < n; i++)
        {
            string[] s = io.r<string>(' ');
            int ans = s[0].CompareTo(s[1]);
            if (ans == 0) { t++; h++; }
            else if (ans < 0) { h += 3; }
            else { t += 3; }
        }
        io.w(t + " " + h);
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 10544
#include <stdio.h>
#include <stdlib.h>
int getdepth(int);
void print(int);
struct Node{
    int parent,left,right;
};
struct Node T[100000];
int count=0;
int d=0;
int main(){
    int n,i,j,node,k,child,l;
    
        scanf("%d",&n);
    
    for(i=0;i<n;i++){
        T[i].parent=-1;
        T[i].left=-1;
        T[i].right=-1;
    }
    for(i=0;i<n;i++){
        scanf("%d%d",&node,&k);
        for(j=0;j<k;j++){
            scanf("%d",&child);
            
            if(j==0){
                T[node].left=child;
            }
            else{
                T[l].right=child;
            }
            l=child;
            T[child].parent=node;
        }
    }
    for(i=0;i<n;i++){
        d=0;
        printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,getdepth(i));
        if(T[i].parent==-1){
            printf("root, [");
        }
        else if(T[i].left==-1)printf("leaf, [");
        else{
            printf("internal node, [");
        }
        print(T[i].left);
        count=0;
        printf("]\n");
    }
    return 0;
}
int getdepth(int a){
    while(T[a].parent!=-1){
        a=T[a].parent;
        d++;
    }
    return d;
}
void print(int t){
    if(t!=-1){
        if(count!=0){
            printf(", ");
        }
        count++;
        printf("%d",t);
        print(T[t].right);
    }
}

Measured memory_bytes: 1784
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, T;
	cin >> N >> T;

	vector<vector<Int>> ab(N, vector<Int>(2));
	for (Int i = 0; i < N; i++) {
		cin >> ab[i][0] >> ab[i][1];
	}
	//sort(ab.begin(), ab.end());

	vector<vector<Int>> dp1(N + 1, vector<Int>(T));//dp1[i+1][j]: 0～i番目までの料理の中で時間j以内となる最大うまさ
	vector<vector<Int>> dp2(N + 1, vector<Int>(T));//dp2[i][j]: i～N-1番目までの料理の中で時間j以内となる最大うまさ
	
	
	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j < T; j++) {

			//i番目の料理を食べる場合
			if (j + ab[i][0] < T) {
				dp1[i + 1][j + ab[i][0]] = max(dp1[i][j] + ab[i][1], dp1[i + 1][j + ab[i][0]]);
			}

			//i番目の料理を食べない場合
			dp1[i + 1][j] = max(dp1[i][j], dp1[i + 1][j]);
		}
	}

	for (Int i = N - 1; i >= 0; i--) {
		for (Int j = 0; j < T; j++) {
			//i番目の料理を食べる場合
			if (j + ab[i][0] < T) {
				dp2[i][j + ab[i][0]] = max(dp2[i + 1][j] + ab[i][1], dp2[i][j + ab[i][0]]);
			}

			//i番目の料理を食べない場合
			dp2[i][j] = max(dp2[i][j], dp2[i + 1][j]);
		}
	}

	Int ans = 0;
	//i番目の料理をT-1分後に注文する場合を全探索
	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j < T; j++) {
			ans = max(ans, dp1[i][j] + dp2[i + 1][T - 1 - j] + ab[i][1]);
		}
	}

	cout << ans << "\n";
}


Measured memory_bytes: 141312
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100005;
int n;
int L[N], R[N];
multiset <pair <int, int> > st, ed;
ll solve() {
    for (int i = 0; i < n; ++ i) {
        st.insert(make_pair(L[i], i));
        ed.insert(make_pair(R[i], i));
    }
    multiset <pair <int, int> > :: iterator it;
    int p = 0;
    int tp = 1;
    ll ans = 0;
    int cnt = 0;
    ll mx = 0;
    while (!st.empty()) {
        mx = max(mx, ans + abs(p));
        if (cnt == 5) break;
        tp ^= 1;
        if (tp & 1) {
            it = ed.begin();
            if (p > it -> first) {
                ans += p - it -> first;
                p = it -> first;
            }
            else {
                ++ cnt;
                continue;
            }
            st.erase(st.find(make_pair(L[it -> second], it -> second)));
            ed.erase(it);
        }
        else {
            it = -- st.end();
            if (p < it -> first) {
                ans += it -> first - p;
                p = it -> first;
            }
            else {
                ++ cnt;
                continue;
            }
            ed.erase(ed.find(make_pair(R[it -> second], it -> second)));
            st.erase(it);
        }
    }
    return max(mx, ans + abs(p));
}
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i) {
        scanf("%d%d", L + i, R + i);
    }
    L[n] = 0, R[n] = 0, ++ n;
    sort(L, L + n); sort(R, R + n);
    ll ans = 0, cur = 0;
    for (int i = 0; i < n; ++ i) {
        cur += L[n - i - 1] - R[i];
        ans = max(ans, cur);
    }
    printf("%lld\n", ans * 2);
    // printf("%lld\n", solve());
    return 0;
}


Measured memory_bytes: 1024
a,b,c,x = [int(input()) for i in range(4)]
count = 0
m = a+b+c
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
    	if (500*i + 100*j + 50*k) == x:
     		count += 1
print(count)

Measured memory_bytes: 3316
#include<stdio.h>
int main()
{
	char c;
	int a,b;
	scanf("%d %c %d",&a,&c,&b);
	if(c=='-')
	{
		printf("%d\n",a-b);
	}
	else 
	{
		printf("%d\n",a+b);
	}
}

Measured memory_bytes: 128
#include<cstdio>
#include<stack>
using namespace std;
typedef pair<int,int> P;
int main(){
    for(;;){
        int n,ins;
        scanf("%d",&n);
        if(n==0)break;
        stack<P> st;
        scanf("%d",&ins);
        st.push(P(ins,1));
        for(int ix=2;ix<=n;ix++){
            scanf("%d",&ins);
            P t=st.top();
            st.pop();
            if(ix%2==0){
                t=P(ins,t.second+1);
            }else{
                if(t.first==ins)t=P(ins,t.second+1);
                else{st.push(t);st.push(P(ins,1));continue;}
            }
            for(;;){
                if(st.empty()){st.push(t);break;}
                P u=st.top();
                st.pop();
                if(u.first==t.first){
                    t=P(t.first,u.second+t.second);
                }else{
                    st.push(u);
                    st.push(t);
                    break;
                }
            }
        }
        int sum=0;
        while(!st.empty()){
            P t=st.top();
            st.pop();
            if(t.first==0)sum+=t.second;
        }
        printf("%d\n",sum);
    }
}

Measured memory_bytes: 0
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<string, int> P;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n)  for(int i=0; i<(n); i++)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
/*int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}*/
int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}
int main(){
     int s, k;
  cin >> k >> s;
  LL ans = 0;
  REP(i,k+1){
    REP(j,k+1){
      int z = s-i-j;
      if(z>=0&&z<=k) ans++;
    }
  }
  

  cout << ans << endl;
}
    




Measured memory_bytes: 256
# 先頭と末尾を保ちつつ
from collections import deque

s = input()
q = int(input())
x, y = deque(), deque()
r = 0
for _ in range(q):
    query = input().split()
    if query[0] == "1":
        r += 1
        x, y = y, x
    elif query[0] == "2":
        f, c = query[1], query[2]
        if f == "1":
            if r % 2 == 0:
                x.appendleft(c)
            else:
                x.append(c)
        elif f == "2":
            if r % 2 == 1:
                y.appendleft(c)
            else:
                y.append(c)

if r % 2 == 1:
    s = s[::-1]
    x = reversed(x)
    y = reversed(y)
print("".join(x) + s + "".join(y))


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

using namespace std;

int main() {
  typedef long long ll;
  ll n, d, x, y, ans = 0;
  for (cin >> n >> d; n--;) {
    cin >> x >> y;
    if (d * d >= x * x + y * y)
      ans++;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define MOD 1000000000+7
#define INF (1LL<<30)
#define LINF (1LL<<55)

int tree[1000000];
int a[1000000];
int arr[1000000];
void build(int x,int l,int r)
{
    if (l==r)tree[x]=0;
    else
    {
        build(x*2,l,(l+r)/2);
        build(x*2+1,(l+r)/2+1,r);
    }
}
void upd(int x,int l,int r,int v,int val)
{
    if (v>r || v<l)return;
    if (l==r)
        tree[x]+=val;
    else
    {
        if (v<=(l+r)/2)
            upd(x*2,l,(l+r)/2,v,val);
        else
            upd(x*2+1,(l+r)/2+1,r,v,val);
        tree[x]=tree[x*2]+tree[x*2+1];
    }
}
int query(int x,int l,int r,int s,int e)
{
    if (s>e)return 0;
    if (s>r || e<l)return 0;
    if (l>=s && r<=e)
        return tree[x];
    return query(x*2,l,(l+r)/2,s,e)+query(x*2+1,(l+r)/2+1,r,s,e);
}
int n;
long long GetSmallerThan(int m)
{
    int N=2*n;
    //build(1,0,N);
    memset(tree,0,sizeof(tree));
    upd(1,0,N,n,1);
    int sum=n;
    long long ret=0;
    for (int i=1;i<=n;i++)
    {
        if (a[i]<=m)sum++;
        else sum--;
        ret+=query(1,0,N,0,sum-1);
        upd(1,0,N,sum,1);
    }
    return ret;
}

int b[1000000];
map<int,int> to;
map<int,int> from;
set<int> S;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i],S.insert(a[i]);
    int tot=0;
    for (set<int>::iterator it=S.begin();it!=S.end();it++)
    {
        to[*it]=tot;
        from[tot++]=*it;
    }
    for (int i=1;i<=n;i++)
    {
        a[i]=to[a[i]];
        b[i]=a[i];
    }
    sort(b+1,b+1+n);
    int l=1,r=n;
    long long len = n;
    len=len*(len+1)/2;
    long long need = len/2+1;
    int ret=-1;
    while(l<=r)
    {
        int mid=(l+r)/2;
        long long num = GetSmallerThan(b[mid]);
        if (num>=need)
        {
            ret=mid;
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }
    }
    //cout<<GetSmallerThan(2)<<endl;
    //cout<<GetSmallerThan(2)<<endl;
    //assert(ret!=-1);
    cout<<from[b[ret]]<<endl;
}


Measured memory_bytes: 26240
import heapq

N, M = map(int, input().split())

jobs = []
for i in range(N):
    a, b = map(int, input().split())
    jobs.append((a, b))
jobs.sort()

hq = []
ans = 0
index = 0
for i in reversed(range(M)):
    for j in range(index, N):
        a, b = jobs[j]
        if a > M - i:
            break
        if a == M - i:
            heapq.heappush(hq, -jobs[j][1])
            index += 1

    if len(hq):
        ans += heapq.heappop(hq) * (-1)

print(ans)


Measured memory_bytes: 20780
// editorial 解

#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

using ll = long long;
using P = pair<int,int>;
template<class T = int> using V = vector<T>;

template<class T> bool inline chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool inline chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T = int> T inline input() { T x; cin >> x; return (x); }
template<class T> void inline print(T& x) { cout << x << '\n'; }
#define debug(x) cerr << #x << ": " << x << endl;

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

  int A,B,C;
  cin >> A >> B >> C;

  if (A == B && B == C) {
    cout << (A % 2 == 0 ? -1 : 0) << endl;
    return 0;
  }

  int ans = 0;
  while(A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
    int tmp_a = A;
    int tmp_b = B;
    int tmp_c = C;
    A = tmp_b/2 + tmp_c/2;
    B = tmp_c/2 + tmp_a/2;
    C = tmp_a/2 + tmp_b/2;
    ans++;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 998244353;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main() {
   int L, R, d; cin >> L >> R >> d;

   cout << R / d - (L - 1) / d << endl;
 }


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int N, L, R, A[50];
//---------------------------------------------------------------------------------------------------
int check(int x) {
    rep(i, 0, N) if (x % A[i] == 0) {
        if (i % 2 == 0) return 1;
        else return 0;
    }

    if (N % 2 == 1) return 0;
    else return 1;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    while (cin >> N >> L >> R) {
        if (N == 0) return;
        rep(i, 0, N) cin >> A[i];

        int ans = 0;
        rep(i, L, R + 1) ans += check(i);
        printf("%d\n", ans);
    }
}



Measured memory_bytes: 3152
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
typedef long double ld;
using namespace std;

//-------------------------------------------------------------------
int M=1;
std::vector<int> seg;
void init(int N){
  while(M<N) M*=2;
  M=M*2-1;
  for(int i=0;i<M;i++) {
    seg.push_back(0);
  }
}
void update(int l, int r, int k){
  k+=(M+1)/2-1;
  seg[k]++;
  while(k>0){
    k = (k-1)/2;
    seg[k] = seg[k*2+1]+seg[k*2+2];
  }
}
ll query(int a, int b, int l, int r, int k){
  if(r<=a || b<=l) return 0;
  if(a<=l && r<=b) return seg[k];
  ll A = query(a, b, l, (l+r)/2, k*2+1);
  ll B = query(a, b, (l+r)/2, r, k*2+2);
  return A + B;
}
//-------------------------------------------------------------------

int main(int argc, char const *argv[]) {
  string S;
  std::cin >> S;
  init(S.size()+1);
  std::vector<int> alpha(26, 0);
  for(int i=0;i<S.size();i++) alpha[S[i]-'a']++;
  int c = 0, center=-1;
  for(int i=0;i<26;i++) if(alpha[i]%2==1) c++, center = i;
  if(c>1) {
    std::cout << -1 << '\n';
    return 0;
  }
  string A = "";
  for(int i=0;i<26;i++) alpha[i]/=2;
  for(int i=0;i<S.size();i++) {
    if(alpha[S[i]-'a'] > 0) {
      A += (S[i]);
      alpha[S[i]-'a']--;
    }
  }
  string C = A;
  reverse(C.begin(), C.end());
  if(center!=-1) A += (center+'a');
  A += C;
  vvi idx = vv(26, 0, 0, int);
  std::vector<int> now(26, 0);
  vector<int> af(A.size());
  for(int i=0;i<S.size();i++) idx[S[i]-'a'].push_back(i);
  ll ans = 0;
  for(int i=0;i<A.size();i++){
    af[i] = idx[A[i]-'a'][now[A[i]-'a']];
    now[A[i]-'a']++;
  }
  for(int i=0;i<af.size();i++){
    update(0, (M+1)/2, af[i]);
    ans += query(af[i]+1, (M+1)/2, 0, (M+1)/2, 0);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 5360
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

#define rep(i, l, r) for (int i = l; i <= r; i ++)
#define dwn(i, r, l) for (int i = r; i >= l; i --)
#define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt)
#define ev e[i].v
#define ec e[i].c
#define sqr(x) (x)*(x)
#define rlxX(x, y) x = max(x, y)
#define rlxN(x, y) x = min(x, y)
#define clr(a, b) memset(a, b, sizeof(a))
#define gc getchar()

typedef long long LL;
typedef double db;
const int N = 5e3 + 5, mod = 1e9 + 7;

int rd() {
	char ch = gc; int ret = 0;
	while (ch < '0' || ch > '9') ch = gc;
	while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc;
	return ret;
}

int n, m, f[N][N];
char str[N];

int Pow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = 1ll*res*a%mod;
		a = 1ll*a*a%mod;
		b >>= 1;
	}
	return res;
}

int main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	n = rd();
	scanf("%s", str);
	m = strlen(str);
	f[0][0] = 1;
	rep(i, 1, n)
		rep(j, 0, i) {
			if (j) f[i][j] = (f[i][j] + (f[i-1][j-1]<<1)%mod)%mod;
			else f[i][j] = (f[i][j] + f[i-1][j])%mod;
			f[i][j] = (f[i][j] + f[i-1][j+1])%mod;
		}
	//printf("%d\n", Pow(2, m));
	printf("%d\n", 1ll*f[n][m]*Pow(Pow(2, m), mod-2)%mod);
	
	return 0;
}
/*

*/



Measured memory_bytes: 96512
local h, w, n = io.read("*n", "*n", "*n")
local t = {}

local function add(i_h, i_w)
  local idx = i_h .. ":" .. i_w --(i_h - 1) * 1000000000 + i_w
  if t[idx] then t[idx] = t[idx] + 1 else t[idx] = 1 end
end

local function subtask(ah, bw)
  if 3 <= bw then add(ah, bw - 2) end
  if 2 <= bw and bw < w then add(ah, bw - 1) end
  if bw < w - 1 then add(ah, bw) end
end

for i = 1, n do
  local ah, bw = io.read("*n", "*n")
  if 3 <= ah then subtask(ah - 2, bw) end
  if 2 <= ah and ah  < h then subtask(ah - 1, bw) end
  if ah < h - 1 then subtask(ah, bw) end
end

local sum = 0
local tbl = {}
for i = 1, 9 do tbl[i] = 0 end
for k, v in pairs(t) do
  tbl[v] = tbl[v] + 1
  sum = sum + 1
end
local rem = (h - 2) * (w - 2) - sum
print(rem)
for i = 1, 9 do print(tbl[i]) end


Measured memory_bytes: 121304
#include<bits/stdc++.h>
#define LL long long
#define M 1000005 
using namespace std;
const int P=1e9+7; 
int  A[M];
int main(){
	int n,a,b;
	cin>>n>>a>>b;
	if(n*a>=b)printf("%d\n",b);
	else printf("%d\n",n*a);
	return 0;
}

Measured memory_bytes: 256
//  .:::.   .:::.
// :::::::.:::::::
// :::::::::::::::
// ':::::::::::::'
//   ':::::::::'
//     ':::::'
//       ':'
#include <bits/stdc++.h>
#define rep(i,a,b) for (i=a;i<b;i++)
#define rep2(i,a,b) for (i=a;i>=b;i--)
// #define mod 1000000007
#define mod2 998244353
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF  1e9+5
#define f first
#define s second
#define endl '\n'
#define ll long long
#define ii pair <int,int>
#define pll pair <ll,ll>
#define vi vector <int>
#define vl vector <ll>
#define vvi vector < vi >
#define vii vector < ii >
#define vpl vector < pll >
#define vvii vector < vii >
#define vll vector < ll >
#define vb  vector <bool>
#define pb push_back
#define mk make_pair
#define pg priority_queue<ll, vector<ll>, greater<ll>>
#define pq priority_queue<ll>
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define cset(a) __builtin_popcountll(a)
#define FILL(a, b, T) fill_n((T *)a, sizeof(a) / sizeof(T), b)
using namespace std;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// unordered_map<long long, int, custom_hash> safe_map;

vll e[100005];
vll c[100005];
ll a[100005];
ll n, mod; 
ll dfs1(ll u, ll par)
{ 
  ll ans = 1, i;
  i = 0;
  for(auto p: e[u])
  {
    if( p != par)
    {
      c[u][i] = dfs1(p,u);
      ans*=c[u][i];
      ans%=mod;
    }
    i++;
  }
  ans+=1;
  ans%=mod;
  return ans;
}
ll dfs2(ll u, ll par, ll pre)
{ 
  ll ans = 1, i;
  i = 0;
  for(auto p: e[u])
  {
    if( p == par)
    {
      c[u][i] = pre;
    }
    ans*=c[u][i];
    ans%=mod; 
    i++;
  }
  a[u] = ans;
  ll L[sz(e[u]) + 1], R[sz(e[u]) + 1];
  L[0] = 1;
  R[sz(e[u])] = 1;
  // prefix. for before i use L[i]
  rep(i,1,sz(e[u]))
  {
    L[i] = (L[i-1]*c[u][i-1])%mod;
  }
  // suffix. for after i use R[i+1]
  rep2(i,sz(e[u]) - 1, 0)
  {
    R[i] = (R[i+1]*c[u][i])%mod;
  }
  ll p;
  rep(i,0,sz(e[u]))
  {
    p = e[u][i]; 
    if( p != par)
    {
      dfs2(p, u, ( (L[i]*R[i+1])%mod + 1)%mod );
    }
  }
}
int main()
{
    
    FIO;
    ll t, q, prev, maxx, m, i, j, k1, k2, k3, k, x, y, flag, sum, cnt, ans;
    cin>>n>>mod;
    rep(i,0,n-1)
    {
      cin>>x>>y;
      e[x].pb(y);
      e[y].pb(x);
      c[x].pb(0);
      c[y].pb(0);
    }
    dfs1(1,-1);
    dfs2(1,-1,1);
    rep(i,0,n)
    {
      cout<<a[i+1]<<endl;
    }
    return 0;    
}


Measured memory_bytes: 24704
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy


X, Y = map(int, input().split())

print("Brown" if abs(X - Y) <= 1 else "Alice")

Measured memory_bytes: 3572
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

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

#define PI 3.1415926535897932384626433832795


class mod_ll
{
public:
	ll m_v;
	static const ll m_m=998244353; // prime value ex. 1000000009
	mod_ll(ll v=0) : m_v(v) {}
	mod_ll operator = (ll rhs)
	{
		m_v=rhs%m_m;
		return *this;
	}
	ll operator ()(){return m_v;}
	mod_ll operator = (mod_ll rhs)
	{
		m_v=rhs.m_v;
		return *this;
	}
	mod_ll operator += (ll rhs)
	{
		m_v=(m_v+rhs)%m_m;
		return *this;
	}
	mod_ll operator += (mod_ll rhs)
	{
		m_v=(m_v+rhs.m_v)%m_m;
		return *this;
	}
	mod_ll operator + (mod_ll rhs)
	{
		auto ret=*this;
		return ret+=rhs;
	}
	mod_ll operator -= (mod_ll rhs)
	{
		m_v=(m_v-rhs.m_v+m_m)%m_m;
		return *this;
	}
	mod_ll operator - (mod_ll rhs)
	{
		auto ret=*this;
		return ret-=rhs;
	}
	mod_ll operator *= (ll rhs)
	{
		m_v=(m_v*rhs)%m_m;
		return *this;
	}
	mod_ll operator *= (mod_ll rhs)
	{
		m_v=(m_v*rhs.m_v)%m_m;
		return *this;
	}
	mod_ll operator * (mod_ll rhs)
	{
		mod_ll ret=*this;
		return ret*=rhs;
	}
	mod_ll operator ^ (ll rhs)
	{
		mod_ll t=*this;
		mod_ll ret(1LL);

		for(;rhs>0;rhs>>=1)
		{
			if(rhs&1) ret*=t;
			t*=t;
		}
		return ret;
	}
	mod_ll operator /= (mod_ll rhs)
	{
		return *this*=(rhs^(m_m-2));
	}
	mod_ll operator /= (ll rhs)
	{
		mod_ll t(rhs);
		return *this/=t;
	}
	mod_ll operator / (mod_ll rhs)
	{
		mod_ll ret=*this;
		return ret/=rhs;
	}
};


mod_ll mod_fact(int n)
{
	static vector<mod_ll> memo(1);

	if(memo.size()<=n)
	{
		if(memo.size()==1)
		{
			memo[0]=1;
		}
		for(int i=memo.size();i<=n;i++)
		{
			memo.push_back(memo.back()*i);
		}
	}
	return memo[n];
}


mod_ll mod_nCr(int n, int r)
{
	mod_ll bunsi=mod_fact(n);
	mod_ll bunbo=mod_fact(n-r)*mod_fact(r);
	return bunsi/bunbo;
}


mod_ll mod_nPr(int n, int r)
{
	mod_ll ret(1);

	for(int i=0;i<r;i++)
	{
		ret*=(n-i);
	}
	return ret;
}


int main(void)
{
	int n, s;
	while(scanf("%d%d", &n, &s)==2)
	{
		vi a(n);

		for(auto&m:a) scanf("%d", &m);

		vector<mod_ll> dp(s+1);
		mod_ll u(2);
		u=u^n;

		dp[0]=u;
		for(int ma:a)
		{
			for(int i=s-ma;i>=0;i--)
			{
				int ts=i+ma;
				dp[ts]+=dp[i]/2;
			}
		}
		mod_ll ans=dp[s];
		printf("%lld\n", ans());
	}
	return 0;
}


Measured memory_bytes: 3252
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>

#define repAll(n) (n).begin(), (n).end()
#define repConAll(n) (n).cbegin(), (n).cend()

using namespace std;

namespace {

}

int main()
{
	int x1, y1, x2, y2;

	cin >> x1 >> y1 >> x2 >> y2;

	int dx = x2 - x1;
	int dy = y2 - y1;

	int x3 = x2 - dy;
	int y3 = y2 + dx;

	int x4 = x3 - dx;
	int y4 = y3 - dy;

	cout << x3 << " " << y3 << " " << x4 << " " <<y4 << endl;

	return 0;
}

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

int main() {
    int n;
    while(cin>>n, n) {
        vector<int> vi;
        for(int i=1; i<n; ++i)
            vi.push_back(i*i%n);

        sort(vi.begin(), vi.end());
        vector<int>::iterator uni = unique(vi.begin(), vi.end());
        vi.erase(uni, vi.end());

        int cnt[(n-1)/2+1];
        memset(cnt, 0, sizeof(cnt));

        for(int i=0; i<vi.size(); ++i) {
            for(int j=i+1; j<vi.size(); ++j) {
                int ci = vi[i] - vi[j];
                if(ci < 0) ci += n;
                if(ci > (n-1)/2) ci = n - ci;
                cnt[ci]++;
            }
        }

        for(int i=1; i<=(n-1)/2; ++i) cout<<cnt[i]*2<<endl;
    }
}

Measured memory_bytes: 1032
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    cout << min(c, b/a) << "\n";
    return 0;
}

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

using namespace std;

int main() {
	string S;
	bool a = false, b = false, c = false;

	cin >> S;

	for (int i = 0; i < 3; ++i) {
		if (S[i] == 'a') {
			a = true;
		}
		if (S[i] == 'b') {
			b = true;
		}
		if (S[i] == 'c') {
			c = true;
		}
	}

	if (a && b && c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  	int h, n; cin >> h >> n;
  int a =0;
  for( int i= 1; i<= n;i++ ){
    int c;cin>>c;a+=c;
  }
  if(a>=h)cout<<"Yes";
  else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 A,B;
	SINT32 ans = 0;

	cin >> N;
	cin >> A >> B;
	
	rep(i,1,N+1) {

		SINT32 buf;
		buf = i/10000 + (i%10000)/1000 + (i%1000)/100 + (i%100)/10 + i%10;
		if ((buf >= A) && (buf <= B)) {
			ans += i;
		}
	}

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

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for(int i=1;i<=10;i++)
        {
            if(n<=i*1000)
            {
               System.out.println((i*1000)-n);
               break;
            }

        }
    }
}

Measured memory_bytes: 27060
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
    
if t[0] >= x[0] + y[0] and t[0] % 2 == (x[0] + y[0]) % 2:
    flag = True
else:
    flag = False

for i in range(N-1):
    time = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if time < dist or time % 2 != dist % 2:
        flag = False
        break
        
if flag:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 11636
#include<iostream>
using namespace std;
int main()
{

	int N, a[9999], value = 0;
	cin >> N;
	
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		value += a[i] - 1;
	}
	cout << value;
	
	
			return 0;

		
	
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF INT_MAX/3
#define mod 1000000007

#define MAX_V 510

//// max flow(Dinic)
struct edge{ int to,cap,rev; };
vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,int cap){
  G[from].push_back((edge){to,cap,(int)G[to].size()});
  G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s]=0;
  que.push(s);
  while(!que.empty()){
    int v=que.front(); que.pop();
    for(int i=0;i<(int)G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[e.to]<0){
        level[e.to]=level[v]+1;
        que.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  while(1){
    bfs(s);
    if(level[t]<0)return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,INF))>0){
      flow+=f;
    }
  }
}

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

  int N,M;
  cin>>N>>M;
  string S;
  cin>>S;

  int source=N,sink=N+1;
  rep(i,N){
    int a;
    cin>>a;
    if(S[i]=='L'){
      add_edge(source,i,a);
      add_edge(i,sink,0);
    }else{
      add_edge(source,i,0);
      add_edge(i,sink,a);
    }
  }

  rep(i,M){
    int s,t,b;
    cin>>s>>t>>b;
    s--;t--;
    if(s>t)swap(s,t);
    add_edge(t,s,b);
  }
  cout<<max_flow(source,sink)<<endl;

  return 0;
}



Measured memory_bytes: 3244
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()
h,w=MI()
for i in range(w+2):
    print("#",end="")
print("")
for i in range(h):
    print("#",end="")
    print(input().rstrip(),end="")
    print("#")
for i in range(w+2):
    print("#",end="")

Measured memory_bytes: 38384
#include<bits/stdc++.h> 
using namespace std;
 
int main(){
 
  long long n,d;
  cin >> n>> d;
  long double x[n][d];
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++)cin >> x[i][j];
  }
 
  long long s=0;
 
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      long double t=0;
      for(int k=0;k<d;k++)t+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      t=sqrt(t);
      if(abs(t-floor(t))<0.00001)s++;
    }
  }
  cout << s << endl;
 
}

Measured memory_bytes: 3728