akhauriyash/Code-Regression huggingface dataset:
// C.

#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<LL> a(n), b(n), c, d;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	for (int i = 0; i < n; ++i) {
		if (a[i] > b[i]) {
			c.push_back(a[i] - b[i]);
		} else if (a[i] < b[i]) {
			d.push_back(b[i] - a[i]);
		}
	}
	LL x = accumulate(c.begin(), c.end(), 0LL);
	LL y = accumulate(d.begin(), d.end(), 0LL);
	int ans = 0;
	if (y > x) {
		ans = -1;
	} else if (y > 0) {
		int i = 0;
		sort(c.rbegin(), c.rend());
		sort(d.rbegin(), d.rend());
		LL p = 0, q = 0;
		for (LL r : d) {
			++ans;
			q = r;
			while (q > 0) {
				if (!p) {
					++ans;
					p = c[i++];
				}
				LL e = min(p, q);
				p -= e;
				q -= e;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
  for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ) {
    if ( L[i].value <= R[j].value ) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int left, int right) {
  int mid;
  if ( left + 1 < right ) {
    mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int partition(struct Card A[], int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r; j++ ) {
    if ( A[j].value <= x.value ) {
      i++;
      t	= A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i + 1];
  A[i + 1] = A[r];
  A[r] = t;
  return i + 1;
}

void quickSort(struct Card A[], int p, int r) {
  int q;
  if ( p < r ) {
    q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A, 0, n);
  quickSort(B, 0, n - 1);

  for ( i = 0; i < n; i++ ) {
    if ( A[i].suit != B[i].suit ) {
      stable = 0;
      break;
    }
  }


  if ( stable == 1 ) printf("Stable\n");
  else printf("Not stable\n");
  for ( int i = 0; i < n; i++ ) {
    printf("%c %d\n", B[i].suit, B[i].value);
    // printf("%c %d\n", A[i].suit, A[i].value);                                
  }

  return 0;
}

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

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;

int main() {
	fast;

	int d, t, s;
	cin >> d >> t >> s;

	if(t * s >= d) cout << "Yes";
	else cout << "No";
}

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

typedef long long ll;

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll a, b;
	cin>>a>>b;

	if(a%2 == 1 && b%2 == 1) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

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

	int ans = 0;
	if (x <= y) {
		if (a + b <= 2 * c) {
			ans += (x * (a + b));
		}
		else {
			ans += (x * 2 * c);
		}

		ans += min((y - x)*b, (y - x) * 2 * c);
	}
	else {
		if (a + b <= 2 * c) {
			ans += (y * (a + b));
		}
		else {
			ans += (y * 2 * c);
		}

		ans += min((x - y)*a, (x - y) * 2 * c);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using int_vec = vector<int>;

void heapify(int_vec& v, int i) {
    int max;

    auto h = v.size();
    auto l = i * 2 + 1;
    auto r = i * 2 + 2;
    if (l < h && v[l] > v[i]) {
        max = l;
    } else {
        max = i;
    }
    if (r < h && v[r] > v[max]) {
        max = r;
    }

    if (max != i) {
        swap(v[i], v[max]);
        heapify(v, max);
    }
}

void heapify(int_vec& v) {
    for (int i = (v.size() - 1) / 2; i >= 0; --i) {
        heapify(v, i);
    }
}

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

    int_vec v;
    for (auto i = 0; i < n; ++i) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    heapify(v);

    for (auto& a: v) {
        cout << " " << a;
    }
    cout << endl;

    return 0;
}

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

int main(){
     string s;
cin>>s;
        map<char, int> m;
        for(char x: s){
            m[x]++;
        }
        for(auto x: m) if(x.second%2!=0) {cout<<"No"<<endl; return 0;}
        cout<<"Yes"<<endl;

}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

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

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

    vector<int> c(m);
    rep(i,0,m) cin >> c[i];

    int dp[21][50001];
    rep(i,0,m+1) {
        rep(j,0,n+1) {
            dp[i][j] = INF;
        }
    }
    rep(i,0,m+1) dp[i][0] = 0;

    rep(i,0,m) {
        rep(j,0,n+1) {
            if(c[i] > j) dp[i+1][j] = dp[i][j];
            else dp[i+1][j] = min(dp[i][j], dp[i+1][j - c[i]] + 1);
        }
    }

    //rep(i,0,m) cout << c[i] << endl;

    /*rep(i,0,m+1) {
        rep(j,0,n+1) {
            printf("%d ",dp[i][j]);
        }
        cout << endl;
    }*/


    cout << dp[m][n] << endl;
    return 0;
}

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

int m,d,d1,d10,ans;

int main(){
    cin>>m>>d;
    for(int i=1;i<=m;i++){
        for(int j=10;j<=d;j++){
            d1=j%10;
            d10=j/10;
            if(d1*d10==i && d1>=2 && d10>=2)ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

int n,m;
vector<vector<int>> G(8);
int seen[8];
int counter = 0;
int sum = 0;

void func(int i){

  // seen[i] = 1;
  //全てが探索済みならカウントを＋＋

  sum = 0;

  for(int i = 0; i < n; i++){
    sum += seen[i];
  }
  if(sum == n) counter ++;

  // printf("now = %d\r\n",i);
  

  for(auto&& next : G[i]){
  // for (int next = 0; next < n; next++){
    // printf("next = %d\r\n",next);
    // printf("seen next = %d\r\n",seen[next]);
    if(seen[next] == 0) {
      // printf("now = %d\r\n",i);
      // printf("next = %d\r\n",next);
      seen[next] = 1;
      func(next);
      seen[next] = 0;
    }
    //else {
      // //全てが探索済みならカウントを＋＋
      // for(int i = 0; i < n; i++){
      //   sum += seen[i];
      // }
      // if(sum == n) counter ++;
    // }
  }

  return;
}

int main(){
  
  cin >> n >> m;
  for(int i = 0; i < m; i++){
    int a,b;
    cin >> a >> b;
    G.at(a-1).push_back(b-1);
    G.at(b-1).push_back(a-1);
    // printf("G[a] = %d\r\n",G[a][i]);
    // printf("G[b] = %d\r\n",G[b][i]);
  }
  // printf("G[0]size = %d\r\n",G.at(1).size());
  // for(int j = 0; j < G.at(0).size(); j++){
  //   printf("G[0] = %d\r\n",G[0][j]);
  // }

  for (int i = 0; i < n; i++) seen[i] = 0;

  seen[0] = 1;
  func(0);
  cout << counter << endl;

  
  return 0;
}

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

int main(){
  int A,B;
  scanf("%d%d",&A,&B);
  if (A%3==0 || B%3==0 || (A+B)%3==0) {
    printf("Possible\n");
  }
  else {
    printf("Impossible\n");
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int number = Integer.parseInt(line);
        String[] in = br.readLine().split(" ");
        ArrayList<Integer> coordinate = new ArrayList<Integer>(); 
        int max = 0;
        int min = 1000;
        
        for(int i = 0; i < in.length; i++) {
            coordinate.add(Integer.parseInt(in[i]));
        }
        for(int j = 0; j < coordinate.size(); j++) {
            if(min > coordinate.get(j)) {
                min = coordinate.get(j);
            }
            if(max < coordinate.get(j)) {
                max = coordinate.get(j);
            }
        }
        System.out.println(max - min);
    }
}

Measured memory_bytes: 24916
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>;
using L = vector<long long>;
using M = map<int,long long>;
using A = vector<vector<long long>>;
using Q = priority_queue<long long>;
using U = unordered_map<int,long long>; //mapとの違いはkeyの順番を保持していない

#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
//存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避
//__gcd(a,b)はコンパイラがGCC時のみ

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    long long n,m,k;
    cin>>n>>m;
    A a;
    for(int i=0  ;i<m  ;i++){
        cin>>k;
        L l(k,0);
        for(int j=0  ;j<k  ;j++){
            cin>>l[j];
        }
        a.push_back(l);
    }
    L p(m,0);
    for(int i=0  ;i<m  ;i++){
        cin>>p[i];
    }
    long long ans = 0 ;
    
    for(int i=0  ;i<pow(2,n)  ;i++){
        L s(m,0);
        L sw(n,0);
        long long tmp;
        for(int j=0  ;j<n  ;j++){
            tmp=i>>j&1;
            sw[j]+=tmp;
        }

        for(int j=0  ;j<m  ;j++){
            for (auto r:a[j]){
                s[j]+=sw[r-1];
            }
        }
        for(int j=0  ;j<m  ;j++){
            s[j]=s[j]%2;
        }
        ans+=(s==p);
    }
    cout<<ans<<endl;
}

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

pub struct StdinReader<R: BufRead> {
    pub reader: R,
    pub buf: String,
}

impl<R: BufRead> StdinReader<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf: String::new(),
        }
    }
}

macro_rules! get {
    ($r:expr, $t:ty) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($r:expr, $($t:ty),*) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($r:expr, $t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($r, $t)
        ).collect::<Vec<_>>()
    };
    ($r:expr, $($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($r, $($t),*)
        ).collect::<Vec<_>>()
    };
    ($r:expr, $t:ty ;;) => {
        {
            let mut line = &mut $r.buf;
            line.clear();
            $r.reader.read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($r:expr, $t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($r, $t ;;)).collect::<Vec<_>>()
    };
}

fn main() {

    let stdin = std::io::stdin();
    let mut r = StdinReader::new(stdin.lock());
    let mut hs: Vec<u32> = vec![];

    for _i in 0..10 {
        let a = get!(r, u32);
        hs.push(a);
    }
    hs.sort_by(|a, b| b.cmp(a));
    for i in 0..3 {
        println!("{}", hs[i]);
    }
}



Measured memory_bytes: 1064
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


print(700 +input().count('o') * 100)


Measured memory_bytes: 3572
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())

    res = 0

    for i in range(1,N+1):
        end = N // i
        res += end * (end + 1) * i // 2

    print(res) 




main()


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod=1000000007;
//head

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

    int n, k;
    cin >> n >> k;
    vi a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vi dp(n,1 << 30);
    dp[0] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = 1; j <= k; j++) {
            if(i+j < n)
                dp[i+j] = min(dp[i] + abs(a[i+j]-a[i]), dp[i+j]);
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;

int main() {
  int n;
  cin>>n;
  vector<int64_t>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int64_t m=*max_element(a.begin(),a.end());
  double d=m/2;
  double s=99999999999;
  int64_t h=0;
  int K=1;
  for(int i=0;i<n;i++){
   if(a[i]==m){if(K--){continue;}}
   if(s>abs((d-double(a[i])))){s=abs((d-double(a[i])));h=a[i];}
  }
  cout<<m<<" "<<h<<endl;
  return 0;}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  string s; cin >> s;
  REP(i,SZ(s)-1){
    if(s[i] == s[i+1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <cassert>
#include <random>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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

void fact_init(int n);
ll exp(ll taban, ll us, ll md);
ll ebob(ll a, ll b);
ll ekok(ll a, ll b);
ll komb(ll a, ll b);

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
    fact.resize(n+5);
    inv_fact.resize(n+5);
    fact[0] = inv_fact[0] = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = (fact[i-1] * i) % mod;
        inv_fact[i] = exp(fact[i], mod-2, mod);
    }
}
ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
    if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll komb(ll a, ll b){
    if(a < b) return 0;
    return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}
const int N = 3e5 + 5;

int main(){
    ios::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	cout<<(exp(10, n, mod) - 2*exp(9, n, mod) + exp(8, n, mod) + 3ll*mod)%mod<<"\n";
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {
		public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			String s = sc.next();
			int ans = 0;
			
		for(int i = 0; i < s.length()/2 ; i++) {
			if(s.charAt(i) != s.charAt(s.length()-i-1)){
				ans += 1;
			}
		}
		System.out.println(ans);
			
}
}

Measured memory_bytes: 22608
// Best practice

#include<bits/stdc++.h>

#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define in(x) 		scanf("%d", &x)
#define echo(x)		printf("%d", x)
#define inf 		(int)(1e18)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;

#define debug(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<i<<" "; cout<< "]" << endl
#define debugp(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<"("<<i.x<<","<<i.y<<")"<<" "; cout<< "]" << endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << "[" << *it << ": " << a << "]\t";
    err(++it, args...);
}

// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };


// Code from Here -------------------------------------------------------------------------------


signed main() {
	tezz


	string s;
	cin >> s;
	string t;
	cin >> t;
	int c=0;
	for(int i=0; s[i]; i++){
		if(s[i]!=t[i])c++;
	}
	cout << c;

	return 0;
}  


Measured memory_bytes: 3792
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int h = Integer.parseInt(scanner.next());
        int a = Integer.parseInt(scanner.next());
        for (int i = 1; true; i++) {
            h = h - a;
            if (h <= 0){
                System.out.println(i);
                return;
            }
        }
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    if(n == 3){
        cout << 2 << endl << 1 << " " << 3 << endl << 2 << " " << 3 << endl;
        return 0;
    }
    int group_sz = (n + 1) / 2;
    vector<vector<int>> vertex(group_sz);
    if(n % 2 != 0)  vertex.back().push_back(n--);
    int limit = n / 2;
    for(int i = 0; i < limit; ++i){
        vertex[i].push_back(i + 1);
        vertex[i].push_back(n - i);
    }
    // for(int i = 0; i < group_sz; ++i){
    //     for(int j = 0; j < vertex[i].size(); ++j){
    //         cerr << vertex[i][j] << " ";
    //     }
    //     cerr << "\n";
    // }
    vector<P> ans;
    for(int i = 0; i < group_sz - 1; ++i){
        int sz = vertex[i].size();
        for(int j = 0; j < sz; ++j){
            for(int k = i + 1; k < group_sz; ++k){
                int sz2 = vertex[k].size();
                for(int l = 0; l < sz2; ++l){
                    ans.push_back(P(vertex[i][j], vertex[k][l]));
                }
            }
        }
    }
    int sz = ans.size();
    cout << sz << "\n";
    for(int i = 0; i < sz; ++i) cout << ans[i].first << " " << ans[i].second << "\n";
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror



#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//距離
double dis(double xa, double ya, double xb, double yb) {
	return pow(pow(xa - xb, 2.0) + pow(ya - yb, 2.0), 0.5);
}



//提出コード↓
ll n, L, sum ,ans = 100000;



int main() {
	cin >> n >> L;
	REP(i, 1, n + 1) sum += (L + i -1);
	REP(i, 1, n + 1) {
		ll tmp = abs(L + i - 1);
		if (tmp < abs(ans)) ans = (L + i - 1);
	}
	cout << sum - ans << endl;

	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = Integer.parseInt(sc.next());
		int[] odd = new int[100000];
		int[] even = new int[100000];
		for (int i = 0; i < N; i++) {
			if ((i & 1) == 1) {
				even[Integer.parseInt(sc.next()) - 1] += 1;
			} else {
				odd[Integer.parseInt(sc.next()) - 1] += 1;
			}
		}
		int oddMax = 0;
		int evenMax = 0;
		for (int i = 0; i < 100000; i++) {
			if (odd[oddMax] < odd[i]) {
				oddMax = i;
			}
			if (even[evenMax] < even[i]) {
				evenMax = i;
			}
		}
		if (oddMax != evenMax) {
			System.out.println(N - (odd[oddMax] + even[evenMax]));
			return;
		}
		int om = odd[oddMax];
		int em = even[evenMax];
		odd[oddMax] = 0;
		even[evenMax] = 0;
		for (int i = 0; i < 100000; i++) {
			if (odd[oddMax] < odd[i]) {
				oddMax = i;
			}
			if (even[evenMax] < even[i]) {
				evenMax = i;
			}
		}
		System.out.println(N - Math.max(om + even[evenMax], em + odd[oddMax]));
	}
}

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

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main(){
  long long int n,ans=1;
  vector<int> v(n);
  cin>>n;
  rep(i,n) v[i]=1;
  for(int i=1;i<=n;i++){
    int k=i;
    for(int j=2;j<=i;j++){
      while(k%j==0){
        v[j-1]++;
        k/=j;
      }
    }
  }
  for(int i=1;i<n;i++){
    ans*=v[i];
    ans%=1000000007;
  }
  cout<<ans<<endl;
}





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

const int N = 100010;

std::set <int> set[N];
std::queue <std::pair <int, int>> q;
int n;
int fa[N], sz[N];

int find(int u){
	return fa[u] == u ? u : fa[u] = find(fa[u]);
}

void unite(int u, int v){
	int _u = find(u), _v = find(v);
	if (_u == _v){
		return;
	}
	fa[_u] = fa[_v];
	sz[_v] += sz[_u];
	find(u);
}

int main(){
	for (int i = 0; i < N; ++ i){
		fa[i] = i;
		sz[i] = 1;
	}
	scanf("%d", &n);
	for (int i = 0, u, v; i < n - 1 << 1; ++ i){
		scanf("%d%d", &u, &v);
		if (set[u].count(v)){
			q.push({u, v});
		}
		else{
			set[u].insert(v);
			set[v].insert(u);
		}
	}
	while (!q.empty()){
		std::pair <int, int> p = q.front();
		q.pop();
		int u = find(p.first), v = find(p.second);
		if (sz[u] > sz[v]){
			std::swap(u, v);
		}
		unite(u, v);
		set[u].erase(v);
		set[v].erase(u);
		for (auto w : set[u]){
			set[w].erase(u);
			if (set[w].count(v)){
				q.push({w, v});
			}
			else{
				set[w].insert(v);
				set[v].insert(w);
			}
		}
		set[u].clear();
	}
	return printf(sz[find(1)] == n ? "YES\n" : "NO\n"), 0;
}

Measured memory_bytes: 24576
#include <stdio.h>

int main(){
  int a[4], b[4];
  int hit ,blow, i,j;
  while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF){
    hit = 0;
    blow = 0;
    scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(a[i] == b[j]){
	  if(i == j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }
    printf("%d %d\n", hit, blow);
  }
  return 0;
}

Measured memory_bytes: 596
#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    string s = (a == b && b == c && a == c) ? "Yes" : "No";
    cout << s << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    vector<ll>x(n);
    vector<ll>y(n);
    REP(i,n){
        cin >> x[i];
        y[i]=x[i];
    }
    sort(ALL(y));
    
    REP(i,n){
        if(y[n/2]<=x[i]){
            cout << y[(n/2)-1] << endl;
        }
        else{
            cout << y[(n/2)] << endl;
        }
    }
    return 0;
}

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

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x = x2 - x1, y = y2 - y1;
    cout << x2 - y << " " << y2 + x << " " << x1 - y  << " " << y1 + x << endl;
}

Measured memory_bytes: 256
using System;

namespace ITP1_7_A
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] strs = Console.ReadLine().Split(' ');
                int m = int.Parse(strs[0]);
                int f = int.Parse(strs[1]);
                int r = int.Parse(strs[2]);
                if (m == -1 && f == -1 && r == -1) break;

                if (m == -1 || f == -1) Console.WriteLine("F");
                else if (m + f >= 80) Console.WriteLine("A");
                else if (m + f >= 65) Console.WriteLine("B");
                else if (m + f < 30) Console.WriteLine("F");
                else if (m + f >= 50 || r >= 50) Console.WriteLine("C");
                else if (m + f >= 30 || r >= 30) Console.WriteLine("D");
                else Console.WriteLine("F");
            }
        }
    }
}

Measured memory_bytes: 8740
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

const int MAX_N = 1e5;
int N;
int A[MAX_N];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	map<int, int> m;
	cin >> N;
	rep(i, 0, N) {
		cin >> A[i];
		m[A[i]]++;
	}

	ll res = 1;
	rep(i, 0, 2) {
		bool flag = false;
		for(auto itr = m.rbegin(); itr != m.rend(); itr++) {
			if(itr->second >= 2) {
				res *= itr->first;
				itr->second -= 2;
				flag = true;
				break;
			}
		}
		if(!flag) {
			cout << 0 << endl;
			return 0;
		}
	}
	cout << res << endl;

}


Measured memory_bytes: 5376
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
const long long int MaxN=10000005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	map <lli,lli> cub;
int main(){
	cin.tie(0),ios_base::sync_with_stdio(0);
	lli N,i,p,q,sum=0,res=0;
	cin>>N;
	cub[0]=1;
	for(i=0;i<N;i++){
		cin>>p;
		sum+=p;
		res+=cub[sum];
		cub[sum]+=1;
	}
	cout<<res;
}

Measured memory_bytes: 12800
#include <iostream>
#include <cstdio>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
int main(){
    int X,A,B;
    cin >> X >> A >> B;
    if(B<=A){cout << "delicious"<< endl;}
    else if(B<=A+X){cout << "safe" << endl;}
    else{cout << "dangerous" << endl;}
return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <cstdio>
using namespace std;
char a[105];
int main()
{
    scanf("%s",a);
    int pre=-1,eds=-1;
    for(int i=0;i<strlen(a);i++)
    {
        if(a[i]=='C'&&pre==-1)
        {
            pre=i;
        }
        if(a[i]=='F') eds=i;
    }
    if(pre<eds&&pre!=-1) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main(){
long b,ka,t,w,ki,y,m,d,j,y1,y2,a1,a2,a3,a4,a5,a6,a7;
string::size_type j1,j2,j3,j4;
string s;
stringstream ss;
while(cin>>s){
if(s=="#")break;
j1=s.find('.');
j2=s.find('.',j1+1);
j3=s.find('.',j2+1);
ss.str("");ss.clear();ss<<s.substr(0,j1);ss>>y;
ss.str("");ss.clear();ss<<s.substr(j1+1,j2-j1);ss>>m;
ss.str("");ss.clear();ss<<s.substr(j2+1,j3-j2);ss>>d;
if(j3==string::npos){
if(m<3){m+=12;y--;}
y1=y/100;y2=y%100;
if(y1>50000)j=(long(36524.25*(y1-50000)))%1872000+long(365.25*y2)+long(30.6*(m+1))+d+277214;
else j=(long(36524.25*y1))%1872000+long(365.25*y2)+long(30.6*(m+1))+d+1136714;
ki=j%20;j-=ki;j/=20;
w=j%18;j-=w;j/=18;
t=j%20;j-=t;j/=20;
ka=j%20;j-=ka;j/=20;
b=j%13;
cout<<b<<"."<<ka<<"."<<t<<"."<<w<<"."<<ki<<endl;
}else{
j4=s.find('.',j3+1);
b=y;ka=m;t=d;
ss.str("");ss.clear();ss<<s.substr(j3+1,j4-j3);ss>>w;
ss.str("");ss.clear();ss<<s.substr(j4+1);ss>>ki;
j=(((b*20+ka)*20+t)*18+w)*20+ki+735163;
a1=j/146097;j%=146097;
if(j==146096){a2=3;j=36524;}else{a2=j/36524;j%=36524;}
a3=j/1461;j%=1461;
if(j==1460){a4=3;j=365;}else{a4=j/365;j%=365;}
a5=j/153;j%=153;
a6=j/61;j%=61;
a7=j/31;j%=31;
y=a1*400+a2*100+a3*4+a4;
if(m=a5*5+a6*2+a7+3,m>12){m-=12;y++;}
cout<<y<<"."<<m<<"."<<j+1<<endl;
}
}
return 0;
}

Measured memory_bytes: 1240
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,m = map(int,readline().split())
lst1 = list(map(int,readline().split()))
lst1.sort(reverse=True)

ans = 0
need = sum(lst1)/(4*m) #以上

for i in lst1:
    if i >= need:
        ans += 1


if ans >= m:
    print("Yes")
else:
    print("No")

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


int main() {
  int N; cin >> N;
  vector<int> A(N);
  int b;
  long long sum = 0;

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

  sort(A.begin(), A.end());
  b = A[N/2];

  for(int i=0; i<N; i++){
    sum += abs(A[i]-b);
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1024
// ABC065
// A - Expired?
#include<bits/stdc++.h>

using namespace std;

int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(b-a<=0)  cout << "delicious" << endl;
    else if(b-a <=x )cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;
}


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

#include <algorithm>
#include <string>

using namespace std;
int main(int argc, char *argv[]) {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	
	s[k-1] = tolower(s[k-1]);
	
	cout << s << endl;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,k = map(int, input().split())
    s = input().rstrip()
    cnt = 0
    for i in range(n-1):
        if s[i]!=s[i+1]:
            cnt += 1
    a = cnt // 2
    b = cnt % 2
    if k<=a:
        print(n-2*(a-k)-1-b)
    else:
        print(n-1)



if __name__ == '__main__':
    main()

Measured memory_bytes: 3564
import 'dart:io';
main() {
  int jyuni = 8;
  var N = int.parse((stdin.readLineSync()));
  if (N <= 599) {jyuni = 8;} else 
  if (N <= 799) {jyuni = 7;} else 
  if (N <= 999) {jyuni = 6;} else 
  if (N <= 1199) {jyuni = 5;} else 
  if (N <= 1399) {jyuni = 4;} else 
  if (N <= 1599) {jyuni = 3;} else 
  if (N <= 1799) {jyuni = 2;} else
  {jyuni = 1;} ;

  print (jyuni);
}


Measured memory_bytes: 13116
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


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

    if(n == 0){
	P(0);
	ret 0;
    }
    string s = "";
    int cnt = 1;
    rep(i,0,64){
	bool m = (n>>i)&1;
	s = (char)('0'+m) + s;
	n -= cnt * m;
	
	cnt *= -2;
    }

    P(s.substr(s.find('1')));
    
    return  0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let a: f64 = sc.cin();
    let b: f64 = sc.cin();
    let c: f64 = sc.cin();

    let mut xs: Vec<u64> = (0..n).map(|_| sc.cin()).collect();
    xs.sort();
    xs.reverse();

    let mut ans: f64 = c / a;
    let mut ac: u64 = 0;
    for i in 0..n {
        ac += xs[i];
        let r = (c + ac as f64) / (a + b * (i + 1) as f64);
        if r > ans { ans = r; }
    }

    put!(ans as u64);

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}



Measured memory_bytes: 5052
while True:
    table = input().split()

    a = int(table[0])
    op = table[1]
    b = int(table[2])

    if op == '?':
        break

    if op == '+':
        print('%d' % (a + b))
    elif op == '-':
        print('%d' % (a - b))
    elif op == '*':
        print('%d' % (a * b))
    elif op == '/':
        print('%d' % (a / b))
    else:
        print('invalid input')


Measured memory_bytes: 5592
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

class suffix_array {
  int n;
  std::string s;
  std::vector<int> suf;
  std::vector<int> rank;
  std::vector<int> lcp;

public:
  suffix_array() = default;
  suffix_array(const std::string& _s)
    : n(_s.length()), s(_s), suf(n), rank(n), lcp(n) {
    std::iota(suf.begin(), suf.end(), 0);
    for (int i = 0; i < n; ++i) rank[i] = s[i];
    int itr = 1;
    auto cmp = [&](int a, int b) {
      if (rank[a] != rank[b]) return rank[a] < rank[b];
      int l = a + itr < n ? rank[a + itr] : -1;
      int r = b + itr < n ? rank[b + itr] : -1;
      return l < r;
    };
    std::vector<int> buff(n);
    for (; itr < n; itr <<= 1) {
      std::sort(suf.begin(), suf.end(), cmp);
      buff[suf[0]] = 0;
      for (int i = 1; i < n; ++i)
        buff[suf[i]] = buff[suf[i - 1]] + cmp(suf[i - 1], suf[i]);

      buff.swap(rank);
    }
    for (int i = 0; i < n; ++i) rank[suf[i]] = i;

    int now = 0;
    for (int i = 0; i < n; ++i) {
      int x = rank[i];
      if (x == n - 1) continue;
      int y = x + 1;
      int j = suf[y];
      if (0 < now) now--;
      for (; now + std::max(i, j) < n; now++)
        if (s[i + now] != s[j + now]) break;

      lcp[x] = now;
    }
  }

  bool find(string& t) {
    int ng = -1, ok = (int)s.length() - 1;
    while (ok - ng > 1) {
      int mid = (ok + ng) / 2;
      if (s.substr(suf[mid], t.length()) < t)
        ng = mid;
      else
        ok = mid;
    }
    return s.substr(suf[ok], t.length()) == t;
  }

  std::vector<int> get_suf() const { return suf; }
  std::vector<int> get_lcp() const { return lcp; }
};

int main() {
  int n;
  std::string s;
  std::cin >> n >> s;
  suffix_array sa = suffix_array(s);
  vector<int> suf = sa.get_suf();
  vector<int> lcp = sa.get_lcp();
  int l = 0, r = n + 1;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    bool found = false;
    // すべての接尾辞配列について、iとのlcpがmid以下になるまで
    rep(i, 0, n) {
      int l1 = suf[i];
      int l2 = suf[i];
      while (i + 1 < n && mid <= lcp[i]) {
        i++;
        l1 = min(l1, suf[i]);
        l2 = max(l2, suf[i]);
      }
      // len <= l2 - l1, 共通部分なし
      if (mid <= l2 - l1) {
        found = true;
        break;
      }
    }
    (found ? l : r) = mid;
  }
  cout << l << endl;
  return 0;
}


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

int main()
{
  ll n, k;
  cin >> n >> k;
  vector<ll> x(n);
  for (ll i = 0; i < n; i++)
  {
    cin >> x[i];
  }

  ll ans = 1e9 + 7;
  for (ll i = 0; i < n - k + 1; i++)
  {
    ll buf;
    buf = min(abs(0 + x[i]) + abs(x[i] - x[i + k - 1]), abs(0 + x[i + k - 1]) + abs(x[i + k - 1] - x[i]));
    ans = min(ans, buf);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int my_abs(int num){
   if (num > 0)
      return num;
   else
      return -num;
}

int main(){
    int H,W;
    cin >> H >> W;
    for(int i = 0;i<W+2;i++){
        cout << "#";
    }
    cout << endl;
    string S;
    for(int j = 0;j<H;j++){
        cin >> S;
        cout << "#" << S << "#" << endl;
    }
    for(int k = 0;k<W+2;k++){
        cout << "#";
    }
    cout << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#define N 1000000
int main(void){
    int a[N],q,query,x,p,back;
    scanf("%d",&q);
    back=0;
    for(int i=0;i<q;i++){
        scanf("%d",&query);
        if(query==2) {
            a[back]='NULL';
            back--;
        }
        else if(query==1){
            scanf("%d",&p);
            if(a[p]!='NULL') printf("%d\n",a[p]);
        }
        else if(query==0){
            scanf("%d",&x);
            if(i!=0) back++;
            a[back]=x;
        }
    }
    return 0;
}



Measured memory_bytes: 2480
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

int d[3];
int N;
int c[3] = {};
vector<vector<int>> tree;
vector<int> hoge, ans;

void solve(int now, int per, int depth){
	d[depth%2 + 1]++;
	hoge[now] = depth%2 + 1;
	
	for(int next : tree[now]){
		if(next == per) continue;
		
		solve(next, now, depth+1);
	}
}

signed main(){
	cout<<fixed<<setprecision(10);
	
	cin>>N;
	
	c[0] = N/3;
	c[1] = (N+2)/3;
	c[2] = (N+1)/3;
	
	tree.resize(N);
	hoge.resize(N);
	ans.resize(N);
	
	for(int i = 0; i < N-1; i++){
		int a, b;
		
		cin>>a>>b;
		
		a--, b--;
		
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	
	solve(0,-1,0);
	
	if(d[2] >= d[1]) {
		if(d[2] >= c[1] + c[2]) {
			for(int i = 0; i < N; i++){
				if(hoge[i] == 2) {
					if(c[2] == 0 && c[1] == 0) {
						ans[i] = c[0] * 3;
						c[0]--;
					} else if(c[2]){
						ans[i] = c[2] * 3 - 1;
						c[2]--;
					} else if(c[1]) {
						ans[i] = c[1] * 3 - 2;
						c[1]--;
					}
				} else if(hoge[i] == 1){
					{
						ans[i] = c[0] * 3;
						c[0]--;
					}
				}
			}
		} else {
			for(int i = 0; i < N; i++){
				if(hoge[i] == 2) {
					if(c[1] == 0) {
						ans[i] = c[0] * 3;
						c[0]--;
					} else {
						ans[i] = c[1] * 3 - 2;
						c[1]--;
					}
				} else if(hoge[i] == 1){
					if(c[2] == 0) {
						ans[i] = c[0] * 3;
						c[0]--;
					} else {
						ans[i] = c[2] * 3 - 1;
						c[2]--;
					}
				}
			}
		}
	} else {
		swap(d[2], d[1]);
		if(d[2] >= c[1] + c[2]) {
			for(int i = 0; i < N; i++){
				if(hoge[i] == 1) {
					if(c[2] == 0 && c[1] == 0) {
						ans[i] = c[0] * 3;
						c[0]--;
					} else if(c[2]){
						ans[i] = c[2] * 3 - 1;
						c[2]--;
					} else if(c[1]) {
						ans[i] = c[1] * 3 - 2;
						c[1]--;
					}
				} else if(hoge[i] == 2){
					{
						ans[i] = c[0] * 3;
						c[0]--;
					}
				}
			}
		} else {
			for(int i = 0; i < N; i++){
				if(hoge[i] == 1) {
					if(c[1] == 0) {
						ans[i] = c[0] * 3;
						c[0]--;
					} else {
						ans[i] = c[1] * 3 - 2;
						c[1]--;
					}
				} else if(hoge[i] == 2){
					if(c[2] == 0) {
						ans[i] = c[0] * 3;
						c[0]--;
					} else {
						ans[i] = c[2] * 3 - 1;
						c[2]--;
					}
				}
			}
		}
	}
	
	for(int i = 0; i < N; i++){
		if(i) cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 19072
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())

if n == 1:
    print(0)
    exit()

ans = 0

fact = factorization(n)

for p, e in fact:
    f = e
    j = 1
    while f >= 0:
        f -= j
        j += 1
    ans += j - 2
    
print(ans)

Measured memory_bytes: 9492