akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
int main(){
	int n,h,m;
	scanf("%d",&n);
	for(;n--;){
		scanf("%d:%d",&h,&m);
		double s=h*30+m/2.,l=m*6,t,d;
		l<s?t=l,l=s,s=t:0;
		d=s-l+360;
		l-s<d?d=l-s:0;
		d<30?
			puts("alert")
		:
			d<90?
				puts("warning")
			:
				puts("safe");
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
const LL MOD = 1e9 + 7;
LL dp[10005][105][2], D;
vector<int> arr;
LL solve(int i, int d, int op) {
    if (i == -1) return d == 0;
    if (~dp[i][d][op]) return dp[i][d][op];
    dp[i][d][op] = 0;
    int up = op ? arr[i] : 9;
    for (int k = 0 ; k <= up ; k++)
        (dp[i][d][op] += solve(i - 1, (d + k) % D, op && (k == arr[i]))) %= MOD;
    return dp[i][d][op];
}
void marmot0814() {
    string s; cin >> s >> D;
    for (auto &c : s)
        arr.push_back(c - '0');
    reverse(arr.begin(), arr.end());
    memset(dp, -1, sizeof(dp));
    cout << (solve(arr.size() - 1, 0, 1) + MOD - 1) % MOD << '\n';
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t = 1, kase = 0; // cin >> t;
    while (t--) {
        // cout << "Case #" << ++kase << ":";
        marmot0814();
    }
}

Measured memory_bytes: 20972
import java.util.*;

public class Main {
	  public static void main(String[] args) {

	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    int h[] = new int[n];
	    int sum = 0;
	    int end = 0;
	    int w = 0;
	    for(int i=0; i<n; i++) {
	      h[i] = sc.nextInt();
	    }
	    while(end <= n){
	      end = 0;
	  	  for(int i=0; i<n; i++){
	        if(h[i] == 0){
	          end++;
	        }else{
	          w = i;
	          break;
	        }
	      }
	      if(end >= n){
	        break;
	      }
	      while(w < n){
	        if(h[w] <= 0){
	          break;
	        }else{
	          h[w]--;
	        }
	        w++;
	      }
	      sum++;
	    }
	    System.out.println(sum);
	  }
}

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

using namespace std;

#define ll long long
#define PI 3.14159265358979323846264338327950L



void solve(){
    string a,b;

    cin >> a >> b;

    for (int i = 0; i < a.length(); i++)
    {
        if(a.at(i) != b.at(i)){
            cout << "No" << endl;
            return;
        }
    }
    
    cout << "Yes" << endl;
    


}





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define int long long
using namespace std;
string s ;
int n,ans=0,a[11][11] ;
int fun(int k)
{
    //cout<<k<<endl ;
    if(k<=1) return 1 ;
    int as=0 ;
    for(int i = 0 ; i < k ; i++)
    {
        //cout<<k-1<<" "<<i<<" "<<a[k-1][i]<<endl ;
        as+=(a[k-1][i]) ;
    }
    //cout<<k<<" "<<as<<endl ;
    return as ;
}
int32_t main()
{
    a[0][0] = 1 ;
    for(int i = 0 ; i <= 10 ; i++)
    {
        for(int j = 0 ; j <= 10 ; j++)
        {
            if(j == 0) a[i][j] = 1 ;
            else if(j == i) a[i][j] = 1 ;
            else if(i < j) a[i][j] = 0 ;
            else a[i][j] = a[i-1][j-1] + a[i-1][j] ;
        }
    }
    cin>>s ; n=s.size() ;
    for(int i = 0 ; i < n ; i++)
    {
        int x=0 ;
        for(int j = i ; j < n ; j++)
        {
            //cout<<i<<" "<<j<<endl ;
            int k=n-j-1,p=i ; x=(x*10)+(s[j]-'0') ;
            int pp=fun(k),q=fun(p) ;
            ans+=(pp*q*x) ;
        }
    }
    cout<<ans<<endl ;
}


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

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

int main()
{
    long long a,b;
    cin>>a>>b;
    
    cout<<(a/gcd(a,b))*b<< endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAXN=100010;
const int MOD=1e9+7;
int n;
int x,y;
int dp[MAXN][2];
vector<int>graf[MAXN];
int add(int x,int y){
	return (x+y)%MOD;
}
int mul(int x,int y){
	return ((ll)x*y)%MOD;
}
void dfs(int x,int p){
	bool list=true;
	dp[x][0]=1;
	dp[x][1]=1;
	for(auto y:graf[x]){
		if(y==p) continue;
		list=false;
		dfs(y,x);
		dp[x][0]=mul(dp[x][0],add(dp[y][0],dp[y][1]));
		dp[x][1]=mul(dp[x][1],dp[y][0]);
	}
}
int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>x>>y;
		graf[x].push_back(y);
		graf[y].push_back(x);
	}
	dfs(1,0);
	cout<<add(dp[1][0],dp[1][1])<<"\n";
	return 0;
}

Measured memory_bytes: 13440
N, M = map(int, input().split())
A = list(map(int, input().split()))
total_vote = sum(A)
criteria = total_vote / (4 * M)
popular_items = 0

for A_i in A:
    if A_i >= criteria:
        popular_items += 1
        
if popular_items >= M:
    ans = 'Yes'
else:
    ans = 'No'
    
print(ans)

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

#define INF 1000000001

using namespace std;

int main(){
    int D, G;
    cin >> D >> G;
    int p[D];
    int c[D];
    for(int i=0; i<D; i++){
        cin >> p[i] >> c[i];
    }

    vector<int> a(D);
    for(int i=0; i<D; i++){
        a[i] = i;
    }
    long ans = INF;
    
    do {
        int temp = G;
        long cnt = 0;
        bool done = false;
        for(int i : a){
            if(temp > 100 * (i+1) * p[i]){
                if(temp > 100 * (i+1) * p[i] + c[i]){
                    temp -= 100 * (i+1) * p[i] + c[i];
                    cnt += p[i];
                }
                else{
                    cnt += p[i];
                    done = true;
                    break;
                }
            }
            else{
                cnt += (temp - 1) / (100 * (i+1)) + 1;
                done = true;
                break;
            }
            if(done) break;
        }
        ans = min(ans, cnt);
    } while(next_permutation(a.begin(), a.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std; 
char s[100010];
int a[10];
int main()
{
	while(scanf("%s",s)!=EOF)
	{
		int flag=1;
		memset(a,0,sizeof(a));
		for(int i=0;i<strlen(s);i++)
		a[s[i]-'a']++;		
		sort(a,a+3);
		if(a[2]-a[0]>1) 
		flag = 0;
		if(a[2]-a[1]>1) 
		flag = 0;
		if(flag) 
		printf("YES\n");
		else 
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProconTemplate
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_c
    class abc169_b
    {
        public static void Main(string[] args)
        {
            //string s = Console.ReadLine();

            string[] asInput = Console.ReadLine().Split(' ');
            long A = long.Parse(asInput[0]);
            decimal B = decimal.Parse(asInput[1]);
            Console.WriteLine(A * (long)(100 * B) / 100);

            //Console.WriteLine(A * B);
            //return;
            ////int Q = int.Parse(asInput[2]);

            //Console.ReadLine();
            //long[] p = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            //long lAns = p[0];

            //for (int i = 1; i < p.Length; i++)
            //{
            //    if (1000000000000000000 / lAns < p[i])
            //    {
            //        lAns = -1;
            //        break;
            //    }
            //    lAns *= p[i];
            //}
            //Console.WriteLine(lAns);


        }
    }
}


Measured memory_bytes: 27492
#include <bits/stdc++.h>
#include <unistd.h>
#include <cctype>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF LLONG_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
using ll = long long;
using Pll = pair<ll,ll>;
using Pii = pair<int,int>;
using Pdd = pair<double,double>;
using dcomplex = complex<double>;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}
double inf() {return std::numeric_limits<double>::infinity();}

int main(int argc, char const *argv[]) {
  ll N, M; cin >> N >> M;
  ll ans;
  if(N==1 && M==1) ans = 1;
  else if(N==1 || M==1) ans = max(N,M)-2;
  else {
    ll a = N-2; ll b = M-2;
    ans = (a<0?0:a)*(b<0?0:b);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
typedef long long ll;
// cd test ; rm -R ./*; cd ..

int main(void) {
  int n, m;
  cin >> n >> m;

  vector<ll> a(n);
  vector<pair<ll, ll>> cb(m);

  rep (i, n) cin >> a[i];
  rep (i, m) cin >> cb[i].second >> cb[i].first;

  sort(a.begin(), a.end());
  sort(cb.rbegin(), cb.rend());

  int c, b;
  tie(c, b) = cb[0];
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (b == 0) {
      j++;
      tie(c, b) = cb[j];
    }
    if (c <= a[i]) break;

    a[i] = c;
    b--;
  }

  ll ans = 0;
  rep (i, n) ans += a[i];

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
	int n,c,x,y,p[100],i;
	y=0;
	scanf("%d %d",&n,&c);
	for(i=0;i<c;i++){
	scanf("%d",&p[i]);
	y=y+p[i];
	}
	x=y/(n+1);
	if(y%(n+1)!=0){
	printf("%d\n",x+1);
	}
	else {
	printf("%d\n",x);
	}
	return 0;
}	


Measured memory_bytes: 2104
a,b,k = map(int,input().split())

for i in range(k):
    if i %2 == 0:
        a -= a % 2
        b += a//2
        a = a//2
    else:
        b -= b % 2
        a += b//2
        b = b//2


print(a)
print(b)

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args)  {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		long k = sc.nextLong();

//		long times = 5000_0000_0000_0000L;
		for(int i = 0; i < k; i++){

			if(s.charAt(i) != '1'){
				System.out.println(s.charAt(i));
				return;
			}
		}

		System.out.println(1);
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
template<typename T> T gcd(T a,T b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
ll n, p3[64], p20 = 1ll<<20;
map<pll, ll> memo;
ll calc(ll a, ll b){
  if(a < 0) return 0;
  if(a == 0 || b <= 0) return 1;
  if(a >= (1ll<<(b+1))-2) return p3[b];
  pll p = pll(a, b);
  if(memo.find(p) != memo.end()) return memo[p];
  ll ret = (calc(a, b-1) + calc(a - (1ll<<(b-1)), b-1) + calc(a - (1ll<<b), b-1)) % mod;
  memo[p] = ret;
  return ret;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  p3[0] = 1;
  FOR(i, 1, 64) p3[i] = p3[i-1] * 3 % mod;
  cin >> n;
  cout << calc(n, 62) << endl;
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b, c, d] <- map strToInt . words <$> getLine
    -- 出力
    putStrLn $ show $ max (a*b) (c*d)


Measured memory_bytes: 508
import java.util.Scanner;

class Main
{
    public static void main(String args[])
    {
        Scanner s = new Scanner(System.in);
        String a = s.nextLine();
        String res="";
        if(a.charAt(a.length()-1)=='s')
        {
           res = a+"es";
        }
        else 
        {
            res = a+"s";
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 38564
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
//#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;
struct item
{
	int key, prior, sz;
	item *l, *r;
	item() {}
	item(int key) : key(key), prior(rand()), l(NULL), r(NULL) {}
};
typedef item * pitem;
int sz(pitem t)
{
	return t ? t -> sz : 0;
}
void up_sz(pitem t)
{
	if(t)
		t->sz = sz(t->l) + 1 + sz(t->r);
}
void merge(pitem &t, pitem l, pitem r)
{
	if(!l || !r) t = l ? l : r;
	else if(r -> prior > l->prior)
		merge(r->l, l, r->l) ,t = r;
	else
		merge(l->r, l->r, r), t = l;
	up_sz(t);
}
void split(pitem t, pitem &l, pitem &r, int val)
{
	if(!t) l = r = NULL;
	else if(val > t->key)
		split(t->r, t->r, r, val), l = t;
	else
		split(t->l, l, t->l, val), r = t; 
	up_sz(t);
}
void erase(pitem t)
{
	if(t)
	{
		erase(t->l);
		erase(t->r);
		delete t;
	}
}
int main()
{
	//ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	ll x;
	cin>>n;
	x = (ll)n * (n + 1) / 2;
	int ar[n];
	set<int> st;
	fore(i, 0, n)
	{
		cin>>ar[i];
		st.insert(ar[i]);
	}
	int mar[st.size()];
	int siz = st.size();
	int con = 0;
	for(set<int>::iterator it = st.begin(); it != st.end(); it++)
		mar[con] = *it, con++;
	int lo = 0, hi = siz -1;
	int mid, res = -1;
	pitem t = NULL, t1, t2, t3;
	while(lo <= hi)
	{
		//cout<<0<<'\n';
		erase(t);
		t = new item(0);
		mid = (lo + hi) / 2;
		//cout<<"     "<<lo<<' '<<hi<<'\n';
		int su = 0;
		ll sum = 0;
		fore(i, 0, n)
		{
			su += ar[i] >= mar[mid]? 1: -1;
			split(t, t1, t2, su+1);
			sum += sz(t1);
			//cout<<su<<','<<sum<<' '<<'\n';
			t3 = new item(su);
			merge(t1, t1, t3);
			merge(t, t1, t2);
		}
		//cout<<mid<<' '<<mar[mid]<<' '<<x<<' '<<sum<<'\n';
		if(sum >= x / 2 + (x&1))
			res = mid, lo = mid +1;
		else
			hi = mid -1;
		//cout<<res<<'\n';
	}
	//cout<<res<<'\n';
	cout<<mar[res];
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Pdd pair<double, double>
const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

bool Collinear(Pdd a, Pdd b, Pdd c)
{
    //3点a,b,cが同一直線上にあるかどうかを調べる
    double x1 = a.first;
    double y1 = a.second;
    double x2 = b.first;
    double y2 = b.second;
    if ((x2 - x1) * (c.second - y1) == (y2 - y1) * (c.first - x1))
        return true;
    else
        return false;
}

bool Including(Pdd a, double r, Pdd b)
{
    //中心座標aで半径rの中にbが含まれているかどうか調べる
    //含んでいたらtrueを返す
    if (r >= hypot(a.first - b.first, a.second - b.second))
        return true;
    else
        return false;
}
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    double ans = inf;
    vector<pair<double, double>> P(N);
    rep(i, N) cin >> P[i].first >> P[i].second;
    rep(A, N) rep(B, N) rep(C, N)
    {
        if (A == B || B == C || C == A)
            continue;
        //頂点P[a],P[b],P[c]の三角形を考えて
        //3点の外接円の中心座標Px,Pyを求める；
        //rは半径
        //もしも3点が同一直線上だったら次の候補に行く
        if (Collinear(P[A], P[B], P[C]))
            continue;
        double a, b, c, d, e, f, aa, bb, cc, dd, ee, ff, px, py, r;
        a = P[A].first;
        b = P[A].second;
        c = P[B].first;
        d = P[B].second;
        e = P[C].first;
        f = P[C].second;
        aa = a * a;
        bb = b * b;
        cc = c * c;
        dd = d * d;
        ee = e * e;
        ff = f * f;
        py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee - ff)) / (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f));
        if (c != a)
            px = (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a));
        else
            px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a));
        r = hypot(px - a, py - b);
        bool ok = 1;
        rep(i, N)
        {
            //半径rで中心が(px,py)の円に点が含まれているかどうか判別する
            if (!Including({px, py}, r, P[i]))
                ok = 0;
        }
        if (ok)
            ans = min(ans, r);
    }
    rep(A, N) rep(B, N)
    {
        if (A == B)
            continue;
        //2点A,Bの中心で半径rの円を調べる
        double px = (P[A].first + P[B].first) / 2;
        double py = (P[A].second + P[B].second) / 2;
        double r = hypot(px - P[A].first, py - P[A].second);
        bool ok = 1;
        rep(i, N)
        {
            //半径rで中心が(px,py)の円に点が含まれているかどうか判別する
            if (!Including({px, py}, r, P[i]))
                ok = 0;
        }
        if (ok)
            ans = min(ans, r);
    }
    cout << ans << endl;
}

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

#define INF_LL (int64)1e18
//#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

class UnionFind{
private:
    ::std::vector<int_fast32_t> par, edge;
    size_t n;

public:
    UnionFind(){}
    UnionFind(size_t n):n(n){
        par.resize(n, -1);
        edge.resize(n, 0);
    }

    uint_fast32_t find(uint_fast32_t x){
        return par[x] < 0 ? x : par[x] = find(par[x]);
    }

    size_t size(uint_fast32_t x){
        return -par[find(x)];
    }

    bool unite(uint_fast32_t x, uint_fast32_t y){
        x = find(x);
        y = find(y);
        edge[x] += 1;
        if(x == y) return false;
        if(size(x) < size(y)) std::swap(x, y);
        par[x] += par[y];
        edge[x] += edge[y];
        par[y] = x;
        return true;
    }

    bool same(uint_fast32_t x, uint_fast32_t y){
        return find(x) == find(y);
    }

    size_t esize(uint_fast32_t x) {
        return edge[find(x)];
    }
};

int main(void) {
    int64 H, W, N;
    cin >> N >> H >> W;
    using T = tuple<int64, int64, int64>;
    vector<T> v;
    REP(i, N) {
        int64 r, c, a;
        cin >> r >> c >> a;
        v.emplace_back(a, r-1, H+c-1);
    }
    sort(all(v), greater<>());
    UnionFind uf(H+W);
    int64 res = 0;
    REP(i, N) {
        int64 r, c, a;
        tie(a, r, c) = v[i];
//        cout << a << " " << r << " " << c << ": " << uf.same(r, c) << " " << uf.size(r) << " ";
//        cout << uf.size(c) << " " << uf.esize(r) << " " << uf.esize(c) << " ";
        if ((!uf.same(r, c) && (uf.size(r) + uf.size(c) > uf.esize(r) + uf.esize(c))) || (uf.same(r, c) && uf.size(r) > uf.esize(r))) {
            res += a;
//            cout << "ok";
            uf.unite(r, c);
        }
//        cout << endl;
    }
    cout << res << endl;
}


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

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

int main(){
  int Tc;
  cin>>Tc;
  while(Tc--){
    ll x,y,z,a,b;
    cin>>x>>y;
    z=extgcd(x,y,a,b);
    ll py=abs(a);
    ll px=abs(b);
    if(z<=50000){
      cout<<3<<endl;
      cout<<0<<' '<<0<<endl;
      if(x*py-y*px<0){
        cout<<x<<' '<<y<<endl;
        cout<<px<<' '<<py<<endl;
      }else{
        cout<<px<<' '<<py<<endl;
        cout<<x<<' '<<y<<endl;
      }
    }else{
      cout<<4<<endl;
      cout<<0<<' '<<0<<endl;
      cout<<x<<' '<<y-1<<endl;
      cout<<x/z<<' '<<y/z<<endl;
      cout<<x-1<<' '<<y<<endl;
    }
  }
  return 0;
}

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

void solve() {
  int r,g,b,k,i=0;
  cin>>r>>g>>b>>k;
  while(i<k && !(r<g && g<b)) {
  	i++;
    if(r>=g)	g*=2;
    else b*=2;
  }
  if(r<g && g<b) cout<<"Yes";
  else cout<<"No";
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3628
N,M = map(int, input().split())
s = []
c = []
t_1 = []
t_2 = []
for i in range(M):
    t_1,t_2 = map(int, input().split())
    s.append(t_1)
    c.append(t_2)  
ans = []
for p in range(N):
    ans.append(-2)
for j in range(M):
    if s[j] > N:
        ans[0:N] = [-1]
        break
    ans[s[j]-1:s[j]] = [c[j]]
if N != 1:
    if ans[0] == 0:
        ans[0:N] = [-1]
    elif ans[0] == -2:
        ans[0] = 1
for r in range(1,M):
    if s[r-1] == s[r]:
        if c[r-1] != c[r]:
            ans[0:N] = [-1]
            break
for k in range(len(ans)):
    if ans[k]==-2:
        ans[k] = 0
print(int("".join(map(str,ans))))

Measured memory_bytes: 3064
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<iostream>
using namespace std;
struct Node{
Node *parent,*left,*right;
int key;
};
Node *NIL,*root;
Node *find(Node*u,int k){
   while(u!=NIL&&k!=u->key){
    if(k<u->key)u=u->left;
    else u=u->right;
   }
   return u;
}

void prin_in(Node* node){
    if(node==NIL)return;
    prin_in(node->left);
    printf(" %d",node->key);
    prin_in(node->right);
}
void prin_pre(Node* node){
    if(node==NIL)return;
    printf(" %d",node->key);
    prin_pre(node->left);
    prin_pre(node->right);

}
void insert(int key)
{
    Node *y=NIL;
    Node *x=root;
    Node *z;
    z=(Node*)malloc(sizeof(Node));
    z->key=key;
    z->left=NIL;
    z->right=NIL;
    while(x!=NIL){
        y=x;
        if(z->key<x->key)
           x=x->left;
        else
            x=x->right;
    }
    z->parent=y;
    if(y==NIL){
        root=z;
    } else{
            if(z->key<y->key)
                y->left=z;
            else {
                y->right=z;
            }
    }
}
int main(){
   int n,i,x;
   string s;
   scanf("%d",&n);
   for(int i=0;i<n;i++)
   {
       cin>>s;
       if(s[0]=='i'){
        scanf("%d",&x);
        insert(x);
       }
       else if(s[0]=='f'){
        scanf("%d",&x);
        Node*t=find(root,x);
        if(t!=NIL)printf("yes\n");
        else printf("no\n");
       }
       else if(s[0]=='p'){
       prin_in(root);
       printf("\n");
       prin_pre(root);
       printf("\n");
       }
   }
   return 0;
}

Measured memory_bytes: 21968
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

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

  vector <ll> A(N);
  for (int i = N - 1; i >= 0; i--){
    cin >> A[i];
  }
  
  bool flag = true;

  
  ll M = 2, m = 2;
  for (int i = 0; i < N; i++){
    ll a = M / A[i];
    ll b = m / A[i];
    if (m % A[i] != 0) b++;

    m = b * A[i];
    M = (a + 1) * A[i] - 1;

    if (m > M){
      flag = false;
    }
  }
  
  if (flag == true){
    cout << m << " " << M << endl;
  }else{
    cout << -1 << endl;
  }
    
  
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<queue>
using namespace std;
typedef long long s64;

#define next nxt
const int ONE = 1000005;
const int INF = 2147483640;

int get()
{
		int res = 1, Q = 1; char c;
		while( (c = getchar()) < 48 || c > 57)
			if(c == '-') Q = -1;
		if(Q) res = c - 48;
		while( (c = getchar()) >= 48 && c <= 57)
			res = res * 10 + c - 48;
		return res * Q;
}

int n, k;
int A[ONE], p[ONE];
int next[ONE], first[ONE], go[ONE], Input[ONE], tot;
priority_queue <int, vector <int>, greater <int> > q;

int res = INF;
namespace Seg
{
		struct power {int val;} Node[ONE * 4];
		void Build(int i, int l, int r)
		{
			Node[i].val = INF;
			if(l == r) return;
			int mid = l + r >> 1;
			Build(i << 1, l, mid), Build(i << 1 | 1, mid + 1, r);
		}

		void Update(int i, int l, int r, int L, int x)
		{
			if(L <= l && r <= L)
			{
				Node[i].val = x;
				return;
			}
			int mid = l + r >> 1;
			if(L <= mid) Update(i << 1, l, mid, L, x);
			else Update(i << 1 | 1, mid + 1, r, L, x);
			Node[i].val = min(Node[i << 1].val, Node[i << 1 | 1].val);
		}

		void Query(int i, int l, int r, int L, int R)
		{
			if(L > R) return;
			if(L <= l && r <= R)
			{
				res = min(res, Node[i].val);
				return;
			}
			int mid = l + r >> 1;
			if(L <= mid) Query(i << 1, l, mid, L, R);
			if(mid + 1 <= R) Query(i << 1 | 1, mid + 1, r, L, R);
		}
}

void Add(int u, int v)
{
		Input[v]++, next[++tot] = first[u], first[u] = tot, go[tot] = v;
}

void Deal()
{
		int now = 0;
		for(int i = 1; i <= n; i++)
			if(!Input[i]) q.push(i);
		while(!q.empty())
		{
			int u = q.top(); q.pop();
			A[u] = ++now;
			for(int e = first[u]; e; e = next[e])
			{
				int v = go[e];
				if(--Input[v] == 0) q.push(v);
			}
		}
		for(int i = 1; i <= n; i++) printf("%d\n", A[i]);
}

int main()
{
		//freopen("permutation.in","r",stdin);
		//freopen("permutation.out","w",stdout);
		n = get(), k = get();
		for(int i = 1; i <= n; i++) p[get()] = i;

		Seg::Build(1, 1, n);
		for(int i = n; i >= 1; i--)
		{
			res = INF, Seg::Query(1, 1, n, p[i] + 1, min(p[i] + k - 1, n));
			if(res != INF) Add(p[i], p[res]);

			res = INF, Seg::Query(1, 1, n, max(1, p[i] - k + 1), p[i] - 1);
			if(res != INF) Add(p[i], p[res]);

			Seg::Update(1, 1, n, p[i], i);
		}

		Deal();
}

Measured memory_bytes: 35060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

struct event{
    int t,id,x;
};

int main(){
    int n,q;
    cin >> n >> q;
    vector<event> events;
    rep(i,n){
        int s,t,x;
        cin >> s >> t >> x;
        events.push_back({s-x,-1,x});
        events.push_back({t-x,0,x});
    }
    map<int,int> ans;
    rep(i,q){
        int d;
        cin >> d;
        ans[d] = -1;
        events.push_back({d,1,0});
    }

    sort(events.begin(),events.end(),[](const event &l,const event &r){
        if(l.t != r.t) return l.t < r.t;
        else return l.id < r.id;
    });

    set<int> st;
    map<int,int> cnt;

    rep(i,2*n+q){
        if(events[i].id == -1){
            st.insert(events[i].x);
            cnt[events[i].x] ++;
        }else if(events[i].id == 0){
            cnt[events[i].x] --;
            if(cnt[events[i].x]==0) st.erase(events[i].x);
        }else{
            if(!st.empty()) ans[events[i].t] = *st.begin();
        }
    }

    for(auto p:ans) cout << p.second << endl;
    return 0;
}

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

flg = True
c = [0 for i in range(n)]
i = 1
b = []
d = []
one = False
while flg:
	x = i-1
	if c[x] == 1 and a[x] == 1:
		flg = False
		one = True
		break
	elif c[x] == 3:
		flg = False
		break
	else:
		c[x] += 1
		if c[x] == 1:
			b.append(x+1)
		if c[x] == 2:
			d.append(x+1)
	i = a[x]
y = k % len(b)
ans = b[y]
if k < len(b):
	print (ans)
else:
	if one:
		print (ans)
	else:
		k -= len(b)
		y = k % len(d)
		ans = d[y]
		print (ans)

Measured memory_bytes: 33932
from collections import deque


N = int(input())
branch = [0] * (N - 1)
for i in range(N-1):
    branch[i] = list(map(int, input().split()))
C = list(map(int, input().split()))
C.sort(reverse=True)
M = sum(C[1:])

adj = [[] for i in range(N+1)]
for i in range(N-1):
    a, b = branch[i]
    adj[a].append(b)
    adj[b].append(a)

ans = [-1] * (N+1)
deq = deque()
deq.appendleft(1)
while len(deq) > 0:
    v = deq.pop()
    ans[v] = C.pop(0)
    for u in adj[v]:
        if ans[u] == -1:
            deq.appendleft(u)

print(M)
print(' '.join(map(str, ans[1:])))


Measured memory_bytes: 50264
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
s=input()
def Z_algo(S):
    n = len(S)
    LCP = [0]*n
    c = 0#最も末尾側までLCPを求めたインデックス
    for i in range(1, n):
        #i番目からのLCPが以前計算したcからのLCPに含まれている場合
        if i+LCP[i-c] < c+LCP[c]:
            LCP[i] = LCP[i-c]
        else:
            j = max(0, c+LCP[c]-i)
            while i+j < n and S[j] == S[i+j]: j+=1
            LCP[i] = j
            c = i
    LCP[0] = n
    return LCP
ans=0
for i in range(n):
    lcp=Z_algo(s[i:])
    for j in range(len(lcp)):
        tmp=min(j,lcp[j])
        ans=max(ans,tmp)
print(ans)
        

Measured memory_bytes: 51932
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		int kosha[][][] = new int[4][3][10];
		
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		// ??\???????????????????´?
		for(int i=1; i<=n; i++){
			int a = scan.nextInt();
			int b = scan.nextInt();
			int c = scan.nextInt();
			int d = scan.nextInt();
			int A = a-1;
			int B = b-1;
			int C = c-1;
			int D = kosha[A][B][C];
			kosha[A][B][C] = D + d;
		}
		
		//?????????
		for (int A=0; true; A++){
			for(int B=0; B<=2; B++){
				for(int C=0; C<=9; C++){
					System.out.print(" " + (kosha[A][B][C]));
				}
				System.out.println("");
			}
			if (A==3) break;
			System.out.println("####################");
		}
		
	}

}

Measured memory_bytes: 29428
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char s[10];
	char ston[2];
	int n;

	scanf("%s", &s);

	ston[0] = s[5];
	ston[1] = s[6];

	n = atoi(ston);

	if (n < 5)
		printf("Heisei\n");
	else
		printf("TBD\n");

	return 0;
}

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

int a[26];

int main()
{
    string str ;
    cin >> str ;
    memset(a,0,sizeof a);

    for(int i = 0 ; i < str.size() ; i++)
    {
        a[str[i]-'a'] = 1 ;
    }
    for(int i = 0 ; i < 26 ; i++)
    {
        if(a[i] == 0)
        {
            cout << (char)(i+'a') << endl;
            return 0;
        }
    }
    cout << "None\n";
    return 0 ;
}


Measured memory_bytes: 512
//package abc170_B;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		double x = in.nextDouble();
		double y = in.nextDouble();
		double res = y / 2 - x;
		if(Math.round(res) == res && res >= 0 && res <= x) System.out.println("Yes");
		else System.out.println("No");
	}

}
///////////////////////////////////TEMPLATE///////////////////////////////////
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

	String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32940
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 100'000;
const int LOGN = 19;

int n, m, k;

void solve(int test) {
  int x = 0, y = 0, z = 0;
  int64 ans = 1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int b;
    cin >> b;
    int mul = b == x;
    mul += b == y;
    mul += b == z;
    if (b == x) {
      ++x;
    } else if (b == y) {
      ++y;
    } else if (b == z) {
      ++z;
    }
    ans *= mul;
    ans %= mod;
  }
  cout << ans << '\n';
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
import heapq
class point:
    def __init__(self, total, use, place):
        self.total = total
        self.use = use
        self.place = place

    def __lt__(self, other):
        return self.total < other.total or (self.total == other.total and self.use > self.use)


w, h, n = map(int, input().split())
if w == h == 1:
    print(0)
    exit()
lights = [list(map(int, input().split())) for _ in range(n)]
que = []
mins = []
for i, j in enumerate(lights):
    dis = j[0] + j[1] - 2
    heapq.heappush(que, point(dis, dis, i))
    mins.append(point(dis, dis, i))
ans = 100000
while que:
    top = heapq.heappop(que)
    ans = min(ans, top.total + max(0, abs(w - lights[top.place][0]) + abs(h - lights[top.place][1]) - top.use))
    for i in range(len(lights)):
        dis = abs(lights[top.place][0] - lights[i][0]) + abs(lights[top.place][1] - lights[i][1]) - 1
        use = max(0, dis - top.use)
        total = top.total + use
        new = point(total, use, i)
        if mins[i] > new:
            mins[i] = new
            heapq.heappush(que, new)
print(ans)


Measured memory_bytes: 7496
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        boolean ok = true;
        for (int i = 0; i < s.length(); i++) {
            if (((i + 1) % 2 != 0 && s.charAt(i) == 'L') || ((i + 1) % 2 == 0 && s.charAt(i) == 'R')) {
                ok = false;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 23252
ans = int(input())
while True:
    op = input()
    if op == '+':
        m = int(input())
        ans += m
    elif op == '-':
        m = int(input())
        ans -= m
    elif op == '*':
        m = int(input())
        ans *= m
    elif op == '/':
        m = int(input())
        ans //= m
    elif op == '=':
        print(ans)
        exit()


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(void){
    ll ans=1;
    ll d,m;
    cin>>d>>m;
    if(fabs(d-m)>1)cout<<"0";
    else{
        for(int i=0;i<m;i++){
            ans*=(i+1);
            ans%=1000000007;
        }
        for(int i=0;i<d;i++){
            ans*=(i+1);
            ans%=1000000007;
        }
        if(fabs(d-m)==0)ans=(ans*2%1000000007);
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int z[111111];
int main()
{
	long long n,k,ba=0;
	cin>>n;
	while(n--)
	{
		long long a;
		cin>>a;
		ba+=a;
		z[a]++;
	}
	cin>>k;
	while(k--)
	{
		long long a,b;
		cin>>a>>b;
		ba+=z[a]*(b-a);
		z[b]+=z[a];
		z[a]=0;
		cout<<ba<<endl;
	}
	return 0;
}

Measured memory_bytes: 3996
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
long long a,b,c,d;
long long gcd(long long x,long long y){
	if(x>y) swap(x,y);
	while(y){
		long long temp=y;
		y=x%y;
		x=temp;
	}
	return x;
}
int main(){
//	printf("%lld\n",gcd(9,6));
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if(a<b){
			printf("No\n");
			continue;
		}
		if(a>=c){
			long long e=a-c;
			e%=b;
			long long f=e+c;
		/*	if(f<b){
				printf("No\n");
				continue;
			}*/
			f-=b;
			long long h=gcd(b,d);
			long long k=c-f;
			long long n=k%h;
			n=h-n;
			if(c+n<b){
				printf("No\n");
				continue;
			}
			long long t=f%h;
			if(t+d<b){
				printf("No\n");
				continue;
			}
			printf("Yes\n");
		}
		else{
			long long f=a-b;
			long long h=gcd(b,d);
			long long k=c-f;
			long long n=k%h;
			n=h-n;
			if(c+n<b){
				printf("No\n");
				continue;
			}
			long long t=f%h;
			if(t+d<b){
				printf("No\n");
				continue;
			}
			printf("Yes\n");
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


void solve(){
    long long  a[3];
    cinf(3,a);
    sort(a,a+3);
    if(a[2]%2==0 || a[1]%2==0 || a[0]%2==0 ) cout << 0 fin;
    else cout << a[0]*a[1] fin;
  

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


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

int N;
string S;
ll res = 0;

bool ok(int idx) {
    if (idx == 0 or idx == N - 1) return true;
    if (S[idx - 1] == '.' or S[idx + 1] == '.') return true;
    {   // left
        int w = 0, b = 0;
        for (int i = idx - 1; i >= 0; --i) {
            if (S[i] == 'W') ++w;
            if (S[i] == 'B') { ++b; break; }
            if (S[i] == '.') break;
        }
        if (not b) return true;
    }
    {   // right
        int w = 0, b = 0;
        for (int i = idx + 1; i < N; ++i) {
            if (S[i] == 'W') ++w;
            if (S[i] == 'B') { ++b; break; }
            if (S[i] == '.') break;
        }
        if (not b) return true;
    }
    return false;
}

ll f(int idx) {
    ll ret = 0;
    if (idx > 0 and S[idx - 1] != '.') {   // left
        int w = 0, b = 0;
        for (int i = idx - 1; i >= 0; --i) {
            if (S[i] == 'W') { ++w; break; }
            if (S[i] == 'B') ++b;
            if (S[i] == '.') break;
        }
        if (w > 0) {
            ret = max<ll>(ret, b);
        }
    }
    if (idx < N - 1 and S[idx + 1] != '.') {   // right
        int w = 0, b = 0;
        for (int i = idx + 1; i < N; ++i) {
            if (S[i] == 'W') { ++w; break; }
            if (S[i] == 'B') ++b;
            if (S[i] == '.') break;
        }
        if (w > 0) {
            ret = max<ll>(ret, b);
        }
    }
    return ret;
}

int main() {

    cin >> N >> S;

    REP(i, N) {
        if (S[i] == '.') {
            if (ok(i)) {
                res = max<ll>(res, f(i));
                // cout << i << ' ' << res << endl;
            }
        }
    }

    cout << res << endl;

}


Measured memory_bytes: 3200
let iota ?(start=0) ?(step=1) cnt =
  let rec doit i acc =
    if i <= 0 then acc
    else doit (i - 1) (start + step*(i - 1) :: acc) in
  doit cnt []

let () =
  let n = read_int () in
  let rec doit n i =
    if n mod 2 <> 0 then i
    else doit (n / 2) (i + 1) in
  let doit n = doit n 0 in
  iota ~start:1 n
  |> List.map doit
  |> List.fold_left (fun (i, (ans, m)) e -> (i + 1, if e > m then (i, e) else (ans, m))) (1, (0, min_int))
  |> (fun (_, (ans, _)) -> ans)
  |> Printf.printf "%d\n"

Measured memory_bytes: 2432
#include<stdio.h>
#include<stdlib.h>

int main() {

	int N,M,P;
	int *X;
	int sum;
	int i,a=0,Answer[1000];

	for(;;) {
		scanf("%d %d %d",&N,&M,&P);
		if(N==0&&M==0&&P==0) break;

		X=(int *)malloc(N*sizeof(int));

		sum=0;
		for(i=0;i<N;i++) {
			scanf("%d",&X[i]);
			sum+=X[i];
		}

		if(X[M-1]==0)
			Answer[a]=0;
		else
			Answer[a]=(sum*(double)(100.0-P))/X[M-1];
		a++;
		free(X);
	}

	for(i=0;i<a;i++)
		printf("%d\n",Answer[i]);

	return 0;
}

Measured memory_bytes: 604
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int imos[100002];

int main() {
	int n, l, r, ans = 0;
	cin >> n;
	while (n--) {
		cin >> l >> r;
		imos[l]++;
		imos[r + 1]--;
	}
	for (int i = 1; i <= 100000; ++i) {
		imos[i] += imos[i - 1];
		ans += imos[i] ? 1 : 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/reversed.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
using boost::adaptors::reversed;
struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
template<class T> void trace_(const char* s, const T& v) { cerr << s << "=" << v; }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { for (; *s != ','; ++s) { cerr << *s; } cerr << "=" << v << ","; trace_(++s, vs...); }
#define TRACE(...) (cerr << "\033[2m\033[33m", trace_(#__VA_ARGS__, __VA_ARGS__), cerr << "\033[0m\n")
#else
#define TRACE(...)
#endif

void prime_factorize(int x, map<int, int>& factors) {
    for (int p = 2; p * p <= x; ++p) {
        while (x % p == 0) {
            ++factors[p];
            x /= p;
        }
    }
    if (x != 1) {
        ++factors[x];
    }
}

constexpr int mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    map<int, int> factors;
    for (int i : irange(2, n+1)) {
        prime_factorize(i, factors);
    }
    TRACE(factors);
    ll ans = 1;
    for (const auto& p : factors) {
        ans *= p.second + 1;
        ans %= mod;
    }
    cout << ans << nl;
}


Measured memory_bytes: 256