akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//以下回答
int main(){
    ll N;
    cin>>N;
    vl a(N);
    vl b(N);
    rep(i,N){
        cin>>a.at(i);
        cin>>b.at(i);
    }
    ll A=*min_element(all(b));
    ll B=*max_element(all(a));
    cout<<A+B<<endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    template<class T> inline bool chmin(T& a, T b) {
        if (a > b) {
            a = b;
            return true;
        }
        return false;
    }
    template<class T> inline bool chmax(T& a, T b) {
        if (a < b) {
            a = b;
            return true;
        }
        return false;
    }

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        bool check=false;
        ll x,y;
        cin>>x>>y;
        rep(i,x+1){
            if(i*2+(x-i)*4==y)check=true;
        }
        if(check)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

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

int main(void) {
	char a, b;
	cin >> a >> b;
	if (a == 'H') {
		if (b == 'H') {
			printf("H");
		}
		else if (b == 'D') {
			printf("D");
		}
	}
	else if (a == 'D') {
		if (b == 'H') {
			printf("D");
		}
		else if (b == 'D') {
			printf("H");
		}
	}

	return 0;
}

Measured memory_bytes: 256
n = int(input())

def hs(k):
    ks = str(k)
    lk = len(ks)
    a = int(ks[0])
    b = int(ks[len(ks) - 1])
    if lk == 1:
        return 1
    if b == 0:
        return 0
    s = 0
    if (a > b) & (lk > 1):
        s += 10 ** (lk - 2) * 2
    elif a == b:
        if lk == 2:
            s += 1
        else:
            s += ((k % (a * 10**(lk - 1))) // 10 + 1) * 2 - 1
    if lk >= 2:
        for i in range(lk - 1):
            if lk - i - 3 >= 0:
                s += 10 ** (lk - 3 - i) * 2
            elif a == b:
                s += 2
    return s

ans = 0
for i in range(1, n + 1):
    ans += hs(i)
print(ans)

Measured memory_bytes: 43452
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

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



signed main(){

    string s; cin >> s;
    int K; cin >> K;
    REP(i, s.size()){
        if(s[i] == 'a') continue;
        int n = (int)(s[i] - 'a');
        if(26 - n <= K){
            s[i] = 'a';
            K -= 26 - n;
        }
    }
    if(K > 0){
        int n = (int)(s[s.size() - 1] - 'a');
        n = (n + K) % 26;
        s[s.size() - 1] = (char)('a' + n);
    }
    cout << s << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#define MAX 1000
#define VMAX 10000

int n, A[MAX], s;
int B[MAX], T[VMAX+1];

int partition(int A[], int p, int r){
	int i, j;
	int x, t;
	x = A[r];
	i = p-1;
	for( j = p ; j < r ; j++ ){
		if( A[j] <= x ){
			i++;
			t = A[i];
			A[i] = A[j];
			A[j] = t;
		}
	}
	t = A[i+1];
	A[i+1] = A[r];
	A[r] = t;
	
	return i + 1;
}

void quickSort(int A[], int p, int r){
	int q;
	if( p < r ){
		q = partition(A, p, r);
		quickSort(A, p, q-1);
		quickSort(A, q+1, r);
	}
}

int solve(){
	int i=0, ans=0;
	int V[MAX];
	
	for( i = 0 ; i < n ; i++ ){
		B[i] = A[i];
		V[i] = 0;
	}
	quickSort(B, 0, n-1);
	
	for( i = 0 ; i < n ; i++ ) T[B[i]] = i;
	for( i = 0 ; i < n ; i++ ){
		if( V[i] ) continue;
		int cur = i;
		int S = 0;
		int m = VMAX;
		int an = 0;
		while( 1 ){
			V[cur] = 1;
			an++;
			int v = A[cur];
			if(v < m){ m = v; }
			S += v;
			cur = T[v];
			if( V[cur] ){ break; }
		}
		ans = ans + fmin(S+(an-2)*m, m+S+(an+1)*s);
	}
	return ans;
}

int main(){
	int i;
	scanf("%d",&n);
	s = VMAX;
	for( i = 0 ; i < n ; i++ ){
		scanf("%d", &A[i]);
		if(A[i] < s){ s = A[i]; }
	}
	int ans = solve();
	printf("%d\n", ans);
	
	return 0;
}



Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int main() {
  
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if( A * B > C * D)	cout << A * B << endl;
  else if( A * B < C * D)	cout << C * D << endl;
  else	cout << A * B << endl;
   
}

Measured memory_bytes: 256
#C
N, M = map(int, input().split())
s = [0] * M
c = [0] * M
for i in range(M):
    s[i], c[i] = map(int, input().split())
ans = -1

for i in range(10**N):
    flag = True
    id = len(str(i))
    
    if id != N:
        continue

    for j in range(M):
        if str(i)[s[j]-1] != str(c[j]):
            flag = False
            break
    if flag:
        ans = i
        break
    else:
        continue 

print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string S;
	cin >> S;

	int ans = 0;
	rep(i, 0, SZ(S))
	{
		if (S[i] == '0')
		{
			ans++;
		}
		else
		{
			ans--;
		}
	}

	cout << (SZ(S) - abs(ans)) << endl;

	return 0;
}



Measured memory_bytes: 512
/*By Ravenclaw_OIer*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < n; (i)++)
#define ll long long
#define ull unsigned long long
#define lsh(X) (1 << (X))
#define lshll(x) (1LL << (x))
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 100010;
int dp[MAXN];
int deg[MAXN];
vector <int> g[MAXN];
int n, m;
int main()
{
	cin >> n >> m;
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		--x;--y;
		g[x].push_back(y);
		deg[y]++;
	}
	stack <int> s;
	rep(i, n)if (!deg[i])s.push(i);
	while (!s.empty()) {
		int u = s.top();
		s.pop();
		for (auto i:g[u]) {
			dp[i] = max(dp[i], dp[u] + 1);
			deg[i]--;
			if (!deg[i])s.push(i);
		}
	}
	int ans = 0;
	rep(i, n)ans = max(ans, dp[i]);
	cout << ans << endl;
	return 0;
} 


Measured memory_bytes: 6528
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    sort(all(a), greater<int>());
    int ans = 0;
    REP(i, n) if(i % 2 == 0) ans += a[i]; else ans -= a[i];
    cout << ans << endl;
}

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

using namespace std;

int sosuu(int n);

int main(){
    int n=0;
    int num=0;
    int a[30][2]={0};
    int max=0;
    while(scanf("%d",&n)!=EOF){
        if(max<n){
            max=n;
        }
        a[num][0]=n;
        num++;
    }
    
    int b[max];
    int c[max];
    int so=0;
    for(int i=0; i<=max; i++){
        b[i]=i;
    }
    b[1]=0;
    
    for(int i=2; i<sqrt(max); i++){
        if(b[i]!=0){
            for(int j=2; j<=max; j++){
                if(i*j<=max){
                    b[i*j]=0;
                }else{
                    j=max;
                }
            }
        }
    }
    
    for(int i=0; i<=max; i++){
        if(b[i]!=0){
            c[so]=i;
            so++;
        }
    }
    
    

    for(int i=0; i<num; i++){
        for(int j=0; j<so; j++){
            if(c[j]<=a[i][0]){
                a[i][1]++;
            }else{
                j=so;
            }
        }
    }

    
    for(int j=0; j<num; j++){
        cout<<a[j][1]<<"\n";
    }
    
}

Measured memory_bytes: 5420
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int dp[100][100], n, a[100], b[100];

int dfs(int l, int r){
  //  printf("%d %d\n", l, r);
  if(l == r) return 0;
  if(dp[l][r] >= 0) return dp[l][r];

  int res = INF;
  REP(i, l, r){
    res = min(res, dfs(l, i) + dfs(i+1, r) + a[l]*b[i]*a[i+1]*b[r]);
  }
  return dp[l][r] = res;
}

int main(){
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  rep(i, n) scanf("%d%d", a+i, b+i);
  printf("%d\n", dfs(0, n-1));
  return 0;
}

Measured memory_bytes: 1240
s = input()
t = input()
n_s = len(s)
n_t = len(t)
ans = float("inf")
for i in range(n_s-n_t+1):
    count = 0
    for j in range(n_t):
        if s[i+j] != t[j]:
            count += 1
    ans = min(ans, count)
print(ans)

Measured memory_bytes: 73252
#not accept

from sys import stdin

N = int(stdin.readline().rstrip())
W = []
W = [int(x) for x in stdin.readline().rstrip().split()]


for T in range(1,N):
    S1 = 0
    S2 = 0
    for i in range(0,T):
        S1 += W[i]
    for i in range(T,N):
        S2 += W[i]
    if T == 1:
        min = abs(S1-S2)
    elif min > abs(S1-S2):
        min = abs(S1-S2)

print(min)

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


#define long long long int

using namespace std;


typedef vector<int> vi;
typedef pair<int, int> pi;

void print(const vector<long> &a) {
    for (auto item : a) {
        cout << item << " ";
        flush(cout);
    }
}

int main() {

    long n;
    cin >> n;
    long res = LONG_MAX;
    for (long i = 1; i * i <= n; ++i) {
        long j = n / i;
        if (i * j == n) {
            res = min(res, j + i - 2);
        }

    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
const ll MOD = 2019;

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

ll extgcd(ll a, ll b, ll &x, ll &y){
    if(b == 0){
        x = 1; y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
    return d;
}

//* calculate a^-1 mod m
ll mod_inverse(ll a, ll m){
    ll x, y;
    extgcd(a, m, x, y);
    return(m + x%m) % m;
}

void solve(string S){
    reverse(ALL(S));
    ll N = S.length();
    vll R(N, 1) ; //* S_i * 10^i % MOD
    vll tenInvMod(N, 1); //* 10^-i % MOD
    ll inv = (mod_inverse(10, MOD) + MOD) % MOD;
    REP(i, N-1){
        R[i+1] = (R[i] * 10) % MOD;
        tenInvMod[i+1] = (tenInvMod[i] * inv) % MOD;
    }
    REP(i, N){
        R[i] = (R[i] * (S[i]-'0')) % MOD;
    }
    vll sum(N+1, 0);
    REP(i, N){
        sum[i+1] = (sum[i] + R[i]) % MOD;
    }

    map<ll, ll> Rec;
    REP(i, N+1){
        Rec[sum[i]]++;
    }
    ll ans = 0;
    for(auto x: Rec){
        ans += x.second*(x.second-1)/2;
    }
    cout<<ans<<endl;
    


}

int main(){
    string S;
    cin >> S;
    solve(move(S));
    return 0;
}


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

map<int, set<int>> G;
int N, M;
int dfs(int c, int p, int cnt) {
    if (cnt == 2) {
        if (c == N - 1) {
            return true;
        } else {
            return false;
        }
    }

    bool ok = false;
    for (auto x : G[c]) {
        if (x == p) continue;
        ok = ok || dfs(x, c, cnt + 1);
    }
    return ok;
}

int main() {
    cin >> N >> M;
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].insert(b);
        G[b].insert(a);
    }

    bool ok = dfs(0, -1, 0);
    if (ok) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    // for (auto x : G) {
    //     cout << "key: " << x.first << ", value: ";
    //     for (auto y : x.second) {
    //         cout << y << ", ";
    //     }
    //     cout << endl;
    // }
}

Measured memory_bytes: 41108
<?php

fscanf(STDIN, "%d", $n);

$array = explode(" ", trim(fgets(STDIN)));
$ans = 0;
$max = 0;
$max_pos = -1;
$r_max = 0;
$second = 0;
$sec_pos = -1;
for($i=0;$i<$n;$i++){
    if($array[$i] == $n){
        $max = max($max, $array[$i]);
        if($max == $array[$i]){
            $max_pos = $i;
        }
        continue;
    }
    $k = $i -1;
    $b_1 = 0;
    $b_2 = 0;
    $a_1 = 0;
    $a_2 = 0;
    $t = 0;
    if($array[$i] > $max){
        $b_1 = $i + 1;
//    }elseif($array[$i] > $sec_pos){
  //      $b_1 = $i - $max_pos;
    //    $b_2 = $max_pos + 1;
    }else {
        while ($k >= 0) {
            if ($array[$k] > $array[$i]) {
                if ($t == 0) {
                    $b_1 = $i - $k;
                    $t = 1;
                } else {
                    $b_2 = $i - $b_1 - $k;
                    $t = 2;
                    break;
                }
            }
            $k--;
        }
        if ($t == 0) {
            $b_1 = $i + 1;
        } elseif ($t == 1) {
            $b_2 = $i - $b_1 + 1;
        }
    }
    $k = $i+1;
    $t = 0;
    if($r_max == $array[$i]){
        $a_1 = $n - $i;
        $r_max--;
    }else {
        while ($k < $n) {
            if ($array[$k] > $array[$i]) {
                if ($t == 0) {
                    $a_1 = $k - $i;
                    $t = 1;
                } else {
                    $a_2 = $k - $a_1 - $i;
                    $t = 2;
                    break;
                }
            }

            $k++;
        }
        if ($t == 0) {
            $r_max = $array[$i] - 1;
            $a_1 = $n - $i;
        } elseif ($t == 1) {
            $a_2 = $n - $a_1 - $i;
        }
    }
    $ans += (($b_2) * $a_1 + ($a_2) * $b_1) * $array[$i];
    $max = max($max, $array[$i]);
    if($max == $array[$i]){
        $max_pos = $i;
    }
}
echo $ans;

Measured memory_bytes: 12792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
 
#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
 
using namespace std;

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

	vector<int> a(n), b(n);
	bool f = true;
	rep(i, n){
		cin >> a[i] >> b[i];
		f = f && a[i] == b[i];
	}

	if(f) {
		cout << 0 << endl;
		return 0;
	}

	int sum = 0;
	rep(i, n) sum += a[i];

	int ans = 0;
	rep(i, n) {
		if (a[i] - b[i] > 0) {
			int diff = a[i] - b[i];
			int res = sum - a[i] + diff;
			ans = max(ans, res);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		BigInteger big, big100000;
		long n;
		int count;

		n = sc.nextLong();
		while (n != 0) {
			count = 0;
			big = new BigInteger("1");
			big100000 = new BigInteger("100000");
			for (int i = 2; i <= n; i++) {
				big = big.multiply(new BigInteger(Integer.toString(i)));
			}
			
			while (big.remainder(big100000).equals(BigInteger.ZERO)) {
				big = big.divide(big100000);
				count += 5;
			}
			while (big.remainder(BigInteger.TEN).equals(BigInteger.ZERO)) {
				big = big.divide(BigInteger.TEN);
				count++;
			}

			System.out.println(count);
			n = sc.nextLong();
		}
	}
}

Measured memory_bytes: 13000
a,b = input().split()
aa = a
bb = b

if a != 1:
    for i in range(int(b)-1):
        aa = aa + a
if b != 1:
    for j in range(int(a)-1):
        bb = bb + b

if a < b:
    print(aa)
else:
    print(bb)

Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include <bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(ll n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
     mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
int main(){
  int n;
  cin>>n;
  mint ans=0;
  V<ll> a(n);
  ll sum=0;
  for(int i=0;i<n;i++){
      cin>>a[i];
      sum+=a[i];
  }
  for(int i=0;i<n;i++){
      sum-=a[i];
      ans+=mint(sum)*mint(a[i]);
  }
  cout<<ans<<"\n";
}


Measured memory_bytes: 4716
#include <iostream>
#include <vector>
#include <string>
typedef long long int ll;
using namespace std;
using vl=vector<ll>;
#define rep(i,N) for(ll i=0;i<N;i++)
#define rep2(i,j,k) for(ll i=j; i<k;i++)
 
int main(){
    ll N,Q;
    string s;
    cin>>N>>Q>>s;
    vl l(Q),r(Q);
    rep(i,Q){
        cin>>l[i]>>r[i];
    }
    
    vl acc_sum(N);
    ll acc=0;
    rep2(i,1,N){
        if(s[i-1]=='A' && s[i]=='C'){
            acc++;
        }
        acc_sum[i]=acc;
    }
    
    rep(i,Q){
        cout<<acc_sum[r[i]-1]-acc_sum[l[i]-1]<<endl;
    }
 
    return 0;
}

Measured memory_bytes: 3456
import java.util.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		String a=s.next(),b=s.next();
		char[]c=new char[n*2];
		for(int i=0;i<n;++i) {
			c[i*2]=a.charAt(i);
			c[i*2+1]=b.charAt(i);
		}
		System.out.println(c);
	}
}


Measured memory_bytes: 22228
/*
 * FileName:     C_fix_4
 * CreatedDate:  2020-05-17 16:17:26 +0900
 * LastModified: 2020-05-17 16:55:42 +0900
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int dp[100000][3]={0};
int dp_search(int **a,int n,int u,int loc){
    if(u==n){
        return 0;
    }
    if(dp[u][loc]!=0){
        return dp[u][loc];
    }
    int one,other;
    if(loc==0){
        one = dp_search(a,n,u+1,1)+a[u][0];
        other = dp_search(a,n,u+1,2)+a[u][0];
    }
    else if(loc==1){
        one = dp_search(a,n,u+1,0)+a[u][1];
        other = dp_search(a,n,u+1,2)+a[u][1];
    }
    else{
        one = dp_search(a,n,u+1,0)+a[u][2];
        other = dp_search(a,n,u+1,1)+a[u][2];
    }
    if(one<other){
        dp[u][loc]=other;
        return other;
    }
    else{
        dp[u][loc]=one;
        return one;
    }
    
}
int main(void){
    int n;
    scanf("%d",&n);
    int **a = malloc(n*sizeof(int*));
    for(int i=0;i<n;i++){
        a[i] = malloc(3*sizeof(int));
        scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
    }
    int ans=0;
    for(int i=0;i<3;i++){
        int tmp = dp_search(a,n,0,i);
//        printf("%d\n",dp_search(a,n,i,0));
        if(ans<tmp){
            ans=tmp;
        }
    }
    printf("%d\n",ans);
    for(int i=0;i<n;i++){
        free(a[i]);
    }
    free(a);
    return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll A,B; cin >> A >> B;
    A--;
    vector<ll> bit(60);
    REP(i,60){
        ll nA,nB;
        nA = (A+1)/((ll)1<<(i+1))*((ll)1<<i) + max((ll)0, (A+1)%((ll)1<<(i+1))-((ll)1<<i));
        nB = (B+1)/((ll)1<<(i+1))*((ll)1<<i) + max((ll)0, (B+1)%((ll)1<<(i+1))-((ll)1<<i));
        bit[i] = (nB-nA)%2;
    }
    ll ans = 0;
    REP(i,60){
        ans += bit[i]*((ll)1<<i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        var C = new string[3];
        for (int i = 0; i < 3; i++)
        {
            C[i] = ReadLine();
        }
        WriteLine($"{C[0][0]}{C[1][1]}{C[2][2]}");
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int W[333];

bool dp[333][333];
int dp2[333];
void solve(){
    rep(i,N)cin>>W[i];
    memset(dp,0,sizeof(dp));
    rep(i,N)dp[i][i]=true;

    for(int len=2;len<=N;len++){
        for(int i=0;i+len<=N;i++){
            int j=i+len;
            if(abs(W[i]-W[j-1])<=1)dp[i][j]|=dp[i+1][j-1];
            for(int k=i+1;k<j;k++)dp[i][j]|=dp[i][k]&dp[k][j];
        }
    }
    memset(dp2,0,sizeof(dp2));
    for(int i=0;i<N;i++){
        chmax(dp2[i+1],dp2[i]);
        for(int j=i+1;j<=N;j++)if(dp[i][j])chmax(dp2[j],dp2[i]+j-i);
    }
    cout<<dp2[N]<<endl;
}
signed main(){
    while(cin>>N,N)solve();
    return 0;
}

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

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

Measured memory_bytes: 3568
#include<cstdio>
#define MAXNUM 20000000;
struct  Card
{
    char suit;
    int value;
};

Card A[100010],B[100010];
Card L[50005], R[50005];


int partition(Card A[], int p, int r)
{
    int i= p-1;
    Card  x = A[r];
    for(int j=p; j<r; j++)
    {
        if(A[j].value <= x.value)
        {
            i++;
            Card cur = A[i];
            A[i] = A[j];
            A[j] = cur;
        }
    }
    A[r] = A[++i];
    A[i] = x;
    return i;
}

void Quick_Sort(Card A[], int p, int r)
{
    if(p < r)
    {
       int q = partition(A,p,r);
        Quick_Sort(A,p,q-1);
        Quick_Sort(A,q+1,r);
    }
}

void Merge(Card A[], int   left, int mid, int right )
{
    int n1 = mid - left;
    int n2 = right - mid;
    //int n = right - left;
    for(int i=0; i < n1; i++)
        L[i] = A[left + i];
    for(int i=0; i < n2; i++)
        R[i] = A[mid + i];
    // Merge
    L[n1].suit = 'A';
    L[n2].suit = 'A';
    L[n1].value = MAXNUM;
    R[n2].value = MAXNUM;
    int i = 0;
    int j = 0;
    for(int k=left; k < right; k++)
    {
        if(L[i].value <= R[j].value)
            A[k] = L[i++];
        else
            A[k] = R[j++];
    }
}

void Merge_Sort(Card A[], int left, int right)
{
    if(left + 1 < right)
    {
        int  mid = (left + right) / 2;
        Merge_Sort(A,left,mid);
        Merge_Sort(A,mid, right);
        Merge(A,left,mid,right);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    char s[5];
    int v;
    for(int i=0; i<n; i++)
    {
        scanf("%s %d", s, &v);
        A[i].suit = B[i].suit = s[0];
        A[i].value = B[i].value = v;
    }
    Quick_Sort(A,0,n-1);
    Merge_Sort(B,0, n);
    int flag = 1;
    for(int i=0; i<n; i++)
    {
        if(A[i].suit != B[i].suit)
        {
            flag = 0;
            break;
        }
    }
    if(flag)
        printf("Stable\n");
    else
        printf("Not stable\n");
    
    for(int i=0; i<n; i++)
    {
        //if(i) printf(" ");
        printf("%c %d\n", A[i].suit, A[i].value);
    }
    //printf("\n");

    return 0;
}


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

int main( void )
{
    char s[ 3 ];
    cin >> s[ 0 ] >> s[ 1 ] >> s[ 2 ];
    int ans = 0;
    for ( int i = 0; i < 3; i++ )
    {
        if ( s[ i ] == 'o' )
        {
            ans++;
        }
    }
    cout << ( 700 + ( ans * 100 ) ) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            a.add(sc.nextInt());
            b.add(sc.nextInt());
        }
        int[] count = new int[4];
        for (int i = 0; i < 3; i++) {
            count[a.get(i) - 1]++;
            count[b.get(i) - 1]++;
        }
        for (int i = 0; i < count.length; i++) {
            if (count[i] >= 3) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }

}


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

int main(){
    int n = 0;
    string s;
    cin >> s;
    
    int flag=0;
    int ans=0;

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout << ans << endl;

    for (int i = 1; i < 4; i++){
        if(s[i-1]==s[i])flag=1;
    }
    


    if(flag==1)cout << "Bad" <<endl;
    else cout << "Good" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    String T = S.replaceAll("ABC", ".");
    System.out.println((S.length()-T.length())/2);
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
ll fact(ll n){
  ll tmp = 1;
  for(int i=0; i<n; i++){
    tmp *= (i+1);
    tmp %= MOD;
  }
  return tmp;
}
int main(){
  ll a,b; cin >> a >> b;
  if(abs(a-b) >= 2){
    cout << 0 << endl;
    return 0;
  }
  ll ans = fact(a)*fact(b)%MOD;
  
  if(a == b){
    ans *= 2;
  }
  cout << ans%MOD << endl;
  
}
  

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

int main() {
	long long int m,n;
long long int ans=0;
cin>>m>>n;
for(int i=n+1;i<=m;i++){
int a=fmaxl(0,n-1-m%i);
//cout<<a<<" ";
if(n!=0){
ans+=m-((m/i+1)*n-a-1);
}
else{
ans+=m;
}
//cout<<ans<<endl;
}
cout<<ans;
	return 0;
}

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

public class Main implements Runnable {

    private void solve() throws IOException {

        long A = nextLong();
        long B = nextLong();
        long C = nextLong();

        if((A % 2 != 0) || (B % 2 != 0) || (C % 2 !=0)) {
            writer.println(0);
            return;
        }
        for(int steps = 1; steps <= 100_000_000; ++steps) {
            long halfA = A / 2;
            long halfB = B / 2;
            long halfC = C / 2;
            A = halfB + halfC;
            B = halfA + halfC;
            C = halfA + halfB;
            if((A % 2 != 0) || (B % 2 !=0) || (C % 2 !=0)) {
                writer.println(steps);
                return;
            }
        }
        writer.println(-1);
    }


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



    BufferedReader reader;
    //    BufferedReader reader2;
    StringTokenizer tokenizer;
    PrintWriter writer;
    //    BufferedWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
//            reader = new BufferedReader(new FileReader("input.txt"));
            //            reader2 = new BufferedReader(new FileReader("1.in"));
            tokenizer = null;
            writer = new PrintWriter(System.out);
//            writer = new     PrintWriter("output.txt");
//                                                    writer = new BufferedWriter(System.out);
            //                        writer = new BufferedWriter(new OutputStreamWriter(System.out));
            solve();
            reader.close();
            //            reader2.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    short nextShort() throws IOException {
        return Short.parseShort(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }

        return tokenizer.nextToken();
    }

}

Measured memory_bytes: 21588
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

//const ll nmax=100001;
//const ll inf=1000000000+7;
const ll nmax=100000;
ll d[nmax+1];
unordered_map<ll,ll> mp;

ll fact(ll n){
    if(n==0) return 1;
    return n*fact(n-1);
}

ll comb(ll n,ll k){
    return fact(n)/(fact(k)*fact(n-k));
}

int main(){
    ll N,M,a,ct,sum;
    cin>>N>>M;
    sum=0;
    mp[0]++;
    for(ll i=1;i<=N;i++){
        cin>>a;
        sum+=a;
//        cout<<"sum:"<<sum<<endl;
        mp[sum%M]++;
    }
    ll ans=0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        ll a=itr->first;
        ll b=itr->second;
//        cout<<"a:"<<a<<", b:"<<b<<endl;
        ans+=b*(b-1)/2;
    }

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


Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

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 FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9+7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;
int dx[8] = { -1,-1,-1,0,0,1,1,1, };
int dy[8] = { 1,0,-1,1,-1,1,0,-1 };


char A[101][101];

int H, W;
void calc(int x, int y) {
	int cnt = 0;
	REP(k, 8) {
		int nx = x + dx[k], ny = y + dy[k];
		if (nx < 0 || nx >= H || ny < 0 || ny >= W)continue;
		if (A[nx][ny] == '#')cnt++;
	}
	A[x][y] = (char)('0' + cnt);
}
void solve() {
	cin >> H >> W;
	REP(i, H)REP(j, W)cin >> A[i][j];
	REP(i, H) {
		REP(j, W) {
			if (A[i][j] == '.')calc(i, j);
		}
	}
	REP(i, H) {
		REP(j, W) {
			cout << A[i][j];
		}cout << endl;
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s, p = "";
  cin >> s;
  for(int i = 0; i < s.size(); i++)
  {
    if(i % 2 == 0)
      p = p + s[i];
  }
  cout << p;
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
 
  char a;
  int  count[26];
 
int main(){
    int i;
    
    while(1){
        i = scanf("%c",&a);
        if(a >= 'a' && a <= 'z')
            count[a - 'a']++;
            
        else if(a >= 'A' && a <= 'Z')
            count[a - 'A']++;
            
        if(i == EOF){
            break;
    }
    }
    for(i = 0; i < 26; i++){
        printf("%c : %d\n",'a' + i, count[i]);
    }
    return 0;
}


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

struct time {
	int c, s, f;
};

int main() {
	int n;
	cin >> n;
	vector<struct time> t(n - 1);
	for (int i = 0; i < n - 1; i++)
		cin >> t[i].c >> t[i].s >> t[i].f;
	for (int i = 0; i < n; i++) {
		int ti = 0;
		for (int j = i; j < n - 1; j++) {
			if (ti < t[j].s)
				ti = t[j].s;
			else if (ti % t[j].f)
				ti += t[j].f - ti % t[j].f;
			ti += t[j].c;
		}
		cout << ti << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)cout<<"hon";
    else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon";
    else
    cout<<"bon";


    return 0;
}


Measured memory_bytes: 3580
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		int a,b,result;
		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();
		
		result = a * b ;
		
		if( (result % 2) == 1) {
			System.out.println("Odd");
		}else {
			System.out.println("Even");
		}
	}

}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


#line 1 "lib/modint.hpp"



#include <iostream>

// Modint
struct Mint {
    static const long long mod = (long long)1e9 + 7;
    long long val;

    Mint() { val = 0; }
    Mint(long long a) { val = a; verify_value(); }

    void verify_value() {
        if (val >= mod) val %= mod;
        if (val < 0) val %= mod, val += mod;
    }

    Mint pow(long long p) const {
        Mint cur = Mint(val), ret = 1;
        while (p > 0) {
            if (p & 1) ret *= cur;
            cur *= cur;
            p >>= 1LL;
        }
        return ret;
    }
    Mint inv() const {
        if (val == 0)
            std::cerr << "WARNING: inv() is called with 0." << std::endl;
        return pow(mod - 2);
    }

    Mint operator+() const { return *this; }
    Mint operator-() const { return Mint(mod - val); }

    Mint operator+=(const Mint &a) {
        val += a.val;
        if (val >= mod) val -= mod;
        return Mint(val);
    }
    Mint operator*=(const Mint &a) {
        val *= a.val;
        if (val >= mod) val %= mod;
        return Mint(val);
    }
    Mint operator-=(const Mint &a) { return *this += -a; }
    Mint operator/=(const Mint &a) { return *this *= a.inv(); }

    Mint operator++() { return *this += Mint(1); }
    Mint operator--() { return *this -= Mint(1); }
    Mint operator++(int) {
        Mint ret = *this;
        ++(*this);
        return ret;
    }
    Mint operator--(int) {
        Mint ret = *this;
        --(*this);
        return ret;
    }

    operator long long() const { return val; }
};

Mint operator+(const Mint &a, const Mint &b) {
    long long ret = a.val + b.val;
    if (ret >= Mint::mod) ret -= Mint::mod;
    return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
    long long ret = a.val * b.val;
    if (ret >= Mint::mod) ret %= Mint::mod;
    return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }

std::ostream &operator<<(std::ostream &out, const Mint &a) { return out << a.val; }
std::istream &operator>>(std::istream &in, Mint &a) {
    in >> a.val;
    a.verify_value();
    return in;
}

Mint pow(Mint a, long long b) {
    return a.pow(b);
}


int main() {
    int n; std::cin >> n;
    std::vector<int> x(n);
    for (int i = 0; i < n; i++) std::cin >> x[i];
    std::vector<Mint> cnt(n + 2);
    int cur = 1, pos = 0;
    for (int i = 0; i < n; i++) {
        cnt[pos]++;
        if (x[i] < cur) pos++;
        else cur += 2;
    }
    Mint ans = 1, sum = 0;
    for (int i = 0; i < n; i++) {
        sum += cnt[i];
        ans *= sum - Mint(i);
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  long double x[N];
  string u[N];
  long double ans=0;
  for(int i=0;i<N;i++){
    cin >> x[i] >> u[i];
    if (u[i]=="JPY") ans+=x[i];
    else ans+=x[i]*380000.0;
  }
  cout << setprecision(20) << ans;
}


Measured memory_bytes: 256
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
	require 'rubygems';RUBY=Gem.ruby
	exec({'RUBY_THREAD_VM_STACK_SIZE'=>'50000000'},RUBY,$0)
end

def dfs(i)
	return 0 if !H.has_key?(i)
	return $memo[i] if $memo[i]>=0
	a=H[i].map{|e|dfs(e)}.sort_by(&:-@)
	r=0
	a.size.times{|i|x=a[i]+i+1;r<x&&r=x}
	$memo[i]=r
end
N=gets.to_i
$memo=[-1]*N
H=Hash.new{|h,k|h[k]=[]}
$<.each_with_index{|e,i|
	H[e.to_i-1]<<i+1
}
dfs(N/2)
p dfs(0)

Measured memory_bytes: 125564
A, B, C = map(int, input().split())
nums = [A, B, C]
nums.sort()

ans = 0
while(nums[0]<nums[2]-1):
    ans += 1
    nums[0]+=2
while(nums[1]<nums[2]-1):
    ans += 1
    nums[1]+=2

if nums[0]==nums[1]==nums[2]:
    ans += 0
elif nums[0] == nums[1]:
    ans += 1
else: ans += 2


print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = int64_t;

int main(){
    int m, k; cin >> m >> k;

    if(m == 0 && k == 0){
        cout << "0 0" << endl;
    } else if(m == 1 && k == 0) {
        cout << "0 0 1 1" << endl;
    } else if(m >= 2) {
        int limit = 1 << m;
        if(k >= limit) {
            cout << -1 << endl;
            return 0;
        }
        vector<int> a;
        rep(i, limit){
            if(i == k) continue;
            a.push_back(i);
        }
        rep(ri, 2){
            for(int num : a) cout << num << ' ';
            cout << k;
            if(!ri) {
                cout << ' ';
                reverse(all(a));
            } else cout << endl;
        }
    } else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 2424