akhauriyash/Code-Regression huggingface dataset:
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add_self(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int add(int a,int b){
	int c=a+b;
	if(c>=mod){
		c-=mod;
	}
	return c;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;

int pref[N][22];

void solve(){
	int n;
	cin>>n;
	vi a(n);
	cin>>a;
	for(int i=0;i<n;i++){
		for(int j=0;j<=20;j++){
			pref[i+1][j]+=pref[i][j];
			if(a[i]&(1<<j)){
				pref[i+1][j]++;
			}
		}
	}
	ll ans=0;
	for(int i=0;i<n;i++){
		int l=i,r=n-1;
		int an=i;
		while(l<=r){
			int mid=(l+r)/2;
			bool flag=false;
			for(int j=0;j<=20;j++){
				if(pref[mid+1][j]-pref[i][j]>=2){
					flag=true;
					break;
				}
			}
			if(!flag){
				l=mid+1;
				an=max(an,mid);
			}
			else{
				r=mid-1;
			}
		}
		ans+=an-i+1;
	}
	cout<<ans;
	
	
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 19456
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

typedef long long ll;

const ll INF = 1e18;
const int BIG = 1e9;
const int maxN = 100 * 1000 + 9;
const string FILENAME = "sample";

string s;

void read(){
	cin >> s;
}

ll ans = 0;
vector<pair<char, ll> > stak;

void insertChar(char c){
	int L = stak.size();
	if(L >= 2 && (stak[L - 2].first == 'A') && (stak[L - 1].first == 'B') && (c == 'C')){
		//cerr << "abc\n";
		ans += stak[L - 2].second;
		ll cnt = stak[L - 2].second;
		stak.pop_back();
		stak.pop_back();
		
		while(stak.size() && stak.back().first == 'A'){
			ans += stak.back().second;	cnt += stak.back().second;
			stak.pop_back();
		}
		
		stak.push_back(make_pair('B', 1));
		stak.push_back(make_pair('C', 1));
		stak.push_back(make_pair('A', cnt));
	} else {
		stak.push_back(make_pair(c, 1));
	}
}

void solv(){
	for(int i = 0, L = s.size(); i < L; i++){
		insertChar(s[i]);
	}

	cout << ans << '\n';
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
#ifdef h4h4
	freopen((FILENAME + ".inp").c_str(), "r", stdin);
	freopen((FILENAME + ".out").c_str(), "w", stdout);
#endif

	read();
	solv();

	return 0;
}

Measured memory_bytes: 6664
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<ll, ll>
const ll  MOD = 1000000007;

int main() {
	ll s, w;
	cin >> s >> w;
	if (s <= w) cout << "unsafe";
	else cout << "safe";
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x;
    cin>>x;
    cout<<1-x<<endl;
    return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>

int main(void){
	int n, cnt = 0;
	int total = 100000;
	
	scanf("%d", &n);
	
	for(cnt = 0; cnt < n; cnt++){
		total = total + total * 0.05;
		if(total % 1000 != 0){
			total = total + 1000;
			total = total / 1000;
			total = total * 1000;
		}
	}
	
	printf("%d\n", total);
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
 
int main()
{
    int a, b, c, x, n=0;
    cin >> a >> b >> c;
    for (x = a; x <= b; x++) {
        if (c%x == 0) {
            n = n + 1;
        }
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int h, w, n;
bool contain(int y, int x){
   return (0 <= y && y < h - 2 && 0 <= x && x < w - 2);
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> h >> w >> n;
    map<P, int> mp;
    while(n--){
        int y, x;
        cin >> y >> x;
        y--; x--;
        for(int i = y - 2; i <= y; i++){
            for(int j = x - 2; j <= x; j++){
                if(!contain(i, j)) continue;
                mp[{i, j}]++;
            }
        }
    }
    vector<int> ans(10);
    for(auto i : mp){
        ans[i.second]++;
    }
    ans[0] = (h - 2) * (w - 2);
    rep(i, 1, 10) ans[0] -= ans[i];
    for(int ii = 0; ii < ans.size(); ii++){
        cout << ans[ii] << endl;
    }
}

Measured memory_bytes: 56576
X,Y,A,B,C= map(int, input().split())
R = list(map(int, input().split()))
G = list(map(int, input().split()))
N = list(map(int, input().split()))

R.sort(reverse=True)
G.sort(reverse=True)
N.sort(reverse=True)

R2 = R[:X]
G2 = G[:Y]

W = sorted(R2 + G2 + N, reverse=True)

print(sum(W[0:X+Y]))

Measured memory_bytes: 23328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<4;i++){
      if(s[i]=='+')
      ans++;
      else
      ans--;
  }
  cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

int N, M, A[1010], B[1010], C[1010], D[1010], E[1010], F[1010];
int XC, X[3030], YC, Y[3030]; int Z[3030][3030]; bool K[3030][3030];

int getx(int x) { return lower_bound(X, X + XC, x) - X; }
int gety(int y) { return lower_bound(Y, Y + YC, y) - Y; }

queue<pair<int, int> > Q;
void enq(int x, int y)
{
	if (!K[x][y]){
		Q.push({ x,y }); K[x][y] = 1;
	}
}

int main()
{
	scanf ("%d %d", &N, &M);
	for (int i = 0; i < N; i++){
		scanf ("%d %d %d", &A[i], &B[i], &C[i]);
		X[XC++] = A[i];
		X[XC++] = B[i];
		Y[YC++] = C[i];
	}
	for (int i = 0; i < M; i++){
		scanf ("%d %d %d", &D[i], &E[i], &F[i]);
		X[XC++] = D[i];
		Y[YC++] = E[i];
		Y[YC++] = F[i];
	}
	X[XC++] = -1.1e9;
	X[XC++] = 0;
	X[XC++] = 1.1e9;
	Y[YC++] = -1.1e9;
	Y[YC++] = 0;
	Y[YC++] = 1.1e9;

	sort(X, X + XC);
	XC = unique(X, X + XC) - X - 1;
	sort(Y, Y + YC);
	YC = unique(Y, Y + YC) - Y - 1;

	for (int i = 0; i < N; i++){
		int a = getx(A[i]);
		int b = getx(B[i]);
		int c = gety(C[i]);

		for (int j = a; j < b; j++){
			Z[j][c - 1] |= (1 << 0);
			Z[j][c] |= (1 << 2);
		}
	}

	for (int i = 0; i < M; i++){
		int d = getx(D[i]);
		int e = gety(E[i]);
		int f = gety(F[i]);

		for (int j = e; j < f; j++){
			Z[d - 1][j] |= (1 << 1);
			Z[d][j] |= (1 << 3);
		}
	}

	int sx = getx(0), sy = gety(0);
	for (int p=0;p<2;p++) for (int q=0;q<2;q++) enq(sx - p, sy - q);
	while (!Q.empty()){
		int x = Q.front().first, y = Q.front().second; Q.pop();
		for (int k = 0; k < 4; k++) if (~Z[x][y] & (1 << k)){
			int px = x + dx[k];
			int py = y + dy[k];
			if (px < 0 || px >= XC || py < 0 || py >= YC) continue;
			enq(px, py);
		}
	}

	for (int i = 0; i < YC; i++){
		if (K[0][i] || K[XC - 1][i]){
			puts("INF");
			return 0;
		}
	}
	for (int i = 0; i < XC; i++){
		if (K[i][0] || K[i][YC - 1]){
			puts("INF");
			return 0;
		}
	}
	long long ans = 0;
	for (int i = 0; i < XC; i++) for (int j = 0; j < YC; j++) if (K[i][j]){
		ans += 1ll * (X[i + 1] - X[i]) * (Y[j + 1] - Y[j]);
	}
	printf ("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 45044
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;
ll fac[MAX],finv[MAX],inv[MAX];

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

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

int main(){
  ll N,ans=0ll;
  cin>>N;
  COMinit();
  
  int A[N],B[N];
  REP(i,N) cin>>A[i]>>B[i];
  
  ll DP[4005][4005];
  REP(i,4005){
    REP(j,4005){
      DP[i][j]=0;
    }
  }
  
  REP(i,N){
    DP[2000-A[i]][2000-B[i]]++;
  }
  
  REP(i,4003){
    REP(j,4003){
      DP[i+1][j]+=DP[i][j];
      DP[i+1][j]%=MOD;
      DP[i][j+1]+=DP[i][j];
      DP[i][j+1]%=MOD;
    }
  }
  
  REP(i,N){
    ans+=DP[A[i]+2000][B[i]+2000];
    ans-=COM(2*(A[i]+B[i]),2*A[i]);
    ans%=MOD;
  }
  
  ans=1LL*ans*inv[2]%MOD;
  if(ans<0) ans+=MOD;
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 246656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

bool debug = 0;

void solve() {
    int n;
    string s;
    cin >> n >> s;
    int num = 0, cnt = 0;
    for (; num < 1000; ++num) {
        int ok = 0;
        string numstr = "000";
        int tmp = num;
        for (int i = 0; i < 3; ++i) {
            numstr[2 - i] = char('0' + tmp % 10);
            tmp /= 10;
        }
        for (int i = 0; i < n; ++i) {
            if (s[i] == numstr[ok]) {
                ++ok;
            }
            if (ok == 3) {
                ++cnt;
                break;
            }
        }
    }
    cout << cnt << endl;
}

int main() {
    if (debug) {
        while (true) {
            cout << "********" << endl;
            solve();
        }
    } else {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3556
//
//  main.cpp
//  temp
//
//  Created by tolemy on 2019/08/04.
//  Copyright © 2019 tolemy. All rights reserved.
//

#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    
    int n = 0;
    cin >> n;
    
    cout << n * n * n;
    
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
KS = [[] for i in range(M)]
for i in range(M):
  KS[i]= list(map(int, input().split()))
P = list(map(int, input().split()))

ans = 0
for i in range(2**N):
  sl = []
  for j in range(N):
    if (i>>j)&1:
      sl.append(j+1)
  for j in range(M):
    if len(set(KS[j][1:])&set(sl))%2 ==P[j]:
      continue
    else:
      break
  else:
    ans += 1
    
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
//using namespace __gnu_pbds;
//typedef tree< pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
//ordered_set;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
#define X first
#define Y second
#define int long long int 
const int N = (int)1e6 + 10;
const int MOD = (int) 1e9 + 7;

int fastpower(int a, int b){
    int res = 1;
    a %= MOD;
    while(b){
        if(b&1) res = (res * a) % MOD;
        a *= a; a %= MOD;
        b >>= 1;
    }
    return res;
}


void solve(){
    //THink in reverse..
    // we want to find contribution of each gcd to happen
    // consider we have k places _ , _ , _ , _ , __ ,n.
    // gcd = 1 -> k^n ways;
    // gcd = 2 -> total multiples of 2 are k/2 -> (k/2)^n ways
    // so on until gcd = n;
    // but we need to take care of overcounting
    int n, k;
    cin >> n >> k;
    vector<int> dp(k + 1, 0);
    for(int gd = k; gd >= 1; --gd){
        int total_multiples = k/gd;
        int temp = fastpower(total_multiples, n);
        temp %= MOD;
        temp %= MOD;
        int extra = 0;
        for(int j = gd * 2; j <= k; j += gd){
            extra = (extra + dp[j]) % MOD;
        }
        dp[gd] = (temp - extra + MOD) % MOD;
    }

    int ans = 0;
    for(int i = 1; i <= k; ++i){
        int add = ( dp[i] % MOD * i % MOD ) % MOD;
        ans += add, ans %= MOD;
    }

    cout << ans << '\n';
   
    
}

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    //int t; cin >> t;
    //while(t--)
        solve();
    return 0;
}
/*
Sample inp
*/

Measured memory_bytes: 3992
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 

void solve()
{
  long double l;
  cin>>l;
  cout<<setprecision(14)<<fixed<<(l/3)*(l/3)*(l/3);
  
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
//  #ifndef ONLINE_JUDGE
//       // for getting input from input.txt
//      freopen("input.txt", "r", stdin);
// //     // for writing output to output.txt
// //     freopen("output1.txt", "w", stdout);
//  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

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

int main() {
  int N, M, K, ans;
  cin >> N >> M >> K;
  ans=0;
  for (int i=0; i<=N; i++) {
    for (int j=0; j<=M; j++) {
      if (i*(M-j)+j*(N-i)==K) {
        ans=ans+1;
      }
    }
  }
  if (ans>0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

int main() {
    int a,b,m;
    cin >> a >> b >> m;
    vector<ll> A(a);
    vector<ll> B(b);
    ll ans = 1000000;
    rep(i,a){
    cin >> A[i]; 
    ans=min(ans,A[i]);
    }
    ll MIN=10000000;
    rep(i,b){
    cin >> B[i];
    MIN=min(B[i],MIN);
    }
    ans+=MIN;
  //cout << ans << endl;
    rep(i,m){
        ll k,l,n;
        cin >> k>>l>>n;
        ans=min(ans,A[k-1]+B[l-1]-n);
     // cout << ans << endl;
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		Console.WriteLine("{0}",new string('x',sc.S.Length));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
using namespace std; 
#define X real()
#define Y imag()

const double EPS = 1e-10;

bool EQ(double a,double b){
  return fabs(a-b) < EPS;
}

typedef complex<double> Point;

namespace std {
  bool operator == (const Point &a, const Point &b) {
    return EQ(a.X, b.X) && EQ(a.Y, b.Y);
  }
  bool operator < (const Point &a, const Point &b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}
struct Segment {
  Point p1, p2;
  Segment(){};
Segment(Point p1, Point p2) : p1(p1), p2(p2) {};
};

typedef Segment Line;
double dot(Point a, Point b){
  return a.X * b.X + a.Y * b.Y;
}
double cross(Point a, Point b){
  return a.real() * b.imag() - a.imag() * b.real();
}

Point project(Segment s, Point p) {
  double r = dot(p - s.p1, s.p2 - s.p1) / norm(s.p2 - s.p1);
  return s.p1 + (s.p2 - s.p1) * r;
}

Point reflect(Segment s, Point p) {
  return p + (project(s, p) - p) * 2.0;
}

bool isOrthogonal(Line l1, Line l2) {
  return EQ(dot(l1.p1 - l1.p2, l2.p1 - l2.p2), 0.0);
}
bool isParallel(Line l1, Line l2) {
  return EQ(cross(l1.p1 - l1.p2, l2.p1 - l2.p2), 0.0);
}

bool intersectLP(Line l, Point p) {
  return EQ(cross(l.p2 - p, l.p1 - p), 0.0);
}
bool intersectSP(Segment s, Point p) {
  return EQ(abs(s.p1 - p) + abs(p - s.p2), abs(s.p2 - s.p1));
}

const int COUNTER_CLOCKWISE = +1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = +2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;
string ccw(Point a, Point b, Point c) {
  Point x = b - a;
  Point y = c - a;
  if(cross(x, y) > EPS) return "COUNTER_CLOCKWISE";
  if(cross(x, y) < -EPS) return "CLOCKWISE";
  if(dot(x, y) < -EPS) return "ONLINE_BACK";
  if(norm(x) < norm(y)) return "ONLINE_FRONT";
  return "ON_SEGMENT";
}

int main()
{
  int n;
  
  Point p0,p1,p2;
  cin >> p0.X >> p0.Y >> p1.X >> p1.Y;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p2.X >> p2.Y;
    cout << ccw(p0,p1,p2) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1252
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int A[110];
int main(){
	int n,x;
	cin >> n >> x;
	for(int i = 0;i < n;i++){
		cin >> A[i];
		x -= A[i];
	}
	sort(A,A + n);
	int ans = n;
	ans += x / A[0];
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	static long mod=1000000007;
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		int[]ar=split();
		int h=ar[0];
		int w=ar[1];
		int[][]a =new int[h][w];
		int[][]b=new int[h][w];
		for(int i=0;i<h;i++)
		{
			ar=split();
			for(int j=0;j<w;j++)
			{
				a[i][j]=ar[j];
			}
		}
		for(int i=0;i<h;i++)
		{
			ar=split();
			for(int j=0;j<w;j++)
			{
				b[i][j]=ar[j];
			}
		}
		boolean[][][]dp=new boolean[h][w][12800];
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				Arrays.fill(dp[i][j], false);
			}
		}
		dp[0][0][Math.abs(a[0][0]-b[0][0])]=true;
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				for(int k=0;k<12800;k++)
				{
					if(!dp[i][j][k])
						continue;
					if(i+1<h)
					{
						dp[i+1][j][k+Math.abs(a[i+1][j]-b[i+1][j])]=true;
						dp[i+1][j][Math.abs(k-Math.abs(a[i+1][j]-b[i+1][j]))]=true;
					}
					if(j+1<w)
					{
						dp[i][j+1][k+Math.abs(a[i][j+1]-b[i][j+1])]=true;
						dp[i][j+1][Math.abs(k-Math.abs(a[i][j+1]-b[i][j+1]))]=true;
					}
				}
			}
		}
		int ans=1000000000;
		for(int i=0;i<12800;i++)
		{
			if(dp[h-1][w-1][i])
				ans=Math.min(ans,i);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 141656
let () = Scanf.scanf "%d %d %d" @@ fun r d x2000 ->
  let xs = Array.make 11 0 in
  xs.(0) <- x2000;
  for i = 1 to 10 do
    xs.(i) <- r * xs.(i - 1) - d;
    Printf.printf "%d\n" xs.(i)
  done

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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    lli n, A, B, curr, l, r, m, cnt, ans ;
    cin>> n >> A >> B ;
    vlli h(n+1) ;
    for(int i=1 ; i<=n ; i++)
      cin>> h[i] ;
    sort(h.begin()+1, h.end()) ;
    A-=B ;
    l=1 ; r=h[n]*A ;
    ans=r ;
    while(l<=r)
      {
        m=(l+r)/2 ;
        cnt=0 ;
        for(int i=1 ; i<=n ; i++)
          {
            curr=max(0LL, h[i]-B*m) ;
            cnt+=ceil(curr/(1.0*A)) ;
          }
        if(cnt<=m)
          {
            r=m-1 ;
            ans=min(ans, m) ;
          }
        else l=m+1 ;
      }
    cout<< ans ;
  }


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



int main()
{
int n,k;
cin>>n>>k;
vector<int> v(n);
for(int index = 0 ;index< n;index++)
    cin>>v[index];

    sort(v.rbegin(),v.rend());

int ans = 0;
for(int index = 0 ;index <k;index++)
    ans+= v[index];

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


Measured memory_bytes: 3608
n = int(input())
x = []
for i in range(n):
    x.append(int(input()))

def isPrime(x):
    if x == 2:
        return True
    
    if x < 2 or x%2 == 0:
        return False
    
    i = 3
    while i <= x**0.5:
        if x%i == 0:
            return False
        i += 2
    
    return True

counter = 0
for i in range(n):
    if isPrime(x[i]) == True:
        counter += 1

print(counter)


Measured memory_bytes: 5988
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int cost = 0;
        int cost2 = 0;
        boolean[] a = new boolean[n+1];

        Arrays.fill(a,false);

        for(int i = 0;i<m;i++){
            int num = sc.nextInt();
            a[num] = true;
        }

        for(int i = x+1;i<=n;i++){
            //System.out.println("cost : " + i);
            if(a[i]){
                cost++;
            }
        }

        for(int i = x-1;i>=0;i--){
            //System.out.println("cost2 : " + i);
            if(a[i]){
                cost2++;
               // System.out.println()
            }
        }
       // System.out.println(cost);
        //System.out.println(cost2);
        System.out.println(Math.min(cost,cost2));
        
    }
}


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

long long pow2(long long x, long long n, int mod=0) {
  if (n == 0) return 1;
  if (mod) {
    if (n & 1) return x * pow2(x, n - 1, mod) % mod;
    long long y = pow2(x, n / 2, mod);
    return y * y % mod;
  } else {
    if (n & 1) return x * pow2(x, n - 1);
    long long y = pow2(x, n / 2);
    return y * y;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k; cin >> n >> k;
  double res = 0;
  for (int i = 1; i < n + 1; i++) {
    int j = i;
    int denom = 1;
    while (j < k) {
      j *= 2;
      denom *= 2;
    }
    res += 1 / (double)denom;
  }
  res /= n;
  cout << setprecision(10) << res << '\n';
  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define pb(x) push_back(x)
#define HAYAKU_HAYAKU ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long SIZE = 1000001;
int main()
{
    HAYAKU_HAYAKU; 
    int n;
    cin>>n;
    n >= 30 ? cout<<"Yes" : cout<<"No";
}

Measured memory_bytes: 3620
#include<iostream>
#include <string>
#include <math.h>

using namespace std;
int main(void)
{
	string s, t;

	cin >> s;
	cin >> t;

	bool ans = true;

	for (int i = 0; ans && i < s.size(); ++i)
	{
		if (s.c_str()[i] != t.c_str()[i])
		{
			ans = false;
		}
	}

	if (ans)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;

}

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        int n, m;
        cin >> n >> m;
        if (n == 0) break;
        int masu[1005] = {};
        rep(i, n) cin >> masu[i + 1];
        int sa[1005] = {};
        rep(i, m) cin >> sa[i];
        int now = 1;
        int ans = 0;
        int i = 0;
        while (i < m && now < n) {
            ans++;
            now += sa[i];
            i++;
            if (now >= n) break;
            now += masu[now];
            now = max(1, now);
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 3016
def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    n = int(input().rstrip())
    a_list = [int(x) for x in input().rstrip().split(" ")]

    def get_num(num, max_count):
        count = 0
        while num % 2 == 0 and count < max_count:
            num = num // 2
            count += 1
        return count

    first = True
    ans = float('inf')
    for a in a_list:
        count = get_num(a, ans)
        if ans > count:
            ans = count

    print(ans)


if __name__ == "__main__":
    resolve()


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

int main() {
	string s[] = {"Sunny", "Cloudy", "Rainy"};
	string S;
	cin >> S;
	for (int i = 0; i < 3; i++) {
		if (S == s[i]) {
			cout << s[(i+1)%3] << endl;
			break;
		}
	}
}


Measured memory_bytes: 256
n = gets.to_s.to_i

q = ["a"]

# a
# aa, ab
# aaa, aab, aba, abb, abc
(n-1).times do |i|
  
  q_n = []
  while q.any?
    
    s = q.shift
    m = s.chars.uniq.size
    
    (m+1).times do |j|
      q_n.push( s + (97 + j).chr )
    end
  end
  
  q = q_n.dup
  
end

puts q.map!{|w,_| w }

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  ll A, B;
  cin >> A >> B;
  cout << A * A - B << endl;
  return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.array;
import std.string;
import std.algorithm;

void main() {
	int n;
	n = to!int(chomp(readln()));

	int res = 0;
	for(int i = 0; i < n; i++) {
		string [] t;
		int l, r;

		t = chomp(readln()).split();
		l = to!int(t[0]);
		r = to!int(t[1]);
		res += r-l+1;
	}
	writeln(res);
}


Measured memory_bytes: 380
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;
typedef string str;

int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  cout << ((s<t)?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
int main() {
    int f[26] = { 0 };
    std::string s;
    while (std::cin >> s) {
        for (auto&& c: s) {
            if (!isalpha(c)) {
                continue;
            }
            ++f[tolower(c) - 'a'];
        }
    }
    for (int i = 0; i < 26; ++i) {
        std::cout << static_cast<char>('a' + i) << " : " << f[i] << std::endl;
    }
}



Measured memory_bytes: 3196
import sys

R, C, K = map(int, input().split())
item = [[0] * (C + 1) for _ in range(R + 1)]  # dp配列と合わせるために, 0行目, 0列目を追加している.
for s in sys.stdin.readlines():
    r, c, v = map(int, s.split())
    item[r][c] = v

dp = [[[0] * (C + 1) for _ in range(R + 1)] for _ in range(4)]
for i in range(R + 1):
    for j in range(C + 1):
        for k in range(4):
            here = dp[k][i][j]
            # 次の行に移動する場合
            if i + 1 <= R:
                # 移動先のアイテムを取らない場合
                dp[0][i + 1][j] = max(dp[0][i + 1][j], here)
                # 移動先のアイテムを取る場合
                dp[1][i + 1][j] = max(dp[1][i + 1][j], here + item[i + 1][j])
            # 次の列に移動する場合
            if j + 1 <= C:
                # 移動先のアイテムを取らない場合
                dp[k][i][j + 1] = max(dp[k][i][j + 1], here)
                # 現在のkが3未満のときのみ, 移動先のアイテムを取ることが可能
                if k < 3:
                    dp[k + 1][i][j + 1] = max(dp[k + 1][i][j + 1], here + item[i][j + 1])
ans = 0
for k in range(4):
    ans = max(ans, dp[k][-1][-1])
print(ans)

Measured memory_bytes: 429804
#include<stdio.h>
int main()
{
    int a[1001];
    int n,i,j,temp,k,sum=0;
    scanf("%d\n",&n);
    scanf("%d\n",&k);
    for(i=0;i<n;i++)
    {
        scanf("%d\n",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(a[j]<a[i])
            {
                 temp=a[i];
                 a[i]=a[j];
                 a[j]=temp;
            }
        }
    }
    for(i=0;i<k;i++)
    {
        sum+=a[i];
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 1736
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

const ll MOD = 998244353;
// const ll MOD = 1e9+7;

struct Edge{
  ll to,cost;
};

using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  Graph graph(n);
  std::vector<ll> dis(n,LONG_MAX);

  rep(i,1,n){
    ll a,b,c;
    std::cin>>a>>b>>c;
    a--;b--;
    graph[a].push_back(Edge{b,c});
    graph[b].push_back(Edge{a,c});
  }

  ll q,k;
  std::cin>>q>>k;

  k--;

  std::priority_queue<P,std::vector<P>,std::greater<P>> que;
  dis[k]=0;
  que.push(P(0,k));

  while(!que.empty()){
    P p=que.top();
    que.pop();
    ll v=p.second;
    if(dis[v]<p.first)continue;

    rep(i,0,graph[v].size()){
      Edge e=graph[v][i];
      if(dis[e.to]>dis[v]+e.cost){
        dis[e.to]=dis[v]+e.cost;
        que.push(P(dis[e.to],e.to));
      }
    }
  }

  rep(i,0,q){
    ll x,y;
    std::cin>>x>>y;
    x--;y--;
    std::cout<<dis[x]+dis[y]<<"\n";
  }
  return 0;
}

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

#define ull unsigned long long
#define ll long long
#define imei(...)   "[ "<< #__VA_ARGS__ <<" = "<< __VA_ARGS__ <<" ] "

using namespace std;

void solve(int t) {
    int n;
    cin >> n;
}

vector<ll> a,b;
int n, m, k;
int main(int argc, char *argv[])
{
    int ans = 0;
    cin >> n >> m >> k;
    a.resize(n+1, 0);
    b.resize(m+1, 0);

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i-1];
    }

    for (int i = 1; i <= m; i++) {
        cin >> b[i];
        b[i] += b[i-1];
    }

    for (int i = 0, j = m; i <= n; i++) {
        if (a[i] > k) break;
        while(a[i] + b[j] > k)
            j--;
        ans = max(ans, i+j);
    }

    cout << ans;

    return 0;
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 200000;
int n;
int a[MAX_N];
multiset<int,greater<int>> c;

int main()
{
#define FASTIO
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;
  forn(i,n) {
    cin >> a[i];
    c.insert(a[i]);
  }

  forn(i,n) {
    c.erase(c.find(a[i]));
    cout << *c.begin() << endl;
    c.insert(a[i]);
  }


  return 0;
}


Measured memory_bytes: 11776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

int main() {
    int K; cin >> K;
    int a = 7 % K;
    bool found = false;
    REP(i, K) {
        if (a == 0) {
            PRINT(i+1);
            found = true;
            break;
        }
        a = (a * 10 + 7) % K;
    }
    if (!found) PRINT(-1);
    return 0;
}

Measured memory_bytes: 3632
new Promise(function(resolve, reject) {
    let cin = "";
    process.stdin
        .on("data", chunk => { cin += chunk; })
        .on("end", () => { resolve([cin, process.stdout]); });
}).then(function([cin, cout]) {
    const d = cin.split(/[ \n]/).map(elt => parseInt(elt));
    for (let sp = 0; d[sp] !== 0; ) {
        const n = d[sp++];
        const a = d.slice(sp, sp + n);
        sp += n;
        
        const average = a.reduce((cdr, car) => cdr + car, 0) / n;
        cout.write(`${a.filter(elt => elt <= average).length}\n`);
    }
});



Measured memory_bytes: 25080
#include <bits/stdc++.h>
using namespace std;
 
#define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define ll long long
 
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
 
#define infi INT_MAX
#define infl LONG_LONG_MAX
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=(b-1);i>=a;i--)
#define F first
#define S second
#define G(a,b) get<a>(b)
#define MP make_pair
#define MT make_tuple
#define pll pair<ll,ll> 
#define endl "\n"
#define ALL(v) v.begin(),v.end()
#define nl cout<<"\n";
#define pr(x) cout<<x;
#define pr1(x) cout<<x<<" ";
#define pr2(x,y) cout<<x<<" "<<y;


void func()
{
  double l;
  cin>>l;
  double x=(l/(double)3)*(l/(double)3)*(l/(double)3);
  printf("%0.7f\n",x );
}

int main() 
{
    fast
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    
    ll ntc=1;
    //cin>>ntc;

    f(i,1,ntc+1)
    {
      //cout<<"Case #"<<i<<":";
      func();
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int in_n;
    int ai;
    int num_array[1000];
    int i;

    scanf("%d",&in_n);
    for(ai=0;ai<in_n;ai++){
        scanf("%d",&num_array[ai]);
    }
    for(i=in_n-1;i>=0;i--){
       if(i==0) printf("%d\n",num_array[i]);
       else     printf("%d ",num_array[i]);
    }
}



Measured memory_bytes: 2044
#!/usr/bin/env python3
import sys


def solve(X: int):
    dp = [False for _ in range(X+1)]
    dp[0] = True
    prices = [100,101,102,103,104,105]
    for i in range(1,X+1):
        for price in prices:
            if i >= price:
                if dp[i-price]:
                    dp[i] = dp[i-price]
                    break
    
    print(int(dp[X]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3864
W,H,N = map(int, input().split())
w=[0]*W
h=[0]*H
for i in range(N):
    x,y,a = map(int, input().split())
    if a==1:
        for i in range(x):
            w[i]=1
    if a==2:
        for i in range(x,W):
            w[i]=1
    if a==3:
        for i in range(y):
            h[i]=1
    if a==4:
        for i in range(y,H):
            h[i]=1
 
print(w.count(0)*h.count(0))

Measured memory_bytes: 9204
#include<stdio.h>
int main()
{
    int v,H,M,S,m_1,m_2;
    scanf("%d",&v);
    H=v/3600;
    m_1=v%3600;
    M=m_1/60;
    m_2=m_1%60;
    S=m_2;
    printf("%d:%d:%d\n",H,M,S);
    return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define INF (1<<30)-1
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int h,w,a,b; cin >> h >> w >> a >> b;
  vector<vi> ans(h,vi(w));

  rep(i,b) rep(j,w-a) ans[i][j+a] = 1;
  rep(i,h-b) rep(j,a) ans[i+b][j] = 1;

  bool res = true;
  rep(i,w){
    int cnt = 0;
    rep(j,h) cnt += ans[j][i];
    if(b != min(cnt,h-cnt)) res = false;
  }
  rep(i,h){
    int cnt = 0;
    rep(j,w) cnt += ans[i][j];
    if(a != min(cnt,w-cnt)) res = false;
  }
  if(res){
    rep(i,h){
      rep(j,w) cout << ans[i][j];
      cout << endl;
    }
  }else cout << "No\n";
  // cout << "\n";
  return 0;
}


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


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 1e9+7;


ll n;
//ll a[SZ];
//ll b[SZ];

ll nsum(ll x) {
    return ((x * (x-1)) / 2);
}


int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
//    ll a, b, d;
    string s, s1, s2;

    cin1(n);
    cot1(nsum(n));

    return 0;
}



Measured memory_bytes: 3616