akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif

ll n,a,b,c,d,mi;
map<ll,ll> dp;
ll solve(ll n) {
	if (n==0) return 0;
	if (dp.count(n)) return dp[n];
	ll ans = 4e18, t;
	REP(u,-1,1) if (n+u>=0&&(n+u)%2==0) { 
		t = solve((n+u)/2);
		ans = min(ans,t+a+abs(u)*d);
		if (n/2<=(ans-t-abs(u)*d)/d) ans=t+n/2*d+abs(u)*d;
	}
	REP(u,-2,2) if (n+u>=0&&(n+u)%3==0) {
		t = solve((n+u)/3);
		ans=min(ans,t+b+abs(u)*d);
		if (2*n/3<=(ans-t-abs(u)*d)/d) ans=t+2*n/3*d+abs(u)*d;
	}
	REP(u,-4,4) if (n+u>=0&&(n+u)%5==0) {
		t = solve((n+u)/5);
		ans=min(ans,t+c+abs(u)*d);
		if (4*n/5<=(ans-t-abs(u)*d)/d) ans=t+4*n/5*d+abs(u)*d;
	}
	if (n>mi/d&&ans!=4e18) { 
		dp[n]=ans;
	}
	else dp[n]=min(ans,solve(n-1)+d);
	return dp[n];
}

void work() {
	dp.clear();
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	mi=min({a,b,c,d});
	dp[1]=d;
	printf("%lld\n",solve(n));
}
int main() {
	int t;
	scanf("%d", &t);
	while (t--) work();
}









Measured memory_bytes: 4560
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    int A, B; cin >> A >> B;

    if (B % A == 0) cout << A + B << endl;
    else cout << B - A << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){  
     int p;
     int a[5]={1,2,3,4,5},b[5];
     for(int i=0;i<5;i++){
         cin >> b[i]; 
     }
     for(int n=0;n<5;n++){
         if(b[n]==0){
             p=a[n];
         }
     }
    cout << p;
    return 0;
 }

Measured memory_bytes: 3588
N = list(map(int, list(input())))

s = sum(N)
op = ["+", "+", "+"]
def print_result(numbers, ops):
    print("{}{}{}{}{}{}{}=7".format(numbers[0], ops[0],
                                 numbers[1], ops[1],
                                 numbers[2], ops[2],
                                 numbers[3]))
        
if s == 7:
    print_result(N, op)
elif (N[0] - N[1] - N[2] - N[3]) == 7:
    print_result(N, ["-", "-", "-"])
else:
    d = (s - 7) / 2
    indexes = [i for i, x in enumerate(N) if x == d]
    if len(indexes) > 1:
        op[indexes[-1] - 1] = "-"
        print_result(N, op)
        exit()
    elif len(indexes) > 0 and (not indexes[0] == 0):
        op[indexes[0] - 1] = "-"
        print_result(N, op)
    else:
        if (N[0] - N[1] - N[2] + N[3]) == 7:
            print_result(N, ["-", "-", "+"])
        elif (N[0] - N[1] +  N[2] - N[3]) == 7:
            print_result(N, ["-", "+", "-"])
        else:
            print_result(N, ["+", "-", "-"])


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

int main(){
    int n;
    cin >> n;
    vector<int> h(n),num(n,0),sum(n,0);
    for(int i = 0; i < n; i++) cin >> h[i];
    for(int i = 0; i+1 < n; i++){
        if(h[i] >= h[i+1]) num[i] = 1;
    }
    int max = 0;
    for(int i = 0; i < n; i++){
        if(num[i] != 1) continue;
        else if(i >= 1 && num[i] == 1 && num[i-1] == 1) continue;
        int j = 0;
        while(num[i+j] == 1){
            sum[i]++; j++;    
        }
        if(max < sum[i]) max = sum[i];
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };


ll ans = inf;
int n, m, x;
int c[15], a[15][15];
int dp[15];

void dfs(int b, ll cost) {
	if (b == n) {
		bool f = true;
		rep(i, m) {
			if (dp[i] < x)f = false;
		}
		if (f)ans = min(ans, cost);
	}
	else {
		dfs(b + 1, cost);

		rep(i, m) {
			dp[i] += a[b][i];
		}

		dfs(b + 1, cost + c[b]);

		rep(i, m) {
			dp[i] -= a[b][i];
		}
	}

}

int main() {

	cin >> n >> m >> x;
	rep(i, n) {
		cin >> c[i];
		rep(j, m) {
			cin >> a[i][j];
		}
	}

	dfs(0, 0);

	if (ans != inf)cout << ans << endl;
	else cout << -1 << endl;

	return 0;
}


Measured memory_bytes: 3600
#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
#include<numeric>
#include <string.h>
#include <unordered_map>
#include <set>

using namespace std;

typedef long long ll;

string s;

void solve() {
    int n;
    cin >> n >> s;
    if (n & 1) {
        cout << "No";
        return;
    }
    if (s.substr(0, n / 2) == s.substr(n / 2, n / 2)) {
        cout << "Yes";
        return;
    }
    cout << "No";
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

// const long long N = ;
const long long MOD = 1e9 + 7;
long long n, A, AB, ABC;
string s;

int main() {
	ios_base::sync_with_stdio(false);

	cin >> s;
	long long nr = 1;
	for(auto i : s) {
		if(i == 'A')
			A += nr;
		else if(i == 'B')
			AB += A;
		else if(i == 'C')
			ABC += AB;
		else {
			ABC = 3 * ABC + AB;
			AB = 3 * AB + A;
			A = 3 * A + nr;
			nr *= 3;
		}
		A %= MOD;
		AB %= MOD;
		ABC %= MOD;
		nr %= MOD;
		// dbg(A, AB, ABC);
	}
	cout << ABC << '\n';
}	

	

Measured memory_bytes: 512
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			double t1=sc.nextDouble();
			double t2=sc.nextDouble();
			double[] s1={70.0, 55.0, 50.0, 43.0, 40.0, 37.5, 35.5};
			double[] s2={148.0, 116.0, 105.0, 89.0, 83.0, 77.0, 71.0};
			String[] s={"E", "D", "C", "B", "A", "AA", "AAA"};
			String ans="NA";
			for(int i=0; i<7; i++){
				if(t1<s1[i]&&t2<s2[i])
					ans=s[i];
				else
					break;
			}
			println(ans);
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;

int main()
{
  // 整数の入力
  ll X;
  ll current = 100;
  ll turn  = 0;
  cin >> X;
  while(current < X){
    current = current + current/100;
    turn++;
  }
  cout << turn << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(long long N, std::string S, long long Q, std::vector<long long> k) {
  rep(q, Q) {
    ll kNum = k[q];
    ll dNum = 0;
    ll mNum = 0;
    ll cNum = 0;
    ll mcNum = 0;
    ll dmNum = 0;
    ll dmcNum = 0;

    rep(r, N) {
      ll l = r - kNum;
      if (l >= 0) {
        if (S[l] == 'D') {
          dNum--;
          dmNum -= mNum;
        } else if (S[l] == 'M') {
          mNum--;
          mcNum -= cNum;
        } else if (S[l] == 'C') {
          cNum--;
        }
      }

      if (S[r] == 'D') {
        dNum++;
      } else if (S[r] == 'M') {
        mNum++;
        dmNum += dNum;
      } else if (S[r] == 'C') {
        cNum++;
        mcNum += mNum;
        dmcNum += dmNum;
      }
    }
    print(dmcNum);
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;
  long long Q;
  scanf("%lld", &Q);
  std::vector<long long> k(Q - 1 - 0 + 1);
  for (int i = 0; i < Q - 1 - 0 + 1; i++) {
    scanf("%lld", &k[i]);
  }
  solve(N, S, Q, std::move(k));
  return 0;
}


Measured memory_bytes: 2308
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll unit = a + b;
    ll clusters = n / unit;
    ll modulo = n % unit;
    ll ans = clusters * a + min(modulo, a);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

int main() {
    ios_base::sync_with_stdio(false);

    int a, b, c;
    cin >> a >> b >> c;
    if((a == b && a != c) || (a == c && b != a) || (b == c && a != c)) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string forecast,reality;
    cin>>forecast>>reality;
    int count=0;
    for (int i=0;i<3;i++) {
        if (forecast.at(i)==reality.at(i)) {
            count++;
        }
    }
    cout<<count<<endl;
}


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

using namespace std;

string S;
int K;

int main() {

    cin >> S;
    cin >> K;

    int one = 0;
    int i = 0;

    while(S[i] == '1'){
        one++;
        i++;
    }

    if(K <= 100 && K <= one){
        cout << 1 << endl;
        return 0;
    }
    else {
        cout << S[i] << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int x,y;

	while (1){
		scanf("%d %d", &x, &y);
		if(x == 0 && y == 0){
			break;
		}
		else if (x > y) {
			printf("%d %d\n", y, x);
		}
		else {
			printf("%d %d\n", x, y);
		}
	}

	return (0);
}

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

bool C(ll X,ll A,ll B){
	for(ll i=max(1LL,X/2-3);i<=min(X,X/2+3);i++){
		ll k=i;
		if(k>=A)k++;
		ll j=X+(B<=X)+1-i;
		if(B<=X&&j<=B)j--;
		if(k*j>=A*B)return 0;
	}
	return 1;
}
int main(){
	int q;cin>>q;
	rep(i,q){
		ll a,b;scanf("%lld%lld",&a,&b);
		ll l=0,r=INT_MAX;
		while(r-l>1){
			ll t=(l+r)/2;
			if(C(t,a,b))l=t;
			else r=t;
		}
		printf("%lld\n",l);
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 100000000000000000

int main() {
    long double A;
    long double B;
    cin >> A >> B;
    ll ans = floor((long double)A * B);
    cout << ans << endl;
}

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

namespace ProgramingStudying2
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToList();

            var ans = new int[n];

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

            for(int i = 0; i < n - 1; i++)
            {
                Console.Write("{0} ",ans[i]);
            }
            Console.Write(ans[n - 1]);
        }
    }
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

bool used[51][51][51][51];
string roomL[51], roomR[51];

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  while (true) {
    int R, C;
    cin >> C >> R;
    if (R == 0 && C == 0) break;
    REP(i, R) cin >> roomL[i] >> roomR[i];

    int slr = 0, slc = 0, elr = 0, elc = 0, srr = 0, src = 0, err = 0, erc = 0;
    REP(r, R) REP(c, C) {
      if (roomL[r][c] == 'L') slr = r, slc = c;
      if (roomR[r][c] == 'R') srr = r, src = c;
      if (roomL[r][c] == '%') elr = r, elc = c;
      if (roomR[r][c] == '%') err = r, erc = c;
    }
    //cout << slr << ' ' << slc << ' ' << elr << ' ' << elc << ' ' << srr << ' ' << src << ' ' << err << ' ' << erc << endl;
    REP(i, R) REP(j, C) REP(k, R) REP(l, C) used[i][j][k][l] = false;
    
    queue<P> que;
    que.push(P(slr * C + slc, srr * C + src));

    bool flag = false;
    while (!que.empty()) {
      P p = que.front(); que.pop();
      int lr = p.first / C, lc = p.first % C, rr = p.second / C, rc = p.second % C;
      //cout << lr << ' ' << lc << ' ' << rr << ' ' << rc << endl;
      if (lr == elr && lc == elc && rr == err && rc == erc) {
	flag = true;
	break;
      } else if (used[lr][lc][rr][rc] || (lr == elr && lc == elc) || (rr == err && rc == erc)) {
	continue;
      }

      used[lr][lc][rr][rc] = true;
      REP(i, 4) {
	int nlr = lr + dr[i], nlc = lc + dc[i], nrr = rr + dr[(i+2*(i&1))%4], nrc = rc + dc[(i+2*(i&1))%4];
	if (nlr < 0 || nlr >= R || nlc < 0 || nlc >= C || roomL[nlr][nlc] == '#') nlr = lr, nlc = lc;
	if (nrr < 0 || nrr >= R || nrc < 0 || nrc >= C || roomR[nrr][nrc] == '#') nrr = rr, nrc = rc;
	if (!used[nlr][nlc][nrr][nrc]) que.push(P(nlr * C + nlc, nrr * C + nrc));
      }
    }
    cout << (flag ? "Yes" : "No") << endl;    
  }
  return 0;
}

Measured memory_bytes: 10348
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    k, s = map(int, readline().split())
    ans = 0

    for x in range(k + 1):
        if s - x > 2 * k or s - x < 0:
            continue
        for y in range(k + 1):
            z = s - x - y
            if z > k or z < 0:
                continue
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73264
N, M = map(int, input().split())
A = [int(a) for a in input().split()]
L = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
A.sort(reverse = True)
#print(A)
dp = [0] + ([-1]*N)
#print(dp)
for i in range(1, N+1):
    for a in A:
        if L[a] <= i:
            dp[i] = max(dp[i], dp[i-L[a]] * 10 + a)
#print(dp)
print(dp[-1])


Measured memory_bytes: 14692
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	}
}


Measured memory_bytes: 35564
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll beki(int n){
  if(n==0) return 1;
  else return 2*beki(n-1);
}
int main(){
  int N, A;
  cin >> N >> A;


  vector<int> x;
  int count_0 = 0;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    if(a!=A){
      x.push_back(a-A);
    }else{
      count_0++;
    }
  }

  if(x.empty()){
    cout << beki(count_0) -1 <<endl;
    return 0;
  }
  
  int l = x.size();


  ll cnt[l+1][5001];

  for(int i=0;i<=l;i++){
    for(int j=0;j<5001;j++){
      cnt[i][j] = 0;
    }
  }

  cnt[0][2500]++;
  //cout << cnt[0][250] <<endl;

  for(int i=1;i<=l;i++){
    for(int j=0;j<5001;j++){
      if(0<=j-x[i] && j-x[i]<5001){
        cnt[i][j] = cnt[i-1][j] + cnt[i-1][j - x[i-1]];
      }else{
        cnt[i][j] = cnt[i-1][j]; 
      }
    }
  }
  //cout << cnt[4][250] <<endl;

  if(cnt[l][2500]==1){
    cout << beki(count_0) -1 << endl;
  }else{
    cout << (cnt[l][2500]-1)*beki(count_0) + beki(count_0) -1 <<endl;
  }
  
  return 0;
}



Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = 998244353;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int n;
int a[N], f[N];

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    cin>>n;
    int mx = -1;
    f(i, n) {
        cin>>a[i];
        mx = max(mx, a[i]);
        f[a[i]]++;
    }
    int ans = 1;
    if(a[0] != 0) {
        cout<<0;
        return 0;
    }
    if(f[0] != 1) {
        cout<<0;
        return 0;
    }
    for(int i = 1; i <= mx; i++) {
        if(f[i] == 0) {
            cout<<0;
            return 0;
        }
        ans = mul(ans, power(f[i - 1], f[i]));
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

const int N = 3e5 + 10;
int n;
LL C, x[N];
int v[N];
LL sb[N], db[N];

int main() {
    cin >> n >> C;
    n++;
    for (int i = 1; i < n; ++i) {
        scanf("%lld%d", &x[i], &v[i]);
        x[n + i] = x[i];
        v[n + i] = v[i];
    }
    for (int i = 1; i <= n; ++i) {
        sb[n + i] = v[n + i]; sb[n - i] = v[n - i];
        db[n + i] = v[n + i]; db[n - i] = v[n - i];
        sb[n + i] += sb[n + i - 1] - (x[i] - x[i - 1] + C) % C;
        sb[n - i] += sb[n - i + 1] - (x[n - i + 1] - x[n - i] + C) % C;
        db[n + i] += db[n + i - 1] - 2 * ((x[i] - x[i - 1] + C) % C);
        db[n - i] += db[n - i + 1] - 2 * ((x[n - i + 1] - x[n - i] + C) % C);
    }
    for (int i = 1; i <= n; ++i) {
        sb[n + i] = max(sb[n + i], sb[n + i - 1]);
        sb[n - i] = max(sb[n - i], sb[n - i + 1]);
        db[n + i] = max(db[n + i], db[n + i - 1]);
        db[n - i] = max(db[n - i], db[n - i + 1]);
    }
    // for (int i = 0; i <= 2 * n; ++i)
    //     printf("%lld ", sb[i]);
    // puts("");

    // for (int i = 0; i <= 2 * n; ++i)
    //     printf("%lld ", db[i]);
    // puts("");

    LL ans = 0;
    for (int i = 0; i < n; ++i)
        ans = max(ans, db[n + i] + sb[i + 1]);
    for (int i = 0; i < n; ++i)
        ans = max(ans, db[i + 1] + sb[n + i]);
    cout << ans << endl;
}

Measured memory_bytes: 7936
n=int(input())
A=[int(i) for i in input().split()]
B=[]
for i in range(n):
  B.append((A[i],i+1))
B.sort(key=lambda x:x[0])
Ans=[]
for i in range(n):
  Ans.append(B[i][1])
print(*Ans)

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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

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);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  int a;
  int ans=0;
  for(int i=0;i<3;i++){
    scanf("%d",&a);
    ans+=a;
  }
  if(ans<22){
    printf("win\n");
    return 0;
  }else{
    printf("bust\n");
    return 0;
  }
}

Measured memory_bytes: 1572
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>


using namespace std;

int main() {
  int n;
  cin >> n;
  long double ans=0;

  priority_queue<long double, vector<long double>, greater<long double>> v;

  for (int i=0; i<n; i++) {
    long double v_t;
    cin >> v_t;
    v.push(v_t);
  }

  while(v.size() > 1 ) {
    long double v1 = v.top(); v.pop();
    long double v2 = v.top(); v.pop();

    v.push((v1+v2)/2.0);
    // cout << v1 << " " << v2 << endl;
  }

  cout << v.top() << endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = (1e9)+7;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int a,b;
  cin>>a>>b;
  if(b*2>=a){
  	cout<<0<<endl;
  }else{
  	cout<<abs(a-(2*b))<<endl;
  }
} 








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=1005;
int n,x[maxn],y[maxn];
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d%d",&x[i],&y[i]);
    long long a=1,b=1;
    for (int i=1;i<=n;++i) {
        long long left=1,right=1e18,mmin=1e18;
        while (left<=right) {
            long long mid=(left+right)>>1;
            if (1.0*mid*x[i]>2e18||1.0*mid*y[i]>2e18||(mid*x[i]>=a&&mid*y[i]>=b)) {
                mmin=mid;
                right=mid-1;
            } else left=mid+1;
        }
        a=mmin*x[i];
        b=mmin*y[i];
    }
    cout<<a+b<<endl;
    return 0;
}


Measured memory_bytes: 3676
def resolve():
  s = input()
  ans = 1
  if s == 'SUN':
    ans = 7
  elif s == 'SAT':
    ans = 1
  elif s == 'FRI':
    ans = 2
  elif s == 'THU':
    ans = 3
  elif s == 'WED':
    ans = 4
  elif s == 'TUE':
    ans = 5
  elif s == 'MON':
    ans = 6
  print(ans)
  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> tree(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  long long val[N];
  fill(val, val + N, 0);
  while (Q--) {
    int p;
    long long x;
    cin >> p >> x;
    val[--p] += x;
  }
  function<void(int, int)> dfs = [&](int v, int p) {
    for (int u : tree[v])
      if (u != p) {
        val[u] += val[v];
        dfs(u, v);
      }
  };
  dfs(0, -1);
  for (int i = 0; i < N; i++) cout << val[i] << (i == N - 1 ? '\n' : ' ');
  return 0;
}


Measured memory_bytes: 34272
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    a, b = MI()
    print(a * b)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9084
a=[]
i=0
while 1:
    l=input().split()

    h=int(l[0])
    w=int(l[1])

    if h==0 and w==0:
        break
    else:
        a.append(h)
        a.append(w)
        i=i+2
m=0
while m<i:
    while a[m]>0:
        print(a[m+1]*"#")
        a[m]=a[m]-1
    print("")
    m=m+2



Measured memory_bytes: 5624
import math

A, B = map(int, input().split())

tax_a = 0.08
tax_b = 0.1

start_price = math.ceil(A / tax_a)
stop_price = math.ceil((A+1) / tax_a)

for i_price in range(start_price, stop_price):
    if math.floor(i_price * tax_b) == B:
        ans = i_price
        break
else:
    ans = -1

print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=1e5+100;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

LL v[N];
int main()
{
	int n=gi(),P=gi(),i,w,b;LL sum=0;
	for (i=1;i<=n;i++) {
		w=gi(),b=gi();
		v[i]=1LL*(P-100)*w-1LL*P*b;
		sum+=1LL*P*b;
	}
	sort(v+1,v+1+n);
	for (i=1;sum>0;sum+=v[i++]);
	cout<<i-1<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <complex>
#include <bitset>
 
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double ld;

int main() {
    //ifstream cin("input.txt");
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m, k;
    cin >> n >> m >> k;
    for (int a = 0; a <= n; ++a) {
        for (int b = 0; b <= m; ++b) {
            int x = a * (m - b) + b * (n - a);
            if (x == k) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
}


Measured memory_bytes: 256
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (200006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define MSB(bm) ((bm==0)?-1:(63-__builtin_clzll((bm))))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}inline ll gcd(ll a,ll b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
// #define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
// #define degug(...) 663
#define cerr if(0)cout
#endif
#warning "// FOR has been inclusive now!!!!"
ll n, A[MAXN], B[MAXN];
ll cy(ll x)  { return (x-1+n)%n + 1; }
int main()
{
	FAST
	cin>>n;
	FOR(i,1,n)cin>>A[i];
	FOR(i,1,n)cin>>B[i];
	priority_queue <pi> pq;
	FOR(i,1,n) pq.emplace(B[i], i);
	ll ans=0;
	while(pq.size()) {
		ll i=pq.top().s, x=pq.top().f; pq.pop();
		if(A[i] > B[i]) { cout<<"-1\n"; return 0; }
		if(A[i]==B[i]) continue;
		// if(pq.size() && B[i]-(((x-pq.top().f)/(B[cy(i-1)]+B[cy(i+1)]) + 1) * (B[cy(i-1)]+B[cy(i+1)])) >= A[i]) B[i]-=(((x-pq.top().f)/(B[cy(i-1)]+B[cy(i+1)]) + 1) * (B[cy(i-1)]+B[cy(i+1)])), ans+=((x-pq.top().f)/(B[cy(i-1)]+B[cy(i+1)]) + 1);
		// else B[i]-=( (ll)ceill((x-A[i])/(ld)(B[cy(i-1)]+B[cy(i+1)])) * (B[cy(i-1)]+B[cy(i+1)]) ), ans+=(ll)ceill((x-A[i])/(ld)(B[cy(i-1)]+B[cy(i+1)]));
		ll two=B[cy(i-1)]+B[cy(i+1)]; if(((x-A[i])/two)*two == 0) { cout<<"-1\n"; return 0; }
		B[i]-=(ll)((x-A[i])/two)*two;
		ans+=(ll)((x-A[i])/two);
		if(A[i]>B[i]) { cout<<"-1\n"; return 0; }
		if(A[i]^B[i]) pq.emplace(B[i], i);
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 9584
#include <bits/stdc++.h>
#define N 50000
using namespace std;
typedef long long ll;
bool used[N];

ll SumD(ll a,ll d,ll n){return (n*(2*a+(n-1)*d))/2;}

bool mark(ll n){
  bool res=1;
  for(ll i=1;i*i<=min((ll)N,n);i++)res&=!used[i],used[i]=1;
  return res;
}

int main(){
  while(1){
    ll n,m,p[21];
    cin>>n>>m;
    if(!n&&!m)break;
    for(int i=0;i<m;i++)cin>>p[i];
    sort(p,p+m);
  
    ll sum=0,cnt=0;
    for(int i=0;i<m;i++){
      sum+=SumD(p[i],p[i],n/p[i]);
      cnt+=n/p[i];
      memset(used,0,sizeof(used));
      for(int j=0;j<i;j++){
	ll lcm=(p[i]/__gcd(p[i],p[j]))*p[j];
	if(!mark(lcm))continue;
	sum-=SumD(lcm,lcm,n/lcm);
	cnt-=(n/lcm);
      }
    }

    printf("%.8f\n",(p[0]!=1)*(1.0*SumD(1,1,n)-sum)/max(1LL,(n-cnt)));
  }
  return 0;
}

Measured memory_bytes: 3256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int C = scanner.nextInt();

        int[] B = new int[M];
        for(int i=0; i<M; i++){
            B[i] = scanner.nextInt();
        }

        int cnt = 0;
        for(int i=0; i<N; i++){
            int sum = C;
            for(int j=0; j<M; j++){
                sum += B[j] * scanner.nextInt();
            }

            if(sum > 0){
                cnt++;
            }
        }

        System.out.println(cnt);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

string to_binary(ll x) {
    string res;
    while (x > 0) {
        char add = (char)(x%2+'0');
        res.push_back(add);
        x/=2;
    }
    return res;
}

int main(int argc, char const *argv[]) {
    ll n,k; cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i], --a[i];

    vector<vector<int>> nxt(70, vector<int>(n));
    rep(i,n) nxt[0][i] = a[i];
    for (int i = 1; i < 70; ++i) {
        rep(j,n) {
            nxt[i][j] = nxt[i-1][nxt[i-1][j]];
        }
    }

    string s = to_binary(k);

    int cur = 0;
    rep(i,s.length()) {
        if (s[i]=='1') {
            cur = nxt[i][cur];
        }
    }
    cout << cur+1 << '\n';
    return 0;
}

Measured memory_bytes: 59748
input_list = []
for i in range(0, 3):
  input_list.append(int(input()))

h = input_list[0]
w = input_list[1]
n = input_list[2]

temp_num = 0
if w <= h:
  temp_num = h
else:
  temp_num = w

answer = 0
if n % temp_num == 0:
  answer = int(n / temp_num)
else:
  answer = (n // temp_num) + 1
print(answer)

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	var k int
	var s string

	fmt.Scanf("%d\n", &k)
	fmt.Scanf("%s\n", &s)

	if len(s) > k {
		fmt.Print(s[:k]+"...")
	} else {
		fmt.Print(s)
	}
}


Measured memory_bytes: 1844
#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
using namespace std;
using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

// プロトタイプ宣言
// int myfunc(int, vvec);

// グローバル変数
// int N, M;
// vvec data(N, vec(M));

// 関数：

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

	int H, W, A, B;
	cin >> H >> W >> A >> B;

	vvec s(H, vec(W, 0));
	rep(i, B) {
		rep(j, A) s.at(i).at(j) = 0;
		for(int j=A; j<W; j++) s.at(i).at(j) = 1;
	}
	for(int i=B; i<H; i++) {
		rep(j, A) s.at(i).at(j) = 1;
		for(int j=A; j<W; j++) s.at(i).at(j) = 0;
	}

	rep(i, H) {
		rep(j, W) cout << s.at(i).at(j);
		cout << endl;
	}
	return 0;
}
// std::string str;
// str = std::to_string(int i);
// bitset<3> s(N);


Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EQ(a,b) (abs((a)-(b))<EPS)
#define chmin(a,b) (a) = min((a),(b))
#define chmax(a,b) (a) = max((a),(b))
using namespace std;
typedef double D;
const D EPS = 1e-8;

struct elevator{
  int cap,rem;
  D v,ts,pos,stop;
  elevator(int a,D b,D c,D d):
    cap(a),v(b),ts(c),pos(d){rem = a; stop=-1;}
  
  D reachTime(D goal){
    if(stop>-EPS)return ts - stop;
    if(rem == 0)return pos/v;
    return abs(goal - pos)/v;
  }

  int move(D goal, D t){
    if(stop>-EPS){
      stop += t;
      if(EQ(stop,ts))stop = -1;
      return 0;
    }

    if(rem==0)goal = 0;
    pos += (goal>pos)?v*t:-v*t;
    if(EQ(goal,pos)){
      stop = 0;
      if(EQ(pos,0)){
	int res = cap-rem;
	rem = cap;
	return res;
      }
    }
    return 0;
  }
};

int main(){
  int N,M;

  while(cin >> N >> M, N){
    D d;
    cin >> d;
    bool flag = false;

    vector<int> device(N);
    rep(i,N)cin >> device[i];

    vector<elevator> el;
    rep(i,M){
      int c,v,ts,x;
      cin >> c >> v >> ts >> x;
      el.push_back(elevator(c,v,ts,d*(x-1)));
    }

    D k,tx,ty,tz;
    cin >> k >> tx >> ty >> tz; k--;
    vector<D> burn(N,-1);
    burn[k] = tx;
    int uf = k+1, df = k-1;
    D nxtu = ty, nxtd = tz;

    int ans = device[0];
    D curTime = 0, lastTime = 0;
    for(;;){
      int goal = -1;
      rep(i,N)if(device[i])goal = i;
      if(goal<1)break;

      D nxtTime = 1e9;
      rep(i,N){
	if(burn[i]>-EPS)chmin(nxtTime, burn[i]);
      }
      if(uf<N)chmin(nxtTime,nxtu);
      if(df>=0)chmin(nxtTime,nxtd);

      rep(i,M)chmin(nxtTime, el[i].reachTime(d*goal) );

      curTime += nxtTime;

      rep(i,N){
	if(burn[i]>-EPS){
	  burn[i] -= nxtTime;
	  if(EQ(burn[i],0)){
	    device[i] = 0;
	    burn[i] = -1;
	  }
	}
      }

      nxtu -= nxtTime;
      if(EQ(nxtu,0)){
	if(uf<N)burn[uf] = tx;
	uf++; nxtu = ty;
      }

      nxtd -= nxtTime;
      if(EQ(nxtd,0)){
	if(df>=0)burn[df] = tx;
	df--; nxtd = tz;
      }

      rep(i,M){
	int num = el[i].move(d*goal,nxtTime);
	if(num){
	  ans += num; chmax(lastTime, curTime + el[i].ts);
	}

	if(EQ(el[i].pos,d*goal) && EQ(el[i].stop,0)){
	  int tmp = min(el[i].rem, device[goal]);
	  el[i].rem -= tmp; device[goal] -= tmp;
	  if(tmp && goal)flag = true;
	}
      }
    }

    rep(i,M){
      if(el[i].rem != el[i].cap){
	ans += el[i].cap - el[i].rem;
	D nxtTime = el[i].pos/el[i].v + el[i].ts;
	if(el[i].stop>-EPS)nxtTime += el[i].ts-el[i].stop;
        chmax(lastTime, curTime + nxtTime);
      }
    }
    cout << fixed << setprecision(6) << ans << " "
      	 << (flag?lastTime:0.0) << endl;
  }
}

Measured memory_bytes: 1308
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
 
int main() {
	int a,b;
	int ans;
	cin >> a >> b;
	int outlet = 1;
	while(outlet < b){
	outlet--;
	ans++;
	outlet += a;
	}
	cout << ans << endl;
		return 0;
}

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

const long long INF = 1LL << 60;

int main() {
    ll N; cin >> N;
    vector<ll> a(N, 0);
    ll sum = 0;
    for(ll i=0; i<N; i++){
        cin >> a.at(i);
        sum += a.at(i);
    }

    if(N==2){
        cout << (ll)abs(a.at(1) - a.at(0)) << endl;
        return 0;
    }

    ll tmp = a.at(0);
    ll min_diff = INF;
    for(ll i=1; i<N-1; i++){
        ll diff;
        tmp += a.at(i);
        diff = (ll)abs(tmp - (sum-tmp));
        min_diff = min(diff, min_diff);
    }

    cout << min_diff << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define repl(k,n) for(k=0;k<n;++k)

int main() {
	int a;
	cin >> a;
	cout << a + pow(a, 2) + pow(a, 3);
	return 0;
}

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

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

	bool ans = false;

	for (int i = 1; i < 10; i++) {
		for (int j = i; j < 10; j++ ) {
			if (i * j == n) ans = true;
		}
	}

	cout << (ans ? "Yes" : "No") << "\n";
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  int a = 0;
  rep(i, 3){
    int b; cin >> b;
    a += b;
  }
  if(a >= 22)cout << "bust" << endl;
  else cout << "win" << endl;
  return 0;
}


Measured memory_bytes: 256