akhauriyash/Code-Regression huggingface dataset:
use std::io::Read;

fn can(m: i64, k: i64, p: &[(i64, i64)]) -> bool {
    let mut sum = 0;
    for &(a, f) in p {
        if a * f <= m {
            continue;
        }
        let c = a - m / f;
        assert!((a - c) * f <= m);
        sum += c;
        if sum > k {
            return false;
        }
    }
    true
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let k: i64 = it.next().unwrap().parse().unwrap();
    let mut a = vec![0i64; n];
    let mut f = vec![0i64; n];
    for i in 0..n {
        a[i] = it.next().unwrap().parse().unwrap();
    }
    for i in 0..n {
        f[i] = it.next().unwrap().parse().unwrap();
    }
    a.sort();
    f.sort();
    f.reverse();
    let p: Vec<(i64, i64)> = a.into_iter().zip(f.into_iter()).collect();
    let mut l = -1i64;
    let mut r = 1_000_000_000_000i64;
    while r - l > 1 {
        let m = (l + r) / 2;
        if can(m, k, &p) {
            r = m;
        } else {
            l = m;
        }
    }
    println!("{}", r);
}

fn main() {
    run();
}


Measured memory_bytes: 18168
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int solve()
{
    int x, y, z, k;
    cin >> x >> y >> z >> k;

    vector<ll> a = fetch_vec<ll>(x);
    vector<ll> b = fetch_vec<ll>(y);
    vector<ll> c = fetch_vec<ll>(z);

    vector<ll> ab(x*y);
    int index = 0;

    for (ll i : a)
    {
        for (ll j : b)
        {
            ab[index++] = i + j;
        }
    }

    std::sort(ab.begin(), ab.end(), std::greater<ll>());

    vector<ll> out(std::min(k, x*y) * z);
    index = 0;

    for (int i = 0; i < std::min(k, x * y); ++i)
    {
        for (ll j : c)
        {
            out[index++] = ab[i] + j;
        }
    }

    std::sort(out.begin(), out.end(), std::greater<ll>());

    for (int i = 0; i < k; ++i)
        cout << out[i] << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
vector<int> ans[MAX_N];

int main()
{
	int N;
	cin >> N;
	int k = -1;
	for (int i = 1; i <= 2*N; ++i)
	{
		if (i * (i-1) == 2 * N) k = i;
	}
	if (k == -1)
	{
		cout << "No" << endl;
		return 0;
	}
	else
	{
		cout << "Yes" << endl;
		cout << k << endl;
		int temp = 1;
		for (int i = 0; i < k; ++i)
		{
			for (int j = i+1; j < k; ++j)
			{
				ans[i].push_back(temp);
				ans[j].push_back(temp);
				temp++;
			}
		}
		rep(i,k)
		{
			cout << k - 1;
			rep(j,k-1)
			{
				cout << " " << ans[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4608
/* 
    author said_v15
  *
   created with web_programmer
  
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string stri;
#define forn for(i=0;i<n;i++)
#define car cin>>arr[i]
#define fl int flag=0; 
#define forn2 for(i=0;i<2*n;i++)
#define pb push_back   
#define pob pop_back  
#define sn "\n"
#define vi vector<int> 
int main()
{  
   ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  int n,k;
  string s;
  cin>>n>>k>>s;
  string s1,s2;
  s[k-1]=tolower(s[k-1]);
  cout<<s<<sn;
  return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int rec[4010];
int n;
signed main() {
    while(cin >> n, n) {
        vector<int> v;
        memset(rec, 0, sizeof(rec));
        int cnt = 0;
        rep(i,0,n) {
            int e, p, q; cin >> e >> p >> q;
            rec[e] += p * q;
            auto itr = find(v.begin(), v.end(), e);
            if(itr == v.end()) v.push_back(e);
        }
        rep(i,0,v.size()) {
            if(rec[v[i]] >= 1000000) {
                cout << v[i] << endl;
                cnt++;
            }
        }
        if(!cnt) cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 3084
#include <cstdio>

using namespace std;

int main() {
  int n,a;
  scanf("%d", &n);
  for(int i=0;i<n;i++){
    scanf("%d", &a);
    if(a%2==0&&(a%3==0||a%5==0)){
      continue;
    }else if(a%2!=0){
      continue;
    }else{
      printf("DENIED\n");
      return 0;
    }
  }
  printf("APPROVED\n");
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;
    vector<ll> A(N), B(N), C(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];
    REP(i, N) cin >> C[i];

    sort(ALL(A));
    sort(ALL(B));
    sort(ALL(C));

    vector<ll> cc(N), cb(N);

    REP(i, N) {
        ll c = C[i];
        cc[i] = lower_bound(ALL(B), c) - B.begin();
    }

    REP(i, N) {
        ll b = B[i];
        cb[i] = lower_bound(ALL(A), b) - A.begin();
        if (i > 0) cb[i] += cb[i-1];
    }
    debug(A, B, C)
    debug(cb, cc)

    ll ans = 0;
    REP(i, N) {
        if (cc[i] == 0) continue;
        ans += cb[cc[i]-1];
    }

    cout << ans << endl;

}


Measured memory_bytes: 4224
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

try:
    N = int(input().strip())
    nums = [int(input()) for i in range(N)]
except ValueError:
    print('ValueError')

num_p = 0
for i in nums:
    if is_prime(i)==True:
        num_p += 1
print(str(num_p))


Measured memory_bytes: 6012
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

void write (int s) {
	if (s < 10) {
		putchar (s + '0');
		return ;
	}
	write (s / 10);
	putchar (s % 10 + '0');
	return ;
}

const int N = 100003;
char s[N];
int n, Next[N], f[N];

int dfs (int x) {
	if (Next[x]) return Next[x];
	int y;
	if (s[x] == 'L') y = x - 1;
	else y = x + 1;
	if (s[x] != s[y]) return Next[x] = x;
	return Next[x] = dfs (y);
}

int main () {
	scanf ("%s", s + 1);
	n = strlen (s + 1);
	int i, x;
	for (i = 1; i <= n; ++i) {
		x = dfs (i);
		if (abs (x - i) & 1) {
			if (s[x] == 'L') --x;
			else ++x;
		}
		++f[x];
	}
	for (i = 1; i < n; ++i) write (f[i]), putchar (' ');
	write (f[n]), putchar ('\n');
	return 0;
}


Measured memory_bytes: 2432
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long x = read.to!long;
	long y = read.to!long;
	
	string ans;
	if(x == 2 && y == 0) ans = "Brown";
	else if(x == 0 && y == 2) ans = "Brown";
	else if(x == y || x - 1 == y || x + 1 == y) ans = "Brown";
	else ans = "Alice";
	
	ans.writeln;
}

void experiment(long x, long y){
	
	long[2][][long[2]] qs;
	foreach(s; 0 .. x + y + 1) foreach(t; -s .. s + 1){
		if((s + t) % 2 != 0) continue;
		long a = (s + t) / 2, b = (s - t) / 2;
		qs[[a, b]] = [];
		for(long i = 1; i * 2 < a; i ++) qs[[a, b]] ~= [a - 2 * i, b + i];
		for(long i = 1; i * 2 < b; i ++) qs[[a, b]] ~= [a + i, b - 2 * i];
	}
	
	long[long[2]] gr;
	foreach(s; 0 .. x + y + 1) foreach(t; -s .. s + 1){
		if((s + t) % 2 != 0) continue;
		long a = (s + t) / 2, b = (s - t) / 2;
		long [] gs = qs[[a, b]].map!(k => gr[k]).array;
		gs.sort();
		foreach(g; 0 .. x + y){
			if(! gs.canFind(g)){
				gr[[a, b]] = g;
				break;
			}
		}
	}
	
	foreach(a; 0 .. x + 1){
		foreach(b; 0 .. y + 1){
			gr[[a, b]].write;
			" ".write;
		}
		"".writeln;
	}
}

/*
x + y =: s, x - y =: t.

(s, t) -> (s - i, t - 3i)

ただし s + t >= 4i
このとき可能

つまり、s + t だけ考えればよく
(s + t) / 4 まで引くことができる

Grundy数


*/


Measured memory_bytes: 256
h, w = map(int, input().split())
s = [[i for i in input()] for j in range(h)]
flag = True
vecs = [(-1, 0), (0, 1), (1, 0), (0, -1)]
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            vec_cnt, w_cnt = 0, 0
            for di, dj in vecs:
                if 0 <= i + di < h and 0 <= j + dj < w:
                    vec_cnt += 1
                    if s[i + di][j + dj] == '.':
                        w_cnt += 1
            if vec_cnt == w_cnt:
                flag = False
print('Yes' if flag else 'No')

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String i = s.nextLine();

		if (i.charAt(2) == i.charAt(3) && i.charAt(4) == i.charAt(5)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		s.close();
	}

}


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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    string s;
    cin>>s;
    int z=s.size()-1;
    if(s[z]=='2'||s[z]=='4'||s[z]=='5'||s[z]=='7'||s[z]=='9')
        cout<<"hon";
    else if(s[z]=='1'||s[z]=='0'||s[z]=='6'||s[z]=='8')
        cout<<"pon";
    else
        cout<<"bon";
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  int newc=10001;
  int cnt=0;
  for (int i=0;i < n;i++) cin >> v.at(i);
  for (int j=0; j < n-1; j++){
    if (v.at(j)==v.at(j+1)) {
      v.at(j+1)=newc;
      newc++;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
l = [0]*n
for i in range(0,n):
    l[i] = list(map(int, input().split()))
c = [int(input()) for i in range(m)]

sum = [0]*n

for i in range(0,n):
    for j in range(0,m):
       sum[i] = sum[i] + l[i][j]*c[j]



for i in range(0,n):
    print(sum[i])





Measured memory_bytes: 6020
import math

A, B, X = map(int, input().split())
if A<B:
	print(A*(-(-X//1000)))
elif A<2*B:
	C = A*(X//1000)
	if X%1000==0:
		pass
	elif X%1000<=500:
		C += B
	else:
		C += A
	print(C)
else:
	print(B*(-(-X//500)))



Measured memory_bytes: 5656
import sys
readline = sys.stdin.readline

n,m = map(int,readline().split())

l=1
r=n
used = set()
while len(used) < m * 2:
  diff = r - l
  rdiff = n - diff
  if diff == rdiff:
    r -= 1
    continue
  if diff in used:
    r -= 1
    continue
  print(l,r)
  used.add(diff)
  used.add(rdiff)
  l += 1
  r -= 1

Measured memory_bytes: 26188
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    long long int k,x,a;
    cin>>k>>x;
    for(int i=1;i<=(2*k-1);i++)
 {a=x-k+i;
 cout<<a<<" ";
 }
 cout<<endl;
    return 0;

}



Measured memory_bytes: 3592
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: String = read();
    let b: String = read();
    println!("{}", if a == b { "H" } else { "D" });
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

std::vector<long> A;
long n, a, b;

bool check(long t){
	std::vector<long> B = A;
	for(int i = 0; i < n; i++) B[i] -= t * b;
	
	long c = 0;
	for(int i = 0; i < n; i++){
		if(B[i] <= 0) continue;
		
		c += (B[i] + (a - b) - 1) / (a - b);
	}
	
	return c <= t;
}

long binary(){
	long ok = 1e9, ng = 0;
	
	while(abs(ng - ok) > 1){
		long mid = (ok + ng) / 2;
		
		if(check(mid)) ok = mid;
		else ng = mid;
	}
	
	return ok;
}

int main(){
	cin >> n >> a >> b; A.resize(n);
	for(int i = 0; i < n; i++) cin >> A[i];
	
	cout << binary() << endl;
	return 0;
}


Measured memory_bytes: 1792
R,G,B,N = list(map(int,input().split()))
cnt = 0
for i in range(N+1):
    for j in range(N+1):
        k = (N-R*i-G*j)//B
        if i>=0 and j>=0 and k>=0 and R*i+G*j+B*k==N:
            cnt+=1
print(cnt)

Measured memory_bytes: 68788
//IIT Kanpur FacelessMen India
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e13;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

ll s1[N],s2[N];
ll laz[N];
void make(int C,int S,int E){
  if(S==E){
    s1[C]=s2[C]=INF;
    return;
  }
  int m=(S+E)>>1;
  make(C*2,S,m); make(C*2+1,m+1,E);
  s1[C]=s2[C]=INF;
}
void upd(int C,int S,int E,int s,ll v,ll seg[]){
  if(s<S||s>E) return;
  if(S==E){
    seg[C]=min(v,seg[C]); return;
  }
  int m=(S+E)>>1;
  upd(C*2,S,m,s,v,seg); upd(C*2+1,m+1,E,s,v,seg);
  seg[C]=min(seg[C*2],seg[C*2+1]);
  //printf("gg%d %d %lld %lld\n",S,E,seg[C],seg[5]);
}
ll qu(int C,int S,int E,int s,int e,ll seg[]){
  if(s>E||e<S) return INF;
  if(s<=S&&E<=e) return seg[C];
  int m=(S+E)>>1;
  ll a =min(qu(C*2,S,m,s,e,seg),qu(C*2+1,m+1,E,s,e,seg));
 // printf("lol %d %d %d %d %d %lld\n",C,S,E,s,e,a);
  return a;
}
int main(){
  // freopen("product.in","r",stdin);
  // freopen("product.out","w",stdout);
  int n,q,a,b; scanf("%d%d%d%d",&n,&q,&a,&b);  
  a--;b--;
  ll lst=b,sum=0;
  make(1,0,n-1);
  upd(1,0,n-1,a,a,s1);
  upd(1,0,n-1,a,-a,s2);
  //printf("%d\n",a);
  REP(i,q){
    int x; scanf("%d",&x);
    x--;
    ll z = min(qu(1,0,n-1,x,n-1,s1)-x,qu(1,0,n-1,0,x,s2)+x)+sum;
   // printf("%lld %lld %lld\n",z,qu(1,0,n-1,x,n-1,s1)-x,qu(1,0,n-1,0,x,s2)+x);
    sum+=abs(lst-x);
    z-=sum;
    upd(1,0,n-1,lst,z+lst,s1); upd(1,0,n-1,lst,z-lst,s2);
    lst = x;
  }
  ll ans=INF;
  REP(i,n) ans=min(ans,qu(1,0,n-1,i,i,s1)-i+sum);
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 12672
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};


bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int N,x,a[101],res=0;
  cin >> N >> x;
  REP(i,N)cin >> a[i];
  sort(a,a+N);
  REP(i,N){
    x -= a[i];
    if(x < 0){
      break;
    }else
      res++;
    if(i == N-1 && x > 0){
      res--;
    }
  }
  cout << res << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}
const int MOD = 1000000007;
mat mul(mat &A, mat &B){
  mat C(A.size(),vec(B[0].size()));
    REP(i,A.size())REP(k,B.size())REP(j,B[0].size()){
    C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
  }
  return C;
}

mat pow(mat A,ll n)
{
  mat B(A.size(),vec(A.size()));
  REP(i,A.size()){
    B[i][i] = 1;
  }
  while(n > 0){
    if ( n & 1) B = mul(B,A);
    A = mul(A,A);
    n >>= 1;
  }
  return B;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int answer = (N-2)*180;
        System.out.println(answer);
    }
}


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;cin>>n;
  cout<<(n%2==0 ? n : n*2)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int n, x, i, j, k, num;

    while (1) {
        num=0;
        scanf("%d %d", &n, &x);
        if (n==0 && x==0) break;
        for (i=1; i<=n; i++) {
            for (j=1; j<n; j++) {
	        for (k=1; k<=n; k++) {
	            if (i==j || j==k || i==k) continue;
		    if (i>j||j>k) continue;
		    if (i+j+k==x) num++;
	        }
	    }
        }
        printf("%d\n", num);
    }
    return 0;
}


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

#define ll long long

int main() {
	int n, w; cin >> n >> w;
	vector<ll> dp(w+1, 0);

	while(n--){
		int wt, v;
		cin >> wt >> v;

		for(int i = w-wt; i>=0; i--){
			dp[i+wt] = max(dp[i+wt], dp[i]+v);
		}
	}

	cout << dp.back() << "\n" ;


return 0;
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;

  vector<int> vec;

  int count = 1;
  while(1) {
    if(find(vec.begin(),vec.end(),A*count % B) == vec.end()) {
      vec.push_back(A*count % B);
    }
    else 
      break;
    count++;
  }

  sort(vec.begin(), vec.end());

  if(find(vec.begin(), vec.end(), C) != vec.end())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
def cin():  return list(map(int,input().split()))

S = input()
T = input()

ans = 10 ** 9 + 7
l1 = len(S)
l2 = len(T)
for i in range(l1 - l2 + 1):
    cnt = 0
    for j in range(l2):
        if S[i + j] != T[j]:  cnt += 1
    ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 67516
import sys
a,b = map(int,input().split())
if a*(-1) == b:
    print(1)
    sys.exit()
if a*b > 0:
    if a >0:
        if a < b:
            #
            print(b-a)
        else:
            #
            print(a-b+2)
    else:
        if a < b:
            #
            print(b-a)
        else:
            #
            print(-b+a+2)
elif a*b < 0:
    if a < 0:
        if abs(a)>abs(b):
            #
            print(-b-a+1)
        else:
            #
            print(b+a+1)
    else:
        if abs(a)>abs(b):
            #
            print(b+a+1)
        else:
            #
            print(-b-a+1)
else:
    if a == 0:
        if b > 0:
            print(b)
        else:
            print(-b+1)
    else:
        if a > 0:
            print(a+1)
        else:
            print(-a)

Measured memory_bytes: 9204
//説明はABC157 youtube
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)

vector<int> to[200005]; //木の構造
vector<int> counter;    //count用 ここに大きさをつけるとだめ
vector<int> done;
void dfs(int v, int p = -1)
{
   if (done[v]!= 1)
    {
        for (int u : to[v])
        {
            if (u == p)
            {
                continue;
            }
            counter[u] += counter[v];
            dfs(u, v);
        }
    }
    done[v] = 1;//そのノードを通った時には1にするという意味
}
int main()
{
    int n;
    int q;
    cin >> n >> q;
    done.resize(200005);
    rep(i, n - 1)
    {
        int a;
        int b;
        cin >> a >> b;
        --a;
        --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    counter.resize(n);
    rep(i, q)
    {
        int p;
        int x;
        cin >> p >> x;
        --p;
        counter[p] += x;
    }
    dfs(0); //全体の木構造を作った後に全探索
    rep(i, n)
    {
        cout << counter[i] << " ";
    }
}


Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
set<char>st;
for(int i=0;i<s.length();i++) st.insert(s[i]);
if(st.size()==s.length()) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int D;
int main()
{
  scanf("%d", &D);
  if (D == 25)
    printf("Christmas\n");
  else if (D == 24)
    printf("Christmas Eve\n");
  else if (D == 23)
    printf("Christmas Eve Eve\n");
  else if (D == 22)
    printf("Christmas Eve Eve Eve\n");

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 1e3 + 17;
ll a[N], b[N], cnt, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[1005][1005];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    double as, asd;
    cin >> as >> asd;
    cout << round((as + asd) / 2);
}


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

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(long long N, std::vector<long long> a){
    ll now=1;
    rep(i,N){
        if(a[i]==now){
            now++;
        }
    }
    if(now==1)op(-1)
    else op(N-now+1)
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 1792
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int D = 86400 , M = 10800;
int n , cnt[D + D];

int main(){
  scanf("%d",&n);
  int c=0;
  rep(i,0,n) {
    int a,b;
    scanf("%d%d",&a,&b);
    c += a;
    c %= D;
    cnt[c]++;
    c += b;
    c %= D;
  }
  rep(i,0,D) cnt[i + D] = cnt[i];
  rep(i,1,D+D) cnt[i] += cnt[i-1];
  int ans=0;
  rep(i,0,D) ans = max(ans , cnt[i + M + 1] - cnt[i]);
  printf("%d\n",ans);
  return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    ll abc[100010][3]{};
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> abc[i][j];
    ll dp[100010][3]{};
    for (int a = 0; a < N; ++a) {
        for (int b = 0; b < 3; ++b) {
            for (int c = 0; c < 3; ++c) {
                if (b == c) continue;
                dp[a + 1][c] = max(dp[a + 1][c], dp[a][b] + abc[a][c]);
            }
        }
    }
    ll res = 0;
    for (int i = 0; i < 3; ++i) res = max(res, dp[N][i]);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 8284
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
	bool flag = false;
	vector<int> A;
	unsigned __int128 x = 1;
	
	cin>>N;
	
	A.resize(N);
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
		if(A[i] == 0) {
			flag = true;
		}
	}
	
	if(flag) {
		cout<<0<<endl;
		return 0;
	}
	
	for(int i = 0; i < N; i++){
		
		
		x *= A[i];
		
		if(x > 1'000'000'000'000'000'000) {
			cout<<-1<<endl;
			return 0;
		}
	}
	
	cout<<(long long)x<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3976
#include <iostream>
#include <string> 
#include <cmath>

using namespace std;

int digit(int n)
{
    int d;
    for (int i = n; i > 0; i/=10) d++;
    return d;
}

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

    int ab = a * pow(10, digit(b)) + b;
    string ans = "No";
    for (int i = 1; i*i <= ab; i++) {
        if (i*i == ab) ans = "Yes";
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
#define ld long double
#define mid (l+r)/2
typedef pair<int,int> pii;
const int maxn=(1<<18)+5;
int a[maxn];
int ans[maxn],mx[maxn];
int tot;
void calc(int id,int n)
{
    for(int i=id;i<=n;i=((i+1)|id))
    {
        ans[i]=max(ans[i],mx[i]+a[id]);
        mx[i]=max(mx[i],a[id]);
        ++tot;
    }
}
int main()
{
    #ifdef local
    freopen("in.txt","r",stdin);
    #endif
    IOS;
    int n;
    cin>>n;
    int m=(1<<n)-1;
    for(int i=0;i<=m;i++) cin>>a[i];
    for(int i=0;i<=m;i++) calc(i,m);
    for(int i=1;i<=m;i++)
    {
        ans[i]=max(ans[i],ans[i-1]);
        cout<<ans[i]<<endl;
    }
    //cout<<tot<<endl;
}


Measured memory_bytes: 6144
using System;


class Program
{
    static void Main(string[] args)
    {
        String[] tmp = Console.ReadLine().Split(' ');
        int N = int.Parse(tmp[0]);
        int X = int.Parse(tmp[1]);

        String[] l = Console.ReadLine().Split(' ');

        int[] L = new int[N+1];

        for(int i = 0; i < N; i++)
        {
            L[i] = int.Parse(l[i]);
        }

        int count = 1;

        int D = 0;

        for(int i = 2; i < N+2; i++)
        {
            D = D + L[i - 2];
            if (D <= X)
            {
                count++;
            }
        }

        Console.Write(count);


        //提出時コメントアウトすること！
        //System.Threading.Thread.Sleep(5000);
        //提出時コメントアウトすること！
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main() {  
  vector<char> s(30);
  for(int i = 0;i < 30;i++){
    cin >> s.at(i);
  }
  
  //cout << s.at(3) <<endl;
  for(int i = 0;i < 3;i++){
    cout << s.at(i) ;
  }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> num(26,50);
  vector<int> now(26,0);
  int l,b;
  string S;
  for (int i=0; i<N; i++) {
    cin >> S;
    l = S.size();
    for (int j=0; j<l; j++) {
      now[S[j] - 'a']++;
    }
    for (int j=0; j<26; j++) {
      num[j] = min(num[j],now[j]);
      now[j] = 0;
    }
  }
  char p;
  for (int i=0; i<26; i++) {
    p = 'a' + i;
    for (int j=0; j<num[i]; j++) {
      cout << p;
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
using namespace std;
int N;
void dfs(set<char> s, string t, int idx) {
  if (idx == N) {
    cout << t << '\n';
    return;
  }
  for (auto c : s) {
    string u = t + c;
    dfs(s, u, idx + 1);
  }
  char c = 'a' + s.size();
  string u = t + c;
  s.insert(c);
  dfs(s, u, idx + 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  set<char> s;
  string t;
  dfs(s, t, 0);
}

Measured memory_bytes: 1536
s = input()
n = len(s)
ans = []

def dfs(i, f, total):
    if i == 3:
        if total == 7:
            global ans
            ans.append(f + '=7')

    else:
        dfs(i+1, f + '-' + s[i+1], total - int(s[i+1]))
        dfs(i+1, f + '+' + s[i+1], total + int(s[i+1]))
        
dfs(0, s[0], int(s[0]))
print(ans[0])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    pair<int,int> time[5];
    for(int i=0;i<5;i++){
    int cost;cin>>cost;
    time[i].second=cost;
     if(cost%10!=0){
    time[i].first=10-(cost%10);
     }
     else{time[i].first=0;}
    //cout<<time[i].first<<endl;
    }
    sort(time,time+5);
    int sum=0;
    for(int i=0;i<5;i++){
        if(time[i].first!=0&&i!=4){
            sum+=time[i].first;
        } 
        sum+=time[i].second;
    }
    cout<<sum<<endl;
}

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

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

	for(int n; cin >> n, n;) {
		vector<bitset<101> > knows(n, bitset<101>(0));
		for(int i = 0; i < n; ++i) {
			int m;
			cin >> m;
			for(int j = 0; j < m; ++j) {
				int p;
				cin >> p;
				knows[i].set(p);
			}
		}

		bitset<101> leak;
		int k;
		cin >> k;
		for(int i = 0; i < k; ++i) {
			int p;
			cin >> p;
			leak.set(p);
		}

		int ans = -100;
		for(int i = 0; i < n; ++i) {
			if((leak & knows[i]) == leak) {
				if(ans == -100)
					ans = i + 1;
				else
					ans = -1;
			}
		}

		cout << (ans < 0 ? -1 : ans) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1200
C[51];c,i;D(u,p){i>=u&&i-u-1&&(p+=C[i-u])<c?c=p:0;}main(){for(i=1;++i<51;C[i]=c){c=9999;D(2,380);D(3,550);D(5,850);D(10,1520);D(12,1870);D(15,2244);}for(;~scanf("%d",&i);)i&&printf("%d\n",C[i/100]);}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        //aとbとcの値を代入する
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        //aとbの値を比較する
        if(a < b && b < c){
            System.out.println("Yes");
        }
        
        else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26248
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, k, i;
	cin >> n >> k;
	int arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	
	double p[n];
	fo(i, 0, n)
	p[i] = (arr[i] + 1) / 2.0;
	
	double pref[n];
	pref[0] = p[0];
	for(i = 1; i < n; i++)
	pref[i] = pref[i - 1] + p[i];
	
	double mx = 0.0;
	fo(i, 0, n) {
		if(i - k >= 0)
		mx = max(mx, pref[i] - pref[i - k]);
		else
		mx = max(mx, pref[i]);
	}
	cout << fixed << setprecision(10) << mx;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define rep(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) static_cast<int>(x.size())
#define mp make_pair
#define fi first
#define se second

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

void buff() { ios::sync_with_stdio(false); cin.tie(nullptr); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod(ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b & 1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

template<typename T> inline void remin(T& x, const T& y) { x = min(x, y); }
template<typename T> inline void remax(T& x, const T& y) { x = max(x, y); }

template<typename T> ostream& operator<<(ostream &os, const vector<T>& v) {
    os << "{"; string sep; for(const auto& x : v) os << sep << x, sep = ", "; return os << "}"; 
}

template<typename T, size_t size> ostream& operator<<(ostream& os, const array<T, size>& arr) {
    os << "{"; string sep; for(const auto& x : arr) os << sep << x, sep = ", "; return os << "}"; 
}

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { 
    return os << '(' << p.first << ", " << p.second << ')'; 
}

constexpr int ms = 5013;

int main() {
    ll fat[ms], inv_fat[ms];
    buff();
    fat[0] = 1ll, inv_fat[0] = 1ll;
    for(int i = 1; i < ms; ++i) {
        fat[i] = (1ll * i * fat[i - 1] ) % MOD; 
        inv_fat[i] = pow_mod(fat[i], MOD - 2); 
    }
    int S; cin >> S;
    long long ans = 0ll;

    auto distrib = [&] (int n, int k) {
        long long res = fat[n + k - 1];
        res = (res * inv_fat[n]) % MOD;
        res = (res * inv_fat[(k-1)]) % MOD;
        return res;
    };

    for(int i = 1; i * 3 <= S; ++i) {
        // quero dividir em I pedaços
        int take = i * 3;
        int rem  = S - take;
        long long add = distrib(rem, i);
        ans = (ans+ add) % MOD;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;
 
int main()
{
    int n;
    cin >> n;
    long long int cnt = 0;

    std::map<int, int> mp;
    //for(int i=0; i<n; i++){
        cnt = 0;
        //cout << "### " << i+1 << endl;
        for(int x=1; x<=n; x++){
            long long int x2 = x*x;
            if(x2 > n) continue;
            for(int y=1; y<=101; y++){
                long long int y2 = y*y;
                //long long int xy = x*y;
                //long long int num = x2+y2+xy;
                //if(num+3 > n) continue;
                for(int z=1; z<=101; z++){
                    
                    long long int z2 = z*z;
                    //long long int xz = x*z;
                    //long long int yz = y*z;
                    long long int num = x2 + y2 + z2 + x*y + x*z + y*z;
                    mp[num]++;
                    /*
                    if(num == i+1){
                        //cout << x << ", " << y << ", " << z << endl;
                        //cout << num << ":" << num+z2+xz+yz << endl;
                        cnt++;
                    }
                    */
                }
            }
        }
        //cout << cnt << endl;
    //}
    for(int i=1; i<=n; i++){
        cout << mp[i] << endl;
    }
 
    return 0;
}

Measured memory_bytes: 5436
#include <algorithm>
#include <array>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
constexpr int INF = 100100100;

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

using namespace std;

int main() {
  // cout << fixed << setprecision(10);
  int A, B;
  cin >> A >> B;
  cout << 2 * max(A, B) - (A != B) << endl;
  return 0;
}


Measured memory_bytes: 256
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	static final int INF = 0x3f3f3f3f;
	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] dp = new int[1 << n]; Arrays.fill(dp, INF); dp[0] = 0;
		while (m-- > 0) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int x = 0;
			while (b-- > 0) {
				int c = sc.nextInt() - 1;
				x |= 1 << c;
			}
			for (int y = 0; y < 1 << n; y++)
				if (dp[y] != INF)
					dp[y | x] = Math.min(dp[y | x], dp[y] + a);
		}
		int ans = dp[(1 << n) - 1];
		println(ans == INF ? -1 : ans);
	}
}


Measured memory_bytes: 49484
#include <bits/stdc++.h>
#define N 1000000
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)  for(int i = n - 1; i >= 0; --i)
#define forr1(i, n) for(int i = n; i >= 1; --i)
#define form(l, r, i)   for(int i = l; i <= r; ++i)
#define forv(r, l, i)   for(int i = r; i >= l; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
  
const int inf = 1e9 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 9;
  
using namespace std;

vector<ll> div(ll n)
{
	ll i = 1;
	vector<ll> ans;
	while(i * i <= n)
    {
    	if(n % i == 0)
    	{
    		if(i != 1)	ans.pb(i);
			if(i * i != n)	ans.pb(n / i);
		}
		i++;
	}
	sort(all(ans));
	return ans;
}

int main()
{
    barnarnar
    ll n;
    cin >> n;
    vector<ll> d1 = div(n), d2 = div(n - 1);
    ll ans = 0;
    for(auto i:d1)
    {
    	ll cn = n;
    	while(cn % i == 0)	cn /= i;
    	if((cn - 1) % i == 0)	ans++;
	}
	cout << ans + d2.si;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forr(i,a,b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const ll MX = 300005;
const ll inf = 2e18;
#define ptr nodo*
#define tam 301000
const ll mod=1e9+7;
ll getmul(ll iz,ll der)
{
    ll mult=1;
    forr(j,iz,der+1)
    {
        mult*=j;
        mult%=mod;
    }
    return mult;
}
ll pot(ll base,ll exp)
{
    ll res=1;
    base%=mod;
    while(exp)
    {
        if (exp&1)
            res*=base,res%=mod;
        base*=base,base%=mod;
        exp/=2;
        base%=mod;
    }
    return res;
}
int main () 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    ll res=pot(2,n)-1;
    res-=(getmul(n-a+1,n)*pot(getmul(1,a),mod-2))%mod;
    res-=getmul(n-b+1,n)*pot(getmul(1,b),mod-2);

    res%=mod;
    res+=mod;
    res%=mod;
    cout<<res<<endl;

}


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

ll n, ans = 0;
ll a[205000], s[205000];

int main() {
    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        s[i] = a[i] + s[i-1];
    }
    for(int i=0; i<n; i++) {
        ans += a[i] * ((s[n-1] - s[i]) % 1000000007);
        ans %= 1000000007;
    }
    cout << ans  << endl;
}

Measured memory_bytes: 6716
#include<stdio.h>
int main(){
  int n,m=0,l;
  scanf("%d",&n);
  l=n;
  while(l>0){
    m+=l%10;
    l/=10;
  }
  if(n%m==0) puts("Yes");
  else puts("No");
 
  return 0;
}

Measured memory_bytes: 128
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    #n=int(input())
    a,b,c= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    if(a+b>=c):
        print(b+c)
    else:
        print(a+2*b+1)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Measured memory_bytes: 3064
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


N = II()
A, B = LI()
P = LI()

a, b, c = 0, 0, 0
for p in P:
    if p <= A:
        a += 1
    elif p <= B:
        b += 1
    else:
        c += 1

print(min(a, b, c))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;


int main(){
  int n; cin >> n;
  int A = 0,B = 0, AB = 0;
  int ans = 0;
  rep(i,n) {
    string s; cin >> s;
    rep(j,s.size()-1) if(s[j] == 'A' && s[j+1] == 'B') ans++;
    if(s[0] == 'B' && s.back() == 'A'){
      AB++;
      continue;
    }
    if(s[0] == 'B') B++;
    if(s.back() == 'A') A++;
  }
  
  if(AB > 0){
    ans += AB - 1;
    if(B > 0){
      ans++;
      B--;
    }
    if(A > 0){
      ans++;
      A--;
    }
  }

  ans += min(A,B);
  

  cout << ans << endl;
}


Measured memory_bytes: 256