akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

	int N, M, X;
	cin >> N >> M >> X;

	vector<int> C(N);
	vector<vector<int>> A(N, vector<int>(M));
	for (int i = 0; i < N; i++)
	{
		cin >> C[i];
		for (int j = 0; j < M; j++)
		{
			cin >> A[i][j];
		}
	}

	// for (int i = 0; i < N; i++)
	// {
	// 	cout << C[i] << " ";
	// 	for (int j = 0; j < M; j++)
	// 	{
	// 		cout << A[i][j] << " ";
	// 	}
	// 	cout << "\n";
	// }

	int result = 1300000;
	for (int i = 0b0; i < pow(2, N); i++)
	{
		// cout << "i: " << i << "\n";
		vector<int> skill(M, 0);
		int money = 0;
		for (int j = 0; j < N; j++)
		{
			if ((i >> (N - 1 - j)) & 0b1 == 1)
			{
				// cout << "j: " << j << "\n";
				money += C[j];
				for (int k = 0; k < M; k++)
				{
					skill[k] += A[j][k];
				}
			}
		}
		for (int k = 0; k < M; k++)
		{
			if (skill[k] < X)
			{
				// cout << "skill " << k << "\n";
				goto failed;
			}
		}
	success:
		result = min(result, money);
	failed:
		continue;
	}

	if (result == 1300000)
	{
		cout << "-1";
	}
	else
	{
		cout << result;
	}
	return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <string>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main(){
	int N, count;
	string S;
	cin >> N;
	cin >> S;
	count = 0;
	for(int i = 0; i < N-2; i++){
		if(S.substr(i, 3) == "ABC"){
			count++;
		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 256
//
// Created by Akifumi Ohata on 2017/09/30.
//


#include<iostream>
#include <vector>
#include <numeric>
#include <math.h>
#include <cmath>
#include<string>

using namespace std;

using ll =  long long int;

int main() {

    string S;


    cin >> S;

    unsigned long size_S = static_cast<int>(S.size());

    for(int iter=1;iter <=size_S;iter++){

        //S.erase(size_S-1);

        if((size_S -iter) %2 !=0) {
            continue;
        }else {

            unsigned long mid = ((size_S-iter) / 2);

            string part1;
            part1 = S.substr(0, mid-1 );

            string part2;
            part2 = S.substr(mid, mid-1 );

           // cout << part1 << " " << part2 << endl;

            if (part1 == part2) {

                cout <<  size_S - iter << endl;
                return 0;
            }
        }
    }

}

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

using namespace std;

int main(){
    int N;
    while(cin >> N){
        vector<long long> A(N);
        for(auto& t : A) cin >> t;
        int b = 0, c = 1, d = 2, e = 3;
        long long sumB = A[0], sumC = A[1], sumD = A[2], sumE = A[3];
        for(int i=4;i<N;i++) sumE += A[i];
        while(e < N-1){
            if(sumD + A[e] > sumE - A[e]) break;
            sumD += A[e];
            sumE -= A[e];
            e++;
        }
        long long res = (1LL << 60);
        while(true){
            for(int i=0;i<2;i++){
                if(c+i == d) continue;
                for(int j=0;j<2;j++){
                    if(e+j == N) continue;
                    long long B = sumB + (i == 0 ? 0 : A[c]);
                    long long C = sumC - (i == 0 ? 0 : A[c]);
                    long long D = sumD + (j == 0 ? 0 : A[e]);
                    long long E = sumE - (j == 0 ? 0 : A[e]);
                    long long M = max(max(B, C), max(D, E));
                    long long m = min(min(B, C), min(D, E));
                    res = min(res, M-m);
                }
            }
            sumC += A[d];
            sumD -= A[d];
            d++;
            if(d == N-1) break;
            while(e < N-1){
                if(d != e && sumD + A[e] > sumE - A[e]) break;
                sumD += A[e];
                sumE -= A[e];
                e++;
            }
            while(c < d-1){
                if(sumB + A[c] > sumC - A[c]) break;
                sumB += A[c];
                sumC -= A[c];
                c++;
            }
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        //N円の税抜き価格X円を知りたい！！
        //値段
        int n = sc.nextInt();
        
        //iが税抜き価格
        for(int i = 0;i <= n;i++){
            if((int)(i * 1.08) == n){
                System.out.println(i);
                return;
            }
        }
        
        System.out.println(":(");
    }
}




Measured memory_bytes: 35820
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long R, long long G) {
  cout << (2*G-R) << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long R,G;
  cin >> R >> G;
  solve(R, G);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
 
int main() {
  int b1[3][10]={0};
  int b2[3][10]={0};
  int b3[3][10]={0};
  int b4[3][10]={0};
  int b,f,r,v,i,j,n;
  cin >> n;
  for (int x=0;x<n;x++){
    cin >> b >> f >> r >> v ;
    if(b==1)b1[f-1][r-1]+=v;
    if(b==2)b2[f-1][r-1]+=v;
    if(b==3)b3[f-1][r-1]+=v;
    if(b==4)b4[f-1][r-1]+=v;
  }


  for(int i=0;i<3;i++){
    for(int j=0;j<10;j++)cout << " "<< b1[i][j] ;
      cout << endl;
  }
  printf("####################\n");
  for(int i=0;i<3;i++){
    for(int j=0;j<10;j++)cout << " "<< b2[i][j] ;
      cout << endl;
  }
  printf("####################\n");
  for(int i=0;i<3;i++){
    for(int j=0;j<10;j++)cout << " "<< b3[i][j] ;
      cout << endl;
  }
  printf("####################\n");
  for(int i=0;i<3;i++){
    for(int j=0;j<10;j++)cout << " "<< b4[i][j] ;
      cout << endl;
  } 
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int N;
int a[SIZE];

bool dp[41][4001];

int solve(int use) {
  memset(dp, 0, sizeof(dp));

  int tmp = a[use];
  a[use] = 0;

  dp[0][0] = true;

  int sum = 0;
  for (int i=0; i<N-1; i++) {
    for (int j=0; j<=sum; j++) {
      if (i < use) dp[i+1][j+a[i]] |= dp[i][j];
      dp[i+1][j] |= dp[i][j];
    }
    sum += a[i];
  }

  debug(sum);

  a[use] = tmp;

  int res = INF;

  for (int i=0; i<N-1; i++) {
    for (int j=0; j<=sum; j++) {
      int t = sum - j;

      if (!dp[N-1][j]) continue;

      if (j <= a[use] || t <= a[N-1]) continue;

      res = min(res, abs((t + a[N-1]) - (j + a[use])));
    }
  }

  return res;
}

int main(){

  cin >> N;

  for (int i=0; i<N; i++)
    cin >> a[i];

  sort(a, a+N);

  int ans = INF;

  for (int i=0; i<N-1; i++) {
    ans = min(ans, solve(i));
  }

  if (ans == INF) ans = -1;

  cout << ans << endl;

  return 0;
}



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

int main(){
  int n,a[1000001];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int ans[1000000];
  for(int i=0;i<n;i++){
    ans[a[i]-1]=i+1;
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n,k;
vector<int> nxt[2222];
int L[2222];
int B[2222];
int cntroot(int u, int p = -1, int l = 0, int b = -1) {
	L[u]=l;
	B[u]=b;
//	printf("u=%d, l=%d\n", u, l);
	int res = l > k/2;
	for(int v : nxt[u]) {
		if(v==p)
			continue;
		res += cntroot(v, u, l+1, p==-1?v:b);
	}
	return res;
}
int main() {
	scanf("%d %d", &n, &k);
	REP(i, n-1) {
		int u,v;
		scanf("%d%d", &u, &v);
		u--;v--;
		nxt[u].pb(v);
		nxt[v].pb(u);
	}
	int ans = 1<<20;
	REP(i, n) {
		int Z = cntroot(i);
		if(k%2==1) {
			vector<int> C(2222);
			REP(j, n) if(L[j]==k/2+1) {
				C[B[j]]++;
			}
			int mx = 0;
			REP(j, n) if(C[j]>C[mx]) {
				mx = j;
			}
			Z -= C[mx];
		}
		ans = min(ans, Z);
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int D;
vector<int> c(26);
int main()
{
    cin >> D;
    int s[366][28];
    int last[28];

    rep(i, 1, 27)
    {
        cin >> c[i];
    }
    rep(i, 1, D + 1)
    {
        rep(j, 1, 27)
        {
            cin >> s[i][j];
            last[j] = 0;
        }
    }
    vector<int> t(D + 1);
    vector<ll> tmp(D + 1);

    ll score = 0;
    ll maxi = 0;
    rep(i, 1, D + 1)
    {
        // rep(j, 1, 27) //i日目の満足度の最大値を求める
        // {
        //     score += s[i][j];
        //     // if (i != j)
        //     // {
        //     //     score -= c[j] * (i - last[j]);
        //     // }
        // }
        maxi = 0;
        rep(j, 1, 27)
        {
            if (maxi < s[i][j])
            {
                score = s[i][j];
                // cout << j << "," << score << endl;
                maxi = score;
                last[j] = i;
                t[i] = j;
            }
        }
    }

    rep(i, 1, D + 1)
    {
        cout << t[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3700
#include<cstdio>
using namespace std;
int n,m,x[100010],y[100010],i,j,k,ans[410],s[410][410];
int main()
{
	scanf("%d%d",&n,&m);
	for (i=1;i<=m;i++) scanf("%d%d",&x[i],&y[i]);
	for (i=1;i<=n;i++)
	{
		ans[i]=1;
		s[i][i]=1;
		for (j=m;j>=1;j--)//need to survive before the jth round?
		{
			if (s[i][x[j]]==0&&s[i][y[j]]==0) continue;
			if (s[i][x[j]]==1&&s[i][y[j]]==1) 
			{
				ans[i]=0;
				break;
			}
			s[i][x[j]]=1;s[i][y[j]]=1;
		}
	}
	int now=0;
	for (i=1;i<=n;i++)
	  for (j=i+1;j<=n;j++)
	  {
	  	if (ans[i]==0||ans[j]==0) continue;
	  	now++;
	  	for (k=1;k<=n;k++)
	  	  if (s[i][k]+s[j][k]>1)
	  	  {
	  	  	now--;
	  	  	break;
		  }
	  }
	printf("%d\n",now);
 } 

Measured memory_bytes: 1536
a,e=gets.chomp.split(' ').map{|n| n.to_i}
b,e=gets.chomp.split(' ').map{|n| n.to_i}
c,e=gets.chomp.split(' ').map{|n| n.to_i}
d,e=gets.chomp.split(' ').map{|n| n.to_i}
puts [a,b].min+[c,d].min


Measured memory_bytes: 1788
def abc176_d():
    h, w = map(int, input().split())
    ch, cw = map(lambda x: int(x)-1, input().split())
    dh, dw = map(lambda x: int(x)-1, input().split())
    grid = [[x for x in str(input())] for _ in range(h)]
    #print(*grid, sep='\n')
    area = [[-1]*w for _ in range(h)]
    aid = -1
    graph = []

    def dfs(i, j):
        nonlocal aid
        if area[i][j] > -1: return
        if grid[i][j] == '#': return
        area[i][j] = aid
        for dx in range(-2, 3):
            for dy in range(-2, 3):
                if 0 <= i+dx and i+dx < h and 0 <= j+dy and j+dy < w:
                    v = area[i+dx][j+dy]
                    if v > -1 and v != aid:
                        graph[aid].add(v)
                        graph[v].add(aid)
        for dx, dy in [(-1,0),(0,-1),(0,1),(1,0)]:
            if 0 <= i+dx and i+dx < h and 0 <= j+dy and j+dy < w:
                dfs(i+dx, j+dy)

    for i in range(h):
        for j in range(w):
            if grid[i][j] == '.' and area[i][j] == -1:
                aid += 1
                graph.append(set())
                dfs(i, j)

    #print(*area, sep='\n')
    #print(graph)

    from collections import deque
    s = area[ch][cw]
    que = deque([s])
    dist = [-1] * (aid+1)
    dist[s] = 0
    while que:
        u = que.popleft()
        for i in graph[u]:
            if dist[i] == -1:
                dist[i] = dist[u] + 1
                que.append(i)
    #print(dist)
    ans = dist[area[dh][dw]]
    print(ans)

if __name__ == '__main__':
    abc176_d()

Measured memory_bytes: 176516
#include <stdio.h>
#define N 100

int n,A[N][N],d[N],f[N]={0},t=0;
void visit(int);

int main(){
  int i,j,u,k,v;

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

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j] = 0;
    }
  }

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

    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u-1][v-1] = 1;

    }
  }

  for(i=0;i<n;i++){
    if(d[i] == 0) visit(i);
  }

  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }

  return 0;
}


void visit(int u){
  int i,j,v;
  t++;
  d[u] = t;
  for(v=0;v<n;v++){
    if(d[v] == 0 && A[u][v] == 1) visit(v);
  } 
  t++;
  f[u] = t;
}




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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

#define pll pair<ll,ll>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define rep(i,n) for (int i = 0; i < n; ++i) 
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl
#define sz(a) int((a).size())
#define endl '\n' // remove for interactive

const int INF = 1e9;
const ll mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}



void solve()
{
    ll s, w; cin>>s>>w;
    if(w >= s) cout<<"unsafe";
    else cout<<"safe";
}

int main()
{
    // clock_t start, end;
    // start = clock();
    ios_base::sync_with_stdio(0); //cant use scanf, printf
    cin.tie(0);cout.tie(0); // no longer auto flush cout before each cin, remove for interactive
    int t = 1;
    // cin>>t;
    REP(i, 1, t)
    {
        solve();
        
    }
    // end = clock();
    // double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    // watch(time_taken);
    ll x = INF; x++;
    return 0;
    
}



/*before sub
TEST: 0, 1, equal, -ve, bounds(random and ez)
ERR/WA: loop vars, out of bounds, endl, finish taking inputs, large doubles, larger INF, corr mod, t
RE: double dec, integer overflow(ll or 1LL mult)
*/





Measured memory_bytes: 3652
#include <bits/stdc++.h>
using i64 = long long;

constexpr i64 mod = 1000000007;

i64 n;
i64 dp[61][2][2][2];

// i桁以下の場合の数, N以下が確定しているか, i-th bitがk, i-th bitがmarkedか
i64 rec(int i, int j, int k, int l) {
    if (dp[i][j][k][l] >= 0) return dp[i][j][k][l];
    i64 ret = 0;
    if (i == 0) {
        if (!j && (n & 1) == 0 && k) ret = 0;
        else if (l && k) ret = 0;
        else ret = 1;
        return dp[i][j][k][l] = ret;
    }
    // 1, marked
    if ((j || ((1ll << (i - 1)) & n)) && (k || l)) {
        ret = rec(i - 1, j, 1, 1);
    }
    // 1, not marked
    if ((j || ((1ll << (i - 1)) & n)) && !(k && l)) {
        ret = (ret + rec(i - 1, j, 1, 0)) % mod;
    }
    // 0, marked
    if (k || l) {
        ret = (ret + rec(i - 1, ((1ll << (i - 1)) & n) || j, 0, 1)) % mod;
    }
    // 0, not marked
    if (!(k && l)) {
        ret = (ret + rec(i - 1, ((1ll << (i - 1)) & n) || j, 0, 0)) % mod;
    }
    return dp[i][j][k][l] = ret;
}

int main() {
    std::cin >> n;
    for (auto &a : dp) for (auto &b : a) for (auto &c : b) for (auto &e : c) e = -1;
    std::cout << rec(60, 0, 0, 0) << std::endl;

    return 0;
}


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

vector< vector <unsigned int> > formulae;
int ans[(1<<17)];

void init(){
  for(unsigned int i = 0 ; i < (1 << 17) ; i++){
    ans[i] = -1;
  }

  for(int n = 1 ; n < 17 ; n++){
    if(n == 1){
      formulae[1].push_back(0b0000000000000000);
      formulae[1].push_back(0b1111111111111111);
      formulae[1].push_back(0b0000000011111111);
      formulae[1].push_back(0b0000111100001111);
      formulae[1].push_back(0b0011001100110011);
      formulae[1].push_back(0b0101010101010101);
    }else{
      for(int i=0 ; i<formulae[n-1].size() ; i++){
        formulae[n].push_back((~formulae[n-1][i])%(1<<16));
      }
      if(n > 4){
        for(int k=1 ; k<n-3 ; k++){
          for(int i=0 ; i<formulae[k].size() ; i++){
            for(int j=0 ; j<formulae[n-3-k].size() ; j++){
              formulae[n].push_back(formulae[k][i] ^ formulae[n-3-k][j]);
              formulae[n].push_back(formulae[k][i] & formulae[n-3-k][j]);
            }
          }
        }
      }
    }
  }
}

unsigned int eval(string s, int ptr){
  if(s[ptr] == '0'){ return 0b0000000000000000; }
  else if(s[ptr] == '1'){ return 0b1111111111111111; }
  else if(s[ptr] == 'a'){ return 0b0000000011111111; }
  else if(s[ptr] == 'b'){ return 0b0000111100001111; }
  else if(s[ptr] == 'c'){ return 0b0011001100110011; }
  else if(s[ptr] == 'd'){ return 0b0101010101010101; }
  else if(s[ptr] == '-'){
    unsigned int e = eval(s,ptr+1);
    return ((~e)%(1<<16));
  } else {
    int op = ptr; int kakko = 0; bool done=false;
    while(!done){
      op++;
      if(kakko == 0){
        if((s[op] == '*' || s[op] == '^')){
          done=true;
        }
      }
      if (s[op]=='(') {kakko++;} else if(s[op]==')') {kakko--;}
    }
    unsigned int e1 = eval(s,ptr+1);
    unsigned int e2 = eval(s,op+1);
    if(s[op] == '^'){
      return e1^e2;
    }else{
      return e1&e2;
    }
  }
}

int main(void){
  formulae.resize(17);
  init();
  for(int i = 1 ; i < 17 ; i++){
    for(int j = 0 ; j < (formulae[i].size()) ; j++){
      unsigned int e = formulae[i][j];
//      cout << ":" << e << endl;
      if(ans[e] == -1){ans[e] = i;}
    }
  }
  for(;;){
    string s;
    cin >> s;
    if(s == "."){return 0;}
    unsigned int e = 0;
    e += eval(s,0);
    cout << ans[e] << endl;
  }
  return 0;
}



Measured memory_bytes: 46732
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

auto g = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0];

void main()
{
  int x, y; readV(x, y); --x; --y;
  writeln(g[x] == g[y] ? "Yes" : "No");
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, T = LI()
    AB = []
    for i in range(N):
        _a, _b = LI()
        AB.append((_a, _b))
    AB = sorted(AB, key=lambda x: (x[0], x[1]))
    a = [elem[0] for elem in AB]
    b = [elem[1] for elem in AB]

    dp = [[0 for _ in range(T + 3001)] for _ in range(N+1)]
    for i in range(N):
        for t in range(T):
            dp[i+1][t+a[i]] = max(dp[i+1][t+a[i]], dp[i][t] + b[i])
            dp[i+1][t] = max(dp[i+1][t], dp[i][t])
    ans = 0
    for i in range(N+1):
        for j in range(T + 3001):
            ans = max(dp[i][j], ans)
    print(ans)
main()



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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

int main(){
		long long h,i,w;
		long long ans=200000000000000;
		scanf("%lld%lld",&h,&w);
		if((h*w)%3==0){
			puts("0");
			return 0;
		}
		for(i=1;i<=h/2;i++){
			long long a=i*w;
			long long b=(h-i)*(w/2);
			long long c=h*w-a-b;
			ans=min(ans,(max(a,max(b,c))-min(a,min(c,b))));
		}
		for(i=1;i<=w/2;i++){
			long long a=i*h;
			long long b=(w-i)*(h/2);
			long long c=h*w-a-b;
			ans=min(ans,(max(a,max(b,c))-min(a,min(c,b))));
		}
		ans=min(ans,w);
		ans=min(ans,h);
		printf("%lld\n",ans);
		return 0;
}


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

int main(){
    int a,b,c,d;
    cin>>a >> b>> c>> d;
    int ta = ((c/b) + ((c % b != 0)? 1 : 0));
    int aok =  ((a /d) + ((a%d != 0 )? 1 : 0));
    //cout<<ta << " "<<aok <<endl;
    if(ta <= aok)
        cout<< "Yes"<< endl;
    else
        cout<< "No"<< endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  bool ok = false;
  srep(i,1,B+1) {
    if(A * i % B == C) ok = true;
  }
  if(ok) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();
    
    int h, r;
    cin >> h >> r;
    if (h + r > 0)cout << "1\n";
    else if (h + r < 0)cout << "-1\n";
    else cout << "0\n";
}


Measured memory_bytes: 3112
tmp = input()
nu = tmp.rfind(' ')

Age = tmp[:nu:]
Bill = tmp[nu+1::]

Age = int(Age)

if(Age >= 13):
  print(int(Bill))
elif(Age <= 12):
  if(Age >= 6):
    print(int(int(Bill) / 2))
  else:
    print(int(0))

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

int main() {
  string s, t;
  cin >> s;
  
  for(int i = 0; i < s.length() ; i++) {
  	if(s.at(i) == '0') {
    	t += '0';
    }
  
  	else if(s.at(i) == '1') {
    	t += '1';
    }
  
  	else{
    	if(!t.empty()) {
        	t.pop_back();
        }
    }
  }
  
  cout << t << endl;
}

Measured memory_bytes: 256
from collections import deque

N = int(input())
c = list(input())
w_index = deque([i for i, x in enumerate(c) if x == 'W'])
r_index = deque([i for i, x in enumerate(c) if x == 'R'])

if len(w_index) == 0 or len(r_index) == 0:
    print(0)
    exit()

ans = 0

while w_index[0] < r_index[-1]:
    l = w_index.popleft()
    r = r_index.pop()
    w_index.append(r)
    r_index.appendleft(l)
    ans += 1
print(ans)


Measured memory_bytes: 20344
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define REP(i,a,b) for(register int i=(a); i<(b); i++)
#define REPE(i,a,b) for(register int i=(a); i<=(b); i++)
#define PERE(i,a,b) for(register int i=(a); i>=(b); i--)
using namespace std;
#define MAXN 5007
int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main() {
	int k; scanf("%d", &k);
	printf("%d\n", a[k-1]);
}


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

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

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int H, W, D;
    std::cin >> H >> W >> D;

    vector<pair<int, int>> table(H * W + 1);
    REP(hi, H) {
        REP(wi, W) {
            int a;
            std::cin >> a;
            table[a] = make_pair(hi, wi);
        }
    }

    auto calc_L1 = [](const pair<int, int>& l, const pair<int, int>& r) -> ll {
                       return abs(l.first - r.first) + abs(l.second - r.second);
                   };

    vector<vector<ll>> sum_table(D, vector<ll>(1, 0));
    REP(i, D) {
        auto& prev = table[i];
        for(int j = i + D; j <= H * W; j += D) {
            sum_table[i].push_back(sum_table[i].back() + calc_L1(table[j], prev));
            prev = table[j];
        }
    }

    int Q;
    std::cin >> Q;

    REP(i, Q) {
        int l, r;
        std::cin >> l >> r;
        auto mod = l % D;
        std::cout << sum_table[mod][r / D] - sum_table[mod][l / D] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    vector<int> c(n);
    vector<int> sa(n);
    rep(i,n){
        cin >> v[i];
        
    }
    rep(i,n){
        cin >> c[i];
        sa[i]=v[i]-c[i];
    }
    sort(sa.begin(),sa.end());
    reverse(sa.begin(),sa.end());
    int sum=0;
    rep(i,n){
        if(sa[i]>=0){
        sum += sa[i];
        }
        else{
            break;
        }
    }
    cout <<sum<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char s[4];
    scanf("%s",&s);
    int i,j,count=0 , count2 = 0;

        if(s[i] == s[i+1] && s[i+1] == s[i+2] && s[i+2] == s[i+3]){
            printf("No");
        }
        else if(s[i]== s[i+1]){
            if(s[i+2] == s[i+3]){
                    printf("Yes");
            }
            else{
                printf("No");
            }
        }else if(s[i] == s[i+2]){
            if(s[i+1]== s[i+3]){
                printf("Yes");
            }else{
                printf("No");
            }
        }else if(s[i] == s[i+3]){
            if(s[i+1] == s[i+2]){
                printf("Yes");
            }        else{
                printf("No");
            }
        }else{
            printf("No");
        }


}


Measured memory_bytes: 128
#include <stack>
#include <iostream>
#include <algorithm>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;

const int N=1e6+5,mod=1000000007;
int n,k,d,a[N],vs[N],c;
int main() {
	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);
	cin>>n>>k;
	for (int i=0;i<k;i++) {
		cin>>d;
		for (int j=0;j<d&&cin>>a[j];j++) vs[a[j]]=1;
	}
	for (int i=1;i<=n;i++) if (vs[i]==0) c++;
	cout<<c;
	return 0;
}


Measured memory_bytes: 3656
# Aizu Problem 0026: Dropping Ink
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


paper = [[0 for col in range(10)] for row in range(10)]

# ink forms: 1=small, 2=medium, 3=large
ink_forms = {1: [[0, 0], [-1, 0], [1, 0], [0, -1], [0, 1]],
             2: [[-1, -1], [-1, 0], [-1, 1],
                 [0, 1], [0, 0], [0, -1],
                 [1, -1], [1, 0], [1, 1]],
             3: [[-1, -1], [-1, 0], [-1, 1],
                 [0, 1], [0, 0], [0, -1],
                 [1, -1], [1, 0], [1, 1],
                 [-2, 0], [2, 0], [0, -2], [0, 2]]}

while True:
    try:
        x, y, s = [int(_) for _ in input().split(',')]
    except EOFError:
        break
    for x_off, y_off in ink_forms[s]:
        x1 = x + x_off
        y1 = y + y_off
        if 0 <= x1 < 10 and 0 <= y1 < 10:
            paper[x1][y1] += 1

print(sum([row.count(0) for row in paper]))
print(max([max(row) for row in paper]))

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

            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];
double dist(ll i, ll j)
{
    double dx=x[i]-x[j];
    double dy=y[i]-y[j];
    return pow(dx*dx+dy*dy,0.5);
}

int main()
{
   ll n,i,j;
   cin>>n;
   for(i=1;i<=n;i++){
        cin>>x[i]>>y[i];
   }
   vector<ll>v;
   for(i=0;i<n;i++)v.pb(i+1);

   ll k=1;
   for(i=1;i<=n;i++)k*=i;

    double sum=0.0;
   do{
        for(i=0;i<n-1;i++){
            sum+=dist(v[i],v[i+1]);
        }
   }while(next_permutation(v.begin(),v.end()));
   //cout<<sum<<endl;
   cout<<fixed<<setprecision(10)<<sum*1.0/k*1.0<<endl;
return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
vector<int> vec[100001], deg(100001), dp(100001);

int dfs(int node){
    for(int u : vec[node]){
        if(dp[u]){
            dp[node]=max(dp[node], dp[u]+1);  continue;
        }
        dp[node]=max(dp[node], dfs(u)+1);
    }
    return dp[node]=max(dp[node], 1);
}

int main(){
    ios::sync_with_stdio(false);    cin.tie(NULL);  cout.tie(NULL);
    int n, m;   cin >> n >> m;
    for(int i=0;m>i;i++){
        int a, b;   cin >> a >> b;
        vec[a].push_back(b);    deg[b]++;
    }
    for(int i=1;n>=i;i++){
        if(deg[i]){
            continue;
        }
        dfs(i);
    }
    int ans=0;
    for(int i=1;n>=i;i++){
        ans=max(ans, dp[i]);
        //cout << dp[i] << " "; 
    }
    cout << ans-1;
}

Measured memory_bytes: 11136
fn run() {
    proconio::input! {
        n: u64,
    }
    let mut ans = 0;
    let mut i = 1;
    while i * i <= n {
        let p = n / i;
        ans += i * p * (p + 1) / 2;
        i += 1;
    }
    i = n / i;
    while i > 0 {
        let x = n / i;
        let y = n / (i + 1);
        ans += i * (i + 1) / 2 * (x * (x + 1) / 2 - y * (y + 1) / 2);
        i -= 1;
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i <= m; ++i) {
		for (int j = 0; j <= n; ++j) {
			if (i * (n - j) + j * (m - i) == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	private static final boolean TEST = false;

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		while (true) {
			int n = in.nextInt();
			int k = in.nextInt();
			String s = in.next();
			System.out.println(solve(n, k, s));
			if (!TEST)
				break;
		}
		in.close();
	}

	private static int solve(int n, int k, String s) {
		int[] sv = new int[s.length()];
		int c = 1;
		int si = 0;
		for (int i = 1; i < s.length(); i++) {
			if (s.charAt(i) != s.charAt(i - 1))
				sv[si++] = c;
			c++;
		}
		sv[si] = c;

		int ans = 0;
		if (s.charAt(0) == '0') {
			ans = sv[Math.min(k * 2 - 1, si)];
			for (int i = 0; i <= si; i += 2)
				ans = Math.max(ans, sv[Math.min(i + 2 * k + 1, si)] - sv[i]);
		} else {
			ans = sv[Math.min(k * 2, si)];
			for (int i = 1; i <= si; i += 2)
				ans = Math.max(ans, sv[Math.min(i + 2 * k + 1, si)] - sv[i]);
		}
		return ans;
	}
}


Measured memory_bytes: 26984
n = int(input())
a = sorted(list(map(int,input().split())))
am = a[-1]+1
b = [0]*am
for i in a:
    b[i]+=1
    if b[i]==1:
        for j in range(i*2,am,i):
            b[j]=2
print(b.count(1))

Measured memory_bytes: 32184
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n,tv,hv,l,t[100],h[100];
	cin >> n >> tv >> hv >> l;
	for (int i=0;i<n;i++)
		cin >> t[i] >> h[i];
	int turn=0;
	int m=0;
	while(1)
	{
		int i=turn%n;
		if(t[i]==0&&h[i]==0)
		{
			cout << i+1 << endl;
			break;
		}
		else if(t[i]!=0)
		{
			tv++;
			t[i]--;
			m+=10;
		} else {
			hv++;
			h[i]--;
			m+=100;
		}
		if(tv>l)
		{
			cout << i+1 << endl;
			break;
		}
		if(m>=90)
		{
			int dif=m-90;
			int tdif=min(dif/10,tv);
			tv-=tdif;
			t[i]+=tdif;
			m=0;
		}
		turn++;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, a, b) for(int i=a; i<b; i++)
#define per(i, a, b) for(int i=b-1; i>=a; i--)
#define ifor(n) for(int i=0;i<n;i++) 
#define jfor(n) for(int j=0;j<n;j++)
#define Ifor(n) for(int i=1;i<n;i++) 
#define Jfor(n) for(int j=1;j<n;j++)
const int inf=0x3f3f3f3f;
int main(){
	int n,r;
	cin>>n>>r;
	if(n>=10)cout<<r<<endl;
	else cout<<100*(10-n)+r<<endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=2e5+50;

int n,m,z,a[N],c[N];

void chk(bool e){
	if(!e){
		puts("Impossible"); 
		exit(0); 
	}
}
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	scanf("%d",&n); 
	rep(i,1,n){
		scanf("%d",a+i); 
		++c[a[i]]; 
		cmax(m,a[i]);
	}
	for(z=m;c[z-1];--z);
	if((m+1)%2==1)chk(z==m/2&&c[z]==1);
	if((m+1)%2==0)chk(z==(m+1)/2&&c[z]==2);
	rep(i,z+1,m)chk(c[i]>=2);
	puts("Possible"); 
	return 0;
}

Measured memory_bytes: 256
h,w,k=gets.split.map &:to_i

hs = []
ws = []
m = []

h.times{
	m << gets.chomp.split("")
}

(0..h).each{ |i|
	hs += (0...h).to_a.combination(i).to_a
}

(0..w).each{ |i|
	ws += (0...w).to_a.combination(i).to_a
}

result = 0

hs.each{ |hc|
	ws.each{ |wc|
		count = 0
		(0...h).each{ |i|
			if hc.include?(i) then
				next
			end
			
			m[i].each_with_index{ |mx,j|
				if mx == "#" && ! wc.include?(j) then
					count += 1
				end
			}
		}
		
		if count == k then
			result += 1
		end
	}
}

puts result

Measured memory_bytes: 14336
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		int n = Integer.parseInt(st.nextToken());
 		int m = Integer.parseInt(st.nextToken());
 		int t = Integer.parseInt(st.nextToken());
 		
 		int numb = (n+m-1)/m;
 		out.println(numb*t);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 25436
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) b.rbegin(),v.rend()
typedef long long ll;
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b;
  cin >> a >> b;
  cout << max(max(a+b,a-b),a*b) << endl;
}

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

using namespace std;

int main()
{
    string S;
    cin >> S;
    bool A = false;
    bool B = false;
    for(int i = 0; i < S.length(); i++)
    {
        if(S[i] == 'A') A = true;
        else    B = true;
    }
    if(A && B) cout << "Yes" << endl;
    else    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a,i,n[1000000];
    scanf("%d",&a);
    for(i=0;i<a;i++){
        scanf("%d",&n[i]);
    }
    long max = n[0];
    for(i=0;i<a-1;i++){
        if(max < n[i+1]){
            max = n[i+1];
        }
    }
    long min = n[0];
    for(i=0;i<a-1;i++){
        if(min > n[i+1]){
            min = n[i+1];
        }
    }
    long sum = 0;
    for(i=0;i<a;i++){
        sum += n[i];
    }
    printf("%ld %ld %ld\n",min,max,sum);
    return 0;
}




Measured memory_bytes: 1976
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {

	
    public static void main(String[] args) {
    	
        Scanner in = new Scanner(System.in);
        
        int N = in.nextInt();
        int[] A = new int[N];
        long distance = 0;
        
        for(int i = 0;i<N;i++){
        	A[i] = in.nextInt();
        	if(i==0)
        		distance += Math.abs(A[i]);
        	else if(i!=0)
        		distance += Math.abs(A[i]-A[i-1]);
        }
        	distance += Math.abs(A[N-1]);
        	
        int dis = 0;
        
        for(int i = 0;i<N;i++){
        	
        	if(i==0)
        		dis = Math.abs(A[i])+Math.abs(A[i]-A[i+1])-Math.abs(A[i+1]);
        	else if(i==N-1)
        		dis = Math.abs(A[i]-A[i-1])+Math.abs(A[i])-Math.abs(A[i-1]);
        	else
        		dis = Math.abs(A[i]-A[i-1])+Math.abs(A[i]-A[i+1])-Math.abs(A[i+1]-A[i-1]);
        		
        	System.out.println(distance-dis);
        
        }
        in.close();
    }

	
}


Measured memory_bytes: 66608
n,a,b,c,d=map(int,input().split())
dp=[0]*(n+1)
dp[0]=1
mod=10**9+7
N=n
fac=[1]*(N+3)
inv=[1]*(N+3)
t=1
for i in range(1,N+3):
    t*=i
    t%=mod
    fac[i]=t
t=pow(fac[N+2],mod-2,mod)
for i in range(N+2,0,-1):
    inv[i]=t
    t*=i
    t%=mod
def comb(n,r):
    if r>n or r<0:
        return 0
    return fac[n]*inv[n-r]*inv[r]%mod

for i in range(a,b+1):
    for j in range(n,i*c-1,-1):
        for k in range(max(j-i*d,j%i),j-i*c+1,i):
            l=((j-k)//i)
            dp[j]+=dp[k]*fac[n-k]%mod*inv[n-j]*inv[l]%mod*pow(inv[i],l,mod)
            dp[j]%=mod
print(dp[-1])

Measured memory_bytes: 50268
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

typedef vector<int> vec;
typedef vector<vec> mat;

mat matmul(mat& a, mat& b) {
  mat c(a.size(), vec(b[0].size(), 0));
  rep(i, a.size()) {
    rep(k, b.size()) {
      rep(j, b[0].size()) {
        c[i][j] |= a[i][k] & b[k][j];
      }
    }
  }
  return c;
}

mat matpow(mat a, ll n) {
  mat b(a.size(), vec(a.size(), 0));
  rep(i, a.size()) b[i][i] = 1;
  while (n > 0) {
    if (n & 1) b = matmul(b, a);
    a = matmul(a, a);
    n >>= 1;
  }
  return b;
}

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

  while (1) {
    int n, m, z;
    cin >> n >> m >> z;
    if (n == 0 && m == 0 && z == 0) return 0;
    
    vector<int> s(2 * m), d(2 * m);
    rep(i, m) {
      cin >> s[i] >> d[i];
      s[i]--, d[i]--;
      s[i + m] = d[i], d[i + m] = s[i];
    }
    mat res(2 * m + 1, vector<int>(2 * m + 1, 0));
    rep(i, 2 * m) {
      rep(j, 2 * m) {
        if (d[i] == s[j] && abs(i - j) != m) res[i][j] = 1;
      }
    }
    rep(j, 2 * m) {
      if (s[j] == 0) res[2 * m][j] = 1;
    }
    res = matpow(res, z);
    bool ans = false;
    rep(j, 2 * m) {
      if (d[j] == n - 1 && res[2 * m][j]) ans = true;
    }
    cout << (ans ? "yes" : "no") << '\n';
  }





  
  return 0;
}


Measured memory_bytes: 3100
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		List<Integer> list = new ArrayList<Integer>();
		for(;;){
			int x = scan.nextInt();
			if(x == 0){
				break;
			}
			list.add(x);
		}

		for(int i = 0; i < list.size(); i++){
			System.out.printf("Case %d: %d\n", i + 1, list.get(i));
		}
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e18
#define mod 1000000007

struct edge{
  ll f,t,c;
};

ll n,m,s,t;
ll d1[101010],cnt1[101010];
ll d2[101010],cnt2[101010];
vector<P> g[101010];
vector<edge> es;
bool used[101010];

int main(){
  cin>>n>>m>>s>>t;
  s--; t--;
	rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--; b--;
    g[a].push_back(P(b,c));
    g[b].push_back(P(a,c));
    es.push_back((edge){a,b,c});
  }
  {
    rep(i,n)d1[i]=INF;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s));
    d1[s]=0;
    cnt1[s]=1;
    while(que.size()){
      ll nd=que.top().fi,v=que.top().se; que.pop();
      if(d1[v]<nd)continue;
      for(P e : g[v]){
        ll u=e.fi,c=e.se;
        if(d1[u]==nd+c){
          (cnt1[u]+=cnt1[v])%=mod;
        }else if(d1[u]>nd+c){
          d1[u]=nd+c;
          cnt1[u]=cnt1[v];
          que.push(P(nd+c,u));
        }
      }
    }
  }
  {
    rep(i,n)d2[i]=INF;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,t));
    d2[t]=0;
    cnt2[t]=1;
    while(que.size()){
      ll nd=que.top().fi,v=que.top().se; que.pop();
      if(d2[v]<nd)continue;
      for(P e : g[v]){
        ll u=e.fi,c=e.se;
        if(d2[u]==nd+c){
          (cnt2[u]+=cnt2[v])%=mod;
        }else if(d2[u]>nd+c){
          d2[u]=nd+c;
          cnt2[u]=cnt2[v];
          que.push(P(nd+c,u));
        }
      }
    }
  }
  ll tot=d1[t];
  ll res=cnt1[t]*cnt2[s]%mod;
  rep(i,n){
    if(d1[i]*2==tot){
      ll cnt=(cnt1[i]*cnt2[i])%mod;
      res=(res-((cnt*cnt)%mod)+mod)%mod;
    }
  }
  rep(i,es.size()){
    ll u=es[i].f,v=es[i].t,c=es[i].c;
    if(d1[u]>d1[v])swap(u,v); // d1[u] < d1[v];
    if(d1[u]*2<tot&&tot<d1[v]*2&&d1[u]+d2[v]+c==tot){
      ll cnt=(cnt1[u]*cnt2[v])%mod;
      res=(res-((cnt*cnt)%mod)+mod)%mod;
    }
  }
  cout<<res<<endl;
	return 0;
}


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

int main() {
    int a, b;
    char op;
    cin >> a >> op >> b;

    if (op == '+')
        cout << a + b << endl;
    else
        cout << a - b << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <stdlib.h>
#include <climits>
using namespace std;
int main()
{
	long int n,m,max1,ans;
	max1=INT_MAX;
	cin>>n>>m;
	int index[n];
	pair <long int,long int >p[n];
	pair <long int ,long int> q[m];
	for(int i =0 ;i <n ; i++)
	{
		cin>>p[i].first;
		cin>>p[i].second;
	}
	for(int i=0;i <m; i++)
	{
		cin>>q[i].first;
		cin>>q[i].second;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			
		int ans1 =abs(p[i].first-q[j].first);
		 int ans2= abs(p[i].second - q[j].second);
		 ans =ans1 +ans2;
		if(ans<max1){
			max1=ans;
			index[i] = j+1;
	
		}
	}
		max1 =INT_MAX;
		
	
}
for(int i=0; i<n;i++)
cout<<index[i]<<"\n";
}


Measured memory_bytes: 256