akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    long long int n=0;
    long long int a=0;
    long long int b=0;
    cin>>n;
    a=n;
    while(a!=0)
    {
        b=b+a%10;
        a=a/10;
    }
    if(n%b==0)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

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

#define S second
#define F first
#define int long long  

//////////

signed main()
{
    fastio;
    int n;
    cin>>n;
    string a,b,c;
    cin>>a>>b>>c;
    int ans=0;
    for(int i=0;i<n;++i)
    {
        if(a[i]==b[i]&&b[i]==c[i])
            continue;
        if(a[i]==b[i]||b[i]==c[i]||a[i]==c[i]){
            ans+=1;
            continue;
        }
        ans+=2;
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a;
    cin >> a ;
    //*/

    /*
    vector<int> vec(4);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    //*
    if( a < 1000 ){
        cout << "ABC" << endl;
    } else {
        cout << "ABD" << endl;
    }
    //*/
    
    //cout << max(a * b, max(a + b, a - b) ) << endl;

    return 0; 
}


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

const int MOD = 1e9 + 7;

int main() {
    int n, m; cin >> n >> m;
    vector<string> a(n);

    for (int i = 0; i < n; i += 1)
        cin >> a[i];

    vector<vector<int>> dp(n + 1, vector<int> (m + 1, 0));
    dp[1][1] = 1;

    for (int i = 1; i <= n; i += 1)
        for (int j = 1; j <= m; j += 1) {
            if (i + j == 2)
                continue;
            if (a[i - 1][j - 1] == '.')
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
        }

    cout << dp[n][m] << "\n";
}

Measured memory_bytes: 5248
#include <iostream>

using namespace std;

int main(){
	int a, b, c, d;
  	cin >> a >> b >> c >> d;
  	if ((abs(a - c) <= d) || (abs(a - b) <= d && abs(b - c) <= d)) cout << "Yes" << endl;
  	else cout << "No" << endl;
  	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	Scanner sc = new Scanner(System.in);

	int a = sc.nextInt();
	int b = sc.nextInt();	
	int d, r;
	double f;

	d = a / b;
	r = a % b;
	f = 1.0 * a / b;
	
	System.out.print(d);
	System.out.print(' ');
	System.out.print(r);
	System.out.print(' ');
	System.out.print(String.format("%.5f", f));
    }
}


Measured memory_bytes: 26488
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    int n = get<int>(), d = get<int>();
    vector<vector<int>> pts(n);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            pts[i].push_back(get<int>());
        }
    }

    int cnt = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i+1; j < n; j++) {
            int acc = 0;
            for (int k = 0; k < d; k++) {
                acc += pow(pts[i][k] - pts[j][k], 2);
            }
            int s = (int) sqrt(acc);
            if (s * s == acc)
                cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
using namespace std;
#pragma warning (disable: 4996)

int N, dist[100009]; vector<pair<int, int>>x[100009];
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>Q;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { x[i].push_back(make_pair((i + 1) % N, 1)); if (i != 0)x[i].push_back(make_pair((i * 10) % N, 0)); }
	for (int i = 0; i < N; i++) dist[i] = 999999999;
	Q.push(make_pair(0, 0));
	while (!Q.empty()) {
		int pos = Q.top().first, tm = Q.top().second; Q.pop();
		for (int i = 0; i < x[pos].size(); i++) {
			int to = x[pos][i].first;
			if (dist[to] > tm + x[pos][i].second) { dist[to] = tm + x[pos][i].second; Q.push(make_pair(to, dist[to])); }
		}
	}
	cout << dist[0] << endl;
	return 0;
}

Measured memory_bytes: 8308
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim q As Long = NextInt()
        Dim h As Long = NextInt()
        Dim s As Long = NextInt()
        Dim d As Long = NextInt()
        Dim n As Long = NextInt()

        For Each v As Long In New Long() {4 * q, 2 * h}
            s = Math.Min(s, v)
        Next

        WriteLine(Math.Min(2 * s, d) * (n \ 2) + s * (n Mod 2))
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module


Measured memory_bytes: 19920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
// for文短縮類
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
// iteratorのbeginとendをまとめて渡す
#define ALL(x) (x).begin(), (x).end()
//略
#define PB push_back  // vectorヘの挿入
#define MP make_pair  // pairのコンストラクタ
#define F first       // pairの一つ目の要素
#define S second      // pairの二つ目の要素
//出力
#define COUT(x) cout << (x) << endl
#define SCOUT(x) cout << (x) << " "
#define ENDL cout << endl
/************ Combination wtih MOD ************
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// preprocess for some tables
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
// combination
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
*******************************************************/
/********** UnionFind ***************
struct UnionFInd {
vector<ll> par;
UnionFInd(ll N) : par(N) {
for (ll i = 0; i < N; i++) {
par[i] = i;
}
}
ll root(ll x) {
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(ll x, ll y) {
ll rx = root(x);
ll ry = root(y);
if (rx == ry) return;
par[rx] = par[ry];
}
bool same(ll x, ll y) {
ll rx = root(x);
ll ry = root(y);
return rx == ry;
}
};
*************************************/
/***********************************
ll gcd(ll a, ll b) {
  if (a < b) {
    swap(a, b);
  }

  ll r = a % b;
  while (r > 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
***********************************/
int main(int argc, char *argv[]) {
  // input高速化。cinとcoutの結合解除。scanfとprintfは使えない。
  cin.tie(0);
  ios_base::sync_with_stdio(0);

  ll m;
  cin >> m;
  vector<ll> d(m);
  vector<ll> c(m);
  REP(i, m){
      ll di, ci;
      cin >> di >> ci;
      d[i] = di;
      c[i] = ci;
  }

  ll ketasu = accumulate(ALL(c), 0LL);
  ll s = 0;

  REP(i, m){
      s += d[i] * c[i];
  }

  cout << (ketasu - 1) + (s - 1) / 9 << endl;
}

Measured memory_bytes: 6300
#include<stdio.h>
#include<math.h>

int p_number(int x){
	int i;
	double r;
	if(x<2){
		return 0;
	}else if(x==2){
		return 1;
	}else if(x%2 == 0){
		return 0;
	}

	r = sqrt(x);

	for(i=3;i<=r;i+=2){
		if(x%i==0)
			return 0;
	}

	return 1;
}


int main(){
	int num;
	int i,count=0;
	int input;

	scanf("%d",&num);
	for(i=0;i<num;i++){
		scanf("%d",&input);
		count += p_number(input);
	}

	printf("%d\n",count);

	return 0;
}


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

// from https://cp-algorithms.com/algebra/fft.html

using cd = complex<double>;
const double PI = acos(-1);

void fft(vector<cd> & a, bool invert) {
    int n = a.size();
    if (n == 1)
        return;

    vector<cd> a0(n / 2), a1(n / 2);
    for (int i = 0; 2 * i < n; i++) {
        a0[i] = a[2*i];
        a1[i] = a[2*i+1];
    }
    fft(a0, invert);
    fft(a1, invert);

    double ang = 2 * PI / n * (invert ? -1 : 1);
    cd w(1), wn(cos(ang), sin(ang));
    for (int i = 0; 2 * i < n; i++) {
        a[i] = a0[i] + w * a1[i];
        a[i + n/2] = a0[i] - w * a1[i];
        if (invert) {
            a[i] /= 2;
            a[i + n/2] /= 2;
        }
        w *= wn;
    }
}

vector<long long> multiply(vector<int> const& a, vector<int> const& b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    int n = 1;
    while (n < a.size() + b.size()) 
        n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);

    vector<long long> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}

const int P = 200003, g = 2;

int main() {
    int modlog[P], modexp[P];
    for (long long m = 1, e = 0; e < P - 1; e++, m = m * g % P) {
        modlog[m] = e;
        modexp[e] = m;
    }
    int n; cin >> n;
    vector<int> p(P, 0);
    vector<long long> a;
    for (int i = 0; i < n; i++) {
        long long x; cin >> x;
        if (x == 0) continue;
        a.push_back(x);
        p[modlog[x]]++;
    }
    n = a.size();
    // for (int i = 0; i < 5; i++) cerr << p[i] << ' ' ; cerr << endl;
    vector<long long> q = multiply(p, p);
    // for (int i = 0; i < 10; i++) cerr << q[i] << ' ' ; cerr << endl;
    long long ans = 0;
    for (int i = 0; i < q.size(); i++) {
        int j = i % (P - 1);
        ans += q[i] * modexp[j];
    }
    for (int i = 0; i < n; i++) ans -= a[i] * a[i] % P;
    cout << ans/2 << endl;
}


Measured memory_bytes: 40144
N=int(input())
B=list(map(int, input().split()))  #複数数値入力

A=[]
A.append( B[0] )

if (N>=3):
  for i in range(N-2):
    A.append(min(B[i], B[i+1]))

A.append( B[-1] )
print(sum(A))

Measured memory_bytes: 3060
#include <cstdio>
#define MOD 1000000007
typedef long long ll; 
ll pw[2005], dp[2005][2005]; 
int main()
{
	// freopen("ARC068-F.in", "r", stdin); 
	int n, k; 
	scanf("%d%d", &n, &k); 
	pw[0] = 1; 
	for (int i = 1; i <= n; i++)
		pw[i] = pw[i - 1] * 2 % MOD; 
	ll ans = 0; 
	for (int i = 2; i <= n; i++)
		dp[1][i] = 1; 
	for (int i = 1; i < k - 1; i++)
	{
		ll sum = dp[i][n - i + 1]; 
		for (int j = n - i; j >= 2; j--)
		{
			(sum += dp[i][j]) %= MOD; 
			(dp[i + 1][j] += sum) %= MOD; 
		}
	}
	for (int i = 2; i <= n; i++)
		(ans += dp[k - 1][i]) %= MOD; 
	if (k == 1)
		ans = 1; 
	if (n == k)
		printf("%lld\n", ans);
	else
		printf("%lld\n", ans * pw[n - k - 1] % MOD);
	return 0; 
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int k;
    string s;
    cin >> s >> k;
    int n=s.size();
    int x;

    for(int i=0; i<n; i++){
        if(s[i]=='a') continue;
        x=26-(s[i]-'a');
        if(x<=k){
            s[i]='a';
            k-=x;
        }
    }

    x=(s[n-1]-'a'+k)%26;
    s[n-1]='a'+x;

    cout << s << endl;
    
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define be(v) v.begin(), v.end()

int fizzbuzz(int a) {
	if(a%3==0) return 0;
	else if(a%5==0) return 0;
	else return a;
}

int main() {
	int n; cin >> n;
	long long int ans = 0;
	for(int i=1;i<=n;i++) {
		ans+=fizzbuzz(i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
using namespace std;
class union_find {
    vector<int> parent_;
public:
    union_find(int n) : parent_(n) { for (int i = 0; i < n; i++) parent_[i] = i; }
    int find(int x) { if (parent_[x] == x) return x; else return parent_[x] = find(parent_[x]); }
    bool same(int x, int y) { return find(x) == find(y); }
    void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; parent_[x] = y; }
};
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> P(N);
    union_find u(N);
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        P[i] = p-1;
    }
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        u.unite(x-1, y-1);
    }
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (u.same(i, P[i])) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 1024
loop do
    a = gets.split.map(&:to_i).map {|x| x > 10 ? 10 : x}
    break if a == [0]
    s = a.inject(:+)
    ace = a.count(1)
    while ace > 0 and s + 10 <= 21
        s += 10
        ace -= 0
    end
    if s > 21
        puts 0
    else
        puts s
    end
end


Measured memory_bytes: 6872
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int k,a,b;cin>>k>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
}

Measured memory_bytes: 3660
n=int(input())
s=0
for i in range(1,int(n**0.5)+1):
  m=n//i
  s+=i*m*(m+1)//2
mx=n
for i in range(1,int((n-1)**0.5)+1):
  mn=max(n//(i+1),int(n**0.5))
  s+=i*(i+1)*(mx*(mx+1)-mn*(mn+1))//4
  mx=mn
print(s)
  

Measured memory_bytes: 66652
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int main() {
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  int y=x%10;
  if(y==2||y==4||y==5||y==7||y==9)cout<<"hon\n";
  else if(y==0||y==1||y==6||y==8)cout<<"pon\n";
  else cout<<"bon\n";
 	return 0;
}

Measured memory_bytes: 3648
/// You just can't beat the person who never gives up
/// ICPC next year

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ;

int n ,k ,arr[N] ;
bool ok[N] ;
int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;++i) scanf("%d",arr+i);
    sort(arr,arr+n);
    for(int i=0;i<n;++i){
        long long sum = arr[i] ;
        int j = 0 ;
        while(sum<k && j<i) sum += arr[j++] ;
        if(sum<k) continue ;
        if(sum-arr[i]<k) ok[i] = 1 ;
        for(int u=0;u<j;++u){
            if(sum-arr[u]<k) ok[u] = 1 ;
        }
    }
    int ans = 0 ;
    for(int i=0;i<n;++i) ans += ok[i]==0 ;
    cout << ans;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  i64 N, A, B;
  cin >> N >> A >> B;
  i64 c = N / (A + B);
  i64 ans = 0;
  ans += c * A;
  i64 rest = N - c * (A + B);
  ans += min(A, rest);
  cout << ans << endl;
}


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

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define REP(i,n) for (ll i = 0; i < n; ++i)

const ll MAX = 1e5+10;
const ll MOD = 1e9+10;

ll N;
vii ps;
map<ii, int> m;
set<ii> s;

int check (int p, int q) {
    int ans = 0;
    for(auto itr = s.begin(); itr != s.end(); itr++) {
        ii key = *itr;
        int pp = key.first+p;
        int qq = key.second+q;
        ans += min(m[make_pair(pp,qq)], m[key]);
    }
    return N-ans;
}

int main() {
    cin >> N;
    REP (i, N) {
        ll x, y;
        cin >> x >> y;
        ii p = make_pair(x,y);
        ps.push_back(p);
        m[p]++;
        s.insert(p);
    }

    int ans = N;
    REP (a, N) {
        REP (b, N) {
            if (a == b) continue;
            int p = ps[a].first - ps[b].first;
            int q = ps[a].second - ps[b].second;
            ans = min(ans, check(p,q));
        }
    }
    cout << ans << endl;
}

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

int a,b,n,c,ok,s;

int main()
{
	cin>>a>>b;
	c=b;
	while (c>0)
	{
		c/=10;
		n++;
	}
	s=1;
	for (int i=1;i<=n;i++) s*=10;
	if (trunc(sqrt(a*s+b))*trunc(sqrt(a*s+b))!=a*s+b) cout<<"No";
	else cout<<"Yes";
	cout<<endl;
	return 0;
}

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

int array[101];
int bf,af,last = 0;
char num[101];

void push(int x){
    array[last] = x;
    last++;
}

int pop(){
    --last;
    return array[last];
}

int main(){
    
    while(scanf("%s", num) != EOF){

        if(num[0] == '+'){
            push(pop() + pop());
        } else if(num[0] == '-'){
            af=pop();
            bf=pop();
            push(bf - af);
        } else if(num[0] == '*'){
            push(pop() * pop());
        } else {
            push(atoi(num));
        }

    }
    printf("%d\n", array[0]);
    return 0;
}


Measured memory_bytes: 2100
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
#debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()

    # 5桁以上
    if N == 10**5:
        print(90909)
        return
    # 5桁
    if N > 9999:
        print(N-10000+1+909)
        return

    # 4桁
    if N > 999:
        print(900+9)
        return

    # 3桁
    if N > 99:
        print(N-100+1 + 9)
        return

    # 2桁
    if N > 9:
        print(9)
        return

    # 1桁
    print(N)


solve()

Measured memory_bytes: 3064
n, k = (int(char) for char in input().split())
d = [int(i) for i in input().split()]

'''
n = 10
k = 8
d = [0, 2, 3]
'''
D = [i for i in range(10)]

like_vals = [int(str(i)) for i in D if i not in d]

i = 0

n = [int(str(n)[i]) for i in range(len(str(n)))]
r = [-1] * len(n)
while i < len(n):
    if n[i] in like_vals:
        r[i] = n[i]
        i += 1
    elif n[i] < max(like_vals):
        like_bigger = [like_val for like_val in like_vals if like_val > n[i]]
        r[i] = min(like_bigger)
        for j in range(i + 1, len(n)):
            r[j] = min(like_vals)
        break
    else:
        r = [-1] * (len(n) + 1)
        if min(like_vals) != 0:
            r[0] = min(like_vals)
        else:
            r[0] = min([like_val for like_val in like_vals if like_val != 0])

        for j in range(1, len(n) + 1):
            r[j] = min(like_vals)
        break

newr = ""
for _r in r:
    newr += str(_r)
newr = int(newr)
print(newr)

Measured memory_bytes: 3064
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
ans = 0
for a in range(1,K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      ans += gcd(a,b,c)

print(ans) 


Measured memory_bytes: 69636
N = input()
K = int(input())
m = len(N)
dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(m + 1)]
dp[0][0][0] = 1

for i in range(1, m + 1):
    l = int(N[i - 1])
    for k in range(K + 1):
        dp[i][1][k] += dp[i - 1][1][k]
        if l != 0:
            dp[i][1][k] += dp[i - 1][0][k]
        else:
            dp[i][0][k] += dp[i - 1][0][k]
        if k - 1 >= 0:
            dp[i][1][k] += 9 * dp[i - 1][1][k - 1]
            if l != 0:
                dp[i][0][k] += dp[i - 1][0][k - 1]
                dp[i][1][k] += (l - 1) * dp[i - 1][0][k - 1]

print(dp[m][0][K] + dp[m][1][K])



Measured memory_bytes: 38256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//
#define int long long
#define ALL(x) (x).begin(), (x).end()
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))
//
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
//
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int H, W, a;
int d[11][11];

signed main() {
  cin >> H >> W;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> d[i][j];
    }
  }
  for (int k = 0; k < 10; k++) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  int sum = 0LL;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a;
      if (a >= 0)
        sum += d[a][1];
    }
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
ll inf = 1e10;
ll w[105], v[105];
ll dp[300005] = {};
ll d[200005];
vector<int> g[100005];
ll rec(int x) {
	if (d[x] > 0) {
		return d[x];
	}
	ll mx = 0;
	for (int i = 0; i < g[x].size(); i++) {
		mx = max(mx,rec(g[x][i])+1);
	}
	d[x] = mx;
	return mx;
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		g[x].push_back(y);
	}
	for (int i = 0; i < n; i++) {
		d[i] = 0;
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans = max(ans, rec(i));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9472
#include <algorithm>
#include <iostream>
#include <stdio.h>

#define MAX_N 200'000

typedef long long ll;

using namespace std;

int X[MAX_N];
int _X[MAX_N];

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> X[i];
    _X[i] = X[i];
  }
  sort(_X, _X + N);
  int m = N / 2;
  for (int i = 0; i < N; ++i) {
    if (X[i] >= _X[m]) {
      printf("%d\n", _X[m - 1]);
    } else {
      printf("%d\n", _X[m]);
    }
  }
}

Measured memory_bytes: 4756
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define ll long long
#define Test int t;cin>>t;while(t--)
#define endl "\n"
#define PI acos(-1)
using namespace std;
const int dx[]={-1,-1,-1,0,0,0,1,1,1};
const int dy[]={-1,0,1,-1,0,1,-1,0,1};
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll lcm(ll a,ll b){
    return a*b/__gcd(a,b);
}
bool prime (int x){
    for(int i=2;i*i<=x;i++){
        if(x%i==0)return 0;
    }
    return 1;
}
int main()
{
    fast();
    string s;
    int k;
    cin>>k>>s;
    k--;
    for(int i=0;i<s.size();i++){
        if(i<=k)cout<<s[i];
        else break;
    }
    k++;
    if(k<s.size())cout<<"...";
    return 0;
}


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

using namespace std;
	
const int maxn = 1e5 + 20;
int ar[maxn];

int main()
{
	string a;
	cin >> a;
	long long b=0,c=1,ans=0;
	for(int i=a.size()-1;i>=0;i--)
	{
		b+=c*(int)(a[i]-'0');
		ans+=9*c;
		c*=10;
	}
	int d=1;
	for(int i = 0; i < 10; i++) 
    {
        if(ans <= b)
        {
            cout << 9 * a.size() - i ;
            break;
        }
        ans -= pow(10, a.size() - 1);
    }
	
}		

 



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

public class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		char ch[] = new char[1200];
		int exist[] = new int[26];
		int index;
		String str;
		
		while((str = buf.readLine()) != null){
			if(str.length() >= 1200){
				break;
			}
			
			ch = str.toCharArray();
			
			for(char c : ch){
				if(Character.isUpperCase(c)){
					index = (int)(c - 'A');
					exist[index] ++;
				}
				else if(Character.isLowerCase(c)){
					index = (int)(c - 'a');
					exist[index] ++;
				}
			}
		}
		for(int i = 0; i < 26; i++){
			char c = (char)('a' + i);
			System.out.println(c + " : " + exist[i]);
		}
	}
}

Measured memory_bytes: 24336
while True:
    a, b, c = input().split()
    a = int(a)
    c = int(c)
    if b == "?":
        break
    if b == "+":
        print(a + c)
    if b == "-":
        print(a - c)
    if b == "/":
        print(a // c)
    if (b == "*"):
        print(a * c)


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

int main() {
    long N = 0;
    cin >> N;
    
    vector<int> nums(N);
    rep(i, N) cin >> nums[i];

    vector<int> sorted_nums(N);
    sorted_nums = nums;

    sort(sorted_nums.begin(), sorted_nums.end());
    
    int count = sorted_nums[N/2] - sorted_nums[N/2-1];
    printf("%d ", count);
}

Measured memory_bytes: 1024
#pragma GCC optimize("O2")

#include <bits/stdc++.h>
#ifdef DEBUG
    #include "debug.hpp"
#endif

using namespace std;

#define all(c) (c).begin(), (c).end()
#define traverse(c, it) for(auto it = (c).begin(); it != (c).end(); it++)
#define rep(i, N) for(int i = 0; i < (N); i++)
#define rep1(i, N) for(int i = 1; i <= (N); i++)
#define rep2(i, s, e) for(int i = (s); i <= (e); i++)
#define rep3(i, s, e, d) for(int i = (s); (d) >= 0 ? i <= (e) : i >= (e); i += (d))
#define pb push_back


#ifdef DEBUG
    #define debug(x...) {dbg::depth++; string dbg_vals = dbg::to_string(x); dbg::depth--; dbg::fprint(__func__, __LINE__, #x, dbg_vals);}
    #define light_debug(x) {dbg::light = 1; dbg::dout << __func__ << ":" << __LINE__ << "  " << #x << " = " << x << endl; dbg::light = 0;}
#else
    #define debug(x...)
    #define light_debug(x) 
#endif

template<typename T>
T& ckmin(T& a, T b){ return a = a > b ? b : a; }

template<typename T>
T& ckmax(T& a, T b){ return a = a < b ? b : a; }

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

int N;
long double dp[301][301][301];
bool ch[301][301][301];

long double rec(int one, int two, int three){
	int zero = N - one - two - three;
	if(zero == N) return 0;
	if(ch[one][two][three]) return dp[one][two][three];
	ch[one][two][three] = 1;
	long double p0 = (long double)zero / N;
	long double p1 = (long double)one / N;
	long double p2 = (long double)two / N;
	long double p3 = (long double)three / N;

	long double ans = 1;
	if(one) ans += p1 * rec(one - 1, two, three);
	if(two) ans += p2 * rec(one + 1, two - 1, three);
	if(three) ans += p3 * rec(one, two + 1, three - 1);
	ans *= (long double)1 / (1 - p0);
	return dp[one][two][three] = ans;
}

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    #ifdef DEBUG
        freopen("debug", "w", stderr);
    #endif

   	cin >> N;
   	int cnt[4];
   	memset(cnt, 0, sizeof cnt);
   	rep(i, N){
   		int a;
   		cin >> a;
   		cnt[a]++;
   	}
    
   	cout << fixed << setprecision(16) << rec(cnt[1], cnt[2], cnt[3]) << '\n';
    #ifdef DEBUG
        dbg::dout << "\nExecution time: " << clock() << "ms\n";
    #endif

    return 0;
}


Measured memory_bytes: 227280
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long double n,k;
    cin>>n>>k;
    long double sum=0;
    for (long double i = 1; i <=n ; ++i) {
//        long long int z=ceil((log(k)-log(i))/log(2));

long long int z=0;
while (pow(2,z)*i<k)
{
    z++;
}
        if(z<0)
            z=0;
        sum+=pow(0.5,z);
    }

    sum/=n;
    cout<<fixed<<setprecision(11)<<sum;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

class Wear{
public:
  int lower_temperature;
  int upper_temperature;
  int gaudiness;
  Wear(int _l,int _u, int _g)
    : lower_temperature(_l),upper_temperature(_u),gaudiness(_g) {}
  Wear() : lower_temperature(0),upper_temperature(0),gaudiness(0){}
};

int main(){
  int total_days;
  int total_wears;
  while(~scanf("%d %d",&total_days,&total_wears)){

    int temperatures[201];
    for(int day=0;day<total_days;day++){
      scanf("%d",temperatures+day);
    }

    Wear wears[201];
    for(int wear_idx=0;wear_idx<total_wears;wear_idx++){
      int lower_temperature,upper_temperature;
      int gaudiness;
      scanf("%d %d %d",&lower_temperature,&upper_temperature,&gaudiness);
      wears[wear_idx] = Wear(lower_temperature,upper_temperature,gaudiness);
    }

    int dp[201][201];
    memset(dp,0,sizeof(dp));

    for(int day = 0; day<total_days; day++){
      for(int from_idx = 0; from_idx < total_wears; from_idx++){
	for(int to_idx = 0; to_idx < total_wears; to_idx++){
	  if(day+1 < total_days
	     && (temperatures[day+1] < wears[to_idx].lower_temperature
		 || wears[to_idx].upper_temperature < temperatures[day+1])) continue;
	  
	  if(temperatures[day] < wears[from_idx].lower_temperature
	     || wears[from_idx].upper_temperature < temperatures[day]) continue;

	  int from = wears[from_idx].gaudiness;
	  int to = wears[to_idx].gaudiness;
	  dp[day+1][to_idx] = max(dp[day+1][to_idx],
				  dp[day][from_idx] + abs(from-to));
	}
      }
    }

    int res = 0;
    for(int wear_idx=0;wear_idx < total_wears;wear_idx++){
      res = max(res,dp[total_days-1][wear_idx]);
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 1356
n, x = map(int, input().split())
a = [int(i) for i in input().split()]
l = len(a)

ans = 0

for i in range(l-1):
    a_0 = a[i]
    a_1 = a[i+1]
    dif = x - a_0
    if a_1 > dif:
        ans += a_1 - dif
        if dif > 0:
            a[i+1] = dif
        else:
            a[i+1] = 0

print(ans)


Measured memory_bytes: 14052
Module Module1
    Dim ary( , ), ary1, ary2, str1, str2
    Dim i, j, j0, k, sm, sm1, myRw, myCl, myCl0 As Integer

    Sub Main()
        myCl0 = 2
'        j0 = 4
'        j0 = InputBox("j0")
        j0 = Console.ReadLine
        
        ReDim ary(1, j0 - 1)
        
'        str1 = InputBox("str1")
        str1 = Console.ReadLine
        ary1 = Split(str1)
'        str2 = InputBox("str2")
        str2 = Console.ReadLine
        ary2 = Split(str2)
        
        For j = 0 To j0 - 1
            ary(0, j) = Int(ary1(j))
            ary(1, j) = Int(ary2(j))
        Next

'        Randomize
        For i = 0 To 1
            For j = 0 To j0 - 1
'                ary(i, j) = Int(9 * Rnd + 1)
'                Cells(i + 1, j + 1 + myCl0) = ary(i, j)
            Next j
        Next i

        sm = 0
        myRw = 4
        For k = j0 - 1 To 0 Step -1
            sm1 = 0
            
            myCl = myCl0
            For j = 0 To j0 - 1
                If j <= k Then
                    sm1 = sm1 + ary(0, j)
'                    Cells(myRw, j + 1 + myCl) = ary(0, j)
                End If
                If j = k Then myCl = myCl + 1
                If j >= k Then
                    sm1 = sm1 + ary(1, j)
'                    Cells(myRw, j + 1 + myCl) = ary(1, j)
                End If
            Next j
            
 '           Cells(myRw, 1) = sm1
            
            If sm < sm1 Then sm = sm1
            myRw = myRw + 1
        Next k
    
'        MsgBox sm
        Console.WriteLine(sm)
    End Sub
End Module

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

int eucliwood(int x, int y) {
  if (y == 0)
    return x;
  else
    return eucliwood(y, x % y);
}

signed main() {
  int a, b, c, d, e, f;
  std::cin >> a >> b >> c >> d >> e >> f;
  vi waterVec;
  REP(i, f + 1) REP(j, f + 1) {
    if ((100 * i * a) + (100 * j * b) > f)
      continue;
    waterVec.PB((100 * i * a) + (100 * j * b));
  }
  vi sugarVec;
  REP(i, f + 1) REP(j, f + 1) {
    if ((c * i) + (d * j) > f)
      continue;
    sugarVec.PB((c * i) + (d * j));
  }
  int total = 100 * a, s = 0;
  for (auto &water : waterVec) {
    for (auto &sugar : sugarVec) {
      if (water + sugar > f || water * e < sugar * 100 || water + sugar == 0)
        continue;
      if (s * (water + sugar) <= total * sugar) {
        s = sugar;
        total = water + sugar;
      }
    }
  }
  std::cout << total << " " << s << std::endl;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
int a[3];
string s;
char c[]={'+','-'};
void dfs(int x,int d){
  if(d==3){
    if(x==7){
      string t;
      r(i,3)t+=c[a[i]];
      cout<<s[0];
      r(i,3)cout<<t[i]<<s[i+1];
      cout<<"=7"<<endl;
      exit(0);
    }
  }
  else{
    a[d]=0;
    dfs(x+s[d+1]-'0',d+1);
    a[d]=1;
    dfs(x-(s[d+1]-'0'),d+1);
  }
}
int main(){
  cin>>s;
  dfs(s[0]-'0',0);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int cooking_time[5];

    for(int i = 0; i < 5; i++){
        cin >> cooking_time[i];
    }
    
    int min_penalty_index = 0;
    for(int i = 1; i < 5; i++){
        if((cooking_time[i] - 1) % 10 < (cooking_time[min_penalty_index] - 1) % 10){
            min_penalty_index = i;
        }
    }

    int total_time = 0;
    
    for(int i = 0; i < 5; i++){
        if(i != min_penalty_index){
            total_time += cooking_time[i];
            while(total_time % 10 != 0){
                total_time += 1;
            }
        }
    }

    total_time += cooking_time[min_penalty_index];

    cout << total_time << endl;

    return 0;

}


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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << endl;

char b[13];
int main() {
  ll N, M;


  CIN(N >> M);

  pair<ll, ll> p[M];
  pair<ll, ll> p_su[M];
  ll P, Y;
  for (int i = 0; i < M; i++) {
    CIN(P >> Y);

    p[i] = {P , Y};
    p_su[i] = {P, Y};
  }

  sort(p , p + M);

  string s1, s2;

  ll count = 1;
  ll ken = 0;
  ll city = 0;
  ll f, s;
  map<ll, map <ll, ll> > m;
  for (int i = 0; i < M; i++) {
    f = p[i].first;
    s = p[i].second;

    if (ken != f) {
      count = 1;
      ken = f;
    }

    m[f][s] = count;

    count++;
  }

  for (int i = 0; i < M; i++) {
    cout << setfill('0') << std::right << std::setw(6) << p_su[i].first;
    cout << setfill('0') << std::right << std::setw(6) << m[p_su[i].first][p_su[i].second];
    cout << endl;
  }


  return 0;
}


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

int main(){

    int round;
    cin >> round;
    int house;
    cin >> house;

    int pos[house];
    int pos_max = 0;
    for(int i=0; i<house; i++){
        cin >> pos[i];
        if((i != 0) && (pos[i]-pos[i-1] > pos_max))
            pos_max = pos[i] - pos[i-1];
    }
    if(round-pos[house-1]+pos[0] > pos_max)
        pos_max = round-pos[house-1]+pos[0];

    cout << round - pos_max << endl;

}

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


int main() {
  long long A, B, C;
  cin >> A >> B >> C;
  if(A%2==0||B%2==0||C%2==0) cout << 0 << endl;
  else cout << min({A*B, B*C, A*C}) << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vec p(A), q(B), r(C);
    Rep (i, A) {
        cin >> p[i];
    }
    Rep (i, B) {
        cin >> q[i];
    }
    Rep (i, C) {
        cin >> r[i];
    }

    sort(r.begin(), r.end(), greater<ll>());
    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());

    vec a;
    Rep (i, X) a.push_back(p[i]);
    Rep (i, Y) a.push_back(q[i]);
    Rep (i, C) a.push_back(r[i]);

    sort(a.begin(), a.end(), greater<ll>());

    // for (ll e : a) cout << e << " ";
    // cout << "\n";

    ll ans = 0;
    Rep (i, X+Y) {
        ans += a[i];
    }

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

Measured memory_bytes: 8304
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
LL t[1010];
LL a[1010];
int main(){
    int n;
    cin >> n;

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

    LL nt = t[0];
    LL na = a[0];
    for(int i = 1; i < n; ++i){
        if(nt <= t[i] && na <= a[i]){
            nt = t[i];
            na = a[i];
            continue;
        }
        LL t0 = nt / t[i];
        LL a0 = na / a[i];
        LL ta = max(t0, a0);
        LL t00 = t[i] * ta;
        LL a00 = a[i] * ta;
        if(nt <= t00 && na <= a00){
            nt = t00;
            na = a00;
            continue;
        }  
        t00 += t[i];
        a00 += a[i];  
        if(nt <= t00 && na <= a00){
            nt = t00;
            na = a00;
            continue;
        }      
    }
    cout << nt + na << endl;
    
    return 0;
}

/*
5
3 10    3 10
48 17   48 17
31 199  62 398
231 23  4158 414
3 2     4158 2772
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;
int dy[] = {0, 1, 0, -1};
int dx[] = {1, 0, -1, 0};

int main() {
    int n, a[100001], b[100001], ans = 0;
    cin >> n;
    rep(i, n) {
        cin >> a[i];
    }
    llong needed_point = 0;
    llong extra_point = 0;
    vector<int> E;
    rep(i, n) {
        cin >> b[i];
        if (b[i] > a[i]) {
            needed_point += b[i] - a[i];
            ++ans;
        } else if (b[i] < a[i]) {
            extra_point += a[i] - b[i];
            E.push_back(a[i] - b[i]);
        }
    }
    if (needed_point == 0) {
        cout << 0 << endl;
        return 0;
    }

    sort(E.begin(), E.end(), greater<int>());
    if (needed_point > extra_point) {
        cout << "-1" << endl;
        return 0;
    } else {
        for (auto itr = E.begin(); itr != E.end(); ++itr) {
            ++ans;
            if (needed_point - *itr <= 0) break;
            needed_point -= *itr;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1404
n=int(input())
S=["".join(sorted(input())) for _ in range(n)]
D={}
for i in S:
    if i not in D:
        D[i]=1
    else:
        D[i]+=1
ans=0
for i in D.values():
    ans+=(i*(i-1))//2
print(ans)

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int x;
  cin >> x;
  if (x < 1200) {
    cout << "ABC";
  } else {
    cout << "ARC";
  }
}

Measured memory_bytes: 256
#include <stdio.h>

void BubbleSort(char c[], int a[], int n);
void SelectionSort(char c[],int a[],int n);
int isStable(char c[], int a[],char oc[],int oa[], int N);

int main(void){
	
	int n;
	scanf("%d",&n);
	
	int a[n];
	char c[n];
	char s[3];
	
	int i;
	
	for(i=0;i<n;i++){
		scanf("%s",s);
		c[i] = s[0];
		a[i] = s[1]-48;
	}
	
	/*for(i=0;i<n;i++){
		printf("%c%d ",c[i],a[i]);
	}
	printf("\n");
	*/
	BubbleSort(c, a, n);
	SelectionSort(c, a, n);

	return 0;
}

void BubbleSort(char c[], int a[], int n)
{

	int i,j;
	int t;
	char tc;
	
	char oc[n];
	int oa[n];
	
	for(i=0;i<n;i++){
		oc[i] = c[i];
		oa[i] = a[i];
	}
	
	for(i=0;i<n;i++){
		for (j = n-1; j > i; j--) {
			if( oa[j] < oa[j-1]) {
				t= oa[j];
				oa[j]=oa[j-1];
				oa[j-1]=t;
				tc= oc[j];
				oc[j]=oc[j-1];
				oc[j-1]=tc;
			}
		}
	}

	for(j=0; j<n; j++) {
		if(j>0){
			printf(" ");
		}
		printf("%c%d",oc[j],oa[j]);
	}
	
	printf("\n");
	
	if(isStable(c,a,oc,oa,n)==0){
		printf("Not stable\n");
	}
	else{
		printf("Stable\n");
	}

}

void SelectionSort(char c[],int a[],int n)
{

	int i,j;
	int t;
	char tc;
	int min, mini;
	
	char oc[n];
	int oa[n];
	
	for(i=0;i<n;i++){
		oc[i] = c[i];
		oa[i] = a[i];
	}
	
	for(i=0;i<n;i++){
		min = oa[i];
		mini = i;
		for (j = i+1; j < n; j++) {
			if( min > oa[j]) {
				min = oa[j];
				mini = j;
			}
		}
		if(i==mini){
			;
		}
		else{
			
			t = oa[i];
			oa[i] = min;
			oa[mini] = t;
			tc = oc[i];
			oc[i] = oc[mini];
			oc[mini] = tc;
			
		}
	}

	for(j=0; j<n; j++) {
		if(j>0){
			printf(" ");
		}
		printf("%c%d",oc[j],oa[j]);
	}
	
	printf("\n");
	
	if(isStable(c,a,oc,oa,n)==0){
		printf("Not stable\n");
	}
	else{
		printf("Stable\n");
	}

}

int isStable(char c[], int aa[],char oc[],int oa[], int N)
{
	int i,j,a,b;
	
	for (i = 0; i<N; i++)
	{
		for (j = i+1; j<N; j++) {
			for( a = 0; a< N; a++) {
				for( b = a+1; b<N-1; b++) {
					if (aa[i] == aa[j]  && c[i] == oc[b] && c[j] == oc[a] && aa[i] == oa[b] && aa[j] == oa[a]) {
						return 0;
					}
					
				}
			}
		}
	}
	
	return 1;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    ll ans = 1e18;
    ll l = 0, r = 0;
    rep(i, n) r += a[i];

    rep(i, n - 1) {
        r -= a[i];
        l += a[i];

        ans = min(ans, abs(r - l));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
n = int(input())
Sn = [input()for i in range(1,n+1)]

C0 = Sn.count('AC')
C1 = Sn.count('WA')
C2 = Sn.count('TLE')
C3 = Sn.count('RE')

print('AC x '+str(C0))
print('WA x '+str(C1))
print('TLE x '+str(C2))
print('RE x '+str(C3))

Measured memory_bytes: 16184
n=int(input())
f=0
l=[]
a=list(input())
l.append(a)
for i in range(n-1):
    b=list(input())
    if b in l:
        f+=1
    l.append(b)
    if a[len(a)-1]!=b[0]:
        f+=1
    a=b
    
if f>0:
    print('No')
else:
    print('Yes')
    

Measured memory_bytes: 3060