akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define MAXN 100001
#define X first
#define Y second
#define MOD 1000000007
#define fr(a,b,c) for(ll a=b;a<c;++a)
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll t,n,i,j;
int main()
{
    fastio;
    cin>>n;
    vector <double > p(n+1);
    double a=1.0;
    fr(i,1,n+1){
        cin>>p[i];
        a*=p[i];
    }
    ll k=n/2;
    vector < vector <double > > dp(n+1,vector <double >(k+1));
    double sum=0.0;
    dp[0][0]=1.0;
    dp[1][0]=p[1];
    dp[0][1]=0.0;
    //cout<<"cooll"<<endl;
    fr(i,1,n+1){
        fr(j,0,k+1){
            if(j==0){
                dp[i][0]=dp[i-1][0]*p[i];
            }
            if(i<j)
                dp[i][j]=0.0;
            else{
                dp[i][j]=(dp[i-1][j]*p[i])+(dp[i-1][j-1]*(1-p[i]));
            }
            //cout<<dp[i][j]<<" ";
        }//cout<<endl;
    }
 /*   cout<<a<<" ";
    fr(i,1,k+1)
        cout<<dp[n][i]<<" ";
    cout<<endl;
   */ fr(i,1,k+1)
        sum+=dp[n][i];
    cout<<setprecision(15)<<(sum+a)<<endl;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
int n,k,ans=1e9;
void dfs(int i,int x){
  if(i==n){
    ans=min(ans,x);
    return;
  }
  dfs(i+1,x+k);
  dfs(i+1,x*2);
}
signed main(){
  cin>>n>>k;
  dfs(0,1);
  cout<<ans<<endl;
  return 0;
}


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

int main(void)
{
	string S;
	cin >> S;
	if(S.substr(0, 4) == "YAKI") printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,a,b,c,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d%d%d",&a,&b,&c);
        if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include<stdio.h>

int heap[500001];
int have;

int left(int a)
{
	return 2*a;
}
int right(int a)
{
	return 2*a+1;
}

void maxheapify(int i)
{
	int l,r,save,max;
	l=left(i);
	r=right(i);
	max=i;
	if(l<=have&&heap[l]>heap[max])
	{
		max=l;
	}
	if(r<=have&&heap[r]>heap[max])
	{
		max=r;
	}
	if(max!=i)
	{
		save=heap[i];
		heap[i]=heap[max];
		heap[max]=save;
		maxheapify(max);
	}
}

int main(void)
{
	int i,N;
	scanf("%d",&N);
	have=N;

	for(i=1;i<=N;i++)
	{
		scanf("%d",&heap[i]);
	}
	for(i=N/2;i>=1;i--)
	{
		maxheapify(i);
	}
	for(i=1;i<=N;i++)
	{
		printf(" %d",heap[i]);
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 3668
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

struct Input
{
	int a,b;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		auto ab = readln().strip().split();
		a = ab[0].to!int;
		b = ab[1].to!int;
	}
}

struct Output
{
}

auto main2(Input* input)
{
    if (1 <= input.a && input.a <= 9 && 1 <= input.b && input.b <= 9)
        return input.a * input.b;
	return -1;
}

unittest { writeln("begin unittest"); }

unittest // example1
{
	string example =
`2 5`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == 10);
}

unittest // example2
{
	string example =
`5 10`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == -1);
}

unittest // example3
{
	string example =
`9 9`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == 81);
}

unittest { writeln("end unittest"); }

void parseExample(out Input input, string example)
{
	struct Adapter
	{
		string[] _lines;
		this(string input) { _lines = input.splitLines(); }
		string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
	}
	parseInput(input, Adapter(example));
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	auto result = main2(&input);
	writeln(result);
}


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

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 6;
            ans -= int.Parse(Console.ReadLine());
            ans -= int.Parse(Console.ReadLine());
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
from bisect import bisect_left
A , B, Q = map(int,input().split(" "))
s = [0] * A
t = [0] * B
x = [0] * Q
for i in range(A):
    s[i] = int(input())
for i in range(B):
    t[i] = int(input())

for i in range(Q):
    x[i] = int(input())
    shrine1 = bisect_left(s,x[i])
    shrine2 = shrine1 - 1
    temple1 = bisect_left(t,x[i])
    temple2 = temple1 - 1
    a = float('inf')
    if shrine1 == len(s):
        s1,s2 = (x[i] - s[-1]),float('inf')
    elif shrine1 == 0:
        s1,s2 = float('inf'),(s[0] - x[i])
    else:
        s1,s2 = x[i] - s[shrine2],s[shrine1] - x[i]

    if temple1 == len(t):
        t1,t2 = (x[i] - t[-1]),float('inf')

    elif temple1 == 0:
        t1,t2 = float('inf'),(t[0] - x[i])
    else:
        t1,t2 = x[i] - t[temple2],t[temple1] - x[i]
    print(min([ max(s2,t2) , max(t1,s1) , min(s1,t2)*2+max(s1,t2), min(s2,t1)*2+max(s2,t1) ]))
    


Measured memory_bytes: 16028
def solve():
    a, b, k = map(int, input().split())
    ans = list()
    for i in range(a, min(a+k, b+1), 1):
        ans.append(i)
    for i in range(b, max(b-k,a), -1):
        ans.append(i)
    ans = list(set(ans))
    ans.sort()
    for i in ans:
        print(i)
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 9080
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main() {
    int n;
    while(cin>>n){
        if(n==0)break;
        
        int sum=0;
        for(int i=1;i<=sqrt(n);i++){
            if(n%i==0){
                if(i!=n)sum+=i;
                if(i*i!=n && i!=1)sum+=n/i;
            }
        }
        if(sum==n)cout<<"perfect number"<<endl;
        else if(sum<n)cout<<"deficient number"<<endl;
        else if(sum>n)cout<<"abundant number"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD  = int(1e9) + 7;

signed main()
{
  i64 x[90] {2, 1};

  int n; cin >> n;
  rep(i, 2, n+1) x[i] = x[i-1] + x[i-2];

  cout << x[n] << endl;
  return 0;
}



Measured memory_bytes: 256
#import<iostream>
#import<set>
#import<algorithm>
using namespace std;main(){int n,k,c[10],i,t;for(;cin>>n>>k,i=n;){for(;i--;)cin>>c[i];sort(c,c+n);set<int>s;do{t=0;for(i=k;i--;)t=t*(c[i]>9?100:10)+c[i];s.insert(t);}while(next_permutation(c,c+n));cout<<s.size()<<endl;}}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();

		System.out.printf("%d %d %d %d",x2-(y2-y1),y2+(x2-x1),x1-(y2-y1),y1+(x2-x1));
		sc.close();
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s1,s2="CODEFESTIVAL2016";
  cin >> s1;
  int x=0;
  for(int i=0;i<16;i++){
    if(s1[i]!=s2[i])x++;
  }
  cout<<x<<endl;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main()
{   
    string s;
    int num;
    priority_queue<int> Q;

    while (cin >> s && s != "end") {
        
        if (s == "insert") {
            cin >> num;
            Q.push(num);
        }

        else if (s == "extract") {
            cout << Q.top() << endl;
            Q.pop();
        }
    }
}


Measured memory_bytes: 6936
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>

#include <queue>


using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n,m;
    cin>>n>>m;
    long long int tmp;
    priority_queue<long long int> pq;
    REP(i,n){
        cin>>tmp;
        pq.push(tmp);
    }
    REP(i,m){
        tmp = pq.top();
        tmp /= 2;
        pq.pop();
        pq.push(tmp);
        if(pq.top()==0){
            cout << 0 << endl;
            return 0;
        }
    }

    long long int result = 0;
    REP(i,n){
        if(pq.top()==0){
            break;
        }
        result += pq.top();
        pq.pop();
        
    }
    cout << result << endl;

    return 0;
}


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

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N;
    cin >> N;
    vector<pair<int, int>> town(N);
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        town[i] = make_pair(x, y);
    }
    double ans = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            ans += sqrt((town[i].first - town[j].first) *(town[i].first - town[j].first) + (town[i].second - town[j].second)*(town[i].second - town[j].second));
        }
    }
    cout << setprecision(15) <<2 * ans / N << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007

    using namespace std;
     //int g[105][105];
    //vector < int > wt(100004);
   // vector < int > a;
    //vector < int > v(30500);
    //int cst[102][100005];
    //int ansr[100005];
 //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;
    //vector < vector < int > > adj(5000, vector < int > (5000));
 //int  dp[1000006];
   // int level[500];


    void solve()
    {
         ll int i,j=0,r=200,p,q,y=0,k=0,ans=0,d,h,flag=0,n,m;
         cin>>n;
         vector < int > v(n);
         rep(i,0,n) cin>>v[i];
         sort(all(v));
         cout<<(v[n/2]-v[n/2-1]);







    }



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

       /*

  void bfs( int i , int j)
       {
           vis[i][j]= true;
         queue < int > que;
         que.push(k);
         while(!que.empty())
         {
            int x= que.front();
            que.pop();
             for ( int i=1;i<=n;i++)
             {
                 if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                 {
                   if(!vis[i])
                   {
                       que.push(i);
                       level[i]=level[x]+1;
                       vis[i]= true;
                   }
                 }
             }
         }
       }

      ll int por(ll int a,ll int b)
         {
            ll int k=1;
            while(b>0)
            {
                if(b%2) k=k*a,k%=hell;
                b/=2;
                a*=a; a%=hell;
            }
            return k;
         } */


Measured memory_bytes: 640
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 1e5 + 5;

void solve() {
    int n;
    cin >> n;
    if(n) printf("0\n");
    else printf("1\n");
}

int main() {
    /*int tc;
    scanf("%d", &tc);
    while(tc--)*/
    solve();
    return 0;
}


Measured memory_bytes: 3632
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{

	int ii;
	int idx;
	int keta;
	int is_end;
	int total[1000];
	char c;

	//クリア
	memset(total, (int)0, sizeof(int)* 1000);

	idx = 0;
	is_end = 0;
	for (;;) {
		keta = 0;
		for (;;) {
			scanf("%c", &c);
			if (keta == 0 && c == '0') {
				scanf("%c", &c);
				if (c == '\n') {
					is_end = 1;
					break;
				}
			}
			if (c == '\n') {
				break;
			}
			total[idx] += (int)c - '0';
			keta++;
		}
		if (is_end == 1) {
			break;
		}
		idx++;
	}

	for (ii = 0; ii < idx; ii++) {
		printf("%d\n", total[ii]);
	}

	return 0;

}

Measured memory_bytes: 540
#include<iostream>
#include<algorithm>
#include<cmath>
#include <vector>
using namespace std;

int main(){
    int a,b,c,d,e,f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double y;
        if(d!=0) y = (c - f * (double)a/d)/(b - e * (double)a/d);
        else y = (f - c * (double)d/a)/(e - b * (double)d/a);
        double x;
        if(a!=0) x = (c - b * y)/a;
        else x = (f - e * y)/d;
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 0
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		double L = sc.nextDouble();
		double max = 0;
		double line = L / 3;

		BigDecimal bd = new BigDecimal(line * line * line);
		System.out.println(bd.toPlainString());
	}
}

Measured memory_bytes: 24660
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        if((x * 2 <= y) && (y <= x * 4) && (y % 2 == 0)) {
		System.out.println("Yes");
		}else{
		System.out.println("No");
		}
    }
}

Measured memory_bytes: 35748
input_line_1 = raw_input()
input_line_2 = raw_input()
#N = int(input_line_1)
count_1 = 0
count_2 = 0
for kigou in input_line_2:
	if kigou == "(":
		count_2 += 1
	if kigou == ")":
		if count_2 > 0:
			count_2 -= 1
		else:
			count_1 += 1
	#print kigou, count_1, count_2
print count_1 * "(" + input_line_2 + count_2 * ")"


Measured memory_bytes: 2568
import math


def digitSum(n):
    count = 0
    while n != 0:
        count += n % 10
        n //= 10
    return count


n =  int(input())


# 0が多くなるようにする
ans = digitSum(n)
if ans == 1:
    print(10)
else :
    print(ans)



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

namespace ABC145A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b;
			a = int.Parse(Console.ReadLine());
			b = a * a;
			Console.WriteLine(b);
		}
	}
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	int x,y;
};

int A,B,R;
vector<int> V[10000];
Info info[100000];

int calc_dist(int x1,int y1,int x2,int y2){
	return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

void func(){
	for(int i = 0; i < A; i++){
		scanf("%d %d",&info[i].x,&info[i].y);
	}

	for(int x = 0; x < 10000; x++)V[x].clear();

	int X,Y;
	for(int i = 0; i < B; i++){
		scanf("%d %d",&X,&Y);
		V[X].push_back(Y);
	}

	for(int x = 0; x < 10000; x++)sort(V[x].begin(),V[x].end());

	ll ans = 0;
	int left,right,m;
	int left_index,right_index;

	for(int i = 0; i < A; i++){
		for(int x = max(0,info[i].x-4*R); x <= min(9999,info[i].x+4*R); x++){
			if(V[x].size() == 0 || V[x][0] > info[i].y+4*R || V[x][V[x].size()-1] < info[i].y-4*R)continue;

			left = 0,right = V[x].size()-1,m = (left+right)/2;
			while(left <= right){
				if(V[x][m] >= info[i].y-4*R){
					left_index = m;
					right = m-1;
				}else if(V[x][m] < info[i].y-4*R){
					left = m+1;
				}else{
					right = m-1;
				}
				m = (left+right)/2;
			}

			left = 0,right = V[x].size()-1,m = (left+right)/2;
			while(left <= right){
				if(V[x][m] <= info[i].y+4*R){
					right_index = m;
					left = m+1;
				}else if(V[x][m] > info[i].y+4*R){
					right = m-1;
				}else{
					left = m+1;
				}
				m = (left+right)/2;
			}

			for(int k = left_index; k <= right_index; k++){
				if(calc_dist(info[i].x,info[i].y,x,V[x][k]) <= 16*R*R){
					ans++;
				}
			}
		}
	}

	printf("%lld\n",ans);
}

int main(){

	while(true){
		scanf("%d %d %d",&A,&B,&R);
		if(A == 0 && B == 0 && R == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 5404
// ABC 151-C
// 2020.1.12 bal4u

#include <stdio.h>
#include <string.h>

int WA[100005];
int AC, NG;

int main()
{
	int p, N, M;
	char S[5];
	
	scanf("%d%d", &N, &M);
	while (M--) {
		scanf("%d%s", &p, S);
		if (S[0] == 'A') {
			if (WA[p] >= 0) {
				++AC;
				NG += WA[p];
				WA[p] = -1;
			}
		} else {
			if (WA[p] >= 0) ++WA[p];
		}
	}
	printf("%d %d\n", AC, NG);
	return 0;
}


Measured memory_bytes: 512
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
double calcTime()
{
    struct::timespec getTime;
    clock_gettime(CLOCK_MONOTONIC, &getTime);
    return (getTime.tv_sec + getTime.tv_nsec*1e-9);
}

mt19937 mrand(random_device{}());

ll v[400];
ll days[30] = {};
ll c[30];
ll s[370][30];
ll ans[400] = {};
ll D;

ll get_score(){
    ll score = 0;
    rep(i,0,26) days[i] = 0;

    rep(i,0,D){
        score += s[i][ans[i]];
        days[ans[i]] = i+1;
        rep(j,0,26){
            score -= c[j] * (i+1 - days[j]); 
        }
    }
    return score;
}

void solve(){
    double start = calcTime();
    cin >> D;
    rep(i,0,26) cin >> c[i];

    rep(i,0,D){
        rep(j,0,26){
            cin >> s[i][j];
        }
    }

    rep(i,0,D){
        ll r = mrand() % 26;
        ans[i] = r;
        days[r] = i+1;
    }
    ll score = get_score();
    ll iter = 0;


    while(true){
        double x = calcTime() - start;
        if(x >= 1.9) break;
        ll temp = (ll)(10.0 * (x - 1.9) * (x - 1.9));
        iter++;
        ll d = mrand() % D;
        ll q = mrand() % 26;
        ll prev_val = ans[d];
        ans[d] = q;
        ll new_score = get_score();
        if(new_score > score){
            score = new_score;
        }else{
            ll r = mrand() % 100;
            if(r <= temp){
                score = new_score;
            }else{
                ans[d] = prev_val;
            }
        }
    }
    // print(score);
    rep(i,0,D) print(ans[i]+1);

}

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

Measured memory_bytes: 3764
import java.util.Scanner;

public class Main {
    public static void main (String[] srgs){
        Scanner sc = new Scanner(System.in); // ??????????????????????????????.

        // ?????????????????? int ?????¨??????????????\???????????????.
        // ??????????????????????????? 0 ????????????.
        while (true) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if (H == 0 && W == 0) { break; }

            // H * W ???????????¢???????????????.
            for (int i = 0; i < H; i ++) {
                for (int j = 0; j < W; j ++) {
                    System.out.print("#");
                }
                System.out.print("\n");
            }
            System.out.print("\n");
        }
    }
}

Measured memory_bytes: 38268
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include<math.h>
using namespace std;

int main()
{
   string s1,s2;
   cin>>s1;
   cin>>s2;
   int count=0;
   for(int i=0;i<s1.size();i++){
       
       if(s1.at(i)!=s2.at(i))
       count++;
       
   }
   
   cout<<count;

    return 0;
}


Measured memory_bytes: 3916
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void DFS(string str,int V,int depth,vector<int> &data)
{
  str += char(V+'0');
  // DEBUG(str);
  data.push_back(stol(str));
  if(depth == 11)return;
  for (int i = -1; i <= 1; i++)
  {
    if(!(i+V >= 0 && i+V <= 9))continue;
    DFS(str,V+i,depth+1,data);
  }
  return;
}
void solve(void)
{
  int K;
  cin>>K;
  vector<int> data;
  for (int i = 1; i < 10; i++)
  {
    DFS("",i,1,data);
  }
  sort(ALL(data));
  // DEBUG(data);
  cout<<data[K-1]<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 10604
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

// [1, n]
int bit[100001], n;

// return a_1 + ... + a_i
int sum(int i) {
  int s = 0;
  while (0 < i) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}

// a_i += x
void add(int i, int x) {
  while (i <= n) {
    bit[i] += x;
    i += i & -i;
  }
}

int main() {
  cin >> n;
  int q;
  cin >> q;
  REP(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com) {
      cout << sum(y) - sum(x - 1) << endl;
    } else {
      add(x, y);
    }
  }
  return 0;
}


Measured memory_bytes: 3484
#include <memory.h>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cctype>
#include <cstring>
#include <climits>
#include <cmath>
#include <vector>
#include <string>
#include <memory>
#include <numeric>
#include <limits>
#include <functional>
#include <tuple>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iostream>

using namespace std;

#define PROFILE_START(i)    clock_t start##i = clock()
#define PROFILE_STOP(i)     fprintf(stderr, "elapsed time (" #i ") = %f\n", double(clock() - start##i) / CLOCKS_PER_SEC)

// https://atcoder.jp/contests/abc149/tasks/abc149_e?fbclid=IwAR0nHOgZ-UygqFHB08BPLs_o3_6r5K2TB_Rd0fV3Ijhcru1aSaIaRQQjo4Y
// E - Handshake

typedef long long           ll;
typedef unsigned long long  ull;

tuple<ll, ll, ll> calc(const vector<int>& A, const vector<ll>& prefixSum, int x) {
    int N = int(A.size());

    ll cnt = 0;
    ll sum = 0;
    ll minX = numeric_limits<ll>::max();

    int j = N - 1;
    for (int i = 0; i < N; i++) {
        while (j >= 0 && (A[i] + A[j]) >= x)
            j--;

        if (j < N - 1) {
            minX = min(minX, 0ll + A[i] + A[j + 1]);
            sum += prefixSum[N] - prefixSum[j + 1] + 1ll * A[i] * (N - 1 - j);
            cnt += N - 1 - j;
        }
    }

    return make_tuple(cnt, sum, minX);
}

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

    int N;
    ll M;
    cin >> N >> M;

    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    sort(A.begin(), A.end());

    vector<ll> prefixSum(N + 1);
    for (int i = 0; i < N; i++)
        prefixSum[i + 1] = prefixSum[i] + A[i];

    int lo = 1, hi = A.back() * 2ll;
    while (lo <= hi) {
        int mid = lo + (hi - lo) / 2;

        auto t = calc(A, prefixSum, mid);

        if (get<0>(t) >= M)
            lo = mid + 1;
        else
            hi = mid - 1;
    }

    auto t = calc(A, prefixSum, hi);
    ll ans = get<1>(t) - get<2>(t) * (get<0>(t) - M);
    cout << ans << endl;

    return 0;
}


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

namespace ABC124_B_Great_Ocean_View
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] height = Console.ReadLine().Split(' ').Select((s) => int.Parse(s)).ToArray();
			int peak = height[0];
			int count = 1;

			for(int i = 1; i < n; i++)
			{
				if(peak > height[i])
				{
					continue;
				}
				else
				{
					peak = height[i];
					count++;
				}
			}

			Console.WriteLine(count);
		}
	}
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main(){
	long i,j,n,m,x,y,k;
  cin>>n>>k;
  vector<long > a(n),dp(n+3,1e11);
  for(i=0;i<n;i++)
    cin>>a[i];
  dp[0]=0;
  for(i=0;i<n;i++){
    for(j=i+1;j<=(i+k) && j<n;j++){
    	dp[j]=min(dp[i]+abs(a[i]-a[j]),dp[j]);
    }
  }
  cout<<dp[n-1]<<endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());


const int N = 300+1;
ld dp[N][N][N];
int cnt[4];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);

	int n;
	cin >> n;

	For(i,n) {
		int a;
		cin >> a;
		cnt[a]++;
	}

	dp[0][0][0] = 0;
	for (int k=0; k<=n; k++) {
		for (int j=0; j+k<=n; j++) {
			for (int i=0; i+j+k<=n; i++) {
				if (i==0 && j==0 && k==0) continue;
				dp[i][j][k] = 1;
				if (i>0) dp[i][j][k] += (ld)i/n * dp[i-1][j][k];
				if (j>0 && i+1<=n) dp[i][j][k] += (ld)j/n * dp[i+1][j-1][k];
				if (k>0 && j+1<=n) dp[i][j][k] += (ld)k/n * dp[i][j+1][k-1];
				dp[i][j][k] /= (ld)(i+j+k)/n;
			}
		}
	}
	cout << dp[cnt[1]][cnt[2]][cnt[3]] << nl;

	return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a * n, b) << endl;
    
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b>>c;
    for(int i=1;i<b;i++){
        if((b*i+c)%a==0){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 305;

int ans [MAX_N][MAX_N];

int main () {
  ios::sync_with_stdio(false);
  
  int n, m, K;
  cin >> n >> m >> K;

  int cur = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;

      if (c == '#') {
        cur++;
        ans[i][j] = cur;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 1; j < m; j++) {
      if (ans[i][j] == 0) {
        ans[i][j] = ans[i][j - 1];
      }
    }

    for (int j = m - 2; j >= 0; j--) {
      if (ans[i][j] == 0) {
        ans[i][j] = ans[i][j + 1];
      }
    }
  }

  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (ans[i][j] == 0) {
        ans[i][j] = ans[i - 1][j];
      }
    }
  }

  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      if (ans[i][j] == 0) {
        ans[i][j] = ans[i + 1][j];
      }
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << '\n';
  }
}


Measured memory_bytes: 4060
_, _, m = STDIN.gets.split.map(&:to_i)
a = STDIN.gets.split.map(&:to_i)
b = STDIN.gets.split.map(&:to_i)

ans = a.min + b.min

m.times do
    xyc = STDIN.gets.split.map(&:to_i)
    t = a[xyc[0]-1] + b[xyc[1]-1] - xyc[2]
    ans = t if ans > t
end

puts ans

Measured memory_bytes: 19852
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll mod=1e9+7 ;
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 (b<a) { a = b; return 1; } return 0; }
//-------------------
int n;
ll a[100];

int main(){
	cin >> n;
	//vector<ll> v(n,LINF);
	FOR(i,1,n){
		cin >> a[i];
	}
	bool ok = false;
	FOR(i,1,n){
		FOR(j,i,n){
			bool cur = true;
			FOR(k,2,n){
				if(k!=i && k!=j && k!=i+1 && k!=j+1){
					if(a[k-1] >= a[k]) cur = false;
				}else{
					if(k==i && a[j] <= a[k-1]) cur = false;
					if(k==j && a[i] <= a[k-1]) cur = false;
					if(k==i+1 && a[j] >= a[k]) cur = false;
					if(k==j+1 && a[i] >= a[k]) cur = false;
				}
			}
			if(cur) ok = cur;
		}
	}

	cout << (ok? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[]args) {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int suji=0;


        for(int x=a;x<b+1;x++){
            if(c%x==0){
                suji++;
            }
        }
        System.out.println(suji);
    }
}


Measured memory_bytes: 26352
#include <iostream>

using namespace std;

int main() 
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if(a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if(b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if(b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else if(c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
    else if(c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
}


Measured memory_bytes: 3112
n = int(input())
a = list(map(int,input().split()))
p = [0] * 8
q = 0
for i in a:
    if i // 400 >= 8:
        q += 1
    else:
        p[i//400] += 1
pp = 0
for qqqq in p:
    if qqqq != 0:
        pp += 1
print(max(1,pp), pp + q)


Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
    vector<int> a(3);
    scanf("%d %d %d", &a[0], &a[1], &a[2]);
    sort(a.begin(), a.end());
    printf("%d %d %d\n", a[0], a[1], a[2]);

    return 0;
}


Measured memory_bytes: 2780
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

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

  size_t n;
  cin >> n;

  vector <ll> a (n);
  rep (i, n) cin >> a [i];

  ll c = 1;
  rep (i, n)
  {
    if (a [i] == c)
    {
      ++ c;
    }
  }

  if (c == 1)
  {
    cout << "-1" << endl;
  }
  else
  {
    cout << n - (c - 1) << endl;
  }
}


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

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

            int digit_10 = N / 10;
            int digit_1 = N % 10;

            if (digit_1 == 9 || digit_10 == 9) {
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 13140
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int m = int.Parse(input[1]);
		input = Console.ReadLine().Split(' ');
        int[] a = new int[n];
        for(int i =0; i< n; i++) a[i] = int.Parse(input[i]);
        int sum = 0;
        for(int i=0; i<n; i++)
        {
          sum += a[i];
        }
        Array.Sort(a);
        if(a[n - m] < (double)sum / m / 4) Console.WriteLine("No");
        else Console.WriteLine("Yes");

	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

long double dp[3300][3300];//i枚投げて　j枚表　確率

int main(){
  int n;
  cin>>n;
  vector<long double> p(n+1);
  rep(i,n) cin>>p[i+1];
  ////
  //cout<<p[2]<<endl;
  dp[1][1]=p[1];
  dp[1][0]=1-p[1];
  for(int i=1;i<=n;i++){
     for(int j=0;j<=n;j++){
        dp[i][j]+=dp[i-1][j]*(1-p[i]);
        if(j-1>=0)dp[i][j]+=dp[i-1][j-1]*p[i];
    //   cout<<dp[i][j]<<endl;
     }
  }
  long double ans=0;
  for(int i=n;i>=(n+1)/2;i--){
   ans+=dp[n][i]; 
 //   cout<<dp[n][i]<<endl;
  }
  
  cout<<fixed<<setprecision(10);
  cout<<ans<<endl;
}

Measured memory_bytes: 155904
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 

		Dice d = new Dice(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
		int q = sc.nextInt();
		
		for (int i = 0; i < q; i++) {
			System.out.println(d.getEast(sc.nextInt(), sc.nextInt()));
		}

		sc.close();
	}
	
	private static class Dice {
		int[] s;
		int up;
		int north;
		int east;

		Dice(int s1, int s2, int s3, int s4, int s5, int s6) {
			s = new int[6];
			s[0] = s1;
			s[1] = s2;
			s[2] = s3;
			s[3] = s4;
			s[4] = s5;
			s[5] = s6;
			up = 1;
			north = 5;
			east = 3;
		}
		
		void N() {
			int temp = 7 - north;
			north = up;
			up = temp;
		}
		
		void S() {
			int temp = 7 - up;
			up = north;
			north = temp;
		}
		
		void E() {
			int temp = 7 - east;
			east = up;
			up = temp;
		}

		void W() {
			int temp = 7 - up;
			up = east;
			east = temp;
		}
		
		int now() {
			return s[up - 1];
		}

		public int getEast(int upValue, int southValue) {
			int upNow;
			for (upNow = 1; upNow <= 6; upNow++) {
				if (s[upNow - 1] == upValue) {
					break;
				}
			}
			int northNow;
			for (northNow = 1; northNow <= 6; northNow++) {
				if (s[northNow - 1] == southValue) {
					northNow = 7 - northNow;
					break;
				}
			}
			
			char[] cmd = "EEEENEEEENEEEENEEEENWNEEEENNEEEE".toCharArray();
			for (int i = 0; i < cmd.length; i++) {
				if (cmd[i] == 'N') {
					N();
				} else if (cmd[i] == 'S') {
					S();
				} else if (cmd[i] == 'E') {
					E();
				} else if (cmd[i] == 'W') {
					W();
				}
				if (northNow == this.north && upNow == this.up) {
					return s[east - 1];
				} else if (northNow == 7 - this.north && upNow == this.up) {
					return s[7 - east - 1];
				} else if (northNow == this.north && upNow == 7 - this.up) {
					return s[7 - east - 1];
				}
			}
			
			return -1;
		}
	}
}

Measured memory_bytes: 17300
#include <cstdio>
#include <string>
#include <queue>

using namespace std;

int main()
{
    char com[20];
    priority_queue<int> PQ;

    while (1) {
        scanf("%s", com);
        if (com[0] == 'i') {
            int key;
            scanf("%d", &key);
            PQ.push(key);
        } else if (com[1] == 'x') {
            printf("%d\n", PQ.top());
            PQ.pop();
        } else if (com[0] == 'e') {
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 6492
#include<bits/stdc++.h>
using namespace std;
static const int MAX = 1000;

void trace(int A[], int N){
    int i;
    for(i=0;i<N;i++){
        if(i>0) cout << " ";
        cout << A[i];

    }
    cout << endl;
}

void insertionSort(int A[],int N){
    int j,i,v;
    for(i=1;i<N;i++){
        v = A[i];
        j=i-1;
        while(j>=0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A,N);
    }
}

int main (){

    int n,A[MAX];

    cin >> n;

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

    trace(A,n);
    insertionSort(A,n);

    return 0;

}


Measured memory_bytes: 3084
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_B
  * x ??? 3 ???
  * ???????????´??° x ?????????????????§???x ?????????????¨????????????????????????????????????°?????????????????????????????????
  */
object Main {
  def main(args: Array[String]): Unit = {
    val x = io.StdIn.readInt()
    val xCubic = Math.pow(x, 3).toInt
    println(xCubic)
  }
}

Measured memory_bytes: 43492
#include <bits/stdc++.h>
using namespace std;
//Coded in Dongge Jifang 2
//IP address: 192.168.10.233
#define INT long long
#define PPP pair<INT,pair<INT,INT> > 
#define mppp(a,b,c) make_pair(a,make_pair(b,c))

set<PPP> se;

void add(INT s,INT t,INT x){
	set<PPP>::iterator it=se.lower_bound(mppp(s,-1,-1));
	INT lst=-1;
	vector<PPP> zz;
	while(1){
		if(it==se.end()){
			break;
		}
		PPP z=*it;
		it++;
		INT q=z.first,p=z.first-z.second.second+z.second.first;
		if(t<p){
			break;
		}
		if(s<=p&&q<=t){
			se.erase(z);
			lst=z.second.second;
		}else if(s<=p){
			se.erase(z);
			zz.push_back(mppp(q,t+1,q));
			lst=t;
		}else if(q<=t){
			se.erase(z);
			zz.push_back(mppp(s-1,p,s-1));
			lst=q;
		}else{
			se.erase(z);
			zz.push_back(mppp(s-1,p,s-1));
			zz.push_back(mppp(q,t+1,q));
			lst=t;
		}
	}
	if(lst!=-1){
		se.insert(mppp(x,lst,lst));
	}
	for(int i=0;i<zz.size();i++){
		se.insert(zz[i]);
	}
}

int main(){
	int num;
	INT mod;
	scanf("%d%lld",&num,&mod);
	se.insert(mppp(mod-1,0,mod-1));
	INT sum=0;
	for(int p=0;p<num;p++){
		INT len;
		int md;
		scanf("%lld%d",&len,&md);
		len<<=1;
		if(md==1){
			if(len>mod){
				puts("-1");
				return 0;
			}
			set<PPP>::iterator it=se.begin();
			INT z=it->first-it->second.second+it->second.first+sum;
			if(z%mod<=mod-len){
				add(z/mod*mod+mod-len-sum+1,z/mod*mod+mod-sum-1,z/mod*mod+mod-sum);
			}else{
				add(z-sum,z/mod*mod+mod-sum-1,z/mod*mod+mod-sum);
				add(z/mod*mod+mod+mod-len-sum+1,z+mod-sum,z/mod*mod+mod+mod-sum);
			}
		}
		sum+=len;
	}
	INT ans=0x3f3f3f3f3f3f3f3fLL;
	set<PPP>::iterator it=se.begin();
	while(1){
		if(it==se.end()){
			break;
		}
		PPP z=*it;
		it++;
		ans=min(ans,sum+z.first-z.second.second);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long cur = 100;
  long long x;
  cin >> x;
  int ans = 0;
  while(cur < x) {
    cur = cur + cur/100;
    ans++;
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tc = 1;
  // cin >> tc;
  for(int i = 1; i <= tc; ++i) {
    // cout << "Case #" << i <<": ";
    solve();
  }
  return 0;
}

Measured memory_bytes: 3640
A,B,K=map(int, input().split())
List = [A,B]
for i in range(K):
  if(List[i]%2==1):
    List[i]=(List[i]-1)//2
    List[i+1]=List[i+1]+List[i]
    List.append(List[i])
  else:
    List[i]=(List[i])//2
    List[i+1]=List[i+1]+List[i]
    List.append(List[i])
#print(List[-3],List[-2])
if(K%2==1):
  print(List[-1],List[-2])
else:
  print(List[-2],List[-1])

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;

using i32 = int;
using i64 = long long;

#define REP(i, stop) for (int i = 0; i < stop; ++i)
#define ALL(v) (v).begin(), (v).end()

template<typename T>
T read() {
  T a = 0;
  for(;;) {
    char c = getchar();
    if (c & 16) {
      a = a * 10 + c - 48;
    } else {
      return a;
    }
  }
}

i64 A[1000], B[1000], C[1000];
i64 AB[3000];
signed main() {
//  i32 x, y, z, k;
//  scanf("%d%d%d%d", &x, &y, &z, &k);
  i32 X = read<i32>(),
      Y = read<i32>(),
      Z = read<i32>(),
      K = read<i32>();
//  REP(i, x) scanf("%lld", &A[i]);
//  REP(i, y) scanf("%lld", &B[i]);
//  REP(i, z) scanf("%lld", &C[i]);
  REP(i, X) A[i] = -read<i64>();
  REP(i, Y) B[i] = -read<i64>();
  REP(i, Z) C[i] = -read<i64>();
  sort(A, A + X);
  sort(B, B + Y);
  sort(C, C + Z);
  using P = pair<i64, i64>;
  set<P> Q;
  Q.insert({A[0] + B[0], 0});
  i32 L = min(K, X * Y);
  i32 AB_i = 0;
  REP(_, L) {
    i64 p = (*Q.begin()).first;
    i64 q = (*Q.begin()).second;
    AB[AB_i] = p;
    ++AB_i;
    Q.erase(Q.begin());
    i32 u = q & 1023;
    i32 v = q >> 10 & 1023;
    i64 u1 = q + 1;
    i64 v1 = q + (1 << 10);
    if (u + 1 < X) Q.insert({A[u + 1] + B[v], u1});
    if (v + 1 < Y) Q.insert({A[u] + B[v + 1], v1});
  }
  Q.clear();
  Q.insert({AB[0] + C[0], 0});
  REP(_, K) {
    i64 p = -(*Q.begin()).first;
    i64 q = (*Q.begin()).second;
    printf("%lld\n", p);
    Q.erase(Q.begin());
    i32 u = q & 4095;
    i32 v = q >> 12 & 1023;
    i64 u1 = q + 1;
    i64 v1 = q + (1 << 12);
    if (u + 1 < L) Q.insert({AB[u + 1] + C[v], u1});
    if (v + 1 < Z) Q.insert({AB[u] + C[v + 1], v1});
  }
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;
typedef long long ll;

int main()
{
	int N, M;
	scanf("%d %d", &N, &M);
	
	if(N == M){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}

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

using namespace std;

int main () {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    for (int i = 0;i<N;i++) {
        cin >> A[i];
        B[i] = A[i];
    }

    sort(B.begin(), B.end());
    for (int i=0;i<N;i++) {
        int li = N-1;
        if (A[i] != B[li]) {
            cout << B[li] << endl;
            continue;
        }
        li--;
        cout << B[li] << endl;
    }
    return 0;
}



Measured memory_bytes: 3200
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
u=input().rstrip().split(" ")
if "Y" in u:
    print("Four")
else:
    print("Three")

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

int main(void){
        int a,b,c;
        int retval;
        cin>>a>>b>>c;
        for(int i=a; i<=b; i++) {
                if(c%i==0) {
                        retval+=1;
                }
        }
        cout<<retval<<endl;
        return 0;
}



Measured memory_bytes: 3108