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 rrep(i, n) for(int i=((int)(n)-1); i>=0; i--)
#define REP(i, k, n) for(int i=(int)(k); i<(int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const int INF = INT_MAX;
const ll inf = 1e18;
const ll mod = 998244353;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

int main(){
	int N, M; cin >> N >> M;
	int ans = 0;
	int H[N];
	rep(i, N) cin >> H[i];
	vector<int> G[N];
	rep(i, M){
		int a, b; cin >> a >> b;
		a--; b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	rep(i, N){
		int f = 0;
		rep(j, G[i].size()){
			int to = G[i][j];
			if(H[to] >= H[i]) f = 1;
		}
		if(!f) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9152
#include<bits/stdc++.h>
#define Rint register int 
using namespace std;
const int N = 1000003;
int n, ans, q[N], front, rear;
char s[N], t[N];
int main(){
	scanf("%d%s%s", &n, s + 1, t + 1);
	if(!strcmp(s + 1, t + 1)){puts("0"); return 0;}
	int cur = n;
	for(Rint i = n;i;i --){
		if(t[i] == t[i - 1]) continue;
		while(cur && (cur > i || s[cur] != t[i])) -- cur;
		if(!cur){puts("-1"); return 0;}
		while(front < rear && q[front] - (rear - front) >= i) ++ front;
		if(cur != i) q[rear ++] = cur;
		ans = max(ans, rear - front + 1);
	}
	printf("%d", ans);
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	ll n, m;
	ll x, y;
	ll a, b, d;
	ll h;
	ll k;
	string s, t;
	//char c;
	ll c;
	ll l_ans = 0;
	string s_ans = "NG";

	cin >> a >> b >> c;

	if (a > b) {
		l_ans += b;
		if (a > c) {
			l_ans += c;
		}
		else {
			l_ans += a;
		}
	}
	else {
		l_ans += a;
		if (b > c) {
			l_ans += c;
		}
		else {
			l_ans += b;
		}
	}

	cout << l_ans << "\n";

	return;
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(7);

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
namespace FastIO
{
	static char c;
	template<typename T>
	inline void read(T& x)
	{
		x=0,c=getchar();
		while(!isdigit(c))c=getchar();
		while(isdigit(c))x=x*10+c-'0',c=getchar();
	}
}
using FastIO::read;

int n,cnt[105],mx;

int main()
{
	read(n);
	for(int i=1,a;i<=n;i++)read(a),cnt[a]++,mx=max(mx,a);
	mx++;
	if(mx&1)
	{
		if(!cnt[mx/2])return puts("Impossible"),0;cnt[mx/2]--;
		for(int i=mx/2+1;i<mx;i++)
		{
			if(cnt[i]<2)return puts("Impossible"),0;
			cnt[i]-=2;
		}
	}
	else for(int i=mx/2;i<mx;i++)
	{
		if(cnt[i]<2)return puts("Impossible"),0;
		cnt[i]-=2;
	}
	mx--;
	if(mx&1)mx=mx/2+2;else mx=mx/2+1;
	for(int i=1;i<mx;i++)if(cnt[i])return puts("Impossible"),0;
	return puts("Possible"),0;
}

Measured memory_bytes: 256
count = 0
n = gets.chomp.to_i
array = gets.split(" ").map{|x| x.to_i}
 
i = 0
while i<n
  j = n-1
  while j > i
    if array[j] < array[j-1]
      array[j],array[j-1] = array[j-1],array[j]
      count = count+1
    end  
    j = j-1
  end
  i=i+1
end
 
i = 0
while i < n 
  print array[i] 
  if i+1 != n
  print " "
  end
  i = i+1
end
print "\n"
print count
print "\n"

Measured memory_bytes: 6108
// #pragma GCC optimize("Ofast")

// #pragma GCC optimize("no-stack-protector")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>

using namespace std;

template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}

template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}
#define left left228
#define right right228
#define ld long double
#define list list228
// #define prev prev228
#define mp make_pair
#define list list228
#define all(v) v.begin(), v.end()


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = (int)s.size();
    if (n & 1) {
        cout << "No\n";
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        if ((i & 1)) {
            if (s[i] != 'i') {
                cout << "No\n";
                return 0;
            }
        } else {
            if (s[i] != 'h') {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

/*
3
1 1 2
2 2 2
3 3 2
2 1 1
3 2 1


2 2
1 1 2
2 2 2
1 2 3
2 1 1

2
2 1 2 2 3
2 2 2 1 1

бархатом обитый гроб
5
1 2
2 3
3 4
3 5
1
2 3
1 2
4 3
2 3 5

*/




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3820
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))

distance = [0] * N

for i in range(N - 1):
  distance[i] = A[i + 1] - A[i]

distance[-1] = K + A[0] - A[-1]

print(K - max(distance))


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

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

    int x;
    int num = 0;
    for (int i = 1; i <= N; i++)
    {
        cin >> x;
        if (2 * x >= 2 * (K - x))
        {
            num += 2 * (K - x);
        }
        else
        {
            num += 2 * x;
        }
    }

    cout << num << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	k--;
	n--;
	if(n%k==0)
		cout<<n/k;
	else
		cout<<n/k+1;
}

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

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

int main() {
  int r, g;
  scanf("%d\n%d", &r, &g);

  printf("%d\n", (g*2-r));
  return 0;
}

Measured memory_bytes: 128
i = 100
for i in range (i):
    a_list = [str(x) for x in input().split()]
    a = int(a_list[0])
    b = int(a_list[2])
    op = a_list[1]
    if op == '+':
        ab = a + b
        print(ab)
        i = i + 1
        continue
    elif op == '-':
        ab = a - b
        print(ab)
        i = i + 1
        continue
    elif op == '*':
        ab = a * b
        print(ab)
        i = i + 1
        continue
    elif op == '/':
        ab = a // b
        print(ab)
        i = i + 1
        continue
    elif op == '?':
        exit()



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

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

    bool expo[X+1]={false};
    expo [1]=true;

    for(int b=2;b<=X;b++){ 
        int v = b*b;
        while(v<=X){
            expo[v] = true; v *= b;
        } 
    }
    for(int i=X;i>=1;i--)if(expo[i]){
        cout<<i<<endl;
        return 0;
    }
} 


Measured memory_bytes: 256
let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs

let () = Scanf.scanf "%d\n" @@ fun n ->
  let csfs =
    Array.to_list @@
      Array.init (n - 1) @@ fun _ ->
        Scanf.scanf "%d %d %d\n" @@ fun c s f -> c, s, f in
  select csfs
  |> List.rev
  |> List.map (fun (_, _, csfs) -> csfs)
  |> (fun csfss -> csfs :: csfss)
  |> List.map
      (List.fold_left (fun t (c, s, f) ->
        c + max ((t + f - 1) - (t + f - 1) mod f) s) 0)
  |> List.iter (Printf.printf "%d\n")



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

int main() {
  int a,b,c,n=0;
  cin>>a>>b>>c;
  if (a==b && b==c)
	  cout<<1;
	else if (a==b ||b==c ||a==c)
	  cout<<2;
	else
	  cout<<3;  

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
using namespace std;
int main()
{
	int a, b, c;
	// 整数の入力
	int n;
	cin >> n;
	int ai[100] = {};
	int aj[100] = {};
	int sum = 0;
	int ans = 0;
	// スペース区切りの整数の入力
	for (a = 0; a < n; a++)
	{
		cin >> ai[a];
		sum += ai[a];
	}
	for (a = 0; a < n; a++)
	{
		cin >> aj[a];
	}
	sum += aj[n - 1];
	ans = sum;
	for (a = n - 1; a >= 1; a--)
	{
		sum = sum - ai[a] + aj[a - 1];
		ans = max(ans, sum);
	}
	// 出力
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	string a, b,keta[5];
	int ans[4],kt[5];
	while (1) {
		for (int i = 0; i <= 5; i++) {
			kt[i] = 1;
		}
		cin >> a >> b;
		if (a == "0"&&b == "0") {
			goto a;
		}
		for(int i=0;i<=3;i++){
			keta[i] = a[i];
		}
		ans[1] = 0;
		ans[2] = 0;
		for (int i = 0; i <= 3; i++) {
			if (a[i] == b[i]) {
				ans[1] = ans[1] + 1;
				kt[i] = 0;
			}
		}
		for (int i = 0; i <= 3; i++) {
			for (int z = 0; z <= 3; z++) {
				if (a[i] == b[z]) {
					if (kt[z]) {
						ans[2] = ans[2] + 1;
					}
				}
			}
		}
		cout << ans[1] << " " << ans[2] << endl;
	}
a:;
}


Measured memory_bytes: 3088
#include<stdio.h>
int main(void){
    int a,b,c,tmp;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b) tmp=a,a=b,b=tmp;
    if(b>c) tmp=b,b=c,c=tmp;
    if(a>b) tmp=a,a=b,b=tmp;
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
typedef long long ll;

long long INF = 1e18;

int main(){
    unsigned long long n,a,b;
    cin>>n>>a>>b;
    ll c = n/(a+b);
    ll d = n - (c * (a + b));
    if(n-(c*(a+b)) > a){
        d = a;
    }
    cout << (c * a) + d << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    K = len(set(A))
    if K % 2 == 1:
        ans = K
    else:
        ans = K - 1

    print(ans)
    return


if __name__ == '__main__':
    main()


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll s; cin >> s;
  vll ans(1000000);
  ans[0] = s;
  for(ll i = 1;i < 100000;i++)
  {
    if(ans[i-1] % 2 == 0) ans[i] = ans[i-1] / 2;
    else ans[i] = 3 * ans[i-1] + 1;
  }
  for(ll i = 1;i < 1000000;i++)
  {
    for(ll j = i - 1;j >= 0;j--)
    {
      if(ans[i] == ans[j])
      {
        fin(i + 1)
        exit(0);
      }
    }
  }
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 8064
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    number = int(input())

    lucas_numbers = [2, 1]

    if number >= 2:
        for i in range(2, number + 1):
            new_value = lucas_numbers[i - 1] + lucas_numbers[i - 2]
            lucas_numbers.append(new_value)

        print(lucas_numbers[number])
    else:
        print(lucas_numbers[1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX_N 201
#define MAX_R 8
#define INF 10000000000001
long long M;
long long R;
long long N;
vector<long long> r(MAX_R);
ll d[MAX_N][MAX_N];
ll dd[MAX_N][MAX_N];
ll res = INF;

void warshall_floyd() {
	for (int k = 1; k <= N; k++) 
		for (int i = 1; i <= N; i++) 
			for (int j = 1; j <= N; j++) d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
}

ll perm[MAX_N];
void permutation(int n) {
	for (int i = 0; i < n; i++) {
		perm[i] = i;
	}
	do {
		ll now = 0;
		for (int i = 0; i < n-1; i++) {
			now += d[r[perm[i]]][r[perm[i+1]]];
		}
		res = min(now, res);
	} while (next_permutation(perm, perm + n));
	return ;
}

int main(){	
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<long long> B(M-1+1);
	vector<long long> A(M-1+1);
	vector<long long> C(M-1+1);
	scanf("%lld",&R);
	
	for(int i = 0 ; i <= R-1 ; i++){
		scanf("%lld",&r[i]);
	}

	for(int i = 0 ; i <= MAX_N-1 ; i++){
		for(int j = 0 ; j <= MAX_N-1 ; j++){
			if (i == j) d[i][j] = 0; else d[i][j] = INF;
		}
	}
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&A[i]);
		scanf("%lld",&B[i]);
		scanf("%lld",&C[i]);
		d[A[i]][B[i]] = C[i];
		d[B[i]][A[i]] = C[i];
	}
	// cout << d[1][3] << endl;
	warshall_floyd();
	// cout << d[1][3] << endl;
	permutation(R);
	cout << res << endl;

	return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

const ll pow9 = 1e9;

ll dp[51][51];

//-------------------------------------------------

int main(void)
{
    int N; cin>>N;
    vll a(N,0LL);
    rep(i,N){
        string s; cin>>s;
        int pos;
        if ((pos = s.find("."))!=string::npos){
            string t = s.substr(0,pos);
            a[i]+=pow9*stoll(t);
            ll m=100000000;
            pos++;
            while(pos<s.size()){
                a[i]+=m*(s[pos]-'0');
                m/=10;
                pos++;
            }
        }else{
            a[i]=pow9*stoll(s);
        }
    }
    vector<pi> vec;
    rep(i,N){
        ll tmp = a[i];
        int cnt2=0,cnt5=0;
        while(tmp%2==0){
            cnt2++;
            tmp/=2;
        }
        while(tmp%5==0){
            cnt5++;
            tmp/=5;
        }
        dp[cnt2][cnt5]++;
        vec.pb({cnt2,cnt5});
    }
    rep(i,50)RFOR(j,49,0) dp[i][j]+=dp[i][j+1];
    rep(j,50)RFOR(i,49,0) dp[i][j]+=dp[i+1][j];
    // rep(i,50){
    //     rep(j,50){
    //         cout<<dp[i][j]<<" ";
    //     }cout<<endl;
    // }
    ll ans=0;
    for(auto v:vec){
        int x = max(0,18-v.fi);
        int y = max(0,18-v.se);
        ans+=dp[x][y];
        if (v.fi>=x && v.se>=y) ans--;
    }
    cout<<ans/2<<endl;
    return 0;
}


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

namespace _0049
{
    class Program
    {
        static void Main(string[] args)
        {
            string temp = "";
            string[] studentData = new string[2];
            string[] bloodType = new string[4] { "A","B","AB","O" };
            int[] member = new int[4] { 0, 0, 0, 0 };
            while ((temp = Console.ReadLine()) != null)
            {
                studentData = temp.Split(',');
                for (int i = 0; i < 4; i++)
                {
                    if (studentData[1] == bloodType[i])
                    {
                        member[i] += 1;
                    }
                }
            }
            foreach (int item in member)
            {
                Console.WriteLine(item);
            }
        }
    }
}



Measured memory_bytes: 15864
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    p = 1
    ans = 0
    while True:
        if p >= B:
            print(ans)
            break
        p -= 1
        p += A
        ans += 1
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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

int main() {
    int n, m;
    cin >> n >> m;
    pair<int, int> p[n];
    rep(i, n) cin >> p[i].first >> p[i].second;
    sort(p, p + n);

    ll ans = 0, cnt = 0;
    rep(i, n) {
        rep(j, p[i].second) {
            ans += p[i].first;
            cnt++;
            if (cnt >= m) break;
        }

        if (cnt >= m) break;
    }

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


Measured memory_bytes: 4284
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorders
{
	public class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			var dic = new Dictionary<int, int>();
			for (int i = 0; i < n; i++) {
				if (dic.ContainsKey(a[i])) {
					dic[a[i]]++;
				} else {
					dic[a[i]] = 1;
				}
			}

			long ans = 0;
			foreach (int key in dic.Keys) {
				if (dic[key] > key) {
					ans += dic[key] - key;
				} else if(dic[key] < key) {
					ans += dic[key];
				}
			}

			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 32476
// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
//#define _GLIBCXX_DEBUG//only for debugging
/*BISMILLAH UR RAHMAN*/ 
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<fixed<<setprecision(10);
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define debug(x) std::cerr << #x << ": " << (x) << '\n';
#define sz(x) int(x.size())
#define INF INT_MAX;
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> ii;
pair<int,pair<int,int>> arr[int(1e5+10)];
int cnt[int(1e5+10)][4];
int dp(int n,int k)
{
  
   if(n<=0) return 0;
   if(cnt[n][k])return cnt[n][k];
   int ans=-INF;
   int select[3] {arr[n].first,arr[n].second.first,arr[n].second.second};
   for(int i=1;i<=3;++i)
    if(i!=k)
    ans=max(ans,dp(n-1,i)+select[i-1]);
   return cnt[n][k]=ans;
}
int main()
{  
  fast
  int n;
  cin>>n;
  int ans=-INF;
  for(int i=1,x,y,z;i<=n;++i)
  {cin>>x>>y>>z;arr[i]={x,{y,z}};}
  int select[3] {arr[n].first,arr[n].second.first,arr[n].second.second};
  for(int i=1;i<=3;++i)
  ans=max(ans,dp(n-1,i)+select[i-1]);
  cout<<ans<<endl;
}

Measured memory_bytes: 10752
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
    ll N, L;
    cin >> N >> L;
    ll a[N];
    rep(i, N){
        cin >> a[i];
    }

    bool flag = false;
    int ind = -1;
    rep(i, N-1) {
        if (a[i] + a[i+1] >= L) {
            flag = true;
            ind = i;
        }
    }

    if (!flag) {
        cout << "Impossible" << endl;
        return 0;
    } else {
        cout << "Possible" << endl;
    }

    rep(i, ind) {
        cout << i + 1 << endl;
    }

    for (int i = N - 2; i > ind; i--) {
        cout << i + 1 << endl;
    }


    cout << ind + 1<< endl;


}

Measured memory_bytes: 1536
input()
n=[x for x in input().split()]
nb=n[::-1]
bs=n[::2]
if len(nb)%2==0:
    be=nb[::2]
else:
    be=nb[1::2]
if len(n)==1:
    print(n[0])
else:
    ans=be+bs
    if len(n)%2!=0:
        ans=ans[::-1]
    print(" ".join(ans))

Measured memory_bytes: 114264
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
for i in range(n-1, -1, -1):
    count = 0
    for j in range(i, n, i+1):
        count += ans[j]
    if count % 2 != a[i]:
        ans[i] = 1

if sum(ans) == 0:
    print(0)
    exit()

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i+1, end=" ")


Measured memory_bytes: 12184
#include <stdio.h>

int main(void) {
	int s[5];
	int a, b, i, max, maxp;
	
	while (1) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) return 0;
		s[0] = a + b;
		for (i = 1; i < 5; i++) {
			scanf("%d %d", &a, &b);
			s[i] = a + b;
		}
		
		max = s[0];
		maxp = 0;
		for (i = 1; i < 5; i++) {
			if (s[i] > max) {
				max = s[i];
				maxp = i;
			}
		}
		
		printf("%c %d\n", 'A' + maxp, max);
	}
}

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

int main()
{
	int N;
	char S[300001];
	scanf("%d", &N);
	scanf("%s", S);
	
	int i, count = 0, max = 0;
	for (i = 0; S[i] != 0; i++) if (S[i] == 'W') count++;
	for (i = 0, count; S[i] != 0; i++) {
		if (S[i] == 'W') count--;
		if (count > max) max = count;
		if (S[i] == 'E') count++;
	}
	
	printf("%d\n", N - max - 1);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

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

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

int main() {
    lli n, m, d;
    cin >> n >> m >> d;
    double ans = 0.0;
    if (2 * d >= n) {
        ans = n;
    } else {
        ans = n + (n - 2 * d);
    }
    if (d == 0) {
        ans = n;
    }
    //cout << ans << endl;
    ans = ans / n / n * (m - 1);
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


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


void solve(long long N, std::vector<long long> A){
    long long total = accumulate(A.begin(), A.end(), 0LL);
    vector<ll> cs(A.size(), 0);
    cs.at(0) = A.at(0);
    for(ll i = 1; i < A.size(); ++i){
        cs.at(i) = cs.at(i - 1) + A.at(i);
    }

    ll ans = numeric_limits<ll>::max();
    for(ll i = 0; i + 1 < A.size(); ++i){
        ll left = cs.at(i);
        ll right = total - left;
        ans = min(ans, abs(left - right));
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

// N種類(価値v, 重さw), 個数無制限, 重さの総和W以下, O(nW)
ll knapsack(int N, int W, vector<ll> v, vector<ll> w){
    // i種類目(1-indexed)までで重さjの時の価値の最大値がdp[i][j]
    vector<vector<ll>> dp(N+1, vector<ll>(W+1, 0));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= W; ++j) {
            if(j < w[i]){
                dp[i+1][j] = dp[i][j];
            } else{
                dp[i+1][j] = max(dp[i][j], dp[i+1][j-w[i]] + v[i]);
            }
        }
    }
    return dp[N][W];
}

int main() {
    ll N;
    cin >> N;
    vector<int>A(3);
    vector<int>B(3);
    cin >> A[0] >> A[1] >> A[2] >> B[0] >> B[1] >> B[2];

    // 各取引所に着いたら一度全てどんぐりにする
    // 整数計画問題であり, ナップサック問題として解ける
    vector<ll> AtoB_w(3);
    vector<ll> AtoB_v(3);
    vector<ll> BtoA_w(3);
    vector<ll> BtoA_v(3);
    for (int i = 0; i < 3; ++i) {
        AtoB_v[i] = B[i] - A[i];
        BtoA_v[i] = A[i] - B[i];
        AtoB_w[i] = A[i];
        BtoA_w[i] = B[i];
    }

    N += knapsack(3, N, AtoB_v, AtoB_w);
    N += knapsack(3, N, BtoA_v, BtoA_w);
    cout << N;
    return 0;
}

Measured memory_bytes: 976996
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <cstring>
#include <string>
#include <sstream>

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

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

    while(n --){
        int in, out; cin >> in >> out;
        if(!~res) continue;
        m += in - out;
        if(m < 0) res = -1; 
        if(m > res) res = m;
    }
    cout << ((~res) ? res:0) << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;
int N;
char ch, s[110],t[110];
int main()
{
    cin>>N;
    cin.get();
    cin>>s;
    cin>>t;
    for(int i=0; i<N; ++i)
        cout<<s[i]<<t[i];
    return 0;
}


Measured memory_bytes: 256
N = int(input())
c = list(input())
ans = 0
FLG = False
j = N - 1
for i, color in enumerate(c):
    if color == "W":
        while c[j] == "W":
            j -= 1
            if j <= i:
                FLG = True
                break
        if FLG:
            break
        ans += 1
        c[i], c[j] = c[j], c[i]

print(ans)

Measured memory_bytes: 77292
#include <iostream>
#include <string>

using namespace std;
int main (){
    int n;
    cin >> n;
    bool jud=0;
    string color;
    for (int i = 0; i < n; i++){
        cin >> color;
        if(color == "Y") jud=1;
    }
    if(jud) cout << "Four\n";
    else    cout << "Three\n";
}

Measured memory_bytes: 256
r,c=map(int,raw_input().split())
mx=[map(int,raw_input().split())+[0] for _ in range(r)]
mx.append([0]*(c+1))
for i in range(c):
    tmp=0
    for j in range(r):
        tmp+=mx[j][i]
    mx[r][i]=tmp
for x in mx:
    x[c]=sum(x)
for x in mx:
    print " ".join(map(str,x))

Measured memory_bytes: 4304
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}
const Int N = 110;

int mem[N][N*N];
bool used[N][N*N];
Int p[N];

Int n, K;
Int dfs(Int pos,Int cnt){
  if(pos == 0) return 0;
  assert(cnt < N*N);
  if(used[pos][cnt]) return mem[pos][cnt];
  used[pos][cnt] = 1;

  Int res = 0;
  for(Int num = 0;num<=K;num++){
    if(num > pos) {
      res = (res + dfs(pos-1, cnt) + (num+cnt) * p[pos-1])%mod;
      continue;
    }
    
    {
      Int a = (cnt - (pos - num));
      Int t = 0;
      if(a >= 0) t = 1 + a / pos;
      
      if(t == 0) res = (res + dfs(pos-1, cnt+t) + (cnt + num) * p[pos-1])%mod;
      else res = (res + dfs(pos-1, cnt + t) + (a%pos) * p[pos-1])%mod;	
    } 
  }
  return mem[pos][cnt] = res;
}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  
  cin>>n>>K;
  p[0] = 1;
  for(Int i=1;i<=n;i++) p[i] = p[i-1] * (K+1)%mod;
  Int ans = dfs(n ,0);
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
ll MOD = 1000000007;

int main() {
	ll N, D, X; cin >> N >> D >> X;
	ll A[100];
	ll cnt = 0;

	rep(i, 0, N) {
		cin >> A[i];
		cnt += (D - 1) / A[i];
		cnt++;
	}
	cout << cnt + X << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,avx2,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0)
typedef long long ll;


ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

//#######################################


int main(){
  boost;
  ll n;
  cin>>n;
  ll a[n];
  ll mx=0;
  ll count[1000006]={};
  for(int i=0;i<n;i++){
    cin>>a[i];
    count[a[i]]++;
    mx=max(mx,a[i]);
  }

  bool flag=true;

  ll counter=0;

  for(ll i=mx;i>1;i--){
    ll j=i;
    counter=0;

    while(j<=mx){
      if(count[j]>=2){
        flag=false;
        break;
      }
      else if(count[j]==1){
        counter++;
      }

      j+=i;

      if(counter==2){
        flag=false;
        break;
      }
    }

    if(!flag)
    break;
  }

  
  ll check1=a[0];
  for(int i=1;i<n;i++){
    check1=__gcd(check1,a[i]);
  }


  if(flag){
    cout<<"pairwise coprime";
  }
  else if(check1==1){
    cout<<"setwise coprime";
  }
  else{
    cout<<"not coprime";
  }


}



Measured memory_bytes: 19248
S = input()
S1 = S[0:((len(S) - 1) // 2)]
S2 = S[((len(S) + 3) // 2 - 1):]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 8884
#include<bits/stdc++.h>
using namespace std;
int a,b;
string n;
int main()
{
	cin>>a>>b;
	for(int s=0;s<b+2;s++)cout<<"#";
	cout<<endl;
	for(int s=0;s<a;s++)
	{
		cout<<"#";
		cin>>n;
		cout<<n<<"#"<<endl;
	}
	for(int s=0;s<b+2;s++)cout<<"#";
	cout<<endl;
}


Measured memory_bytes: 3592
N,M=map(int,input().split())
par = [i for i in range(N+1)]
rank = [0]*(N+1)
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x]==rank[y]:rank[x]+=1

for i in range(M):
    a,b = map(int,input().split())
    unite(a,b)
for i in range(N+1):
    find(i)
print(len(set(par))-2)

Measured memory_bytes: 19228
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	string a;
	cin>>a;
	if(a=="SUN"){
		cout<<7;
	}
	else if(a=="MON"){
		cout<<6;
	}
	else if(a=="TUE"){
		cout<<5;
	}
	else if(a=="WED"){
		cout<<4;
	}
	else if(a=="THU"){
		cout<<3;
	}
	else if(a=="FRI"){
		cout<<2;
	}
	else if(a=="SAT"){
		cout<<1;
	}
}

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

struct node{
	long long int a,b;
};

bool cmp(node e,node f)
{
	if(e.a!=f.a)
		return e.a<f.a;
	else
		return e.b>f.b;

}

int main()
{

long long int n,m,y=0;

cin>>n>>m;

node d[n+1];
for(int i=1;i<=n;i++)
	cin>>d[i].a>>d[i].b;

sort(d+1,d+n+1,cmp);

for(int i=1;i<=n;i++)
{
	if(d[i].b<m)
	{
		y+=d[i].a*d[i].b;
		m-=d[i].b;
	}
	else
	{
		y+=d[i].a*m;
		break;
	}
}
cout<<y;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int answer =0;
  for (int i = 0; i < N; i++) {
    if (i%2 == 0) 
      answer += a.at(i);
    else 
      answer -= a.at(i);
  }
  
  cout << answer << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, A[int(1e5+5)], now[3];
ll ans = 1;
int main(){
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> A[i];
    ll cnt = 0;
    for (int j = 0; j < 3; j++){
      if (A[i] == now[j]){
        if (cnt == 0) now[j]++;
        cnt++;
      }
    }
    ans *= cnt; ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

struct int_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

struct pair_hash {
    size_t operator()(pii x) const {
        return int_hash{}(x.first) ^ (int_hash{}(x.second) << 16);
    }
};

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<cd> vcd;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pii>> vvpii;
typedef vector<vector<pll>> vvpll;
typedef unordered_map<int, int, int_hash> umpii;
typedef unordered_map<ll, ll, int_hash> umpll;
typedef unordered_set<int, int_hash> usi;
typedef unordered_set<ll, int_hash> usll;
typedef unordered_set<pii, pair_hash> uspii;
typedef queue<int> qi;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = numeric_limits<int>::max();
const int MX = 100001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, m; cin >> n >> m;
    auto comp = [](int x, int y){ return x > y; };
    multiset<int, decltype(comp)> s(comp);
    F0R(i, n) {
        int x; cin >> x;
        s.insert(x);
    }

    while(m--) {
        int x = *s.begin();
        s.erase(s.begin());
        s.insert(x / 2);
    }

    ll sum = 0;
    for(int i : s) sum += i;
    cout << sum << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c;
	cin >> a >> b >> c;
	if(a*b*c%2==1){
		long long maxi = max(a,max(b,c));
		long long mini = min(a,min(b,c));
		long long midi = a+b+c - maxi - mini;
		cout << mini*midi;
	}
	else cout << 0;
		
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readInteger()
    val dp = Array(n + 1) { DoubleArray(n + 1) { 0.0 } }
    val ps = readDoubleList()
    dp[0][0] = 1.0
    for (i in 0 until n) {
        for (j in 0..i) {
            dp[i + 1][j + 1] += dp[i][j] * ps[i]
            dp[i + 1][j] += dp[i][j] * (1 - ps[i])
        }
    }
    var ans = 0.0
    for (i in ((n + 1) / 2)..n) {
        ans += dp[n][i]
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 121724
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long X, Y;
    cin >> X >> Y;
    if(X * 4 < Y || 2 * X > Y) {
        cout << "No" << endl;
        return 0;
    }
    if((4 * X - Y) % 2 == 0){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string b;
    cin >> b;
    
    if(b == "A") cout << "T";
    if(b == "T") cout << "A";
    if(b == "C") cout << "G";
    if(b == "G") cout << "C";
}


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


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

  int A, B, C;
  map<int,int,greater<int>> d;

  rep(i,N) {
    cin >> A;
    d[A]++;
  }

  rep(i,M) {
    cin >> B >> C;
    d[C] += B;
  }

  ll num = 0, ans = 0;
  for (auto c: d) {
    ll value = c.first;
    ll count = c.second;
    if (num + count > N) {
      ans += value * (N - num);
      break;
    }
    ans += value * count;
    num += count;
  }

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


Measured memory_bytes: 12948
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {

			int N = sc.nextInt();
			int max = N-1;
			int count = 0;
			for (int A = 1; A < N; A++) {
				for (int B = 1; B < N; B++) {
					int tmp = N -(A * B);
					if (tmp > 0) {
						count++;
					} else {
                      break;
                    }
				}
			}
			System.out.println(count);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}


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

int main()
{
    ios::sync_with_stdio(false);
    int n,x=0,y=0,maior = 0;
    vector<int> v(n),c(n);

    cin >> n;

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

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

    for(int i =0;i<n;i++){
        if(v[i]-c[i]>0){
            maior+=v[i]-c[i];
        }
    }

    cout<<maior<<endl;

    return 0;
}


Measured memory_bytes: 512
Scanf.scanf "%d" (fun n ->
    let calc count =
        let rec loop rest i =
            if rest < i then i - 1 else
                loop (rest - i) (i + 1)
        in
        loop count 1
    in
    let rec loop r i acc =
        if r = 1 then acc else
        if i * i > n then acc + 1 else
            if r mod i <> 0 then loop r (i + 1) acc else
                let rec loop2 r count =
                    if r mod i = 0 then loop2 (r / i) (count + 1) else
                        loop r (i + 1) (acc + calc count)
                in
                loop2 r 0
    in
    Printf.printf "%d\n" @@
        if n = 1 then 0 else loop n 2 0
)

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

int main() {
  long N;
  cin>>N;
  long ans =0;
  int flg=1;
  while(N>=10){
    ans+=9;
    if(N%10!=9) flg=0;
    N/=10;
  }
  if(flg)ans += N;
  else ans+=N-1;
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
# count = 0
# list a[i]が偶数かどうかをチェック。ループはとりあえず省略する

exist_odd = False
# in_if = 0
in_for = 0
# in_while = 0
while exist_odd == False:
    for i in range(n):
        if a[i] % 2 != 0:
            exist_odd = True
            if n != i:
                in_for -= 1
            break
        else:
            a[i] = a[i] / 2
        # in_if += 1
        # print(in_if)
    in_for += 1
print(in_for)

Measured memory_bytes: 9172
#include <cstdio>

typedef long long lint;

lint abs(lint num) { return num > 0 ? num : -num; }
int main()
{
	lint a, b, c, k;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);

	lint ret;
	if (k & 1) ret = b - a;
	else ret = a - b;

	if (abs(ret) > 1000000000000000000ll) printf("Unfair");
	else printf("%lld", ret);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL<<60;

int main(){
    int N;cin >> N;
    vector<int> A(N);
    for(int i=1;i<N;i++){
        int data;cin >> data;
        A[data-1]++;
    }
    for(auto &i:A){
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 3988
from operator import itemgetter
a=int(input())
b=[list(map(int,input().split())) for i in range(a)]
b=sorted(b,key=itemgetter(1))
c=0
d=0
for i in range(a):
  c+=b[i][0]
  if c>b[i][1]:
    d=1
    break
    
if d==0:
  print("Yes")
else:
  print("No")

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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,c;
  cin >> a>> b>>c;
  if(a+b+c >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
	return 0;
}


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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

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

  vector<ll> A(N);
  for (auto&& a : A) {
    cin >> a;
  }

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

  ll ans = 0;

  for (ll i = 1; i < N; i++) {
    // cerr << "i: " << i << ", add: " << A[i / 3] << endl;
    ans += A[i / 2];
  }

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


Measured memory_bytes: 4848
#include<bits/stdc++.h>
#define LLI long long int
#define ULTRA 2134567890
#define MOD 1000000007

using namespace std;

int a[2007];

int main()
{
    int i,j;
    int N;
    LLI K;

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


    LLI total = 0;
    for( i=0; i<N; i++)
    {
        int num = a[i];
        LLI cnt = 0;
        for( j=0; j<i; j++)
        {
            if(a[j] < num)
                cnt++;
        }
        total += ( cnt*( (K-1)*K/2 % MOD) ) % MOD;
        total %= MOD;
        cnt = 0;
        for( j=i+1; j<N; j++)
        {
            if( a[j] < num)
            {
                cnt++;
            }
        }
        total += ( cnt*( K*(K+1)/2 % MOD) ) % MOD;
        total %= MOD;
        // printf(">>>%lld\n",total);
    }

    printf("%lld\n",total);


    return 0;
}


Measured memory_bytes: 256