akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
const int INF = 1 << 30;

int main() {
	int N;
	cin >> N;
	int count = 1 << N;
	vector<int>S(count);
	int maxS = 0;
	int pos = -1;
	for (int i = 0; i < count; ++i) {
		cin >> S[i];
	}
	sort(S.rbegin(), S.rend());
	vector<bool>Ssub(count, false);
	vector<int>T;
	T.push_back(S[0]);
	Ssub[0] = true;
	for (int i = 0; i < N; ++i) {
		sort(T.rbegin(), T.rend());
		int memo = 0;
		int tsize = T.size();
		for (int j = 0; j < tsize; ++j) {
			bool b = false;
			for (; memo < count; ++memo) {
				if (Ssub[memo]) {
					continue;
				}
				if (S[memo] < T[j]) {
					Ssub[memo] = true;
					T.push_back(S[memo]);
					b = true;
					break;
				}
			}
			if (!b) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 5324
/*
   fuckin fuck fuck
 */

#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

typedef long long int LLI;

int n;
LLI total[1000000];
bool used[1000000];
vector<int> ans;
map<int, int> order;

bool cmp(int a, int b) {
  return order[a] < order[b];
}

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    fill(total, total+4010, 0);
    fill(used, used+4010, false);
    ans.clear();
    order.clear();

    for (int i=0; i<n; i++) {
      int id;
      LLI p, q;

      scanf("%d%lld%lld", &id, &p, &q);
      if (!order.count(id)) order[id] = i;

      total[id] += p*q;
      if (total[id] >= 1000000 && !used[id]) {
        ans.push_back(id);
        used[id] = true;
      }
    }

    sort(ans.begin(), ans.end(), cmp);
    for (int i=0; i<ans.size(); i++) {
      printf("%d\n", ans[i]);
    }

    if (ans.empty()) puts("NA");
  }
}

Measured memory_bytes: 2832
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
ans=[]
for i in range(y):
    ans.append("U")
for i in range(x):
    ans.append("R")
for i in range(y):
    ans.append("D")
for i in range(x):
    ans.append("L")
ans.append("L")
for i in range(y+1):
    ans.append("U")
for i in range(x+1):
    ans.append("R")
ans.append("D")
ans.append("R")
for i in range(y+1):
    ans.append("D")
for i in range(x+1):
    ans.append("L")
ans.append("U")

print("".join(ans))

Measured memory_bytes: 67480
a[1<<18];u[1<<18];i;j;b;r;h;m;main(n){for(;i<=n;i++)scanf("%d",i?a+i:&n);for(qsort(a+1,n,4,"\x8b\6+\7\xc3");~scanf("%d",&b);j++?a[i]-b?r++:u[i]++:0)for(i=0,h=n+1;h-i>1;a[m]<b|a[m]==b&u[m]?h=m:(i=m))m=h+i>>1;puts(r?"NO":"YES");}

Measured memory_bytes: 1788
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

vector<int64_t> ReadVector(int size)
{
    vector<int64_t> vec(size);
    for (auto &num : vec) {
        cin >> num;
    }
    return vec;
}

vector<int64_t> GetDeltas(const vector<int64_t> &vec)
{
    vector<int64_t> deltas(vec.size() - 1);
    for (size_t i = 0; i < deltas.size(); i += 1) {
        deltas[i] = vec[i + 1] - vec[i];
    }
    return deltas;
}

int64_t GetSum(const vector<int64_t> &vec, int64_t mod)
{
    int64_t sum = 0;
    for (size_t i = 0; i < vec.size(); i += 1) {
        auto left = i + 1;
        auto right = vec.size() - i;

        sum = (sum + 1LL * left * vec[i] % mod * right % mod) % mod;
    }
    return sum;
}

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

    auto a = GetDeltas(ReadVector(n));
    auto b = GetDeltas(ReadVector(m));

    constexpr int64_t kMod = 1e9 + 7;
    auto sum_a = GetSum(a, kMod);
    auto sum_b = GetSum(b, kMod);

    auto res = sum_a * sum_b % kMod;
    cout << res << "\n";

    return 0;
}


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


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

    ll n,k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i = k; i<n+2; i++){
        ll tmp =  i*(2*n-i+1)/2 - i*(i-1)/2 + 1;
        /*cout << i << " ";
        cout << i*(2*n-i+1)/2 ;
        cout << i*(i-1)/2 <<endl; */
        ans += tmp;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                Console.WriteLine("{0} {1}",a[0]*a[1],a[0]+a[0]+a[1]+a[1]);
            }
        }
    }
}

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

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
	// write your code here
        int n = Integer.parseInt(br.readLine().trim());
        HashSet<Integer> st=new HashSet<>();
        for (int i=0; i<n; i++){
            int d = Integer.parseInt(br.readLine().trim());
            st.add(d);
        }
        System.out.println(st.size());
    }

}



Measured memory_bytes: 23124
//abc165_e.cpp
//Mon May 25 21:36:24 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

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

	int low = 1;
	int high = n;
	// int check = 0;
	// if (n%2==0){
		// check = n/2;
	// }
	for (int i=0;i<m;i++){
		if (n%2==1){
			cout << low << " " << high << endl;
		}else {
			int x = 0;
			if (n/2>=high-low){
				x=1;
			}
			cout << low << " " << high-x << endl;
		}
		low++;
		high--;
	}

//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3608
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

graph = defaultdict(list)
for _ in range(M):
	a, b = MAP()
	graph[a-1].append(b-1)
	graph[b-1].append(a-1)

#print(graph)

ans = 0
A = list(range(1, N))

for x in permutations(A, N-1):
	#print(x)
	y = [0]
	tmp = graph[0]
	for i in range(N-1):
		if x[i] in tmp and not x[i] in y:
			y.append(x[i])
			tmp = graph[x[i]]
		else:
			break
	else:
		ans += 1
		#print("成功")

print(ans)



Measured memory_bytes: 5160
#include<cstdio>
using namespace std;
typedef long long LL;
int main()
{
	LL a[1001],n;
	scanf("%lld",&n);
	a[0]=2;a[1]=1;
	for(int i=2;i<=n;i++)
	{
		a[i]=a[i-1]+a[i-2];
	}
	printf("%lld",a[n]);
}

Measured memory_bytes: 128
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        PriorityQueue<Integer> mae = new PriorityQueue<Integer>();
        PriorityQueue<Integer> ato = new PriorityQueue<Integer>((Integer x1, Integer x2) -> x2 - x1);
        long[] maeSum = new long[N+1];
        long[] atoSum = new long[N+1];
        long ans = Long.MIN_VALUE;
        int[] A = new int[N * 3];
        for (int i = 0; i < N * 3; i++) {
            int a = sc.nextInt();
            A[i] = a;
            if (i < N) {
                mae.add(a);
                maeSum[0] += a;
            } else if (i >= N * 2) {
                ato.add(a);
                atoSum[N] += a;
            }
        }
        for (int i = N; i < N * 2; i++) {
            int k = i - (N-1);
            if(A[i] > mae.peek()){
                maeSum[k] = maeSum[k - 1] - mae.poll() + A[i];
                mae.add(A[i]);
            }else{
                maeSum[k] = maeSum[k - 1];
            }
        }
        for(int i = N *2 -1; i >= N; i--){
            int k = i - N;
            if(A[i] < ato.peek()){
                atoSum[k] = atoSum[k + 1] - ato.poll() + A[i];
                ato.add(A[i]);
            }else{
                atoSum[k] = atoSum[k + 1];
            }
        }
        for(int i = 0; i <= N; i++){
            ans = Math.max(ans, maeSum[i] - atoSum[i]);
        }
        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 100960
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

#include <vector>

struct UnionFind
{
    vector<int> data;

    UnionFind(int sz)
    {
        data.assign(sz, -1);
    }

    bool unite(int x, int y)
    {
        x = find(x), y = find(y);
        if (x == y)
            return false;
        if (data[x] > data[y])
            swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }

    int find(int k)
    {
        if (data[k] < 0)
            return k;
        return (data[k] = find(data[k]));
    }

    int size(int k)
    {
        return (-data[find(k)]);
    }

    bool connected(int x, int y)
    {
        return (find(x) == find(y));
    }
};

int N, K, L;

int main()
{
    cin >> N >> K >> L;
    UnionFind uf1(N), uf2(N);
    for (int i = 0; i < K; i++)
    {
        int p, q;
        scanf("%d%d", &p, &q);
        p--, q--;
        uf1.unite(p, q);
    }

    for (int i = 0; i < L; i++)
    {
        int p, q;
        scanf("%d%d", &p, &q);
        p--, q--;
        uf2.unite(p, q);
    }

    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; i++)
    {
        mp[{uf1.find(i), uf2.find(i)}]++;
    }
    for (int i = 0; i < N; i++)
    {
        cout << mp[{uf1.find(i), uf2.find(i)}] << (i == N - 1 ? '\n' : ' ');
    }
}

Measured memory_bytes: 13568
#include<iostream>
#include<queue>
using namespace std;

static const int N = 100;
static const int INF = 100000000000;

int n, Adj[N][N];
int d[N];


void bfs(int s) {
	

	queue<int> q;
	q.push(s);
	
	for (int i=0; i< n;i++)d[i] = INF;
	d[s] = 0;
	int u;

	while (!q.empty()) {
		u = q.front(); q.pop();
		for(int v=0;v<n;v++){
			if (Adj[u][v] == 0) continue;
			if (d[v] != INF) continue;
			d[v] = d[u] + 1;
			q.push(v);
			}
		}
	for (int i = 0; i < n; i++) {
		cout << i + 1 << " " << ((d[i] == INF) ? (-1) : d[i]) << endl;
		}
	}



int main() {
	
	int  u, k, v;
	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			Adj[i][j] = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			Adj[u][v] = 1;
		}
	}
	
	bfs(0);
	return 0;
}

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


ll N, M;
vector<vector<ll>> G;
vector<ll> DP;

int dfs(ll x){
    if(DP[x] != -1) return DP[x];
    else {
        ll Max = 0;
        for(auto v : G[x]) Max = max(Max, (ll)dfs(v));
        DP[x] = Max+1;
        return DP[x];
    }
}


int main(){
    cin >> N >> M;
    G.resize(N);
    DP.resize(N); for(int i = 0; i < N; i++) DP[i] = -1;
    for(int i = 0; i < M; i++){
        ll a, b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
    }
    ll Max = 0;
    for(int i = 0; i < N; i++) Max = max(Max, (ll)dfs(i));
    cout << Max-1 << endl;
    





}

Measured memory_bytes: 8576
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	N := nextInt(sc)
	m := make(map[int]int, 0)
	for i := 0; i < N-1; i++ {
		m[nextInt(sc)]++
	}
	// fmt.Println(m)
	for i := 1; i <= N; i++ {
		fmt.Println(m[i])
	}
}


Measured memory_bytes: 13304
#include <iostream>
#include <cstring>

using namespace std;

namespace sorting_five_numbers
{
    class SortingFiveNumbers
    {
    private:
        //! データサイズ
        static const int Size = 5;

        //! 入力値
        int dataList[Size];

    public:
        /**
        * @brief コンストラクタ
        */
        SortingFiveNumbers(int target[]) {
            memset(dataList, 0, Size);

            for (int i = 0; i < Size; i++) {
                dataList[i] = target[i];
            }
        }

        /**
        * @fn int* createDescendingList()
        * @brief 降順にソートしたリストを生成する
        * @return int* ソート済みリスト
        */
        int* createDescendingList();
    };

    class Control
    {
    private:
        //! データサイズ
        static const int Size = 5;

    public:
        /**
        * @fn bool executeEx()
        * @brief 5つの整数を読み込み、降順に整列し出力する
        * @return bool 入力値が範囲内ならtrueを、そうでなければfalseを返す
        */
        bool executeEx();

    private:
        /**
        * @fn void read(int target[])
        * @brief 標準入力から読み込む
        * @param[out] target 入力データ
        */
        void read(int target[]);

        /**
        * @fn void write(int target[])
        * @brief 標準出力に書き込む
        * @param[in] target 出力データ
        */
        void write(int target[]);

        /**
        * @fn bool check(int target[])
        * @brief 入力データが範囲内か調べる
        * @param[in] target 調査対象
        * @return bool 入力データが範囲内ならtrueを、そうでなければfalseを返す
        */
        bool check(int target[]);
    };
}

using namespace sorting_five_numbers;

int* SortingFiveNumbers::createDescendingList()
{
    for (int i = 0; i < Size - 1; i++) {
        int max = i;
        for (int j = i + 1; j < Size; j++) {
            if (dataList[max] < dataList[j]) {
                max = j;
            }
        }
        int t = dataList[i];
        dataList[i] = dataList[max];
        dataList[max] = t;
    }

    return dataList;
}

bool Control::executeEx()
{
    int input[Size] = { 0 };
    int* output = NULL;

    read(input);

    if (!check(input))
        return false;

    SortingFiveNumbers list(input);

    output = list.createDescendingList();

    write(output);

    return true;
}

void Control::read(int target[])
{
    for (int i = 0; i < Size; i++)
        cin >> target[i];
}

void Control::write(int target[])
{
    for (int i = 0; i < Size; i++) {
        (i != Size - 1) ? cout << target[i] << " " : cout << target[i] << endl;
    }
}

bool Control::check(int target[])
{
    static const int Min = -100000;
    static const int Max = 100000;

    for (int i = 0; i < Size; i++) {
        if (Min > target[i] || Max < target[i])
            return false;
    }

    return true;
}

int main()
{
    if (!Control().executeEx())
        return 1;
}



Measured memory_bytes: 3108
#include<stdio.h>
int main()
{
    int a[32]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51},n;
    scanf("%d",&n);
    printf("%d\n",a[n-1]);
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  long long t = N % (A+B);
  long long m = N / (A+B);
  cout << m*A + min(t,A) << endl;
  return 0;
}

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

const long long MX = 1e18;

int main(){
    int n;
    cin >> n;
    long long  ans = 1;
    bool ng = false;
    for (int i = 0; i < n; ++i){
        long long a;
        cin >> a;
        if (a == 0){
            cout << 0 << endl;
            return 0;
        }
        if (ng || (MX + 1)/ans < a || ans*a > MX){
            ng = true;
        }
        ans *= a;
    }
    if (ng) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
x, n = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
a = []
for i in range(-2,102):
    if i not in p:
        a.append(i)

m = []
for i in range(len(a)):
    m.append(abs(a[i] - x))

miner = min(m)
res = []
for i in a:
    if abs(x - i) == miner:
        res.append(i)

print(min(res))

Measured memory_bytes: 9200
#include <stdio.h>

int main(void){
   int HP,atkN,i,j,tmp,max_index;
   scanf("%d%d",&HP,&atkN);
   unsigned short int KM_dmg[atkN];
   unsigned short int bukket[40001];

   for(i=0;i<atkN;i++)
      scanf("%hu",&KM_dmg[i]);


   //Sort
   for(i=0;i<atkN;i++)
      bukket[KM_dmg[i]]++;
   
   for(i=0,j=0;i<40001;i+=0){
      if(bukket[i]>=1){
         KM_dmg[j] = i;
         j++;
         bukket[i]--;
      } else { i++; }

      if(j==atkN) break;
   }
   
   for(i=0;i<atkN;i++){
      HP=HP-(int)KM_dmg[atkN-i-1];
      if(HP<1) {printf("Yes\n"); return 0;}
   }
   
   printf("No\n");
   return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;

void solve() {
	cin >> N;
	cout << (N - 1) / 2 << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



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

int main(){
	int i,N,num,num1,num2;
	int change_times=0;
	bool flag=false;
	vector<int> numbers;
	cin>>N;
	for(i=0;i<N;i++){
		cin>>num;
		numbers.push_back(num);
	}
	
	while(flag==false){
		flag=true;
		for(i=N-1;i>=1;i--){
			if(numbers[i]<numbers[i-1]){
				num1=numbers[i];
				num2=numbers[i-1];
				numbers[i]=num2;
				numbers[i-1]=num1;
				flag=false;
				change_times+=1;
			}
		}
	}
	
	cout<<numbers[0];
	for(i=1;i<N;i++)cout<<" "<<numbers[i];
	cout<<endl<<change_times<<endl;
	return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
int ans;
vector<vector<int>> q1(51);
int q;
vector<int> v;
void score(int s, int n, int prev, int m, int *ans)
{
    if(s == n)
    {   
       int tmp = 0;
    //    for(int i=0; i<n; i++)
    //    {
    //        cout<<v[i]<<'\n';
    //    }
       for(int k=0; k<q; k++)
       {
          
            if( ( v[q1[k][1] - 1] - v[q1[k][0] - 1] ) == q1[k][2] )
            {
                tmp += q1[k][3];
                // cout<<tmp<<'\n';
            }
            // cout<<v[q1[k][1]-1]<<" "<<q1[k][1]<<" "<<k<<'\n';
       }
    //    cout<<ans<<'\n';
       *ans = max(*ans, tmp);
       return;
    }
    for(int i=prev; i<=m; i++)
    {
        v.push_back(i);
        score(s + 1, n, i, m, ans);
        v.pop_back();
    }
}
int main()
{
    int n,m;
    cin>>n>>m>>q;
    int ans = 0;
    for(int i=0; i<q; i++)
    {
        for(int j=0; j<4; j++)
        {
            int x;
            cin>>x;
            q1[i].push_back(x);
            // cout<<q1[i][j]<<" ";
        }
        // cout<<'\n';
    }
    ans = 0;
    score(0, n, 1, m, &ans);
    cout<<ans<<'\n';
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
 
#define TRACE(x) cerr << #x << " = " << x << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
#define SZ(x) (int)(x).size()
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
template<class Num>
Num mabs(Num A){
  if(A < 0) return -A;
  return A;
}

char str[1005];

int main(){
  scanf("%s", str);
  int n = strlen(str);
  if(str[n - 1] == 's'){
    str[n] = 'e'; str[n + 1] = 's';
  }
  else{
    str[n] = 's';
  }
  
  cout << str << endl;
  
  return 0;
}


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

using namespace std;

int main(){
	int dp[50001];
	for(int i=0;i<50001;i++) dp[i] = 1e9;
	dp[0] = 0;
	int n,m;
	cin >> n >> m;
	for(int i=0;i<m;i++){
		int d;
		cin >> d;
		for(int i=0;i+d<50001;i++){
			dp[i+d] = min(dp[i+d],dp[i]+1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 3308
import numpy as np

h, w, k = map(int,input().split())
c = [input().split() for i in range(h)]

f = [[0]*w for i in range(h)]

for i in range(h):
    for j in range(w):
        if c[i][0][j] == '#':
            f[i][j] = 1
cnt = 0
for i in range(1<<h):
    hlist = []
    for ii in range(h):
        if i & (1<<ii):
            hlist.append(ii)
    for j in range(1<<w):
        wlist = []
        for jj in range(w):
            if j & (1<<jj):
                wlist.append(jj)
        #print(hlist)
        #print(wlist)
        ff = np.delete(f, hlist, 0)
        ff = np.delete(ff, wlist, 1)
        # print(ff)
        if ff.sum() == k:
            cnt += 1
print(cnt)

Measured memory_bytes: 27172
import java.io.*;

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		for(int i=0;i<n;i++)
			System.out.println(in.readLine().replaceAll("Hoshino", "Hoshina"));
	}
}

Measured memory_bytes: 16956
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <climits>
#include <iomanip>
 
using namespace std;
 
 
 
int main() {
    double W, H, x, y;
 
    cin >> W >> H >> x >> y;
 
    double res;
    int pattern;

    res = (H * W) / 2;

    if ((2 * x == W) & (2 * y == H)) {
        pattern = 1;
    } else {
        pattern = 0;
    }

    cout << fixed << setprecision(10) << res << ' ' << pattern;
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<char,int>mp;
    string s;
    int i;
    cin>>s;
    int n=s.size();

    for(i=0;i<n;i++)
        mp[s[i]]++;

  for(char j='a';j<='z';j++)
  {
      if(mp[j]%2)
      {
          cout<<"No\n";
          return 0;
      }
  }
  cout<<"Yes\n";
  return 0;
}


Measured memory_bytes: 3604
'use strict'

const main = input => {
	const args = input.trim().split(' ')
	const n = Number(args[0])
	const a = Number(args[1])
	const b = Number(args[2])

	if ((a * n) < b) console.log(a * n)
	else console.log(b)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21064
N = int(input())
h_list = list(map(int, input().split()))

dp = [float("inf")] * N
dp[0] = 0

for i in range(N-1):
    dp[i + 1] = min(dp[i] + abs(h_list[i + 1] - h_list[i]), dp[i + 1])
    if i + 2 <= N - 1:
        dp[i + 2] = min(dp[i] + abs(h_list[i + 2] - h_list[i]), dp[i + 2])
print(dp[N-1])


Measured memory_bytes: 13928
#include "bits/stdc++.h"

#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			1'010'000'000'000'000'017LL
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )

using namespace std;

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


void Main()
{
	ll X, Y;
	cin >> X >> Y;

	bool ans = false;
	rep(c, 0, X + 1) {
		rep(t, 0, X + 1) {
			if ((c + t == X) && (c * 2 + t * 4 == Y)) ans = true;
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>

using namespace std;

int main()
{
	int num;
	cin >> num;
	if (num == 0)return 0;
	vector<int> v(num);
	for (int a = 0; a < num; a++) {
		cin >> v[a];
	}
	cout << v[num - 1];
	for (int a = (num - 2); a >= 0; a--) {
		cout << ' ';
		cout << v[a];
	}
	cout << endl;
}


Measured memory_bytes: 3100
#include<iostream>
#include<cmath>
using namespace std;
#include<iomanip>
#include<algorithm>
const int N = 102;
int main(){
	ios::sync_with_stdio(false);
	int n,k;
	int a[N];
	cin>>n>>k;
	for(int i = 0;i < n;i++){
		cin>>a[i];
		k -= a[i];
	}
	sort(a,a+n);
	cout<<n+k/a[0]<<endl;
	return 0;
}

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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {

	return;
}

void solve() {
	lli n;
	cin >> n;
	
	lli ans = 0, p;
//	for (p = 10; p < n; p *= 100) {
//		ans += p * 9 / 10;
//	}
//	
//	ans += max(0LL, n - (p / 10));

	for (int i = 1; i <= n; ++i) {
		int j = i, cnt = 0;
		while (j > 0) {
			j /= 10;
			++cnt;
		}
		
		if (cnt % 2 == 1) ++ans;
	}
	
	cout << ans << '\n';
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <climits>
#define int long long
using namespace std;
typedef pair <int,int> P;
#define to first
#define co second
#define fi first
#define se second
const int INF=INT_MAX;
const int MAX_N=100000;
vector <P> G[MAX_N];
int n,d[MAX_N];
void dijk(int s){
  priority_queue <P,vector<P>,greater<P> > que;
  fill(d,d+n,INF);
  d[s]=0;
  que.push(P(0,s));
  for(;!que.empty();){
    P p=que.top(); que.pop();
    int v=p.se;
    if (d[v]<p.fi) continue;
    for(int i=0;i<G[v].size();i++){
      P e=G[v][i];
      if(d[e.to]>d[v]+e.co){
	d[e.to]=d[v]+e.co;
	que.push(P(d[e.to],e.to));
      }
    }
  }
}
signed main(){
  int e,r;
  cin>>n>>e>>r;
  for(int i=0,a,b,c;i<e;i++){
    cin>>a>>b>>c;
    G[a].push_back(make_pair(b,c));
  }
  dijk(r);
  for(int i=0;i<n;i++){
    if(d[i]==INF) cout<<"INF"<<endl;
    else cout<<d[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 19412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("m_solutions2020/m_solutions2020_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int A, B, C, K;
  cin >> A >> B >> C >> K;
  
  rep(i, K) {
    if (A >= B) {
      B *= 2;
    } else if (B >= C) {
      C *= 2;
    }
  }

  bool ok = (A < B && B < C);

  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

class UnionFind {
public:
    vector<int> par;
    UnionFind(vector<int> par) : par(par) {}
    int get_root(int i) {
        if (par[i] == i) return i;
        return par[i] = get_root(par[i]);
    }
    void set_root(int i, int root) {
        par[i] = get_root(root);
    }
};

int main()
{
    while (1) {
        int n, q; cin >> n >> q;
        if (!n) break;

        vector<int> par(n);
        loop (n-1, i) {
            cin >> par[i+1];
            par[i+1]--;
        }

        vector<char> type(q);
        vector<int> val(q);
        loop (q, i) {
            cin >> type[i] >> val[i];
            val[i]--;
        }

        vector<int> marked(n);
        loop (q, i) {
            if (type[i] == 'M') {
                if (marked[val[i]]) type[i] = 'x';
                else marked[val[i]] = 1;
            }
        }

        vector<int> ufpar(n);
        loop (n, i) {
            if (marked[i]) ufpar[i] = i;
            else ufpar[i] = par[i];
        }

        UnionFind UF(ufpar);

        ll ans = 0;
        loop (q, i) {
            int j = q - 1 - i;
            if (type[j] == 'Q') {
                ans += UF.get_root(val[j]) + 1;
            }
            if (type[j] == 'M') {
                UF.set_root(val[j], par[val[j]]);
            }
        }

        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5164
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int main(){
int N;
cin>>N;
vector<long long >A(N);
rep(i,N){
    cin>>A[i];
}
sort(A.begin(),A.end());
bool both=false;
if(A[0]<0 && A[N-1]>=0)both=true;

vector<pair<long long,long long>>ope(N-1);
if(both){
    for(int i=1;i<N-1;i++){
        if(A[i]<0)
        {
            ope[i-1]=make_pair(A[N-1],A[i]);
            A[N-1]-=A[i];
        }
        else{
            ope[i-1]=make_pair(A[0],A[i]);
            A[0]-=A[i];
        }
    }
    ope[N-2]=make_pair(A[N-1],A[0]);
    A[N-1]-=A[0];
    cout<<A[N-1]<<endl;
}
else if(A[N-1]<0){
    for(int i=N-2;i>=0;i--){
            ope[N-2-i]=make_pair(A[N-1],A[i]);
            A[N-1]-=A[i];    
    }
    cout<<A[N-1]<<endl;
}
else if(A[0]>=0){
    for(int i=1;i<N-1;i++){
            ope[i-1]=make_pair(A[0],A[i]);
            A[0]-=A[i];    
    }
    ope[N-2]=make_pair(A[N-1],A[0]);
    A[N-1]-=A[0];
    cout<<A[N-1]<<endl;
}

rep(i,N-1){
    cout<<ope[i].first<<" "<<ope[i].second<<endl;
}
 return 0;
}
/*
bymyself

second 11m50s
3
1 -1 2


4
-1 1
2 -2


3
1 1 1

1
1 1
1 0
*/

Measured memory_bytes: 4224
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<bitset>
using namespace std;
typedef pair<double,int> P;
typedef pair<P,int> PP;
#define F first
#define S second
#define INF (10000000.0)
int N,M,p,A,B,ST;
double T[10];
struct edge{
  int t;
  double c;
  edge(int t,double c) : t(t),c(c) {}
};
vector<edge> G[101];
double d[(1<<8)][101];
double solve(){
  for(int i=0;i<(1<<8);i++){
    for(int j=0;j<101;j++){
      d[i][j]=INF;
    }
  }
  priority_queue<PP> q;
  q.push( PP(P(0.0,0),A) );
  d[0][A]=0.0f;
  while(!q.empty()){
    PP p = q.top(); q.pop();
    int st = p.F.S;
    if(st == ST) continue;
    int id = p.S;
    double c = p.F.F;
    // printf("%lf %d %d\n",c,id,st);
    for(int i=0;i<(int)G[id].size();i++){
      edge e = G[id][i];
      //    printf("e.to  =  %d\n",e.t);
      for(int j=0;j<N;j++){
	//	cout << bitset<10>(j) << endl;
	if(st & (1<<j)) continue;
	int nst = (st|(1<<j));
	if(d[nst][e.t] > c + e.c/T[j]){
	  d[nst][e.t] = c + e.c/T[j];
	  //  printf("%d->%d ... %lf + %lf / %lf = %lf \n",id,e.t,c,e.c,T[j],c+e.c/T[j]);
	  q.push( PP(P(c + e.c/T[j],nst),e.t) );
	}
      }
    }
  }
  double res = INF;
  for(int i=0;i<(1<<N);i++){
    res = min(res,d[i][B]);
    //    printf("%lf\n",res);
  }
  return res;
}
int main(){
  while(1){
    scanf("%d %d %d %d %d",&N,&M,&p,&A,&B);
    if(!N && !M && !p && !A && !B) break;
    for(int i=0;i<N;i++){
      int t;
      scanf("%d",&t);
      T[i]=(double)t;
    }
    for(int i=0;i<p;i++){
      int x,y,z;
      scanf("%d %d %d",&x,&y,&z);
      G[x].push_back(edge(y,(double)z));
      G[y].push_back(edge(x,(double)z));
    }
    ST = (1<<N)-1;
    double res = solve();
    if(res == INF){
      puts("Impossible");
    } else {
      printf("%.4lf\n",res);
    }
    for(int i=1;i<=M;i++) G[i].clear();
  }
}

Measured memory_bytes: 1528
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        String s = ns();

        int idx = s.length();
        while (idx > 0) {
            if (idx - 7 >= 0 && s.substring(idx - 7, idx).equals("dreamer")) {
                idx -= 7;
            } else if (idx - 5 >= 0 && s.substring(idx - 5, idx).equals("dream")) {
                idx -= 5;
            } else if (idx - 5 >= 0 && s.substring(idx - 5, idx).equals("erase")) {
                idx -= 5;
            } else if (idx - 6 >= 0 && s.substring(idx - 6, idx).equals("eraser")) {
                idx -= 6;
            } else {
                break;
            }
        }

        if (idx == 0) {
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 13520
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

void add (i32 *bit, i32 x, i32 v) {
  i32 n = bit[0];
  for (i32 i = x; i <= n; i += i & -i) {
    bit[i] += v;
  }
}

i32 find (i32 *bit, i32 x) {
  i32 sum = 0;
  for (i32 i = x; i > 0; i -= i & -i) {
    sum += bit[i];
  }
  return sum;
}

typedef struct range {
  i32 l, r;
  struct range *next;
} range;

void run (void) {
  i32 n = read_int();
  i32 m = read_int();
  range *a = (range *) calloc (n, sizeof (range));
  range **start = (range **) calloc (m + 1, sizeof (range *));
  for (i32 i = 0; i < n; ++i, ++a) {
    i32 l = read_int();
    i32 r = read_int() + 1;
    i32 d = r - l;
    *a = (range) {l, r, start[d]};
    start[d] = a;
  }
  i32 *bit = (i32 *) calloc (m + 2, sizeof (i32));
  bit[0] = m + 1;
  for (i32 d = 1, i = 0; d <= m; ++d) {
    for (range *p = start[d - 1]; p != NULL; p = p->next) {
      ++i;
      add (bit, p->l, 1);
      add (bit, p->r, -1);
    }
    i32 ans = n - i;
    for (i32 j = d; j <= m; j += d) {
      ans += find (bit, j);
    }
    print_int (ans);
    putchar ('\n');
  }
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 6656
#include <iostream>

using namespace std;
int n, a[15];
long res;

int main()
{
	cin >> n;

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

	res = 1;
	for (int i = 0; i < n; ++i)
		res *= 3;

	long tmp = 1;
	for (int i = 0; i < n; ++i)
		if (a[i] % 2 == 0)
			tmp *= 2;

	res -= tmp;

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


void  bubbleSort(int number[], int length);

int main() {


	int N, D[10000];
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &D[i]);
	}

	bubbleSort(D, N);

	int ans = N;

	for (int i = 0; i < N - 1; i++) {
		if (D[i] == D[i + 1]) {
			ans--;
		}
	}

	printf("%d", ans);

}



void  bubbleSort(int number[], int length) {
	for (int i = 0; i < length; i++)
		for (int j = i + 1; j < length; j++)
			if (number[i] < number[j]) {
				int tmp = number[i];
				number[i] = number[j];
				number[j] = tmp;
			}
}

Measured memory_bytes: 128
N = int(input())
bc = [0, 1, 1, 2, 1, 2, 2, 3]
for i in range(N):
    ans = 0
    b = 0
    rest = 3
    while rest:
        s = input()
        if s == "OUT":
            rest -= 1
            continue

        if s == "HIT":
            b = (b << 1) | 1
            if b & 8:
                ans += 1
                b ^= 8
        else:
            ans += bc[b] + 1
            b = 0
    print(ans)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

int main() {
    ll n, m, d;
    cin >> n >> m >> d;
    if ( d == 0 ) {
        printf("%.8f\n", (double)(m-1)/(double)n);
        return 0;
    }
    printf("%.8f", 2 * ( (double)n - (double)d ) / ( (double)n * (double)n ) * (double)(m - 1) );
    return 0;
}


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

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

	vector<int64_t> A( N );
	int64_t sum = 0;
	int64_t sum2 = 0;

	for( int i = 0; i < N; ++i ) {
		int64_t num;
		cin >> num;

		A.at( i ) = num;
		sum += num;

		if( (i & 1) && (i < N-1) ) {
			sum2 += num;
		}
	}

	int64_t x = sum - 2 * sum2;

	for( int i = 0; i < N-1; ++i ) {
		cout << x << ' ';

		x = 2 * A.at( i ) - x;
	}

	cout << x << endl;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    string S;
    int w;

    cin >> S;
    cin >> w;

    for(int i = 0; i < S.size(); i = i + w)
    {
        cout << S[i];
    }
    cout << endl;
    return 0;
}

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

using namespace std;
string S = "";


int main(void) {
	int a = 0;
	cin >> S;
	for (int i = 0; i < 3; i++) {
		if (S[i] == '1') {
			++a;
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
while 1:
    M,F,R = map(int,input().split())
    if M == -1 and F == -1 and R == -1:
        break
    if M == -1 or F == -1:
        print("F")
    elif M+F >= 80:
        print("A")
    elif M+F >= 65:
        print("B")
    elif M+F >= 50:
        print("C")
    elif M+F >= 30:
        if R >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")



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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, y;
    cin >> n >> y;
    int res = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (n - i - j < 0) break;
            if (10000 * i + 5000 * j + 1000 * (n - i - j) == y) {
                cout << i << " " << j << " " << n - i - j << '\n';
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << '\n';
    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
// clang-format on

main {
  int n, k;
  cin >> n >> k;
  vi l(n);
  rep(i, n) cin >> l[i];
  sort(rall(l));
  cout << accumulate(l.begin(), l.begin() + k, 0LL) << endl;
}


Measured memory_bytes: 384
fun main(args:Array<String>) {
    val n = readLine()!!.takeLast(1).toInt()
    when(n) {
        2,4,5,7,9 -> "hon"
        0,1,6,8 -> "pon"
        3 -> "bon"
        else -> ""
    }.let { println(it) }
}

Measured memory_bytes: 35820
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  int t1,t2,r1,r2;
  cin>>t1>>t2>>r1>>r2;
  if(r1<0||r2<0){
    if(t1==t2) drop("Draw");
    if(t1>t2) drop("Bob");
    if(t1<t2) drop("Alice");
  }
  if(r1==r2) drop("Draw");
  if(r1<r2) drop("Bob");
  if(r1>r2) drop("Alice");
  return 0;
}



Measured memory_bytes: 3084