akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    try {
      int oneNum = stdIn.nextInt();
      if (oneNum < 0) return;
      int zeroNum = stdIn.nextInt();
      if (zeroNum < 0) return;
      int minusOneNum = stdIn.nextInt();
      if (minusOneNum < 0) return;
      int selectNum = stdIn.nextInt();
      if (selectNum < 1 || (oneNum + zeroNum + minusOneNum) < selectNum || (oneNum + zeroNum + minusOneNum) > 2 * Math.pow(10, 9)) return;
      int maxValue = 0;
      int restSelect = selectNum;
      if (restSelect != 0) {
        if (oneNum <= restSelect) {
          for (int oneCnt = 0; oneCnt < oneNum; oneCnt++) {
            maxValue++;
          }
          restSelect -= oneNum;
        } else {
          for (int oneCnt = 0; oneCnt < restSelect; oneCnt++) {
            maxValue++;
          }
          restSelect = 0;
        }
      }
      if (restSelect != 0) {
        if (zeroNum <= restSelect) {
          restSelect -= zeroNum;
        } else {
          restSelect -= restSelect;
        }
      }
      if (restSelect != 0) {
        if (minusOneNum <= restSelect) {
          for (int minusOneCnt = 0; minusOneCnt < minusOneNum; minusOneCnt++) {
            maxValue--;
          }
          restSelect -= minusOneNum;
        } else {
          for (int minusOneCnt = 0; minusOneCnt < restSelect; minusOneCnt++) {
            maxValue--;
          }
          restSelect -= restSelect;
        }
      }
      System.out.println(maxValue);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      stdIn.close();
    }
  }
}

Measured memory_bytes: 35740
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = G;
		Array.Sort(N);
		WriteLine(N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9 ? "YES" : "NO");
	}
}


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

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;


template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}

const int N=5e5+10;

template<typename T>
struct Fenwick{
    vector<T> tree;
    Fenwick(int n){
        tree.resize(n);
    }

    T query(int i){
        int sum=0;
        while(i){
           sum+=tree[i];
           i-=i&(-i);
       }  
       return sum;
    }
    void update(int i,int n,T val){
       while(i<=n){
          tree[i]+=val;
          i+=i&(-i);
       }
    }
};


int solve(){
 	int n,k;cin>>n>>k;
 	vector<int>a(n+1);
 	rep(i,1,n+1){
 		cin>>a[i];
 	}
 	auto func=[&](int x){
 		int cnt=0;
 		for(int i=1;i<=n;i++){
 			if(a[i]==x)continue;
 			cnt+=(a[i]/x);
 		}
 		return cnt<=k;
 	};
 	int l=1,u=1e9;
 	int ans=1e9;
 	while(l<=u){
 		int m=(l+u)/2;
 		if(func(m)){
 			u=m-1;
 			ans=m;
 		}
 		else{
 			l=m+1;
 		}
 	}
 	cout<<ans<<endl;
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
 

Measured memory_bytes: 4724
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?(c=getchar()):0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
const int N=200010;
char s[N],*t=s;
int main(){
	int n=ni,tot=ni;
	scanf("%s",s);
	char inv=0,fir=0;
	while(*(t+(n&1))){
		char c=*t;
		c^=fir^inv;
		if(tot==0){
			putchar(c);
			int rest=t-s;
			for(;*++t;putchar((*t)^inv));
			for(int i=0;i<rest;i++){
				putchar('B'-((rest-i)&1));
			}
			putchar('\n');
			return 0;
		}
		tot--;
		if(c=='B'){
			t++;
			inv^='A'^'B';
			fir=0;
		}else{
			fir='A'^'B';
		}
	}
	if(n&1){
		putchar((*t)^fir^inv^((tot&1)?('A'^'B'):0));
		for(int i=1;s[i];i++){
			putchar('A'+(i&1));
		}
	}else{
		for(int i=0;s[i];i++){
			putchar('A'+((i&1)==0));
		}
	}
	putchar('\n');
	return 0;
}

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

using namespace std;
#define mp make_pair
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;


char chs[3] = {'R', 'G','B'};

int idx(char ch){
    for(int k=0;k<3;k++)
        if(ch == chs[k])
            return k;
}

int other(char c1, char c2){
    for(int k=0;k<3;k++)
        if(chs[k] != c1 && chs[k] != c2)
            return k;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n;
    cin >> s;
    int i,j,k;
    vvi cnt(n, vi(3, 0));

    for(i=n-1;i>=0;i--){
        if(i+1 < n)
            for(int k=0;k<3;k++)
                cnt[i] = cnt[i+1];
        cnt[i][idx(s[i])]++;
    }
    
    ll ans = 0;
    int o;
    for(i=0;i<n-2;i++){
        for(j=i+1;j<n-1;j++){
            if(s[i] == s[j]) continue;
            o = other(s[i],s[j]);
            ans += cnt[j+1][o];
            if(j + (j-i) < n && o == idx(s[j + (j-i)]))
                ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<pair<int,int> > ans;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(i+1+j+1!=(n/2)*2+1)
				ans.push_back(make_pair(i+1,j+1));
		}
	}
	cout << ans.size() << endl;
	for(int i=0;i<ans.size();i++)
		cout << ans[i].first << " " << ans[i].second << endl;
}

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

const int limit = 50;

int n, m;
int a[limit], b[limit];

bool graph[limit][limit];
bool visited[limit];

void dfs(int v) {
	visited[v] = true;
	for (int v2 = 0; v2<n; v2++) {
		if (graph[v][v2] == false) continue;
		if (visited[v2] == true) continue;
		dfs(v2);
	}
}

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

	for (int i = 0; i<m; i++) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	int ans = 0;
	for (int i = 0; i<m; i++) {
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

		for (int j = 0; j<n; j++) visited[j] = false;

		dfs(0);

		bool bridge = false;
		// 橋じゃないならDFSにより全ての頂点を通ることになる
		for (int j = 0; j<n; j++) if (visited[j] == false) bridge = true;
		if (bridge) ans += 1;

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	cout << ans << endl;

	return 0;
}

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

int bubbleSort(int a[], int n) {
    int t, count = 0;
    bool flag = 1;
    while (flag) {
        flag = 0;
        for (int j = n-1; j > 0; j--) {
            if (a[j] < a[j-1]) {
                t = a[j];
                a[j] = a[j-1];
                a[j-1] = t;
                flag = 1;
                count++;
            }
        }
    }
    return count;
}

int main()
{
    int n, count = 0;  cin >> n;
    int a[n];
    rep(i,n)  cin >> a[i];

    count = bubbleSort(a,n);

    rep(i,n) {
        if (i < n-1)  cout << a[i] << ' ';
        else  cout << a[i] << endl;
    }
    cout << count << endl;
}


Measured memory_bytes: 3092
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include "bits/stdc++.h"

typedef long long ll;
using namespace std;

int a,b,h; 

int main() {
	cin >> a >> b >> h;
	printf("%d\n",(a+b)*h/2 ); 
	return 0;
}


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

#define mp make_pair
#define pb push_back

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int MAX_N = 1000000;
int n,q;
string s;

int main()
{
  cin >> n >> s >> q;

  int k;
  while (q--) {
    cin >> k;
    i64 r = 0, dc = 0, mc = 0, mdc = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == 'D') {
        dc++;
      } else if (s[i] == 'M') {
        mc++;
        mdc += dc;
      } else if (s[i] == 'C') {
        r += mdc;
      }

      if (i >= k-1) {
        if (s[i-k+1] == 'D') {
          dc--;
          mdc -= mc;
        } else if (s[i-k+1] == 'M') {
          mc--;
        }
      }
    }
    cout << r << endl;
  }

  return 0;
}


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

int main() {

  int N;
  cin>>N;
  
  int cnt=0,cnt2=0;
  for(int i=1;i<=N;i+=2){
    cnt=0;
    for(int j=1;j<=i;j++){
      if(i%j==0){
        cnt++;
      }
    }
    if(cnt==8)
      cnt2++;
  }
  
  cout<<cnt2<<endl;;
  return 0;
}


Measured memory_bytes: 256
s=int(input())
c=[s]
for i in range(1000000):
  if c[i]%2==0:
    d=c[i]/2
    if d in c:
      print(i+2)
      exit()
    else:
      c.append(d)
  else:
    e=3*c[i]+1
    if e in c:
      print(i+2)
      exit()
    else:
      c.append(e)
    
      

Measured memory_bytes: 3060
#include<stdio.h>
int main ()
{   int K,a,b;
   scanf("%d",&K);
   scanf("%d %d",&a,&b);
   for(int i=a;i<=b;i++)
     if(i%K==0) {printf("OK");return 0;}
   printf("NG");
   return 0;
}

Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)
typedef long long int lli;

lli gcd(lli a, lli b){
    if(a%b==0) return b;
    return gcd(b,a%b);
}

int main(){
    int n;
    cin >> n;
    REP(repeat, n){
        lli a,b,c,d;
        cin >> a >> b >> c >> d;

        bool yes = false;
        if(a >= b){
            if(b == d){
                if(a%b <= c){
                    yes = true;
                }
            }else if(b <= d){
                lli g = gcd(d-b, d);
                //lli x = c/g +1;
                lli aa = a%d -d;
                lli x = (c-aa)/g +1;
                //x *= g;
                x = x*g +aa;
                //cerr << g << endl;
                if(x >= b){
                    yes = true;
                }
            }
        }

        if(yes){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// UVa11248 Frequency Hopping：使用Dinic算法
// Rujia Liu
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;

const int maxn = 300 + 10;
const int INF = 1000000000;

struct Edge {
  int from, to, cap, flow;
};

bool operator < (const Edge& a, const Edge& b) {
  return a.from < b.from || (a.from == b.from && a.to < b.to);
}

struct Dinic {
  int n, m, s, t;
  vector<Edge> edges;    // ?数的?倍
  vector<int> G[maxn];   // ?接表，G[i][j]表示?点i的第j条?在e数?中的序号
  bool vis[maxn];         // BFS使用
  int d[maxn];           // 从起点到i的距?
  int cur[maxn];        // 当前弧指?

  void ClearAll(int n) {
    for(int i = 0; i < n; i++) G[i].clear();
    edges.clear();
  }

  void ClearFlow() {
    for(int i = 0; i < edges.size(); i++) edges[i].flow = 0;    
  }

  void AddEdge(int from, int to, int cap) {
    edges.push_back((Edge){from, to, cap, 0});
    edges.push_back((Edge){to, from, cap, 0});
    m = edges.size();
    G[from].push_back(m-2);
    G[to].push_back(m-1);
  }

  bool BFS() {
    memset(vis, 0, sizeof(vis));
    queue<int> Q;
    Q.push(s);
    vis[s] = 1;
    d[s] = 0;
    while(!Q.empty()) {
      int x = Q.front(); Q.pop();
      for(int i = 0; i < G[x].size(); i++) {
        Edge& e = edges[G[x][i]];
        if(!vis[e.to] && e.cap > e.flow) {
          vis[e.to] = 1;
          d[e.to] = d[x] + 1;
          Q.push(e.to);
        }
      }
    }
    return vis[t];
  }

  int DFS(int x, int a) {
    if(x == t || a == 0) return a;
    int flow = 0, f;
    for(int& i = cur[x]; i < G[x].size(); i++) {
      Edge& e = edges[G[x][i]];
      if(d[x] + 1 == d[e.to] && (f = DFS(e.to, min(a, e.cap-e.flow))) > 0) {
        e.flow += f;
        edges[G[x][i]^1].flow -= f;
        flow += f;
        a -= f;
        if(a == 0) break;
      }
    }
    return flow;
  }

  int Maxflow(int s, int t) {
    this->s = s; this->t = t;
    int flow = 0;
    while(BFS()) {
      memset(cur, 0, sizeof(cur));
      flow += DFS(s, INF);
    }
    return flow;
  }

  vector<int> Mincut() { // call this after maxflow
    vector<int> ans;
    for(int i = 0; i < edges.size(); i++) {
      Edge& e = edges[i];
      if(vis[e.from] && !vis[e.to] && e.cap > 0) ans.push_back(i);
    }
    return ans;
  }

  void Reduce() {
    for(int i = 0; i < edges.size(); i++) edges[i].cap -= edges[i].flow;
  }
};

Dinic g;

vector <int>ans;

int main() {
	int n, m, u, v;
	scanf("%d%d",&n,&m);
	for(int i = 0; i < m; i++) {
		scanf("%d%d",&u,&v);
		g.AddEdge(u,v,1);
	}
	scanf("%d%d",&u,&v);
	printf("%d\n",g.Maxflow(u,v));
	int tot = 0;
	for(int i = 0; i < m; i++) if(g.edges[i<<1|1].flow > 0) {
		ans.push_back(i+1);
		tot++;
	}
	printf("%d\n",ans.size());
	while(tot--) printf("%d\n",ans[tot]);
	return 0;
}

Measured memory_bytes: 1128
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T>
vector<T> make_v(size_t size, const T& init){ return vector<T>(size, init); }

template<class... Ts>
auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }


int main() {
    int n;
    cin >> n;
    auto v = make_v(n, n, 0LL);
    auto x = make_v(n, n, 1);
    for (auto &&i : v) {
        for (auto &&j : i) {
            scanf("%lld", &j);
        }
    }
    ll ans = 0;
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                if(i == k || k == j || j == i) continue;
                if(v[i][j] > v[i][k]+v[k][j]){
                    puts("-1");
                    return 0;
                }else if(v[i][j] == v[i][k]+v[k][j]){
                    x[i][j] = 0;
                }
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            if(x[i][j]) ans += v[i][j];
        }
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;

const int N = 2e5 + 5;
ll dp[N];
int arr[N];

ll calc(pair<int, ll> p, int h)
{
    return 1ll * p.first * h + p.second;
}

ll query(vector<pair<int, ll>>& lines, int h)
{
  ll ret = 1e18;
  int st = 0, en = lines.size() - 1;
  while (st <= en)
  {
    int mid = (st + en) / 2;
    if(mid == lines.size() - 1)
    {
      ret = min(ret, calc(lines[mid], h));
      break;
    }
    ll first = calc(lines[mid], h), second = calc(lines[mid + 1], h);
    ret = min(ret, min(first, second));
    if(first >= second)
      st = mid + 1;
    else
      en = mid - 1;
  }
  return ret;
}

ld intersection(pair<int, ll> p1, pair<int, ll> p2)
{
  return (ld)(p2.second - p1.second) / (p1.first - p2.first);
}

int main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int n;
  ll c;
  cin >> n >> c;
  for(int i = 0; i < n; i++)
    cin >> arr[i];
  vector<pair<int, ll>> lines;
  dp[0] = 0;
  lines.push_back({-2 * arr[0], dp[0] + 1ll * arr[0] * arr[0]});
  for(int i = 1; i < n; i++)
  {
    dp[i] = c + 1ll * arr[i] * arr[i] + query(lines, arr[i]);
    pair<int, ll> newLine = {-2 * arr[i], dp[i] + 1ll * arr[i] * arr[i]};
    while (lines.size() >= 2 && intersection(lines[lines.size() - 2], newLine) < intersection(lines.back(), lines[lines.size() - 2]))
      lines.pop_back();
    lines.push_back(newLine);
  }
  cout << dp[n - 1];
  return 0;
}


Measured memory_bytes: 8176
'use strict';
let stdin = require('fs').readFileSync('/dev/stdin', 'utf8');
let a = 0, b = 0;
for(let x of stdin.split(' ')) {
	x = parseInt(x);
	if(x == 5) {
		a++;
	} else if(x == 7) {
		b++;
	}
}
console.log(a == 2 && b == 1 ? "YES" : "NO");

Measured memory_bytes: 7412
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int x, y; cin >> x >> y;
	int ans = 0;
	while (x <= y) {
		x *= 2; ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  
  int N=0, K=0;
  
  cin >> N >> K;
  
  if(N%K==0) {
    
    cout << "0" << endl;
    
  } else {
    
    cout << "1" << endl;
    
  }
  
}

Measured memory_bytes: 256
/*
जिन खोजा तिन पाइया, गहरे पानी पैठ,
मैं बपुरा बूडन डरा, रहा किनारे बैठ।
*/
#include<bits/stdc++.h>
#include<iostream>

using namespace std;

#define boost ios::sync_with_stdio(0);cin.tie(0);
#define forn(i,n) for ( int i=0 ; i < n ; i++ )
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define lb lower_bound
#define ub upper_bound
#define vi vector<int >
#define pii pair<int, int>
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SQ(a) (a)*(a)
#define ll long long
#define lli long long int
#define ull unsigned long long
#define endl '\n'
#define Pi(a) printf("%d\n",a);
#define debug2(a,b) printf("%d\t%d\n",a,b);
#define debug1(a) printf("%d\n",a);
#define Si(a) scanf("%d",&a);
#define mod 1000000007
#define w(n) while(n--)



int main()
{
	//freopen ("f.in","r",stdin);
 	//freopen ("f.out","w",stdout);
	boost
	//code
	int n;
	cin >> n;
	map<ll,ll> m1,m2;
	forn(i,n){
		int a;
		cin >> a;
		if(i%2){
			m2[a]++;
		}
		else m1[a]++;
	}
	ll to = n/2;
	ll one,two;
	ll val1,val2;
	one=two=0;
	for(auto it:m1){
		if(one<it.S){
			one=it.S;
			val1=it.F;
		}
	}
	for(auto it:m2){
		if(two<it.S){
			two=it.S;
			val2=it.F;
		}
	}
	if(val1==val2){
		ll other1,other2;
		other1=other2=0;
		for(auto it:m1){
			if(it.F==val1) continue;
			other1=max(other1,it.S);
		}
		for(auto it:m2){
			if(it.F==val2) continue;
			other2=max(other2,it.S);
		}
		if(other2&&other1)
		cout << max(0LL,min(2*to-other1-two,2*to-other2-one)) << endl;
		else if(other1){
			cout << 2*to-other1-two << endl;
		}
		else if(other2){
			cout << 2*to-other2-one << endl;
		}
		else{
			cout << to << endl;
		}
	}
	else cout << 2*to-one-two << endl;
	return 0;

}
/*
-> check for array out of bounds & array declaired before size input(runtime error)
-> check for int overflow, use ll
-> check for corner cases like 0
-> check for j++ in while loop for every case
-> use boost except for interactive problems
*/

Measured memory_bytes: 6528
#include<iostream>
#include<string.h>
#include<map>
using namespace std;
map<char,int>m;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        char a;
        cin>>a;
        m[a]++;
    }
    int cnt=m.size();
    if(cnt==1)
     cout<<"One"<<endl;
     else if (cnt==2)
     cout<<"Two"<<endl;
     else if(cnt==3)
     cout<<"Three"<<endl;
     else if(cnt==4)
     cout<<"Four"<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <iostream>
#include <numeric>
#include <string>
using namespace std;
using ll = long long;
int main(){
  ll K;
  ll res=0;
  cin >> K;
  for(ll i=1;i<K+1;i++){
    for(ll j=1;j<K+1;j++){
      for(ll k=1;k<K+1;k++){
      res+=gcd(gcd(i,j),k);
      }
    }
  }
	cout << res << endl;
}

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

int main() {
  string w;
  cin >> w;
  
  if( w == "Sunny"){
    cout << "Cloudy" << endl;
  }
  
  if( w == "Cloudy"){
    cout << "Rainy" << endl;
  }
  
  if(w == "Rainy"){
    cout << "Sunny" << endl;
  }
}


Measured memory_bytes: 256
n = int(input())
s = list(input())
j = 1
count = 0
for i in range(n):
    if s[i] == 'R':
        continue
    else:
        while 1:
            if j + i >= n:
                break
            elif s[-j] == 'R':
                s[i] = 'R'
                s[-j] = 'W'
                count += 1
                break
            j += 1
print(count)

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

typedef long long int ll;
typedef pair<int,int> pii;
const int mod = 1e9+7;

int main(){
    int n,k;
    scanf("%d %d",&n,&k);

    ll ans = 0;
    for(ll i = k; i <= n + 1; i++){
        ans += i * (n - i + 1) + 1;
        ans %= mod;
    }

    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3764
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {

        FastScanner fs = new FastScanner();

        int r = fs.nextInt();
        System.out.println( r * 2 * 3.141592 );

    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int bufferLength = 0;

        private boolean hasNextByte() {
            if (ptr < bufferLength) {
                return true;
            } else {
                ptr = 0;
                try {
                    bufferLength = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return bufferLength > 0;
            }
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    private static int gcd( int a , int b ){
        int x;
        int y;
        if (a > b) {
            x = a;
            y = b;
        } else {
            x = b;
            y = a;
        }
        int tmp;
        while ((tmp = x % y) != 0) {
            x = y;
            y = tmp;
        }
        return y;
    }

}


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

int main() {
	// your code goes here
	// return 0;
	int n = 0, d = 0, count = 0;
	cin >> n >> d;
	for(int i = 0; i < n; i++){
		long double a , b;
		cin >> a >> b;
		long double root = sqrt(pow(a,2) + pow(b,2));
		// cout<<root<<endl;
		if(root <= d)
			count++;
	}
	cout<<count<<endl;
	return 0;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;

typedef long long int ll;

void solve(){
	string s1,s2;
	cin >> s1 >> s2;
	int N = s1.size(), M = s2.size();
	vector<vector<pair<int,string> > > dp(2,vector<pair<int,string> >(M+1,mp(0,"")));

	int coun = 1;
	for(int i = 1; coun <= N; i = (i+1)%2,coun++){
		for(int j = 1; j <= M; j++){
			int a = dp[(i+1)%2][j].first,b = dp[i][j-1].first, c= dp[(i+1)%2][j-1].first+ (s1[coun-1]== s2[j-1]);
			if(a >= b && a >= c){
				dp[i][j].first = a;
				dp[i][j].second = dp[(i+1)%2][j].second;
			} 
			else if(b >= a && b >= c){
				dp[i][j].first = b;
				dp[i][j].second = dp[i][j-1].second;
			}
			else{
				dp[i][j].first = c;
				dp[i][j].second = dp[(i+1)%2][j-1].second;
				dp[i][j].second.pb(s1[coun-1]);
			}
			//cout << dp[i][j].first << " ";
		}
		//cout << endl;
	}
//	cout << "  ";
//	for(int i = 0; i < s2.size(); i++) cout << s2[i] << " ";
//	cout << endl;
//	for(int i = 1; i <= N; i++){
//		cout << s1[(i+1)%2] << " ";
//		for(int j = 1; j <= M; j++){
//			cout << dp[i][j].first << " ";
//		}
//		cout << endl;
//	}
	cout << dp[N%2][M].second << endl;
}

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

	int T;
	//cin >> T;
	T =1;
	while(T--){
		solve();
	}
	return 0;
}




Measured memory_bytes: 8380
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N,M,C;
	cin>>N>>M>>C;
	int B[M];
	for(int i=0;i<M;i++)cin>>B[i];
	int res = 0;
	for(int i=0;i<N;i++)
	{
		int ans = C;
		for(int j=0;j<M;j++)
		{
			int a; cin>> a;
			ans += B[j]*a;
		}
		if(ans>0)++res;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
n,m = gets.chomp.split(" ").map(&:to_i)
a = m.times.map{gets.chomp.split(" ").map(&:to_i)}
b = Hash.new(0)
m.times do |i|
  if a[i][0] == 1
    b[a[i][1]] += 1
  elsif a[i][1] == n
    b[a[i][0]] += 1
  end
end 
if b.values.include?(2)
  puts "POSSIBLE"
else
  puts "IMPOSSIBLE"
end

Measured memory_bytes: 30716
#include<bits/stdc++.h>
#define N 305
#define mk(x,y) make_pair(x,y)
using namespace std;
const int p = 1000000007;
int n,m;
vector<pair<int,int> >v[N];
int f[2][N][N][3];
struct node
{
    int l,r,x;
}a[N];
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d%d",&a[i].l,&a[i].r,&a[i].x);
        if(a[i].l==a[i].r&&a[i].x!=1)
        {
            puts("0");return 0;
        }
        else v[a[i].r].push_back(mk(a[i].l,a[i].x));
    }
    f[1][0][0][0]=f[1][0][0][1]=f[1][0][0][2]=1;
    int now=1,pre=0;
    for(int i=2;i<=n;i++)
    {
        now^=1;pre^=1;
        memset(f[now],0,sizeof(f[now]));
        int ed=v[i].size();
        for(int j=0;j<=n;j++)
        {
            for(int k=0;k<=n;k++)
            {
                for(int l=0;l<=2;l++)
                {
                    if(!f[pre][j][k][l])continue;
                    int p1,p2;
                    for(int s=0;s<=2;s++)
                    {
                        if(s==l)p1=j,p2=k;
                        else if((s==2&&l==1)||(s==1&&l==2)||(s==0&&l==2))p1=j,p2=i-1;
                        else p1=i-1,p2=j;
                        for(int r=0;r<ed;r++)
                        {
                            int tmp=(p1>=v[i][r].first)+(p2>=v[i][r].first);
                            if(tmp+1!=v[i][r].second){p1=-1;break;}
                        }
                        if(p1==-1)continue;
                        (f[now][p1][p2][s]+=f[pre][j][k][l])%=p;
                    }
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)for(int k=0;k<=2;k++)(ans+=f[now][i][j][k])%=p;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2432
def _gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def gcd(a, b, c):
    return _gcd(_gcd(a, b), c)

n = int(input())
ans = 0
for i in range(1, n+1):
    ans += gcd(i, i, i)
for i in range(1, n+1):
    for j in range(i+1, n+1):
        ans += gcd(i, j, j)*6
for i in range(1, n+1):
    for j in range(i+1, n+1):
        for k in range(j+1, n+1):
            ans += gcd(i, j, k)*6
print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 9999999

using namespace std;

int main(){
	ll n, t, a;
	cin >> n >> t >> a;
	ll h, ans;
	float diff = INF;
	REP(i, n){
		cin >> h;
		if (abs(t - 0.006*h - a) < diff){
			diff = abs(t - 0.006*h - a);
			ans = i + 1;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
//Tariquzzaman Faisal
//_Faisal101_
//IUT_CSE'19
//190041101
 
#include<iostream>
#include<stdio.h>
#include<vector>
#include<deque>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstring>
#include<climits>
#include<cmath>
#include<iterator>
#include<set>
#define fileOut freopen("out.txt","w",stdout)
#define fileIn freopen("in.txt","r",stdout)
#define testcases ll TC,T; cin >> TC; for(T=1; T<=TC; T++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define INFLL 9223372036854775807
#define INF 2147483647
#define pi acos(-1.0)
#define ll long long
#define endll printf("\n")
#define CASE printf("Case %lld: ",T)
#define ff first
#define ss second
#define mem(ara,n) memset(ara,n,sizeof ara)
#define ull unsigned long long
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mid3(a,b,c) min(max(a,b),max(b,c),max(a,b))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define endl '\n'
#define ld long double
 
 
using namespace std;


int main(){
    string s;
    cin >> s;
    string s2 = "";
    for (int i = 0; i < s.size(); ++i)
    {
        s2+='1';
        i++;
        if(i<s.size()){
            s2+= '0';
        }
    }
    //cout<<s<<endl<<s2<<endl;
    ll counter = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        if(s[i] != s2[i]){
            counter++;
        }
    }
    if(s.size() - counter < counter){
        counter = s.size() - counter;
    }
    cout<< counter <<endl;
    return 0;
}

Measured memory_bytes: 3720
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

  string s; cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
    print("Bad");
  } else {
    print("Good");
  }

  return 0;
}

Measured memory_bytes: 384
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner br = new Scanner(System.in);
	static List<Integer> tmp = new ArrayList<Integer>();

	public static void main(String[] args) throws IOException {
		int yamahuda[];

		while (true) {
			// ?±±???????????°n
			int n = br.nextInt();
			yamahuda = new int[n];
			// ??????????????°r
			int r = br.nextInt();

			// 0 0?????´???break;
			if (n == 0 && r == 0) {
				break;
			}

			// ?±±????????????n????????????
			for (int i = 0; i < n; i++) {
				yamahuda[i] = n - i;
			}
			// ?±±???????????£?????????
			for (int i = 0; i < r; i++) {
				shuffle(yamahuda);
			}
			System.out.println(yamahuda[0]);

		}
	}

	public static int[] shuffle(int[] yamahuda) throws IOException {
		// p??¨c?????\???
		int p = br.nextInt();
		int c = br.nextInt();
		tmp.clear();
		if (p - 1 < c) {

			// ?????????????±±???????????????????????????tmp???????´?
			for (int i = 0; i < c; i++) {
				tmp.add(yamahuda[p - 1 + i]);
			}
			for (int i = 0; i < p - 1; i++) {
				yamahuda[c + i] = yamahuda[i];
			}
			for (int i = 0; i < c; i++) {
				yamahuda[i] = tmp.get(i);
			}
		} else {
			// ???????????????
			for (int i = 0; i < p - 1; i++) {
				tmp.add(yamahuda[i]);
			}
			for (int i = 0; i < c; i++) {
				yamahuda[i] = yamahuda[p - 1 + i];
			}
			for (int i = 0; i < p - 1; i++) {
				yamahuda[c + i] = tmp.get(i);
			}
		}
		return yamahuda;
	}

}

Measured memory_bytes: 38776
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int k = Integer.parseInt(in.next());
            int s = Integer.parseInt(in.next());
            int ans = 0;

            for (int i = 0; i <= k; i++) {
                for (int j = 0; j <= k; j++) {
                    int z = s - j - i;
                    if (0 <= z && z <= k) {
                        ans++;
                    }
                }
            }

            // 出力
            out.println(ans);

        }

    }
}



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

typedef long long ll;
typedef long double ld;

vector <int> graf[100005];
int indeg[100005];
int dp[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=m; i++){
        int a, b;
        cin >> a >> b;
        graf[a].push_back(b);
        indeg[b]++;
    }
    queue <int> q;
    for(int i=1; i<=n; i++){
        if(indeg[i] == 0){
            q.push(i);
        }
    }
    int res = 0;
    while(!q.empty()){
        int v = q.front();
        q.pop();
        res = max(res, dp[v]);
        for(auto c : graf[v]){
            indeg[c]--;
            dp[c] = max(dp[c], dp[v]+1);
            if(indeg[c] == 0) q.push(c);
        }
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 6528
import math
k = int(input())

ans = 0
tyu = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        d = math.gcd(a,b-a)
        for c in range(1,k+1):
            ans += math.gcd(d,c)
    
print(ans)

Measured memory_bytes: 9184
#include <iostream>
#include <cstring>

using namespace std;

string k;
int d, n;
int dp[10005][105][2];
const int mod = 1e9 + 7;

char str[10005];
int sum;
int rek(int at, int dd, int smaller) {
	if (at == n) {
		// cout << (dd % d == 0 ? "yes" : "naw") << "\n";
		return (dd % d == 0);
	}
	if (dp[at][dd][smaller] != -1) return dp[at][dd][smaller];

	int sol = 0;
	for (int nd = 0; nd <= (smaller ? 9 : k[at] - '0'); ++nd) {

		//str[at] = nd + '0';
		//sum += nd;
		// cout << str << " " << sum << "\n";

		int newsum = (dd + nd) % d;
		sol += rek(at + 1, newsum, smaller || (nd < (k[at] - '0')));
		sol %= mod;

		//str[at] = '\0';
		//sum -= nd;
	}

	return dp[at][dd][smaller] = sol;
}

int main() {
	cin >> k >> d;
	n = k.size();
	memset(dp, -1, sizeof dp);
	int res = rek(0, 0, 0);
	cout << (res-1 >= 0 ? res-1 : res+mod-1) << "\n";
}

Measured memory_bytes: 9472
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    long A, B, C, D;
    scan(A, B, C, D);
    writeln(max(A * B, C * D));
}


Measured memory_bytes: 256
def main():
    i = list(map(int, input().split()))

    if i[0] < 2 or 5 < i[0]:
        return
    if i[1] < 1 or 100 < i[1]:
        return
    if i[2] <= i[1] or i[1] > 200:
        return

    for j in range(10):
        a = i[0] * i[2] - i[1]
        print(a)
        i[2] = a 

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

long long h,n,a,zr;

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

cin >> h >> n;

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

if (zr >= h)
	cout << "Yes";
else 
	cout << "No";


return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long 
#define f(j) for(ll i=0;i<j;i++)
#define pb(i) push_back(i)
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;    
typedef vector<vector<long long> > matrix; 
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	// faster
	int n,k;
	cin>>n>>k;
	int a[n],dp[n]={0};
	f(n)	cin>>a[i];
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=INT_MAX;
		for(int j=i-1;j>=max(0,i-k);j--)
			dp[i] = min(abs(a[i]-a[j])+dp[j],dp[i]);
	}
	cout<<dp[n-1]<<"\n";	
return 0;	
}

Measured memory_bytes: 4424
n = int(input())
a = list(map(int, input().split()))

total = [0, 0]
cnt = [0, 0]
for i in range(2):
    for j in range(n):
        total[i] += a[j]
        if (i+j)%2 == 0:
            if total[i] >= 0:
                cnt[i] += abs(total[i]+1)
                total[i] = -1
        else:
            if total[i] <= 0:
                cnt[i] += abs(total[i]-1)
                total[i] = 1
print(min(cnt))


Measured memory_bytes: 14212
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

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

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  i64 n;
  string s;
  cin >> n >> s;
  map<char, int> m;
  rep(i, n) m[s[i]]++;
  i64 ans = 1;
  for (auto x: m) {
    ans *= x.second + 1;
    ans %= 1000000007;
  }
  cout << ans - 1 << endl;
  return 0;
}


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

vector<int> Subvec(vector<int> X, int p, int l){
	vector<int> Y;
	for(int i = p; i < p+l; i++) Y.push_back(X[i]);
	return Y;
}

vector<int> SelectionSort(vector<int> A, int i){
	int N = A.size() - 1;
	int j_0 = i;
	for(int j = i; j < N; j++){
		if(A[j] < A[j_0]) j_0 = j;
	}
	if(j_0 != i){
		A[N]++;
		int a = A[j_0];
		A[j_0] = A[i];
		A[i] = a;
	}
	return A;
}

void Output(vector<int> A){
	int n = A.size() - 1;
	for(int i = 0; i < n; i++) cout << A[i] << ' ';
	cout << A[n] << endl;
}

int main(){
	int N;
	cin >> N;
	vector<int> A;
	A.resize(N+1);
	for(int i = 0; i < N; i++) cin >> A[i];
	A[N] = 0;
	for(int i = 0; i < N; i++) A = SelectionSort(A, i);
	Output(Subvec(A, 0, N));
	cout << A[N] << endl;
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N,M;
  map<string,ll> coin;
  cin>>N;
  rep(i,N){
    string d;
    cin>>d;
    coin[d]++;
  }
  cin>>M;
  rep(i,M){
    string d;
    cin>>d;
    coin[d]--;
  }
  ll ans=0;
  for(auto i=coin.begin();i!=coin.end();i++){
    ans=max(ans,i->second);
  }
  cout<<ans<<endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; string s; cin>>n>>s;
	int R,G,B;
	R=G=B=0;
	for(auto&i:s){
		if(i=='R')++R;
		else if(i=='G')++G;
		else if(i=='B')++B;
	}
	int64_t ans=(int64_t)R*G*B;
	for(int i=0;i<n;++i){
		for(int j=i+1;j<n;++j){
			int k=j+(j-i);
			if(k<n){
				if(s.at(i)==s.at(j)||s.at(j)==s.at(k)||s.at(k)==s.at(i))continue;
				--ans;
			}
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 3684
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret

# 全探索だと
# 3^N通りになってTLEだこれ

# 制限がなければ、iごとにmaxを取っておわりO(N)

# iの時の最善の状態が[i,j](jは行動)のとき、i+1最善の状態は[i+1,k](k!=j)となる
# これはDPで実装できそう！


# import numpy as np

N = read_a_int()
# ABC = np.array(read_matrix(N))
# # A, B, C = read_col(N, 3)

# dp = np.full((N, 3), -float('inf'))
# # 0->a,1->b,2->c

# dp[0, :] = ABC[0]

# for i in range(N - 1):
#     dp[i + 1, 0] = dp[i, 1:].max()+ABC[i+1, 0]
#     dp[i + 1, 1] = dp[i, (0, 2)].max() + ABC[i+1, 1]
#     dp[i + 1, 2] = dp[i, :2].max()+ABC[i+1, 2]

# # print(dp)
# print(int(dp[N-1].max()))

# TLEしたのでpypy3仕様にかきなおし

ABC = read_matrix(N)

# dp = np.full((N, 3), -float('inf'))
dp = [[-float('inf') for _ in range(3)] for _ in range(N)]
# 0->a,1->b,2->c

for i in range(3):
    dp[0][i] = ABC[0][i]

for i in range(N - 1):

    for j in range(3):
        iterlist = [0, 1, 2]
        iterlist.remove(j)
        dp[i+1][j] = max([dp[i][k] + ABC[i+1][j] for k in iterlist])

# print(dp)
print(int(max(dp[-1])))


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

long long llsqrt(long long n){
	int i;
	for(i = 1; n > 0; i++){
		n-= i * 2 + 1;
	}
	return i - 1;
}

int main(){
	long long N;
	long long A,B;
	cin >> N;
	long long S = llsqrt(N);
	for( int  i = S ; i >= 1; i-- ){
		if( N % i == 0 ){
			A = i; B = N / i;
			break;
		}
	}
	cout << (A-1) + (B-1) << endl;
}


Measured memory_bytes: 256