akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)

int main(){
  int N;
  
  cin >> N;
  
  if (N % 2 == 0){
    cout << N << endl;
  }
  else
  {
    cout << N * 2 << endl;
  }
  
}

Measured memory_bytes: 3520
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<vector<long long>>d(n+1,vector<long long>(3, 0));
    for(int j=0;j<3;j++)
      d[0][j]=0;

    for(int i=1;i<=n;i++){
        for(int j=0;j<3;j++){
            cin>>d[i][j];
        }
        for(int l=0;l<3;l++){
          long long tmp=0;
          for(int k=0;k<3;k++){
            if(k!=l){
             tmp=max(tmp, d[i][l]+d[i-1][k]);
            }
          }
          d[i][l]=tmp;
          //cout<<i<<" "<<l<<" "<<d[i][l]<<" ";
        }
    }
    cout<<max(d[n][2], max(d[n][0], d[n][1]));
    return 0;
}


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

// B - Count Balls
int main() {
    long long N, A, B;
    cin >> N >> A >> B;

    long long count = N / (A + B);
    long long bal = N % (A + B);
    long long plus = 0;

    if (bal >= A) plus = A;
    else plus = bal;

    cout << (count * A) + plus;

}

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

int main(){
    int n,s[10001],q,t,total=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    cin >> q;
    for(int i=0;i<q;i++){
        cin >> t;
        for(int j=0;j<n;j++){
            if(t==s[j]){
                total++;
                break;
            }
        }
    }
    cout<<total<<endl;
    return 0;
    
}


Measured memory_bytes: 3132
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N,M,C = inpl()
BB = inpl()
ans = 0
for _ in range(N):
    AA = inpl()
    tmp = C
    for i in range(M):
        tmp += AA[i] * BB[i]
    if tmp > 0:
        ans += 1

print(ans)


Measured memory_bytes: 4336
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 1e-8;

int main(){
	int n;

	while(~scanf("%d",&n)){
		if(n==0) break;
		int table[7];
		memset(table,0,sizeof(table));
		for(int i=0;i<n;i++){
			int age;
			scanf("%d",&age);
			table[age/10 >= 6 ? 6 : age/10]++; 
		}

		for(int i=0;i<7;i++){
			printf("%d\n",table[i]);
		}
	}
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
    char str1[10],str2[10],str3[10];
    int a,b,i,n=0,m=0;
    scanf("%s %s",str1,str2);
    scanf("%d %d",&a,&b);
    scanf("%s",str3);
    for(i=0;i<10;i++){
        if(str3[i]==str1[i])n++;
        if(str3[i]==str2[i])m++;
    }
    if(n>m){
        a--;
    }else{
        b--;
    }
    printf("%d %d",a,b);
    return 0;
}

Measured memory_bytes: 128
use strict;
use warnings;
package SuffixArray;
#sub sa_is(\@$);
sub sa_is{
	my$upper=shift;
	my@s=@_;
	my$n=@s;
	if($n==0){
		return();
	}
	elsif($n==1){
		return(0);
	}
	elsif($n==2){
		if($s[0]<$s[1]){
			return(0,1);
		}
		else{
			return(1,0);
		}
	}
	my@sa=(0)x$n;
	my@ls;
	$ls[$n-1]=undef;
	for(my$i=$n-2;$i>=0;$i--){
		$ls[$i]=$s[$i]==$s[$i+1]?$ls[$i+1]:$s[$i]<$s[$i+1];
	}
	my@sum_l=(0)x($upper+1);
	my@sum_s=(0)x($upper+1);
	for(0..$n-1){
		if($ls[$_]){
			$sum_l[$s[$_]+1]++;
		}
		else{
			$sum_s[$s[$_]]++;
		}
	}
	for(0..$upper){
		$sum_s[$_]+=$sum_l[$_];
		$sum_l[$_+1]+=$sum_s[$_]if$_<$upper;
	}
	my$induce;
	$induce=sub{
		my@sa=(-1)x$n;
		my@buf=@sum_s;
		for(@_){
			next if$_==$n;
			$sa[$buf[$s[$_]]++]=$_;
		}
		@buf=@sum_l;
		$sa[$buf[$s[$n-1]]++]=$n-1;
		for(0..$n-1){
			my$v=$sa[$_];
			$sa[$buf[$s[$v-1]]++]=$v-1if$v>=1&&!$ls[$v-1];
		}
		@buf=@sum_l;
		for(my$i=$n-1;$i>=0;$i--){
			my$v=$sa[$i];
			$sa[--$buf[$s[$v-1]+1]]=$v-1if$v>=1&&$ls[$v-1];
		}
		return@sa;
	};
	my@lms_map=(-1)x($n+1);
	my$m=0;
	my@lms=();
	for(1..$n-1){
		if(!$ls[$_-1]&&$ls[$_]){
			$lms_map[$_]=$m++;
			push@lms,$_;
		}
	}
	@sa=$induce->(@lms);
	if($m>0){
		my@sorted_lms;
		for(@sa){
			push@sorted_lms,$_ if$lms_map[$_]!=-1;
		}
		my@rec_s=();
		my$rec_upper=0;
		$rec_s[$lms_map[$sorted_lms[0]]]=0;
		for(1..$m-1){
			my$l=$sorted_lms[$_-1];
			my$r=$sorted_lms[$_];
			my$end_l=$lms_map[$l]+1<$m?$lms[$lms_map[$l]+1]:$n;
			my$end_r=$lms_map[$r]+1<$m?$lms[$lms_map[$r]+1]:$n;
			my$same=1;
			if($end_l-$l!=$end_r-$r){
				$same=0;
			}
			else{
				$l++,$r++while$l<$end_l&&$s[$l]==$s[$r];
				$same=0if$l==$n||$r==$n||$s[$l]!=$s[$r];
			}
			$rec_upper++if!$same;
			$rec_s[$lms_map[$sorted_lms[$_]]]=$rec_upper;
		}
		my@rec_sa=sa_is($rec_upper,@rec_s);
		$sorted_lms[$_]=$lms[$rec_sa[$_]]for 0..$m-1;
		@sa=$induce->(@sorted_lms);
	}
	return@sa;
}
sub suffix_array(\$){
	my@s=map ord,split"",${$_[0]};
	return sa_is(255,@s);
}
package LcpArray;
sub lcp(\@\@){
	my@s=@{$_[0]};
	my$n=@s;
	my@sa=@{$_[1]};
	my@rnk=(0)x$n;
	$rnk[$sa[$_]]=$_ for 0..$n-1;
	my@lcp=(0)x($n-1);
	my$h=0;
	for(0..$n-1){
		$h--if$h>0;
		next if$rnk[$_]==0;
		my$j=$sa[$rnk[$_]-1];
		$h++while$j+$h<$n&&$_+$h<$n&&$s[$j+$h]==$s[$_+$h];
		$lcp[$rnk[$_]-1]=$h;
	}
	return@lcp;
}
sub lcp_array(\$\@){
	my@s=map ord,split"",${$_[0]};
	return lcp(@s,@{$_[1]});
}
package main;
my$s=<>;
chomp$s;
my@sa=SuffixArray::suffix_array($s);
my@lcp=LcpArray::lcp_array($s,@sa);
my$ans=@sa*(@sa+1)/2;
$ans-=$_ for@lcp;
print$ans,$/;


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

using namespace std;

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

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

    int trial_num;
    if( K >= 41 ) trial_num = 41;
    else trial_num = K;

    for(int n=0; n< trial_num; ++n){
        vector<int> delta(N, 0);
        // for(int i=0; i<N; ++i){
        //     int power = a[i];

        //     int MIN = max(0, i - power);
        //     int MAX = min( N-1, i + power);

        //     if(power > 0){
        //         for(int j=MIN; j<i; ++j){
        //             delta[j]++;
        //         }

        //         for(int j=i+1; j<=MAX; ++j){
        //             delta[j]++;
        //         }
        //     }
        // }
        // for(int i=0; i<N; ++i){
        //     delta[i]++;
        // }
        // swap(a, delta);

        for(int i=0; i<N; ++i){
            int power = a[i];
            int l  = max(0, i- power);
            int r = min(N-1, i+power);
    
            delta[l]++;
            if(r+1 < N) delta[r+1]--;
        }

        for(int i=1; i<N; i++){
            delta[i] += delta[i-1];
        }
        swap(a, delta);
    }

    for(int i=0; i<N; ++i){
        cout << a[i] << " ";
    }


    return 0;
}

Measured memory_bytes: 5068
import numpy as np
N, M, C = [int(i) for i in input().split()]
B = np.array([int(i) for i in input().split()])
A = []
cor = 0
for i in range(N):
    A = np.array([int(j) for j in input().split()])
    if (sum(A*B) + C) > 0:
        cor += 1
        A = []
    else:
        A = []
print(cor)

Measured memory_bytes: 12424
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
ll N,ans=0;
int main(){ //srand((unsigned)time(NULL));
  cin >> N;
  sieve(100000000);
  for (int i = 0; i < N; i++) {
    ll x;
    cin >> x;
    if(IsPrime[x])ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 14904
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

t=1
#t=ii()
for _ in range(t):
    s=ip()
    ans=s.count('R')
    if(ans==2 and s[0]=='R' and s[2]=='R'):
        ans=1
    print(ans)    
    

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

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

//繰り返し自乗法によるmod累乗計算
//a = 底、　n = 指数
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//nCa 
ll comb(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}


int main(){
  int n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i,n) cin >> h[i];
  ll ans = 1001001001;
  sort(h.begin(), h.end());
  for(int i = k; i <= n; i++){
    ans = min(ans, h[i-1] - h[i-k]);
  }
  cout << ans << endl;
}






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

int n;

void input() {
    cin >> n;
}

void solve() {
    for(int i = 1 ; i < 10; i++) {
        for( int j = 1; j < 10; j++) {
            if(i*j == n) {
                cout << "Yes" << endl;
                return ;
            }
        }
    }
    cout << "No" << endl;
    return ;
}

int main() {
    input();
    solve();

}


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

int main() {
	int n;
	cin >> n;
	vector<vector<int> > arr(n, vector<int> (3));
	vector<vector<int> > dp(n, vector<int> (3));

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 3; j++) {
			cin >> arr[i][j];
		}
	}
	for(int i = 0; i < 3; i++) {
		dp[0][i] = arr[0][i];
	}
	for(int i = 1; i < n; i++) {
		for(int j = 0; j < 3; j++) {
			dp[i][j] = arr[i][j] + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]);
		}
	} cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]))<< endl;
	return 0;
}


Measured memory_bytes: 13184
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<queue>
#define int long long
#define mod (int)(1000000007)
using namespace std;
int test[213456], aa[213456];

signed main() {
	int n, a = 1234567890, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> test[h];
	}
	sort(test, test + n);
	for (int h = 0; h < n - 1; h++) {
		if (abs((double)test[n - 1] / 2 - test[h]) < a) {
			a = abs((double)test[n - 1] / 2 - test[h]);
			ans = test[h];
		}
	}
	cout << test[n - 1] << ' ' << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
char check[5] =  {'M', 'A', 'R', 'C', 'H'};
ull cnt[5] = {0,0,0,0,0};

ull com(ull n){
    return n*(n-1)*(n-2)/6;
}

int main(){
    int n;
    ull ans=0;
    ull CNT1=0,CNT2=0,multi=1,sum=0;
    string s[100005] = {};

    
    cin>>n;
    rep(i,0,n){
        cin>>s[i];
        rep(j,0,5){
            if (s[i][0] == check[j]){
                cnt[j]++;
            }
        }
    }

    ans += cnt[0] * cnt[1] * cnt[2];
    ans += cnt[0] * cnt[1] * cnt[3];
    ans += cnt[0] * cnt[1] * cnt[4];
    ans += cnt[0] * cnt[2] * cnt[3];
    ans += cnt[0] * cnt[2] * cnt[4];
    ans += cnt[0] * cnt[3] * cnt[4];
    ans += cnt[1] * cnt[2] * cnt[3];
    ans += cnt[1] * cnt[2] * cnt[4];
    ans += cnt[1] * cnt[3] * cnt[4];
    ans += cnt[2] * cnt[3] * cnt[4];

    cout<<ans<<endl;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int n,m,u,v;
vector<int> adj[N];
bool vis[N];
deque<int> ans;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	while (m--){
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	int ok=1,pos=1;
	while (ok){
		ok=0;
		ans.push_back(pos);
		vis[pos]++;
		for (int &nxt : adj[pos]){
			if (!vis[nxt]){
				ok=1;
				pos=nxt;
			}
		}
	}
	ok=0;
	for (int &nxt : adj[1]){
		if (!vis[nxt]){
			pos=nxt;
			ok=1;
		}
	}
	while (ok){
		ok=0;
		ans.push_front(pos);
		vis[pos]++;
		for (int &nxt : adj[pos]){
			if (!vis[nxt]){
				ok=1;
				pos=nxt;
			}
		}
	}
	cout << ans.size() << "\n";
	int first=1;
	while (!ans.empty()){
		if (!first){
			cout << " ";
		}else{
			first--;
		}
		cout << ans.front();
		ans.pop_front();
	}
	cout << "\n";
}

Measured memory_bytes: 6764
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT
 
using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;
 
template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }
 
int n;
int m;
 
int main () {
    string s;
    cin >> s;
    int ans = 700;
    for (int i = 0; i < 3; i++) ans += int (s[i] == 'o') * 100;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 基本はdouble
//map<キー,値> p は辞書。p[キー] = 値
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}


int main() {
	int N; cin >> N;
	cout << N * (N + 1) / 2 << endl;
}

Measured memory_bytes: 256
var

  S : ansistring;
  
begin

  readln(S);
  
  while s <> '' do

    if (pos('dreamereraser',s)=1) then
      delete(s,1,13)
    else if (pos('dreamererase',s)=1) then
      delete(s,1,12)
    else if (pos('dreameraser',s)=1) then 
      delete(s,1,11)
    else if (pos('dreamerase',s)=1) then
      delete(s,1,10)
    else if (pos('dreamer',s)=1) then
      delete(s,1,7)
    else if (pos('eraser',s)=1) then
      delete(s,1,6)
    else if (pos('dream',s)=1) then
      delete(s,1,5)
    else if (pos('erase',s)=1) then
      delete(s,1,5)
    else
    begin
      writeln('NO');
      halt;
    end;

    
    writeln('YES');

end.

Measured memory_bytes: 1380
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;



void solve() {
	ll n, k; cin >> n >> k;
	ll le = -1, ri = (1e+18) + 1;
	while (ri - le > 1) {
		ll mid = (le + ri) / 2;
		ll sum = mid;
		ll cur = mid/2;
		for (ll i = 1; i < n; i++) {
			sum += cur;
			cur /= 2;
			if (cur == 0)break;
		}
		if (sum > k)ri = mid;
		else le = mid;
	}
	cout << le << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(4);
	//init();
	solve();
	stop
		return 0;
}



Measured memory_bytes: 3212
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        
        if(a <= b && b <= c && a <= c){
            System.out.println(a + " " + b + " " + c);

        } else if (a <= c && c <= b && a <= b){
        System.out.println(a +" "+ c +" "+ b);

    } else if (b <= a && b <= c && c <= a){
        System.out.println(b +" "+ c +" "+ a);

    } else if (b <= a && a <= c && b <= c){
        System.out.println(b +" "+ a +" "+ c);

    } else if (c <= b && b <= a && c <= a){
        System.out.println(c +" "+ b +" "+ a);

    } else if (c <= a && c <= b && a <= b){
        System.out.println(c +" "+ a +" "+ b);

    } else{
    }
}
}


Measured memory_bytes: 26192
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, D, i, X[200001], Y[200001], ans=0;

    cin >> N >> D;

    for(i=1; i<=N; i++){
        cin >> X[i] >> Y[i];

        if(X[i]*X[i]+Y[i]*Y[i]<=D*D) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int s1s2s3;
  int x;
  int y;
  int z;
  cin >> s1s2s3;
  x = s1s2s3/100;
  y = s1s2s3/10 - 10*x;
  z = s1s2s3 - 100*x -10*y;
  cout << x + y + z << endl;
}


Measured memory_bytes: 3536
/*** akshaykumar99 ***/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long INF = INT_MAX;
const long long LINF = LLONG_MAX;
const long long N = 1e5+1;
 
typedef int ll;
typedef long double ld;  

void test_case()
{
    ll a,b;
    cin >> a >> b;
    ll c = a*b;
    cout << c<<'\n';
    
}

int32_t main()
{
    IOS(); 
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	//C問題

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int k,x;

		k = scanner.nextInt();
		x = scanner.nextInt();

		if (500 * k >= x) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

struct Music {
	std::string name;
	int time;
};
int main() {
	int n; std::cin >> n;
	std::vector<Music> musics(n);
	for (auto& m : musics) std::cin >> m.name >> m.time;
	std::string x; std::cin >> x;
	int time = 0;
	for (auto i = 0; i < n; ++i) {
		if (musics[i].name == x) {
			for (auto j = i + 1; j < n; ++j) {
				time += musics[j].time;
			}
			break;
		}
	}
	std::cout << time << std::endl;
}


Measured memory_bytes: 888
from collections import defaultdict
import sys

def soinsuu(soinsuu_dic, num):
    for i in range(2, int(num ** 0.5) + 1):
        while num % i == 0:
            num //= i
            soinsuu_dic[i] += 1
    if num > 1:
        soinsuu_dic[num] += 1
    return soinsuu_dic

def main():
    num = int(input())
    data = list(input())

    now_ele = 0
    ans = now_ele
    for ele in data:
        if ele == 'I':
            now_ele += 1
        else:
            now_ele -= 1
        ans = max(ans, now_ele)

    print(ans)




if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
n, m, c = map(int, input().split())
B = list(map(int, input().split()))

num = 0

for _ in range(n):
    A = list(map(int, input().split()))
    ans = [a*b for (a, b) in zip(A, B)]
    if sum(ans)+c > 0:
        num += 1

print(num)


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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
int main() {
  int h,w;cin>>h>>w;
  vector<string> g(h);
  REP(i,h){
    string s;cin>>s;
    g[i]=s;
  }
  vector<bool> hh(h);
  vector<bool> ww(w);
  string white=string(w,'.');
  REP(i,h){
    hh[i]=(g[i]==white);
  }
  REP(j,w){
    bool lines=true;
    REP(i,h){
      if(g[i][j]!='.'){
        lines=false;
      }
    }
    ww[j]=lines;
  }
  REP(i,h){
    if(hh[i])continue;
    REP(j,w){
      if(ww[j])continue;
      cout << g[i][j];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
int main(void){
    char s[7];
    scanf("%s",&s);
    if(strcmp(s,"Sunny")==0){
        printf("Cloudy");
    }
    if(strcmp(s,"Cloudy")==0){
        printf("Rainy");
    }
    if(strcmp(s,"Rainy")==0){
        printf("Sunny");
    }
}

Measured memory_bytes: 256
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5)+1)):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo

import collections

N,P = map(int,input().split())

memo = prime(P)

c = collections.Counter(memo)

ans = 1

for key,value in c.items():
    if N <= value:
        ans *= key**(value//N)
print(ans)

Measured memory_bytes: 66020
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
struct node{
	int x;
	node *l,*r,*p;
};
node* root=NULL;
void insert(int x){
	node *n=(node*)malloc(sizeof(node));
	n->x=x;
	n->r=n->l=NULL;
	node *tmp=root,*fa=NULL;
	while(tmp!=NULL){
		fa=tmp;
		if (x<tmp->x) tmp=tmp->l; 
		else tmp=tmp->r;
	}
	n->p=fa;
	if (fa==NULL){
		root=n;
	}
	else{
		if (x<fa->x) fa->l=n;
		else fa->r=n;
	}	
}
node *find(int k){
	node *T=root;
	while (T!=NULL){
		if (k<T->x) T=T->l;
		else if (k>T->x) T=T->r;
		else return T;
	}
	return NULL;
}
node *findmin(node *T){
	if (T->l!=NULL) return findmin(T->l);
	else return T;
}
void dele(node *tar){
	node *tmp,*son;
	if (tar->l==NULL||tar->r==NULL) tmp=tar;
	else tmp=findmin(tar->r);
	if (tmp->l!=NULL) son=tmp->l;
	else son=tmp->r;
	if (son!=NULL) son->p=tmp->p;
	if (tmp->p==NULL) root=son;
	else if (tmp==tmp->p->l) tmp->p->l=son;
	else tmp->p->r=son;
	if (tmp!=tar) tar->x=tmp->x;
}
void ino(node *T){
	if (T!=NULL){
		ino(T->l);
		printf(" %d",T->x);
		ino(T->r);
	}
}
void pre(node *T){
	if (T!=NULL){
		printf(" %d",T->x);
		pre(T->l);
		pre(T->r);
	}
}
main(){
	int n,xx;
	string ins;
	scanf("%d",&n);
	for (int i=0;i<n;i++){
		cin>>ins;
		if (ins=="insert"){
			scanf("%d",&xx);
			insert(xx);
		}
		else if (ins=="find"){
			scanf("%d",&xx);
			if (find(xx)!=NULL) printf("yes\n");
			else printf("no\n");
		}
		else if (ins=="delete"){
			scanf("%d",&xx);
			dele(find(xx));
		}
		else if (ins=="print"){
			ino(root);printf("\n");
			pre(root);printf("\n");
		}
	}
}


Measured memory_bytes: 22068
import numpy as np
from scipy.sparse import csr_matrix, csgraph
N, X, Y = map(int, input().split())
data = [1] * N
row = list(range(N - 1)) + [X - 1]
column = list(range(1, N)) + [Y - 1]
graph = csr_matrix((data, (row, column)), dtype=np.int32, shape=(N, N))
dists = csgraph.shortest_path(graph.toarray(), directed=False).astype(np.int32)
print(*np.bincount(np.triu(dists).ravel(), minlength=N)[1:], sep="\n")

Measured memory_bytes: 99312
#include <iostream>

int main(int argc, const char * argv[]) {
    int K,A,B;
    bool isOK=false;
    std::cin >> K;
    std::cin >> A >> B;
    
    for(int i=A;i<=B;i++){
        if(i%K==0){
            isOK=true;
            break;
        }
    }
    
    // insert code here...
    if(isOK){
        std::cout << "OK";
    }else{
        std::cout << "NG";
    }
    
    return 0;
}

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

    const int maxn=1e5+7;
    int dp[maxn];

    int a[maxn];

    int main (){
        int tmp=6,cnt=0;
        a[cnt++]=1;
        while(tmp<=100000){
            a[cnt++]=tmp;
            tmp*=6;
        }
        tmp=9;
        while(tmp<=100000){
            a[cnt++]=tmp;
            tmp*=9;
        }
        sort(a,a+cnt);
        int n;cin>>n;
        memset(dp,0x3f3f3f3f,(n+3)*sizeof(int));
        dp[0]=0;
        for(int i=0;i<cnt;i++){
            for(int j=a[i];j<=n;j++)
                dp[j]=min(dp[j],dp[j-a[i]]+1);
        }
        cout<<dp[n]<<endl;
        return 0;
    }


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// 入力受付
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int array[] = new int[n];
		for(int i = 0; i < n; i++){
			array[i] = i+1;
		}

		int counter = 0;

		for(int num: array){
			if(num % 2 != 0){
				counter++;
			}
		}

		System.out.println((double)counter / n);

	}
}

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

int main(void){
    int N; cin >> N;
    set<int> A;
    int free=0;

    for(int i=0; i<N; i++){
        int x; cin >> x;
        if(x>=3200) free++;
        else A.insert(x/400);
    }

    cout << max(1, (int)A.size()) << " " << A.size()+free << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> as(n);
    int sum = 0;
    for (auto& a : as)
    {
        cin >> a;
        sum += a;
    }
    int min_diff = numeric_limits<int>::max();
    int min_index = -1;
    for (int i = 0; i < n; i++)
    {
        auto diff = abs(sum - as[i] * n);
        if (min_diff > diff)
        {
            min_diff = diff;
            min_index = i;
        }
    }
    cout << min_index << endl;
}


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

int string_check(string &p_s){
    int count = 0;
    int n = (int)p_s.length();
    for(int i=0;i < n; i++){
        if(i >= n-i-1) break;
        if(p_s[i] == p_s[n-i-1] && i != n-i-1){
            count++;
        }
    }
    return (n-count*2) / 2;
}
int main(){
    string s = "";
    cin >> s;
    int count = string_check(s);
   cout << count << '\n';
   
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a,b,sum=0;

		String s;
		char k;
		a = sc.nextInt();
		s = sc.next();
		b = sc.nextInt();
		

		k = s.charAt(b-1);

		
		for(int i=0;i<a;i++)
		{
			char t = s.charAt(i);
			if(t != k)
			{
				System.out.print("*");
			}
			else
			{
				System.out.print(k);
			}
		}
				
		
	}
}

Measured memory_bytes: 23636
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
dx = [-1, 0, 1]
dy = [-1, 0, 1]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            for d_x in dx:
                for d_y in dy:
                    if 0 <= i + d_x < h and 0 <= j + d_y < w and s[i + d_x][j + d_y] != '#':
                        if s[i + d_x][j + d_y] == '.':
                            s[i + d_x][j + d_y] = 1
                        else:
                            s[i + d_x][j + d_y] += 1

for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            s[i][j] = 0
        print(s[i][j], end='')  # 改行せずにprint
    print()

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

void chmin(int64_t& a, int64_t b){
    a = min(a, b);
}
void chmax(int64_t& a, int64_t b){
    a = max(a, b);
}

int N;
string S;
vector<int> edges[2000];

int64_t dpmax[2000], dpmin[2000];
int num[2000];
int64_t res = 0;

void dfs(int i, int p){
    for(int j : edges[i]){
        if(j == p) continue;
        dfs(j, i);
        num[i] += num[j];
        dpmax[i] += dpmax[j];
    }
    if(edges[i].size() >= 2){
        dpmin[i] = dpmax[i] % 2;
        for(int j : edges[i]){
            if(j == p) continue;
            int64_t cand = dpmin[j] + dpmax[j] - dpmax[i];
            chmax(dpmin[i], cand);
        }
    }else{
        dpmin[i] = dpmax[i];
    }

    if(p == -1) return;
    if(S[i] == '1') num[i]++;
    dpmax[i] += num[i];
    dpmin[i] += num[i];
    res += num[i];
}

int main(){
    cin >> N >> S;
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    const int64_t INF = 1e18;
    int64_t ans = INF;
    for(int i=0; i<N; i++){
        fill(dpmin, dpmin+N, 0);
        fill(dpmax, dpmax+N, 0);
        fill(num, num+N, 0);
        res = 0;

        dfs(i, -1);
        if(dpmin[i] == 0){
            //cerr << "R"<< i+1 << " " << res << endl;
            chmin(ans, res/2);
        }
        //cerr << "\n----\n";
    }
    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>

int main(){
  char N[300000];
  int S=0;
  scanf("%s",N);
  int l=strlen(N);
  for(int i=0;i<l;i++){
   S+=(int)(N[i]-'0'); 
  }
  if(S%9==0) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 1832
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

const string t[4] = {"maerd", "remaerd", "esare", "resare"};




int main() {
  string S;
  cin >> S;
  reverse(all(S));

  bool f = true;

  for (int i = 0; i < S.size();) {
    bool g = false;
    rep(j, 4) {
      if (S.substr(i, t[j].size()) == t[j]) {
        g = true;
        i += t[j].size();
      }
    }
    if (!g) {
      f = false;
      break;
    }
  }

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


}


Measured memory_bytes: 512
s=input()
t=[s[0]]

if len(s)==1:
    print(1)
    exit()
i=1
while 1:
    tmp=""
    while tmp=="" or tmp==t[-1]:
        tmp+=s[i]
        i+=1
        if i==len(s):
            if t[-1]!=tmp:
                t.append(tmp)
            print(len(t))
            exit()
    t.append(tmp)


Measured memory_bytes: 56396
n = int(input())
a = [int(_) for _ in input().split()]
ans = a[0]
for i in a:
    if i == 0:
        print(0)
        exit()
for i in range(1, len(a)):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 21692
/*#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
*/
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

int N;
ll A, B;
ll h[100000];

bool f(ll mid) {
    ll tmp = 0;
    for (int i = 0; i < N; i++) {
        ll hi = h[i] - mid * B;
        if (hi > 0) {
            tmp += (hi + A - B - 1)/(A-B);
        }
    }
    return tmp <= mid;
}

int main() {
    cin >> N;
    cin >> A >> B;
    for (int i = 0; i < N; i++) cin >> h[i];


    ll lb = 0;
    ll rb = 1e10;
    while (rb - lb > 1) {
        ll mid = (rb+lb)/2;
        if (f(mid)) rb = mid;
        else lb = mid;
    }

    cout << rb << endl;


}


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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))

int main(){
    FAST
    int n; cin >> n;
    int cnt[n + 1];
    mm(cnt);
    for(int i = 1; i < n; i++){
        int a; cin >> a;
        cnt[a]++;
    }
    for(int i = 1; i <= n; i++){
        cout << cnt[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4364
import collections
import bisect


N, M = map(int, input().split())
P = [list(map(int, input().split())) for _ in range(M)]
a = collections.defaultdict(list)
for x, y in sorted(P):
    a[x] += [y]
for x, y in P:
    idx = bisect.bisect(a[x], y)
    print(str(x).zfill(6), str(idx).zfill(6), sep='')


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

char cad[200];

int main()
{
	int maxi = -1;
	int n;
	scanf("%d", &n);
	map<string, int> mapa;
	for(int i = 0 ; i < n; i++)
	{
		scanf("%s", cad);
		maxi = max(maxi, ++mapa[string(cad)]);
	}

	for(const auto p: mapa)
	{
		if(p.second == maxi)
			printf("%s\n",p.first.c_str());
	}
	
	return 0;
}

Measured memory_bytes: 23808
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int n;
	long long tmp, sum = 0;
	vector<long long> a;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> tmp;
		a.push_back(tmp);
		sum += tmp;
	}
	cout << *min_element(a.begin(),a.end()) << " "
		 << *max_element(a.begin(),a.end())	<< " "
		 << sum << endl;
	return 0;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string S;cin >> S;
    bool ans = true;
    bool on = true;
    rep(i,S.size()){
        if(on && S[i] == 'h'){
            on = false;
        }
        else if(!on && S[i] == 'i'){
            on = true;
        }
        else{
            ans = false;
        }
    }

    if(!on){
        ans = false;
    }

    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
from copy import copy
import random
random.seed(1)
import math
import sys
input = sys.stdin.readline
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(D)]
last = [0]*26
ans = [0]*D
score = 0
for i in range(D):
    ps = [0]*26
    for j in range(26):
        pl = copy(last)
        pl[j] = i+1
        ps[j] += s[i][j]
        for k in range(26):
            ps[j] -= c[k]*(i+1-pl[k])
    idx = ps.index(max(ps))
    last[idx] = i+1
    ans[i] = idx+1
    score += max(ps)
for k in range(1,40001):
    na = copy(ans)
    x = random.randint(1,365)
    y = random.randint(1,365)
    na[x-1] = na[y-1]
    last = [0]*26
    ns = 0
    for i in range(D):
        last[na[i]-1] = i+1
        ns += s[i][na[i]-1]
        for j in range(26):
            ns -= c[j]*(i+1-last[j])
    if k%100 == 1:
        T = 3000-(2998*k/40000)
    p = pow(math.e,-abs(ns-score)/T)
    if ns > score or random.random() < p:
        ans = na
        score = ns
for a in ans:
    print(a)

Measured memory_bytes: 88592
N, M = map(int, input().split())
if N > M:
    tmp = N
    N = M
    M = tmp

# N <= M としても一般性を失わない
if N == 1:
    if M == 1:
        print(1)
    elif M == 2:
        print(0)
    else:
        print(M-2)
elif N == 2:
    print(0)
else:
    print((N-2)*(M-2))

Measured memory_bytes: 3060
fun main() {
    val builder = StringBuilder()

    var ans = 1L

    readInputLine()

    readInputLine().split(" ").map { it.toLong() }.sorted().forEach {
        if (it == 0L) {
            println(0)
            return
        }
        if (it > 1000000000000000000L / ans) {
            println(-1)
            return
        }
        ans *= it
    }

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 64168
#include <stdio.h>
#define N 2000002
 
void counting(int[], int[], int);
int n;
int b[N];
int c[N];
 
int main() {
    int i;
    int a[N];
    int max;
 
    scanf("%d", &n);
    for(i = 1; i < n+1; i++) {
        scanf("%d", &a[i]);
    }
 
    max = a[0];
    i = 1;
    while(i < n+1) {
        if(max < a[i]) max = a[i];
        i++;
    }
 
    counting(a, b, max);
 
    return 0;
}
 
void counting(int a[], int b[], int k) {
    int i;
 
 
    for (i = 0; i < n; i++) {
        c[i] = 0;
    }
    for (i = 1; i < n+1; i++) {       // 出現数
        c[a[i]]++;
    }
    for (i = 1; i < k+1; i++) {       // 足していく
        c[i] += c[i-1];
    }
    for (i = n; i > 0; i--) {
        b[c[a[i]]] = a[i];
        c[a[i]]--;
    }
    for (i = 1; i < n; i++) {
        printf("%d ", b[i]);
    }
    printf("%d\n", b[n]);
}

Measured memory_bytes: 24036
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
}

signed main(){
  ll sum = 0;
  string s;
  cin >> s;
  rep(i,int(s.size())){
    sum += s[i] - '0';
  }
  if(sum%9==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3712
n, a, b = map(int, input().split())

DIVIDER = 10 ** 9 + 7
MAX_BIT = 64

flg_DIV = []
tmp = DIVIDER - 2
for i in range(MAX_BIT):
    flg_DIV.append(tmp % 2)
    tmp >>= 1

memo = [None] * (max(a, b) + 1)
    
def myinv(arg):
    global DIVIDER
    if memo[arg] != None: return memo[arg]
    pow_arg = []
    tmp = arg
    for i in range(MAX_BIT):
        pow_arg.append(tmp)
        tmp = (tmp * tmp) % DIVIDER
    #
    # print("##", arg, pow_arg)
    ret = 1
    for i in range(MAX_BIT):
        if flg_DIV[i]:
            ret = (ret * pow_arg[i]) % DIVIDER
    #
    memo[arg] = ret
    return ret

# def mydiv(arg_a, arg_b):
#     ret = (arg_a * myinv(arg_n)) % DIVIDER
#     return ret

# calc 2^n
flg_n = []
tmp = n
for i in range(MAX_BIT):
    flg_n.append(tmp % 2)
    tmp >>= 1

pow_2 = []
tmp = 2
for i in range(MAX_BIT):
    pow_2.append(tmp)
    tmp = (tmp * tmp) % DIVIDER

ans = 1
for i in range(MAX_BIT):
    if flg_n[i]:
        ans = (ans * pow_2[i]) % DIVIDER
# print("# 2^n =", ans)
        
# subtract nCa ans nCb
nCa = 1
for i in range(min(a, n - a)):
    nCa = (nCa * (n - i)) % DIVIDER
# print("# {0}C{1} =".format(n, a), nCa)
for i in range(min(a, n - a)):
    nCa = (nCa * myinv(i + 1)) % DIVIDER
# print("# {0}C{1} =".format(n, a), nCa)

nCb = 1
for i in range(min(b, n - b)):
    nCb = (nCb * (n - i)) % DIVIDER
# print("# {0}C{1} =".format(n, b), nCb)
for i in range(min(b, n - b)):
    nCb = (nCb * myinv(i + 1)) % DIVIDER
# print("# {0}C{1} =".format(n, b), nCb)
# print("#", 2, myinv(2), (2 * myinv(2)) % DIVIDER)

ans = (ans - nCa) % DIVIDER
ans = (ans - nCb) % DIVIDER
ans = max(0, ans - 1) # no flower

print(ans)

Measured memory_bytes: 48604
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = list(enumerate(iim()))

    A.sort(key=lambda x: (x[1], (2*x[0]-N)**2), reverse=True)

    dp = [0] * (N+1)
    dp0 = dp[:]
    for i, (j, ai) in enumerate(A):
        for k in range(i+1):
            dp[k] = max(dp[k], dp0[k] + abs(N-i+k-1-j) * ai)
            dp[k+1] = max(dp[k+1], dp0[k] + abs(k-j) * ai)
        dp, dp0 = dp0, dp

    print(max(dp0))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 10824
/*Ph@n^0m Dec0d3r*/
/*----------------*/
/* 	^_HAR HAR MAHADEV_^
   	|Om namah shivaya|
*/
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define fast std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pb(temp) push_back(temp)
#define mp make_pair
#define mod (ll)1000000007
//using namespace boost::multiprecision;
using namespace std ;
typedef unsigned long long int ulli;

ulli gcd(ulli x,ulli y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
ulli factorial(ulli n)
{
    if (n == 0)
    return 1;
    return n * factorial(n - 1);
}
ll findS(ll s)
{
	return (sqrtl(8*s + 1) - 1)/2;
}
ll prime(ll a){
    if(a==1)return 0;
    if(a==2 || a==3)return true;
    if(a%2==0 ||a%3==0)return 0;
    for(ll i=5;i<=sqrt(a);i+=6)
        if(a%i==0 || a%(i+2)==0)
            return 0;

    return 1;
}
ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2) % mod;
    p = (p * p) % mod;

    return (y%2 == 0)? p : (x * p) % mod;
}
ll powermod(ll x,ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll nCr(ll n,ll k)
{
    ll C[k+1];
    //memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%(ll)(1e9 + 7);
    }
    return C[k];
}
ll LOGN(ll n , ll r){
	return (n > r-1) ? (1 + LOGN(n / r , r)) : 0 ;
}
void dfs(vector<ll> v[], bool visited[], ll current_node){
	visited[current_node]=true;
	for(ll nxt_node : v[current_node]){
		if(visited[nxt_node]==false){
			dfs(v , visited, nxt_node);
		}
	}
	return;
}

void bfs(vector<ll> v[], bool visited[], ll root){

    int current_node;
    queue<int> q;

    q.push(root);

    while(!q.empty()){

        current_node=q.front();

        visited[current_node]=true;

        for(int x:v[current_node])
            if(!visited[x])
                q.push(x);
    }
}
ll computeXOR(ll n)
{
    switch(n & 3)
    {
    case 0: return n;     
    case 1: return 1;     
    case 2: return n + 1;
    case 3: return 0;    
    }
}
int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        if (arr[m] == x)
            return m;

        if (arr[m] < x)
            l = m + 1;

        else
            r = m - 1;
    }

    return -1;
}
int maxSubArraySum(int a[], int size)
{
   int max_so_far = a[0];
   int curr_max = a[0];
   for (int i = 1; i < size; i++)
   {
        curr_max = max(a[i], curr_max+a[i]);
        max_so_far = max(max_so_far, curr_max);
   }
   return max_so_far;
}
int main(){
	fast;
	string s[] = {"SAT","FRI","THU","WED","TUE","MON","SUN"} ;
	string in ;
	cin >> in ;
	int p = 0 ;
	while(in != s[p]){
		p ++ ;
	}
	cout << p+1 ;
}


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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

int hori[300001], vert[300001];

void solve(int tc) {
    int h, w, m;
    cin >> h >> w >> m;
    vt<pii> a(m);
    set<pii> s;
    for (pii &i : a) {
        cin >> i.fi >> i.se;
        s.emplace(i.fi, i.se);
        hori[i.fi]++, vert[i.se]++;
    }
    
    vt<int> mxHori, mxVert;
    int mxH = 0, mxV = 0;
    for (int i = 1; i <= h; i++) {
        if (hori[i] > mxH) {
            mxHori.clear();
            mxH = hori[i];
        }
        if (hori[i] == mxH) mxHori.push_back(i);
    }
    for (int i = 1; i <= w; i++) {
        if (vert[i] > mxV) {
            mxVert.clear();
            mxV = vert[i];
        }
        if (vert[i] == mxV) mxVert.push_back(i);
    }

    for (int i : mxHori) {
        for (int j : mxVert) {
            if (!s.count(pii(i, j))) {
                cout << mxH + mxV;
                return;
            }
        }
    }

    cout << mxH + mxV - 1;
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int tcs = 1;
    for (int tc = 1; tc <= tcs; tc++) solve(tc);
}


Measured memory_bytes: 26092