akhauriyash/Code-Regression huggingface dataset:
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;

int main(){
    ll n;
    std::cin >> n;
    ll result = 0;
    for (int i = 1; i <= n; i++) {
        if( to_string(i).length()%2==1){
            result++;
        }
    }
    std::cout << result << std::endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

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



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	if (n % 2 == 0) {
		ll sum = 0;
		for (int i = 0; i < n / 2; i++) {
			sum -= a[i];
		}
		for (int i = n / 2; i < n; i++) {
			sum += a[i];
		}
		ll ans = 2 * sum;
		ans += a[n / 2 - 1];
		ans -=a[n / 2];
		cout << ans << endl;
		return 0;
	}
	ll sum = 0;
	for (int i = 0; i < n / 2; i++) {
		sum -= a[i];
	}
	for (int i = n / 2 + 1; i < n; i++) {
		sum += a[i];
	}
	ll ans = 2 * sum;
	ans += max(a[n / 2] - a[n / 2 + 1], a[n / 2 - 1] - a[n / 2]);
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 3760
import java.io.*;
import java.util.*;

public class Main{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String fileName) throws FileNotFoundException{br = new BufferedReader(new FileReader(fileName));}
        String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt(){return Integer.parseInt(next());}
        long nextLong(){return Long.parseLong(next());}
        double nextDouble(){return Double.parseDouble(next());}
        char[][] readCharArray(int n,int m) {
        	String str;
        	char[][] arr = new char[n][m];
        	for(int i=0;i<n;i++) {
        		str=nextLine();
        		for(int j=0;j<n;j++) {
        			arr[i][j]=str.charAt(j);
        		}
        	}
        	return arr;
        }
        char[][] readCharArray(int n){
        	return readCharArray(n,n);
        }
        int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}
        long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}
        String nextLine(){String str = "";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;}
    }
    static final Random random=new Random();
    static void ruffleSort(int[] a) {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
    	FastReader st = new FastReader();
    	int n = st.nextInt();
    	if(n<3) System.out.println("0");
    	else {
    		long[] dp = new long[n+1];
    		int mod = 1000000007;
    		if(n>=3) dp[3]=1;
    		if(n>=4) dp[4]=1;
    		if(n>=5) dp[5]=1;
    		if(n>=6) dp[6]=2;
    		for(int i=7;i<=n;i++) {
    			dp[i] = (dp[i-2]+dp[i-3]+dp[i-4])%mod;
    		}
    		System.out.println(dp[n]);
    	}
    	
    }
}

Measured memory_bytes: 25420
A, B, C, D, E, F = map(int, input().split())
a, b = [], []

for i in range(31):
    for j in range(31):
        v = 100*A*i+100*B*j
        if v < F:
            a.append(v)
        else:
            break

for i in range(3000//C+2):
    for j in range(3000//D+2):
        v = C*i+D*j
        if v < F:
            b.append(v)
        else:
            break

a.sort()
b.sort()

c = -1
ans = [0, 0]
for ai in a:
    for bi in b:
        t = ai+bi
        if t > 0 and t <= F and (E*ai//100) >= bi:
            tc = 100*bi/(ai+bi)
            if c < tc:
                c = tc
                ans = [t, bi]

print(*ans)


Measured memory_bytes: 90508
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long
#define ld long double

struct XX{
    int t;
    int d;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.t) == (riRight.t)){
            return riLeft.d < riRight.d;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.t) < (riRight.t);
    }
};


//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}

//int n;
////int dat[2*10000000];
////int dat2[2*10000000];
//int dat[10];
//int dat2[10];
//
//void init(int n_){
//    n=1;
//    while(n<n_)n*=2;
//    for(int i=0;i<2*n-1;i++){
//        dat[i]=0;
//        dat2[i]=0;
//    }
//}
//
//void initset(int k,int a){
//    k+=n-1;
//    dat[k]=a;
//    while(k>0){
//        k=(k-1)/2;
//        dat[k]=dat[k*2+1]+dat[k*2+2];
//    }
//}
//
////[a,b)の間を[l,r]区間で比較しアップデート
////引数のindexに注意
////nは固定。initで計算すみ
////update2(L[i],R[i]+1,0,0,n,D[i]);
//void update2(int a,int b,int k,int l,int r,int v){//v更新値、区間は0-index
//    if(r<=a || b<=l)return;
//    if(a<=l && r<=b){
//        dat[k]+=dat2[k];
//        if(r-l>1){
//            dat2[k*2+1]+=dat2[k]/2;
//            dat2[k*2+1]+=dat2[k]/2;
//        }
//        dat2[k]=v*(r-l);
//        return;
//    }else{
//        update2(a,b,k*2+1,l,(l+r)/2,v);
//        update2(a,b,k*2+2,(l+r)/2,r,v);
//        return;
//    }
//}
//
//int query(int a,int b,int k,int l,int r){
//    if(r<=a || b<=l)return 0;
//    if(a<=l && r<=b){
//        dat[k]+=dat2[k];
//        if(r-l>1){
//            dat2[k*2+1]+=dat2[k]/2;
//            dat2[k*2+1]+=dat2[k]/2;
//        }
//        dat2[k]=0;
//        return dat[k];
//    }
//    else{
//        int vl=query(a,b,k*2+1,l,(l+r)/2);
//        int vr=query(a,b,k*2+2,(l+r)/2,r);
//        return vl+vr;
//    }
//}



int main(int argc, const char * argv[])
{
    //scanf("%s",S);
    //scanf("%d",&N);
    //scanf("%lld %lld",&target1,&target2);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //ifstream ifs("3.txt");//テスト用
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);

    int A,B,T;
    cin >>A>>B>>T;
    int ans=0;
    int sum=0;
    for(int i=1;i<100;i++){
        if(A+sum<=T){
            sum+=A;
            ans+=B;
        }else{
            break;
        }
    }
    cout << ans << endl;
    //ここまで
    //cout << "ans" << endl;
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    
    return 0;
}


Measured memory_bytes: 256
package main

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

func popcount(n int) int {

	var cnt int
	for ; n > 0; n >>= 1 {
		if n&1 == 1 {
			cnt++
		}
	}
	return cnt
}

func f(n int) int {
	// v, ok := a[n]
	// if ok {
	// 	return v
	// }
	return n % popcount(n)
	// fmt.Println(a[n])
	// return a[n]
}

func solve() {
	sc := newScanner(os.Stdin)
	n := sc.scanInt()
	x := sc.scanString()
	xcnt := strings.Count(x, "1")
	xmin, xplus := 0, 0
	// a := map[int]int{}
	xminarr := make([]int, n)
	xplusarr := make([]int, n)
	// farr := make([]int, 1e9)
	xminarr[0] = 1
	xplusarr[0] = 1
	for i := 1; i < n; i++ {
		if xcnt-1 > 0 {
			xminarr[i] = xminarr[i-1] * 2 % (xcnt - 1)
		}
		xplusarr[i] = xplusarr[i-1] * 2 % (xcnt + 1)
	}
	for i := 0; i < n; i++ {
		if x[i] == '0' {
			continue
		}
		if xcnt-1 > 0 {
			xmin += xminarr[n-i-1] % (xcnt - 1)
			xmin %= (xcnt - 1)
		}
		xplus += xplusarr[n-i-1] % (xcnt + 1)
		xplus %= (xcnt + 1)
	}
	for i := 0; i < n; i++ {
		cnt := 1
		var y int
		if x[i] == '1' {
			if xcnt-1 <= 0 {
				fmt.Println(0)
				continue
			}
			y = (xmin - xminarr[n-i-1] + xcnt - 1) % (xcnt - 1)
		} else {
			y = (xplus + xplusarr[n-i-1]) % (xcnt + 1)
		}
		for y > 0 {
			// fmt.Println(y, "ye")
			y = f(y)
			cnt++
		}
		fmt.Println(cnt)
	}
	return
}

var sc = bufio.NewScanner(os.Stdin)

type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) scanString() string {
	s.sc.Scan()
	return s.sc.Text()
}
func (s *scanner) scanInt() int {
	a, err := strconv.Atoi(s.scanString())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func (s *scanner) scanFloat64() float64 {
	f, err := strconv.ParseFloat(s.scanString(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	var i, j int
	for {
		for i = n - 2; i >= 0; i-- {
			if nums[i] < nums[i+1] {
				break
			}
		}
		if i < 0 {
			return
		}
		for j = n - 1; ; j-- {
			if nums[j] > nums[i] {
				break
			}
		}
		nums[i], nums[j] = nums[j], nums[i]
		for k, l := i+1, n-1; k < l; {
			nums[k], nums[l] = nums[l], nums[k]
			k++
			l--
		}
		*ret = append(*ret, makeCopy(nums))
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}

func pow(n, m int) int {
	ret := 1
	for i := 0; i < m; i++ {
		ret *= n
	}
	return ret
}

func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func eratosthenes(n int) []int {
	search := make([]bool, n+1)
	ans := []int{}
	for i := 2; i < n+1; i++ {
		search[i] = true
	}
	for i := 2; i*i < n+1; i++ {
		for j := 2; i*j < n+1; j++ {
			search[i*j] = false
		}
	}
	for i := 2; i < n; i++ {
		if search[i] {
			ans = append(ans, i)
		}
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


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

int n;
ll a[200005];
ll cnt;

bool CMP(ll a, ll b){
	return a > b;
}

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + 1 + n, CMP);
	for(int i = 1; i <= n / 2; i++) cnt += a[i];
	cnt *= 2;
	if(n % 2 == 1) cnt += a[n / 2 + 1];
	cout << cnt - a[1] << endl;
	return 0;
}

Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
const int maxn = 100005;
typedef pair<ll, ll>par;
const ll mod = 1e9+7;

double pi = acos(-1);
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in", "r",stdin);
    #endif // acm

    int a, b, h, m;
    cin >> a >> b >> h >> m;

    h *= 5;

    h *= 6;

    double hh = h + m/2.0;
    m *= 6;
    double mm = m;
    double d =  ( max(hh, mm) - min(hh, mm) ) ;


    if( d == 180 ){
        cout << fixed << setprecision(20) << a+b << "\n";
        return 0;
    }else{
        double alpha = (d*pi)/180.;
        double c = sqrt( a*a + b*b - 2*a*b*cos(alpha) );
        cout << fixed << setprecision(20) << c << "\n";
    }


    return 0;
}


Measured memory_bytes: 4308
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<math.h>
using namespace std;
double map[11][11];
int main()
{
	int n,d;
	while(scanf("%d %d",&n,&d)!=EOF)
	{
	    	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
		{
			scanf("%lf",&map[i][j]);
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			double sum=0;
			if(i==j)
			continue;
			for(int k=0;k<d;k++)
			{
				sum+=pow(map[i][k]-map[j][k],2.0);
			}
			double tmp=sqrt(sum);
			if(tmp-floor(tmp)==0.000)
			ans++;
		}
	}
	printf("%d\n",ans);	
	}
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

int sz[100001], parent[100001], ans[100001], in[100001];
vector<int> g[100001];

int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void make_set(int v) {
    parent[v] = v;
    sz[v] = 1;
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (sz[a] < sz[b])
            swap(a, b);
        parent[b] = a;
        sz[a] += sz[b];
    }
}

void solve() {
        int n, m, k; cin >> n>> m>> k;
        lp(i, n+ 1) make_set(i);
        lp(i, m) {
                int a, b; cin >> a>> b;
                in[a]++;
                in[b]++;
                union_sets(a, b);
        }
        lp(i, k) {
                int a, b; cin>> a>> b;
                int x= find_set(a), y= find_set(b);
                if (x== y) {
                        ans[a]-= 1;
                        ans[b]-= 1;
                }
        }
        for (int i= 1; i<= n; i++) {
                int x= find_set(i);
                cout << sz[x]- in[i]+ ans[i]- 1<< " ";
        }
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


Measured memory_bytes: 6272
#include<bits/stdc++.h>
#define intt unsigned long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i = 0;i<n;i++)
        cin>>a[i];

    vector<int>dp(n,INT_MAX);
    dp[0] = 0;
    for(int i = 0;i<n;i++)
    {
        for(int j = i+1;j<=i+k && j<n;j++)
            dp[j] = min(dp[j],dp[i]+abs(a[j]-a[i]));
    }
    cout<<dp.back()<<"\n";
}



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

signed main(){
    int n; cin >> n;
    int x; string com;
    list<int> lst;
    rep(i,n){
        cin >> com;
        if (com == "insert"){
            cin >> x;
            lst.push_front(x);
        }
        if (com == "delete"){
            cin >> x;
            for(auto itr = lst.begin(); itr != lst.end(); ++itr){
                if (*itr == x) {
                    lst.erase(itr);
                    break;
                }
            }
        }
        if (com == "deleteFirst") lst.pop_front();
        if (com == "deleteLast") lst.pop_back();
    }
    for(auto itr = lst.begin(); itr != lst.end(); ++itr){
        if (itr == lst.begin()) cout << *itr;
        else cout << " " << *itr;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 34404
# DEFINE
LENGTH_1 = 10
LENGTH_2 = 3
LENGTH_3 = 4

list_3d = [[[0 for i in range(LENGTH_1)] for j in range(LENGTH_2)] for k in range(LENGTH_3)]


# INPUT
n = int(input())

for _ in range(n):

    b, f, r, v = map(int, input().split())

    list_3d[b - 1][f - 1][r - 1] += v


# OUTPUT
for k in range(LENGTH_3):
    for j in range(LENGTH_2):
        for i in range(LENGTH_1):
            print(f" {list_3d[k][j][i]}", end="")
        print()

    if k != LENGTH_3 - 1:
        print("#" * 20)



Measured memory_bytes: 5640
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

int f(ll b, ll n){
    if(n < b) return n;
    else return f(b, n / b) + (n % b);
}

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

    ll n, s; cin>>n>>s;

    if(n == s){
        cout << n + 1 << endl;
        return 0;
    }

    for(ll b=2; b*b<=n; b++){
        if(f(b, n) == s){
            cout << b << endl;
            return 0;
        }
    }

    // n = α * b + β
    // s = α + β
    ll ans = INF;
    for(ll alpha=1; alpha*alpha<=n; alpha++){
        if((n - s) % alpha == 0){
            ll b = (n - s) / alpha + 1;
            ll beta = n - alpha * b;
            if(b <= beta || b <= alpha) continue;
            if(b < 2) continue;
            if(beta < 0) continue; 

            chmin(ans, b);
        }
    }

    cout << (ans == INF ? -1 : ans) << endl;
}

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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 3e5 + 123;
int n, a[N], cnt[N];
ll p[N];

int get(int x) {
	int pos = lower_bound(cnt + 1, cnt + n + 1, x) - cnt;
	return (n - pos + 1) + (p[pos - 1] / x);
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	sort(cnt + 1, cnt + n + 1);
	for (int i = 1; i <= n; i++) {
		p[i] = p[i - 1] + cnt[i];
	}
	for (int k = 1; k <= n; k++) {
		int l = 0, r = n / k + 1;
		while (l < r - 1) {
			int mid = l + r >> 1;
			if (get(mid) >= k) {
				l = mid;
			}	else {
				r = mid;
			}
		}
		cout << l << '\n';
	}
}


Measured memory_bytes: 5632
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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



int main(void) {
	int n;
	int total = 0;
	
	cin >> n;
	vector<int> s(n);
	FOR(i, 0, n - 1) {
		cin >> s[i];
		total += s[i];
	}

	sort(s.begin(), s.end());

	if (total % 10 == 0) {
		FOR(i, 0, n - 1) {
			if (s[i] % 10 != 0) {
				total -= s[i];
				break;
			}
			if (i == n - 1) {
				total = 0;
			}
		}
	}
	cout << total << endl;


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int dp[(1 << 20)];

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> doll(N);
    rep(i, N) { cin >> doll[i]; }
    vector<vector<int>> sum(M, vector<int>(N + 1));
    for(int k = 0; k < M; k++) {
        for(int i = 0; i < N; i++) {
            if(doll[i] == k + 1)
                sum[k][i + 1] = sum[k][i] + 1;
            else
                sum[k][i + 1] = sum[k][i];
        }
    }

    for(int bit = 0; bit < (1 << M); bit++)
        dp[bit] = INF;
    dp[0] = 0;
    for(int bit = 0; bit < (1 << M); bit++) {
        int pos = 0;
        rep(i, M) if(bit & (1 << i)) pos += sum[i][N];
        for(int i = 0; i < M; i++) {
            if(bit & (1 << i))
                continue;
            dp[bit | (1 << i)] =
                min(dp[bit | (1 << i)],
                    dp[bit] +
                        (sum[i][N] - (sum[i][pos + sum[i][N]] - sum[i][pos])));
        }
    }
    cout << dp[(1 << M) - 1] << endl;
    return 0;
}


Measured memory_bytes: 15120
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
typedef long long int ll;

using namespace std;


int gcd(int a,int b){
	if(a%b==0)return b;
	return gcd(b,a%b);
}

int main(){
	while(1){
		ll a,b;
		if( !(cin>>a>>b) )break;
		ll g=gcd(a,b);
		cout<<g<<" "<<a*b/g<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
import java.util.*;

/**
 * Main
 */
public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    for (int i = 0; i < m; i++) {
      n -= sc.nextInt();
    }
    sc.close();
    if (n < 0) {
      n = -1;
    }
    System.out.println(n);
  }
}

Measured memory_bytes: 39068
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N;
    cin >> N;
    bool ret = false;
    for (auto && i: irange(0LL, 1000LL)){
        for (auto && j: irange(0LL, 1000LL)){
            if (4 * i + 7 * j == N) ret = true;
        }
    }
    if (ret) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
parr = [int(input()) for _ in range(5)]
arr = []

for x in parr:    
    if x%10 == 0:
        arr.append([0,x,x])
    else:
        arr.append([x%10, (x//10 + 1)*10,x])

arr.sort()

found = False
ans = 0
for cur in arr:
    r,v,o = cur
    if r == 0:
        ans += v
    else:
        if found:
            ans += v
        else:
            ans+= o
            found = True

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 1e5 + 10;
// make sure N size is correctttt!!!!!!!!!

int dp[105][N], WT, w[N], v[N], n;

int solve(int idx, int curr_wt){
   if(idx >= n){
      return 0;
   }
   int &ans = dp[idx][curr_wt];
   if(ans != -1)
      return ans;
   ans = -inf;
   ans = solve(idx+1, curr_wt);
   if(curr_wt + w[idx] <= WT){
      smax(ans, solve(idx+1, curr_wt+w[idx]) + v[idx]);
   }
   return ans;
}

int32_t main(){_

   cin>>n>>WT;

   for (int i = 0; i < n; ++i)
   {
      cin>>w[i]>>v[i];
   }

   memset(dp, -1, sizeof dp);
   cout<<solve(0,0);

   //make sure N size is correct!!!!!!!!!
   return 0;
}

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

using namespace std;
long long h[200005];
long long n, k, cnt = 0;
int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h, h + n);
	if (k > n) k = n;
	for (int i = 0; i < n - k; i++) {
		cnt += h[i];
	}
	cout << cnt;
	return 0;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}



signed main(){
    int N;
    while(cin>>N,N){
        int cnt[30]={};
        string name[30];
        int m[30],d[30][30];
        rep(i,N){
            cin>>name[i]>>m[i];
            rep(j,m[i]){
                cin>>d[i][j];
                cnt[d[i][j]]++;
            }
        }

        int sum[30]={};
        rep(i,N){
            rep(j,m[i]){
                sum[i]+=N-cnt[d[i][j]]+1;
            }
        }
        int ma=0;
        rep(i,N){
            if(sum[ma]>sum[i]||(sum[ma]==sum[i]&&name[ma]>name[i])){
                ma=i;
            }
        }
        cout<<sum[ma]<<" "<<name[ma]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double PI = acos(-1.0);
const double INF = DBL_MAX / 10;

int n, m;
vector<double> angle;
vector<vector<vector<double> > > memo;

double solve(int x, int y, int rest)
{
    if(memo[x][y][rest] > -0.5)
        return memo[x][y][rest];

    if(rest == 0){
        double d = angle[y] - angle[x];
        if(d < 0.0)
            d += 2 * PI;

        double ret;
        if(d < PI){
            ret = d / 2.0 - sin(d) / 2.0;
        }else{
            ret = d / 2.0 + sin(2 * PI - d) / 2.0;
        }
        return memo[x][y][0] = ret;
    }

    double ret = INF;
    for(int i=(x+1)%n; i!=y; (++i)%=n){
        int a = 0;
        int b = rest - 1;
        while(b >= 0){
            if((i - x + n - 1) % n >= a && (y - i + n - 1) % n >= b){
                double tmp = solve(x, i, a) + solve(i, y, b);
                ret = min(ret, tmp);
            }
            ++ a;
            -- b;
        }
    }
    return memo[x][y][rest] = ret;
}

int main()
{
    for(;;){
        cin >> n >> m;
        if(n == 0)
            return 0;

        angle.resize(n);
        for(int i=0; i<n; ++i){
            cin >> angle[i];
            angle[i] *= 2 * PI;
        }

        memo.assign(n, vector<vector<double> >(n, vector<double>(m, -1.0)));
        double ret = INF;
        for(int i=0; i<n; ++i)
            ret = min(ret, solve(i, i, m-1));
        ret = PI - ret;

        printf("%0.6f\n", ret);
    }
}

Measured memory_bytes: 1396
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

template<class T>
class Segtree{
	unsigned int n;
	unsigned int size;
	vector<T> node;
	T val;
	function< T(T,T)> f;
public:
	Segtree(unsigned int a_n, T a_val, function< T(T,T)> a_f) :n(1),val(a_val),f(a_f){
		while(n<a_n)n<<=1;
		size = n*2-1;
		node.assign(size,val);
	}
	void set(int i, T x){
		node[i+n-1]=x;
	}
	T get(int i){
		return node[i+n-1];
	}
	void update(){
		for(int i=n-2;i>=0;i--){
			node[i] = f(node[i*2+1],node[i*2+2]);
		}
	}
	void update(int i, T x){
		i += n-1;
		node[i]=x;
		while(i>0){
			i = (i-1)/2;
			node[i] = f(node[i*2+1],node[i*2+2]);
		}
	}
	T query(int a,int b){
		return _query(a,b,0,0,n);
	}
	T _query(int a,int b,int i,int l,int r){
		if(r<=a || b<=l) return val;
		if(a<=l && r<=b) return node[i];
		else{
			T vl = _query(a,b,i*2+1,l,(l+r)/2);
			T vr = _query(a,b,i*2+2,(l+r)/2,r);
			return f(vl,vr);
		}
	}
};

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

    LL n;
    cin>>n;
    VL h(n);
    VL a(n);
    REP(i,n)cin>>h[i];
    REP(i,n)cin>>a[i];

    Segtree<LL> seg(200005, 0, [](LL a, LL b){return max(a,b);});
    REP(i,n){
        LL v = seg.query(0,h[i]);
        seg.update(h[i], v + a[i]);
    }

    PUTS(seg.query(0, 200005));
}

Measured memory_bytes: 7552
N,M = list(map(int,input().split()))
data = [list(map(int,input().split())) for i in range(M)]
road = [0]*N
for i in range(M):
    x = data[i][0] - 1
    y = data[i][1] - 1
    road[x] += 1
    road[y] += 1
for i in range(N):
    print(road[i])


Measured memory_bytes: 3060
n, k = map(int, input().split())
mod = 10**9+7
def make_fact(n):#0~nの階乗を求める
    fact = [1]*(n+1)
    for i in range(1, n+1):
        fact[i] = fact[i-1]*i%mod
    return fact
fact = make_fact(n*2) #＠
def make_fact_inv(n):#0~nの階乗のmodに関する逆元を求める
    fact_inv = [1]*(n+1)
    fact_inv[n] = pow(fact[n], mod-2, mod)#フェルマーの小定理
    for i in range(n, 0, -1):
        fact_inv[i-1] = fact_inv[i]*i%mod
    return fact_inv
fact_inv = make_fact_inv(n*2)#＠
def comb(n, k):#nCk
    return fact[n]*fact_inv[k]*fact_inv[n-k]%mod
mod = 10**9+7
ans = 0
for i in range(n):
    m = n-i
    c = n-m
    if c+i>k*2:
        continue
    ans+=comb(n, i)*comb(m+c-1, m-1)%mod
    ans%=mod
print(ans)

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


int main() {
    string s;
    cin>>s;
    string t;
    cin>>t;
    ll n=s.length(),l=t.length();
    vector<vector<ll>> dp(128);
    vector<ll> v(128,0);
    for(ll i=0;i<n;i++)
    {
        dp[s[i]].push_back(i+1);
        v[s[i]]=1;
    }
    
    for(ll i=0;i<l;i++)
    {
        if(v[t[i]]==0)
        {
           // cout<<"yes";
            cout<<-1;
            exit(0);
        }
    }
    ll tmp=-1,x=0,search=-1;
    for(ll i=0;i<l;i++)
    {
      //  cout<<tmp<<" ";
        char c = t[i];
        if(search==-1)
        {
            tmp=(x*n)+dp[c][0];
            search=dp[c][0];
            continue;
        }
        auto it = upper_bound(dp[c].begin(),dp[c].end(),search);
        
        if(it==dp[c].end())
        {
            x++;
            tmp=(x*n)+dp[c][0];
            search=dp[c][0];
            continue;
        }
     //   cout<<*it<<" ";
        tmp=(x*n)+(*it);
        search=(*it);
    }
    // for(ll i=0;i<l;i++)
    // {
    //     int c= (int)t[i];
    //     for(ll j=0;j<dp[c].size();j++)
    //     {
    //         cout<<dp[t[i]][j]<<" ";
    //     }
    //     cout<<endl;
    // }
   // cout<<search<<" ";
    cout<<tmp<<endl;


	return 0;
}

Measured memory_bytes: 1724
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int s = 0, m = 0, h = 0;
		s = sc.nextInt();
		while(s >= 60){
			m=m+1;
			s = s-60;
			while(m >= 60){
				h=h+1;
				m = m-60;
			}
		}
		System.out.println(h+":"+m+":"+s);
	}
}



Measured memory_bytes: 26216
#include <stdio.h>
int main(void){
	
int i;
int num;


scanf("%d",&num);

if(num==111)
printf("999");
if(num==119)
printf("991");
if(num==191)
printf("919");
if(num==199)
printf("911");
if(num==911)
printf("199");
if(num==919)
printf("191");
if(num==991)
printf("119");
if(num==999)
printf("111");



return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int N;cin>>N;
	int A[N];int temp=1;int cnt=0;
	rep(i,0,N){
		cin>>A[i];
		if(A[i]==temp){ cnt++; temp++; }
	}cout<<(cnt ? N-cnt : -1)<<endl;
}

Measured memory_bytes: 1024
textdata = list(map(int, input().split()))
route_num = textdata[0]
time_lim = textdata[1]
candidate = []

ctlist = [list(map(int, input().split())) for _ in range(route_num)]

for c, t in ctlist:
    if t > time_lim:
        continue
    else:
        candidate += [c]
        
if len(candidate)==0:
    print("TLE")
else:
    print(min(candidate))

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

int main(){
  int N, counter;
  counter = 0;
  cin >> N;
  for(int i = 0;i < N;i++){
    string S;
    cin >> S;
    if(S == "Y"){
      counter++;
    }
  }
  if(counter >= 1){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}

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

using namespace std;

int bubblesort(int n,int a[])
{   
    int count = 0;

    for(int i = 0;i<n;i++)
    {
        for(int j = n-1 ;i<j;j--)
        {
            if(a[j-1]>a[j])
            {
                swap(a[j-1],a[j]);
                count++;
            }
        }
    }

    return count;

}

static const int MAX = 100;

int main()
{
    int n = 0,a[MAX],cnt = -1;
    cin >> n;

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

    cnt = bubblesort(n,a);

    for(int i = 0;i<n;i++)
    {   
        if(i>0)
        {
            cout << " ";
        }
        cout << a[i];

    }

    cout << "\n";

    cout << cnt << endl;

    return 0;


    

}


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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            var n = int.Parse(Console.ReadLine());
            int cnt = 0;
            
            for(int i = 1; i <= n; i++)
            {
                if (i % 2 == 1) cnt++;
            }

            double ans = (double)cnt / (double)n;

            Console.WriteLine(ans);


        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }
    }
}


Measured memory_bytes: 11092
def p_f():
    L, R = map(int, input().split())
    mod = 10 ** 9 + 7
    # dp[i][j][k][l]: iは桁, jはL<=xか, kはy<=Rか, lは桁数が同じか
    dp = [[[[0] * 2 for _ in range(2)] for _ in range(2)] for _ in range(61)]
    dp[60][0][0][0] = 1
    for i in reversed(range(60)):
        # LとRのiビット目を取り出す
        lb = L >> i & 1
        rb = R >> i & 1
        for j in range(2):
            for k in range(2):
                for l in range(2):
                    # 前の状態
                    pre = dp[i + 1][j][k][l]
                    for x in range(2):
                        for y in range(2):
                            nj, nk, nl = j, k, l
                            if x and (not y):  # xが1でyが0
                                continue
                            if (not l) and x != y:
                                continue
                            if x and y:
                                nl = 1
                            # j: L <= x
                            if (not j) and (not x) and lb:
                                continue
                            if x and (not lb):
                                nj = 1
                            # k: y <= R
                            if (not k) and y and (not rb):
                                continue
                            if (not y) and rb:
                                nk = 1
                            dp[i][nj][nk][nl] += pre

    ans = 0
    for j in range(2):
        for k in range(2):
            for l in range(2):
                ans += dp[0][j][k][l]
                ans %= mod
    print(ans)

if __name__ == '__main__':
    p_f()


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

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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  bool ans = true;
  if(y - r < 0) ans = false;
  if(y + r > H) ans = false;
  if(x - r < 0) ans = false;
  if(x + r > W) ans = false;

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






Measured memory_bytes: 3116
using System;
using System.Linq;
using static System.Math;

namespace CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            ReadInt(out a, out b);
            Console.WriteLine(b % a == 0 ? (a + b) : (b - a));
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        #endregion
    }
}

Measured memory_bytes: 13396
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long ans = sc.nextLong();
    for(int i = 1; i < n; i++) {
      long a = sc.nextLong();
      ans = gcd(ans, a);
    }
    System.out.println(ans);
  }

  public static long gcd(long x, long y) {
    if(y == 0) return x;
    return gcd(y, (x % y));
  }
}

Measured memory_bytes: 57176
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define VAR(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

i64 divceil(i64 a, i64 b) { return (a + b - 1) / b; }

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    VAR(i64, K, A, B);
    if (A >= K) {
        print(1);
    } else if (B >= A) {
        print(-1);
    } else {
        const i64 x = divceil(max<i64>(0, K - A), A - B);
        print(x + x + 1);
    }

    return 0;
}


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

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

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

// 関数：

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin>>N;
	cout<<N*N*N<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define maxn 100005
#define maxm 120005
typedef long long ll;
using namespace std; 

int n, s;
struct node{
	int x;
	ll p;
	bool operator < (const node & a)const{
		return x < a.x;
	}
}home[maxn];

inline int read(){
	int x = 0, f = 1;char ch = getchar();
	while(ch > '9' || ch < '0'){if(ch == '-') f = -1;ch = getchar();}
	while(ch >= '0' && ch <= '9'){x = x * 10 + ch -'0';ch = getchar();}
	return x * f;
}

ll ans, sum[maxn];

int main(){
	int i,j,u,v,f;
	n = read(), s = read();
	for(i = 1;i <= n;i++) home[i].x = read(), home[i].p = read();
	sort(home + 1, home + n + 1);
	int l = 1, r = n;
	int flag = -1;
	while(home[l].x < s && home[r].x > s){
		if(home[l].p < home[r].p) home[r].p += home[l].p,  sum[r] += sum[l] + (flag != 0 ? home[r].x - home[l].x : 0), flag = 0, l++;
		else home[l].p += home[r].p, sum[l] += sum[r] + (flag != 1 ? home[r].x - home[l].x : 0), flag = 1, r--;
	}
	printf("%lld\n", home[l].x <= s ? sum[l] + s - home[l].x : sum[r] - s + home[r].x);
}

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

#define FOR(i,a,b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define x first
#define y second

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

using namespace std;

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

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &b : a) cin >> b;

  int sol = 0;
  for (int i = 0, j = 0; i < n; i = j){
    bool asc = false, desc = false;
    int prev = a[i];
    while (true){
      if (asc && a[j] < prev) break;
      if (desc && a[j] > prev) break;
      if (a[j] < prev) desc = true;
      if (a[j] > prev) asc = true;
      prev = a[j];
      ++j;
    } ++sol;
  } cout << sol << endl;

  return 0;
}


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

int main() {
  int N, K;
  int res;
  
  cin >> N;
  cin >> K;
  
  res=1;
  
  while(N>0){
    N/=K;
    res++;
  }
  
  if (N==0){
    res--;
  }
  
  cout << res << endl;

}


Measured memory_bytes: 256