akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace ITP1_4_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<string[]>();
            string[] input;
            while (true)
            {
                input = Console.ReadLine().Split(' ');
                if (input[1] == "?") break;
                list.Add(input);
            }                         
            foreach(var l in list)
            {
                switch (l[1])
                {
                    case "+":
                        Console.WriteLine(int.Parse(l[0]) + int.Parse(l[2]));
                        break;
                    case "-":
                        Console.WriteLine(int.Parse(l[0]) - int.Parse(l[2]));
                        break;
                    case "*":
                        Console.WriteLine(int.Parse(l[0]) * int.Parse(l[2]));
                        break;
                    case "/":
                        Console.WriteLine(int.Parse(l[0]) / int.Parse(l[2]));
                        break;
                }
            }
        }
    }
}

Measured memory_bytes: 9408
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

A2 = np.abs(A)
x = A2.min()
s = A2.sum()
A3 = A < 0
if A3.sum() % 2 == 0:
    print(s)
else:
    print(s-2*x)



Measured memory_bytes: 23384
i,B[];C(n,l,r,t){t=B[10-n];return!n--||t>l&&C(n,t,r)||t>r&&C(n,l,t);}main(){for(;~scanf("%*d%d"+!!*B*3,B+i);)i++-9||puts(C(10,0,i=0)?"YES":"NO");}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  vector<char> vec;
  rep(i, 4) {
    char c; cin >> c;
    vec.push_back(c);
  }
  sort(vec.begin(), vec.end());
  if (vec[0] == vec[1] && vec[1] != vec[2] && vec[2] == vec[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}

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

using namespace std;

int main()
{
    string S;
    cin >> S;
    bool exist = false;
    char x = S[0];
    for (int i = 1; i < S.size(); ++i)
    {
        if (x != S[i])
        {
            cout << "Yes" << endl;
            exist = true;
            break;
        }
    }
    if (!exist)
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

bool solve(int n, vector<int> &t, vector<int> &x, vector<int> &y) {
    rep(i, n) {
        if (i == 0) {
            if (x[i] + y[i] > t[i]) return false;
            else if ((t[i] - (x[i] + y[i])) % 2 == 1) return false;
        } else {
            int diff_x = abs(x[i] - x[i-1]);
            int diff_y = abs(y[i] - y[i-1]);
            int diff_t = t[i] - t[i-1];
            if (diff_x + diff_y > diff_t) return false;
            else if ((diff_t - (diff_x + diff_y)) % 2 == 1) return false;
        }
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    vector<int> t(n), x(n), y(n);
    rep(i, n) {
        cin >> t[i] >> x[i] >> y[i];
    }
    if (solve(n, t, x, y)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 4196
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    int ans=0;
    for(int i=1;i<=n;i+=2){
        int cnt=0;
        for(int j=1;j<=i;j++){
            if(i%j==0)
                cnt++;
        }
        if(cnt==8){
           
             ans++;
        }
           
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
package main

import "fmt"

func main(){
	var S string;
	fmt.Scan(&S);
	ans := 0;
	for i := 0 ; i < len(S) ; i++{
		if (i+1) % 2 == 1 {
			if S[i] == 'R' || S[i] == 'U' || S[i] == 'D' {
				ans++;
			}else {
				break;
			}
		}else {
			if S[i] == 'L' || S[i] == 'U' || S[i] == 'D' {
				ans++;
			}else {
				break;
			}
		}
	}
	if ans == len(S) {
		fmt.Println("Yes");
	}else {
		fmt.Println("No");
	}
}

Measured memory_bytes: 512
#include <stdio.h>
int main (void){
    int N,A,B;
    scanf("%d %d %d" , &N,&A,&B);
    
    if(1<=N && N<=20,
        1<=A && A<=50,
        1<=B && B<=50){

        }else{
            printf("error");
        }

        int NA = N*A;
        if(NA<B){
            printf("%d", NA);
        }else if(NA>B){
            printf("%d", B);
        }else if (NA == B){
            printf("%d", NA);
        }
        }
        



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n;
	cin >> n;
	int a[n];
	ll ans = 1;
	ll e = 1;
	REP(i, n){
		cin >> a[i];
		if (a[i] % 2 == 0){
			e *= 2;
		}
		ans *= 3;
	}
	cout << ans - e << endl;
}


Measured memory_bytes: 256
def count_div_2(n)
  ret = 0
  while n % 2 == 0
    n /= 2
    ret += 1
  end
  ret
end

n = gets.to_i
as = gets.split.map(&:to_i)
p as.map { |a| count_div_2(a) }.inject(:+)

Measured memory_bytes: 2428
#include <stdio.h>

int main(){

	int i,N;
	long long int a,b,c;

	scanf("%d", &N);
	a = 0; //menor que o menor possível
	b = 1000000001; //maior que o maior possivel
	for (i = 0; i < N; i++){
		scanf("%lld", &c);
		if (c > a)
			a = c;
		if (c < b)
			b = c;
	}
	printf("%lld\n", a-b);
	
	return 0;

}


Measured memory_bytes: 128
/* 
 * Author: aps
 * Time: 24-06-2019 17:21:35
**/
#include<bits/stdc++.h>

#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef pair<int,int> pii;

const ll inf = 1e18;
const ll mod = 1e9+7;

inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x;}
inline ll sub(ll x, ll y) { x -= y; if (x < 0) x += mod; return x;}
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod;}
inline ll power(ll a, ll b) {
    ll x = 1;
    while (b) {
        if (b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}
inline ll inv(ll a) { return power(a, mod - 2);}

ll a,b,c,d;

ll f(ll x){
    return (b/x-(a-1)/x);
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> a >> b >> c >> d;
    ll x = (c*d)/__gcd(c,d);
    cout << (b-a+1) - (f(c) + f(d) - f(x)) << endl;
    return 0;
}


Measured memory_bytes: 256
import heapq
a, b, c, d = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al, reverse=True)
bl = sorted(bl, reverse=True)
cl = sorted(cl, reverse=True)
q = []
heapq.heappush(q, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])
ans = []
heapq.heappush(ans, [-(al[0] + bl[0] + cl[0]), 0, 0, 0])

#while True:
for i in range(d):
    s, aq, bq, cq = heapq.heappop(q)
    if len(al) > aq+1:
        if [-(al[aq+1] + bl[bq] + cl[cq]), aq+1, bq, cq] not in ans:
            heapq.heappush(q, [-(al[aq+1] + bl[bq] + cl[cq]), aq+1, bq, cq])
            heapq.heappush(ans, [-(al[aq+1] + bl[bq] + cl[cq]), aq+1, bq, cq])
            #q.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])
            #ans.append([al[aq+1] + bl[bq] + cl[cq], aq+1, bq, cq])

    if len(bl) > bq+1:
        if [-(al[aq] + bl[bq+1] + cl[cq]), aq, bq+1, cq] not in ans:
            heapq.heappush(q, [-(al[aq] + bl[bq+1] + cl[cq]), aq, bq+1, cq])
            heapq.heappush(ans, [-(al[aq] + bl[bq+1] + cl[cq]), aq, bq+1, cq])
            #q.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])
            #ans.append([al[aq] + bl[bq+1] + cl[cq], aq, bq+1, cq])

    if len(cl) > cq+1:
        if [-(al[aq] + bl[bq] + cl[cq+1]), aq, bq, cq+1] not in ans:
            heapq.heappush(q, [-(al[aq] + bl[bq] + cl[cq+1]), aq, bq, cq+1])
            heapq.heappush(ans, [-(al[aq] + bl[bq] + cl[cq+1]), aq, bq, cq+1])
            #q.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])
            #ans.append([al[aq] + bl[bq] + cl[cq+1], aq, bq, cq+1])

    #q = sorted(q)

    #if len(ans) > d:
    #   ans = sorted(ans, reverse=True)
    #    if ans[d][0] > q[len(q)-1][0]:
    #        break

for i in range(d):
    print(-heapq.heappop(ans)[0])


Measured memory_bytes: 5108
#include<bits/stdc++.h>
using namespace std;typedef long long ll;const int N=2e5+7;ll n,i,fa[N],A,d,a[N],l[N],r[N];main(){cin>>n>>d,A=(n-1)*d;for(i=1;i<=n;i++)cin>>a[i],A+=a[i],l[i]=r[i]=1e18;l[1]=a[1];for(i=2;i<=n;i++)l[i]=min(l[i-1],a[i]-(i-1)*d);r[n]=a[n]+(n-1)*d;for(i=n-1;i;i--)r[i]=min(r[i+1],a[i]+(i-1)*d);for(int i=2;i<n;i++)A+=min((i-1)*d+l[i],r[i]-(i-1)*d);cout<<A;}

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

int n, k, h[100104];
int dp[100104];

int main() {
	cin>>n>>k;
	for(int i = 1; i<= n ; i++)	cin>>h[i];
	memset(dp,-1,sizeof(dp));
	dp[1] = 0;
	for(int i = 1;i<n;i++){
		for(int j = 1;j<=k;j++){
			if(dp[i+j]== -1)
				dp[i+j] = dp[i]+abs(h[i+j]-h[i]);
			else
				dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
		}
	}
	cout<<dp[n];
	return 0;
}

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

int main(){
  string a,b;
  while(1){
    int hit=0,blow=0;
    cin>>a>>b;
    if(a=="0" && b=="0") break;
    for(int i=0;i<a.size();i++)
      for(int j=0;j<a.size();j++)
	if(a[i]==b[j]){
	  if(i==j) hit++;
	  else blow++;
	}
    cout<<hit<<" "<<blow<<endl;
  }
  return 0;
}

Measured memory_bytes: 1184
#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);
}

const int N = 2e3+45;

int a[N];
int n, z, w;
int dp[N][2];
int c[N][N];

void mmax(int &x, int y) {
	if (x == -1) x = y;
	x = max(x, y);
}

void mmin(int &x, int y) {
	if (x == -1) x = y;
	x = min(x, y);
}

int rek(int i, int p, int prev) {
	if (i == n-1) return abs(a[i]-a[prev]);
	int &ret = dp[i][p];
	if (ret != -1) return ret;
	for (int j = i+1; j < n; ++j) {
		if (p) mmin(ret, rek(j, !p, i));
		else mmax(ret, rek(j, !p, i));
	}
	return ret;
}

void solve() {
	for (int i = 0; i < N; ++i) for (int j = 0; j < 2; ++j) dp[i][j] = -1;
	scanf("%d%d%d", &n, &z, &w);
	a[0] = z;
	a[1] = w;
	n += 2;
	for (int i = 2; i < n; ++i) {
		scanf("%d", a+i);
	}
	printf("%d", rek(1, 0, 0));
}

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define ren(i,n) for(int i=n-1;i>=0;i--)
#define iter(it,v) for(auto it:v)
#define iterp(it,v) for(auto it=v.begin(),it!=v.end();it++)
#define itern(it,v) for(auto it=v.rbegin();it!=v.rend();it++)
#define w(n) while(n--)
#define forp(i,a,b) for(int i=a;i<=b;i++)
#define forn(i,a,b) for(int i=a;i>=b;i--)
#define sc(a) scanf("%d",&a)
#define pf(a) printf("%d",a)
#define init(a,r) for(auto&i:a) i=r;
#define inpt(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define inp(a) for(int&i:a) cin>>i;
#define diss(a) for(int i:a) cout<<i<<' ';
#define disn(a) for(int i:a) cout<<i<<'\n';
#define debug(a) cout<<#a<<": ";for(auto i:a)cout<<i<<" ";cout<<'\n';
#define mpii map<int,int>
#define sii set<int>
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define all(v) v.begin(),v.end()
#define bitc __builtin_popcount
#define fst ios::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define pq priority_queue
#define pii pair<int,int>
#define cs(a) cout<<a<<' '
#define cn(a) cout<<a<<'\n'
#define deb(a,b) cout<<a<<' '<<b<<endl;
#define yy "YES"
#define nn "NO"
#define ff first
#define ss second
typedef long long ll;
const int mod=1e9+7,mod1=998244353;
const int N=2e5+7;
int ar[N];
void a_b_l(){
    int n;
    cin>>n;
    int dp[n][3];
    rep(i,n){
        rep(j,3)
            cin>>dp[i][j];
    }
    forp(i,1,n-1){
        dp[i][0]+=max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]+=max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]+=max(dp[i-1][1],dp[i-1][0]);
    }
    cn(max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]));
}
signed main(){
    fst;
    int t=1;
    //cin>>t;
    w(t)
    	a_b_l();
}

Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
using namespace std;
char s[110];
int n,pos,maxn;
int main()
{
    scanf("%d%s",&n,s+1);
    for(int i=1;i<=n;++i)
    {
        if(s[i]=='I') ++pos;
        else --pos;
        maxn=max(maxn,pos);
    }
    printf("%d\n",maxn);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;

using namespace std;

int main()
{
    int N, M, tmp;
    ll ans = 0;
    cin >> N >> M;

    typedef pair<ll, ll> pair;
    vector<pair> pair_vec;

    for (int i = 0; i < N; i++) {
        ll tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        pair_vec.push_back(pair(tmp1, tmp2));
    }

    std::sort(
        pair_vec.begin(),
        pair_vec.end(),
        [](const pair& x, const pair& y){return x.first < y.first;}
    );
    tmp = M;
    for(auto& i: pair_vec){
        if (tmp - i.second >= 0) {
            ans += i.first * i.second;
            tmp -= i.second;
        }
        else {
            ans += tmp*i.first;
            break;
        }
    }

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


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 998244353;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

ll modpow(ll a, ll p)
{
  if (p == 0)
    return 1;
  if (!(p % 2))
  {
    ll halfP = p / 2;
    ll half = modpow(a, halfP);
    return half * half % mod;
  }
  else
  {
    return a * modpow(a, p - 1) % mod;
  }
}

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

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

    int num = 200010;
    vector<ll> fact(num), ifact(num);
    fact[0] = 1;
    fact[1] = 1;
    for (int i = 2; i < num; i++)
    {
      fact[i] = fact[i - 1] * i;
      fact[i] %= mod;
    }
    for (int i = 0; i < num; i++)
    {
      ifact[i] = modpow(fact[i], mod - 2);
      ifact[i] %= mod;
    }
    auto comb = [&](ll a, ll b){
      ll res;
      res = fact[a] * ifact[a-b] % mod * ifact[b] % mod;
      return res;
    };
    ll ans = 0;
    REPS(i, 0, K) {
      ans += comb(N-1, i) * M % mod * modpow(M-1, N - i - 1);
      ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

map <int, int> M;
int ans;

int main()
{
  int n, x;
  scanf("%d", &n);
  for(; n--; ){
    scanf("%d", &x);
    M[x] ++;
  }
  for(auto t: M){
    if(t.second >= t.first) ans += t.second - t.first;
    else ans += t.second;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 4736
import bisect
N = input()
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
c = sorted(map(int,input().split()))

a_big_b = [0] * len(a)
for i,p in enumerate(a):
    j = bisect.bisect_right(b, p)
    a_big_b[i] = j

b_big_c = [0] * len(b)
for i in range(len(b)-1,-1,-1):
    k = len(c) - bisect.bisect_right(c, b[i])
    if i==len(b)-1:b_big_c[i] = k
    else:b_big_c[i] = k + b_big_c[i+1]

g=0
for aa in a_big_b:
    if aa == len(b_big_c):pass
    else:g += b_big_c[aa]
print(g)

Measured memory_bytes: 24096
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n;
	cin >> n;
	int ans = 0;
	for(int i = 1; i <= n;i++){
		int x;
		cin >> x;
		if(i%2==1 and x%2 == 1) ans++;
	}
	cout << ans;
}

Measured memory_bytes: 3608
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

void sputs(){}
template <class Head, class... Tail>
void sputs(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) == 0) { cout << endl; }
  else { cout << " "; }
  sputs(std::move(tail)...);
}

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  int n;cin>>n;/*{{{*/
  vector<int> a(n);
  map<int, int> cnt;
  rep(i, n) {
    cin>>a[i];
    cnt[a[i]]++;
  }
  dump(a);/*}}}*/

  if (sz(cnt)>2){
    cout << "No" << endl;
    return 0;
  }
  else if (sz(cnt)==1){
    int p = (*cnt.begin()).first;
    if (p<=n/2) {  // pが実際の種類数
      cout << "Yes" << endl;
    }
    else if (p+1==n){  // p+1が実際の種類数
      cout << "Yes" << endl;
    }
    else{ cout << "No" << endl; }
  }
  else if (sz(cnt)==2){
    int p = (*cnt.rbegin()).first;
    int p2 = (*cnt.begin()).first;
    int x = (*cnt.begin()).second;
    int y = (*cnt.rbegin()).second;
    // x+y/2種類以下
    if (p2+1!=p){
      cout << "No" << endl; 
    }
    else if (x+1<=p && p<=x+y/2 && y>=2){
      cout << "Yes" << endl; 
    }
    else{
      cout << "No" << endl; 
    }
  }
  
  return 0;
}


Measured memory_bytes: 7296
//https://atcoder.jp/contests/abc124/tasks/abc124_d
//另一种炫酷的方法
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
int dif[100005],pre[100005],a[100005],n,k,ed,ans,cur,pos,i;
int main()
{
	scanf("%d %d\n",&n,&k);
	a[0]=0;
	pre[0]=0;
	for (i=1;i<=n;i++) scanf("%1d",&a[i]);
	for (i=1;i<=n;i++)
	{
		dif[i]=a[i]^a[i-1];
	}
	for (i=1;i<=n;i++)
	{
		pre[i]=pre[i-1]+dif[i];
	}
	cur=0;
	pos=0;
	ans=-1;
	while (pos+1<=n)
	{
		pos++;
		cur=cur^dif[pos];
		ed=upper_bound(pre,pre+n+1,2*k-(!cur)+pre[pos])-pre;
		if (ed-pos>ans) ans=ed-pos;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
 
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  long long m,n;
  cin >> m >> n;
  long long ans = 1;
  while(n > 0){
    if(n&1){
      ans = (ans*m)%MOD;
    }
    m = (m*m)%MOD;
    n >>= 1;
    // cout << ans << " " << m << " " << n << endl;
  }

  cout << ans << endl;
}



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

using namespace std;
const int N = 1e5 + 10;

long long n, l, t;
long long x[N], w[N];
pair<long long, int> y[N];

bool cmp(pair<long long, int> A, pair<long long, int> B)
{
	if(A.first != B.first) return A.first < B.first;
	return A.second > B.second;
}
int main()
{
	cin >> n >> l >> t;
	for (int i = 1; i <= n; i++)
	{
		int xx, ww;
		scanf("%d%d", &xx, &ww);
		x[i] = xx;
		w[i] = ww;
		if (w[i] == 1)
		{
			y[i] = make_pair((x[i] + t) % l, i);
		}
		else
		{
			y[i] = make_pair(((x[i] - t) % l + l) % l, i);
		}
	}
	sort(y + 1, y + n + 1);
	
	long long cnt = 0;
	
	for (int i = 2; i <= n; i++)
	{
		if (w[1] != w[i])
		{
			if (w[1] == 1 && w[i] == 2)
			{
				cnt += ((x[i] - x[1]) < t * 2) + (2 * t - (x[i] - x[1]) - 1) / l;
			}
			else
			{
				cnt += ((l - x[i] + x[1]) <= t * 2) + (2 * t - (l - x[i] + x[1])) / l;
			}
		}
	}
	
	long long pos = -1;
	for(int i = 1; i <= n; i++) if(y[i].second == 1) pos = i;
	if (w[1] == 1)
	{
		pos = pos - cnt;
	}
	else
	{
		pos = pos + cnt;
	}
	pos = (pos % n + n) % n;
	if (pos == 0) pos += n;
	
	for (int i = pos; i <= n; i++)
	{
		printf("%d\n", (int) y[i].first);
	}
	for (int i = 1; i <= pos - 1; i++)
	{
		printf("%d\n", (int) y[i].first);
	}
	return 0;
}

Measured memory_bytes: 4352
#include<stdio.h>
int main(void)
{
  int n, p, sum=0, max=0, i;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &p);
    sum += p;
    if(p > max){
      max = p;
    }
  }
  printf("%d\n", sum - max / 2);
  
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

using vi = vector<int>;

inline void Main() {
  // code
  int N, R = -10000;
  cin >> N;
  vi V(N), C(N);
  rep(i, N) cin >> V.at(i);
  rep(i, N) cin >> C.at(i);

  rep(bit, 1 << N) {
    int tmp = 0;
    rep(i, N) {
      if (bit & (1 << i)) {
        tmp += V.at(i);
        tmp -= C.at(i);
      }
    }
    R = max(R, tmp);
  }

  cout << R << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String args[]) {
 
        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
 
        // 主処理
        String result;
        switch (s) {
            case "ABC":
                result = "ARC";
                break;
            default:
                result = "ABC";
                break;
        }
 
        // 出力
        System.out.println(result);
    }
}

Measured memory_bytes: 35584
n=input()
k=int(input())
keta=len(n)
#桁dp
#dp0 n以下確定
#dp1 未確定
#dp[桁][個数]
dp0=[[0]*(k+1) for _ in range(keta)]
dp1=[[0]*(k+1) for _ in range(keta)]
dp0[0][0]=1
dp0[0][1]=int(n[0])-1
dp1[0][1]=1
for i in range(1,keta):
	if n[i]=="0":
		for j in range(k+1):
			dp1[i][j]=dp1[i-1][j]
		dp0[i][0]=dp0[i-1][0]
		for j in range(1,k+1):
			dp0[i][j]=dp0[i-1][j-1]*9+dp0[i-1][j]
	else:
		for j in range(1,k+1):
			dp1[i][j]=dp1[i-1][j-1]
		dp0[i][0]=dp0[i-1][0]
		for j in range(1,k+1):
			dp0[i][j]=dp1[i-1][j]+dp1[i-1][j-1]*(int(n[i])-1)+dp0[i-1][j-1]*9+dp0[i-1][j]
print(dp0[-1][k]+dp1[-1][k])





Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100010];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    ll x=0;
    for(int i=1;i<=n;i++){
        if(i%2==1) x+=a[i];
        else x-=a[i];
    }
    cout<<x<<" ";
    ll now=x/2;
    for(int i=2;i<=n;i++){
        cout<<(a[i-1]-now)*2<<" ";
        now=(a[i-1]-now);
    }
    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll = long long;
const ll INF = 10e9;
const ll mod = 10e9+7;

int solve(int n, vector<int>h){
  vector<int>dp(n);
  dp[0] = 0;
  dp[1] = abs( h[0] - h[1] );
  for (int i=2; i<n; i++){
    dp[i] = min(
      dp[i-1] + abs( h[i] - h[i-1] ),
      dp[i-2] + abs( h[i] - h[i-2] )
    );
  }
  return dp[n-1];
}

int main(){
  int n; cin>>n;
  vector<int>h(n);
  rep(i,n) cin>>h[i];
  cout << solve(n,h) << endl;
  return 0;
}

Measured memory_bytes: 4160
N=int(input())
List='abcdefghijklmnopqrstuvwxy'

Ans=''

while N>=1:
    Amari=N%26
    
    if Amari==0:
        Ans='z'+Ans
    else:
        Ans=List[Amari-1]+Ans
        
    N=(N-1)//26
    
print(Ans)


Measured memory_bytes: 8768
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int n;
string s;

int main()
{
	cin >> n >> s;
	stack<int> t;
	rep(i,0,n){
		int add = (s[i]=='('? 0 : 1);
		t.push(add);
		while(t.size()>=2){
			int fst = t.top();t.pop();
			if(fst == 1 && t.top() == 0){ //けせる
				t.pop();
			}else{
				t.push(fst);
				break;
			}
		}
	}
	int a=0,b=0,u;
	while(!t.empty()){
		u = t.top();t.pop();
		if(u==0)a++;
		else b++;
	}
	rep(i,0,b)printf("(");
	cout << s;
	rep(i,0,a)printf(")");
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
l = [int(x) for x in input().split()]
ans=int(1)
aaa=True
if 0 in l:
    aaa = False
    print(0)
else:
    for j in range(n):
        ans = ans*l[j]
        if ans > 10**18:
            print(-1)
            aaa=False
            break
if aaa:print(ans)
        

Measured memory_bytes: 21472
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  sort(all(A));

  auto bsearch = [&]() {
    auto test = [&](ll k) {
      auto boundary = [&](ll k, ll a) {
        ll tmp = k/a;
        ll res = (a>0 ? -longinf : longinf);
        for(int d=-2; d<=2; d++) {
          if(a*(tmp+d)<=k) {
            res = (a>0 ? max(tmp+d, res) : min(tmp+d, res));
          }
        }
        return res;
      };
      ll cnt = 0;
      rep(i, N) {
        int j;
        if(A[i] < 0) {
          ll lb = boundary(k, A[i]);
          j = lower_bound(all(A), lb) - begin(A);
          cnt += N - j - (i >= j);
        } else if(A[i] == 0) {
          if(k >= 0) cnt += N-1;
        } else {
          ll ub = boundary(k, A[i]);
          j = upper_bound(all(A), ub) - begin(A);
          cnt += j - (i < j);
        }
      }
      assert(cnt%2==0);
      return cnt/2 < K;
    };

    ll ng = longinf;
    ll ok = -longinf;
    while(abs(ok-ng) > 1) {
      ll mid = (ok+ng)/2;
      if(test(mid)) ok = mid;
      else ng = mid;
    }
    return ok+1;
  };

  cout << bsearch() << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
int n , flag = 0;
  scanf("%d",&n);
  
 char s[n][2];
  
 for(int i = 0;i < n;i ++){
   scanf("%c",s[i]);
   if(s[i][0]=='Y'){
     flag = 1;
     break;
   }
 }
  if(flag==1){
    printf("Four");
  }
  else{
    printf("Three");
  }
  return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    val N = nextLong()
    val max = Math.sqrt(N.toDouble()).toLong()
    var ans = Int.MAX_VALUE
    var a = 1L
    while (a <= max) {
        try {
            if (N % a != 0L) continue
            val b = N / a
            ans = Math.min(ans, Math.max(D(a), D(b)))
        } finally {
            a += 1
        }
    }
    println(ans)
}
fun D(d: Long) =
    if (d > 999999999L) 10 else
    if (d > 99999999L) 9 else
    if (d > 9999999L) 8 else
    if (d > 999999L) 7 else
    if (d > 99999L) 6 else
    if (d > 9999L) 5 else
    if (d > 999L) 4 else
    if (d > 99L) 3 else
    if (d > 9L) 2 else 1
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 33716
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int a, b, c, d;
  cin>>a>>b>>c>>d;
  (a*c>a*d)?(a = a*c):(a = a*d);
  (b*c>b*d)?(b = b*c):(b = b*d);
  (a>b)?cout<<a:cout<<b;
}

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

int main() {
  int a, b, k;
  cin >> a >> b >> k;


  if (a < b) swap(a, b);
  int cnt = 0;
  int ans;
  vector<int> vec;
  for (int i = 1; i < b+1; i++) {
    if (a%i==0 && b%i==0) vec.push_back(i);
  }
  cout << vec[vec.size()-k] << endl;
  return 0;
}

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

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}

#define N 200901
int u,v,m,a[N],dfn[N],vi[N],si[N],tt,n,c[N<<1][2],tot,f[N<<1];

void dfs(int p, int pr)
{
	dfn[p]=++tt;
	vi[p]=1;
	for(int o=a[p]; o; o=c[o][1]){
		if(c[o][0]==pr)continue;
		int u=c[o][0];
		if(vi[u]){
			if(dfn[u]<dfn[p]){
				++si[p], f[o]=1;
			}
		} else {
			dfs(u,p);
			if(si[u]%2)f[o^1]=1;
			else ++si[p],f[o]=1;
		}
	}
}

int main()
{
	n=read(); m=read();
	tot=1;
	for(int i=1;i<=m;++i){
		u=read(), v=read();
		c[++tot][0]=v; c[tot][1]=a[u]; a[u]=tot;
		c[++tot][0]=u; c[tot][1]=a[v]; a[v]=tot;
	}
	dfs(1,0);
	if(si[1]%2){
		puts("-1");
		exit(0);
	}
	for(int i=1;i<=m;++i){
		if(f[i<<1])printf("%d %d\n",c[(i<<1)|1][0],c[i<<1][0]);
		else printf("%d %d\n",c[i<<1][0],c[(i<<1)|1][0]);
	}
}

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

int main() {
	int k;
	cin >> k;
	string s;
	cin >> s;
	if(s.size()<=k)cout<<s;
	else {
		rep(i,k)cout<<s[i];
		cout<<"...";
	}
	return 0;
}


Measured memory_bytes: 3620
<?php
fscanf(STDIN,'%s',$S);
fscanf(STDIN,'%s',$T);
$SA=str_split($S);
$TA=str_split($T);
sort($SA);
rsort($TA);
$S=implode($SA);
$T=implode($TA);
if(strnatcmp($S,$T)<0){
    echo 'Yes';
}else{
    echo 'No';
}
echo "\n";
?>

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define __ ios_base::sync_with_stdio(false); cin.tie(NULL);

void scan(ll &n) { scanf("%lld",&n) ; }
void scan(ll &n, ll &m) { scanf("%lld%lld",&n,&m) ; }
void scan(vector<ll> &v) { ll n = v.size() ; for(ll i=0 ;i<n;i++) scanf("%lld",&v[i]) ; }


void solve() {

    string s ;
    cin >> s ;
    ll x = 0 ;
    for (ll i = 0 ; i< s.size() ; i++) {
        x += (s[i] -'0') ;
    }
    cout << (x%9 ? "No\n" : "Yes\n") ;
}

int main() {

    cin.tie(0);
	ios_base::sync_with_stdio(0);

	ll t = 1 ;
	//cin >> t ;
	for (ll cz = 1 ;cz <= t ; cz++) {
       // cout << "Case " <<cz <<": " ;
        solve() ;
	}
    return 0 ;
}







Measured memory_bytes: 3728
#pragma GCC optimize("Ofast", "unroll-loops")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

#define MAX_H (80)
#define MAX_W (80)
#define MAX_AB (80)


int main() {
	/* 入力の受け取り */
	int h, w; cin >> h >> w;
	vector<vector<int>> a(h);
	for (int i = 0; i < h; ++i) {
		a[i].resize(w);
		for (int j = 0; j < w; ++j)
			cin >> a[i][j];
	}
	vector<vector<int>> b(h);
	for (int i = 0; i < h; ++i) {
		b[i].resize(w);
		for (int j = 0; j < w; ++j)
			cin >> b[i][j];
	}
	
	/* pos[i][j][x] : (i,j)に到達時点でxにできるか */

	vector<vector<vector<bool>>> pos(h);
	for (int i = 0; i < h; ++i) pos[i].resize(w);
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j)
			pos[i][j].resize(MAX_AB * (MAX_H + MAX_W) + 1, false);
	// (0,?)を埋める
	pos[0][0][abs(a[0][0] - b[0][0])] = true;
	for (int i = 1; i < h; ++i) {
		int d = abs(a[i][0] - b[i][0]);
		for (int x = 0; x <= MAX_AB * (MAX_H + MAX_W); ++x) {
			if (pos[i - 1][0][x]) {
				pos[i][0][x + d] = true;
				pos[i][0][abs(x - d)] = true;
			}
		}
	}
	// (?,0)を埋める
	for (int j = 1; j < w; ++j) {
		int d = abs(a[0][j] - b[0][j]);
		for (int x = 0; x <= MAX_AB * (MAX_H + MAX_W); ++x) {
			if (pos[0][j - 1][x]) {
				pos[0][j][x + d] = true;
				pos[0][j][abs(x - d)] = true;
			}
		}
	}
	// 残りを埋める
	for (int i = 1; i < h; ++i) {
		for (int j = 1; j < w; ++j) {
			int d = abs(a[i][j] - b[i][j]);
			for (int x = 0; x <= MAX_AB * (MAX_H + MAX_W); ++x) {
				if (pos[i][j - 1][x]) {
					pos[i][j][x + d] = true;
					pos[i][j][abs(x - d)] = true;
				}
				if (pos[i - 1][j][x]) {
					pos[i][j][x + d] = true;
					pos[i][j][abs(x - d)] = true;
				}
			}
		}
	}

	/* 答えを求める */
	
	int ans = -1;
	for (int x = 0; x <= MAX_AB * (MAX_H + MAX_W); ++x) {
		if (pos[h - 1][w - 1][x]) {
			ans = x; break;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 10624
def bubbleSort( cards )
    n = cards.length
    0.upto( n-1 ) { |i|
        ( n-1 ).downto( i+1 ) { |j|
            if cards[j][1].to_i < cards[ j-1 ][1].to_i
                cards[j], cards[ j-1 ] = cards[ j-1 ], cards[j]
            end
        }
    }
   puts( cards.join( " " ) )
end

def selectionSort( cards )
    n = cards.length
    0.upto( n-1 ) { |i|
        mini = i
        ( i+1 ).upto( n-1 ) { |j|
            if cards[j][1].to_i < cards[ mini ][1].to_i
                mini = j
            end
        }
        if mini != i
            cards[i], cards[ mini ] = cards[ mini ], cards[i]
        end
    }
    puts( cards.join( " " ) )
end


n = gets.to_i
cards = gets.split( " " )
cards2 = cards.clone
bubbleSort( cards )
puts( "Stable" )
selectionSort( cards2 )
if cards2.join( " " ) == cards.join( " " )
	puts( "Stable" )
else
	puts( "Not stable" )
end

Measured memory_bytes: 6116
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys


def solve(x):
  for i in range(1,1001):
    if x == i**2:
      return True
  return False

a,b = map(int, input().split())
x = int(str(a)+str(b))
if solve(x):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const int mod = 1e9 + 7;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n - 1);
    for (int i = 0; i < n - 1; i++)
    {
        cin >> a.at(i);
    }
    map<int, int> buka;
    for (int i = 1; i < n + 1; i++)
    {
        buka[i] = 0;
    }

    for (int i = 0; i < n - 1; i++)
    {
        buka[a.at(i)]++;
    }

    for (int i = 1; i < n + 1; i++)
    {
        cout << buka.at(i) << endl;
    }

    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    int temp;
    int ans = 0;
    for (size_t i = 2; i < 32; i++)
    {
        temp = log(N)/log(i);
        //cout << "(" << temp << "," << i << ")" << endl;
        if (temp == 1)
        {
            continue;
        }
       
        if(ans < pow(i,temp)){
                ans = pow(i,temp);
                //cout << temp << endl;
            //    cout << ans << endl;
        }
        temp++;
        if (N<pow(i,temp))
        {
            continue;
        }
        
        if(ans < pow(i,temp)){
                ans = pow(i,temp);
                //cout << temp << endl;
        //        cout << ans << endl;
        }
    }
    
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 4032
import sys
sys.setrecursionlimit(10**6)
N = int(input())
ND = ["E", "E?", "A", "R", "A?", "R?"]
T = [input() for i in range(N)]
G = [[] for i in range(N)]
for i in range(N-1):
    s, t = map(int, input().split())
    G[s-1].append(t-1)
MOD = 10**9 + 7
def dfs(v):
    t = T[v]
    if t[0] in ['E', 'R']:
        r = 1
    else:
        r = 0
    t0 = t[0]
    for w in G[v]:
        x = dfs(w)
        if t0 == 'E':
            r = r * x % MOD
        elif t0 == 'R':
            r = r * (x+1) % MOD
        else:
            r += x
    if t[0] == 'R':
        r -= 1
    if t[-1] == '?':
        r += 1
    return r % MOD
print(dfs(0))


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

int main()
{
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  char c;
	cin >> c;
	if('Z' - c < 26 && 'Z' - c >= 0) cout<< "A";
	else cout<< "a";
    

  return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  string a,b,c;cin>>a>>b>>c;
  char dif='A'-'a';
  cout<<(char)(a[0]+dif)<<(char)(b[0]+dif)<<(char)(c[0]+dif)<<"\n";
  return 0;
}


Measured memory_bytes: 256
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let n: usize = parse_line().unwrap();
    let x: Vec<usize> = parse_line().unwrap();
    let mut y = x.clone();
    y.sort();

    for i in 0..n {
        if x[i] < y[n / 2] {
            println!("{}", y[n / 2]);
        } else {
            println!("{}", y[n / 2 - 1]);
        }
    }
}


Measured memory_bytes: 6172
#include <stdio.h>
#define ABS(n)	((n) < 0 ? -(n) : (n))
int main()
{
  int q;
  double x,y;
  for(;;){
    scanf("%d",&q);
    if(q == -1) break;
    x = q/2;
    while((y = ABS(x * x * x - q)) >= 0.00001 * q){
      x = x - y / (3 * x * x);
    }
    printf("%.6lf\n",x);
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*;

class Main {

    static class Card{
        final String key;
        final int value;

        Card(String k, int v){
            key = k;
            value = v;
        }
        @Override
        public String toString() {
            return key + value;
        }
    }

    private static Card[] bubbleSort(Card[] C){
        int n = C.length;

        for (int i = 0; i < n; i++) {
            for (int j = n-1; j > i ; j--)
                if(C[j].value < C[j-1].value){
                    // swap
                    Card temp = C[j];
                    C[j] = C[j-1];
                    C[j-1] = temp;
                }
        }
        return C;
    }

    private static Card[] selectionSort(Card[] C){
        int n = C.length;

        for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (C[j].value < C[mini].value)
                    mini = j;
            // swap
            if(mini != i) {
                Card temp = C[i];
                C[i] = C[mini];
                C[mini] = temp;
            }
        }
        return C;


    }

    /**
     *
     * @param a is the list of card after bubble sort, which is stable
     * @param b is the list of card after selection sort,
     *          which is sometimes not stable
     * @return return true if the list after selection sort is table,
     *          otherwise, false.
     */
    private static boolean isStable(Card[] a, Card[] b){
        for (int i = 0; i < a.length; i++)
            if (a[i].key != b[i].key)
                return false;
        return true;
    }

    // print the list of cards
    private static String print(Card[] cards){
        int n = cards.length;
        String s = "";
        for (int i = 0; i < n - 1; i++)
            s = s + cards[i].toString() + " ";
        return s + cards[n-1].toString();
    }

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        Card[] cards = new Card[n];
        // get all cards from input, and store it to cards
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            cards[i] = new Card(s.substring(0,1),Integer.parseInt(s.substring(1)));
        }
        // since all method here is static, I need to store the original cards twice
        Card[] cards2 = new Card[n];
        for (int i = 0; i < n; i++)
            cards2[i] = cards[i];

        bubbleSort(cards);
        String bubble = print(cards);
        System.out.println(bubble);
        // bubble sort is always stable
        System.out.println("Stable");

        // Now, let's do the selection sort
        selectionSort(cards2);
        String selection = print(cards2);
        System.out.println(selection);
        if (isStable(cards,cards2)) System.out.println("Stable");
        else System.out.println("Not stable");

    }
}



Measured memory_bytes: 26400
k = int(input())
a = list(map(int, input().split()))

mx = 3
mn = 2
for i in range(k)[::-1]:
    mn = (mn + a[i] - 1) // a[i] * a[i]
    # print(mx + a[i] - 1)
    mx = (mx + a[i] - 1) // a[i] * a[i]
    # mx = min(2 * a[i] - 1, 2 * mx - 1)
    # print(mn, mx)
mx -= 1
# print()

ans = (mn,mx)
for i in range(k):
    mx = (mx // a[i]) * a[i]
    mn = (mn // a[i]) * a[i]
# print(mn, mx)

if mn == 2 and mx == 2:
    print(*ans)
else:
    print(-1)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 1;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

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

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

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

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans %= mod;
        ans *= power(i + 1, mod - 2);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n,h,maxa = 0,ans = 0;
    cin >> n >> h;
    vector<ll> b(n);
    rep0(i, n){
        ll a;
        cin >> a >> b[i];
        maxa = max(a,maxa);
    }
    sort(all(b),greater<>());
    rep0(i, n){
        if(b[i] < maxa || h <= 0)break;
        h -= b[i];
        ++ans;
    }
    pf(ans + max((h + maxa - 1) / maxa,0ll));
    return 0;
}


Measured memory_bytes: 1024
import sys
from collections import Counter
from collections import deque
import math
import fractions
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a=lmp()
c=a[0]
for i in range(1,n):
    c=fractions.gcd(c,a[i])
ans=0
while True:
    if c%2==0:
        ans+=1
        c=c//2
    else:
      break
print(ans)

Measured memory_bytes: 5076