akhauriyash/Code-Regression huggingface dataset:
def fibcmb(start,end):
    start += 1
    end -= 1
    up = end - start
    a1 = 1
    a2 = 2
    if up < 0:
        return 0
    elif up == 0:
        return 1
    elif up == 1:
        return a1
    elif up == 2:
        return a2
    else:
        for _ in range(up-2):
            an = a1 + a2
            a1 = a2
            a2 = an
        return an

n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
ans = 1
cmb = [0]*(m+1)
if m == 0:
    ans = fibcmb(-1,n+1)
else:
    cmb[0] = fibcmb(-1,a[0])
    for i in range(1,m):
        cmb[i] = fibcmb(a[i-1],a[i])
    cmb[-1] = fibcmb(a[-1],n+1)
    for i in range(m+1):
        ans *= cmb[i]
print(ans%1000000007)

Measured memory_bytes: 7848
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int main(){
    int a , b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    vector<int> var;
    var.push_back(a * x + b * y);
    var.push_back(max(x ,y) * 2 * c);
    if (a >= 2 * c && x < y)
        var.push_back( 2 * x * c + (y - x) * b);
    if (b >= 2 * c && y < x)
        var.push_back( 2 * y * c + (x - y) * a);
    
    if ( x > y)
        var.push_back(2 * y * c + (x - y) * a);
    else
        var.push_back(2 * x * c + (y - x) * b);
    
    cout << *min_element(var.begin(), var.end()) << endl;
    
}


Measured memory_bytes: 256
#include<iostream>

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

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

    string res = "";

    // 文字列のサイズ分ループ
    rep(i, (int) s.size()) {
        if (i % 2 == 0) res += s[i];
    }

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


Measured memory_bytes: 512
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
string ma[15];
int num[15][1010];
int sum[15];
int h,w,x;
int cal(int i){
	int n=__builtin_popcount(i)+1,it=0,ret=0;
	memset(num,0,sizeof(num));
	rep(j,h){
		rep(k,w) num[it][k]+=(ma[j][k]-'0');
		if((i&(1<<j))) it++;
	}
	rep(j,n) rep(k,w){
		//cout<<i<<j<<k<<' '<<num[j][k]<<endl;
		if(num[j][k]>x){
			return 100100;
		}
	}
	memset(sum,0,sizeof(sum));
	rep(k,w){
		int f=0;
		rep(j,n){
			if(sum[j]+num[j][k]>x) f=1;
		}
		if(f>0){
			memset(sum,0,sizeof(sum));
			ret++;
		}
		rep(j,n) sum[j]+=num[j][k];
	}
	return ret+n-1;
}
int main()
{
	int mi=100100;cin>>h>>w>>x;
	rep(i,h) cin>>ma[i];
	rep(i,(1<<(h-1))){
		mi=min(mi,cal(i));
	}
	cout<<mi<<endl;
}


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

typedef long long ll;

int main() {
    int N;
    ll M;
    cin >> N >> M;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    sort(A.begin(),A.end());
    vector<ll> sum(N+1);
    for(int i=0;i<N;i++) sum[i+1] = sum[i] + A[i];

    auto calc = [&](int x){
        ll tot = 0, num = 0;
        for (int i=0;i<N;i++){
            int j = lower_bound(A.begin(),A.end(),x-A[i]) - A.begin();
            num += N - j;
            tot += sum[N] - sum[j];
            tot += A[i]*(ll)(N-j);
        }
        return make_pair(tot,num);
    };

    int lower = -1;
    int upper = 200005;
    while (upper - lower >1){
        int mid = (upper + lower)/2;
        if (calc(mid).second >= M) lower = mid;
        else upper = mid;
    }
    auto p = calc(lower);
    ll ans = p.first;
    ans -= (p.second - M)*lower;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int main(void) {
    int N, M, X;
    cin >> N >> M >> X;
    int A[M];
    for (int i = 0; i < M; ++i) {
        cin >> A[i];
    }

    int leftcost = 0, rightcost = 0;
    for (int i = X - 1; i >= 0; --i) {
        bool charge = false;
        for (int j = 0; j < M; ++j) {
            if (i == A[j]) {
                charge = true;
                break;
            }
        }
        if (charge) {
            leftcost++;
        }
    }
    for (int i = X + 1; i <= N; ++i) {
        bool charge = false;
        for (int j = 0; j < M; ++j) {
            if (i == A[j]) {
                charge = true;
                break;
            }
        }
        if (charge) {
            rightcost++;
        }
    }

    cout << min(leftcost, rightcost) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <functional>
#include <iostream>
#define INF 100000000
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,s,t;
int q[101];
int a[101][101];
int dist[101];
vector<P> G[101];

void dijk(){
	for(int i=0;i<n;i++){
		dist[i]=INF;
	}
	dist[t]=0;
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,t));
	while(que.size()){
		P p=que.top();
		que.pop();
		int v=p.second;
		if(p.first>dist[v])continue;
		for(int i=0;i<G[v].size();i++){
			if(dist[G[v][i].first]>dist[v]+G[v][i].second){
				dist[G[v][i].first]=dist[v]+G[v][i].second;
				que.push(P(dist[G[v][i].first],G[v][i].first));
			}
		}
	}
}

typedef vector<double> vec;
typedef vector<vec> mat;

vec gauss_jordan(const mat &A,const vec& b){
	int N=A.size();
	mat B(N,vec(N+1));
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			B[i][j]=A[i][j];
		}
	}
	for(int i=0;i<N;i++){
		B[i][N]=b[i];
	}
	for(int i=0;i<N;i++){
		int pivot=i;
		for(int j=i;j<N;j++){
			if(fabs(B[j][i])>fabs(B[pivot][i]))pivot=j;
		}
		swap(B[i],B[pivot]);
		if(fabs(B[i][i])<EPS)continue;
		for(int j=i+1;j<=N;j++){
			B[i][j]/=B[i][i];
		}
		for(int j=0;j<N;j++){
			if(i!=j){
				for(int k=i+1;k<=N;k++){
					B[j][k]-=B[j][i]*B[i][k];
				}
			}
		}
	}
	vec x(n);
	for(int i=0;i<n;i++){
		x[i]=B[i][n];
	}
	return x;
}

void solve(){
	dijk();
	if(dist[s]==INF){
		printf("impossible\n");
		return;
	}
	mat A(n,vec(n));
	vec B(n);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			A[i][j]=0.0;
		}
		B[i]=0.0;
		A[i][i]=1.0;
	}
	for(int i=0;i<n;i++){
		if(i==t){
		}else if(q[i]==1){
			int best=INF;
			for(int j=0;j<G[i].size();j++){
				best=min(best,dist[G[i][j].first]+G[i][j].second);
			}
			if(best==INF)continue;
			int cnt=0;
			for(int j=0;j<G[i].size();j++){
				if(best==dist[G[i][j].first]+G[i][j].second){
					cnt++;
				}
			}
			A[i][i]=cnt;
			int sum=0;
			for(int j=0;j<G[i].size();j++){
				int nv=G[i][j].first;
				if(best==dist[nv]+G[i][j].second){
					A[i][nv]-=1;
					sum+=G[i][j].second;
				}
			}
			B[i]+=sum;
		}else{
			int cnt=(int)G[i].size();
			A[i][i]=cnt;
			if(cnt==0)continue;
			int sum=0;
			for(int j=0;j<G[i].size();j++){
				int nv=G[i][j].first;
				A[i][nv]-=1;
				sum+=G[i][j].second;
			}
			B[i]=sum;
		}
	}
	vec C=gauss_jordan(A,B);
	printf("%.15f\n",C[s]);
}

int main(void){
	while(1){
		scanf("%d%d%d",&n,&s,&t);
		if(n==0 && s==0 && t==0)break;
		s--;
		t--;
		for(int i=0;i<n;i++){
			scanf("%d",&q[i]);
		}
		for(int i=0;i<n;i++){
			G[i].clear();
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				scanf("%d",&a[i][j]);
				if(a[i][j]>0)G[i].push_back(P(j,a[i][j]));
			}
		}
		solve();
	}
	return 0;
}

Measured memory_bytes: 3320
//सत्यान्न प्रमदितव्यम्  ||

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

#define ll long long
#define ld long double
#define pb push_back
// #define mp make_pair
#define nt _int128
#define fir first
#define sec second
#define fast_as_levi ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define inf 0x3f3f3f3f

const ll mod = 1000000007;
#define mx 1000005
const ll mxi = 4e4+5;
// ll ar[mx][mx] = {0};

ll sol(ll x)
{
	while(x/10 > 0)
	{
		x /= 10;
	}
	return x;
}

int main()
{
    fast_as_levi;
    ll i,n;
    cin>>n;
    ll ans=1;
    ll ar[n];
    for(i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    ll mi = ar[0];
    for(i=1;i<n;i++)
    {
        if(ar[i]<=mi)
        {
            ans++;
        }
        mi = min(ar[i],mi);
    }
    cout<<ans;
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vb = vector<bool>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define xx first
#define yy second

#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)

#define rv(type,name,count) vector<type> name(count); FOR(_i,0,count) cin >> name[_i];
#define grid(type,name,c1,c2) vector<vector<type>> name(c1, vector<type>(c2)); FOR(_i,0,c1)FOR(_j,0,c2)cin >> name[_i][_j];

int main() {
	ll n, k;
	cin >> n >> k;
	vl v(n); FOR(i,0, n) cin >> v[i];
	vector<bool> winner(k+1);
	winner[0] = false;
	FOR(i, 0, k+1) {
		for(ll move : v) if (move <= i && !winner[i - move]) winner[i] = true;
	}
	if (winner[k]) cout << "First" << endl;
	else cout << "Second" << endl;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll n, d;cin >> n >> d;
	vector<vector<double>> v;
	REP(i, n){
		vector<double> tmp(d);
		REP(j, d)cin >> tmp[j];
		v.PB(tmp);
	}

	ll ans = 0;
	REP(i, n){
		REP(j, i){
			ll now = 0;
			REP(k, d){
				now += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
			}
			for(ll i = 0;i < 300;i++){
				if(now == i * i)ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))
#define	N 200005

ll a[N];

int main(void) {
	int n;
	scanf("%d", &n);
	REP(i, n) {
		scanf("%lld", &a[i]);
	}
	if (n % 2 == 0) {
		ll dp[2];
		ll pd[2];
		dp[1] = a[n - 1];
		dp[0] = max(a[n - 2], a[n - 1]);
		for (int i = n - 3; i >= 0; i -= 2) {
			pd[1] = dp[1] + a[i];
			pd[0] = max(pd[1], dp[0] + a[i - 1]);
			dp[0] = pd[0];
			dp[1] = pd[1];
		}

		printf("%lld\n", max(dp[0], dp[1]));
	}
	else {
		ll dp[3];
		ll pd[3];
		dp[2] = a[n - 1];
		dp[1] = max(a[n - 2], a[n - 1]);
		dp[0] = max(a[n - 3], dp[1]);

		for (int i = n - 3; i >= 0; i -= 2) {
			pd[2] = dp[2] + a[i];
			pd[1] = max(pd[2], dp[1] + a[i - 1]);
			pd[0] = max(pd[1], dp[0] + a[i - 2]);
			dp[0] = pd[0];
			dp[1] = pd[1];
			dp[2] = pd[2];
		}

		printf("%lld\n", max(dp[0], max(dp[1], dp[2])));
	}


	return 0;
}


Measured memory_bytes: 5316
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long  ll;
//typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set
// this for long double
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
#define halt {cout<<-1; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int N = 1010;
const int INF = 1e8;
const ll MOD1=1073741824;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
string bin_rep(int n)
{
          string s="";
      for(int i=31;i>=0;i--)
   {
           if(n&(1<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 set<char> s;
 for(int i=0;i<3;i++)
 {
           char a;
           cin>>a;
           s.insert(a);
 }
 if(s.count('7')) cout<<"Yes";
 else cout<<"No";
 
 
 
 
 
    
 
 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
using namespace std;

bool check1(string s){
	return s[0] == 'A';
}

pair<bool,ll> check2(string s){
	pair<bool, ll> ret; ret.first = 0;
	for (ll i = 2; i < s.size() - 1; ++i){
		if (s[i] == 'C'){
			if (!ret.first){
				ret.first = 1;
				ret.second = i;
			}
			else return pair<bool,ll>(0,0);
		}
	}return ret;
}

bool check3(string s,ll n){
	for (int i = 1; i < s.size(); ++i){
		if (i == n) continue;
		if (!('a' <= s[i] && s[i] <= 'z')) return 0;
	}return 1;
}

int main(){
	string s; cin >> s;
	if (check1(s)){
		pair<bool, ll> p = check2(s);
		if (p.first){
			if (check3(s, p.second)){
				cout << "AC" << endl;
				return 0;
			}
		}
	}cout << "WA" << endl;
	return 0;
}

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

int main(){
    int i,N;
    cin >> N;
    int p,pmax=0,psum=0;
    for(i=0;i<N;i++){
        cin >> p;
        psum += p;
        if (pmax < p) pmax = p;
    } 
    cout << psum - pmax/2 << endl;
}

Measured memory_bytes: 256
from collections import deque
N, M = map(int, input().split())
K = [[] for _ in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    A, B = A-1, B-1
    K[A].append(B)
    K[B].append(A)
used = [0]*N
ans = 0
for i in range(N):
    c = 0
    if used[i] == 0:
        P = deque([i])
        used[i] = 1
        while P:
            c += 1
            a = P.popleft()
            for j in K[a]:
                if used[j] == 0:
                    used[j] = 1
                    P.append(j)
    ans = max(c, ans)
print(ans)

Measured memory_bytes: 111536
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
static const int MAX_N = 100000;

int N;
P p[2 * MAX_N];

int main(){
	scanf("%d", &N);
	ll res1 = 0, res2 = 0, res3 = 0;
	for(int i = 0; i < N; i++){
		scanf("%lld %lld", &p[2 * i].first, &p[2 * i + 1].first);
		res1 += p[2 * i].first, res2 += p[2 * i + 1].first;
		p[2 * i].second = i; p[2 * i + 1].second = i;
	}
	sort(p, p + 2 * N);
	int num[MAX_N];
	fill(num, num + N, 0);
	bool flag = true;
	int index = -1;
	for(int i = 0; i < N; i++){
		res3 += p[i].first;
		num[p[i].second]++;
		if(num[p[i].second] >= 2) flag = false;
	}
	if(flag){
		if(p[N - 1].second != p[N].second) res3 = res3 - p[N - 1].first + p[N].first;
		else res3 = res3 - max(p[N - 1].first - p[N + 1].first, p[N - 2].first - p[N].first);
	}
	printf("%lld\n", min(min(res1, res2), res3));
	return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    cout << fixed << setprecision(10);
    
    int N, M; cin >> N >> M;
    // out_edge iからjに向いている, in_edge iへjから向いている
    vector<vector<int>> out_edge(N), in_edge(N);
    // iからjに通ったかどうかを保存する
    vector<set<int>> passed(N);
    // 距離を保存する
    vector<int> pass_l(N, 0);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        // x-1からy-1へ向いている
        out_edge[x-1].push_back(y-1);
        // passed[x-1].push_back(false);
        // y-1にx-1から入っている
        in_edge[y-1].push_back(x-1);
    }

    // ノードを入れる
    queue<int> nq;
    rep(i, N) {
        // 入っているものがないならpush
        if (in_edge[i].size() == 0) {
            nq.push(i);
        }
    }

    // queueがemptyじゃない間
    while (!nq.empty()) {
        int node = nq.front();
        nq.pop();
        // rep(i, out_edge[node].size()){
        for(int next_node: out_edge[node]) {
            // int next_node = out_edge[node][i];
            // 距離更新
            pass_l[next_node] = max(pass_l[next_node], pass_l[node]+1);
            // 通った
            // passed[node][i] = true;
            passed[node].insert(next_node);
            // 向いているエッジがなければpush
            bool pushing = true;
            for(int from_node: in_edge[next_node]) {
                // まだ通っていない、受向エッジがある
                if (passed[from_node].count(next_node) == 0) {
                    pushing = false;
                    break;
                }
            }
            if (pushing) {
                nq.push(next_node);
            }
        }
    }

    int ans = 0;
    rep(i, N) {
        ans = max(pass_l[i], ans);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int a;
    string O,E;
    cin >> O >> E;
      for(int i=0;i<O.size();++i){ 
        cout << O.at(i);
      if(i<E.size()){
        cout << E.at(i);
    }
      }
    cout<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int a, b;
  while (cin >> a >> b) {
    if (a + b == 15) {
      cout << "+" << endl;
    } else if (a * b == 15) {
      cout << "*" << endl;
    } else {
      cout << "x" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m: usize = sc.read();
    let values: Vec<(usize, char)> = (0..m)
        .map(|_| {
            let s: usize = sc.read();
            let c: i32 = sc.read();
            (s - 1, std::char::from_digit(c as u32, 10).unwrap())
        })
        .collect();
    let (start, end) = {
        if n == 1 {
            (0, 10)
        } else if n == 2 {
            (10, 100)
        } else {
            (100, 1000)
        }
    };
    for x in start..end {
        let x_str: Vec<char> = x.to_string().chars().collect();
        let mut ok = true;
        for &(s, c) in values.iter() {
            if x_str[s] != c {
                ok = false;
            }
        }
        if ok {
            println!("{}", x);
            return;
        }
    }
    println!("-1");
}
 
fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];
 
    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}
 
//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}
 
impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
 
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

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

#define N 8
#define FREE  -1
#define NOT_FREE 1

int X[N][N],row[N],col[N],dpos[2*N-1],dneg[2*N-1];

void initialize(){
 int i,j;
 for(i=0;i<N;i++){
   row[i] = FREE;
   col[i] = FREE;

   for(j=0;j<N;j++){
     X[i][j]=0;
 }
 }
 for(j=0;j<2*N-1;i++){
   dpos[j]=FREE;
   dneg[j]=FREE;
 }
}


void printBoard(){
 int i,j;
 for(i=0;i<N;i++){
   for(j=0;j<N;j++){
     if(X[i][j]){
       if(row[i]!=j) return;
     }
   }
 }
 for(i=0;i<N;i++){
   for(j=0;j<N;j++){
     if(row[i]==j) {
         printf("Q");
     }
     else {
         printf(".");
   }
}
 printf("\n");
 }
 return;
}

void recursive(int i){
 int j;
 if(i==N){
   printBoard(); 
   return;
 }
 for(j=0;j<N;j++){
   if(col[j]  == NOT_FREE  || 
      dpos[i+j] == NOT_FREE ||
      dneg[i-j + N-1] == NOT_FREE ) {
          continue;
}
   row[i]=j; col[j] = dpos[i+j] = dneg[i-j + N-1] = NOT_FREE;

   recursive(i+1);

   row[i] = col[j] = dpos[i+j] = dneg[i-j + N-1] = FREE;
 }
}

int main(){
   int i,j,x,y,n;

   //initialize();
 for(i=0;i<N;i++){
   row[i] = FREE;
   col[i] = FREE;

   for(j=0;j<N;j++){
     X[i][j]=0;
 }
 }

 for(j=0;j<2*N-1;j++){
   dpos[j]=FREE;
   dneg[j]=FREE;
}
   scanf("%d",&n);
 for(i=0;i<n;i++){
   scanf("%d%d",&x,&y);
   X[x][y]=1;
 }
 recursive(0);
}




Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 2e9;

int main(){ 
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  int res = 0;
  sort(l.begin(), l.end());
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (l[i] == l[j]) continue;
      for (int k = j + 1; k < n; k++) {
        if (l[i] == l[k]) continue;
        if (l[j] == l[k]) continue;
        if (l[i] + l[j] > l[k]) res++;
      }
    }
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 3636
#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(){
	int n,k; cin>>n>>k;
	vl v(n);
	rep(i,0,n)cin>>v[i];
	rep(i,0,n){
		if(i>=k){
			if(v[i-k]<v[i])cout<<"Yes"<<endl;
			else cout<<"No"<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 4840
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const ll mod = 1000000007;

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

    int N, K;
    cin >> N >> K;

    ll ans = 0;
    FOR(n, K, N+2) {
        ll _min = n*(n-1)/2;
        ll _max = n*(N-(n-1) + N)/2;
        ans += ((_max-_min + 1) + mod)%mod;

        //cout << n << ": " << "max=" << _max << ": min=" << _min << endl;
    } 

    cout << ans%mod << endl;

    return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
//小さい順にソート
int c[100002];
void merge(int i,int j,int *s){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d]=s[b];
        b++;
      }
      else if(j<b){
        c[d]=s[a];
        a++;
      }
      else if(s[a]<s[b]){
        c[d]=s[a];
        a++;
      }
      else{
        c[d]=s[b];
        b++;
      }
    }
    for(d=i;d<=j;d++)
      s[d]=c[d];
  }
}

int main(){
  int n,i;
  scanf("%d",&n);
  int a[n+1];
  a[0]=0;
  for(i=1;i<=n;i++)
    scanf("%d",&a[i]);
  merge(0,n,a);
  int check=0,count=0;
  for(i=1;i<=n;i++){
    if(a[i]==a[i-1]){
      if(check%2==0)
        count++;
      else
        count--;
      check++;
    }
    else{
      count++;
      check=1;
    }
  }
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 2488
#include<stdio.h>
#include<stdlib.h>
int l[100005], r[100005];
long long int c[100005];
int asc(const void* a, const void* b)
{
	if (l[*(int*)a] > l[*(int*)b])return 1;
	if (l[*(int*)a] < l[*(int*)b])return -1;
	return 0;
}
long long int min(long long int a, long long int b)
{
	if (a < b)
		return a;
	else
		return b;
}
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int i, j;
	for (i = 0; i < m; i++)
	{
		scanf("%d %d %lld", &l[i], &r[i], &c[i]);
		l[i]--;
		r[i]--;
	}
	int a[100005];
	for (i = 0; i < m; i++)
		a[i] = i;
	qsort(a, m, sizeof(int), asc);
	long long int seg[400005];
	int p = 1;
	while (p < n)
		p *= 2;
	for (i = 0; i < 2 * p - 1; i++)
		seg[i] = 1000000000000000018;
	seg[p - 1] = 0;
	int sl, sr;
	for (i = 0; i < m; i++)
	{
		sl = 0;
		sr = p;
		j = 0;
		while (j < p - 1)
		{
			seg[2 * j + 1] = min(seg[2 * j + 1], seg[j]);
			seg[2 * j + 2] = min(seg[2 * j + 2], seg[j]);
			if (l[a[i]] < (sr + sl) / 2)
			{
				sr = (sl + sr) / 2;
				j = 2 * j + 1;
			}
			else
			{
				sl = (sl + sr) / 2;
				j = 2 * j + 2;
			}
		}
		sl = l[a[i]] + p - 1;
		sr = r[a[i]] + p - 1;
		while (sl != sr)
		{
			if (sl % 2 == 0)
				seg[sl] = min(seg[sl], seg[l[a[i]] + p - 1] + c[a[i]]);
			if (sr % 2 > 0)
			{
				seg[sr] = min(seg[sr], seg[l[a[i]] + p - 1] + c[a[i]]);
				sr--;
			}
			sl = (sl - 1) / 2;
			sr = (sr - 1) / 2;
		}
		seg[sl] = min(seg[sl], seg[l[a[i]] + p - 1] + c[a[i]]);
	}
	sl = 0;
	sr = p;
	j = 0;
	while (j < p - 1)
	{
		seg[2 * j + 1] = min(seg[2 * j + 1], seg[j]);
		seg[2 * j + 2] = min(seg[2 * j + 2], seg[j]);
		if (n - 1 < (sr + sl) / 2)
		{
			sr = (sl + sr) / 2;
			j = 2 * j + 1;
		}
		else
		{
			sl = (sl + sr) / 2;
			j = 2 * j + 2;
		}
	}
	if (seg[n + p - 2] > 1000000000000015)
		printf("-1\n");
	else
		printf("%lld\n", seg[n + p - 2]);
	return 0;
}

Measured memory_bytes: 5236
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

class restaurant {
public:
  i64 id;
  std::string city;
  i64 score;

  bool operator<(const restaurant& other) const {
    return this->city < other.city || (this->city == other.city && this->score > other.score);
  }
};

namespace std {
  std::istream& operator>>(std::istream& is, restaurant& self) {
    static i64 next_id = 1;
    self.id = next_id++;
    return is >> self.city >> self.score;
  }
}

int main() {
  i64 N;
  std::cin >> N;
  std::vector<restaurant> restaurants;
  tools::read(restaurants, N);
  std::sort(restaurants.begin(), restaurants.end());
  for (const restaurant& restaurant : restaurants) {
    std::cout << restaurant.id << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int[] L = new int[N];
        for (int i = 0; i < N; i++) {
            L[i] = Integer.parseInt(scanner.next());
        }
        int total = Arrays.stream(L).sum();
        int max = Arrays.stream(L).max().orElse(0);
        System.out.println(total - max > max ? "Yes" : "No");


    }
}



Measured memory_bytes: 28500
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	A := ScanInt(scanner)
	B := ScanInt(scanner)
	C := ScanInt(scanner)
	X := ScanInt(scanner)
	Y := ScanInt(scanner)
	
	if (A + B <= 2 * C) {
	    fmt.Println(A * X + B * Y)
	} else {
	    max := Max(X, Y)
	    min := Min(X, Y)
	    
	    ans := 2 * C * min
	    
	    max -= min
	    if max > 0 {
	        if min == X {
	            if B <= 2 * C {
	                ans += B * max
	            } else {
	                ans += 2 * C * max
	            }
	        } else {
	            if A <= 2 * C {
	                ans += A * max
	            } else {
	                ans += 2 * C * max
	            }
	        }
	    }
	    fmt.Println(ans)
	}
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func ScanText(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func Max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Abs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

Measured memory_bytes: 640
import math
a,b,c,d = map(int,input().split())

def death_time(hp,atack):
    if hp%atack == 0:
        return hp/atack
    else:
        return hp//atack + 1

takahashi_death = death_time(a,d)
aoki_death = death_time(c,b)

if aoki_death<=takahashi_death:
    print("Yes")
else:
    print("No")

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

int main (){
  int H , A ,B;
  cin >> H >> A ;
  
  
  
  for (int i = 1 ; i <= H ;i++){ 
    B = H-A*i ;
    
    if  (B <=  0 ){
      cout << i << endl ; 
    return 0 ; 
    }


  
  
  
  }
  
  
  
}



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

int main() {
	int a,b,cnt=0;
	string s;
	cin>>a>>b;
	for(int i=a;i<b+1;i++){
		s=to_string(i);
		if(s.substr(0,1)==s.substr(4,1) && s.substr(1,1)==s.substr(3,1))cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner stdIn=new Scanner(System.in);
        int x=stdIn.nextInt();
        int y=stdIn.nextInt();
        int z=stdIn.nextInt();
        if(x<y){
            if(y<z){
                System.out.println(x+" "+y+" "+z);
            }else if(z<x){
                System.out.println(z+" "+x+" "+y);
            }else{
                System.out.println(x+" "+z+" "+y);
            }
        }
        else if(y<x){
            if(x<z){
                System.out.println(y+" "+x+" "+z);
            }else if(z<y){
                System.out.println(z+" "+y+" "+x);
            }else{
                System.out.println(y+" "+z+" "+x);
            }
        }
    }        
}


Measured memory_bytes: 26288
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit()

INF = 10 ** 18 + 1
ans = 1
for e in a:
    ans *= e
    ans = min(ans, INF)

if ans == INF:
    ans = -1

print(ans)


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

int main() {
  char s[3];
  scanf("%s",s);
  sort(s,s+4);
  if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) {
    cout << "Yes";
  }
  else cout << "No";
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, 0, n) cin >> a[i];
  ll x2 = 0;
  rep(i, 0, n) {
    if (i & 1)
      x2 -= a[i];
    else
      x2 += a[i];
  }

  vector<int> ans(n);
  ans[0] = x2 / 2;
  rep(i, 0, n - 1) { ans[i + 1] = a[i] - ans[i]; }

  rep(i, 0, n) ans[i] *= 2;
  rep(i, 0, n) {
    if (i > 0)
      cout << " ";
    cout << ans[i];
  }
  cout << endl;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  vector<int> v(n);
  int mn=INT_MAX;
  for(int i=0;i<n;i++)
  {
    cin>>v[i];
    if(v[i]<mn)
        mn=v[i];
  }
  vector<bool> v1(k+1);
  for(int i=0;i<mn;i++)
    v1[i]=false;
  for(int i=mn;i<=k;i++)
  {
    v1[i]=false;
    for(int j=0;j<n;j++)
    {
       if(i>=v[j]&&!v1[i-v[j]])
       {
         v1[i]=true;
         break;
       }
    }
  }
  if(v1[k])
    cout<<"First"<<endl;
  else
    cout<<"Second"<<endl;
  return 0;
}



Measured memory_bytes: 3648
#include<stdio.h>
#define MAX 100000
int A[MAX],n;

int partition(int p, int r) {
  int x = A[r];
  int i = p-1,j,temp;
  for(j=p;j<r;j++) {
    if(A[j] <= x) {
      i++;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
    temp = A[i+1];
    A[i+1] = A[r];
    A[r] = temp;
  return i+1;
}

int main()  {
  int i,q;
  scanf("%d",&n);
  for(i = 0;i<n;i++) scanf("%d",&A[i]);
   q = partition(0,n-1);

   for(i = 0;i<n;i++) {
     if(i) printf(" ");
     if(i == q) printf("[");
     printf("%d", A[i]);
     if(i ==q) printf("]" );
   }
   printf("\n" );
   return 0;
}

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

using namespace std;
typedef long long ll;

int solve(vector<int> v)
{
    int n=v.size();
    vector<int> l(n,-1);
    stack<array<int,2>> s;
    s.push({-1,-1});
    for(int i=0;i<n;i++)
    {
        while(s.top()[0]>=v[i]) s.pop();
        l[i]=s.top()[1];
        s.push({v[i],i});
    }
    vector<int> r(n,n);
    while(!s.empty()) s.pop();
    s.push({-1,n});
    for(int i=n-1;i>=0;i--)
    {
        while(s.top()[0]>=v[i]) s.pop();
        r[i]=s.top()[1];
        s.push({v[i],i});
    }
    int res=0;
    for(int i=0;i<n;i++) res=max(res,(v[i]+1)*(r[i]-l[i]));
    return res;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0;i<h;i++) cin >> s[i];
    vector<vector<int>> sum(h-1,vector<int>(w-1,0));
    for(int i=0;i<h-1;i++) for(int j=0;j<w-1;j++) sum[i][j]=((((s[i][j]=='#')^(s[i][j+1]=='#')^(s[i+1][j]=='#')^(s[i+1][j+1]=='#'))%2)==0);
    int res=max({h,w,solve(sum[h-2])});
    for(int i=h-3;i>=0;i--)
    {
        for(int j=0;j<w-1;j++) if(sum[i][j]==1) sum[i][j]+=sum[i+1][j];
        res=max(res,solve(sum[i]));
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 23220
#include<bits/stdc++.h>
#define GO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
const int Max = 2e3 + 5;
const int Mod = 1e9 + 7;

int main()
{
	GO;
	ll l, r;
	cin >> l >> r;
	ll ans = 2019;
	r = min(r, l + 2019);
	for (ll i = l; i < min(r, l + 2019); i++)
		for (ll j = i + 1; j <= r; j++)
			ans = min(ans, i * j%2019);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
(defun solve (n)
  (let ((a (make-array n :initial-element 0)))
    (dotimes (i (1+ (floor (sqrt n))))
      (dotimes (j (1+ i))
        (dotimes (k (1+ j))
          (let* ((x (1+ i))
                 (y (1+ j))
                 (z (1+ k))
                 (sum (+ (expt x 2)
                         (expt y 2)
                         (expt z 2)
                         (* x y)
                         (* y z)
                         (* z x))))
            (when (<= sum n)
              (cond
                ((= x y z) (incf (aref a (1- sum))))
                ((or (= x y) (= y z)) (incf (aref a (1- sum)) 3))
                (t         (incf (aref a (1- sum)) 6))))))))
    a))

(defun main ()
  (let* ((n (read))
         (ans (solve n)))
    (dotimes (i n)
      (fresh-line)
      (princ (aref ans i)))
    (fresh-line)))

(main)


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

int main() {
    int tt=1;
    //cin >> t;
    while(tt--){
        ll n,x,t;
        cin >> n >> x >> t;
        if(n%x==0){
            cout << (n/x)*t<<endl;
        }else{
            cout << (n/x + 1) *t << endl;  
        }
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- "
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long  
#define p(x)               cout << x << "\n" ; 
#define MOD                100000007
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5;  
const double pie = 3.14159265358979323846 ;
// limit for array size 
double dist(double Ax,double X,double Ay, double Y){
  double best = (Ax-Ay)*(Ax-Ay) + (X-Y)*(X-Y) ;
  best = sqrt(best) ;
  return best ;
}
int tests(){ 
  // vector <vector <int>> M(3,vector <int> (3,271)) ;
  string s ;
  cin >> s ;
  int i = 0 ;
  set <int> S ;
  for(auto it : s )
    S.insert(it) ;
  if(S.size() == 1 )
    return cout << "No\n",0 ; 
  
  cout << "Yes\n" ; 
  return 0 ;
}
int main(){
    I__O ;  
    int cases = 1 ;
    // cin >> cases ; 
    while(cases--)
      tests(); 
    return 0 ; 
}

Measured memory_bytes: 256
#include<stdio.h>

struct intree{
  int parent;
  int left;
  int right;
  int key;
};

int size;
struct intree list[100000];
int Parent(int i){
   return list[i/2].key;
}

int Left(int i){
  return list[2*i].key;
 
}

int Right(int i){
  return list[2*i+1].key;  
 
}

int main(void){
  int i,j;
  
  scanf("%d",&size);
  for(i=1;i<=size;i++) scanf("%d",&list[i].key);
  
  
  for(i=1;i<=size;i++){
    if(i!=1) list[i].parent=Parent(i);
    else  list[i].parent=-1;  
    list[i].left=Left(i);
    list[i].right=Right(i);
  }
  
  
  for(i=1;i<=size;i++){
    printf("node %d: ",i);
    printf("key = %d, ",list[i].key);  
    if(i!=1)
      printf("parent key = %d, ",list[i].parent);
    if(size>=2*i)
      printf("left key = %d, ",list[i].left);
    if(size>=2*i+1)
      printf("right key = %d, ",list[i].right);
    printf("\n");  
  }
  return 0;
}

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

typedef long long ll;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
ll q[N]; 
int n, k;

int main()
{
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++) scanf("%lld", &q[i]);
	
	sort(q + 1, q + 1 + n);
	
	ll res = 1;
	if(n == k || q[n] < 0) {
		//奇数就选绝对值尽量小，偶数就选绝对值尽量大 
		if(k & 1) for(int i = n - k + 1; i <= n; i++) res = res * q[i] % mod;
		else for(int i = 1; i <= k; i++) res = res * q[i] % mod;
	}
	else {
		int l = 1, r = n;
		if(k & 1) res = res * q[r] % mod, r--, k--;
		while(k) {
			if(q[l] * q[l + 1] > q[r] * q[r - 1]) res = res * q[l] % mod * q[l + 1] % mod, l += 2;
			else  res = res * q[r] % mod * q[r - 1] % mod, r -= 2;
			k -= 2;
		}
	}
	
	res = (res % mod + mod) % mod;
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 5276
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int main()
{
    int k;
    cin>>k;
    int sum=0,len=1;
    while(1)
    {
        sum=sum*10+7;
        sum%=k;
        if(sum==0)
        {
            cout<<len<<endl;
            return 0;
        }
        if(len>k)
        {
            cout<<-1<<endl;
            return 0;
        }
        len++;
    }


}

Measured memory_bytes: 3608
#include<stdio.h>
int main(void){
   int x, y, h, w, l, n, i, sum = 0;;
   scanf("%d", &n);
   while ( n != 0) {
      for (i = 0; i < n; i++ ) {
         scanf("%d %d %d %d", &x, &y, &h, &w);
         l = x + y + h;
         if ( l <= 60 && w <= 2 ) sum += 600;
         else if ( l <= 80 && w <= 5) sum += 800;
         else if ( l <= 100 && w <= 10 ) sum += 1000;
         else if ( l <= 120 && w <= 15 ) sum += 1200;
         else if ( l <= 140 && w <= 20 ) sum += 1400;
         else if ( l <= 160 && w <= 25 ) sum += 1600;
      }
      printf("%d\n", sum);
      sum = 0;
      scanf("%d", &n);
   }
   return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string.h>
#include <cmath>

using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);++(i))

int n,m;

vector<int> s;
vector<int> d;

int main(){

    while(cin >> n >> m,n || m){
        s.assign(n,0);
        d.assign(m,0);
        for(int i = 0;i < n;i++){
            cin >> s[i];
        }
        for(int i =  0;i < m;i++){
            cin >> d[i];
        }

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

        vector<int> dp((1 << n),0);
        vector<int> ofuton((1 << n),0);

        for(int i = 1;i < (1 << n);i++){
            for(int j = 0;j < n;j++){
                if(i & (1 << j)){
                    ofuton[i] = ofuton[i & ~(1 << j)] + s[j];
                }
            }
        }

        dp[0] = 0;

        for(int i = 0;i < m;i++){
            for(int state = 0;state < ( 1 << n ) ; state++){
                for(int j = 0;j < n;j++){
                    if(state & (1 << j)){
                        int before = state & ~(1 << j);
                        dp[state] = min(dp[state] , dp[before]);
                    }
                }
            }

            for(int state = 0;state < (1 << n) ; state++){
                dp[state] += abs(d[i] - ofuton[state]);
            }
        }

        int res = dp[0];
        for(int r : dp){
            res = min(res , r);
        }

        cout << res << endl;
    }
}

        




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

int main() {
  int A, B, j;
  j = 0;
  cin >> A >> B;
  for (int i = 0; i <= B - A; i++){
    int a, b, c, d, e;
    a = (A + i) / 10000;
    b = ((A + i) % 10000) /1000;
    c = ((A + i) % 1000) /100;
    d = ((A + i) % 100) /10;
    e = (A + i) % 10;
    if (a == e && b == d)
    j++;
  }
  cout << j << endl;
}


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

int main(){
  int n;
  cin >> n;
  
  int ans = 0;
  for (int i = 1; i <= n; i+=2)
  {
    int cnt = 0;
    for (int j = 1; j <= i; j++)
    {
      if(i%j==0) cnt++;
    }
    if(cnt==8) ans++;    
  }
  cout << ans << endl;  
}

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

typedef long long ll;
#define ABSOL(a) (a<0 ? (a*(-1)) : a)
#define rep(i, a, b) for(i = a; i < b; i++)
#define REP(i, a, b) for(i = a; i <= b; i++ )
#define scanstr(str) getline(cin, str)

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	ll a, b;
	
	cin >> a >> b;
	
	a = a - (2 * b);
	
	if(a < 0){
		cout << 0 << endl;
		return 0;
	}
	
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;


int main()
{
	string s;
	int m;
	cin >> s >> m;
	
	string S;
	for (unsigned int i = 0; i < (s.size() + m - 1) / m; i++)
		printf("%c", s.at(i * m ));
}

Measured memory_bytes: 256