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

//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e6+2;
void solve(){
   int h;
   sl(h);
   int res=0,cnt=1;
   while(h){
	   res=res+cnt;
	   h=h/2;
	   cnt=cnt*2;
   }
   cout<<res<<endl;
}

signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();

   }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
using namespace std;

int main(){
    int n,a,b;
    cin >> n;
    if(n==1){
        cout <<"Hello World";
    }else{
        cin >> a >> b;
        cout << a+b;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/arc098/tasks/arc098_b>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll N; cin >> N;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    ll bitflag = 0;
    int r = 0;
    for(int l = 0; l < N;l++){
        while(r < N){
            bool ok = true;
            for(int k = 0; k < 20;k++){
                if((A[r]>>k)&1){
                    if((bitflag>>k)&1){
                        ok = false;
                        break;
                    }
                }
            }
            if(!ok) break;
            bitflag += A[r++];
        }
        res += (r-l);
        
        bitflag -= A[l];
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;


public class Main {

    class A {
        int a;
        int b;

        public A(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            A a1 = (A) o;
            return a == a1.a &&
                    b == a1.b;
        }

        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }
    }


    private void solve(InputReader in, PrintWriter out) {
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();
        int x3 = x1 - (y2 - y1);
        int y3 = y1+(x2-x1);
        int x4 = x2 - (y2 - y1);
        int y4 = y2+(x2-x1);
        out.println(x4 + " " + y4 + " " + x3 + " " + y3);
    }


    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        try (
                InputReader in = new InputReader(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }


    static class InputReader implements AutoCloseable {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

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

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


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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        @Override
        public void close() {

        }
    }

}


Measured memory_bytes: 22868
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>

using namespace std;

string S;
char moji[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

int main(){
	cin >> S;
	for(int i=0; i<26;i++){
	int k=1;
		for(long long int j=0;j<S.size();j++){
			if(moji[i] == S[j]){
				k = 0;
			}
			}
					if(k==1){
				cout << moji[i] << endl;
				return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

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

set_random;

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

ll n , ans;

int main() {
    fast_io;

    cin >> n;
    for(ll i = 1 ; i * i <= n ; i++){
        if(n % i == 0){
            ll x = n / i - 1;
            if(x != 0 && n / x == n % x)  ans += x;
        }
    }
    cout << ans << endl;

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

int n,m,p,q,r,sum;

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

    while(true) {
	cin>>n;
	if(n==0) break;
	cin>>m>>p>>q>>r;
	deque<P> v;
	v.pb(P(1,n));
	REP(i,m) {
		int x,y;cin>>x>>y;
		deque<P> a,b;
		sum=0;
		while(sum+v.front().se<=x) {
			sum+=v.front().se;
			a.pb(v.front());
			v.pop_front();
		}
		a.pb(P(v.front().fi,x-sum));
		if(v.front().se>a.back().se) v.front()=P(v.front().fi+x-sum,v.front().se-a.back().se);
		else v.pop_front();
		sum+=a.back().se;
		while(sum+v.front().se<=y) {
			sum+=v.front().se;
			b.pb(v.front());
			v.pop_front();
		}
		b.pb(P(v.front().fi,y-sum));
		if(v.front().se>b.back().se) v.front()=P(v.front().fi+y-sum,v.front().se-b.back().se);
		else v.pop_front();
		while(!b.empty()) {
			if(b.front().se!=0) v.pb(b.front());
			b.pop_front();
		}
		while(!a.empty()) {
			if(a.front().se!=0) v.pb(a.front());
			a.pop_front();
		}
	}
	//cout<<endl<<"v"<<endl;
	//for(auto i:v) cout<<i.fi<<' '<<i.se<<endl;
	sum=0;
	deque<P> dq,ans;
	p--;
	while(sum+v.front().se<=p) {
		sum+=v.front().se;
		dq.pb(v.front());
		v.pop_front();
	}
	dq.pb(P(v.front().fi,p-sum));
	if(v.front().se>dq.back().se) v.front()=P(v.front().fi+p-sum,v.front().se-dq.back().se);
	else v.pop_front();
	sum+=dq.back().se;
	while(sum+v.front().se<=q) {
		sum+=v.front().se;
		ans.pb(v.front());
		v.pop_front();
	}
	ans.pb(P(v.front().fi,q-sum));

	int cnt=0;
	for(auto s:ans) {
		//cout<<"s "<<s.fi<<' '<<s.se<<endl;
		if(s.fi>r) continue;
		if(s.se+s.fi<=r) cnt+=s.se;
		else cnt+=r-s.fi+1;
	}
	cout<<cnt<<endl;
    }

	return 0;
}



Measured memory_bytes: 3220
import java.io.*;
import java.util.*;
import static java.lang.System.*;

public class Main {
	static FastScanner sc = new FastScanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		long debt = 100000;
		for (int i=0; i<n; i++) {
			debt *= 1.05;
			if (debt%1000!=0) {
				debt -= debt%1000;
				debt += 1000;
			}
		}
		out.println(debt);
	}
}



class FastScanner implements Closeable {
	private final InputStream in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	public FastScanner(InputStream in) {this.in = in;}
	private boolean hasNextByte() {
		if (ptr < buflen) {return true;}
		else{
			ptr = 0;
			try {buflen = in.read(buffer);}
			catch (IOException e) {e.printStackTrace();}
			if (buflen <= 0) {return false;}
		}
		return true;
	}
	private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {throw new NumberFormatException();}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}
			else{throw new NumberFormatException();}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() { return Double.parseDouble(next());}
	public void close() {
		try {in.close();}
		catch (IOException e) {}
	}
}


Measured memory_bytes: 24336
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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;
}

const int INF = 1e9;
const long long LINF = 1e18;

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

    cout << N * N * N << endl;

    return 0;
}


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

int main() {
    int n,m,i,j,sum,a,b,c,x,y;
	int da[100][100],use[100];
	while(cin >> n) {
		if (n==0) break;
		for (i=0;i<n;i++) { use[i]=0; for (j=0;j<n;j++) da[i][j]=0; }
        cin >> m;
		for (i=0;i<m;i++) {
			scanf("%d,%d,%d",&a,&b,&c);
			da[a][b]=c/100; da[b][a]=c/100;
		}
		use[0]=1; sum=0;
		for (a=0; a<n-1; a++) {
         b=600000000;
		 for (i=0;i<n;i++) if (use[i]==1) {
			 for (j=0;j<n;j++) if (da[i][j]>0) if (da[i][j]<b && use[j]==0) { b=da[i][j]; x=j; y=i;}
		 }
		 use[x]=1; sum+=b-1;
         da[y][x]=0; da[x][y]=0;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
def create(month, days):
    day = 1
    while week:
        calendar[(month, day)] = week[0]
        week.append(week[0])
        del week[0]
        if day == days: break
        day += 1
        
week = ['Thursday','Friday','Saturday','Sunday','Monday','Tuesday','Wednesday']
calendar = {}
for i in range(12):
    month = i+1
    if month in (1,3,5,7,8,10,12):
        create(month, 31)
    elif month == 2:
        create(month, 29)
    else:
        create(month, 30)
    
while True:
        month, day = map(int, raw_input().split())
        if month == 0 and day == 0: break
        print calendar[(month, day)]

Measured memory_bytes: 4292
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x:-x[1])

B=[]
for bc in BC:
    B+=[bc[1]]*bc[0]
    if len(B)>=N:
        break
B+=[0]*(N-len(B))
print(sum([max(A[i],B[i]) for i in range(N)]))


Measured memory_bytes: 88344
/*
 * written by Yaqi Zhang (zhang623@wisc.edu)
 * University of Wisconsin-Madison
 * 2019
 */
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int d = n % 10;
    if(d == 3) cout << "bon";
    else if (d == 0 || d == 1 || d == 6 || d == 8) cout << "pon";
    else cout << "hon";
    cout << endl;
    return 0;
    
}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define lld long long int
#define ld long double
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b)	for(lld i=a;i<=b;i++)
#define repr(i,a,b) for(lld i=a;i>=b;i--)
#define ar array
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
lld n,m;
lld arr[300000];
string st;
int main()
{
     ios;
     lld TESTS,q,a,s,b,r,k,c,p,h,w,d,x,y,z,xs,ys,t;
     TESTS=1;
//     ans=0;
     //cin>>TESTS;
   //  memset(dpt,0,sizeof(dpt));memset(dput,0,sizeof(dput));
    // memset(dsu1,0,sizeof(dsu1));
     while(TESTS--)
     {
         cin>>x;
         lld ans=0;
         ans+=1000*(x/500);
         x%=500;
         x/=5;
         ans+=5*(x);
         cout<<ans;
     }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int n,t;
int main(){
    cin >>n;
    for(int i=1; i<10; i++){
        if(n<=i*100+i*10+i){
            cout << i << i << i << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>












char c[6][6];

void solve()
{
	for(int i=1;i<=2;i++)for(int j=1;j<=3;j++)cin>>c[i][j];
	if(c[1][1]==c[2][3]&&c[1][2]==c[2][2]&&c[1][3]==c[2][1])cout<<"YES\n";
	else cout<<"NO\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

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

using namespace std;
typedef long long ll;

int C[12];
int A[12][12];

int main(){
  int N, M, X;
  cin >> N >> M >> X;
  
  for(int i=0; i<N; i++){
    cin >> C[i];
    for(int j=0; j<M; j++) cin >> A[i][j];
  }
  
  int cmin = 1e9;
  for(int i=0; i<(1<<N); i++){
    vector<int> sumA(M);
    int csum = 0;
    for(int j=0; j<N; j++){
       if(i & (1<<j)){
         for(int k=0; k<M; k++){
    	 	sumA[k] += A[j][k];
         }
         csum += C[j];
       }
    }
           
    bool smaller = false;
    for(int j=0; j<M; j++){
      if(sumA[j] < X){
        smaller = true;
        break;
      }
    }
    
    if(!smaller) cmin = min(cmin, csum);
  }
  
  if(cmin == 1e9) cmin = -1;
  
  cout << cmin << endl;
  return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
const int maxn = 3555;
int M(){
    string u;
    if(!(cin >> u)) return 0;
    for(int e = 0; e < 8; e++) u.pop_back();
    cout << u << endl;
    return 1;
}
int main(){
    while(M());
    return 0;
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int x[50];
ll dp[51][51][2501];
int main() {
  int n, a;
  cin >> n >> a;
  reps(i,n)
    cin >> x[i];
  rep(i,n+1)
  dp[i][0][0] =1;
  reps(i,n)
     reps(j,n)
      rep(k,n*a+1){
        if(k < x[i]){
          dp[i][j][k] = dp[i-1][j][k];
	} else{
          dp[i][j][k] = dp[i-1][j][k]+dp[i-1][j-1][k - x[i]];
        }
      }
  ll ans = 0;
  reps(j,n)
	if(dp[n][j][j*a]) ans+=dp[n][j][j*a];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 50048
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MA=1e13+5;

int main(){
	ll n; 
	cin>>n;
	ll sum=0;
	ll Min=MA;
	for(ll i=1;i<=sqrt(n);i++){
		if(n%i==0){
			ll t=n/i;
			sum=i+t-2;
			Min=min(Min,sum);
		}
	}
	cout<<Min<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(i % 2 == 0 && s[i] == 'L'){
            cout << "No" << endl;
            return 0;
        }
        if(i % 2 == 1 && s[i] == 'R'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
//g++ main.cpp -I /usr/local/include/ac-library
#include<cmath>
//#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
//using namespace atcoder;
stack<int> st;
queue<int> qu;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define pb push_back
#define sz(x) (int)(x).size()
#define mod 1000000007
//#define mint=modint1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll N;
int main(){
    ll C;
    cin>>N>>C;
    vec x(N), v(N);
    rep(i,N) cin>>x[i]>>v[i];
    vec sum(N), walk_sum(N);
    multiset<ll> left, walk_left;
    for(ll i = N-1 ; i>=0; --i){
        sum[i] = v[i];
        walk_sum[i] = v[i];
        if(i == N-1) {
            sum[i] -= C - x[i];
            walk_sum[i] -= 2*(C - x[i]);
        }else {
            sum[i] += sum[i+1] - (x[i+1] - x[i]);
            walk_sum[i] += walk_sum[i+1] - 2*(x[i+1] - x[i]);
        }
        left.insert(sum[i]);
        walk_left.insert(walk_sum[i]);
    }
    auto fite = left.end();
    --fite;
    ll ans, right = 0;
    ans = max(0LL, *fite);
    rep(i,N){
        auto ite = left.lower_bound(sum[i]);
        left.erase(ite);
        auto ite2 = walk_left.lower_bound(walk_sum[i]);
        walk_left.erase(ite2);
        right += v[i] - x[i];
        if(i > 0) right += x[i-1];
        ans = max(ans, right);
        if(i != N-1){
            ite = left.end(); --ite;
            ans = max(ans, right + *ite - x[i]);
            ite2 = walk_left.end(); --ite2;
            ans = max(ans, right + *ite2);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 15648
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
typedef long long ll;
const int MOD = 1e9 + 7;
ll N, ma, mi;
int main(void)
{
	cin >> N >> mi >> ma;
	if (N == 1)if(mi!=ma)cout << 0 << endl;
	else cout << 1 << endl;
	else {
		ll u = (ma - mi)*(N - 2) + 1;
		cout << ((u >= 0)? u:0) << endl;;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    m = int(input())
    a = list(map(int, input().split()))
    n = int(input())
    b = list(map(int, input().split()))

    if len(a) < len(b): print(0)
    elif b[0] < a[0]: print(0)
    elif a[-1] < b[-1]: print(0)
    else: print(hoge(a, b))

def hoge(a, b):
    i = j = 0
    while 1:
        if len(b) <= j: return 1
        elif len(a) <= i: return 0
        itema = a[i]
        itemb = b[j]
        if itema == itemb:
            i += 1
            j += 1
            continue
        elif itema < itemb:
            i += 1
            continue
        else: return 0
        
main()



Measured memory_bytes: 35284
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;
const int N = 85, zero = 6500;

int n, m, a[N][N], b[N][N];
bitset<zero * 2> f[N][N];

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int main() {
    read(n), read(m);
    for (R int i = 1; i <= n; ++i)
        for (R int j = 1; j <= m; ++j)
            read(a[i][j]);
    for (R int i = 1; i <= n; ++i)
        for (R int j = 1; j <= m; ++j)
            read(b[i][j]);
    for (R int i = n; i; --i) {
        for (R int j = m; j; --j) {
            if (i == n && j == m) {
                f[i][j][zero + a[i][j] - b[i][j]] = f[i][j][zero + b[i][j] - a[i][j]] = 1;
                continue;
            }
            int p = abs(a[i][j] - b[i][j]);
            if (i != n) f[i][j] |= (f[i + 1][j] << p) | (f[i + 1][j] >> p);
            if (j != m) f[i][j] |= (f[i][j + 1] << p) | (f[i][j + 1] >> p);
        }
    }
    for (R int i = 0; i <= zero; ++i)
        if (f[1][1][zero + i] || f[1][1][zero - i])
            return printf("%d\n", i), 0;
    return 0;
}

Measured memory_bytes: 11008
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

    int len = s.length();

    int ap = -1;
    for(int i = 0; i < len; i++){
        if(s[i] == 'A'){
            ap = i;
            break;
        }
    }

    int zp = -1;
    for(int i = len-1; i >= 0; i--){
        if(s[i] == 'Z'){
            zp = i;
            break;
        }
    }

    cout << (zp - ap + 1) << endl;

    return 0;
}


Measured memory_bytes: 832
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] x = sc.next().toCharArray();
		char[] y = sc.next().toCharArray();

		if (x[0] == y[0]) {
			pr.println('=');
		} else if (x[0] < y[0]) {
			pr.println('<');
		} else {
			pr.println('>');
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


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

int main(){
    int H,N;
    cin >> H >> N;
    
    vector<int> vec(N);
    for(int i=0; i<N; ++i) cin >> vec.at(i);

    int total = 0;

    for(int i=0; i<N; ++i) total += vec.at(i);
    if(total >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 640
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    a, b, c, x, y = map(int, input().split())
    if a + b < 2 * c:
        print(a * x + b * y)
    else:
        # num_c = min(x, y)
        if x < y:
            if b < 2 * c:
                print(x * 2 * c + (y - x) * b)
            else:
                print(y * 2 * c)
        else:
            if a < 2 * c:
                print(y * 2 * c + (x - y) * a)
            else:
                print(x * 2 * c)
        
        



if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int n,k,sol;
int main(){
	cin>>n>>k;
for(int i=0;i<=n;i++){
	for(int j=0;j<=n;j++){
		
			if(k-i-j<=n&&k-i-j>=0){
				sol++;
				
			}
	
	}
}
cout<<sol<<endl;

return 0;
}


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

int main(){
  vector<int> numOfLetter(255,0);
  char tmp;
  while(cin>>tmp){
  numOfLetter[tmp]++;
  
  }
  
  for(int i=97;i<=122;i++){
    if(numOfLetter[i]%2){
      cout<<"No"<<endl;
      return 0;
    }
  
  }
  
  cout<<"Yes"<<endl;
  return 0;
  
  
}

Measured memory_bytes: 256
int main(void){
    
    int x[301],y[301];
    int a,b,c,i=0;
    
    while(1){
        scanf("%d %d",&x[i],&y[i]);
        if(x[i]==0 && y[i]==0){
            break;
        }
        i++;
    }
    
    for(a=0;a<i;a++){
        for(c=0;c<y[a];c++){
            printf("#");
        }
        printf("\n");
        printf("#");
        for(b=0;b<x[a]-2;b++){
            for(c=0;c<y[a]-2;c++){
                printf(".");
            }
            printf("#");
            printf("\n");
            printf("#");
            
        }
        for(c=0;c<y[a]-1;c++){
            printf("#");
        }
        printf("\n");
        printf("\n");
    }
}


Measured memory_bytes: 2128
import java.util.Scanner;

class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int a1 = sc.nextInt();
		int a2 = sc.nextInt();
		int a3 = sc.nextInt();
		sc.close();
		if(a1 + a2 + a3 >= 22){
			System.out.println("bust");
		}else{
			System.out.println("win");
		}
	}		
}


Measured memory_bytes: 21844
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  }

}

Measured memory_bytes: 28116
#include <bits/stdc++.h>
using namespace std;
int64_t excla(int64_t x){
    if (x == 1) return 1;
    return (x * (excla(x - 1) % 1000000007)) % 1000000007;
}
int main(){
    int64_t N, M;
    cin >> N >> M;
    int64_t ans;
    if (abs(N - M) >= 2) ans = 0;
    else ans = excla(N) * excla(M) % 1000000007;
    if (N == M) ans = ans * 2 % 1000000007;
    
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    list<int> L;
    auto itr = L.end();
    for(int i = 0; i < n; i++)
    {
        int q, x;
        cin >> q;
        if(q == 0) 
        {
            cin >> x;
            itr = L.insert(itr, x);
        }
        else if(q == 1)
        {
            cin >> x;
            if(x > 0) for(int i = 0; i < x; i++) itr++;
            else for(int i = 0; i < -x; i++) itr--;
        }
        else if(q == 2)
        {
            itr = L.erase(itr);
        }
    }
    for(auto x : L)
    {
        cout << x << "\n";
    }
    return 0;
}




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

ll lcm(ll a, ll b);

int main(){
  int N; cin >> N;
  vector<ll> T(N);
  FOR(i,N){
  	cin >> T[i];
  }
  ll res = 1;
  FOR(i,N){
  	res = lcm(res,T[i]);
  }
  cout << res << endl;
  return 0;
}

ll lcm(ll a,ll b){
  ll u,v;u=a;v=b;
  ll t;
  if (b>a){
  	t=a; a=b; b=t;
  }
  while (a%b != 0){
    t = a;
  	a = b;
    b = t % b;
  }
  return (u/b)*v;
}

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

int main() {
int n;
cin >> n;
bool flag=false;
for (int i=1;i<10;i++){
    if(n<10){flag=true;
    break;}
    if(n%i==0){
        if(n/i<10){flag=true;
        break;}
      
    }

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


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

int main() {
  int x,a,b;
  cin >> x >> a >> b;
  if(b-a <= 0){
    cout << "delicious" << endl;
  }
  else if(b-a <= x){
    cout << "safe" << endl;
  }
  else{
    cout << "dangerous" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int x; cin >> x;
	int t = 1;
	while (true) {
		if (t*(t + 1) / 2 >= x)break;
		t++;
	}
	cout << t << endl;
	return 0;
}

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

using namespace std;

int main() {
	int data[3];

	for (int i = 0; i < 3; ++i) {
		cin >> data[i];
	}
	sort(data, data + 3);
	for (int i = 0; i < 3; ++i) {
		cout << data[i] << (i == 2 ? '\n' : ' ');
	}

	return 0;
}


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

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

  int i = 1, tmp = n;
  array<int, 1000005> a = {0};
  a[n] ++;
  while (true) {
    i ++;
    if (tmp % 2 == 0) {
      tmp /= 2;
      if (a[tmp] > 0) break;
      else a[tmp] ++;
    } else {
      tmp = 3 * tmp + 1;
      if (a[tmp] > 0) break;
      else a[tmp] ++;
    }
  }
  int ans = i;

  cout << ans << endl;
}


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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int p,q,r;
    cin >> p >> q >> r;
    int ans=p+q+r;
    ans-=max({p,q,r});
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        List<Res> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            String name = sc.next();
            int point = Integer.parseInt(sc.next());
            list.add(new Res(i, name, point));
        }

        Collections.sort(list, (r1, r2) -> {
            if (!r1.name.equals(r2.name)) {
                return r1.name.compareTo(r2.name);
            }
            else {
                return r1.point < r2.point ? 1 : -1;
            }
        });

        for (Res res : list) {
            System.out.println(res.i + 1);
        }
    }

}

class Res {
    int i;
    String name;
    int point;
    Res (int i, String name, int point) {
        this.i = i;
        this.name = name;
        this.point = point;
    }
}

Measured memory_bytes: 27092
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc = 1; 
    //cin >> tc;
    while(tc--){
        int n; cin >> n;
        int ans = 0;
        string s; cin >> s;
        int r = 0, g = 0, b = 0;
        for(auto x:s)
            if(x == 'R')
                r++;
            else if(x == 'G')
                g++;
            else b++;
        ans = r*g*b;
        FOR(i,0,n)
        {
            FOR(k,i,n)
            {
                if((i+k)%2) continue;
                int j = (i+k)/2;
                if(s[i] != s[j] and s[j] != s[k] and s[k] != s[i])
                    --ans;
            }
        }
        cout << ans;
        
    }    
}


Measured memory_bytes: 3592
// Question A


#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <unordered_map>
#include <algorithm>
#include <stack>
#include <queue>

// Question A




using namespace std;
int main()
{
	long long a, b, c;
	long long k;
	cin >> a >> b >> c >> k;

	long long diff = a - b;
	if (k % 2 != 0)
	{
		diff *= -1;
	}

	if (diff> 1000000000000000000 || diff < -1000000000000000000)
	{
		cout << "Unfair\n";
	}
	else
	{
		cout << diff;
		cout << "\n";
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int now = 0;
    int ans = 1;
    for (int i = 1; i < n; ++i) {
        if (now == 0) {
            if (a[i-1] < a[i]) now = 1;
            else if (a[i-1] > a[i]) now = 2;
        } else if (now == 1) {
            if (a[i-1] <= a[i]) continue;
            ans++;
            now = 0;
        } else {
            if (a[i-1] >= a[i]) continue;
            ans++;
            now = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3692
n = int(input())
A = list(map(int,input().split()))

A = sorted(A,reverse=True)
ans = 0
ans += A[0]
if n % 2 == 0:
  j = n//2
  ans += sum(A[1:j])*2
  
else:
  j = n//2
  ans += sum(A[1:j])*2
  ans += A[j]
print(ans)  

Measured memory_bytes: 31680
#include<iostream>
#include<algorithm>
#define rep(i,n)for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
int main()
{
    ll a,b,k;
    cin>>a>>b>>k;
    if (k<=a)
    {
        a=a-k;
    }
    else
    {
        b=b-(k-a);
        if(b<0)b=0;
        a=0;
    }
    cout<<a<<" "<<b<<endl;

    return 0;
}


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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair
#define clamp(v,lo,hi) min(max(v,lo),hi)

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }
template<typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template<typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }


inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


int solve(int H,int W,int N,vi& x, vi& y) {
    vvi ps(H+1);
    rep(i,N) {
        if (x[i] >= y[i]) {
            ps[ x[i] ].pb(y[i]);
        }
    }

    int rightmost=0;
    int best=H;
    rep(i,H) {
        if (ps[1+i].empty()) {
            rightmost++;
        } else {
            sort(ALL(ps[1+i]));
            if (ps[1+i][0] <= rightmost) {
                best = 1+i; break;
            } else if (rightmost+1 == ps[1+i][0]) {
                ;
            } else {
                rightmost++;
            }
        }
    }

    return best;
}

int main() {
    int H,W,N; scanf("%d%d%d", &H, &W, &N);
    vi x(N), y(N);
    rep(i,N){
        scanf("%d%d", &x[i], &y[i]);
        --x[i]; --y[i];
    }
    cout << solve(H,W,N,x,y) << endl;
    return 0;
}


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

int main(){
  int number, leg;
  bool check = false;
  cin >> number;
  cin >> leg;
  for (int i=0; i<=number; i++){
    if (i*2 + (number -i)*4 == leg){
      check = true;
      break;
    }
  }
  if(check) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"

using namespace std;
typedef long long ll ;
typedef pair <ll,ll>  pii;

ll v1[100001], v2[100001], v3[100001];
vector <ll> v;

int  main() {
    ll cc,x,y,a,b,c,sum = 0;
    cin >> cc >> y >> a >> b >> c;
    for(ll i = 1; i <= a; i++) {
        cin >> x;
        v1[i] = x;
    }
    for(ll i =1; i <= b; i++) {
        cin >> x;
        v2[i] = x;
    }
    for(ll i = 1; i <= c; i++) {
        cin >> x;
        v.push_back(x);
        v3[i] = x;
    }
    sort(v1 + 1,v1 + a + 1, greater <ll> ());
    sort(v2 + 1,v2 + b + 1, greater <ll> ());
    for(ll i = 1;i <= cc;i++){
        v.push_back(v1[i]);
    }
    for(ll i = 1;i <= y;i++){
        v.push_back(v2[i]);
    }
    sort(v.begin(), v.end(), greater <ll>());
    ll cx = cc + y;
    for(auto z : v){
        sum += z;
        cx--;
        if(cx == 0)
            break;
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 8560
#include<stdio.h>
int main()
{   int n,l,m,i,s;
	while(~scanf("%d%d",&n,&m))
	{    int a[m];
	   s=0,l=0; 
	   for(i=0;i<n;i++)
		{
		scanf("%d",&a[i]);
		s+=a[i];
		if(s<=m)
		l++;
	    }
	    printf("%d\n",l+1);
		
	 } 
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int sqr[200005];

int main(){

    int N, A, B, C, D;
    bool doubleRock = false, tripleSqr = false;
    char S[200005];

    cin >> N >> A >> B >> C >> D ;

    for(int i=1; i<=N; i++){
        cin >> S[i] ;
    }

    sqr[0] = 1;
    for(int i=1; i<=N; i++){
        if(S[i] == '.') sqr[i] = 0;
        else sqr[i] = 1;

        if(((i < D) || (i < C)) && (i > A)){
            if((sqr[i] == 1 && sqr[i-1] == 1)){
                doubleRock = true;
            }
        }
        if(C > D){
            if((i > B) && (i <= D+1) ){
                if(sqr[i] == 0 && sqr[i-1] == 0 && sqr[i-2] == 0){
                    tripleSqr = true;
                }
            }
        }
    }

    if(doubleRock){
        cout << "No" << endl;
    } else{
        if(C < D){
            cout << "Yes" << endl;
        } else{
            if(tripleSqr == true){
                cout << "Yes" << endl;
            } else{
                cout << "No" << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4560
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int w = scanner.nextInt();
        long[] dp = new long[w + 1];
        for (int i = 0; i < n; i++) {
            int wi = scanner.nextInt();
            long vi = scanner.nextInt();
            for (int j = w, k = w-wi; k>=0; j--,k--) {
                dp[j] = Math.max(dp[j], dp[k]+vi);
            }
        }
        long ans = 0;
        for (long a : dp) ans = Math.max(ans, a);
        System.out.println(ans);
    }
}


Measured memory_bytes: 37160
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  if(x%10==3){
    cout<<"bon";
  }
  else if(x%10==0 or x%10==1 or x%10==6 or x%10==8){
    cout<<"pon";
  }
  else{
    cout<<"hon";
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    string s;
    cin >> s;
    string t;
    for(int i = 0; i < s.size(); i += 2) t.push_back(s[i]);
    cout << t << endl;

    return 0;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
    using namespace std;
     
    #define ll long long
    #define mod 1000000007
    #define IO_fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     
     int len = 0;

     class node{
         public:
         vector<int> neighs;
         bool visited;
     };

     void dfs(vector<node> &v, int source){
         len += 1;
         v[source].visited = true;
         for(int i = 0 ; i<v[source].neighs.size() ; i++){
             if(!v[v[source].neighs[i]].visited){
                 dfs(v,v[source].neighs[i]);
             }
         }
         return;
     }

    int main(){
        IO_fast
        int n, m;
        cin >> n >> m;
        vector<node> v(n);
        for(int i = 0 ; i<n ; i++) v[i].visited = false;

        for(int i = 0 ; i<m ; i++){
            int temp1, temp2;
            cin >> temp1 >> temp2;
            v[temp1-1].neighs.push_back(temp2-1);
            v[temp2-1].neighs.push_back(temp1-1);
        }

        int maxlen = 0;
        for(int i = 0 ; i<n ; i++){
            len = 0;
            if(!v[i].visited){
                dfs(v,i);
                if(len>maxlen){
                    maxlen = len;
                }
            }
        }

        cout << maxlen << endl;
    }

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

int main()
{
    int i, j;
    int signed n, m, c;
    cin >> n >> m >> c;
    int b[m];
    int a[n][m];
    int count[n];
    int hantei = 0;
    for (i = 0; i < m; i++)
        scanf("%d", &b[i]);
    for (i = 0; i < n; i++)
        for(j = 0; j < m; j++)
            scanf("%d", &a[i][j]);
    for (i = 0; i < n; i++) {
        count[i] = c;
        for (j = 0; j < m; j++)
            count[i] += a[i][j] * b[j];
        if (count[i] > 0)
            hantei++;
    }
    cout << hantei << endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, flag=0;
    long long a, m=1;
    cin>>n;
    while(n--){
        cin>>a;
        if (flag) {
            if (a==0) {
                m=0;
                break;
            }
        }else{
            if (a == 0) {
                m = 0;
                break;
            }
            if (a > 1000000000000000000 / (double)m) {
                m=-1;
                flag=1;
                continue;
            }
            m *= a;
            if (m > 1000000000000000000) {
                m = -1;
                flag=1;
            }
        }
    }
    cout<<m<<"\n";
}

Measured memory_bytes: 3632