akhauriyash/Code-Regression huggingface dataset:
import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n, p = read_ints()
    a = read_int_list()
    for x in a:
        if x % 2 == 1:
            print(pow(2, n - 1))
            break
    else:
        print(0 if p == 1 else pow(2, n))

if __name__ == '__main__':
    Main()

Measured memory_bytes: 9220
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int n, m = 0;
	long long sum = 0;
	char str[20];
	long long int ss[5];
	memset(ss, 0, sizeof(ss));
	cin >> n;
	for (int i = 0;i < n;i++)
	{
		cin >> str;
		if (str[0] == 'M')
			ss[0]++;
		else if (str[0] == 'A')
			ss[1]++;
		else if (str[0] == 'R')
			ss[2]++;
		else if (str[0] == 'C')
			ss[3]++;
		else if (str[0] == 'H')
			ss[4]++;
	}
	for (int i = 0;i < 5;i++)
		if (ss[i])m++;
	for (int i = 0;i < 5;i++)
	{
		for (int p = i + 1;p < 5;p++)
		{
			for (int k = p + 1;k < 5;k++)
			{
				if (ss[i] && ss[p] && ss[k])
					sum += ss[i] * ss[p] * ss[k];
			}
		}
	}
	printf("%lld", sum);
	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define REP(i, n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()

using namespace std;


class BKagamiMochi {
public:
    ll N;
    set<ll> s;

    void solve(std::istream& in, std::ostream& out) {
        in >> N;
        REP(i, N) { ll tmp; in >> tmp; s.insert(tmp); }
        out << s.size() << endl;
    }
};


int main() {
    BKagamiMochi solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin >> n;
	ll ans = n;
	for (int i = 0; i < n - 1; ++i) {
		int u, v; cin >> u >> v;
		if (u > v) swap(u, v);
		ans += 1LL * (i + 1) * (n - i);
		ans -= 1LL * u * (n - v + 1);
	}
	cout << ans << '\n';
}

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

int main() {
  int n, a;
  cin >> n >> a;
  cout << n * n - a << endl;
  return 0;
}

Measured memory_bytes: 256
function Main( input ){

	var a = 'No', i = 1, l = 10;
	for( ; i < l; i = ( i + 1 )|0 ){
		var r = input / i;
		if( Number.isInteger( r ) && r < 10 ){
			a = 'Yes';
			break;
		}
	}
	console.log( a );
	
}

Main( require( 'fs' ).readFileSync( '/dev/stdin', 'utf8' ) );

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m,q;
vi g[125252];
pii query[125252];
int qc[125252];

int color[125252];
int dist[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int a,b;
    scanf("%d%d",&a,&b);
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  scanf("%d",&q);
  REP(i,q){
    int v,d,c;
    scanf("%d%d%d",&v,&d,&c);
    --v;
    query[q-1-i] = pii(v,d);
    qc[q-1-i] = c;
  }
  REP(i,n)dist[i] = -1;
  REP(i,q){
    int qv = query[i].first;
    int qd = query[i].second;
    int c = qc[i];
    if(dist[qv] >= qd)continue;
    dist[qv] = qd;
    queue<pii> Q;
    Q.push(pii(qv,qd));
    while(!Q.empty()){
      int p = Q.front().first;
      int d = Q.front().second;
      Q.pop();
      if(color[p]==0)color[p] = c;
      if(d>0)for(int to : g[p]){
        if(dist[to] >= d-1)continue;
        dist[to] = d-1;
        Q.push(pii(to,d-1));
      }
    }
  }
  REP(i,n)printf("%d\n",color[i]);
  return 0;
}


Measured memory_bytes: 9736
#include <vector>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

void make_fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

void input_from_file() {
    freopen("input.inp", "r", stdin);
}

typedef long long cc;

/*
    This is the end of template
*/

cc res = 0;
string s;

void print() {

}

void reset() {

}

void read_inp() {
    cin >> s;
}

void init() {
    s = '<' + s;
    s += '>';
}

cc sum(int x) {
    return 1ll * x * (x + 1) / 2;
}

void solve() {
    int n = s.length();
    for (int i = 1; i < n; i++) {
        if (s[i] == '>' && s[i - 1] == '<') {
            int cnt_open = 0;
            for (int j = i - 1; j > 0; j--) {
                if (s[j] == '>') break;
                cnt_open++;
            }
            int cnt_close = 0;
            for (int j = i; j < n - 1; j++) {
                if (s[j] == '<') break;
                cnt_close++;
            }
//            cout << cnt_open << " " << cnt_close << "\n";
            i += cnt_close;
            if (cnt_open > cnt_close) {
                swap(cnt_open, cnt_close);
            }
            res += sum(cnt_open - 1);
            res += sum(cnt_close);
        }
    }
}

void get_result() {
    cout << res;
}

int main() {
    make_fast_io();
//    input_from_file();
    read_inp();
    init();
    solve();
    get_result();
    return 0;
}


Measured memory_bytes: 1308
import java.io.*;

class Main
{
    public static void main (String[ ] args) throws Exception
    {
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        
        String str = br.readLine();
        String[] strArr = (br.readLine()).split(" ");
        
        for(int i = strArr.length - 1; i >= 0; i--)
        {
            if(0 != i)
            {
                System.out.print(strArr[i] + " ");
            }
            else
            {
                System.out.print(strArr[i]);
            }
        }
        System.out.println();
    }
}

Measured memory_bytes: 24352
N=int(input())

count=0
for M in range(1,N+1):
	lis=[]
	if M%2==1:
		for i in range(1,M+1):
			if M/i == M//i:
				lis.append(i)

		if len(list(set(lis))) == 8:
			count+=1

print(count)

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

int T;
lint A, B, C, D;

int main()
{
    cin >> T;
    for (int t = 0; t < T; t++)
    {
        cin >> A >> B >> C >> D;
        C++;
        if (B > D || A < B)
        {
            cout << "No" << endl;
        }
        else
        {
            A = A - (A - C - 1) / B * B;
            lint rem = A - C;
            lint gcd = __gcd(B, D);
            lint remmin = rem - rem / gcd * gcd;
            // cout << rem << " " << gcd << " " << remmin << endl;
            if (remmin + C >= B)
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }
        }
    }
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main()
{
  string s; cin >> s;
  if (s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <limits.h>
using namespace std;

void north(int* faces) {
	int tmp[7];

	//top(1) to back(5)
	tmp[5] = faces[1];

	//front(2) to top(1)
	tmp[1] = faces[2];

	//right(3) to right(3)
	tmp[3] = faces[3];

	//left(4) to left(4)
	tmp[4] = faces[4];

	//back(5) to bottom(6)
	tmp[6] = faces[5];

	//bottom(6) to front(2)
	tmp[2] = faces[6];

	memcpy(faces, tmp, sizeof(tmp));

}
void west(int* faces) {
	int tmp[7];

	//top(1) to left(4)
	tmp[4] = faces[1];

	//front(2) to front(2)
	tmp[2] = faces[2];

	//right(3) to top(1)
	tmp[1] = faces[3];

	//left(4) to bottom(6)
	tmp[6] = faces[4];

	//back(5) to back(5)
	tmp[5] = faces[5];

	//bottom(6) to right(3)
	tmp[3] = faces[6];

	memcpy(faces, tmp, sizeof(tmp));

}
bool check(int* faces, int* taget, int frontNum) {

	int tmp[7];
	for (int i = 1; i < 7; i++)
	{
		tmp[i] = faces[i];
	}

	tmp[frontNum] = INT_MAX;


	if (frontNum == 3 || frontNum == 4) west(tmp);

	while (true)
	{
		north(tmp);
		if (tmp[2] == INT_MAX)break;
	}
	tmp[2] = faces[frontNum];



	for (int i = 1; i < 7; i++)
	{
		if (tmp[i] != taget[i]) break;
		if (i == 6) return true;
	}

	for (int i = 0; i < 3; i++)
	{
		west(tmp);
		for (int j = 1; j < 7; j++)
		{
			if (tmp[j] != taget[j]) break;
			if (j == 6) return true;
		}
	}


	return false;
}

bool dice(int *faces, int *taget, int front) {

	for (int i = 1; i < 7; i++)
	{
		if (faces[i] == front) {
			if (check(faces, taget, i)) return true;
		}
	}



	return false;
}


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

	int faces[100][7];

	for (int i = 0; i < diceNum; i++)
	{
		for (int j = 1; j < 7; j++)
		{
			cin >> faces[i][j];
		}
	}

	for (int i = 0; i < (diceNum - 1); i++)
	{
		for (int j = i; j < (diceNum - 1); j++)
		{
			if (dice(faces[j+1],faces[i],faces[i][2]))
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}


	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int n;
  cin >> n;

  int ans = 1;
  int maxH;
  cin >> maxH;

  REP(i, n-1) {
    int tmp;
    cin >> tmp;
    if(tmp >= maxH) {
      ans++;
    }
    maxH = max(tmp, maxH);
  }

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


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

const int N = 1e5 + 5;
int n;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    for (int i = 0; i < n; i++){
        if(i == 0)a[i]--;
        else{
            if (a[i] == a[i-1])continue;
            else if(a[i] < a[i-1]){
                cout << "No" << "\n";
                return 0;
            }else{
                a[i]--;
            }
        }
    }
    
    cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}

void solve() {
    int n;string s;cin>>n>>s;
    if(n%2==1){
        cout<<"No\n";
        return;
    }
    fr(i,0,n/2-1){
        if(s[i]!=s[i+n/2]){cout<<"No\n";return;}
    }
    cout<<"Yes\n";
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;
typedef pair<ii,int> iii;

///////////////////////////////////
///// for any code taken from cheatsheet

/////

int n; 
int A[18], B[18];
int mn = 1e9;

void brute_force(int k, vector<iii> vec)
{
	if(k == n)
	{
		// sort(vec.begin(), vec.end());
		// for(int i = 0; i < n; i++)
		// 	printf("%d|%d|%d ", vec[i].fi.fi, vec[i].se, vec[i].fi.se); printf("\n");

		int res = 0;
		for(int i = 0; i < n; i++)
		{
			int idx = i;
			while(idx && vec[idx-1].fi.fi > vec[idx].fi.fi)
			{
				res++;
				vec[idx].se ^= 1;
				vec[idx-1].se ^= 1;
				swap(vec[idx], vec[idx-1]);
				idx--;
			}
		}
		for(int i = 0; i < n-1; i++)
		{
			for(int j = i+1; j < n; j+=2)
			{
				if(vec[i].se && vec[j].se && vec[i].fi.fi == vec[j].fi.fi)
				{
					res += j-i;
					vec[i].se ^= 1;
					vec[j].se ^= 1;
					break;
				}
			}
		}

		bool bol = 1;
		for(int i = 0; i < n; i++)
			if(vec[i].se)
				bol = 0;

		if(bol)
		{
			// printf("%d\n", res);
			// for(int i = 0; i < n; i++)
			// printf("%d|%d|%d ", vec[i].fi.fi, vec[i].se, vec[i].fi.se); printf("\n");

			mn = min(mn, res);
		}

		// for(int i = 0; i < n; i++)
		// 	printf("%d|%d|%d ", vec[i].fi.fi, vec[i].se, vec[i].fi.se); printf("\n");

	}
	else
	{
		vec.push_back({{A[k], k}, 0});
		brute_force(k+1, vec);
		vec.pop_back();

		vec.push_back({{B[k], k}, 1});
		brute_force(k+1, vec);
		vec.pop_back();
	}
}


int main()
{
	// freopen("input.in", "r", stdin);
	
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &A[i]);
	for(int i = 0; i < n; i++) scanf("%d", &B[i]);
	brute_force(0, {});
	printf("%d\n", (mn == 1e9)? -1 : mn);
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
using namespace std;
#define MOD 1000000007
#define MAXN 200000
typedef long long ll;
ll inv[MAXN+5],s[MAXN+5];
int n;
ll PowMod(ll a,int b)//快速幂
{
	ll ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%MOD;
		a=a*a%MOD;
		b>>=1;
	} 
	return ans;
 } 
void Pre()
{
	s[0]=1;
	for(int i=1;i<=n;i++)
	s[i]=s[i-1]*i%MOD;
	inv[0]=1;
	inv[n]=PowMod(s[n],MOD-2);
	for(int i=n-1;i>0;i--)
	inv[i]=inv[i+1]*(i+1)%MOD;
 } 
 ll C(int a,int b)
 {
 	if(a<0||b<0) return 1;
 	return s[a]*inv[b]%MOD*inv[a-b]%MOD;
 }
 
int main()
{
	int h,w,a,b;
	scanf("%d %d %d %d",&h,&w,&a,&b);
	n=h+w-2;
	Pre();
	ll ans=C(h+w-2,h-1);
	for(int i=1;i<=b;i++)
	{
		ans-=C(h-a+i-2,h-a-1)*C(a-1+w-i,a-1)%MOD;
		ans=(ans%MOD+MOD)%MOD;
	}
	printf("%lld\n",ans);
 } 

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

int main() {
    int64_t H, W;
    cin >> H >> W;
    if (H == 1 || W == 1) {
        cout << 1 << endl;
    } else {
        cout << (((H + 1) / 2) * ((W + 1) / 2) + (H / 2) * (W / 2)) << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second
#define PII pair<int,int>
#define show(x) cerr << #x << " = " << x << '\n'
using namespace std;

int s[5];
int main(int argc,char *argv[]){
    int n ,m;
    bool f = false;
    cin >> n >> m;
    fill(s, s + 5, -1);
    for(int i = 0;i < m;i ++){
        int a, b;
        cin >> a >> b;
        if(s[a] == -1 || s[a] == b)s[a] = b;
        else{
            printf("-1\n");
            return 0;
        }
    }
    if(n > 1 && s[1] == 0)printf("-1\n");
    else if(n == 1){
        if(s[1] == -1)printf("0\n");
        else printf("%d\n",s[1]);
    }
    else{
        for(int i = 1;i <= n;i ++){
            if(s[i] == -1){
                if(i == 1)printf("1");
                else printf("0");
            }
            else printf("%d", s[i]);
        }
        printf("\n");
    }
    return 0;
}

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

using namespace std;

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

const ll INF=1e9+7;
int n,k=1,g,a[101];
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n;
	rep(i,n){
		cin>>a[i];
		g+=a[i];
	}
	if(g%10!=0){
		cout<<g;
		return 0;
	}
	sort(a+1,a+n+1);
	while(a[k]%10==0&&k<=n){
		k++;
	}
	if(k>n){
		cout<<0;
	}
	else{
		cout<<g-a[k];
	}
	return 0;
}

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

using namespace std;

template<typename T> class minimum_heap : public priority_queue<T, vector<T>, greater<T>> {};

int main()
{
  uint64_t N, K;
  cin >> N >> K;
  
  vector<int64_t> V(N);
  for (uint64_t n = 0; n < N; ++n) {
    cin >> V[n];
  }
  
  vector<int64_t> S(N + 1, 0);
  for (uint64_t n = 0; n < N; ++n) {
    S[n + 1] = V[n] + S[n];
  }
  
  int64_t ans = 0;
  
  uint64_t M = min(N, K);
  minimum_heap<int64_t> Lq;
  for (uint64_t A = 0; A <= M; ++A) {
    int64_t L = S[A] - S[0];
    if (A >= 1 && V[A - 1] < 0) { Lq.push(V[A - 1]); }
    
    minimum_heap<int64_t> Rq;
    for (uint64_t B = 0; B <= M - A; ++B) {
      int64_t R = S[N] - S[N - B];
      if (B >= 1 && V[N - B] < 0) { Rq.push(V[N - B]); }
      
      int64_t T = L + R;
      uint64_t D = K - (A + B);
      minimum_heap<int64_t> LLq(Lq), RRq(Rq);
      for (uint64_t d = 0; d < D; ++d) {
        if (!LLq.empty() && !RRq.empty()) {
          if (LLq.top() < RRq.top()) {
            T -= LLq.top();
            LLq.pop();
          } else {
            T -= RRq.top();
            RRq.pop();
          }
        } else if (!LLq.empty()) {
          T -= LLq.top();
          LLq.pop();
        } else if (!RRq.empty()) {
          T -= RRq.top();
          RRq.pop();
        } else {
          break;
        }
      }
      ans = max(ans, T);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n = STDIN.gets.to_i
sequence = STDIN.gets.split[0...n].map(&:to_i)
m = STDIN.gets.to_i
questions = STDIN.gets.split[0...m].map(&:to_i)

combined = []
1.upto(n) do |i|
	sequence.combination(i).each { |e| combined << e.inject(:+) }
end
questions.each { |q| puts combined.include?(q) ? "yes" : "no" }

Measured memory_bytes: 15972
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const LL INF = 1LL<<30;
const double eps = 1e-13;

vector<int> adj[100009];

int solve(int x,int p=-1){
	int ans=0;
	for(int i:adj[x]){
		if(i==p)continue;
		int cv=solve(i,x);
		ans^=(cv+1);
	}
	return ans;
}

int main(){
	DRI(n);
	REP(i,n-1){
		DRII(a,b);a--;b--;
		adj[a].PB(b);
		adj[b].PB(a);
	}
	if(solve(0)==0)printf("Bob");
	else printf("Alice");
}


Measured memory_bytes: 10368
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef pair<int,int> pii;

int X,Y,Z;
int roulette[4];
pii ba[50];
double memo[50][5001];

double solve(int now, int money) {
  if (now >= Y) return money;
  if (memo[now][money] >= 0) return memo[now][money];
  int e = ba[now].first, a = ba[now].second;
  double res = 0;
  int oldnow = now, oldmoney = money;
  if (e == 1)
    now += a;
  else if (e == 2) {
    money += a;
  } else if (e == 3){
    money = max(0, money-a);
  }
  REP(i,X) {
    res += 1.0/X * solve(now+roulette[i], money);
  }
  return memo[oldnow][oldmoney] = res;
}

int main() {
  while(cin>>X>>Y>>Z,X||Y||Z) {
    REP(i,X) cin >> roulette[i];
    REP(i,Y)
      ba[i] = pii(0,0);
    REP(i,Z) {
      int n,e,a;
      cin>>n>>e>>a;
      ba[n] = pii(e,a);
    }
    REP(i,50) REP(j,5001) memo[i][j] = -1;
    cout << (int)(solve(0,0)) << endl;
  }
}

Measured memory_bytes: 0
//url:
//problem name: 

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S;
    cin >> S;
    
    veci res(26);
    for(char c : S) res[(int)c-97]++;
    REP(i,26) {
        if(res[i]%2 != 0) {
            cout << "No" << endl;
            return 0;
        } 
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")

#include <stdio.h>
#include <stdlib.h>

int get_int() {
    int res = 0;
    char c = getchar();
    while(c != '\n') {
        res *= 10;
        res += c - '0';
        c = getchar();
    }
    return res;
}


void put_int(int n) {
    char c[30];
    int sz = 0;
    c[sz++] = (n % 10) + '0';
    n /= 10;
    while(n > 0) {
        c[sz++] = (n % 10) + '0';
        n /= 10;
    }
    for(int i = sz-1; i >= 0; i--) {
        putchar(c[i]);
    }
    putchar('\n');
}

int main(){
    int n = get_int();
    int ans = 8 - (n - 400) / 200;
    put_int(ans);
    return 0;
}


Measured memory_bytes: 1512
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

int main() {
  int x1, x2, x3, x4, x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;

  int ans;
  if (x1 == 0) ans = 1;
  else if (x2 == 0) ans = 2;
  else if (x3 == 0) ans = 3;
  else if (x4 == 0) ans = 4;
  else if (x5 == 0) ans = 5;

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


Measured memory_bytes: 3580
s=input()
q=int(input())
from collections import deque
qq=deque(s)
cnt=0
for i in range(q):
    j=input()
    if j=="1":
        cnt+=1
        continue
    _,k,l=j.split()
    if (k=="2")^cnt%2:
        qq.append(l)
    else:
        qq.appendleft(l)

if cnt%2==1:
    print("".join(reversed(list(qq))))
else:
    print("".join(qq))

Measured memory_bytes: 76120
r=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

if r<1200:
    print("ABC")
elif r<2800:
    print("ARC")
else:
    print("AGC")



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

int main()
{
    std::ios_base::sync_with_stdio (false);
    int n;
    cin>>n;
    vector<ll>a(n);
    vector<ll>b(n);
    vector<ll>c(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    for(int i=1;i<n;i++){
        a[i]+=max(b[i-1],c[i-1]);
        b[i]+=max(a[i-1],c[i-1]);
        c[i]+=max(b[i-1],a[i-1]);
    }
    ll ans=max(a[n-1],b[n-1]);
    ans=max(ans,c[n-1]);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    string S;
    cin >> S;
    map<char, int> mp;
    for (auto &c : S) {
        mp[c] = 1;
    }
    cout << ((mp['N'] == mp['S'] && mp['W'] == mp['E']) ? "Yes" : "No") << endl;

    return 0;
}

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

const ll mod = 1e9 + 7;

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){
		y %= x;
		swap(x, y);
	}
	return y;
}


ll mpow(ll x, ll r){
	if(r == 1) return x;
	if(r % 2 == 1) return x * mpow(x, r-1) % mod;
	else{
		ll aa = mpow(x, r/2);
		return aa*aa%mod;
	}
}

int main(){
	ll N, K; cin >> N >> K;
	ll ans = 0, num[K+1];
	for(int g=K; g>=1; g--){
		if(g==K){
			num[K] = 1;
			ans += K;
		}else{
			ll xx = mpow(K/g, N);
			num[g] = xx;
			for(int j=2; j<=(K/g); j++){
				num[g] = (num[g] - num[j*g] + 10*mod) % mod;
			}
			ans = (ans + g*num[g]%mod) % mod;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
//vector<vector<int>> a(5, vector<int>(5, 0)) 5*5-0
int main(){
    int res = 0;
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
        if(s.at(i) != t.at(i)){
            res++;
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 3828
fun main() {
    data class Score(val a: Int, val b: Int, val c: Int, val d: Int)
    val (n, m, q) = readLine()?.split(" ")?.map(String::toInt) ?: return
    val score = 0.until(q).map {
        val a = readLine()?.split(" ")?.map(String::toInt) ?: return
        Score(a[0] - 1, a[1] - 1, a[2], a[3])
    }

    val cList = mutableListOf<List<Int>>()
    fun generate(n: Int, m: Int, i: Int, c: List<Int>) {
        if (c.size == n) {
            cList.add(c)
        } else {
            c.last().until(m + 1).forEach {
                generate(n, m, it + 1, c + it)
            }
        }
    }
    1.until(m + 1).forEach {
        generate(n, m, it, listOf(1))
    }
    val max = cList.map { list ->
        var s = 0L
        score.forEach { score ->
            if (list[score.b] - list[score.a] == score.c) {
                s += score.d
            }
        }
        s
    }.max()
    println(max.toString())
}


Measured memory_bytes: 124196
N,M = map(int, input().split())
K = [list(map(int, input().split())) for _ in range(N)]

dict = {}
for i in range(N):
    for j in range(1,len(K[i])):
        if K[i][j] in dict:
            dict[K[i][j]] += 1
        else:
            dict[K[i][j]] = 1

cnt = 0
for v in dict.values():
    if v == N:
        cnt += 1
print(cnt)




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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N=5;
    vector<int> A(N);
    REP(i,N) cin>>A[i];
    int K;
    cin>>K;
    bool ans = true;
    if (A[4] - A[0] > K) ans = false;
    if (ans) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
    return 0;
}

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

int main() {
  int n, m, x, y;
  
  while(cin >> n && n) {
    vector<pair<int, int> > vec;
    for(int i=0; i<n; i++) {
      cin >> x >> y;
      vec.push_back(make_pair(x, y));
    }
    
    cin >> m;
    for(int i=0; i<m; i++) {
      cin >> x >> y;
      vec.push_back(make_pair(x, y));
    }
    
    int N = n+m;
    
    vector<int> dp(N, 0);
    
    sort(vec.begin(), vec.end());
    
    int ans = 0;
    
    for(int i=0; i<N; i++) {
      for(int j=0; j<i; j++) {
	if(vec[j].first < vec[i].first && vec[j].second < vec[i].second) {
	  dp[i] = max(dp[i], dp[j]+1);
	}
      }
      ans = max(dp[i], ans);
    }
    
    cout << ans+1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
vector <char> v;
vector<int> num;

int main(){
  long long int  N,M;

  cin >>N>>M;

  cout << abs(N-2)*abs(M-2)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int a[n+1],i,ans=0,j,b;
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
		j=i%2;
		b=a[i]%2;
		if(j==1 && b==1) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>
#include <math.h>
double theta(double x1,double y1,double x2,double y2);

int main(void){
	int a;
    double xa,ya,xb,yb,xc,yc,xd,yd;
    float alpha;
    while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n",&xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)!=EOF) {
    	alpha = theta(xb-xa,yb-ya,xd-xa,yd-ya)+theta(xa-xb,ya-yb,xc-xb,yc-yb)+theta(xd-xc,yd-yc,xb-xc,yb-yc)+theta(xa-xd,ya-yd,xc-xd,yc-yd);
		a = alpha * 1000000;
        if (a==6283185) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}

double theta(double x1,double y1,double x2,double y2) {
    return acos(1.0*(x1*x2+y1*y2)/(sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2)));
}

Measured memory_bytes: 652
import sys
from collections import Counter as cc
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    a, b = mi()
    def sxor(x):
        ret = ((x+1)//2)%2
        if x%2 == 0:
            ret ^= x
        return ret
    ans = sxor(b)^sxor(a-1)
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9392
import math

def main():
    N, D = map(int, input().split())
    x = []
    for i in range(N):
        x.append(list(map(int, input().split())))
    count = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            t = 0
            for k in range(D):
                t = t + ((x[i][k] - x[j][k]) ** 2)
            t = math.sqrt(t)
            if t.is_integer() == True:
                count += 1
    print(count)
main()  

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

int main(){
	int n,a,b;
	cin>>n>>a>>b;
	
	int cnt=0;
	for(int i=1; i<n+1; i++){
		int x=i;
		int r=0;
		int k=0;
		while(x!=0){
			r=x%10;
			x/=10;
			k+=r;
		}
		if(k>=a&&k<=b) cnt+=i;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int n = sc.nextInt();

        int[] w = new int[n];

        for (int i=0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;

        for (int i=0; i < n; i++) {
            min = Math.min(diff(w, i), min);
        }

        System.out.println(min);
    }

    private static int diff(int[] w, int t) {
        int s1 = 0;
        int s2 = 0;
        for (int i=0; i < w.length; i++) {
            if (i < t) {
                s1 += w[i];
            } else {
                s2 += w[i];
            }
        }

        return Math.abs(s1 - s2);
    }

}


Measured memory_bytes: 23764
def printData(data):
    for d in data:
        val = f'{d}'
        if data[-1] != d:
            end = " "
        else:
            end = "\n"
        print(f'{d}',end=end)

num = int(input())
data = list(map(int,input().split()))

printData(data)

for i in range(1,num):
    v = data[i]
    j = i -1 
    while j >= 0 and data[j] > v:
        data[j+1] = data[j]
        j -= 1
    data[j+1] = v
    printData(data)



Measured memory_bytes: 5996
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T;
  cin >> S >> T;
  int B = 0;
  for (int i = 0; i < S.size() - T.size() + 1; i++) {
    int A = 0;
    for (int j = 0; j < T.size(); j++) {
      if (S.at(i + j) == T.at(j)) {A++;}
    }
    B = max(B, A);
  }
  cout << T.size() - B << endl;
}

Measured memory_bytes: 3652
module Main where

import Control.Applicative
import Data.List

getInt :: IO Int
getInt = head <$> getInts

getInts :: IO [Int]
getInts = map read . words <$> getLine

main :: IO ()
main = do
  { xs <- getInts
  ; putStrLn $ unwords $ map show $ sort xs
  }



Measured memory_bytes: 3668
n, k = map(int, input().split())
a =list(map(int, input().split()))
ball = 0
count = [0]*(n+1)
for i in range(n):
    count[a[i]] += 1

count.sort(reverse=True)
for i in range(k):
    ball += count[i]

print(n - ball)


Measured memory_bytes: 24996
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int m = n % 10;
    if (n % 10 == 3) {
        cout << "bon" << endl;
    } else if (m == 0 || m == 1 || m == 6 || m == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i)
  
  a.each_index do |i|
    a[i] -= i + 1
  end
  b = (a.sort)[n / 2]
  
  m = 1e+32
  [b - 2, b - 1, b, b + 1, b + 2].each do |c|
    s = 0
    a.each_index do |i|
      s += (a[i] - c).abs
    end
    m = [m, s].min
  end
  puts m.to_s
end
 
if self.to_s === 'main' then
  main(ARGV)
end

Measured memory_bytes: 20992
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
satisfaction = 0
last_dish = 10000

for i in range(N):
    satisfaction += B[A[i]-1]
    if A[i] - last_dish == 1:
        satisfaction += C[last_dish-1]
    last_dish = A[i]

print(satisfaction)


Measured memory_bytes: 61828
#def main(S, b):
if __name__ == '__main__':
    A = [
        1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1,
        15, 2, 2, 5, 4, 1, 4, 1, 51
    ]
    k = int(input())
    print(A[k - 1])
    # s = input()
    # flag = 1
    # while (len(s) > 0):
    #     if (s[:2] == "hi"):
    #         s = s[2:]
    #     else:
    #         flag = 0
    #         s = ""
    # if (flag):
    #     print("Yes")
    # else:
    #     print("No")


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>


using namespace std;

int main() {

	int K, A, B;
	cin >> K;
	cin >> A >> B;

	for (int i = A; i <= B; i++) {
		if (i%K == 0) {
			cout << "OK";
			return 0;
		}


	}
	
	cout << "NG";
	return 0;

}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	int n;
	scanf("%d",&n);
	ll s=0,pre=1e6;
	for(int i=0;i<n;i++){
		int t;
		scanf("%d",&t);
		s+=min(pre,t);
		pre=t;
	}
	printf("%lld",s);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int  main()
{
    int n,m;
    cin>>n>>m;
    int sum=0,ans=1;
    for(int i=0;i<n;i++)
    {
        int l;
        cin>>l;
        sum+=l;

        if(sum<=m)
        {
            ans++;
        }

    }
    cout<<ans<<endl;
    exit(0);
}


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

#define MAXLEN 51

int count(char haystack[], char needle) {
    int c = 0, i;
    for (i = 0; i < strlen(haystack); i++) {
        if (haystack[i] == needle) {
            c++;
        }
    }
    return c;
}

int main(void) {
    int n, i, min;
    char target;
    char strings[MAXLEN][MAXLEN];
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s", strings[i]);
    }
    for (target = 'a'; target <= 'z'; target++) {
        min = count(strings[0], target);
        for (i = 1; i < n; i++) {
            if (min == 0) {
                break;
            }
            else if (min > count(strings[i], target)) {
                min = count(strings[i], target);
            }
        }
        for (i = 0; i < min; i++) {
            printf("%c", target);
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
constexpr ll pow2(const int n) { return 1ll << n; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vi h(N, 0);
    rep(i, N) cin >> h[i];

    int ans = 0;
    int prev = 0;
    rep(i, N) {
        if (h[i] > prev) {
            ans += h[i] - prev;
        }
        prev = h[i];
    }

    write(ans);
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;

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



Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

int main(void)
{
    int_fast8_t a, b, c;
    scanf("%" SCNdFAST8 " %" SCNdFAST8 " %" SCNdFAST8, &a, &b, &c);
    puts((a <= c && c <= b) ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
struct Node{
	int l,r;
}a[100005];
int n,m,k;
string s;
int main(){
	m = 0;
	scanf("%d%d",&n,&k);
	cin >> s;
	for (int i = 0;i < n;++i){
		if (s[i] == '0'){
			a[m].l = i;
			while(s[++i] == '0'){

			}
			i--;
			a[m++].r = i;
		}
	}
	a[m].l = n;
	if (m <= k) return 0 * printf("%d\n",n);
	int ans = a[k].l;
	//cout << ans << endl;
	for (int i = 1;i + k-1 < m;++i){
		//cout << a[i+k].l-1 << " " << a[i-1].r << endl;
		//cout << a[i+k].l - 1 - a[i-1].r << endl;
		ans = max(ans,a[i+k].l - 1 - a[i-1].r);
	}
	printf("%d\n",ans);
	return 0;
}
/*
19 3
0101010101001111001
*/


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

int main() {
int N,X;
cin >> N >> X;
vector<int> Dornuts(N);
for(int i = 0; i < N; i++){
cin >> Dornuts.at(i);}
sort(Dornuts.begin(), Dornuts.end());
int sum = 0;
for(int i = 0; i < N; i++){
sum += Dornuts.at(i);}
X -= sum;
int count = 0;
while(X  - Dornuts.at(0) >= 0){
X -= Dornuts.at(0);
count++;}
cout << count + N << endl;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] K = new int[N];
		int[] A = new int[M+1];
		int a = 0;
		for(int i=0; i<N; i++) {
			K[i] = sc.nextInt();
			for(int j=0; j<K[i]; j++) {
				int b = sc.nextInt();
				A[b]++;
			}
		}
		sc.close();
		for(int i=1; i<=M; i++) {
			if(A[i] == N) {
				a++;
			}
		}
		System.out.println(a);
	}

}

Measured memory_bytes: 38660
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    
    public static void main(String[] args){
        B();
    }

    public static void A(){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(6 - (a + b));
    }

    public static void B(){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] s = sc.nextLine().split("\\s+");
    StringBuilder ans = new StringBuilder();
    for(int i = 0; i < n; i++){
        ans.append(s[0].charAt(i));
        ans.append(s[1].charAt(i));

    }

    System.out.print(ans.toString());

    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i<N; i++)
#define RVROOP(i, N) for(int i=N; i>=0; i--)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int c[10][10];

int main(){
  ll N; cin>>N;
  for(int i=1; i<=N; i++){
    int a=i;
    while(a>=10){
      a/=10;
    }
    c[a][i%10]++;
  }
  ll ans=0;
  for(int i=1; i<=N; i++){
    int a=i;
    while(a>=10){
      a/=10;
    }
    ans+=c[i%10][a];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

n,q = [int(s) for s in input().split()]
par = []
for i in range(n):
    par.append(i)

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x,y):
    return find(x) == find(y)

def union(x,y):
    x = find(x)
    y = find(y)
    if x != y:
        par[x] = y

for i in range(q):
    q_type,x,y = [int(s) for s in input().split()]
    if q_type == 1:
        if same(x,y):
            print(1)
        else:
            print(0)
    else:
        union(x,y)


Measured memory_bytes: 13092
N = input()

L = []
def dfs(s):
  if len(s) > 1 and int(s) >= int(N):
    return
  for c in '357':
    l = s+c
    if int(l) > int(N):
      return
    
    if '3' in l and '5' in l and '7' in l:
      L.append(int(l))
    dfs(l)
  return

dfs('')

print(len(L))


Measured memory_bytes: 4020
/*input
7 4 2
3
*/

#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>




#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define fill(a)  memset(a, 0, sizeof (a))
#define mp make_pair
#define pb push_back
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define pdd pair<double, double>
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define forstl(i,v) for(auto &i: v)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.f<<" , "<<it.s<<endl;} cerr<<endl
#define PI           3.14159265358979323846

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define pdd pair<double, double>
#define in(v,n) vll v(n);rep(i,n) cin>>v[i]


using namespace std;


int main(){
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    cin.exceptions(cin.failbit);
    int T;
	// cout<<std::fixed<<std::setprecision(35);
	// cin>>T;while(T--)
	{
		ll t,n,i,j,x,y,m,l,d,k,a,b,c;
		cin>>a>>b>>c;
		cin>>k;
		while(k--){
			if(b<=a) b=b*2;
			else if(c<=b) c=c*2;
		}
		if(c>b&&b>a) cout<<"Yes\n";
		else cout<<"No\n";
	}
}

Measured memory_bytes: 3648