akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define int long long
signed main(){
//int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    vector<int> valppp(n);
    vector<int> valppm(n);
    vector<int> valpmp(n);
    vector<int> valpmm(n);
    vector<int> valmpp(n);
    vector<int> valmpm(n);
    vector<int> valmmp(n);
    vector<int> valmmm(n);
    for(int i = 0; i < n; i++) {
        int x,y,z;
        cin >> x >> y >> z;
        valppp[i]=x+y+z;
        valppm[i]=x+y-z;
        valpmp[i]=x-y+z;
        valpmm[i]=x-y-z;
        valmpp[i]=-x+y+z;
        valmpm[i]=-x+y-z;
        valmmp[i]=-x-y+z;
        valmmm[i]=-x-y-z;
    }
    sort(valppp.rbegin(),valppp.rend());
    sort(valppm.rbegin(),valppm.rend());
    sort(valpmp.rbegin(),valpmp.rend());
    sort(valpmm.rbegin(),valpmm.rend());
    sort(valmpp.rbegin(),valmpp.rend());
    sort(valmpm.rbegin(),valmpm.rend());
    sort(valmmp.rbegin(),valmmp.rend());
    sort(valmmm.rbegin(),valmmm.rend());

    int sumppp=0;
    int sumppm=0;
    int sumpmp=0;
    int sumpmm=0;
    int summpp=0;
    int summpm=0;
    int summmp=0;
    int summmm=0;

    for(int i = 0; i < m; i++) {
        sumppp+=valppp[i];
        sumppm+=valppm[i];
        sumpmp+=valpmp[i];
        sumpmm+=valpmm[i];
        summpp+=valmpp[i];
        summpm+=valmpm[i];
        summmp+=valmmp[i];
        summmm+=valmmm[i];
    }
    int ans=max({sumppp,sumppm,sumpmp,sumpmm,summpp,summpm,summmp,summmm});
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3716
#include<iostream>
using namespace std; // 575

const int MAX = 100001;

int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}
int main() {
	static int N, A[MAX];
	cin >> N;
	for (int i = 0;i < N;++ i) cin >> A[i];
	static int cumsumL[MAX], cumsumR[MAX]; // cumsumL[i] = [0, i)のgcd cumsumR[i]は[i, N)のgcd
	cumsumL[0] = cumsumR[N] = 0; // 実質、単位元として扱えるよ
	for (int i = 0;i < N;++ i) {
		cumsumL[i + 1] = gcd(cumsumL[i], A[i]);
		cumsumR[N - i - 1] = gcd(cumsumR[N - i], A[N - i - 1]);
	}
	int ans = 0;
	for (int i = 0;i < N;++ i) ans = max(ans, gcd(cumsumL[i], cumsumR[i+1]));
	cout << ans;
	
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

両側gcdを持っておけば、1個の除外がO(1)判定でできるのでO(N)
gcdがO(logN)なのでO(NlogN)
*/

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

vii child(100010);
vi depth(100010);
bitset<100010> used;

int dfs(int now, int par, int dep) {
  int res = 1;
  depth[now] = dep;
  used[now] = true;
  rep (i, child[now].size()) {
    int nex = child[now][i];
    if (nex == par || used[nex]) {
      continue;
    }
    res += dfs(nex, now, dep + 1);
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<pll> d(n);
  map<ll, int> mp;
  rep (i, n) {
    cin >> d[i].first;
    d[i].second = i;
    mp[d[i].first] = i;
  }
  sort(all(d));
  reverse(all(d));
  vi p(n);
  vi num(n, 1);
  int root = d.back().second;
  p[root] = -1;
  num[root] = n;
  rep (i, n - 1) {
    int v = d[i].second;
    ll su = d[i].first + 2 * num[v] - n;
    int u;
    try {
      u = mp.at(su);
    }
    catch (...) {
      cout << -1 << endl;
      return 0;
    }
    p[v] = u;
    child[u].push_back(v);
    num[u] += num[v];
  }
  if (dfs(root, -1, 0) != n) {
    cout << -1 << endl;
    return 0;
  }
  ll sr = 0;
  rep (i, n) {
    sr += depth[i];
  }
  if (sr != d.back().first) {
    cout << -1 << endl;
    return 0;
  }
  rep (i, n) {
    if (p[i] == -1) {
      continue;
    }
    cout << i + 1 << " " << p[i] + 1 << endl;
  }
}
  
  


Measured memory_bytes: 18944
#include<stdio.h>

int main()
{
	int n=0,i;
	char c[5];
	scanf("%s", c);
	for (i = 0; i < 4; i++)
	{
		if (c[i] == '+')
			n++;
		else
			n--;
	}
	printf("%d", n);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main{

    int n;
    int[][] t;
    int[] hand;
    int INF = Integer.MAX_VALUE;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            n = sc.nextInt();
            if(n==0) break;

            hand = new int[n];
            t = new int[n][n];
            for(int i=0; i<n; i++){
                hand[i] = sc.nextInt();
                for(int j=0; j<n; j++) t[i][j] = sc.nextInt();
            }

            int[] dp = new int[1<<n];
            Arrays.fill(dp, INF);
            dp[0] = 0;

            for(int mask=0; mask<(1<<n); mask++){
                for(int j=0; j<n; j++){
                    if((mask & (1<<j))==0){
                        int min = hand[j];
                        for(int k=0; k<n; k++){
                            if((mask & (1<<k))>0){
                                min = Math.min(min, t[j][k]);
                            }
                        }
                        dp[mask^(1<<j)] = Math.min(dp[mask^(1<<j)], dp[mask] + min);
                    }
                }
            }
            System.out.println(dp[(1<<n)-1]);
        }
    }

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

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = (ll)1e15;

int main(void)
{
	double r;
	cin >> r;
	cout << fixed << setprecision(10);
	cout << r * 2 * M_PI << endl;
	return 0;
}


Measured memory_bytes: 3784
n,m=map(int, input().split())
from math import sqrt
d0=[]
for i in range(1,int(sqrt(m)+1)):
    if m%i==0:
        d0.append(i)
d=d0[:]
for di in reversed(d0):
    d.append(m//di)
for i in reversed(d):
    if i<=m//n:
        print(i)
        break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    if((n-1)/2+1 >= K){
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	a, _ := sc.NextInts(5)
	for i, v := range a {
		if v == 0 {
			fmt.Print(i + 1)
			return
		}
	}
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}

// NextInts reads n integers from io stream.
func (sc *Scanner) NextInts(n int) (arr []int, e error) {
	arr = make([]int, n)
	for i := 0; i < n; i++ {
		v, e := sc.NextInt()
		if e != nil {
			return nil, e
		}
		arr[i] = v
	}
	return arr, nil
}


Measured memory_bytes: 1756
#include<stdio.h>
#include<math.h>
#define pb push_back
//#define FAST ios::sync_with_stdio(false);cin.tie(NULL),cout.tie(NULL);
//typedef long long ll;
#define pi acos(-1.0)
//using namespace std;

int main()
{
     int n,m,a,b=0,ans=0;
scanf("%d%d",&n,&m);
     while(m--)
     {
scanf("%d",&a) ;
        b+=a;
     }
     if(n-b>=0)
        printf("%d\n",n-b);
     else
        printf("-1\n");
//    cin>>r;
//    cout<<2*pi*r<<fixed<<setprecision(12)<<endl;
    return 0;
}


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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll a, b, c; gi(a); gi(b); gi(c);
	if((c-a-b)>=0 && 4*a*b<(c-a-b)*(c-a-b)) pstr("Yes");
	else pstr("No");
}

//a*b<((c-a-b)/2)^2

Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <vector>
#include <set>
using namespace std;

#define int long long
#define rep(n, i) for (int i = 0; i < n; i++)
#define rep2(m, n, i) for (int i = m; i < n; i++)
#define rep_r(n, i) for (int i = n - 1; i >= 0; i--)

const int INF = 1LL << 60;
const int MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    int a[n];
    rep(n, i) {
        cin >> a[i];
        a[i] = -a[i];
    }
    int dp[n + 1];
    fill(dp, dp + n + 1, INF);
    dp[0] = a[0];
    rep2(1, n, i) {
        *upper_bound(dp, dp + n + 1, a[i]) = a[i];
    }
    rep(n + 1, i) {
        if (dp[i] == INF) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 1792
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let S = read![[i64]];

    // A=N-1, B=1 で必ずスコア 0 を達成できる
    let mut max_sum = 0;

    // C = A - B
    for C in 1..N {
        // 踏んだ蓮のスコアの総和
        let mut sum = 0;

        // 踏んだ蓮の集合
        let mut done = BTreeSet::new();

        // ジャンプ回数 2x + 1 の経路を探索 (O(log N))
        let mut x = 0;
        loop {
            let A = N - 1 - min(N - 1, x * C);
            let B = A - min(A, C);
            if A == 0 || B == 0 {
                break;
            }

            // 最後のジャンプの1回前の戻りジャンプ
            let u = N - 1 - A;
            if !done.insert(u) {
                // 同じ蓮を踏んだ
                break;
            }
            sum += S[u];

            // 最初のジャンプ
            let v = A;
            if !done.insert(v) {
                break;
            }
            sum += S[v];

            max_sum = max(max_sum, sum);

            // 今のループで踏んだ蓮は次のループでも踏むので sum や done はそのままでよい
            x += 1;
        }
    }

    println!("{}", max_sum)
}


Measured memory_bytes: 8444
#include <cstdio>
#include <functional>
#include <queue>
#include <vector>
typedef long long lld;
typedef std::priority_queue<int> max_heap;
typedef std::priority_queue<int, std::vector<int>, std::greater<int>> min_heap;
max_heap mxh;
min_heap mnh;
int a, b, Q;
lld A, B;

// mxh: [3, 2, 1]
// mnh: [5, 8, D]

void update() {
    B += b;
    if (mxh.empty()) {
        mxh.push(a);
    } else if (a <= mxh.top()) {
        A += mxh.top() - a;
        mxh.push(a);
    } else {
        A += a - mxh.top();
        mnh.push(a);
    }
    while (mxh.size() >= (mnh.size() + 2u)) {
        mnh.push(mxh.top());
        mxh.pop();
        A -= 1LL * (mnh.top() - mxh.top()) * (mxh.size() - mnh.size());
    }
    while (mnh.size() > mxh.size()) {
        A -= 1LL * (mnh.top() - mxh.top()) * (mnh.size() - mxh.size());
        mxh.push(mnh.top());
        mnh.pop();
    }
}

int query() { return mxh.top(); }

int main() {
    scanf("%d", &Q);
    A = B = 0LL;
    for (int q = 1; q <= Q; ++q) {
        char cmd;
        scanf(" %c", &cmd);
        switch (cmd) {
        case '1':
            scanf(" %d%d", &a, &b);
            update();
            break;
        case '2':
            printf("%d %lld\n", query(), A + B);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3452
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string str;
	char a[4][4];
	while((cin>>str)!=0){
		for(int i=0;i<9;i++){
			a[i/3][i%3]=str[i];
		}
		if(a[0][0]=='o'&&a[0][1]=='o'&&a[0][2]=='o')cout<<'o';
		else if(a[1][0]=='o'&&a[1][1]=='o'&&a[1][2]=='o')cout<<'o';
		else if(a[2][0]=='o'&&a[2][1]=='o'&&a[2][2]=='o')cout<<'o';
		else if(a[0][0]=='o'&&a[1][0]=='o'&&a[2][0]=='o')cout<<'o';
		else if(a[0][1]=='o'&&a[1][1]=='o'&&a[2][1]=='o')cout<<'o';
		else if(a[0][2]=='o'&&a[1][2]=='o'&&a[2][2]=='o')cout<<'o';
		else if(a[0][0]=='o'&&a[1][1]=='o'&&a[2][2]=='o')cout<<'o';
		else if(a[0][2]=='o'&&a[1][1]=='o'&&a[2][0]=='o')cout<<'o';
		
		else if(a[0][0]=='x'&&a[0][1]=='x'&&a[0][2]=='x')cout<<'x';
		else if(a[1][0]=='x'&&a[1][1]=='x'&&a[1][2]=='x')cout<<'x';
		else if(a[2][0]=='x'&&a[2][1]=='x'&&a[2][2]=='x')cout<<'x';
		else if(a[0][0]=='x'&&a[1][0]=='x'&&a[2][0]=='x')cout<<'x';
		else if(a[0][1]=='x'&&a[1][1]=='x'&&a[2][1]=='x')cout<<'x';
		else if(a[0][2]=='x'&&a[1][2]=='x'&&a[2][2]=='x')cout<<'x';
		else if(a[0][0]=='x'&&a[1][1]=='x'&&a[2][2]=='x')cout<<'x';
		else if(a[0][2]=='x'&&a[1][1]=='x'&&a[2][0]=='x')cout<<'x';	
	
		else cout<<'d';
		cout<<endl;
	}
	return 0;
}

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

int main(){
 int n,w,h;
  cin >> h >> w >> n;
  int ans=0;
  if(h>w){
    if(n%h==0) ans = ceil(n /h);
    else ans = ceil(n/h)+1;
  }
  else{
    if(n%w==0) ans = ceil(n /w);
    else ans = ceil(n/w)+1;
  }
  cout << ans;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    foreach(_;0..readln().chomp().to!int())
    {
        auto m = readln().split().map!(to!real);
        immutable x1=m[0], y1=m[1], x2=m[2], y2=m[3], x3=m[4], y3=m[5], x4=m[6], y4=m[7];
        writeln((x1-x2)*(y3-y4)==(x3-x4)*(y1-y2)?"YES":"NO");
    }
}

Measured memory_bytes: 1060
from math import ceil
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & (1 << j):
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & (1 << j):
                neededsolve = ceil((G - score) / (100*(j+1)))
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    break
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)

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

int main(){
    string s, t;
    int n;
    cin >> n;
    cin >> s >> t;
    char ans[2*n];
    int f = 0;
    for(int i = 0; i < n; i++){
        ans[i+f] = s[i];
        ans[i+1+f] = t[i];
        f++;
    }
    for(int i = 0; i < 2*n; i++){
        printf("%c", ans[i]);
    }
    return 0;
}

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

int main() {
  int n, m, s = 0;
  cin >> n >> m;
  vector<bool> v(n, 1);
  vector<int> a(n, 0);
  rep(i, m){
    int b;
    cin >> b;
    v[b-1] = 0;
  }
  rep(i, n){
    if(i == 0 && v[0]) a[0] = 1;
    if(i == 1 && v[1]) a[1] = 1;
    if(i > 0 && v[i-1]) a[i] += a[i-1];
    if(i > 1 && v[i-2]) a[i] += a[i-2];
    a[i] %= 1000000007;
  }
  cout << a[n-1] << endl;
  return 0;
}

Measured memory_bytes: 640
package main

import (
	"fmt"
	"sort"
)

type re struct {
	num int
	s string
	p int
}

type res []re

func (a res) Len() int           { return len(a) }
func (a res) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a res) Less(i, j int) bool {
	if a[i].s == a[j].s {
		return a[i].p > a[j].p
	}
	return a[i].s < a[j].s 
}

func main() {
	var n int
	fmt.Scan(&n)

	arr := make(res,n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i].s,&arr[i].p)
		arr[i].num = i+1
	}

	sort.Sort(arr)

	for _, e := range arr {
		fmt.Println(e.num)
	}

}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            int x = sc.nextInt();
            if(n == 0 && x ==0) break;
            int num[] = new int[400];
            for(int l = 0; l < 400; l++) {
                num[l] = 0;
            }

            for(int i = n; i > 2; i--){
                for(int j = i - 1; j > 1; j--){
                    for(int k = j - 1; k > 0; k--){
                        num[i+j+k] += 1;
                    }
                }
            }
            System.out.println(num[x]);
        }
    }
}


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

int main(){
  int N;
  cin >> N;
  if(N%2 == 0)cout<< N/2 <<endl;
  else cout <<  (N+1)/2<< endl;


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define for1(n) for(i=1; i<=(n); i++)


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s="";
    char aa[26],cc='a';
    aa[0]='z';
    for1(25)aa[i]=cc++;
    cin>>n;
    while(n>0)
    {
        x=n%26;
        s+=aa[x];
        n=n/26;
        if(x==0)n--;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
}



Measured memory_bytes: 3640
import java.util.Scanner;

/**
 * B - Count Balls
 * 高橋君は青と赤の 2 色のボールを持っており、これらを一列に並べようとしています。
 * 初め、列にボールはありません。
 * 根気のある高橋君は、次の操作を10の100乗 回繰り返します。
 * 列の末尾に、A 個の青いボールを加える。
 * その後、列の末尾に B 個の赤いボールを加える。
 * こうしてできる列の先頭からN 個のボールのうち、青いボールの個数はいくつでしょうか。
 */
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner( System.in );
        // 先頭から確認するボールの数
        long n = sc.nextLong();
        // 青いボールの数
        long a = sc.nextLong();
        // 赤いボールの数
        long b = sc.nextLong();

        long ballCnt = 0;
        // 青いボールを１つ以上並べている時
        if( a > 0 ) {
            // 繰り返す数を求める
            long divisionAns = n / ( a + b );
            // 繰り返す数を算出した割り算の余りを求める
            long remainderOfDivision = n % ( a + b );

            ballCnt += divisionAns * a;
            ballCnt += remainderOfDivision < a ? remainderOfDivision : a;
        }

        System.out.println( ballCnt );

        sc.close();
    }
}

Measured memory_bytes: 23764
K,N = input().split();
A = list(input().split());

K = int(K);
N = int(N);

A = [int(a) for a in A];

B = [];
for i in range(len(A)):
  B.append(A[i]-A[i-1]);

#修正
B [0] = (K - A[len(A) -1]) + A[0];

max_B = max(B);
ans = K - max(B);

print(ans);

Measured memory_bytes: 24856
import copy


class Dice:
    def __init__(self, eyes: [int]):
        self.__eyes = eyes

    @property
    def eyes(self):
        return self.__eyes

    def top(self):
        return self.__eyes[0]

    def right(self):
        return self.__eyes[2]

    def roll_s(self):
        tmp = copy.copy(self.__eyes)
        tmp[0] = self.__eyes[4]
        tmp[1] = self.__eyes[0]
        tmp[2] = self.__eyes[2]
        tmp[3] = self.__eyes[3]
        tmp[4] = self.__eyes[5]
        tmp[5] = self.__eyes[1]
        self.__eyes = tmp

    def roll_e(self):
        tmp = copy.copy(self.__eyes)
        tmp[0] = self.__eyes[3]
        tmp[1] = self.__eyes[1]
        tmp[2] = self.__eyes[0]
        tmp[3] = self.__eyes[5]
        tmp[4] = self.__eyes[4]
        tmp[5] = self.__eyes[2]
        self.__eyes = tmp

    def roll_n(self):
        tmp = copy.copy(self.__eyes)
        tmp[0] = self.__eyes[1]
        tmp[1] = self.__eyes[5]
        tmp[2] = self.__eyes[2]
        tmp[3] = self.__eyes[3]
        tmp[4] = self.__eyes[0]
        tmp[5] = self.__eyes[4]
        self.__eyes = tmp

    def roll_w(self):
        tmp = copy.copy(self.__eyes)
        tmp[0] = self.__eyes[2]
        tmp[1] = self.__eyes[1]
        tmp[2] = self.__eyes[5]
        tmp[3] = self.__eyes[0]
        tmp[4] = self.__eyes[4]
        tmp[5] = self.__eyes[3]
        self.__eyes = tmp

    def turn_right(self):
        tmp = copy.copy(self.__eyes)
        tmp[0] = self.__eyes[0]
        tmp[1] = self.__eyes[3]
        tmp[2] = self.__eyes[1]
        tmp[3] = self.__eyes[4]
        tmp[4] = self.__eyes[2]
        tmp[5] = self.__eyes[5]
        self.__eyes = tmp

    def adjust_top(self, top: int):
        for _ in range(4):
            if self.top() is top:
                break
            self.roll_e()
        for _ in range(4):
            if self.top() is top:
                break
            self.roll_s()

    def adjust_front(self, front: int):
        for _ in range(4):
            if self.front() is front:
                break
            self.turn_right()

    def front(self):
        return self.__eyes[1]

    def roll(self, direction: str):
        if direction.lower() == 'n':
            self.roll_n()
        if direction.lower() == 'e':
            self.roll_e()
        if direction.lower() == 's':
            self.roll_s()
        if direction.lower() == 'w':
            self.roll_w()


def resolve():
    eyes1 = list(map(int, input().split()))
    eyes2 = list(map(int, input().split()))

    dice1 = Dice(eyes1)
    dice2 = Dice(eyes2)

    random1 = max(set(eyes1+eyes2))

    dice1.adjust_top(random1)
    dice2.adjust_top(random1)

    dice2.adjust_front(dice1.front())

    if dice1.eyes == dice2.eyes:
        print('Yes')
    else:
        print('No')



resolve()



Measured memory_bytes: 6360
#include<bits/stdc++.h>
using namespace std;
#define in(s) ll s; cin >> s
#define pr(r) cout << r << endl
#define prr(m,n) cout<<m<<" "<<n<<endl
#define prarr(a,i,n) fab(j,i,n) cout << a[j] << " "
#define wh(t) ll t; cin >> t; while(t--)
#define sz(u) u.size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define arr(a,n) vl a(n, 0); fab(i, 0, n) cin >> a[i]
#define prs(u) cout << u << " "
#define fab(i,a,b) for(ll i = a; i < b; i++)
#define fba(i,b,a) for(ll i = b; i >= a; i--)
#define fa(i, x) for(auto i: x)
#define mem(s, j) memset(s, j, sizeof(s))
#define sup ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define ll long long int
#define vl vector<ll>
#define vpl vector<pl>
#define pl pair<ll, ll>
#define pll pair<ll, pl>
#define vvl vector<vl>
#define vvpl vector<vpl>
#define mxe(x, n) *max_element(x, n)
#define mne(x, n) *min_element(x, n)
#define mp make_pair
#define pb push_back
#define fs first
#define sd second
#define fr front()
#define bk back()
#define rr return
const ll N = (ll)3e5;
const ll inf = (ll)1e18 + 7;
const ll mod = (ll)1e9 + 7;
const ll MX = (ll)1e9 + 7;
const ll MAX = (ll)1e12 + 7;
 
bool rsort1(const pair<ll, ll> &a,const pair<ll, ll> &b) { return (a.first > b.first);}
bool rsort2(const pair<ll, ll> &a,const pair<ll, ll> &b) { return (a.second > b.second);}
bool sort2(const pair<ll, ll> &a,const pair<ll, ll> &b){ return (a.second < b.second);}

void add(ll &x, ll y){
    x = ((x % mod) + (y % mod)) % mod;
}

void mul(ll &x, ll y){
    x = ((x % mod) * (y % mod)) % mod;
}

ll sm(vl a) {
    ll sum = 0;
    for(auto i: a)
        sum += i;
    return sum;
}

ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y % 2 == 0) 
        return power(x, y / 2) * power(x, y / 2); 
    else
        return x * power(x, y / 2) * power(x, y / 2); 
}
 
bool isPrime(ll p)
{
    for(ll i = 2;i * i <= p; i++)
        if(p % i == 0)
            rr false;
    rr true;
}


int main()
{
	sup;
    
    
    string s, a;
    cin >> s;
    ll q, t, f, check = 1;
    cin >> q;
    stack<string> st;
    while(q--) {
        cin >> t;
        if(t == 1) {
            if(check == 1)
                check = 0;
            else 
                check = 1;
        }
        else {
            cin >> f >> a;
            if(f == 1) {
                if(check == 0)
                    s += a;
                else 
                    st.push(a);
            }
            else {
                if(check == 1)
                    s += a;
                else 
                    st.push(a);
            }
        }
    }
    if(check == 1) {
        while(!st.empty()) {
            cout << st.top();
            st.pop();
        }
        cout << s;
    }
    else {
        string u;
        while(!st.empty()) {
            u += st.top();
            st.pop();
        }
        s = u + s;
        reverse(all(s));
        cout << s;
    }
    return 0;
}

Measured memory_bytes: 9936
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    READV(M);
    READAR(A,N);
    set<ll> X;
    bool ok=true;
    ll lcm=1;
    FORI(i,0,N)
    {
        A[i]=A[i]/2;
        ll z=0;
        ll prev=2;
        while (A[i]%prev==0)
        {
            z++;
            prev*=2;
        }
        X.insert(z);
        if (sz(X)>1)
        {
            ok=false;
            break;
        }
        else
        {
            lcm=(lcm*A[i])/__gcd(lcm,A[i]);
            if (lcm>(ll)1e9)
            {
                ok=false;
                break;
            }
        }
    }
    if (ok)
    {
        ll ans=M/lcm;
        ans=(ans+1)/2;
        cout<<ans<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
    
    

//-----------------------------------------------------------------------------------------------------------//


    
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
#define REP(i,b,e) for(int i=b;i<(int)e;i++)
typedef long long ll;
typedef map<ll,ll> mll;
typedef vector<ll> vll;
ll INF=1e18;
int inf=1e9+1000;

int N;
string s;


int main(){
    cin>>N>>s;
    int ans=0;
    int p=0;
    rep(i,N-1){
        if(s[i]=='E') p++;
    }
    ans=p;
    rep(i,N-1){
        if(s[i]=='E'&&s[i-1]=='E'){ p--;
        }
      if(s[i]=='E'&&s[i-1]=='W'){ 
        }
      if(s[i]=='W'&&s[i-1]=='W'){ p++;
        }
      if(s[i]=='W'&&s[i-1]=='E'){ 
      }
        ans=min(ans,p);
    }
    cout<<ans<<endl;

    
    return 0;
}


Measured memory_bytes: 900
#include<iostream>
using namespace std;
int main(){
	int m,d;
	for(;;){
		cin >>m>>d;
		if(m == 0 && d == 0){break;}
		if(m == 2){d+=3;}
		else if(m == 3){d+=4;}
		else if(m == 5){d+=2;}
		else if(m == 6){d+=5;}
		else if(m == 8){d+=3;}
		else if(m == 9){d+=6;}
		else if(m == 10){d+=1;}
		else if(m == 11){d+=4;}
		else if(m == 12){d+=6;}
		if(d%7 == 1){cout <<"Thursday"<<endl;}
		else if(d%7 == 2){cout <<"Friday"<<endl;}
		else if(d%7 == 3){cout <<"Saturday"<<endl;}
		else if(d%7 == 4){cout <<"Sunday"<<endl;}
		else if(d%7 == 5){cout <<"Monday"<<endl;}
		else if(d%7 == 6){cout <<"Tuesday"<<endl;}
		else if(d%7 == 0){cout <<"Wednesday"<<endl;}
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;
class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s[]= in.nextLine().split("");
        if ( new HashSet<String>(Arrays.asList(s)).size()==s.length ) System.out.println("yes");
        else System.out.println("no");
    }
}

Measured memory_bytes: 21844
S = input()

red = 0
blue = 0
ans = 0
for s in S:
    if s == "0":
        red += 1
        if blue >= 1:
            ans += 2
            red -=1
            blue -= 1
    else:
        blue += 1
        if red >= 1:
            red -= 1
            blue -=1
            ans += 2

print(ans)


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898

//------------------------------------------------------

int n, m;
string a[51], b[51];

bool check(int x, int y) {

    REP(i, x, x + m) {

        REP(j, y, y + m) {
            if (i >= n || j >= n) return false;
            if (a[i][j] != b[i - x][j - y]) return false;
        }
    }
    return true;
}

int main() {
    cin >> n >> m;
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    rep(i, n) {

        rep(j, n) {
            if (check(i, j)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}



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

i = 1

def seed(l):
    if len(l) == 1:
        yield l
        return
    for j in range(len(l)):
        m = l[:j] + l[j + 1:]
        for s in seed(m):
            s = l[j:j + 1] + s
            yield s

i = 1
for s in seed(list(range(1, N + 1))):
    if s == P:
        a = i
    if s == Q:
        b = i
    i += 1

print(abs(a-b))




Measured memory_bytes: 3064
import sys
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)


class Comb(object):

    def __init__(self, n, MOD=1e9 + 7):
        self.MOD = MOD

        fac = [0] * (n + 10)
        finv = [0] * (n + 10)
        inv = [0] * (n + 10)

        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1

        for i in range(2, n + 10):
            fac[i] = fac[i - 1] * i % MOD
            inv[i] = MOD - inv[int(MOD % i)] * (MOD // i) % MOD
            finv[i] = finv[i - 1] * inv[i] % MOD
        self.fac = fac
        self.finv = finv
        self.inv = inv

    def calc_c(self, n, k):
        if n < k:
            return 0
        return self.fac[n] * (self.finv[k] * self.finv[n - k] %
                              self.MOD) % self.MOD

    def calc_h(self, n, k):
        return self.calc_c(n + k - 1, k)


MOD = 10**9 + 7
n, k = map(int, read().split())

comb = Comb(n, MOD)

ans = 0

for i in range(min(n, k) + 1):
    ans += comb.calc_c(n, i) * comb.calc_c(n - 1, i) % MOD

print(ans % MOD)


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

#define debug(x) cerr << #x << ": " << x << endl

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  int res = 0;
  for (int i = 1; i <= n; i += 2) {
    set<int> divs;
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        divs.insert(j);
        divs.insert(i / j);
      }
    }
    if (divs.size() == 8)
      ++res;
  } 
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 256
n = list(input())

if (int(n[len(n)-1]) == 0) or (int(n[len(n)-1]) == 1) or (int(n[len(n)-1]) == 6) or (int(n[len(n)-1]) == 8):
  print("pon")
elif (int(n[len(n)-1]) == 3):
  print("bon")
else:
  print("hon")

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

int read()
{
	int ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=false;
	if(ch=='-')
	{
		flag=true;
		ch=getchar();
	}
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10+ch-'0';
	return flag?-ans:ans;
}

long long rell()
{
	long long ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=false;
	if(ch=='-')
	{
		flag=true;
		ch=getchar();
	}
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10ll+(long long)(ch-'0');
	return flag?-ans:ans;
}

void write(int a)
{
	if(!a)
	{
		putchar('0');
		return;
	}
	static char ans[233];
	int n=0;
	for(;a;a/=10)ans[n++]=a%10+'0';
	for(;n;)putchar(ans[--n]);
}

void write(long long a)
{
	if(!a)
	{
		putchar('0');
		return;
	}
	static char ans[233];
	int n=0;
	for(;a;a/=10)ans[n++]=a%10+'0';
	for(;n;)putchar(ans[--n]);
}
const int N=1<<18;
int s[N],n;

void add(int i)
{
	for(;i<=n;i+=i&-i)s[i]++;
}

long long query(int i)
{
	int ans=0;
	for(;i;i-=i&-i)ans+=s[i];
	return ans;
}

int main()
{
	int m;
	scanf("%d%d",&n,&m);
	if(!m)
	{
		printf("%lld\n",(long long)n*n);
		return 0;
	}
	long long ans=0;
	for(int k=n;k>=m;k--)
	{
		ans+=query(n-k)+n-k;
		for(int i=k;i<=n;i+=k)add(i);
		//printf("k=%d ans=%lld\n",k,ans);
	}
	write(ans);
	return 0;
}


Measured memory_bytes: 640
import itertools

n = int(input())
a = sorted(list(map(int,input().split())))
res = 0
g = itertools.groupby(a)

for k,v in g:
    l = len(list(v))
    if l>k:
        res += l-k
    elif l<k:
        res += l

print(res)


Measured memory_bytes: 14528
#include<bits/stdc++.h>
//#include<unordered_map>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<sstream>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
#define asd signed QP;scanf("%d",&QP);while(QP--)
#define alll(x,y) x+1,x+1+y
typedef pair<int,int> PI;
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;}
int lowbit(int x){return x&-x;}
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
//
const int BN=1e5+5;
struct BIT{
    int c[BN];
    void init(){memset(c,0,sizeof c);}
    int lowbit(int i){return i&-i;}
    void add(int i,int t){while(i<BN)c[i]+=t,i+=lowbit(i);}
    int ask(int i){int ans=0;while(i)ans+=c[i],i-=lowbit(i);return ans;}
};
//
const double eps=1e-6;
const int mod=1e9+7;
//const int mod=998244353;
const int modd=mod-1;
//
const int maxm=1e5+5;


void solve(){
    int x=re;
    int now=100;
    int ans=0;
    while(now<x){
        ans++;
        now=now+now/100;
    }
    pr(ans);

}
signed main(){
//    while(1)
//    asd
        solve();
    return 0;
}
/*

*/


Measured memory_bytes: 3636
#include<iostream>
#include<cmath>
#include<algorithm>

#define ll long long

using namespace std;

const int N = 1e6 + 10;

int tr[N];
int n,m;
int last[N];
int ans[N];
struct node{
	int l,r,pos;
}nod[N];

int color[N];

int lowbit(int x)
{
	return x & -x;
}

void add(int x, int a)
{
	for(int i=x; i<=n; i+=lowbit(i)) tr[i]+=a;
}

int query(int x)
{
	int rul = 0;
	for(int i=x; i; i-=lowbit(i)) rul += tr[i];
	return rul;
}

bool cmp(node a, node b)
{
	return a.r < b.r;
}

int main()
{
	cin>>n>>m;
	for(int i=1; i<=n; i++) scanf("%d",&color[i]);
	for(int i=1; i<=m; i++)
	{
		scanf("%d %d",&nod[i].l,&nod[i].r);
		nod[i].pos = i;
	}
	sort(nod+1, nod+m+1, cmp);
	int next = 1;
	for(int i=1; i<=m; i++)
	{
		for(int j=next; j<=nod[i].r; j++)
		{
			if(last[color[j]]) add(last[color[j]], -1);
			last[color[j]] = j;
			add(j, 1);
		}
		next = nod[i].r+1;
		ans[nod[i].pos] = query(nod[i].r) - query(nod[i].l-1);
	}
	for(int i=1; i<=m; i++)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1000000007;

ll n,m;
vector<ll> a,b;
ll solve() {
	ll res=1;
	ll biggerA=0,biggerB=0;
	for (int x = n*m;x > 0;x--) {
		if (a[biggerA] > x) return 0;
		if (b[biggerB] > x) return 0;
		ll tmp = 1;
		if (a[biggerA] == x&&b[biggerB] == x) {
			tmp = 1;
			biggerA++;
			biggerB++;
		} else if (a[biggerA] == x) {
			tmp = biggerB;
			biggerA++;
		} else if (b[biggerB] == x) {
			tmp = biggerA;
			biggerB++;
		} else {
			tmp = biggerA * biggerB - (n*m-x);
			if (tmp <= 0) return 0;
		}
		res = (res * tmp) % inf;
	}
	return res;
}

int main() {
	cin >> n >> m;
	a.resize(n+1); b.resize(m+1);
	for (int i=0;i<n;i++) cin >> a[i];
	for (int i=0;i<m;i++) cin >> b[i];
	sort(a.begin(),a.end(),greater<ll>());
	sort(b.begin(),b.end(),greater<ll>());
	cout << solve() << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

//
// Macro debug!
//

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

//
// Macro input!
//

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//
// IteratorExt
//

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}





fn main() {
    input! {
        xs: chars,
    }

    let is_good = xs.windows(2).all(|w| w[0] != w[1]);
    let ans = if is_good { "Good" } else { "Bad" };
    println!("{}", ans);
}


Measured memory_bytes: 4352
/* ex3_2
   moka223711 */

#include <stdio.h>

int main(void){
	int num, K, i = 1;
	scanf("%d %d", &num, &K);

	// numがK^i以上のとき、K進法はi桁で表せる
	// numをKで割り続けて何回割れるかをiでカウントする
	while(num >= K){
		num /= K;
		i++;
	}

	printf("%d", i);

	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
    long long aI, aO, aT, aJ, aL, aS, aZ;
    cin >> aI >> aO >> aT >> aJ >> aL >> aS >> aZ;

    long long num6 = min(min(aJ, aL), aI);
    long long num4 = (aI - num6) / 2 + (aJ - num6) / 2 + (aL - num6) / 2;
    long long num2 = aO;
    long long total = 6 * num6 + 4 * num4 + 2 * num2;

    if (num6 > 0) {
        num6--;
        num4 = (aI - num6) / 2 + (aJ - num6) / 2 + (aL - num6) / 2;
        num2 = aO;
        long long total2 = 6 * num6 + 4 * num4 + 2 * num2;
        total = max(total, total2);
    }

    cout << total / 2 << endl;
}


Measured memory_bytes: 256
S = input()
if S == "SUN":
    print(7)
if S == "MON":
    print(6)
if S == "TUE":
    print(5)
if S == "WED":
    print(4)
if S == "THU":
    print(3)
if S == "FRI":
    print(2)
if S == "SAT":
    print(1)


Measured memory_bytes: 2940