akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define MAX 100
using namespace std;
vector<int> weight(MAX+1), earn(MAX+1);
int n;
long long dp[MAX+1][MAX*MAX*10+1];
long long knapsack(int i, int value)
{
	if(i==n||value<=0)
	{
		if(value==0)	
			return 0LL;
		else return LLONG_MAX;
	}
	if(dp[i][value]!=-1)
		return dp[i][value];
	long long a = LLONG_MAX,b;
	if(value>=earn[i])
	{
		a = knapsack(i+1,value-earn[i]);
		if(a^LLONG_MAX)
			a += 1LL*weight[i];
	}
	b = knapsack(i+1,value);
	dp[i][value] = min(a,b);
	return dp[i][value];
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int w,maxvalue = 0;
	cin>>n>>w;
	for(int i=0;i<n;++i)
		cin>>weight[i]>>earn[i],maxvalue += earn[i];
	for(int i=0;i<n;++i)	
		for(int j=1;j<=maxvalue;++j)
			dp[i][j] = -1;
	int ans = 0;
	for(int i=1;i<=maxvalue;++i)
		if(knapsack(0,i)<=w)
			ans = i;
	cout<<ans<<endl;
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m,n;
    	cin>>n>>k;
    	ll ans=peak;
    	ans=min(n%k,k-(n%k));
    	cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
from functools import lru_cache

N = int(input().strip())
A = [int(v) for v in input().strip().split()]
C = {}


@lru_cache(maxsize=None)
def pair(k):
    return k * (k - 1) // 2

@lru_cache(maxsize=None)
def calc(s, a):
    return s - pair(C[a]) + pair(C[a] - 1)

for a in A:
    C.setdefault(a, 0)
    C[a] += 1

S = sum([pair(v) for v in C.values()])

for a in A:
    print(calc(S, a))


Measured memory_bytes: 52344
N,K,Q = map(int,input().split())
S=[int(input()) for i in range(Q)]
Point=[int(K-Q) for i in range(N)]
for x in range(Q):
    Point[S[x]-1]+=1

for x in range(N):
    if Point[x]<1:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 11776
#include<stdio.h> 

#include<string.h> 

 

char X[1001],Y[1001]; 

 

int LCS_Length(void){ 

  int i,j; 

  int m = strlen(X); 

  int n = strlen(Y); 

  int c[m+1][n+1]; 

 

  for(i=1 ; i<=m ; i++) c[i][0] = 0; 

  for(j=0 ; j<=n ; j++) c[0][j] = 0; 

   

  for(i=1 ; i<=m ; i++){ 

    for(j=1 ; j<=n ; j++){ 

      if(X[i-1] == Y[j-1]) c[i][j] = c[i-1][j-1] + 1; 

      else if(c[i-1][j] >= c[i][j-1]) c[i][j] = c[i-1][j]; 

      else c[i][j] = c[i][j-1]; 

    } 

  } 

  return c[m][n];  

} 

 

main(){ 

  int i,n; 

  scanf("%d",&n); 

  for(i=0 ; i<n ; i++){ 

    scanf("%s%s",X,Y); 

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

  } 

  return 0; 

} 


Measured memory_bytes: 5648
from collections import Counter
n, k = map(int,input().split())
ans = 0
arr = list(map(int,input().split()))
arr = list(Counter(arr).items())
arr = list(map(list,arr))
arr = sorted(arr, key=lambda x:x[1])[:-k]
for i in arr:
    ans += i[1]
print(ans)

Measured memory_bytes: 49036
#include <stdio.h>
#include <math.h>
#define BUF 1000

// ?????°???2?????????????????????????????¢??°
double twice_power(double x) {
    double tmp;
    if (x < 0) tmp = (-1.0) * x;
    else tmp = x;

    return (x * x);
}

int main(void) {
    int i, n;
    double std[BUF], ave, alpha, ans;

    while (1) {
        ave = 0.0; alpha = 0.0;
        scanf("%d", &n);                                                        // ???????????°n???????????????
        if (n == 0) break;
        for (i = 0; i < n; i++) scanf("%lf", &std[i]);                          // ???????????????????????°???????????????
        for (i = 0; i < n; i++) ave += std[i]; ave /= n;                        // ??????????????????
        for (i = 0; i < n; i++) alpha += twice_power(std[i] - ave); alpha /= n; // ?????£?????????
        ans = sqrt(alpha);
        printf("%f\n", ans);
    }

    return 0;
}

Measured memory_bytes: 660
s = input()
x = []
for i in s:
    x.append(ord(i) - ord('a'))
K = int(input())
for i in range(len(x)):
    if x[i] == 0:
        continue
    d = 26 - x[i]
    if K >= d:
        x[i] = 0
        K -= d
x[-1] = (x[-1] + K) % 26
for i in x:
    print(chr(i + ord('a')), end = "")
print()

Measured memory_bytes: 5620
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
xyz = [[] for i in range(n+1)]
for _ in range(m):
    x, y, z = map(int, input().split())
    xyz[x].append(y)
    xyz[y].append(x)
    
ans = 0
visited = [False]*(n+1)
def dfs(x):
    visited[x] = True
    for y in xyz[x]:
        if not visited[y]:
            dfs(y)

for x in range(1, n+1):
    if visited[x]:
        continue
    dfs(x)
    ans += 1
    
# print(visited)
print(ans)


Measured memory_bytes: 104692
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>
#include <stack>
#include <cassert>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;
using Graph = Vvec<int>;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> u(N-1), v(N-1);
    for(int i=0; i<N-1; i++) cin >> u[i] >> v[i];

    ll ans = N * (N+1) * (N+2) / 6;
    for(int i=0; i<N-1; i++){
        if(u[i] > v[i]) swap(u[i], v[i]);
        ans -= u[i] * (N - v[i] + 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5988
#[allow(dead_code)]
fn main() {
    let t = i::str();
    let s: &str = t.as_str();
    if s == "ABC" {
        println!("{}", "ARC");
    } else {
        println!("{}", "ABC");
    }
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  string s;
  cin >> n >> s;
  vector<int> d(n+1,0);
  int x = 0;
  REP(i,n){
    d[i+1] = d[i] + (s[i]=='(' ? 1 : -1);
    if(x>d[i+1]) x = d[i+1];
  }
  REP(i,-x) cout << '(';
  cout << s;
  REP(i,d[n]-x) cout << ')';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>

using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> d;
    vector<ll> a(n);
    rep(i, 0, n)cin >> a[i];
    vector<ll> b(n);
    rep(i, 0, n)cin >> b[i];
    int count = 0;
    ll p = 0, sum = 0;
    rep(i, 0, n){
        ll dif = a[i]-b[i];
        sum += dif;
        d.push_back(dif);
        if(dif < 0){
            count++;
            p += (-1)*dif;
        }
    }
    if(count == 0){
        cout << "0" << endl;
        return 0;
    }
    if(sum < 0){
        cout << "-1" << endl;
        return 0;
    }
    int c;
    sort(d.begin(), d.end(), greater<ll>());
    rep(i, 0, n){
        p -= d[i];
        if(p <= 0){
            c = i+1;
            break;
        }
    }
    cout << count + c << endl;
}

Measured memory_bytes: 2428
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 20000; ++i) {
        if (i * 8 / 100 == a && i * 10 / 100 == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


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

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double y = x / a;
    double c = (2 * y - a * b) / a;
    if (c <= 0.0) {
        double e = 2 * y / b;
        printf("%.10f\n", 90 - 180.0 / acos(-1.0) * atan(e / b));
        return 0;
    }
    
    double d = b - c;
    printf("%.10f\n", 180.0 / acos(-1.0) * atan(d / a));
}  

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    cout << a * b / 2 << '\n';
    return 0;
}


Measured memory_bytes: 3596
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = findK(n);
        if(k==-1){
            System.out.println("No");
            System.exit(0);
        }
        int[][] res = new int[k][k-1];
        for(int i=0;i<k-1;i++) res[0][i] = i+1;
        int[] index = new int[k];
        for(int i=0;i<k;i++) index[i]=i;
        for(int row=1;row<k;row++){
            int idx = 0;
            for(int j=0;j<row;j++) res[row][idx++] = res[j][index[j]++];
            if(row==k-1) continue;
            res[row][idx++]=res[row-1][k-2]+1;
            while(idx<k-1){
                res[row][idx] = res[row][idx-1]+1;
                idx++;
            }
        }
        System.out.println("Yes");
        System.out.println(k);
        for(int i=0;i<k;i++){
            System.out.print(Integer.toString(k-1)+" ");
            for(int j=0;j<k-1;j++){
                System.out.print(Integer.toString(res[i][j])+" ");
            }
            System.out.println("");
        }
    }
    static int findK(int n){
        int k=1;
        while(k*(k-1)<=2*n){
            if(k*(k-1)==2*n) return k;
            k++;
        }
        return -1;
    }
}


Measured memory_bytes: 56328
def main():
    M, D = (int(i) for i in input().split())
    ans = 0
    for m in range(1, M+1):
        for d in range(10, D+1):
            s = str(d)
            d1 = int(s[1])
            d10 = int(s[0])
            if d1 >= 2 and d10 >= 2 and m == d1*d10:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39280
import java.util.*;
public class Main {
 public static void main(String args[])
 {
	 Scanner input=new Scanner(System.in);
	  long h=input.nextLong();long w=input.nextLong();
	  long sum=0;
	  if(w==1||h==1)System.out.print(1);
	  else
	  {
	  if(w%2==0)sum=(long)h*w/2;
	  else
	  {
		  long k=h/2;
		  sum+=(long)k*((w+1)/2+(w-1)/2);
		  if(h%2==1)sum+=(w+1)/2;
	  }
	  System.out.println(sum);
 }
}
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
     
#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()
     
using namespace std;
using ll = long long;
using P = pair<int, 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( a > b ) { a = b; return 1; } return 0; }
     
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
  int w, h, x, y; cin >> w >> h >> x >> y;
  cout << (double)w * h / 2 << " ";

  if( 2 * x == w && 2 * y == h ){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for ( auto blockTime = make_pair(chrono::high_resolution_clock::now(), true);blockTime.second;\
debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
#define li long long int
#define ld long double
#define eb push_back
#define pb pop_back
#define INF 1e18+10
#define MINF -1e18-10
#define rep(i,a,b) for(li i=a;i<b;i++)
#define size(a) a.size()
#define rev(a) reverse(a.begin(),a.end())
#define len(a) a.length()
#define f first
#define s second
#define sort(a) sort(a.begin(),a.end())
#define vli vector<li>
#define vvli vector<vli >
#define pli pair<li,li>
#define vpli vector<pli>
#define inp(t) li t;cin>>t; while(t--)
using namespace std;
const li mod = 1e9+7;
const long int MAXN = 1e5+100;

li power(li a, li b, li mod) { a%=mod; li ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
li powerinv(li a)
{
  return power(a,mod-2,mod);
}

li add(li a,li b) { return (((a%mod)+(b%mod))%mod);}
li sub(li a,li b) { return (((a%mod)-(b%mod))%mod);}
li mul(li a,li b) { return (((a%mod)*(b%mod))%mod);}

bool isprime(li n)
{
  if (n == 1)
    return false;
  int i = 2;
  while (i*i <= n){
      if (n % i == 0)return false;
      i += 1;
  }
  return true;
}

li lcm(li a,li b)
{
    return ((a*b)/__gcd(a,b));
}

// vector<li> G[MAXN];
// li visited[MAXN];
 
// void dfs(li n,li num)
// {
// 	visited[n] = 1; //visited this node set to true
// 	for(auto it : G[n])
// 	{
// 		dfs(it,n);
// 	}
// }

void solve()
{
	li n,x,t;
	cin>>n>>x>>t;

	li a = (n/x) + ((n%x)!=0);
	cout<<a*t<<endl;
}	

int main()
{	
	IOS;

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	
	solve();
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>

using namespace std ;
int main () {
  int N;
  int d[100];
  int cnt=1;
  cin >> N;
  for(int i=0;i<N;i++) {
    cin >> d[i];
  }
  sort(d,d+N);
  for(int i=0;i<N-1;i++) {
    if(d[i]!=d[i+1]) {
      cnt = cnt + 1;
    }
  }
  cout << cnt << endl;
  return(0);
}

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

int main() {
  ll a,b,c,k; cin >> a >> b >> c >> k;
  if(k<=a) cout << k << endl;
  else if(k>a && k<=a+b) cout << a << endl;
  else if(k>a+b){
    ll h = k-(a+b);
    cout << a-h << endl;
  }
  return 0;
}




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

int main(){

    int A, B;
    cin >> A >> B;

    int ans = INT_MIN;
    ans = max(ans, A + B);
    ans = max(ans, A - B);
    ans = max(ans, A * B);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define DEBUG(x) cerr << #x << ": " << x << "\n"

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

const int MOD = 1000000007;

long modpow(long a, int n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        long h = modpow(a, n / 2);
        return h * h % MOD;
    } else {
        return (a * modpow(a, n - 1)) % MOD;
    }
}

long comb(int a, int b) {
    if (b > a - b) {
        return comb(a, a - b);
    }
    long m = 1, d = 1;
    REP(i, b) {
        m *= (a - i);
        d *= (b - i);
        m %= MOD;
        d %= MOD;
    }
    return (m * modpow(d, MOD - 2)) % MOD;
}

// main
int main() {
    int N, M;
    cin >> N >> M;
    long res = 1;
    for (int i = 2; i * i <= M; ++i) {
        int c = 0;
        while (M % i == 0) {
            ++c;
            M /= i;
        }
        res *= comb(c + N - 1, c);
        res %= MOD;
    }
    if (M != 1) {
        res *= N;
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}


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

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

    std::map<std::string, int> map;
    map["AC"] = 0;
    map["WA"] = 0;
    map["TLE"] = 0;
    map["RE"] = 0;

    for (int i = 0; i < N; i++) {
        std::string str;
        std::cin >> str;
        map[str]++;
    }

    std::cout << "AC x " << map["AC"] << std::endl;
    std::cout << "WA x " << map["WA"] << std::endl;
    std::cout << "TLE x " << map["TLE"] << std::endl;
    std::cout << "RE x " << map["RE"] << std::endl;
}


Measured memory_bytes: 3632
def main():
    N = int(input())

    table = []
    for _ in range(N):
        a, b, c = map(int, input().split())
        table.append((a, b, c))

    dp = [0] * 3

    for i in range(N):
        a, b, c = table[i]

        a0 = dp[0]
        b0 = dp[1]
        c0 = dp[2]

        dp[0] = max(b0, c0) + a
        dp[1] = max(c0, a0) + b
        dp[2] = max(a0, b0) + c

    print(max(dp))

main()


Measured memory_bytes: 20536
def read_input():
    n = int(input())
    return n


def count_coin(x, op, min_op):
    if x == 0:
        return 0

    if x in min_op.keys():
        return min_op[x]

    min_count = 10000000
    for o in op:
        if x >= o:
            count = 1 + count_coin(x - o, op, min_op)
            if count < min_count:
                min_count = count

    min_op[x] = min_count
    return min_count


def submit():
    n = read_input()

    ops = [1, 6, 9]

    for op in ops[1:]:
        i = 1
        t = op ** i
        while t <= n:
            ops.append(t)
            t *= op

    ops = list(set(ops))
    ops.sort(reverse=True)
    print(count_coin(n, ops, {}))

if __name__ == '__main__':
    submit()


Measured memory_bytes: 15072
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  int a[M], b[M], num[N+1] = {};

  for(int i=0; i<M; ++i)
    cin >> a[i] >> b[i];

  for(int i=0; i<M; ++i) {
    ++num[a[i]];
    ++num[b[i]];
  }

  for(int i=1; i<=N; ++i)
    cout << num[i] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;

int vis[100009];
typedef pair<int, int> P;


int main()
{
    int k;
    scanf("%d", &k);
    deque<P> q;
    memset(vis, 0, sizeof(vis));
    q.push_back(make_pair(1, 1));
    while(!q.empty())
    {
        P x = q.front(); q.pop_front();
        if(vis[x.first]) continue;
        vis[x.first] = 1;
        if(x.first == 0)
        {
            printf("%d\n", x.second);
            break;
        }
        q.push_front(make_pair(x.first*10 % k, x.second));
        if(vis[(x.first+1)%k]==0)q.push_back(make_pair((x.first+1) % k, x.second+1));

    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL n; cin >> n;
		string S; cin >> S;
		UL k; cin >> k;
		rep(i, S.size()) {
			if (S[i] != S[k - 1]) S[i] = '*';
		}
		cout << S << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

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

using namespace std;

char tab[310][310];
int mask[310][310];

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int h, w, k;
    cin >> h >> w >> k;

    for(int i=1;i<=h;++i)
        for(int j=1;j<=w;++j)
            cin >> tab[i][j];
    
    int counter = 1;
    for(int i=1;i<=h;++i){
        bool found = false;
        for(int j=1;j<=w;++j)
            if(tab[i][j] == '#'){
                found = true;
                mask[i][j] = counter;
                counter++;
            }
        if(!found){
            for(int j=1;j<=w;++j)
                mask[i][j] = mask[i-1][j];                
        }else{
            int local_counter = counter-1;
            bool first = true;
            for(int j=w;j>=1;j--)
                if(tab[i][j] == '.')
                    mask[i][j] = local_counter;
                else{
                    if(first)
                        first = false;
                    else    
                        local_counter--;
                }
        }
    }

    for(int i=h;i>=1;--i){
        bool found = false;
        for(int j=1;j<=w;++j)
            if(tab[i][j] == '#'){
                found = true;
                counter--;
            }else{
                if(mask[i][j]) found = true;
            }
        if(!found)
            for(int j=1;j<=w;++j)
                mask[i][j] = mask[i+1][j];                
    }

    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j)
            cout << mask[i][j] << ' ';
        cout << '\n';
    }

    return 0;
}

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

int main(){
    int n; cin >> n;
    int i=0;
    for(i;i<10;i++){
        if(n<pow(2, i+1)){
            break;
        }
    }
    cout << pow(2, i) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node{
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else {
      x = x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }else {
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  string com;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    cin >> com;
    if(com[0] == 'f'){
      scanf("%d", &x);
      Node *t = find(root, x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    } else if(com == "insert"){
      scanf("%d", &x);
      insert(x);
    } else if(com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
    return 0;
}


Measured memory_bytes: 22076
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	h = readline() |> split |> parseMap
	count = 0
	k = sum(h)
	while k > 0
		for i in 1:n
			if h[i] > 0
				t = 0
				for j in i:n
					if h[j] == 0
						break
					else
						h[j] -= 1
						t += 1
					end
				end
				k -= t
				count += 1
				break
			end
		end
	end
	println(count)
end

main()


Measured memory_bytes: 168704
//Bismillahir-Rahmanir-Rahim
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int llu;
#define f1(i,n) for(i=1;i<=n;i++)
#define f(i,n) for(i=0;i<n;i++)
#define Max 100009
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
     ll n,i,j,t,m=0,T,ans=0,r,k,p=0,q,x,y,l;
         string s;
         cin>>s;
         l=s.size();
         for(i=0;i<l;i++)
         {
             m+=s[i]-'0';
         }
         if(m%9==0)
            cout<<"Yes\n";
         else cout<<"No\n";
}












Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main(){
  int a;
  int b = 2;
  int tmp;
  int r;
  int x;
  cin >> a;
  x = a * 2;
  if(a < b){
    b = a;
    a = 2;
  }
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  cout << x / b << endl;
}

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

int main()
{
    string str1, str2;
    cin >> str1 >> str2;
    int len1 = str1.length();
    int len2 = str2.length();
    int dp[2][len1 + 1];
    memset(dp, 0, sizeof dp);
    for (int i = 0; i <= len1; i++) dp[0][i] = i;
    for (int i = 1; i <= len2; i++) {
        for (int j = 0; j <= len1; j++) {
            if (j == 0) dp[i % 2][j] = i;
            else if (str1[j - 1] == str2[i - 1]) {
                dp[i % 2][j] = dp[(i - 1) % 2][j - 1];
            }
            else {
                dp[i % 2][j] = 1 + min(dp[(i - 1) % 2][j], min(dp[i % 2][j - 1], dp[(i - 1) % 2][j - 1]));
            }
        }
    }
    cout << dp[len2 % 2][len1] << endl;
    return 0;
}



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

int main(void)
{
	char str1[20];
	char str2[20];
	int soe = 0;
	int i;
	
	scanf("%s", str1);
	
	soe = strlen(str1);
	
	strcpy(str2, str1);
	
	for (i = 0; soe >= 0; soe--){
		str2[i] = str1[soe - 1];
		
		i++;
	}
	
	str2[i] = '\0';
	
	printf("%s\n", str2);
	
	return (0);
}

Measured memory_bytes: 1692
#include<iostream>
using namespace std;
int main(){
int w[10],k[10],tmp,i,j;
for(i=0;i<10;i++){
cin>>w[i];
}
for(i=0;i<10;i++){
cin>>k[i];
}
for(i=0;i<9;i++){
for(j=9;j>i;j--){
if(w[j]>=w[j-1]){
tmp=w[j];
w[j]=w[j-1];
w[j-1]=tmp;
}
if(k[j]>=k[j-1]){
tmp=k[j];
k[j]=k[j-1];
k[j-1]=tmp;
}
}
}
cout<<w[0]+w[1]+w[2]<<" "<<k[0]+k[1]+k[2]<<endl;
return 0;
}





Measured memory_bytes: 3088
using System;
class abc123c{
  static void Main(){
    long[] p=new long[6];
    
    for(int i=0;i<6;i++){
      p[i]=long.Parse(Console.ReadLine());
    }
    
    long min=Math.Min(p[1],Math.Min(p[2],Math.Min(p[3],Math.Min(p[4],p[5]))));
    
    long result=p[0]/min+4;
    long d=p[0]%min;
    
    if(d!=0)result++;
    Console.WriteLine(result);
    return;
  }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
long long n,a[200010],b[200010],c[200010];
long long sum[200010];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%ld",&c[i]);
		a[c[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		//cout<<a[i]<<" ";
		if(a[i]>=2)
			b[i]=a[i]*(a[i]-1)/2;
	}
	//cout<<endl;
	for(int i=1;i<=n;i++)
	{
		//cout<<b[i]<<" ";
		sum[i]=sum[i-1]+b[i];
	}
	//cout<<endl;
	for(int i=1;i<=n;i++)
	{
		//cout<<sum[i]<<" ";
		printf("%ld\n",sum[c[i]-1]+sum[n]-sum[c[i]]+(a[c[i]]-1>=2?(a[c[i]]-1)*(a[c[i]]-2)/2:0));
	}
}

Measured memory_bytes: 8704
#include <stdio.h>

int main(){
	float a,b,c,d,e,f;
	float x,y;
	
	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) != EOF){
		y = (d*c - a*f)/(d*b - a*e);;
		x = (c - b*y) / a;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

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

n=int(input())  #数値入力 「N」だけの入力のとき
h=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
cnt=0
L=0
while L != len(h):
    if h[L] != 0:
        for r in range(L+1 ,len(h)):
            if h[r] == 0:
                #do it
                h[L:r] = [i-1 for i in h[L:r]]
                cnt+=1
                break
        else:
            r = len(h)
            h[L:r] = [i-1 for i in h[L:r]]
            cnt+=1
    elif h[L] == 0:
        L+=1
print(cnt)


Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(){
  int h,w,i,j,a,b;
  char s[10];
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      scanf("%s",s);
      if(strcmp(s,"snuke")==0){
	a=i;
	b=j;
      }
    }
  }
  printf("%c%d\n",b+'A',a+1);
  return 0;
}


Measured memory_bytes: 128
n = int(input())
v = [int(i) for i in input().split()]
v.sort()
ans = (v[0] + v[1]) / 2
if n == 2: print(ans)
else:
    for i in range(1, n-1):
        ans  = (ans + v[i+1]) / 2
    print(ans)

Measured memory_bytes: 3060
# input
K, X = map(int, input().split())
R_max = -(10 ** 6)
L_max = 10 ** 6

# check
result = [X]
for R, L in zip(range(K - 1, -1, -1), range(0, K, 1)):
    result += [X - r for r in range(1, R + 1) if X - r >= R_max and X - r not in result]
    result += [X + l for l in range(1, L + 1) if X + l <= L_max and X + l not in result]

# output
result.sort()
op = ""
for res in result:
    op += str(res)
    op += " "

print(op[:-1])

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		String s = scan.next();
		int w = scan.nextInt();
		
		String ans = "";
		for(int i = 0; i < s.length(); i+= w) {
			ans += s.charAt(i);
		}
		
		System.out.println(ans);
    }
}


Measured memory_bytes: 25940
#include <stdio.h>

int main(void)
{
    char ch[6] = "ABCDEF";
    char a, b;
    int n, m;

    scanf("%c %c", &a, &b);
    for (int i = 0; i < 6; i++){
        if (a == ch[i])
        n = i;
        if (b == ch[i])
        m = i;
    }

    if (n > m)
        printf(">");
    else if (n < m)
        printf("<");
    else if (n == m)
        printf("=");

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int64_t N, K, A, S;
  cin >> N >> K;
  A = 1000000007LL;
  S = 0LL;
  for (int64_t i = K; i <= N + 1; i++) {
    S += ((i % A) * (N % A)) % A;
    S += - ((i % A)* (i % A)) % A;
    S += i;
    S += 1;
    S %= A; 
  }
  cout << S << endl;
}

Measured memory_bytes: 3636
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int dx[] = { -1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};


int main() {

	long long  x, y, a, b, c; cin >> x >> y >> a >> b >> c;

	priority_queue<long long , vector<long long >, greater<long long >> red, green;
	priority_queue<long long > cless;

	for (int i = 1; i <= a; i++) {
		int ri; cin >> ri;
		if (red.size() < x) red.push(ri);
		else if (red.top() < ri) red.pop(), red.push(ri);
	}

	for (int i = 1; i <= b; i++) {
		int gi; cin >> gi;
		if (green.size() < y) green.push(gi);
		else if (green.top() < gi) green.pop(), green.push(gi);
	}

	for (int i = 1; i <= c; i++) {
		int ci; cin >> ci;
		cless.push(ci);
	}

	while (!cless.empty() and min(red.top(), green.top()) < cless.top()) {
		if (red.top() < green.top()) red.pop(), red.push(cless.top()), cless.pop();
		else green.pop(), green.push(cless.top()), cless.pop();
	}

	long long  ans = 0;
	while (!red.empty()) ans += red.top(), red.pop();
	while (!green.empty()) ans += green.top(), green.pop();

	cout << ans;


	return 0;
}

Measured memory_bytes: 6244
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for i in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)
s = sum(T)
for i in range(M):
    print(s-T[P[i]-1]+X[i])

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

using namespace std;
typedef long long ll;

int main(){
    ll n, x, ans = 0; cin >> n;
    int L[2005];
    for(int i=0; i < n; i++)
        cin >> L[i];
    sort(L, L + n);
    for (int i = 0; i < n-1; i++)
    {
        for (int j = i+1; j < n; j++)
        {
            x = L[i] + L[j];
            auto iter = lower_bound(L + j, L+n, x);
            ans += iter - L - j - 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F(i, a, b) for (int i = (a); i < (b); ++i)
#define F2(i, a, b) for (int i = (a); i <= (b); ++i)
#define dF(i, a, b) for (int i = (a); i > (b); --i)
#define dF2(i, a, b) for (int i = (a); i >= (b); --i)
#define maxn 1010
#define maxm 200010
using namespace std;
typedef long long LL;
int f[maxn][maxn][2], vis[maxn<<1], T;
struct node {int to, id; };
vector<node> edge[maxn];
pair<int, int> E[maxm];
void dfs(int u, int src, int id, int type) {
    f[src][u][type] = id; vis[u] = T;
    for (auto& e : edge[u]) {
        int v = e.to;
        if (vis[v]!=T) dfs(v, src, id, type);
    }
}
void work(int src) {
    ++T; vis[src] = T;
    for (auto& e : edge[src]) {
        int v = e.to;
        if (vis[v]!=T) dfs(v, src, e.id, 0);
    }

    reverse(edge[src].begin(), edge[src].end());
    ++T; vis[src] = T;
    for (auto& e : edge[src]) {
        int v = e.to;
        if (vis[v]!=T) dfs(v, src, e.id, 1);
    }
}
int main() {
//    freopen("in.txt", "r", stdin);
    int n, m, u, v;
    scanf("%d%d", &n ,&m);
    F2(i, 1, m) {
        scanf("%d%d", &u, &v);
        edge[u].push_back({v, i});
        E[i] = {u, v};
    }
    F2(i, 1, n) work(i);
//    F2(i, 1, n) {
//        F2(j, 1, n) printf("%d ", f[i][j][0]); puts("");
//    }
//    F2(i, 1, n) {
//        F2(j, 1, n) printf("%d ", f[i][j][1]); puts("");
//    }
    F2(i, 1, m) {
        int u = E[i].first, v = E[i].second;
        if (f[v][u][0]!=0 ^ (f[u][v][0]!=i||f[u][v][1]!=i)) puts("diff");
        else puts("same");
    }
    return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int A,B;
  cin>>A>>B;
  if(A<13)B/=2;
  cout<<(A>5?B:0)<<endl; 
  return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int a[210000];
    int num[210000] = {0};
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        ++num[a[i]-1];
    }
    
    sort(num, num + n);
    
    int ans = 0;
    for(int i = 0; i < n - k; ++i) ans += num[i];
    
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

int n;
int a[100];
bool vis[100];
int c[100];

bool check() {
  REP (i, n) ++c[a[i]];
  int x = *max_element(a, a+n);
  int y = (x + 1) / 2;

  if (x % 2) {
    if (c[y] < 2) return false;
    c[y] -= 2;
  } else {
    if (c[y] < 1) return false;
    c[y] -= 1;
  }
  
  for (int i = y+1; i <= x; i++) {
    if (c[i] < 2) return false;
    c[i] -= 2;
  }

  REP (i, y+1) if (c[i] > 0) return false;
  return true;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  REP (i, n) cin >> a[i];
  if (check())
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> u(n);
    for(int i=0; i<n; ++i) {
        cin >> u[i];
    }
    int m;
    cin >> m;
    bool locked = true;
    for(int i=0; i<m; ++i) {
        string t;
        cin >> t;
        if(find(begin(u), end(u), t) != end(u)) {
            if(locked) {
                cout << "Opened by " << t << "\n";
            } else {
                cout << "Closed by " << t << "\n";
            }
            locked = !locked;
        } else {
            cout << "Unknown " << t << "\n";
        }
    }
}


Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int A,B,C;
  cin>>A>>B>>C;
  cout<<A*B*C/max(A,max(B,C))/2<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}

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


int main() {
  map<ll,ll> mp;
  rep(i,3){
    ll a; cin >> a;
    mp[a]++;
  }
  for(auto it : mp){
    if(it.second == 1) cout << it.first << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  while(1){
    int h,w;
    cin>>h>>w;
    if(h==0 && w==0)break;
    char v[100][100];
    rep(i,h)scanf("\n%s",v[i]);
    int used[100][100]={};
    i=0;j=0;
    bool ans=true;
    while(1){
      if(used[i][j]){
        ans=false;
        break;
      }
      used[i][j]++;
      if(v[i][j]=='>')j++;
      else if(v[i][j]=='<')j--;
      else if(v[i][j]=='^')i--;
      else if(v[i][j]=='v')i++;
      else break;
    }
    if(ans)cout<<j<<" "<<i<<endl;
    else cout<<"LOOP"<<endl;
  }
}

Measured memory_bytes: 3184
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N 200005
#define ll long long
#define db double
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
int n,m,A[N];ll ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++) A[i]=(n-i)/m+1;
	A[0]--,ans=(ll)A[0]*A[0]*A[0];
	if(m%2==0)
	{
		A[m]=A[0];
		if(n%m>=m/2) A[m]++;
		ans+=(ll)A[m]*A[m]*A[m];
	}
//	for(int i=1;i<m;i++) if((i+i)%m==0) ans+=(ll)A[i]*A[i]*A[m-i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    long long n, k;
    scanf("%lld %lld", &n, &k);
    long long i, a, b;
    long long p[100005] = {};
    for (i = 0; i < n; i++)
    {
        scanf("%lld %lld", &a, &b);
        p[a] += b;
    }
    i = 0;
    while (k > 0)
    {
        k -= p[i];
        i++;
    }
    i--;
    printf("%lld\n", i);
    return 0;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	static long long X, A[2000], B[2000][2000], C[2010], ans = 1145141919810364364;
	cin >> N >> X;
	for (int i = 0; i < N; i++) cin >> A[i], B[i][0] = A[i];
	for (int i = 0; i < N; i++) {
		for (int j = 1; j < N; j++) {
			B[i][j] = min(B[i][j - 1], A[(i - j + N) % N]);
		}
	}
	for (int i = 0; i < N; i++) {
		C[i] = i * X;
		for (int j = 0; j < N; j++) {
			C[i] += B[j][i];
		}
	}
	for (int i = 0; i < N; i++) {
		ans = min(ans, C[i]);
	}
	cout << ans;
}

Measured memory_bytes: 31488
#include <iostream>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
int main(){
	int n,p;
	while(true){
		scanf("%d%d",&n,&p);
		if(n==0) break;
		int st[50]={},in=p;
		for(int cnt=0;;cnt++){
			if(cnt==n) cnt=0;
			if(in!=0) st[cnt]++,in--;
			else in+=st[cnt],st[cnt]=0;
			if(st[cnt]==p){
				printf("%d\n",cnt);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,m,a,b;cin>>n>>m>>a>>b;
  VV<char> v(n,V<char>(m,'.'));

  if(a-1>=m/2 && b-1>=n/2 && n%2 && m%2 && 3<=n && 3<=m && ((a-1-(m/2))%2==0||(b-1-(n/2))%2==0) ) {
    v[1][0]='^';v[2][0]='v';
    v[0][2]='^';v[1][2]='v';
    v[0][0]='<';v[0][1]='>';
    v[2][1]='<';v[2][2]='>';
    a-=2;
    b-=2;
  }

  if(n%2){
    rep(j,1,m){
      if(!a || j>=m)break;
      if(v[0][j-1]!='.')continue;

      v[0][j]='>';
      v[0][j-1]='<';
      a--;
    }
  }

  if(m%2){
    rep(i,1,n){
      if(!b || i>=n)break;
      if(v[i-1][0]!='.')continue;

      v[i][0]='v';
      v[i-1][0]='^';
      b--;
    }
  }

  rep(j,1,m){
    repr(i,0,n){
      if(!a)break;
      if(v[i][j-1]!='.' || v[i][j]!='.')continue;
      v[i][j-1]='<';
      v[i][j]='>';
      a--;
    }
  }

  rep(i,1,n){
    rep(j,0,m){
      if(!b)break;
      if(v[i-1][j]!='.' || v[i][j]!='.')continue;
      v[i-1][j]='^';
      v[i][j]='v';
      b--;
    }
  }

  /*/rep(i,0,n){
      rep(j,0,m){
        cout<<v[i][j];
      }
      cout<<ENDL;
    }*/

  if(!a && !b){
    cout<<"YES"<<ENDL;
    rep(i,0,n){
      rep(j,0,m){
        cout<<v[i][j];
      }
      cout<<ENDL;
    }
  }else{
    cout<<"NO"<<ENDL;
  }
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 2304