akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn rec(v: usize, g: &Vec<Vec<usize>>, dp: &mut Vec<Option<usize>>) -> usize {
    if let Some(res) = dp[v] {
        return res;
    }

    let mut childs: Vec<usize> = g[v].iter().map(|&v2| rec(v2, g, dp)).collect();
    childs.sort();
    let res = childs
        .iter()
        .rev()
        .zip(1..g[v].len() + 1)
        .map(|(&c, m)| c + m)
        .max()
        .unwrap_or(0);

    dp[v] = Some(res);
    res
}

fn main() {
    let n = get!(usize);
    let aa = get!(usize; n-1);

    let mut g = vec![Vec::new(); n];

    for (&w, l) in aa.iter().zip(1..) {
        let w = w - 1;
        g[w].push(l);
    }

    let ans = rec(0, &g, &mut vec![None; n]);

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


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

typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;

int main(){
  ll N;
  cin >> N;
  vector<ll> v(N);
  for(int i=0;i<N;i++){
    cin >> v[i];
    v[i] = v[i] == i+1;
  }
  ll ans = 0;
  for(int i=0;i<N;i++){
    if(v[i]){
      v[i] = 0;
      if(i+1 < N)
        v[i+1] = 0;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include "boost/multiprecision/cpp_int.hpp"
#include <unordered_set>

using ll = long long;
using ull = unsigned long long;
namespace mp = boost::multiprecision;

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	std::string S; std::cin >> S;
	std::unordered_set<char> sets;

	for (int i = 0; i < S.size(); i++) {
		sets.insert(S[i]);
	}

	for (char i = 'a'; i <= 'z'; i++) {
		if (sets.find(i) == sets.end()) {
			std::cout << i;
			break;
		}
		if (i == 'z')std::cout << "None";
	}

	return 0;

}

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


int main(){
    int S;
    cin >> S;
    int h = S / 3600;
    S = S % 3600;
    int m = S / 60;
    int s = S % 60;
    cout << h << ":" << m << ":" << s << endl;
}
    
    
    



Measured memory_bytes: 3100
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i++)
using namespace::std;

int n;

int main(){
	int n,m,a[200],ans;
	cin>>n>>m;
	REP(i,n)scanf("%d",&a[i]);
	REP(k,m+1)REP(i,n-1){
		if((k)&&(a[i]%k)>(a[i+1]%k))swap(a[i],a[i+1]);
	}
	REP(i,n)printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 3184
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint K;
	cin >> K;

	vector<lint> ans(50, K / 50);
	for (int i = 0; i < 50; i++) {
		if (i != 49 - K % 50 ) ans[i] += i + 1;
	}

	cout << 50 << "\n";
	for (const auto &e : ans) cout << e << " ";

	return 0;
}

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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> c(h, vector<char>(w));
    int sumblack = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> c[i][j];
            if (c[i][j] == '#')
                sumblack++;
        }
    }
    // cout << sumblack << endl;
    // black
    vector<int> sumH(h), sumW(w);
    for (int i = 0; i < h; i++)
    {
        sumH[i] = 0;
        for (int j = 0; j < w; j++)
            if (c[i][j] == '#')
                sumH[i]++;
    }
    for (int j = 0; j < w; j++)
    {
        sumW[j] = 0;
        for (int i = 0; i < h; i++)
            if (c[i][j] == '#')
                sumW[j]++;
    }
    int ans = 0;
    for (int bitH = 0; bitH < (1 << h); bitH++)
    {
        for (int bitW = 0; bitW < (1 << w); bitW++)
        {
            int rmblack = 0;
            for (int i = 0; i < h; i++)
            {
                if (bitH & (1 << i))
                {
                    rmblack += sumH[i];
                }
            }
            for (int j = 0; j < w; j++)
            {
                if (bitW & (1 << j))
                {
                    rmblack += sumW[j];
                    for (int i = 0; i < h; i++)
                    {
                        if (bitH & (1 << i))
                        {
                            // overlap
                            if (c[i][j] == '#')
                                rmblack--;
                        }
                    }
                }
            }
            if (sumblack - rmblack == k)
                ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3644
//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define INF (lint )(1e9)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
using namespace std;


int main()
{__
      
      lint t;
      cin>>t;

      while(t--)
      {
         lint a,b,c,d;
         cin>>a>>b>>c>>d;

         int flg=0;
         if(a<b || d<b)
            flg=1;
         if(a>=b && d>=b )
         {
            if(c>=b-1 )
               flg=0;
            else
            {
               a%=b;
               lint tb =(__gcd(b,d));
               d=tb;

               lint k=b-1-a;
               k/=tb;

               lint maxk = (a+ k*d)%b;
               if(maxk  > c)
                  flg=1;
               else
                  flg=0;
            }
         }
         if(flg)
            cout<<"No"<<endl;
         else
            cout<<"Yes"<<endl;
      }
      return 0;
}

Measured memory_bytes: 256
#include <climits>
#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

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

typedef vector<vector<int>> graph;

void dfs(int v, const graph &G, vector<bool> &visited, vector<int> &order) {
	visited[v] = true;
	for(const auto &to : G[v]) {
		if(!visited[to]) dfs(to, G, visited, order);
	}
	order.emplace_back(v);
}

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

	for(int n; cin >> n && n;) {
		unordered_map<string, int> encoder;
		vector<int> price(n);

		for(int i = 0; i < n; ++i) {
			string name;
			cin >> name >> price[i];
			encoder[name] = i;
		}

		int m;
		cin >> m;

		graph G(n);
		for(int i = 0; i < m; ++i) {
			string target;
			int k;
			cin >> target >> k;

			const int to = encoder[target];
			for(int j = 0; j < k; ++j) {
				string from;
				cin >> from;
				G[encoder[from]].emplace_back(to);
			}
		}

		vector<bool> visited(n, false);
		vector<int> order;
		for(int v = 0; v < n; ++v) {
			if(!visited[v]) dfs(v, G, visited, order);
		}

		vector<int> sum(n, INT_MAX);
		for(int i = n - 1; i >= 0; --i) {
			const int v = order[i];
			chmin(sum[v], price[v]);

			for(const auto &to : G[v]) {
				if(sum[to] == INT_MAX) sum[to] = 0;
				sum[to] += sum[v];
			}
		}

		string want;
		cin >> want;
		cout << sum[encoder[want]] << endl;
	}

	return EXIT_SUCCESS;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

  ll n;
  cin >> n;

  ll res = LLONG_MAX;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ll tmp;
      if (i * i != n) {
        tmp = (i - 1) + (n / i - 1);
      } else {
        tmp = (i - 1) * 2;
      }
      res = min(res, tmp);
    }
  }


  cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define usll                    unordered_set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define input(a,n)              for(ll i=0;i<n;++i) cin>>a[i];
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int main()
{
	fastIO
//	inp_out();
	ll n,m;
	cin>>n;
	vll a(n);
	input(a,n);
	umll freq;
	for(auto i:a)	freq[i]++;
	for(ll i=1;i<=n;++i)	cout<<freq[i]<<"\n";
	return 0;
}



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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){

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

  ll result=1000;
  rep(i, n-1){
    int y = a[i];
    int td=a[i+1];

    result = max<ll>(result, (result/y)*td+result%y);
  }

  cout<<result<<endl;

  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  string s[3]; cin >> s[0] >> s[1] >> s[2];
  int now = 0;

  while (true){
    //cout << now << " " << s[now] << endl;
    if (s[now] == "") {
      if (now == 0) cout << "A" << endl;
      else if (now == 1) cout << "B" << endl;
      else cout << "C" << endl;
      return 0;
    }
    int tmp = now;
    now = s[now][0] - 'a';
    s[tmp].erase(0, 1);
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INFTY 10000000000
typedef long long int ll;
const int MOD=1000000007;
using Graph = vector<vector<int>>;
using ipair = pair<ll,ll>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main(){

  int n;
  cin>>n;
  int d = n%10;
  if(d==3)cout<<"bon";
  else if(d==0||d==1||d==6||d==8)cout<<"pon";
  else cout<<"hon";

  return 0;
}

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

int main(){
  string s;
  cin >> s;
  bool ans2=false;
  char C;
  for(char c='a';c<='z';c++){
    bool ans1=true;
    for(int i=0;i<s.size();i++){
      if(c==s[i]){
        ans1=false;
        break;
      }
    }
    if(ans1){
      C=c;
      ans2=true;
      break;
    } 
  }
  if(ans2){
    cout << C << endl;
  }else{
    cout << "None" << endl;
  }
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> ai;
  int res = 0;
  for(int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    ai.push_back(temp);
  }
  for(int i = 0; i < N; i++) {
    if(ai[i] > 0 && (i + 1) == ai[ai[i] - 1]) {
      ai[ai[i] - 1] = -1;
      res++;
    }
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b)
		cout<<c<<"\n";
	else if(a==c)
		cout<<b<<"\n";
	else if(b==c)
		cout<<a<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

bool isvalidflip(ll flip)
{

    int one = 0;
    while (flip != 0)
    {
        one += (flip & 1);
        flip >>= 1;
    }
    return (one % 2 == 0);
}

int calc(int n, ll flip, vector<int> &a, vector<int> &b)
{
    vector<int> c(n);
    vector<int> d(n);
    vector<int> rev(n);
    rep(i, n)
    {
        rev[i] = (flip >> i) & 1;
        if (((flip >> i) & 1) == 0)
        {
            c[i] = a[i];
        }
        else
        {
            c[i] = b[i];
        }
        d[i] = c[i];
    }
    sort(ALL(c));
    vector<int> order(n);
    bool isok = false;
    map<int, bool> mp;
    mp.clear();
    rep(i, n)
    {
        isok = false;
        rep(j, n)
        {
            if (mp[j] == true)
            {
                continue;
            }
            if (d[i] == c[j] && ((rev[i] == 0 && abs(i - j) % 2 == 0) || (rev[i] == 1 && i != j && abs(i - j) % 2 == 1)))
            {
                //cerr << i << " " << j << endl;
                mp[j] = true;
                isok = true;
                order[i] = j;
                break;
            }
        }
        if (isok == false)
        {
            return -1;
        }
    }
    /*
    rep(i, n)
    {
        cerr << c[i] << " ";
    }
    cerr << endl;
    
    */
    int ret = 0;
    rep(i, n)
    {
        rep(j, i + 1, n)
        {
            if (order[i] > order[j])
            {
                ret++;
            }
        }
    }
    return ret;
}

int main(int argc, char const *argv[])
{
    int n;
    int ans = (1 << 30);
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(flip, (1 << n))
    {
        // cerr << flip << endl;
        if (!isvalidflip(flip))
        {
            //  cerr << "invalid" << endl;
            continue;
        }
        int ret = calc(n, flip, a, b);
        //cerr << "valid: " << ret << endl;

        if (ret != -1)
        {
            ans = min(ans, ret);
        }
    }
    if (ans == (1 << 30))
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define typeof(x) __typeof__(x)
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define PB push_back
#define MP make_pair
#define vec vector

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
  int len = v.size();
  s << "[";
  for (int i = 0; i < len; i++) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  s << "]";
  return s;
}

bool no_need(int m, const vec<int>& a, int K)
{
  vec<bool> s(K);
  s[0] = true;
  rep(i, 0, SZ(a)) {
    if (i == m) {
      continue;
    }
    rrep(j, 0, K) {
      if (s[j] && j + a[i] < K) {
        s[j + a[i]] = true;
      }
    }
  }

  int MAX = 1e9;
  rrep(i, 0, K) {
    if (s[i]) {
      MAX = i;
      break;
    }
  }

  return MAX + a[m] < K;
}



signed main()
{
  int N, K; cin >> N >> K;
  vec<int> a(N);
  rep(i, 0, N) {
    cin >> a[i];
  }
  SORT(a);

  int l = -1, r = N;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (no_need(m, a, K)) {
      l = m;
    } else {
      r = m;
    }
  }

  cout << l + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
h = list(map(int,input().split()))

dp = [10**9]*n
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        if i-j >= 0:
            dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[n-1])


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

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

    if (a > b) {
        d = a;
        a = b;
        b = d;
    }
    
    if (b > c) {
        d = b;
        b = c;
        c = d;
    }

    if (a > b) {
        d = a;
        a = b;
        b = d;
    }

    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

 bool check(string s){
	bool kaibun=true;
	rep(i,s.size()/2){
		if(s[i]!=s[s.size()-i-1]){
			kaibun=false;
			break;
		}
	}
	return kaibun;
}

int main(){
	string s,tmp="";
	cin>>s;
	int num=0;
	rep(i,s.size()){
		if(s[i]!='x')tmp+=s[i];
	}
	if(!check(tmp))cout<<-1<<endl;
	else{
		int left=0,right=s.size()-1;
		while(left<right){
			if(s[left]=='x' && s[right]!='x'){
				num++;
				left++;
			}else if(s[left]!='x' && s[right]=='x'){
				num++;
				right--;
			}else{
				left++;
				right--;
			}
		}
		cout<<num<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vpl vector<pair<long long,long long>>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
long long MOD = 1000000007;
const long double pi = 3.1415926535897932;
#define pb push_back
#define mp make_pair
#define mt make_tuple
//(mod m)でのaの逆元を計算する
//a/b(mod m)=a(mod m)*modinv(b,m)
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll N,Q;
    string S;
    cin>>N>>Q>>S;
    vl AC(N,0);
    rep2(i,1,N){
        if(S[i-1]=='A'&&S[i]=='C'){
            AC[i-1]++;
        }
        AC[i]+=AC[i-1];
    }
    rep(i,Q){
        ll l,r;
        cin>>l>>r;
        l-=2;
        r-=2;
        if(r<0){
            cout<<0<<endl;
            continue;
        }
        if(l<0){
            cout<<AC[r]<<endl;
        }else{
            cout<<AC[r]-AC[l]<<endl;
        }
    }
}

Measured memory_bytes: 1792
//============================================================================
// Name        : ALDS1_1_B.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int gcd(int a, int b) {
	if(a<b) swap(a,b);
	if(b==0) return a;
	if(b==1) return 1;
	return gcd(b,a%b);
}

int main() {
	int a,b;
	cin >> a >> b;
	cout << gcd(a,b) << endl;
	return 0;
}

Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String[] in = sc.nextLine().split(" ");
		
		if(in[0].equals(in[1])) {
			System.out.println("Yes");
		}else System.out.println("No");
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>

using namespace::std;

int main() {
	int N; cin >> N;
	vector<int> H;

	int ans = 0;
	int max = -1;
	for (int i = 0; i < N; i++) {
		int t; cin >> t;
		H.push_back(t);
		if (H[i] >= max) {
			ans++;
			max = H[i];
		}
	}
	
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;
  cin>>N;
  set<int> A;
  for(int i=2;i<=N;i++)
    A.insert(i);
  for(int i=2;i*i<=N;i++){
    if(!A.count(i))
      continue;
    vector<int> B(0);
    for(int j:A){
      if(j<i)
        continue;
      if(i*j>N)
        break;
      B.push_back(i*j);
    }
    for(int j:B)
      A.erase(j);
  }
  int l=1;
  for(int i:A){
    int j=0;
    for(int k=N;k>0;k/=i)
      j+=k/i;
    l=l*(j+1)%1000000007;
  }
  cout<<l<<endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans = 0;
	if(k<=a+b){
		cout<<min(k,a)<<'\n';
	}
	else{
		ans = a;
		ans -= (k-(a+b));
		cout<<ans<<'\n';
	}
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  ll data[n][m + 1];
  REP(i, n) {
    REP(j, m + 1) {
      int x;
      cin >> x;
      data[i][j] = x;
    }
  }

  ll ans = INT_MAX;
  for (int bit = 0; bit < (1 << n); ++bit) {
    ll tmp = 0;
    ll a[m + 1];
    REP(i, m + 1) { a[i] = 0; }
    for (int i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        tmp += data[i][0];
        FOR(j, 1, m + 1) { a[j] += data[i][j]; }
      }
    }

    bool flag = true;
    FOR(i, 1, m + 1) {
      if (a[i] < x) flag = false;
    }

    if (flag) ans = min(ans, tmp);
  }
  if (ans == INT_MAX) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

struct UnionFind{
	vector<int> par;
	vector<int> rank;
	
	UnionFind(int n){
        init(n);
    }
	
	//n要素で初期化
	void init(int n){
		par.resize(n);
		rank.resize(n);
		for(int i = 0; i < n; i++){
			par[i] = i;
			rank[i] = 0;
		}
	}
	
	//木の根を求める
	int root(int x){
		if(par[x] == x) return x;
		else return par[x] = root(par[x]);
	}
	
	//xとyの属する集合を併合
	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y) return;
		if(rank[x] < rank[y]) par[x] = y;
		else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
	
	bool same(int x, int y){
		return root(x) == root(y);
	}
};

int main(){
	int n,k,l;
	cin >> n >> k >> l;
	int p[k],q[k];
	REP(i,k){
		cin >> p[i] >> q[i];
		p[i]--;
		q[i]--;
	}
	int r[l],s[l];
	REP(i,l){
		cin >> r[i] >> s[i];
		r[i]--;
		s[i]--;
	}
	UnionFind road(n);
	REP(i,k) road.unite(p[i], q[i]);
	UnionFind train(n);
	REP(i,l) train.unite(r[i], s[i]);
	map<P, int> m;//pairをkeyとしたmap
	REP(i,n) m[make_pair(road.root(i), train.root(i))]++;//それぞれの都市の根(グループ)のpairをmapに代入
	REP(i,n){
		cout << m[make_pair(road.root(i), train.root(i))];
		if(i != n - 1) cout << " ";
	}
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


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

    int cnt = 0;
    string ans = "No";
    for(int i = 0; i < n; i++){
        int a, b; cin >> a >> b;
        if(a == b) cnt++;
        else cnt = 0;
        if(3 <= cnt) ans = "Yes";
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
#a,bの最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

N,M = map(int,readline().split())
A = list(map(int,readline().split()))

B = [A[i]//2 for i in range(N)]
ans = 1

dev_c = 0
while A[0]%2 != 1:
    A[0] = A[0]//2
    dev_c += 1
#print(dev_c)

for i in range(1,N):
    dev_c2 = 0
    while A[i]%2 != 1:
        A[i] = A[i]//2
        dev_c2 += 1
    if dev_c != dev_c2:
        ans = 0
        break

l = B[0]
if ans == 1:
    for i in range(N):
        l = lcm(l,B[i])

#print(l)

if ans != 0:
    ans = (M//l+1)//2

print(ans)

Measured memory_bytes: 58224
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.ST                 as ST
import qualified Data.Array.Unboxed            as AU
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import qualified Data.Foldable                 as DF
import           Data.Int
import qualified Data.IntMap                   as IM
import           Data.List
import qualified Data.Map                      as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                      as S
import qualified Data.Sequence                 as SQ
import           Data.Time
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
readInts n = replicateM n readInt
readString = map BS.unpack . BS.words <$> BS.getLine
readStrings n = replicateM n <$> readString
toPair [x, y] = (x, y)

main = do
  readInt
  s <- getLine
  print $ solve s

solve s = length $ filter (\x -> isPrefixOf "ABC" x) $ tails s


Measured memory_bytes: 380
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n*3];
		for(int i=0; i<n*3; i++){
			a[i] = in.nextInt();
		}
		Arrays.sort(a);

		long sum = 0;
		for(int i=0; i<n; i++){
			sum += a[n*3-(i+1)*2];
		}

		System.out.println(sum);
	}

}


Measured memory_bytes: 92780
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 500005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    while (cin >> n) {
        vector<ll> v(n);
        ll sum = 0;
        for (auto &i : v) {
            cin >> i;
            sum += i;
        }
        if (n == 1) {
            cout << "YES\n";
            continue;
        }
        ll sig = (n * (n + 1)) / 2;
        if (sum % sig) {
            cout << "NO\n";
            continue;
        }
        sum /= sig;
        ll norm = sum;
        ll nd = 0;
        int f = 0;
        for (int i = 0 ; i < n ; i++) {
            ll dif = v[(i + 1) % n] - v[i];
            //cout << dif <<' '<<norm<<endl;
            if (dif > norm) {
                f = 1;
                break;
            }
            dif = norm - dif;
            if (dif % n) {
                f = 1;
                break;
            }
            nd += dif / n;
        }
        //cout << f <<' '<<nd<<' '<<sum<<endl;
        if (f == 1 || nd != sum) {
            cout << "NO\n";
        }
        else {
            cout << "YES\n";
        }
    }
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 23 13:27:43 2020

@author: NEC-PCuser
"""

N = int(input())

ans = 0
a_count = 0
b_count = 0
ab_count = 0
for i in range(N):
    s = input()
    if (s[0] == "B" and s[len(s) - 1] == "A"):
        ab_count += 1
    else:
        if (s[0] == "B"):
            b_count += 1
        if (s[len(s) - 1] == "A"):
            a_count += 1
    
    ans += s.count("AB")
    
    
plus = min([a_count, b_count])
    
if (ab_count != 0 and a_count + b_count > 0):
    plus += ab_count
elif (ab_count != 0):
    plus += (ab_count - 1)

print(ans + plus)

Measured memory_bytes: 9092
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int l = in.nextInt();
        int r = in.nextInt();
        Set<Integer> set = new HashSet<>();
        int first = l % 2019;
        set.add(first);
        for (int i = l + 1; i <= r; i++) {
            first++;
            set.add(first);
            if (set.size() > 2019) {
                break;
            }
        }

        long result = Integer.MAX_VALUE;
        List<Integer> list = new ArrayList<>(set);
        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                long tmp = (long) list.get(i) * (long) list.get(j) % 2019;
                result = Math.min(result, tmp);
            }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
struct edge {int to, cost;};
vector<int>Y(int a) {
	vector<int>V;
	for (int i = 1; i*i <= a; i++) {
		if (a%i == 0) {
			V.push_back(i);
			V.push_back(a / i);
		}
	}
	sort(V.begin(), V.end());
	return V;
}
signed main() {
	int n, m; cin >> n >> m;
	vector<int>V = Y(m);
	for(int i=V.size()-1;i>=0;i--){
		if (m / n >= V[i]) {
			cout << V[i] << endl;
			return 0;
		}
	}
	}

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

//#define debug(...)   printf( __VA_ARGS__ )
#define debug(...)   /****nothing****/

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define mp make_pair
#define pii pair<int,int>
#define F first
#define S second
#define sz(x) (int)(x).size()
#define nopos string::npos
#define fr(i,a,b) for(i=a;i<=b;i++)
#define frn(i,a,b) for(i=a;i>=b;i--)

ll x,ans=2147483647,t,i,j,a1,a2;
int main()
{
//    debug("%d\n",ans);
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    cin>>x;
    ll lft=0,rgt=x;

    while(lft<rgt)
    {
        ll mid=(lft+rgt)>>1LL;
        ll tot=1LL*mid*(mid+1)/2;

        if(tot>=x)
            rgt=mid , ans=min(ans,mid);
        else
            lft=mid+1;
    }

    if(ans==2147483647)
    cout<<x;
    else
     cout<<lft;

    return 0;
}

/*

If 1 + 2 + ... + t <X then you can not reach coordinate X at time t. Conversely, if 1 + 2 + ... + t ≥ X
You can show that you can reach coordinate X at time t. Indeed, let's take a subset of {1, 2, .., t} whose sum becomes X
Then, if you do so, you jump right to the subset only when it is the chosen length, otherwise do not jump
You can arrive at the coordinates X by abbreviation. Therefore, you can find such a minimum t later. This is
That one+√8X + 1
Since it becomes 2, it can be obtained by O (1) when calculated by this function. Even if we do not do that, the answer
O(√X), try t in order from the front, t (t + 1)
2 ≥ Even if you only judge X every time, the time calculation amount O (
√
X)
You can ask for an answer.
*/




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;print(n*n*n);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int ans = 0;
		for(int i = 0; i < N; i++) {
			boolean ok = true;
			for(int j = 0; j < i; ++j) {
				if(H[i] < H[j]) {
					ok = false;
					break;
				}
			}
			if(ok) ans++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
import math

n = int(input())

setmap = dict()
for index in range(n):
  s = input()
  sorted_s = ''.join(sorted(s))
  if setmap.get(sorted_s) is not None:
    setmap[sorted_s] = setmap[sorted_s] + 1
  else:
    setmap[sorted_s] = 1

same_count = 0
for val in setmap.values():
  if val != 1:
    same_count += int(math.factorial(val) / (2 *  math.factorial(val - 2)))
print(same_count)


Measured memory_bytes: 17888
#include <stdio.h>

class Dice{
public:
	Dice(){
		number = new int[6];
		work = new int[6];
	};
	~Dice(){
		delete[] number;
		delete[] work;
	};

	void setLabel(int index,int num){
		number[index] = num;
	};

	void roll(char dst){
		for(int i = 0; i < 6; i++) work[i] = number[i];
		switch(dst){
		case 'E':
			setNumber(work[3],work[1],work[0],work[5],work[4],work[2]);
			break;
		case 'N':
			setNumber(work[1],work[5],work[2],work[3],work[0],work[4]);
			break;
		case 'S':
			setNumber(work[4],work[0],work[2],work[3],work[5],work[1]);
			break;
		case 'W':
			setNumber(work[2],work[1],work[5],work[0],work[4],work[3]);
			break;
		}
	};

	int returnPeek(){
		return number[0];
	}

private:
	void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}

private:
	int* number;
	int* work;
};

int main(){
	Dice dice;
	int label;
	char ch;
	for(int i = 0; i < 6; i++){
		scanf("%d",&label);
		dice.setLabel(i,label);
	}
	getchar(); 
	while((ch = getchar()) != '\n'){
		dice.roll(ch);
	}
	printf("%d\n",dice.returnPeek());
}

Measured memory_bytes: 1036
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool cmp (int a, int b) {
  return(a < b);
}

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

vector<int> v, d;

int main(){
  int N, X;
  cin >> N >> X;
  v.push_back(X);
  for (int i=0;i<N;i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  for (int i=0;i<N;i++) {
    d.push_back(v[i+1] - v[i]);
  }
  sort(d.begin(), d.end());
  for (int i=0;i<N-1;i++) {
    int r = gcd(d[i+1], d[i]);
    d[i+1] = r;
  }
  cout << d[N-1] << endl;
  return(0);
}


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

int main() {
    int H, W;

    while(1) {
        cin >> H >> W;
        if(H == 0 && W == 0) break;

        for(int j = 0; j < H; j++) {
            for(int i = 0; i < W; i++) {
                cout << '#';
                if(i == W-1) cout << endl;
            }
        }

        cout << endl;
    }

}


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

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

Measured memory_bytes: 256
n = int(input())
s = sorted([int(input()) for _ in range(n)])

sumNum = sum(s)
if sumNum % 10 != 0:
  print(sumNum)
  exit()
else:
  ans = 0
  for i in s:
    if (sumNum - i) % 10 != 0:
      ans = max(ans, sumNum - i)
  print(ans)

Measured memory_bytes: 9076
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

int main(){
    int n,x,t;
    cin >> n >> x >> t;
    cout << (n+x-1)/x*t << endl;
}



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

int main(){
  int A, B;
  cin >> A >> B;
  int ans = 0;
  for(int i=A; i<=B; i++){
    int x = i%100;
    int y = i/1000;
    if( ((x%10)==y/10) && ((y%10)==x/10) ){
      ans++;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3636
s = input()

cnt_l = [0]*(len(s)+1)
cnt_r = [0]*(len(s)+1)

for i in range(1, len(s)+1):
    if s[i-1] == "<":
        cnt_l[i] = cnt_l[i-1] + 1
    else:
        cnt_l[i] = 0

for i in range(len(s)-1, -1, -1):
    if s[i] == ">":
        cnt_r[i] = cnt_r[i+1]+1
    else:
        cnt_r[i] = 0

ans = 0
for l, r in zip(cnt_l, cnt_r):
    ans += max(l, r)
print(ans)


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

M = []
last = 0

# M0を求める
m0 = 0
oper = 1
for a in A:
  m0 += oper * a
  oper = -1 * oper
#print(m0)

M.append(m0)

for i in range(1, N):
  mi = (-1 * M[-1]) + (2 * A[i-1])
  M.append(mi)
#print(M)

ans = ' '.join(str(m) for m in M)
print(ans)

Measured memory_bytes: 19144
#include <stdio.h>
#include <cmath>
#include <algorithm>

using namespace std;


int main(){

    double q,tmp,next,limit;

    while(true){
    	scanf("%lf",&q);
    	if(q == -1)break;

    	limit = 0.00001*q;
    	tmp = q/2;
    	next = q/2;

    	while(fabs(next*next*next-q) >= limit){
    		tmp = next;
    		next = tmp - (tmp*tmp*tmp-q)/(3*tmp*tmp);
    	}

    	printf("%.6lf\n",next);

    }

    return 0;
}

Measured memory_bytes: 2560
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n = I()
i = 1
def keta(v):
    a = 0
    while v:
        a += v%10
        v //= 10
    return a
ans = INF
while 2*i <= n:
    ans = min(ans, keta(i) + keta(n-i))
    i += 1
print(ans)


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

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

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

int cnt[MAXN];

void solve(){
	REP(i, 0, 3) {
		int a, b;
		cin >> a >> b;
		cnt[a]++, cnt[b]++;
	}
	REPN(i, 1, 4) {
		if (cnt[i] == 3) {
			printf("NO\n");
			return;
		}
	}
	printf("YES\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
using namespace std;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
const int MOD = 1000 * 1000 * 1000 + 7 ;
const int N = 4  ;
const int MAXN = 1000*100 + 5 ;
const int INF = INT_MAX ;


int main (){
int n ;
cin >> n ;
map<string ,int>mp;
int mx = -1 ; 
for(int i = 0 ;i <n ;++i)
{	string s ; 
	cin >> s ;
	mp[s]++ ;
	mx = max( mx , mp[s]); 
}
vector<string>res ;

tr(mp , i ){
	
	if (mx == i.ss )
	res.pb(i.ff);  
}


for (string  s : res )
cout << s <<"\n" ;

 


return 0 ;
 
}

// 2 year => 2 3 -> 6 5 1 5 5 1 5 


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    if(A == B){
        if(A != C){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(B == C){
        if(A != C){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(A == C){
        if(A != B){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256