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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;
ll x[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n,k; cin >> n >> k;
	vll pos,neg;
	for(int i=0; i<n; i++){
		cin >> x[i];
		if(x[i]>0)pos.eb(x[i]);
		else neg.eb(abs(x[i]));
	}
	pos.eb(0); neg.eb(0);
	sort(all(pos));
	sort(all(neg));
	
	ll ans = 1e18;
	for(int i=0; i<=k; i++){
		int j=k-i;
		// i for pos, j for neg
		if(i>=pos.size()||j>=neg.size())continue;
		ll sm = min(pos[i],neg[j]);
		ll bg = max(pos[i],neg[j]);
		ans = min(sm*2+bg,ans);
	}
	cout << ans << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 2424
#include <iostream>
#include <algorithm>
#include <vector>

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

int main() {

    ll n,m ;
    cin >> n >> m ;

    if(m==1){
        cout << 0 << endl ;
        return 0 ;
    }
    ll ans = min(m/2,n) ;
    ll tmpc = m-ans*2 ;
    ans+= tmpc/4 ;


    cout << ans << endl ;

    return 0 ;
}


Measured memory_bytes: 3560
n,k=map(int,input().split())
P=list(map(int,input().split()))
S=[0]*(n+1)
S[1]=P[0]

for i in range(1,n):
    S[i+1]=S[i]+P[i]

ma=0
for i in range(k,n+1):
    s=S[i]-S[i-k]
    ma=max(ma,s)
print((ma+k)/2)

Measured memory_bytes: 71792
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	s = parseMap(split(chomp(readline()),""))
	a = Set{Int}()
	chk = zeros(Int,100)
	chks = zeros(Int,10) 
	for i in 1:n
		for j in 1:100
			if chk[j]==1
				push!(a,j*10+s[i]-1)
			end
		end
		for j in 1:10
			if chks[j] == 1
				chk[10*(j-1)+s[i]+1] = 1
			end
		end
		chks[s[i]+1] = 1
	end
	println(length(a))
end

main()

Measured memory_bytes: 114608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n];
            long sum = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                sum += a[i];
                if (i > 0) a[i] += a[i - 1];
            }
            long min = Long.MAX_VALUE;
            for (int i = 0; i < n - 1; i++) {
                min = Math.min(min, Math.abs(a[i] - (sum - a[i])));
            }
            out.println(min);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
struct union_find
{
    vector<int>parent;
    vector<int>rank;
    int forest;
    union_find(int n){
        parent = vector<int>(n+1);
        rank   = vector<int>(n+1);
        forest = n;
        for(int i=1;i<=n;i++){
            parent[i]=i;
            rank[i]=1;
        }
    }
    int find_parent(int child){
        if(child==parent[child])return parent[child];
        return parent[child]=find_parent(parent[child]); 
    }
    int merge(int x,int y){
        if(rank[x]>rank[y])swap(x,y);
        parent[x]=y;
        if(rank[x]==rank[y])rank[y]++;
    }
    bool union_set(int x,int y){
        x = find_parent(x),y=find_parent(y);
        if(x!=y){
            merge(x,y);
            forest--;
        }
        return x!=y;
    }
};
int a[N];
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    int x,y;
    union_find uf = union_find(n);
    for(int i=0;i<m;i++){
        scanf("%d %d",&x,&y);
        uf.union_set(a[x],a[y]);
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        if(uf.find_parent(a[i])==uf.find_parent(i))ans++;
    }
    printf("%d",ans);
    
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, K, Q;
bool vis[MAX];
vector<int> path;
vector<int> g[MAX];

bool dfs(int u) {
	vis[u] = true;
	path.push_back(u);
	if (u == N) {
		return true;
	}
	for (int i = 0; i < g[u].size(); ++i) {
		int v = g[u][i];
		if (vis[v]) continue;
		if (dfs(v)) return true;
	}
	path.pop_back();
	return false;
}

void dfs2(int u, int &cnt) {
	vis[u] = true;
	cnt += 1;
	for (int i = 0; i < g[u].size(); ++i) {
		int v = g[u][i];
		if (vis[v]) continue;
		dfs2(v, cnt);
	}
}

int main()
{
	int i, j, k, u, v;
	scanf("%d", &N);
	for (i = 0; i < N - 1; ++i) {
		scanf("%d%d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1);
	int len = path.size();
	memset(vis, 0, sizeof(vis));
	for (i = 0; i < path.size(); ++i) vis[path[i]] = true;
	vector<int> vec;
	for (i = 1; i < path.size() - 1; ++i) {
		int cnt = 0;
		dfs2(path[i], cnt);
		vec.push_back(cnt);
	}
	int a, b;
	a = b = 0;
	dfs2(1, a);
	dfs2(N, b);
	len -= 2;
	for (i = 0; i < vec.size(); ++i) {
		if (i < (len + 1) / 2) a += vec[i];
		else b += vec[i];
	}

	b += len / 2;
	a += (len + 1) / 2;
	if (a > b) printf("Fennec");
	else printf("Snuke");
}

Measured memory_bytes: 10104
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{   speed_up;
    int m, n, i, j, k, l;
    cin>>n>>m;
    vector<string> a(n), b(m);
    for(i = 0; i<n; i++)
    {
        cin>>a[i];
    }
    for(j = 0; j<m; j++)
    {
        cin>>b[j];
    }
    for(i = 0; i<n; i++)
    {
        for(j = 0; j<n; j++)
        {
            if(a[i][j]!= b[0][0]) continue;
            bool x = 1;
            for(k = 0; k<m; k++)
            {
                for(l = 0; l<m; l++)
                {
                    if(i+k>=n || j+l>=n || a[i+k][j+l]!=b[k][l])
                    {
                        x = 0;
                        break;
                    }
                }
                if(x == 0) break;

            }
             if(x)
                {
                    puts("Yes");
                    return 0;
                }

        }
    }
    puts("No");
    return 0;
}







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

int main() {
  int A;
  char p;
  int B;
  cin >> A >> p >> B;
  
  if(p=='+'){
    cout << A + B << endl;
  }
  
  if(p=='-'){
    cout << A - B << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;

int abs_val(int a, int b){return (a - b) > 0 ? (a - b) : (b - a);}

int main(){
    int n, k;
    int x[100] = {0};

    scanf("%d %d", &n, &k);
    for(int i = 0; i < n; ++i){
        scanf("%d", &x[i]);
    }

    int sum = 0;
    for(int i = 0; i < n; ++i){
        if(abs_val(k, x[i]) > abs_val(0, x[i])){
            sum += abs_val(0, x[i]) * 2;
        }else{
            sum += abs_val(k, x[i]) * 2;
        }
    }

    printf("%d\n", sum);

    return 0;
}


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

int main(){
  int n,m; cin>>n>>m;
  vector<int> a(n);
  for(int i=0; i<n; ++i)cin>>a[i];
  vector<pair<int,int>> cb(m);
  for(int i=0; i<m; ++i){
    int b,c; cin>>b>>c;
    cb[i]=make_pair(c,b);
  }

  sort(a.begin(),a.end());
  sort(cb.begin(),cb.end());

  int i=0;
  for(int j=m-1; j>=0; --j){
    for(int k=0; k<cb[j].second; ++k){
      if(a[i]<cb[j].first){
        a[i]=cb[j].first;
        ++i;
      }else goto end;
    }
  }

  end:;
  long long ans=0LL;
  for(int i=0; i<n; ++i)ans+=a[i];
  cout<<ans<<endl;
  
}


Measured memory_bytes: 1408
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    print(S()[:3])
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 76628
#include <bits/stdc++.h>
using namespace std;
int main() {
  int c=0;
  string s;
  cin >>s;
  
  int n = s.size();
  
  for(int i=0;i<n/2;i++){
    if(s.at(i)!=s.at(n-1-i))c++;
  }
  
  cout << c << endl;
}

Measured memory_bytes: 256
/*
                       _oo0oo_
                      o8888888o         BE LIKE BUDDHA
                      88" . "88         KEEP CALM AND CODE HARD.
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  AVINASH PRASAD 
  DATE:/10/2019
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    long long int n;
    cin >> n;
    cout << n*n << endl;
    return 0;
}

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

using namespace std;

int main(){

    string s,p;
    int flag=0;

    cin >> s >> p;

    for(int i=0;i<s.size();i++ ){
        if(flag == 1){break;}
        if(s[i] != p[0] ){continue;}
        for(int j=0;j<p.size();j++){
            if(p[j] != s[(i+j)%(s.size())]){break;}
            if(j == p.size()-1){flag=1;}
        }
    }

    cout << ((flag)? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3152
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;
#define ts(x)                       to_string(x)
#define ti(x)                       stoi(x)
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define mine(v)                     *min_element(all(v))
#define maxe(v)                     *max_element(all(v))
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define SIZE(x)                     (int)x.size()
#define endl                        "\n"

//template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll input(){ll n; cin >> n ; return n;}

//void add(int I, int value){seg[I += MAXN] = value;for (I >>= 1; I; I >>= 1){seg[I] = __gcd(seg[I << 1], seg[I << 1 | 1]);}}

//int query(int l, int r){int ans = seg[l + MAXN];for (l += MAXN, r += MAXN + 1; l < r; l >>= 1, r >>= 1){if(l & 1) ans = __gcd(ans, seg[l ++]);if(r & 1) ans = __gcd(ans, seg[-- r]);}return ans;}

string base2(ll n){string a = "";while(n >= 2){a += (char)(n % 2 + '0');n /= 2;}a += (char)(n + '0');reverse(all(a));return a;}

const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;

ll pw(ll a , ll b, ll mod)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % mod, b / 2, mod)) % mod : pw(a * a % mod, b / 2, mod))); }

int v[MAXN];

bool dp[MAXN];

int main(){
    fast_io;
    //cout << fixed << setprecision(15);
    //scanf("%d %d %f %lld %s %c", &x);
    //printf("%d %d %f %lld %s %c", x);
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        cin >> v[i];
    }
    for(int i = 1; i <= k; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if(v[j] <= i)
            {
                if(dp[i - v[j]] == 0)
                {
                    dp[i] = 1;
                }
            }
        }
    }
    cout << ((dp[k])? "First" : "Second");
    return 0;
}

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

using namespace std;
using LL = long long;

const LL MOD = (LL)1e9 + 7;
const int MAXN = 2000010;

LL K, N;
string S;

LL fat[MAXN], ifat[MAXN];

LL mul(LL a, LL b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}

LL add(LL a, LL b) {
    return ((a % MOD) + (b % MOD)) % MOD;
}

LL fexp(LL b, LL e) {
    if (b == 0 || e == 1) return b;
    if (b == 1 || e == 0) return 1;
    LL r = fexp(b, e / 2);
    if (e & 1) return mul(mul(r, r), b);
    return mul(r, r);
}

void build() {
    fat[0] = 1;
    for(int i = 1; i < MAXN; ++i)
        fat[i] = mul(i, fat[i - 1]);

    ifat[MAXN - 1] = fexp(fat[MAXN - 1], MOD - 2);

    for(int i = MAXN - 2; i >= 0; --i)
        ifat[i] = mul(i + 1, ifat[i + 1]);
}

LL comb(LL n, LL r) { 
    if (n < r) return 0; 
    return mul(fat[n], mul(ifat[r], ifat[n - r])); 
}

void solver() {
    build();

    cin >> K >> S;
    N = S.length();

    LL end = N + K;

    LL ans = 0;
    for(LL i = N; i <= end; ++i) 
        ans = add(ans, mul(comb(end, i), fexp(25, end - i)));
    
    cout << ans << '\n';

}

int main() {

    ios_base :: sync_with_stdio(0); cin.tie(NULL);

    int t = 1;
    //cin >> t;
    
    while(t--)
        solver();

    return 0;
}

Measured memory_bytes: 35340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,T,min;
    cin >> N >> T;
  min = 99999998;
  vector<int>c(N);
  vector<int>t(N);
  for(int i = 0; i < N; i++){
    cin >> c.at(i) >> t.at(i);
  }
  for(int i = 0; i < N; i++){
    if(t.at(i) <= T){
      if(min > c.at(i)){
        min = c.at(i);
      }
    }
  }
  if(min == 99999998){
  cout << "TLE" << endl;
  }else{
    cout << min << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>

 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no

//    auto start = chrono::steady_clock::now()

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readstring(s); readstring(t_);
        int ret = s.size();
        forr(i,0,s.size()-t_.size()+1) {
            int ct = 0;
            forr(j,0,t_.size()) {
                ct += (t_[j]!=s[i+j]);
            }
            ret = min(ret,ct);
        }
        cout << ret << endl;
    }

//    auto end = chrono::steady_clock::now();
//    cerr << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;

    return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
const int N=5e5+4;
int n,m;
int root[N],sum[N*50],lc[N*50],rc[N*50];
int tim;
map<int,int> mp;
inline int read() {
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
inline void build(int &rt,int l,int r) {
	rt=++tim;
	sum[rt]=0;
	if (l==r) return ;
	int mid=l+r>>1;
	build(lc[rt],l,mid);
	build(rc[rt],mid+1,r);
}
inline void init() {
	tim=0;
	mp.clear();
	n=read(),m=read();
	build(root[0],1,n);
}
inline void modify(int &rt,int pre,int l,int r,int pos,int val) {
	rt=++tim;
	sum[rt]=sum[pre]+val;
	if (l==r) return ;
	lc[rt]=lc[pre];
	rc[rt]=rc[pre];
	int mid=l+r>>1;
	if (pos<=mid) modify(lc[rt],lc[pre],l,mid,pos,val);
	else modify(rc[rt],rc[pre],mid+1,r,pos,val);
	sum[rt]=sum[lc[rt]]+sum[rc[rt]];
}
inline int query(int rt,int l,int r,int pos) {
	if (l==r) return sum[rt];
	int mid=l+r>>1;
	if (mid<pos) return query(rc[rt],mid+1,r,pos);
	else return sum[rc[rt]]+query(lc[rt],l,mid,pos);
}
int main() {
	int kase=1;
	while (kase--) {
		init();
		for (register int i=1;i<=n;++i) {
			int x=read();
			if (!mp.count(x)) {
				modify(root[i],root[i-1],1,n,i,1);
			} else {
				int temp;
				modify(temp,root[i-1],1,n,mp[x],-1);
				modify(root[i],temp,1,n,i,1);
			}
			mp[x]=i;
		}
		while (m--) {
			int x=read(),y=read();
			printf("%d\n",query(root[y],1,n,x));
		}
	}
	return 0;
}

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

bool prime(int x){
  for(int i=2;i*i<=x;i++){
    if(x%i==0){
        return false;
    }
  }
  return true;
}

int main(){
  int X,n;
  cin >> X;
  n = X;
  while(!prime(n)){
      n++;
  }
  cout << n;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N, x; cin >> N >> x;
    vector<int> A(N);
    REP(i, 0, N) cin >> A[i];

    sort(ALL(A));

    int ans = 0;
    REP(i, 0, N) {
        if (x >= A[i]) {
            x -= A[i];
        } else {
            cout << i << endl;
            return 0;
        }
    }

    if (x == 0) cout << N << endl;
    else cout << N - 1 << endl;

    return 0;
}

Measured memory_bytes: 256
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 1e18
idx = 0
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)


Measured memory_bytes: 3064
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    n = int(input())
    l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    arr = []
    for x in l:
        for y in l:
            arr.append(x*y)

    if n in arr:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
    1


Measured memory_bytes: 3060
N = int(input())
B = list(map(int, input().split()))
S = 0

for i in range(N):
    if i == 0:
        S += B[0]
    elif i == N-1:
        S += B[N-2]
    else:
        S += min(B[i], B[i-1])

print(S)

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

int main(){
  int N, M;
  cin >> N >> M;
  int a, b;
  vector<int> c(N);
  for (int i=0; i<M; i++) {
    cin >> a >> b;
    for (int j=0; j<N; j++) {
      if (a == j+1 || b == j+1)
        c.at(j)++;
    }
  }
  for (int i=0; i<N; i++) {
    cout << c.at(i) << endl;
  }
}

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

int main(){
 	long long n,m,sum = 0;
  	cin>>n>>m;
  	long long a[m];
  	for(int i = 0;i <m ; i++)
    {
      cin>>a[i];
      sum += a[i];
      }
  	if(sum>n)cout<<-1;
  	else cout<<n-sum;
  
}

Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define INF 1000000007
#define MOD 1000000007
#define MAX_N 105
#define ARRAY_MAX 1005

char mp[ARRAY_MAX][ARRAY_MAX];
int dp[ARRAY_MAX][ARRAY_MAX];
int h,w;

int main(){

    cin >> h >> w;
    REP(i,h){
        REP(j,w){
            cin >> mp[i][j];
        }
    }

    int index;
    REP(i,ARRAY_MAX){
        if(mp[0][i] == '.'){
            dp[0][i] = 1;
        }else{
            index = i;
            break;
        }
    }
    for(int i = index;i < ARRAY_MAX;i++){
        dp[0][i] = 0;
    }
    REP(i,ARRAY_MAX){
        if(mp[i][0] == '.'){
            dp[i][0] = 1;
        }else{
            index = i;
            break;
        }
    }
    for(int i = index;i < ARRAY_MAX;i++){
        dp[i][0] = 0;
    }
    for(int i = 1;i < h;i++){
        for(int j = 1;j < w;j++){
            if(mp[i][j] == '#'){
                dp[i][j] = 0;
            }else{
                dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
            }
        }
    }

    cout << dp[h-1][w-1] << endl;


    return 0;
}

Measured memory_bytes: 5120
class Dice:
    """サイコロを操作するクラス"""
    def __init__(self, num):
        self.num = num
    def roll_north(self):
        tmp = self.num[:]
        self.num[0] = tmp[1]
        self.num[1] = tmp[5]
        self.num[4] = tmp[0]
        self.num[5] = tmp[4]
    def roll_south(self):
        tmp = self.num[:]
        self.num[0] = tmp[4]
        self.num[1] = tmp[0]
        self.num[4] = tmp[5]
        self.num[5] = tmp[1]
    def roll_east(self):
        tmp = self.num[:]
        self.num[0] = tmp[3]
        self.num[2] = tmp[0]
        self.num[3] = tmp[5]
        self.num[5] = tmp[2]
    def roll_west(self):
        tmp = self.num[:]
        self.num[0] = tmp[2]
        self.num[2] = tmp[5]
        self.num[3] = tmp[0]
        self.num[5] = tmp[3]
    def print_dice(self):
        print(self.num)
    def print_top(self):
        print(self.num[0])

num = list(map(int, input().split()))
dice = Dice(num)
for i in input():
    if i == "N":
        dice.roll_north()
    elif i == "S":
        dice.roll_south()
    elif i == "E":
        dice.roll_east()
    elif i == "W":
        dice.roll_west()
    else:
        print("input error")
dice.print_top()



Measured memory_bytes: 5612
#include <stdio.h>
void spin1(int a[]);
void spin2(int a[]);
void spin3(int a[]);

int main(void){
	int d[6],q,u,f,i;
	for(i=0;i<6;i++){
		scanf("%d",&d[i]);
	}
	scanf("%d",&q);
	while(q--){
		scanf("%d %d",&u,&f);
		if(d[0]==u||d[1]==u||d[5]==u||d[4]==u){
			while(d[0]!=u)
				spin1(d);
			while(d[1]!=f)
				spin2(d);
		}
		else{
			while(d[0]!=u)
				spin3(d);
			while(d[1]!=f)
				spin2(d);
		}
		printf("%d\n",d[2]);
	}
	
	return 0;
}

void spin1(int a[]){
	int t=a[0];
	a[0]=a[4];
	a[4]=a[5];
	a[5]=a[1];
	a[1]=t;
}
void spin2(int a[]){
	int t=a[1];
	a[1]=a[2];
	a[2]=a[4];
	a[4]=a[3];
	a[3]=t;
}
void spin3(int a[]){
	int t=a[0];
	a[0]=a[2];
	a[2]=a[5];
	a[5]=a[3];
	a[3]=t;
}



Measured memory_bytes: 2032
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int N;
	cin >> N;
	int S[N];
	char buf;
	int ret=N+1,cnt=0;
	scanf("%c",&buf);
	REP(i,N){
		scanf("%c",&buf);
		S[i] = (buf=='E') ? 1 : 0;
		cnt+= S[i];
	}
	cnt -= S[0];
	ret = cnt;
	errln(cnt);
	FOR(i,1,N-1){
		cnt = cnt - S[i] + (1- S[i-1]);
		ret = min(cnt,ret);
		errln(cnt);
	}
	println(ret);
}


Measured memory_bytes: 1408
import java.util.Scanner

object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val a, b, c = sc.nextInt()

    //val h = for (_ <- 0 until n) yield sc.nextInt()
    (a, b, c)
  }

  def solve(n: Int): Int = {
    0
  }


  def main(args: Array[String]): Unit = {
    val (a, b, c) = read()
    if ((a < c && c < b) ||(b < c && c < a)) {
      println("Yes")
    } else {
      println("No")
    }
  }

}

Measured memory_bytes: 25800
#![allow(unused)]

use proconio::input;
use proconio::marker::{Bytes, Chars, Usize1};
use std::cmp::{Reverse, min, max};
use itertools::Itertools;

#[proconio::fastout]
fn main() {
    input! {
        n: usize,
        ps: [Usize1; n * n],
    }

    let mut costs = vec![0; (n + 2).pow(2)];
    let mut exited = vec![false; (n + 2).pow(2)];

    for x in 1..=n {
        for y in 1..=n {
            costs[x * (n + 2) + y] = min(min(x - 1, n - x), min(y - 1, n - y));
        }
    }

    let mut ans = 0;
    for p in ps {
        let x = p / n;
        let y = p % n;
        let p = (x + 1) * (n + 2) + (y + 1);

        exited[p] = true;
        ans += costs[p];

        let mut q = vec![p];
        while let Some(p1) = q.pop() {
            let c = costs[p1] + if exited[p1] { 0 } else { 1 };
            for &p2 in &[p1 - 1, p1 + 1, p1 - (n + 2), p1 + (n + 2)] {
                if costs[p2] > c {
                    costs[p2] = c;
                    q.push(p2);
                }
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 8628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,p,q,ct,x,z;
    string s;
    char c;
    map<char,ll>mp;
    cin>>s;
    for(ll i=0;i<s.size();i++)
    {
        c=s[i];
        mp[c]++;
    }
    ct=0;
    for(char i=65;i<=90;i++)
    {
        p=mp[i];
        if(p==2) ct++;
    }
    if(ct==2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int x,y;
    cin>>x>>y;
    if(y%2) cout<<"No";
    else {
        for(int i=0;i<=100;i++) {
            for(int j=0;j<=100;j++) {
                if(i+j==x) {
                    if(i*2+j*4==y) {
                        cout<<"Yes";
                        return;
                    }
                }
            }
        }
        cout<<"No";
    }

}


int main()
{
    fastio;
    int t;

    t = 1;
    //cin >> t;
    //int test=t;
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	string a,b,c; cin>>a>>b>>c;
  reverse(all(a));
  reverse(all(b));
  reverse(all(c));
  char k='a';
  char ans;
  while(true){
    if(k=='a'){
      if(a.empty()){
        ans='A';
        break;
      }
      k=a[a.size()-1];
      a.pop_back();
    }
    else if(k=='b'){
      if(b.empty()){
        ans='B';
        break;
      }
      k=b[b.size()-1];
      b.pop_back();
    }
    else{
      if(c.empty()){
        ans='C';
        break;
      }
      k=c[c.size()-1];
      c.pop_back();
    }
  }
    cout<<ans<<endl;
      
    
  
	
	
	return 0;
}

Measured memory_bytes: 3612
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
a = rl()
t = 1
for i in a:
    if i&1==0:
        t*=2
print(3**n-t)














Measured memory_bytes: 27092
import java.util.Scanner;

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

		int X = sc.nextInt();
		int ans = 0;
		
		for (int i = 1; i < 33; i++){
			
			int tmp = i;
			
			for (int j = 0; j < 9; j++){
				tmp *= i;
				
				if (ans < tmp && tmp <= X){
					ans = tmp;
			}
			
			}

		}
		
		System.out.println(ans);

	}
}

Measured memory_bytes: 23892
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;

int gcd(int a, int b) {
	if (a < b) swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}


ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

int D, N;

int main() {
	cin >> D >> N;
	if (N == 100) N++;
	cout << beki(100, D) * N << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n, a, b,max,min;
    scanf("%d %d %d",&n,&a,&b);

    if(a+b<=n){
        min = 0;
    }else{
        min = a+b-n;
    }
    if(a<b){
        max = a;
    }else if(a>=b){
        max = b;
    }

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

Measured memory_bytes: 128
/*
Who are you ? And what are you doing here ??
╭━┳━╭━╭━╮╮
┃┈┈┈┣▅╋▅┫┃      
┃┈┃┈╰━╰━━━━━━╮
╰┳╯┈┈┈┈┈┈┈┈┈◢▉◣
╲┃┈┈┈┈┈┈┈┈┈▉▉▉ 
╲┃┈┈┈┈┈┈┈┈┈◥▉◤ 
╲┃┈┈┈┈╭━┳━━━━╯
╲┣━━━━━━┫﻿

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <sstream>
#include <cstring>
#include <numeric>
#include <ctime>
#include <cassert>
#include <random>
#include <valarray>
//#include <fstream>
#define re return
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define y0 y32479
#define y1 y95874
#define next next239
#define prev prev239
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define ba back()
#define popcount __builtin_popcountll
#define fastIO()                 \
    {                            \
        ios::sync_with_stdio(0); \
        cin.tie(0);              \
        cout.tie(0);             \
    }
#define in(x) \
    int x;    \
    cin >> x;
#define in1(x) \
    int x;     \
    cin >> x;  \
    x--;
#define inll(x) \
    ll x;       \
    cin >> x;
#define ins(x) \
    string x;  \
    cin >> x;

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef pair<double, double> pdd;
typedef long double LD;
typedef double D;

bool checkp(string s)
{
    bool flag=true;
    int n=s.length();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            flag=false;
            break;
        }
    }
    return flag;
}

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

    //cout<<s.substr(0,(s.length()-1)/2)<<"\n"<<s.substr((s.length()+2)/2,s.length())<<endl;

    if(checkp(s) && checkp(s.substr(0,(s.length()-1)/2)) && checkp(s.substr((s.length()+2)/2,s.length())))
        cout<<"Yes"<<endl;
    else
    {
            cout<<"No"<<endl;
    }
    

    return 0;
}

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

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

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

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

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

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

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

void main()
{
    long A, B, C;
    scan(A, B, C);

    solve(A, B, C).writeln();
}

long solve(long A, long B, long C)
{
    if (C <= B)
    {
        return C + B;
    }

    long result;

    result += 2 * B;
    C -= B;
    result += min(C, A);
    C -= A;
    if (0 < C)
    {
        result++;
    }
    return result;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


Measured memory_bytes: 32708
//sunuke さんのコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);++i)
#define chmax(x,y) x=max(x,y)
const ll INF = 1e18;
ll dp[200001][4]; // [N][skip]

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

  rep(i, N+1) dp[i][0] = dp[i][1] =  dp[i][2] =-INF;
  dp[0][0] = 0;

  rep(i, N){

		chmax(dp[i+1][1], dp[i][0]);
		chmax(dp[i+1][0], dp[i][0] + ((i+0)%2? 0:A[i]));

		chmax(dp[i+1][2], dp[i][1]);
		chmax(dp[i+1][1], dp[i][1] + ((i+1)%2? 0:A[i]));

		chmax(dp[i+1][3], dp[i][2]);
		chmax(dp[i+1][2], dp[i][2] + ((i+2)%2? 0:A[i]));

  }

  cout << dp[N][N%2+1] << endl;

	// // print =====================
	// puts("---");//
	// rep(i,N)cout<<A[i]<<" ";//
	// puts("");//
	// puts("===");//
	// cout<<"i: ";
	// rep(i,N+1) printf("%5d ",i);//
	// puts("");//
	// rep(j,skip+1){
	// 	cout<<j<<": ";
	// 	rep(i,N+1){
	// 		if(dp[i][j] == -INF) cout<<"----- ";
	// 		else printf("%5lld ",dp[i][j]);
	// 	}
	// 	puts("");
	// }
	// puts("===");//
	// rep(i,N+1){
	// 	cout<<i<<": ";
	// 	rep(j,skip+1){
	// 		if(dp[i][j] == -INF) cout<<"----- ";
	// 		else printf("%5lld ",dp[i][j]);
	// 	}
	// 	puts("");
	// }
	// // ===========================

}


Measured memory_bytes: 10384
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static final int HIT = 0; // ??????????????????????????????
    public static final int BLOW = 1; // ??????????????????????????????

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

	Scanner sc = new Scanner(System.in);
	ArrayList<int[]> outList = new ArrayList<>();

	while (sc.hasNextLine()) {
	    int[] answer = getNumberArray(sc.nextLine().split(" ")); // ?????????????????????

	    int[] expected = getNumberArray(sc.nextLine().split(" ")); // ?§£??????????????????

	    int[] hitAndBlow = getHitAndBlow(answer, expected);

	    outList.add(hitAndBlow);
	}

	for (int[] hitAndBlow : outList) {
	    System.out.println(hitAndBlow[HIT] + " " + hitAndBlow[BLOW]);
	}
	sc.close();
    }

    /**
     * ??\???????????????????????????0???9???????????????????????????????????????????´??????????????????????
     * 
     * @param input
     * @return
     */
    public static int[] getNumberArray(String[] input) {
	int[] numbers = new int[10]; // 0???9?????°????????¶????????¨?????????
	Arrays.fill(numbers, 0); // 0??§?????????
	// ???????????°????????????????????????
	// ??????????????°????????????????????????????????????????????±??????????????????
	for (int i = 0; i < input.length; i++) {
	    // ???????????????????????????
	    int num = Integer.parseInt(input[i]);

	    for (int j = 0; j < 10; j++) {
		if (num == j) {
		    numbers[j] = i + 1;
		}
	    }
	}
	return numbers;
    }

    /**
     * ?????? ????????¨?§£????????¢???????????§?????????????????¨?????????????????????????´????????????????????????????
     * 
     * @param answer
     * @param expected
     * @return hitandblow?????????
     */
    public static int[] getHitAndBlow(int[] answer, int[] expected) {

	int[] hitAndBlow = new int[2]; // 0???hit 1???blow

	for (int i = 0; i < 10; i++) {
	    if (answer[i] == 0) {
		continue;
	    }
	    if (answer[i] == expected[i]) {
		hitAndBlow[HIT]++;
		continue;
	    }

	    if (answer[i] != 0 && expected[i] != 0) {
		hitAndBlow[BLOW]++;
		continue;
	    }
	}

	return hitAndBlow;
    }
}

Measured memory_bytes: 26092
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long pow_mod(long long n,long long k,long long m){
    if (k == 0){
        return 1;
    } else if (k % 2 == 1){
        return pow_mod(n,k-1,m)*n % m;
    } else {
        long long t = pow_mod(n,k/2,m);
        return t*t % m;
    }
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_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 || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
    long long a,b;
    while(cin >> a >> b){
        cout << GCD(max(a,b),min(a,b)) << " " << LCM(max(a,b),min(a,b)) << endl;
    }
}


Measured memory_bytes: 3032
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

long long gcd(long long a, long long b) {
  long long r = 1;
  while (r != 0) {
    r = a%b;
    a = b;
    b = r;
  }
  return a;
}

ll comb(int n, int r) {
  if (n < r) {
    return 0;
  }
  if (n == r) {
    return 1;
  }
  vector<int> cb(r);
  rep(i, r) {
    cb.at(i) = n-i;
  }
  vector<int> cc(r);
  rep(i, r) {
    cc.at(i) = i+1;
  }

  rep(i, r) {
    rep(j, r) {
      int g = gcd(cb.at(j), cc.at(i));
      if (g > 1) {
        cb.at(j) /= g;
        cc.at(i) /= g;
      }
      if (cc.at(i) == 1) break;
    }
  }

  ll ans2 = 1;
  rep(i, r) {
    ans2 = ans2 * cb.at(i);
  }
  return ans2;
}

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

  int N, a, b; cin >> N >> a >> b;
  vector<ll> v(N);
  rep(i, N) {
    cin >> v.at(i);
  }
  sort(v.rbegin(), v.rend());

  ll sum = 0;
  rep(i, a) {
    sum += v.at(i);
  }
  double ans1 = (double)sum/a;
  cout << std::fixed << std::setprecision(6) << ans1 << endl;

  ll min = v.at(a-1);
  int r = 0;
  int n = 0;
  rep(i, a) {
    if (v.at(i) == min) {
      r++;
      n++;
    }
  }

  for(int i=a; i<N; i++) {
    if (v.at(i) == min) {
      n++;
    }
  }

  //debug(n); debugln(r);

  if (v.at(0) != min) {
    cout << comb(n,r) << endl;
    return 0;
  }
  
  //special case
  ll ans = 0;
  for(int r = a; r <= b; r++) {
    ans += comb(n,r);
    //debug(n); debug(r); debugln(comb(n,r));
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(lli i=a; i<b; i++)
#define loopb(i, a, b) for(lli i=a; i>=b; i--)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli power(lli x, lli y){
    lli res = 1;
    x = x ;
    while (y > 0) {
        if (y & 1)
            res = (res*x) ;
        y = y>>1;
        x = (x*x);
    }
    return res;
}
lli solve(){
	string s;
	cin>>s;
	if(s == "MON")	cout<<6;
	else if(s == "TUE")	cout<<5;
	else if(s == "WED")	cout<<4;
	else if(s == "THU")	cout<<3;
	else if(s == "FRI")	cout<<2;
	else if(s == "SAT")	cout<<1;
	else	cout<<7;
}
int main(){
	fastio;
	lli t;
//	cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}

Measured memory_bytes: 764
#include<stdio.h>
int main()
{
	int x[301]={0},i,j;
	for(i=1;i<18;++i)for(++x[i*i],j=0;j+i*i<301;++j)x[j+i*i]+=x[j];
	while(scanf("%d",&i),i)printf("%d\n",x[i]);
	return 0;
}

Measured memory_bytes: 0