akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

int main() {
  int n, x;
  cin >> n >> x;
  VI v(n);
  REP(i, n) {
    cin >> v[i];
  }

  SORT(v);
  int ans = 0;
  bool flag = false;
  REP(i, n) {
    if (x >= v[i]) {
      ans++;
      x -= v[i];
    } else {
      flag = true;
      break;
    }
  }
  if (!flag && x != 0) {
    ans--;
  }

  ANS(ans);
  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  int i = 0;
  while(i * 2 < n)
  {
    i++;
  }
  cout << i << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define yes { cout << "YES" << endl; exit(0); }
#define no { cout << "NO" << endl; exit(0); }
#define impossible { cout << "Impossible" << endl; exit(0); }

using namespace std;

typedef long long ll;
typedef pair<int,int> Pair;

const int Nmax = 5e5 + 5;
const int Mod = 998244353;

int n;
ll cnt[Nmax];
char A[Nmax];
ll pw[Nmax];

int color[Nmax], t[Nmax];
vector<int> changed, edge[Nmax];


void init()
{
    int i;
    for(i=1; i<=n; ++i) t[i] = i, edge[i].clear();
    for(i=1; i<=n; ++i) color[i] = -1;
}

void add_edge(int x, int y)
{
    edge[x].push_back(y); edge[y].push_back(x);
}

int boss(int x)
{
    if(x == t[x]) return x;
    return t[x] = boss(t[x]);
}

bool unite(int x, int y)
{
    x = boss(x); y = boss(y);
    if(x == y) return 0;
    t[x] = y;
    return 1;
}


void dfs(int node, int C = 0)
{
    changed.push_back(node);
    color[node] = C;

    for(auto it : edge[node])
        if(color[it] == -1)
            dfs(it, C ^ 1);
}

void solve(int d)
{
    int i;
    init();

    if(d == 2*n)
    {
        ll ans = 0;

        for(i=1; i<=n; ++i)
            if(A[i] == '1')
            {
                ans += pw[n-i];
                if(ans >= Mod) ans -= Mod;
            }

        ++ans;

        for(i=1; i < d; ++i)
            if(d % i == 0)
            {
                ans -= cnt[i];
                if(ans < 0) ans += Mod;
            }

        ans %= Mod;
        cnt[d] = ans;
        return;
    }





    for(i=1; i<=n-d; ++i)
        unite(i, i+d);

    for(i=1; i<=d; ++i)
        add_edge(boss(i), boss(n-d+i));

    int rest = 0;
    for(i=1; i<=n; ++i)
        if(i == boss(i) && color[i] == -1)
        {
            dfs(i);
            ++rest;
        }

    for(i=1; i<=n; ++i)
        for(auto it : edge[i])
            if(color[it] == color[i]) return; /// nu e bipartit

    for(i=1; i<=n; ++i) color[i] = -1;
    changed.clear();

    ll ans = 0;
    //OK = 1;

    bool state = 1;

    for(i=1; i<=n; ++i)
    {
        bool ok = (color[boss(i)] == -1);

        if(A[i] == '1')
        {
            if(ok) dfs(boss(i), 0);

            if(color[boss(i)] != 1)
                ans += pw[rest - ok];

            ans %= Mod;

            for(auto it : changed) color[it] = -1;
            changed.clear();
        }

        if(ok) dfs(boss(i), A[i] - '0');
            else state &= (color[boss(i)] == A[i] - '0');

        if(ok) --rest;
        changed.clear();

        if(!state) break;
    }

    if(state)
    {
        ans += pw[rest];
        ans %= Mod;
    }

    for(i=1; i < d; ++i)
        if(d % i == 0)
        {
            ans -= cnt[i];
            if(ans < 0) ans += Mod;
        }

    cnt[d] = ans;
}

int main()
{
 //   freopen("input", "r", stdin);
    // freopen("output", "w", stdout);
    cin.sync_with_stdio(false); cin.tie(0);

    cin >> n;
    cin >> (A+1);

    int i;
    ll ans = 0;

    pw[0] = 1;
    for(i=1; i<=2*n; ++i) pw[i] = pw[i-1] * 2 % Mod;

    for(i=1; i<=2*n; ++i)
        if((2*n) % i == 0)
        {
            solve(i);
            ans += (ll) cnt[i] * i;
            ans %= Mod;
        }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 34164
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
l = [0] * n
r = [0] * n
for i in range(1, n):
    l[i] = max(l[i-1], a[i-1])
for i in range(n-2, -1, -1):
    r[i] = max(r[i+1], a[i+1])
for i in range(n):
    print(max(l[i], r[i]))

Measured memory_bytes: 15684
import math

nab = [int(x) for x in input().split()]
n = nab[0]
a = nab[1]
b = nab[2]
counts = []
nums = [int(x) for x in input().split()]
means = []
nums.sort(reverse = True)
for i in range(a, b+1):
  means.append(sum(nums[:i])/i)
  counts.append(int(math.factorial(nums.count(nums[i-1]))/(math.factorial(nums[:i].count(nums[i-1]))*math.factorial(nums.count(nums[i-1])-nums[:i].count(nums[i-1])))))

maxim = max(means)
print(maxim)
k = 0
count = 0
while k<len(means):
  if means[k]==maxim:
    count+=counts[k]
  k+=1
print(count)

#print(means.count(max(means)))

'''
def C(n, k):
  return C(n-1, k-1) + C(n-1, k)
  
for n in range(MAX_N):
  for k in range(MAX_K):
    C[n][k] = C[n-1][k-1] + C[n-1][k]
'''

Measured memory_bytes: 3064
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
//#include <unordered_map>
#include <numeric>
 
using namespace std;
 
const int mod = 1e9 + 7;


long long k;
string s;

int main() {

	cin >> s;
	cin >> k;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == '1') {
			k--;
			if(k <= 0) return cout << 1, 0;
		}else {
			return cout << s[i], 0;
		}
	}
} 

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
-- import Data.List
-- import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace

solve :: Int -> [Int] -> Int
solve n as = maximum [abs (x - y) | x <- as, y <- as]

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
      line2:remLines2 = remLines1
      as = map readBInt line2
  in solve n as

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents


Measured memory_bytes: 892
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            var s = ReadLine();
            int pre = int.Parse(s.Substring(0, 2));
            int after = int.Parse(s.Substring(2, 2));

            if (0<pre && pre <=12)
            {
                if (0 < after && after <= 12)
                {
                    WriteLine("AMBIGUOUS");
                }
                else
                {
                    WriteLine("MMYY");
                }
            }
            else
            {
                if (0<after && after <= 12)
                {
                    WriteLine("YYMM");
                }
                else
                {
                    WriteLine("NA");
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <limits.h>

using namespace std;

int main(int argc, char const* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int w;
    cin >> S >> w;;
    for (int i=0; i<S.length(); i+=w) {
        cout << S[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;


int main(){

	int N,M,maximum,table[1000];

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		maximum = 0;

		for(int i = 0; i < N; i++)scanf("%d",&table[i]);

		for(int i = 0; i < N-1; i++){
			for(int k = i+1; k < N; k++){
				if(table[i]+table[k] <= M){
					maximum = max(maximum,table[i]+table[k]);
				}
			}
		}

		if(maximum == 0){
			printf("NONE\n");
		}else{
			printf("%d\n",maximum);
		}
	}

	return 0;
}

Measured memory_bytes: 2628
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

print(max(a)-min(a))


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

typedef double D;
typedef tuple<D, D> P2;
typedef tuple<D, D, D> P3;

namespace std {
    P2 operator+(const P2 &a, const P2 &b) {
        D ax, ay, bx, by;
        tie(ax, ay) = a;
        tie(bx, by) = b;
        return P2{ax + bx, ay + by};
    }
    P2 operator*(const P2 &a, const P2 &b) {
        D ax, ay, bx, by;
        tie(ax, ay) = a;
        tie(bx, by) = b;
        return P2{ax * bx, ay * by};
    }
    P3 operator-(const P3 &a, const P3 &b) {
        D ax, ay, az, bx, by, bz;
        tie(ax, ay, az) = a;
        tie(bx, by, bz) = b;
        return P3{ax - bx, ay - by, az - bz};
    }
    P3 operator*(const P3 &a, const P3 &b) {
        D ax, ay, az, bx, by, bz;
        tie(ax, ay, az) = a;
        tie(bx, by, bz) = b;
        return P3{ax * bx, ay * by, az * bz};
    }
}

double sum_elem(const P3 &p) {
    D x, y, z;
    tie(x, y, z) = p;
    return x + y + z;
}

int main() {
    int n;
    while(cin >> n, n) {
        vector<P3> p(n), v(n);
        vector<P2> r(n);
        vector<tuple<D, int, int>> time_step(n);
        for (int i = 0; i < n; i++) {
            double px, py, pz, vx, vy, vz, pr, vr;
            cin >> px >> py >> pz >> vx >> vy >> vz >> pr >> vr;
            p[i] = P3{px, py, pz};
            v[i] = P3{vx, vy, vz};
            r[i] = P2{pr, vr};
            time_step[i] = make_tuple(pr/vr, i, -1);
        }

        for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
            // dist = (pd + t * vd)^2 = vd*vd t^2 + 2 * pd * vd t + pd * pd
            auto pd = p[i] - p[j], vd = v[i] - v[j];
            auto PA = sum_elem(vd * vd), PB = 2 * sum_elem(vd * pd), PC = sum_elem(pd * pd);

            D dr, vdr; tie(dr, vdr) = r[i] + r[j];
            D RA = vdr * vdr, RB = -2 * dr * vdr, RC = dr * dr;

            D A = PA - RA, B = PB - RB, C = PC - RC;
            if (A < 1e-8) continue;
            D root = sqrt(B * B - 4 * A * C);
            auto t1 = (-B + root) / (2 * A), t2 = (-B - root) / (2 * A);
            if (t1 > 0)
                time_step.push_back(make_tuple(t1, i, j));
            if (t2 > 0)
                time_step.push_back(make_tuple(t2, i, j));
        }

        sort(time_step.begin(), time_step.end());
        vector<D> ans(n, -1);
        for (auto step : time_step) {
            D time;
            int s1, s2;
            tie(time, s1, s2) = step;
            if (ans[s1] < 0 && (s2 < 0 || ans[s2] < 0)) {
                ans[s1] = time;
                if (s2 >= 0) ans[s2] = time;
            }
        }

        for (auto time : ans) {
            printf("%.10lf\n", time);
        }
    }
}



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

using namespace std;

long long a[102], b[102];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	long long s = 0;
	cin >> n;
	for(int i = 0; i < n - 1; ++i) cin >> b[i];
	a[0] = b[0];
	for(int i = 1; i < n - 1; ++i) a[i] = min(b[i - 1], b[i]);
	a[n - 1] = b[n - 2];
	for(int i = 0; i < n; ++i) s += a[i];
	cout << s;

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;

ll log(ll x, ll n){
	if(x==1){
		return n;
	}else{
		return log(x/2, n+1);
	}
}

ll beki(ll x , ll n){
	
	ll ans = 1;
	for(int i = 0; i < n; i++)
	{
		ans *= x;
	}
	return ans;
	
}

int main(){
	ll L;
	cin >> L;

	ll r = log(L,0);

	ll N = r+1;

	ll M = 0;
	ll buff[60][3];
	
	for(int i = 0; i < N-1; i++)
	{
		buff[M][0] = i+1;
		buff[M][1] = i+2;
		buff[M][2] = 0;
		buff[M+1][0] = i+1;
		buff[M+1][1] = i+2;
		buff[M+1][2] = beki(2,i);
		M += 2;
	}
	
	
	for(int i = N-1; i >= 1; i--)
	{

		if (L-beki(2,i-1) >= beki(2,r)){
			buff[M][0] = i;
			buff[M][1] = N;
			buff[M][2] = L - beki(2,i-1);
			M++;
			L = L - beki(2,i-1);
		}
	}
	
	cout << N << " " << M << endl;
	
	for(int i = 0; i < M; i++)
	{
		cout << buff[i][0] << " " << buff[i][1] << " " << buff[i][2] << endl;
	}

	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

ll f(ll x, ll m) {
    return x * x % m;
}

int main(void) {
    ll N, X, M;
    cin >> N >> X >> M;
    map<ll, ll> A;
    vector<ll> ans{0};
    rep(i, N) {
        if(A.count(X) == 0) {
            A[X] = i;
            ans.push_back(ans.back() + X);
            X = f(X, M);
        } else {
            ans.push_back(ans.back() + ((N - i) / (i - A[X])) * (ans.back() - ans[A[X]]));
            ans.push_back(ans.back() + (ans[A[X] + (N - A[X]) % (i - A[X])] - ans[A[X]]));
            break;
        }
    }
    cout << ans.back() << endl;
    return 0;
}


Measured memory_bytes: 6768
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  string s, t;cin>>s>>t;
  int a, b;cin>>a>>b;
  string u;cin>>u;
  if(s==u)cout<<--a<<" "<<b<<endl;
  else cout<<a<<" "<<--b<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 3608
S = input()
K = int(input())

ans = 0
tmp = 0
head = 1
hip = 1
if S[0] == S[-1]: key = True
else: key = None
itr = 0
b = 0
for s1, s2 in zip(S[:-1], S[1:]):
    if s1 == s2:
        tmp += 1
    else:
        ans += (tmp+1)//2
        if (key == True) and (b == 0):
            head = tmp
            b+=1
        tmp = 0

    if (key == True) and (itr == len(S)-2):
        hip = tmp
    itr += 1
ans += (tmp+1)//2
ans = ans*K
if key==True and b==0:
    ans = len(S)*K//2
if (head%2 == 0) and (hip%2 == 0):
    ans += K-1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
main(){
    int k=38;
    int n=38*37+1;
    cout<<n<<" "<<k<<endl;
    vector<vec> v(2000);
    rep(i,38){
      v[i].pb(1);
    rep(j,37){
    v[i].pb(i*37+j+2);}}
    rep(i,37){
    rep(j,37){
      v[i*(k-1)+k+j].pb(i+2);
    rep(l,37)v[i*37+38+j].pb((v[l+1][(j+l*i)%37+1]));}}
    rep2(i,0,n-1){
    rep(j,k)cout<<v[i][j]<<" ";
    cout<<endl;}
}

Measured memory_bytes: 896
#include<cstdio> 
#include<cstring> 
#include<algorithm> 
#define gc getchar() 
#define pc putchar 
inline int read() {
	int x = 0,f = 1; 
	char c = gc; 
	while(c < '0' || c > '9') {if(c == '-')f = -1; char c = getchar();} 
	while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = getchar(); 
	return x * f; 
} 
void print(int x) { 
	if(x < 0) { 
		pc('-'); 
		x = -x; 
	} 
	if(x >= 10) print(x / 10); 
	pc(x % 10 + '0'); 
} 
const int maxn = 100007; 
int a[maxn]; 
int main() {
	int n = read(),k = read(); 	 	
	for(int i = 1;i <= n;++ i)  a[i] = read(); 
	std::sort(a + 1, a + n + 1); 
	int ans = 0; 
	for(int i = 1;i <= n;++ i) { 
		if(i < n) { if(a[i] <= k ) k -= a[i],ans ++;} 
		else if(i == n && a[i] == k) ans ++;     
		else break; 
	} 
	print(ans); 
	pc('\n'); 
}
 


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int f(int x){
	if(x==1) return 1;
  	return x * f(x-1);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 	
	int n;
  	cin >> n;
  	vi p(n);
  	vi q(n);
  	rep(i,n) cin >> p[i];
  	rep(i,n) cin >> q[i];
	vi a(n);
  	rep(i,n) a[i] = i+1;
  
  	map<vi, int>mp;
  	do{
    mp[a] = mp.size();
    }while(next_permutation(all(a)));
  
  	int ans = abs(mp[p]-mp[q]);
  	cout << ans << endl;
    return 0;
}

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<pair<int,int>>> v(n);
    vector<int> p(m),y(m);
    for(int i=0;i<m;i++){
        cin>>p[i]>>y[i];
        v[p[i]-1].emplace_back(make_pair(y[i],i));
    }
    for(int i=0;i<n;i++){
        sort(v[i].begin(),v[i].end());
        for(int j=0;j<v[i].size();j++){
            y[v[i][j].second]=j+1;
        }
    }
    for(int i=0;i<m;i++){
        printf("%06d%06d\n",p[i],y[i]);
    }
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

int gcd(int x, int y)
{
	return y ? gcd(y, x % y) : x;
}

string str;

bool check(long long n) {
	return (n & (n - 1)) == 0;
}

void hawawa()
{
	string str;
	cin >> str;
	for (char c = 'a'; c <= 'c'; c++) {
		if (count(begin(str), end(str), c) != 1) {
			cout << "No\n";
			return;
		}
	}
	cout << "Yes\n";
}

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


Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);
const nin=()=>{const r = input[0];input.shift();return Number(r);}
const sin=()=>{const r = input[0];input.shift();return String(r);}
const out = (...a) => {console.log(...a);}
const rep = (n, callback) => {for(let i = 0;i < n; i++){callback();}}

const main = () => {
  let x = nin();
  let a = nin();
  x < a ? out(0) : out(10);
}
main();

Measured memory_bytes: 7500
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a=[0]
b=[0]

for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
j=M
ans=0
for i in range(N+1):#aは小さい方から
    if a[i]>K:    #a[0]=0なのでいきなりbreakすることはない
        break
    while b[j]>K-a[i] : #bは大きい方から
        j-=1            #j,ansの値は次のループに引き継がれる
    ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 47648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

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

using namespace std;

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

    map<string,bool> ma;
    rep(i,n) {
        string s;
        cin >> s;
        ma[s] = true;
    }

    int m;
    cin >> m;

    bool lock = true;
    rep(i,m) {
        string s;
        cin >> s;

        if(!ma[s]) cout << "Unknown " << s << endl;
        else {
            if(lock) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
            lock = !lock;
        }
    }
    
    return 0;
}

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

int main() {
  int op;
  std::scanf("%d", &op);
  if (op == 1) {
    std::printf("Hello World\n");
  } else if (op == 2) {
    int a, b;
    std::scanf("%d%d", &a, &b);
    std::printf("%d\n", a + b);
  }
  return 0;
}

Measured memory_bytes: 256
// AtCoder Grand Contest 010
// A - Addition

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


int N;

int main() {

    int a;
    int ans;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a;
        ans += a % 2;
    }
    cout << (ans % 2 == 0 ? "YES" : "NO") << endl;

    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>//ラウンドロビンスケジューリング
#include<string.h>

typedef struct process{
	char name[10];
	int time;
}PROC;

PROC list[100000];

int main(void){
	int i,j,n,q,total=0,max=0,temp,count=0;
	char tem[10];
	
	scanf("%d %d",&n,&q);

	for(i = 0;i < n;i++){
		scanf("%s %d",list[i].name,&list[i].time);
	}
	for(i = 0;i < n;i++){
		if(list[i].time >= max){
			max = list[i].time;
		}
	}

	for(i = 0;;i++){
		if(i == n){
			i = 0;
			for(j = 0;j < n;j++){
				if(list[j].time > 0){
					list[count] = list[j];
					count++;
				}
			}
			n = count;
			count = 0;
		}
		if(n == 0){
			break;
		}
		if(list[i].time <= q){
			total += list[i].time;
			list[i].time = 0;
			printf("%s %d\n",list[i].name,total);
		}else if(list[i].time > q){
			list[i].time -= q;
			total += q;
		}
	}
	

	return 0;
}

Measured memory_bytes: 1380
import sys
import math
import heapq
from collections import deque
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N,M,P=LI()
EDGES = []
E1 = [[] for i in range(N+1)]
E2 = [[] for i in range(N+1)]

for i in range(M):
    F,T,C=LI()
    EDGES.append((F,T,P-C))
    E1[F].append(T)
    E2[T].append(F)

def bellman_ford(edges):
    # print(edges)
    DIST=[10**18]*(N+1)
    DIST[1] = 0
    for i in range(N):
        for j in range(len(edges)):
            fr, to, cost = edges[j]
            if (DIST[to] > DIST[fr] + cost):
                if (i == N-1):
                    print(-1)
                    exit()
                else:
                    DIST[to] = DIST[fr] + cost
    # print(DIST)
    print(max(-DIST[-1], 0))

def dfs(edge, s):
    use= {s}
    q=[s]
    while q:
        v = q.pop()
        for w in edge[v]:
            if w in use:
                continue
            use.add(w)
            q.append(w)
    return use

use = dfs(E1,1) & dfs(E2, N)
# print(use)
bellman_ford([(a,b,c) for a,b,c in EDGES if (a in use and b in use)])


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

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

int main() {
    int N;
    cin >> N;
    vector<ll> L(N+1);
    L.at(0)=2, L.at(1)=1;

    rep(i,N-1)
        L.at(i+2) = L.at(i+1) + L.at(i);

    cout << L.at(N) << endl;
}

Measured memory_bytes: 256
#include<iostream>
typedef long long ll;

using namespace std;

int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x=a*c;
    ll y=a*d;
    ll z=b*c;
    ll z1=b*d;
   cout<<max(x,max(y,max(z,z1)))<<endl;
}


Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include <cstring>
#include<bits/stdc++.h>
using namespace std;   
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if (a>c or a+b<c)
	{
		cout<<"NO";
		return 0;
	 } 
	if (a+b>=c) cout<<"YES"; 
    return 0;  
} 

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

typedef struct list_
{
    int data;
    struct list_ *prev;
    struct list_ *next;
} list;

    //リスト先頭挿入
void insert(list *left)
{
	list *n = malloc(sizeof(list));
    scanf("%d",&n->data);
    list *right = left->next;
    left->next = n;
    right->prev = n;
    n->prev = left;
    n->next = right;
}

    //data==キー　削除
void delete(list *head,list *tail)
{
    int d;
    scanf("%d",&d);
    for(list *i = head->next;i != tail;i=i->next)
    {
        if(i->data == d){
            list *left = i->prev;
            list *right = i->next;
            left->next = right;
            right->prev = left;
            free(i);
            break;
        }
    }
}

    //リスト先頭削除
void deleteFirst(list *head)
{
    list *delfir = head->next;
    list *chn = delfir->next;
    chn->prev = head;
    head->next = chn;
    free(delfir);
}

    //リスト末尾削除
void deleteLast(list *tail)
{
    list *dellas = tail->prev;
    list *chn = dellas->prev;
    chn->next = tail;
    tail->prev = chn;
    free(dellas);
}

int main()
{
    int m;
    scanf("%d",&m);
    char order[50];
    list head;
    list tail;
    head.next = &tail;
    tail.prev = &head;
    for(int i=0;i<m;i++)
    {
        scanf("%s",order);
        if(!(strcmp(order,"insert")))  insert(&head);
        else if(!(strcmp(order,"delete")))  delete(&head,&tail);
        else if(!(strcmp(order,"deleteFirst")))  deleteFirst(&head);
        else if(!(strcmp(order,"deleteLast")))  deleteLast(&tail);
    }
    int flg = 0;
    for(list *i = head.next;i != &tail;i=i->next)
    {
        if(i != head.next)   printf(" %d",i->data);
        else printf("%d",i->data);
    }
    printf("\n");
}


Measured memory_bytes: 32960
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}



int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k]){
                    if((a[i]+a[j]>a[k])&&(a[i]+a[k]>a[j])&&(a[k]+a[j]>a[i]))cnt++;
                }
            }
        }
    }

cout<<cnt;
    return 0;
}


Measured memory_bytes: 3628
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = input()
ok = [False] * n
score = {"r": p, "s": r, "p": s}
ans = 0
for i in range(n):
    if i>=k and t[i-k]==t[i] and not ok[i-k]:
        ok[i] = True
    else:
        ans += score[t[i]]

print(ans)

Measured memory_bytes: 73924
#include <iostream>
#include <cmath>
#include <limits>

#define MAX_N 10
#define MAX_D 10

using namespace std;

int main(){
    int N, D;
    int array[MAX_N][MAX_D] = {0};
    int count = 0;

    cin >> N >> D;

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

    double sum = 0.0;

    for (int i=0;i<N-1;i++){
        for (int k=i+1;k<N;k++){
            sum = 0;
            for (int j=0;j<D;j++){
                sum += pow((double)(array[i][j] - array[k][j]),2.0);
            } 
            sum = sqrt(sum);  
//            cout << "sum = " << sum << endl;        
            if (fabs(floor(sum) - ceil(sum)) <= 1.0e-4 * fmax(1, fmax(fabs(floor(sum)), fabs(ceil(sum))))){
                count++;
            }            
        }
    }

    cout << count << endl;

    return 0;
}

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

using namespace std;

#define long long long
//#define double __float128
#define INF (long) 1e18
#define MOD 1'000'000'007
#define mll map<long, long>
#define pll pair<long, long>
#define umap unordered_map
#define umll umap<long, long>
#define pb push_back
#define FOR(i, a, b) \
  for (long i = a; i < (long) b; i++)
#define SORT(v, atr) \
  stable_sort(v.begin(), v.end(), \
    [](auto &a, auto &b) { return a.atr < b.atr; });
#define UNSORT(v, atr) \
  sort(v.begin(), v.end(), \
    [](auto &a, auto &b) { return a.atr > b.atr; });
#define PRINTV(v) \
  FOR (_i, 0, v.size()) \
    cout << v[_i] << " "; \
  cout << "\n";

set<long> gera_primos(long n)
{
  set<long> primos;
  vector<bool> crivo(n+1);
  primos.insert(2);
  for (long i = 3; i <= n; i += 2) {
    if (crivo[i]) continue;
    primos.insert(i);
    for (long j = i; j <= n; j += i) {
      crivo[j] = true;
    }
  }
  return primos;
}

struct Link
{
  long from, to, t;
};

struct Node
{
  bool visitado = false;
  set<long> in, out;
};

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

  long n;
  cin >> n;

  vector<long> a(n), b(n);
  for (auto &x : a) cin >> x;
  for (auto &x : b) cin >> x;

  long total = 0;
  FOR (i, 0, n) {
    if (a[i] > b[i]) total -= a[i] - b[i];
    if (a[i] < b[i]) total += (b[i] - a[i]) / 2;
  }
  if (total < 0) {
    puts("No");
  } else {
    puts("Yes");
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int d[600010];

int main() {
  int n,Q;
  while(input(n,Q)) {
    memset(d,0,sizeof(d));
    REP(i,n) {
      int c; input(c);
      d[c] = c;
    }
    REP(i,600000) {
      chmax(d[i+1], d[i]);
    }
    while(Q--) {
      int x;
      input(x);
      int ans = 0;
      for (int y=x; y<300000+x; y+=x) {
        chmax(ans, d[y-1]%x);
      }
      output(ans);
    }
  }
}

Measured memory_bytes: 3420
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

int a[3];
int n;
int main() {
	scanf("%d%d%d%d", a,a+1,a+2,&n);
	sort(a,a+3);

	printf("%d\n", a[2] * (1 << n) + a[1] + a[0]);
	return 0;
}



Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <random>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int D;

int c[27];
int s[366][27];
int last[27];

vector<int> ans;
ll ans_score;

ll calcScore(){
    rep(i,27) last[i] = 0;
    ll score = 0;
    for(int d = 1; d <= D; ++d){
        int t = ans[d];
        score += s[d][t];
        last[t] = d;
        for(int i = 1; i <= 26; ++i){
            score -= c[i] * (d - last[i]);
        }
    }
    return score;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> D;
    for(int i = 1; i <= 26; ++i) cin >> c[i];
    for(int i = 1; i <= D; ++i){
        for(int j = 1; j <= 26; ++j){
            cin >> s[i][j];
        }
    }
    ans.resize(D, 1);
    ans_score = calcScore();
    //local search
    std::random_device rnd;
    std:: mt19937 mt(rnd());
    std::uniform_int_distribution<> randD(1,D);
    std::uniform_int_distribution<> randA(1,26);
    rep(_,200000){
        int d = randD(mt);
        int q = randA(mt);
        int old = ans[d];
        ans[d] = q;
        ll score = calcScore();
        if(ans_score > score) ans[d] = old;
        else ans_score = score;
    }
    rep(i,D) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
     //https://www.codechef.com/viewsolution/28454497
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define int long long
vector < ll> primes;
 int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int n,m;
bool isvalid(int x,int y){
  return (x>=0 and x<n and y>=0 and y<m);
}
void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.push_back(p);  
}
 const int N = 5e5 + 5;
 	int connected;
	int par[N], sz[N];
 
struct DSU
{

	void init(int n) 
	{
		for(int i=1;i<=n;i++)
		{
			par[i]=i;
			sz[i]=1;
		}
		connected=n;
	}
 
	int getPar(int k)
	{
		while(k!=par[k])
		{
			par[k]=par[par[k]];
			k=par[k];
		}
		return k;
	}
 
	int getSize(int k)
	{
		return sz[getPar(k)];
	}
 
	void unite(int u, int v)
	{
		int par1=getPar(u), par2=getPar(v);
 
		if(par1==par2)
			return;
 
		connected--;
 
		if(sz[par1]>sz[par2])
			swap(par1, par2);
 
		sz[par2]+=sz[par1];
		sz[par1]=0;
		par[par1]=par[par2];
	}
};
 
 

DSU dsu;
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
        return gcd(b % a, a); 
} 
ll powermod(ll x, ll y){
    if(y==0)
    return 1;
        
    if(y%2==0)
    return (powermod(x,y/2)*powermod(x,y/2))%mod;
    else
    return (((powermod(x,y/2)*powermod(x,y/2))%mod)*x)%mod;
}
   
int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
   
    int h,w,n;
    cin>>h>>w>>n;
    
    int m=max(h,w);
    
    if(n>=m)
    {
        if(n%m==0)
        {
            cout<<n/m;
        }
        else
        {
            cout<<n/m+1;
        }
    }
    else
    {
        cout<<"1";
    }
    
    
    
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int a, b, c; cin >> a >> b >> c;
  map<int, int> m{};
  ++m[a];
  ++m[b];
  ++m[c];
  for (const auto& p : m) {
    if (p.second == 1) {
      cout << p.first << CRLF;
    }
  }
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
H,W,D,*r=`dd`.split.map &:to_i
d=[0]*(D+1);x=[];(0..H*W-1).each{|e|x[r[e]]=e};(D+1..H*W).each{|i|d[i]=d[i-D]+(x[i]/W-x[i-D]/W).abs+(x[i]%W-x[i-D]%W).abs};r[H*W+1..-1].each_slice(2){|a,b|puts d[b]-d[a]}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rll() {
	long long n;
	scanf("%lld", &n);
	return n;
}
#define MOD 1000000007

typedef int64_t s64;
template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
	ModInt &operator^=(long long p){
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	ModInt operator^(long long p)const{return ModInt(*this)^=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    explicit operator int() const { return x; }                           // added by QCFium
    ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            std::swap(a,b);
            u-=t*v;
            std::swap(u,v);
        }
        return ModInt(u);
    }
    friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};
typedef ModInt<MOD> mint;

struct MComb {
    std::vector<mint> fact;
    std::vector<mint> inversed;
    MComb(int n) { // O(n+log(mod))
        fact = std::vector<mint>(n+1,1);
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
        inversed = std::vector<mint>(n+1);
        inversed[n] = fact[n] ^ (MOD-2);
        for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
    }
    
    mint ncr(int n, int r) {
        return (fact[n] * inversed[r] * inversed[n-r]);
    }
    
    mint npr(int n, int r) {
        return (fact[n] * inversed[n-r]);
    }
    
    mint nhr(int n, int r) {
        assert(n+r-1 < (int)fact.size());
        return ncr(n+r-1, r);
    }
};

int main() {
	int n = ri();
	mint a = ri();
	mint b = ri();
	mint c = ri();
	mint x;
	MComb com(2 * n + 1);
	for (int i = 0; i < n; i++) {
		x += (a ^ n) * (b ^ i) / ((a + b) ^ (n + i)) * com.ncr(n + i - 1, i) * (n + i);
		x += (b ^ n) * (a ^ i) / ((a + b) ^ (n + i)) * com.ncr(n + i - 1, i) * (n + i);
	}
	x *= (mint) 100 / (mint) (100 - (int) c);
	std::cout << x << std::endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;

int A[2][101];

int main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		cin >> A[0][i];
	}
	int s = 0;
	REP(i, N)
	{
		cin >> A[1][i];
		s += A[1][i];
	}

	int ts = 0, ds = 0, max = 0;
	REP(i, N)
	{
		ts += A[0][i];
		max = std::max(ts + s - ds, max);
		ds += A[1][i];
	}

	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    int ma = 0;
    map<string, int> cnt;
    for(int i = 0; i < n; i++){
        cin >> s;
        cnt[s]++;
        ma = max(ma, cnt[s]);
    }

    for(auto &u : cnt){
        if(u.second == ma){
            cout << u.first << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 19164
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>> v,v2;
	
	char arr[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>arr[i][j];
			if(arr[i][j]=='#'){
				v.push_back({i,j});
				v2.push_back({j,i});
			}
		}
	}
	for(int i=0;i<n;i++){
		v.push_back({i,m});
		v.push_back({i,-1});
		v2.push_back({m,i});
		v2.push_back({-1,i});
	}
	for(int i=0;i<m;i++){
		v.push_back({n,i});
		v.push_back({-1,i});
		v2.push_back({i,n});
		v2.push_back({i,-1});
	}
	sort(v.begin(),v.end());
	sort(v2.begin(),v2.end());
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(arr[i][j]=='.'){
				auto x=*(lower_bound(v.begin(),v.end(),make_pair(i,j))-1);
				auto y=*upper_bound(v.begin(),v.end(),make_pair(i,j));
				auto x2=*(lower_bound(v2.begin(),v2.end(),make_pair(j,i))-1);
				auto y2=*upper_bound(v2.begin(),v2.end(),make_pair(j,i));
				ans=max(ans,y.second-x.second+y2.second-x2.second-2);
	//			cout<<x2.first<<' '<<x2.second<<' '<<y2.first<<' '<<y2.second<<'\n';
			}
		}
	}
	cout<<ans-1;
}

Measured memory_bytes: 68548