akhauriyash/Code-Regression huggingface dataset:
n = gets.chomp.to_i

def is_prime?(n)
    2.upto(n-1) do |i|
        return false if n % i == 0
    end
    return true
end

count = 0
ans = []
for i in 11..55555
    break if ans.length == n
    next if i % 5 != 1
    ans << i if is_prime?(i)
end

puts ans.join(" ")

Measured memory_bytes: 1788
/**    Name        : Sourav Roy
       Institution : Hajee Mohammad Danesh Science & Technology University  (H S T U) **/


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

#define ff                          first
#define ss                          second
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define maX(a,b)                    ( (a) > (b) ? (a) : (b))
#define miN(a,b)                    ( (a) < (b) ? (a) : (b))
#define FasterIO                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define yes                         cout << "YES" << endl
#define no                          cout << "NO" << endl
#define endl                        "\n"
#define int                         long long
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{
    FasterIO;

    string s;
    cin >> s;
    char ck = s[s.length()-1];
    if(ck=='2' || ck=='4' || ck=='5' || ck=='7' || ck=='9')
        cout << "hon" << endl;
    else if(ck=='0' || ck=='1' || ck=='6' || ck=='8')
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
}



Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  ll n;
  cin>>n;
  vector<ll>p(n);
  rep(i,n)cin>>p[i];
  vector<ll>idx(n);
  rep(i,n){
    p[i]--;
    idx[p[i]]=i+1;
  }
  multiset<ll>ms;
  ms.emplace(0);ms.emplace(0);
  ms.emplace(n+1);ms.emplace(n+1);
  ll ans=0;
  for(ll id=n-1;id>=0;--id){
    ms.emplace(idx[id]);
    auto itr=ms.lower_bound(idx[id]);
    ll sum=(*next(next(itr))-*next(itr))*(*itr-*prev(itr))+(*prev(itr)-*prev(prev(itr)))*(*next(itr)-*itr);
    //cerr<<sum<<endl;
    ans+=sum*(id+1);
  }
  cout<<ans;
}

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


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

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

    rep(i, N){
        if(a[i]%2 == 1){
            cout << "first" << endl;
            return 0;
        }
    }

    cout << "second" << endl;
    return 0;

    return 0;
}

Measured memory_bytes: 3780
using System;

namespace AtCoder.ABC088
{
    public class A
    {
        public static void Solve()
        {
            int num = 2;
            var a = new int[num];
            for (int i  = 0; i < num; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }

            bool isPay = false;
            if (a[0] <=a[1])
            {
                isPay = true;
            }
            else
            {
                if (a[0] % 500 <= a[1])
                {
                    isPay = true;
                }
            }    
            
            Console.WriteLine(isPay ? "Yes":"No");
        }    
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC088.A.Solve();
        }
    }
}


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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

int a, b, c, d;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> a >> b >> c >> d;

	while (1) {
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}

		c -= b;

		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}

		a -= d;
	}

	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n, k, t, d;
    cin >> n >> k;
    priority_queue<pair<int, int>> pq;
    for(int i = 0; i < n; i++) {
        cin >> t >> d;
        pq.push({d, t});
    }
    unordered_map<int, int> cnt;
    multiset<pair<int, int>> kind;
    priority_queue<pair<int, int>> mx;
    while (!pq.empty()) { // select top different types
        tie(d, t) = pq.top(); pq.pop();
        if (cnt.size() < k && cnt.count(t) == 0) {
            kind.insert({d, t});
            cnt[t] = 1;
        } else {
            mx.push({d, t});
        }
    }
    while(kind.size() < k) {
        if (!mx.empty()) {
            tie(d, t) = mx.top(); mx.pop();
            kind.insert({d, t});
            cnt[t] += 1;
        }
    }
    ll acc = 0, ans = 0;
    for(auto& p: kind)
        acc += p.first;
    ans = acc + cnt.size() * cnt.size();
    while (!mx.empty()) {
        tie(d, t) = mx.top(); mx.pop();
        auto it = kind.begin();
        if (d < it->first)
            break;
        if (--cnt[it->second] == 0)
            cnt.erase(it->second);
        acc -= it->first;
        kind.erase(it);
        acc += d;
        cnt[t] += 1;
        kind.insert({d, t});
        ans = max(ans, acc + (ll)cnt.size()*(ll)cnt.size());
    }
    cout << ans << endl;
    return 0;
}




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

#define sint(a) scanf("%d", &a)
#define sint2(a, b) scanf("%d %d", &a, &b)
#define sll(a) scanf("%lld", &a)
#define sll2(a, b) scanf("%lld %lld", &a, &b)
#define mem(a, i) memset(a, i, sizeof(a))
#define pb push_back
#define int long long
#define ll long long
#define lson node << 1
#define rson (node << 1) + 1
#define endl "\n"

const int maxn = 3e3 + 10;
const int mod = 998244353;
const double pi = acos(-1);

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}

int qpow(int a, int n)
{
    int b = 1;
    while (n)
    {
        if (n & 1)
            b = a * b % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return b;
}

class Prime_Number
{
public:
    int prime[maxn], s, v[maxn];
    void prime_init(int n)
    {
        for (int i = 2; i <= n; i++)
        {
            if (!v[i])
            {
                prime[s++] = i;
                for (int j = 1; j * i <= n; j++)
                    v[i * j] = 1;
            }
        }
    }
};

//*************************
int Map[maxn][maxn];
int dp[maxn][maxn][4];
void solve()
{
    int r, c, n;
    while (cin >> r >> c >> n)
    {
        mem(Map, 0);
        mem(dp, 0);
        for (int i = 0; i < n; i++)
        {
            int x, y, v;
            sll2(x, y);
            sll(v);
            Map[x][y] = v;
        }
        for (int i = 1; i <= r; i++)
            for (int j = 1; j <= c; j++)
            {
                if (Map[i][j] == 0)
                {
                    for (int k = 0; k < 4; k++)
                    {
                        dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
                        dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][k]);
                    }
                }
                if (Map[i][j])
                {
                    for (int k = 0; k < 4; k++) //不选
                    {
                        dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
                        dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][k]);
                    }
                    for (int k = 1; k< 4; k++) //选
                    {
                        dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k - 1] + Map[i][j]);
                        dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][k] + Map[i][j]);
                    }
                }
            }
        int ans = 0;
        for (int i = 0; i < 4; i++)
            ans = max(ans, dp[r][c][i]);
        printf("%lld\n", ans);
    }
}
signed main()
{
    solve();
    return 0;
}


Measured memory_bytes: 357740
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iomanip>

int main(){
  
  long long int n, m, d;
  
  scanf("%lld%lld%lld", &n, &m, &d);
  
  std::cerr << "Answer:" << std::endl;
  if(d == 0){
    std::cout << std::setprecision(14) /*<< std::scientific */<< (m-1.0)/n << std::endl;
  }
  else{ // if(d>0)
    std::cout << std::setprecision(14) /*<< std::scientific*/ << (2.0*(n-d))/(n*n) * (m-1.0) << std::endl;
  }
  
  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sh cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);
#define FILE freopen("test.in", "r", stdin);
#define vprint(v) for (int ii = 0; ii < v.size(); ii++){cout << v[ii] << " ";}
#define debugv(v) if (v.size() != 0) {cout << "[ "; for (int __ = 0; __ < (int)(v.size()) - 1; __++){cout << v[__] << ", ";} cout << v[(int)(v.size()) - 1] << " ]" << endl;} else {cout << "[]" << endl;}
#define debug cout << "-----------------------------------------------" << endl;
#define print1(a) cout << "{ " << a << " }" << endl;
#define print2(a, b) cout << "{ " << a << ", " << b << " }" << endl;
#define print3(a, b, c) cout << "{ " << a << ", " << b << ", " << c << " }" << endl;
#define print4(a, b, c, d) cout << "{ " << a << ", " << b << ", " << c << ", " << d << " }" << endl;
using namespace std;
#define int long long
const int INF = 1e9 + 228;
const int MAXN = 1e5 + 228;
map<int, int> used;
signed main()
{
#ifdef LOCAL
    FILE;
#endif
    sh;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
    	int aa;
    	cin >> aa;
    	if (used[aa]) {
    		cout << "NO" << endl;
    		return 0;
    	}
    	used[aa] = 1;

    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int L, R, d;
  cin >> L >> R >> d;
  int count =0;
  int sum =0;
  int i=1;
  if(d >= L) {
    while( d * i <=R){
      i++;
      count++;
    }
  }
  if(d<L) {
    while( d * i <= R) {
      i++;
      count++;
    }
    int i=1;
    while( d * i < L) {
      i++;
      sum++;
    }
  }
 cout << count - sum << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define repi(n) rep(i,n)
#define int long long
#define str string
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;
#define SORT(a) sort(all(a));
#define INF 1LL<<60
#define inf INF
#define out(i) cout<<i<<endl;
#define allSum(a) accumulate(a.begin(),a.end(),0)
int min(int a,int b){if(a>b)return b;return a;}
int max(int a,int b){if(a>b)return a;return b;}

signed main(){
  int n,m,l;
  str s,t;
  cin>>n>>m>>s>>t;
  l=n/__gcd(n,m)*m;
  int ln=l/n,lm=l/m;
  vint a(n),b(m);
  rep(i,n)a[i]=ln*i;
  rep(i,m)b[i]=lm*i;
  a.pb(INF);
  bool ans=true;
  rep(i,n){
    int itr=lower_bound(all(b),a[i])-b.begin();
    if(a[i]==b[itr]){
      if(s[i]!=t[itr])ans=false;
    }
  }
  cout<<(ans?l:-1)<<endl;


  return 0;
}



Measured memory_bytes: 2432
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <climits>
#include <vector>
#include <utility>
#define N 2020
using namespace std;

char a[N];
vector<int> e[N];
int f[N], v[N], s[N];

void DFS(int x, int p)
{
    int i, k;
    vector<pair<int, int> > t;

    v[x] = 0;
    s[x] = a[x] == '1';
    for(i = 0; i < (signed)e[x].size(); i ++)
        if(e[x][i] != p)
        {
            DFS(e[x][i], x);
            s[x] += s[e[x][i]];
            v[x] += v[e[x][i]] + s[e[x][i]];
            t.push_back(make_pair(v[e[x][i]] + s[e[x][i]], e[x][i]));
        }

    f[x] = 0;
    if(!t.empty())
    {
        sort(t.begin(), t.end());
        for(i = k = 0; i < (signed)t.size() - 1; i ++)
            k += t[i].first;
        if(k >= t.back().first)
            f[x] = v[x] / 2;
        else
            f[x] = k + min(f[t.back().second], (t.back().first - k) / 2);
    }

    return;
}

int main(void)
{
    int n, u, v;
    int i;

    scanf("%d %s", &n, a);
    for(i = 1; i < n; i ++)
    {
        scanf("%d %d", &u, &v);
        e[-- u].push_back(-- v);
        e[   v].push_back(   u);
    }

    for(i = 0, v = INT_MAX; i < n; i ++)
    {
        DFS(i, i);
        // printf("at %d : sum %d, f %d\n", i, ::v[i], f[i]);
        if(~::v[i] & 1 && f[i] * 2 >= ::v[i])
            v = min(v, ::v[i] / 2);
    }
    printf("%d\n", v == INT_MAX ? -1 : v);

    return 0;
}


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

int main(){
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  if(S.at(0)==S.at(1) && S.at(1)!=S.at(2) && S.at(2)==S.at(3)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

namespace ARC063D {
    class Program {
        static void Main(string[] args) {
            int[] NTinput = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = NTinput[0];
            int T = NTinput[1];
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int min = 1000000009;
            int num = 0;
            int nowprofit = 0;
            for (int i = 0; i < N; i++) {
                if (input[i] < min) {
                    min = input[i];
                }
                int dif = input[i] - min;
                if (dif > nowprofit) {
                    nowprofit = dif;
                    num = 1;
                } else if (dif == nowprofit) {
                    num++;
                }
            }
            Console.WriteLine(num);
        }
    }
}


Measured memory_bytes: 21728
/* 
 * Project: AtCoder Beginners Contest 169 
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/05/31
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cmath>
using namespace std;

int n;
long long a[100000];

void solve() {
    
    for (int i=0;i<n;i++) {
        if (a[i] == 0) {
            printf("0\n");
            return;
        }
    }

    long mul = 1;
    for (int i=0;i<n;i++) {
        if (mul/ powl(10, 18) * a[i] > 1) {
            printf("-1\n");
            return;
        }
        mul *= a[i];
    }

    printf("%ld\n", mul);
    return;
}

int main() {

    scanf("%d", &n);
    for (int i=0;i<n;i++) {
        scanf("%Ld", &a[i]);
    }
    solve();

}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int a[501][501];

// usage:
// vector<S> v; v.push_back(S(1, 2, "abc")); v.emplace_back(1, 2, "abc");
// S& s = v[0];
struct S
{
  int x1, y1, x2, y2;
  S()
  {
    x1 = 0;
    y1 = 0;
    x2 = 0;
    y2 = 0;
  }
};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int H, W;
  cin >> H >> W;
  for (int y = 1; y <= H; y++) {
    for (int x = 1; x <= W; x++) {
      int a_;
      cin >> a_;
      a[y][x] = a_ & 1;
    }
  }
  vector<S> ans;
  for (int y = 1; y <= H; y++) {
    for (int x = 1; x <= W; x++) {
      if (a[y][x - 1]) {
        a[y][x] += a[y][x - 1];
        a[y][x] &= 1;
        S s;
        s.x1 = x - 1;
        s.y1 = y;
        s.x2 = x;
        s.y2 = y;
        ans.push_back(s);
      }
    }
  }
  for (int x = W; x <= W; x++) {
    for (int y = 1; y <= H; y++) {
      if (a[y - 1][x]) {
        a[y][x] += a[y - 1][x];
        a[y][x] &= 1;
        S s;
        s.x1 = x;
        s.y1 = y - 1;
        s.x2 = x;
        s.y2 = y;
        ans.push_back(s);
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    S s;
    s = ans[i];
    cout << s.y1 << " " << s.x1 << " " << s.y2 << " " << s.x2 << endl;
  }

  return 0;
}

Measured memory_bytes: 5232
#include<stdio.h>
#include <stdlib.h>

int main () {
    int a, b, c;
    char str[128];

    fgets(str,sizeof(str),stdin);
    a = atoi(str);
    fgets(str,sizeof(str),stdin);
    b = atoi(str);
    fgets(str,sizeof(str),stdin);
    c = atoi(str);
    //printf("%d, %d, %d\n", a,b,c);

    printf ("%d\n", (a+b)*c/2);

    return 0;
}


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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int H, W; cin >> H >> W;
	int h, w; cin >> h >> w;

	int res = H * W - (w * H + h * W - (h * w));
	cout << res << endl;

	return 0;
}

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

struct Node
{
	long long data;
	struct Node *next, *prev;
};
typedef struct Node *List;

List init()
{
	List list;
	list = (List)malloc(sizeof(struct Node));
	list->next = list;
	list->prev = list;
	return list;
}

void insert(List head, long long x)
{
	List tmp;
	tmp = (List)malloc(sizeof(struct Node));
	tmp->data = x;
	tmp->next = head->next;
	head->next->prev = tmp;
	head->next = tmp;
	tmp->prev = head;
}

void delete(List list, long long x)
{
	if (list->next == list->prev)
		return;
	List tmp;
	tmp = list->next;
	
	while (tmp != list && tmp->data != x)
		tmp = tmp->next;
	if (tmp == list)
		return;

	tmp->prev->next = tmp->next;
	tmp->next->prev = tmp->prev;
	free(tmp);
}

void deleteFirst(List list)
{
	if (list->next == list)
		return;
	List tmp;
	tmp = list->next;
	tmp->prev->next = tmp->next;
	tmp->next->prev = tmp->prev;
	free(tmp);
}

void deleteLast(List list)
{
	if (list->next == list)
		return;
	List tmp;
	tmp = list->prev;
	tmp->prev->next = tmp->next;
	tmp->next->prev = tmp->prev;
	free(tmp);
}

void print(List list)
{
	if (list->next == list)
		return;
	List tmp;
	tmp = list;
	while (tmp->next!=list)
	{
		tmp = tmp->next;
		if (tmp != list->next)
			printf(" ");
		printf("%lld", tmp->data);
	}
	printf("\n");
}

void solve()
{
	List list;
	list = init();
	long long n, x;
	char s1[20];
	
	scanf("%lld", &n);
	for (long long i = 0; i < n; i++)
	{
		scanf("%s", s1); 
		if (strcmp(s1, "insert") == 0)
			scanf("%lld", &x),insert(list, x);
		if (strcmp(s1, "delete") == 0)
			scanf("%lld", &x),delete(list, x);
		if (strcmp(s1, "deleteFirst") == 0)
			deleteFirst(list);
		if (strcmp(s1, "deleteLast") == 0)
			deleteLast(list);
	}
	print(list);
}

int main()
{
	solve();
}


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

def warshall_floid(d):
    for k in range(1,n+1):
        for i in range(1,n+1):
            for j in range(1,n+1):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d
n,m,l = map(int,readline().split())
d = [[10**12]*(n+1) for i in range(n+1)]
for i in range(m):
    a,b,c = map(int,readline().split())
    d[a][b] = c
    d[b][a] = c
for i in range(1,n+1):
    d[i][i] = 0
d = warshall_floid(d)
for i in range(1,n+1):
    for j in range(1,n+1):
        if d[i][j] <= l:
            d[i][j] = 1
        else:
            d[i][j] = 10**12
d = warshall_floid(d)
q = int(readline())
for i in range(q):
    s,t = map(int,readline().split())
    if d[s][t] >= 10**12:
        print(-1)
    else:
        print(d[s][t]-1)

Measured memory_bytes: 52572
n = int(input())
a = list(map(int,input().split()))

ok = True
for i in range(n):
  x = a[i]
  if x % 2 == 0:
    if x % 3 == 0 or x % 5 == 0:
      continue
    else:
      ok = False

if ok:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main (){
    int h, n;
    cin >> h >> n;
    vector<int> dp(h+1, INF);
    dp[0] = 0;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        rep(j, h) {
            int nj = min(j + a, h);
            dp[nj] = min(dp[nj], dp[j] + b);
        }
    }

    cout << dp[h] << endl;

}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int s = scanner.nextInt();
    Set<Integer> set = new HashSet<>();
    set.add(s);
    for (int i = 2; i <= 1000000; i++) {
      s = f(s);
      if (set.contains(s)) {
        System.out.println(i);
        return;
      }
      set.add(s);
    }
  }

  private static int f(int n) {
    if (n % 2 == 0) return n/2;
    return 3 * n + 1;
  }
}


Measured memory_bytes: 19924
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int A,B;cin>>A>>B;
  if((A-B)%2 == 0)
  {
    cout<<(max(A,B) - min(A,B))/2 + min(A,B)<<endl;
  }
  else
  {
    cout<<"IMPOSSIBLE"<<endl;
  }
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 256
N=int(input())
if N==1:
  print(1)
  exit()
L=list()
R=list()
for i in range(N):
  a,b=map(int,input().split())
  L.append([a,b])
k=dict()
for i in range(N-1):
  for j in range(i+1,N):
    a,b=L[i]
    c,d=L[j]
    R.append([a-c,b-d])
    n=str(a-c)+" "+str(b-d)
    if n in k:
      k[n]+=1
    else:
      k[n]=1
    R.append([c-a,d-b])
    n=str(c-a)+" "+str(d-b)
    if n in k:
      k[n]+=1
    else:
      k[n]=1
op=max(k.values())
print(N-op)

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

int main()
{
	int n, q, l, r;
	string s;
	
	cin >> n >> q;
	cin >> s;
	
	int a[n+5], cnt = 0, ac = 0;
	a[0] = 0;
	
	for(int i = 0; i < n-1; i++){
		a[i+1] = cnt;
		if(s[i] == 'A' && s[i+1] == 'C') ac = 1;
		if(ac) cnt++;
		a[i+2] = cnt;
		ac = 0;
	}
	
	//for(int i = 0; i < n; i++) a[i] += a[i-1];
	//for(int i = 1; i <= n; i++) cout << a[i] << " ";
	
	while(q--){
		cin >> l >> r;
		
		cout << a[r] - a[l] << "\n";
	}
	
	
	return 0;
}


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

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

  int sum = 0;
  vector<int> A(N);
  rep(i,0,N-1)
  {
    cin >> A[i];
    sum += A[i];
  }

  sort(begin(A), end(A), greater<int>());
  double required = sum / 4.0 / M;

  bool ok = true;
  rep(i,0,M-1)
    if (A[i] < required)
      ok = false;

  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define fastio      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int N = 1e6 + 6;

map<int , int>romp , colmp ;
map<pii, int> mp;


vector<int>rec[N];
int ara[N], tree[4*N];

void build(int node , int l , int r) {
    if(l == r) {
        tree[node] = ara[l];
        return;
    }
    int mid = (l+r)/2;
    build(node<<1, l , mid);
    build(node<<1|1 , mid+1 , r);
    tree[node] = max(tree[node<<1] , tree[node<<1|1]);
}

void update(int node, int l , int r , int id , int val) {
    if(l > r || l > id || r < id)return ;
    if(l == r) {
        tree[node] += val;
        return;
    }
    int mid = (l+r)/2;
    update(node<<1 , l ,mid , id , val);
    update(node<<1|1 , mid+1 , r , id , val);
    tree[node] = max(tree[node<<1] , tree[node<<1|1]);
}

int main()  {
    fastio;
    
    
    int n , m , cnt;
    cin>>n>>m>>cnt;
    while(cnt -- ) {
        int x , y;
        cin>>x>>y;
        rec[x].push_back(y);
        ara[y]++;
    }  

    int nn = 3e5;
    build(1 ,1 , nn );

    int ans = 0;
    for(int i = 1 ; i <= nn ; i++ ) {
        for(auto x : rec[i]) update(1 ,1 , nn , x , -1);
        ans = max(ans , (int)rec[i].size() + tree[1] );
        for(auto x : rec[i]) update(1 ,1 , nn , x , 1);
    }
    cout<<ans<<'\n';

    
    
    return 0;
    
}

Measured memory_bytes: 41744
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back

using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;
int t=1;
vll_t a,b;
int ans=INT_MAX;
int  main(){
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
	// #endif
	int a,b,c;
	cin>>a>>b>>c;
	int count=0;
	if(a%2==b%2&&b%2==c%2){
		int ma=max(a,max(b,c));
		cout<<(3*ma-a-b-c)/2<<endl;
	}
	else{
		if(a%2==b%2&&b%2!=c%2){
			c--;
			int ma=max(c,max(a,b));
			cout<<((3*ma-a-b-c)/2)+1<<endl;
		}
		else if(a%2==c%2&&b%2!=c%2){
			b--;
			int ma=max(c,max(a,b));
			cout<<((3*ma-a-b-c)/2)+1<<endl;
		}
		else if(c%2==b%2&&a%2!=c%2){
			a--;
			int ma=max(c,max(a,b));
			cout<<((3*ma-a-b-c)/2)+1<<endl;
		}
	}
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
 
def insertionSort(arr):
    arr_len = len(arr)
    for i in range(arr_len):
        v = arr[i]
        j = i - 1
        while j >= 0 and arr[j] > v :
            A[j +1] =A[j]
            j = j -1
        arr[j+1] = v
        print(' '.join([str(x) for x in arr]))
 
insertionSort(A)


Measured memory_bytes: 5608
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int inf=1<<29;
const int maxn=1e5+100;
char s[maxn];

int main()
{
    //freopen("1.txt","r",stdin);
    while (scanf("%s",s+1)!=EOF)
    {
        int len=strlen(s+1);
        int ans=inf;
        for (int i=1;i<=len;i++)
        {
            if (s[i]!=s[i+1])
                ans=min(ans,max(i,len-i));
        }
        printf("%d\n",ans);
    }
    return 0;
}


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

int h, w;
char board[60][60];
string res = "Yes";
int di[4] = {0, 1, 0, -1};
int dj[4] = {1, 0, -1, 0};

int main(){
  cin >> h >> w;
  rep(i, h){
    cin >> board[i];
  }
  rep(i, h){
    rep(j, w){
      if(board[i][j] == '.'){
        continue;
      }
      bool can = false;
      rep(k, 4){
        const int ni = i + di[k];
        const int nj = j + dj[k];
        if(ni < 0 || h <= ni){
          continue;
        }
        if(nj < 0 || w <= nj){
          continue;
        }
        if(board[ni][nj] == '#'){
          can = true;
        }
      }
      if(!can){
        res = "No";
      }
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int A,B;
    int i,j=0,S=0;
  
    scanf("%d%d",&A,&B);
  
    if(B==1) printf("0\n");
    else{
      for(i=1;i<=500;i++){
        S=i*A-(i-1);
        j++;
        if(S>=B){
         printf("%d\n",j);
         return 0;
        }
      }
    }
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 0;
  cin >> N;
  int count = 1;
  vector<tuple<string, int, int>> SP;
  
  for (int i = 0; i < N; i++) {
    string s;
    int p;
    cin >> s >> p;
    SP.push_back(make_tuple(s, 100 - p, count));
    count++;
  }
  
  sort(SP.begin(), SP.end());
  for (auto t : SP) {
  	cout << get<2>(t) << endl;
  }
}

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

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

  if ( n % 2 == 0){
    int i = n;
    while(i > 0){
      cout << a[i] << " ";
      i -= 2;
    }
    i = 1;
    while(i <= n){
      cout << a[i];
      if ( i != n){
        cout << " ";
      }
      i += 2;
    }
    cout << endl;
  } else {
    int i = n;
    while(i > 0){
      cout << a[i] << " ";
      i -= 2;
    }
    i = 2;
    while(i <= n){
      cout << a[i];
      if ( i != n){
        cout << " ";
      }
      i += 2;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
 
using namespace std;
 
class Point{
public:
  double x,y;
 
  Point(double x = 0,double y = 0): x(x),y(y){}
  Point operator + (Point p){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}
  bool operator < (const Point& p) const{ return !equals(x,p.x)?x<p.x:(!equals(y,p.y)&&y<p.y); }
  bool operator == (const Point& p)const{ return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS; }
 
};
 
Point rotate(Point a,double rad){ return Point(cos(rad)*a.x - sin(rad)*a.y,sin(rad)*a.x + cos(rad)*a.y); }
 
const double DINF = 1e20;
int n;
Point ps[2][1010],tmp[1010];
 
inline double getDist(Point p){ return sqrt(p.x*p.x+p.y*p.y); }
 
bool comp_arg(const double &a,const double &b) { return !equals(fabs(a),fabs(b)) && fabs(a) < fabs(b); }
 
void compute(){
  Point grv[2] = {Point(),Point()};
  rep(i,2) rep(j,n) grv[i] = grv[i] + ps[i][j];
  rep(i,2) grv[i] = grv[i] / (double)n;
  rep(i,2) rep(j,n) ps[i][j] = ps[i][j] - grv[i];
  sort(ps[0],ps[0]+n);
  sort(ps[1],ps[1]+n);
 
  vector<double> arg_buf;
  rep(i,min(10,n)) rep(j,n) {
    double dist[2] = { getDist(ps[0][i]), getDist(ps[1][j]) };
    if( !equals(dist[0],dist[1]) ) continue;
    arg_buf.push_back( atan2(ps[0][i].y,ps[0][i].x) - atan2(ps[1][j].y,ps[1][j].x) );
  }
 
  sort(arg_buf.begin(),arg_buf.end(),comp_arg);
  arg_buf.erase(unique(arg_buf.begin(),arg_buf.end()),arg_buf.end());
 
  rep(i,(int)arg_buf.size()){
    double arg = arg_buf[i];
    rep(j,n) tmp[j] = rotate(ps[1][j],arg);
    sort(tmp,tmp+n);
    bool failed = false;
    rep(j,n) if( !( tmp[j] == ps[0][j] ) ) { failed = true; break; }
    if( !failed ) { printf("%.10lf\n",fabs(arg)); break; }
  }
 
}
 
int main(){
  while( cin >> n, n ){
    rep(i,2) rep(j,n) cin >> ps[i][j].x >> ps[i][j].y;
    compute();
  }
  return 0;
}

Measured memory_bytes: 1512
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<iomanip>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
int N,a[100001];
int main(){
    int N; cin >> N;
    string s; cin >> s;
    map<char,int> mp;
    for(int i = 0; i < s.size(); i++){
        mp[s[i]]++;
    }
    ll ans = 1;
    for(char x = 'a'; x <= 'z'; x++){
        if(mp[x] >= 1){
            ans *= (mp[x]+1);
            ans %= MOD;
        }
    }
    cout << ans-1 << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <map>

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<int, int> m;
    for (int i = 0; i < n - 1; i++)
    {
        int k;
        cin >> k;
        m[k]++;
    }
    for (int i = 0; i < n; i++)
    {
        cout << m[i + 1] << endl;
    }
}

Measured memory_bytes: 13024
import Control.Applicative

data Dice = Dice {
	top :: Integer,
	right :: Integer,
	left :: Integer,
	front :: Integer,
	back :: Integer,
	bottom :: Integer
}

data Direction = E | N | S | W deriving (Eq, Show, Read)

main = do 
	[_top, _front, _right, _left, _back, _bottom] <- toIntList <$> getLine
	commands <- map (\x -> read [x] :: Direction) <$> getLine
	let dice = Dice { top=_top, front=_front, right=_right, left=_left, back=_back, bottom=_bottom }
	print . top $ foldl rotate dice commands


toIntList :: String -> [Integer]
toIntList = map read . words


rotate :: Dice -> Direction -> Dice
rotate d E = Dice{ 
					right = top d,
					top = left d,
					left = bottom d, 
					bottom = right d,
					front = front d,
					back = back d
}
rotate d W = Dice{ 
					left = top d, 
					top = right d,
					right = bottom d,
					bottom = left d,
					front = front d,
					back = back d
}
rotate d N = Dice{ 
					back = top d,
					top = front d,
					front = bottom d,
					bottom = back d,
					right = right d,
					left = left d
}
rotate d S = Dice{ 
					front = top d,
					top = back d,
					back = bottom d, 
					bottom = front d,
					right = right d,
					left = left d
}


Measured memory_bytes: 4128
def traveling(N: int, plan: list)->bool:
    ct, cx, cy = 0, 0, 0
    for nt, nx, ny in plan:
        if nt-ct < abs(nx-cx) + abs(ny-cy):
            return False
        if (nt-ct) % 2 != (abs(nx-cx) + abs(ny-cy)) % 2:
            return False
    return True


if __name__ == "__main__":
    N = int(input())
    plan = [tuple(int(s) for s in input().split()) for _ in range(N)]
    yes = traveling(N, plan)
    print('Yes' if yes else 'No')


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

int n, a[1010], mn = 101010100, mx = 0, m[1010];

int main(){

cin >> n;
rep(i, 1, n){
cin >> a[i];
m[a[i]]++;
mn = min(mn, a[i]);
mx = max(mx, a[i]);
}


if(mx %2 ==1&& mn == (mx+1)/2 && m[mn] == 2){
rep(i, mn+1, mx){
if(m[i]>=2){m[i]-=2;continue;}
else return 0*printf("Impossible");
}
cout << "Possible";
}

else if(mx%2==0  && mn == mx/2 && m[mn]==1) {


      rep(i, mn+1, mx){
      if(m[i]>=2){m[i]-=2;continue;}
      else return 0*printf("Impossible");
      }
       cout << "Possible";

}
else cout << "Impossible";











return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    string s;
    cin >> s;
    int N = int(s.length());
    bool ans = false;
    int be,en;
    rep(i,N-1){
        if(ans) break;
        string a = s.substr(i,2);
        set<char> aa;
        aa.insert(a[0]);
        aa.insert(a[1]);
        if(aa.size() == 1){
            ans = true;
            be = i+1;
            en = i+1+1;
        }
        if(i < N-3){
            string b = s.substr(i,3);
            set<char> bb;
            bb.insert(b[0]);
            bb.insert(b[1]);
            bb.insert(b[2]);
            if(bb.size() <= 2){
                ans = true;
                be = i+1;
                en = i+1+2;
            }
        }
    }
    
    if(ans){
        cout << be csp en << endl;
    }else{
        cout << -1 csp -1 << endl;
    }
    
    
    
    
    
    

    return 0;
}


Measured memory_bytes: 512
S = input()
a = int(S == S[::-1])
N = len(S)
S1 = S[:(N-1)//2]
b = int(S1 == S1[::-1])
S2 = S[(N+3)//2-1:]
c = int(S2 == S2[::-1])

print("Yes" if a*b*c == 1 else "No")

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	K := ReadInt()
	s := ""
	for i := 0; i < K; i++ {
		s += "ACL"
	}
	fmt.Println(s)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) (a []int) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt())
	}
	return
}


Measured memory_bytes: 1828
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<queue>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
#define M 1000000007

int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		lld a, b, c;
		scanf("%lld %lld %lld", &a, &b, &c);
		printf("%lld\n", ((a - 1) / b + 1) * c);
	}
	return 0;
}

Measured memory_bytes: 1716
/// --- In the name of ALLAH --- ///


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


typedef long long              ll;
typedef vector<int>            vi;
typedef vector<ll>             vl;
typedef vector<vi>             vvi;
typedef vector<vl>             vvl;
typedef pair<int,int>          pii;
typedef pair<double, double>   pdd;
typedef pair<ll, ll>           pll;
typedef vector<pii>            vii;
typedef vector<pll>            vll;
typedef double                 dl;

#define endl                   '\n'
#define PB                     push_back
#define F                      first
#define S                      second
#define all(a)                 (a).begin(),(a).end()
#define rall(a)                (a).rbegin(),(a).rend()
#define sz(x)                  (ll)x.size()
#define wt                     ll t; cin>>t; while(t--)
#define input(a,n)             for(int i=0;i<n;i++) cin>>a[i];

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;


#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define mod 10000007
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


const ll mx=1e9;



//q=51;

//ll b[q+1][q+1];


 main()
{
    optimize();
    int n,i,j=0;
    cin>>n;
    string s[n+1];
    map<string,int>m;
    for(i=1;i<=n;i++){
        cin>>s[i];
        m[s[i]]++;
        }

        for(auto u:m)
        {
            if(u.S>1){
                cout<<"No"<<endl;
                return 0;}

        }
        for(i=2;i<=n;i++)
        {
            ll n=sz(s[i-1]);
           if(s[i-1][n-1]!=s[i][0])
           {
               j++;
               cout<<"No"<<endl;
               break;
           }
        }
        if(j==0)
            cout<<"Yes"<<endl;


    return 0;
}






























































































Measured memory_bytes: 3664
class Main
{
    public static void main(String[] args)
    {
        for ( int i = 1; i < 10; i++ ) {
            for ( int j = 1; j < 10; j++ ) {
                System.out.println(i + "x" + j + "=" + (i*j));
            }

        }

    }

}

Measured memory_bytes: 16852
#include<stdio.h>
 int main(void)
 {
     int a,b,i,j;

     scanf("%d%d",&a,&b);

     if((b>10)&&(b<100)) j=a*100;
     else if(b==100) j=a*1000;
     else if((b>1)&&(b<10)) j=a*10;

     for(i=1;i<=1000;i++)
       if(j+b==i*i) { printf("Yes\n"); return 0; }

     printf("No\n");

     return 0;
 }


Measured memory_bytes: 128
import numpy as np
h,w=map(int,input().split())
L=[[i for i in input()] for i in range(h)]
L_first=np.zeros((2,w),dtype=str)
L_first2=np.zeros((1,1),dtype=str)
L=np.array(L,dtype=str)
L=np.insert(L_first,1,L,axis=0)
L=np.insert(L,0,L_first2,axis=1)
L=np.insert(L,w+1,L_first2,axis=1)
ans=np.zeros((h,w),dtype=str)
for i in range(1,h+1):
    for j in range(1,w+1):
        num = 0
        if L[i][j]==".":
            L2=L[i-1:i+2,j-1:j+2]
            ans[i-1][j-1]=np.sum(L2=="#")
        else:ans[i-1][j-1]="#"
for i in range(h):
    print("".join(ans[i]))

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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define Push_back(p, a, b) (p).push_back( make_pair( (a), (b) ) )

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;  } return 0;  }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;  } return 0;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

// π M_PI
// deg = rad*180/M_PI

int main() {
    int64_t n;
    cin >> n;
    cout << n+n*n+n*n*n << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
#include <deque>
#include <cstdint>
using namespace std;

int main () {
  int s;
  cin >> s;
  int m = 1;
  int f[1000000] = {0};
  while (true){
    if (f[s-1] == 0){
      f[s-1]++;
      if (s%2 == 0){
        s = s / 2;
      } else {
        s = 3*s + 1;
      }
      m++;
    } else {
      cout << m;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>

typedef long long LL;

constexpr long long INFLL = 1e18;

using namespace std;

map<LL, LL> v;

void isPrime(LL N, LL temp)
{
    LL n = N;
    for (LL i = temp; i <= sqrt(N); i++)
    {
        LL count = 0;

        while (n % i == 0)
        {
            count++;
            n /= i;
        }
        if (count)
        {
            v[i] = count;
        }
    }
    if (n != 1)
    {
        v[N] = 1;
    }
}

int main()
{
    LL N;
    cin >> N;
    if (N == 1)
    {
        cout << 0 << endl;
        return 0;
    }

    isPrime(N, 2);

    LL count = 0;
    LL temp, sum;
    sum = 0;

    for (LL i = 2; i <= sqrt(N); i++)
    {
        if (v.count(i))
        {
            sum = 0;
            temp = v.at(i);
            for (int k = 1;; k++)
            {
                sum += k;
                if (sum > temp)
                {
                    break;
                }
                count++;
            }
        }
    }

    if (v.count(N))
    {
        count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3144
#include <stdio.h>

int S, Oo, h, m, s;

int main(){

	scanf("%d", &S);
	
	h = S / 3600;
	
	m = S / 60 - h * 60;

	s = S - h * 3600 - m * 60;

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 592