akhauriyash/Code-Regression huggingface dataset:
#include <iostream> 
    #include <algorithm> 
    #include <cstring> 
    #include <cstdio>
    #include <vector> 
    #include <queue> 
    #include <cstdlib> 
    #include <iomanip>
    #include <cmath>
    #include <cassert>
    #include <ctime> 
    #include <map> 
    #include <set> 
    using namespace std; 
    #define lowbit(x) (x&(-x)) 
    #define max(x,y) (x>y?x:y) 
    #define min(x,y) (x<y?x:y) 
    #define MAX 100000000000000000 
    #define MOD 1000000007
    #define pi acos(-1.0) 
    #define ei exp(1) 
    #define PI 3.141592653589793238462
    #define ios() ios::sync_with_stdio(false)
    #define INF 1044266558
    #define mem(a) (memset(a,0,sizeof(a)))
    typedef long long ll;
    const int maxn=1e6+7;
    struct cmp
    {
        bool operator()(const ll &a,const ll &b)
        {
            return a>b;
        }
    };
    multiset<ll,cmp>s;
    multiset<ll>::iterator it;
    priority_queue<ll,vector<ll> >q;
    ll cnt,x,n;
    int main()
    {
        while(scanf("%lld",&n)!=EOF)
        {
            s.clear();
            for(int i=0;i<n;i++)
            {
                scanf("%lld",&x);
                s.insert(x);
            }
            x=0;
            for(it=s.begin();it!=s.end();it++)
            {
                if(*it==x) cnt++;
                else x=*it,cnt=1;
                if(cnt==2) q.push(x),cnt=0;
            }
            if(q.size()<2) printf("0\n");
            else x=q.top(),q.pop(),printf("%lld\n",x*q.top());
            while(!q.empty()) q.pop();
        }
        return 0;
    }

Measured memory_bytes: 5632
#include<stdio.h>

int main(void)
{
	int W,H;
	int x,y,r;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if(y+r <= H && y-r >= 0 && x+r <= W && x-r >= 0){
	printf("Yes\n");
	}
	else
	{
	printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define V vector
#define SI size()
#define pb push_back
#define mk make_pair
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Test ll test;cin>>test;while(test--)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
using namespace std;
const ll mod = 1e9+7;
int main() {
    Fast
    ll n;
    cin>>n;
    ll arr[n];
    loop(i,0,n){
        cin>>arr[i];
    }
    sort(arr,arr+n,greater<ll>());
    ll ans = 0;
    ans += arr[0];
    ll t = n;
    t -= 2;
    ll have = t/2;
    // cout<<have<<"  "<<ans<<endl;
    ll i=1;
    for(ll j=0;j<have;i++,j++){
        ans += arr[i]*2;
    }
    if(t%2 == 1){
        ans += arr[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5212
using System;

namespace ITP1_5_C
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                string[] str = Console.ReadLine().Split(' ');
                int H = int.Parse(str[0]);
                int W = int.Parse(str[1]);

                if(H==0 || W==0) break;

                for(int i=0; i<H; i++)
                {
                    for(int j=0; j<W; j++)
                    {
                        if((i%2==0 && j%2==0) || (i%2==1 && j%2==1) )
                        {
                            Console.Write('#');
                        }
                        else
                        {
                            Console.Write('.');
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
            
        }
    }
}



Measured memory_bytes: 15928
import numpy as np


def searchPrimeNumber(N):
    N = N + 1
    is_prime = np.ones((N, ), dtype=bool)
    is_prime[:2] = 0
    N_max = int(np.sqrt(N))
    for j in range(2, N_max + 1):
        if (is_prime[j]):
            is_prime[j * j::j] = False
    prime = np.arange(N)[is_prime]
    return prime


def main():
    X = int(input())
    p = searchPrimeNumber(10**5 + 10)

    p = p[p >= X]
    print(p[0])


main()


Measured memory_bytes: 22404
///*** author: HM Imu SC ***\\\

#include<bits/stdc++.h>

using namespace std;

#define tillEnd() int t,testCase=1;scanf("%d",&t);while(t--)
#define FEO(container) for(auto ith : container)
#define FEIO(container) for(int i=0; i<container.size();i++)
#define showCase(str) cout<<"Case "<<testCase<<": "<<str<<endl;testCase++
#define read_auto() freopen("in.txt","r",stdin)
#define write_auto() freopen("out.txt","w",stdout)
#define read_write_auto() read_auto();write_auto()
#define to_order() ofstream order("test_cases.txt")
#define space << " " <<
#define get_random(a,b) rand()%(b-a+1)+a
#define lint long long int
#define INF(x) INT_MAX-x
#define boost_io() ios_base::sync_with_stdio(false);cin.tie(false)

int main(){

    int n;

    cin>>n;

    cout<<ceil(pow(n,3));

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const int mod=1e6+3;
typedef long long ll;
#define inf 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define per(i,a,b) for(int i=(a);i<b;i++)
#define rep(i,a,b) for(int i=(a);i<=b;i++)
#define pi acos(-1.0)
#define mid ((l+r)>>1)
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
#define qwq puts("QWQ");
void read(int &x)
{
	int f=1;x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=f;
}
int a[maxn],b[maxn];
int main()
{
   int n;read(n);
   rep(i,1,n)read(a[i]);
   int i,j,ans=0;
   for(i=n;i>=1;i--)
   {
   	   int sum=0;
   	   for(j=i*2;j<=n;j+=i)
   	   {
   	   	 sum+=b[j];
   	   }
   	   if(sum%2!=a[i])
   	   {
   	   	  b[i]=1;ans++;
   	   }
   }
   printf("%d\n",ans);
   rep(i,1,n)
   {
   	if(b[i])printf("%d ",i);
   }
}

Measured memory_bytes: 2432
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	int R;
	cin >> R;
	cout << 2 * acos(-1) * R ;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3820
#include <stdio.h>

int main(){
  char A[2];
  char B[2];
  scanf("%s",A);
  scanf("%s",B);
  if(A[0]==B[2]&&A[1]==B[1]&&A[2]==B[0]){
    printf("YES");
  }else{
    printf("NO");
  }
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	double a,b; cin>>a>>b; cout<<setprecision(10)<<fixed<<a/b<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

int main()
{
	int n;
	int s[1000];

	int sum;
	double ave;
	double rho, rho2;

	while(true) {
		cin >> n;
		if(n == 0)
			break;
		sum = 0;
		for(int i = 0; i < n; ++i) {
			cin >> s[i];
			sum += s[i];
		}
		ave = (double)sum / (double)n;
		rho = 0;
		for(int i = 0; i < n; ++i) {
			rho += (pow(s[i] - ave, 2.0));
		}
		rho2 = rho / n;
		printf("%.8f\n", sqrt(rho2));
	}
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> xs(M);
  rep(i, M) cin >> xs[i];

  if (M <= N) {
    cout << 0 << endl;
    return 0;
  }

  sort(xs.begin(), xs.end());
  int ans = xs[M-1] - xs[0];

  priority_queue<int> q;
  rep(i, M-1) {
    q.push(xs[i+1] - xs[i]);
  }
  rep(i, N-1) {
    int num = q.top();
    ans -= num;
    q.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Path | diff Path.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Path.cpp && ./a.out

/*
 
 3/3/2019
 
 19:56-
 
 */

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  VI ds(4);
  REP(_,3) {
    int a,b; cin>>a>>b;
    --a,--b;
    ds[a]++,ds[b]++;
  }
  sort(ALL(ds));
  VI a={1,1,2,2};
  cout<<(ds==a?"YES":"NO")<<endl;
  
  return 0;
}


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

using namespace std;

const int N = 1e3 + 5, M = 1e2 + 2, OO = 0x3f3f3f3f, mod = 1e9 + 7;

char grid[N][N];

int rows, cols;

int mem[N][N];
bool valid(int i, int j, char c)
{
	return i < rows && j < cols && c != '#';
}

int main()
{
	scanf("%d %d", &rows, &cols);
	mem[rows - 1][cols - 1] = 1;
	for(int i = 0; i < rows; ++i)	scanf("%s", grid + i);
	for(int i = rows - 1; i >= 0; --i)
	{
		for(int j = cols - 1; j >= 0 ; --j)
		{
			if(valid(i + 1, j, grid[i][j]))
				mem[i][j] += mem[i + 1][j];
			if(valid(i, j + 1, grid[i][j]))
				mem[i][j] += mem[i][j + 1];
			mem[i][j] %= mod;
		}
	}
	printf("%lld\n", mem[0][0]);
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int a,b,x,c;
   cin>>a>>b>>x;
   if(a<1){
     c=-1;
   }else{
     c=(a-1)/x;
   }
   cout<<b/x-c<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

veci dx = {-1,0,1,0};
veci dy = {0,-1,0,1};

int main() {
    int H,W; cin >> H >> W;
    vector<string> S(H);
    REP(i,H) cin >> S[i];
    REP(i,H) REP(j,W) {
        bool ok = false;
        if(S[i][j] == '#') {
            REP(dir,4) {
                int ni = i + dy[dir];
                int nj = j + dx[dir];
                if(ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
                if(S[ni][nj] == '.') continue;
                else ok = true;
            }
            if(ok == false) {
                cout <<  "No" << endl;
                return 0;
            } 
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define LL long long
#define F(i, a, b) for(int i = a; i <= b; ++i)

using namespace std;

const int maxn = 1e5 + 5;
int n, L, a[maxn];
int p = 0;

int main()
{
	scanf("%d%d", &n, &L);
	F(i, 1, n) scanf("%d", &a[i]);
	F(i, 1, n - 1) if(a[i] + a[i + 1] >= L)
	{
		p = i;
		break;
	}
	if(!p) printf("Impossible");
	else{
		printf("Possible\n");
		F(i, 1, p - 1) printf("%d\n", i);
		for(int i = n - 1; i > p; --i) printf("%d\n", i);
		printf("%d\n", p);
	}
	return 0;
}

Measured memory_bytes: 4204
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int a,b,c,d,e,f;
	cin >> a >> b >> c >> d >> e >> f;
	vector<int> aa,bb;

	for(int i=0;i*a*100<=f;i++)
		for(int j=0;j*b*100<=f-i*a*100;j++)
			aa.push_back((i*a+j*b)*100);
	for(int i=0;i*c<=f;i++)
		for(int j=0;j*d<=f-i*c;j++)
			bb.push_back(i*c+j*d);


	double mx=0;
	int ansA=0;
	int ansB=0;
	for(int i=0;i<aa.size();i++)
		for(int j=0;j<bb.size();j++)
		{
			double A=aa[i];
			double B=bb[j];
			if(A+B>f)continue;
			if(100*B>A*e)continue;
			if(100*B/(A+B)>=mx)
			{
				mx=100*B/(A+B);
				ansA=A;
				ansB=B;
			}
		}
	

	cout << ansA+ansB << " " << ansB << endl;


	
}

Measured memory_bytes: 1400
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
using namespace std;
#define M 9999991

typedef long long ll;

char S1[1000001],S2[10001];
int N,n;

int pow_mod_S(int n,char s){
    ll x = 1;
    ll m = 128;
    while (n > 0) {
        if (n&1) {
            x = (m*x)%M;
        }
        m = (m*m)%M;
        n >>= 1;
    }
    return (x*s)%M;
}

int make(char S[]){
    ll x = 0;
    for (int i = 0; i < n; i++) {
        x = (x + pow_mod_S(n-i-1,S[i]))%M;
    }
    return x;
}

void RollingHash(){
    ll ORG = make(S2);
    ll comp = make(S1);
    ll n_1 = pow_mod_S(n-1,1);
    
    if (comp == ORG) printf("0\n");
    
    for (int i = 0; i < N-n; i++) {
        comp = (comp + M - (n_1*S1[i])%M)%M;
        comp = (comp*128)%M;
        comp = (comp + S1[i+n])%M;
        
        if (comp == ORG) printf("%d\n",i+1);
    }
}

int main(){
    cin >> S1 >> S2;
    N = strlen(S1);
    n = strlen(S2);
    
    RollingHash();
    
    return 0;
}

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

int main(){
  int N,D,Q; cin >> N >> D >> Q;
  vector<vector<int>> M(N+1,vector<int>(N+1,0));
  for(int i=0;i<D;i++){
    int L,R;
    cin >> L >> R;
    M[L][R] ++;
  }
  vector<vector<int>> sum(N+1,vector<int>(N+1,0));
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){
      sum[i][j]=M[i][j]+sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
    }
  }
  for(int i=0;i<Q;i++){
    int p,q; cin >> p >> q;
    int ans = sum[q][q] - sum[q][p-1] - sum[p-1][q] + sum[p-1][p-1];
    cout << ans << endl;
  }
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

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

    if (a == 1) a = 14 ;
    if (b == 1) b = 14 ;

     if (a > b) cout << "Alice" ;

    else if (a < b) cout << "Bob" ;

    else if (a == b) cout << "Draw" ;





    return 0 ;
}



Measured memory_bytes: 256
s = input()
n = len(s)
if n <= 1:
  print(0)
  exit()
else:
  left = 0
  ans = 0
  for i in range(n):
    if s[i] == 'W':
      left+= 1
      ans += (i+1)-left
      #print(left)
print(ans)


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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec[i];
  }
  int flag = 0; // flag 0: OK, 1: 注意 2: 不可能
    
  for (int i = 0; i < N-1; i++) {
    if (vec[i] < vec[i+1]) {
      flag = 0;
      continue;
    }
    
    if (vec[i] == vec[i+1]) {
      continue;
    }
    
    if (vec[i] - vec[i+1] >= 2) {
      flag = 2;
      break;
    }
    
    if (vec[i] - vec[i+1] == 1 && flag == 0) {
      flag = 1;
      continue;
    }
    
    if (vec[i] - vec[i+1] == 1 && flag == 1) {
      flag = 2;
      break;
    }
  }
  
  if (flag == 0 || flag == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
    
  }
    
}

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

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

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

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

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int MMAX=30;
int favoriteFoods[MMAX+1];

// Problem Specific Parameter:

int main() {
  int n, m; cin >> n >> m;
  for(int i = 0; i < n; ++i) {
    int k; cin >> k;
    int a[k];
    for(int j = 0; j < k; j++) {
      cin >> a[j];
      a[j] = a[j]--;
      favoriteFoods[a[j]]++;
    }
  }
  int ans = 0;
  for(int i = 0; i <= MMAX; i++) {
    if(favoriteFoods[i] == n) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(M)]
if N==1:
  e,f=0,10
elif N==2:
  e,f=10,100
else:
  e,f=100,1000
for i in range(e,f):
  a=str(i)
  flag=True
  for j,k in A:
    if a[j-1]!=str(k):
      flag=False
  if flag:
    print(a)      
    exit()
print(-1)  

Measured memory_bytes: 3064
import java.util.*;


public class Main {
    public static void main(String[] args){

        Scanner s = new Scanner(System.in);
        int cards = s.nextInt();
        ArrayList<Integer> card = new ArrayList<Integer>();

        for (int i = 0; i < cards; i++) {
          card.add(s.nextInt());
        }

        // 降順
        Collections.sort(card, Comparator.reverseOrder()); 

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < cards; i++) {
          if(i%2 == 0) {
            alice = alice + card.get(i);
          } else {
            bob = bob + card.get(i);
          }
        }
        System.out.println(alice-bob);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define vvi vector<vector<int> >
#define ss second
#define ff first
#define ll long long
#define mod (1000*1000*1000+7)
#define pq priority_queue< int >
#define endl '\n'
#define int ll
// #define gcd __gcd
#define popcount(x) __builtin_popcountll(x)
#define fill(x, y) memset(x, y, sizeof(x))
#define search(arr, c) binary_search(arr.begin(), arr.end(), c)
// default binary search returns a bool
 
// int dx[]={1,0,-1,0}; 
// int dy[]={0,1,0,-1}; //4 Direction 
 
// int dx[]={1,1,0,-1,-1,-1,0,1}; 
// int dy[]={0,1,1,1,0,-1,-1,-1};  // 8D
vector <string> grid ;
int sx , sy , ex , ey, ans = INT_MAX;
int h , w ;

vector<vector <int > > dist;

int legal(int x ,int y){
    if (x < 0 || x >= h || y < 0 || y >= w || grid[x][y] == '#')return 0;
    return 1;
}

void solve(){

    
    cin >> h >> w;
    cin >> sx >> sy;
    sx-- , sy--;
    cin >> ex >> ey;
    ex-- , ey--;
    grid = vector <string>(h);
    for (int i = 0 ; i < h ; i++)cin >> grid[i];

    dist = vector<vector <int > > ( h , vi(w , INT_MAX));
    deque<int>qx , qy;
    qx.push_back(sx);
    qy.push_back(sy);
    dist[sx][sy] = 0;
    int dx[] = {-1 ,  1 , 0 , 0};
    int dy[] = {0 , 0 , -1 ,  1};
    while(!qx.empty()){
        int x = qx.front() , y = qy.front();
        // cout << x << " " << y << endl;
        qx.pop_front() , qy.pop_front();

        for (int i = 0 ; i < 4 ; i++){
            int new_x = dx[i]+x , new_y = dy[i]+y;
            if (!legal(new_x , new_y))continue;
            if (dist[new_x][new_y] > dist[x][y]){
                dist[new_x][new_y] = dist[x][y];
                qx.push_front(new_x);
                qy.push_front(new_y);
            }
        }
        // cout << x << " " << y << endl;
        for (int i = x-2 ; i <= x+2 ; i++){
            for (int j = y-2 ; j <= y+2 ; j++){
                if (!legal(i , j))continue;
                if (dist[i][j] > dist[x][y]+1){
                    dist[i][j] = dist[x][y]+1;
                    qx.push_back(i);
                    qy.push_back(j);
                }
            }
        }
        // cout << x << " " << y << endl;
    }
    cout << (dist[ex][ey]>=INT_MAX ? -1 : dist[ex][ey])<<endl;
}

 
int32_t main(){

    #ifndef ONLINE_JUDGE 
  
    freopen("input.txt", "r", stdin); 
  
    // freopen("output.txt", "w", stdout); 
  
    #endif 
 
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
 
 
    int t = 1;
    // cin >> t;
    for (int tt = 0 ; tt < t ; tt++){
        
        // cout << "Case " << (tt+1) <<": " << endl;
        solve();
    }
    
}

Measured memory_bytes: 12728
S = list(map(int,list(input())))
N = len(S)

def func(a,n,l):
    if len(l) == 0:
        return a + n

    l2 = [i for i in l]
    m = l2.pop(0)

    return func(a,10*n+m,l2) + (func(a+n,m,l2))

n = S.pop(0)
print(func(0,n,S))


Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <list>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

using ll = long long;
const int maxn = 21;
const ll mod = 1e9 + 7;
ll dp[1 << maxn];
int v[maxn][maxn];

int count_ones(int mask, int n) {
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt += (mask & (1 << i)) > 0;
  }
  return cnt;
}

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

  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> v[i][j];
  dp[(1 << n) - 1] = 1;

  for (int i = (1 << n) - 2; i >= 0; i--) {
    int j = count_ones(i, n);
    ll& ans = dp[i];
    ans = 0;

    for (int k = 0; k < n; k++) {
      if (i & (1 << k)) continue;
      if (!v[j][k]) continue;
      ans += dp[i | (1 << k)];
      ans %= mod;
    }
  }
  cout << dp[0] << endl;

  return 0;
}


Measured memory_bytes: 16640
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int a,b;char op;
    cin >> a >> op >> b;
    if(op=='+')
    {
        cout << a+b << endl;
    }
    else
    {
        cout << a-b << endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// Binary Indexed Tree / Fenwick tree
// can calculate partial sum in O(logN)
// can update single datum in O(logN)
// lower_bound is binary search O(logN)
// 0-indexed!!!
template <typename T = int>
struct BinaryIndexedTree {
    int n;
    vector<T> bit;
    BinaryIndexedTree(int n_, T init = 0) : n(n_), bit(n_ + 1, init) {}
    BinaryIndexedTree(vector<T> init) : n(init.size() + 1), bit(init.size() + 1) {
        for (int i = 1; i < init.size() + 1; ++i) {
            bit[i] = init[i - 1];
        }
    }
    T sum(int i) {
        i++;
        T s = bit[0];
        for (int x = i; x > 0; x -= (x & -x))
            s += bit[x];
        return s;
    }
    void add(int i, T a) {
        i++;
        if (i == 0)
            return;
        for (int x = i; x <= n; x += (x & -x))
            bit[x] += a;
    }
    int lower_bound(int w) {
        if (w <= 0)
            return 0;
        int x = 0, r = 1;
        while (r < n)
            r <<= 1;
        for (int k = r; k > 0; k >>= 1) {
            if (x + k <= n && bit[x + k] < w) {
                w -= bit[x + k];
                x += k;
            }
        }
        return x + 1;
    }
    int upper_bound(int w) {
        if (w < 0)
            return 0;
        int x = 0, r = 1;
        while (r < n)
            r <<= 1;
        for (int k = r; k > 0; k >>= 1) {
            if (x + k <= n && bit[x + k] <= w) {
                w -= bit[x + k];
                x += k;
            }
        }
        return x + 1;
    }
    T query(int l, int r) { return sum(r - 1) - sum(l - 1); }
};

int main() {
    ll n, k;
    cin >> n >> k;
    vl a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    // sum >= k * (r - l + 1);
    // sum_r - k * r >= sum_l - k * l;
    vl sum(n + 1);
    sum[0] = 0;
    for (int i = 0; i < n; ++i) {
        sum[i + 1] = a[i] + sum[i];
    }
    for (ll i = 1; i <= n; ++i) {
        sum[i] -= i * k;
    }
    vl sorted = sum;
    sort(sorted.begin(), sorted.end());
    BinaryIndexedTree<> bit(n + 1);
    ll ret = 0;
    for (int i = 0; i <= n; ++i) {
        int idx = lower_bound(sorted.begin(), sorted.end(), sum[i]) - sorted.begin();
        ret += bit.sum(idx);
        bit.add(idx, 1);
    }
    cout << ret << "\n";
    return 0;
}

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define debug(i) cout << i << endl;
#define debugarr(a) for(auto i : a) cout << i << " ";

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>

using namespace std;

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

    int n;
    cin >> n;
    
    pi arr[n];
    for(int i = 0; i < n; i++) {
        cin >> arr[i].F;
        arr[i].S = i;
    }

    sort(arr, arr + n);
    for(int i = 0; i < n; i++) {
        int j = n - 1;
        while(arr[j].S == i) {
            j--;
        }
        cout << arr[j].F << "\n";
    }
}


Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int answer = 0;

		for (int i = 1; i <= n; i = i + 2) {
			int count = 0;
			for (int j = 1; j <= n / 2; j = j + 2) {
				if (i % j == 0)
					count++;
			}
			if (count + 1 == 8) {
				answer++;
			}
		}

		System.out.println(answer);
		sc.close();
	}
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    int h, w, n;
    cin >> h >> w >> n;
    cout << (n+ max(h, w) -1) / max(h, w) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define sp(x) fixed<<setprecision(x)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    fast_io;
    
    int n,k;
    cin>>n>>k;
    
    vector<int> v(n);
    for(int& i : v)
    cin>>i;
    
    vector<bool> dp(k+1,0);
    for(int i=0;i<=k;i++)
    {
        for(int move : v)
        {
            if(i-move>=0 && dp[i-move]==0)
            dp[i] = 1;
        }
    }
    
    (dp[k]>0) ? cout<<"First" : cout<<"Second";
    
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,k; cin>>h>>w>>k;
    vector<vi> ans(h, vi(w, 0));
    vector<int> p;
    int color=1;
    rep(i,h){
        bool flg=false;
        rep(j,w){
            char c; cin>>c;
            if (c=='#' && flg) color++;
            if (c=='#' && !flg) flg=true;
            ans[i][j] = color;
        }
        if (flg){
            color++;
        }else{
            p.pb(i);
        }
    }
    for(auto e:p){
        rep(i,w){
            if (e!=0){
                ans[e][i] = ans[e-1][i];
            }else{
                ans[e][i] = ans[e+1][i];
            }
        }
    }
    for(auto e:p){
        rep(i,w){
            if (e!=h-1){
                ans[e][i] = ans[e+1][i];
            }else{
                ans[e][i] = ans[e-1][i];
            }
        }
    }
    reverse(all(p));
    for(auto e:p){
        rep(i,w){
            if (e!=0){
                ans[e][i] = ans[e-1][i];
            }else{
                ans[e][i] = ans[e+1][i];
            }
        }
    }
    for(auto e:p){
        rep(i,w){
            if (e!=h-1){
                ans[e][i] = ans[e+1][i];
            }else{
                ans[e][i] = ans[e-1][i];
            }
        }
    }
    rep(i,h){
        rep(j,w){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
  int H, W;
  int count = 0;
  string Stop, Smid, Sbot, Sbuf;
  Stop = ".";
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    
    //入力する列を調整
    if (i == 0) {
      for (int k = 0; k < W - 1; k++) {
        Stop += ".";
      }
      
      if (H > 1) {
        cin >> Smid >> Sbot;
      }
      else {
        cin >> Smid;
        Sbot = ".";
        for (int l = 0; l < W - 1; l++) {
          Sbot += ".";
        }
      }
      //cout << Stop << Smid << Sbot << endl;
    }
    else if (i < H - 1) {
      cin >> Sbot;
      //cout << Stop << Smid << Sbot << endl;
    }
    else {
      Sbot = ".";
      for (int l = 0; l < W - 1; l++) {
        Sbot += ".";
      }
      //cout << Stop << Smid << Sbot << endl;
    }
    Sbuf = Smid;
    
    //各文字の判定
    for (int j = 0; j < W; j++, count = 0) {
      if (W == 1) {
        if (Smid.at(j) == '#') {
          cout << "#" << endl;
        }
        else {
          count = (Stop.at(0) == '#') + (Sbot.at(0) == '#');
          cout << count << endl;
        }
      }
      else if (Smid.at(j) == '#') {
        cout << "#";
        if (j == W - 1) {
          cout << endl; //W文字目なら改行
        }
      }
      else if (j == 0) {
        count = (Stop.at(0) == '#') + (Stop.at(1) == '#')
          + (Smid.at(1) == '#')
          + (Sbot.at(0) == '#') + (Sbot.at(1) == '#');
        cout << count;
      }
      else if ((j > 0)&&(j < W - 1)) {
        count = (Stop.at(j - 1) == '#') + (Stop.at(j) == '#') + (Stop.at(j + 1) == '#')
          + (Smid.at(j - 1) == '#') + (Smid.at(j + 1) == '#')
          + (Sbot.at(j - 1) == '#') + (Sbot.at(j) == '#') + (Sbot.at(j + 1) == '#');
        cout << count;
      }
      else {
        count = (Stop.at(W - 2) == '#') + (Stop.at(W - 1) == '#')
          + (Smid.at(W - 2) == '#')
          + (Sbot.at(W - 2) == '#') + (Sbot.at(W - 1) == '#');
        cout << count << endl;
      }
    }
    
    //変数に格納している行Sを更新
    Stop = Sbuf;
    Smid = Sbot;
  }
}


Measured memory_bytes: 256
A, B = map(int, input().split())

num = len(bin(B)) - 2

ans = 0

for i in range(num):
    j = 2 ** i
    rep = j * 2
    m1 = (A - 1) // rep * j
    m2 = (A - 1) % rep
    if m2 >= j:
        m1 += m2 - j + 1
    n1 = B // rep * j
    n2 = B % rep
    if n2 >= j:
        n1 += n2 - j + 1

    if (n1 - m1) % 2 == 1:
        ans += j

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
int F[50];

int fibonacci(int n){
  if((n==0)||(n==1))return F[n]=1;
  if(F[n]!=-1)return F[n];
  return F[n]=fibonacci(n-1)+fibonacci(n-2);
}

int main(){
  int n,i;
  
  for(i=0;i<50;i++)F[i]=-1;

  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}



Measured memory_bytes: 2080
#include<cstdio>

using namespace std;

int main() {
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);

    int max = A;
    if(max < B) max = B;
    if(max < C) max = C;
    int sum = A + B + C;
    if(sum % 2 != max % 2) {
        ++max;
    }
    printf("%d\n", ((max * 3) - sum)/2);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <bitset>

#define INF 0x7fffffff
#define REP(i,j,k) for(int i = j;i <= k;i++)
#define squr(x) (x) * (x)
#define lowbit(x) (x&(-x))
#define getint(x) scanf("%d", &(x))
#define getLL(x) scanf("%lld", &(x))
typedef long long LL;

using namespace std;

LL n, x, ans;

int main(int argc, const char * argv[]) {
    
    getLL(n);
    getLL(x);
    ans += n;
    LL a = x, b = n - x;
    while (a != 0 && b != 0) {
        if (a < b) {
            swap(a, b);
        }
        if (a % b == 0) {
            LL temp = a / b;
            ans += b * (2 * temp - 1);
            b = 0;
        } else {
            LL temp = a / b;
            ans += b * 2 * temp;
            a -= temp * b;
        }
    }
    
    printf("%lld\n",ans);
    
    return 0;
}










Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main( String[] args ){

        Scanner in = new Scanner(System.in);

        int n = Integer.parseInt(in.nextLine());

        String[] params = in.nextLine().split(" ");
        int[] ws = new int[n];
        for( int i = 0 ; i < params.length ; i++ ){
            ws[i] = Integer.parseInt(params[i]);
        }

        int ans = -1;
        for( int t = 1 ; t < n ; t++ ){

            int min = 0;
            int max = 0;

            for( int i = 0 ; i <= t ; i++ ){
                min += ws[i];
            }
            for( int i = t + 1 ; i < n ; i++ ){
                max += ws[i];
            }

            max -= min;
            if( max < -1 ) max *= -1;

            if( ans == -1 )ans = max;
            else if( max < ans ){
                ans = max;
            }

        }

        System.out.println( ans );

    }
}

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

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

fn to_index(x: i64, y: i64, r: i64, c: i64) -> i64 {
    if x == 0 {
        return y;
    } else if y == c {
        return c + x;
    } else if x == r {
        return c + r + (c - y);
    } else if y == 0 {
        return c + r + c + (r - x);
    }
    unreachable!();
}

fn main() {
    let v = read_vec::<i64>();
    let (r, c, n) = (v[0], v[1], v[2] as usize);
    let mut pairs = vec![];
    for _ in 0..n {
        let v = read_vec::<i64>();
        let (x1, y1, x2, y2) = (v[0], v[1], v[2], v[3]);
        if (x1 == 0 || x1 == r || y1 == 0 || y1 == c) && (x2 == 0 || x2 == r || y2 == 0 || y2 == c)
        {
            pairs.push((x1, y1, x2, y2));
        }
    }

    let mut indexes = vec![];
    for (i, (x1, y1, x2, y2)) in pairs.into_iter().enumerate() {
        indexes.push((to_index(x1, y1, r, c), i));
        indexes.push((to_index(x2, y2, r, c), i));
    }
    indexes.sort();

    let mut found_stack = vec![];
    for (_, idx) in indexes {
        if found_stack.is_empty() || found_stack[found_stack.len() - 1] != idx {
            found_stack.push(idx);
        } else {
            found_stack.pop();
        }
    }
    if found_stack.is_empty() {
        println!("YES");
    } else {
        println!("NO");
    }
}

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

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


Measured memory_bytes: 13376
#include<stdio.h>
#include <math.h>
int main(void){
int N;
int counter,num;
int min=10000;
scanf("%d",&N);
for (counter=1; counter<=N; counter++) {

		scanf("%d",&num);
      int d=0;
      while(num%2 ==0){
        num /=2;
        ++d;
      }
   if(min>d)
      min=d;

		}
printf("%d\n", min);
return 0;
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int h, n, s = 0;
    cin >> h >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s += a[i];
    }
    int k = *max_element(a.begin(), a.end());
    
    if (h <= s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 640
#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, A[10101], B[10101];
//---------------------------------------------------------------------------------------------------
#define yes "Yes"
#define no "No"
string solve() {
    ll cnt = 0;
    rep(i, 0, N) {
        if (A[i] < B[i]) {
            cnt += (B[i] - A[i]) / 2;
        } else {
            cnt -= A[i] - B[i];
        }
    }

    if (cnt < 0) return no;
    return yes;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> B[i];
    cout << solve() << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>

using namespace std;

int main(){
    string S;
    cin >> S;
    
    // 1文字の判定
    if(S[0] != 'A'){
        cout << "WA\n";
        return 0;
    }
    
    // 2文字目と末尾の判定
    if(isupper(S[1]) || isupper(S[S.length() - 1])){
        cout << "WA\n";
        return 0;
    }
    
    // 3文字目と末尾から2文字目の間の判定
    bool flag = false;
    int index;
    for(int i = 2; i <= S.length() - 2; i++){
        if(!flag && S[i] == 'C'){
            flag = true;
            index = i;
        }
        
        else if(flag && S[i] == 'C'){
            cout << "WA\n";
            return 0;
        }
        
        else    ;
    }
    if(!flag){
        cout << "WA\n";
        return 0;
    }
    
    for(int i = 2; i <= S.length() - 2; i++){
        if(i == index)      continue;
        
        if(!islower(S[i])){
            cout << "WA\n";
        }
    }
    
    cout << "AC\n";
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = map(int, readline().split())
A = list(map(int, readline().split()))

for i in range(K, N):
    if A[i-K] < A[i]:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 29284
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
//#pragma GCC target(avx)
using namespace std;
#define int long long
int n;
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;

    vector <int> A(n+12);
    A[1] = 1;
    A[2] = 2;
    for(int i = 3; i <= n; ++i){
        if(A[i-1] == 2 || A[i-2] == 2)A[i] = 1;
        else A[i] = 2;
    }
    vector <vector < int > >G(n+1);
    for(int i = 1; i < n; ++i){
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int st = 1;
    int odl = 0;
    {
        vector <int> dis(n+1, -1);
        queue <int> Q;
        dis[1] = 0;
        
        Q.push(1);
        while(!Q.empty()){
            int v = Q.front();
            Q.pop();
            for(int y : G[v]){
                if(dis[y] == -1){
                    dis[y] = dis[v] + 1;
                    if(dis[y] > odl){
                        odl = dis[y];
                        st = y;
                    }
                    Q.push(y);
                }
            }
        }
    }

    {
        vector <int> dis(n+1, -1);
        queue <int> Q;
        dis[st] = 0;
        odl = 0;
        Q.push(st);
        while(!Q.empty()){
            int v = Q.front();
            Q.pop();
            for(int y : G[v]){
                if(dis[y] == -1){
                    dis[y] = dis[v] + 1;
                    if(dis[y] > odl){
                        odl = dis[y];
                    }
                    Q.push(y);
                }
            }
        }
    }
    //cerr <<"odl  " << odl << '\n';
    if(A[odl+1] == 1){
        cout <<"First\n";
    }
    else {
        cout <<"Second\n";
    }
}

Measured memory_bytes: 17520
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

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

int main(){
    string s,t;
    ll ans=1001;
    cin >> s >> t;
    ll ss=s.size();
    ll tt=t.size();
    for(ll i=0;i<=ss-tt;i++){
        ll count=0;
        for(ll j=0;j<tt;j++){
            if(s[i+j]!=t[j]) count++;
        }
        ans=min(ans,count);
    }
    
    cout << ans << endl;

    return 0;
}











Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    string s;
    cin >> s;
    bool f = false;
    int S=0,T = 0;
    int ans = s.size();
    for (int i = 0; i < s.size();i++){
        if (f){
            if (s[i] == 'T'){
                if (S > 0) ans -=2,S--;
                else f = false;
            }
            else{
                S++;
            }
        }
        else{
            if (s[i] == 'S') f = true,S++;
            else continue;
        } 
    }
    cout << ans << endl;
    
    
    return 0;
}

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

int main()
{
    int a,b,c,d,x,y;
    cin >> a >> b >> c >> d;
    x = a*b;
    y = c*d;
    if ( x >= y)
    {
        cout << x << endl;
    }
    else
    {
        cout << y << endl;
    }

    return 0;
}

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

public class Main {

    public static boolean[] composite;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        init();

        int X = in.nextInt();

        while (X < composite.length && composite[X]) {
            ++X;
        } System.out.println(X);
    }

    private static void init() {
        composite = new boolean[(int) 1e5 + 5];
        composite[0] = composite[1] = true;
        composite[2] = false;
        for (int i = 4; i < composite.length; i += 2) {
            composite[i] = true;
        }

        for (int i = 3; i < composite.length; i+= 2) if (!composite[i]) {
            for (int j = i + i; j < composite.length; j += i) {
                composite[j] = true;
            }
        }
    }
}

Measured memory_bytes: 21972
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

if c12-c11 == c22-c21 == c32-c31:
	if c13-c12 == c23-c22 == c33-c32:
		if c21-c11 == c22-c12 == c23-c13:
			if c31-c21 == c32-c22 == c33-c23:
				print('Yes')
				exit()
				
print('No')

Measured memory_bytes: 3060