akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

int dp[2][111111];
int n,m,a[111];

int dfs(int x, int t) {
  if(x<0) return t;
  if(dp[t][x]!=-1) return dp[t][x];
  int r=t?0:1;
  rep(i,n) {
    int z=dfs(x-a[i],(t?0:1));
    if(z==t) r=z;
  }
  dp[t][x]=r;
  return r;
}

void Main() {
  cin >> n >> m;
  rep(i,n) R a[i];
  memset(dp,-1,sizeof(dp));
  if(dfs(m,1)) pr("First");
  else pr("Second");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 5760
#include <stdio.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using ii = pair<int, int>;

#define eb emplace_back

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

  int s, w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe";
  else
    cout << "safe";
}


Measured memory_bytes: 3120
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;

struct NODE{
	string to;
	int cost;
	NODE(string to,int cost): to(to) , cost(cost) {}
};
bool operator < (const NODE &a, const NODE &b){
		return a.cost > b.cost;
}


int main(){
	int n , m;
	while(cin >> n >> m && n){
		map<string,vector<NODE> > v;
		string A,B,C;
		cin >> A >> B >> C;
		for(int i = 0 ; i < m ; i++){
			string a,b; int c,d; cin >> a >> b >> c >> d;
			c = c / 40 + d;
			v[a].push_back(NODE(b,c));
			v[b].push_back(NODE(a,c));
		}
		map<string,int> done[3];
		priority_queue<NODE> Q;
		Q.push(NODE(A,0));
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			if(done[0].count(q.to))continue;
			else done[0][q.to] = q.cost;
			for(int i = 0 ; i < v[q.to].size() ; i++){
				Q.push(NODE(v[q.to][i].to,q.cost+v[q.to][i].cost));
			}
		}
		Q.push(NODE(C,0));
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			if(done[2].count(q.to))continue;
			else done[2][q.to] = q.cost;
			for(int i = 0 ; i < v[q.to].size() ; i++){
				Q.push(NODE(v[q.to][i].to,q.cost+v[q.to][i].cost));
			}
		}
		cout << done[0][B] + done[2][B] << endl;
		
		
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long long int n,u,a[5000000],ans,b[5000000],ma=0,mi=1145141919;
vector<int> d;

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

    for(int i=0;i<n;i++){
       mi=min(abs(a[i]),abs(mi));
    }

    for(int i=0;i<n;i++){
       ans+=abs(a[i]);
    }







    if(u%2==0)cout<<ans<<endl;
    else cout<<ans-(mi*2)<<endl;

}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
 
// #define DEBUG
#define fi first
#define se second
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)      //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++) //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)    //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))        //array size
#define SORTD(a) sort(a,a+ASIZE(a),greater<int>()) //sort in descending order for array
#define SORTA(a) sort(a,a+ASIZE(a))                //sort in ascending order for array
#define SORTS(a) sort(a.begin(),a.end())           //sort in ascending order for string type
typedef long long LL;
typedef unsigned int UINT;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector< Vi > VVi;
 
void SCAN(int *a){scanf("%d",a);}                             //scan for type int
void SCAN(int *a,int n){int i;REP(i,n){scanf("%d",&a[i]);}}   //scan for type int array
void SCAN(P *a){scanf("%d",&a->fi);scanf("%d",&a->se);} 
void SCAN(UINT *a){scanf("%u",a);}                            //scan for type unsigned int
void SCAN(UINT *a,int n){int i;REP(i,n){scanf("%u",&a[i]);}}  //scan for type unsigned int array
void SCAN(LL *a){scanf("%lld",a);}                            //scan for type long long int
void SCAN(LL *a,int n){int i;REP(i,n){scanf("%lld",&a[i]);}}  //scan for type long long int array
void SCAN(char *c){scanf(" %c",c);}                           //scan for type char
void SCAN(char *c,int n){int i;REP(i,n){scanf(" %c",&c[i]);}} //scan for type char array
 
const int MOD = 1000000007;
const int INF = 1999999999;
const LL INFLL = 999999999999999;
 
const int DX4[4]= {-1,0,1,0};
const int DY4[4]= {0,-1,0,1};
 
//fill an N-dimensional array with val
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
	fill((T*)array,(T*)(array+N),val);
}
 
long double pascalTri(int n,int r){
	long double tri[n+1][n+1];
	int i,j;
	REP(i,n+1){REP(j,n+1){tri[i][j]=0;}}
	REP(i,n+1){
		REP(j,n+1){
			if(j>i){break;}
			if(j==0||j==i){tri[i][j]=1;}else{tri[i][j]=(tri[i-1][j-1]+tri[i-1][j]);}
		}
	}
	return tri[n][r];
}
 
LL GCD(LL a,LL b){
	LL t;
	if(a<b){t=a;a=b;b=t;}
	if(b==0){return a;}
	LL r;
	while(a%b!=0){
		r=a%b;
		a=b;
		b=r;
	}
	return b;
}
 
LL LCM(LL a,LL b){
	LL ab=(a*b)%MOD;
	return ab/GCD(a%b,b);
}
 
double area(P a,P b,P c){
	return ((b.fi-a.fi)*(c.se-a.se)-(b.se-a.se)*(c.fi-a.fi))/2.;
}
 
int checkCross(P v1,P v2,P a,P b){
	// cout<<area(v1)<<" "<<area(v2)<<endl;
	if(area(a,b,v1)*area(a,b,v2)>=0){return 0;}
	if(area(v1,v2,a)*area(v1,v2,b)>=0){return 0;}
	return 1;
}
 
 
 
int main(){
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	int n;
	int a,b;
	int k;
	int i,j,r;

	SCAN(&n);SCAN(&a);SCAN(&b);

	#ifdef DEBUG
		auto start=chrono::system_clock::now();
	#endif
 
	if(n*a<b){
		printf("%d\n",n*a);
	}else{
		printf("%d\n",b);
	}
 
	
 
	#ifdef DEBUG
		auto end=chrono::system_clock::now();
		cout<<"Elapsed time : "<<chrono::duration_cast<chrono::milliseconds>(end-start).count()<<"ms."<<endl;
	#endif
	return 0;
}

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

int main() {
  int x;
  do {
    cin >> x;
  } while (x < 2 || x > 100000);

  int result;
  int a, b, c;

  for (a = x; 1; a++) {
    c = 0;
    for (b = 2; b <= a / 2; b++) {
      if (a % b == 0) {
        c = 1;
        break;
      }
    }
    if (c == 0) {
      result = a;
      break;
    }
  }
  cout << result;
  return 0;
}


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

flag = True
flag_=True #単調増加True,単調減少False
ans = 0

for i in range(n-1):
  if flag == True:
    if a[i]==a[i+1]:
      continue
    elif a[i]< a[i+1]:
      flag_ = True
    elif a[i]> a[i+1]:
      flag_ = False
    flag = False
      
  else:
    if flag_ == True and a[i]<= a[i+1]:
      continue
    elif flag_ == False and a[i]>= a[i+1]:
      continue
    else:
      ans = ans +1
      flag = True
print(ans+1)

Measured memory_bytes: 15020
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var S string
	scanner.Scan()
	S = scanner.Text()
	fmt.Println(solve(S))
}
func solve(S string) string {
	if S == "ABC" {
		return "ARC"
	}
	return "ABC"
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue

using namespace std;
typedef long long ll;
ll const inf = 1e9;
ll const mod = 1e9 + 7;
int n;

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

    s.insert(s.begin(), '0');
    n = s.size() - 1;
    if(s[1] == '0'){
        cout << -1 << endl;
        return 0;
    }
    fr(i, 0, n + 1){
        if(s[i] != s[n - i]){
            cout << -1 << endl;
            return 0;
        }
    }
    int p = 1;
    int p2;
    int sub = 1;
    int siz = 1;
    fr(i, 2, n + 1){
        if(s[i] == '0') continue;
        p2 = siz + 1;
        siz ++;


        cout << p2 <<' '<<p<<endl;
        int rem = i - sub - 1;
        fr(j, 0, rem){
            cout << p2 <<' '<<siz + 1<< endl;
            siz ++;
        }
        p = p2;
        sub = i;
    }
    while(siz < n){
        cout << p2 <<' '<<siz + 1 << endl;
        siz ++;
    }



    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string n , result;
    cin >> n;

    for(int i=0 ; i<n.length(); i++){
        if(n[i] == '0')
            result+='0';
        else if(n[i] == '1')
            result+='1';
        else if(n[i] == 'B'){
            if (result.length()>0) {
                result.resize(result.size() - 1);
            }
        }
    }

    cout << result ;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<string>
#include<cmath>

using namespace std;

int main()
{
	int n, m;
	int i, j;
	int la, lb, ua, ub;
	int num;

	scanf("%d", &n);

	m = n / 2;

	num = 2 * m*(m - 1) + (n - 1)*(n % 2);

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

	for (i = 1; i < m; i++)
	{
		la = i;
		ua = m * 2 + 1 - i;

		for (j = i + 1; j <= m; j++)
		{
			lb = j;
			ub = m * 2 + 1 - j;

			printf("%d %d\n%d %d\n%d %d\n%d %d\n", la, lb, la, ub, ua, lb, ua, ub);
		}
	}

	if (n % 2)
	{
		for (i = 1; i < n; i++)
		{
			printf("%d %d\n", i, n);
		}
	}

	return 0;
}

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

int main(void){
  int n; cin >> n;
  int h[n]; rep(i,n) cin >> h[i];
  int max = h[0];
  int ans = 1;
  for(int i = 1; i < n; i++){
    if(max <= h[i]){
      ans++;
      max = h[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs vector<string>
#define MX LLONG_MAX
#define MN LLONG_MIN
#define MOD 1000000007
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,a,b,c=0;
    string st;
    while(cin>>k>>a>>b)
    {
        bool f=0;
        for(i=a;i<=b;i++)
        {
            if(i%k==0)
            {
                f=1;
                break;
            }
        }
        if(f) cout<<"OK"<<en;
        else cout<<"NG"<<en;
    }
}




Measured memory_bytes: 3632
var
    s:string;
    k:int64;
    i:longint;
begin
    readln(s);
    readln(k);
    for i:=1 to length(s) do
        if (s[i]<>'1') or (i=k) then
            begin
                writeln(s[i]);
                exit;
            end;
end.

Measured memory_bytes: 128
N,M,K=map(int, input().split())
mod=998244353
if M==1:
  if N-1<=K:
    print(1)
    exit()
  else:
    print(0)
    exit()
    
MAX_N = 10**6
fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1] = pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%mod

def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod

def f(k,n,m):
  #a=(pow(m-1,n-k)*m//(m-1))%mod
  a=(pow(m-1,n-k-1,mod)*m)%mod
  b=mod_comb_k(n-1,k,mod)
  return a*b%mod

ans=0
for i in range(0,K+1):
  d=f(i,N,M)
  ans+=d
  ans%=mod
  #print(d)
print(ans)

Measured memory_bytes: 88100
#include <stdio.h>

int n;
double dp[3005],ans;
int p;

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    dp[0]=1.0;
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        while (getchar()!='.');
        scanf("%d",&p);
        for (int j=i; j>=0; j--) {
            dp[j+1]+=dp[j]*p/100.0;
            dp[j]=dp[j]*(100-p)/100.0;
        }
    }
    for (int i=n/2+1; i<=n; i++) ans+=dp[i];
    printf("%.10f\n",ans);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <typename T = char, typename U = string>
vector<pair<T, int>> rle(const U &s) {
  int n = s.size();
  vector<pair<T, int>> res;
  T now = s[0];
  int cnt = 1;
  FOR(i, 1, n) {
    if (s[i] != now) {
      res.emplace_back(now, cnt);
      cnt = 0;
    }
    now = s[i];
    ++cnt;
  }
  res.emplace_back(now, cnt);
  return res;
}

int main() {
  string s; cin >> s;
  int ans = 0;
  for (auto p : rle<>(s)) {
    if (p.first == 'R') chmax(ans, p.second);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3656
from itertools import permutations

ary = []
for i in range(5):
    ary.append(int(input()))

def calc(perm):
    time = 0
    for p in perm:
        if (time % 10 == 0):
            time += ary[p]
        else:
            time += 10 - time % 10
            time += ary[p]
    return time

times = []
for perm in permutations(range(5)):
    times.append(calc(perm))

print(min(times))


Measured memory_bytes: 3060
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt
    val b = sc.nextInt
    println(compare(a, b))
  }
  def compare(a: Int, b:Int): String = {
    if (a > b) {
      "a > b"
    } else if(a < b) {
      "a < b"
    } else {
      "a == b"
    }
  }
}

Measured memory_bytes: 44844
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    ll ans = 1;
    imfor(i, n) {
        if (i == 0) {
            ans *= k;
        }
        else {
            ans *= (k - 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
S = input()
new_S = ""
for alphabet in S:
    if ord(alphabet) + N > ord("Z"):
        new_S = new_S + chr(ord("A")-1+(ord(alphabet) + N - ord("Z")))
    else:
        new_S = new_S + chr(ord(alphabet) + N)
print(new_S)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int x = Integer.parseInt(sc.next());
     int y = Integer.parseInt(sc.next());
     if ( x * 500 >= y) System.out.println("Yes");
     else System.out.println("No");
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

#define MOD 2019

int main(){
	string s;
	cin>>s;
	ll n=s.size();
	ll t[2019]={};//「左からi~n(i:0~n)の数値」を2019で割ったあまりが何個あるか
	t[0]++;
	ll tmp=0,power=1;
	REPR(i,n){
		tmp+=(s[i]-'0')*power;
		power*=10;
		power%=MOD;
		tmp%=MOD;
		//cout<<tmp<<endl;
		t[tmp]++;
	}
	ll ans=0;
	REP(i,MOD){
		ans+=t[i]*(t[i]-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

ll n, x, t;

void reset()
{
}

void input()
{
	cin>>n>>x>>t;
}

void solve()
{
	ll temp = 0;
	cout<<(n/x + (n % x !=0))*t<<endl;
}

void LetsRock()
{
	solve();	
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

		input();
		reset();
		LetsRock();
	
	return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N; cin >> N;
	string S; cin >> S;
	int a = 0, b = 0, c = 0;
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'R') a++;
		if (S[i] == 'G') b++;
		if (S[i] == 'B') c++;
	}
	ans = (ll)a * b * c;
	
	for (int i = 0; i < N-1; i++) {
		for (int k = i+2; k < N; k += 2) {
			int j = (i+k)/2;
			if (S[i] != S[j] && S[i] != S[k] && S[j] != S[k]) ans--;
		}
	}
	cout << ans << endl;
}

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


Measured memory_bytes: 3656
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000000
using namespace std;
typedef long long ll;

int main(){
  ll n;  cin >> n;
  ll ans = 0;
  vector<int> a(n), b(n), c(n);
  rep(i, 0, n)  cin >> a[i];
  rep(i, 0, n)  cin >> b[i];
  rep(i, 0, n)  cin >> c[i];
  sort(all(a)); sort(all(b)); sort(all(c));
  rep(i, 0, n){
    auto ait = lower_bound(all(a), b[i]);
    auto cit = upper_bound(all(c), b[i]);
    ans += (ait-a.begin())*(c.end()-cit);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1536
def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
#include "bits/stdc++.h"

/************* Using *************/
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using graph_t = vector<vector<ll>>;

/*********** Constants ***********/
const auto INF  = static_cast<int>(1e10);
const auto INFL = static_cast<ll>(1e18);
const auto MOD  = static_cast<ll>(1e9 + 7);
const auto NIL  = nullptr;

/*********** Variables ***********/
ll A, B, ANS;

/************* Utils *************/

/*********** Functions ***********/
bool init() {
    cin >> A >> B;
    ANS = 0;
    return true;
}

void solve() {
    ANS = max(A + B, A - B);
    ANS = max(ANS, A * B);
}

void output() {
    cout << ANS << endl;
}

int main() {
    init();
    solve();
    output();
    return 0;
}


Measured memory_bytes: 256
import itertools,math
N=int(input())
nl=[i for i in range(N)]
x=[]
y=[]
d=0
for _ in range(N):
	X,Y=[int(i) for i in input().split()]
	x.append(X)
	y.append(Y)
per_nl=list(itertools.permutations(nl))
for k in per_nl:
	for i in range(N-1):
		d+=((x[k[i+1]]-x[k[i]])**2+(y[k[i+1]]-y[k[i]])**2)**(0.5)
print(d/math.factorial(N))

Measured memory_bytes: 7972
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int x,a,b,c;
cin >> x;
 a=x/100;
 b=(x-100*a)/10;
 c=x-(100*a)-(10*b);
 if(a==7 || b==7 || c==7){
 cout <<"Yes"<<endl;
 }else{
 cout <<"No"<<endl;
 }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define lli long long int
#define all(x) x.begin(),x.end()
#define siz(x) x.size()
#define prs(x,y) x.find(y)!=x.end()
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res;}
inline int level(int n){int ans=0;while(n%2==0){n/=2;ans++;}return ans;}
lli a[200005],vis[200005],tim[200005],k;
lli ans=0;
lli dfs2(int i,lli curr);

lli dfs(int i)
{
	k--;
	if(k==0)
	{ans=i;
	return 0;}
	//cout<<i<<"\n";
	vis[i]=1;
	tim[i]=k;
	if(!vis[a[i]])
	dfs(a[i]);
	else
	{
		//cout<<i;
		lli length=1+tim[a[i]]-tim[i];
		//cout<<length<<" "<<k<<endl;
		lli l=k%length;
		if(l==0)
			l=length;
		dfs2(a[i],l);
	}
	return 0;
}
lli dfs2(int i,lli curr)
{
	assert(curr>0);
	curr--;
	//cout<<i<<" "<<curr<<endl;
	if(curr==0)
	{ans=i;
	return 0;}
	dfs2(a[i],curr);
	return 0;
}
int main()
{
	lli n;
	memset(vis,0,sizeof(vis));
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	k+=1;
	dfs(1);
	cout<<ans;
}



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


int main() {

   ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);

   int n, m, ans = 0;
   cin >> n >> m;
   vector <vector <int>> light(m);
   vector <int> num(m), prt(m);
   for (int i = 0; i < m; i++) {
      cin >> num[i];
      for (int j = 0; j < num[i]; j++) {
         int temp;
         cin >> temp;
         light[i].push_back(temp);
      }
   }
   for (int i = 0; i < m; i++) {
      cin >> prt[i];
   }

   for (int x = 0; x < (1 << n); x++) {
      bool jury = true;
      for (int i = 0; i < m; i++) {
         int cnt = 0;
         for (int j = 0; j < num[i]; j++) {
            if (x & (1 << (light[i][j] - 1))) {
               cnt++;
            }
         }
         if (cnt % 2 != prt[i]) {
            jury = false;
            break;
         }
      }
      if (jury) {
         ans++;
      }
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int main(){
   
   int k, x;
   cin >> k >> x;

   if(500*k >= x) cout << "Yes";
   else cout << "No";
   
   return 0;
}

Measured memory_bytes: 256
def xor(n):
	if n % 4 == 0:
		return n
	elif n % 4 == 1:
		return 1
	elif n % 4 == 2:
		return n + 1
	else:
		return 0

A, B = map(int, input().split())
print(xor(A - 1) ^ xor(B))


Measured memory_bytes: 2940
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let b: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let c: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let x: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut ans = 0;
    for i in 0..a + 1 {
        for j in 0..b + 1 {
            for k in 0..c + 1 {
                if 500 * i + 100 * j + 50 * k == x {
                    ans += 1;
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>
int main()
{
    long long int i,j,x,p,k,mn,N;
    int c=0;


    long long int A[10000];
    scanf("%lld",&N);

    x=sqrt(N);

    for(int i=1,k=0; i<=x; i++)
    {
        if( N%i==0)
        {


                j=N/i;
                p=i+j-2;
                c=c+1;



                A[k]=p;


                k++;

        }

    }




    mn=A[0];
    for(int k=1; k<c; k++)
    {
        if(A[k]<mn)
        {
            mn=A[k];

        }
    }
    printf("%lld\n",mn);



    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

x, y = MI()
if y % 2 == 1:
    print("No")
    sys.exit()
y = y // 2
if y > x * 2 or y < x:
    print("No")
    sys.exit()
print("Yes")

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	int n;cin >> n;
	vector<vector<llong> > d(3,vector<llong>(n+1,0));
	for(int i = 1; i<= n; i++){
		cin >> d[0][i] >> d[1][i] >> d[2][i];
	}
	vector<vector<llong> > dp(3,vector<llong>(n+1,0));
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				if(j == k)continue;
				dp[j][i] = max(dp[k][i-1]+d[j][i],dp[j][i]);
			}
		}
	}
	//for(auto v : dp){for(auto e : v)cerr << e << " ";cerr << endl;}
	llong ans = 0;
	for(int i = 0; i < 3; i++){
		ans = max(ans, dp[i][n]);
	}
	cout << ans << endl;


	return 0;
}



Measured memory_bytes: 5744
N = int(input())
line = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y','z']
output =""
while True:
    if N == 0:
        break
    if (int(N/26)):
        output = line[(N%26) -1] + output
        if N%26 == 0:
            N = int((N-1)/26)
        else:
            N = int(N/26)
    
    else:
        output = line[(N%26) -1] + output
        break
print(output)

Measured memory_bytes: 9140
N = int(input())
from collections import deque

def solve(N):
    ans = 0
    d = deque([3,5,7])
    n = d.popleft()
    while n<=N:
        if len(set(list(str(n))))==3:
            ans += 1
        for num in [3,5,7]:
            new = int(str(n)+str(num))
            d.append(new)
        n = d.popleft()
    return ans
print(solve(N))

Measured memory_bytes: 5692
/**
*    created: 08.07.2020 09:21:12
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    string s; cin >> s;
    int l = 0, cnt = 0;
    rep(i,n) {
        if (s[i] == '(') cnt++;
        else cnt--;
        chmin(l,cnt);
    }
    rep(i,-l) cout<< '(';
    cout << s;
    rep(i,cnt-l) cout<< ')';
    cout << endl;
    return 0;
}

Measured memory_bytes: 3532
#include<map>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define No {puts("-1");return 0;}
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
using namespace std;
typedef long long ll;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"in%s.txt",s);
	freopen(str,"r",stdin);
//	sprintf(str,"out%s.txt",s);
//	freopen(str,"w",stdout);
	#endif
}
inline ll rd()
{
	static ll x,f;
	x=0;f=1ll;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1ll;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10ll+ch-'0';
	return f>0?x:-x;
}
const int N=100010;
struct edge{
	int u,v,next;
	edge(int u=0,int v=0,int next=0):u(u),v(v),next(next){}
}e[N];
int n,siz[N],rt;ll d[N];
int tot=0,head[N];
struct node{
	ll x;int id;
}q[N];
map<ll,int>mp;

inline bool cmp(node a,node b){return a.x>b.x;}
inline void add(int u,int v){e[++tot]=edge(u,v,head[u]);head[u]=tot;}

void dfs1(int u,int dep)
{
	d[rt]+=dep;
	fe(i,u){int v=e[i].v;dfs1(v,dep+1);}
}
void dfs2(int u)
{
	fe(i,u){
		int v=e[i].v;
		d[v]=d[u]+ll(n-(siz[v]<<1ll));
		dfs2(v);
	}
}

int main()
{
	n=rd();fo(i,1,n)mp[q[q[i].id=i].x=rd()]=i,siz[i]=1;
	sort(q+1,q+n+1,cmp);
	fo(i,1,n-1){
		int x=q[i].id;
		ll dd=q[i].x-n+(siz[x]<<1);
		if(dd>=q[i].x)No
		if(!mp.count(dd))No
		int fa=mp[dd];
		add(fa,x);siz[fa]+=siz[x];
	}
	rt=q[n].id;
	dfs1(rt,0);
	dfs2(rt);
	fo(i,1,n)if(d[q[i].id]!=q[i].x)No
	fo(i,1,tot)printf("%d %d\n",e[i].u,e[i].v);
	return 0;
}


Measured memory_bytes: 13440
#include <iostream>
using namespace std;
int main(void) { 
    int ans, n, m, v[101], w[101];  
    int dp[101][10001];  
    cin >> n >> m;  
    for (int i = 0; i < n; i++){  
        cin >> v[i] >> w[i];    }    
        for(int i=0; i<=m; i++) dp[0][i] = 0;    
        for (int i = 0; i < n; i++)   
        for (int j = 0; j <= m; j++) {      
            if (j < w[i])  dp[i + 1][j] = dp[i][j];      
            else            dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);    
        }   
        
        cout << dp[n][m] << endl;   
    return 0;
    
}
        


Measured memory_bytes: 7044
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
string f(ll x){
    if(!x){
        return "0";
    }
    string s;
    while(x){
        if(x%2){
            s+='1';
        }else{
            s+='0';
        }
        x/=2;
    }
    reverse(all(s));
    return s;
}
int main(){
    ll X;
    cin>>X;
    map<ll,ll> a;
    REP(i,1<<20){
        ll t=1;
        ll n=0;
        REP(j,20){
            if(i&(1<<j)){
                n+=t;
            }
            t*=-2;
        }
        a[n]=i;
    }
    map<ll,ll> b;
    REP(i,1<<20){
        ll t=1<<20;
        ll n=0;
        REP(j,20){
            if(i&(1<<j)){
                n+=t;
            }
            t*=-2;
        }
        b[n]=i;
    }
    if(a.find(X)!=a.end()){
        cout<<f(a[X])<<endl;
        return 0;
    }
    if(b.find(X)!=b.end()){
        cout<<f(b[X]<<20)<<endl;
        return 0;
    }
    for(auto itr:a){
        ll p=X-itr.fi;
        if(b.find(p)!=b.end()){
            cout<<f(itr.se+(b[p]<<20))<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 131328
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int L,R = 0;
		L = A + B;
		R = C + D;
		if(L > R) {System.out.println("Left");}
		else if(L == R) {System.out.println("Balanced");}
		else if(L < R){System.out.println("Right");}
}}

Measured memory_bytes: 22608
n = int(input())
s = []
for i in range(n):
    s.append(input())

ans = ""

INF = 1000

for c_i in range(ord('a'), ord('z')+1):
    small = INF
    c = chr(c_i)
    for i in range(n):
        cnt = s[i].count(c)
        small = min(small, cnt)
    ans += c * small

print(ans)

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::Ordering;

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    input! {
        n: i32,
        k: i32
    }
    let mut now = 1;
    for _ in 0..n {
        let val1 = now + k;
        let val2 = 2 * now;
        if val1 < val2 {
            now = val1;
        } else {
            now = val2;
        }
    }
    println!("{}", now);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

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

  if(N >= 1800) cout << 1 << endl;
  else if(N >= 1600) cout << 2 << endl;
  else if(N >= 1400) cout << 3 << endl;
  else if(N >= 1200) cout << 4 << endl;
  else if(N >= 1000) cout << 5 << endl;
  else if(N >= 800) cout << 6 << endl;
  else if(N >= 600) cout << 7 << endl;
  else cout << 8 << endl;
  

}

Measured memory_bytes: 3632
module app;

import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

struct Node
{
	uint counter;
	uint counterTotal;
	uint parentIndex; // 0-origin, uintにしたせいで根を表現できないのは処理でごまかす
	bool parentFixed;
	uint[] neighborhoods;
}

void main()
{
	auto input = parseInput();
	Node[] nodes; // 0-origin
	nodes.length = input.n;
	
	foreach (operation; input.operations)
	{
		nodes[operation.p - 1].counter += operation.x;
	}
	nodes[0].counterTotal = nodes[0].counter;

	foreach (edge; input.edges)
	{
		nodes[edge.a - 1].neighborhoods ~= edge.b - 1;
		nodes[edge.b - 1].neighborhoods ~= edge.a - 1;
	}
	
	nodes[0].parentFixed = true;
	
	uint[] queue;
	queue ~= 0;
	
	while (queue.length > 0)
	{
		auto target = queue[0];
		queue = queue[1..$];
		foreach (childIndex; nodes[target].neighborhoods)
		{
			if (nodes[childIndex].parentFixed)
			{ }
			else
			{
				nodes[childIndex].parentIndex = target;
				nodes[childIndex].parentFixed = true;
				nodes[childIndex].counterTotal = nodes[target].counterTotal + nodes[childIndex].counter;
				queue ~= childIndex;
			}
		}
	}
	
	foreach (i, ref node; nodes)
	{
		if (i == 0)
		{
			writef("%d", node.counterTotal);
		}
		else
		{
			writef(" %d", node.counterTotal);
		}
	}
}

struct Input
{
	uint n;
	uint q;
	Edge[] edges;
	Operation[] operations;
}

struct Edge
{
	uint a;
	uint b;
}

struct Operation
{
	uint p;
	uint x;
}

Input parseInput()
{
	Input input;
	auto nq = readln().strip().split();
	input.n = nq[0].to!uint;
	input.q = nq[1].to!uint;
	input.edges.length = input.n - 1;
	for (int i = 0; i < input.n - 1; i++)
	{
		auto ab = readln().strip().split();
		input.edges[i].a = ab[0].to!uint;
		input.edges[i].b = ab[1].to!uint;
	}
	input.operations.length = input.q;
	for (int i = 0; i < input.q; i++)
	{
		auto px = readln().strip().split();
		input.operations[i].p = px[0].to!uint;
		input.operations[i].x = px[1].to!uint;
	}
	return input;
}


Measured memory_bytes: 19452
dishes = [int(input()) for i in range(0, 5)]

maxloss = 0
maxlossidx = 0
loss = 0
for i in range(0, 5):
    loss = 10 - int(str(dishes[i])[-1:])
    if loss < 10 and  loss > maxloss :
        maxloss = loss
        maxlossidx = i

last = dishes[maxlossidx]
del dishes[maxlossidx]

work = 0
for i in range(0,4):
    if dishes[i] % 10 != 0:
        dishes[i] += 10 - int(str(dishes[i])[-1:])

    work += dishes[i]

print(work + last)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, m;
  cin >> n >> m;
  vector<string> a;
  for (int i = 0; i < n; i++) {
	string s;
	cin >> s;
	a.push_back(s);
  }
  vector<string> b;
  for (int i = 0; i < m; i++) {
	string s;
	cin >> s;
	b.push_back(s);
  }
  bool flag = false;
  for (int i = 0; i <= n - m; i++) {
	for (int j = 0; j <= n - m; j++) {
	  bool check = true;
	  for (int k = i; k < m + i; k++) {
		for (int l = j; l < m + j; l++) {
		  if (b[k - i][l - j] != a[k][l]) {
			check = false;
		  }
		}
	  }
	  if (check) {
		flag = true;
		break;
	  }
	}
  }
  if (flag) {
	cout << "Yes" << endl;
	return 0;
  }
  else {
	cout << "No" << endl;
	return 0;
  }
  return 0;
}



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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int cnt = 0;
    int C = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(i != 0 && A[i - 1] == A[i]){
            cnt++;
            A[i] = C;
            C--;
        }
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

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

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

    for(int i = 1 ; i <= 9 ; ++i){
        for(int j = 1 ; j <= 9 ; ++j){
            printf("%dx%d=%d\n", i, j, i * j);
        }
    }

    return 0;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}

void solution() {
int a,b;
  cin >> a >> b;
  cout << a*b  << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  solution();
}


Measured memory_bytes: 3640