akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

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

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

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

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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

mint t1(ll H, ll W) {
	ll c = gcd(H, W);

	return pw(2, H) + pw(2, W) + pw(2, c) - 3;

}

int main() {
	ll H, W, T;
	cin >> H >> W >> T;

	ll gh = gcd(H, T);
	ll gw = gcd(W, T);

	mint ans = pw(t1(H / gh, W / gw), gh * gw);
	cout << ans << endl;
}

Measured memory_bytes: 3560
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int flag = 1;
	while(n>0){
		if(n%10==7){
			flag = 0;
			break;
		}
		n/=10;
	}
	if(flag) printf("No");
	else printf("Yes");
	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<int, int> > vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef pair<int, int> pii;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax];
int main()
{
    ios::sync_with_stdio(0);
    ll sum = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> arr[i];
        sum += arr[i];
    }
    ll ans = INF;
    ll sum1 = arr[1];
    sum -= arr[1];
    ans = min(ans, abs(sum1 - sum));

    for(int i = 2; i <= n - 1; i ++)
    {
        sum -= arr[i];
        sum1 += arr[i];

        ans = min(ans, abs(sum - sum1));
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
function Main(input) {
	var lines = input.split("\n");
	var titles = lines.map(l => l.split(' ')[0]).splice(1, lines.length - 3)
	var sleptAt = titles.indexOf(lines[lines.length - 2])
	var sum = 0
	for(var i = sleptAt + 2; i < lines.length -2 ; i ++) {
		sum+= Number(lines[i].split(' ')[1])
	}
	console.log(sum)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

int main() {
  int x,y; 
  cin>>x>>y;
  for(int i=0;i<=x;i++){
    int t=x-i;
    if(2*i+4*t==y){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3624
object Main {

  def calc(X: Int): Int = {
    var max = 1
    for {
      i <- 1 to math.sqrt(X).toInt
      j <- 2 to math.sqrt(X).toInt
      n = math.pow(i, j).toInt
      if n <= X
    } {
      max = math.max(max, n)
    }
    max
  }

  def main(args: Array[String]): Unit = {
    val in = io.Source.fromInputStream(System.in).getLines()
    val X= in.next().toInt
    System.out.println(calc(X))
  }
}


Measured memory_bytes: 25412
# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from functools import reduce

# a, b = [int(v) for v in input().split()]


def main():
    N, M = [int(v) for v in input().split()]
    A = list(set([int(v) // 2 for v in input().split()]))

    def func(a):
        count = 0
        while a % 2 == 0:
            count += 1
            a //= 2
        return count

    fa = func(A[0])
    for a in A[1:]:
        if func(a) != fa:
            print(0)
            exit()

    def gcd(a, b):
        if b == 0:
            return a
        return gcd(b, a % b)

    def lcm(v1, v2):
        return v1 * v2 // gcd(v1, v2)

    a_lcm = 1
    for a in A:
        d = gcd(a_lcm, a)
        a_lcm = a_lcm * a // d
        if a_lcm > M:
            print(0)
            exit()

    # a_lcm = reduce(lambda v1, v2: lcm(v1, v2), A)

    print((M // a_lcm + 1) // 2)


main()


Measured memory_bytes: 14748
package main

import (
	"fmt"
)

func main() {
	var W, H, x, y float64
	fmt.Scan(&W, &H, &x, &y)

	fmt.Print(W * H / 2)

	if (x*2 == W) && (y*2 == H) {
		fmt.Println(" 1")
	} else {
		fmt.Println(" 0")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
const ll INF = 1e10;
const ll MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i ++) cin >> a[i];
    ll ans = 0;
    for (int i = 0; i < n - 1; i ++ ) {
        ans += a[i]/2;
        if (a[i]%2 == 1 && a[i + 1] > 0) {
            ans ++;
            a[i + 1] --;
        }
    }
    ans += a[n - 1]/2;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long 
using namespace std;
typedef pair<int,int> ii;

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	int n, k; cin >> n >> k;
	int arr[n]; 
	
	for(int i = 0;i < n;i++) cin >> arr[i];
	
	for(int t = 0;t < min(200LL,k);t++){
		
		
		int brr[n]; fill(brr,brr+n,0);
		
		for(int i = 0;i < n;i++){
			int l = max(i-arr[i], 0LL);
			int r = min(i+arr[i], n-1);
			
			if(r != n-1) brr[r+1]--;
			brr[l]++;
		}
		
		for(int i = 1;i < n;i++) brr[i] += brr[i-1];
		for(int i = 0;i < n;i++) swap(arr[i],brr[i]);
	}
	
	for(int i = 0;i < n;i++) cout << arr[i] << " ";	
}



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

def even_judgement(A):
  count = 0
  for a in A:
    if a%2 == 0:
      count += 1
  if count == N:
    return True
  else:
    return False

S_COUNT = 0
while even_judgement(A):
  A = list(map(lambda x: x/2, A))
  S_COUNT += 1
print(S_COUNT)

Measured memory_bytes: 3064
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

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

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

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

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


void solve(){
    
}

ll dp[110][10010];
ll weight[110],value[110];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,w;
    cin>>n>>w;
    rep(i,n) cin>>value[i]>>weight[i];
    
    for(ll a=0;a<=w;a++) dp[0][a]=0;
    
    rep(i,n){
        for(ll j=0;j<=w;j++){
            if(j>=weight[i]) dp[i+1][j]=max(dp[i][j-weight[i]]+value[i],dp[i][j]);
            else dp[i+1][j]=dp[i][j];
        }
    }
    cout<<dp[n][w]<<endl;
    return 0;
}



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

using namespace std;

const int N = 1e5 + 100, inF = 2e9;

int n, h[N], dp[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		dp[i] = (i > 0) * inF;
		cin >> h[i];
		if (i >= 1)
			dp[i] = min(dp[i], dp[i - 1] + abs(h[i - 1] - h[i]));
		if (i >= 2)
			dp[i] = min(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]));
	}
	cout << dp[n - 1];
}


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

int main() {
    string s;
    cin >> s;
    int count=0;
    int ans=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='A'||s.at(i)=='C'||s.at(i)=='G'||s.at(i)=='T'){
            count++;
            ans=max(ans,count);
        }
        else{
            ans=max(ans,count);
            count=0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
main::IO()
main= do
    _ <- readLn::IO Int
    a <- map (read::String -> Integer) . words <$> getLine
    let elmnt = drop 1 $ zip (scanl (+) 0 (init a)) (scanr (+) 0 a)
    print $ minimum $ map (abs) $ map (\e -> (fst e - snd e)) elmnt 



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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE 
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n;
    cin>>n;
    int c=0;
    int arr[n];
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        if(arr[i]%2!=0 && i%2!=0)
            c++;
    }
    cout<<c<<"\n";
    return 0;
}





Measured memory_bytes: 3632
N=int(input())
h=list(map(int,input().split()))

dp=[0]*(N)

for i in range(1,N):
    if i==1:
        dp[i]=abs(h[i]-h[i-1])
    else:
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

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

int main() {
	long long X;//希望金額
	long long bank=100;//預金額
	int years=0;//年数
	cin >> X;
	while (bank < X) {
		bank = bank + bank / 100;
		years = years + 1;
	}
	cout << years;
	return 0;
}

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

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

  int n = s.size();
  s += s;

  vector<vector<int>> v(26);
  for (int i = 0; i < s.size(); ++i) {
    v[s[i] - 'a'].push_back(i);
  }

  int pos = 0;
  long long ans = 0;

  for (int i = 0; i < t.size(); ++i) {
    int j = t[i] - 'a';
    if (v[j].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    pos = *lower_bound(v[j].begin(), v[j].end(), pos) + 1;
    if (pos >= n) {
      pos -= n;
      ans += n;
    }
  }
  ans += pos;

  cout << ans << endl;
}

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;
signed main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto& x : a) cin >> x;
  sort(a.begin(), a.end());
  
  const int mod = 1e9 + 7;
  vector<int> fac(n + 1), inv(n + 1), finv(n + 1);
  fac[0] = fac[1] = 1;
  inv[1] = 1;
  finv[0] = finv[1] = 1;
  for (int i = 2; i <= n; i++) {
    fac[i] = 1LL * fac[i - 1] * i % mod;
    inv[i] = mod - 1LL * (mod / i) * inv[mod % i] % mod;
    finv[i] = 1LL * finv[i - 1] * inv[i] % mod;
  }
  auto comb = [&](int n, int k) -> int {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * (1LL * finv[k] * finv[n - k] % mod) % mod;
  };
  
  int min_sum = 0;
  for (int i = 0; i < n; i++) {
    int t = 1LL * a[i] * comb(n - i - 1, k - 1) % mod;
    min_sum = (min_sum + t) % mod;
  }
  
  int max_sum = 0;
  for (int i = 0; i < n; i++) {
    int t = 1LL * a[i] * comb(i, k - 1) % mod;
    max_sum = (max_sum + t) % mod;
  }
  
  cout << (mod + max_sum - min_sum) % mod << endl;
}

Measured memory_bytes: 3328
from collections import Counter
n = int(input())
ws = [input() for i in range(n)]
if len(Counter(ws)) < len(ws):
    print("No")
    exit(0)

for i in range(1, len(ws)):
    if ws[i][0] != ws[i-1][-1]:
        print("No")
        exit(0)
print("Yes")


Measured memory_bytes: 3444
import sys
input = sys.stdin.readline

import numpy as np

R,G,B,N = map(int,input().split())

count = 0
R_limit = N // R

for i in range(R_limit,-1,-1):
    N_temp = N - i*R
    G_limit = N_temp // G
    for j in range(G_limit,-1,-1):
        N_temp2 = N_temp - j * G
        B_mod = N_temp2 % B
        if B_mod == 0:
            count = count+1

print(count)

Measured memory_bytes: 21524
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  ios::sync_with_stdio(false);
  int P = 37;
  int K = P + 1;
  int N = P * K + 1;
  cout << N << " " << K << endl;;
  REP(i,0,K) {
    cout << N << " ";
    REP(j,0,P) {
      cout << i * P + j + 1 << " ";
    }
    cout << endl;
  }
  REP(i,0,P) {
    REP(j,0,P) {
      cout << N - P + i << " ";
      REP(k,0,P) {
        cout << k * P + (i * k + j) % P + 1 << " ";
      }
      cout << endl;
    }
  }
      
  return 0;
}


Measured memory_bytes: 512
//#pragma region ALL(include define etc)
#include <iostream>   // swap(a, b)
#include <string>
#include <cmath>      // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592)
#include <vector>     // vec.push_back(a) vec.pop_back()
#include <algorithm>  // max(a, b) min(a, b) reverse() sort()
#include <functional> // sort(a, a + N, greater<型>());
#include <math.h>
#define int long long
#define ll long long
using namespace std;
//#pragma endregion

signed main()
{
	//int x;

	//int n;
	//int m;
	string s;
	string t;
	//int m1, m2;

	//int k, d;
	int all = 0;
	int a, b;

	bool flag = true;

	//string str;

	cin >> s >> t;
	//cin >> x;

	a = s.length();

	for (int i = 0; i < a; i++)
	{
		if (s[i] != t[i])
		{
			flag = false;
			break;
		}
	}


	//cout << all << "\n";

	if (flag == true)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    string s;
    cin>>s;
    long long q,i,x,y,a=0,j;
    char z;
    cin>>q;
    for(i=1;i<=q;i++)
    {
        cin>>x;
        if(x==1)
        {
           a++;
        }        
        else if(x==2)
        {
           cin>>y;
           cin>>z;
           if(y==1)
           {
              if(a%2!=0)
              {
                 s.push_back(z);
              }
              else
              {
                 s=z+s;
              }
           }
           else if(y==2)
           {
              if(a%2!=0)
              {
                 s=z+s;
              }
              else
              {
                 s.push_back(z);
              }
           }
        }
    }
    if(a%2==0)
    {
        cout<<s<<endl;
    }
    else
    {
       reverse(s.begin(),s.end());
       cout<<s<<endl;
    }
    return 0;
}

Measured memory_bytes: 4696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    string N;
    cin >> N;
    int l = N.length();
    int k[l];
    for (int i = 0; i < l; i++) {
        k[i] = N[i] - '0';
    }
    if (l == 1) {
        cout << min(k[0], 10 - k[0] + 1) << "\n";
        return 0;
    }
    int d[l + 1][2]{};
    d[0][1] = 10 - k[0];
    d[0][0] = k[0];
    for (int i = 1; i < l; i++) {
        d[i][0] = min(d[i - 1][0] + k[i], d[i - 1][1] + k[i] + 1);
        d[i][1] = min(d[i - 1][0] + 10 - k[i], d[i - 1][1] + 10 - k[i] - 1);
    }
    cout << min(d[l - 1][0], d[l - 1][1] + 1) << "\n";
    // for (int i = 0; i < l; i++) {
    //     printf("%d %d\n", d[i][0], d[i][1] + 1);
    // }
    return 0;
}

Measured memory_bytes: 13060
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
int main()
{
	double x, y;
	cin >> x >> y;
	int wari = x / y;
	int amari = (int)x % (int)y;
	double warishousu = x / y;
	cout << wari << " " << amari << " " << fixed << setprecision(10) << warishousu << endl;
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define str string
#define pb push_back
#define vc vector
#define ci cin
#define co cout
// remove fropen in online judge
int main()
{ 
   

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a[10];
    for(int i=0;i<5;i++)
        cin>>a[i];
    for(int i=0;i<5;i++)
    {
        if(a[i]==0)
        {
            cout<<i+1;
            break;
        }
    }

    
    
    
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;
int n,mp[101][101],D[101];

void dijkstra(){
  bool used[101]={};
  for(int i=0;i<101;i++)D[i]=INF;
  D[0]=0;

  while(1){
    int cost=INF,pos=-1;
    for(int i=0;i<n;i++) if(!used[i]&&D[i]<cost) pos=i,cost=D[i];
    if(pos==-1)return ;
    used[pos]=1;    
    for(int i=0;i<n;i++)D[i]=min(D[i],cost+mp[pos][i]);
  }
}


int main(){

  cin>>n;
  for(int i=0;i<101;i++)
    for(int j=0;j<101;j++) mp[i][j]=INF;
  
  for(int i=0,a,m;i<n;i++){
    cin>>a>>m;
    for(int j=0,b,c;j<m;j++)cin>>b>>c,mp[a][b]=c;
  }
  dijkstra();
  for(int i=0;i<n;i++)cout <<i<<" "<<D[i]<<endl;
  
  return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int n; scanf("%d", &n);
  int p;
  long long cur = 1000; 
  scanf("%d", &p);
  for (int a, i = 1; i < n; ++i) {
    scanf("%d", &a);
    if (a > p) {
      cur = cur/p*a+cur%p;
    }
    p = a;
  }
  printf("%lld", cur);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3824
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;

class Segment_Tree {
	vector<long long int>v;
	int num;
	long long int ret;
	bool is_min;
	long long int Update(int place) {
		if (place >= v.size() / 2) {
			return v[place];
		}
		if (is_min) {
			v[place] = min(Update(place * 2), Update(place * 2 + 1));
			return v[place];
		}
		v[place] = max(Update(place * 2), Update(place * 2 + 1));
		return v[place];
	}
public:
	Segment_Tree(int n, bool min) {
		n++;
		num = 1;
		while (num < n * 2) {
			num *= 2;
		}
		is_min = min;
		if (min) {
			v.resize(num, MOD*MOD);
		}
		else v.resize(num, -MOD * MOD);
	}
	void Insert(int place, long long int num, bool update) {
		place += v.size() / 2;
		v[place] = num;
		if (!update)return;
		place /= 2;
		while (place) {
			if (is_min)v[place] = min(v[place * 2], v[place * 2 + 1]);
			else v[place] = max(v[place * 2], v[place * 2 + 1]);
			place /= 2;
		}
	}
	void TopDown() {
		Update(1);
	}
	long long int RMQ(int a, int b) {
		if (is_min)ret = LLONG_MAX;
		else ret = LLONG_MIN;
		if (is_min) {
			b++;
			for (a += num / 2, b += num / 2; a < b; a >>= 1, b >>= 1) {
				if (a & 1)ret = min(ret, v[a++]);
				if (b & 1)ret = min(ret, v[--b]);
			}
		}
		else {
			b++;
			for (a += num / 2, b += num / 2; a < b; a >>= 1, b >>= 1) {
				if (a & 1)ret = max(ret, v[a++]);
				if (b & 1)ret = max(ret, v[--b]);
			}
		}
		return ret;
	}
};

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

	cin >> N >> M >> K;
	string s;
	cin >> s;
	s = "A" + s + "A";
	int box = 0;
	int lst = 0;
	for (int i = 1; i <= N; i++) {
		if (s[i] == 'o'&&i > lst) {
			lst = i + K;
			box++;
		}
	}
	if (box > M) {
		return 0;
	}
	Segment_Tree l(N + 2, false);
	Segment_Tree r(N + 2, false);
	l.Insert(0, 0, true);
	for (int i = 1; i <= N; i++) {
		int add = l.RMQ(0, max(0LL, i - K - 1));
		if (s[i] == 'o')add++;
		l.Insert(i, add, true);
	}
	r.Insert(N + 1, 0, true);
	for (int i = N; i >= 1; i--) {
		int add = r.RMQ(min(N + 1, i + K + 1), N + 1);
		if (s[i] == 'o')add++;
		r.Insert(i, add, true);
	}
	vector<vector<int>>ans(M + 1);
	for (int i = 1; i <= N; i++) {
		if (l.RMQ(0, max(0LL, i - K - 1)) + r.RMQ(min(N + 1, i + K + 1), N + 1) == M - 1 && s[i] == 'o')ans[l.RMQ(0, max(0LL, i - K - 1))].push_back(i);
	}
	for (int i = 0; i <= M; i++) {
		if (ans[i].size() == 1)cout << ans[i].front() << endl;
	}
}

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

using namespace std;

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

#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=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, c, d[40][40], C, t[10][40];
	cin>>n>>c;
	REP(i, c){
		REP(j, c){
			cin>>d[i][j];
		}
	}
	REP(i, n){
		REP(j, n){
			cin>>C;
			++t[(i+j)%3][C-1];
		}
	}
	int ans=1<<30;
	REP(i, c){
		REP(j, c){
			REP(k, c){
				if(i!=j && j!=k && k!=i){
					int tmp=0;
					REP(l, c){
						tmp+=d[l][i]*t[0][l];
						tmp+=d[l][j]*t[1][l];
						tmp+=d[l][k]*t[2][l];
					}
					ans=min(ans, tmp);
				}
			}
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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


int main() {
int n;
long long ans=1;
cin>>n;
REP(i,n)
ans *= (i+1);
cout<<ans<<endl;
}

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

int arr[200003] , N; vector < int > pot;

#define PII pair < int , int >
PII stk[200003]; int top;
bool check(int mid){
	top = 0;
	for(auto t : pot){
		while(top && stk[top].first > t) --top;
		auto add = [&](int x){
			if(top && stk[top].first == x) ++stk[top].second;
			else stk[++top] = PII(x , 1);
		};
		add(t);
		while(stk[top].first && stk[top].second == mid){--top; add(stk[top + 1].first - 1);}
		if(stk[top].first == 0) return 0;
	}
	return 1;
}

int main(){
	ios::sync_with_stdio(0); cin >> N;
	for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	for(int i = 2 ; i <= N ; ++i) if(arr[i] <= arr[i - 1]) pot.push_back(arr[i]);
	int L = 1 , R = N + 1;
	while(L < R){int mid = (L + R) >> 1; check(mid) ? R = mid : L = mid + 1;}
	cout << L; return 0;
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}
template<class T>
void print_array(T a[],size_t n){
  cerr<<"array:";
  REP(n-1)cerr<<a[i]<<",";
  cerr<<a[n-1]<<endl;
}

int N;
int a[100];
pair<int,int> A[100];

int main(){
  cin>>N;
  REP(N)cin>>a[i];
  int means=0;
  REP(N)means+=a[i];
  REP(N)a[i]*=N;
  REP(N){
    A[i]=make_pair(a[i],i);
  }
  sort(A,A+N);
  if(means==A[0].first){
    cout<<0<<endl;
    return 0;
  }
  auto itr=lower_bound(A,A+N,make_pair(means,0));
  itr--;
  if(means-itr->first<(itr+1)->first-means){
    itr=lower_bound(A,A+N,make_pair(itr->first,0));
    cout<<itr->second<<endl;
  }else if(means-itr->first==(itr+1)->first-means){
    auto itr2=itr+1;
    itr=lower_bound(A,A+N,make_pair(itr->first,0));
    cout<<min(itr->second,itr2->second)<<endl;
  }else{
    cout<<(itr+1)->second<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 16;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	return !printf("%d\n", A^B^C);
}

Measured memory_bytes: 256
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    string s; cin >> s;
    deque<char> d;
    rep(i, s.size())
    {
        d.push_back(s[i]);
    }
    IN(q);
    bool r = false;
    rep(i, q)
    {
        IN(t);
        if (t == 1)
            r = !r;
        else
        {
            IN(f); char c; cin >> c;
            if (f == 1 && !r || f == 2 && r) d.push_front(c);
            else d.push_back(c);
        }
    }
    rep(i, d.size())
    {
        cout << d[r ? d.size()-i-1 : i];
    }
    cout << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 976
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2200000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b) {a = b; return true;}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b) {a = b; return true;}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
    ll n; cin >> n;
    vl a(n); rep(i,n) cin >> a[i];
    priority_queue<ll> pq;
    rep(i,n) pq.push(a[i]);
    ll ans = 0;
    while(1){
        ll u = pq.top(); pq.pop();
        if(u <= n-1) break;
        ans += u / n;
        vl v;
        while(!pq.empty()){
            v.push_back(pq.top()); pq.pop();
        }
        rep(i,v.size()){
            v[i] += u / n;
            pq.push(v[i]);
        }
        v.clear();
        u -= u / n * n;
        pq.push(u);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h> 
using namespace std; 
// Binary indexed tree supporting binary search.
 
 
#define x first
#define y second
 
#define forn(i, n) for(int i = 0; i < int(n); ++i)
 
typedef pair<int, int> pii;
//#define forn(i, a,b) for (int i = (int) a; i <= (int) b; ++i)
const int MAXN = 200005;
const int INF = 1000000000;
struct change{
	int a,b;
};
vector<vector<int> > adj(MAXN);
int numbers[MAXN];
int n;
vector<int> dyn(MAXN,INF);
int changes[MAXN];
vector<int> :: iterator it;
int ans[MAXN];
int poss[MAXN];
void dfs(int node,int parent){
	it = lower_bound(dyn.begin(),dyn.end(),numbers[node]);
	changes[node] = dyn[it-dyn.begin()];
	dyn[it-dyn.begin()] = numbers[node];
	poss[node] = it-dyn.begin();
	it = lower_bound(dyn.begin(),dyn.end(),INF-1);
	ans[node] = (it - dyn.begin());
	forn(i,adj[node].size()){
		if(adj[node][i] != parent){
			dfs(adj[node][i],node);
		}
	}
	dyn[poss[node]] = changes[node];
	
}
int main(){
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
 	cin>>n;
 	forn(i,n){
 		cin>>numbers[i];
	}
 	forn(i,n-1){
 		int a,b;
 		cin>>a>>b;
 		a--;b--;
 		adj[a].push_back(b);
 		adj[b].push_back(a);
	}
	dfs(0,-1);
	forn(i,n){
		cout<<ans[i]<<" ";
	}
	cout<<'\n';
	return 0;	
}

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

int main(){
   ll a,b,v,w,t;
   cin>>a>>v>>b>>w>>t;
   
   if(b>a){   
       ll sum1 = a+(v*t);
       ll sum2 = b+(w*t);
       if(sum1 >= sum2)cout<<"YES";
       else cout <<"NO";
   }
   else {
   	   ll sum3 = a-(v*t);
   	   ll sum4 = b-(w*t);
       if(sum3 <= sum4)cout<<"YES";
       else cout <<"NO";
   }
   return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		if (N%2==0) {
			System.out.println(N);
		} else {
			System.out.println(N*2);
		}
	}
}

Measured memory_bytes: 21844
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
  //happy coding

  int n;
  cin>>n;
  vi a(n),b(n);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }

  sort(all(a));
  sort(all(b));

  int ans;
  if(n%2==1){
    ans = b[n/2] - a[n/2]+1;
  }else{
    ans = b[n/2-1]+b[n/2]-(a[n/2-1]+a[n/2])+1;
  }

  cout<<ans<<endl;

  
  return 0;
}
int main(){
  int test = 1;
  //scanf("%d", &test);
  while (test--)solve();return 0;
}

Measured memory_bytes: 4816
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define fr for(ll i=0;i<n;++i)
#define in(a,n) ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
#define print(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<' ';br
#define printv(v) vector<ll> :: iterator it;for(it=v.begin();it!=v.end();it++)cout<<*it<<' ';br
#define print2(a,b) cout<<a<<' '<<b;br
#define print3(a,b,c) cout<<a<<' '<<b<<' '<<c;br
#define sum(a,n) ll sum=0;for(ll i=0;i<n;i++)sum+=a[i];
#define br cout<<endl;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define mod 1000000007
using namespace std;
int main()	{
	SPEED
	ll n,m,x,ans; 
	cin >> n;
	in(a,n)
	ll* dp = new ll [n + 1];
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	for(ll i = 2; i < n; i++) {
		dp[i] = min(dp[i-2] + abs(a[i] - a[i-2]), dp[i-1] + abs(a[i] - a[i-1]));
	}
	cout << dp[n-1];
	return 0;
}

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

int main() {
    int N;
    cin>>N;
    vector<int64_t> L(N+1);
    
    L.at(0)=2;
    L.at(1)=1;
    
    for(int i=2;i<(N+1);i++){
      L.at(i)=L.at(i-1)+L.at(i-2);    
  }
  
  cout<<L.at(N)<<endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

	vector<int> a(N);
	vector<int> b(N);
	vector<int> c(M);
	vector<int> d(M);

	for (int i = 0;i < N;i++)
		cin >> a[i] >> b[i];

	for (int i = 0;i < M;i++)
		cin >> c[i] >> d[i];

	for (int i = 0;i < N;i++)
	{
		int ans = abs(a[i] - c[0]) + abs(b[i] - d[0]);
		int point = 0;
		for (int j = 1;j < M;j++)
		{
			int num = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (ans > num)
			{
				ans = num;
				point = j;
			}
		}

		cout << point + 1 << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int x, y, z;
    cin >> x >> y >> z;
    OUT(max(max(x*10+y+z,x+y*10+z),x+y+z*10));

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long X, long long Y){
	ll res = 0;
	if (X == 1) res += 300000;
	if (X == 2) res += 200000;
	if (X == 3) res += 100000;
	if (Y == 1) res += 300000;
	if (Y == 2) res += 200000;
	if (Y == 3) res += 100000;
	if (X == 1 && Y == 1) res += 400000;
	cout << res << endl;
}

int main(){	
	long long X;
	long long Y;
	scanf("%lld",&X);
	scanf("%lld",&Y);
	solve(X, Y);
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		//String t = sc.next();
		//String g = sc.next();
		//long n = sc.nextLong();
		//long m = sc.nextLong();
		//long k = sc.nextLong();
		//long l = sc.nextLong();
		long count=0;

		/*for(int i=1;i<10000;i++) {
			if(n<500*(i+1)) {
				count=i;
				break;
			}
		}*/
		if(s.substring(0,1).equals(s.substring(1,2))||s.substring(1,2).equals(s.substring(2,3))||s.substring(0,1).equals(s.substring(2,3))) {
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
		//System.out.println((int)Math.ceil((n+m)/2.0));
		//System.out.println(s.substring(0,1)+t.substring(1,2)+g.substring(2,3));
	}
}




Measured memory_bytes: 22996
INF=10**30
def Belman_Ford(s,N,Edge):
    dist=[INF]*N
    neg=[False]*N
    dist[s]=0
    for i in range(N-1):
        for f,t,c in Edge:
            if dist[t]>dist[f]+c and dist[f]!=INF:
                dist[t]=min(dist[t],dist[f]+c)
    for i in range(N):
        for f,t,c in Edge:
            if dist[t]>dist[f]+c and dist[f]!=INF:
                dist[t]=dist[f]+c
                neg[t]=True
            if neg[f]:
                neg[t]=True
    return dist,neg
                
N,M,P=map(int,input().split())
Edge=[]
for i in range(M):
    a,b,c=map(int,input().split())
    Edge.append((a-1,b-1,-(c-P)))
dist,neg=Belman_Ford(0,N,Edge)

if(neg[N-1]):
    print(-1)
else:
    ans=-dist[N-1]
    print(max(0,ans))

Measured memory_bytes: 52696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
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;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<class T>
struct BIT{
    vector<T> data;
    BIT(int size){
        data.assign(size+1,0);
    }
    T sum(int k){
        //[0,k]
        T res=0;
        for(++k;k>0;k-=k&-k){
            res+=data[k];
        }
        return res;
    }
    T sum(int l,int r){
        //[l,r]
        return sum(r)-sum(l-1);
    }
    void add(int k,T x){
        for(++k;k<data.size();k+=k&-k){
            data[k]+=x;
        }
    }
};
int index(int n,int k){
    return n+k;
}
int main(){
    int n;
    cin>>n;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    if(n==1){
        cout<<vec[0]<<endl;
        return 0;
    }
    int ok=0,ng=INF;
    while(ng-ok>1){
        int mid=(ok+ng)/2;
        vi sum(n+1);
        REP(i,n){
            if(vec[i]>=mid){
                sum[i+1]++;
            }else{
                sum[i+1]--;
            }
        }
        REP(i,n){
            sum[i+1]+=sum[i];
        }
        BIT<ll> tr((n+1)*2+10);
        ll ans=0;
        REP(i,n+1){
            ans+=tr.sum(index(n,sum[i]));
            tr.add(index(n,sum[i]),1);
        }
        if(ans>=1ll*(n+1)*n/4){
            ok=mid;
        }else{
            ng=mid;
        }
    }
    cout<<ok<<endl;
    return 0;
}

Measured memory_bytes: 2688
#include<stdio.h>
#include<string.h>
int main(void){
  char s[2000];
  scanf("%s",&s);
  int a=0,b=0,c=0,d=0;
  for(int i=0;i<strlen(s);i++){
    if(s[i]=='N')a=1;
    if(s[i]=='S')b=1;
    if(s[i]=='W')c=1;
    if(s[i]=='E')d=1;
  }
  if(a-b||c-d){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,k) = get!(usize, usize);
    let (r,s,p) = get!(usize, usize,usize);
    let t = get!(String).chars().collect::<Vec<_>>();

    let mut vec = vec![Vec::new(); k];
    for i in 0..n {
        vec[i%k].push(t[i]);
    }

    let mut sum = 0;
    for i in 0..k {
        let mut before = ' ';
        let mut count = 0;
        for &e in &vec[i] {
            if before == e {
                count += 1;
            } else {
                let plus = (count+1)/2;
                sum += plus*match before {
                    'r' => p,
                    's' => r,
                    'p' => s,
                    _ => 0,
                };
                count = 1;
            }
            before = e;
        }
        let plus = (count+1)/2;
        sum += plus*match before {
            'r' => p,
            's' => r,
            'p' => s,
            _ => 0,
        };
    }
    println!("{}", sum);
}


Measured memory_bytes: 12668
n = int(raw_input())
s = raw_input()
cases = ["SS", "SW", "WS", "WW"]

def inv(c):
    return "S" if c == "W" else "W"

for i in xrange(2, n + 2):
    for j, case in enumerate(cases):
        p = case[i - 2]
        c = case[i - 1]
        d = s[(i - 1) % n]
        if d == "o":
            if c == "S":
                newcase = case + p
            else:
                newcase = case + inv(p)
        else:
            if c == "S":
                newcase = case + inv(p)
            else:
                newcase = case + p
        cases[j] = newcase

for case in cases:
    if case[-2:] == case[:2]:
        print case[:-2]
        break
else:
    print "-1"


Measured memory_bytes: 3460
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    int a,b,k;
    cin>>a>>b>>k;
    vector<int> v(102,0);
    for(int i=1;i<=a;i++){
        if(a%i==0){
            v[i]++;
        }
        if(b%i==0){
            v[i]++;
        }
    }
    int cnt=0;
    for(int i=100;i>=0;i--){
        if(v[i]==2){
            cnt++;
        }
        if(cnt==k){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256