akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N){
  cout<<N/2+N%2<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    if (!solve2()) {
      out.println(-1)
    }
  }

  fun solve2(): Boolean {
    val N = ni()
    val A = nal(N + 1)
    if (N == 0) {
      if (A[0] != 1L) return false
      out.println(1)
      return true
    }

    if (A[0] != 0L) return false

    val MAX = 1e13.toLong() + 100

    val dp = LongArray(N + 1) // 親になるノード数の上限
    dp[0] = 1
    for (i in 1 .. N) {
      val mx = dp[i - 1] * 2
      dp[i] = min(MAX,mx - A[i])
      if (dp[i] < 0) return false
    }
    debug(dp)
    val dp2 = LongArray(N + 1)
    for (i in N downTo 1) {
      val nodes = dp2[i] + A[i]
      val mnPar = (nodes + 1) / 2
      val mxPar = nodes
//      val l = max(0, mnPar)
      if (dp[i - 1] < mnPar) return false

      val r = min(dp[i - 1], mxPar)
      dp2[i - 1] = r
    }

    debug(dp2)

    out.println(dp2.sum() + A.sum())
    return true
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


Measured memory_bytes: 51432
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}



 
int main(){
    string s;
    cin>>s;
    if(s.length()%2 != 0){
        puts("No");
        return 0;
    }
    for (ll i=0;i<s.length();i++){
            if (i%2==0){
                if (s[i]!='h'){
                    puts("No");
                    return 0;
                }
            }else{
                if (s[i]!='i'){
                    puts("No");
                    return 0;
                }
            }
        }
    puts("Yes");
        return 0;
    }
 
    
    



Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		int INF = Integer.MAX_VALUE/2;
		StringBuilder ans = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		int D = Integer.parseInt(sc.next());
		int[] c = new int[26];
		Arrays.setAll(c, i -> Integer.parseInt(sc.next()));
		int[][] s = new int[D][26];
		for(int i = 0; i < D; i++)
			Arrays.setAll(s[i], x -> Integer.parseInt(sc.next()));
		sc.close();
		int[] con = new int[D];
		TreeSet<Integer>[] used = new TreeSet[26];
		for(int i = 0; i < 26; i++) {
			used[i] = new TreeSet<>();
			used[i].add(-1);
		}
		for(int d = 0; d < D; d++) {
			int max = -INF, now = 0;
			for(int i = 0; i < 26; i++) {
				int temp = 0;
				temp += s[d][i];
				for(int j = 0; j < 26; j++)
					if(i != j)
						temp -= c[j] * (d - used[j].last());
				if(max < temp) {
					max = temp;
					now = i;
				}
			}
			con[d] = now;
			used[now].add(d);
		}
		for(int i = 0; i < 26; i++)
			used[i].add(D);
		Random r = new Random();
		while(true) {
			int d = r.nextInt(D);
			for(int q = 0; q < 26; q++) {
				if(q == con[d])
					continue;
				long temp = 0;
				temp -= s[d][con[d]];
				temp += s[d][q];
				temp -= c[con[d]] * (used[con[d]].ceiling(d) - d) * (d - used[con[d]].lower(d));
				temp += c[q] * (d - used[q].lower(d)) * (used[q].ceiling(d) - d);
				if(temp > 0) {
					con[d] = q;
					used[con[d]].remove(d);
					used[q].add(d);
				}
			}
			if(System.currentTimeMillis() - start > 1850)
				break;
		}
		for(int i : con)
			ans.append((i+1) + "\n");
		System.out.println(ans);
	}

}

Measured memory_bytes: 62312
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<sstream>
#include<algorithm>

using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define sRead(x,y,z)  scanf("%d%d%d",&x,&y,&z)
#define gc(x)  scanf(" %c",&x);
#define  INF (ll)1e14
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
const int N = 11000;
const int M=  2e5+5;
using namespace std;
typedef long long ll;
struct Edge
{
    int next;
    int to;
    ll dis;
}edge[M*2];
int head[M],tot;
ll d[M];bool vis[M];
inline void add(int from,int to,ll dis){
    edge[++tot].next = head[from];
    edge[tot].to = to;
    edge[tot].dis = dis;
    head[from] = tot;
}
struct node
{
    ll val;int id;
    node(){}
    node(int a,ll b):id(a),val(b){}
    bool operator <(node A)const{
        return val > A.val;
    }
};
void dij(int u)
{
    mmt(vis,0);
    d[u] = 0;
    priority_queue<node> Q;
    Q.push({u,0});
    node tmp;
    while(Q.size()){
        tmp = Q.top();
        Q.pop();
        int x = tmp.id;
        if(vis[x]) continue;
        for(int i =  head[x];~i;i = edge[i].next){
            int y = edge[i].to;
            ll dis = edge[i].dis;
            if(d[y] > d[x] +dis){
                d[y] = d[x] + dis;
                Q.push({y,d[y]});
            }
        }
    }
}
inline void init(int n)
{
    mmt(head,-1);
    tot = 0;
    for(int i = 1;i <= n;++i) d[i] = INF;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    init(n);
    int u,v;ll dis;
    for(int i = 1;i <= n;++i){
        add(i,i - 1,0);
    }
    for(int i = 1;i <= m;++i){
        cin>>u >> v>>dis;
        add(u,v,dis);
    }
    dij(1);
    if(d[n] == INF) cout<<-1<<endl;
    else cout<<d[n]<<endl;
}


Measured memory_bytes: 6776
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <cmath>

using namespace std;

long long arr[200010], sum[200010], ss;
int main() {
	long long n, m, mn = 1e15;
	cin >> n;
	cin >> arr[0];
	sum[0] = arr[0];
	for (int i = 1; i < n; ++i) {
		cin >> arr[i];
		sum[i] = sum[i - 1] + arr[i];
	}
	ss = arr[n - 1];
	for (int i = n - 2; i >= 0; --i) {
		mn = min(mn, abs(ss - sum[i]));
		ss += arr[i];
	}
	cout << mn;
	return 0;
}

Measured memory_bytes: 3328
/*
PROG: agc025a
LANG: C++11
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
 */
#include <bits/stdc++.h>

using namespace std;

template<class T>
void readi(T &x)
{
	T input = 0;
	bool negative = false;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = input * 10 + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	x = input;
}
template<class T>
void printi(T output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
template<class T>
void ckmin(T &a, T b)
{
	a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
	a = max(a, b);
}
long long randomize(long long mod)
{
	return ((1ll << 30) * rand() + (1ll << 15) * rand() + rand()) % mod;
}

#define MP make_pair
#define PB push_back
#define PF push_front
#define fi first
#define se second
#define debug(x) cerr << #x << " = " << x << endl;

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;

#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll

long long normalize(long long x, long long mod = INF)
{
	return (((x % mod) + mod) % mod);
}

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int S(int x)
{
	int res = 0;
	while(x)
	{
		res += (x % 10);
		x /= 10;
	}
	return res;
}

int N;
int ans = INF;

int32_t main()
{
	ios_base::sync_with_stdio(0); 
	srand(time(0));
	//	cout << fixed << setprecision(10);	
	//	cerr << fixed << setprecision(10);
	if (fopen("agc025a.in", "r"))
	{	
		freopen ("agc025a.in", "r", stdin);
	//	freopen ("agc025a.out", "w", stdout);
	}
	cin >> N;
	for (int i = 1; i < N; i++)
	{
		ckmin(ans, S(i) + S(N - i));
	}
	cout << ans << '\n';
	//	cerr << "time elapsed = " << (clock() / (CLOCKS_PER_SEC / 1000)) << " ms" << endl;
	return 0;
}


Measured memory_bytes: 256
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << endl;    
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
template <class X>
void printarr(X arr[], int n) 
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << ' ';
    cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;
 
ll fpow(ll a, ll n) {
    ll ans = 1;
    while (n) {
        if (n&1) ans = (ans*a)%modulo;
        a = (a*a)%modulo; n = n >> 1;
    }
    return ans;
}
 
void solve() {
	int n; cin >> n;
	pll arr[n];
	For(i,0,n) {
		ll x,l; cin >> x >> l;
		arr[i] = {x+l, x-l};
	}    
	sort(arr,arr+n);
	int ans = 1;
	ll curr_end = arr[0].F;
	For(i,1,n) {
		ll l,r; tie(r,l) = arr[i];
		if (l >= curr_end) {
			++ans;
			curr_end = r;
		}
	}
	cout << ans << endl;
}
 
int main() {
    fast_io();
    int t = 1;
    //cin >> t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int K;
int D[10] = {0};

bool Find(int x) {
  while (x) {
    const auto r = x % 10;
    for (int i = 0; i < K; ++i) {
      if (r == D[i]) return true;
    }
    x /= 10;
  }
  return false;
}

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

  int N;
  cin >> N >> K;
  for (int i = 0; i < K; ++i) cin >> D[i];

  for (int v = N;; ++v) {
    if (!Find(v)) {
      cout << v << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int N, K, T, U, V, L;
	cin >> N >> K >> T >> U >> V >> L;
	vector<int> Vec(N);
	for(int i = 0; i < N; ++i)
	{
		cin >> Vec[i];
	}

	int pos = 0;
	double time = 0;
	int carrot_time = 0;
	int point = 0;
	int carrot = 0;
	while(true)
	{
		pos++;
		if(carrot_time)
		{
			--carrot_time;
			time += 1.0 / V;
		}
		else
		{
			time += 1.0 / U;
		}
		if(carrot > 0 && carrot_time == 0)
		{
			--carrot;
			carrot_time = T * V;
		}
		if(pos == Vec[point])
		{
			if(point != Vec.size() - 1)
			{
				++point;
			}
			if(carrot < K)
			{
				if(carrot_time == 0)
				{
					carrot_time = T * V;
				}
				else
				{
					++carrot;
				}
			}
			else if(carrot == K)
			{
				carrot_time = T * V;
			}
		}
		
		if(pos == L)
		{
			printf("%.9f\n", time);
			break;
		}
	}
}

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

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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
#define MEM( arr, i ) memset( arr, i, sizeof (arr) )
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;


void precal() {


	 return;
}

void solve() {
	lli n, m, x, y;
	cin >> n >> m >> x >> y;
	vcL X, Y;
	
	X.push_back(x);
	Y.push_back(y);

	for (int i = 0; i < n; ++i) {
		int tmp;
		cin >> tmp;
		X.push_back(tmp);
	}
	
	for (int i = 0; i < m; ++i) {
		int tmp;
		cin >> tmp;
		Y.push_back(tmp);
	}

	sort( X.begin(), X.end() );
	sort( Y.begin(), Y.end() );
	
	if ( *X.rbegin() < *Y.begin() ) cout << "No War\n";
	else cout << "War\n";
}

int main() {
	precal();
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}


Measured memory_bytes: 384
use itertools::Itertools;
use proconio::input;

fn main() {
    input! {
        n: usize,
        xy: [(f64, f64); n],
    }

    let ans = xy
        .iter()
        .permutations(n)
        .map(|e| {
            e.windows(2)
                .map(|e| ((e[0].0 - e[1].0).powf(2.0) + (e[0].1 - e[1].1).powf(2.0)).sqrt())
                .sum::<f64>()
        })
        .sum::<f64>()
        / (1..=n).product::<usize>() as f64;

    println!("{}", ans);
}


Measured memory_bytes: 2188
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
ll MOD = 1000000007;
string yes = "Yes\n";
string no = "No\n";

int main() {
	ll total_height = 0, max_for_now = -1;
	ll n;
	cin>>n;
	vector<ll> a(n);
	for(ll i=0;i<n;i++) {
		cin>>a[i];
	}
	for(ll i=0;i<n;i++) {
		if(a[i]<max_for_now) {
			total_height += max_for_now - a[i];
		} else {
			max_for_now = a[i];
		}
	}
	cout<<total_height<<endl;
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
     
    #define REP(i,n) for(int i=0;i<(int)(n);++i)
    #define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
     
    using namespace std;
    typedef long long ll;
     
    int main(){
        int N;
        cin >> N;
        int a[N];
        REP(i,N){
            cin >> a[i]; 
        }
        sort(a,a+N);
        double ret = (double)a[0];
        
        FOR(i,1,N){
            ret += (double)a[i];
            ret /= 2;
        }

        cout << ret << endl;
    	return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int n,r,t;
  int a[5]={1,2,3,4,5};
  int b[7]={0,1,2,3,4,5,6};
  int c[7][5];
  vector<int> v;
  int count=0;
  rep(i,7) {
    rep(j,5) {
      count++;
      c[i][j]=count;
    }
  }
  cin >> n;
  rep(i,n){
    cin >> r >> t;
    bool flag1 = false,flag2 = false;
    if(r%100 != 0) flag1 = true;
    if(t%30 != 0) flag2 = true;
    r /= 100;
    t /= 30;
    int tmp1,tmp2;
    rep(i,7) if(t==b[i]) tmp1=t;
    rep(i,5) if(r==a[i]) tmp2=r-1;
    //cout << tmp1 << " " << tmp2 << " " << "#" << c[tmp1][tmp2] << endl;
    v.push_back(c[tmp1][tmp2]);
    if(flag1 == true) v.push_back(c[tmp1][tmp2+1]);
    if(flag2 == true) v.push_back(c[tmp1+1][tmp2]);
    if(flag1 == true && flag2 == true) v.push_back(c[tmp1+1][tmp2+1]);
    sort(v.begin(),v.end());
    rep(i,v.size()) {
      if(v.size()==1) cout << v[i] << endl;
      else if(i==v.size()-1) cout << v[i] << endl;
      else cout << v[i] << " ";
    }
    v.clear();
  }
  return 0;
}



Measured memory_bytes: 3116
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int k = in.nextInt();

            out.println(((k + 1) / 2) * (k / 2));
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



Measured memory_bytes: 21332
#include<stack>
#include<cstdio>
#include<vector>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int V_MAX=17;
const int INF=1<<29;

int ord[V_MAX],low[V_MAX];
void dfs(int u,int &c,stack<int> &S,bool *inS,const vector<int> *G,int &scc_id,int *scc){
	ord[u]=low[u]=c++;
	S.push(u);
	inS[u]=true;

	rep(i,G[u].size()){
		int v=G[u][i];
		if(ord[v]==-1){
			dfs(v,c,S,inS,G,scc_id,scc);
			low[u]=min(low[u],low[v]);
		}
		else if(inS[v]){
			low[u]=min(low[u],ord[v]);
		}
	}

	if(ord[u]==low[u]){
		int v;
		do{
			v=S.top(); S.pop();
			inS[v]=false;
			scc[v]=scc_id;
		}while(v!=u);
		scc_id++;
	}
}

int SCC(int n,const vector<int> *G,int *scc){
	static bool inS[V_MAX];
	rep(u,n){
		ord[u]=-1;
		inS[u]=false;
	}
	stack<int> S;
	int c=0,n_scc=0;
	rep(u,n) if(ord[u]==-1) dfs(u,c,S,inS,G,n_scc,scc);
	return n_scc;
}

template<class T>
struct edge{
	int v;
	T cost;
};

template<class T>
int minimum_arborescence(int n,const vector< edge<T> > *G_in,int root){
	static vector< edge<T> > buf[V_MAX],buf2[V_MAX],*G=buf,*G2=buf2;
	rep(u,n) G[u].clear();
	rep(u,n) rep(i,G_in[u].size()) {
		const edge<T> &e=G_in[u][i];
		if(u!=e.v) G[u].push_back(e);
	}

	T ans=0;
	while(1){
		static int from[V_MAX];
		static T mini[V_MAX];
		rep(u,n) from[u]=-1;
		rep(u,n) rep(i,G[u].size()) {
			const edge<T> &e=G[u][i];
			if(from[e.v]==-1 || mini[e.v]>e.cost){
				from[e.v]=u;
				mini[e.v]=e.cost;
			}
		}

		rep(v,n) if(v!=root) {
			ans+=mini[v];
			if(from[v]==-1) return INF;
		}

		static vector<int> H[V_MAX];
		rep(v,n) H[v].clear();
		rep(v,n) if(v!=root) H[from[v]].push_back(v);

		static int scc[V_MAX];
		int N=SCC(n,H,scc);
		if(n==N) return ans;

		rep(i,N) G2[i].clear();
		rep(u,n) rep(i,G[u].size()) {
			const edge<T> &e=G[u][i];
			if(scc[u]!=scc[e.v]){
				G2[scc[u]].push_back((edge<T>){scc[e.v],e.cost-mini[e.v]});
			}
		}
		swap(G,G2);
		n=N;
		root=scc[root];
	}
}

int main(){
	for(int n;scanf("%d",&n),n;){
		int a[16][17];
		rep(u,n){
			scanf("%d",a[u]+n);
			rep(v,n) scanf("%d",a[u]+v);
		}

		int root=n;
		vector< edge<int> > G[V_MAX];
		rep(u,n+1) rep(v,n) G[u].push_back((edge<int>){v,a[v][u]});

		printf("%d\n",minimum_arborescence(n+1,G,root));
	}

	return 0;
}

Measured memory_bytes: 1076
#include<bits/stdc++.h>
using namespace   std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define double    long double
#define ull       unsigned long long
#define mod       1000000007
#define vi        vector<ll>
#define extreme   inline
#define ppi       pair<ll,pair<ll,ll>>
#define pb        push_back
#define mp        make_pair
#define pi        2*acos(0.0)
#define pr(a,x,n) for(int i=x;i<n;i++){cout<<a[i]<<" ";}
#define p(a)      cout<<a;
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define test      cout<<"THIS_AND_THIS"<<endl;
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
#define MAX 100 
void printString(int n) 
{ 
    char str[MAX];
    int i = 0;
    while (n > 0) { 
        int rem = n % 26; 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
  
    return; 
} 
void solve(){
	
	ll n;cin>>n;
	printString(n);
}
int32_t main(){
	kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main() {
  int n;
  int64_t sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if (i%3 != 0 && i%5 != 0){
      sum += i;
    }
  }
  cout << sum << endl;
}



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

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

  if(c%2==0)
  {
    cout<<"Even"<<endl;
  }
  else
  {
    cout<<"Odd"<<endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  string s;
  cin >> s;
  const int n = s.size();
  s = "." + s; // 1-indexed

  if (s[1] == '0') { // s[1] must be 1
    cout << -1 << endl;
    return 0;
  }
  if (s[n] == '1') { // s[n] must be 0
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    if (s[i] != s[n-i]) { // s[i] must be same with s[n-i]
      cout << -1 << endl;
      return 0;
    }
  }

  // Here, s is valid. We make a tree called Caterpillar.
  queue<int> ones; // A container which contains the indices where s[i] == '1'
  for (int i = 1; i < n; ++i) {
    if (s[i] == '1') {
      ones.push(i);
    }
  }
  ones.push(n); // We treat n as the member of ones. This is the root.

  for (int i = 1; i < n; ++i) {
    if (i == ones.front()) { // i is in ones
      ones.pop();
    }
    cout << i << " " << ones.front() << endl;
  }
}


Measured memory_bytes: 1916
import java.util.Comparator;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<String, Map<Integer, Integer>> city = new TreeMap<>();
		for (int i = 1; i <= N; i++) {
			String s = sc.next();
			int p = sc.nextInt();
			Map<Integer, Integer> point = null;
			if (city.containsKey(s))
				point = city.get(s);
			else {
				point = new TreeMap<>(new Comparator<Integer>() {
					public int compare(Integer k1, Integer k2) {
						return k2.compareTo(k1) ;
					}
				});
			}
			point.put(p, i);
			city.put(s, point);
		}
		sc.close();
		for(Map<Integer, Integer> point : city.values()) {
			for(Integer index : point.values()) {
				System.out.println(index);
			}
		}
	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;

void Main(){

  int N; cin>>N;

  // XAGCX or AXGCX or XAGXC or XGACX or XACGX


  ll dp[N+1][4][4][4]={}; // A,C,G,T 3文字記録すれば良い 違反していないもの

  dp[0][3][3][3]=1;

  rep(i,N){

      rep(j,4){
          rep(k,4){
              rep(l,4){
                  rep(p,4){ // j,k,l,p
                      if(k==0 and l==2 and p==1) continue;
                      if(j==0 and l==2 and p==1) continue;
                      if(j==0 and k==2 and p==1) continue;
                      if(k==2 and l==0 and p==1) continue;
                      if(k==0 and l==1 and p==2) continue;
                      dp[i+1][k][l][p]+=dp[i][j][k][l];
                      dp[i+1][k][l][p]%=MOD;
                  }
              }
          }
      }

      // C X,A,G

      // C A,X,G

      // C A,G,X

      // C X,G,A

      // G X,A,C

  }

  ll ans=0;

  rep(j,4){
      rep(k,4){
          rep(l,4){
              ans+=dp[N][j][k][l];
              ans%=MOD;
          }
      }
  }

  cout<< ans<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


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

int main(){
    map<char , int> letter_fre;
    string a;
    cin >> a;
    for(auto i: a) {
        if(letter_fre.count(i) > 0) letter_fre[i]++;
        else letter_fre.insert(make_pair(i, 1));
    }
    bool c = true;
    for(auto i: letter_fre) {
        if(i.second % 2 != 0) {
            c = false;
            break;
        }
    }
    if(c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define pb push_back
int n;
long long int dp[22][(1<<21)+100], wynik;
vector <int> v[22];
int main()
{
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
	{
		for (int o=1; o<=n; o++)
		{
			int x;
			scanf("%d", &x);
			if(x==1) v[i].pb(o-1);
		}
	}
	for (int i=0; i<(int)v[1].size(); i++)
	{
		dp[1][(1<<v[1][i])]=1;
	}
	for (int i=1; i<=n; i++)
	{
		for (int o=0; o<=(1<<n)-1; o++)
		{
			if (dp[i][o]==0) continue;
			if (i!=n)
			{
				for (int j=0; j<(int)v[i+1].size(); j++)
				{
					if ((o&(1<<v[i+1][j]))==0)
					{
						dp[i+1][(o|(1<<v[i+1][j]))]=(dp[i+1][(o|(1<<v[i+1][j]))]+dp[i][o])%M;
					}
				}
			}
			
			
			if (i==n)
			{
				wynik=(wynik+dp[i][o])%M;
			}
		}
	}
	printf("%lld", wynik%M);
}


Measured memory_bytes: 309504
/* prime_factorization.cpp
    素因数分解

    verified: AOJ NTL_1_A
        http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A&lang=ja
*/
#include <bits/stdc++.h>
using namespace std;

/*  prime_factor(n)
    入力：整数 n
    出力：nの素因数分解
    計算量：O(√n)前後
*/
template <typename T>
vector<pair<T, T>> prime_factor(T n) {
    vector<pair<T, T>> ret;
    for (T i = 2; i * i <= n; i++) {
        T tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}

int main() {
    long long N;
    cin >> N;
    vector<pair<long long, long long>> prime_fac = prime_factor(N);

    cout << N << ":";
    for (auto p : prime_fac) {
        for (int i = 0; i < p.second; i++) {
            cout << " " << p.first;
        }
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3320
/*
    Created by Rahul Goel.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/*******************************************************************************/
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*******************************************************************************/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
ll mod_sum() { return 0LL; }
template < typename T, typename... Args >
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%MOD + MOD)%MOD; }
/*******************************************************************************/
ll mod_prod() { return 1LL; }
template< typename T, typename... Args >
T mod_prod(T a, Args... args) { return (a * mod_prod(args...))%MOD; }
/*******************************************************************************/
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/
using pii = pair < ll, ll >;
using vi = vector < ll >;
using vb = vector < bool >;
using vvi = vector < vector < ll > >;
using vvb = vector < vector < bool > >;
using vpii = vector < pii >;
using vvpii = vector < vector < pii > >;
/*******************************************************************************/
//.-.. . -. -.- .- .. ... .-.. --- ...- .
/*
    Code begins after this.
*/

ll solve() {
    ll n;
    cin >> n;
    string ans;
    for (ll i = 0; i < n; i++) {
        ans += "ACL";
    }
    cout << ans << endl;
    return 0;
}

signed main() {
    fastio;

    ll t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


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

int main() {
	int L, R, d;
	cin >> L >> R >> d;

	int count = 0;
	for (int i = L; i < R + 1; i++) {
		if (i % d == 0) {
			count++;
		}
	}

	cout << count << endl;
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  for (ll i = 0; i < N - 1; ++i) {
    A.at(i + 1) += A.at(i);
  }
  vector<ll> sum(N + 1, 0);
  for (ll i = 0; i < N; ++i) {
    sum.at(i + 1) = (A.at(i) - i - 1) % K;
  }
  map<ll, ll> mp;
  if (K > N) {
    for (ll i = 0; i <= N; ++i) {
      mp[sum.at(i)] += 1;
    }
    ll ans = 0;
    for (const auto& [key, value] : mp){
      ans += value * (value - 1) / 2;
    }
    cout << ans << "\n";
  }
  else {
    for (ll i = 0; i < K; ++i) {
      mp[sum.at(i)] += 1;
    }
    ll ans = 0;
    for (ll i = 0; i <= N; ++i) {
      ans += mp[sum.at(i)] - 1;
      mp[sum.at(i)] -= 1;
      if (i + K <= N) {
        mp[sum.at(i + K)] += 1;
      }
    }
    cout << ans << "\n";
  }

  // for (ll i = 0; i <= N; ++i) {
  //   cout << sum.at(i) << " ";
  // }
  // cout << "\n";
}


Measured memory_bytes: 18764
#include<bits/stdc++.h>
#define rep(i, n) for(i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
 
ll Greatest_common_divisor(ll a, ll b){
  if(b == 0){
    return a;
  } else {
    return Greatest_common_divisor(b, a%b);
  }
}
 
int main(){
  ll A, B;
  cin >> A >> B;
  
  ll c, j = 0, d, count = 1;
  vector<ll> list;
  c = Greatest_common_divisor(A, B);
  d = c;
  
  
  for (ll i = 2; i <= sqrt(d) + 1; i++){
    if(c%i == 0){
      count++;
      while(c%i == 0){
        c /= i;
      }
    }
  }
  
  if(c > 1){
    count ++;
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(str, input().split()))

b = collections.deque()

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
if n % 2 == 0:
    print(" ".join(b))
else:
    b = reversed(b)
    print(" ".join(b))

Measured memory_bytes: 26564
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n), cnt(n, 0);
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }
    int cur = 0;
    ll cou = 0;
    while(true){
        if(cnt[cur] > 0 || cou == k) break;
        cnt[cur] = cou;
        cur = a[cur];
        cou++;
    }
    if(cou == k){
        cout << cur + 1 << endl;
        return 0;
    }
    k -= cnt[cur];
    k %= (cou - cnt[cur]);
    cou = 0;
    while(true){
        if(cou == k) break;
        cur = a[cur];
        cou++;
    }
    cout << cur + 1 << endl;
    return 0;
}

Measured memory_bytes: 6368
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int n, a[1010]={0};
    while(cin >> n){
        int min=1000001;
        if(n == 0)  break;
        for(int i=0; i< n; i++){
            cin >> a[i];
        }
        for(int i=0; i<n; i++){
            for(int j=i+1; j<n; j++){
                if(min > abs(a[j]-a[i]))    min=abs(a[j]-a[i]);
            }
        }
        cout << min <<endl;
    }
    return 0;
}



Measured memory_bytes: 3000
#include <bits/stdc++.h>
//#pragma comment(linker, "/STACK:1024000000,1024000000") 
#define MOD 998244353
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define set0(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
#define rep(i,l,r) for(int i=l;i<r;i++)
using namespace std;
string s;
int n,sum;
long long dp[200005][3][3],ans=1;
bool flag=1;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s;
	n=s.length();
	sum=s[0]-'a';
	for(int i=1;i<n;i++){
		(sum+=s[i]-'a')%=3;
		flag&=(s[i]==s[i-1]);
		(ans*=3ll)%=MOD;
	}
	if(flag){
		cout<<"1\n";
		return 0;
	}
	if(n<=3){
		if(n==2)cout<<"2\n";
		else{
			if(s[0]==s[1] || s[1]==s[2])cout<<"6\n";
			else if(s[0]==s[2])cout<<"7\n";
			else cout<<"3\n";
		}
		return 0;
	}
	dp[0][0][0]=dp[0][1][1]=dp[0][2][2]=1;
	rep(i,1,n)rep(j,0,3)rep(k,0,3)rep(l,0,3){
		if(k!=l)(dp[i][(j+l)%3][l]+=dp[i-1][j][k])%=MOD;
	}
	for(int i=0;i<3;i++)(ans+=MOD-dp[n-1][sum][i])%=MOD;
	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			(ans+=MOD-1)%=MOD;
			break;
		}
	}
	cout<<(ans+1)%MOD<<endl;
	return 0;
}

Measured memory_bytes: 14612
#include <stdio.h>
#define min(a, b) ((a)>(b) ? (b) : (a))
int main(){
  int field[3][3];
  int rowmin[3];
  for(int i=0; i<3; i++){
    int mini = 101;
    for(int j=0; j<3; j++){
      scanf("%d", &field[i][j]);
      mini = min(mini, field[i][j]);
    }
    rowmin[i] = mini;
  }
  for(int i=0; i<3; i++){
    int kari = field[0][i] - rowmin[0];
    for(int j=1; j<3; j++){
      if(field[j][i] - rowmin[j] != kari){
	printf("No\n");
	return 0;
      }
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t,k;
    cin>>t>>k;
    int arr[t];
    for(int i=0;i<t;i++){
        cin>>arr[i];
    }
    sort(arr,arr+t);
    int sum=0;
    for(int i=0;i<k;i++){
        sum+=arr[i];
    }
    cout<<sum<<endl;
}


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

using namespace std;

#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz(x) ((int)(x).size())

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

const int N = 1e5 + 5;

ll ans = 9e18L;

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

	ll h, w;
	cin >> h >> w;
	if(h > w) swap(h, w);

	ans = min(ans, (w % 3 > 0) * h);
	ans = min(ans, (h % 3 > 0) * w);
	for(ll i = 1; i < w; ++i) {
		ll mx = max(i * h, (w - i) * ((h + 1) / 2));
		ll mn = min(i * h, (w - i) * (h / 2));
		ans = min(ans, mx - mn);
	}
	for(ll i = 1; i < h; ++i) {
		ll mx = max(i * w, (h - i) * ((w + 1) / 2));
		ll mn = min(i * w, (h - i) * (w / 2));
		ans = min(ans, mx - mn);
	}
	cout << ans;


	return 0;
}


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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define all(c) begin(c),end(c)

template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

auto solve() {
    int N;
    cin>>N;
    vi a(N);
    for (auto &&e:a) cin >> e;

    double avr = accumulate(all(a), 0.0) / N;
    vector<double> diff(N);
    double mn = 1<<29;
    REP(i,N) {
        diff[i] = abs(avr - a[i]);
        mn = min(mn, diff[i]);
    }
    REP(i,N) {
        if(mn == diff[i])
            return i;
    }

    return -1;
}

int main() {
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 256
from math import sqrt, factorial
from itertools import permutations
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


class Solver(object):
    def __init__(self):
        pass

    def solve(self, N: int, cities: list):
        dist = float()
        for p in permutations(range(N)):
            for index, n in enumerate(p):
                if index == 0:
                    a = cities[n]
                    continue
                else:
                    b = a
                    a = cities[n]
                    dist += self.__distance(a, b)
        return dist/factorial(N)

    def __distance(self, a: list, b: list) -> float:
        return sqrt(abs(a[0]-b[0])*abs(a[0]-b[0]) + abs(a[1]-b[1])*abs(a[1]-b[1]))


def main():
    N = int(input())
    t_l = [[int(i) for i in input().split()] for _ in range(N)]

    solver = Solver()
    print(solver.solve(N, t_l))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    x = int(input())
    if x == 7 or x == 5 or x == 3:
        print('YES')
    else:
        print('NO')
 
if __name__ =='__main__':
    main()   


Measured memory_bytes: 3060
/* ex4_3
    riverstone*/

#include<stdio.h>

int main(void){

    int height_West, height_East;
    int ans;
    scanf("%d %d",&height_West, &height_East);//西と東の埋もれていない棒の高さを受け取る

    ans=snowdepth(height_West, height_East);//関数snowdepthで計算した結果をansに代入
    printf("%d\n",ans);//ansを出力
    return 0;

}

//雪の深さを計算する関数の定義
int snowdepth(int height_a, int height_b){
    //雪の深さは以下のように定義される
    //(height_b-height_a)*(height_b-height_a +1)/2は東の棒の高さ。それから雪に埋もれていない分の高さを引く
    int snow_height=(height_b-height_a)*(height_b-height_a +1)/2 -height_b;
    return snow_height;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;


int main(){
  int w,a,b; cin >> w >> a >> b;
  int ar = a+w, br = b+w;
  if(a <= b && b <= ar){
    cout << 0 << endl;
    return 0;
  }
  if(a <= br && br <= ar){
    cout << 0 << endl;
    return 0;
  }
  int dist = abs(ar-b);
  dist = min(dist, abs(a-br));
  cout << dist << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define INF 0x3fffffff
using namespace std;

int n,m;
int ans,best;
int f[50][50];

int main()
{
    while(~scanf("%d",&n)&&n)
    {
        m=0;
        best=INF;
        for(int i=0;i<9;i++)
            for(int j=0;j<9;j++)
            {
                if(i==j)
                {
                    f[i][j]=0;
                    continue;
                }
                f[i][j]=INF;
            }
        for(int i=1;i<=n;i++)
        {
            int x,y,va;
            scanf("%d%d%d",&x,&y,&va);
            f[x][y]=f[y][x]=va;
            m=max(m,max(x,y));
        }

        for(int k=0;k<=m;k++)
            for(int i=0;i<=m;i++)
                for(int j=0;j<=m;j++)
                    f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
        for(int i=0;i<=m;i++)
        {
            int sum=0;
            for(int j=0;j<=m;j++)
                sum+=f[i][j];
            if(best>sum)
            {
                best=sum;
                ans=i;
            }
        }
        printf("%d %d\n",ans,best);
    }
}

Measured memory_bytes: 2596
#include<iostream>
#include<stdio.h>

int main(){
  int H,W,i,j;
  while(true){
    scanf("%d %d",&H,&W);
    if(H==0 && W==0)break;
    for(i=0;i<H;i++){

      if(i==0 || i==H-1){
        for(j=0;j<W;j++){
          printf("#");//上底と下底                           
        }
      }else{
        printf("#");//左枠                                           
        for(j=0;j<W-2;j++){
          printf(".");
        }
        printf("#");//右枠                                    
      }
      printf("\n");

    }
    printf("\n");

  }
  return 0;
}


Measured memory_bytes: 3136
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding


	int n;
	cin>>n;
	int sum = 0;
	if(n>=10){
		sum+=9;
	}if(n>=1000){
		sum+=900;
	}if(n>=100000){
		sum+=90000;
	}

	if(n<10){
		sum+=(n%10);
	}if(n>=100&&n<1000){
		sum += 100*((n/100)-1);
		sum+=(n%100)+1;
	}if(n>=10000&&n<100000){
		sum += 10000*((n/10000)-1);
		sum+=(n%10000)+1;
	}
	cout<<sum<<endl;

	
	return 0;
}
int main(){
	int test = 1;
  	//scanf("%d", &test);
  	while (test--)solve();return 0;
}

Measured memory_bytes: 256