akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    multiset<int> st;
    REP(i,n){
        int x = in();
        st.insert(x);
    }
    int ans = 0;
    for (int x : st) ans += x - 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

bool compare(const pair<string,double> &a,const pair<string,double> &b){
  if(a.second==b.second) return a.first<b.first;
  else return a.second>b.second;
}

int main(void){
  int n;
  while(cin>>n,n){
    vector<pair<string,double> > v;
    for(int i=0;i<n;++i){
      string l;
      int p,a,b,c,d,e,f,s,m;
      cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      v.push_back(make_pair(l,(double)(f*s*m-p)/(a+b+c+(d+e)*m)));
    }
    sort(v.begin(),v.end(),compare);
    for(int i=0;i<v.size();++i){
      cout<<v[i].first<<endl;
    }
    cout<<"#"<<endl;
  }
}

Measured memory_bytes: 1220
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s; i<(n); ++i)
#define ALL(n) begin(n),end(n)
using ll = long long;
const ll INF = numeric_limits<ll>::max();
const double PI = 3.14159265;

int main(){
    double R;
    cin >> R;

    cout << fixed << setprecision(10);
    cout << 2 * PI * R << endl;

    return 0;
}


Measured memory_bytes: 3784
N = int(input())
A = list(map(int, input().split()))

odd_count = 0
even_count = 0

for i in A:
    if i%2==1:
        odd_count += 1
    else:
        even_count += 1

if odd_count%2==1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 14104
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int[] table = new int[10];
		table[0] = 1;
		for(int i=1; i< 10;i++){
			table[i] = table[i-1]<<1;
		}
		for(;sc.hasNextInt();){
			int n = sc.nextInt();
			String out = "";
			for(int i = 0; i< 10;i++){
				if((table[i] & n) == 0) continue;
				out += (table[i]) +" ";				
			}
			System.out.println(out.trim());
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<deque>
using namespace std;
int main(void)
{
	deque<int> dq;
	int q,x,d,p,i,n;
	scanf("%d",&q);
	for(i=0;i<q;i++)	{
		scanf("%d",&n);
		if(n==0)	{
			scanf("%d %d",&d,&x);
			if(d==0)	dq.push_front(x);
			else dq.push_back(x);
		}
		else if(n==1)	{
			scanf("%d",&p);
			printf("%d\n",dq[p]);
		}
		else {
			scanf("%d",&d);
			if(d==0)	dq.pop_front();
			else dq.pop_back();
		}
	}
	return 0;
}


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

const int N = 3e5+1;
const int mod = 1e9+7;

long long b[61][2];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    long long a; scanf("%lld", &a);
    for (int j = 0; j <= 60; a>>=1, ++j) {
      ++b[j][a&1];
    }
  }
  long long ans = 0;
  for (int i = 0; i <= 60; ++i) {
    ans += b[i][0]*b[i][1] % mod * ((1LL<<i) % mod) % mod;
    ans %= mod;
  }
  printf("%lld", ans);
  
  return 0;
}


Measured memory_bytes: 3832
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll x, y;
    cin >> x >> y;
    ll ans = 12345634537849;
    if (x <= y)ans = min(ans, y - x);
    if (-x <= y)ans = min(ans, y + x +1);
    if (x <= -y)ans = min(ans, - y - x+1);
    if (-x <= -y)ans = min(ans, - y + x + 2);
    cout << ans << endl;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) {

		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		try(BufferedReader br = new BufferedReader(reader)) {
			char[] c = br.readLine().toCharArray();
			c[3] = '8';
			System.out.println(new String(c));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}


Measured memory_bytes: 21204
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t a, b;
  cin >> a >> b;
  if (a <= 0 && b >= 0) {
    cout << "Zero" << endl;
  } else if (a > 0) {
    cout << "Positive" << endl;
  } else {
    if ((b - a + 1) % 2 == 0) {
      cout << "Positive" << endl;
    } else {
      cout << "Negative" << endl;
    }
  }

  return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int c;
  int answer = 1;
  c = A;
  
  if(B == 1){
    cout << 0 << endl;
  }
  
  else{
    while (c < B){
    c += A -1;
    answer++;
  }
 
  
  cout << answer << endl;
  }
}

Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}//a>b
int main(void){
	int i,j,k,n,m;cin>>n;
	int iti=0,ni=0,yon=0;
	for(i=0;i<n;i++){
		int q;cin>>q;
		if(q%4==0){yon++;}
		else if(q%2==0){ni++;}
		else{iti++;}
	}
	if(ni>0){iti++;}
	if(yon+1>=iti){cout<<"Yes"<<endl;}
	else{cout<<"No"<<endl;}
	return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
 	int n;
  	cin>>n;
  	ll arr[n],dp[n+2];
  	for(int i=0;i<n;i++)
    cin>>arr[i];
  	dp[0]=0;
  	dp[1]=abs(arr[0]-arr[1]);
  	for(int i=2;i<n;i++)
    {
    	if(((dp[i-1]+abs(arr[i]-arr[i-1]))<(dp[i-2]+abs(arr[i]-arr[i-2]))))
        dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
        else
        dp[i]=dp[i-2]+abs(arr[i]-arr[i-2]);
        //cout<<dp[i]<<" ";
    }
            cout<<dp[n-1];
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    bool Twin = true; 
    while(1){
        c -= b;//高橋君の攻撃
        if(c<=0){
            break;
        }
        a -= d;//青木君の攻撃
        if(a<=0){
            Twin = false;
        }
    }
    YN(Twin);
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod=1e9+7;
long long INF=1e7;
double EPS = 1e-12;
typedef long long int lld;
double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;}
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scd(a) scanf("%d",&a)
#define scd2(a,b) scanf("%d%d",&a,&b)
#define scd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scf(a) scanf("%lf",&a)
#define scf2(a,b) scanf("%lf%lf",&a,&b)
#define scf3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) c.begin(), c.end()
#define sz(a) ((int)a.size())
#define Error(x) cout<< #x << " = " << (x) <<endl;
#define Error2(a,b) cout<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define Error3(a,b,c) cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<")\n";
#define Error4(a,b,c,d) cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" , "<<#d<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<" , "<<(d)<<")\n";
#define errop(a) cout<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll
 
typedef pair<lld,lld> PA;
 
lld powP(lld a,lld b){
    if(b==0) return 1%mod;
    lld k;
    k=powP(a,b/2);
    k=k*k%mod;
    if(b%2==0) return k;
    else return a*k%mod;
}
 
bool bitSet(lld n,lld i){
    if((n&(1LL<<i))!=0) return true;
    else return false;
}
 
lld findGcd(lld a,lld b){
    if(a==0) return b;
    else return findGcd(b%a,a);
}
 
#define lim 500010
#define lim2 200003
#define qqqqqq 210
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];
// vector<lld> V[lim];
// int X[lim],Y[lim],C[lim];
// string S[lim];
lld A[lim],B[lim];
// map<lld,lld> M;



int main(){
    lld T,i,n,m,p,j,l,e,r,b,c,k,q,a,d,w,x,y,u,v,z,t,curr,prev,sum,ans,pos,val,countA,indicator;
    ans = LLONG_MAX;
    sum = 0;
    sc(n);
    rep(i,1,n) sc(A[i]),sum += A[i];
    a = 0;
    rep(i,1,n-1){
        a += A[i];
        sum -= A[i];
        ans = min(ans,abs(a-sum));
    }
    prL(ans);
    return 0;
}

Measured memory_bytes: 4352
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define v_sum(a)         accumulate(a.begin(),a.end(),0)
#define v_max(a)         *max_element(a.begin(),a.end())
#define v_min(a)         *min_element(a.begin(),a.end())
#define v_uni(a)         a.erase(unique(a.begin(),a.end()),a.end())
#define pi          	 3.14159265358979323846

using namespace std;

ll const mod=1e9+7;


int main()
{
	Nayon;
	ll i,j,k=0,cnt=0,n,k1=0,k2=0,t,m;
	cin>>n;
	for(i=0;i<n;i++){
		cout<<"ACL";
	}
	cout<<nl;
	return 0;
}

//Happy Coding......

Measured memory_bytes: 3580
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, X; cin >> N >> X;
	vector<int>L(N); rep(i, 0, N) { cin >> L[i]; }
	int D = 0;
	int ans = 1;
	rep(i, 0, N) {
		D += L[i];
		if (D <= X)ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	/*int n;
	cin >> n;
	vector<int> b(n - 1);
	rep(i, n-1) {
		cin >> b[i];
	}


	cout << << endl;
	return 0;*/
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n-1);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	rep(i, n) {
		cin >> b[i];
	}
	rep(i, n-1) {
		cin >> c[i];
	}
	ll ans = 0;
	rep(i, n) {
		ans += b[i];
		if (i != n - 1 && a[i] + 1 == a[i + 1]) {
			ans += c[a[i]];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/
int main(){
  string s;
  cin >> s;
  set<char> st;
  for(auto ss:s){
    st.insert(ss);
  } 
  if(st.size() == s.size()) cout << "yes" << endl;
  else cout << "no" << endl;
}

Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Shine Like a Sun , Burn like a Sun 

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
using namespace std;
signed main()
{
    fast;
    
    ll n,k,i;
    cin>>n>>k;
    ll a[n+2] , f[n+2];
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
    	cin>>f[i];
    }
    sort(a,a+n);
    sort(f,f+n,greater<ll>());
    ll lo=0 , hi = 1000000000000000;
    while(lo<hi)
    {
    	ll mid = (lo+hi)/2;
    	ll sum=0;
    	for(i=0;i<n;i++)
    	{
    		sum += max(0LL, a[i] - (mid/f[i]));
    	}
    	if(sum<=k)
    	{
    		hi = mid;
    	}
    	else
    	{
    		lo = mid + 1;
    	}
    }
    
    cout<<lo;
}

Measured memory_bytes: 3328
import java.util.*;

public class Main{

    int w,d;
    int[] front,side;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            w = sc.nextInt();
            d = sc.nextInt();
            if(w==0 && d==0) break;
            front = new int[w];
            side = new int[d];
            for(int i=0; i<w; i++) front[i] = sc.nextInt();
            for(int i=0; i<d; i++) side[i] = sc.nextInt();

            Arrays.sort(front);
            Arrays.sort(side);

            int block = 0;
            int idxF = w-1, idxS = d-1;
            while(idxF>=0 && idxS>=0){
                if(front[idxF]==side[idxS]){
                    block += front[idxF];
                    idxF--;
                    idxS--;
                }else if(front[idxF]>side[idxS]){
                    block += front[idxF];
                    idxF--;
                }else{
                    block += side[idxS];
                    idxS--;
                }
            }
            
            for(int i=idxF; i>=0; i--) block += front[i];
            for(int i=idxS; i>=0; i--) block += side[i];
            
            System.out.println(block);
        }
    }

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

Measured memory_bytes: 12000
#include <iostream> 
#include <vector>
using namespace std;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	int n;
	int sum=0;
 
	cin >> n;
	vector<int> x(n, 0);
 
	
	
	for (int i = 0; i < n; i++){
		cin >> x[i];
		if (i % 2 == 0)	sum += x[i];
		else sum -= x[i];
	}
 
	for (int i = 0; i < n; i++){
		if (i != 0)  sum= 2 * x[i-1] - sum;
		else sum = sum;
		cout << sum << " ";
	}
 return 0; 
}

Measured memory_bytes: 1792
#include<cstdio>
int a[205];
int n,cnt;
int main(){
	int t;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=2*n;i++){
		for(int j=i;j<=2*n;j++){
			if(a[i]>a[j]){
				t=a[i];
				a[i]=a[j];
				a[j]=t;
			}
		}
	}
	for(int i=1;i<=2*n;i+=2)
		cnt+=a[i];
	printf("%d",cnt);
}

Measured memory_bytes: 128
#define _'			'
A[_];long P[_],M=1e9+7,F[_],I[_],X;i,j,k,t;c(a,b)int*a,*b;{t=*a-*b?:a[1]-b[1];}p(a,b){return b?p(a%M*a%M,b/2)*(b%2?a:1L)%M:1;}f(a,b){return F[a+b]*I[a]%M*I[b]%M;}main(s){for(*I=1;++X<_;~scanf("%d",A+i)&&i++%2&&gets(P))I[X]=p(s=F[X]=X*s%M,M-2);for(qsort(A,i/2,8,c);j<i;P[j++]=X)for(X=f(t=--A[k=++j],s=--A[j]);--k;X=t<A[--k]?X:(X-f(s-A[k-1],t-A[k])*P[k]%M+M)%M);printf("%d",X);}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define ll long long

using namespace std;

bool sorter(pair<int, int> a, pair<int, int>b)
{
    return a.first>b.first;
}

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

    ll n, m;
    cin>>n>>m;
    ll arr[n];
    ll sum=0;
    for (int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr, arr+n);
    pair<int, int> values[m];
    for (int i=0;i<m;i++)
    {
        int b, c;
        cin>>c>>b;
        values[i] = {b, c};
    }
    sort(values, values+m, sorter);
    int x=-1;
    for (int i=0;i<m;i++)
    {
        bool flag=false;
        for (int l=0;l<values[i].second;l++)
        {
            x++;
            if (x==n)
            {
                flag = true;
                break;
            }
            if (arr[x]<values[i].first)
            {
                sum+=values[i].first;
            }

            else
            {
                sum+=arr[x];
                flag=true;
                break;
            }
        }
        if (flag)
            break;
    }
    if (x+1!=n)
    {
        x++;
        for (int i=x;i<n;i++)
        {
            sum+=arr[i];
        }
    }
    cout<<sum;



}



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

int main() {
  int N;
  cin >> N;
  
  int answer = 0;
  for (int i = 1; i <= N; i += 2) {
    int count = 0;
    for (int n = 1; n <= i; n += 2) {
      if (i % n == 0) {
        count++;
      }
    }
    
    if (count == 8) {
      answer++;
    }
  }
  
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int fac[500005],ifac[500005];
const int mod=998244353;
inline int power(int a,int b){
	int c=1;
	while(b){
		if(b&1)c=1ll*c*a%mod;
		a=1ll*a*a%mod;
		b>>=1;
	}
	return c;
}
inline int c(int x,int y){
	if(y<0||y>x)return 0;
	return 1ll*fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(n>m)swap(n,m);
	fac[0]=1;
	for(int i=1;i<=m;i++)fac[i]=1ll*fac[i-1]*i%mod;
	ifac[m]=power(fac[m],mod-2);
	for(int i=m;i>=1;i--)ifac[i-1]=1ll*ifac[i]*i%mod;
	int ans=0;
	for(int i=0;i<=n;i++){
		ans=(ans+(i&1?-1ll:1ll)*c(n,i)*c(m,i)%mod*fac[i]%mod*power(n+1,m-i)%mod*power(m+1,n-i))%mod;
	}
	printf("%d\n",(ans+mod)%mod);
}

Measured memory_bytes: 4096
N = int(input())
S = input()
ans = N
sumB = [0] * (N + 1)
tmp = 0
for i in range(N):
    if S[i] == '#':
        tmp += 1
    sumB[i+1] = tmp
for i in range(N+1):
    ans = min(sumB[i] + (N - i) - (sumB[N] - sumB[i]), ans)
    # print(sumB[i] , (N - i), (sumB[N] - sumB[i]), ans)
print(ans)


Measured memory_bytes: 11144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int k;
    cin >> k;
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    int cnt = 0;
    for (int i = 1;i < 10; i++) {
        pq.push(i);
    }
    while(1) {
        ll x = pq.top(); pq.pop();
        cnt++;
        if (cnt == k) {
            cout << x << endl;
            return;
        }
        if (x % 10 == 0) {
            pq.push(x * 10);
            pq.push(x * 10 + 1);
        } else if (x % 10 == 9) {
            pq.push(x * 10 + 9);
            pq.push(x * 10 + 8);
        } else {
            int l = x % 10;
            pq.push(x * 10 + l);
            pq.push(x * 10 + l - 1);
            pq.push(x * 10 + l + 1);
        }
    }
}

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

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();

ll p = 1000000007;

ll modpow (ll radix,ll index){
    if(index == 0)return 1;
    if(index == 1)return radix % p;
    ll c;
    c = modpow(radix,index/2);
    c = c * c % p;
    if(index % 2){
        return c * radix % p;
    }
    return c;
    
}
// m[i]はk=iのときの最大公約数の総和
ll N,K,x,y,z,m[100001],ans[100001];
int main(){
    scanf("%lld%lld",&N,&K);
    m[1] = 1;
    for(ll i = 2; i<=K;i++){
        z = 0;
        for(ll j = 2;j*j <= i;j++){
            //iがjの倍数の時(被り対策)
            if(i%j==0){
                //iがj^2の倍数->もう足す必要ないので０
                if((i/j)%j == 0) m[i] = 0;
                //iがjの●倍   ->●の分だけ引く
                else m[i] = - m[i/j];
                z = 1;
                break;
            }
        }
        //iが素数のとき
        if(z == 0) m[i] = -1;
    }
    z = 0;
    for(ll i = 1; i <= K; i++){
        x = K / i;
        x = modpow(x,N);
        y = 1;
        while(y*y < i){
            if(i%y == 0){
                ans[y] += x * m[i/y];
                ans[y] += p;
                ans[y] %= p;
                ans[i / y] += x * m[y];
				ans[i / y] += p;
				ans[i / y] %= p;

			}
			y++;
		}
		if (y * y == i) {
			ans[y] += x * m[y];
			ans[y] += p;
			ans[y] %= p;
		}
	}
	for (int i = 1; i <= K; i++) {
		z += ans[i] * i;
		z %= p;
	}
	printf("%lld\n", z);
}


Measured memory_bytes: 5248
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "YES";
    private static final String NO = "NO";

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

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve2(N, A) ? YES : NO);
    }

    private static boolean solve2(int N, int[] A) {
        Arrays.sort(A);

        for (int i=1; i<N; i++) {
            if (A[i-1] == A[i]) return false;
        }

        return true;
    }


    private static boolean solve(int N, int[] A) {
        boolean[] fill = new boolean[(int)Math.pow(10, 9)+1];

        for (int i=0; i<N; i++) {
            if(fill[A[i]]) return false;

            fill[A[i]] = true;
        }

        return true;
    }
}

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

int main() {

	using namespace std;

	while (true) {

		int x, y;
		cin >> x >> y;

		if (x == 0 && y == 0) {
			break;
		}
		else {

			if (x < y) {
				cout << x << " " << y << endl;
			}
			else {
				cout << y << " " << x << endl;
			}

		}

	}

	return 0;

}


Measured memory_bytes: 3052
fn main() {
    // let mut a = String::new();
    // std::io::stdin().read_line(&mut a).ok();
    // let _a: i32 = a.trim().parse().unwrap();

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let mut iter = buf.trim().split_whitespace();

    let x = iter.next().unwrap().parse::<i32>().unwrap();
    let y = iter.next().unwrap().parse::<i32>().unwrap();

    let b = solve(x, y);

    println!("{}", if b {"Yes"} else {"No"});
}

fn solve(x: i32, y: i32) -> bool {
    let mut b = false;

    for i in 0..=x {
        if (x - i) * 4 + i * 2 == y {
            b = true;
            break
        }
    }

    b
}

Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 500000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	int n;
	IN(n);
	vector<int>b(n-1);
	REP(i,n-1){
		IN(b[i]);
	}
	ll ans=0;
	REP(i,n-2){
		ans+=min(b[i],b[i+1]);
	}
	ans+=b[0]+b[n-2];
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,a;
	cin>>x>>a;
	if (x<a)
	{
		cout<<0<<endl;
		
		
		
		
	}
	else
	{
		cout<<10<<endl;
	}
	return 0;
	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		double n = ((Math.sqrt(8 * N+1) - 1)/2);
		boolean can = n % 1 == 0;
		int a = (int)n;
		if(can) {
			System.out.println("Yes");
			System.out.println(a+1);
			int[][] A = new int[a][a+1];

			for(int i = 1;i <= N;i++) {
				int co = 0;
				int raw = 0;
				int aa = a;
				while(i > aa) {
					raw ++;
					aa += a-raw;
				}
				co = a - (aa - i)-1;
				A[co][raw] = i;
				A[raw][co+1] = i;
			}

			for(int i = 0;i < a+1;i++){
				System.out.print(a + " ");
				for(int j = 0;j < a;j++) {
					System.out.print(A[j][i]);
					if(j != a-1) {
						System.out.print(" ");
					}else {
						System.out.println();
					}
				}
			}




		}else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 47684
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

int main() {
    LL A, B, C, K;
    scanf("%lld %lld %lld %lld", &A, &B, &C, &K);
    if (K % 2) {
        printf("%lld\n", B - A);
    } else {
        printf("%lld\n", A - B);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
 
using namespace std;
 
typedef pair<int,int>P;
 
const int MAX_N = 100;
const int MAX_W = 10000;
 
int n,W;
int w[MAX_N];
int v[MAX_N];
int m[MAX_N];
int dp[MAX_W+1];
int deq[MAX_W+1];
int deqv[MAX_W+1];
 
int main()
{
    cin >> n >> W;
    rep(i,n){
        scanf("%d%d%d",&v[i],&w[i],&m[i]);
    }
    rep(i,n){
        rep(a,w[i]){
            int s=0,t=0;
            for(int j=0;j*w[i]+a<=W;j++){
                int val = dp[j*w[i]+a]-j*v[i];
                while(s<t&&deqv[t-1]<=val){
                    t--;
                }
                deq[t] = j;
                deqv[t++] = val;
                dp[j*w[i]+a] = deqv[s] + j*v[i];
                if(deq[s] == j-m[i]){
                    s++;
                }
            }
        }
    }
    cout << dp[W] << "\n";
    return 0;
}

Measured memory_bytes: 3336
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int a,b;
	cin >> a>>b;
	cout<< (a-1)*(b-1) << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

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

ll n;

int main(){
    cin >> n;
    vector<ll> v(n),r(n+1),l(n+1);
    rep(i,n)cin >> v[i];
    rep(i,n)r[i+1] = gcd(r[i],v[i]);
    // rep(i,n+1)cout << r[i] << " ";
    // cout << endl;
    reverse(ALL(v));
    rep(i,n)l[i+1] = gcd(l[i],v[i]);
    ll ans = 1;
    rep(i,n){
        ans = max(ans,gcd(r[i],l[n-1-i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main() {
	
	int N=0;
	scanf("%d", &N);
	if(N==1){
	printf("Hello World\n");
}
else
	if(N==2){
	int A=0; int B=0;
	scanf("%d\n%d", &A, &B);
	A+B;
	printf("%d", A+B);
}

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

vvi g, gw;
vi sz;
ll sum = 0;
int n;
vi isc;

void dfs(int v, int p) {
  bool ok = true;
  for (int i = 0; i < g[v].size(); ++i) {
    int nv = g[v][i];
    if (nv == p) continue;
    dfs(nv, v);
    sum += 2 * gw[v][i] * (ll)min(sz[nv], n - sz[nv]);
    sz[v] += sz[nv];
    if (sz[nv] * 2 > n) ok = 0;
  }
//  cerr << v << ' ' << p << ' ' << sz[v] << ' ' << g[v].size() << endl;
  if (sz[v] * 2 < n) ok = 0;
  isc[v] = ok;
}

int main() {
//std::ios::sync_with_stdio(false);
  scanf("%d", &n);
  g.resize(n);
  gw.resize(n);
  sz.assign(n, 1);
  isc.assign(n, 0);
  for (int i = 0; i < n-1; ++i) {
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
    gw[a].push_back(c);
    gw[b].push_back(c);
  }
  dfs(0, -1);
  ll res = 0;
  for (int v = 0; v < n; ++v) if (isc[v]) {
    for (int i = 0; i < g[v].size(); ++i) {
      int u = g[v][i];
      ll cur = sum - gw[v][i];
//      cerr << v << ' ' << u << ' ' << cur << endl;
      if (isc[u]) {
        res = cur;
        break;
      }
      res = max(res, cur);
    }
    break;
  }
  printf("%lld\n", res);
  return 0;
}

Measured memory_bytes: 18688
#include<stdio.h>
int main(void)
{
	int n,k,q,x[100001]={0},a,i,j;
	scanf("%d %d %d", &n, &k, &q);
	for(i=0; i<q; i++)
	{
		scanf("%d", &a);
		x[a]++;
	}
	for(i=1; i<=n; i++)
	{
		if(x[i]+k-q>0)
		printf("Yes\n");
		else
		printf("No\n");
	}
	
	return 0;
}

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

using namespace std;

int main()
{
        int n,r=0,s=0,k=0;
        cin>>n;
        k=n;
        while(n>0)
        {
            r=n%10;
            s=s+r;
            n=n/10;
        }
        //cout<<s<<endl;
        if(k%s==0)
                cout<<"Yes"<<endl;
        else
                cout<<"No"<<endl;
        return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <vector>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{␣"; for(auto nth : list){ cout << nth << "␣"; } cout << "}" << endl;

using namespace std;

int main() {
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); ++i) {
        cout << S[i];
        if (i == 3) cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX_V = 15;
const int INF = 1<<28;

int G[MAX_V][MAX_V];

int V, E;
int memo[MAX_V][1 << MAX_V];
void init() {
    memset(memo, -1, sizeof(memo));
}
int dfs(int v, int used) {
    if (used == (1 << V) - 1) return G[v][0];
    if (memo[v][used] >= 0) return memo[v][used];
    int ret = INF;
    for (int u = 0; u < V; u++) {
        if (v == u || G[v][u] == INF || (used & (1 << u))) continue;
        chmin(ret, dfs(u, used | (1 << u)) + G[v][u]);
    }
    return memo[v][used] = ret;
}
int TSP() {
    init();
    return dfs(0, 1);
}

int main() {
    cin >> V >> E;
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) G[i][j] = INF;
        G[i][i] = 0;
    }
    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        G[s][t] = d;
    }
    int Ans = TSP();
    cout << (Ans >= INF ? -1 : Ans) << endl;
    return 0;
}


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

#define endl "\n"
#define INF 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define deb(x) cout << #x << " => " << x << "\n"
#define deba(x) cout << #x << "\n"; for (auto a : x) cout << a << " "; cout << "\n";
#define debm(x) cout << #x << "\n"; for (auto a : x){for(auto b : a) cout << b << " "; cout << "\n";}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)

int32_t main() { fastio;
    int n; cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    bool possible = true;
    for (auto x : arr) {
        if (x % 2 == 0 and (x % 3 != 0 and x % 5 != 0)) {
            possible = false;
        }
    }
    if (possible) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 405
#define INF 1000000000
#define MOD 998244353
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,a[MAXN],b[MAXN];
int dp[MAXN][MAXN];
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
void dec(int &a,int b) {a-=b; if(a<0) a+=MOD;}
int pow_mod(int a,int i)
{
    int s=1;
    while(i)
    {
        if(i&1) s=1LL*s*a%MOD;
        a=1LL*a*a%MOD;
        i>>=1;
    }
    return s;
}
int fact[MAXN],invf[MAXN];
int main()
{
    fact[0]=invf[0]=1;
    for(int i=1;i<=400;i++) fact[i]=1LL*fact[i-1]*i%MOD;
    invf[400]=pow_mod(fact[400],MOD-2);
    for(int i=399;i>=1;i--) invf[i]=1LL*invf[i+1]*(i+1)%MOD;
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d%d",&a[i],&b[i]);
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    int asum=0,bsum=0;
    for(int i=0;i<n;i++)
    {
        asum+=a[i]; bsum+=b[i];
        for(int j=asum;j>=a[i];j--)
            for(int k=0;k<=bsum;k++)
            {
                int coef=1;
                for(int l=0;l<=min(k,b[i]-1);l++)
                {
                    dec(dp[j][k],1LL*coef*dp[j-a[i]][k-l]%MOD*invf[l]%MOD);
                    coef=1LL*coef*a[i]%MOD;
                }
            }
    }
    int ans=0;
    for(int i=1;i<=asum;i++)
    {
        int coef=1;
        for(int j=0;j<bsum;j++)
        {
            coef=1LL*coef*i%MOD;
            add(ans,1LL*dp[i][j]*fact[j]%MOD*pow_mod(coef,MOD-2)%MOD);
        }
    }
    ans=(MOD-1LL*ans*asum%MOD)%MOD;
    printf("%d\n",ans);
    return 0;
}


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

int main() {
  int n, d, x;
  cin >> n >> d >> x;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    int choco = 0;
    for (int i = 0; i <= d; i++) {
      if (i * a + 1 <= d) choco++;
    }
    ans += choco;
  }
  cout << ans + x << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<set>
#include<map>
#include<utility>
#define ul unsigned long long int
#define ll long long int
#define MAX 1000000+1
using namespace std;
#define F first
#define S second
#define pi 2*acos(0.0)
#define PB push_back
#define Pp push
#define LSTAGE 1
int arr[200010];
ll bfs(vector<int> a[])
{
    queue<int>v;
    v.push(1);
    int t;
    arr[1] = 0;
    int x;
    while(v.size())
    {
        t = v.front();
        v.pop();
        if(arr[t]==2)
            return 1;
        for(int i= 0; i < a[t].size(); i++)
        {
            x = a[t][i];
            if(arr[x]==-1)
            {
                v.push(x);
                arr[x] = arr[t]+1;

            }
        }

    }
    return 0;

}


int main()
{
    ll n, r, t, f, s;
    t = f = s = 0;
    cin >> n;
    for(ll i =0; i< n; i++)
    {
        cin >> r;
        if(r%4==0)
            f++;
        else if(r%4==2)
            t++;
        else
            s++;
    }
    n--;
    if(t)
        t--;


    n -= t;
    n -= f*2;
    if(n <= 0)

        cout <<"Yes";
    else
        cout << "No";


    return 0;
}


Measured memory_bytes: 256
import math
n = int(input())
max_target = int(math.sqrt(n) // 1)
ans = 10 ** 9
for a in range(1, max_target + 1):
  if n % a == 0:
    b = n // a
    f = max(len(str(a)), len(str(b)))
    ans = min(ans, f)
print(ans)


Measured memory_bytes: 65008
#include <stdio.h>

int main() {
  long a,b;
  long num[1010] = {};

  scanf("%ld%ld", &a, &b);

  long sub;
  sub = b - a;
  long ans = 0;

  for(int i = 1; i <= 1000; i++){
    num[i] = num[i-1] + i;
    if(sub == i) ans = num[i-1] - a;
  }

  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010


int main(){
	IOS;
	ll n;cin>>n;
	ll a[n],b[n];rep(i,0,n)cin>>a[i];
	ll f=1,x=0;
	for(ll i=n-1;i>=0;--i)x+=f*a[i],f=-1ll*f;
	b[0]=x;
	rep(i,1,n)b[i]=2*a[i-1]-b[i-1];
	rep(i,0,n)cout<<b[i]<<" ";
	return 0;
}



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

int main() {

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

for(int i=1;i<k+1;i++)
{
	if(res[i] ==0)
	{
		if(i<a[1])
		res[i]=2;

		else
		{
			
			for(int j=1;j<n+1;j++)
			{	
				if(i>a[j])
				{
					if(res[i-a[j]]==2)
					{res[i]=1;
					break;}

					else res[i]=2;
				}
			}
		}


	}
}
if(res[k]==1) cout<<"First";
else cout<<"Second";
	// your code goes here
	return 0;
}

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

const int M = (int)1e9+7;
typedef long long LL;

void fastIO_test(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

void solve(void)
{
    string s;
    cin >> s;
    LL n=s.length();
    if(s[n-1]=='s')
    {
		s.push_back('e');
		s.push_back('s');
	}
	else{
		s.push_back('s');
	}
	cout << s << "\n";
}

int main()
{
    fastIO_test();

    LL t=1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


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

const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int64_t> a(n);
    for (auto &it : a) cin >> it;
    int64_t ans = 0, sum = 0;
    
    for (int i = 0; i < n; i++) {
        ans = (ans + sum * a[i]) % mod;
        sum = (sum + a[i]) % mod;
    }
    cout << ans << "\n";
    return 0;
}

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

int main(){
    int n,d,x;
    cin >> n >> d >> x;
    int A[n];
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    int sum = 0;
    for(int i = 0; i < n; i++){
        sum += (d-1) / A[i] + 1;
    }
    cout << sum + x << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

num_list = [0 for _ in range(10 ** 5)]
for i in a:
    if i > 0:
        num_list[i - 1] += 1
    num_list[i] += 1
    if i < 10 ** 5 - 1:
        num_list[i + 1] += 1
print(max(num_list))


Measured memory_bytes: 14092
#include<stdio.h>
#include<stdlib.h>
#define MAX 200000000

void insert(int);
int extractMax(void);
void heapIncreaseKey(int,int);
void maxHeapify(int);
int parent(int);
int left(int);
int right(int);

int S[MAX+1];
int cnt=0;

int main()
{
  int i = 0,num,ret;
  char com[10];

  while(1){
    scanf("%s",com);
    if(com[2] == 'd')break;

    if(com[0] == 'i'){
      scanf("%d",&num);
      insert(num);
    }
    else if(com[0] == 'e'){
      ret = extractMax();
      printf("%d\n",ret);
    }
  }
  
 
  return 0;
}

void insert(int key)
{
  cnt++;
  S[cnt] = -1;
  heapIncreaseKey(cnt,key);
}

void heapIncreaseKey(int i, int key)
{
  int temp;
  
  S[i] = key;
  
  while(i > 1 && S[parent(i)] < S[i]){
    temp = S[i];
    S[i] = S[parent(i)];
    S[parent(i)] = temp;
    i = parent(i);
  }
}

int extractMax(void)
{
  int max;

  max = S[1];
  S[1] = S[cnt];
  cnt--;
  maxHeapify(1);

  return max;
}

void maxHeapify(int i)
{
  int l,r,largest,temp;

  l = left(i);
  r = right(i);

  if(l <= cnt && S[l] > S[i])
    largest = l;
  else
    largest = i;
  if(r <= cnt && S[r] > S[largest])
    largest = r;

  if(largest != i){
    temp = S[i];
    S[i] = S[largest];
    S[largest] = temp;
    maxHeapify(largest);
  } 
}

int parent(int i)
{
  return i/2;
}

int left(int i)
{
  return 2 * i;
}

int right(int i)
{
  return 2 * i + 1;
}



Measured memory_bytes: 5592