akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;
  h = min(h, 2 * q);
  s = min(s, 2 * h);
  d = min(d, 2 * s);
  ll price = 0;
  if(n>=2){
    price += d * (n / 2);
    n -= 2 * (n / 2);
  }
  if(n==1){
    price += s;
  }
  print(price);
}

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

int main(void)
{
    int N, i;
    long long int T[200];
    long long int a,b,r,gcd,X;
    
    scanf("%d",&N);
    
    for(i=0; i<N; i++){
        scanf("%lld",&T[i]);
    }
    
    gcd=T[0];
    for(i=1; i<N; i++){
        //最小公倍数を求めてそれをAに代入
        if(gcd < T[i]){
            a = T[i];
            b = gcd; 
        } else {
            b = T[i];
            a = gcd; 
        }
        r = a%b;
        while(r != 0){
            a = b;
            b = r;
            r = a%b;
        }
        gcd=T[i]/b*gcd;
    }
    
    printf("%lld\n",gcd);
    
    return 0;
}

Measured memory_bytes: 256
/*
Problem : https://atcoder.jp/contests/abc126/tasks/abc126_c
Algorithm : math
Status :
*/
#include <bits/stdc++.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;

const int INF = 0x3f3f3f3f;

int n,k;
double ans;

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%d",&n,&k);
	for(int i = 1;i <= n;i++){
		double tmp = 1.0 / (double)n;
		int x = i;
		while(x < k){
			tmp /= 2.0;
			x *= 2;
		}
		ans += tmp;
	}
	printf("%.12f\n",ans);
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int dp[100000000];

int main(){
	int N,M;	
	while(~scanf("%d %d",&N,&M)){
		if(N==M && M==0) break;
		vector<int> Points;
		Points.push_back(0);
		for(int i=0;i<N;i++){
			int p;
			scanf("%d",&p);
			Points.push_back(p);
		}

		vector<int> Points2;
		for(int i=0;i<=N;i++){
			for(int j=0;j<=N;j++){
				Points2.push_back(Points[i]+Points[j]);
			}
		}

		sort(Points2.begin(),Points2.end());
		vector<int>::iterator it = unique(Points2.begin(),Points2.end());
		Points2.erase(it,Points2.end());


		int res=0;
		for(vector<int>::iterator it = Points2.begin();it != Points2.end();it++){
			if(M-*it<0) continue;

			vector<int>::iterator it2 = lower_bound(Points2.begin(),Points2.end(),M-*it);
			if(it2==Points2.end()) continue;
			res = max((it2 == Points2.begin() ? 0 : *(it2-1)) + *it,res);
		}

		printf("%d\n",res);
	}
}

Measured memory_bytes: 5136
#include <stdio.h>

void bubbleSort(int arr[], int n) {
	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < n - i - 1; j++) {
			if (arr[j] > arr[j + 1]) {
				int swap = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = swap;
			}
		}
	}
}

int main() {
	int n;
	scanf("%d", &n);
	int arr[n];
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	int ctr = 0;
	bubbleSort(arr, n);
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (arr[i] != arr[j] && arr[j] != arr[k] && arr[i] + arr[j] > arr[k]) {
					ctr++;
				}
			}
		}
	}
	printf("%d\n", ctr);
	return 0;
}

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

int main()
{
  int sum;
  string a;
  while(1){
    cin>>a;
    if(a[0]=='0')break;
    sum=0;
    for(int i=0;a[i]!='\0';i++){
      sum+=(a[i]-'0');
    }
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std ; 
#define ll              long long int
// #define cini(x)	        scanf("%lld",&x)
// #define cins(s)	        scanf("%s",s)
#define deb(x)          cout << (x) << "  " ;
#define out(x)          cout << (x) << endl ;
#define endl            '\n'
#define pb              push_back
#define mk              make_pair
#define fastio          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(x,n,v)     for(int v=(int)x; v<(int)n; v++)
#define loopr(n,x,v)     for(ll v=n-1; v>=x; v--)
#define mod             1000000007
#define all(x)          x.begin(), x.end()
#define clr(x)          memset(x, 0, sizeof(x))
#define sortall(x)      sort(all(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define PI              3.1415926535897932384626
#define setbits(x)      __builtin_popcount(x)
#define zrobits(x)      __builtin_ctz(x)
#define ps(x,y)         fixed << setprecision(y) << (x)
#define w(t)            int t; cin>>t; while(t--) 
#define     vi          vector<ll>
#define     vtt         vector<pair<ll,ll>> 
#define     pii         pair<ll,ll> 
#define  mapp           map<ll,ll> 
#define  sett           set<ll>
int dp[1000][1000] ;
ll mpow(ll base, ll exp); 
// =================================
// =================================





int main(){
    fastio ;
    // w(t)
    // {
        ll a=0, b=0, c=0, d=0, e=0, p=0, q=0, r=0 ;
        ll ans=0, res=0, cnt=0, sum=0, diff=0, mul=1, val=0, k=0 ;
        // loop(0,n,i) brr[i]=0;
        // char s[100005];
        ll n,m ;
        cin >> n ;
        cin >> m ;
        // cin >> s ;
        ll arr[n+1][m+1], brr[n+1][m+1]; 
        loop(0,n,i){
            string s ;
            cin >> s ;
            // cout << s ;
            loop(0,m,j){
                  if(s[j]=='.')  arr[i][j]=1;
                          else   arr[i][j]=0;
            }
        }
        loop(0,n,i) loop(0,m,j) brr[i][j]=0;
        loop(0,n,i){
            loop(0,m,j){
                if(i==0 && j==0){
                    if(arr[i][j]==1) brr[i][j]=1;
                }
                else if(i==0){
                    if(arr[i][j]==0){ brr[i][j]=0; continue; }
                    else  brr[i][j] += brr[i][j-1]%mod;
                }
                else if(j==0){
                    if(arr[i][j]==0){ brr[i][j]=0; continue; }
                    else  brr[i][j] += brr[i-1][j]%mod;
                }
                else{
                    if(arr[i][j]==0){ brr[i][j]=0; continue; }
                    else brr[i][j] += (brr[i][j-1]+brr[i-1][j])%mod ;
                }
            }
        }
        cout << brr[n-1][m-1]%mod << endl ;
    // }
    return 0 ;
}

// g++ x.cpp -o as && ./as

Measured memory_bytes: 19260
n, k = list(map(int, input().split()))
v = [0 for i in range(n)]
for i in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  for j in range(d):
    v[a[j]-1] += 1
ans = 0
for i in range(n):
  if v[i] == 0:
    ans += 1
print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
#include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ull unsigned long long
#define pi (acos(-1))
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=

using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll &x, ll &y);
ll nCr(ll n, ll r);
void stat();
constexpr ll mod = 1000000000 + 7;
int main()
{
    stat();
char c;cin>>c;
if(isupper(c)){
cout<<'A'<<endl;
}
else{
	cout<<'a'<<endl;
}
    return 0;
}
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat() {
#ifdef local
    rep(i, 2) {std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) { num = num * (n - i + 1) / i; }
    return num;
}


Measured memory_bytes: 3636
N = int(input())
l = list(map(int,input().split(" ")))
for i in range(N):
    if l[i] % 2 == 1:
        pass
    else:
        if l[i] % 6 == 0 or l[i] % 10 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

Measured memory_bytes: 3060
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 




/*****************************************************************************/

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

	int n, W;
	cin >> n >> W;
	vi w(n), v(n);
	f_v2I(w, v, n);
	vvi dp(n + 1, vi(100100, ll_INF));
	dp[0][0] = 0;
	f(i, 0, n) {
		f(j, 0, 100100) {
			if (j >= v[i]) {
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			}
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	int ans = 0;
	f(i, 0, 100100) {
		if (dp[n][i] <= W) {
			ans = i;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 80256
#include <stdio.h>

int main(void) {
    int A1,A2,A3;
    
    scanf("%d %d %d",&A1,&A2,&A3);
    
    if (A1+A2+A3>=22) {
        printf("bust\n");
    } else {
        printf("win\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

bool is_prime(long long n)
{
    if (n == 1) {
        return false;
    }

    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

int main()
{
    long long n;
    std::cin >> n;

    long long ans = 0;
    for (int i = 1; i <= n / 2; i++) {
        if (n - i != i) {
            ans++;
        }
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define cl clear()
#define sqr(a) (a*a)
#define mk make_pair
#define po pop()
#define pu push
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()
string en="\n";
string sp=" ";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs  vector<string>
#define MX LLONG_MAX
#define MN LLONG_MIN
#define MOD 1000000007
#define vp(vi,x) cin>>x; vi.pb(x);
#define bsearch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,p,q,a,b,c=0;
    bool f=0,ff=0;string st,ss; char ch;
    while(cin>>st>>ss)
    {
        c=0;
        rep(i,st.sz)
        {
            if(st[i]!=ss[i])c++;
        }
        cout<<c<<en;
    }
}




Measured memory_bytes: 3924
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int r=sc.nextInt();
        int c=sc.nextInt();
        String[] ar=new String[r];
        TreeSet<Integer> setRow=new TreeSet<Integer>();
        TreeSet<Integer> setCol=new TreeSet<Integer>();
        for(int i=0;i<r;i++){
            ar[i]=sc.next();
            if(!ar[i].contains("#")){
                setRow.add(i);
            }
        }
        char[][] ch=new char[r][c];
        for(int i=0;i<r;i++){
            ch[i]=ar[i].toCharArray();
        }
        boolean b=false;
        for(int j=0;j<c;j++){
            b=false;
            for(int i=0;i<r;i++){
                //System.out.println("C");
                if(ch[i][j]=='#'){
                    //System.out.println("B");
                    b=true;
                    break;
                }
            }
            if(b==false){
                //System.out.println("A");
                setCol.add(j);
            }
            //System.out.println("j="+j);
        }
        for(int i=0;i<r;i++){
            if(!setRow.contains(i)){
                for(int j=0;j<c;j++){
                    if(!setCol.contains(j)){
                        System.out.print(ch[i][j]);
                    }
                }      
            System.out.println();
            }
        }
    }  
}

Measured memory_bytes: 22692
#include <bits/stdc++.h>
    #define hell                         1000000007 
    #define M                            1000000007
    #define Maxi                      10000000000000000
        #define lcm(a,b)                     (a*b)/__gcd(a,b)
        #define ll                           long long

        #define vll                          vector<ll>
        #define vi                           vector<long long>
        #define pll                          vector< pair<ll,ll> >
        #define pb                           push_back
        //#define mp                           make_pair
        #define all(v)                       v.begin(),v.end()
        #define lbnd                         lower_bound
        #define ubnd                         upper_bound
        #define bs                           binary_search
        #define F                            first
        #define S                            second
        #define rep(i,a,b)                   for(i=a;i<b;i++)
        #define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
        #define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
        #define ret(x)                       return cout<<x,0;
        #define dbg(x)                       cout << #x << " is " << x << endl;
        //#define endl                           '\n'
     
     
        // Debug //
     
        #define trace(x)                 cerr << #x << ": " << x << endl;
        #define trace1(x)                cerr << #x << ": " << x << endl;
        #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
        #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
        #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
        #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
        #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


    using namespace std;
    
    //ll parent
    ll arr[100005];
    map<ll,vector<ll>>m1;
    int main()
    {

         ios_base::sync_with_stdio(false);
         cin.tie(NULL);cout.tie(NULL);
      
      double p=1.0;
      ll i,j;
      ll n;
      cin>>n;
      ll a[n];
      rep(i,0,n)
      {
        cin>>a[i];
        p=p*a[i];
      }
      double sum1=0.0;
      for(i=0;i<n;i++)
      {
        sum1+=(p/a[i]);
      }
      cout<<p/sum1<<endl;
      return 0;
  }

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>

using namespace std;
typedef long long int ll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)

ll llmax(ll a, ll b){
  return a > b ? a : b;
}

ll log2(ll n){
  ll l = 1;
  while(n /= 2) l++;
  return l;
}

ll calc_ans(ll* eks, ll N, ll K, ll d){
  ll mask = 1;
  mask <<= d;
  if(d == 0){
    if(K == 0) return eks[0];
    return max(eks[0], N - eks[0]);
  }
  if(d >= log2(K)){
    return mask * eks[d] + calc_ans(eks, N, K, d-1);
  }
  else{
    ll tmp = mask * eks[d];
    rep(i, d){
      ll m = 1;
      tmp += (m << i) * llmax(eks[i], N - eks[i]);
    }
    if(eks[d] * 2 >= N) return tmp;
    return llmax(tmp, mask * (N - eks[d]) + calc_ans(eks, N, K - mask, d-1));
  }
}

int main(){
  ll N, K;
  scanf("%lld %lld", &N, &K);
  vector<ll> A(N);
  rep(i, N) cin >> A[i];

  ll max = *max_element(A.begin(), A.end());
  ll logmax = log2(max);
  ll logk = log2(K);
  ll each_keta_sum[llmax(logmax, logk)] = {};
  ll mask = 1;
  rep(k, logmax){
    rep(i, N) if(A[i] & mask) each_keta_sum[k]++;
    mask = mask << 1;
  }

  ll ans = calc_ans(each_keta_sum, N, K, llmax(logmax, logk) - 1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

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

void solve() {
    int N; cin>>N;
    vector<ll> a(N);
    for (int i = 0; i < N; ++i) {
        cin>>a[i];
    }

    ll maxi=2,mini=2;
    for (int i = N-1; i >= 0; --i) {
        ll b_maxi = maxi/a[i]*a[i];
        ll b_mini = ((mini-1)/a[i]+1)*a[i];
        if(b_maxi<mini){
            cout<<-1<<endl;
            return;
        }

        maxi=b_maxi+a[i]-1;
        mini=b_mini;

    }
    cout<<mini<<" "<<maxi<<endl;

}


#define SINGLE
int main() {
#ifdef SINGLE
    solve();
#else
    int N;
    cin>>N;
    for(int i=0;i<N;++i){
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 3992
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int left=k,ans=0;
    ans+=min(left,a); left-=a;
    if(left>0) left-=b;
    if(left>0) ans-=left;
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
using namespace std;

const long long N = 300001, P = 1e9 + 7;

long long power(long long val, long long st, long long p) {
    if (st == 0) {
        return 1;
    }
    long long temp = power(val, st / 2, p);
    temp = temp * temp;
    temp %= p;
    if (st % 2 == 1) {
        temp *= val;
        temp %= p;
    }
    return temp;
}


long long fact[8000000];

void fct(long long n, long long p) {
    fact[0] = 1;
    for (long long i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}

long long c(long long n, long long k, long long p = -1) {
    if (p == -1) {
        long long x = fact[n];
        long long y = (fact[k] * fact[n - k]);
        return (x / y);
    } else {
        long long x = fact[n];
        long long y = (fact[k] * fact[n - k]) % p;
        x = (x * power(y, p - 2, p)) % p;
        return x;
    }
}


int32_t main() {
    long long n;
    cin >> n;
    fct(n + 1, P);
    long long ans = 0;
    for (int i = 2; i <= n; i++) {
        ans += ((((c(n, i, P) * ((power(2ll, i, P) - 2 + P) % P)) % P) * power(8ll, n - i, P)) % P);
        ans %= P;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 11376
function gerTheNumberOfCoin(){
   var T=[];
   for(var i=0;i<=n;i++){
      T[i]=Number.POSITIVE_INFINITY;
    }
    T[0]=0;    
    for(var i=0;i<m;i++){    
       for(var j=C[i];j<=n;j++){
          T[j]=Math.min(T[j],T[j-C[i]]+1);
       }
    }
    return T[n];
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var nm=Arr[0].split(" ").map(Number);
var n=nm[0];
var m=nm[1];
var C=Arr[1].split(" ").map(Number);
var min=gerTheNumberOfCoin();
console.log(min);

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

using namespace std;

int main(void){
    int D,T ,S;
    int iBuf1;
    cin >> D >> T >> S;
    iBuf1 = T*S;
    if(iBuf1 >= D)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
   
    
}

Measured memory_bytes: 3628
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <limits.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '(L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

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

  vector<LL> X(n),Y(n);
  vector<LL> Xary,Yary;//領域決定用
  
  REP(i,n){
      cin>>X[i]>>Y[i];
      Xary.push_back(X[i]);
      Yary.push_back(Y[i]);
  }
  SORT(Xary);
  SORT(Yary);


  LL ans=LLONG_MAX;

  //始点と終点を単純に変える
  for(int xi = 0; xi < n; ++xi)for(int xj = xi + 1; xj < n;++xj)for(int yi = 0; yi < n; ++yi)for(int yj = yi + 1; yj < n;++yj)
  {
    int num=0;
    LL xmin=Xary[xi],xmax=Xary[xj];
    LL ymin=Yary[yi],ymax=Yary[yj];
    
    //単純に何個範囲内にあるか調べる
    REP(i,n){
        if(xmin<=X[i]&&X[i]<=xmax&&ymin<=Y[i]&&Y[i]<=ymax){
            num++;
        }
    }
    if(num>=k){
        ans=min(ans,(xmax-xmin)*(ymax-ymin));
    }

  }


  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

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

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    a = root(a);
    return -Parent[a];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(a < b) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }
};

int main(){
  int n; cin >> n;
  int ans = 1e9;
  for(int i = 1; i < n; i++) {
    int a = i, b = n-i;
    int sum = 0;
    while(a > 0){
      sum += a%10;
      a /= 10;
    }
    while(b > 0){
      sum += b%10;
      b /= 10;
    }
    chmin(ans, sum);
  }
  cout << ans << endl;
}

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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

int N;

int main(){
    cin >> N;
    vector<int> C(N+1);
    vector<int> F(200010,0);
    long long DP[N+1];
    DP[0] = 1;
    Rep(i,N)cin >> C[i+1];
    Rep(i,N){
        if(F[C[i+1]] == 0)DP[i+1] = DP[i];
        else if(F[C[i+1]] == i)DP[i+1] = DP[i];
        else DP[i+1] = DP[i] + DP[F[C[i+1]]];
        F[C[i+1]] = i+1;
        DP[i+1] %= MOD;
        //cout << DP[i+1] << endl;
    }
    cout << DP[N] << endl;
    //cin >> N;
}

Measured memory_bytes: 3328
import collections
import itertools
import operator


class UnionFind:
    def __init__(self, elems=None):
        class KeyDict(dict):
            def __missing__(self, key):
                self[key] = key
                return key

        self.parent = KeyDict()
        self.rank = collections.defaultdict(int)

        if elems is not None:
            for elem in elems:
                _, _ = self.parent[elem], self.rank[elem]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    def are_same(self, x, y):
        return self.find(x) == self.find(y)

    def grouper(self):
        roots = [(x, self.find(x_par)) for x, x_par in self.parent.items()]
        root = operator.itemgetter(1)
        for _, group in itertools.groupby(sorted(roots, key=root), root):
            yield [x for x, _ in group]


uf = UnionFind()


n, m = map(int, input().split())
for i in range(m):
    x, y = map(int, input().split())
    uf.unite(x, y)

g = list(uf.grouper())

ans = 1
for i in g:
    ans = max(ans, len(i))

print(ans)

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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> d(n);
    for (size_t i = 0; i < n; i++) cin >> d[i];

    sort(d.begin(), d.end());
    int ans = d[n/2] - d[n/2-1];

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


Measured memory_bytes: 3768
w,h,n = map(int,input().split())
w_min = 0
w_max = w
h_min = 0
h_max = w
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        if w_min < x:
            w_min = x
            
    if a == 2:
        if w_max > x:
            w_max = x
            
    if a == 3:
        if h_min < y:
            h_min = y
            
    if a == 4:
        if h_max > y:
            h_max = y

w = (w_max-w_min)
h = (h_max-h_min)
if (w > 0) and(h > 0):
    print(w*h)
    
else:
    print(0)

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

const char sp = ' ';

vector<int> vi;

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

    vi.resize(N);

    REP(i, N) cin >> vi[i];

    ALL(sort, vi);

    int min = vi[0];
    int max = vi[N - 1];

    int half = max / 2;

    // 以上
    auto itr = ALL(lower_bound, vi, half);

    int h = distance(vi.begin(), itr);

    if (N == 2) cout << max << sp << min << endl;
    else
    {
        // half - vi[h - 1] < vi[h] - half
        if (2 * half < vi[h - 1] + vi[h])
        {
            cout << max << sp << vi[h - 1] << endl;
        }
        else
        {
            cout << max << sp << vi[h] << endl;
        }
    }

    return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPE(i, n) for (int i = 0; i <= (n); ++i)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'

typedef long long ll; //64bit型
using namespace std;

const long long INF = 1LL << 60; //無限大の値
static const int N = 100;

int main()
{
    int n, p[N + 1], m[N + 1][N + 1];
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> p[i - 1] >> p[i];
    }

    for (int i = 1; i <= n; i++)
        m[i][i] = 0;
    for (int l = 2; l <= n; l++)
    {
        for (int i = 1; i <= n-l+1; i++)
        {
            int j = i + l - 1;
            m[i][j] = (1 << 21);
            for (int k = i; k <= j - 1; k++)
            {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }

    cout << m[1][n] << endl;

    return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using ll = long long;
using namespace std;
bool solve(int n, vector<int> & a, vector<vector<int> > & g) {
    vector<int> dp(n);
    auto is_leaf = [&](int i) { return g[i].size() == 1; };
    function<bool (int, int)> go = [&](int i, int parent) {
        if (is_leaf(i)) {
            dp[i] = a[i];
        } else {
            ll sum_dp = 0;
            for (int j : g[i]) if (j != parent) {
                if (not go(j, i)) return false;
                sum_dp += dp[j];
            }
            if (sum_dp < a[i]) return false;
            ll b = sum_dp - a[i];
            ll c = a[i] - b;
            if (b < 0 or c < 0) return false;
            int argmax_dp = *whole(max_element, g[i], [&](int j, int k) { return make_pair(j != i, dp[j]) < make_pair(k != i, dp[k]); });
            ll max_dp = dp[argmax_dp];
            if (max_dp > sum_dp / 2) {
                if (sum_dp - max_dp < b) return false;
            } else {
                if (sum_dp / 2 < b) return false;
            }
            dp[i] = c;
        }
        return true;
    };
    assert (n >= 2);
    if (n == 2) {
        return a[0] == a[1];
    } else {
        int i = 0;
        while (is_leaf(i)) ++ i;
        if (not go(i, -1)) return false;
        return dp[i] == 0;
    }
}
int main() {
    int n; cin >> n;
    vector<int> a(n); repeat (i,n) cin >> a[i];
    vector<vector<int> > g(n);
    repeat (i,n-1) {
        int x, y; cin >> x >> y; -- x; -- y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    cout << (solve(n, a, g) ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 15872
/*
	* ernestvw
	* C++
	* May 2020
*/

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

#define int long long

#define x first
#define y second
#define pb push_back
#define pii pair<int, int>
#define veci vector<int>
#define vecs vector<string>
#define amax(x, v) x = max(x, (v))
#define amin(x, v) x = min(x, (v))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define nl '\n'

using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

const int oo = 1e9; // INT_MAX
const long long OO = 1e18; // LLONG_MAX
const double eps = 1e-9;
const int p197 = 1000000007;
const int p998 = 998244353;
const int p103 = 1000003;

#define TEST_CASES 0

void solve(int test_case);

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int T = 1;
	if(TEST_CASES) cin >> T;
	for(int t = 1; t <= T; t++)
		solve(t);

	return 0;
}

// ---------------------------------------------------

int k, a, b;

void solve(int test_case) {
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK"<<endl;
			return;
		}
	}
	cout<<"NG"<<endl;
}



















































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

namespace ABC125
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] abt = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(abt[1]*Math.Floor((abt[2] + 0.5) / abt[0]));
        }
    }
}


Measured memory_bytes: 13396
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[500005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=500005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }



lld maxSubArraySum(vector<lld> &a, lld size) 
{ 
    lld max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (lld i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 


lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;
lld ss=1;

void solve()
{    
    lld t;
    cin>>n>>x>>t;
    ans = (n/x)+((n%x)?1:0);
    cout<<ans*t;
}

void fun111(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    
}

int main()
{
    // fun111();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    // cin>>t;
    // cout<<t;
    lld p1 = 1e9 + 7;
    // getfac(p1);
    //check the value by which modulo is to be taken
    // precompute();
    for(int i=0;i<t;i++)
    {
        // cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3632
def isprime(n)
  2.upto(10000) {|i|
    if(0==(n % i) && (n > i)) 
        return 0
    end
  }
  1
end

n = STDIN.gets.split[0].to_i

cnt=0
0.upto(n-1) {|i| 
  n = STDIN.gets.split[0].to_i
  cnt+=1 if isprime(n)==1
}
p cnt

Measured memory_bytes: 8724
#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 ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

const long long INF = (long long) 1e11+1;
const long long mod = (long long) 100000000 ;
const long long hell = (long long) 1000000007;


ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x*res);
    x=(x*x);    
    y=y/2;
  }
  return res;
}

ll modinv(ll x,ll m){
  return power(x,m-2);
}

void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}


void solve(){
    int n,m;
    cin>>n;
    ll a[n+1];
    memset(a,0,sizeof(a));
    forn(i,1,n){
        int x;
        cin>>x;
        a[x]++;
    }
    forn(i,1,n+1)
    cout<<a[i]<<" ";
}


int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;
  
   while(test--)
   solve();
}

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/

// gcd of strings
/*
string getgcd(string s1,string s2){
    
    while(true){
        if(s1.length()<s2.length()){
            swap(s1,s2);
            continue;
        }
        if(s2.empty())
        return s1;
        
        if(s1.substr(0,s2.length())!=s2)
        return "";
        
        s1=s1.substr(s2.length());
    }
}
*/
/*
// for user defined DS hashmap and set
 
struct hash_pair{
      size_t operator()(const pair<int,pair<int,int>>& p) const{
          auto hash1=hash<int>()(p.F) ;
          auto hash2=hash<int>()(p.S.F) ;
          auto hash3=hash<int>()(p.S.S) ;
          return (hash1^hash2)^hash3;
      }  
};
struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator () (std::pair<T1, T2> const &pair) const
	{
		std::size_t h1 = std::hash<T1>()(pair.first);
		std::size_t h2 = std::hash<T2>()(pair.second);

		return h1 ^ h2;
	}
};
*/



Measured memory_bytes: 5172
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<iterator>
#define ll long long
#define mod 1000000007
#define inf 100000000000000
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	string str1, str2;
	cin>>str1>>str2;
	int i,j;
	int dp[str1.size()+1][str2.size()+1];
	for(i=0; i<=str2.size(); i++)
	{
		dp[0][i]=0;
	}
	for(i=0; i<=str1.size(); i++)
	{
		dp[i][0]=0;
	}
	for(i=1; i<=str1.size(); i++)
	{
		for(j=1; j<=str2.size(); j++)
		{
			if(str1[i-1]==str2[j-1])
			{
				dp[i][j]=1+dp[i-1][j-1];
			}
			else
			{
				dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	i=str1.size();
	j=str2.size();
	string ans="";
	while(i>0 && j>0)
	{
		if(str1[i-1]==str2[j-1])
		{
			ans+=str2[j-1];
			i--;
			j--;
		}
		else
		{
			if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}
	reverse(ans.begin(), ans.end());
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 35456
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s;
  int n;
  cin>>s>>n;
  rep(i,s.size()){

    if(i==s.size()-1&&n!=0){
      s[i]=(s[i]-'a'+n)%26+'a';   
    }else if(n>=('z'-s[i])+1&&s[i]!='a'){
      n=n-int('z'-s[i])-1;
      s[i]='a';
    }
  }
  cout<<s<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int l,r;
  int lmax=-1,rmin=n;
  for(int i=0;i<m;++i){
    cin>>l>>r;
    lmax = max(lmax,l);
    rmin = min(r,rmin);
  }
  if(rmin-lmax+1>0){
    cout<<rmin-lmax+1<<endl;
  }else{
    cout<<0<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	int A, B;	cin >> A >> B;
	string str = to_string(A) + to_string(B);
	int num = atoi(str.c_str());
	int sqrt = pow(num, 0.5);
	if (pow(sqrt, 2) == num) {
		cout << "Yes" << endl;
		cin >> A;
		return 0;
	}
	cout << "No" << endl;
	cin >> A;
	return 0;
}

Measured memory_bytes: 384