akhauriyash/Code-Regression huggingface dataset:
// Given an array of integers of size ‘n’.
// Our aim is to calculate the maximum sum of ‘k’
// consecutive elements in the array.

/*{{{*/
#include<bits/stdc++.h>
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(), (X).end()
#define rep(I, A, B) for (int I = (A); I <= (B); ++I)
#define repr(I, A, B) for (int I = (A); I >= (B); --I)
#define fors(I, S) for (int I = 0; S[I]; ++I)
#define get_pos(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define mp make_pair
#define pb emplace_back
#define ms0(X) memset((X), 0, sizeof((X)))
#define ms1(X) memset((X), -1, sizeof((X)))
#define len(X) strlen(X)
#define in insert
#define cn count
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef set<int> si;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
#define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
/*}}}*/

const int SIZE = 1e6 + 10;

vi p;
bool prime[SIZE];

void sieve() {
	memset(prime, true, sizeof(prime));
	for (int i = 2; i * i <= SIZE; ++i) {
		if (prime[i] == true) {
			for (int j = i * i; j <= SIZE; j += i) {
				prime[j] = false;
			}
		}
	}
	rep(i, 2, SIZE)
	if (prime[i])
		p.pb(i);
}

void solve() {
	sieve();
	int x;
	R(x);
	int pos = get_pos(p, x);
	W(p[pos]);
}

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

#define MULTITEST 0
#if MULTITEST
	CASET {
		solve();
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 4840
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<int> a(N);
    for (int &t: a)
        cin>>t;

    long long inv = 10000000000000LL;
    vector<vector<long long>> T(N, vector<long long>(N, inv));

    function<long long(int, int)> f = [&](int p, int q) -> long long
    {
        if (p>q)
            return 0;
        if (T[p][q] != inv)
            return T[p][q];
        return T[p][q] = max(
            a[p] - f(p+1, q),
            a[q] - f(p, q-1));
    };
    cout<<f(0, N-1)<<endl;
}


Measured memory_bytes: 70912
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
 
using namespace std;
 
int main()
{
    int n;
    cin >> n;
 
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
 
    long sum = 0;
    long cost1 = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i % 2 == 0) {
            if (sum <= 0) {
                cost1 += -sum + 1;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                cost1 += sum + 1;
                sum = -1;
            }
        }
    }
 
    sum = 0;
    long cost2 = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i % 2 == 1) {
            if (sum <= 0) {
                cost2 += -sum + 1;
                sum = 1;
            }
        } else {
            if (sum >= 0) {
                cost2 += sum + 1;
                sum = -1;
            }
        }
    }
 
    cout << min(cost1,cost2) << endl;
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

ll gcd (ll a, ll b) {
  if (a < b) swap(a, b);
  while (b > 0ll) {
    ll tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
};



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

  ll a, b;
  while (cin >> a >> b) {
    ll g = gcd(a, b);
    ll l = a / g;
    l *= b;
    cout << g << " " << l << endl;
  }

  return 0;
};



Measured memory_bytes: 3108
n= int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans=0

for i in range(0,n):
    ans += b[a[i]-1]


    if i>=1:
        if a[i]==a[i-1]+1:

            ans+=c[a[i]-2]


print(ans)


Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
const int N=1e5+10,mod=1e9+7,OO=0x3f3f3f3f;
typedef long long ll;
ll n,x,y,dp[N][2];
vector<int>adj[N];
void dfs(int u=1,int p=-1){
    dp[u][0]=dp[u][1]=1;
    for(auto v:adj[u]){
        if(v==p)continue;
        dfs(v,u);
        dp[u][0]=(dp[u][0]*((dp[v][1]+dp[v][0])%mod))%mod;
        dp[u][1]=(dp[u][1]*dp[v][0])%mod;
    }


}
int main()
{
    Elhabashy
    input();
    cin>>n;
    for(int i=1;i<n;i++){
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    dfs();
    ll ans = dp[1][0]+dp[1][1];
	cout<<(ans%mod+mod)%mod<<endl;
}


Measured memory_bytes: 17568
(setq s(concatenate 'list(read-line)))
(setq m 0)
(setq p 0)
(loop for i from 0 to(1-(length s))do
      (if(or(char= (nth i s)#\A)(char= (nth i s)#\T)(char= (nth i s)#\G)(char= (nth i s)#\C))
         (incf p)
         (progn(setq m(max m p))(setq p 0))))
(princ(max m p))

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

typedef long long ll;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = min(b - 1, n);
  ll ans = (ll)(a * x / b) - (a * (ll)(x / b));
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3616
N, M = map(int, input().split())
A=[0]*N
ans=0
e=0
for i in range(M):
  s, c = map(int, input().split())
  if(s==1 and c==0 and N!=1):
    print(-1)
    e=1
    break
  if A[s-1]==0 or A[s-1]==c:
  	A[s-1]=c
  else:
    print(-1)
    e=1
    break
if A[0]==0 and N!=1:
  A[0]=1
for i in range(N):
  ans+=A[i]*(10**(N-i-1))
if e==0:
  print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
int l[100010],r[100010],idx[100010];

int c(const void*p,const void*q){
	if(r[*(int*)p]<r[*(int*)q])return -1;
	return 1;
}

int main(){
	int n;
	scanf("%d",&n);
	rep(i,0,n){
		int a,b;
		scanf("%d%d",&a,&b);
		l[i]=a-b;
		r[i]=a+b;
		idx[i]=i;
	}
	qsort(idx,n,sizeof(int),c);
	int ans=0,end=-2e9-10;
	rep(i,0,n){
		if(end<=l[idx[i]]){
			ans++;
			end=r[idx[i]];
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int ls, lt, flag=0;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  ls = s.size();
  lt = t.size();
  if(ls<lt){
    for(int i=0; i<ls; i++){
      if(s[i]>t[i]){
        cout << "No";
        return 0;
      }
      if(s[i]<t[i]){
        cout << "Yes";
        return 0;
      }
    }
    cout << "Yes";
    return 0;
  }
  if(ls>=lt){
    for(int i=0; i<lt; i++){
      if(s[i]>t[i]){
        cout << "No";
        return 0;
      }
      if(s[i]<t[i]){
        cout << "Yes";
        return 0;
      }
    }
    cout << "No";
    return 0;
  }
}

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

using std::pair;
using std::make_pair;
typedef pair<int, int> Pair;

#define update_max(a, b) if ((a) < (b)) (a) = (b)
#define update_min(a, b) if ((a) > (b)) (a) = (b)

void run(int case_id = 0) {
  long long n;
  std::cin >> n;
  long long answer = n * (n - 1) / 2;
  std::cout << answer << "\n";
}

void multi_cases_main() {
  int num_tests;
  std::cin >> num_tests;
  for (int t = 1; t <= num_tests; ++ t) {
    run(t);
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  run();
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



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

	string N;
	int K;


	cin >> N >> K;
	long long dp[102][4][2] = {};
	dp[0][0][0] = 1;

	rep(i, N.size()) rep(j, K) rep(k, 2) {
		dp[i + 1][j][k || 0 < N[i] - '0'] += dp[i][j][k];
		for(int d=1;d<10;d++){
			if (k == 0 && d >N[i] - '0')break;

			dp[i + 1][j + 1][k || d < N[i] - '0'] += dp[i][j][k];
		}
	}
	long long ans = 0;
	rep(i, N.size() + 1) rep(k, 2) {
		ans += dp[i][K][k];
	}
	cout << ans << endl;




	return 0;
}

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

#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define ll long long

int main(void)
{
    ll sum,t;
    char c;
    while(1)
    {
        sum=0;t=0;
        while((c=getchar())!='\n')
        {
            t++;
            sum+=c-'0';
        }
        if(sum==0&&t==1)
        {
            break;
        }
        printf("%lld\n",sum);
    }
    return 0;
}




Measured memory_bytes: 2032
#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);

    n = n % 1000;
    if(n != 0){
        n = 1000 - n;
        printf("%d\n", n);
    }
    else {
        printf("%d\n", n);        
    }

    return 0;
}


Measured memory_bytes: 1708
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF = 1000000100;

int main(){
    int N;
    string S,T;
    cin >> N;
    cin >> S >> T;
    string u="";
    for(int i=0;i<N;i++){
        u+=S[i];
        u+=T[i];
    }
    cout << u << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

const ll INF = 4e18;
const int MM = 100010;
int n, w;
ll dp[MM];

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

    cin >> n >> w;
    fill(dp + 1, dp + MM, INF);
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        for (int j = MM - 1; j >= b; j--) {
            dp[j] = min(dp[j], dp[j - b] + a);
        }
    }
    int ans = MM - 1;
    while (dp[ans] > w) ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
		long long x,y;
		cin >> x >> y;

		int res = 0;

		long long ai = x;
		while (ai <= y){
				ai = ai * 2;
				res += 1;
		}
		cout << res << endl;
		return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
 int N,M,X,Y;
  in(N>>M>>X>>Y);
  vl x(N),y(M);
  rep(i,N) in(x[i]);
  rep(i,M)in(y[i]);
 sort(all(x));
  sort(all(y));
  bool f = false;
  for(int i=X+1;i<=Y;i++){
   if(x[N-1]<i&&i<=y[0]) f = true; 
  }
  if(f) out("No War");
  else out("War");
}

Measured memory_bytes: 256
n = int(input())
MX = 10**18
a = [int(x) for x in input().split()]
for x in a:
  if x == 0:
    print(0)
    exit(0)
ans = 1
for x in a:
  ans *= x
  if ans > MX:
    print(-1)
    exit(0)
print(ans)

Measured memory_bytes: 21708
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  long long x, i, j, p;
  cin >> x;
  vector<int> buf;
  for (j = 0; j <= 1000; j++){
    if (j >= 2){
      p = j;
      while(p <= x){
        buf.push_back(p);
        p *= j;
      }
    }
    else{
      buf.push_back(j);
    }
    if (j*j > x) break;
  }
  sort(buf.begin(), buf.end());
  cout << buf.back() << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int main()
{
    int N, M, X[100000];
    cin >> N >> M;
    for(int i = 0; i < M; i++) cin >> X[i];
    sort(X, X+M);

    int diff[100000];
    for(int i = 0; i < M - 1; i++) diff[i] = X[i+1] - X[i];

    long long int ans = 0;
    sort(diff, diff + M - 1);
    for(int i = 0; i < M - 1 - (N - 1); i++) ans += diff[i];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <map>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int main()
{
    long long n,k;
    cin >> n >> k;
    cout << min(n%k, k-(n%k)) << endl;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int n;cin>>n;
    vector<pair<int,int>>a(n);

    rep(i,n){
        int aa;cin>>aa;
        a[i]=make_pair(aa,i+1);

    }
    sort(a.begin(),a.end());

    rep(i,n){
        cout<<a[i].second<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 1664
N=int(input())
A=list(map(int,input().split()))

L=sum(A)

LS=A[0]
for i in range(1,N):
    LS+=A[i]
    if LS>L/2:
        L1=LS-A[i]
        L2=L-L1
        L3=LS
        L4=L-LS
        ans=min(abs(L1-L2),abs(L3-L4))
        print(ans)
        exit()




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

int main(void) {
    int N;
    cin >> N;
    
    vector<int> a(N);

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

    sort(a.begin(), a.end());
    cout << a[N-1] - a[0] << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  double A,B;
  scanf("%lf", &A);
  scanf("%lf", &B);
  if(A > B){
    printf("GREATER\n");
  }else if(A == B){
    printf("EQUAL\n" );
  }else{
    printf("LESS\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;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int h,a;
    cin >> h >> a;
    int count=0;
    while(true){
        if(h<=0) break;
        else{
            h-=a;
            count++;
        }
    }
    cout << count << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> p(N);
  for (int i = 0; i < N; i++) cin >> p[i];
  
  int min;
  int count = 0;
  
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      min = p[i];
      count++;
    }
    else if (p[i] < min) {
      min = p[i];
      count++;
    }
  }
  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> p;
#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 rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define srep(i, from, to) for(int i = from; i < (int)(to); i++)
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
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;
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> x(n);
  rep(i, n) cin >> x[i];

  ll ans = LINF;
  ll minx = x[0];
  ll maxx = x[k - 1];
  ans = abs(maxx - minx);
  ans += min(abs(maxx), abs(minx));

  k--;
  for(int i = k; i < n; i++) {
    minx = x[i - k];
    maxx = x[i];
    ll res = abs(maxx - minx);
    res += min(abs(maxx), abs(minx));
    // cout << res << " " << minx << " " << maxx << endl;
    chmin(ans, res);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
/*"for if God is with them who can be against them."
   it's beter to die struggling than to abandon the effort where there is still
   a chance of accomlishing something more..NEVER GIVE UP.
   */

/* "IF THERE IS NO WAY OUT LOOK AT THE BOTTOM". */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define endl '\n'
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
#define watch(x) cout << (#x) << " is " << (x) << endl
void solve() {
	int n, x, t;
	cin >> n >> x >> t;
	int k = n / x + (n % x > 0);
	cout << (t * k);
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	IOS;
	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
	return 0;
	/*TRY AGAIN, NO MATTER HOW MANY TIMES YOU FAILED ALWAYS TRY ONCE MORE*/
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n,k;
int h[110];
int main(){
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		int x;
		cin>>x;
		for(int j=1;j<=x;j++){
			int y;
			cin>>y;
			h[y]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(!h[i])ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main()
{
	string s;
	cin >> s;
	bool flag = false;
	char ans;

	vector<char> alphabet =
	{ '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' };

	for (int i = 0; i < s.size(); i++)
	{
		for (int j = 0; j < alphabet.size(); j++)
		{
			if (s.at(i) == alphabet.at(j))
			{
				alphabet.at(j) = '0';
			}
		}
	}

	for (int i = 0; i < alphabet.size(); i++)
	{
		if (alphabet.at(i) != '0')
		{
			flag = true;
			ans = alphabet.at(i);
			break;
		}
	}

	if (flag)
	{
		cout << ans << endl;
	}
	else
	{
		cout << "None" << endl;
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ll int n,d;
    cin>>n>>d;
    ll int count=0;
    while(n--)
    {
        double a,b;
        cin>>a>>b;
        a=a*a;
        b=b*b;
        double m;
        m=sqrt(a+b);
        if(m<=d) count++;
        
    }
    cout<<count;
    return 0;
}


Measured memory_bytes: 3748
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String[] input = scanner.nextLine().split(" ");
    int input1 = Integer.parseInt(input[0]);
    int input2 = Integer.parseInt(input[1]);
    
    int sum = 0;
    for (int i = 0; i < 2; i++) {
      if (input1 > input2) {
        sum += input1;
        input1--;
      }
      else {
        sum += input2;
        input2--;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

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

    auto it = unique(s.begin(), s.end());
    s.resize(distance(s.begin(), it));
    cout << len(s) << '\n';
    
    return 0;
}

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

int main(){
    long long n, a, b;
    cin >> n >> a >> b;

    if(n == 1 and a != b){
        printf("0\n");
        return 0;
    }

    if(a > b){
        printf("0\n");
        return 0;
    }

    printf("%lld\n", (a+(n-1)*b) - ((n-1)*a + b)+1);

    return 0;
}

Measured memory_bytes: 256
n=int(input())
l=[int(i) for i in input().split()]
 
l.sort()
 
def func(one,two,three):
  if len({one,two,three})==3 and one+two>three:
    return True
  return False
 
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three=l[k]
      if func(one,two,three):
        ans+=1
        
print(ans)

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

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define LL long long
#define ULL unsigned long long
#define LB lower_bound
#define MOD1 1000000007
#define MOD2 1000000009

int main()
{
    static const int _ = []() {
        ios::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        return 0;
    }();
    int n;
    cin >> n;

    vector<int> dp(3);

    for (int day = 0; day < n; day++)
    {
        vector<int> new_dp(3, 0);
        vector<int> c(3);
        for (int i = 0; i < 3; i++)
        {
            cin >> c[i];
        }

        for (int i = 0; i < 3; i++) //prev day
        {
            for (int j = 0; j < 3; j++) //curr day
            {
                if (i != j)
                    new_dp[j] = max(new_dp[j], c[j] + dp[i]);
            }
        }
          dp = new_dp;
    }

    cout << max(dp[1], max(dp[2], dp[0]));
    return 0;
}


Measured memory_bytes: 256
use std::io;
use std::str;

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buffer: vec![],
        }
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }

    pub fn tokens<T: str::FromStr>(&mut self) -> Vec<T> {
        assert!(self.buffer.is_empty());
        let mut input = String::new();
        self.reader.read_line(&mut input).expect("Failed read");
        input
            .split_whitespace()
            .map(|x| x.parse().ok().expect("Failed parse"))
            .collect()
    }
}

const INF: i64 = 2000000000;
const MAX_SUM_VALUES: usize = 100000;

// v: sum of the values of the chosen items
// dp[v]: the minimum total weight of items with total value v exactly.
fn push_dp(n: usize, max_weight: usize, weights: &[i64], values: &[i64]) -> i64 {
    let mut dp = [INF; MAX_SUM_VALUES + 1];
    dp[0] = 0;
    let sum_values = values.iter().sum::<i64>() as usize;
    for i in 0..n {
        for v in (0..=MAX_SUM_VALUES).rev() {
            let new_value = v + values[i] as usize;
            let prev = dp[v];
            if new_value <= MAX_SUM_VALUES {
                dp[new_value] = dp[new_value].min(prev + weights[i]);
            }
        }
    }
    let mut ans = 0;
    for v in (0..=sum_values).rev() {
        if dp[v] as usize <= max_weight {
            ans = v;
            break;
        }
    }
    ans as i64
}

// f(0, W) = 0
// f(n, W) = f(n - 1, W)
// f(n, W) = f(n - 1, W - weights[n]) + values[n]
fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n: usize = scan.token();
    let max_weight: usize = scan.token();
    let mut weights = Vec::new();
    let mut values = Vec::new();
    for _ in 0..n {
        weights.push(scan.token::<i64>());
        values.push(scan.token::<i64>());
    }
    let ans = push_dp(n, max_weight, &weights, &values);
    writeln!(out, "{}", ans).ok();
}

fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());
    solve(&mut scan, &mut out);
}


Measured memory_bytes: 2972
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd

#define CIN(x) int x;cin>>x;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";
#define ENDL cout<<endl;

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end());

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    CIN(n);
    V d(n);
    VECCIN(d);
    CIN(m);
    V t(m);
    VECCIN(t);

    M first_;
    FOREACH(x,d)first_[x]++;
    M second_;
    FOREACH(x,t)second_[x]++;

    bool flag=true;
    FOREACH(x,second_){
        if(x.second>first_[x.first])flag=false;
    }
    YES(flag);

    return 0;
}


Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    int a,b;
    cin >> a >> b;
    rep(i,10000){
        double p;
        p=i*0.08;
        if(a!=(int)p)continue;
        p=i*0.1;
        if(b!=(int)p)continue;
        cout << i;
        return 0;
    }
    cout << -1;



    
}

/*
*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //10^19 < 9223372036854775807
typedef unsigned long long ull; //10^20 < 18446744073709551615

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

#define MOD 1000000007

int main(void)
{
    ll N,K;
    cin >> N >> K;

    vector<int> H(N);
    REP (i,N) {
        cin >> H[i];
    }

    ll ans = 0;
    sort(H.begin(),H.end());
    REP (i,N-K) {
        ans += H[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3952
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  string s;
  cin>>s;
  rep(i,0,s.sz-1){
    if(s[i]==s[i+1]){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
  }
  rep(i,0,s.sz-2){
    if(s[i]==s[i+2]){
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << -1 << " " << -1 << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
using namespace std;

int main()
{
    string S;
    cin >> S;
    string T = "BW";
    int index = 0;
    if (S[0] == 'W') {
        index = 1;
    }
    int counter = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] != T[index]) {
            counter++;
            index = index == 1 ? 0 : 1;
        }
    }
    printf("%d\n", counter);
}

Measured memory_bytes: 512
def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    lcount = 0
    rcount = 0
    merged = []
    while lpos < len(left) and rpos < len(right):
        if left[lpos] <= right[rpos]:
            merged.append(left[lpos])
            lpos += 1
            lcount += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            rcount += 1
    
    if left[lpos:]:
        merged.extend(left[lpos:])
        lcount += len(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
        rcount += len(right[rpos:])
        
    return merged, lcount + rcount

if __name__ == '__main__':
    n = int(raw_input())
    A = map(long, raw_input().split())
    
    sorted, count = merge_sort(A)
    print ' '.join(str(x) for x in sorted)
    print count

Measured memory_bytes: 62928
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxc 1000010

int main()
{
    int n;
    cin>>n;
    if(n%111>0)
        cout<<(n/111+1)*111<<endl;
    else
        cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N; string S;
int E[301010], W[301010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> S;

    rep(i, 0, N) {
        if (S[i] == 'E') E[i] = 1;
        else W[i] = 1;
    }

    rep(i, 1, N) {
        W[i] += W[i - 1];
        E[i] += E[i - 1];
    }

    int ans = inf;
    rep(i, 0, N) {
        int sm = 0;
        if (i) sm += W[i - 1];
        sm += E[N - 1] - E[i];
        chmin(ans, sm);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3092
import sys
input = sys.stdin.buffer.readline

mod = 10 ** 9 + 7
n = int(input())
a = list(map(lambda x: format(int(x), "b").zfill(60), input().split()))

ans = 0
for i in range(60):
    cnt = 0
    for j in a:
        if j[- i - 1] == "1":
            cnt += 1
    tmp = cnt * (n - cnt)
    for _ in range(i):
        tmp = tmp * 2 % mod
    ans += tmp
print(ans % mod)

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

double di(double a,double b,double c,double d){return sqrt((c-a)*(c-a)+(d-b)*(d-b));}

int main(){
    double pai=3.141592653589;
    double x1,y1,x2,y2,ans;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    printf("%lf\n",di(x1,y1,x2,y2));
    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}
map<int64_t, int> prime_factor(int64_t n)
{
    map<int64_t, int> ret;
    for (int64_t i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

void solve(long long S)
{
    ll x3, y3;
    y3 = ceil(S,1000000000);
    x3 = 1000000000 * y3 - S;

    cout << "0 0 1000000000 1 " << x3 << " " << y3 << endl;
}
int main()
{
    long long S;
    scanf("%lld", &S);
    solve(S);
    return 0;
}


Measured memory_bytes: 256
//3Ìª¯¶<=>3Ì¤¿2æÁ½Ïª¢¸êà³
#define c(a,b,c,d,e,f)(c-a)*(f-b)-(e-a)*(d-b)
main(){float d,e,f,g,h,i,m,n,o,p,q;for(;~scanf("%f%f%f%f%f%f%f%f",&d,&e,&f,&g,&h,&i,&m,&n);puts(o*p>0&&p*q>0?"YES":"NO"))o=c(d,e,f,g,m,n),p=c(f,g,h,i,m,n),q=c(h,i,d,e,m,n);return 0;}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using static System.Math;

class Program
{
    static void Main()
    {
        long x = long.Parse(Console.ReadLine());
        long n = (long)(-1 + Sqrt(1 + 8 * x)) / 2;
        if (n * (n + 1) / 2 < x) n++;
        Console.WriteLine(n);
    }
}

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

#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 0; (int)(n) < i; i--)
#define Int long long
using namespace std;

int main(void){
   int c,d;
   cin >> c;
   d = c+(c*c)+((c*c)*c);
   cout << d << endl;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int h,w,k,ans[300][300];
string s[300];
bool f[300];

signed main() {
    cin >> h >> w >> k;
    rep(i,h) {
        cin >> s[i];
        rep(j,w) if (s[i][j] == '#') f[i] = true;
    }
    int now = 0,hoge = h;
    bool F=false;
    rep(i,h) {
        bool fir=false;
        F |= f[i];
        if (!F) continue;
        hoge = min(hoge, i);
        if (f[i]) now++;
        rep(j,w) {
            if (f[i]) {
                if (s[i][j] == '#') {
                    if (fir) now++;
                    fir = true;
                }
                ans[i][j] = now;
            } else {
                ans[i][j] = ans[i-1][j];
            }
        }
    }
    repm(i,hoge) rep(j,w) ans[i][j] = ans[i+1][j];
    rep(i,h) {
        rep(j,w) cout << ans[i][j] << " ";
        cout << endl;
    }

}




Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main(){
    int h,n,a;
    cin>>h>>n;
    for(int i=0;i<n;i++){
        int b;
        cin>>b;
        a+=b;
    }
    if(a<h)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define sb __builtin_popcount
#define MOD (ll)1000000009
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll h, w, k1;
    cin >> h >> w >> k1;
    string s[h];
    for (ll i = 0; i < h; i++)
    {
        cin >> s[i];
    }
    ll ans = LLONG_MAX;
    for (ll i = 0; i < (1 << (h - 1)); i++)
    {
        vector<ll> v;
        ll tans = 0;
        for (ll j = 0; j < h - 1; j++)
        {
            if (i & (1ll << j))
            {
                v.push_back(j + 1);
                tans++;
            }
        }
        v.push_back(h);
        vector<ll> prev;
        for (ll j = 0; j < w; j++)
        {
            vector<ll> sum;
            ll sumt = 0;
            ll ind = 0;
            for (ll k = 0; k < h; k++)
            {
                if (v[ind] == k)
                {
                    sum.push_back(sumt);
                    sumt = (s[k][j] - '0');
                    ind++;
                }
                else
                {
                    sumt += (s[k][j] - '0');
                }
            }
            sum.push_back(sumt);
            ll fl = 0;
            for (auto i : sum)
            {
                if (i > k1)
                {
                    fl = 1;
                    break;
                }
            }
            if (fl == 1)
            {
                tans = LLONG_MAX;
                break;
            }
            else
            {
                if (j == 0)
                {
                    prev = sum;
                }
                else
                {
                    ll fl = 0;
                    for (ll k = 0; k < sum.size(); k++)
                    {
                        if (prev[k] + sum[k] > k1)
                        {
                            fl = 1;
                            break;
                        }
                    }
                    if (fl)
                    {
                        tans++;
                        prev = sum;
                    }
                    else
                    {
                        for (ll k = 0; k < sum.size(); k++)
                        {
                            prev[k] += sum[k];
                        }
                    }
                }
            }
        }
        //cout << i << tans << endl;
        ans = min(ans, tans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    char abc[] = {'a', 'b', 'c'};
    int rem[3] = {9, 9, 9};
    string tmp;
    bool flag[3] = {false, false, false};

    cin >> tmp;

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (tmp[i] == abc[j] && rem[0] != j && rem[1] != j) {
                flag[i] = true;
                rem[i] = j;
                break;
            } else {
                flag[i] = false;
            }
        }
    }

    if (flag[0] && flag[1] && flag[2]) {
        cout << "Yes";
    } else {
        cout << "No";
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define SZ(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
#define repe(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
const int MOD = 1e9 + 7;
string s;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	int n;
	cin >> n;
	cin >> s;
	n = n << 1;
	lint ans = 1;
	int l = 0;
	rep (i, 0, n - 1) {
		int now = (s[i] == 'B');
		if (l) {
			if ((now + l) & 1) {
				++l;
			} else {
				(ans *= l) %= MOD; --l;
			}
		} else {
			if (now) {
				++l;
			} else {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	rep (i, 1, n >> 1) {
		ans = ans * i % MOD;
	}
	if (l) ans = 0;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 720
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
works = []
for i in range(N):
    a, b = getNM()
    works.append([a, b])
works.sort(key = lambda i: i[1])

done = 0
flag = True
for w in works:
    done += w[0]
    if done > w[1]:
        flag = False
print('Yes' if flag else 'No')

Measured memory_bytes: 106860
import java.util.Scanner;
import java.util.function.DoubleUnaryOperator;


public class Main{
	
	public static void main(String[] args){
		DoubleUnaryOperator s = D -> D * D * Math.PI;
		DoubleUnaryOperator t = D -> 2 * D * Math.PI;
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		sc.close();
		System.out.printf("%f %f", s.applyAsDouble(r), t.applyAsDouble(r));
	}
	
}

Measured memory_bytes: 32712
parseInt(x) = parse(Int, x)
function main()
	n = parse(readline())
	h = map(parseInt, split(readline()))
	s = 0
	ans = 0
	for i = 1:n-1
	  if h[i] >= h[i+1]
	    s += 1
	  else
	    ans = max(ans, s)
	    s = 0
	  end
	end
	print(max(ans, s))
end

main()

Measured memory_bytes: 172736
#include<bits/stdc++.h>
long long L[100];
using namespace std;
int main(){
	int n;
	cin>>n;
	L[0]=2;
	L[1]=1;
	for(int i=2;i<=n;i++){
		L[i]=L[i-1]+L[i-2];
	}
	cout<<L[n]<<endl;
	return 0;
}

Measured memory_bytes: 256