akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

template<ll MOD> class MInt {
  ll value;
public:
  MInt() : value(0) {}
  MInt(int v) : value(v) {}
  MInt(ll v) : value(v) {}
  MInt& operator+=(const MInt<MOD> &r) {
    value += r.value; if (value > MOD) value -= MOD; return *this;
  }
  MInt& operator-=(const MInt<MOD> &r) {
    value -= r.value; if (value < 0) value += MOD; return *this;
  }
  MInt& operator*=(const MInt<MOD> &r) {
    value *= r.value; value %= MOD; return *this;
  }
  MInt& operator/=(const MInt<MOD> &r) {
    (*this) *= r.inv(); return *this;
  }
  MInt operator+(const MInt<MOD> &r) const { MInt result = *this; result += r; return result; }
  MInt operator-(const MInt<MOD> &r) const { MInt result = *this; result -= r; return result; }
  MInt operator*(const MInt<MOD> &r) const { MInt result = *this; result *= r; return result; }
  MInt operator/(const MInt<MOD> &r) const { MInt result = *this; result /= r; return result; }
  MInt pow(ll p) const {
    MInt result = 1, x = *this;
    for (;p;p >>= 1) {
      if (p & 1) result *= x;
      x *= x;
    }
    return result;
  }
  MInt inv() const { return this->pow(MOD - 2); }
  operator ll() const { return value; }
  
};

typedef MInt<1000000007> Int;

class C_cls {
  static const int N = 1000000;
  vector<Int> facts;
public:
  C_cls() : facts(vector<Int>(N, 1)){
    FOR(i,1,N) facts[i] = facts[i-1] * Int(i);
  }
  Int choose(int n, int r) { return facts[n] / (facts[r] * facts[n-r]); }
};

C_cls C;

Int calc(int n, int m, int k) {
  Int result = 0;
  REP(d,n) {
    result += Int(n - d) * Int(m) * Int(m) * C.choose(n * m - 2, k - 2) * Int(d);
  }
  return result;
}

int main() {
  int n, m, k;
  while (cin >> n >> m >> k) {
    cout << calc(n, m, k) + calc(m, n, k) << endl;
  }
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define decimal fixed << setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;

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

    int ans = 0;
    rep(i, n){
        bool f=false;
        for(int j=i; j>=0; j--){
            if(h[j] > h[i]) f=true;
        }
        if(!f) ans++;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
    #include <string>
    #include <set>  
    #include <algorithm>
    #include <vector>
    #include <cmath>
    #include <queue>
    #include <deque>
    #include <cstring>
    #include <cstdio>
    #include <map>
    #include <numeric>
    #include <cassert>
    #include <iomanip>
    #include <sstream>
using namespace std;
int n,p,ch=0;
long long ans=1;
int main()
{
	cin>>n>>p;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		if(a%2)ch=1;
		ans*=2;
	}
	if(ch)cout<<ans/2<<endl;
	else if(p)cout<<0<<endl;
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n; cin >> n;
  string s;
  map<string,int> blue;
  map<string,int> red;

  REP(i,n) { cin >> s; blue[s]++; }
  int m; cin >> m;
  REP(i,m) { cin >> s; red[s]++; }

  int ans = 0;
  for (auto x : blue) ans = max(ans, x.second - red[x.first]);
  COUT(ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
typedef long long ll;
map<long long, long long> primefact;
const ll MOD = 1'000'000'007;
void factprime(long long x, map<ll, ll> &pf)
{
    long long i = 2;
    long long cur = x;
    while (cur >= 2)
    {
        bool flag = false;
        for (long long i = 2;; i++)
        {
            if (i * i > cur)
            {
                flag = true;
                pf[cur]++;
                break;
            }
            if (cur % i == 0)
            {
                cur = cur / i;
                pf[i]++;
                break;
            }
        }
        if (flag)
            break;
    }
}
int main(void)
{
    int n;
    cin >> n;
    long long ans = 1;
    for (ll i = 2; i <= n; i++)
    {
        factprime(i, primefact);
    }
    for (auto i : primefact)
    {
        ans = (ans * (i.second + 1)) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline
X, K, D = map(int, input().split())
A=int((K-X/D)/2)
if 0<=A and A<=K:print(min(abs(-K*D+2*A*D+X),abs(-K*D+2*(A+1)*D+X)))
else:print(min(abs(X+K*D),abs(X-K*D)))

Measured memory_bytes: 9168
n,k = gets.chomp.split.map(&:to_i)
pp = gets.chomp.split.map(&:to_i)
q = []
qq = [0]
pp.each do |num|
    q.push(1+num)
end
i=0
for i in 0..(n-1)
    qq.push(qq[i]+q[i])
end
max = 0
j = 0
while true
    maximum = qq[k+j]-qq[j]
    max = max > maximum ? max : maximum
    j += 1
    if (k+j-1) == n
        break
    end
end
print max / 2.0


Measured memory_bytes: 31208
#include<bits/stdc++.h>
using namespace std;
 
const int N = 1e5+3;
vector<int>v[N];
bool vis[N];
list<int>L;
list<int>::iterator it;
void dfs(int u,bool des)
{
    for(int i=0; i<v[u].size(); ++i)
    {
        int e = v[u][i];
        if(!vis[e])
        {
            if(!des) L.push_back(e);
            else L.push_front(e);
            vis[e] = true;
            dfs(e,des);
            return;
        }
    }
}
int main()
{
    int n, m, a, b;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&a,&b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    L.push_back(1);
    L.push_back(v[1][0]);
    vis[1] = vis[v[1][0]] = true;
    dfs(1,true);
    dfs(v[1][0],false);
    printf("%d\n",L.size());
    for(it=L.begin(); it!=L.end(); ++it)
        printf("%d ",*it);
    printf("\n");
    return 0;
}

Measured memory_bytes: 9472
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    vector<vector<ll> >a(10,vector<ll>(10));
    ll k=0;
    ll kk=1;
    REP(i,1,n+1){
        ll c=i;
        ll kk=1;
        while(c){
            c/=10;
            kk*=10;
        }
        kk/=10;
        a[i%10][i/kk]++;
    }
    ll ans=0;
    REP(i,1,10){
        REP(j,1,10){
            ans+=a[i][j]*a[j][i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using static System.Console;
using static System.Math;
class E { static void Main() => new K(); }
class K
{
	int[] G() => ReadLine().Split().Select(x => int.Parse(x)).ToArray();
	public K()
	{
		var I = G();
		int Y = I[0], X = I[1];
		var m = new char[X, Y];
		for (var y = 0; y < Y; y++)
		{
			var s = ReadLine();
			for (var x = 0; x < X; x++) m[x, y] = s[x];
		}
		var ans = 0L;
		for (var x = 0; x < X - 1; x++)
		{
			var p = new int[Y + 1, Y + 1];
			for (var i = 0; i < Y; i++) if (m[x, i] == m[x + 1, i]) p[0, 0]++;
			for (var a = 1; a <= Y; a++) for (var i = 0; i < Y - a; i++) if (m[x, i] == m[x + 1, i + a]) p[a, 0]++;
			for (var b = 1; b <= Y; b++) for (var i = 0; i < Y - b; i++) if (m[x, i + b] == m[x + 1, i]) p[0, b]++;
			for (var a = 1; a <= Y; a++) for (var b = 1; b <= Y; b++) p[a, b] = p[a - 1, b - 1] - (m[x, Y - a] == m[x + 1, Y - b] ? 1 : 0);
			var dp = new int[Y + 1, Y + 1];
			for (var a = Y - 1; a >= 0; a--) for (var b = Y - 1; b >= 0; b--) dp[a, b] = p[a, b] + Min(dp[a, b + 1], dp[a + 1, b]);
			ans += dp[0, 0];
		}
		Console.WriteLine(ans);
	}
}


Measured memory_bytes: 20980
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vecl<T: FromStr>(n: usize) -> Vec<T> {
    let mut v = vec![];
    for _ in 0..n {
        v.push(read::<T>());
    }

    v
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    const M: i64 = 1000000007;

    let n = read::<usize>();

    let s1: Vec<_> = read::<String>().chars().collect();
    let s2: Vec<_> = read::<String>().chars().collect();

    let a = (0..n).fold(1, |dp, i| {
        if s1[i] == s2[i] {
            if i == 0 {
                3
            } else if s1[i - 1] == s2[i - 1] {
                dp * 2 % M
            } else {
                dp
            }
        } else {
            if i == 0 {
                6
            } else if s1[i] == s1[i - 1] {
                dp
            } else if s2[i] == s2[i - 1] {
                dp
            } else if s1[i - 1] == s2[i - 1] {
                dp * 2 % M
            } else {
                dp * 3 % M
            }
        }
    });

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


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

const int N = 505;
using LL = long long;
int dp[N][N], n, mod, l[N], r[N];
struct node { int val, id, typ; } data[N];
void reduce(int &x) { x += x >> 31 & mod; }
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> mod;
	for (int i = 0; i < n; ++i)
		l[i] = std::ceil(std::sqrt(n * n - i * i)), r[i] = std::sqrt(4 * n * n - i * i) + 1;
	for (int i = n; i < n + n; ++i)
		r[i] = std::sqrt(4 * n * n - i * i) + 1;
	r[0] = 2 * n;
	for (int i = 0; i < n; ++i)
		data[i] = {l[i], i, 0};
	for (int i = n; i < 2 * n; ++i)
		data[i] = {r[i], i, 1};
	std::sort(data, data + n + n, [] (node a, node b) { return a.val != b.val ? a.val < b.val : r[a.id] < r[b.id]; });
	int ans = 0;
	for (int k = 0; k <= n; ++k) {
		std::memset(dp, 0, sizeof dp);
		dp[0][0] = 1; int bsum = 0, asum = 0;
		for (int i = 0; i < n * 2; ++i) {
			for (int j = 0; j <= k; ++j) {
				if (data[i].typ == 0) {
					// choose a
					reduce(dp[i + 1][j + 1] -= (LL) dp[i][j] * (data[i].val - j - bsum) % mod);
					// choose c
					reduce(dp[i + 1][j] += (LL) dp[i][j] * (r[data[i].id] - k - n - (asum - j)) % mod - mod);
				} else {
					// choose b
					reduce(dp[i + 1][j] += (LL) dp[i][j] * (data[i].val - j - bsum) % mod - mod);
				}
			}
			if (data[i].typ == 1) ++bsum;
			else ++asum;
		}
		// std::cout << dp[4][0] << std::endl;
		reduce(ans += dp[n * 2][k] - mod);
	}
	std::cout << ans << '\n';
	return 0;
}


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

int main(){
  string s;
  cin >> s;
  int ch=0;
  int sz = s.size();
  int szt = sz/2;
  if(sz%2==1){
    rep(i, szt){
    int szo = sz -1 -i;
    if(s.at(i)!=s.at(szo)){
      ch = 1;
      cout << "No" << endl;
      break;
    }
    //cout << szo << endl;
  }  
  if(ch==0){
    int  szf = szt/2;
    rep(i, szf){
      int szk=szt-i-1;
      int szp = szt+i+1;
      int szq = sz -i-1;
      if(s.at(i)!=s.at(szk) || s.at(szp)!=s.at(szq)){
        ch = 2;
        cout << "No" << endl;
        break;
      }
    }
    if(ch!=2){
      cout << "Yes" << endl;
    }
  }
  }
  else if(sz%2==3){
  rep(i, szt){
    int szo = sz -1 -i;
    if(s.at(i)!=s.at(szo)){
      ch = 1;
      cout << "No" << endl;
      break;
    }
    //cout << szo << endl;
  }  
  if(ch==0){
    int  szf = szt/2;
    rep(i, szf){
      int szk=szt-i-1;
      int szp = szt+i+1;
      int szq = sz -i-1;
      if(s.at(i)!=s.at(szk) || s.at(szp)!=s.at(szq)){
        ch = 2;
        cout << "No" << endl;
        break;
      }
    }
    if(ch!=2){
      cout << "Yes" << endl;
    }
  }
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>

using namespace std;

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

int N, K;
pair<int, int> E[200000];
vector<int> G[200000];
set<int> S[200000];
int ans[200000];
int deg[200000];
int C;

void dfs(int u, int p, int c) {
  for (int i : G[u]) {
    int v = E[i].first == u ? E[i].second : E[i].first;
    if (v == p) continue;
    if (deg[u] <= C) {
      c = (c + 1) % C;
      ans[i] = c;
      dfs(v, u, c);
    } else {
      dfs(v, u, 0);     
    }
  }
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, K = 0;
  cin >> N;
  REP(i, N - 1) {
    cin >> E[i].first >> E[i].second;
    E[i].first--;
    E[i].second--;
    G[E[i].first].push_back(i);
    G[E[i].second].push_back(i);
    deg[E[i].first]++;
    deg[E[i].second]++;
  }
  int k = 1 << 18;
  for (int i = 1 << 18; i >= 1; i >>= 1) if (k - i >= 0) {
    int c = 0;
    REP(j, N) c += deg[j] > k - i;
    if (c <= K) {
      k -= i;
    }
  }
  C = k;
  cout << C << '\n';
  if (C > 1) dfs(0, -1, 1);
  REP(i, N - 1) cout << ans[i] + 1 << '\n';
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

char ans[125252];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  ll a, b, c;
  string s[125252];
  cin>>n>>a>>b>>c;
  REP(i, n){
    cin>>s[i];
  }
  ll x[3];
  x[0]=a;x[1]=b;x[2]=c;
  REP(i, n){
    int c1=s[i][0]-'A', c2=s[i][1]-'A';
    if(x[c1]<x[c2]){
      ans[i]=s[i][0];
      ++x[c1];--x[c2];
    }
    else if(x[c1]>x[c2]){
      ans[i]=s[i][1];
      --x[c1];++x[c2];
    }
    else{
      int n1=-1, n2=-1;
      if(i<n-1){
        n1=s[i+1][0]-'A';n2=s[i+1][1]-'A';
      }
      if(c1==n1 || c1==n2){
        // DEBUG(c1);
        ans[i]=s[i][0];
        ++x[c1];--x[c2];
      }
      else{
        ans[i]=s[i][1];
        --x[c1];++x[c2];
      }
    }
    if(x[c1]<0 || x[c2]<0){
      cout<<"No"<<'\n';
      return 0;
    }
  }
  cout<<"Yes"<<'\n';
  REP(i, n){
    cout<<ans[i]<<'\n';
  }
  return 0;
}


Measured memory_bytes: 7680
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	n := scanInt(sc)

	ns := make([]int, n)
	for i := 0; i < n; i++ {
		ns[i] = scanInt(sc)
	}

	sorted := make([]int, n)
	for i, n := range ns {
		sorted[i] = n
	}
	sort.Ints(sorted)

	first := sorted[n-1]
	second := sorted[n-2]

	w := bufio.NewWriter(os.Stdout)
	for i := 0; i < n; i++ {
		if ns[i] == first {
			fmt.Fprintln(w, second)
		} else {
			fmt.Fprintln(w, first)
		}
	}
	w.Flush()
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}


Measured memory_bytes: 6912
def selection_sort(data)
  swap_count = 0
  last_index = data.size - 1
  0.upto(last_index) { |i|
    minj = i
    i.upto(last_index) { |j|
      minj = j if data[j] < data[minj]
    }
    if minj != i
      data[i], data[minj] = data[minj], data[i]
      swap_count += 1
    end
  }
  [data, swap_count]
end

data = $stdin.read.lines[1].split("\s").map(&:to_i)
sorted, swap_count = selection_sort(data)
puts sorted.join(' ')
puts swap_count

Measured memory_bytes: 8620
#include <bits/stdc++.h>
using namespace std;
 
//#define READ_NUMBER(i) scanf("%d",i)
 
int main(){
	int A, B, C;
	cin >> A >> B >> C;
	if(C < B / A){
		cout << C << endl;
	}else{
		cout << B / A << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    int x;
    for (int i = 0; i < n; ++i) {
        cin >> x;
    }
    int ans = 1;
    n = n - k;
    while (n >= k) {
        n = n - (k - 1);
        ++ans;
    }
    if (n > 0) {
        ++ans;
    }
    cout << ans << endl;

    return 0;
}

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

int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(){
    int N,K,*x,*ABS1,*ABS2,i,abs1=1,abs2=1,minim=1000000000;
    cin >> N >> K;
    x = new int[N];
    ABS1 = new int[N];
    ABS2 = new int[N];
    for(i=0;i<N;i++){
        ABS1[i] = 0;
        ABS2[i] = 0;
    }
    for(i=0;i<N;i++){
        cin >> x[i];
        if(x[i]<0){
            ABS1[abs1] = abs(x[i]);
            abs1++;
        }
        else if(x[i]==0){
            K--;
        }
        else{
            ABS2[abs2] = abs(x[i]);
            abs2++;
        }
    }
    qsort(ABS1,abs1,sizeof(int),compare_int);
    //abs1 = abs2 = 0;
    for(i=0;i<=K;i++){
        if(i<abs1&&K-i<abs2){
            if(ABS1[i]<ABS2[K-i]){
                minim = min(minim,ABS1[i]*2+ABS2[K-i]);
            }else{
                minim = min(minim,ABS1[i]+ABS2[K-i]*2);
            }
        }
        //cout << minim << endl;
    }
    if(minim==1000000000){
        cout << 0 << endl;
    }else{
        cout << minim << endl;
    }
    return 0;
}

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

namespace ConsolePractice
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string[] str = Console.ReadLine().Split(' ');
            int x = int.Parse(str[0]);
            int y = int.Parse(str[1]);            
            int c = x+y/2;
            Console.Write(c.ToString());
           
        }
    }
}


Measured memory_bytes: 11092
"use strict";

function main(input){
  const args = input.trim().split(' ').map(_=>parseInt(_,10));
  const n = args[0];
  const y = args[1];
  
  for(let i=0; i<=n; i++){
    for(let k=0; k<=n-i; k++){
      const x = 10000*i + 5000*k + 1000*(n - i - k);
      if(x == y) {
        console.log([i,k,n-i-k].join(' '));
        return;
      }
    }
  }
  
  console.log("-1 -1 -1");
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

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

int main(void){
    ll N;
    cin >> N;
    vector<ll> A(N-1);
    vector<vector<ll>> B(N);
    
    for(int i=0; i<N-1; i++){
        cin >> A[i];
        B[A[i]].push_back(i);
    }
    for(int i=1;i<N;i++){
        cout << B[i].size() << endl;
    }
    cout << 0 << endl;
}

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

using namespace std;

int main()
{
  int n;
  cin >> n;
  double x;
  while(n--)
  {
    double a;
    cin >> a;
    x=x+((double)(1))/a;
  }

  x=((double)(1))/x;

  cout << fixed << setprecision(9) << x;

}


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

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		

		
		String s = sc.next();
		
		int  count = 0;
		// 15 8以上
		for(char c: s.toCharArray()) {
			if(c == 'o') {
				count++;
			}
		}
		
		int rest = 15 - s.length();
		String answer = (count + rest) >= 8 ? "YES" : "NO";
		System.out.println(answer);
		
		

	}
	


}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        long m = Long.parseLong(sc.next());
        long ans = 0;
        if (n * 2 == m) {
            ans = n;
        } else if (n * 2 > m) {
            ans = m / 2;
        } else {
            long temp = m - n - n;
            temp = (temp / 4) + n;
            ans = temp;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
S = input()
cond1 = (S[0]=="A")
cond2 = (S[2:len(S)-1].count("C") == 1)


flag = True
if not cond1:
    flag = False
else:
    if not cond2:
        flag = False
    else:
        idx = S[2: len(S)-1].index("C") + 2
        new = S[1:idx] + S[idx+1:]
        if new != new.lower():
            flag = False

if flag:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define int long long
#define float long double
#define PB push_back
#define MP make_pair
#define ss second
#define ff first
#define PI 3.14159265
#define fastrack ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int M = 1e9 + 7;
int n, p;

signed main(){
    fastrack;
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << "\n";
    return 0;
}


Measured memory_bytes: 256
import math
a,b,c,d=map(int,input().split())

cyaku=b//c
dyaku=b//d


cds=b//((c*d)//(math.gcd(c,d)))

x=b-(cyaku+dyaku-cds)

cyaku2=(a-1)//c
dyaku2=(a-1)//d

cds2=(a-1)//((c*d)//(math.gcd(c,d)))

y=(a-1)-(cyaku2+dyaku2-cds2)

print(x-y)

Measured memory_bytes: 9096
n=int(input())
h=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(n):
  if h[i]%2==0:
    cnt1+=1
    if h[i]%3==0 or h[i]%5==0:
      cnt1-=1
    else:
      print('DENIED')
      break
else:
  print('APPROVED')     


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define pb push_back

using namespace std;
typedef pair<int, int> pii;

vector<vector<int>> g;
vector<bool> vis;

void dfs(int node) {
    vis[node] = true;
    for (int c : g[node]) {
        if (!vis[c]) dfs(c);
    }
}

int main() {
    fastIO;
    int n, m;
    cin >> n >> m;

    g = vector<vector<int>>(n);
    vis = vector<bool>(n);

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    int components = 0;
    for (int i = 0; i < n; i++) {
        if (!vis[i]) {
            components++;
            dfs(i);
        }
    }
    cout << components - 1;

}


Measured memory_bytes: 9256
#include <stdio.h>
int main(void){
int a,b,c;
scanf("%d%d%d", &a, &b, &c);
if(a+b==c){
printf("Yes");
}else if(b+c==a){
printf("Yes");
}else if(c+a==b){
printf("Yes");
}else{
printf("No");
}

return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var R = int.Parse(Console.ReadLine());
            var min = R;
            var max = -int.MaxValue;

            for (var i = 1; i < n; i++)
            {
                R = int.Parse(Console.ReadLine());
                max = Math.Max(max, R - min);
                min = Math.Min(R, min);
            }

            Console.WriteLine(max);
        }
    }
}



Measured memory_bytes: 19972
h, w = map(int, input().split())
S = [ [s for s in input()] for _ in range(h) ]
flag = True
for y in range(h):
    for x in range(w):
        if S[y][x] == '#':
            flag = False
            if y > 0 and S[y-1][x] == '#': flag = True
            if y < h-1 and S[y+1][x] == '#': flag = True
            if x > 0 and S[y][x-1] == '#': flag = True
            if x < w-1 and S[y][x+1] == '#': flag = True
        if flag == False:
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 39408
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

ll dp[410][410];

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<ll> sum(n+1);
    sum[0] = 0;
    rep(i,n) sum[i+1] = sum[i]+a[i];

    memset(dp, -1, sizeof(dp));

    auto rec = [&](auto &&rec, int l, int r) -> ll {
        if (l == r) return 0;
        if (dp[l][r] != -1) return dp[l][r];

        ll res = 1e18;

        repf(mid, l, r) {
            chmin(res, rec(rec, l, mid) + rec(rec, mid+1, r) + (sum[r+1]-sum[l]));
        }
        return dp[l][r] = res;
    };

    cout << rec(rec, 0, n-1) << endl;

    return 0;
}

Measured memory_bytes: 1536
function Main(input){
    input = input.split("\n");
    var k = 0;
    while(1){
        input[k] = input[k].split(" ");
        var n = parseInt(input[k][0],10);
        var m = parseInt(input[k++][1],10);
        if(n == 0 && m == 0)
            break;
        var t = [],h = [],tsum = 0,hsum = 0;

        for(var i = 0;i < n;i++){
            t[i] = parseInt(input[k++],10);
            tsum += t[i];
        }
        for(var i = 0;i < m;i++){
            h[i] = parseInt(input[k++],10);
            hsum += h[i];
        }
        if((tsum + hsum) % 2){
            console.log("-1");
            continue;
        }
        var flag = true;
        for(var i = 0;i < n;i++){
            for(var j = 0;j < m;j++){
               if(tsum - t[i] + h[j] == hsum + t[i] - h[j]){
                   flag = false;
                   console.log(t[i] + " " + h[j]);
                   break;
               }
            }
            if(!flag)
                break;
        }
        if(flag)
            console.log("-1");
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 15460
#include<stdio.h>
#include<string.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a+b==c||a+c==b||b+c==a)
		printf("Yes\n");
	else
	 	printf("No\n"); 		 
	return 0;
}

Measured memory_bytes: 128
from collections import Counter

def main():
    input()
    a = [int(i) for i in input().split()]
    c = Counter(a)
    s = sum(v * (v - 1) // 2 for v in c.values())
    for i in a:
        print(s - (c[i] - 1))

if __name__ == '__main__':
    main()

Measured memory_bytes: 26772
#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;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin>>a>>b;
    if((a&1)==1 && (b&1)==1){
        cout<<"Odd"<<endl;
    }
    else{
        cout<<"Even"<<endl;
    }
    return 0;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int n; cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  ASC(a);
  cout << a.back() - a.front() << endl;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int ans=0;
for ( int i = 0; i <= n - 3; i ++) {
if ( s [ i ] == 'A' && s [ i + 1] == 'B' && s [ i + 2] == 'C' ) ans ++;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string input;
        while ((input = Console.ReadLine()) != null)
        {
            int[] a = input.Split(',').Select(int.Parse).ToArray();
            int[] b = Enumerable.Repeat(0, 14).ToArray();
            bool fourCard = false, threeCard = false, onePair = false, twoPair = false, straight = false;
            foreach (var n in a) b[n]++;
            for (int i = 0; i < b.Length; i++)
            {
                if (b[i] == 4) fourCard = true;
                if (b[i] == 3) threeCard = true;
                if (b[i] == 2 && onePair) twoPair = true;
                else if (b[i] == 2 && !onePair) onePair = true;
                if (i < 10 && b[i] == 1 && b[i + 1] == 1 && b[i + 2] == 1 && b[i + 3] == 1 && b[i + 4] == 1) straight = true;
            }
            if (b[10] == 1 && b[11] == 1 && b[12] == 1 && b[13] == 1 && b[1] == 1) straight = true;
            if (fourCard) Console.WriteLine("four card");
            else if (threeCard && onePair) Console.WriteLine("full house");
            else if (straight) Console.WriteLine("straight");
            else if (threeCard) Console.WriteLine("three card");
            else if (twoPair) Console.WriteLine("two pair");
            else if (onePair) Console.WriteLine("one pair");
            else Console.WriteLine("null");
        }
    }
}


Measured memory_bytes: 9308
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int N;
	string S;
	cin >> N >> S;
	int alpha[1000];
    int count_max = 0;
	for (int i = 1; i < N; ++i) {
		int count = 0;
		for (int a = 0; a < 1000; ++a) {
			alpha[a] = 0;
		}
		for (int j = 0; j < i; ++j) {
			for (int k = i; k < N; ++k) {
				if (S[j] == S[k] && alpha[S[j]] == 0) {
					alpha[S[j]] = 1;
					count++;
				}
			}
		}
		count_max = max(count, count_max);
	}
	cout << count_max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

set<llong> s;
llong n;
llong p[20];

void f(llong i, llong lcm) {
    if (i >= n) {
        if (lcm != 0) s.insert(lcm);
        return;
    }

    f(i + 1, lcm);

    if (lcm == 0) {
        f(i + 1, p[i]);
    }
    else {
        f(i + 1, lcm / __gcd(lcm, p[i]) * p[i]);
    }
}

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

    f(0, 0);

    cout << s.size() << endl;

    return 0;
}



Measured memory_bytes: 4048
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long x = sc.nextLong();
    
    if(a!=0){
      System.out.println(b/x-(a-1)/x);
    }else{
      System.out.println(b/x+1);
    }
  }
}
    

Measured memory_bytes: 35624
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;
typedef unsigned int uint;
typedef long long ll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    vector<int> h(n);
    fori(n)
        cin>>h[i];

    vector<int> c(n, 1000000001);
    c[0]=0;
    fori(n) {
        for(int j=1; j<=k; j++) {
            if(i+j<n) 
                c[i+j]=min(c[i+j], c[i]+abs(h[i]-h[i+j]));
            }
    }

    cout<<c[n-1]<<endl;
        

}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 2000000000;
constexpr auto MOD = 1000000007;

int main() {
	string s;
	cin >> s;

	int topp = 0;

	rep(i, s.size()) {
		if (s[i] == 'p')topp++;
	}

	cout << s.size() / 2 - topp << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    long long int n,m;
    while(scanf("%lld%lld",&n,&m)==2)
    {   if(m==1&&n==1)
        printf("1\n");
        else
        if(m==1||n==1)
            printf("%d\n",max(m,n)-2);
        else if(n==2||m==2)
            printf("0\n");
        else
            printf("%lld\n",(n-2)*(m-2));
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  explicit __timestamper(const char* what) : what(what){};
  explicit __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

int main() {
#ifdef LOCAL
  freopen("a.in", "r", stdin);
  freopen("a.out", "w", stdout);
#endif

  int n, k;
  while (scanf("%d%d", &n, &k) == 2) {

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }

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

    if (k % g == 0 && k <= *max_element(a.begin(), a.end())) {
      printf("POSSIBLE\n");
    } else {
      printf("IMPOSSIBLE\n");
    }
  }

  return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x% mod+mod)%mod){}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};

mint choose(ll n, ll a){
	mint x = 1, y = 1;
	rep(i, a){
		x *= n-i;
		y *= i+1;
	}
	return x / y;
}

mint ans = 0;

ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n/2);
	if(n & 1) res = res * x % MOD;
	return res;
}

int main(void){
	ll n, a, b; cin >> n >> a >> b;
	ans = mod_pow(2, n);
	ans -= 1;
	ans -= choose(n, a);
	ans -= choose(n, b);

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

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> A = new ArrayList<Integer>();

        for (;;) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) {
                for (int i=0; i<A.size(); i=i+2) {
                    for (int j=0; j<A.get(i); j++) {
                        for (int k=0; k<A.get(i+1); k++) {
                            if (j == 0 || j == A.get(i)-1) {
                                System.out.print("#");
                            }
                            else if (k == 0 || k == A.get(i+1)-1) {
                                System.out.print("#");
                            }
                            else {
                                System.out.print(".");
                            }
                        }
                        System.out.println();
                    }
                    System.out.println();
                }
                break;
            }
            else {
                A.add(H);
                A.add(W);
            }
        }

    }
}


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

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << a * b / 2 << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
q = int(input())
k = list(map(int, input().split()))
for ki in k:
    D=M=DM=C=0
    for i in range(n):
        if s[i] == "D":
            D += 1
        elif s[i] == "M":
            M += 1
            DM += D
        if i >= ki:
            j = i-ki
            if s[j] == "D":
                D -= 1
                DM -= M
            elif s[j] == "M":
                M -= 1
        if s[i] == "C":
           C += DM
    print(C)

Measured memory_bytes: 61168
#include<bits/stdc++.h>
using namespace std;
int main() {

    long long int a,b,n;
    while(cin>>a>>b>>n) {
        if(n>=b) {
            long long int diff = n - b;
            n = n - diff;
            long long int fl = floor((a*(n-1))/(long double)b);
            cout<<fl<<endl;
        }
        else{
            long long int fl = floor((a*n)/(long double)b) - a * floor(n/(long double)b);
            cout<<fl<<endl;
        }
    }
}


Measured memory_bytes: 3604
#include <iostream>
#include <set>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;

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

    set<int> x, y;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (a[i][j] == '#') {
                x.insert(i);
                y.insert(j);
            }
        }
    }

    for (int i : x) {
        for (int j : y) {
            cout << a[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	ll a, b, m; cin >> a >> b >> m;
	vint aa(a), bb(b); vinput(aa); vinput(bb);
	ans = INF;
	rep(i, m){
		int x, y, c; cin >> x >> y >> c;
		x--; y--;
		ans = min(ans, aa[x]+bb[y]-c);
	}
	sort(all(aa));
	sort(all(bb));
	ans = min(ans, aa[0]+bb[0]);
	cout << ans << endl;
	return 0;
}

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

int main(void) {
  int N, K;
  cin >> N >> K;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    if (h >= K) ans++;
  }
  cout << ans << endl;

  return 0;
}

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

struct UnionFind {
	vector<int> parent, size;

	UnionFind(int n) : parent(n), size(n, 1) {
		for (int i = 0; i < n; i++) {
			parent[i] = i;
		}
	}

	int operator[](int x) {
		if (parent[x] == x) return x;
		return parent[x] = operator[](parent[x]);
	}

	bool merge(int x, int y) {
		x = operator[](x);
		y = operator[](y);
		if (x == y) return false;
		if (size[x] < size[y]) swap(x, y);
		parent[y] = x;
		size[x] += size[y];
		return true;
	}
};

bool solve() {
	int n, m;
	cin >> n >> m;
	UnionFind uf(n + m);
	for (int i = 0; i < n; i++) {
		int k;
		scanf("%d", &k);
		for (int j = 0; j < k; j++) {
			int l;
			scanf("%d", &l);
			l--;
			uf.merge(i, n + l);
		}
	}
	for (int i = 0; i < n; i++) {
		if (uf[i] != uf[0]) return false;
	}
	return true;
}

int main() {
	puts(solve() ? "YES" : "NO");
}


Measured memory_bytes: 1792
#include<math.h>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include <array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
//AtCoderC++.cpp

using namespace std;

int main() {
	string A, B, C; cin >> A >> B >> C;
	if (A.end()[-1] != B.begin()[0] || B.end()[-1] != C.begin()[0]) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long 
#define fi first
#define se second 
#define mod 1000000007

using namespace std;

int n, k, a[110];
int dp[100100];

int main() {
    // ifstream cin("tst.in");
    // ofstream cout("tst.out");
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

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

    dp[0] = 1;
    for (int i = 1; i <= k; i++) {
        bool f = 0;
        bool lose = 0;
        for (int j = 1; j <= n; j++) {
            if (i - a[j] >= 0) 
                f = 1;

            if (i - a[j] < 0)
                continue;

            if (dp[i - a[j]] == 1)
                lose = 1;
        }

        if (f == 0) {
            dp[i] = 1;
            continue;
        }

        if (lose == 1)
            dp[i] = 2;
        else dp[i] = 1;
    }

    if (dp[k] == 2)
        cout << "First";
    else cout << "Second";

    return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

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

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

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

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n; std::cin >> n;
  vi p(n); rep(i, n) std::cin >> p[i];
  int ans = 0;
  rep(i, n) {
    if (p[i] == i+1) swap(p[i], p[i+1]), ans++;
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 640
N = int(input())
S = list(input())

count = {i:0 for i in range(N)}
for i in range(N):
    Pre = S[:i]
    Bak = S[i:]
    Pre_set = sorted(set(Pre))
    Bak_set = sorted(set(Bak))
    for j in Pre_set:
        for k in Bak_set:
            if j == k:
                count[i] += 1
max = max(count.values())
# print(count)
print(max)

Measured memory_bytes: 3064