akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c >= 22) {
		cout << "bust";
	}
	else {
		cout << "win";
	}
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from collections import deque
import copy
str_list_befor = ['0', '1', '2','3','4','5', '6', '7','8','9']
str_list_after = ['a', 'b', 'c','d','e','f', 'g', 'h','i','j']

n = int(input())

dq = deque()
dq.append([0])
if n > 1:
    for i in range(n-1):
        # print("i: " + str(i))
        for j in range(len(dq)):
            # print("j: " + str(j))
            prv = dq.popleft()
            for j in range(max(prv)+2):
                tmp = copy.copy(prv)
                tmp.append(j)
                # print(tmp)
                dq.append(tmp)
            # print(dq)

for i in range(len(dq)):
    result = ""
    tmp_r = dq.popleft()
    result = "".join(map(str, tmp_r))
    for j in range(len(str_list_befor)):
        result = result.replace(str_list_befor[j], str_list_after[j])

    print(result)


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

typedef long long ll;

const ll Inf = 9000000000000000000ll;
const int Maxn = 200005;

int n;
ll a[Maxn];
ll sum;
ll res = Inf;

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
        sum += a[i];
    }
    ll oth = 0;
    for (int i = 0; i + 1 < n; i++) {
        sum -= a[i]; oth += a[i];
        res = min(res, abs(sum - oth));
    }
    printf("%lld\n", res);
    return 0;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
enum = enumerate

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def main():
	N,C,K = linput()
	vA = vinput(N)
	vA.sort()
	#vA.reverse()
	
	res = 0
	#i = 0   #..N
	cnt = 0 #..C
	x = 0   #(T-x)..K
	
	for a in vA:
		if a<=x and cnt<C:
			cnt += 1
			continue
		cnt = 1
		res += 1
		x = a+K
	
	#sT = "No Yes".split()
	#print(sT[res])
	print(res)

if __name__ == "__main__":
	main()


Measured memory_bytes: 77392
#include <bits/stdc++.h>
using namespace std;
int ans[200000];
int a[200000];
int main(void)
{
	int n,k;
	cin >> n>>k;

	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	ans[0]=0;
	for (int i = 1; i <=k; ++i)
	{
		int flag=0;
		for (int j = 0;j < n; ++j)
		{
			if(i-a[j]>=0)
			{
				if(ans[i-a[j]]==0)
				{
					flag=1;
					break;
				}
			}
			else
			{
				break;
			}
		}
		if(flag==0)
		{
			ans[i]=0;
		}
		else
		{
			ans[i]=1;
		}
	}
	if(ans[k]==1)
	{
		printf("First\n");
	}
	else
	{
		printf("Second\n");
	}
}

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int n;
    cin >> n;
    vector<int> a(n);

    rep(i, n)
    {
        cin >> a[i];
    }
    int l = 0;
    int r = n - 1;
    ll left = a[l];
    ll right = a[r];
    while (l < r - 1)
    {
        if (left < right)
        {
            l++;
            left += a[l];
        }
        else
        {
            r--;
            right += a[r];
        }
    }
    
    c(abs(left - right));
    return 0;
}

Measured memory_bytes: 1024
c1, c2, c3 = map(int, input().split())
c4, c5, c6 = map(int, input().split())
c7, c8, c9 = map(int, input().split())
if c4-c1==c5-c2 and c5-c2 == c6-c3 and c7-c4 ==c8-c5 and c8-c5 == c9-c6:
    if c2-c1 == c5-c4 and c5-c4 == c8-c7 and c3-c2 == c6-c5 and c6-c5 == c9-c8:
      print('Yes')
    else:print('No')
else:
  print('No')

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int main()
{
    char st[1000];
    int n,i,sum=0,r,m,len,c=0,c1=0;
    scanf("%s",st);
    len=strlen(st);
    for(i=0;i<len;i++){
        if(st[i]=='+'){
            c++;
        }
        else if(st[i]=='-'){
            c1++;
        }
    }
    m=c-c1;
    printf("%d\n",m);
    return 0;
}


Measured memory_bytes: 128
import collections

n = int(input())
Vn = list(map(int, input().split(' ')))
Es, Os = Vn[0:n:2], Vn[1:n:2]

if (Vn.count(Vn[0]) == len(Vn)):
    print(n//2)
    exit()

# 各集合Es, Os の最頻値を val_Es_1, val_Os_1 とする
# また、最頻値の出現回数をそれぞれ、cnt_Es_1, cnt_Os_1 とする
val_Es_1, cnt_Es_1 = collections.Counter(Es).most_common()[0]
val_Os_1, cnt_Os_1 = collections.Counter(Os).most_common()[0]

if val_Es_1 != val_Os_1:
    print(n - (cnt_Es_1 + cnt_Os_1))
    exit()

# 各集合Es, Os の2番目の最頻値を val_Es_2, val_Os_2 とする
# また、最頻値の出現回数をそれぞれ、cnt_Es_2, cnt_Os_2 とする
val_Es_1, cnt_Es_2 = collections.Counter(Es).most_common()[1]
val_Os_1, cnt_Os_2 = collections.Counter(Os).most_common()[1]

print(min(n - (cnt_Es_1 + cnt_Os_2), n - (cnt_Es_2 + cnt_Os_1)))
exit()




Measured memory_bytes: 17500
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	max := a[0]
	count := 1
	for i := 1; i < n; i++ {
		if a[i] >= max {
			max = a[i]
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Spandan Mishra
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BCraneAndTurtle solver = new BCraneAndTurtle();
        solver.solve(1, in, out);
        out.close();
    }

    static class BCraneAndTurtle {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.readInt();
            int legs = in.readInt();

            for (int i = 0; i <= n; i++) { // crane
                for (int j = 0; j <= n; j++) { // turtle
                    if ((i * 2 + j * 4) == legs && i + j == n) {
                        System.out.println("Yes");
//                    System.out.println("cranes =" + i + " turtles =" + j);
                        return;
                    }
                }
            }

            System.out.println("No");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32292
using System;

class E
{
	static void Main()
	{
		var n = Array.ConvertAll($"0{Console.ReadLine()}".ToCharArray(), x => x - '0');
		var r = 0;
		for (int i = n.Length - 1; i >= 0; i--)
			if (n[i] < 5 || n[i] == 5 && n[i - 1] < 5)
			{
				r += n[i];
			}
			else
			{
				r += 10 - n[i];
				n[i - 1]++;
			}
		Console.WriteLine(r);
	}
}


Measured memory_bytes: 38004
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

int main() {
	int n; std::cin >> n;
	std::vector<long long int> bars(n); for (auto& b : bars) std::cin >> b;
	for (auto i = 1; i < bars.size(); ++i) bars[i] += bars[i - 1];
	auto greater = std::lower_bound(bars.begin(), bars.end(), (bars.back() + 1) / 2);
	auto min_price = *greater - (bars.back() - *greater);
	if (greater != bars.begin()) {
		auto smaller = std::prev(greater);
		min_price = std::min(min_price, (bars.back() - *smaller) - *smaller);
	}
	std::cout << min_price << '\n';
}

Measured memory_bytes: 1792
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
 
from functools import reduce
# from math import *
from fractions import *
H, W = map(int, readline().split())
S = [0 for i in range(H)]
for i in range(H):
    S[i] = readline().decode().strip()

from collections import deque
def bfs(start, H, W):
    INF = 10 ** 9
    dist = [INF] * (H * W)
    q = deque([(start[0], start[1], 100)])
    dist[start[0] * W + start[1]] = 0
    while q:
        (i, j, z) = q.popleft()
        d = dist[i * W + j]
        for dy in range(-1, 2):
            for dx in range(-1, 2):
                if dx * dy != 0:
                    continue
                if dx == dy:
                    continue
                if i + dy < 0 or i + dy >= H or j + dx < 0 or j + dx >= W:
                    continue
                if S[i + dy][j + dx] == '#':
                    continue
                if dist[(i + dy) * W + j + dx] != INF:
                    continue
                dist[(i + dy) * W + j + dx] = d + 1
                q.append((i + dy, j + dx, 100))
    return max(x for x in dist if x < INF)

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        start = (i, j)
        ans = max(ans, bfs(start, H, W))
print(ans)


Measured memory_bytes: 71512
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();

       if(a + b >=10) {
       System.out.println("error");
       } else {
       System.out.println(a + b);
       }
  }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    Int H; cin >> H;
    Int ans = 0, cnt = 1;
    while (H) {
        if (H == 1) {
            ans += cnt;
            H = 0;
        } else {
            ans += cnt;
            cnt *= 2;
            H = H / 2;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    L = readline().strip()

    eq, less = 2, 1
    for d in L[1:]:
        if d == '1':
            less = (eq + 3 * less) % MOD
            eq = 2 * eq % MOD
        else:
            less = 3 * less % MOD

    print((eq + less) % MOD)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 69060
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	int len,i,j;
	char s[105];
	bool ok=false;
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<len;i++)
	{
		if(s[i]=='C')
		{
			for(j=i+1;j<len;j++)
			{
				if(s[j]=='F') ok=true;
			}
		}
	}
	if(ok==true) cout<<"Yes"<<endl;
	if(ok==false)cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    char S[4];
    int i;

    gets(S);

    if(S[0] == 'S' && S[1] == 'S' && S[2] == 'S')
        printf("0\n");
    else if(S[0] == 'R' && S[1] == 'R' && S[2] == 'R')
            printf("3\n");
    else if(S[0] == 'S'){
        if(S[1] == 'R' && S[2] == 'R')
            printf("2\n");
        else
            printf("1\n");
    }
    else if(S[0] == 'R'){
        if(S[1] == 'R')
            printf("2\n");
        else
            printf("1\n");
    }

    return 0;
}


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

using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 10;
vector< int > adj[MAXN];
int n, m;
ll a, b, c;
bool h[MAXN], mark[MAXN];
bool ok = true;
void dfs(int u){
	//cout << u << endl;
	mark[u] = true;
	for(int i = 0; i < adj[u].size(); i ++){
		int v = adj[u][i];
		if( !mark[v] )
			h[v] = !h[u], dfs(v);
		else if(h[u] == h[v])  ok = false;
	}
	return;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < m; i ++){
		int u, v;
		cin >> u >> v, u --, v --;
		adj[u].push_back(v), adj[v].push_back(u);
	}
	for(int i = 0; i < n; i ++){
		if( !mark[i] ){
			ok = true;
			dfs(i);
			if( adj[i].empty()) a ++, mark[i] = true;
			else if( ok ) b ++;
			else c ++;
		}
	}
	ll ans = 0LL;
	//cout << a << " " << b << " " << c << endl;
	ans += a*a, ans += a*(1LL* n - a)*2LL, ans += 2LL*b*b, ans += 2LL*b*c, ans += c*c;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15468
#include "bits/stdc++.h"
using namespace std;
int main() {
	long W, A, B;
	cin >> W >> A >> B;
	long left = B - A - W, right = A - B - W;
	long ans = 0;
	if (left < 0 && right < 0) ans = 0;
	else ans = max(left, right);
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n;
  cin >> n;
  
  map<int,int> p;
  rep(i,n){
  int x;
  cin>>x;
    if(p.count(x-1)) p.at(x-1)++;
    else p[x-1]=1;
    if(p.count(x)) p.at(x)++;
    else p[x]=1;
    if(p.count(x+1)) p.at(x+1)++;
    else p[x+1]=1;    
  }
  
  int ans=0;
  for(auto x:p){
    ans=max(ans,x.se);
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <map>

using namespace std;

int main(){
    int n; cin >> n;
    int ans = n/1.08;
    //cout << "ans: " << ans << endl;
    //cout << "ans+1: "<< (ans+1)*1.08 << endl;
    if(  (int)(ans * 1.08) == n) cout << ans << endl;
    else if( (int)((ans+1)*1.08) == n) cout << ans+1 << endl;
    else cout << ":(" << endl;
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<pair<ll,ll>> vec(n);
  for(int i=0;i<n;i++){
    ll x,l;
    cin>>x>>l;
    ll p=x-l;
    ll q=x+l;
    vec[i]=make_pair(q,p);
  }
  sort(vec.begin(),vec.end());
  int ans=1;
  ll z=vec[0].first;
  for(int i=1;i<n;i++){
    if(z<=vec[i].second){
      ans++;
      z=vec[i].first;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,num=0;
	cin>>a>>b>>c;
	b=b+c;
	a-=(b+c);
	while(a>=0)
	{
		a-=b;
		num++;
	}
	if(num<0)
	{
		cout<<0<<endl;
		return 0;
	}
	cout<<num<<endl;
	return 0;
}

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

using namespace std;

int main()
{
	string str;
	
	while (getline(cin, str)){
		while (1){
			if(str.find("this") != -1 || str.find("the") != -1 || str.find("that") != -1){
           		break;
        	}
		
			for (int i = 0; i < str.size(); i++){
				if (str[i] != ' ' && str[i] != '.'){
					if (str[i] == 'z') str[i] = 'a';
					else str[i]++;
				}
			}
		
		}
		cout << str << endl;
	}
}

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

using namespace std;

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

#define int ll

main(){
	int n;
	cin >> n;
	char s[n+1];
	cin >> s;

	char pass[4];
	pass[3] = 0;

	int ans = 0;

	for(int i=0;i<1000;i++){
		pass[2] = '0'+i%10;
		pass[1] = '0'+(i/10)%10;
		pass[0] = '0'+(i/100)%10;
		bool b2 = false;
		bool b1 = false;
		bool b0 = false;
		
		for(int j=0;j<n;j++){
			if(!b0 && pass[0]==s[j]){
				b0 = true;
			}else if(b0 && !b1 && pass[1]==s[j]){
				b1 = true;
			}else if(b0 && b1 && !b2 && pass[2]==s[j]){
				b2 = true;
			}
		}
		if(b0 && b1 && b2){
			ans++;
			//cout << pass << endl;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define pi 3.14159265358979323846
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--)
  
long long fact(long long a, long long b){
    int r= max(a, b);
    int v= min(a, b);
    int l=1;
    // if(v==0)
    for(int i=r+1; i<=a+b; i++){
        l*=i;
    }
    for(int i=v; i>=2; i--){
        l/=i;
    }
    return l;
}

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

int powr(int a) { 
    int var=1;
    for(int i=0; i<a; i++){
        var*=2;
    }
    return var;
}

signed main(){   
    fast;
    int n, d;
    cin >> n >> d;
    int a, b, c=0;
    rep(i,0,n){
        cin >> a >> b;
        if(a*a+b*b<=d*d)
            c++;
    }
    cout << c;
}

Measured memory_bytes: 3628
n = int(input())
li = list(map(int,input().split()))
count = 0

for i in range(n-2):
    s = li[i:i+3]
    if s[0] > s[1] and s[1] > s[2]:
        count += 1
    elif s[0] < s[1] and s[1] < s[2]:
        count += 1

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){

	int n;
	cin >> n;
	int b[1000000] = {};

	rep(i,n-1) {
		cin >> b[i];
	}

	int ans = b[0];
	rep(i,n-2) {
		ans+=min(b[i], b[i+1]);
	}
	ans += b[n-2];

	cout << ans << endl;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int x, y, z; cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 256
/*
    Created by Tejas Chaudhari
    link:
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

void re_curse()
{
    ld r;
    cin>>r;
    cout<<M_PI*2*r<<endl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    re_curse();
    return 0;
}

Measured memory_bytes: 3808
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int B[30];
int A[30][30];

signed main() {
	int N, M, C;
	cin >> N >> M >> C;
	rep(i, M) {
		cin >> B[i];
	}

	rep(i, N) {
		rep(j, M) {
			cin >> A[i][j];
		}
	}

	int ans=0;

	rep(i, N) {
		int chara = C;
		rep(j, M) {
			chara += A[i][j] * B[j];
		}
		if (chara > 0) ans++;
	}
	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);

if (abs($a - $b) <= $d && abs($b - $c) <= $d) {
    echo 'Yes';
} elseif (abs($a - $c) <= $d){
    echo 'Yes';
}else {
    echo 'No';
}




Measured memory_bytes: 4604
# B問題
# pythonの文字列は作成後に変更できないことに注意。リストに変えて、また戻す必要がある。
N = int(input())
S = input()
S_list = list(S)

# Asciiコードが関わる
for i in range(len(S_list)):
    x = (ord(S_list[i]) - ord('A') + N)%26 +ord('A')
    S_list[i] = chr(x)

ans = ''.join(S_list)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long  n, a, b, ans, m, c, k;
  cin >> n >> a >> b;
  c = a + b;
  m = n/c;
  k = n - m*c;
  if(a <= k){
    ans = (m + 1)*a;
  }else{
    ans = m*a + k;
  }
  
  
  cout << ans <<endl;
}


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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B)
        cout << C << endl;
    else if (A == C)
        cout << B << endl;
    else
        cout << A << endl;
    return 0;
}

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

int B[100000];
bool visit[100000];

int main(){
  long N;
  cin >> N;
  for(long i=0; i<N; i++){
    int a; cin >> a;
    B[i] = a-1;
  }
  long pos=0;
  visit[pos]=true;
  long count=0;
  while(pos!=1){
    count++;
    pos = B[pos];
    if(visit[pos]==true){
      cout << "-1" << endl;
      return 0;
    }
    visit[pos]=true;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// rep(i, 1, 5) --> {1,2,3,4}
// rep(i, 5, 1) --> {4,3,2,1}
// rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string s;
    cin >> s;
    for (int i=0; i<s.size(); i+=2)
        cout << s[i];
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(char,c);
  OUT((c=='a'||c=='i'||c=='u'||c=='e'||c=='o')?"vowel":"consonant")BR;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, l, tmp = inf, total;


int main() {

	cin >> n >> l;

	rep(i, n) {
		total += l + i;
		if (abs(tmp) > abs(l + i)) {
			tmp = l + i;
		}
	}

	cout << total - tmp << endl;

	return 0;
}


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

using namespace std;
int main()
{
  int w,q;
  for(;cin>>w>>q,w;)
    {
      vector<pair<int,int> > qu;
      qu.push_back(make_pair(-1,w));
      for(int i=0;i<q;i++)
	{
	  char f;
	  cin>>f;
	  if(f=='s')
	    {
	      int id,ww;
	      cin>>id>>ww;
	      bool flag=true;
	      int cnt=0;
	      for(int i=0;i<qu.size();i++)
		{
		  if(qu[i].first==-1 && qu[i].second>=ww)
		    {
		      if(qu[i].second-ww>0)
			{
			  qu.insert(qu.begin()+i+1,make_pair(-1,qu[i].second-ww));
			}
		      qu[i].first=id;
		      qu[i].second=ww;
		      flag=false;
		      cout<<cnt<<endl;
		      break;
		    }
		  cnt+=qu[i].second;
		}
	      if(flag)
		cout<<"impossible"<<endl;
	    }
	  else
	    {
	      int id;
	      cin>>id;
	      for(int i=0;i<qu.size();i++)
		{
		  if(qu[i].first==id)
		    {
		      qu[i].first=-1;
		      if(i+1<qu.size() && qu[i+1].first==-1)
			{
			  qu[i].second+=qu[i+1].second;
			  qu.erase(qu.begin()+i+1);
			}
		      if(i-1>=0 && qu[i-1].first==-1)
			{
			  qu[i-1].second+=qu[i].second;
			  qu.erase(qu.begin()+i);
			}
		      break;
		    }
		}
	    }
	  /*
	    cout<<"qu:";
	    for(int i=0;i<qu.size();i++)
	    cout<<" < "<<qu[i].first<<","<<qu[i].second<<"> ";
	    cout<<endl;
	  */
	}
      cout<<"END"<<endl;
    }

}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;

int main(){
	int n, l;
	cin >> n >> l;
	vector<string> s;
	rep(i, n){
		string tmp;
		cin >> tmp;
		s.push_back(tmp);
	}
	sort(s.begin(), s.end());
	rep(i, s.size()) cout << s[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &V) {
  for (int i = 0; i < (int)V.size(); ++i) {
    if (i != 0) os << ' ';
    os << V[i];
  }
  return os;
}
template<typename T>
istream &operator>>(istream &is, vector<T> &V) {
  for (int i = 0; i < (int)V.size(); ++i) {
    is >> V[i];
  }
  return is;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(0, c - (a - b));
  return 0;
} 


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

namespace ac = atcoder;

void solve()
{
    int n,q,u,v,x;
    cin>>n>>q;
    ac::dsu dsu(n);
    while(q--)
    {
        cin>>x>>u>>v;
        if(x==0)
        {
            dsu.merge(u,v);
        }
        else
        {
            cout<<dsu.same(u,v)<<endl;
            
        }
        
    }
}
int main() {
    int t=1;
    //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3940
#include<iostream>
using namespace std;
bool isp[1<<17];
int cnt[1<<17];
main()
{
	for(int i=2;i<1<<17;i++)isp[i]=true;
	for(int i=2;i<1<<17;i++)
	{
		if(isp[i])for(int j=i+i;j<1<<17;j+=i)isp[j]=false;
	}
	for(int i=2;i<1<<17;i++)
	{
		cnt[i]=cnt[i-1];
		if(i%2==1&&isp[i]&&isp[(i+1)/2])cnt[i]++;
	}
	int Q;cin>>Q;
	for(;Q--;)
	{
		int l,r;cin>>l>>r;
		cout<<cnt[r]-cnt[l-1]<<endl;
	}
}


Measured memory_bytes: 1280
open System

[<EntryPoint>]
let main argv = 
  let n = Console.ReadLine() |> int
  
  let rec f = 
    function 
    | [] | [ _ ] -> []
    | (x :: y :: z) -> x :: f z
  
  let l = 
    Console.ReadLine().Split()
    |> Array.map int
    |> Array.sort
    |> Array.toList
  
  f l
  |> List.sum
  |> Console.WriteLine
  0


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

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

ll N,S;
ll A[3005];

ll mod = 998244353;

ll dp[3005][3005];

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

    cin >> N >> S;

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

    for (int i = 0;i < N;i++){
        dp[i+1][A[i]] += i+1;
        for (int j = 0;j <= S;j++){
            dp[i][j] %= mod;
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= mod;
            if(j+A[i] <= S){ 
                dp[i+1][j+A[i]] += dp[i][j];
                dp[i+1][j+A[i]] %= mod;
            }
        }
    }

    ll ans = 0;
    for (int i = 0;i <= N;i++){
        ans += dp[i][S];
        ans %= mod;
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 70784
n = int(input())
if n == 100000:
    print(90909)
elif (9999 < n) and (n < 100000):
    print(909 + n - 9999)
elif (999 < n) and (n < 10000):
    print(909)
elif (99 < n) and (n < 1000):
    print(9 + n - 99)
elif (9 < n) and (n < 100):
    print(9)
else:
    print(n)


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

typedef long long ll;

int main()
{
    string s;
    ll k;
    cin >> s >> k;
    int i = 0;
    while (s[i] == '1') i++;
    if (k <= i)
        cout << '1' << endl;
    else
        cout << s[i] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      int counter = 0;
      boolean comp = false;
      while(!comp) {
         comp = true;
         for(int i = n-1; i >= 1; i --) {
            if(arr[i-1] > arr[i]) {
               int temp = arr[i];
               arr[i] = arr[i-1];
               arr[i-1] = temp;
               comp = false;
               counter ++;
            }
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      System.out.println("\n" + counter);
   }
}


Measured memory_bytes: 26380
def abc173_e():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    mod = 10**9 + 7

    A.sort(reverse=True)  # 符号付きの大きい順
    B = sorted(A, key=lambda x: abs(x), reverse=True)  # 絶対値の大きい順
    C = []

    if k == n:
        C = A  # 全部使う
    elif k % 2 == 1 and A[0] < 0:
        C = A[:k]  # 絶対値小さい順にk個
    else:
        plus = []
        minus = []
        for b in B[:k]:
            if b >= 0: plus.append(b)
            else: minus.append(b)

        if len(minus) % 2 == 1:
            # 積が負になるので入れ替え検討
            rem1, add1, rem2, add2 = None, None, None, None

            rem1 = minus[-1]  # 負値の絶対値最小
            add1 = max(B[k:])  # 残りものの正値の絶対値最大
            valid1 = (add1 >= 0)

            valid2 = False
            if plus:
                rem2 = plus[-1]
                add2 = min(B[k:])  # 負値の絶対値最大
                valid2 = (add2 < 0)

            if valid1 and valid2:
                if add1 * rem2 > rem1 * add2:
                    minus[-1] = add1
                else:
                    plus[-1] = add2
            elif valid1:
                minus[-1] = add1
            elif valid2:
                plus[-1] = add2

        C = plus + minus

    ans = 1
    for c in C:
        ans *= c
        if ans < 0: ans += mod
        ans %= mod
    print(ans)

if __name__ == '__main__':
    abc173_e()

Measured memory_bytes: 31808
A = [list(map(int,input().split())) for i in range(3)]
B = [[False for i in range(3)] for j in range(3)]
N = int(input())
for k in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                B[i][j] = True
ans = 'No'
if B[0][0] and B[0][1] and B[0][2]:
    ans = 'Yes'
if B[1][0] and B[1][1] and B[1][2]:
    ans = 'Yes'
if B[2][0] and B[2][1] and B[2][2]:
    ans = 'Yes'
if B[0][0] and B[1][0] and B[2][0]:
    ans = 'Yes'
if B[0][1] and B[1][1] and B[2][1]:
    ans = 'Yes'
if B[0][2] and B[1][2] and B[2][2]:
    ans = 'Yes'
if B[0][0] and B[1][1] and B[2][2]:
    ans = 'Yes'
if B[0][2] and B[1][1] and B[2][0]:
    ans = 'Yes'
print(ans)


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

int main() {
  int a,b;
  cin >> a >> b;
  if (a <= 9 && b <= 9) cout << a*b << endl;
  else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())

def get_ans(x):
    if x == 0:
        return ['0']
    d = []
    i = 0
    div = 1
    while x != 0:
        if x % (div*2) == 0:
            d.append('0')
        else:
            d.append('1')
            x -= div
        i += 1
        div = div * (-2)
    return d

a = get_ans(N)
b = list(reversed(a))
ans = ''.join(b)
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#define N 10000

int linearSearch(int S[], int key, int n){
  int i;
  for( i = 0 ; i < n-1 ; i++ ){
    if(S[i] == key) return 1;
  }
  return 0;
}

int main(){
  int i, n, S[N], q, key, cont = 0;

  scanf("%d", &n);
  for( i = 0 ; i < n ; i++ ){
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for( i = 0 ; i < q ; i++ ){
    scanf("%d", &key);
    if( linearSearch(S, key, n) == 1 ) cont++;
  }
  printf("%d\n", cont);
  return 0;
}



Measured memory_bytes: 2144
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
string s;
int k;
vector <string> ans, realans;
int main()
{
	cin>>s>>k;
	for(int i=0; i<s.size(); i++) 
		for(int j=1; j<=5; j++) {
			if(i + j - 1 >= s.size()) continue;
			ans.push_back(s.substr(i, j));
		}
	sort(ans.begin(), ans.end());
	realans.push_back(ans[0]);
	for(int i=1; i<ans.size(); i++)
		if(ans[i] != ans[i-1]) realans.push_back(ans[i]);
	cout<<realans[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 1916
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


n, a, b, c, d = li()

exist = False
mx = n - 1

for i in range(n):
    if a + i*c - (mx-i)*d <= b <= a + i*d - (mx-i)*c:
        exist = True
        break

print("YES" if exist else "NO")

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

int		main(void)
{
	int w, a, b;

	cin >> w >> a >> b;
	int ans = 0;
	if (a + w < b)
		ans = b - (a + w);
	else if (b + w < a)
		ans = a - (b + w);
	else
		ans = 0;
	cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;

int main(){
	string S;
	cin >> S;

	int red=0;
	for(int i=0; i<S.size(); i++) if(S[i]=='0') red++;
	int blue = S.size()-red;

	cout << 2*min(blue, red) << endl;

	return 0;
}


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

const int SIZE=2*1e5+1;
using dbl=double;
const dbl INF=2;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    vector<vector<dbl>> dp(n+1,vector<dbl>(SIZE,INF));
    dp[0][1]=0;
    for(int i=0;i<n;i++){
        for(int j=1;j<SIZE;j++){
            for(int k=j;k<SIZE;k+=j){
                dp[i+1][k]=min(dp[i+1][k],max(dp[i][j],dbl(abs(a[i]-k))/a[i]));
            }
        }
    }
    cout<<fixed<<setprecision(10);
    cout<<*min_element(dp[n].begin(),dp[n].end())<<endl;
    return 0;
}


Measured memory_bytes: 37140
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N;cin>>N;
  vector<long>X(N),Y(N);
  for(long i=0;i<N;i++)cin>>X[i]>>Y[i];
  vector<long>P(N);for(long i=0;i<N;i++)P[i]=i;
  double ans=0;long n=0;
  do{
    n++;
    for(long i=1;i<N;i++)ans+=sqrt((X[P[i]]-X[P[i-1]])*(X[P[i]]-X[P[i-1]])+(Y[P[i]]-Y[P[i-1]])*(Y[P[i]]-Y[P[i-1]]));
  }while(next_permutation(P.begin(),P.end()));
  cout<<fixed<<setprecision(12)<<ans/n<<endl;
}

/*



*/

Measured memory_bytes: 3748
/* package codechef; // don't place package name! */

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*; 
import java.lang.*; 
import java.io.*;
import java.math.BigInteger; 
import java.math.*;

 public class Main{
     
	public static void main(String[] args) {
		
		InputStream inputStream = System.in;

		InputReader sc = new InputReader(inputStream);

				
		// int t=sc.nextInt();
		 long c=1000000007;
	
	    int n=sc.nextInt();
	    int k=sc.nextInt();
	    int a[] = new int[n];
	    for(int i=0;i<n;i++){
	      a[i]=sc.nextInt();
	    }
	    int dp[]= new int[n];
	    dp[0]=0;
	     dp[1]=Math.abs(a[1]-a[0]);
	    for(int i=2;i<n;i++){
	      dp[i]=Integer.MAX_VALUE;
	      for(int j=1;j<=k;j++){
	        if(j<=i){
	      dp[i]=Math.min(dp[i],Math.abs(a[i]-a[i-j])+dp[i-j]);}
	    }
	    }
	    System.out.println(dp[n-1]);
	}
	

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
				    tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
				    throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public float nextFloat() {
			return Float.parseFloat(next());
		}
		
		
	}
}

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

#define pb push_back

using namespace std;

const int N = 5000 + 10;
const int mod = 1e9 + 7;

vector<int> G[N];
int f[N][N], g[N], tmp[N];
int n, size[N];

void dfs(int u, int dad) {
	f[u][size[u] = 1] = 1;
	for(auto v : G[u]) 
		if(v != dad) {
			dfs(v, u);
			for(int i = 1; i <= size[u] + size[v]; ++ i) tmp[i] = 0;
			for(int i = 1; i <= size[u]; ++ i)
				for(int j = 0; j <= size[v]; ++ j)
					(tmp[i + j] += 1ll * f[u][i] * f[v][j] % mod) %= mod;
			for(int i = 1; i <= size[u] + size[v]; ++ i)
				f[u][i] = tmp[i];
			size[u] += size[v];
		}
	for(int i = 2; i <= size[u]; i += 2)
		(f[u][0] += mod - 1ll * f[u][i] * g[i] % mod) %= mod;
}

int main() {
#ifdef ylsakioi
	freopen("e.in", "r", stdin);
	freopen("e.out", "w", stdout);
#endif
	int x, y; g[0] = 1;
	scanf("%d", &n);
	for(int i = 2; i <= n; i += 2)
		g[i] = 1ll * g[i - 2] * (i - 1) % mod;
	for(int i = 1; i < n; ++ i) {
		scanf("%d%d", &x, &y);
		G[x].pb(y), G[y].pb(x);
	}
	dfs(1, 0);
	printf("%d\n", mod - f[1][0]);
	return 0;
}


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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,n;
  cin>>h>>n;
  int sum=0;
  while(n--){
    int a;
    cin>>a;
    sum+=a;
  }
  if(h<=sum){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  return 0;
}

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

int n, k, t[100005];

signed main(){
  
  cin>>n>>k;
  
  for(int i=0;i<n;i++) cin>>t[i];
  
  priority_queue<int>  q;
  
  for(int i=0;i<n-1;i++) q.push( t[i+1] - t[i] - 1 );
  
  int ans = t[n-1] - t[0] + 1;
  
  k--;
  
  while(k--){
    
    ans -= q.top();
    
    q.pop();
    
  }

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



Measured memory_bytes: 4716
t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}

Measured memory_bytes: 0
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main{
	private void solve(){
		int n=gInt(),a=gInt(),b=gInt();
		System.out.println(
				ints(n)
				.filter(i->i<a||b<=i)
				.count()
				);
	}

	public static void main(String[] $){
		new Main().solve();
		System.out.flush();
	}


	static class System{
		private static final InputStream	in	=java.lang.System.in;
		private static final PrintWriter	out	=new PrintWriter(java.lang.System.out,false);
	}

	static Scanner s=new Scanner(System.in);


	static int gInt(){
		return s.nextInt();
	}

	static long gLong(){
		return s.nextLong();
	}

	static long gDouble(){
		return s.nextLong();
	}


	static Range rep(int i){
		return new Range(i);
	}

	static Range rep(int f,int t){
		return new Range(f,t);
	}

	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
		int from,to,c;
		Range(int from,int to){
			this.from=from;
			this.to=to;
			this.c=from;
		}
		Range(int n){
			this(0,n-1);
		}
		@Override
		public Iterator<Integer> iterator(){
			return this;
		}
		@Override
		public boolean hasNext(){
			return c<=to;
		}
		@Override
		public int nextInt(){
			return c++;
		}
	}


	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}

	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}


	static IntStream ints(int n){
		return REPS(n).map(i->gInt());
	}

	static Stream<String> strs(int n){
		return REPS(n).mapToObj(i->s.next());
	}

}

Measured memory_bytes: 26836
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 10005;
int main(void) {
    int a,b;
    double c,d;
    scanf("%d%d",&a,&b);
    c = a;
    d = b;
    printf("%d %d %.5f",a/b,a%b,c/d);
    return 0;
}


Measured memory_bytes: 3184
import sys
input = sys.stdin.readline

def main():
    N,P = map(int,input().split())
    if N==1:
        print(P)
    elif N>50:
        print(1)
    else:
        ans = 1
        insuu = 2
        while insuu**N<=P:
            if P%(insuu**N)==0:
                ans *= insuu
                P //= insuu**N
            else:
                insuu += 1
        print(ans)

if __name__ == '__main__':
    main()


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

int main() {
    vector<vector<bool> > table(4,vector<bool>(13,false));
    int n;
    cin >> n;
    REP(i,n) {
        string c;
        int a, c_;
        cin >> c >> a;
        if(c == "S") c_ = 1;
        if(c == "H") c_ = 2;
        if(c == "C") c_ = 3;
        if(c == "D") c_ = 4;
        table[c_ - 1][a - 1] = true;
    }
    REP(j,4) {
        REP(k,13) {
            if(!table[j][k]) {
                char c;
                if(j == 0) c = 'S';
                if(j == 1) c = 'H';
                if(j == 2) c = 'C';
                if(j == 3) c = 'D';
                cout << c << " " << k + 1 << endl; 
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3164
import time

start = time.time()
K = int(input())

n = 7
cnt = 1

n %= K

while n:
    n *= 10
    n += 7
    cnt += 1
    n %= K
    if time.time() - start > 1.95:
        print(-1)
        break

else:
    print(cnt)

Measured memory_bytes: 9172