akhauriyash/Code-Regression huggingface dataset:
/* ***********************************************
Author        :yang12138
Created Time  :2018年01月21日 星期日 21时14分45秒
File Name     :D.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)

const int N=2005;

int W[N][N];

int get(int x1,int y1,int x2,int y2){
//	if(!(x1<=x2 && y1<=y2)) return 0;
	return W[x2][y2]-W[x2][y1-1]-W[x1-1][y2]+W[x1-1][y1-1];
}

void solve(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		int x,y;
		char ch;
//		scanf("%d %d %c",&x,&y,&ch);
		cin>>x>>y>>ch;
		if(ch=='B') y+=k;
		x%=2*k,y%=2*k;
		x++,y++;
		W[x][y]++;
	}

	/*
	for(int i=1;i<=2*k;i++){
		for(int j=1;j<=2*k;j++){
			W[i][j]+=W[i][j-1];
			B[i][j]+=B[i][j-1];
		}
	}
	for(int j=1;j<=2*k;j++){
		for(int i=1;i<=2*k;i++){
			W[i][j]+=W[i-1][j];
			B[i][j]+=B[i-1][j];
		}
	}
	*/
	for(int i=1;i<=2*k;i++)
		for(int j=1;j<=2*k;j++){
			W[i][j]+=W[i-1][j]+W[i][j-1]-W[i-1][j-1];
	//		B[i][j]+=B[i-1][j]+B[i][j-1]-B[i-1][j-1];
		}


	int ans=0;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=k;j++){
			int tmp=0;
			tmp+=get(1,1,i,j)+get(i+1,j+1,i+k,j+k);
			tmp+=get(i+k+1,j+k+1,2*k,2*k)+get(1,j+k+1,i,2*k)+get(i+k+1,1,2*k,j);
			/*
			tmp+=get(B,1,j+1,i,j+k)+get(B,i+k+1,j+1,2*k,j+k);
			tmp+=get(B,i+1,1,i+k,j)+get(B,i+1,j+k+1,i+k,2*k);
			*/
			ans=max(ans,max(tmp,n-tmp));

			/*
			tmp=0;
			tmp+=get(B,1,1,i,j)+get(B,i+1,j+1,i+k,i+k);
			tmp+=get(B,i+k+1,j+k+1,2*k,2*k)+get(B,1,j+k+1,i,2*k)+get(B,i+k+1,1,2*k,j);
			tmp+=get(W,1,j+1,i,j+k)+get(W,i+k+1,j+1,2*k,j+k);
			tmp+=get(W,i+1,1,i+k,j)+get(W,i+1,j+k+1,i+k,2*k);
			ans=max(ans,tmp);
			*/
		}
	}

	cout<<ans<<endl;
}

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    
	solve();
    return 0;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9223372036854775807 //  巨大数INF
using namespace std;

signed main() {
  int W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << fixed << setprecision(10);
  double a = W;
  double b = H;
  double ans = a * b / 2;
  cout << ans << ' ';
  if (W%2==0 && H%2==0 && W/2==x && H/2==y) cout << 1 << endl;
  else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;
const int MAX = 110000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint log_mul(lint base, lint bit) {
    lint res = 0;

    while (bit) {
        if (bit & 1) res = (res + base) % MOD;
        base = (base + base) % MOD;
        bit >>= 1;
    }

    return res;
}

int main() {
    int n, k;
    cin >> n >> k;
    vec a(n);
    rep(i, n) cin >> a[i];

    COMinit();
    sort(all(a));

    lint res = 0;

    rep(i, n) {
        lint t = ((a[i] % MOD) + MOD) % MOD;
        // max
        if (i >= k-1) {
            res += log_mul(t, COM(i, k-1));
            res %= MOD;
        }

        // min
        if (i <= n-k) {
            res -= log_mul(t, COM(n-i-1, k-1));
            res = ((res % MOD) + MOD) % MOD;
        }
    }

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

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    cout<<((A+B)==(C+D)?"Balanced":((A+B)>(C+D)?"Left":"Right"))<<endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	xs := make([]int, n)
	left := 101
	right := 0
	for i := 0; i < n; i++ {
		xs[i] = eGetInt(scanner)
		if xs[i] < left {
			left = xs[i]
		}
		if xs[i] > right {
			right = xs[i]
		}
	}
	min := math.MaxInt32
	for i := left; i <= right; i++ {
		sum := 0
		for j := 0; j < n; j++ {
			sum += pow(i-xs[j], 2)
		}
		if sum < min {
			min = sum
		}
	}
	fmt.Println(min)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	return int(math.Pow(float64(a), float64(n)))
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}


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

int main(){
    int K, X; cin >> K >> X;
    for(int i = X - K + 1; i <  X + K ; i++){
        if(i != X - K + 1) cout << " ";
        cout << i;
    }
    cout << endl;
}

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

using namespace std;

void dfs(int x,int y);

char field[12][13];

int main(void){
    int i,j;
    int count;
    while(cin.get()!=EOF){
        count=0;
        for(i=0;i<12;i++){
            cin.getline(field[i],13,'\n');
        }
        for(i=0;i<12;i++){
            for(j=0;j<12;j++){
                if(field[i][j]=='1'){
                    count++;
                    dfs(i,j);
                }
            }
        }
        if(cin.eof())break;
        cout<<count<<endl;
    }
    return(0);
}

void dfs(int x,int y){
    int dx[]={0,0,1,-1};
    int dy[]={1,-1,0,0};
    int nx,ny;
    int i;
    
    field[x][y]='0';
    
    for(i=0;i<4;i++){
        nx=x+dx[i];
        ny=y+dy[i];
        if(0<=nx&&nx<12&&0<=ny&&ny<12){
            if(field[nx][ny]=='1'){
                dfs(nx,ny);
            }
        }
    }
    return;
    
}

Measured memory_bytes: 1136
dish = []
5.times do
  dish << gets.to_i
end

ary = dish.map{|x| x%10}.sort_by{|x| x}
ary.delete(0)
if ary.length == 0
  min = 0
else
  min = 10-ary[0]
end

5.times do |i|
  dish[i] = ((dish[i]/10).to_i+1)*10 if dish[i]%10 != 0
end

print dish.inject(&:+)-min

Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>

int main(void) {
	int n;
	scanf("%d",&n);
	char cardA[n][2];
	char cardB[n][2];
	for(int i = 0; i < n; i++)scanf("%s",&cardA[i][0]);
    strcpy(cardB, cardA);
	for(int i = 0; i < n-1; i++){
		for(int j = 0; j < n-i-1; j++){
			if(cardA[j][1] > cardA[j+1][1]){
				int temp		= cardA[j][0];
				cardA[j][0]		= cardA[j+1][0];
				cardA[j+1][0]	= temp;
				temp			= cardA[j][1];
				cardA[j][1]		= cardA[j+1][1];
				cardA[j+1][1]	= temp;
			}
		}
	}
	for(int i = 0; i < n-1; i++){
		int minj = i;
		for(int j = i; j < n; j++){
			minj = (cardB[minj][1] > cardB[j][1])?j:minj;
		}
		int temp		= cardB[i][0];
		cardB[i][0]		= cardB[minj][0];
		cardB[minj][0]	= temp;
		temp			= cardB[i][1];
		cardB[i][1]		= cardB[minj][1];
		cardB[minj][1]	= temp;
	}
	printf("%c%c",cardB[0][0],cardB[0][1]);
	for(int i = 1; i < n; i++)printf(" %c%c",cardA[i][0],cardA[i][1]);
	printf("\n");
	printf("Stable\n");
	printf("%c%c",cardB[0][0],cardB[0][1]);
	for(int i = 1; i < n; i++)printf(" %c%c",cardB[i][0],cardB[i][1]);
	printf("\n");
	for(int i = 0; i < n; i++){
		if(cardA[i][0]==cardB[i][0]){
			continue;
		}
		printf("Not stable\n");
		return 0;
	}
	printf("Stable\n");
	return 0;
}



Measured memory_bytes: 2104
{-# LANGUAGE OverloadedStrings #-}
import Data.Char
import Data.List
import Control.Monad
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  n <- head.parseLine <$> BS.getLine
  BS.putStrLn . BS.pack . show $ if even n then (n`div`2) else (n`div`2+1)
  where
     parseLine = unfoldr (BS.readInt . BS.dropWhile isSpace)

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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset ((a), v, sizeof (a))

using namespace std;

typedef long long ll;
typedef pair <int, int> ii;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ii> vii;

const int N = 200005;
const int INF = (int)1e+9;

int n;
string S;
int dat[N];
map <int, int> dp;

int get (int x) {
	if (dp.find(x) == dp.end()) return INF;
	return dp[x];
}

int Solve () {
	int res = 0;
	for (int i = 0; i < n; ++i) {
		int dp_now = INF;
		res ^= dat[i];
		dp_now = min (dp_now, 1 + get (res));
		for (int i = 0; i < 26; ++i) {
			dp_now = min (dp_now, 1 + get (res ^ (1 << i)));
		}

		if (dp.find(res) == dp.end()) dp[res] = dp_now;
		else dp[res] = min (dp[res], dp_now);

		if (i == n - 1) return dp_now;
	}
}

int main () {
	cin >> S;
	n = S.length();
	dp[0] = 0;
 	for (int i = 0; i < n; ++i) {
		dat[i] = 1 << (S[i] - 'a');
		//printf ("%d\n", dat[i]);
	}

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

Measured memory_bytes: 10628
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <memory.h>
#include <cstring>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <atcoder/fenwicktree>

using namespace std;
using namespace atcoder;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, q;
	cin >> n >> q;
	fenwick_tree<long long int> tree(n);
	long long int t;

	for (int i = 0; i < n; i++)
	{
		cin >> t;
		tree.add(i, t);
	}

	int a, b, c;

	for (int i = 0; i < q; i++)
	{
		cin >> a >> b >> c;
		if (a == 0)
		{
			tree.add(b, c);
		}
		else
		{
			cout << tree.sum(b, c) << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 8232
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}


// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long int combination_mod(long long int a,long long int b){
    long long int ans=1;
    b=min(b,a-b);
    for(int i=0;i<b;i++){
        ans*=a-b+i+1;
        ans%=MOD;
        ans*=modinv(i+1,MOD);
        ans%=MOD;
    }
    return ans;
}

int main(){
    INT(n,k);
    int red=n-k;
    ll ans=1;
    for(int i=1;i<=k;i++){
        ans=combination_mod(k-1,i-1);
        if(red>=i-1)ans*=combination_mod(red+1,i);
        else ans=0;
        ans%=MOD;
        out(ans);
    }
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  string s; cin>>s;
  vector<vector<int>>suff(n+1,vector<int>(3,0));
  suff[n] = {0,0,0};
  for(int i = n-1; i >= 0 ; i--){
    suff[i] = suff[i+1];
    if(s[i] == 'R')suff[i][0]++;
    if(s[i] == 'G')suff[i][1]++;
    if(s[i] == 'B')suff[i][2]++;
  }
  long long res = 0;
  for(int i = 0 ; i < n ; i++){
    for(int j = i+1 ; j < n ; j++){
      if(s[i] == s[j])continue;
      if('R'!=s[i] && 'R'!=s[j])res+=suff[j][0] - (j+(j-i) < n && s[j + (j-i)]=='R');
      if('G'!=s[i] && 'G'!=s[j])res+=suff[j][1] - (j+(j-i) < n && s[j + (j-i)]=='G');
      if('B'!=s[i] && 'B'!=s[j])res+=suff[j][2] - (j+(j-i) < n && s[j + (j-i)]=='B');
    }
  }
  cout<<res;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	int ans=-1e9,mn; cin>>mn;
	for(int i=1;i<n;++i){
		int r; cin>>r;
		ans=max(ans,r-mn);
		mn=min(mn,r);
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3232
#include <stdio.h>
#include <string.h>
#include <stdint.h>

#define MOD 1000000007

int mpow(int a, int b) {
	int res = 1;
	for (int cur = a; b; b >>= 1) {
		if (b & 1) res = (int64_t) res * cur % MOD;
		cur = (int64_t) cur * cur % MOD;
	}
	return res;
}

int dp[5001][5001]; // i times => j

int main() {
	int n;
	scanf("%d", &n);
	char s[5001];
	scanf("%s", s);
	
	int k = strlen(s);
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i; j++) {
			// add 0/1
			dp[i + 1][j + 1] += 2 * dp[i][j] % MOD;
			if (dp[i + 1][j + 1] >= MOD)
				dp[i + 1][j + 1] -= MOD;
			// remove
			if (j) {
				dp[i + 1][j - 1] += dp[i][j];
				if (dp[i + 1][j - 1] >= MOD)
					dp[i + 1][j - 1] -= MOD;
			} else {
				dp[i + 1][j] += dp[i][j];
				if (dp[i + 1][j] >= MOD)
					dp[i + 1][j] -= MOD;
			}
		}
	}
	printf("%d", (int)((int64_t) dp[n][k] * mpow(mpow(2, k), MOD - 2) % MOD));
	
	
	
	return 0;
}


Measured memory_bytes: 96384
#include <iostream>
using namespace std;
int main(void){
    // Your code here
    int a;
    char b[100];
    cin>>a;
    int c=0;
    for(int i=0;i<100;i++){
        b[i]=0;
    }
    for(int i=0;i<a;i++){
        cin>>b[i];
    }
    if(a%2!=0){
        cout<<"No";
        return 0;
    }
    
    for(int i=0;i<a/2;i++){
        if(b[i]==b[(a/2)+i]){
            c++;
        }
    }
    if(c==a/2){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> inline T GCD_L(T a,T b){
  T r;
  while(a){
    r=b;
    b=a;
    a=r%a;
  }
  return b;
}
int N;
int A[100000];
int main(){
  int res;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int KL2GvlyY, Q5VJL1cS;
    if(N==0){
      Q5VJL1cS = 0;
    }
    else{
      Q5VJL1cS = A[0];
      for(KL2GvlyY=1;KL2GvlyY<N;KL2GvlyY++){
        Q5VJL1cS = GCD_L(Q5VJL1cS, A[KL2GvlyY]);
      }
    }
    res =Q5VJL1cS;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190715-1

// --- original code ---
// int N, A[1d5];
// {
//   int res;
//   rd(N,A(N));
//   res = gcd(A(N));
//   wt(res);
// }


Measured memory_bytes: 640
lst1=[]
for i in range(4):
    a=int(input())
    lst1.append(a)
A=min(lst1)

lst2=[]
for j in range(2):
    b=int(input())
    lst2.append(b)
B=min(lst2)

X=sum(lst1)
Y=sum(lst2)
Z=X+Y-A-B
print(Z)


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define hash dhsjakhd
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;

unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 eng(seed);

uniform_int_distribution<> DD(0, (1ll << 31));

ll random2(){
    return (ll(DD(eng))*(1ll << 31) + ll(DD(eng))) & ((1ll << 62ll)-1);
}

ll n,m,T,k,q;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const int MAXN = 200001;

string s;

ll A[MAXN] = {0};

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

    //freopen("input.txt","r",stdin);
   // freopen("autput.txt","w",stdout);
    ll a,b,c,d;

    cin >> n;
    cin >> s;

    ll ans = 1;
    rep(c1,0,n){
        ans *= ll(c1+1);
        ans %= big;
    }

    ll parity = 0;
    per(c1,2*n,0){
        a = 0;
        if(s[c1] == 'B')a = 1;
        a ^=parity;
        A[c1] = a;
        parity^=1;
    }

    ll mi = 0;

    rep(c1,0,2*n){
        //cerr << A[c1];
        if(A[c1] == 0){
            mi++;
        }
        else{
            ans *= mi;
            ans %= big;
            mi--;
        }
    }//cerr << "\n";

    if(mi > 0)ans = 0;
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 2196
import bisect

while(1):
    n,S=map(int,raw_input().split())
    if n==0:    break
    A=[]
    for i in range(n):
        A.append(int(raw_input()))
    A.sort()
    ans=0
    for i in range(1,n):
        ans+= max(0,i- bisect.bisect(A[:i],S-A[i]) )
    print ans

Measured memory_bytes: 6804
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = SS()
    B = SS()
    C = SS()

    ans = sum([len(set(s)) - 1 for s in zip(A, B, C)])
    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10076
#include<stdio.h>
#include<iostream>
#include<vector>
 
int main(){
  int N;
  unsigned long long ans= 1;
  int flag =0;
  float w = 0;
  
  std::cin>>N;
  
  for(int i=0; i<N; i++){
    unsigned long long a;
    std::cin>>a;
    w = log10((float)a)+w;
    
    //std::cout<<w<<std::endl;
    
    if(a == 0){
      	
    	ans = 0;
      	flag = 0;
    }
    else{
        
      
      	if(w> 18.0 ||  ans*a > powl(10.0, 18.0)){
    		flag = 1;
          	
    	}else{
        	ans = ans*a;
        }
      
    }
    
    
    
    
  }
  
  if(flag == 0){
    	std::cout<<ans;
    }else{
  		std::cout<<"-1";
  }
 
}

Measured memory_bytes: 3476
#include<bits/stdc++.h>
#define pb push_back
typedef long long ll;
#define mod pow(10,9)+7
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;
	cin >> n;
	int a[n];
	int b[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		cin >> b[i];
	}
	int count = 0;
	int maxcount = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] == b[i])
			count++;
		else
		{
			if (count >= maxcount)
			{
				maxcount = count;
			}
			count = 0;
		}
	}
	if (maxcount >= 3 || count >= 3)
		cout << "Yes\n";
	else
		cout << "No\n";


	return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main{

    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	int n = sc.nextInt();
	int y = sc.nextInt()/1000;
	
	boolean flag = false;
	
	for(int i = 0;i<=n;i++){//10000
	    if(flag == true)break;
	    
	    for(int j = 0;j<=n;j++){//5000
	       
		if((10*i)+(5*j)+(n-i-j) == y && (n-i-j)>=0){
		    System.out.println(i+" "+j+" "+(n-i-j));
		    flag = true;
		}
	    }
	}
	if(flag == false){
	    System.out.println("-1 -1 -1");
	}
    }
}


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

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let r: u32 = read();
    println!("{}", r * r);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	bool flag=true;
	int pre=-1;
	rep(i,n){
		int h;
		cin>>h;
		if(pre>h){
			flag=false;
		}
		if(pre<h){
			h--;
		}
		pre=h;
	}
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 *
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int H = sc.nextInt();
        int W = sc.nextInt();
        String[] S = new String[H];
        for (int i=0; i<H; i++) {
            S[i] = sc.next();
        }

        System.out.println(solve(H, W, S));
    }

    private static long solve(int H, int W, String[] S) {
        int[][] scoreH = new int[H][W];
        int[][] scoreW = new int[H][W];

        for (int i=0; i<H; i++) {
            int prev = -1;
            int next;

            while ((next = S[i].indexOf('#', prev+1)) != -1) {
                for (int k=prev+1; k<next; k++) {
                    scoreH[i][k] = next - prev - 1;
                }
                prev = next;
            }
            for (int k=prev+1; k<W; k++) {
                scoreH[i][k] = W-prev-1;
            }

            /*
            System.err.println("calc scoreH at " + i);
            for (int w=0; w<W; w++) {
                System.err.print(scoreH[i][w] + " ");
            }
            System.err.println();
             */
        }


        for (int i=0; i<W; i++) {
            int prev = -1;
            int next;

            while ((next = indexOf(H, S, i, prev+1)) != -1) {
                for (int k=prev+1; k<next; k++) {
                    scoreW[k][i] = next - prev - 1;
                }
                prev = next;
            }
            for (int k=prev+1; k<H; k++) {
                scoreW[k][i] = H-prev-1;
            }

            /*
            System.err.println("calc scoreW at " + i);
            for (int h=0; h<H; h++) {
                System.err.print(scoreW[h][i] + " ");
            }
            System.err.println();
             */
        }

        int max = 0;
        for (int h=0; h<H; h++) {
            for (int w=0; w<W; w++) {
                max = Math.max(max, scoreH[h][w] + scoreW[h][w] - 1);
            }
        }

        return max;
    }

    private static int indexOf(int H, String[] S, int w, int start) {
        for (int s = start; s<H; s++) {
            if (S[s].charAt(w) == '#') return s;
        }

        return -1;
    }
}


Measured memory_bytes: 68860
function main(input) {
    const input_array = input.split("\n");

    const coins_count = input_array.slice(0,3);
    const desired_sum = parseInt(input_array.slice(-1), 10);
    const A = parseInt(coins_count[0], 10),
          B = parseInt(coins_count[1], 10),
          C = parseInt(coins_count[2], 10),
          X = parseInt(input_array[3], 10);

    var count = 0;

    for (var a = 0; a <= A; ++a) {
        for (var b = 0; b <= B; ++b) {
            for (var c = 0; c <= C; ++c) {
                var sum = (a * 500) + (b * 100) + (c * 50);
                if (sum === X) ++count;
            }
        }
    }
    console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



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

int main(){
	int n;
	cin >> n;
	long long int a[n+1];
	for(int i=0;i<=n;i++){
		cin >> a[i];
	}
	long long int b[n];
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	long long int sum=0;
	for(int i=0;i<n;i++){
		if(a[i]>b[i]){
			sum+=b[i];
		}
		else{
			sum+=a[i];
			if(b[i]-a[i]>a[i+1]){
				sum+=a[i+1];
				a[i+1]=0;
			}
			else{
				sum+=b[i]-a[i];
				a[i+1]=a[i+1]-b[i]+a[i];
			}
		}
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    if N >= 30:
        print("Yes")
        return

    print("No")


main()


Measured memory_bytes: 64636
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount _builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
//
#define forn(i, n)for(ll i=0;i<n;i++)
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(int j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll A,B;
int main(){FAST;
cin>>A>>B;
if(A<=5)cout<<0;
else if(A>5 and A<13)cout<<B/2;
else cout<<B;
return 0;
}




Measured memory_bytes: 384
N, M = map(int, input().split())

ans = 1
for i in range(1,int(M ** 0.5) + 1):
    if M % i == 0:
        if i >= N:
            ans = max(ans, M // i)
        if M // i >= N:
            ans = max(ans, i)
print(int(ans))


Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <queue>
#include <time.h>

using namespace std;

#define INT_MAX 2147483647
typedef long long ll;

ll gcd(ll m, ll n);		//最大公倍数
ll lcm(ll m, ll n);		//最小公倍数

int main(void) {

	int ans = 0;

	int n;
	cin >> n;
	if (n % 2 == 0) {
		//none
		ans = n;
	}
	else {
		ans = n * 2;
	}

	cout << ans << endl;

	return 0;

}

// 2番目から3要素だけ抜き出した部分文字列を取得する
//std::string result = s.substr(2, 3);  

#if 1
//最大公倍数
ll gcd(ll m, ll n)
{
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
#endif

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

using Graph = vector<vector<int>>;

vector<int> cycle(auto& G) {
  const auto N = G.size();
  vector<int> walk;

  vector<bool> ng(N), used(N);
  function<bool(int)> dfs = [&](auto cur) {
    if(ng[cur]) return false;
    if(used[cur]) {
      walk.emplace_back(cur);
      return true;
    }
    used[cur] = true;
    for(auto nex: G[cur]) {
      if(dfs(nex)) {
        walk.emplace_back(cur);
        return true;
      } else {
        ng[nex] = true;
      }
    }
    used[cur] = false;
    ng[cur] = true;
    return false;
  };

  for(auto v=0; v<N; ++v) if(!used[v]) if(dfs(v)) break;

  vector<int> cycle;
  if(!walk.empty()) {
    for(auto v: walk) {
      cycle.emplace_back(v);
      if(1<cycle.size() && v == walk[0]) break;
    }
    reverse(begin(cycle), end(cycle));
  }
//   cout<<"cycle: "; for(auto v: cycle)cout<<" "<<v+1;cout<<endl;
  return cycle;
}

vector<int> shrink(auto& G, auto C) {
  unordered_set<int> V;
  function<bool(int)> update = [&](auto i) {
    if(i == C.size()-1) return false;
    auto cur = C[i];
    for(auto nex: G[cur]) if(V.count(nex)) if(nex != C[i+1]) {
      auto j = i;
      while(C[++j%=C.size()] != nex) V.erase(C[j]);
      if(i < j) {
        C.erase(begin(C)+i+1, begin(C)+j);
      } else {
        C.erase(begin(C)+i+1, end(C));
        C.erase(begin(C), begin(C)+j);
        C.emplace_back(C[0]);
      }
      return true;
    }
    return update(i+1);
  };

  for(auto v: C) V.emplace(v);
  while(update(0)) {
//     cout<<"update: "; for(auto v: C)cout<<" "<<v+1;cout<<endl;
  }
  return C;
}

int main() {
  int N, M;
  cin >> N >> M;
  Graph G(N);
  for(auto i=0; i<M; ++i) {
    int A, B;
    cin >> A >> B;
    G[--A].emplace_back(--B);
  }

  auto C = cycle(G);
  if(C.empty()) {
    cout << -1 << endl;
  } else {
    auto V = shrink(G, C);
    cout << V.size() - 1 << endl;
    for(auto i=1; i<V.size(); ++i) cout << V[i]+1 << endl;
  }
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 101

int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int top=0;
int S[MAX]={};

int main(){
  int x,ans;
  char s[100];
  while(scanf("%s", s)!=EOF){
    if (s[0] == '+' ){
      push(pop()+pop());
    } else if ( s[0] == '-' ){
      ans=pop()-pop();
      push(ans*(-1));
    } else if ( s[0] == '*' ){
      push(pop()*pop());
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",pop());
  return 0;
}

int isEmpty(void){
  return top==0;
}

int isFull(){
  return top>=MAX-1;
}

void push(int x){
  if(isFull()){
    printf("is full!\n");
    exit(1);
  }
  top++;
  S[top]=x;
  //  printf("%d ",top);
}

int pop(){
  if(isEmpty()){
    printf("is Empty!\n");
    exit(2);
  }
  top--;
  return S[top+1];
}



Measured memory_bytes: 2108
/*{{{*/
#include <bits/stdc++.h>
#ifdef _GLIBCXX_DEBUG
int c_;
#define cout (c_?cerr:cout)
#define debug(...) {if(!c_)cerr<<"\033[96;1m";++c_;\
__VA_ARGS__;--c_; if(!c_)cerr<<"\033[0m";}
#else
#define debug(...)
#endif
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
#define dump(...) debug(print(#__VA_ARGS__, '=',  __VA_ARGS__))
#define dump_range(...) debug(cerr<<#__VA_ARGS__<<": ";print_range(__VA_ARGS__))
using namespace std; using ll = long long; 
template< typename t > using V = vector< t >; void print(){cout<<'\n';}
template< typename t, typename... v > void print(const t& a, v&&... b)
{cout << a << (sizeof...(b)? " " : ""); print(b...);}
template< typename t > void print_range(t a, const t& b)
{while (a!=b) cout << (*a++) << ' '; cout << '\n';}
/*}}}*/

constexpr int nax = 1e5;

int n;
int tb[nax * 2];
int ilo[nax * 2];
ll pref[nax * 2];

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

    cin >> n;
    for (int i = 0; i < 2 * n; ++i)
        cin >> tb[i], ilo[i] = tb[i];
    sort(ilo, ilo + 2 * n);
    if (n == 2)
    {
        print(min(tb[0], tb[3]) + min(tb[1], tb[2]));
        return 0;
    }
    ll sum[2] = {0, 0};
    for (int i = 0; i < 2 * n; ++i)
        sum[i & 1] += tb[i];
    ll res = *min_element(sum, sum + 2);
    for (int i = 0; i < 2 * n; ++i)
        pref[i] = (i == 0? 0 : pref[i - 1]) + ilo[i];
    for (int i = 0; i < 2 * n; i += 2)
    {
        ll q = pref[n - 3];
        ll a = min(tb[i], tb[i + 1]);
        ll b = max(tb[i], tb[i + 1]);
        if (a <= ilo[n - 3] and b <= ilo[n - 2])
            q += ilo[n - 2] + ilo[n - 1];
        else if (a <= ilo[n - 3])
            q += ilo[n - 2], q += b;
        else
            q += a + b;
        res = min(res, q);
    }

    print(res);
}

Measured memory_bytes: 3328
#include<iostream>
using namespace std;
int map[100][100];
int main() {
	int x1,y1,x2,y2,x3,y3,x4,y4,tmp = 0;
	cin>>x1>>y1>>x2>>y2;
	//x3
	tmp = x2+y1;
	x3 = tmp-y2;
	cout<<x3<<' ';
	//y3
	tmp = y2-x1;
	y3 = x2+tmp;
	cout<<y3<<' ';
	//x4
	tmp = x1-y2;
	x4 = tmp+y1;
	cout<<x4<<' ';
	//y4
	tmp = x2-x1;
	y4 = tmp+y1;
	cout<<y4;
	return 0;
} 

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,x;
  cin>>N>>x;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  sort(rng(A));
  int ans=0;
  for(int i=0;i<N;i++){
    if(i==N-1){
      if(A[i]==x)ans++;
    }
    else if(A[i]<=x){
      ans++;
      x-=A[i];
    }
    else break;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main extends App {
  def gcd(x:Int,y:Int,cnt:Int):String = if(y>0) { if(x>=y) gcd(y,x%y,cnt+1) else gcd(x,y%x,cnt+1) } else x + " " + cnt

  var s = "0 0"
  while( {s=readLine.trim;s} != "0 0" ){
    val n = s.split(" ").map(_.toInt);val x = n(0);val y = n(1)
    println(gcd(x,y,0))
  }
}

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

int main() {
    int ans = 0;
    int n, m, a, b;
    int h[100000];
    bool good[100000] = {false};
    cin >> n >> m;
    for(int i=0; i<n; i++)
    {
        cin >> h[i];
    }
    for(int i=0; i<m; i++)
    {
        cin >> a >> b;
        if(h[a-1] > h[b-1])
        {
            good[b-1] = true;
        }
        else if(h[b-1] > h[a-1])
        {
            good[a-1] = true;
        }
        else 
        {
            good[a-1] = true;
            good[b-1] = true;
        }
    }

    for(int i=0; i<n; i++)
    {
        if(good[i] == false) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 4128
#include<bits/stdc++.h>
#define lld long long int
#define pb push_back
#define in insert
#define mod 1000000007
#define pi 3.14159265358979

using namespace std;

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

    lld n;
    cin>>n;
    vector<lld>v(n),c(n),ans_v;
    for(lld i=0;i<n;i++)cin>>v[i];
    for(lld i=0;i<n;i++)cin>>c[i];
    for(lld i=0;i<n;i++)
    {
        ans_v.pb(v[i]-c[i]);
    }
    sort(ans_v.begin(),ans_v.end());
    //for(lld i=0;i<n;i++)cout<<ans_v[i]<<' ';cout<<"\n";
    lld ans=0;
    for(lld i=n-1;i>=0;i--)
    {
        if(ans_v[i]<0)break;
        ans+=ans_v[i];
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	x := getInt()

	ans := (x / 11) * 2
	switch {
	case x%11 > 6:
		ans += 2
	case x%11 > 0:
		ans++
	}

	fmt.Println(ans)
}

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

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


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

const int MOD = 1000000007;
int main() {
  int N, M, a;
  unordered_set<int> broken;
  cin >> N >> M;

  for(int i = 0; i < M; i++) {
    cin >> a;
    broken.insert(a);
  }
  vector<long long> dp(N+1);
  dp[0] = 1;
  dp[1] = 1 - broken.count(1);

  for(int i = 2; i <= N; i++) {
    if(broken.count(i) == 0)
      dp[i] = (dp[i-1]+dp[i-2])%MOD;
  }
  cout << dp[N];
}




Measured memory_bytes: 5156
//https://atcoder.jp/contests/abc140/tasks/abc140_a
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	cout<<(n*n*n)<<"\n";
	return 0;
}

Measured memory_bytes: 3624
package main

import "fmt"

func main() {

	var (
		H int
		W int
		h int
		w int
	)

	fmt.Scan(&H, &W)
	fmt.Scan(&h, &w)

	S := H * W
	x := h * W
	y := w * (H - h)
	result := S - (x + y)

	fmt.Print(result)

}


Measured memory_bytes: 512
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	string s;
	cin >> s;
	int he, ta;
	REP(i,s.size()){
		if(s[i] == 'A'){
			he = i;
			break;
		}
	}
	for(int i = s.size()-1; i >= 0; i--){
		if(s[i] == 'Z'){
			ta = i;
			break;
		}
	}
	cout << ta-he+1 << endl;
}

Measured memory_bytes: 3748
#include <cstdio>
#include <vector>
#include <deque>

struct BFS
{
  size_t N;
  size_t M;
  std::vector<std::vector<size_t>> Graph;
  std::vector<size_t> dist;
  std::vector<std::vector<size_t>> distMap;
  std::deque<size_t> que;
  std::vector<size_t> arrow;

  BFS()
  {
    std::scanf("%lu %lu",&N,&M);
    
    Graph.resize(N);
    for(size_t i=0;i!=M;i++)
    {
      size_t j1,j2;
      std::scanf("%lu %lu",&j1,&j2);
      j1--;
      j2--;
      Graph[j1].push_back(j2);
      Graph[j2].push_back(j1);
    }

    dist.assign(N,-1);
    distMap.resize(N);
    arrow.assign(N,-1);
  }

  void find(size_t pos)
  {
    dist[pos]=0;
    distMap[dist[pos]].push_back(pos);
    que.push_back(pos);

    while(que.empty()==false)
    {
      pos=que.front();
      que.pop_front();

      for(size_t i=0;i!=Graph[pos].size();i++)
      {
        size_t nextPos=Graph[pos][i];

        if(dist[nextPos]!=-1)
          continue;

        dist[nextPos]=dist[pos]+1;
        distMap[dist[nextPos]].push_back(nextPos);
        que.push_back(nextPos);
        arrow[nextPos]=pos;
      }
    }
  }
};

int main()
{  
  BFS f;
  f.find(0);
  
  for(size_t i=1;i!=f.arrow.size();i++)
  {
    if(f.arrow[i]==-1)
    {
      std::printf("No\n");
      std::fflush(stdout);
      return 0;
    }
  }

  std::printf("Yes\n");
  for(size_t i=1;i!=f.arrow.size();i++)
  {
    std::printf("%lu\n",f.arrow[i]+1);
  }
  std::fflush(stdout);
  
  return 0;
}

Measured memory_bytes: 16588
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
int main() {
	int n;
	while (cin >> n, n) {
		int dp[300][300];
		int w[300];
		rep(i, n) {
			cin >> w[i];
		}
		rep(i, n) {
			dp[i][i] = 0;
			if (i < n - 1) {
				dp[i][i + 1] = 0;
				if (abs(w[i] - w[i + 1]) <= 1) {
					dp[i][i + 1] = 2;
				}
			}
		}
		Rep(l, 2,n) {
			rep(i, n - l) {
				int res = 0;
				Rep1(j, i, i + l-1) {
					res = max(res, dp[i][j] + dp[j+1][i + l]);
				}
				res = max(res, dp[i + 1][i + l - 1]);
				if (abs(w[i] - w[i + l]) <= 1 && dp[i + 1][i + l - 1] == l - 1) {
					res = l + 1;
				}
				dp[i][i + l] = res;
			}
		}
		cout << dp[0][n - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 3444
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
	ll n, a, b, h[100010], ma = 1e9, mi = 0;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++)cin >> h[i];
	while (ma - mi > 1) {
		ll mid = (ma + mi) / 2;
		ll cnt = 0;
		for (int i = 0; i < n; i++) {
			ll num = h[i] - mid * b;
			if (num <= 0)continue;
			cnt += num / (a - b);
			if (num % (a - b))cnt++;
		}
		if (cnt <= mid)ma = mid;
		else mi = mid;
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
int ceil(int a,int b){// a以上でｂの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){ //stoi関数の代用//
    return atoi(s.c_str());
}
int main(void){
    int a,b,w;
    cin>>w>>a>>b;
    if(a<=b && b<=a+w){
        cout<<"0"<<endl;
    }    
    else if(a<=b+w && b<=a){
        cout<<"0"<<endl;
    }
    else {
        if(b>a+w) cout<<b-(a+w)<<endl;
        else cout<<a-(b+w)<<endl;
    } 
    return 0;
}

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

int main(void)
{
	string str;

	while(cin >> str)
	{
		bool flag = true;

		for(int i = 0; i < str.size(); i++)
		{
			if(i%2 == 0)
			{
				if(str[i] != 'R' && str[i] != 'U' && str[i] != 'D')
				{
					flag = false;
					break;
				}
			}

			else
			{
				if(str[i] != 'L' && str[i] != 'U' && str[i] != 'D')
				{
					flag = false;
					break;
				}
			}
			
		}

		if(flag)
			cout << "Yes\n";
		if(!flag)
			cout << "No\n";
	}
}

Measured memory_bytes: 256
#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;

int main(void){
  string s; cin >> s;
  int ans = 0;
  for(int i = 1; i < s.size(); i++){
    if(s.at(i) == s.at(i-1)){
      if(s.at(i) == '1'){
        s.at(i) = '0';
      }
      else s.at(i) = '1';
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512