akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <climits>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <functional>
#include <unordered_set>
#include <cstring>
#include <cassert>
#include <bitset>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x...)
#endif
//#define int ll
//#pragma GCC optimize("Ofast")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
#define sz(x) int((x).size())

#ifndef LOCAL
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#else
	mt19937 rng(228);
#endif

const int N = 5e3 + 7;
const int inf = INT_MAX / 2;
const ll INF = LLONG_MAX / 3;
const int MOD = 998244353;
const ld eps = 1e-6;
const string cars[] = {"🚗", "🚕", "🚙"};



signed main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(9);
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	string s, t;
	cin >> s >> t;

	if (t.substr(0, sz(t) - 1) == s) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}


	return 0;
}

Measured memory_bytes: 3680
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll n, m;
ll a[200005];
ll b[200005];
ll c[200005];
ll ans;

int main()
{
    scanf("%lld%lld", &n, &m);
    for(ll i = 1; i <= n; i++) scanf("%lld", &a[i]);
    for(ll i = 1; i <= n; i++)
    {
        b[a[i]]++;
    }
    for(ll i = 1; i <= n; i++)
    {
        for(ll j = 0; j < b[i]; j++)
        {
            c[max(0LL, i - j)]++;
        }
    }
    for(ll i = 1; i <= n; i++)
    {
        if(c[i]) ans++;
    }
    while(m--)
    {
        ll t1, t2;
        scanf("%lld%lld", &t1, &t2);
        ll x = a[t1];
        ll y = t2;
        c[max(0LL, x - b[x] + 1)]--;
        if(c[max(0LL, x - b[x] + 1)] == 0 && x - b[x] + 1 > 0) ans--;
        b[x]--;
        c[max(0LL, y - b[y])]++;
        if(c[max(0LL, y - b[y])] == 1 && y - b[y] > 0) ans++;
        b[y]++;
        a[t1] = t2;
        printf("%lld\n", n - ans);
    }
    return 0;
}


Measured memory_bytes: 6144
import qualified Control.Monad as Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.Maybe as Maybe
import qualified Debug.Trace as Trace

dist :: [Int] -> [Int] -> Double
dist a b = sqrt ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
    where x1 = (fromIntegral (a !! 0))
          y1 = (fromIntegral (a !! 1))
          x2 = (fromIntegral (b !! 0))
          y2 = (fromIntegral (b !! 1))

solve :: Int -> [[Int]] -> Double
solve n a = (foldl1 (+) dists) / (fromIntegral n)
    where dists = [dist x y | x <- a, y <- a]

main = do
    n <- (fst . Maybe.fromJust . BS.readInt) <$> BS.getLine
    a <- Monad.replicateM n (map (fst . Maybe.fromJust . BS.readInt) . BS.words <$> BS.getLine)
    let ans = solve n a
    print ans

Measured memory_bytes: 3924
H, W, M = map(int, input().split())

hs = [0] * H
ws = [0] * W
checked = set()

for i in range(M):
    r,c = map(int, input().split())
    r -= 1
    c -= 1

    hs[r] += 1
    ws[c] += 1
    checked.add((r, c))

mh, mw = 0, 0
for i in range(H):
    mh = max(mh, hs[i])
for j in range(W):
    mw = max(mw, ws[j])

max_h_list = []
max_w_list = []
    
for i in range(H):
    if hs[i] == mh: max_h_list.append(i)    
for j in range(W):
    if ws[j] == mw: max_w_list.append(j)

ans = mh + mw

for i in max_h_list:
    for j in max_w_list:
        if (i,j) not in checked:
            print(ans)
            exit()
print(ans-1)    

Measured memory_bytes: 176860
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

intmax_t get_gcd(intmax_t b, intmax_t a)
{
    while (b != 0) {
        intmax_t r = a % b;
        a = b;
        b = r;
    }

    return a;
}

int main(int argc, char const* argv[])
{
    int64_t N, X, x[(int)1e5];
    int64_t gcd, d[(int)1e5];

    scanf("%" PRId64 "%" PRId64, &N, &X);
    for (int i = 0; i < N; i++) {
        scanf("%" PRId64, &x[i]);
        d[i] = llabs(x[i] - X);
    }

    gcd = d[0];
    for (int i = 1; i < N; i++) {
        gcd = get_gcd(gcd, d[i]);
    }

    printf("%" PRId64 "\n", gcd);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define num(i,j,k) ((((i)-1)*m+(j))*2+k)
using namespace std;
const int N = 1000010;
const int inf = 1e9;
inline int read()
{
  int p=0; int f=1; char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();}
  while(ch>='0' && ch<='9'){p=p*10+ch-'0'; ch=getchar();}
  return p*f;
}
struct node
{
  int x,y,c,next;
}edge[N]; int len,first[N];
void ins(int x,int y,int c)
{
  len++; edge[len].x=x; edge[len].y=y; edge[len].c=c; edge[len].next=first[x]; first[x]=len;
  len++; edge[len].x=y; edge[len].y=x; edge[len].c=0; edge[len].next=first[y]; first[y]=len;
}

int n,m; char str[310][310]; int s,d; int tot;

queue<int>q; int dep[N]; 

bool bfs()
{
  while(!q.empty()) q.pop(); q.push(s);
  for(int i=1;i<=tot+n+m;i++) dep[i] = 0; dep[s] = 1;
  while(!q.empty())
  {
    int x = q.front();
    for(int k=first[x];k!=-1;k=edge[k].next)
    {
      int y = edge[k].y;
      if(dep[y] == 0 && edge[k].c)
      {
        dep[y] = dep[x] + 1;
        q.push(y);
      }
    }
    q.pop();
  }
  return dep[d] > 0;
}

int dfs(int x,int flow)
{
  if(x==d || flow == 0) return flow;
  int delta=0;
  for(int k=first[x];k!=-1;k=edge[k].next)
  {
    int y = edge[k].y;
    if(dep[y] == dep[x] + 1 && edge[k].c && flow > delta)
    {
      int minf = dfs(y,min(flow - delta , edge[k].c));
      edge[k].c-=minf; edge[k^1].c+=minf;
      delta+=minf;
    }
  }
  if(delta==0) dep[x] = 0;
  return delta;
}

int main()
{
  len = 1; memset(first,-1,sizeof(first));
 
  n = read(); m = read();
  for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
  {
    scanf("\n%c",&str[i][j]);
    if(str[i][j] == 'S') s = num(i,j,0);
    else if(str[i][j] == 'T') d = num(i,j,1);
  }

  tot = num(n,m,1);
  for(int i=1;i<=n;i++) // tot + i
  {
    for(int j=1;j<=m;j++) // tot + n + j
    {
      if(str[i][j] == '.') continue;
      if(str[i][j] == 'o') ins(num(i,j,0) , num(i,j,1) , 1);
      else ins(num(i,j,0) , num(i,j,1) , inf);
      ins(num(i,j,1) , tot+i , inf);
      ins(num(i,j,1) , tot+n+j , inf);
      ins(tot+i , num(i,j,0) , inf);
      ins(tot+n+j , num(i,j,0) , inf);
      // printf("(%d,%d) ,  %d %d\n",i,j,i,j);
    }
  }
  
  int ans = 0;
  while(bfs())
    ans+=dfs(s,inf);
  return printf("%d\n",(ans >= inf) ? -1 : ans),0;
}

Measured memory_bytes: 8576
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  ll arr[100] = {};
  for (int i = 1; i <= N; ++i)
  {
    string s = to_string(i);
    arr[(s[0] - '0') * 10 + (s[s.size() - 1] - '0')]++;
  }
  ll ans = 0;
  for (int i = 0; i < 100; ++i)
  {
    if (i % 10 == 0)
      continue;
    string s = to_string(i);
    if (s[0] == s[s.size() - 1])
    {
      ans += arr[i] * arr[i];
    }
    else
    {
      int j = (s[0] - '0') + (s[s.size() - 1] - '0') * 10;
      ans += arr[i] * arr[j];
    }
  }
  cout << ans << endl;

  return 0;
}


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

// #define INFTY FP_INFINITE
#define INFTY 2147483647

int ct=0;

void printer(int *array, int fst, int n){
  int i;
  for(i=fst; i<n; i++){
    printf("%d",array[i]);
    if(i != n-1) printf(" ");
    else printf("\n");
  }
}


void merge(int *A, int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int *L = (int *)malloc(sizeof(int) * (n1 + 1));
  int *R = (int *)malloc(sizeof(int) * (n2 + 1));
  int i, j, k;

  // printf(">>merge(in) : ");
  // printer(A, left, right);
  // printf("   %d %d %d %d %d\n",left, mid, right, n1, n2);

  for(i=0; i<n1; i++){
    L[i] = A[left + i];
  }
  for(i=0; i<n2; i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;

  // printf("   L : ");
  // printer(L, 0, n1+1);
  // printf("   R : ");
  // printer(R, 0, n2+1);

  i = 0;
  j = 0;
  for(k=left; k<right; k++){
    ct++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }

  // printf(">>merge(out) : ");
  // printer(A, left, right);
  // printf("\n");

}

void mergeSort(int *A, int left, int right){
  int mid;

  // printer(A, left, right);

  if(left+1 < right){
    mid = (left + right) / 2;
    // puts("left");
    mergeSort(A, left, mid);
    // puts ("right");
    mergeSort(A, mid, right);
    // puts("merge");
    merge(A, left, mid, right);
  }
}


int main(){
  int n, *S;
  int i;

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

  mergeSort(S, 0, n);

  printer(S, 0, n);
  printf("%d\n",ct);

  return 0;
}



Measured memory_bytes: 64516
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

int main(void){
	ll n,m;
	cin>>n>>m;
	ll a;
	vector<ll> A;
	rep(i,n){
		cin>>a;
		A.push_back(a);
	}

	vector<pair<ll,ll>> kukan;//pair<ll,ll> 左端, 右端
	rep(i,n-1){
		if(A[i] < A[i+1]){
			kukan.push_back(pair<ll,ll>{A[i]+m,A[i+1]+m});
			kukan.push_back(pair<ll,ll>{A[i],A[i+1]});
		}
		else{
          kukan.push_back(pair<ll,ll>{A[i],A[i+1]+m});
          kukan.push_back(pair<ll,ll>{A[i]+m,A[i+1]+m+m});
        }
	}
	sort(all(kukan));

	//pair<ll,ll> : 右端,左端
	priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>>> que;
	
	ll val = 0;//現在の明るさtを挟む区間の個数
	int ki = 0;
	ll toku = 0;//お気に入りによって得した量
	ll max_toku = 0;
	rep(t,2*m+3){
		toku += val;
		chmax(max_toku, toku);//明るさtをお気に入りにした時に得した量(手数圧縮量) = toku になってる.
		while(que.size() > 0 && que.top().first == t){
			pair<ll,ll> top = que.top();
			val--;
			toku -= top.first - top.second - 1;//お気に入りがその区間から外れることで, 今まで得とカウントしてた量は無効
			que.pop();
		}
		while(ki < kukan.size() && kukan[ki].first == t){
			que.push(pair<ll,ll>{kukan[ki].second, kukan[ki].first});
			val++;
			ki++;
			toku -= 1;//t+1をお気に入りにしても, まだ得はしないので.
		}
		
		//cout<<toku<<" ";
		//cout<<que.size()<<" ";
	}
	//cout<<endl;
	ll ans = 0;
	rep(i,A.size()-1){//手数圧縮しなかった場合にかかる手数
		if(A[i] < A[i+1]) ans += A[i+1] - A[i];
		else ans += A[i+1] - A[i] + m;
	}
	ans -= max_toku;
	cout<<ans<<endl;
	//cout<<toku<<endl;
	//cout<<max_toku<<endl;
	return 0;
}


Measured memory_bytes: 8556
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var m = int.Parse(line[0]);
            var w = int.Parse(line[1]);
            if (m == 0 && w == 0) break;
            line = Console.ReadLine().Trim().Split(' ');
            var bm = Array.ConvertAll(line, int.Parse);
            line = Console.ReadLine().Trim().Split(' ');
            var bw = Array.ConvertAll(line, int.Parse);
            var dp = new int[m + 1, 1 << w];
            for (int i = 0; i < m + 1; i++)
                for (int j = 0; j < (1 << w); j++) dp[i, j] = -1;
            var ans = goDP(dp, bm, bw, m, w);
            Console.WriteLine(ans);
        }
    }
    static int goDP(int[,] dp, int[] bm, int[] bw, int m, int w)
    {
        var ans = 0;
        dp[0, 0] = 0;
        var kmax = 1 << w;
        for (int i = 0; i < m; i++)
            for (int k = 0; k < kmax; k++)
            {
                if (dp[i, k] == -1) continue;
                dp[i + 1, k] = Max(dp[i + 1, k], dp[i, k]);
                for (int j = 0; j < w; j++)
                {
                    var ww = 1 << j;
                    if ((k & ww) >= 1) continue;
                    var t = (k | ww);
                    dp[i + 1, t] = Max(dp[i + 1, t], dp[i, k] + calcEP(bm[i], bw[j]));
                    ans = Max(ans, dp[i + 1, t]);
                }
            }
        return ans;
    }
    static int calcEP(int m, int b)
    {
        var w = Abs(m - b);
        return w * (w - 30) * (w - 30);
    }
}


Measured memory_bytes: 17936
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
#include <queue>
using namespace std;

#define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define fi first
#define sc second
#define pb push_back
#define double long double
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int>> vpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<int, int> pii;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

const i64 MOD = 1000000007;
const i64 INF = 2e15;

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

	int n;
	cin >> n;

	vi a(n);
	int me1 = -1, me2 = -1;

	REP(i, 0, n - 1) {
		cin >> a[i];

		if (me1 == -1) {
			me1 = a[i];
			continue;
		}
		else if (a[i] > me1) {
			me2 = me1;
			me1 = a[i];
		}
		else if (a[i] > me2) {
			me2 = a[i];
		}
	}

	REP(i, 0, n - 1) {
		if (a[i] == me1) cout << me2 << endl;
		else cout << me1 << endl;
	}

	return 0;
}

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

int main() {
  int n,m;
  char c;
  cin >> m >> n >> c;
  for(int i=0; i<n; i++) {
    for(int j=0; j<m; j++) {
      if((!i||i==n-1)&&(!j||j==m-1)) cout << "+";
      else if(!i||i==n-1) cout << "-";
      else if(!j||j==m-1) cout << "|";
      else if(i==n/2&&j==m/2) cout << c;
      else cout << ".";
    }
    cout << endl;
  }
  return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a[3];

int main() {
	inc(i, 3) { cin >> a[i]; }
	sort(a, a + 3);
	
	int x = (a[2] - a[0]) / 2 + (a[2] - a[1]) / 2;
	int y = (a[2] - a[0]) % 2 + (a[2] - a[1]) % 2;
	int ans = x + (y == 0 ? 0 : 3 - y);
	
	cout << ans << endl;
	
	return 0;
}


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

int main() {
	int e, ans;
	while ( cin >> e && e != 0 ) {
		ans = 1000000;
		for ( int z = 0; z * z * z <= e; z++ ) {
			for ( int y = 0; z * z * z + y * y <= e; y++ ) {
				int x = e - z * z * z - y * y;
				if ( x + y + z < ans ) ans = x + y + z;
			}
		}
	cout << ans << endl;
	}
}

Measured memory_bytes: 1160
n=int(input())

dp=[200000]*(n+1)
dp[0]=0

for i in range(n+1):
    power=1
    while power<=i:
        dp[i]=min(dp[i], dp[i-power]+1)
        power*=6
    power=9
    while power<=i:
        dp[i]=min(dp[i], dp[i-power]+1)
        power*=9

print(dp[n])

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int a, b;
    cin >> a >> b;

    if(a == 1) a += 20;
    if(b == 1) b += 20;

    if(a > b){
        cout << "Alice" << endl;
    }else if(a < b){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    int n = 0 ; 
    cin >> n ;
    double bais[n+1] , probab[n+1][n+1] , ans = 0 ;
    for(int i = 1 ; i <= n ; i++)
        cin >> bais[i] ;
    for(int i = 0 ; i <= n ; i++)
        for(int j = 0 ; j <= n ; j++)
            probab[i][j] = 0 ;
    probab[0][0] = 1 ;
    for(int i = 1 ; i <= n ; i++)
        probab[i][0] = probab[i-1][0]*(1-bais[i]) ;
    for(int i = 1 ; i <= n ; i++)
        for(int j = 1 ; j <= i ; j++)
            probab[i][j] = bais[i]*(probab[i-1][j-1]) + probab[i-1][j]*(1-bais[i]) ;
    /*for(int i = 1 ; i <= n ; i++){
        for(int j = 0 ; j <= n ; j++)
            cout << probab[i][j] << " " ;
        cout << "\n" ;
    }*/
    for(int i = n/2+1 ; i <= n ; i++)
        ans += probab[n][i] ;
    cout << fixed << setprecision(10) << ans ;
}

Measured memory_bytes: 74024
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.IArray           as IA
import qualified Data.Array.IO               as AI
import qualified Data.Array.MArray           as MA
import qualified Data.Array.ST               as STA
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import qualified Data.Graph                  as G
import           Data.Int
import qualified Data.IntMap                 as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence               as SQ
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Tree                   as T
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putLn :: Show a => a -> IO ()
putLn = print

putList :: Show a => [a] -> IO ()
putList [n] = put n
putList (n:ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n] = putStr n
putStrList (n:ns) = do
  putStr n
  putStr " "
  putStrList ns

main = do
  [r] <- readInt
  [g] <- readInt
  put $ g * 2 - r


Measured memory_bytes: 380
<?php
$C=str_split(fgets(STDIN));
$s='';
foreach($C as $c){
	$n=ord($c);
	if(64<$n && $n<91) $s.=chr($n+32);
	elseif(96<$n && $n<123) $s.=chr($n-32);
	else $s.=$c;
}
echo $s;

Measured memory_bytes: 15452
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ac = 0;
		int wa = 0;
		int tle = 0;
		int re = 0;
		for(int i = 0 ; i < N ; ++i){
			String s = sc.next();
			switch (s) {
			case "AC":
				++ac;
				break;
			case "WA":
				++wa;
				break;
			case "TLE":
				++tle;
				break;
			case "RE":
				++re;
				break;
			default:
				break;
			}
		}
		System.out.printf("AC x %d\n" , ac);
		System.out.printf("WA x %d\n" , wa);
		System.out.printf("TLE x %d\n" , tle);
		System.out.printf("RE x %d\n" , re);
	}
}


Measured memory_bytes: 57448
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
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; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	int x = (-1 + sqrt(1 + 8 * N)) / 2;
	int y = N - x*(x + 1) / 2;
	for (int i = 1; i <= x + 1; i++) {
		if (i == x + 1 - y)continue;
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)

cnt=0
surplus=0
for x in c.values():
    if x>=2 and x%2==1:
        tmp=(x-1)//2
        cnt+=2*tmp
    elif x>=2 and x%2==0:
        tmp=(x-1)//2
        cnt+=2*tmp
        surplus+=1

if surplus%2==0:
    cnt+=surplus
else:
    cnt+=surplus+1
    
print(n-cnt)

Measured memory_bytes: 17652
#include <bits/stdc++.h>
#define EPS (1e-10)
using namespace std;
 
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
 
 
namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
  bool operator ==(const P& a, const P& b){
    return abs(a.real()-b.real())<EPS&&abs(a.imag()-b.imag())<EPS;
  }
}
 
double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
 
int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)?????????´???????????????(c-a)?????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)?????????´???????????????(c-a)?????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
 
bool isIntersect(L s1, L s2){  
  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}
 
P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}
 
bool onEdge(P a){return a.real()==-100||a.real()==100||a.imag()==-100||a.imag()==100;}
 
int Unique(vector<P> &p){
  int res=0;
  for(int i=0;i<(int)p.size();i++){
    int flg=1;
    for(int j=i+1;j<(int)p.size();j++) if(p[i]==p[j]) flg=0;
    res+=flg;
  }  
  return res;
}
 
int main(){
  int n;
  while(cin>>n,n){
    int ans=1;
    vector<L> v;
     
    for(int i=0;i<n;i++){
      int sx,sy,gx,gy;
      cin>>sx>>sy>>gx>>gy;
      L l=L(P(sx,sy),P(gx,gy));
       
      vector<P> p;
      for(int i=0;i<v.size();i++){
    if(!isIntersect(l,v[i]))continue;
    P cp=crossPoint(l,v[i]);
    if(!onEdge(cp))p.push_back(cp);
      }
      ans+=1+Unique(p);
      v.push_back(l);
    }  
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3048
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << x << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector< int > A(n);

    REP (i, n) {
        scanf("%d", &A[i]);
    }

    vector< int > l(n);
    vector< int > r(n);

    l[0] = A[0];
    r[n - 1] = A[n - 1];

    FOR (i, 1, n) {
        l[i] = __gcd(l[i - 1], A[i]);
        r[n - i - 1] = __gcd(r[n - i], A[n - i - 1]);
    }

    int maxv = max(r[0], max(r[1], l[n - 2]));

    FOR (i, 1, n - 1) {
        maxv = max(maxv, __gcd(l[i - 1], r[i + 1]));
    }

    OUT(maxv);

    return 0;
}



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

int main()
{
    string a,b;
    cin>>a>>b;
    int n = a.size(),count=0;
    for(int i = 0 ; i < n ; i++ )
        if(a[i] != b[i])
            count++;
    cout<<count<<endl;
}

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

m, r = a[-1], 0
mid = m/2

for i in range(n-1):
    if a[i] >= mid:
        r = a[i] if abs(mid - a[i]) < abs(mid - a[i-1]) else a[i-1]
        break

print(m, r)


Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

string S;
ll ans = 0;
int n;

void dfs(int i, ll sum, ll k) {
    if (i == n) {
        ans += sum + k;
        return;
    }

    int s = S[i] - '0';
    dfs(i + 1, sum + k, s);
    dfs(i + 1, sum, 10 * k + s);
}

int main() {
    cin >> S;
    n = S.size();
    dfs(1, 0, S[0] - '0');
    cout << ans << endl;
}

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

int main() {
    int N; cin >> N;
    vector<int long long> a(N);
    for (int i=0; i<N; ++i) cin >> a[i];
    int ans = 0;
    for (int i=0; i<N; ++i) ans += a[i] - 1;
    cout << ans << endl;
}   

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

int main() {
  long long N, H;
  cin >> N;
  vector<long long> line(N);
  
  for (int i = 0; i < N; i++) {
    cin >> line.at(i);    
  }

  long long temp_max = line.at(0);
  string ans = "Yes";
  
  for (int i = 1; i < N; i++) {
    if (line.at(i) < temp_max - 1) {
      ans = "No";
      break;
    }
    else if (line.at(i) > temp_max)
      temp_max = line.at(i);
  }

  cout << ans << endl;
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;
    put((int)sqrt(n) * (int)sqrt(n))
    return 0;
}

Measured memory_bytes: 3680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong();
        long d = s.nextLong();
        long x,y;
        int res=0;
        for(long i=0;i<n;i++){
            x=s.nextLong();
            y=s.nextLong();
            if(x*x+y*y<=d*d)
                res++;
        }
        System.out.println(res);
    }
    static int gcd(int a, int b)
    {
        if(b==0) {
            return a;
        }
        return gcd(b,a%b);
    }
    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

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

const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get()
{
    if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
    if(H==T) return -1;return *H++;
}
inline int read()
{
    int x=0;char c=Get();
    while(!isdigit(c)) c=Get();
    while(isdigit(c)) x=x*10+c-'0',c=Get();
    return x;
}
inline int readopt()
{
    char c=Get();
    while(c!='+'&&c!='-') c=Get();
    return c;
}

typedef long long LL;
const int N=100010;
int num[N],n,k;
char opt[N];
LL f[2][3];

int main()
{
    n=read();
    num[0]=read();
    for(int i=1;i<n;i++)
    {
        opt[i]=readopt();
        num[i]=read();
    }
    f[k=0][0]=num[0];
    f[0][1]=f[0][2]=-(1ll<<60);
    for(int i=1;i<n;i++,k^=1)
    {
        if(opt[i]=='+')
        {
            f[k^1][0]=max(max(f[k][0],f[k][1]),f[k][2])+num[i];  //原地转移 或 拆1/2个括号
            f[k^1][1]=max(f[k][1],f[k][2])-num[i];  //原地转移 或 拆1个括号
            f[k^1][2]=f[k][2]+num[i];  //原地转移
        }
        else
        {
            f[k^1][0]=max(max(f[k][0],f[k][1]),f[k][2])-num[i];  //原地转移 或 拆1/2个括号
            f[k^1][1]=max(max(f[k][1],f[k][2])+num[i],f[k][0]-num[i]);  //原地转移 或 拆1个括号 或 添1个括号
            f[k^1][1]=max(max(f[k][1]-num[i],f[k][2]-num[i]),f[k^1][1]);  //拆1/2个括号又添1个括号
            f[k^1][2]=max(f[k][2]-num[i],f[k][1]+num[i]);  //原地转移 或 添1个括号
            f[k^1][2]=max(f[k][2]+num[i],f[k^1][2]);  //拆1个括号又添1个括号
        }
    }
    LL ans=max(max(f[k][0],f[k][1]),f[k][2]);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1792
import kotlin.*


fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val s = sc.nextCharArray()
        val n = s.size
        val ans = Array(n) { 0 }

        var f = false
        var cnt = 0
        for (i in 0 until n) {
            if (s[i] == 'R') {
                if (!f) {
                    f = true
                    cnt = 0
                }
                cnt++
            } else if (f) {
                ans[i] += cnt / 2
                ans[i - 1] += (cnt + 1) / 2
                f = false
            }
        }
        f = false
        for (i in n - 1 downTo 0) {
            if (s[i] == 'L') {
                if (!f) {
                    f = true
                    cnt = 0
                }
                cnt++
            } else if (f) {
                ans[i] += cnt / 2
                ans[i + 1] += (cnt + 1) / 2
                f = false
            }
        }

        println(ans.joinToString(" "))
    }
}

class MyScanner {
    private var ptr = 0
    private var l = listOf<String>()

    fun next(): String {
        while (l.size <= ptr) {
            l = readLine()!!.split(' ')
            ptr = 0
        }
        return l[ptr++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun list(): List<String> {
        ptr = l.size
        return readLine()!!.split(' ')
    }

    fun intList() = list().map { s -> s.toInt() }
    fun longList() = list().map { s -> s.toLong() }
    fun doubleList() = list().map { s -> s.toDouble() }

    fun array() = list().toTypedArray()
    fun intArray() = intList().toIntArray()
    fun longArray() = longList().toLongArray()
    fun doubleArray() = doubleList().toDoubleArray()
}


Measured memory_bytes: 41852
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i, k;
    db ans = LLONG_MIN, rp = 1, rs = 0;
    cin >> n >> k;
    vll a(n);
    for(i = 0; i < n; i++)
        cin >> a[i];
    for(i = 0; i < k; i++)
        rs += a[i];
    ans = max(ans, (rs + k) / 2);
    for(i = k; i < n; i++)
        rs += a[i] - a[i - k], ans = max(ans, (rs + k) / 2);
    printf("%.12lf\n", ans);
    return 0;
}

Measured memory_bytes: 1792
fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    loop {
        let d: u32 = sc.read();
        let e: f64 = sc.read();
        if d == 0 { break; }
        let mut answer = 1e18;
        for x in 0..d + 1 {
            let y = d - x;
            let x = x as f64;
            let y = y as f64;
            let x2 = x * x;
            let y2 = y * y;
            let dist = (x2 + y2).sqrt();
            let cost = (dist - e).abs();
            if answer > cost {
                answer = cost;
            }
        }
        println!("{}", answer);
    }
}

pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(reader: R) -> Scanner<R> {
        Scanner { reader }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=5;
int a[N][N];
bool win()
{

    if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1)
        return 1;

    if(a[0][2]==-1 && a[1][1]==-1 && a[2][0]==-1)
        return 1;

    if(a[0][0]==-1 && a[0][1]==-1 && a[0][2]==-1)
        return 1;
    if(a[1][0]==-1 && a[1][1]==-1 && a[1][2]==-1)
        return 1;
    if(a[2][0]==-1 && a[2][1]==-1 && a[2][2]==-1)
        return 1;

    if(a[0][0]==-1 && a[1][0]==-1 && a[2][0]==-1)
        return 1;

    if(a[0][1]==-1 && a[1][1]==-1 && a[2][1]==-1)
        return 1;
    if(a[0][2]==-1 && a[1][2]==-1 && a[2][2]==-1)
        return 1;


return 0;


}
void change(int x)
{

    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
        {
            if(a[i][j]==x)
            {
                a[i][j]=-1;
            }
        }

}
int main()
{
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
        {
            cin>>a[i][j];
        }
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        int x;
        scanf("%d",&x);
        change(x);
    }
    if(win()){
        printf("Yes");
    }
    else{
        printf("No");
    }

}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
int main(){
    int N;
    cin >> N;
    vector < tuple <string,int,int> > g(N);
    for(int i=0;i<N;i++){
        //cin >> g.at(i).first >> g.at(i).second;
        //g.at(i).third = i;
        string s;
        int p;
        cin >> s >> p ;
        g.at(i) = make_tuple(s,100-p,i+1); 
    }
    sort(g.begin(),g.end());
    for(int i = 0;i< N; i++){
        string a;
        int b,c;
        tie(a,b,c) = g.at(i);
        //cout << a<< " "<<100- b<<" " <<c << endl;
        cout << c << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)

bool prime[1000000];
int cou[1000000]={0};

int main(){
	int n;
	
	rep(i, 1000000) prime[i] = true;
	prime[1]=false;
	for(int i=1;i*i<1000000;i++){
		if(prime[i]){
			for(int j=i*i;j<1000000;j+=i){
				prime[j]=false;
			}
		}
	}
	rep(i,999999){
		if(prime[i+1]) cou[i+1]=cou[i]+1;
		else cou[i+1]=cou[i];
	}
	while(cin>>n){
		cout<<cou[n]<<endl;
	}
	return 0;
}

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define FI ios::sync_with_stdio(false); cin.tie(0);

#define LL long long

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;

int main() {
	int n,x,t;
	cin >> n >> x >> t;
	int ans = t * ((n + (x-1))/x);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3628
N = int(input())
S = input()

d = {"R": 0, "G": 0, "B": 0}
for i in range(N):
    d[S[i]] += 1

cnt = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = 2 * j - i
        if k >= N:
            continue

        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            cnt += 1

print(d["R"] * d["G"] * d["B"] - cnt)


Measured memory_bytes: 73308
#include <bits/stdc++.h>
using namespace std;
int mark[200];
int main(){
  	char str[5];
  	scanf("%s",str);
  int a=0;	
  	for(int i=0;i<4;i++){
    	 mark[str[i]]++;
    	if(mark[str[i]]==2)a++;
    }
  	if(a==2)puts("Yes");
  	else puts("No");
	return 0;
}

Measured memory_bytes: 256
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
typedef pair<ii,ii> iiii;
long long mod = 1000000007LL;
long long base = 37;
long long large = 1000000000000000000LL;


void gcdE(long long a,long long b,long long& d,long long& x,long long& y){
	if(!b){
		d=a;
		x=1;
		y=0;
	}else{
		gcdE(b,a%b,d,y,x);
		y-=x*(a/b);
	}
}

//to calculate (a/b) mod n, change it to ((a mod n)*inv(b,n)) mod n
long long inv(long long a,long long n){
	long long d,x,y;
	gcdE(a,n,d,x,y);
	return d==1?(x+n)%n:-1;
}

long long mul(long long x,long long y){
	return (x*y)%mod;
}
int main(){
	int n,m;
	cin>>n>>m;
	if(n<m) swap(n,m);
	vector<long long> p(n+m+1,1LL);
	for(int i=1;i<=n+m;i++){
		p[i]=1LL*i*p[i-1];
		p[i]%=mod;
	}
	if(n==m){
		cout<<(mul(p[n],p[n])*2LL)%mod<<endl;
	}else{
		if(n==m+1){
			cout<<mul(p[n],p[m])<<endl;
		}else{
			cout<<0<<endl;
		}
	}




	/*int totalcase;
	int testcase=0;
	cin>>totalcase;
	ofstream out;
	out.open("result.txt");

	while(totalcase--){
		testcase++;
		out<<"Case #"<<testcase<<": ";
		cout<<testcase<<": "<<endl;

		//GOGOGO


		//END
	}
	out.close();*/

	return 0;
}


Measured memory_bytes: 1792
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

tree = [[] for i in range(n)]

dp0 = [0 for i in range(n)]
dp1 = [0 for i in range(n)]

dp0[0] = 1
dp1[-1] = 1

for i in range(n-1):
    o,p = m()
    o -= 1
    p -= 1
    tree[o].append(p)
    tree[p].append(o)

de = cl.deque([0,-1])
co = 1
while de:
    po = de.popleft()
    if po == -1:
        co += 1
        if len(de) == 0:
            break
        de.append(-1)
        continue
    for i in tree[po]:
        if dp0[i] == 0:
            dp0[i] = co
            de.append(i)

de = cl.deque([n-1,-1])
co = 1
while de:
    po = de.popleft()
    if po == -1:
        co += 1
        if len(de) == 0:
            break
        de.append(-1)
        continue
    for i in tree[po]:
        if dp1[i] == 0:
            dp1[i] = co
            de.append(i)

dp0[0] = 0
dp1[-1] = 0

co = 0

for i in range(n):
    co += 1 if dp0[i] - dp1[i] <= 0 else -1
if co > 0:
    print("Fennec")
else:
    print("Snuke")





Measured memory_bytes: 29400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
struct RangeSum{
    vector<T> cs;
    RangeSum(const vector<T>& v){
        cs.resize(v.size());
        REP(i, v.size()){
            cs.at(i) = v.at(i);
            if(i > 0){
                cs.at(i) += cs.at(i - 1);
            }
        }
    }
    T query(ll l, ll r){
        if(l >= r || cs.size() == 0){ return 0; }
        r = min((ll)cs.size(), r);
        T ret = cs.at(r - 1);
        if(l > 0){
            ret -= cs.at(l - 1);
        }
        return ret;
    }
};


int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), a2(n);
    REP(i, n){
        cin >> a.at(i);
        a2.at(i) = max(0LL, a.at(i));
    }

    RangeSum<ll> rs1(a), rs2(a2);

    ll ans = numeric_limits<ll>::min();
    REP(i, n - k + 1){
        ll tmp = rs2.query(0, i) + rs2.query(i + k, n);
        ans = max(ans, tmp);
        ans = max(ans, tmp + rs1.query(i, i + k));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6432
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define M 256
int main(){
	ll x;
	cin>>x;
	vector<int> res; res.reserve(5000);
	rep(i, 7) res.pb(i);
	rep(i, 8){
		ll y = x%M;
		if(i==7) y = x;
		rep(k, y) res.pb(7);
		x /= M;
		if(i==7) break;
		rep(j, 8){
			for(int k = 6; k >= i+1; k--) res.pb(k);
			rep(k, 1<<j) res.pb(i);
		}
	}
	string s, fes = "FESTIVAL";
	rep(i, res.size()) s += fes[res[i]];
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
jumps = [int(n) for n in input().split()]

dp = [float("inf")] * N
dp[0] = 0

for i in range(N - 1):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(jumps[i] - jumps[i + 1]))
    if i + 2 < N:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(jumps[i] - jumps[i + 2]))

print(dp[-1])

Measured memory_bytes: 20448
n = int(input())
xl_lis = [list(map(int,input().split())) for i in range(n)]
tempx = -(10**10)
ans = 0
xl_lis.sort()
# print(xl_lis)
for i in xl_lis:
    a = i[0]
    b = i[1]
    if tempx > a - b and tempx < a + b:
        ans += 1
    
    elif tempx > a - b and tempx >= a + b:
        ans += 1
        tempx = a + b
    else:
        tempx = a + b
print(n-ans)


Measured memory_bytes: 27872