akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef pair<long long, long long> sushi_t;

int
main()
{
    long long n, c;
    cin >> n >> c;
    vector<sushi_t> xv(n);
    for (int i = 0; i < n; i++) {
        long long x, v;
        cin >> x >> v;
        xv[i] = make_pair(x, v);
    }
    sort(xv.begin(), xv.end());

    // no turn
    vector<long long> acc(n + 1), acct(n + 1);
    acc[0] = 0;
    acct[0] = 0;
    long long prev_x = 0;
    for (int i = 0; i < n; i++) {
        acc[i + 1] = acc[i] + (prev_x - get<0>(xv[i])) + get<1>(xv[i]);
        acct[i + 1] = acct[i] + (prev_x - get<0>(xv[i])) * 2 + get<1>(xv[i]);
        prev_x = get<0>(xv[i]);
    }
    vector<long long> dec(n + 1), dect(n + 1);
    dec[0] = 0;
    dect[0] = 0;
    prev_x = 0;
    for (int i = 0; i < n; i++) {
        dec[i + 1] = dec[i] + (prev_x - (c - get<0>(xv[n - i - 1]))) +
            get<1>(xv[n - i - 1]);
        dect[i + 1] = dect[i] + (prev_x - (c - get<0>(xv[n - i - 1]))) * 2 +
            get<1>(xv[n - i - 1]);
        prev_x = c - get<0>(xv[n - i - 1]);
    }
    long long ans = 0;
    for (int i = 0; i < n + 1; i++) {
        if (acc[i] > ans)
            ans = acc[i];
        if (dec[i] > ans)
            ans = dec[i];
    }

    // turn
    long long maxdec = 0;
    for (int i = n; i > 0; i--) {
        if (maxdec < dec[n - i])
            maxdec = dec[n - i];
        long long tmp = acct[i] + max(maxdec, (long long)0);
        if (tmp > ans)
            ans = tmp;
    }
    long long maxacc = 0;
    for (int i = n; i > 0; i--) {
        if (maxacc < acc[n - i])
            maxacc = acc[n - i];
        long long tmp = dect[i] + max(maxacc, (long long)0);
        if (tmp > ans)
            ans = tmp;
    }

    cout << ans << endl;
}


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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

int main() {
    {
        _time time(disable);
        _i64 x; _i64 count = 0;
        while(cin >> x && x != 0) { count++; cout << "Case " << count << ": " << x << endl; }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

#define endl "\n"

const int MOD = 1000000007;


int main()
{
    string x;
    cin >> x;
    if(x == "Sunny")
        cout << "Cloudy" << endl;
    else if (x == "Cloudy")
        cout << "Rainy" << endl;
    else
        cout << "Sunny" << endl;

	return 0;
}



Measured memory_bytes: 3592
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
   ll x=c-a;
    ll y=d-b;
    cout<<c-y<<spc<<d+x<<spc<<a-y<<spc<<b+x<<endl;
return 0;
}


Measured memory_bytes: 4992
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
s=gs

R=[]
G=[]
B=[]

def tar_array(c)
  case c
  when 'R'
    R
  when 'B'
    B
  when 'G'
    G
  end
end

n.times do |i|
  tar_array(s[i]).push i
end

cnt=R.size*G.size*B.size

0.upto n-2 do |i|
  (i+1).upto n-1 do |j|
    kk= j + j-i
    break if kk>n-1
    cnt-=1 if s[i]!=s[j]&&s[i]!=s[kk]&&s[j]!=s[kk]
  end
end

puts cnt

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

using namespace std;

int A[100005];
int N;

int main() {
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    int sum = 0;
    for (int i = 1; i <= N + 1; i++) {
        sum += abs(A[i - 1] - A[i]);
    }
    for (int i = 1; i <= N; i++) {
        cout << sum - abs(A[i - 1] - A[i]) - abs(A[i + 1] - A[i]) + abs(A[i - 1] - A[i + 1]) << endl;
    }
}

Measured memory_bytes: 1664
#include <stdio.h>

int main(void)
{
	int a,b; 
	
	scanf("%d",&a);
	scanf("%d",&b);
	
	if(a < b)
		puts("a < b");
	else if(a > b)
		puts("a > b");
	else
	puts("a == b");
	

	
	return 0;
}

Measured memory_bytes: 2692
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  long long int n,a,b,x,rem,ans;
  cin>>n>>a>>b;
  ans=0;
  x=n/(a+b);
  ans+=x*a;
  rem=n%(a+b);
  if(rem>a) ans+=a;
  else ans+=rem;
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

bool graph[101][101];
vector<ll> to[101010];
vector<ll>ball(101010, 1);
char c[10][10];
bool visited[10][10];
char math[1010][1010];

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	ll total = 0;
	ll target = 0;
	vector<ll>ans;
	for (ll i = 1;i <= n;++i) {
		total += i;
		if (total > n) {
			total -= i;
			target = i;
			break;
		}
		ans.push_back(i);
	}
	ll res = n - total;
	ans[target - res - 1] += res;
	rep(i, ans.size()) {
		cout << ans[i] << endl;
	}
	return 0;
}


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

int main() {
  int N;
  string S;
  int count = 0;
  
  cin >> N >> S;
  
  for(int i = 2; i < N; i++) {
    if(S.at(i - 2) == 'A' && S.at(i - 1) == 'B' && S.at(i) == 'C') {
      count++;
    }
  }
  
  cout << count << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vs(N);
  vector<int> right(N);
  for (int &e : vs) cin >> e;
  sort(vs.begin(), vs.end());
  if (N%2 == 0) {
    for (int i = 0; i < N; i++) right[i]=i/2*2+1;
  }
  else {
    for (int i = 0; i < N; i++) right[i]=(i+1)/2*2;
  }
  
  if (vs != right) {
    cout << 0 << endl;
  }
  
  else {
    int ans = 1;
    int p = N/2;
    for (int i = 0; i < p; i++) {
      ans *= 2;
      ans %= 1000000007;
    }
    cout << ans << endl;
  }
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    int odd = 0;
    REP(i,N) {
        int inp;
        cin >> inp;
        if (inp%2==1) odd++;
    }
    string ans;
    if (odd%2==0) ans = "YES";
    else ans = "NO";

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 384
#include<algorithm>
#include<cstdio>
using namespace std;
int a[100000],n,t,ans;
int main()
{
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&a[i]);
  sort(a,a+n);a[n]=2100000000;
  for(int i=0;i<n;i++)
  {
    ++t;
	if(a[i]!=a[i+1])
	{
	  if(t%2==1)++ans;
	  t=0;
	}
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 640
N, K = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
for a in range(K+1):
    for b in range(a+1):
        if a + b > K:
            break
        for c in range(K+1):
            if a + b + c > K:
                break
            if a + c > N:
                break
            for d in range(c+1):
                if a + b + c + d > K:
                    break
                va = V[:a]
                vc = V[::-1][:c]
                va.sort(reverse = True)
                vc.sort(reverse = True)
                ans = max(ans, sum(va[:a-b]) + sum(vc[:c-d]))
print(ans)

Measured memory_bytes: 50136
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = [a,b,c,d,e]
k = int(input())
dis = []
for i in range(5):
  for j in range(5):
    if i == j:
      continue
    else:
      dis.append(abs(x[i]-x[j]))
for d in dis:
  if d>k:
    print(":(")
    exit(0)

print("Yay!")


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

int main()
{
	int n,x,b,count=0;
	vector<int> m;
	cin >> n >> x;
	for(int i=0;i<n;i++){
		cin >> b;
		m.push_back(b);
		x-=m[i];
		count++;
	}
	sort(m.begin(),m.end());
	while(x>=m[0]){
		x-=m[0];
		count++;
	}
	cout << count;
	return 0;
}


Measured memory_bytes: 256
//This disgusting code is wriiten by Juruo D0zingbear
//Please don't hack me! 0v0 <3
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}

// cf IO: I64d
// atcoder IO: ｌｌｄ
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int Maxn=200005;
int a[Maxn];
int pos[Maxn],n;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		pos[a[i]]=i;
	}
	set<int> now;
	now.insert(0);
	now.insert(n+1);
	long long ans=0;
	for (int i=1;i<=n;i++){
		set<int>::iterator it=now.lower_bound(pos[i]);
		int v1=*it;
		it--;
		int v2=*it;
		//v1->pos[i]* pos[i]+1->v[2]
		ans+=1ll*(pos[i]-v1)*(v2-pos[i])*i;
		now.insert(pos[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> d(N, 0);
    int recover = 0;
    for (auto &x: d) cin >> x;
    for (size_t i=0; i<d.size(); i++) {
        for (size_t j=(i+1); j<d.size(); j++) {
            recover += d[i] * d[j];
        }
    }
    cout << recover << endl;
    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
vector <int> adj[2*100000+5];
bool visited[2*100000+5];
int cnt;
void dfs(int s)
{
    visited[s]=1;
    cnt++;
    for(int a : adj[s])
    {
        if(not visited[a]) dfs(a);
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,m;cin>>n>>m;
    for(int i=0;i<m ;i++)
    {
        int x,y;cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    int ans=1;
    int cc=0;
    for(int i=1;i<=n;i++)
    {
        if(not visited[i])
        {
            cnt=0;
            dfs(i);
            if(cnt>1) cc++,ans=max(ans,cnt);
        }
    }
    cout<<ans<<endl;
    return 0;
}
/*


*/



Measured memory_bytes: 20940
N = int(input())
A = [int(input()) for i in range(N)]

if A[0] == 0 and all(A[i + 1] - A[i] <= 1 for i in range(N - 1)):
    ans = A[N - 1]
    for i in range(N - 2, -1, -1):
        if A[i] != A[i + 1] - 1:
            ans += A[i]
else:
    ans = -1

print(ans)


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

using namespace std;

int main()
{
    int n;

    cin >> n;

    string s;

    cin >> s;

    if(n%2 != 0) cout << "No\n";

    else {
        int r = n/2;

        for(int i=0;i<n/2;i++)
        {
            if(s[i]!=s[r+i]){
                cout << "No\n";
                exit(0);
            }
        }

        cout << "Yes\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}
//cout << fixed << setprecision(10);

int main()
{
  string s; cin>>s;
  ll n=s.size(),cnt=0,loc;
  vector<ll>ans(n);
  bool r=true;
  rep(i,n)
  {
    if(r)
    {
      if(s[i]=='L')
      {
        if(i==n-1) ans[n-1]++;
        loc=i;
        ans[loc-1]+=(cnt+1)/2;
        ans[loc]+=cnt/2;
        cnt=1;
        r=false;
      }
      else cnt++;
    }
    
    else
    {
      if(s[i]=='R' || i==n-1)
      {
        if(i==n-1) cnt++;
        ans[loc-1]+=cnt/2;
        ans[loc]+=(cnt+1)/2;
        cnt=1;
        r=true;
      }
      else cnt++;
    }
  }
  
  rep(i,n) cout<<ans[i]<<' ';
}

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

int m = 1e9 + 7;
int main()
{
	int n; cin >> n;
	ll a = 1, b = 1, c = 1;
	for (int i = 0; i < n; ++i)
	{
		a = a * 10 % m;
		b = b * 9 % m;
		c = c * 8 % m;
	}
	cout << (a - 2*b + c + 2*m) % m << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000003;

void Main(){
    int R, G, B, N;
    scanf("%d%d%d%d", &R, &G, &B, &N);
    long long ans = 0;
    for(int r = 0; r < N / R + 1; r++){
        for(int g = 0; g < N / G + 1; g++){
            int b = N - r * R - g * G;
            if(b >= 0 && b % B == 0)ans++;
        }
    }
    printf("%lld\n", ans);
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    REP(i, N) {
        ll a = i + 1;
        ll m = (K - (a % K));
        if (2 * m % K != 0)
            continue;
        ll n = (N - m) / K + 1;
        ans += n * n;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps DBL_EPSILON
#define mod (ll)998244353
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int sx, sy, tx, ty, n, x[1010], y[1010], r[1010];
vector<pair<int, double>> vec[1010];
prique<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> que;
double dist[1010];
signed main() {
	cin >> sx >> sy >> tx >> ty >> n;
	x[0] = sx; y[0] = sy;
	x[n + 1] = tx; y[n + 1] = ty;
	REP(i, n) {
		cin >> x[i] >> y[i] >> r[i];
	}
	rep(i, n + 2) {
		rep(j, n + 2) {
			if (i == j)continue;
			vec[i].push_back(make_pair(j, max((double)0, hypot(x[i] - x[j], y[i] - y[j]) - r[i] - r[j])));
		}
	}
	REP(i, n + 1)dist[i] = DBL_MAX;
	que.push(make_pair(0, 0));
	while (!que.empty()) {
		auto node = que.top();
		que.pop();
		if (node.first > dist[node.second])continue;
		for (auto p : vec[node.second]) {
			if (dist[node.second] + p.second < dist[p.first]) {
				dist[p.first] = dist[node.second] + p.second;
				que.push(make_pair(dist[p.first], p.first));
			}
		}
	}
	printf("%.12lf\n", dist[n + 1]);
	return 0;
}

Measured memory_bytes: 22384
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define forr(i,p,n) for(ll i=p;i<n;i++)
#define tam 1000010
#define tamlog 12
#define offset 50000
#define mp make_pair
using namespace std;
typedef long long  ll;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef pair<ll,ii> iii;
const ll INF=1e11;
string txt;
const ll P1=53;
ll P[tam],hsh[tam];
ll n;
bool prefij[tam],sufij[tam];
const ll MOD=1e9+7;
ll gethash(ll pos,ll delta)
{
    ll iz,der;
    if (delta<0)
    {
        der=pos;
        iz=pos+delta+1;
    }
    else
    {
        der=pos+delta-1;
        iz=pos;
    } 
    //cout<<endl;
    //cout<<iz<<" inquery "<<der<<" "<<hsh[iz]<<" "<<hsh[der+1]<<endl;
    return ((hsh[iz]-hsh[der+1]*P[abs(delta)])%MOD+MOD)%MOD;
}
void tle(){tle();}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>txt;
    ll antP=1,anthsh=0;
    set<char> s;
    //cout<<txt<<"\n";
    hsh[txt.size()]=0;
    P[0]=1;
    for(ll i=txt.size()-1;i>=0;i--)
    {
        P[txt.size()-i]=(antP*P1)%MOD;
        antP=P[txt.size()-i];
        hsh[i]=((txt[i]-'a'+1)*P1+anthsh*P1)%MOD;
        anthsh=hsh[i];
      //  cout<<hsh[i]<< ' '<<P[txt.size()-i]<<" "<<i<<" "<<txt.size()-i<<endl;
        s.insert(txt[i]);
    }
    //cout<<gethash(1,-1)<<"alfin";
    //cout<<"aca";
    //cout<<gethash(0,-1)<<endl;
    //return 0;

    if (s.size()==1)
    {
        cout<<txt.size()<<"\n1\n";
        return 0;
    }
    //check
    n=txt.size();
    set<ll> s1,s2;
    forr(delta,1,n)
    {
        s1.clear(),s2.clear();
        s1.insert(gethash(delta-1,-delta));
        s2.insert(gethash(n-(delta-1)-1,delta));
        for(ll j=delta+delta-1;j<n;j+=delta)
        {
            if (s1.size()<=1)
            s1.insert(gethash(j,-delta));
            if (s2.size()<=1)
            s2.insert(gethash(n-j-1,delta));
            prefij[j]|=(s1.size()==1);
            sufij[n-j-1]|=(s2.size()==1);
            //cout<<j<<" "<<n-j-1<<' '<<delta<<" "<<prefij[j]<<" "<<sufij[n-j-1]<<endl;
        }
    }   
    ll  c=0;
    forr(i,0,n)
    {
        if (prefij[i]==0&& sufij[i+1]==0)
            {
                c++;
                //cout<<i+1<<endl;
            }
    }
    if (sufij[0]!=0&& prefij[n-1]!=0)
    cout<<"2\n"<<c<<"\n";
    else
    cout<<"1\n1\n";
}


Measured memory_bytes: 12188
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int H,W;

struct Info{
	Info(int arg_row,int arg_col,int arg_num){
		row = arg_row;
		col = arg_col;
		num = arg_num;
	}

	int row,col,num;
};

int diff_row[4] = {-1,0,0,1},diff_col[4] = {0,-1,1,0};

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= H+1 && col >= 0 && col <= W+1)return true;
	else{
		return false;
	}
}

void func(){

	char map[H+2][W+3];

	for(int row = 0; row <= H+1; row++){
		for(int col = 0; col <= W+1; col++){
			map[row][col] = '.';
		}
	}

	char buf[W+1];
	int goal_row,goal_col;

	for(int row = 1; row <= H; row++){
		scanf("%s",buf);
		for(int col = 1; col <= W; col++){
			map[row][col] = buf[col-1];
			if(buf[col-1] == '&'){
				goal_row = row;
				goal_col = col;
			}
		}
	}

	int min_count[H+2][W+2];

	for(int row = 0; row <= H+1; row++){
		for(int col = 0; col <= W+1; col++){
			min_count[row][col] = BIG_NUM;
		}
	}

	queue<Info> Q;

	for(int col = 1; col <= W; col++){
		min_count[0][col] = 0;
		Q.push(Info(0,col,0));
		min_count[H+1][col] = 0;
		Q.push(Info(H+1,col,0));
	}

	for(int row = 1; row <= H; row++){
		min_count[row][0] = 0;
		Q.push(Info(row,0,0));
		min_count[row][W+1] = 0;
		Q.push(Info(row,W+1,0));
	}

	int next_row,next_col;

	while(!Q.empty()){

		if(Q.front().row == goal_row && Q.front().col == goal_col){
			Q.pop();
		}else if(Q.front().num > min_count[Q.front().row][Q.front().col]){
			Q.pop();
		}else{

			for(int i = 0; i < 4; i++){
				next_row = Q.front().row + diff_row[i];
				next_col = Q.front().col + diff_col[i];

				if(!rangeCheck(next_row,next_col))continue;

				if(map[Q.front().row][Q.front().col] == '#' && map[next_row][next_col] != '#'){
					if(min_count[next_row][next_col] > Q.front().num+1){
						min_count[next_row][next_col] = Q.front().num+1;
						Q.push(Info(next_row,next_col,Q.front().num+1));
					}
				}else{
					if(min_count[next_row][next_col] > Q.front().num){
						min_count[next_row][next_col] = Q.front().num;
						Q.push(Info(next_row,next_col,Q.front().num));
					}
				}
			}
			Q.pop();
		}
	}

	printf("%d\n",min_count[goal_row][goal_col]);

}


int main(){

	while(true){
		scanf("%d %d",&W,&H);
		if(W == 0 && H == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3144
#include<stdio.h>
#include<stdlib.h>
int main(){
    int n;
    scanf("%d",&n);
    int* stones=(int*)malloc(sizeof(int)*n);
    for(int i=0;i<n;i++)
	scanf("%d",&stones[i]);

    //f(i)=min(s[i]-s[i-1]+f(i-1),s[i]-s[i-2]+f(i-2)
    int* f=(int*) malloc(sizeof(int)*n);
    f[0]=0;
    int temp=stones[1]-stones[0];
    f[1]=temp>0? temp: -temp;

    for(int i=2;i<n;i++){
	temp=stones[i]-stones[i-1];
	if(temp<0) temp=-temp;
	int s1=temp+f[i-1];

	temp=stones[i]-stones[i-2];
	if (temp<0) temp=-temp;
	int s2=temp+f[i-2];

	f[i]=s1>s2? s2:s1;
	
    }
    printf("%d\n",f[n-1]);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef int64_t intl;


int main(){
  int N,M,Q;
  cin >> N >> M >>Q;
  vector<int> A(N,1);
  vector<vector<int>> abcd(Q,vector<int>(4));
  
  Rep(i,Q){
    Rep(j,4){
      cin >> abcd.at(i).at(j);
    }
  }
  int dsum =0;
  int dsum_max=0;
  int Mem;
  
  while (1){  
    
    Rep(i,Q){
      if ( A.at( abcd.at(i).at(1)-1 ) - A.at( abcd.at(i).at(0)-1 ) == abcd.at(i).at(2) ){
        dsum += abcd.at(i).at(3);
      }
    }//この時点でのAにおけるdsum計算
    
    dsum_max = max( dsum , dsum_max ); //dsum_max更新
    dsum = 0;//dsumの初期化
    
  auto it = A.end();
  it --;
  while ( it != A.begin() && *it == M){
    it --;
  }
  if ( it == A.begin() ){break;} //Aが{1,M,M…}であることを確認して離脱
    Mem = *it + 1;
    while ( it != A.end() ){
      *it = Mem;
      it ++;
    } //Aを更新
    
    
    
  }//whileループ終端
  
  cout << dsum_max;
  
}

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

int main() {
  int a;
  int b;
  int c;
  int k;
  cin >> a >> b >> c >> k;
  if(a >= k){
    cout << k << endl;
  }
  else if(a + b >= k){
    cout << a << endl;
  }
  else{
    cout << a + a + b - k << endl;
  }
    
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <ctype.h>
#include <algorithm>
using namespace std;

const int maxN = 100000;
long long dp[maxN + 1];

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

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

	return 0;
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  double ret = 0;
  rep(i,N){
    double x;
    string u;
    cin >> x >> u;

    if(u == "JPY") ret += x;
    else ret += x * 380000.0;
  }

  printf("%.12lf\n", ret);
  
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		int q = Integer.parseInt(br.readLine());

		String X, Y;
		StringBuilder ans = new StringBuilder();
		while (q-- > 0) {
			X = br.readLine();
			Y = br.readLine();
//			System.out.println( solvelcs(X, Y) );
			ans.append( solvelcs(X, Y) + "\n" );
		}

		System.out.print(ans);
	}

	static int[][] memo;

	static boolean[][] ismemoized;

	static int lcs(String X, String Y, int Xi, int Yi) {
		if (Xi == -1 || Yi == -1) return 0;

		if (ismemoized[Xi][Yi]) return memo[Xi][Yi];

		if ( X.charAt(Xi) == Y.charAt(Yi) ) {
			ismemoized[Xi][Yi] = true;
			return memo[Xi][Yi] = lcs(X, Y, Xi-1, Yi-1) + 1;
		}

		ismemoized[Xi][Yi] = true;
		return memo[Xi][Yi] = Math.max( lcs(X, Y, Xi, Yi-1), lcs(X, Y, Xi-1, Yi) );
	}

	public static int solvelcs(String X, String Y) {
		memo = new int[X.length()][Y.length()];
		ismemoized = new boolean[X.length()][Y.length()];

		return lcs(X, Y, X.length()-1, Y.length()-1);
	}
}

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define all(c) begin(c),end(c)

template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


auto solve() {
    string S;
    cin >> S;

    int N = S.size();
    int min_diff = 999;
    REP(i, N) {
        stringstream ss;
        if (i + 3 > N) break;
        REP(j, 3) {
            ss << S[i + j];
        }

        int diff;
        ss >> diff;
        min_diff = min(min_diff, abs(753 - diff));
    }

    return min_diff;
}

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

    cout << solve() << endl;
    return 0;
}


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

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

    vector<string> w = {"Sunny", "Cloudy", "Rainy", "Sunny"};
    for (int i = 0; i < 4; i++) {
        if (w[i] == s) {
            cout << w[i + 1] << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2018/10/29/004900
int main() {
    int N;
    cin >> N;
    // 部分集合はk個数
    // 1. どの整数も２つにふくまれる要素の数は 2 * Nになる
    // 2. どの２つの集合もインターセクションがシングルトン
    // N = k * (k-1)
    bool flag = true;
    int K = 0;
    for(int k = 0; k <= N; k++) {
        if(N * 2 == k * (k + 1)) {
            cout << "Yes" << endl;
            K = k;
            flag = false;
            break;
        }
    }
    if(flag) {
        cout << "No" << endl;
        return 0;
    }

    cout << K + 1 << endl;
    vector<vector<long long>> res(K + 1, vector<long long>());
    long long sum = 1;
    for(int k = K; k >= 1; --k) {
        for(int i = 0; i < k; ++i) {
            res[K - k].push_back(sum + i);
            res[K - k + i + 1].push_back(sum + i);
        }
        sum += k;
    }

    for(int i = 0; i < K + 1; ++i) {
        cout << res[i].size();
        for(int j = 0; j < res[i].size(); ++j)
            cout << " " << res[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<algorithm>
#include<functional>
#include<queue>
#include<vector>
#include<cmath>
#include<iomanip>

using namespace std;

typedef pair<double, int> P;

struct Edge {
	int to;
	double cost;
	Edge(int a, double b) { to = a, cost = b; }
};

struct shelter {
	double x, y, r;
	shelter(double a, double b, double c) {
		x = a, y = b, r = c;
	}
	shelter() { x - 0, y = 0, r = 0; }
};

double getdis(shelter A, shelter B) {
	double dis = sqrt(pow(A.x - B.x, 2) + pow(A.y - B.y, 2)) - A.r - B.r;
	if (dis > 0) return dis;
	else return 0;
}

double sx, sy, tx, ty;
int N;
vector<shelter> S;
vector<vector<Edge>> E;

double dis[1002];

void djk(int s) {

	for (int i = 0; i < N + 2; i++)dis[i] = 1000000000000000;

	priority_queue<P, vector<P>, greater<P>> pq;
	pq.push(P(0, s));
	dis[s] = 0.0;
	
	while (pq.size()) {
		P now = pq.top(); pq.pop();
		int pos = now.second;
		double totalcost = now.first;
		if (totalcost > dis[pos])continue;

		for (int i = 0; i < E[pos].size(); i++) {
			int nxt = E[pos][i].to;
			double cost = E[pos][i].cost;
			if (dis[nxt] > dis[pos] + cost) {
				dis[nxt] = dis[pos] + cost;
				pq.push(P(dis[nxt], nxt));
			}
		}
	}
}

int main() {
	cin >> sx >> sy >> tx >> ty;
	cin >> N;
	S.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i].x >> S[i].y >> S[i].r;
	}

	E.resize(N + 2);
	E[0].push_back(Edge(N + 1, getdis(shelter(sx, sy, 0), shelter(tx, ty, 0))));
	for (int i = 0; i < N; i++) {
		E[0].push_back(Edge(i + 1, getdis(shelter(sx, sy, 0), S[i])));//どうせ最初のスタートに戻らないので一方通行の辺でもいい
		E[i + 1].push_back(Edge(N + 1, getdis(shelter(tx, ty, 0), S[i])));//上と同じ理由でゴールも一方通行
	}
	
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j)continue;
			E[i + 1].push_back(Edge(j + 1, getdis(S[i], S[j])));
			E[j + 1].push_back(Edge(i + 1, getdis(S[j], S[i])));
		}
	}

	djk(0);

	cout << setprecision(12) << dis[N + 1] << endl;

	return 0;
}

Measured memory_bytes: 38128
#include<bits/stdc++.h>
using namespace std;
#define w(t) int t;cin>>t;while(t--)
#define pb   push_back
#define mk   make_pair
#define u_s  unordered_set
#define endl "\n"
#define prDouble(x) cout<<fixed<<setprecision(10)<<x
#define ll long long int
#define ipair pair<int,int>
#define all(x) (x).begin(), (x).end()

const int mod=pow(10,9)+7;

bool compare(pair<int,int>p1,pair<int,int>p2){
    return p1.second<p2.first;
}
void open_file(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
void fast_io(){
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
      
}
/*
  ll C(ll n,ll k){
  
  if(k>n)return 0;
  
  ll ans=1;

  if(k>n-k)
    k=n-k;
  for(ll i=1;i<=k;i++)
    ans*=(n-i+1),ans/=i;

  return ans;
  }
  unsigned long long fact(long long a)
  {
  unsigned long long res=1;
  for(long long i=a;i>0;i--)
    res*=i;
  return res;
  }
  unsigned long long comb(long long a,long long b)
  {
  if((a-b)<b) b=a-b;
  if(a<=19) return fact(a)/(fact(a-b)*fact(b));
  if(a==b||b==0) return 1;
  if(b==1) return a;
  return comb(a-1,b-1)+comb(a-1,b);
  }
*/



void solve(){
     
  int n,k; cin>>n>>k; vector<int>A(n);

  for(int i=0;i<n;i++)cin>>A[i];
  
  bool dp[k+2];
  sort(all(A));
  memset(dp,0,sizeof dp);
  
  for(int i=1;i<=k;i++){

      for(int move:A){

         if(move>i)continue;
         if(dp[i-move]==0){
            dp[i]=1;
           break;
         }
      }
  }
  
  cout<<(dp[k]==1 ? "First" : "Second");
}
int main(){

//  open_file();
  fast_io();
  
  solve();
  
  return 0;  
    
}


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


int main() {
  string s;
  cin >> s;
  int len = s.size();
  int cnt = 0;
  
  rep(i,len){
    if(s.at(i) == '2') cnt++;
  }
  
  cout << cnt << endl;
}

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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    cout << 'A' << b.at(0) << 'C' << endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
 
//defines
typedef long long ll;
typedef long double ld;

ll a,b,c,n,m,k,t=1;

void solve()
{
    char ff;cin>>ff;
    if(ff>='A' and ff<='Z')cout<<'A';
    else cout<<'a';
 if(t>0)cout<<"\n";
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

 // cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

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

using namespace std;
const long long MOD = 998244353;

///mt19937 mt(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N = 600100;

void solve() {
        long long n, x, t;
        cin >> n >> x >> t;
        cout << (n + x - 1) / x * t << endl;
}


int main() {
#ifdef QWERTY
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
#endif
        ios_base::sync_with_stdio(false);


        int t = 1;
//        cin >> t;

        for (int i = 1; i <= t; i++) {
//                cout << "Case #" << i << ": ";
                solve();
        }

        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
        return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<ctime>
#include<map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;
const int N=200005;
const int M=1000005;
void getint(int&num){
    char c;bool flag=0;num=0;
    while((c=getchar())<'0'||c>'9')if(c=='-')flag=1;
    while(c>='0'&&c<='9'){num=num*10+c-48;c=getchar();}
    if(flag) num=-num;
}
int n,first[30],len[N],id[N],tot[30];
int ch[M][27],sz[M],letter[M][27],cnt=1;
ll ans;string str[N];
map<string,int> vis;
inline void insert(string str){
	int m=str.length(),x=1;
	for(int i=0;i<26;i++)
		first[i]=-1;
	
	for(int i=0;i<m;i++)
		if(first[str[i]-'a']==-1){
			first[str[i]-'a']=i;
			tot[str[i]-'a']++;
		}
	
	if(m==1){
		ans+=tot[str[0]-'a']-1;
		return ;
	}
	
	for(int i=m-1;i>=0;i--){
		int y=str[i]-'a';
		if(!ch[x][y])
			ch[x][y]=++cnt;
		x=ch[x][y];
		sz[x]++;
		
		if(i==1)
			ans+=letter[x][str[0]-'a'];
		
		for(int j=0;j<26;j++)if((~first[j])&&first[j]<i)
			letter[x][j]++;
	}
}
bool cmp(int i,int j){return len[i]>len[j];}
int main(){
	getint(n);
	for(int i=1;i<=n;i++){
		cin>>str[i];
		len[i]=str[i].length();
		id[i]=i;
	}
	sort(id+1,id+n+1,cmp);
	for(int i=1;i<=n;i++){
		insert(str[id[i]]);
		if(!vis.count(str[id[i]]))
			vis[str[id[i]]]=1;
		else ans+=vis[str[id[i]]];
	}
	
	cout<<ans<<endl;
}
/*

*/


Measured memory_bytes: 226848
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, p;
    while (cin >> a >> p) {
        p += a * 3;
        cout << p / 2 << endl;
    }
}


















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

using namespace std;

int main() {
    string s, t;
    while (cin >> s >> t) {
        int len = s.size(), i;
        for (i = 0; i < len; ++i) {
            if (s.find(s[i]) != t.find(t[i])) break;
        }
        if(i < len) puts("No");
        else puts("Yes");
    }
    return 0;
}


Measured memory_bytes: 776
#include <iostream>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int a,b;
    cin>>a>>b;
    if(a>=1 && a<=9 &&b>=1 && b<=9)
    {
        cout<<a*b<<endl;
    }
    else cout<<"-1"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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



















int main(){
    ll n, k;
    cin >> n >> k;
    cout << n - k + 1 << endl;
}

Measured memory_bytes: 768
#include "bits/stdc++.h"
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<stack>
#include<complex>
#include<memory>

#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
using ll = long long int;

using Graph=vector<vector<int>>;
	
#define WHATS(var)cout<<__LINE__<<' '<<#var<<"="<<var<<endl;
	
template<class S, class T> ostream& operator <<(ostream &os, const pair<S, T> v){
	os << "( " << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<T> &v){
	for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<vector<T>> &v){
	for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<set<T>> &v){
	for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const set<T> &v){
	int i=0;
	for(auto it:v){
		if(i > 0){os << ' ';}
		os << it;
		i++;
	} 
	return os;
}

#include<random>
const int mod=1e9+7;

vector<vector<ll>>memo(51,vector<ll>(51));
vector<vector<ll>>sums(51,vector<ll>(51));

void init(){
    for(int i=1;i<=50;++i){
        for(int j=1;j<=i;++j){
            ll answer=1;
            for(int k=0;k<j;++k){
                answer*=i-k;
                answer/=k+1;
            }
            memo[i][j]=answer;
        }
    }
    for(int i=0;i<=50;++i){
        for(int j=1;j<=50;++j){
            if(j!=1)sums[i][j]+=sums[i][j-1];
            sums[i][j]+=memo[i][j];
        }
    }
    //WHATS(sums)
}
vector<int> simulate(vector<int>v,int K){
    while(K--){
        auto nv(v);
        vector<int>pluss(v.size()+1);
        for(int i=0;i<v.size();++i){
            int l=max(0,i-v[i]);
            int r=min(int(v.size()),i+v[i]+1);
            pluss[l]++;
            pluss[r]--;
        }
        int sum=0;
        for(int i=0;i<v.size();++i){
            sum+=pluss[i];
            nv[i]=sum;
        }
        v=nv;
        //WHATS(v);
    }
    return v;
    
}
void solve(){
    ll A,V,B,W;cin>>A>>V>>B>>W;
    ll T;cin>>T;
    bool ok=true;
    if(V<=W){
        ok=false;
    }else{
        ll dis=A-B;
        if(dis<=(V-W)*T){
            ok=true;
        }else{
            ok=false;
        }
    }
    if(ok)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie();
    string st;cin>>st;
    cout<<st.substr(0,3)<<endl;
	return 0;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define pb(v) push_back(v)
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using P = pair<int ,int>;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int k; cin >> k;
    queue<ll> q;
    FOR(i, 1, 10) q.push(i);

    ll ans;
    while(true) {
        ans = q.front(); q.pop();
        k--;
        if (!k) break;
        int tmp = ans%10;
        int s = max(0, tmp-1), e = min(9, tmp+1);
        FOR(i, s, e+1) q.push(ans*10ll + i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
n, d = map(int, input().split())
x = []

for _ in range(n):
  x.append(list(map(int, input().split())))

def distance(x, y):
  d = 0
  for i in range(len(x)):
    d += (x[i]-y[i])**2
  return d ** (1/2)

count = 0

for i in range(n):
  for j in range(i+1, n):
    if distance(x[i], x[j]) % 1 == 0:
      count += 1

print(count)

Measured memory_bytes: 38640