akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define ll long long
ll ans = 0;

void merge(int *A, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1+1]; int R[n2+1];
    int i, j, k;
    for (i = 0; i < n1; i++) {
        L[i] = A[left+i];
    }
    for (i = 0; i < n2; i++) {
        R[i] = A[mid+i];
    }
    L[n1] = (1e+9)+1;
    R[n2] = (1e+9)+1;
    
    i = 0; j = 0;
    for (k = left; k < right; k++) {
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
            ans += n1 - i;
        }
    }
}

void mergeSort(int *A, int left, int right) {
    if (left+1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main(void) {
    int n, i;
    scanf("%d", &n);
    int S[n];
    for (i = 0; i < n; i++) {
        scanf("%d", &S[i]);
    }

    mergeSort(S, 0, n);

    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3404
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

LL powmod(LL x, LL y){
	LL a = 1;
	while(y){
		if(y & 1){ a = a * x % MOD; }
		x = x * x % MOD;
		y >>= 1;
	}
	return a;
}

void mainmain(){
	int n, c;
	cin >> n >> c;
	vll as(n), bs(n);
	for(int i = 0; i < n; ++i){ cin >> as[i]; }
	for(int i = 0; i < n; ++i){ cin >> bs[i]; }

	vector<LL> dp1(c + 1), dp2(c + 1), dp3(c + 1);
	dp1[0] = 1;
	for(int i = 0; i < n; ++i){
		dp2 = dp1;
		fill(ALL(dp3), 0LL);
		for(LL xi = as[i]; xi <= bs[i]; ++xi){
			LL sum = 0;
			for(int j = 0; j <= c; ++j){
				sum = (sum * xi + dp2[j]) % MOD;
				dp3[j] = (dp3[j] + sum) % MOD;
			}
		}
		dp1 = dp3;
	}
	cout << dp1[c] << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();

		if (n * a > b) {
			System.out.println(b);
		} else {
			System.out.println(n * a);
		}
	}

}


Measured memory_bytes: 21588
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)

	str := oneStr()

	ans := 0
	for i := 0; i < len(str); i++ {
		if str[i] == '1' {
			ans++
		}
	}

	fmt.Println(ans)
}

func oneInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func oneStr() string {
	sc.Scan()
	return sc.Text()
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, oneInt())
	}
	return nums
}

func scanStrings(len int) (strs []string) {
	for i := 0; i < len; i++ {
		strs = append(strs, oneStr())
	}
	return strs
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

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

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func cumSum(nums []int) []int {
	sums := []int{0}

	for i := 0; i < len(nums); i++ {
		sums = append(sums, sums[i]+nums[i])
	}
	return sums
}


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

sum_w = [0]
sum_b = [0]
for i in range(N):
  if S[i] == ".":
    sum_w.append(sum_w[-1] + 1)
    sum_b.append(sum_b[-1])
  else:
    sum_b.append(sum_b[-1] + 1)
    sum_w.append(sum_w[-1])

ans = float("inf")
for i in range(N + 1):
  ans = min(ans, sum_b[i] + sum_w[-1] - sum_w[i])
  
print(ans)


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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

template<typename T>
class Heap {
private:
    vector<T> heap;
    int lastIndex = 0;
    function<bool(T, T)> compare;

    int up(int x) {
        if(x == 1) {
            return x;
        }
        if(compare(heap[x/2], heap[x])) {
            return x;
        }
        swap(heap[x/2], heap[x]);
        return up(x/2);
    }
    int down(int x) {
        if(x == lastIndex) {
            return x;
        }
        if(x*2 > lastIndex) {
            return x;
        }
        if(x*2 == lastIndex) {
            if(compare(heap[x], heap[x*2])) {
                return x;
            }
            swap(heap[x], heap[x*2]);
            return x*2;
        }

        int i = x*2 + !compare(heap[x*2], heap[x*2 + 1]);

        if(compare(heap[x], heap[i])) {
            return x;
        }
        swap(heap[x], heap[i]);
        return down(i);
    }
public:
    Heap(int size, function<bool(T, T)> compare) {
        lastIndex = 0;
        heap.resize(size + 1);
        this->compare = compare;
    }
    Heap(int size) {
        Heap(size, less<T>());
    }

    void add(T t) {
        lastIndex++;
        heap[lastIndex] = t;
        up(lastIndex);
    }
    void del() {
        swap(heap[1], heap[lastIndex]);
        lastIndex--;
        down(1);
    }
    T get() {
        return heap[1];
    }
    bool empty() {
        return lastIndex == 0;
    }
};

struct Task {
    LL A;
    LL B;
};

int main() {
    LL N, M;
    cin >> N >> M;
    Task tasks[N];
    REP(i, N) {
        cin >> tasks[i].A >> tasks[i].B;
    }
    auto cmp = [](Task a, Task b) {return a.B > b.B;};
    sort(tasks, tasks + N, cmp);
    bool reserved[M + 1];
    fill(reserved, reserved + M + 1, false);

    vector<vector<LL>> v;
    v.resize(M + 1);

    for(int i = 0;i < N;i++) {
        if(0 <= M - tasks[i].A) {
            v[M - tasks[i].A].push_back(tasks[i].B);
        }
    }
    REP(i, M + 1) {
        sort(ALL(v[i]), greater<LL>());
    }

    Heap<LL> heap(N, greater<LL>());
    LL res = 0;
    for(LL i = M;0 <= i;i--) {
        for(LL j = 0;j < v[i].size();j++) {
            heap.add(v[i][j]);
        }
        if(!heap.empty()) {
            res += heap.get();
            heap.del();
        }
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 7936
#include <iostream>
#include <math.h>

using namespace std;

long long int lnln(long long int N, long long int X) {
	if (N == 0) return 1;
	if (X == 1) return 0;
	else if (X <= pow(2,N+1) - 2) return lnln(N-1, X-1);
	else if (X == pow(2,N+1) - 1) return pow(2, N);
	else if (X >= pow(2,N+1) && X <= pow(2,N+2) - 4) return pow(2, N) + lnln(N-1, X-pow(2,N+1)+1);
	else if (X == pow(2,N+2) - 3) return pow(2,N+1) - 1;
	else return 0;
}

int main(void) {
	long long int N, X;
	cin >> N >> X;
	cout << lnln(N, X) << endl;

}


Measured memory_bytes: 384
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
    arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
    for (auto& i : arr) {
        fill_all(i, v);
    }
}

bool abok[20000];
bool acok[20000];
bool bcok[20000];

int main()
{

    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);
    std::string input[3];
    for (size_t i = 0; i < 3; i++)
    {
        in >> input[i];
    }

    auto check_ok = [&](const std::string& input0, const std::string& word, bool okarr[]) {
        for (int i = -2000; i <= 2000; i++)
        {
            bool ok = true;
            for (int j = 0; j < (int)word.size(); ++j)
            {
                if (i + j < 0) {
                    continue;
                }
                if ((int)(input0.size()) <= i + j) {
                    break;
                }

                auto a = input0[i + j];
                auto b = word[j];
                if (a == b) {}
                else if (a == '?') {}
                else if (b == '?') {}
                else {
                    ok = false;
                    break;
                }
            }
            okarr[10000 + i] = ok;
        }
    };
    fill_all(abok, true);
    fill_all(acok, true);
    fill_all(bcok, true);
    check_ok(input[0], input[1], abok);
    check_ok(input[0], input[2], acok);
    check_ok(input[1], input[2], bcok);

    int min_range = 12000;
    for (int i = -4000; i <= 4000; i++)
        for (int j = -4000; j <= 4000; j++)
    {
        if (abok[10000 + i] && bcok[10000 + j] && acok[10000 + i + j]) {
            int pos[6] = {
                0, ((int)input[0].size()),
                i, ((int)input[1].size()) + i,
                i + j, ((int)input[2].size()) + i + j,
            };
            std::sort(pos, pos + 6);
            min_range = std::min(min_range, pos[5] - pos[0]);
        }
    }


    out << min_range << endl;

    return 0;
}
#endif


Measured memory_bytes: 512
fn main() {
    let mut sc = Scanner::new();
    let (sx, sy): (f64, f64) = (sc.read(), sc.read());
    let (tx, ty): (f64, f64) = (sc.read(), sc.read());
    let n: usize = sc.read();
    let mut v = vec![(sx, sy, 0.0)];
    for _ in 0..n {
        let x: f64 = sc.read();
        let y: f64 = sc.read();
        let r: f64 = sc.read();
        v.push((x, y, r));
    }
    v.push((tx, ty, 0.0));
    let n = v.len();

    let mut dist = vec![std::f64::INFINITY; n];
    let mut vis = vec![false; n];
    dist[0] = 0.0;
    for _ in 0..n {
        let mut now = n;
        for i in 0..n {
            if vis[i] {
                continue;
            }
            if now == n {
                now = i;
            } else if dist[now] > dist[i] {
                now = i;
            }
        }
        vis[now] = true;
        let (x, y, r) = v[now];
        for i in 0..n {
            let (tx, ty, tr) = v[i];
            let dx = tx - x;
            let dy = ty - y;
            let d = (dx * dx + dy * dy).sqrt() - tr - r;
            let d = if d > 0.0 { d } else { 0.0 };
            if dist[i] > dist[now] + d {
                dist[i] = dist[now] + d;
            }
        }
    }

    println!("{}", dist[n - 1]);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 4352
// by adiforluls
#pragma GCC optimize ("-O2")
#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 FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define rep(i,a,b)      for(ll i=a;i<b;i++)
#define rfor(i,a,b)     for(ll i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define endl            '\n'
#define SIZE            1000005
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const ll lul2 = 998244353;
const ll lul = 1000000007;

void mod(ll &x)
{
    if(x>=lul) x-=lul;
    if(x<0) x+=lul;
}

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

ll expo(ll n, ll p)
{
    if(p == 0) return 1;
    ll x = expo((n*n)%lul, p/2)%lul;
    if(p&1) return (x*n)%lul;
    return x;
}
//---------------------------------------------------------------------

unordered_map<ll,ll> ma;
void solve()
{
    ll x; cin>>x;
    rep(i,0,205)
    {
        ll a = i*i*i*i*i;
        ma[a] = i;
    }
    rep(i,0,205)
    {
        ll a = i*i*i*i*i;
        ll b = abs(x-a);
        if(ma.count(b))
        {
            if(a+b == x) b = -ma[b];
            else b = ma[b];
            cout<<i<<" "<<b;
            return;  
        }
    }  
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    rep(i,1,t+1){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
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 p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# 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;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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 long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// テーブルを作る前処理
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    vector<ll> X(N);
    REP(i, N) cin >> X[i];

    ll ans = 0;
    REP(i, N - 1) ans += min((X[i + 1] - X[i])*A, B);
    
    pl(ans)

    return 0;
}


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

int main() {
  int month,day;
  int md[] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
  while ( cin >> month >> day, month || day ) {
    int total = 0;
    for ( int i = 0; i < month-1; i++ ) total += md[i];
    total += day;
    if ( total % 7 == 1 ) cout << "Thursday" << endl;
    else if ( total % 7 == 2 ) cout << "Friday" << endl;
    else if ( total % 7 == 3 ) cout << "Saturday" << endl;
    else if ( total % 7 == 4 ) cout << "Sunday" << endl;
    else if ( total % 7 == 5 ) cout << "Monday" << endl;
    else if ( total % 7 == 6 ) cout << "Tuesday" << endl;
    else if ( total % 7 == 0 ) cout << "Wednesday" << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

#define debug(s) cout<< #s <<" = "<< s <<endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(a,val) memset(a, val, sizeof a)
#define PB push_back
#define endl '\n'

inline int myrand(int l, int r) {
	int ret = rand(); ret <<= 15; ret ^= rand();
	if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
	return ret;
}
template <typename F, typename S>
ostream& operator << (ostream& os, const pair< F, S>& p) {
    return os<<"(" <<p.first<<", "<<p.second<<")"; }

typedef pair<int, int> ii;
template<typename T> using min_pq =
	priority_queue<T, vector<T>, greater<T> >;

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

#define int long long

int a, b, c, k;

int32_t main () {
	//freopen("in", "r", stdin);
	//freopen("output.out", "w", stdout);
	cin>>a>>b>>c>>k;
	if(k & 1) {
		cout<<b - a<<endl;
	} else {
		cout<<a - b<<endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int partition(int *A,int p,int r){
  int x,n;
  int i,j;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      n=A[i];
      A[i]=A[j];
      A[j]=n;
    } 
  }
  n=A[i+1];
  A[i+1]=A[r];
  A[r]=n;
  return i+1;
}
int main(){
  int n,i;
  int A[100000];
  int p=0,r,x;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  r=n-1;
  x=partition(A,p,r);
  printf("%d",A[0]);
  for(i=1;i<n;i++){
    if(i==x)printf(" [%d]",A[i]);
    else  printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 2104
import math
n,d=map(int,input().split())
L=[list(map(int, input().split())) for i in range(n)]
x=0
for i in range(n):
  if math.sqrt(L[i][0]**2+L[i][1]**2)<=d:
    x+=1
  else:
    pass
print(x)

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

using namespace std;

int main()
{
    int n, x;
    int a[100];

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

    sort(&a[0], &a[n-1]);

    int count = 0;
    for (int i = 0; i < n-1; i++) {
        if (a[i] > x) {
            break;
        }

        x -= a[i];
        count++;
    }

    if (a[n-1] == x) {
        count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
  long N;
  cin >> N;
  long *d = new long[N];
  for (int i=0; i<N; i++) {
    cin >> d[i];
  }
  sort(d, d+N);
  long res = d[N/2]-d[N/2-1];
  cout << res << endl;
}

Measured memory_bytes: 1024
N = int( input() )

s = []

while True:
    if (N % 2):
        s.append( str(1) )
        N -= 1
    else:
        s.append (str(0))
        N = N
    N /= -2
    if (N == 0):
        break
    
s.reverse()
s = "".join(s)

print (s)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
const ll INF=1e9+7;
const ll N = 102;

ll n,m,x,ans1=0,ans2=0,w=0;
vector <ll> v;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m>>x;
	FOR(i,0,m){
		cin>>w;
		if(w<x)ans1++;
		else ans2++;
	}
	pri(min(ans1,ans2));
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		long h = Integer.parseInt(sc.next());
		Long[] Throw = new Long[n];
		long maxAP = 0;long t=0;
		for(int i=0;i<n;i++) {
			t = Long.parseLong(sc.next());
			Throw[i] = Long.parseLong(sc.next());
			if(t>maxAP)maxAP=t;
		}
		sc.close();
		Arrays.sort(Throw,Comparator.reverseOrder());

		int cnt=0;
		while(cnt<n&&0<h) {
			if(Throw[cnt]<=maxAP)break;
			h-=Throw[cnt];
			cnt++;
		}

		if(h > 0) {
			cnt+=h/maxAP+1;
			if(h%maxAP==0)cnt--;
		}
		System.out.println(cnt);
	}

}

Measured memory_bytes: 63732
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if (abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

}


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

int main(){
	int N;
	cin >> N;
	vector<long long> h(N);
	vector<long long> dp(N,-1);
	long long loop,loop2;
	for(loop=0;loop<N;loop++){
		cin >> h[loop];
	}
	dp[0]=0;
	int jp1,jp2;
	for(loop=0;loop<N-1;loop++){
		jp1 = h[loop+1]-h[loop];
		if(jp1<0){
			jp1 *= -1;
		}
		if(dp[loop+1]==-1||dp[loop+1]>dp[loop]+jp1){
			dp[loop+1] = dp[loop]+jp1;
		}
		if(loop<N-2){
			jp2 = h[loop+2]-h[loop];
			if(jp2<0){
				jp2 *= -1;
			}
			dp[loop+2] = dp[loop] + jp2;
		}
	}
	cout << dp[N-1] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    ll X, K ,D;
    cin >> X >> K >> D;
    ll judge=abs(X)/D;
    if(judge>=K){
        cout << abs(X)-D*K << endl;
        return 0;
    }
    ll dif=0;
    ll times=0;
    if(abs(X)%D==0){
        dif=0;
        times=K-abs(X)/D;
    }
    else{
        dif=abs(X)%D;
        dif=D-dif;
        times=K-(abs(X)/D+1);
    }
    if(X%D==0){
        times=abs(X)/D;
    }
    else{
        times=abs(X)/D+1;
    }
    times=K-times;
    if(times%2==0){
        cout << abs(dif) << endl;
    }
    else if(times%2!=0){
        cout << abs(abs(dif)-abs(D)) << endl;
    }
}


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

int main(){
    int n;
    while(cin >> n && n){
        string post[1000];
        int depth[1000];
        fill(depth, depth+n, 0);
        for(int x = 0; x < n; x++){
            cin >> post[x];
        }
        for(int x = 0; x < n; x++){
            string::iterator ub = upper_bound(post[x].begin(), post[x].end(), 'A');
            depth[x] = ub - post[x].begin();
            if(!depth[x]) continue;
            int y;
            for(y = 0; y < depth[x]; y++){
                post[x][y] = ' ';
            }
            *--ub = '+';
            for(y = x-1; y >= 0; y--){
                if(depth[y] <= depth[x]) break;
            }
            if(depth[y] == depth[x]){
                int d = depth[x]-1;
                for(int z = y+1; z < x; z++){
                    post[z][d] = '|';
                }
            }
        }
        for(int x = 0; x < n; x++){
            cout << post[x] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1988
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll a,p;
    cin >> a >> p;
    
    cout << (a*3+p)/2 << endl;
    
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    bool a = (A == B) && (B == C) && (C == A);
    bool b = (A != B) && (B != C) && (C != A);

    cout <<  ((a || b) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
const int INF = (1<<30);

int main(){

  int m, n;
  int p[10001], c[501], e[501];
  int sum[10001] = {0};
  int dp[10001];

  cin >> m >> n;

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

  sort(p, p+m, greater<int>() );
  for(int i=0; i<n; i++) {
    cin >> c[i] >> e[i];
  }

  for(int i=0; i<m; i++) {
    if( i == 0 ) sum[i] += p[i];
    else sum[i] += p[i] + sum[i-1];
  }

  for(int i=0; i<=m; i++) dp[i] = INF;
  dp[0] = 0;

  for(int i=0; i<n; i++) {
    for(int j=m; j>=c[i]; j--) {
      for(int k=j-c[i]; k<j; k++) {
	dp[j] = min(dp[j], dp[k] + e[i]);
      }
    }
    for(int j=0; j<=c[i]; j++) {
      dp[j] = min(dp[j], e[i]);
    }
  }

  int ans = 0;
  for(int i=0; i<m; i++) {
    ans = max(ans, sum[i] - dp[i+1]);
  }

  cout << ans << endl;
}

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

fn main() {
    let n = scan!(usize);
    let mut ans = 0;
    for i in 1.. {
        if n % i == 0 {
            let m = i - 1;
            if m > 0 && n / m == n % m {
                ans += m;
            }

            if i < n / i {
                let m = n / i - 1;
                if m > 0 && n % m == n / m {
                    ans += m;
                }
            }
        }
        if n < i * i {
            break;
        }
    }

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


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int a, b;
    cin >> a >> b;
    // 処理
    if (b % a == 0) {
        cout << a + b << endl;
    } else {
        cout << b - a << endl;
    }
    // 出力

    return 0;
}


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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using Int = signed;
//INSERT ABOVE HERE
Int dp[2][1010][1010];
Int pv[1010][1010];
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> a(m),b(m);
  for(Int i=0;i<m;i++) cin>>a[i]>>b[i],a[i]--,b[i]--;

  vector<vector<Int> > G(n);
  for(Int i=0;i<m;i++) G[a[i]].emplace_back(b[i]);

  memset(dp,0,sizeof(dp));
  memset(pv,-1,sizeof(pv));
  
  using T = tuple<Int, Int, Int>;
  queue<T> q;
  for(Int i=0;i<m;i++){
    pv[a[i]][b[i]]=i;
    dp[0][a[i]][b[i]]=1;
    q.emplace(0,a[i],b[i]);
  }
  while(!q.empty()){
    Int t,x,y;
    tie(t,x,y)=q.front();q.pop();
    //cout<<t<<":"<<x<<":"<<y<<"::"<<pv[x][y]<<endl;
    for(Int z:G[y]){
      if(x==z) continue;
      Int nt=t||(~pv[x][z]&&pv[x][y]!=pv[x][z]);
      if(dp[nt][x][z]) continue;
      if(pv[x][z]<0) pv[x][z]=pv[x][y];
      dp[nt][x][z]=1;
      q.emplace(nt,x,z);
    }    
  }

  for(Int i=0;i<m;i++){
    Int s=dp[1][a[i]][b[i]];
    Int t=dp[0][b[i]][a[i]]|dp[1][b[i]][a[i]];
    //cout<<s<<" "<<t<<endl;
    cout<<(s^t?"diff":"same")<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 38452
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

ll dp[13][MAX];


int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    string str; cin >> str;

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    rep(i, str.size()){
        rep(j, 13){
            if(str[i] == '?'){
                rep(k, 10){
                    ll num = k;
                    num = j * 10 + num;
                    dp[num%13][i+1] += dp[j][i];
                    dp[num%13][i+1] %= MOD;
                }
            }
            else{
                ll num = str[i] - '0';
                num = j * 10 + num;
                dp[num%13][i+1] += dp[j][i];
                dp[num%13][i+1] %= MOD;
            }
        }
    }

    print(dp[5][str.size()]);
    
    
    return 0;
}


Measured memory_bytes: 10624
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct card{
    char suit;
    int value;
};
void bublesort (card a[], int n){
    int flag = 1;
    while (flag){
        flag = 0;
        for (int j = (n - 1); j > 0; j --){
            if (a[j].value < a[j - 1].value){
                swap(a[j - 1],a[j]);
                flag = 1;
            }
        }
    }
}
void selectionsort (card a[], int n){
    card mina;
    int  s;
   for (int i = 0; i < (n - 1); i ++ ){
        mina = a[i];
        int flag = 0;
        for (int k = i; k < n; k ++){
            if (mina.value > a[k].value){
                mina = a[k];
                s = k;
                flag ++;
            }
        }
        if (flag != 0){
            swap (a[i], a[s]);
        }
    }
}
int main(){
    int n;
    cin >> n;
    card a[n], b[n];
    for (int i = 0; i < n; i++){
        scanf("%*c%c",&a[i].suit);
        scanf("%d",&a[i].value);
        b[i] = a[i];
    }
    bublesort(a, n);
    selectionsort(b,n);
    for (int i = 0; i < n; i++){
        if (i > 0) putchar (' ');
        printf("%c%d",a[i].suit,a[i].value);
    }
    cout << endl << "Stable" << endl;
    int flag = 0;
    for (int i = 0; i < n; i++ ) {   
        if (i > 0) putchar (' ');
        printf("%c%d",b[i].suit,b[i].value);
        if (!(a[i].value == b[i].value && a[i].suit == b[i].suit)) flag = 1;

    }
    cout << endl;
    if (flag) cout << "Not stable" << endl;
    else cout << "Stable" << endl; 
}


Measured memory_bytes: 3268
//          ★★ ASHWINI SHARMA ★★ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define ull unsigned long long int
#define ll long long int
#define ui unsigned int
#define pb push_back
 
#define PI 3.1415926535897932385
#define INF 1e9
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007 
                              //          ★★ ASHWINI SHARMA ★★      
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll exp(ll x, ll y, ll p)
{
    ll res = 1;   
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)    
            res = (res*x) % p;
        y = y>>1;     
        x = (x*x) % p; 
    }
    return res;
}



int main() {
    
    fastio;
    int n, x, t;
    cin >> n >> x >> t;
    int y = n / x;
    if(n % x != 0)
        y++;
    cout << y * t;
    return 0; 
}

Measured memory_bytes: 3648
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int A[3][3];
	rep(i, 3) rep(j, 3) {
		int a;
		cin >> a;
		A[i][j] = a;
	}
	int N;
	cin >> N;
	rep(i, N) {
		int b;
		cin >> b;
		rep(i, 3) rep(j, 3) {
			if (A[i][j] == b) {
				A[i][j] = 0;
			}
		}
	}

	int OK = 0;
	rep(i, 3) {
		int zero = 1;
		rep(j, 3) if (A[i][j] != 0) zero = 0;
		if (zero) OK = 1;
	}
	rep(j, 3) {
		int zero = 1;
		rep(i, 3) if (A[i][j] != 0) zero = 0;
		if (zero) OK = 1;
	}
	int zero = 1;
	rep(i, 3) if (A[i][i] != 0) zero = 0;
	if (zero) OK = 1;
	zero = 1;
	rep(i, 3) if (A[i][2 - i] != 0) zero = 0;
	if (zero) OK = 1;

	if (OK) co("Yes");
	else co("No");

	Would you please return 0;
}

Measured memory_bytes: 256
function Main(input) {
    ans = Infinity;
    input = input.split("\n");
    input[0] = Number(input[0]);
    //W[i](E[i]) := i文字めの左(右)にあるW(E)の数
    W = new Array(input[0]); E = new Array(input[0]);
    WCnt = 0; ECnt = 0;
    for (i = 0; i < input[0]; i++) {
        W[i] = WCnt; E[input[0]-i-1] = ECnt;
        if (input[1][i] == 'W') WCnt++;
        if (input[1][input[0]-i-1] == 'E') ECnt++;
    }
    //[i]の左にあるWの数と右にあるEの数の和の最小値
    for (i = 0; i < input[0]; i++) ans = Math.min(W[i] + E[i], ans);
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 19020
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <queue>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const char W = '.';
const char B = '#';

const int MAXD = 105;
int dp[MAXD][MAXD];

int h, w;

string row;
vector<string> board;

int dh[2] = {-1, 0};
int dw[2] = {0, -1};

int main() {
    GI(h);
    GI(w);

    FORN(i, h) {
        cin >> row;
        board.PB(row);
    }

    FORN(i, MAXD) FORN(j, MAXD) dp[i][j] = INF;

    FORN(i, h) {
        FORN(j, w) {
            if (i == 0 && j == 0) {  // base case
                dp[i][j] = (board[i][j] == B);
            }
            else {
                FORN(k, 2) {
                    auto pi = i + dh[k];
                    auto pj = j + dw[k];

                    if (pi >= 0 && pj >= 0) {
                        dp[i][j] = min(dp[i][j], dp[pi][pj] + (board[i][j] == B && board[pi][pj] == W));
                    }
                }
            }
        }
    }

    printf("%d\n", dp[h-1][w-1]);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int check(int a, int b, int c, int *checker){
	if(checker[a-1] == 1 && checker[b-1] == 1 && checker[c-1] == 1)
		return 1;
	else
		return 0;
}

int main(void){
	int bingo[9];
	int n;
	int checker[9] = {0,};
	int flag = 0;

	for(int i = 0; i < 9; i++){
		scanf("%d", &bingo[i]);
	}

	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		int temp_num;
		scanf("%d", &temp_num);

		for(int j = 0; j < 9; j++)
			if(bingo[j] == temp_num)
				checker[j] = 1;
	}
	if(check(1, 4, 7, checker) == 1)
		flag = 1;
	if(check(2, 5, 8, checker) == 1)
		flag = 1;
	if(check(3, 6, 9, checker) == 1)
		flag = 1;
	
	if(check(1, 2, 3, checker) == 1)
		flag = 1;
	if(check(4, 5, 6, checker) == 1)
		flag = 1;
	if(check(7, 8, 9, checker) == 1)
		flag = 1;

	if(check(1, 5, 9, checker) == 1)
		flag = 1;
	if(check(3, 5, 7, checker) == 1)
		flag = 1;


	if(flag == 1)
		printf("Yes");
	else
		printf("No");


	return 0;
}

Measured memory_bytes: 128