akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  for(ll i = 0; i < n; ++i)
  {
    cin >> a[i];
  }

  vector<ll> sum(a);
  for(ll i = 1; i < n; ++i)
  {
    sum[i] += sum[i - 1];
  }

  map<ll, ll> mp;
  for(const auto& v : sum)
  {
    mp[v % m]++;
  }

  ll ans = mp[0];
  for(const auto& m : mp)
  {
    ll v = m.second;
    ans += v * (v - 1) / 2;
  }
  cout << ans;
  
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

int main() {
    int N; cin >> N;
    int sum = 0, ng;
    for (int i = 1; i <= N; i++) {
        sum += i;
        if (sum - N >= 0) {
            ng = sum - N;
            break;
        }
    }
    sum = 0;
    for (int i = 1; i <= N; i++) {
        if (i == ng) continue;
        sum += i;
        cout << i << endl;
        if (sum >= N) break;
    }
}

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

using namespace std;


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

	vector<int> list;
	list.reserve(n);
	for(int i = 0; i < n; i++)
	{
		cin >> list[i];
	}
	for(int i = n - 1; i >= 0; i--)
	{
		cout << list[i];
		if(i != 0){ cout << ' '; }
	}
	cout << endl;



	return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define LL long long 
using namespace std;
LL I, O, J, L;
int main()
{
#ifdef hk_cnyali
	freopen("C.in", "r", stdin);
	freopen("C.out", "w", stdout);
#endif
	LL x;
	scanf("%lld%lld%lld%lld%lld", &I, &O, &x, &J, &L);
	if (!I || !J || !L) cout<<O + I / 2 * 2 + J / 2 * 2 + L / 2 * 2<<endl;
	else if (I % 2 == J % 2 && J % 2 == L % 2) cout<<O + I + J + L<<endl;
	else cout<<O + I + J + L - 1<<endl;
	return 0;
}

Measured memory_bytes: 256
from itertools import combinations

N,K=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(N)]
ans=float("inf")

for i,j in combinations(o,2):
    x1,y1=i
    x2,y2=j
    xmax,xmin=max(x1,x2),min(x1,x2)

    for k,l in combinations(o,2):
        x3,y3=k
        x4,y4=l
        ymax,ymin=max(y3,y4),min(y3,y4)

        v=0
        for m in o:
            x5,y5=m
            if xmin<=x5<=xmax and ymin<=y5<=ymax:
                v+=1
        
        if v>=K:
            ans=min(ans,(ymax-ymin)*(xmax-xmin))


print(ans)

Measured memory_bytes: 52700
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

int max2(int a, int b){return a<b?b:a;}
int min2(int a, int b){return a>b?b:a;}

int a[50][2];
int main(void){
	int n=nextint();
	int k=nextint();
	for(int i=0; i<n; i++){
		a[i][0]=nextint();
		a[i][1]=nextint();
	}
	long ans=LONG_MAX;
	for(int l=0; l<n; l++){
		for(int r=0; r<n; r++){
			for(int u=0; u<n; u++){
				for(int d=0; d<n; d++){
					int K=0;
					int L=min2(a[l][0], a[r][0]);
					int R=max2(a[l][0], a[r][0]);
					int U=min2(a[u][1], a[d][1]);
					int D=max2(a[u][1], a[d][1]);
					for(int i=0; i<n; i++){
						if(L<=a[i][0] && a[i][0]<=R && U<=a[i][1] && a[i][1]<=D){
							K++;
						}
					}
					long now=(long)(R-L)*(D-U);
					if(K>=k && now<ans) ans=now;
				}
			}
		}
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;
#define MOD 1000000007
typedef long long ll;
int main(){
	ll N, K;
	cin >> N >> K;
	ll sum = 0;
	for(ll i = K; i <= N+1; i++){
      	ll small, big;
      	small = (0 + i-1)*i/2;
      	big = (N-i+1 + N)*i/2;
      	ll ans = big - small +1;
		sum = (sum + ans)%MOD;
    }
	cout << sum << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <numeric>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
int main(void){
    int N;
    cin >> N;
    int tpnm = N,tpsm = 0;
    while(tpnm > 0)
    {
        tpsm += tpnm % 10;
        tpnm = tpnm / 10;
    }
    if(N%tpsm==0)
    {
        cout << "Yes" << endl;
        exit(0);
    }
    cout << "No" << endl;
    
}


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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (1000006)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;


signed main() {
    while(1) {
        int n,m,p;
        cin >> n >> m >> p;
        if(n==0 && m==0 && p==0) return 0;
        vector<int> x(n);
        for(int i=0; i<n; i++) cin >> x[i];
        int sum = 0;
        for(int i=0; i<n; i++){
            sum += x[i];
        }
        //DEBUG(sum);
        //DEBUG((sum*100)*(100-p)/100);
        if (x[m-1] == 0) {
            cout << 0 << endl;
            continue;
        }
        int y = (sum*100) * (100-p) / (x[m-1] * 100);
        cout << y << endl;

    }
}


Measured memory_bytes: 3096
#include <iostream>

using namespace std;
int p[10010];

int root(int i)
{
    if(p[i]==i) return i;
    return root(p[i]);
}

bool is_sames(int a,int b)
{
    return root(a)==root(b);
}

void union1(int a,int b)
{
    p[root(a)]=root(b);
}
int main()
{
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n;i++)
        p[i]=i;
    for(int i=0;i<q;i++)
    {
        int s,a,b;
        cin>>s>>a>>b;
        if(s)
            cout<<is_sames(a,b)<<endl;
        else
            union1(a,b);
    }
   // cout << "Hello world!" << endl;
    return 0;
}



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

int main(){
	int n;
	int a[300000];
	int b[300000];
	cin>>n;
	int f=0;
	for(int i=0;i<n;i++){cin>>a[i];}
	if(n%2==0){
		for(int i=n-1;i>0;i-=2){if(f)cout<<" ";f=1;cout<<a[i];}
		for(int i=0;i<n-1;i+=2){if(f)cout<<" ";f=1;cout<<a[i];}
	}
	else{
		for(int i=n-1;i>=0;i-=2){if(f)cout<<" ";f=1;cout<<a[i];}
		for(int i=1;i<n-1;i+=2){if(f)cout<<" ";f=1;cout<<a[i];}
	}
	cout<<endl;
	return(0);
}

Measured memory_bytes: 2944
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

ans = ""
for i in range(1,100):
    n = 26**i
    if N > n:
        N -= 26**i
        continue

    N = N - 1
    for j in range(i):
        x,y = divmod(N, 26)
        ans += chr(ord('a') + y)
        N = N //26
    break
    
print(ans[::-1])

Measured memory_bytes: 27028
n = int(input())
s = input()
max = 0
for i in range(n-1):
    be = s[:i+1]
    af = s[i+1:n]
    c = []
    d = []
    count = 0
    for j in range(len(be)):
        if not be[j] in c:
            c.append(be[j])
    for k in range(len(af)):
        if not af[k] in d:
            d.append(af[k])
    for l in c:
        if l in d:
            count += 1
    if count > max:
        max = count

print(max)

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

int Ans=2147483647;
int N,to[5];
int len[20];

inline int Rd() {
	
	int x=0,f=1; 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();
	return x*f;
}

inline void CkMin(int &aa,int bb) {
	if(aa>bb) aa=bb; return;
}
inline int Abs(int x) {
	return x<0?-x:x;
}

int cnt[5];
int cho[20];
int totlen[4];

void Calc() {
	
	if(cnt[1]==0||cnt[2]==0||cnt[3]==0) return;
	register int i,j,k;
	int res=0;	
	totlen[1]=totlen[2]=totlen[3]=0;
	for(i=1;i<=N;++i) totlen[cho[i]]+=len[i]; 
	for(i=1;i<=3;++i) res+=(cnt[i]-1)*10+Abs(totlen[i]-to[i]);
	CkMin(Ans,res);
	return;
}
void Dfs(int Deep) {

	if(Deep>N) {
		Calc();
		return;
	}	
	for(register int i=0;i<=3;++i) {
		cho[Deep]=i,++cnt[i];
		Dfs(Deep+1);
		--cnt[i];
	} return;
}

int main() {

	register int i;
	N=Rd();
	to[1]=Rd(),to[2]=Rd(),to[3]=Rd();
	for(i=1;i<=N;++i) len[i]=Rd();
	Dfs(1);
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 256
def gcd(a,b); b==0 ? a : gcd(b, a % b); end

N = gets.strip.to_i
as = gets.strip.split.map(&:to_i)

from_left = [as[0]]
from_right = [as[-1]]

(N - 1).times do |i|
  from_left[i+1] = gcd(from_left[i], as[i+1])
  from_right[i+1] = gcd(from_right[i], as[-2-i])
end

max = [from_right[N-2], from_left[N-2]].max
1.upto(N-2) do |i|
  gcd_without_i = gcd(from_left[i-1], from_right[N-i-2])
  max = gcd_without_i if gcd_without_i > max
end
puts max


Measured memory_bytes: 11392
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int a[N],v,mx,n,k;
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),mx=max(mx,a[i]),v=v==0? a[1]:__gcd(a[i],v);
	if(k%v==0&&k<=mx) puts("POSSIBLE");
	else puts("IMPOSSIBLE");
	return 0;
} 

Measured memory_bytes: 640
#!/usr/bin/env ruby
class Dice
  def initialize(d)
    @dices = d
  end

  def go_s
    @dices[0], @dices[1], @dices[5], @dices[4]  = @dices[4], @dices[0], @dices[1], @dices[5]
  end

  def go_e
    @dices[0], @dices[2], @dices[5], @dices[3]  = @dices[3], @dices[0], @dices[2], @dices[5]
  end

  def go_w
    @dices[0], @dices[2], @dices[5], @dices[3]  = @dices[2], @dices[5], @dices[3], @dices[0]
  end

  def go_n
    @dices[0], @dices[1], @dices[5], @dices[4]  = @dices[1], @dices[5], @dices[4], @dices[0]
  end

  def now
    @dices[0]
  end
end

dice = Dice.new(gets.chomp.split.map(&:to_i))

gets.chomp.each_char do |chr|
  case chr
  when 'W'
    dice.go_w
  when 'S'
    dice.go_s
  when 'E'
    dice.go_e
  when 'N'
    dice.go_n
  end
end
puts dice.now

Measured memory_bytes: 6888
#include<iostream>
#include<vector>
#define int long
using namespace std;
vector<pair<pair<int,int>,long> >G;
long d[1010];
int p[1010];
main()
{
	int n,m;cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;long c;cin>>a>>b>>c;--a,--b;
		G.push_back(make_pair(make_pair(a,b),-c));
	}
	for(int i=0;i<n;i++)
	{
		d[i]=1e15;
		p[i]=i;
	}
	d[0]=0;
	p[0]=-1;
	for(int j=0;j<n-1;j++)
	{
		for(int i=0;i<m;i++)
		{
			int u=G[i].first.first,v=G[i].first.second;
			long c=G[i].second;
			if(d[u]!=1e15&&d[v]>d[u]+c)
			{
				d[v]=d[u]+c;
				p[v]=u;
			}
		}
	}
	int now=n-1;
	while(p[now]!=-1)
	{
		for(int i=0;i<m;i++)
		{
			int u=G[i].first.first,v=G[i].first.second;
			long c=G[i].second;
			if(d[v]>d[u]+c&&v==now)
			{
				cout<<"inf"<<endl;
				return 0;
			}
		}
		now=p[now];
	}
	cout<<(-d[n-1])<<endl;
}

Measured memory_bytes: 384
//region Template
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../debug_prettyprint.hpp"
#else
#define debug(...) 42
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#endif
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<<fixed<<setprecision(12);
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
#define EXIT(answer) { cerr<<"EXIT #"<<__LINE__<<endl; cout<<answer<<endl; exit(0); }
#define sz(v) int(v.size())
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> istream& operator>>(istream& in, pair<T,U> &p) { in>>p.first>>p.second; return in; }
template<typename T> inline vector<T> READ(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T> >;
typedef signed long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
//endregion


int main() {
    FASTIO

    string s,t; cin>>s>>t;
    int ans=9999;

    FOR(i,s.length()-t.length()+1) {
        int ch=0;
        FOR(j,t.length())
        if(t[j] != s[i+j])
            ch++;

        ans|=MIN(ch);
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3648
import math
#sys.exit()
#sorted( ,reverse=True)
#R = int(input())
N,M= map(int, input().split())
A = list(map(int, input().split()))
#print(N)
#print(S,T)
#print(A)

#print('Yes')
#print('No')
if N-sum(A)>= 0:
    print(N-sum(A))
else:
    print(-1)

Measured memory_bytes: 9880
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 111
void build(){

}
int ans , len;
char c[ N ];
void init(){
  scanf( "%s" , c );
  len = strlen( c );
}
int vv[ N ] , v2[ N ];
void go( char ctmp ){
  for( int i = 0 ; i < len ; i ++ )
    vv[ i ] = ( c[ i ] == ctmp );
  int tans = 0;
  for( int i = len ; i ; i -- ){
    if( accumulate( vv , vv + i , 0 ) == i ){
      ans = min( ans , tans );
      return;
    }
    tans ++;
    for( int j = 0 ; j < i ; j ++ )
      v2[ j ] = vv[ j ];
    for( int j = 0 ; j + 1 < i ; j ++ )
      if( v2[ j ] or v2[ j + 1 ] )
        vv[ j ] = 1;
      else
        vv[ j ] = 0;
  }
}
void solve(){
  ans = len - 1;
  for( int i = 0 ; i < len ; i ++ )
    go( c[ i ] );
  printf( "%d\n" , ans );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


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

#define INF 100000000

typedef pair<int, int> P;

int h, w, n;
char maps[50][50];;
int times[50][50];

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

int cnt = 0;

int bfs(){
    queue<P> que;
    int sx = 0,
        sy = 0,
        gx = w - 1,
        gy = h - 1;
    
    for(int y = 0; y < h; y++){
        for(int x = 0; x < w; x++){
            times[x][y] = INF;
        }
    }
    
    que.push(P(sx,sy));
    times[sx][sy] = 0;
    
    while(que.size()){
        P p = que.front(); que.pop();
        if(p.first == gx && p.second == gy){
            break;
        }
        
        for(int i = 0; i < 4; i++){
            int nx = p.first + dx[i],
                ny = p.second + dy[i];
            if(0 <= nx && nx < w && 0 <= ny && ny < h &&
            maps[nx][ny] != '#' && times[nx][ny] == INF ){
                que.push(P(nx,ny));
                times[nx][ny] = times[p.first][p.second] + 1;
            }
        }
    }
    
    if(times[gx][gy] == INF) return -1;
    return times[gx][gy] + 1;
}

int solve(){
    int tmp = bfs();
    if(bfs() == -1){return -1;}
    return cnt - bfs();
}

int main(void){
    cin >> h >> w;
    
    for(int y = 0; y < h; y++){
        for(int x = 0; x < w; x++){
            cin >> maps[x][y];
            if(maps[x][y] == '.') cnt++;
        }
    }
    
    cout << solve() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int w , a , b;
    cin >> w >> a >> b;
    if( abs( w - a ) > abs( w - b ) ) cout << 'B';
    else cout << 'A';
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

int main(){
    ll H, N;
    cin >> H >> N;
    ll sum = 0;
    REP(i,N){
        ll a;
        cin >> a;
        sum += a;
    }

    if(H <= sum){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


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

const int N = 2e5+10;
vector< vector<int> > G(N);
vector< vector<int> > c(N,vector<int>(2));
//c[u][0]=隣接するAの数,c[u][1]=隣接するBの数}
vector<bool> deleted(N);
string s;

void check(int i){
  if(deleted[i]) return;
  deleted[i] = true;
  for(int v : G[i]){
    if(deleted[v]) continue;
    (s[i] == 'A' ? c[v][0] : c[v][1]) -= 1;
    if(c[v][0] == 0 || c[v][1] == 0) check(v);
  }
}

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

  int n,m; cin >> n >> m >> s;
  for(int i = 0; i < m; i++){
    int a,b; cin >> a >> b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
    (s[a] == 'A' ? c[b][0] : c[b][1]) += 1;
    (s[b] == 'A' ? c[a][0] : c[a][1]) += 1;
  }

  for(int i = 0; i < n; i++){
    if(c[i][0] == 0 || c[i][1] == 0) check(i);
  }

  for(int i = 0; i < n; i++){
    if(!deleted[i]){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 25040
#include <iostream>
#include<algorithm>
#include<iomanip>
#include<string.h>
#include<unordered_map>
#include<map>
#include<cmath>
#include<vector>
#include<iomanip>
#include<queue>
using namespace std;
#define inf 1000003
#define x first
#define y second
#define ll long long
#define ii pair<ll, ll>
#define vi vector<ll>
#define pb push_back
#include<set>
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll n, k;

int main()
{
    ios
    ll i, j, k, t, z, a, b;
    cin>>n;
    ll A[3*n];
    for(i=0; i<3*n; i++) cin>>A[i];
    priority_queue<ll, vector<ll>, greater<ll>>start;
    priority_queue<ll>end;
    ll sum=0;
    for(i=0; i<n; i++) start.push(A[i]), sum+= A[i];
    ll s[n+1]={0}, e[n+1]={0};
    s[0]= sum;
    for(i=n; i<2*n; i++){
        sum-= start.top();
        start.pop();
        start.push(A[i]);
        sum+= A[i];

        s[i-n+1]= max(s[i-n], sum);
    }
  //  cout<<endl;
    sum=0;
    for(i=3*n-1; i>=2*n; i--) end.push(A[i]), sum+= A[i];
    e[n]= sum;
    for(i=2*n-1; i>=n; i--){
        sum-= end.top();
        sum+= A[i];
        end.pop();
        end.push(A[i]);
        e[i-n]= min(sum, e[i-n+1]);
    }
    ll ans= -100000000000000;
    for(i=0; i<=n; i++)
        ans= max(ans, s[i]-e[i]);
    cout<<ans;
}


Measured memory_bytes: 6516
#include <iostream>
#include <string>
#include <algorithm>
#define int long long
using namespace std;

bool check(string s) {
    char x = s[0];
    for (int i = 1; i < s.size(); i++) {
        if (x != s[i]) return false;
    }
    return true;
}

signed main() {
    string s;
    cin >> s;

    int count[26];
    for (int i = 0; i < 26; i++) {
        count[i] = 0;
    }

    for (int i = 0; i < s.size(); i++) {
        count[s[i] - 'a']++;
    }

    int maxcount = count[0];
    for (int i = 1; i < 26; i++) {
        maxcount = max(maxcount, count[i]);
    }

    int ans = 1000;
    for (int i = 0; i < 26; i++) {
//        if (count[i] < maxcount) continue;
        string temp = s;
        int res = 0;
        while (!check(temp)) {
            for (int j = 0; j < temp.size() - 1; j++) {
                if (temp[j + 1] == i + 'a') temp[j] = temp[j + 1];
            }
            temp.erase(temp.begin() + temp.size() - 1);
            res++;
//            cout << temp << endl;
        }
        ans = min(ans, res);
    }

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



Measured memory_bytes: 256
def main():
    N = int(input())
    ANS = []
    while N > 0:
        if N%26==0:
            ANS.insert(0,'z')
            N = N//26 -1
        else:
            ANS.insert(0,chr(N%26+96))
            N = N//26
    print(''.join(ANS))


if __name__ == '__main__':
    main()

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

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

	if (a>b){
		tmp=b;
		b=a;
		a=tmp;
	}
	if (b>c){
		tmp=c;
		c=b;
		b=tmp;
	}
	if (a>b){
			tmp=b;
			b=a;
			a=tmp;
		}
	cout <<a<<" "<<b<<" "<<c<<endl;
	return 0;
}



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

int main() {

    int S;
    cin >> S;

    int l = S / 100;
    int r = S % 100;

    if (1 <= l && l <= 12)
    {
        if (1 <= r && r <= 12)
        {
            cout << "AMBIGUOUS" << endl;
        }
        else
        {
            cout << "MMYY" << endl;
        }
        
    }
    else 
    {
        if (1 <= r && r <= 12)
        {
            cout << "YYMM" << endl;
        }
        else
        {
            cout << "NA" << endl;
        }
        
    }

    return 0;
}


Measured memory_bytes: 3508
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(void){
    // Your code here!
    int n;
    string key;
    map<string, int> dic;

    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> key;
        auto res = dic.insert(make_pair(key, 0));
        if(res.second == false){dic[key] += 1;}
    }
    
    int max=0;
    vector<string> tops;
    for(auto it = dic.begin(); it != dic.end(); ++it)
    {   
        if(max < it->second){ max = it->second; tops.clear(); tops.push_back(it->first);}
        else if(max == it->second){ tops.push_back(it->first); }
    }
    
    sort(tops.begin(), tops.end());
    
    for(int i=0; i<tops.size(); i++){
        cout << tops[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 26868
#include<stdio.h>
int main(){

  int n,m,a[51][51],j,i;
    char b[51][51];

    scanf("%d%d",&n,&m);

    for(i=0;i<=n;i++){
      for(j=0;j<=m;j++){
	a[i][j]=100000000;
      }
    }


  for(i=1;i<=n;i++){
    scanf("%s",b[i]);
    for(j=1;j<=m;j++){
      a[i][j]=b[i][j-1]-'0';
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      if(i+j==2) continue;

      if(a[i-1][j]>a[i][j-1]){
	a[i][j]+=a[i][j-1];
      }
      else a[i][j]+=a[i-1][j];
    }
  }

  printf("%d\n",a[n][m]);
  return 0;
}

Measured memory_bytes: 608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.stream.IntStream;

class Main {
	
    public static void main(String[] args) {
		OriginScanner os = new OriginScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = os.nextInt();
		int k = os.nextInt();
		int q = os.nextInt();
		
		int[] points = new int[n];
		
		for (int i = 0; i < q; i++) {
			points[os.nextInt() - 1]++;
		}
		IntStream.of(points).forEach(p ->{
			if (p - (q - k) > 0) pw.println("Yes");
			else pw.println("No");
		});
		pw.close();
	}
    
	static class OriginScanner {
		StringTokenizer token;
		BufferedReader br;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		
		String next() {
			while (token == null || !token.hasMoreElements()) { 
				token = new StringTokenizer(nextLine());
			}
			return token.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 38728
#include<iostream>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(r <= x && r <= y && x+r <= W && y+r <= H){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
    
}


Measured memory_bytes: 3116
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
vector<bool>visited(5, false);
vector<vector<bool>>G(5, vector<bool>(5, false));
int vcount = 0;
bool can = false;
void dfs(int from) {
	visited[from] = true;
	vcount++;
	if (vcount == 4)can = true;
	else {
		for (int i = 1; i <= 4; ++i) {
			if (!visited[i] && G[from][i]) {
				dfs(i);
			}
		}
	}
	visited[from] = false;
	vcount--;
	return;
}
int main() {
	for (int i = 0; i < 3; ++i) {
		int a, b;
		cin >> a >> b;
		G[a][b] = G[b][a] = true;
	}
	for (int i = 1; i < 4; ++i) {
		dfs(i);
		if (can) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		
		int max = 1 - (int) Math.pow(10, 9);
		int ri = scanner.nextInt();
		for (int i = 1; i < n; i++) {
			int rj = scanner.nextInt();
			max = Math.max(max, rj - ri);
			ri = Math.min(ri, rj); 
		}
		
		scanner.close();
		
		System.out.println(max);
	}
} 



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

int main(){
	unsigned long long N,K;
	cin >> N >> K;
	unsigned long long x=(N/K)*(N/K)*(N/K);
	if(K%2==0){
		x+=(2*N/K-N/K)*(2*N/K-N/K)*(2*N/K-N/K);
	}
	cout << x << endl;
}


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

using namespace std;


const int DIM = 1e5 + 7;

int viz[DIM];

unsigned long long euclid(unsigned long long a, unsigned long long b)
{
    long long c;
    while (b) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}


unsigned long long lgput(unsigned long long N, unsigned long long P)
{
   unsigned long long rez = 1;
    while(P > 0)
    {
        if(P & 1)
        {
            rez *= N;

            P--;
        }
        N*=N;

        P /= 2;
    }
    return rez;
}

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

      int n,m;

      cin >> n >> m;

       unsigned long long y = 0;
      long long put = 0;

      for(int i = 1; i <= n; i++)
        {
          unsigned long long x;
          cin >> x;


          if(y == 0)
            y = x;
          else
            {
                y = y / euclid(x,y);
                y *= x;
            }
            long long cnt = 0;
            while(x % 2 == 0)
            {
                cnt++;
                x/= 2;
            }

            if(put == 0)
            put = cnt;
            else
            if(put != cnt)
            {
                cout << 0;
                return 0;
            }

        }


        y /= 2;

    unsigned long long rez = ( (m / y) + 1) / 2;


    cout << rez;
    return 0;
}


Measured memory_bytes: 256
s = str(input())
start = 0
end = 0
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break

s = s[::-1]


for j in range(len(s)):
    if s[j] == "Z":
        end = len(s) - j
        break

print(end-start)


Measured memory_bytes: 9276
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

import heapq
class Reverse:
    def __init__(self, val):
        self.val = val
        
    def __lt__(self, other):
        return self.val > other.val
        
    def __repr__(self):
        return repr(self.val)
    
class Heapq:
    def __init__(self, arr, desc = False):
        if desc:
            for i in range(len(arr)):
                arr[i] = Reverse(arr[i])
        self.desc = desc
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        if self.desc: return heapq.heappop(self.hq).val
        else: return heapq.heappop(self.hq)
 
    def push(self, a):
        if self.desc: heapq.heappush(self.hq, Reverse(a))
        else: heapq.heappush(self.hq, a)
 
    def top(self):
        if self.desc: return self.hq[0].val
        else: return self.hq[0]

N,K = II()
A = III()
F = III()

A.sort()
F.sort(reverse=True)

ng = -1
ok = 10**12

while (abs(ok-ng) > 1):
    mid = (ok+ng)//2
    num = 0
    for i in range(N):
        a = math.floor(mid/F[i])
        if A[i]>a:
            num += A[i]-a
    if num<=K:
        ok = mid
    else:
        ng = mid

print(ok)

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n;
    cin >> n;
    vll d(n);
    rep(i,n)cin >> d[i];
    ll ans = 0;
    rep(i,n-1){
        REP(j,i+1,n){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define PP pop_back()
#define ALL(x) x.begin(),x.end()
#define st first
#define nd second
#define sz(x) (int) x.size()
#define pii pair<int,int>
#define ii int,int
#define ll long long
#define lf double
#define llu long long unsigned
#define INPUT freopen("inp.in","r",stdin);
#define OUTPUT freopen("oup.out","w",stdout);
#define sag(x) 2*x+1
#define sol(x) 2*x
#define orta ((bas+son)/2)
#define set(x,y) memset(x,y,sizeof(x))
#define MIN3(x,y,z) min(min(x,y),z)
#define MAX3(x,y,z) max(max(x,y),z)
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define ROF(i,j,k) for(int i=j;i>=k;i--)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000007
#define inf 20000000000000
#define N 105
using namespace std;
int main() {
    int x,y;
    cin>>x>>y;
    if(x<=0 && y>=0)
        cout<<"Zero\n";
    else if(x>0 && y>0)
        cout<<"Positive\n";
    else {
        if((y-x+1)%2)
            cout<<"Negative\n";
        else
            cout<<"Positive\n";
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#define DIM 3

void swap(int* data1, int* data2);
void selection_sort(int* data, int dim);

int main(int argc, char *argv[]){
  int data[DIM];
  scanf("%d %d %d", &data[0], &data[1], &data[2]);
  selection_sort( data, DIM );
  printf("%d %d %d\n", data[0], data[1], data[2]);
  return(0);
}

void swap(int* data1, int* data2){
  int tmp;
  tmp=*data1;
  *data1=*data2;
  *data2=tmp;
}
void selection_sort(int* data, int dim){
  int i,j;
  int min_index;
  for(i=0; i<dim; i++){
    min_index=i;
    for(j=i+1; j<dim; j++){
      if( data[j] < data[min_index] )
	min_index=j;
      else
	;
    }
    swap( &data[i], &data[min_index] );
  }
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define mod 1e+7
#define int long long
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
signed main() {
	 garou;
	 int n;
     cin>>n;
     int a[n];
     map<int,int> mp;
     for(int i=0;i<n;i++){
         cin>>a[i];
         mp[i+a[i]]++;
     }
     int ans=0;
     for(int i=0;i<n;i++){
         if(mp[i-a[i]]>0){
             ans+=mp[i-a[i]];
         }
     }
     cout<<ans;
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 15;
const double eps = 1e-6;

int n, m;
int p[N], c[N];

int main()
{
    cin >> n >> m;
    m /= 100;
    for(int i = 0; i < n; i++)
    {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }

    int res = 0x3f3f3f3f;
    for(int t = 0; t < (1 << n); t++)
    {
        int s = m, cnt = 0;
        for(int i = 0; i < n; i++)
            if((t >> i) & 1)
            {
                s -= p[i] * (i + 1) + c[i];
                cnt += p[i];
            }

        for(int i = n - 1; i >= 0; i--)
            if(s > 0 && !((t >> i) & 1))
            {
                int c = s / (i + 1);
                c = min(c, p[i] - 1);
                s -= c * (i + 1);
                cnt += c;
            }

        if(s <= 0) res = min(res, cnt);
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
// E - Coprime
#include <bits/stdc++.h>
using namespace std;
#define rpd(i,s,e,d) for(int i=(s);i<(int)(e);i+=(d))

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

	int N; cin>>N;
	vector<int> C(1e6+1, 0);
	int g = 0;
	rpd(i, 0, N, 1){ int a; cin>>a; C[a]++; g = gcd(g, a); }

	auto not_pairwise = [&]{
		rpd(i, 2, C.size(), 1){
			int c = 0;
			rpd(j, i, C.size(), i) c += C[j];
			if(c > 1) return true;
		}
		return false;
	};

	cout<< vector<string>{"pairwise","setwise","not"}[(g > 1) + not_pairwise()] <<" coprime\n";
}


Measured memory_bytes: 7116
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, INF = 1e9, larg = 1e5;
int A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
int max_value = 0, max_index = 0;
int min_value = INF, min_index = 0;

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

int main() {
	cin >> N >> M;
	cout << N-M+1;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX / 10000;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


int main()
{
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int ans = 0;
	rep(i, n) {
		if (s[i] != t[i]) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;

int main() {
	long double T,tA,tB,D,dA,dB;
	cin >> T>> D  >>tA >>tB >> dA >> dB;
	long double minium=1<<30;
	REP(i,1000/dA+1)
		REP(j,1000/dB+1)
			if(i*dA+j*dB<=D && i+j)
			minium=min(minium,abs(T-(i*dA*tA+j*dB*tB)/(dA*i+dB*j)));
	cout << minium << endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1288
#include<iostream>
using namespace std;
int main(){
  int i,j,x,y;
  cin >> x >> y;
  for(i=0;i<=x;i++){
    j=x-i;
    if(i*2+4*j==y){
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 3632
n = int(input())
comments = {}
for i in range(n):
    a = int(input())
    comments[i] = []
    for _ in range(a):
        x,y = map(int, input().split())
        comments[i].append([x-1, y == 1])

ans = 0

for i in range(2 ** n):
    fail = False #　うまく行かなかったとき,矛盾が生じたときTrue
    results = [None] * n # 結果用のリスト
    for j in range(n):
        # 嘘つきと仮定している人以外の証言の整合性を図る
        candidate = ((i >> j) & 1 ) == 1
        # iを2進数としてjだけビットシフトその一番下の桁が1かどうか判定する
        # i >> jでiをjだけシフトした10進数の値が得られる.
        # (i >> j) & 1 でビットのしもひと桁が1かどうか判定する
        # ((i >> j) & 1) == 1で下一桁が1のときTrue
        # Trueのとき,正直者認定
        if results[j] == None:
            results[j] = candidate
        elif results[j] != candidate:
            # 矛盾が生じたとき
            fail = True
            break
        if candidate == False:
            continue
        else:
            for comment in comments[j]:
                if results[comment[0]] == None:
                    results[comment[0]] = comment[1]
                if results[comment[0]] != comment[1]:
                    fail = True
                    break
            if fail:
                break
    if not fail:
        
        counter = 0
        for k in results:
            if k:
                counter += 1
        if counter >= ans:
            ans = counter
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,x;
  cin >> n >> x;
  vl L(n);
  rep(i,n){
    cin >> L[i];
  }
  ll d=0;
  ll i=0;
  ll cnt=1;
  while(d<=x&&i<n){
    d +=L[i];
    if(d>x){
      break;
    }
    else{
      cnt++;
      i++;
    }
  }
  cout << cnt << endl;
}

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

ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}

ll lcm (ll a, ll b) {return a / gcd(a, b) * b;}

ll f(ll x, int c, int d) {
  ll res = x;
  res -= x/c;
  res -= x/d;
  res += x/lcm(c, d);
  return res;
}

int main() {
  ll a, b;
  int c, d;
  cin >> a >> b >> c >> d;
  ll ans = f(b, c, d) - f(a-1, c, d);
  cout << ans << endl;
  return 0;
}


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


int main()
{
    int D, G;
    vector<int> p(11), c(11);

    cin >> D >> G;
    for( int i = 0; i < D; ++i ) cin >> p[i] >> c[i];

    int ans = 1e+9;

    // それぞれの数を全部使うかで 2^D 通りを全探索
    for( int i = 0; i < (1 << D); ++i  ){
        int num_solved = 0;
        int sum_score = 0;
        int remind_max = -1;  // 使ってない数で一番大きなもの
        // 全て使う数を使って残りのスコアなどを求める
        for( int j = 0; j < D; ++j ){
            if( i & (1 << j) ){
                num_solved += p[j];
                sum_score += 100*(j+1) * p[j] + c[j];
            }else{
                remind_max = j + 1;
            }
        }
        if( sum_score < G ){
            int s = 100 * remind_max;
            int necessary_num = (G - sum_score + s - 1) / s;
            // s - 1 を入れておくと必要な手をうまく + 1 できる
            if( necessary_num >= p[remind_max-1] ) continue;
            num_solved += necessary_num;
        }
        ans = min( ans, num_solved );
    }
    
    cout << ans << endl;
    
    return 0;

}

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

int main(){
  int N; cin >> N;
  long int h,w; cin >> h >> w;
  long int a,b;
  int r = 0;
  REP(i,N){
    cin >> a >> b;
    if(a>=h){
      if(b>=w){
        r++;
      }
    }
  }
  cout << r << "\n";
}

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

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

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



// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(200005);


//nPk
 mint f(int n, int k) {
    if (n < 0) return 0;
    // nPk = nCk * k!
    mint res = comb(n,k);
    res *= comb.fact[k];
    return res;
}




//組み合わせの数nCrを計算
   int calcNumOfCombination(int n, int r){
       int num = 1;
       for(int i = 1; i <= r; i++){
           num = num * (n - i + 1) / i;
       }
       return num;
   }





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

vector<P> p;
  //mを素因数分解
      for (ll i = 2; i*i <= m; ++i) {
        if(m%i==0){
          ll cnt=0;
          while(m%i==0){
            cnt++;
            m=m/i;

          }
          p.push_back(make_pair(i,cnt));

        }
      }
    if (m!=1)  p.push_back(make_pair(m,1));
  //  cout<<p[1].first;

//cout<<comb(100000,9)<<endl;
  mint ans=1;
  //cout<<nv<<'n'<<endl;
  int nv=p.size();
  rep(i,nv){
  //  cout<<comb(p[i].second+n-1,p[i].second)<<endl;
    ans*=comb(p[i].second+n-1,p[i].second);
  //  cout<<p[i].first<<' '<<p[i].second<<endl;
  //  cout<<ans<<endl;
  }
  cout<<ans.x;


}


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

using namespace std;
#define ll long long
const int N = 206;
int ans[N];

int main() {
    ll C; cin >> C;
    int HiBit = 63 - __builtin_clzll(++C), n = 0;
    for (int i = HiBit - 1; i >= 0; i--) {
        if (((C>>i)&1) == 0) n++, ans[n] = n;
        else {
            n++, ans[n] = n;
            for (int i = 1; i <= n; i++) ans[i]++;
            n++, ans[n] = 1;
        }
    }
    cout << 2 * n << "\n";
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    for (int i = 1; i <= n; i++) cout << i << " ";
    cout << "\n";

    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#define N 101
#define INF 100000000
int min(int,int);
int main(){
  int i,j,k,l,n,r[N],M[N][N];
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++)  scanf("%d %d",&r[i-1],&r[i]);
  
  for(i=1;i<=n;i++)   M[i][i]=0;
  
  for(j=2;j<=n;j++){
    for(i=1;i<=n-j+1;i++){
      l = i + j - 1;
      M[i][l] = INF;
      for (k=i;k<=l-1;k++){
	M[i][l]=min(M[i][l],M[i][k] + M[k+1][l] + r[i-1]*r[k]*r[l]);
      }
    }
  }
  printf("%d\n",M[1][n]);
  return 0;
}
int min(int r,int o){
  if(r<o) return r;
  return o;
}

Measured memory_bytes: 636
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    it = map(int, sys.stdin.read().split())
    N, K = next(it), next(it)
    A = list(it)
    A.sort(reverse=True)

    def ok(n):
        k = K
        for ai in A:
            if ai <= n:
                return True

            a, b = divmod(ai, n)
            if b == 0:
                a -= 1
            k -= a
            if k < 0:
                return False
        return True


    lo, hi = 1, A[0]
    while lo < hi:
        mi = (lo+hi)//2

        if ok(mi):
            hi = mi
        else:
            lo = mi+1

    print(hi)



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 108684