akhauriyash/Code-Regression huggingface dataset:
/*https://bom.to/nxtvde2k1m4l*/
#include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cout << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define task "NAME"
typedef pair<int,int> ii;
typedef long long ll;
map<int,int> dd;
void init()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    freopen(task".inp","r",stdin);
    freopen(task".out","w",stdout);
}
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i ++) {
        int x ; cin >> x;
        if (dd[x]) return cout << "NO", 0;
        dd[x] = 1;
    }
    cout << "YES";
}







Measured memory_bytes: 9600
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 10 21:46:33 2020

@author: naoki
"""

N = int(input()) # 横列の数N
array1 = list(map(int,input().split())) # 1行目のアメの数を入力
array2 = list(map(int,input().split())) # 2行目のアメの数を入力
#どの段階で下の行に移るかが問題でアメの取り方はN通りある
count = [0 for i in range(N)] # 取った雨の数の合計を格納する配列。

for k in range(N): # k列目で下の行に移った場合
    i = 0
    j = k
    while i <= k:
        count[k] = count[k] + array1[i] 
        i+=1            
        while j <= N-1:
            count[k] = count[k] + array2[j]
            j+=1
count.sort(reverse = True)

print(count[0])

Measured memory_bytes: 3064
#include <stdio.h>

int main()
{
    int a, b, c;
    int count;
    scanf("%d %d %d", &a, &b, &c);
    count = 0;
    for( ; a <= b ; a++) {
        if((c%a) == 0) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 2112
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <assert.h>

using namespace std;
typedef long long ll;

char rgby(int x){
	if(x==0)
		return 'R';
	if(x==1)
		return 'G';
	if(x==2)
		return 'B';
	if(x==3)
		return 'Y';
	if(x==-1)
		assert(false);
}

int main(){
	ll H,W,d;
	cin >> H >> W >> d;
	vector<vector<int> > ans(H, vector<int>(W, -1));
	if(d%2){
		for(int y=0;y<H;y++)
			for(int x=0;x<W;x++)
				ans[y][x]=(y+x)%2;
	}else{
		for(int bx=0;bx<W+(d/2);bx+=d){
			for(int by=0;by<H+(d/2);by+=d){//RGRG
				int col = (by/d + bx/d)%2;
				for(int dy=-(d-2)/2; dy<=(d-2)/2;dy++)
					for(int dx=abs(dy);dx<d-abs(dy);dx++){
						if(0<= by+dy && by+dy<H && 0<=bx+dx && bx+dx < W)
							ans[by+dy][bx+dx]=col;
					}
			}
		}
		for(int bx=-(d/2);bx<W+d/2;bx+=d){//BYBY
			for(int by=(d/2);by<H+d/2;by+=d){
				int col = ((by+d/2)/d + (bx+d/2)/d)%2 + 2;
				for(int dy=-(d-2)/2; dy<=(d-2)/2;dy++)
					for(int dx=abs(dy);dx<d-abs(dy);dx++){
						if(0<= by+dy && by+dy<H && 0<=bx+dx && bx+dx < W)
							ans[by+dy][bx+dx]=col;
					}
			}
		}
	}
	for(int y=0;y<H;y++){
		for(int x=0;x<W;x++)
			cout << rgby(ans[y][x]);
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1536
import java.util.ArrayList;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;



	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		N = sc.nextInt();
		M = sc.nextInt();
		map = new ArrayList<ArrayList<Integer>>(200001);

		for(int i = 0;i <200000;i++){				//初期化
			ArrayList<Integer> set = new ArrayList<Integer>();
			set.add(0);
			map.add(set);
		}

		for(int  i = 0;i < M;i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			map.get(a).add(b);
		}

		dfs(1,0);
		System.out.println("IMPOSSIBLE");


	}

	static void dfs(int p, int count){				//pは現在地、cは何回定期便を使ったか

		if(count > 2){
			return;
		}

		if(p == N){
			System.out.println("POSSIBLE");
			System.exit(0);
		}

		for(int i= 0;i < map.get(p).size();i++){
			int nextp = map.get(p).get(i);					//隣接点
			count++;
			dfs(nextp, count);					
			count--;
		}

	}

}




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

using namespace std;

int main()
{
    int n {0};
    cin >> n;
    vector <int> h (n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; i++)
    {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 4056
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		System.out.println(solve(sc.nextLine(), sc.nextLine()));
	}

	long solve(String A, String B) {
		Scanner sc = new Scanner(System.in);
		int n = A.length();
		String BBB = B + B + B;
		int[] prev1 = new int[BBB.length()];
		int[] next1 = new int[BBB.length()];
		for (int i = 0; i < BBB.length(); ++i) {
			if (BBB.charAt(i) == '1') {
				prev1[i] = i;
			} else {
				if (i > 0) {
					prev1[i] = prev1[i - 1];
				} else {
					prev1[i] = -1;
				}
			}
		}
		for (int i = BBB.length() - 1; i >= 0; --i) {
			if (BBB.charAt(i) == '1') {
				next1[i] = i;
			} else {
				if (i + 1 < BBB.length()) {
					next1[i] = next1[i + 1];
				} else {
					next1[i] = BBB.length();
				}
			}
		}

		long ans = Long.MAX_VALUE;
		out: for (int rot = -n; rot <= n; ++rot) {
			boolean[] distinct = new boolean[n];
			int n10 = 0, n01 = 0;
			for (int i = 0; i < n; ++i) {
				if (A.charAt(i) == BBB.charAt((i + n) + rot)) {
					continue;
				}
				distinct[i] = true;
				if (A.charAt(i) == '0') {
					++n01;
				} else {
					++n10;
				}
			}
			int[] left = new int[n];
			int[] right = new int[n];
			for (int i = 0; i < n; ++i) {
				if (!distinct[i])
					continue;
				if (next1[0] == BBB.length()) {
					continue out;
				}
				left[i] = ((i + n) + rot) - prev1[(i + n) + rot];
				right[i] = next1[(i + n) + rot] - ((i + n) + rot);
				if (rot > 0) {
					left[i] = Math.max(0, left[i] - rot);
				} else {
					right[i] = Math.max(0, right[i] + rot);
				}
			}
			ans = Math.min(ans, 2 * f(left, right) + n10 + n01 + Math.abs(rot));
		}
		return (ans > 2 * n ? -1 : ans);
	}

	long f(int[] left, int[] right) {
		class Pair implements Comparable<Pair> {
			int left;
			int right;

			public Pair(int left_, int right_) {
				left = left_;
				right = right_;
			}

			public int compareTo(Pair o) {
				if (left != o.left)
					return Integer.compare(left, o.left);
				else
					return Integer.compare(right, o.right);
			};
		}
		int n = left.length;
		ArrayList<Pair> list = new ArrayList<>();
		for (int i = 0; i < n; ++i) {
			list.add(new Pair(left[i], right[i]));
		}
		Collections.sort(list);
		for (int i = (list.size() - 2); i >= 0; --i) {
			if (list.get(i).right <= list.get(i + 1).right) {
				list.remove(i);
			}
		}

		long ret = Long.MAX_VALUE;
		PriorityQueue<Pair> pq = new PriorityQueue<>();
		for (int i = 0; i < list.size(); ++i) {
			pq.add(list.get(i));
		}
		Pair pre = null;
		while (!pq.isEmpty()) {
			Pair pair = pq.poll();
			if (pre == null) {
				ret = Math.min(ret, pair.right);
			} else {
				ret = Math.min(ret, pair.right + pre.left);
			}
			if (pq.isEmpty()) {
				ret = Math.min(ret, pair.left);
			}
			pre = pair;
		}
		return ret;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 162700
#include <stdio.h>
int main(){
	int n,i;
	long a,b,xb,xa,ans=0;
	scanf("%d%d%d",&n,&a,&b);
	for(i=0;i<n;i++){
		if(i==0)
		scanf("%d",&xa);
		else{
		xb=xa;
		scanf("%d",&xa);
		if((xa-xb)*a<b)
		ans+=(xa-xb)*a;
		else
		ans+=b;
	    }
	}	
    printf("%ld",ans);
    return 0;
 }

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){string S;cin>>S;int a=0,b=0,c=0;for(int i=0;i<S.size();i++){if(S.at(i)=='a')a++;else if(S.at(i)=='b')b++;else c++;}cout<<(max(max(a,b),c)-min(min(a,b),c)<2? "YES":"NO")<<endl;}

Measured memory_bytes: 3760
N, K = map(int, input().split())
ans = 0
for i in range(1, N+1):
    if i >= K:
        ans += (1 / N)
        continue
    t = 1.0
    for j in range(1, K):
        t /= 2
        if i * 2 ** j >= K: break
    ans += (t / N)
print(ans)


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N-1);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }
    for(int i=0; i<N; i++){
        cin >> B.at(i);
    }
    for(int i=0; i<N-1; i++){
        cin >> C.at(i);
    }
    int former=0,ans=0;
    for(int i=0; i<N; i++){
        if(i!=0){
            former=i-1;
            if(A.at(i)-A.at(former)==1){
                ans+=C.at(A.at(former)-1);
            }
        }
        ans += B.at(A.at(i)-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int A[2][110];

int main() {

    int N; cin >> N;
    REP(i,2) REP(j,N) cin >> A[i][j];

    int ans = 0;
    REP(i,N) {
        int cnt = 0;
        REP(j,i + 1) cnt += A[0][j];
        for (int j = i; j < N; j++) cnt += A[1][j];
        ans = max(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

int n,k;
Vi v[2001];
int tot,cnt;
void dfs(int N,int p,int d)
{
	if(d<=k/2)tot++;
	if(d==k/2+1)cnt++;
	if(d>=k/2+1)return;
	for(int next:v[N])
	{
		if(next==p)continue;
		dfs(next,N,d+1);
	}
}
int res(int x)
{
	tot=1;
	int tmp=0;
	for(int next:v[x])
	{
		cnt=0;
		dfs(next,x,1);
		tmp=max(tmp,cnt);
	}
	if(k&1)tot+=tmp;
	return n-tot;
}
int main() {
	scanf("%d%d",&n,&k);
	fup(i,1,n-1,1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	int ans=INF;
	fup(i,1,n,1)ans=min(ans,res(i));
	printf("%d",ans);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	
	int arr[100001];
	for(int i=1;i<=100000;i++)
	{
		cin>>arr[i];
	}

	ll int dp[n+1];


	dp[1]=0;

	dp[2]=dp[1]+abs(arr[1]-arr[2]);
	/*if(n==2)
	{
		cout<<dp[2]<<endl;
		return 0;
	}*/
	//dp[3]=min(dp[1]+abs(arr[2]-arr[3]),dp[1]+abs(arr[1]-arr[3]));

	/*if(n==3)
	{
		cout<<dp[3]<<endl;
		return 0;
	}*/
	//cout<<dp[1]<<" "<<dp[2]<<" "<<dp[3]<<" ";
	for(int i=3;i<=n;i++)
	{
		/*a=dp[i-1]+abs(arr[i]-arr[i-1]);
		b=dp[i-2]+abs(arr[i]-arr[i-2]);*/
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
		//cout<<dp[i]<<" ";
	}

	//cout<<endl;
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1408
function Main(input) {
    input = input.split("\n");
    tmp = input[0].split(" ");
    var n = parseInt(tmp[0], 10);
    var m = parseInt(tmp[1], 10);
    var res=Math.ceil((n-1)/(m-1));
    console.log('%d', res);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  if(N % 2 == 0){
    myout(N / 2 - 1);
  }else{
    myout(Math.floor(N / 2));
  }

}


Measured memory_bytes: 31068
n = int(input())
H = [int(h) for h in input().split()] + [10e+9+7]
f = 1
for i in range(-1,-n-1,-1):
    if H[i] - H[i-1] < -1:
        f = 0
        break
    elif H[i] - H[i-1] == -1:
        H[i-1] = H[i-1] - 1
if f:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14396
#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>

int main(int argc, char** argv)
{
	while (true)
	{
		int count = 0;
		std::cin >> count;
		if (count == 0)
		{
			break;
		}

		double total = 0;
		std::vector<double> scores;
		for (int i = 0; i < count; ++i)
		{
			double tmp;
			std::cin >> tmp;
			scores.push_back(tmp);

			total += tmp;
		}

		double ave = total / scores.size();

		double dev = 0;
		for (int i = 0; i < count; ++i)
		{
			double tmp = (scores[i] - ave);
			dev += (tmp * tmp);
		}
		dev /= scores.size();
		dev = sqrt(dev);

		printf("%.5lf\n", dev);
	}

	return 0;
}


Measured memory_bytes: 3236
#include "bits/stdc++.h"
using namespace std;

#define F(i, a, n) for(int i=a;i<n;i++)
#define REP(i, n) F(i, 0, n)
#define REP1(i, n) for(int i=1;i<=n;i++)
#define MOD 1000000007

typedef long long ll;

const int MAX = 2e6 + 5;

string s[3];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	REP(i, 3){
		cin>>s[i];
	}
	REP(i, 3){
		cout<<char(toupper(s[i][0]));
	}
	return 0;
}

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

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b == c | b + c == a | c + a == b)
    {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
def main():
    NAB = list(map(int,input().split()))

    # X = NAB[0]
    # a = 0
    # b = 0
    #
    # while X >= 0:
    #     X -= NAB[1]
    #     a += 1
    #     # print("go")
    #
    #     if X <= 0:
    #         break
    #
    #     X -= NAB[2]
    #     b += 1
    #
    # # print(a)
    # # print(b)
    #
    # if b < 0:
    #     print(NAB[1]*a - abs(X))
    # else:
    #     print(NAB[1]*a)



    # tm = NAB[0] // (NAB[1] + NAB[2]) * NAB[1]
    # amari = NAB[0] % (NAB[1] + NAB[2])
    # tm += min(amari,NAB[1])
    #
    # print(tm)

    b = 0

    tm = NAB[0]//(NAB[1]+NAB[2])
    amari = NAB[0] % (NAB[1]+NAB[2])

    # print(tm)
    if NAB[1] < amari:
        b = (tm*NAB[1])+ NAB[1]
    else:
        b = (tm*NAB[1])+ amari

    print(b)


    # b = 0
    # if NAB[1] == 0:
    #     b = 0
    # elif NAB[2] == 0:
    #     b = NAB[1]
    #
    # elif NAB[0] < NAB[1]+NAB[2]:
    #     if NAB[0] < NAB[1]:
    #         b = NAB[0]
    #     else:
    #         b = NAB[1]
    #
    # else:
    #     tm = NAB[0]//(NAB[1]+NAB[2])
    #     amari = NAB[0] % (NAB[1]+NAB[2])
    #
    #     # print(tm)
    #     if NAB[1] < amari:
    #         b = (tm*NAB[1])+ NAB[1]
    #     else:
    #         b = (tm*NAB[1])+ amari

    # print(b)



            # cA = NAB[1]
    # cB = NAB[2]
    #
    # for i in range(NAB[0]):
    #
    #     if NAB[1] == 0:
    #         break
    #     if NAB[2] == 0:
    #         b = NAB[1]
    #         break
    #
    #     if cA != 0:
    #         b += 1
    #         cA -= 1
    #     elif cB != 0 and cA == 0:
    #         cB -=1
    #     else:
    #         cA = NAB[1]
    #         cB = NAB[2]
    #
    #         b += 1
    #         cA -= 1




if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>

#define int long long

using namespace std;

int n, S[100010], W[100010], D[100010], Sz[100010], F[100010], ans = 0;

int find(int x) {
    int t = lower_bound(D + 1, D + n + 1, x) - D;
    if(D[t] != x) {
        puts("-1");
        exit(0);
    }
    return t;
}

signed main() {
    scanf("%lld", &n);
    for(int i = 1; i <= n; i++) scanf("%lld", &D[i]);
    memcpy(S, D, sizeof D);
    sort(D + 1, D + n + 1);
    for(int i = 1; i <= n; i++) W[find(S[i])] = i;
    for(int i = 1; i <= n; i++) Sz[i] = 1;
    for(int i = n; i > 1; i--) {
        F[i] = find(D[i] - n + Sz[i] * 2);
        Sz[F[i]] += Sz[i];
        ans += Sz[i];
    }
    if(ans != D[1]) {
        puts("-1");
        return 0;
    }
    for(int i = 2; i <= n; i++) printf("%lld %lld\n", W[i], W[F[i]]);
    return 0;
}

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

int n;
const int maxn = 1e5 + 5;

int x[maxn], a, b;

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> a >> b;
    for(int i = 1;i <= n;i++){
        cin >> x[i];
    }
    long long ans = 0;
    for(int i = 1;i < n;i++){
        ans += min(1LL * b, 1LL * (x[i + 1] - x[i]) * a);
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
	string S;
	cin >> S;
	for(int i=0;i<S.size();i++){
		if((i%2==0 && S[i]=='L') || (i%2==1 && S[i]=='R')){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,sz[100005],fa[100005];
long long d[100005],res;
map<long long,int> id;
priority_queue<pair<long long,int> > pq;
vector<int> e[100005];
vector<pair<int,int> > ans;
void dfs(int x,int d){
	res+=d;
	for(int i=0;i<e[x].size();i++) dfs(e[x][i],d+1);
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		sz[i]=1;
		cin>>d[i];
		id[d[i]]=i;
		pq.push(make_pair(d[i],i));
	}
	while(pq.size()>1){
		int x=pq.top().second;pq.pop();
		id.erase(d[x]);
		if(!id.count(d[x]-(n-sz[x])+sz[x])){
			puts("-1");
			return 0;
		}
		fa[x]=id[d[x]-(n-sz[x])+sz[x]];
		sz[fa[x]]+=sz[x];
		e[fa[x]].push_back(x);
		ans.push_back(make_pair(fa[x],x));
	}
	int rt=pq.top().second;
	res=0;
	dfs(rt,0);
	if(res!=d[rt]){
		puts("-1"); 
	}
	else{
		for(int i=0;i<n-1;i++){
			printf("%d %d\n",ans[i].first,ans[i].second);
		}
	}
	return 0;
}

Measured memory_bytes: 16496
#include <iostream>
#include <vector>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
using namespace  std;

const double cos60 = cos(M_PI / 3);
const double sin60 = sin(M_PI / 3);

struct StPnt
{
  double m_nx;
  double m_ny;

  StPnt() :
    m_nx(0), m_ny(0)
  { }

  StPnt(double nx, double ny) :
    m_nx(nx), m_ny(ny)
  { }
};

void fnInput(int &rnRcSiz)
{
  cin >> rnRcSiz;
}

void fnPntGet(const StPnt &cnroPntL, const StPnt &cnroPntR, vector<StPnt> &rvoRtnPnt)
{
  rvoRtnPnt[0].m_nx = (2 * cnroPntL.m_nx + cnroPntR.m_nx) / 3;
  rvoRtnPnt[0].m_ny = (2 * cnroPntL.m_ny + cnroPntR.m_ny) / 3;
  rvoRtnPnt[2].m_nx = (cnroPntL.m_nx + 2 * cnroPntR.m_nx) / 3;
  rvoRtnPnt[2].m_ny = (cnroPntL.m_ny + 2 * cnroPntR.m_ny) / 3;

  rvoRtnPnt[1].m_nx =  (rvoRtnPnt[2].m_nx - rvoRtnPnt[0].m_nx) * cos60 
                     - (rvoRtnPnt[2].m_ny - rvoRtnPnt[0].m_ny) * sin60 + rvoRtnPnt[0].m_nx;
  rvoRtnPnt[1].m_ny =  (rvoRtnPnt[2].m_nx - rvoRtnPnt[0].m_nx) * sin60 
                     + (rvoRtnPnt[2].m_ny - rvoRtnPnt[0].m_ny) * cos60 + rvoRtnPnt[0].m_ny;
}

void fnResult(const StPnt &cnroPnt)
{
  cout << cnroPnt.m_nx << " " << cnroPnt.m_ny << endl;
}

void fnKoch(int nRcSiz, const StPnt &cnroPntL, const StPnt &cnroPntR)
{
  if (!nRcSiz) return;

  vector<StPnt> voRtnPnt(3);
  fnPntGet(cnroPntL, cnroPntR, voRtnPnt); 
  
  nRcSiz--;
  fnKoch(nRcSiz, cnroPntL, voRtnPnt[0]);
  fnResult(voRtnPnt[0]);

  fnKoch(nRcSiz, voRtnPnt[0], voRtnPnt[1]);
  fnResult(voRtnPnt[1]);

  fnKoch(nRcSiz, voRtnPnt[1], voRtnPnt[2]);
  fnResult(voRtnPnt[2]);

  fnKoch(nRcSiz, voRtnPnt[2], cnroPntR);
}

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

  int nRcSiz;
  vector<StPnt> voPnt;

  fnInput(nRcSiz);
  StPnt oPntL(0, 0);
  StPnt oPntR(100, 0);

  fnResult(oPntL);
  fnKoch(nRcSiz, oPntL, oPntR);
  fnResult(oPntR);
  return 0;
}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll n;

void solve(){
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            for(int k = 1; k <= n; k++)
                ans += __gcd(i, __gcd(j, k));
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <math.h>
int main(void){
    int n, array[101], g=0, h, ans=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&array[i]);
        g+=array[i];
    }
    h = round((float)g/n);
    for(int i=0;i<n;i++){
        ans += pow((h-array[i]),2);
    }
    printf("%d\n",ans);
    
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;

int main() {
	int n,m,x,val;
	cin>>n>>x;
	int L[n+2], D[n+2];
	D[0] = 0;
	for(int i=0;i<n;i++){
		scanf("%d",&L[i]);
			D[i+1] = D[i] + L[i];
			//printf("%d %d\n", L[i], D[i]);
	}
	/*D[n] = D[n-1] + L[n-1];
	int pos = lower_bound(D,D+n+1, x)-D;
	while(pos>0 and D[pos]>x) pos--;*/
	
	int cnt = 1;
	for(int i=1;i<=n;i++) {
		//printf("%d\n", D[i]);
		if(D[i]<=x) cnt++;
		else break;
	}
	printf("%d\n", cnt); 
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    map<int, int> m;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        m[a]++;
    }
    vector<pair<int, int>> vs;
    for (auto& v : m)
    {
        vs.emplace_back(v.second, v.first);
    }
    sort(vs.begin(), vs.end());
    int counter = vs.size();
    int sum = 0;
    for (auto& v : vs)
    {
        if (counter <= k)
        {
            break;
        }
        sum += v.first;
        counter--;
    }
    cout << sum << endl;
}


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

int main(){
  string bg[8]={"AAA","AA","A","B","C","D","E","NA"};
  double m500[7]={35.5,37.5,40.0,43.0,50.0,55.0,70.0};
  double m1000[7]={71.0,77.0,83.0,89.0,105.0,116.0,148.0};
  double a,b;
  while(cin >> a && cin >> b){
    int ans=7;
    for(int i=0;i<7;i++){
      if(a < m500[i] && b < m1000[i]){
	ans = i;
	break;
      }
    }
    cout << bg[ans] << endl;
  }
}

Measured memory_bytes: 1228
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    vector<int> A;
    int ans = 0;
    int N;
    
    cin >> N;
    
    bool is_ok = false;
    for ( int i = 0; i < N; i++ ) {
        int a;
        cin >> a;
        A.push_back(a);
        ans+=a;
        if ( a%10 ) { is_ok = true; }
    }
    
    if ( !is_ok ) {
        cout << 0 << endl;
        return 0;
    }
    
    
    sort( A.begin(), A.end() );
    
    int i = 0;
    while( ans%10 == 0 && i < N ) {
        if ( A[i]%10 ) {
            ans -= A[i];
        }
        i++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace D
{
    class Program
    {
        static int B(int[] ABC,int N)
        {
            Array.Sort(ABC);
            int sum = 0;

            for (int a=0; a<N-2; a++)
            {
                for (int b = a + 1; b < N - 1; b++)
                {
                    for (int c = N - 1; c > 0; c--)
                    {
                        int d = ABC[c] - ABC[a] - ABC[b];
                        if (d < 0)
                        {
                            sum += c - b;
                            break;
                        }
                    }
                }
            }
            return sum;
        }
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] L = Console.ReadLine().Split(' ');
            int[] ABC = new int[N];

            for(int i=0;i<N;i++)
            {
                ABC[i] = int.Parse(L[i]);
            }

            //int result = A(ABC, N);
            int result = B(ABC, N);
            Console.WriteLine(result);
        }
    }
}


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

static int bubbleSort(int *A, int N){
	int temp, count=0;
	bool flag;
	do{
		flag = false;
		for (int j = N - 1; j >= 1; j--){
			if (A[j] < A[j - 1]){
				temp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = temp;
				count++;
				flag = true;
			}
		}
	} while (flag);

	return count;
}

int main(void){
	int N, *A, count;

	cin >> N;

	A = new int[N];

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

	count = bubbleSort(A, N);

	for (int i = 0; i < N; i++){
		cout << A[i];
		if (i != N - 1){
			cout << " ";
		}
	}

	cout << "\n" << count <<"\n";

	return 0;
}

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

int main(){
    ll N,M; cin>>N>>M;
    vector<bool> b(N,true);
    vector<ll> w(N+1);
    ll ac=0,wa=0;
    for (ll i = 0; i < M; i++){
        ll p; string S;
        cin>>p>>S;
        if(b[p]){
            if(S=="WA"){
                w[p]++;
            }else{
                b[p]=false;
            }
        }
    }
    for(ll i=0;i<N+1;i++){
        if(!b[i]){
        wa+=w[i];
        ac++;
        }
    }
    cout<<ac<<" "<<wa<<endl;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    int n, m;
    cin >> n >> m;

    bool box[n] = {};
    box[0] = true;
    int box_num[n];
    rep(i, n) box_num[i] = 1;
    rep(i, m) {
        int x, y;
        cin >> x >> y; x--, y--;
        box_num[x]--, box_num[y]++;
        box[y] = (box[x] || box[y]);
        if (box_num[x] == 0) box[x] = false;
    }

    int ans = 0;
    rep(i, n) ans += box[i];
    cout << ans << endl;

    return 0;
}

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

int main() {
  vector<int>a(5);
  for(int i=0;i<5;i++) cin>>a[i];
  vector<int>b(5);
  for(int i=0;i<5;i++){
    if(a[i]%10==0) b[i]=a[i];
    else b[i]=a[i]+10-a[i]%10;
  }
  int y=0;
  int ans=b[0]+b[1]+b[2]+b[3]+b[4];
  for(int i=0;i<5;i++){
    int x=a[i]-b[i];
    y=min(y,x);
  }
  cout<<ans+y<<endl;
}

Measured memory_bytes: 256
/*
ID: Bipin Singh [bipinsingh061]
LANG: C++
TASK: gift1
*/
#include<bits/stdc++.h> 
using namespace std; 
#define deb(x) cout <<"\n"<< (#x) << " = " << (x) << "\n"
#define int long long int

void inputoutput()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
}



bool dfs(int src,int c , bool *vis , vector<int> (&v)[2001] , int col[])
{
	vis[src]=true;
	col[src]=c ;
	// cout<<src<<" ";

	for(auto it : v[src])
	{
		if(!vis[it])
		{
			if(dfs(it,c*-1,vis,v,col)==false)
				return false;
		}
		else
		{
			if(col[src]==col[it])
				return false;
		}
	}
	return true ;
}

int mod=1e9+7 ;


void update(vector<int>& D, int l, int r, int x) 
{ 
    D[l] += x; 
    D[r + 1] -= x; 
}

int32_t main()
{
	inputoutput();


	int n;
	cin>>n;
	int ar[n];
	int pref[n+1];


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

	int sum=0;
	for(int i=n-1 ; i>=0 ; --i)
	{
		sum=(sum+ar[i])%mod;
		pref[i]=sum;
	}
	pref[n]=0;

	int ans=0;

	for(int i=0 ; i<n;  ++i)
	{
		ans=(ans+(ar[i]*pref[i+1]) )%mod ;
	}
	cout<<(ans+mod)%mod;


	

	

    



	return 0;
}




Measured memory_bytes: 6672
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  ll N;
  cin >> N;

  int ans;
  for (ll i = 1; i * i <= N; i++) {
    if (N % i == 0) ans = i;
  }
  out(ans + N / ans - 2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  vector<int> a(2);
  rep(i, 2) cin >> a[i];

  sort(a.begin(), a.end());
  rep(i, a[1]) cout << a[0];
  cout << endl;




  
  return 0;
}

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

int main() {

  string a, b, c;
  cin >> a >> b >> c;
  if ( a[a.size()-1] == b[0] && b[b.size()-1] == c[0] ) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
 
  return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> xs(n, 0);
    for (int i = 0; i < n - 1; ++i) {
        int a;
        cin >> a;
        --a;
        ++xs[a];
    }
    for (auto x : xs) {
        cout << x << "\n";
    }
    return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int a = int.Parse(input[1]);
            int b = int.Parse(input[2]);
            if (n * a > b)
            {
                Console.WriteLine(b);
            }
            else
            {
                Console.WriteLine(n * a);
            }
        }
    }
}


Measured memory_bytes: 13140
// CONTEST

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

// Utility
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
template<typename T> struct is_container {
template<typename C> static char test(typename C::const_iterator*); template<typename> static int test(...);
static bool const value = sizeof(test<T>(nullptr)) == sizeof(char) && !std::is_same<std::string, T>::value;
};
namespace std {
template<class ...Ts>        istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class T1, class T2> istream& operator>>(istream& i, pair<T1, T2>& x) { i >> x.first >> x.second; return i; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
istream& operator>>(istream& i, T& x) { for (auto& y : x) { i >> y; } return i; }
}

// Debugging
#define DD(X) std::cout << #X ": " << (X) << std::endl << std::flush
#define DD2(X) std::cout << #X ":" << std::endl; for (auto x : (X)) { std::cout << x << std::endl << std::flush; }
namespace std {
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; apply([&](auto&& y, auto&&... ys){ o << y; ((o << ", " << ys), ...); }, x); o << ")"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { o << tie(x.first, x.second); return o; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
ostream& operator<<(ostream& o, const T& x) { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
}

// Main
void mainCase() {
  int n, x, t;
  cin >> n >> x >> t;

  int res = t * ((n + (x - 1)) / x);
  cout << res << endl;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  // [ Single case ]
  mainCase();
  return 0;
  // [ Multiple cases ]
  // int t;
  // cin >> t;
  // FOR(i, 0, t) { mainCase(); }
  // return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
ll n, a,  m = 1e16;
int main(){
	scanf("%lld", &n);
	rep(i,5){
		scanf("%lld", &a);
		m = min(a, m);
	}
	printf("%lld\n", (n+m-1)/m+4);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,k;
  string ans;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a > k){
    ans = ":(";
  }
  else{
    ans = "Yay!";
  }
  cout << ans << endl;
}
  
      
      
      


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

int main(void) {
	int a, b, c,ab,bc,ca,ac,ba,cb;
	cin >> a >> b >> c;
	ab = a *10+b+c;
	bc = b *10+c+a;
	ca = c * 10 + a+b;
	ac = a * 10 + c+b;
	ba = b * 10 + a+c;
	cb = c * 10 + b+a;
	cout << max({ ab,bc,ca,ac,ba,cb });

}

Measured memory_bytes: 256
S = list(input())
N = len(S)
# N 文字の文字列 S から、長さ N+1 の ---累積和--- s[0], s[1], ..., s[N] を作る
# これを 2019 で割ったあまりで分類する (具体的には counter[ r ] := あまりが r のやつが何個あるか)
# 各 r ごとに、counter[r] 個から 2 個選ぶ方法の数を、足し上げる

counter = [0] * 2019
k = 10
for i in range(N + 1):
    if i == 0:
        sub = 0
    elif i == 1:
        sub = int(S[N - 1])
    else:
        sub += int(S[N - i]) * k
        k *= 10
        k %= 2019
    rest = sub % 2019
    counter[rest] += 1

ans = 0
for r in counter:
    ans += r * (r - 1) // 2
print(ans)

Measured memory_bytes: 10532
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define repp(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define popcnt __builtin_popcount
#define all(v) v.begin(),v.end()
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
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;}
template<class T> T gcd(T a, T b){return b?GCD(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/GCD(a,b);}

int main(){
    ll n; cin >> n;
    if(n%2 == 0){
        ll ans = 0;
        ll i = 10;
        while(n/i>0){
            ans += n/i;
            i *= 5;
        }
        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }
    
    return 0;
}


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

int main() {
 int H,W;
  cin >> H >> W;
  vector<vector<char>>vec(H,vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> vec.at(i).at(j);
    }
  }
  vector<vector<char>>vecT(W,vector<char>(H));
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < H; j++) {
     vecT.at(i).at(j)=vec.at(j).at(i);
    }
  }
  
  vector<vector<char>>vecH(H,vector<char>(W,'.'));
  vector<vector<char>>vecW(W,vector<char>(H,'.'));
  //これであっとるんか？//
  int numH;
  vector<int>pushH(numH);
  int numW;
  vector<int>pushW(numW);
  
  
  
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
     //pushHやpushWの中の数字と同じときtrueにしたい
      
      if(vec.at(i) == vecH.at(i)){
        
       continue; 
      }
       else if(vecT.at(j) == vecW.at(j)){
         if (j ==W-1){
          cout <<endl; 
           continue;
         }
         else{
          continue; 
         }
      }
      if (j == W-1){
       cout <<vec.at(i).at(j)<<  endl; 
      }
      else{
      cout << vec.at(i).at(j);
      }
      
      
    }
  }        
          
}


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

using namespace std;

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

bool check(vector<int> &v1, vector<int> &v2){
    vector<int> cnt(5);
    for(auto e : v1) ++cnt[e];
    for(auto e : v2) ++cnt[e];
    int dup = 0;
    for(int i = 0; i < 5; ++i) if(cnt[i] > 1) ++dup;
    return dup <= 1;
}

long long solve(int n, vector<int> &a){
    vector<vector<int>> v;
    vector<vector<int>> v2;
    rep(i,n)rep(j,i){
        v.push_back({j, i});
        rep(k,j){
            v2.push_back({k, j, i});
            rep(l,k){
                v2.push_back({l, k, j, i});
            }
        }
    }

    vector<vector<vector<int>>> v3(1);
    for(auto &vv : v2) v3.push_back({vv});
    for(auto &vv : v2) for(auto &vvv : v2) if(check(vv, vvv)) v3.push_back({vv, vvv});
    int tmp = 0;

    for(auto vx : v3)
        rep(S,1<<v.size()){
            vector<long long> cnt(n);
            int pop = 0;
            for(auto vvx : vx){
                pop += vvx.size()-1;
                for(auto e : vvx){
                    ++cnt[e];
                }
            }
            bool okok = true;
            for(int j = 0; j < (int)v.size(); ++j){
                if(~S >> j & 1) continue;
                for(auto vvx : vx) if(!check(vvx, v[j])) okok = false;
                for(auto e : v[j]) ++cnt[e];
                ++pop;
            }
            if(!okok) continue;
            bool ok = true;
            for(int j = 0; j < n; ++j) if(cnt[j] > a[j]) ok = false;
            if(!ok) continue;
            tmp = max(tmp, pop);
        }

    return accumulate(a.begin(), a.end(), 0ll) - tmp;
}

int main(){
    vector<int> a(5);
    int n;
    cin >> n;
    rep(i,n) cin >> a[i];
    cout << solve(n,a) << endl;
}

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

typedef long long int LLI;

int N;
int as[214514];
LLI ans;

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

  int l = 0;
  int r = 0;
  int a = 0;
  int b = 0;
  while (r < N) {
    while (r < N && a == b) {
      ans += r-l;
      a += as[r];
      b ^= as[r++];
    }

    while (l < N && a != b) {
      a -= as[l];
      b ^= as[l++];
    }
  }
  ans += r-l;
  printf("%lld\n", ans);
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict, deque #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N = ii()
#S = [list(map(int, list(input()))) for _ in range(N)]
rel = [[] for _ in range(N)]

for i in range(N):
    S = input()
    l = []
    for j in range(N):
        if S[j] == '1':
            l.append(j)
    rel[i] = l

flag = [0]*N
ans = 0

for i in range(N):
    flag = [0]*N
    que = deque([i])
    add = 0
    flag[i] = 1
    while que != deque([]):
        node = que.popleft()
        for nn in rel[node]:
            if not flag[nn]:
                que.append(nn)
                flag[nn] = flag[node] + 1
    ans = max(ans, max(flag))

for i in range(N):
    for t in rel[i]:
        if abs(flag[t] - flag[i]) != 1:
            print(-1)
            exit()

print(ans)

Measured memory_bytes: 3700
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL A, B, C;
	in >> A >> B >> C;
	if (A == B && B == C && A == C) out << "Yes" << std::endl;
	else out << "No" << std::endl;
}


Measured memory_bytes: 256