akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    typedef pair<int,int> pii;
    struct Edge{
        int from,to;
        LL cost;
        Edge(int from,int to,LL cost)
            : from(from),to(to),cost(cost) {};
    };
    typedef vector<vector<Edge>> Graph;

    LL dijkstra(const int start,const int goal, const vector<vector<Edge>> &graph , vector<int> &prev){
        // start, goal, graph, previous vertex on the shortest pass (prev[start]=-1)
        // <<cost , place>, prev>
        typedef tuple<LL,int,int> T;
        int N = graph.size();
        vector<LL> dist(N,LINF);
        vector<char> visited(N,false);
        priority_queue<T,vector<T>,greater<T> > Q;
        Q.push(make_tuple(0,start,-1));
        while(!Q.empty()){
            LL cost;
            int place,from;
            tie(cost,place,from)=Q.top();
            Q.pop();
            if(visited[place]) continue;
            prev[place]=from;
            if(place == goal) return cost;
            dist[place]=cost;
            visited[place] = true;
            for(int j=0;j<(int)graph[place].size();j++){
                if(dist[graph[place][j].to]<=graph[place][j].cost+cost)continue;
                Q.push(make_tuple(graph[place][j].cost+cost,graph[place][j].to,place));
            }
        }
        return -1;
    }
    int k;
    Graph g;
    Problem(LL n):k(n),g(k+1){};

    void solve(){
        if(k == 1){cout << 1 <<endl;return;}
        for(int i=0; i<k; ++i){
            for(int j=0; j<10; ++j){
                int to = (i*10+j)%k;
                if(i*j>0 and to==0)to=k;
                g[i].push_back(Edge(i,to,j));
            }
        }
        vector<int> prev(k+1);
        cout << dijkstra(0,k,g,prev) <<"\n";
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    while(n%2==0)n/=2;
    while(n%5==0)n/=5;
    Problem p(n);
    p.solve();
    return 0;
}



Measured memory_bytes: 40300
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	int N;
	String S;

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

	void solve() {
		N = nextInt();
		int K = nextInt();
		int r = nextInt();
		int s = nextInt();
		int p = nextInt();

		String T = next();
		char []t = T.toCharArray();
		long sum = 0;
		// s < r < p < s
		char []c = new char[N];
		for(int i=0;i<N;i++) {
			if(K > i) {
				if(t[i]=='r') {
					c[i]='p';
					sum+=p;
				}else if(t[i]=='p'){
					c[i]='s';
					sum+=s;
				}else if(t[i]=='s'){
					c[i]='r';
					sum+=r;
				}
				continue;
			}

			if(t[i]=='r') {
				if(c[i-K]=='p')continue;
				c[i]='p';
				sum+=p;
			}else if(t[i]=='p'){
				if(c[i-K]=='s')continue;
				c[i]='s';
				sum+=s;
			}else if(t[i]=='s'){
				if(c[i-K]=='r')continue;
				c[i]='r';
				sum+=r;
			}

		}
		out.println(sum);
	}


	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}

	long lcm(long m, long n) {
	        return m * n / gcd(m, n);
	}
}

Measured memory_bytes: 29268
"use strict";
function main(input) {
    let arr = input.split(" ").map(Number);
    let A = arr[0];
    let B = arr[1];
    let K = arr[2];
    console.log(A - Math.min(A, K), B - Math.min(B, K - Math.min(A, K)));
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29492
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length() - 2;
        System.out.println(String.valueOf(s.charAt(0)) + n + s.charAt(s.length() - 1));
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
// #define vb          vector<bool>
// #define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
// #define ub(x)       upper_bound(x)
// #define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("b1.in","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define PRIME           1000000007
#define MAX         50000
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define pi          3.14159265358979323
int i,j,k;
// int n;
// const int N=1e6+5;
// vector<bool> prime(N);
// void sieve(){
//     for(int i=0;i<=N;i++)prime[i]=true;
//     prime[0]=prime[1]=false;
//     for(int i=2;i*i<=N;i++){
//         if(prime[i] and i*i<=N){
//             for(int j=i*i;j<=N;j+=i){
//                 prime[j]=false;
//             }
//         }
//     }
// }
// const int N=1e3+5;
// int a[N];


void Anon_mouS(){
    int N, K;
    cin >> N >> K;
    vector<int> v(N);
    for (int i = 0; i < N; i++) cin >> v[i];
 
    deque<int> dq;
    for (int i = 0; i < K; i++) dq.push_back(v[i]);
 
    for (int i = K; i < N; i++) {
        if (dq.front() < v[i]) cout << "Yes\n";
        else cout << "No\n";
        dq.pop_front();
        dq.push_back(v[i]);
    }
}
int32_t main(){
    fastio;
    int q=1;
    // sieve();
    // cin>>q;
    for(int it=1;it<=q;it++){
        // cout<<"Case #"<<it<<": ";
        Anon_mouS();
    }
    return 0;   
}

Measured memory_bytes: 6300
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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


int main(){
    ll n, k;
    cin >> n >> k;
    int res = 0;
    while(n > 0){
        n /= k;
        res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    string a, b;
    cin >> a >> b;

    int x = atoi((a + b).c_str());

    string ans = "No";
    REP(i, 1000){
        if(x == i * i) ans = "Yes";
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(abs(c-a) <= d || (abs(b-a) <= d && abs(c-b) <= d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////





int main() {

	ll N, K;
	cin >> N >> K;

	char s[MAX];
	repn(i, N) { cin >> s[i]; }

	s[0] = '1';//番兵

	ll ren[MAX] = {};

	ll cnt = 1;

	repn(i, N) {
		if (s[i] == s[i - 1]) { ren[cnt]++; }
		else { cnt++; ren[cnt] = 1; }
	}

	
	ll sum = 0;

	repn(i, 2*K+1) {
		sum += ren[i];
	}

	ll ans = sum;

	repn(i, N) {
		sum = sum - ren[2 * i - 1] - ren[2 * i] + ren[2 * K + 2 * i] + ren[2 * K + 2 * i + 1];
		
		ans = max(ans, sum);
	}

	cout << ans;


	system("PAUSE");
}

Measured memory_bytes: 9208
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



void solve(){
    string a,b;
    cin>>a>>b;
    sort(all(a));
    sort(all(b));
    reverse(all(b));
    if(a<b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 500000

void buildMaxHeap(void);
void maxHeapify(int i);

int n;
int heap[MAX];

int main(){
    int i;
    
    scanf("%d",&n);
    
    for(i=1;i<=n;i++){
        scanf("%d",&heap[i]);
    }
    buildMaxHeap();
    for(i=1;i<=n;i++){
        printf(" %d",heap[i]);
    }
    printf("\n");
    return 0;
}

int Parent(int i){
    return i/2;
}
int Left(int i){
    return 2*i;
}
int Right(int i){
    return 2*i+1;
}

void maxHeapify(int i){
    int L,R,largest,temp;
    L=Left(i);
    R=Right(i);
    
    if(L<=n && heap[L]>heap[i]){
        largest=L;
    }
    else {
        largest=i;
    }
    if(R<=n && heap[R]>heap[largest]){
        largest=R;
    }
    
    if(largest!=i){
        temp=heap[i];
        heap[i]=heap[largest];
        heap[largest]=temp;
        maxHeapify(largest);
    }
}
void buildMaxHeap(void){
    int i;
    for(i=(int)n/2;i>0;i--){
        maxHeapify(i);
    }
}

Measured memory_bytes: 2552
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n;cin>>n;
  string ans;
  ll cnt=0;
  while(n>0){
    ll tmp=n%26;
    n/=26;
    if(tmp==0){tmp=26;n--;}
    
    ans.push_back('a'+tmp-1);
    cnt++;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<endl;
}






Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e18, MOD = 1e9 + 7;
int main() {
    int n, p, res = 0;
    cin>>n;
    int mn = INF;
    while(n--) {
        cin>>p;
        if(mn >= p) res++;
        mn = min(mn, p);
    }
    cout<<res<<endl;
}


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

int n;
int m[125];
int p[125][125];
int k;
int l[125];

int main(){
    while(true){
        cin>>n;
        if(n==0)break;
        REP(i,n){
            cin>>m[i];
            REP(j,m[i])cin>>p[i][j];
            sort(p[i],p[i]+m[i]);
        }
        cin>>k;
        REP(i,k)cin>>l[i];
        vector<int> cand;
        REP(i,n){
            int cnt = 0;
            REP(j,m[i]){
                cnt += count(l,l+k,p[i][j]);
            }
            if(cnt == k)cand.push_back(i);
        }
        if(cand.size() == 1){
            cout << cand[0]+1 << endl; 
        }else{
            cout << -1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repr(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 99999999999999
#define MAX_V 100010
#define MAX_E 2019

    /*Solve*/

int main(){
    ll n;
    cin >> n;
    priority_queue<ll> a;
    rep(i,n){
        ll x;cin >> x;
        a.push(x);
    }
    while(1){
        if(a.size()==1)
            break;
        ll b=a.top();
        a.pop();
        ll c=a.top();
        if(b%c==0)continue;
        ll d=b%c;
        a.push(d);
    }
    cout << a.top();
}

Measured memory_bytes: 1400
/**
 * Created by kame on 2017/04/15.
 */
/**
 * Created by kame on 2017/04/15.
 */
import java.util.*;
public class Main {
    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();
        }
        int result=1;
        int frag=0;
        for(int i=1;i<N;i++){
            if(A[i]-A[i-1]==0){

            }
            if(A[i]-A[i-1]>0){
                if(frag==-1){
                    result++;
                    frag=0;
                    continue;
                }
                frag=1;

            }
            if(A[i]-A[i-1]<0){
                if(frag==1){
                    result++;
                    frag=0;
                    continue;
                }
                frag=-1;
            }
        }
        System.out.println(result);
    }
}

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

int main(){
  long long x, y;
  cin >> x >> y;

  if (y == 1 || x == y) {
    cout << -1 << endl;
    return 0;
  }

  for (long long i=x; i < x*y; i+=x){
    if (i % y != 0) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  
  for(int i=1; i<10; i++){
    if(n%i==0 && n/i<10){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

using namespace std;

const int m = 1000;

int main(){
    ios::sync_with_stdio(false);
    int x; cin >> x;

    for(int a = 0; a<m;a++){
        for (int b=(-1)*m;b<m;b++){
            if(pow(a,5)-pow(b,5) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4036
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
int main(){
    int h,w,mx=80*160*2,i,j,k,tmp;
    cin >> h >> w;
    vector<vector<int> > c(h,vector<int>(w));
    rep(i,h){
        rep(j,w){
            cin >> c.at(i).at(j);
        }
    }
    rep(i,h){
        rep(j,w){
            cin >> tmp;
            c.at(i).at(j)=abs(c.at(i).at(j)-tmp);
        }
    }
    bool dp[80][80][26000];
  	rep(i,80)rep(j,80)rep(k,26000)dp[i][j][k]=0;
    dp[0][0][c.at(0).at(0)]=1;
    rep(i,h){
        rep(j,w){
            rep(k,mx){
              if(dp[i][j][k]){
                if(i<h-1){
                  dp[i+1][j][k+c.at(i+1).at(j)]=1;
                  dp[i+1][j][abs(k-c.at(i+1).at(j))]=1;
                }
                if(j<w-1){
                  dp[i][j+1][k+c.at(i).at(j+1)]=1;
                  dp[i][j+1][abs(k-c.at(i).at(j+1))]=1;
                }
              }
            }
        }
    }
    rep(k,mx){
        if(dp[h-1][w-1][k]){
            cout << k << endl;
            break;
        }
    }
}

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

ll dp[200][2][200];

int main(){
    string N;
    ll K;
    cin >> N >> K;

    rep(i, 0, 200){
        rep(j, 0, 2){
            rep(k, 0, 200) dp[i][j][k] = 0;
        }
    }

    // dp[#digits][0:exact, 1:smaller][#digits smaller than or equal to K]

    dp[1][0][1] = 1;
    dp[1][1][0] = 1;
    if(N[0] - '0' != 1) dp[1][1][1] = N[0] - '0' - 1; 

    rep(d, 1, N.size()){

        ll D = N[d] - '0';

        // smaller -> smaller
        dp[d+1][1][0] = dp[d][1][0];
        rep(i, 1, K+1){
            dp[d+1][1][i] = 9 * dp[d][1][i-1] + dp[d][1][i];
        }

        // exact -> smaller
        if(D != 0){
            dp[d+1][1][0] += dp[d][0][0];
            rep(i, 1, K+1){
                dp[d+1][1][i] += (D-1) * dp[d][0][i-1] + dp[d][0][i];
            }
        }

        // exact -> exact
        rep(i, 0, K+1){
            if(dp[d][0][i] != 0){
                if(D == 0) dp[d+1][0][i] = dp[d][0][i];
                else dp[d+1][0][i+1] = dp[d][0][i];
            }
        }
    }

    cout << dp[N.size()][0][K] + dp[N.size()][1][K] << endl;
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
using namespace std;
typedef long long int ll;
ll a[100001],b[100001],c[100001],dp[100001][3];
ll n;
int main()
{
    scanf("%lld",&n);
    for(int i = 1; i <= n; i++)scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
    //start dp
    for(int i = 1; i <= n; i++)
    {
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2] = max(dp[i-1][1],dp[i-1][0])+c[i];
    }
    printf("%lld\n",max(max(dp[n][0],dp[n][1]),dp[n][2]));
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> P;
typedef pair<int, P> P2;
const int inf = 0xfffffff;
const lli llinf = 0xfffffffffffffff;

int main()
{
	int n, m;
	cin >> n >> m;
	//cout << "a" << endl;
	priority_queue<P,vector<P>,greater<P>> city[100005];
	for (lli i = 1; i <= m; i++) {
		lli a, b;
		cin >> a >> b;
		city[a].push(P(b, i));
	}
	vector<P2> data;
	for (int i = 1; i <= n; i++) {
		int cnt = 1;
		while (!city[i].empty()) {
			P p = city[i].top();
			city[i].pop();
			data.push_back(P2(p.second, P(cnt,i)));
			cnt++;
		}
	}
	sort(data.begin(), data.end());
	for (int i = 0; i < m; i++) {
		int cit_num = data[i].second.second, num = data[i].second.first;
		int ina = cit_num, ten1 = 6;
		while (ina > 0) {
			ina /= 10;
			ten1--;
		}
		int ina2 = num, ten2 = 6;
		while (ina2 > 0) {
			ina2 /= 10;
			ten2--;
		}
		for (int j = 0; j < ten1; j++) cout << 0;
		cout << cit_num;
		for (int j = 0; j < ten2; j++) cout << 0;
		cout << num;
		cout << endl;
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 10612
#include <stdio.h>

int main(void) {
	unsigned long long a = 0;
	double b = 0;
	unsigned long long c = 0;
	unsigned long long aa = 0;

	scanf("%llu", &a);
	scanf("%lf", &b);
	aa = b * 1000;

	c = aa % 10;
	if (c >= 5) {
		c = aa / 10 + 1;
	}
	else if (c < 5) {
		c = aa / 10;
	}

	c = c * a/100;
	
	printf("%llu", c);

	return 0;
}


Measured memory_bytes: 2220
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
ans = 0
import itertools
for path in itertools.permutations([i for i in range(n)]):
  for i in range(n-1):
    next = a[path[i+1]]
    now = a[path[i]]
    ans += ((next[1]-now[1])**2 + (next[0]-now[0])**2)**(1/2)

for i in range(n, 0, -1):
  ans /= i
print(ans)

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

int calc1();
int calc2();
int calc3();

int p;
string eq;

int calc1() {
  int a = calc2();
  while (eq[p]=='+' || eq[p]=='-') {
    if (eq[p]=='+') {
      p++;
      a += calc2();
    } else if (eq[p]=='-') {
      p++;
      a -= calc2();
    }
  }
  return a;
}

int calc2() {
  int a = calc3();
  while (eq[p]=='*' || eq[p]=='/') {
    if (eq[p]=='*') {
      p++;
      a *= calc3();
    } else if (eq[p]=='/') {
      p++;
      a /= calc3();
    }
  }
  return a;
}

int calc3() {
  int a;
  if (eq[p]=='(') {
    p++;
    a = calc1();
    p++;
  } else {
    a = 0;
    while (eq[p]>='0'&&eq[p]<='9') {
      a *= 10;
      a += eq[p++] - '0';
    }
  }
  return a;
}

int main() {
  int n, r;

  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> eq;
    p = 0;
    r = calc1();
    cout << r << endl;
  }
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
long long int dp[3000][3000][4]={0};
long long int f[3000][3000]={0};
int main(){
  long long int R,C,K;
  cin>>R>>C>>K;
  
  for(int i=0;i<K;i++){
    long long int r,c,v;
    cin>>r>>c>>v;
    r--;c--;
    f[c][r]=v;
  }
  dp[0][0][1]=f[0][0];
  for(int i=0;i<R;i++){
    for(int j=0;j<C;j++){
      for(int k=0;k<4;k++){
        if(j-1>=0 && k-1>=0){
          dp[j][i][k]=max(max(dp[j-1][i][k-1]+f[j][i],dp[j][i][k]),dp[j-1][i][k]);
        }
        if(i-1>=0){
          if(k==0){
            long long int m=0;
            for(int l=0;l<4;l++)m=max(m,dp[j][i-1][l]);
            dp[j][i][k]=max(m,dp[j][i][k]);
          }
          else if(k==1){
            dp[j][i][k]=max(dp[j][i][k-1]+f[j][i],dp[j][i][k]);
          }
        }
      }
    }
  }
  long long int m=0;
  for(int i=0;i<4;i++)m=max(dp[C-1][R-1][i],m);
  cout<<m<<endl;
}


Measured memory_bytes: 355116
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
int main(){
  long double a,b,c;
  long double eps = 1.0E-14;
  cin>>a>>b>>c;
  a = sqrt(a);
  b = sqrt(b);
  c = sqrt(c);
  if(a+b+eps<c){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }

}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>
#include <stack>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int N;
  cin >> N;
  cout << (N%2==0?N:2*N) << endl;

  return 0;
}








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

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int K;

    void input() {
        cin >> K;
    }

    void ki() {
        if (K == 1) {
            cout << 1 << endl << 1 << endl;
            return;
        }
        int m = (K / 4 + 1) * 2;
        vector<vector<int> > ans(m, vector<int>(m));
        cout << m << endl;
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < m; ++j) {
                ans[i][j] = (i + j) % m + m * (j % 2 == 1);
//                if (ans[i][j] == 2 * m - 1) ans[i][j] = m - 1;
                if (ans[i][j] >= K) ans[i][j] -= m;
                cout << ans[i][j] + 1 << " ";
            }
            cout << endl;
        }
    }

    void gu() {
        int m = K / 2;
        if(K == 2){
            cout << 2 << endl << 2 << " " << 1 << endl << 1 << " " << 2 << endl;
            return;
        }
        vector<vector<int>> ans(m, vector<int>(m));
        cout << m << endl;
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < m; ++j) {
                ans[i][j] = i % m + m * (j % 2 == 1);
                cout << ans[i][j] + 1 << " ";
            }
            cout << endl;
        }
    }

    void solve() {
        input();
//        if (K % 2) ki();
//        else gu();
        if(K == 2 || K % 4 == 0) gu();
        else ki();

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 2304
a = io.read()
s = {}
flag = "Yes"
last = nil
for i = 1, a do
	b = io.read()
	if s[b] or (last and string.sub(b, 1, 1) ~= last) then
		flag = "No"
	end
	s[b] = true
	last = string.sub(b, #b, #b)
end
print(flag)

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

int main(){
	int i;
	string T;
	cin >> T;
	int N = T.size();
	for(i = 0; i < N; i++){
		if(T[i] == 'P'){
			printf("P");
		}
		else{
			printf("D");
		}
	}
	printf("\n");
	return 0;
	vector<int> dp_D(N, 0), dp_P(N, 0);
	if(T[0] == 'D' || T[0] == '?'){
		dp_D[0] = 1;
	}
	for(i = 1; i < N; i++){
		if(T[i] == 'D'){
			dp_D[i] = max(dp_D[i - 1] + 1, dp_P[i - 1] + 2);
		}
		else if(T[i] == 'P'){
			dp_P[i] = max(dp_D[i - 1], dp_P[i - 1]);
		}
		else{
			dp_D[i] = max(dp_D[i - 1] + 1, dp_P[i - 1] + 2);
			dp_P[i] = max(dp_D[i - 1], dp_P[i - 1]);
		}
	}
	printf("%d\n", max(dp_D[N - 1], dp_P[N - 1]));
	return 0;
}

Measured memory_bytes: 3752
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;
// vector<int> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  // A.resize(N);
  // for (int i = 0; i < N; i++) {
  //   int tmp;
  //   cin >> tmp;
  //   A[i] = tmp;
  // }

  int ans = N % 10;
  if (ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9) {
    cout << "hon" << endl;
  } else if (ans == 0 || ans == 1 || ans == 6 || ans == 8) {
    cout << "pon" << endl;
  } else if (ans == 3) {
    cout << "bon" << endl;
  }

  return 0;
}


Measured memory_bytes: 3036
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int a,b;
	char c;
	cin >> a >> c >> b;
	
	if(c == '+')
	{
		cout << a+b << endl;
	}
	else
	{
		cout << a-b << endl;
	}
	
	return 0;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n,k;
  cin >> n >> k;

  priority_queue<int> monsters;
  int m;
  for(int i=0;i<n;i++){
    cin >> m;
    monsters.push(m);
  }
  for(int i=0;i<k;i++){
    if(monsters.empty())break;
    monsters.pop();
  }
  int64_t count = 0;
  
  while(!monsters.empty()){
    count += monsters.top();
    monsters.pop();
  }
  
  cout << count << endl;
  
  return 0;
}




Measured memory_bytes: 4352
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}


func nextLine() string {
    sc.Scan()
    return sc.Text()
}


func main(){
	var N int
	var res,min int
	var P []int
	fmt.Scan(&N)
	for i:=0;i<N;i++{
		t:=0
		fmt.Scan(&t)
		P = append(P,t)
	}
	min=P[0]
	res=1

	for i:=1;i<N;i++{
		if P[i]<min {
			res++
			min=P[i]
		}
	}

	fmt.Println(res)
}


Measured memory_bytes: 7680
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>
#include <functional>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* ---------- Functions */
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> P(A);
    vector<int> Q(B);
    vector<int> R(C);
    for (int i = 0; i < A; i++) cin >> P[i];
    for (int i = 0; i < B; i++) cin >> Q[i];
    for (int i = 0; i < C; i++) cin >> R[i];

    sort(P.begin(), P.end(), greater<>());
    sort(Q.begin(), Q.end(), greater<>());
    sort(R.begin(), R.end(), greater<>());

    int idx = 0;
    int sum = 0;
    int a = 0;
    int b = 0;

    for(; idx < min(C, X+Y); idx++) {
        sum += R[idx];
    }
    if (idx < X + Y) {
        int cnt = X + Y - idx;
        while (cnt > 0) {
            if (a < X && (b == Y || P[a] > Q[b])) {
                sum += P[a++];
            } else {
                sum += Q[b++];
            }
            cnt--;
        }
    }
    idx--;

    while (true) {
        if (idx < 0) break;
        if ((a == X || P[a] < R[idx]) && (b == Y || Q[b] < R[idx])) break;
        bool update = false;

        if (a < X && b < Y) {
            if (P[a] >= Q[b] && P[a] > R[idx]) {
                sum -= R[idx];
                sum += P[a];
                idx--;
                a++;
                update = true;
            } else if (Q[b] >= P[a] && Q[b] > R[idx]) {
                sum -= R[idx];
                sum += Q[b];
                idx--;
                b++;
                update = true;
            }
        } else if (b < Y) {
            if (Q[b] > R[idx]) {
                sum += Q[b] - R[idx];
                idx--;
                b++;
                update = true;
            }
        } else if (a < X) {
            if (P[a] > R[idx]) {
                sum += P[a] - R[idx];
                idx--;
                a++;
                update = true;
            }
        }

        if (!update) break;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,t;
    cin>>n;
    for(int i=1;i<=n;i++)
	{
        cin>>t>>x>>y;
        if(x+y>t||(t-x-y)%2!=0)
        {cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Pair[] array = new Pair[n];
		for(int i = 0; i < n; i++)
			array[i] = new Pair(sc.nextInt(), sc.nextInt());
		Arrays.sort(array);
		
		int time = 0;
		for(int i = 0; i < n; i++) {
			if(time + array[i].a > array[i].b) {
				System.out.println("No");
				return;
			}
			time += array[i].a;
		}
		
		System.out.println("Yes");
	}
	
	static class Pair implements Comparable<Pair> {
		int a;
		int b;
		
		public Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}
		
		public int compareTo(Pair p) {
			return this.b - p.b;
		}
	}
}


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

using namespace std;

int main() {
    int p;
    cin >> p;
    map<string, int> mp;
    mp["AC"] = 0, mp["WA"] = 0, mp["TLE"] = 0, mp["RE"] = 0;
    while (p--) {
        string a;
        cin >> a;
        mp[a]++;
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d", mp["AC"], mp["WA"], mp["TLE"], mp["RE"]);
    return 0;
}

Measured memory_bytes: 3724
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int n = s.length();
    int max = 0;
    int count = 0;
    
    for(int i=0; i<n; i++) {
      String str = s.substring(i,i+1);
      if(str.equals("A") || str.equals("C") || str.equals("G") || str.equals("T")){
        count++;
        if(max < count){
          max = count;
        } 
      } else {
        count = 0;
      }
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 22740
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += B[A[i]-1]
    if i > 0 and A[i] == A[i-1] + 1:
        ans += C[A[i]-2]

print(ans)


Measured memory_bytes: 3064
H, W = list(map(int, input().split()))
maps = [['']*(W+2) for _ in range(H+2)]
maps[0] = ['#']*(W+2)
for i in range(H):
    maps[i+1] = ['#']+list(input())+['#']
maps[H+1] = ['#']*(W+2)

ans = 0
L = [[[0, 0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if maps[i+1][j+1] == '#':
            continue
        if j >= 1 and L[i][j-1][1] > 0:
            L[i][j][1] = L[i][j-1][1]
        else:
            u = j+1
            while maps[i+1][u] == '.':
                u += 1
            L[i][j][1] = u-j-1
        if i >= 1 and L[i-1][j][0] > 0:
            L[i][j][0] = L[i-1][j][0]
        else:
            u = i+1
            while maps[u][j+1] == '.':
                u += 1
            L[i][j][0] = u-i-1
        ans = max(ans, L[i][j][0]+L[i][j][1]-1)
print(ans)

Measured memory_bytes: 581308
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

class Main{
    public static void main(String[] a){
    	List<Integer> numList = new ArrayList<>();
    	Scanner scanner = new Scanner(System.in);
    	for(int i=0;i<10;i++){
    		numList.add(scanner.nextInt());
    	}
    	numList.sort(Comparator.reverseOrder());
    	for(int j=0; j<3; j++){
    		System.out.println(numList.get(j));
    	}
    	scanner.close();
    }
}

Measured memory_bytes: 26292
n = int(input())
matrix = [[-1 for j in range(n)] for i in range(n)]

for i in range(n):
  a = int(input())
  for j in range(a):
    x, y = map(int, input().split())
    matrix[i][x - 1] = y

ans = 0
for i in range(2 ** n):
  str_i = format(i, "0" + str(n) + "b")
  flag = True
  for j in range(n):
    if str_i[j] == "1":
      for k in range(n):
        if matrix[j][k] >= 0 and matrix[j][k] != int(str_i[k]):
          flag = False
          break
  if flag:
    ans = max(ans, str_i.count('1'))

print(ans)

Measured memory_bytes: 3064
from collections import defaultdict


def main():
    N = int(input())
    a = list(map(int, input().split()))

    boss_dict = defaultdict(int)
    for i in a:
        boss_dict[i] += 1
    
    for i in range(1, N + 1):
        print(boss_dict[i])



if __name__ == "__main__":
    main()

Measured memory_bytes: 37456
from collections import defaultdict

N = int(input())
An = list(map(int, input().split()))

d = defaultdict(int)
for i in range(N):
    d[An[i]] += 1

edges = sorted(d.items(), key=lambda x: x[0], reverse=True)
w, h = 0, 0
ans = 0
for edge, amount in edges:
    if amount < 2:
        continue

    if amount >= 4:
        w, h = max(w, edge), max(h, edge)
        ans = max(ans, w*h)
    if amount >= 2:
        if not w:
            w = edge
        else:
            h = edge
            ans = max(ans, w*h)

print(ans)


Measured memory_bytes: 22436
use std::cmp;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
    	a:usize,
    }
       
    println!("{}", 3*a*a);
}

Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    vector<int> x(n+1, 0);
    set<pair<int, int> > s;
    for(int i=1; i<=n; ++i)
        s.insert(make_pair(0, i));

    for(int i=0; i<q; ++i){
        int a, v;
        cin >> a >> v;

        s.erase(make_pair(x[a], a));
        x[a] -= v;
        s.insert(make_pair(x[a], a));

        cout << s.begin()->second << ' ' << (-s.begin()->first) << endl;
    }

    return 0;
}

Measured memory_bytes: 51956
#include<bits/stdc++.h>
#define FOR(i,x,y) for(int i=(x),i##END=(y);i<=i##END;++i)
#define DOR(i,x,y) for(int i=(x),i##END=(y);i>=i##END;--i)
template<typename T,typename _T>inline bool chk_min(T &x,const _T y){return y<x?x=y,1:0;}
template<typename T,typename _T>inline bool chk_max(T &x,const _T y){return x<y?x=y,1:0;}
typedef long long ll;
const int N=2e5+5;
char s[N];
int n;
int S[N];

int main()
{
	scanf("%d%s",&n,s+1);
	FOR(i,1,n)S[i]=S[i-1]+(s[i]=='#');
	int ans=1e9;
	FOR(i,0,n)chk_min(ans,S[i]+(n-i)-(S[n]-S[i]));
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1280
n = int(input())
a = list(map(int, input().split()))
wa = 0
cnt = 0
for i in range(n):
    if i % 2 == 0 and wa + a[i] <= 0:
        cnt += 1 - (wa + a[i])
        wa = 1
    elif i % 2 == 1 and wa + a[i] >= 0:
        cnt += wa + a[i] + 1
        wa = -1
    else:
        wa += a[i]
ans = cnt
wa = 0
cnt = 0
for i in range(n):
    if i % 2 == 1 and wa + a[i] <= 0:
        cnt += 1 - (wa + a[i])
        wa = 1
    elif i % 2 == 0 and wa + a[i] >= 0:
        cnt += wa + a[i] + 1
        wa = -1
    else:
        wa += a[i]
print(min(ans, cnt))


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

using namespace std;

#define int long long 
#define MOD 1000000007


signed main(){
	//freopen("a.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.length();
	for(char ch = 'a';ch <= 'z'; ch++){
		int f[n+1];
		int cf[n+1];
		memset(cf,0,sizeof(cf));
		memset(f,0,sizeof(f));
		f[0] = 0;
		cf[0] = 0;
		int cc = 0;
		for(int i=1;i<=n;i++){
			if(s[i-1] == ch) cc++;
			f[i] = 2*cc - i;
			if(i!=1 && f[i]>cf[i-2]){
				int j = i-2;
				int c = 1;
				while(j>=0){
					if(s[j]==ch) c++;
					if((i-j)/2 < c){
						cout << j+1 << " " << i;
						return 0;
					}
					j--;
				}
			}
			cf[i] = min(cf[i-1],f[i]);
		}
	}
	cout << "-1 -1";
	return 0;
}


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

// Defining comparator function as per the requirement 
static int myCompare(const void* a, const void* b) 
{ 
  
    // setting up rules for comparison 
    return strcmp(*(const char**)a, *(const char**)b); 
} 
  
// Function to sort the array 
void sort(char** arr, int n) 
{ 
    // calling qsort function to sort the array 
    // with the help of Comparator 
    qsort(arr, n, sizeof(char*), myCompare); 
} 
 

#define LENGTH 10

int main()
{
    int N,i,j,d;
    int pntr=0;
    int count=0;
    int max=0;
    int many=1;
    char** words;
    char** member;

    scanf("%d",&N);
    words = (char**)malloc(N*sizeof(char*));
    for (i = 0; i < N; i++)
    {
        words[i] = (char*)malloc((LENGTH+1) * sizeof(char));
    }
    member = (char**)malloc(N*sizeof(char*));
    for (i = 0; i < N; i++)
    {
        member[i] = (char*)malloc((LENGTH+1) * sizeof(char));
    }
    for(i=0;i<N;i++)
    {
        scanf("%s",words[i]);
    }
    
    sort(words,N); 
    strcpy(member[0],words[0]);
    for(i=1;i<N;i++)
    {
        if(!strcmp(words[i],words[i-1]))
        {
            count++;
        }
        else
        {
            count=0;
        }
        
        if(count > max)
        {
            max = count;
            pntr =0;
            many= 1;
            strcpy(member[pntr],words[i]); 
        }
        else if(count == max)
        {
            pntr++;
            strcpy(member[pntr], words[i]);
            many++;
        }
        else
        {
            
        }
    }
    for(i=0;i<many;i++)
    {

        printf("%s\n",member[i]);
    }

    return 0;
}

Measured memory_bytes: 17516
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    cout<<(ll)pow(2,(int)log2(n)+1)-1;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    int a[(int)1e5 + 1] = {};
    rep(i, n)
    {
        int c;
        cin >> c;
        a[c]++;
    }
    int e = 0, o = 0;
    rep(i, 1e5 + 1)
    {
        if (a[i] != 0)
        {
            if (a[i] % 2 == 1)
                o++;
            else
                e++;
        }
    }
    if (e % 2 == 0)
        OP(o + e);
    else
        OP(o + e - 1);

    return 0;
}

Measured memory_bytes: 640