akhauriyash/Code-Regression huggingface dataset:
### constant

MAXGE = 10

### main

n, k = gets.strip.split(' ').map{|s| s.to_i}

books = MAXGE.times.map{[]}
nge = 0

n.times do
  ci, gi = gets.strip.split(' ').map{|s| s.to_i}
  books[gi - 1] << ci
  nge = gi if nge < gi
end

for g in (0...nge)
  books[g].sort!{|a, b| b <=> a}
end
#p nge
#p books

costs = [0]

for g in (0...nge)
  bs = books[g]
  bslen = bs.length

  costs0 = costs.clone
  clen = costs.length

  csum = 0

  for nbk in (0...bslen)
    csum += bs[nbk]
    csum0 = csum + nbk * (nbk + 1)

    for i in (0...clen)
      j = i + nbk + 1
      break if j > k
      nc = costs[i] + csum0
      if costs0[j].nil? || costs0[j] < nc
        costs0[j] = nc
      end
    end
  end

  costs = costs0
  #p [g, costs]
end

puts costs[k]

Measured memory_bytes: 6156
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int y,m,d;
string s="";

string tostr(int t) { 
   ostringstream os; os<<t; 
   return os.str(); 
}

int main(){
	while(cin >> y >> m >> d){
		s = tostr(y);

		if(m/10 == 0){
			s += "/0" + tostr(m);
		}else{
			s += '/' + tostr(m);
		}


		if(d/10 == 0){
			s += "/0" + tostr(d);
		}else{
			s += '/' + tostr(d);
		}

		if(s >= "1989/01/08"){
			printf("heisei %d %d %d\n",y-1989+1,m,d);
		}else if(s >= "1926/12/25"){
			printf("showa %d %d %d\n",y-1926+1,m,d);
		}else if(s >= "1912/07/30"){
			printf("taisho %d %d %d\n",y-1912+1,m,d);
		}else if(s >= "1868/09/08"){
			printf("meiji %d %d %d\n",y-1868+1,m,d);
		}else{
			printf("pre-meiji\n");
		}

	}
}

Measured memory_bytes: 3240
import java.util.*;
import java.lang.*; 
class Main{
	public static void main(String[] args){
		int x=0;
		Scanner input=new Scanner(System.in);
	int a[]=new int [3];
	for(int i=0; i<3; i++)
	{
		a[i]=input.nextInt();
	}
	for(int j=0;j<3;j++)
	{
		x=x+a[j];
	}
		if(x==17)
		{
			System.out.println("YES");
		}
		else{System.out.println("NO");}
	}
}



Measured memory_bytes: 21844
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	scan := newScanner()
	S := scan.nextLine()
	s := []byte(S)
	var a [26][]int
	for i := 0; i < len(s); i++ {
		k := s[i] - 'a'
		a[k] = append(a[k], i)
	}
	// log.Println(a)
	ans := 1 << 30
	for i := 0; i < 26; i++ {
		if len(a[i]) == 0 {
			continue
		}
		ansn := make([]int, len(s))
		for j := 0; j < len(s); j++ {
			var hit bool
			for k := 0; k < len(a[i]); k++ {
				if a[i][k] == j {
					goto NEXT
				}
				if j < a[i][k] {
					ansn[j] = a[i][k] - j
					hit = true
					break
				}
			}
			if !hit {
				ansn[j] = len(s) - j
			}
		NEXT:
		}
		// log.Println(ansn)
		ans = min(ans, smax(ansn))
	}
	fmt.Println(ans)
}

func zero(a int) int {
	if a == 0 {
		return 0
	} else if a > 0 {
		return 1
	} else {
		return -1
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func smax(a []int) int {
	r := a[0]
	for i := 1; i < len(a); i++ {
		r = max(r, a[i])
	}
	return r
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}

func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main() {
	long long n;
	vector <long long> val(5);
	long long x=0;
	
	cin >> n;

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

	x = (n-1)/(*min_element(val.begin(), val.end())) + 5;
	//cout << *min_element(val.begin(), val.end()) << endl;

	cout << x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL); cout.tie(NULL);}
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
 
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
	cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) {
	cin >> p.first;
	return cin >> p.second;
}
 
mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(61378913);
/* usage - just do rng() */
 
void usaco(string filename) {
  // #pragma message("be careful, freopen may be wrong")
	freopen((filename + ".in").c_str(), "r", stdin);
	freopen((filename + ".out").c_str(), "w", stdout);
}
 
const lld pi = 3.14159265358979323846;
// const ll mod = 1000000007;
// const ll mod = 998244353;
// ll mod;
 


ll n, m, k, q, l, r, x, y, z;
const ll template_array_size = 1000625;
ll a[template_array_size];
ll b[template_array_size];
ll c[template_array_size];
string s, t;
ll ans = 0;

vector<ll> in_row[300005];
multiset<ll> best;

void upd(ll pos, ll delta) {
	best.erase(best.find(c[pos]));
	c[pos] += delta;
	best.insert(c[pos]);
}

void solve(int tc = 0) {
	cin >> n >> m >> k;
	
	for (ll i = 0; i < m; i++) {
		c[i] = 0;
		best.insert(0);
	}
	
	for (ll i = 0; i < k; i++) {
		cin >> x >> y;
		--x; --y;
		in_row[x].push_back(y);
		upd(y, 1);
	}
	
	ans = 0;
	for (ll i = 0; i < n; i++) {
		ll cur = in_row[i].size();
		
		for (ll x: in_row[i]) {
			upd(x, -1);
		}
		
		if (best.size()) {
			cur += *best.rbegin();
		}
		
		ans = max(ans, cur);
		
		for (ll x: in_row[i]) {
			upd(x, 1);
		}
	}
	
	cout << ans << '\n';
}
 
int main() {
	#ifdef galen_colin_local
		auto begin = std::chrono::high_resolution_clock::now();
	#endif
	
	send help
 
	#ifndef galen_colin_local
		// usaco("cowland");
	#endif
	
	// usaco("cowland");
 
	int tc = 1;
	// cin >> tc;
	for (int t = 0; t < tc; t++) solve(t);
	
	#ifdef galen_colin_local
		auto end = std::chrono::high_resolution_clock::now();
		cout << setprecision(4) << fixed;
		// cout << "Execution time: " << std::chrono::duration_cast<std::chrono::duration<double>>(end - begin).count() << " seconds" << endl;
	#endif
} 


Measured memory_bytes: 36456
a,b,c,d=input()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a+b+c+d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a+b-c+d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b-c-d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b+c+d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c-d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a-b-c-d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;
int n, l, r, q[maxn], vis[maxn];

vector <int> e[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1, u, v; i < n; i++) {
        scanf("%d %d", &u, &v);
        e[u].push_back(v), e[v].push_back(u);
    }
    l = 1, r = 0;
    vis[1] = 1;
    vis[n] = 2;
    q[++r] = 1;
    q[++r] = n;
    for (; l <= r; ) {
        int u = q[l++];
        for (int v : e[u]) {
            if (!vis[v]) {
                vis[v] = vis[u];
                q[++r] = v;
            }
        }
    }
    int sum1 = 0, sum2 = 0;
    for (int i = 1; i <= n; i++) {
        if (vis[i] == 1) {
            sum1++;
        } else {
            sum2++;
        }
    }
    puts(sum1 > sum2 ? "Fennec" : "Snuke");
    return 0;
}

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

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			int n = int.Parse(str[0]);
			int k = int.Parse(str[1]);

			//List<int> data = new List<int>(n);
			int[] data = new int[n];
			for (int i = 0; i < n; i++)
			{
				int input = int.Parse(Console.ReadLine());
				data[i] = input;
			}
			List<int> sorted = data.ToList();
			sorted.Sort();

			int min = 999999999;
			int num = n - k;
			for(int i = 0; i <= num; i++)
			{
				int n1 = sorted[i];
				int n2 = sorted[i + k-1];
				if (min > n2 - n1)
				{
					min = n2 - n1;
				}
			}

			Console.WriteLine(min);
		}
	}
}

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

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

    int ans = 1;

    for(int i = 1; i <= n; i++){
        ans = min(2 * ans, ans + k);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np

h,w=map(int,input().split())
zentai=[list(input()) for i in range(h)]

for z in zentai[:]:
  if "#" not in z:
    zentai.remove(z)

tr=np.array(zentai)
tr=tr.T
tr=tr.tolist()

for z in tr[:]:
  if "#" not in z:
    tr.remove(z)

tr=np.array(tr)
tr=tr.T
tr=tr.tolist()

for i in tr:
  print("".join(i))

Measured memory_bytes: 12540
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long cost(long long* A, const long long& index, const long long& area){
  if (area==0 || area==4) {
    return A[index];
  } else if (area==1 || area==3) {
    if (A[index]==0) {
      return 2;
    } else if(A[index]%2==0) {
      return 0;
    } else {
      return 1;
    }
  } else if (area==2){
    if (A[index]%2==0){
      return 1;
    } else {
      return 0;
    }
  }
}

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

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

  vector< vector<long long> > dp;
  dp.resize(n);
  for(long long i=0; i<n; i++){
    dp[i].resize(5);
  }

  for(int j=0;j<5;j++){
    dp[0][j] = cost(A,0,j);
  }

  for(long long i=1;i<n;i++){
    dp[i][0] = dp[i-1][0]+cost(A,i,0);
    for(int j=1;j<5;j++){
      long long mindp = *std::min_element(dp[i-1].begin(), dp[i-1].begin()+j+1);
      dp[i][j] = min(mindp+cost(A,i,j), dp[i][j-1]);
    }
  }

  long long ans = *std::min_element(dp[n-1].begin(), dp[n-1].end());
  cout << ans << endl;

  return 0;
}

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

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int MAX = 1E6 + 10;
int pr[MAX];

int main() {
	int res = 0;
	int n;
	cin >> n;

	for(int i = 2; i < MAX; i++) {
		if(pr[i])
			continue;
		for(int j = i; j < MAX; j += i)
			pr[j] = i;
		// for(int i = 1; i <= 1000; i++) {
	}
	// 	for(int j = 1; j <= 1000; j++) {
	// 		if(n - i * j > 0)
	// 			res++;
	// 	}
	// }
	// cout << res << '\n';

	for(int i = 1; i < n; i++) {
		// for(int j = 1; j * j <= i; j++) {
		// 	if(i % j == 0 && j != i/j)
		// 		res += 2;
		// 	else if(i % j == 0)
		// 		res++;
		// }

		int num = 1;
		int tmp = i;
		while(tmp > 1) {
			int p = pr[tmp];
			int cnt = 0;
			while(pr[tmp] == p) {
				cnt++;
				tmp /= p;
			}
			num *= cnt + 1;
		}
		res += num;
	}

	cout << res << '\n';
}


Measured memory_bytes: 7504
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#pragma optimize("JARU SOSISONI")

using namespace std;

#define int long long
#define fast cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define geometry cout.setf(ios::fixed); cout.precision(15);
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;

const int INF = 1e18 + 100;
const int MOD1 = 998244353;
const int MOD = 1e9 + 7;
const int N = 10001;
const int nul = 0;
const int SIZE = 1e6 * 3;


signed main() {
#ifdef parasha
    freopen("A.in.txt", "r", stdin);
#endif // parasha
    fast;
    string s;
    cin >> s;
    int now = 0;
    int ans = 0, n = s.size();
    for (int i = 0; i < n; i++) {
        if (s[i] == 'g') {
            if (now > 0) {
                ans++;
                now--;
            } else now++;
        } else {
            if (now == 0) {
                ans--;
                now++;
            } else now--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3748
n = int(input())
alist = [int(a) for a in input().split()]

alist.sort()
an = alist[-1]
alist = alist[:-1]

front = 0
back = 0
a_pre = alist[0]
for a in alist:
    if a > an / 2:
        front = a_pre
        back = a
        break
    else:
        a_pre = a

if front >= an - back:
    print("{:d} {:d}".format(an, front))
else:
    print("{:d} {:d}".format(an, back))


Measured memory_bytes: 14052
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	const int mod = 1e9+7;
	struct mat{
		int a[3][3];
		inline mat operator * (R const mat &x)const{
			static mat c;memset(c.a,0,sizeof c.a);
			for(R int i=0;i<3;++i)
				for(R int j=0;j<3;++j)
					for(R int k=0;k<3;++k)
						c.a[i][k]=(c.a[i][k]+1ll*a[i][j]*x.a[j][k])%mod;
			return c;
		}
	}A[33],base;
	int b[3],c[3];
	void mul(R const mat&m){
		for(R int i=0;i<3;++i)c[i]=b[i],b[i]=0;
		for(R int i=0;i<3;++i)
			for(R int j=0;j<3;++j)
				b[i]=(b[i]+1ll*m.a[i][j]*c[j])%mod;
	}
	int n,m;
	int main(){
		read(n);read(m);
		*A=(mat){{{1,0,1},{1,1,1},{1,2,2}}};
		base=(mat){{{0,mod-2,mod-1},{1,1,1},{1,2,2}}};
		for(R int i=1;i<32;++i)A[i]=A[i-1]*A[i-1];
		b[0]=1;
		R int x=0,y;
		while(m--){
			read(y);
			for(int i=30;~i;i--)if(y-x-1>>i&1)mul(A[i]);
			mul(base);x=y;
		}
		for(R int i=30;~i;i--)if(n-x>>i&1)mul(A[i]);
		cout<<b[2];
		return 0;
	}
}
int main(){
	return Night::main();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define rep(i, n) for(int i=0;i<(n);i++)
using namespace std;
const int MOD = 1e9 + 7;

int main() {
  int N, K;
  cin >> N >> K;
  // A = 0以上, B = 0以下, C = 共通
  vector<long long> A, B, C;
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    C.push_back(a);
    if (a >= 0) A.push_back(a);
    else B.push_back(a);
  }
  // 全て負かつ奇数　= 負になる
  // N == K かつ負が奇数個　＝　負になる
  bool ok = true;
  if (N == K) {
    ok = (B.size() % 2) == 0;
  } else {
    if (A.size() == 0) {
      ok = (K % 2) == 0;
    }
  }

  long long ans = 1;
  if (!ok) {
    // 大きい方からK個が最善
    sort(C.begin(), C.end());
    rep(i, K) {
      ans *= C[N-1-i];
      ans %= MOD;
    }
    ans = (ans + MOD) % MOD;
  } else {
    sort(A.begin(), A.end());
    sort(B.begin(), B.end(), greater<int>());

    // 必ず正にできる
    // 奇数個の場合は正の最大値を掛ける
    if (K % 2 == 1) {
      ans *= A.back();
      ans %= MOD;
      A.pop_back();
    }

    // 二つをペアにして新しいリストを作る
    vector<long long> x;
    int a_size = A.size();
    for (int i = 0; i < (a_size / 2); i++) {
      long long a1, a2;
      a1 = A.back(); A.pop_back();
      a2 = A.back(); A.pop_back();
      x.push_back(a1 * a2);
    }
    int b_size = B.size();
    for (int i = 0; i < b_size / 2; i++) {
      long long b1, b2;
      b1 = B.back(); B.pop_back();
      b2 = B.back(); B.pop_back();
      x.push_back(b1 * b2);
    }
    sort(x.begin(), x.end());
    for (int i = 0; i < K / 2; i++) {
      long long xb = x.back(); x.pop_back();
      xb %= MOD;
      ans *= xb; 
      ans %= MOD;
    }
  }
  
  cout << ans;
}


Measured memory_bytes: 8336
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
int dn[4]={-1,1,0,0};
int dm[4]={0,0,-1,1};
ll longinf=(1ll<<60);
int main(){
      ll N,T;
      cin>>N>>T;
      ll A[N];
      rep0(i,N) cin>>A[i];
      int maxnow=0;
      int diffmaxnow=0;
      int ans=0;
      for(int i=N-1;i>=0;i--){
            if(A[i]>maxnow){
                  maxnow=A[i];
            }
            else{
                  if(maxnow-A[i]>diffmaxnow){
                        diffmaxnow=maxnow-A[i];
                        ans=1;
                  }
                  else if(maxnow-A[i]==diffmaxnow){
                        ans++;
                  }
            }
      }
      cout<<ans<<endl;
      return 0;
}

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

int main() {
  
  int c =1;
  int N, K;
  cin >> N >> K;  

  for (int i = 0; i < N; i++) {
    if(c*2 > c+K){
      c = c+K;
    }
    else{
      c = c*2;
    }
  }
    cout << c << endl;
    

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n, m;
	cin >> n >> m;
	int c[1010];
	for (int i = 0; i < m; i++){
		int a;
		cin >> c[i] >> a;
	}
	sort(c, c + m);
	int sum = 0;
	for (int i = 1; i < m; i++){
		sum += max(0, n - c[i]);
	}
	cout << sum << endl;
	char ch; cin >> ch;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define Int long long
#define pb push_back
using namespace std;


Int N,M,K;
Int X,Y,Z,D;
const int MAXN=105;
Int B,C;


struct DisJointSet{
    vector<int> SZ;
    vector<int> ID;
    int n;

    DisJointSet(int n){
        SZ.resize(n);
        ID.resize(n);
        this->n=n;
        
        for(int i=0;i<n;++i){
            ID[i]=i;
            SZ[i]=1;
        }
    }
    
    int find(int x){
        return (ID[x]==x ? x:find(ID[x]));
    }
    
    void Union_find(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(SZ[x]>SZ[y]){
            ID[y]=x;
            SZ[x]+=SZ[y];
        }
        else{
            ID[x]=y;
            SZ[y]+=SZ[x];
        }
        return;
    }
};

int main()
{
      char c;cin>>c;
      ++c;
      cout<<c;
}

Measured memory_bytes: 3636
N, K = map(int, input().split())

ans = 0
if K == 0:
  ans += N**2
else:
  for i in range(K+1, N+1):
    ans += (N//i)*(i-K)
    if N%i > K-1:
      ans += (N%i) - (K-1)
print(ans)

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

using namespace std;

typedef long long ll;

const int MAXN = 1005;
const ll INF = 1e18L + 5;

vector< pair<int, ll> > adj[MAXN];


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

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

	int a, b;
	ll c;
	for (int i = 0; i < M; i++) {
		cin >> a >> b >> c;
		a--, b--;
		adj[a].push_back(make_pair(b, c));
	}
	
	vector<ll> dist(MAXN, -INF);
	dist[0] = 0;
			
	for (int loop = 0; loop < N - 1; loop++) {
		for (int u = 0; u < N; u++) {
			for (auto v : adj[u])
				dist[v.first] = max(dist[v.first], dist[u] + v.second);
		}
	}

	ll ans = dist[N-1];
	
	for (int loop = 0; loop < N - 1; loop++) {
		for (int u = 0; u < N; u++) {
			for (auto v : adj[u])
				dist[v.first] = max(dist[v.first], dist[u] + v.second);
		}
	}
	
	if (dist[N-1] != ans)
		cout << "inf\n";
	else
		cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Numerics;

class Program {
    static void Main (string[] args) {
        var input = INP();
        int N = TOI(input[0]);

        if(N>=30) {
            CWL("Yes");
        } else {
            CWL("No");
        }

    }

    public static List<int> PrimeFactors (int n) {
        var tmpList = new List<int>();
        int i = 2;
        int tmp = n;

        while(i * i <= n) {
            if(tmp % i == 0) {
                tmp /= i;
                tmpList.Add(i);
            } else {
                i++;
            }
        }

        if(tmp != 1) tmpList.Add(tmp);

        return tmpList;
    }

    static string[] INP () {
        return Console.ReadLine().Split(' ');
    }

    static void CWL (string value) {
        Console.WriteLine(value);
    }

    static void CWL (int value) {
        Console.WriteLine(value);
    }

    static void CWL (long value) {
        Console.WriteLine(value);
    }

    static void CWL (float value) {
        Console.WriteLine(value);
    }

    static void CWL (double value) {
        Console.WriteLine(value);
    }

    static int TOI (string str) {
        return int.Parse(str);
    }

    static long TOL (string str) {
        return long.Parse(str);
    }

    static float TOF (string str) {
        return float.Parse(str);
    }

    static double TOD (string str) {
        return double.Parse(str);
    }

    /*static void Main (string[] args) {
        var input = INP();
        var input2 = INP();
        var input3 = INP();

        CWL("dummy");
    }*/
}


Measured memory_bytes: 27464
#include <cstdio>
#include <algorithm>

const int MN = 200005;

int N, M, A[MN], Ans;

inline bool check(int pos) {
	int Now = 0;
	for (int i = 1; i <= pos; ++i)
		Now = std::max(Now, A[i] + A[2 * pos - i + 1]);
	for (int i = 1; i <= N - pos; ++i) {
		int v = A[2 * pos + i] + A[2 * N - i + 1];
		if (v < M) return 0;
		Now = std::max(Now, v - M);
	}
	Ans = std::min(Ans, Now);
	return 1;
}

int main() {
	scanf("%d%d", &N, &M), Ans = M;
	for (int i = 1; i <= 2 * N; ++i) scanf("%d", &A[i]);
	std::sort(A + 1, A + 2 * N + 1);
	int l = 0, r = N, mid;
	while (l <= r) {
		mid = (l + r) >> 1;
		if (check(mid)) r = mid - 1;
		else l = mid + 1;
	}
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 1024
import java.util.*; 
public class Main{
  public static void main(String ... string){
    Scanner sc = new Scanner(System.in); 
    int a = sc.nextInt(),b = sc.nextInt(), c = sc.nextInt(); 
    for(int i = 1; i<b; i++){
      if((a*i - c)%b == 0){
        System.out.println("YES"); 
        return; 
      }
    }
    System.out.println("NO"); 
  }
                 
  }


Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#define nmax 100000
#define qmax 50000

int binarySearch(int);
int S[nmax],n;
int count;
int judge[qmax];

int main()
{
  int q;
  int T[qmax],i,flag,j,x;

  scanf("%d",&n);

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

  scanf("%d",&q);

  for( i = 0 ; i < q ; i++ )
    {
      scanf("%d",&T[i]);   
    x = binarySearch(T[i]);
      if( x != -1 ) count++;
    }

  printf("%d\n",count);

  return 0;
}


int binarySearch(int key)
{
  int left,right,mid;
  left = 0;
  right = n;
  while( left < right )
    {
      mid = (left + right)/2;
      if( S[mid] == key )
	return mid;    
      else if( key < S[mid] )
	right = mid;
      else 
	left = mid + 1;
    }
  return -1;

}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n;
    cin >> n;
    vector <int> v(n);
    for(int i=0;i<n;++i) cin >> v[i];
    map <int,int> even, odd;
    for(int i=0;i<n;++i) {
        if(i%2==0) ++even[v[i]];
        else ++odd[v[i]];
    }
    int even1=0, even2=0, odd1=0, odd2=0;
    int e1=0, e2=0, o1=0, o2=0;
    int cnt=0;
    for(auto itr=even.begin();itr!=even.end();++itr) {
        if(itr->second > cnt) {
            cnt=itr->second;
            even1=itr->first;
        }
    }
    e1=cnt;
    cnt=0;
    for(auto itr=even.begin();itr!=even.end();++itr) {
        if(itr->second > cnt && itr->first!=even1) {
            cnt=itr->second;
            even2=itr->first;
        }
    }
    e2=cnt;
    cnt=0;
    for(auto itr=odd.begin();itr!=odd.end();++itr) {
        if(itr->second > cnt) {
            cnt=itr->second;
            odd1=itr->first;
        }
    }
    o1=cnt;
    cnt=0;
    for(auto itr=odd.begin();itr!=odd.end();++itr) {
        if(itr->second > cnt && itr->first!=odd1) {
            cnt=itr->second;
            odd2=itr->first;
        }
    }
    o2=cnt;
    cnt=0;
    if(even1!=odd1) cout << n-e1-o1 << endl;
    else cout << min(n-e1-o2,n-e2-o1) << endl;
}

Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//整数の入力
		int K = sc.nextInt();
		//文字列の入力
		String S = sc.next();
		//配列の定義
		char [] s = new char [K];
		//条件分岐
		if (S.length() <= K) {
			System.out.println(S);
		}else {  //文字列の切り出し
			for(int i = 0; i < K; i++) {
				s[i] = S.charAt(i);
				System.out.print(s[i]);
			}
			System.out.println("...");
		}
	}

}


Measured memory_bytes: 35584
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;

class stack{
  int S[1000];
  int head;
public:
  stack(){head=1;}
  int pop(){return S[--head];}
  void push(int a){S[head++]=a;}
};

int main(){
  stack obj;
  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      obj.push(obj.pop()+obj.pop());
    }
    else if(s[0]=='-'){
      int a=obj.pop();
      int b=obj.pop();
      obj.push(b-a);
    }
    else if(s[0]=='*'){
      obj.push(obj.pop()*obj.pop());
    }
    else obj.push(atoi(s));
  }

  printf("%d\n",obj.pop());

  return 0;
}

  




Measured memory_bytes: 3208
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <sstream>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
typedef long long int lli;
typedef pair<int,int> P;
#define F first
#define S second
const int INF=1000000000;

int main(){
	string str;
	while(getline(cin,str)){
		stringstream s;
		s << str;
		int l;
		s >> l;
		vector<int> r;
		while(!s.eof()){
			int tmp;
			s >> tmp;
			r.push_back(tmp);
		}	
		double dp[1<<12][12];
		double d[12][12];
		int n=(int)r.size();
		for(int i=0; i<n; ++i){
			for(int j=0; j<n; ++j){
				d[i][j]=2*sqrt(r[i]*r[j]);
			}
		}
		for(int S=0; S<(1<<n); ++S){
			fill(dp[S],dp[S]+n,INF);
		}
		for(int i=0; i<n; ++i){
			dp[(1<<n)-1-(1<<i)][i]=r[i];
		}
		for(int S=(1<<n)-2; S>=0; --S){
			for(int j=0; j<n; ++j){
				if(!(S&(1<<j))){
					for(int k=0; k<n; ++k){
						if(S==0) dp[S][j]=min(dp[S][j],dp[S|1<<j][k]+d[j][k]+r[j]);
						else dp[S][j]=min(dp[S][j],dp[S|1<<j][k]+d[j][k]);
					}
				}
			}
		}
		double res=INF;
		for(int i=0; i<n; ++i){
			res=min(res,dp[0][i]);
			//cout << dp[0][i] << "\n";
		}
		if(res<=l) cout << "OK\n";
		else cout << "NA\n";
		//cout << res << "\n";
	}
	return 0;
}

Measured memory_bytes: 1620
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include<cstring>

using namespace std;

int main(){
  char S[100];
  int i;
  cin >> S;
  i=strlen(S)-1;
  int count=0;
  for(int j=0;j<=i;j++){
    if(S[j] != S[i]){
      count++;
    }
    i--;
  }
  cout << count;
}


Measured memory_bytes: 256
N = int(input())
S = input()
x = S.count('E') - (1 if S[0] == 'E' else 0)
ans = x
for s1, s2 in zip(S, S[1:]):
    if s1 == 'W':
        x += 1
    if s2 == 'E':
        x -= 1
    ans = min(ans, x)
print(ans)


Measured memory_bytes: 73928
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict

# UnionFind
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]

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

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            self.parent[x] = y

    def same(self, x, y):
        return self.root(x) == self.root(y)

N, K, L = map(int, input().split())
un = UnionFind(N)
for i in range(K):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    un.unite(p, q)
G = [[] for i in range(N)]
for i in range(L):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    G[r].append(s)
    G[s].append(r)
done = [False]*N
D = []
gid = 0
def dfs(i, gid):
    D[gid][un.root(i)] += 1
    done[i] = True
    for nex in G[i]:
        if done[nex]: continue
        dfs(nex, gid)
for i in range(N):
    if not done[i]:
        D.append(defaultdict(int))
        dfs(i, gid)
        gid += 1
ans = [0]*N
done = [False]*N
gid = 0
def dfs2(i, gid):
    done[i] = True
    ans[i] = D[gid][un.root(i)]
    for nex in G[i]:
        if done[nex]: continue
        dfs2(nex, gid)
for i in range(N):
    if not done[i]:
        dfs2(i, gid)
        gid += 1
print(*ans)


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

const int MAX_M = 1e4;
int n, m;
int a[MAX_M];

void solve() {
    int hw = 0;
    for (int i = 0; i < m; i++) {
        hw += a[i];
    }
    if (n - hw >= 0) {
        cout << n - hw << endl;
    } else {
        cout << -1 << endl;
    }
}

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

Measured memory_bytes: 3632
N = int(input())
U = list(map(int, input().split()))

tmp_even = {}
tmp_odd = {}

for i in range(N):
    u = U[i]
    if i % 2 == 0:
        if u not in tmp_even:
            tmp_even[u] = 0
        tmp_even[u] += 1
    else:
        if u not in tmp_odd:
            tmp_odd[u] = 0
        tmp_odd[u] += 1

even = [(e, tmp_even[e]) for e in tmp_even]
odd = [(o, tmp_odd[o]) for o in tmp_odd]
# print(even)
# print(odd)

even.sort(reverse=True, key = lambda x: x[1])
odd.sort(reverse=True, key = lambda x: x[1])
# print(even[:5])
# print(odd[:5])

if even[0][0] != odd[0][0]:
    print(N - even[0][1] - odd[0][1])
    exit()
if len(even) == 1 and len(odd) == 1:
    print(N // 2)
    exit()
if even[0][1] == odd[0][1]:
    if even[1][1] > odd[1][1]:
        print(N - odd[0][1] - even[1][1])
    else:
        print(N - even[0][1] - odd[1][1])
    exit()
elif even[0][1] > odd[0][1]:
    print(N - even[0][1] - odd[i][1])
else:
    print(N - even[1][1] - odd[0][1])


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

#define ll long long
#define db double
#define pb push_back
#define mk make_pair
#define mxx 123456789987
vector< pair<ll,pair<ll,ll> > >v[200005];
ll pos[200005],a[200005],f=1,n;
void Set(ll m)
{
    ll i;
    for(i=0; i<=m+5; i++)
    {
        pos[i]=mxx;
    }
}
void dfs(ll i)
{
    queue<ll>q;
    q.push(i);

    while(!q.empty())
    {
        ll x=q.front();
        q.pop();
        ll sz=v[x].size();
        for(i=0; i<sz; i++)
        {
            ll fst=v[x][i].first;
            ll y=v[x][i].second.first;
            ll d=v[x][i].second.second;
            if(pos[x]!=mxx&&pos[y]!=mxx)
            {
                if(fst==1)
                {
                    if(pos[x]+d!=pos[y])
                    {
                        f=0;
                    }
                }
                else
                {
                    if(pos[x]-d!=pos[y])
                    {
                        f=0;
                    }
                }
            }
            else
            {
                if(fst==1)
                {
                    pos[y]=pos[x]+d;
                }
                else
                {
                    pos[y]=pos[x]-d;
                }
                q.push(y);
            }
        }
    }

}
int main()
{
    ll i,j,k,m,x,y,z;
    cin>>n>>m;
    Set(m);
    for(i=0; i<m; i++)
    {
        cin>>x>>y>>z;
        a[x]++;
        a[y]++;
        v[x].pb(mk(1,mk(y,z)));
        v[y].pb(mk(2,mk(x,z)));
    }
    for(i=1; i<=n; i++)
    {
        if(a[i]>0&&pos[i]==mxx)
        {
            pos[i]=1;
            dfs(i);
        }
    }
    if(f==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 22144
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;	
char a[101],b[101]={"CODEFESTIVAL2016"};int ans=0;
int main()	
{
//	freopen("weigh.in","r",stdin);
//	freopen("weigh.out","w",stdout);
	cin>>a;
	for(int i=0;i<16;i++)
	{
		if(a[i]!=b[i]) ++ans;
	}
	cout<<ans<<"\n";
	return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;
constexpr int tenfive = 100000;

int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	vector<int> t(N);
	for (int i = 0; i < N; i++) {
		cin >> s[i] >> t[i];
	}

	string X;
	cin >> X;
	int ans = 0;
	bool co = false;
	for (int i = 0; i < N; i++) {
		if (co) {
			ans += t[i];
		}
		if (X == s[i])co = true;
	}

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



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,Q,K;
int A[SIZE];

void solve() {
    cin>>N;
    string S;
    map<string, int> M;
    REP(i,N) {
        cin>>S;
        M[S]++;
    }
    out("AC x %lld\n", M["AC"]);
    out("WA x %lld\n", M["WA"]);
    out("TLE x %lld\n",M["TLE"]);
    out("RE x %lld\n", M["RE"]);
    //cout << ans << endl;
}


Measured memory_bytes: 3760
import math

N = int(input())

A = [int(input()) for _ in range(N)]

idx_A = {}
for i in range(N):
    idx_A[A[i]] = i

B = tuple(sorted(A))

"""
ソート後の位置までの距離が奇数だと操作１が一回必要になる
一度の操作１で最大で２個までのソート後の位置までの距離が奇数のものを偶数にずらしてあげられる
ので、正しい位置までの距離が奇数のものの個数をしらべて、最小の操作１の回数を求める
"""
cnt = 0
for i in range(N):
    if abs(i - idx_A[B[i]]) % 2 == 0: # あまり０なら操作２だけで所定の位置に動かせる
        continue
    else:
        cnt += 1


print(math.ceil(cnt/2))


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

int dp[1005];


int getSum(int n) {
  if(dp[n]) return dp[n];
  int ans = 0;
  int i = 1;
  while(i <= n) {
    ans += i;
    dp[i] = ans;
    ++i;
  }
  return ans;
}
/***** MAIN *****/
signed main() {
  int n, k;
  cin >> n >> k;
  int nums[n];
  double expecteds[n];
  REP(i,n) {
    cin >> nums[i];
    expecteds[i] = (double)getSum(nums[i]) / (double) nums[i];
  }
  double ans = 0;
  double last_ans;
  REP(i,k) {
    ans += expecteds[i];
  }
  last_ans = ans;
  REPS(i,1,n-k+1) {
    double tmp_ans = last_ans - expecteds[i-1] + expecteds[i+k-1];
    if(tmp_ans > ans) ans = tmp_ans;
    last_ans = tmp_ans;
  }
  
  cout << fixed;
  cout << setprecision(10) << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define fr(i,c,b) for(int i=c;i<b;i++)
#define frl(i,c,b) for(ll i=c;i<b;i++)
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define MAX 100001
#define M 1000000007
#define pb push_back

typedef long long int ll;

using namespace std;

int main()
{
    si(n); si(x); si(t);
    ll ans=ceil((double)n/(double)x);
    //watch(ans);
    cout<<ans*t;
}

Measured memory_bytes: 3748
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  ll N;
  ll count=0;
  ll m=pow(10,9)+1;
  ll S=0;
  cin>>N;
  for(int i=0;i<N;i++){
    ll X;
    cin>>X;
    if(X<0) count++;
    m=min(m,abs(X));
    S+=abs(X);
  }
  if(count%2==1) S=S-2*m;
  cout<<S;
return 0;}

Measured memory_bytes: 3604
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

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

#define ll long long
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=1e5+500;
const ll inf=1e17+800;

string s;
vector<ll> ger[maxn];
vector<ll> topol;
ll dp[maxn];
ll dpp[maxn];
ll sz[maxn];
ll dpu[maxn];
ll dppu[maxn];
ll par[maxn];
ll kol;

void dfs(ll a,ll p=-1){
	topol.pb(a);
	sz[a]=s[a];
	par[a]=p;
	vector<ll> vec;
	ll s=0;
	for(auto v:ger[a]){
		if(v!=p){
			dfs(v,a);
			sz[a]+=sz[v];
			dp[a]+=dp[v];
			dp[a]+=sz[v];
		
			vec.pb(dpp[v]+sz[v]);
			s+=dpp[v]+sz[v];
		}	
	}
	sort(vec.begin(),vec.end());
	if(vec.size()){
		if(s-vec.back()<vec.back()){
			dpp[a]=2*vec.back()-s;
		}else{
			dpp[a]=s%2;
		}
	}
}
void dfss(ll a,ll p=-1){
	for(auto v:ger[a]){
		if(v!=p){
			dpu[v]=dpu[a]+dp[a]-(dp[v]+sz[v])+(kol-sz[v]);
			dfss(v,a);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	ll n;
	cin>>n;
	cin>>s;
	for(ll i=0;i<n;i++){
		s[i]-='0';
		kol+=s[i];
	}
	for(ll i=1;i<n;i++){
		ll a,b;
		cin>>a>>b;
		a--;b--;
		ger[a].pb(b);
		ger[b].pb(a);
	}
	dfs(0);
	dfss(0);
	for(auto i:topol){
		if(i==0)continue;
		ll p=par[i];
		ll s=0;
		vector<ll> vec;
		for(auto v:ger[p]){
			if(v!=i && v!=par[p]){
				vec.pb(dpp[v]+sz[v]);
				s+=dpp[v]+sz[v];
			}
		}
		vec.pb(dppu[p]);
		s+=dppu[p];
		sort(vec.begin(),vec.end());
		if(vec.size()){
			if(s-vec.back()<vec.back()){
				dppu[i]=2*vec.back()-s;
			}else{
				dppu[i]=s%2;
			}
		}
		dppu[i]+=kol-sz[i];
	}
	ll ans=inf;
	for(ll i=0;i<n;i++){
		vector<pii> vec;
		for(auto v:ger[i]){
			if(v!=par[i]){
				vec.pb(mp(dp[v]+sz[v],dpp[v]+sz[v]));
			}
		}
		vec.pb(mp(dpu[i],dppu[i]));
		sort(vec.begin(),vec.end());
		ll s=0;
		for(auto e:vec){
			s+=e.F;
		}
		if(s%2==1 || vec.back().S>s-vec.back().F){
			continue;
		}
		ans=min(ans,s/2);
	}
	if(ans==inf){
		cout<<-1;
	}else{
		cout<<ans;
	}
}


Measured memory_bytes: 5632
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        ll A,B;
        cin >> A >> B;
        if((A+B) % 2){
            cout << "IMPOSSIBLE" << endl;
            return;
        }

        cout << (A+B) / 2 << endl;


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
const fi='arc076_a.inp';
        fo='arc076_a.out';
        du=1000000007;
var a,b:longint;
        d:array[0..100000] of qword;
procedure mori;
        var i:longint;
        begin
                d[0]:=1;
                for i:=1 to 100000 do d[i]:=d[i-1]*i mod du;
        end;
function conan:qword;
        var kq:qword;
        begin
                if abs(a-b) > 1 then exit(0);
                kq:=d[b]*d[a] mod du;
                if a=b then kq:=kq*2 mod du;
                exit(kq);
        end;
begin

        readln(a,b);
        mori;
        writeln(conan);

end.


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

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

  set<int> pon ={ 2,4,5,7,9 };
  if ( pon.count( N % 10 ) )cout << "hon";
  else if( N % 10 == 3 ) cout << "bon";
  else cout << "pon";

  return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main {
	public static void main(String[] args){
		//データ取り込み
		Scanner sc = new Scanner(System.in);
		//String S = sc.next();
		//int N = sc.nextInt();
		//System.out.println();
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int cnt = 0;
		
		if(N*A>=B){
			System.out.println(B);
		}else{
			System.out.println(N*A);
		}
	}
}


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

int main()
{
  int n;
  cin >> n;
  
  int p[n];
  rep(i,n){
    cin >> p[i];
  }
  
  sort(p,p+n,greater<int>());
  p[0] /= 2;
  int sum = 0;
  rep(i,n){
    sum += p[i];
  }
  
  cout << sum << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i=0; i<N; i++) {
    cin >> V[i];
  }
  
  int C=0;
  for (int i=0; i<N; i++) {
    if (V[i]!=i+1) {
      C++;
    }
  }
  if (C<=2) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3596