akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define aint(v) v.begin(),v.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define ump gp_hash_table<int,int,custom_hash>
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
/*int **dp,in main function,int row,col;dp=new int*[n];rep(i,n)dp[i]=new int[m]*/
//**** Maths Section*******/
int power(int x,int y);
bool isPrime(int n);
int modInv(int a,int b);
int gcdExtended(int a,int b,int *x,int* y);
int mpower(int a,int b,int p);
/***************************/
int32_t main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  fastio
  char a;
  cin>>a;
  a++;
  cout<<a<<endl;
  return 0;
}

int modInv(int a, int m)
{
int x, y;
int g = gcdExtended(a, m, &x, &y);
int res = (x%m + m) % m;
return res;
}

int gcdExtended(int a, int b, int *x, int *y)
{
if (a == 0){
    *x = 0, *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtended(b%a, a, &x1, &y1);
  *x = y1 - (b/a) * x1;
  *y = x1;
  return gcd;
}

int mpower(int x, int y, int p)
{
int res = 1;
x = x % p;
while(y > 0){
    if(y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
    }
    return res;
}
int power(int x, int y)
{
int res = 1;
while (y > 0){
    if (y & 1) res = res*x;
      y = y>>1;
      x = x*x;
    }
    return res;
}

bool isPrime(int n)
{
if (n <= 1)  return false;
  if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
      int p=sqrt(n);
      for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
          return false;
      return true;
}


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

/*
 * @title StronglyConnectedComponents
 */
class StronglyConnectedComponents{
	int num,is_2sat,half,max_id;
	vector<vector<int>> edge,redge;
	vector<int> label,visited,order;
	inline void dfs(int curr){
		visited[curr] = 1;
		for(int next:edge[curr]) if(!visited[next]) dfs(next);
		order.push_back(curr);
	}
	inline void rdfs(int curr,int id){
		visited[curr] = 1;
		label[curr] = id;
		for(int next:redge[curr]) if(!visited[next]) rdfs(next,id);
	}
	inline int rev(int i) { return i < half ? i + half : i - half; }
public:
	StronglyConnectedComponents(const int n, bool is_2sat=0):num(n),max_id(0),is_2sat(is_2sat){
		if(is_2sat) num*=2;
		edge.resize(num);
		redge.resize(num);
		label.resize(num);
		visited.resize(num);
		half=num/2;
	}
	inline int operator[](int idx) {
		return label[idx];
	}
	inline void make_edge(const int from,const int to) {
		edge[from].push_back(to);
		redge[to].push_back(from);
	}
    //xがflg_xならばyがflg_y
	inline void make_condition(int x, bool flg_x, int y, bool flg_y) {
		if (!flg_x) x = rev(x);
		if (!flg_y) y = rev(y);
		make_edge(x, y);
		make_edge(rev(y), rev(x));
	}
    //is_2sat=1のときに、2satを満たすかを返却する
	inline bool solve(void) {
		for(int& e:visited) e = 0;
		for(int i = 0; i < num; ++i) if(!visited[i]) dfs(i);
		for(int& e:visited) e = 0;
		reverse(order.begin(),order.end());
		for(int i:order) if(!visited[i]) rdfs(i,max_id++);
		if(!is_2sat) return true;
		for (int i = 0; i < num; ++i) if (label[i] == label[rev(i)]) return false;
		return true;
	}
    vector<vector<int>> topological_sort(void) {
        vector<vector<int>> ret(max_id);
        for(int i=0;i<num;++i) ret[label[i]].push_back(i);
        return ret;
    }
	int is_true(int i) {
		return label[i] > label[rev(i)];
	}
	void print(void) {
		for(auto id:label) cout << id << " ";
		cout << endl;
	}
};


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    StronglyConnectedComponents scc(N);
    while(M--) {
        int u,v; cin >> u >> v;
        scc.make_edge(u,v);
    }
    scc.solve();
    auto vv=scc.topological_sort();
    cout << vv.size() << "\n";
    for(auto& v:vv) {
        cout << v.size();
        for(auto& e:v) cout << " " << e;
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 81488
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int x = Integer.parseInt(line.split(" ")[0]);
	    int y = Integer.parseInt(line.split(" ")[1]);

	    int area = x * y;
	    int len = (x + y) * 2;

	    System.out.println(area + " " + len);
	}
}

Measured memory_bytes: 24184
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
using namespace std;
    
#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vec = 4;
const int Vecy[Vec] = {0,-1,0,1};
const int Vecx[Vec] = {1,0,-1,0};
const int Modd = 1000000007;


int n;
int d[100001];

int main(){
    cin >> n;
    rep(i,n){
        cin >> d[i];
    }

    sort(d, d+n);

    int under = d[n/2-1];
    int upper = d[n/2];
    cout << upper - under << endl;


    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, a: "List[int]", b: "List[int]", p: "List[int]", x: "List[int]"):
    dedges = [set() for i in range(N+1)]
    uedges = [set() for i in range(N+1)]
    score = [0] * (N+1)

    for i in range(N-1):
        dedges[a[i]].add(b[i])
        # uedges[b[i]].add(a[i])

    # 自分以下のすべての子ノードを記録するようにする
    for i in range(Q):
        score[p[i]] += x[i]

    for i in range(1, N+1):
        for j in dedges[i]:
            score[j] += score[i]

    print(' '.join(map(str, score[1:])))


    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    a = [int()] * (N-1)  # type: "List[int]" 
    b = [int()] * (N-1)  # type: "List[int]" 
    for i in range(N-1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    p = [int()] * (Q)  # type: "List[int]" 
    x = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        p[i] = int(next(tokens))
        x[i] = int(next(tokens))
    solve(N, Q, a, b, p, x)

if __name__ == '__main__':
    main()


Measured memory_bytes: 155588
#include<iostream>

using namespace std;

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int start, end;
    if(a<c)start = c;
    else start = a;

    if(b<d)end = b;
    else end = d;

    cout << max(end - start, 0) << endl;
}


Measured memory_bytes: 256
#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); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    string a,b;
    cin >> a >> b;
    if (a == b){
        cout << "H" << endl;
    }
    else{
        cout << "D" << endl;
    }
}


Measured memory_bytes: 256
a,b,c,d,e,f = map(int, input().split())
ws = []
for i in range(f//100//a+1):
    for j in range(f//100//b+1):
        w = 100*(a*i+b*j)
        if 0 < w <= f:
            ws.append(w)
        if w >= f:
            break
ss = []
for i in range(f*e//(100+e)//c+1):
    for j in range(f*e//(100+e)//d+1):
        s = c*i+d*j
        if 0 <= s <= f*e//(100+e):
            ss.append(s)
n = []
for w in ws:
    for s in ss:
        if w+s > f:
            continue
        if s > e*w//100:
            continue
        n.append((s/(w+s), w+s, s))

nmax = max(n, key=lambda x:x[0])
print(nmax[1], nmax[2])


Measured memory_bytes: 104416
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

int main(){
    string l;
    cin>>l;
    int dig=l.size();
    vector<vector<ll> > dp(dig+1,vector<ll>(2,0));
    dp[0][0]=1;
    dp[0][1]=0;
    for(int i=0;i<dig;i++)
	{
        if(l[i]=='1')
		{
            dp[i+1][0]=(2*dp[i][0])%1000000007;
            dp[i+1][1]=(dp[i][0]+dp[i][1]*3)%1000000007;
        }
        else
		{
            dp[i+1][0]=dp[i][0];
            dp[i+1][1]=(dp[i][1]*3)%1000000007;
        }
    }
    cout<<(dp[dig][0]+dp[dig][1])%1000000007<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

//bool flag = __builtin_add_overflow(a , b , &tmp);
//bool flag = __builtin_mul_overflow(a , b , &tmp);
//bool flag3= __builtin_sub_overflow(a , b , &tmp);

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-12;
const long long inf = 2e12 + 12;
const int MAXN = 2000006, MAXM = 102, Mod = 1000000007 , MAXLog = 20;


int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;

    int a, b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << '\n';

    return 0;
}

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

int main(void){
    int a,b ;
    cin >> a >> b ;
    if (a>b){
        for (int i=0; i<a; i++){
            cout << b ;
        }
    } else {
        for (int i=0; i<b; i++){
            cout << a ;
        }
    }
    cout << endl ;
}

Measured memory_bytes: 256
#include <iostream>

#include <algorithm>
#include <numeric>

#include <vector>
#include <queue>
#include <stack>
#include <map>

#define FOR(i,b,e) for(int i=b;i<e;i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;

typedef pair<int, int> P;

const int MAX_N = 100;
int n;

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

  while (true) {
    vector<int> scores;

    cin >> n; 
    if (n == 0) break;

    REP(i,n) {
      int s;
      cin >> s;
      scores.push_back(s);
    }

    sort(scores.begin(), scores.end());
    int sum = accumulate(scores.begin() + 1, scores.end() - 1, 0);

    cout << sum / (n - 2) << endl;
  }
}


Measured memory_bytes: 3136
import           Control.Monad
import qualified Data.Sequence as Seq

main = do
  s <- Seq.fromList <$> getLine

  let solve s res | Seq.length s < 2 = res
                  | otherwise =
                    let l Seq.:< ss = Seq.viewl s
                        ss' Seq.:> r = Seq.viewr ss
                    in
                      if l == r
                      then solve ss' res
                      else case (l, r) of
                        ('x', _) -> solve (s Seq.|> 'x') (res+1)
                        (_, 'x') -> solve ('x' Seq.<| s) (res+1)
                        _        -> -1

  print $ solve s 0

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

using namespace std;

int main() {
    string s;
    cin >> s;
    int q;
    int cnt = 0;
    cin >> q;
    vector<char> v, v2;
    while(q--) {
        int t;
        cin >> t;
        if(t == 1){
            cnt++;
        }
        else{
            char c;
            int k;
            cin >> k;
            
            cin >> c;
            
            if(cnt % 2 == 0 and  k == 1) {
                
                v.push_back(c);
            }
            else if(cnt % 2 == 0 and k == 2)
                v2.push_back(c);
            else if(cnt % 2 and k == 1)
                v2.push_back(c);
            else
                v.push_back(c);
        }
    }
    for(int i = 0; i < v2.size(); i++) {
        s += v2[i];
    }
    reverse(s.begin(), s.end());
    
    for(int i = 0; i < v.size(); i++) {
        s += v[i];
    }
    if(cnt % 2 == 0)
        reverse(s.begin(), s.end());
    cout << s;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rbf(a, x) for (auto& a : x)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    template<typename Num>
        constexpr Num mypow(Num a, long long b) {
            if(b==0)return 1;
            if (a==0)return 0;
            Num x = 1;
              while (b > 0) {
                if(b & 1)x*=a;
                a*=a;
                b >>= 1;
              }
              return x;
        }

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll k,t;
        cin>>k>>t;
        vl A(t);
        rep(i,t)cin>>A[i];
        sort(rall(A));
        ll n=A[0];
        cout<<max(2*n-1-k,0LL)<<endl;
    }

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,c,counter = 0;
    cin >> a >> b >> c;
    for (int i = a; i <= b; i++) {
        if (c%i == 0) {
            counter ++;
        }
    }
    cout << counter << endl;
}


Measured memory_bytes: 3092
# frozen_string_literal: true

n, k = gets.split.map(&:to_i)

MOD = 10**9 + 7
N = n * 3

def ncrmod(n, r)
  return 0 if r < 0 || r > n

  r = [r, n - r].min
  $g1[n] * $g2[r] * $g2[n - r] % MOD
end

$g1 = [1, 1]
$g2 = [1, 1]
$inverse = [0, 1]

2.upto(N + 1) do |i|
  $g1.push(($g1[-1] * i) % MOD)
  $inverse.push((-$inverse[MOD % i] * (MOD / i)) % MOD)
  $g2.push(($g2[-1] * $inverse[-1]) % MOD)
end

def nhr(n, r)
  ncrmod(n+r-1, r)
end

1.upto(k) do |i|
  if n - k < i - 1
    puts 0
  else
    puts ncrmod(k - 1, i - 1) * nhr(i + 1, n - k - i + 1) % MOD
  end
end


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  vector<P> a(m);
  rep(i,m){
    cin>>a[i].fi>>a[i].se;
  }
  sort(begin(a),end(a));
  int now=1e9;
  int ans=1;
  rep(i,m){
    if(a[i].fi>=now){
      ans++;
      now=a[i].se;
    }else{
      now=min((ll)now,a[i].se);
    }
    //cout<<a[i].fi<<' '<<a[i].se<<' '<<now<<endl;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main(){

    int r;
    int g;
    int b;

    cin >> r >> g >> b;

	int value = r*100 + g*10 + b;

	if(value%4 == 0){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}



	return 0;

}


Measured memory_bytes: 256
def Small_and_Large(a , b , k):

    ans = []

    for i in range(k):
        if a + i <= b:
            ans.append(a + i)
        if b - i >= a:
            ans.append(b - i)

    return sorted(set(ans))

def main():
    a , b , k = map(int , input().split())
    ans = Small_and_Large(a, b, k)
    for i in ans:
        print(i)


if __name__ == '__main__':
    main()

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

int main(){
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "Yes ";
    else if(s[1] == s[2] && s[2] == s[3]) cout << "Yes ";
    else cout << "No ";
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

void solve() {
    string s;
    sc(s);
    vector<int> cnt(26, 0);
    for(char ch : s) {
        cnt[ch - 'a']++;
    }
    ll ans = (sz(s) * 1LL * (sz(s) - 1)) / 2 + 1;
    fr(i, 0, 25) {
        ans -= (cnt[i] * 1LL * (cnt[i] - 1)) / 2;
    }
    cout << ans;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

int main() {
    int N;
    ll sum = 0;
    cin >> N;
    ll n;
    rep2(i, 1, N+1) {
        sum += i;
        if (sum >= N) {
            n = i;
            break;
        }
    }
    rep2(i, 1, n+1) {
        if (i == sum - N) {
            continue;
        }
        cout << i << endl;
    }
}

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

bool isKaibun (string s) {
    for (int i = 0; i < s.size()/2; i++) {
        if (s.at(i) != s.at(s.size()-1-i)) {
            return false;
        }
    }
    return true;
}

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

    if (!isKaibun(S)){
        cout << "No" << endl;
        return 0;
    }

    bool split1 = isKaibun(S.substr(0, (S.size()-1)/2));
    bool split2 = isKaibun(S.substr((S.size()+3)/2-1, S.size()-1));

    string result = "No";
    if (split1 & split2) {
        result = "Yes";
    }

    cout << result << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math

def prime_number_identifier(num):
    for candidate in range(2, int(math.sqrt(num)) + 1):
        if num % candidate == 0:
            return False
    return True


input_num = int(raw_input())
counter = 0
found_number = 0
while counter < input_num:
    candidate_number = int(raw_input())
    if prime_number_identifier(candidate_number):
        found_number += 1
    counter += 1

print found_number

Measured memory_bytes: 6620
#include<stdio.h>
#include<stdlib.h>
typedef struct{
  int parent;
  int left;
  int right;
}Node;

int main(){
  int n,k,id,h,r,depth,p,i,j;
  Node *T;

  scanf("%d", &n);

  T=malloc(sizeof(Node)*n);

  for(i=0;i<n;i++){
    T[i].parent=-1;
    T[i].left=-1;
    T[i].right=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d %d", &id, &k);
    for(j=0;j<k;j++){
      scanf("%d",&h);
      T[h].parent=id;

      if(j==0) T[id].left=h;
      else if(j>0) T[r].right = h;
      r=h;
    }
  }

  for(j=0;j<n;j++){
    depth=0;
    p=T[j].parent;

    while(p!=-1){
      p=T[p].parent;
      depth++;
    }

    if(depth==0){
      printf("node %d: parent = -1, depth = 0, root, [", j);
    }
    
    else if(T[j].left == -1){
      printf("node %d: parent = %d, depth = %d, leaf, [", j, T[j].parent, depth);
    }
    else{
      printf("node %d: parent = %d, depth = %d, internal node, [", j, T[j].parent, depth);
    }
 
    p = T[j].left;
    if(p != -1) printf("%d", p);
 
    while(p != -1){
      p = T[p].right;
      if(p != -1) printf(", %d", p);
    }
    printf("]\n");
  }
 
  return 0;
}



Measured memory_bytes: 2972
#include<stdio.h>
int main (void){
	int x1=0,x2=0,x3=0,input,s;
	for(s=0;s<10;s++){
		scanf("%d\n",&input);
		if(x1 < input){
			x3 = x2;
			x2 = x1;
			x1 = input;
		}else{
			if(x2 < input){
				x3 = x2;
				x2 = input;
			}else{
				if(x3 < input){
					x3 = input;
				}
			}
		}
	}
	printf("%d\n%d\n%d\n",x1,x2,x3);
	return(0);
}

Measured memory_bytes: 1032
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n,c,ans=0;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    for(int i=0;i<n;i++){cin>>c;v[i]-=c;}
    for(int i=0;i<n;i++)if(v[i]>0)ans+=v[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
is_easy = {
 1 => {'R' => true,'L'=> false, 'D'=> true,'U' => true},
 0 => {'R' => false,'L'=> true, 'D'=> true,'U' => true}
}

string = STDIN.gets.chomp
all_easy_steps = string.split(//).map.with_index{|x, i| is_easy[(i+1)%2][x] }.all?
puts (all_easy_steps ? "Yes" : "No")


Measured memory_bytes: 3836
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
ans = [[0,0,0] for i in range(3)]



for i in range(3):
  for j in range(3):
    for k in b:
      if(a[i][j] == k):
        ans[i][j] = 1
        break
if(ans[0][0] + ans[0][1] + ans[0][2] == 3 or ans[0][0] + ans[1][0] + ans[2][0] == 3 or ans[1][0] + ans[1][1] + ans[1][2] == 3 or ans[2][0] + ans[2][1] + ans[2][2] == 3 or ans[0][2] + ans[1][2] + ans[2][2] == 3 or ans[0][1] + ans[1][1] + ans[2][1] == 3 or ans[0][0] + ans[1][1] + ans[2][2] == 3 or ans[0][2] + ans[1][1] + ans[2][0] == 3):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n,m;
    cin >> n >> m;
    map<int,int> m1;
    map<int,int> m2;
    set<int> s;
    fff(i,m) {
        int a;string s1;
        cin >> a >> s1;
        s.insert(a);
        if(s1=="AC")
        m1[a]=1;
        if(m1[a]!=1 and s1=="WA")
        m2[a]++;
    }
    
    int c=0,d=0;
    for(auto i:s) {
        if(m1[i]==1) {
            c++;
            d+=m2[i];
        }
    }
    
    cout << c << " " << d;
    
    
	return 0;
    
}

Measured memory_bytes: 26112
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string[] A = Console.ReadLine().Split(' ');

            int[] answer = new int[N];

            for(int i = 0; i < A.Length; i++)
            {
                answer[int.Parse(A[i]) - 1]++;
            }            

            Console.WriteLine(string.Join<int>(" ",answer));
            
        }
    }
}


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


using namespace std;

bool isprime[10001];
void MakePrime(int n) {
    isprime[2] = true;
    for (int i = 3; i < n; i += 2) {
        bool a = false;
        for (int j = 3; j <= std::sqrt(i); j += 2) {
            if (i%j == 0) {
                a = true;
            }
        }
        if (a == false) {
            isprime[i] = true;
        }
    }
}
 
int main() {
    int n;
    MakePrime(10000);
    while (cin >> n) {
        int ans = 0;
        for (int i = 2; i < n; i++) {
            if (isprime[i] && isprime[n + 1 - i])ans++;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3124
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>

using namespace std;

int main(){
  string s;
  int d_num[200005];
  cin >> s;
  for(int i=0;i < s.size();i++) d_num[i] = s[i] - '0';
  int sum = 0;
  for(int i=0;i < s.size();i++){
    sum += d_num[i];
  }
  if(sum % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n;cin>>n;
  int a,b,c,d;cin>>a>>b>>c>>d;
  a--;
  b--;
  c--;
  d--;
  string s;cin>>s;

  bool ans = true;
  int anzen = 1;
  int kiken = 0;
  int maxAnzen = 1;
  int maxKiken = 0;

  for(int i = a+1;i<=c;i++){
    if(s[i]=='.'){
      if(s[i-1]=='.'){
        anzen++;
      }else{
        maxKiken = max(maxKiken,kiken);
        kiken = 0;
        anzen = 1;
      }
    }else{
      if(s[i-1]=='.'){
        maxAnzen = max(maxAnzen,anzen);
        anzen = 0;
        kiken = 1;
      }else{
        kiken++;
      }
    }
  }
  maxAnzen = max(maxAnzen,anzen);

  int anzen2 = 1;
  int kiken2 = 0;
  int maxAnzen2 = 1;
  int maxKiken2 = 0;

  for(int i = b+1;i<=d;i++){
    if(s[i]=='.'){
      if(s[i-1]=='.'){
        anzen2++;
      }else{
        maxKiken2 = max(maxKiken2,kiken2);
        kiken2 = 0;
        anzen2 = 1;
      }
    }else{
      if(s[i-1]=='.'){
        maxAnzen2 = max(maxAnzen2,anzen2);
        anzen2 = 0;
        kiken2 = 1;
      }else{
        kiken2++;
      }
    }
  }
    maxAnzen2 = max(maxAnzen2,anzen2);

  if(maxKiken>1||maxKiken2>1)ans=false;

  if(c>d){
    if(maxAnzen2>2){
      //cout<<"に";

    }else if(s[b-1]=='.'&&s[b+1]=='.'){
      //cout<<"で";

    }else if(s[d-1]=='.'&&s[d+1]=='.'){
      //cout<<"ろ";

    }else{
      ans = false;
    }
  }

  if(ans){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
    



 

  return 0;
}

Measured memory_bytes: 640
L, R = map(int, input().split())
min_num = 2020
for i in range(L, R):
    for j in range(L+1, R+1):
        min_num = min(min_num, (i*j)%2019)
        if min_num == 0:
            break
    else:
        continue
    break
            
print(min_num)

Measured memory_bytes: 3060
#include<stdio.h>
#include<algorithm>
using namespace std;
int l[210];
int main()
{
	int min(int x,int y);
	int n,i;
	while(~scanf("%d",&n))
	{
		int s=0;
		for(i=1;i<=2*n;i++)
		    scanf("%d",&l[i]);
		sort(l+1,l+1+2*n);
		for(i=1;i<=2*n;i++)
		s+=min(l[i],l[i+1]),i++;
		printf("%d\n",s);    
	}
}
int min(int x,int y)
{
	if(x>y)return y;
	else return x;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())

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

const int n = 1e6+10;

int N;
int A[n], F[n];

int bin(int a, int b){
  if(F[b] > F[a]+F[b-a])
    return 0;
  else
    return 1;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for(int i=1; i<n; i++){
    int x = i;
    while(x%2 == 0){
      F[i]++;
      x /= 2;
    }
    F[i] += F[i-1];
  }
  bool has1 = false;
  int m2 = 0;
  for(int i=0; i<N; i++){
    char c;
    cin >> c;
    A[i] = c-'0';
    A[i]--;
    if(A[i] == 1)
      has1 = true;
    m2 += (A[i]%2) * bin(i, N-1);
  }
  m2 %= 2;
  if(m2){
    //cerr << ".";
    cout << "1\n";
  }
  else if(has1){
    //cerr << "..";
    cout << "0\n";
  }
  else{
    int m22 = 0;
    for(int i=0; i<N; i++){
      if(A[i] == 2){
        m22 += bin(i, N-1);
      }
    }
    m22 %= 2;
    if(m22){
      //cerr << "...";
      cout << "2\n";
    }
    else{
      //cerr << "....";
      cout << "0\n";
    }
  }
  /*
  for(int i=0; i<=N; i++){
    for(int j=0; j<=i; j++){
      cout << bin(j, i) << " ";
    }
    cout << endl;
  }
  */

  return 0;
}


Measured memory_bytes: 8192
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let vec: Vec<&str> = buf.split_whitespace().collect();
    let fst = vec[0].chars().nth(0);
    let snd = vec[0].chars().nth(1);
    let trd = vec[0].chars().nth(2);

    let mut ans = 700;

    if fst == "o".chars().nth(0) {
        ans = ans + 100;
    }
    if snd == "o".chars().nth(0) {
        ans = ans + 100;
    }
    if trd == "o".chars().nth(0) {
        ans = ans + 100;
    }

    println!("{:?}", ans);

}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int M=1000000007;

int modInverse(int a,int n)
{
	int r1=n,r2=a;
	int t1=0,t2=1;
	int q,t,r;
	int k3;
	while(r2>0)
	{
		q=r1/r2;
		r=r1%r2;
		t=t1-q*t2;
		r1=r2,r2=r;
		t1=t2,t2=t;
	}
	if(r1==1)
		k3=t1;
	if(k3<0)
		k3+=n;
	return k3;	
}

int fpower(int a,int n)
{
	int p=1;
	while(n>0)
	{
		if(n&1)
			p=((p%M)*(a%M))%M;
		a=((a%M)*(a%M))%M;
		n=n>>1;
	}
	return p;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(10)<<fixed;
	
	int n,a,b;
	cin>>n>>a>>b;
	int t=fpower(2,n)-1;
	int f=1;
	for(int i=n;i>n-a;i--)
		f=(f*i)%M;
	int f1=1;
	for(int i=1;i<=a;i++)
		f1=(f1*i)%M;
	f1=(f*modInverse(f1,M))%M;
	t-=f1;
	if(t<0)
		t+=M;
	f=1;
	for(int i=n;i>n-b;i--)
		f=(f*i)%M;
	f1=1;
	for(int i=1;i<=b;i++)
		f1=(f1*i)%M;
	f1=(f*modInverse(f1,M))%M;
	t-=f1;
	if(t<0)
		t+=M;
	cout<<t<<endl;
	return 0;
}



Measured memory_bytes: 256
N = gets.to_i
x = Array.new(N)
y = Array.new(N)
N.times do |i|
  x[i],y[i] = gets.split.map(&:to_i)
end
dist = 0
dist_num = 0
[*0..N-1].permutation(N).to_a.each_with_index do |z, index|
  dist_num += 1
  (z.length-1).times do |i|
    node1 = z[i]
    node2 = z[i+1]
    dist += Math.sqrt( (x[node1]-x[node2])**2 + (y[node1]-y[node2])**2 )
  end
end
puts dist / dist_num

Measured memory_bytes: 6780
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>

const int N = 1000000;

int n;
char string[N + 1];
std::deque <int> letters[26];

int count[N];
bool present[N];

void modify(int k, int v) {
  for(; k < n; k += ~k & k + 1) {
    count[k] += v;
  }
}

int query(int k) {
  int ret = 0;
  for (; k >= 0; k -= ~k & k + 1) {
    ret += count[k];
  }
  return ret;
}

void remove(int i) {
  present[i] = false;
  modify(i, -1);
}

int main() {
  scanf("%s", string);
  n = strlen(string);
  for (int i = 0; i < n; ++ i) {
    letters[(int)(string[i] -= 'a')].push_back(i);
  }


  int odd_count = 0;
  for (int i = 0; i < 26; ++ i) {
    odd_count += letters[i].size() & 1;
  }
  if (odd_count != (n & 1)) {
    puts("-1");
    return 0;
  }
  memset(present, true, sizeof(present));
  for (int i = 0; i < n; ++ i) {
    modify(i, 1);
  }
  long long answer = 0;
  for (int l = 0, r = n - 1; l < r; ) {
    if (!present[l]) {
      l ++;
    } else if(!present[r]) {
      r --;
    } else {
      int left_cost = query(n - 1) - query(letters[(int)string[l]].back());
      int right_cost = query(letters[(int)string[r]].front()) - 1;
      answer += std::min(left_cost, right_cost);
      int token = left_cost < right_cost ? string[l] : string[r];
      remove(letters[token].front());
      remove(letters[token].back());
      letters[token].pop_front();
      letters[token].pop_back();
    }
  }
  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int n;
int h[105];
int res=1;
vector <pair<pair<int,int>,int> >vec;
int dp[105][105][2];

namespace combinatorics
{
	int mod=1e9+7;
	inline int add(int a,int b)
	{
		return (a+b)%mod;
	}
	inline int minus(int a,int b)
	{
		return (a-b+mod)%mod;
	}
	inline int mutiply(int a,int b)
	{
		return (1LL*a*b)%mod;
	}
	inline int fastpow(int basic,int x)
	{
		int res=1;
		while(x)
		{
			if(x&1)	res=mutiply(res,basic);
			basic=mutiply(basic,basic);
			x>>=1;
		}
		return res;
	}
	inline int inv(int x)
	{
		return fastpow(x,mod-2);
	}
};
using namespace combinatorics;

inline void solve(int l,int r)
{
//	cout<<l<<' '<<r<<endl;
//	Sleep(1000);
	if(l==r) return;
	int mi=inf,ma=inf;
	for(int i=l;i<r;i++)
	{
		mi=min(mi,h[i]);
	}
	vec.push_back({{l,r},mi-(l==0 && r==n)});
	for(int i=l;i<r;i++)
	{
		h[i]-=mi;
	}
	int last=l;
	for(int i=l;i<=r;i++)
	{
		if(h[i]==0) solve(last,i),last=i+1;
	}
}

inline int way(int l,int r)
{
	int res=0;
	for(auto x:vec)
	{
		if(l<=x.first.first && r>=x.first.second) res=(res+x.second)%(mod-1);
	}
	return fastpow(2,res);
}

int main()
{
//	freopen("input.txt","r",stdin);
//	freopen("1.out","w",stdout);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	solve(0,n);
//	for(auto x:vec)
//	{
//		printf("From %d to %d, having %d floors.\n",x.first.first+1,x.first.second,x.second);
//	}
	dp[0][1][0]=1;
	dp[0][1][1]=1;
	for(int i=0;i<n-1;i++)
	{
		for(int j=1;j<=i+1;j++)
		{
			for(int k=0;k<2;k++)
			{
				dp[i+1][j+1][k]=add(dp[i+1][j+1][k],dp[i][j][k]);
				dp[i+1][1][!k]=add(dp[i+1][1][!k],mutiply(dp[i][j][k],way(i-j+1,i+1)));
			}
		}
	}
	int res=0;
	for(int i=1;i<=n;i++)
	{
		dp[n-1][i][0]=mutiply(dp[n-1][i][0],way(n-i,n));
		dp[n-1][i][1]=mutiply(dp[n-1][i][1],way(n-i,n));
		res=add(res,add(dp[n-1][i][0],dp[n-1][i][1]));
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
template<typename T> using Graph = vector<vector<T>>;
template<typename T> using Spacial = vector<vector<vector<T>>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

template<typename T> struct is_pair : false_type{};
template<typename T1, typename T2> struct is_pair<pair<T1, T2>> : true_type{};
template<typename T> struct is_vector : false_type{};
template<typename T> struct is_vector<vector<T>> : true_type{};

template<typename T1, typename T2>
istream &operator >> (istream &istr, pair<T1, T2> &p) {
  istr >> p.first >> p.second;
  return istr;
} 
template<typename T1, typename T2>
ostream &operator << (ostream &ostr, const pair<T1, T2> &p) {
  ostr << p.first << " " << p.second;
  return ostr;
}
template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) return ostr;
  bool vp = is_vector<T>() || is_pair<T>();
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    ostr << (vp ? "\n" : " ") << *itr;
  }
  return ostr;
}

template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int modpow(int a, long long n, int mod = MOD) {
  int ret = 1;
  do {
    if (n & 1) ret = 1LL * ret * a % mod;
    a = 1LL * a * a % mod;
  } while (n >>= 1);
  return ret;
}

template<typename T>
T GCD(T a, T b) { return b ? GCD(b, a%b) : a; }
template<typename T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

template<typename T1, typename T2>
bool CompareBySecond(pair<T1, T2> a, pair<T1, T2> b) {
  return a.second != b.second ? a.second < b.second : a.first < b.first;
}
template<typename T>
bool CompareBySlope(pair<T, T> a, pair<T, T> b) {
// counterclockwise from 12 o'clock direction
  if (a.first * b.first < 0) return a.first < b.first;
  if (a.first == 0) return a.second >= 0 || b.first > 0;
  if (b.first == 0) return b.second < 0 && a.first < 0;
  return a.second * b.first < a.first * b.second;
}


/* -------- <templates end> -------- */


void solve() {
  int h, w, n; cin >> h >> w >> n;
  cout << (n-1) / max(h, w) + 1 << endl;
}


/* -------- <programs end> -------- */


signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  if(N==1){
    cout<<"Hello World"<<endl;
  }else{
    int A,B;
    cin>>A>>B;
    cout<<A+B<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int MM_CHECK (char s1, char s2);
int main(void) {
   
   char S[10];
   
   scanf("%s",S);
   
   int YYMM = 0;
   int MMYY = 0;
   
   YYMM = MM_CHECK(S[2],S[3]);
   MMYY = MM_CHECK(S[0],S[1]);
   
   if (YYMM == 1 && MMYY == 1) {
      printf("AMBIGUOUS\n");
   }
   else if (YYMM == 1 && MMYY == 0) {
      printf("YYMM\n");
   }
   else if (YYMM == 0 && MMYY == 1) {
      printf("MMYY\n");
   }
   else {
      printf("NA\n");
   }
  
   return 0;
}

int MM_CHECK (char s1, char s2) {
   
   if (s1 == '0' && s2 == '1') {
      return 1;
   }
   else if (s1 == '0' && s2 == '2') {
      return 1;
   }
   else if (s1 == '0' && s2 == '3') {
      return 1;
   }
   else if (s1 == '0' && s2 == '4') {
      return 1;
   }
   else if (s1 == '0' && s2 == '5') {
      return 1;
   }
   else if (s1 == '0' && s2 == '6') {
      return 1;
   }
   else if (s1 == '0' && s2 == '7') {
      return 1;
   }
   else if (s1 == '0' && s2 == '8') {
      return 1;
   }
   else if (s1 == '0' && s2 == '9') {
      return 1;
   }
   else if (s1 == '1' && s2 == '0') {
      return 1;
   }
   else if (s1 == '1' && s2 == '1') {
      return 1;
   }
   else if (s1 == '1' && s2 == '2') {
      return 1;
   }
   else {
      return 0;
   }
   
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>

using namespace std;

const int MAX_N = 2e5 + 5;

typedef long long ll;

struct Block {
  int c1, c0, id;
  ll invs;

  Block (int _c1 = 0, int _c0 = 0, int _id = 0) :
    c1(_c1), c0(_c0), id(_id), invs((ll) _c1 * (ll) _c0) {}
};

bool operator< (Block p, Block q) {
  ll chara = (ll) p.c1 * (ll) q.c0 - (ll) p.c0 * (ll) q.c1;
  if (chara != 0) {
    return chara < 0;
  }
  return p.id < q.id;
}

Block merge (Block p, Block q) {
  Block ans;
  ans.id = p.id;
  ans.c1 = p.c1 + q.c1;
  ans.c0 = p.c0 + q.c0;
  ans.invs = p.invs + q.invs + (ll) p.c1 * (ll) q.c0;
  return ans;
}

int arr [MAX_N];
int par [MAX_N];
vector<int> adj [MAX_N];

set<Block> *ans [MAX_N];
int clz [MAX_N];
int cto [MAX_N];

void dfs (int u) {
  pair<int, int> bigch = {-1, -1};
  for (int nxt : adj[u]) {
    dfs(nxt);
    bigch = max(bigch, make_pair((int) ans[nxt]->size(), nxt));
  }

  int bigc = bigch.second;
  if (bigc == -1) {
    if (arr[u] == 0) {
      clz[u] = 1;
    } else {
      cto[u] = 1;
    }
    ans[u] = new set<Block> ();
  } else {
    // let's merge!
    ans[u] = ans[bigc];
    for (int nxt : adj[u]) {
      clz[u] += clz[nxt];
      cto[u] += cto[nxt];
      if (nxt != bigc) {
        for (auto it = ans[nxt]->begin(); it != ans[nxt]->end(); it++) {
          ans[u]->insert(*it);
        }
      }
    }

    if (arr[u] == 0) {
      clz[u]++;
    } else {
      Block front (1, clz[u], u);
      clz[u] = 0;

      while (!ans[u]->empty() && *ans[u]->begin() < front) {
        Block cf = *ans[u]->begin();
        ans[u]->erase(ans[u]->begin());
        front = merge(front, cf);
      }
      ans[u]->insert(front);
    }
  }
}

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

  int n;
  cin >> n;

  for (int i = 2; i <= n; i++) {
    cin >> par[i];
    adj[par[i]].push_back(i);
  }

  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }

  dfs(1);
  Block sol (0, 0, 0);
  set<Block> bls = *ans[1];
  while (!bls.empty()) {
    Block cf = *bls.begin();
    bls.erase(bls.begin());
    sol = merge(sol, cf);
  }

  cout << sol.invs << endl;
}


Measured memory_bytes: 60032
#include <iostream>
using namespace std;
int main(){
    // Your code here!
    bool cards[4][14];
    int n,rank;
    char suit;
    
    for(int s=0;s<4;s++)
     for(int r=1;r<=13;r++)
      cards[s][r]=0;
      
    cin>> n;
    for(int i=0;i<n;i++){
        cin>>suit>>rank;
        if(suit=='S') cards[0][rank]=1;
        if(suit=='H') cards[1][rank]=1;
        if(suit=='C') cards[2][rank]=1;
        if(suit=='D') cards[3][rank]=1;
    }
    
    for(int s=0;s<4;s++){
        for(int r=1;r<=13;r++){
            if(cards[s][r]) continue;
            if(s==0) suit='S';
            if(s==1) suit='H';
            if(s==2) suit='C';
            if(s==3) suit='D';
            cout<<suit<<" "<<r<<endl;
            
            
        }
    }
}



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

int main(){
  int n,i = 1,sum=0;
  cin >> n;
  while(i<=n){
    int temp = i,count = 0;
    while(1){
      if(temp/10==0){break;}
      ++count;
      temp /=10;
    }
    if((count + 1) % 2 != 0){
      ++sum;
    }
    ++i;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int a,b,c,f=1;
    scanf("%d%d%d",&a,&b,&c);
    if(a==b)
        if(a!=c&&b!=c) { printf("Yes"); f=0;}
    if(a==c)
        if(a!=b&&c!=b) { printf("Yes"); f=0;}
    if(c==b)
        if(c!=a&&b!=a) { printf("Yes"); f=0;}
    if(f==1) printf("No");
}


Measured memory_bytes: 128
import sys
def input():
    return sys.stdin.readline()[:-1]
N,M=map(int,input().split())
l=[[] for i in range(10**5)]
for i in range(N):
    a,b=map(int,input().split())
    l[a-1].append(b)
h=[]
import heapq
a=0
for i in range(M):
    for j in l[i]:
        heapq.heappush(h,-j)
    if h:
        a-=heapq.heappop(h)
print(a)

Measured memory_bytes: 86036