akhauriyash/Code-Regression huggingface dataset:
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Maybe (fromJust)
import Data.List (unfoldr, find)
import Data.Tuple (swap)

main :: IO ()
main = do
  let
    cs = unfoldr next (0, 1) :: [(Int, Int)]
      where
        next :: (Int, Int) -> Maybe ((Int, Int), (Int, Int))
        next (i, k) = Just ((i, 26 * pred k), (succ i, 26 * k))
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  let
    k = fst . fromJust . find ((pred n * 25 <) . snd) $ cs :: Int
    m = 26 * (pred $ 26 ^ pred k) `div` 25 :: Int
    ds = reverse . take k . unfoldr (Just . swap . (`divMod` 26)) $ pred n - m :: [Int]
  putStrLn . map (toEnum . (97 +)) $ ds

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

ll f(ll x){
    if(x<0) return 0;
    ll res = 0;
    REP(i,42){
        if(i==0)continue;
        res += (max((x%(1LL<<(i+1)))-(1LL<<i)+1LL,0LL)%2)<<i;
    }
    res += (x%4)==1 || (x%4)==2;
    return res;
}

int main() {
    ll a, b;
    cin >> a >> b;
    //cout << f(a-1) << " " << f(b) << endl;
    cout << (f(a-1)^f(b)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
 string s,t;
 cin>>s>>t;
 int cnt=0;
 for(int i=0;i<s.size();i++){
     if(s[i]!=t[i]){cnt++;}
 }
 cout<<cnt<<endl;
  return 0;
}

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

int n,a[1000],ans=1;

int main(){
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	sort(a,a+n);
	for(int i=0; i<n-1; i++){
		if(a[i] != a[i+1]) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
using namespace std;
using ll = long long;
int main(){
  ll n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> sum(n);
  sum[0] = a[0];
  for(int i=1;i<n;i++) sum[i]= sum[i-1]+a[i];
  ll max_sum = sum[k-1];
  for(int i =1; i<(n-k+1);i++){
    max_sum=max(sum[i+k-1]-sum[i-1],max_sum);
    //cout << sum[i+k-1]-sum[i-1] << endl;
  }
  long double ans = (double)(max_sum/2.0+k/2.0);
  cout <<setprecision(25)<< ans << endl;
}

Measured memory_bytes: 2560
class PriorityQueue
  def initialize(&comp)
    @heap = []
    @node_num = 0
    if !block_given?
      @comp = Proc.new { |x, y| x <= y }
    else
      @comp = comp
    end
  end

  attr_reader :heap

  def push(x)
    current_node_num = @node_num
    @node_num += 1
    while current_node_num > 0
      parent_node_num = (current_node_num - 1) / 2
      break if @comp.call(@heap[parent_node_num], x) # 逆転してないなら抜ける
      # 親ノードを下ろして自分を上に
      @heap[current_node_num] = @heap[parent_node_num]
      current_node_num = parent_node_num
    end
    @heap[current_node_num] = x
  end

  alias_method(:<<, :push)

  def pop
    # 最(小|大)値
    ret = @heap[0]
    # 根にもってくる値
    @node_num -= 1
    x = @heap[@node_num]
    # 根から下ろしていく
    i = 0
    while (a = i * 2 + 1) < @node_num
      # 子どうしを比較
      b = a + 1
      a = b if b < @node_num && @comp.call(@heap[b], @heap[a])
      break unless @comp.call(@heap[a], x)
      @heap[i] = @heap[a]
      i = a
    end
    @heap[i] = x
    return ret
  end

  def get
    @node_num == 0 ? nil : @heap[0]
  end

  def empty?
    return get.nil?
  end
end

#
# dijkstra
#   O(|E|log|V|)
#   隣接表現グラフgraph, 始点start, inf
#
def dijkstra(graph, start, inf = Float::INFINITY)
  vertex_num = graph.size
  que = PriorityQueue.new { |x, y| x[0] <= y[0] }
  dist = Array.new(vertex_num, inf)
  dist[start] = 0
  que.push([0, start])
  while !que.empty?
    d, v = que.pop
    dist_now = dist[v]
    next if dist_now < d
    graph[v].size.times do |i|
      # e is an instance of Edge
      #   Edge = Struct.new(:to, :cost)
      e = graph[v][i]
      if dist[e.to] > dist_now + e.cost
        que.push([dist[e.to] = dist_now + e.cost, e.to])
      end
    end
  end
  return dist
end

Edge = Struct.new(:to, :cost)
n, m = gets.split.map(&:to_i)
g = Array.new(n) { [] }

(n - 2).times do |i|
  g[i + 1] << Edge.new(i, 0)
end

m.times do
  l, r, c = gets.split.map(&:to_i)
  l -= 1
  r -= 1
  g[l] << Edge.new(r, c)
end
ans = dijkstra(g, 0)[n - 1]
puts ans == Float::INFINITY ? -1 : ans


Measured memory_bytes: 29424
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[M];
		int[] b = new int[M];
		int[] count = new int[N];

		for(int i=0; i<M; i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();

			count[a[i]-1]++;
			count[b[i]-1]++;
		}

		for(int i=0; i<N; i++){
			System.out.println(count[i]);
		}
	}

}


Measured memory_bytes: 22868
#include<iostream>
using namespace std;
int main(){
    string str;
    int counter[26]={};
    while(cin >> str){
        for(int i=0;i<str.size();i++){
            if('a'<=str[i] && str[i]<='z'){
                counter[str[i]-'a']++;
            }
            else if('A'<=str[i] && str[i]<='Z'){
                counter[str[i]-'A']++;
            }
        }
        
    }
    for(int i=0;i<26;i++){
            cout << (char)('a'+i) << " : " << counter[i] << endl;
    }
}



Measured memory_bytes: 3196
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

namespace {

typedef std::vector<int> IntVector;

/**
 * return degit length
 * It will return 1 if val is 0
 */
int degit_length(int val) {
  int length = 1;
  val /= 10;
  while (val) {
    length += 1;
    val /= 10;
  }

  return length;
}

int pow10(int n) {
  int res = 1;
  for (int i = 0; i < n; ++i) {
    res *= 10;
  }

  return res;
}

IntVector slice_degit(int val) {
  IntVector iv;

  iv.push_back(val % 10);
  for (int i = 1; i < degit_length(val); ++i) {
    iv.push_back((val / pow10(i)) % 10);
  }

  return iv;
}

} // namespace

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

  int n, k;

  std::cin >> n >> k;

  int ki[10];
  for (int i = 0; i < 10; ++i) {
    ki[i] = 0;
  }

  int t;
  for (int i = 0; i < k; ++i) {
    std::cin >> t;
    ki[t] = 1;
  }

  int res = n;
  for (;;) {
    IntVector iv = slice_degit(res);
    bool is_ng = false;
    for (auto v : iv) {
      if (ki[v]) {
        is_ng = true;
        break;
      }
    }

    if (!is_ng) {
      break;
    }
    ++res;
  }

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int d[30][200002];
int main() {
    int n, c, a=0;
    cin>>n>>c;
    for(int i=0;i<c;i++){
        for(int j=0;j<200002;j++){
            d[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        int s, t, u;
        cin>>s>>t>>u;
        u--;
        d[u][s*2]++;
        d[u][t*2]--;
    }
    for(int i=0;i<c;i++){
        for(int j=1;j<200002;j++){
            d[i][j]+=d[i][j-1];
        }
        for(int j=0;j<200001;j++){
            if(d[i][j]==0&&d[i][j+1]>0){
                d[i][j]++;
            }
        }
    }
    for(int j=0;j<200002;j++){
        int b=0;
        for(int i=0;i<c;i++){
            if(d[i][j]>0)b++;
        }
        a=max(a, b);
    }
    cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define pb push_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define mt make_tuple
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define forn(i, a) for(int i=0; i<a; i++)
#define Forn(i, a) for(int i=1; i<=a; i++)
#define read(x) ((scanf("%s", &_), (x) = _))
#define INF 1e9
#define memINF 127
#define inf 1e18
#define all(x) x.begin(), x.end()
#define MOD 1e9+7 
#define HASH 1543 
#define FAST ios_base::sync_with_stdio(0)

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;
typedef vector<vector<ll> > matrix;

using namespace std;

inline int in() 
{
    int x=0, c;
    while((uint)((c=getchar())-48)>=10) 
		if(c=='-') 
			return -in();
    do 
	{ x=(x<<3)+(x<<1)+(c^48); }
	while((uint)((c=getchar())^48)<10);
    return x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}
using namespace std;
int n , a[100005], b[100005], l, r, mid;
int sum[200005];
ll need;
void update(int x)
{
    while(x<=n*2)
        sum[x]++, x+=x&-x;
}
inline int ss(int x)
{
    int res=0;
    for( ; x>0; x&=x-1)
        res+=sum[x];
    return res;
}
bool chk(int val)
{
    memset(sum, 0, sizeof(sum));
    int s=n;
    update(s);
    ll res=0;
    Forn(i, n)
    {
        if(a[i]>=val)
            s++;
        else 
            s--;
        res+=ss(s);
        update(s);
    }
    return res>=(need>>1)+(need&1);
}
int main()
{
    n=in();
    need=(1ll*n*(n+1))>>1;
    Forn(i, n)
    {
        a[i]=in();
        b[i]=a[i];
    }
    sort(b+1, b+1+n); 
    l=0;
    r=n+1;
    while(l+1<r)
    {
        mid=(l+r)>>1;
        if(!chk(b[mid]))
            r=mid;
        else 
            l=mid;
    }
    printf("%d\n", b[l]);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	if(n%2!=0)
	{
		if((n/2+1)>=k)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
	else
	{
		if((n/2)>=k)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}


#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;


int G[600][600];

struct UnionFind{
    vector<int> par,sizes;
    UnionFind(int n):par(n+1),sizes(n+1,1){
        rep2(i,1,n)par[i]=i;
    }
    int find(int x){
        return (x==par[x]?x:par[x]=find(par[x]));
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return ;
        if(sizes[x]<sizes[y]){
            swap(x,y);
        }
        par[y]=x;
        sizes[x]+=sizes[y];
    }
    bool same(int x,int y) {return (find(x)==find(y));}
    int size(int x) {return sizes[find(x)];}
};
main(){
    int n=in();
    int h=in(),w=in();
    UnionFind uf(h+w+10);
    vector<pair<ll,pii>> v;
    rep(i,n){
        int r=in(),c=in(),a=in();
        v.pb({a,{r,c+h}});
        uf.unite(r,c+h);
    }
    vector<vector<pair<ll,pii>>> W(h+w+10);
    vec t;
    rep(i,n){
        int s=uf.find(v[i].second.first);
        W[s].pb(v[i]);
        t.pb(s);
        //cout<<s<<endl;
    }
    sort(all(t));
    ll ans=0;
    t.erase(unique(all(t)),t.end());
    UnionFind uf2(h+w+10);
    vec used(h+w+10);
    for(auto e:t){
        sort(all(W[e]),greater<pair<ll,pii>>());
        rep(i,W[e].size()){
            //cout<<W[e][i].first<<" "<<W[e][i].second.first<<W[e][i].second.second<<endl;
            if(!uf2.same(W[e][i].second.first,W[e][i].second.second)){
                if(used[uf2.find(W[e][i].second.first)]&&used[uf2.find(W[e][i].second.second)]){
                    continue;
                }
                bool a=0;
                if(used[uf2.find(W[e][i].second.first)]||used[uf2.find(W[e][i].second.second)]){
                    a=1;
                }
                uf2.unite(W[e][i].second.first,W[e][i].second.second);
                if(a)used[uf2.find(W[e][i].second.first)]=1;
                ans+=W[e][i].first;
            }
            else{
                if(!used[uf2.find(W[e][i].second.second)]){
                    used[uf2.find(W[e][i].second.second)]=1;
                    ans+=W[e][i].first;
                }
            }

        }

    }
    cout<<ans<<endl;
}

Measured memory_bytes: 13936
using System;

namespace AtCoder123C
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal N = decimal.Parse(Console.ReadLine());
            decimal[] MaxAvailable = new decimal[5];
            decimal sum = 0;
            decimal min = 1000000000000000;
            for (int i = 0; i < 5; i++)
            {
                MaxAvailable[i] = decimal.Parse(Console.ReadLine());
                if (min > MaxAvailable[i])
                {
                    min = MaxAvailable[i];
                }
            }
            if (N % min == 0) {
                sum = 4 + Math.Floor(N / min);
            }
            else
                sum = 5 + Math.Floor(N/min);
            Console.WriteLine(sum);
        }
    }
}


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

using namespace std;

int main(){
	int N;
	cin >> N;
	int R[N + 5];
	int maxn = -999999999;
	for(int t = 0; t < N; t++){
		cin >> R[t]; 
	}
	int maxv = -2000000000;
	int minv = R[0];
		 
	for(int i = 1; i < N; i++){
		maxv = max(maxv,R[i]-minv);
		minv = min(minv,R[i]);
	}
	cout << maxv << endl;
	return 0;
}



Measured memory_bytes: 3880
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll p = 2;
    ll e;
    ll ans = 0;
    while(p * p <= N){
        if(N % p == 0){
            e = 1;
            while(N % (ll)pow(p, e) == 0){
                N /= pow(p, e);
                ans++;
                e++;
            }
            while(N % p == 0){
                N /= p;
            }
        }
        p++;
    }
    if(N > 1){
        ans++;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 4064
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;
int main() {
	int N;
	cin>>N;

	int ans=0;
	for(int i=1; i<=N;++i) {
		if(i%2==1) {
			int cnt=0;
			for(int j=1; j<=i; ++j) {
				if(i%j==0)++cnt;
			}
			if(cnt==8)++ans;
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	D, T, S := getInt(), getInt(), getInt()

	if T*S >= D {
		out("Yes")
		return
	}
	out("No")
}


Measured memory_bytes: 1776
#include <stdio.h>
#include <math.h>
int main(void){
    int n;
    scanf("%d", &n);
    // 1, 2, 4, 8, 16, 32, 64
    int ans=0;
    while(n!=0){
        n/=2;
        ans++;
    }
    printf("%d\n", (int)pow(2, ans-1));
}


Measured memory_bytes: 2552
# https://atcoder.jp/contests/abc114/tasks/abc114_d

# 75数...約数をちょうど75個持つ整数
# 約数がちょうど75個→ その数を素因数分解すると
# A**74 or A**2 * B**4 * C**4 or A**2 * B**24 or A**16 * B**4 (必要条件？)

# N！の約数である→N!を割り切れる→素因数分解の肩の数が大きい

# N!の素因数分解の結果に対して、指数が4以上→2つ必要、2以上→1つ必要
# 一般化する。指数が4以上である底の個数をB,指数が2以上4未満である底の個数をAと定義した場合
# BC2 * A + BC3 が答えとなる


def factorization(n: int):
    if n == 1:
        return []  # 1は素数ではない
    # 素因数分解
    arr = []
    temp = n
    for i in range(2, int(n**0.5) + 1):  # ここにバグがないか心配
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append((i, cnt))

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

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

    return arr


def make_divisors(n: int, sort=False):
    # 約数列挙
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    if sort:
        divisors.sort()
    return divisors


def combination_mod(n, r, mod):
    if r > n:
        return 0  # このような通りの数は無いため便宜上こう定義する
    r = min(r, n - r)
    nf = rf = 1
    for i in range(r):
        nf = nf * (n - i) % mod
        rf = rf * (i + 1) % mod
    return nf * pow(rf, mod - 2, mod) % mod


from collections import defaultdict

N = int(input())
fact = defaultdict(lambda: 0)
for n in range(1, N + 1):
    tmp = factorization(n)
    for k, v in tmp:
        fact[k] += v

# A**74 or B**2 * C**4 * D**4 or E**2 * F**24 or G**14 * H**4 (必要条件？)
A, B, C, D, E, F, G, H = 0, 0, 0, 0, 0, 0, 0, 0
for k, v in fact.items():
    if v >= 74:
        A += 1

    if v >= 4:
        C += 1
    if 2 <= v < 4:
        B += 1

    if v >= 24:
        F += 1
    if 24 > v >= 2:
        E += 1

    if v >= 14:
        G += 1
    if 14 > v >= 4:
        H += 1


# print(fact)
MOD = 10**9 + 7
ans = A
ans += combination_mod(C, 2, MOD) * B + combination_mod(C, 3, MOD) * 3
ans += E * F + combination_mod(F, 2, MOD) * 2
ans += G * H + combination_mod(G, 2, MOD) * 2

print(ans)


Measured memory_bytes: 3316
#![allow(non_snake_case, unused_imports, deprecated)]

// Input macros
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,VecDeque,BinaryHeap};
// Module for v1.15.1
use std::ascii::AsciiExt; // deprecated since 1.26.0: use inherent method instead

// Functions

// Main
fn main(){

    input!{
        S: chars,
    }

    let d1 = S[0] as u8 - 48;
    let d2 = S[1] as u8 - 48;
    let d3 = S[2] as u8 - 48;
    let d4 = S[3] as u8 - 48;

    let dd1 = d1*10 + d2;
    let dd2 = d3*10 + d4;

    let mut f1 = false;
    let mut f2 = false;
    if 1<=dd1 && dd1<=12{
        f1 = true;
    }
    if 1<=dd2 && dd2<=12{
        f2 = true;
    }
    let ans;
    if f1 && f2{
        ans = "AMBIGUOUS";
    }else if f1{
        ans = "MMYY";
    }else if f2{
        ans = "YYMM";
    }else{
        ans = "NA";
    }

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int main() {
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
   //cout << std::fixed;
    //cout << std::setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n; cin>>n;
    int a[n];
    int ans;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i==0) ans=a[i];
        else 
        ans=gcd(ans,a[i]);
    }
    cout<<ans;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
    static int parity = -1; 
    public static void printminusbinary(int n){
	parity *= -1;
	if(n == 0) return;
	printminusbinary((n - parity * Math.abs(n) % 2) / 2);
	System.out.print(Math.abs(n) % 2);
}
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
	if(N == 0){
	    System.out.println("0");
	}
	else{
	printminusbinary(N);
	System.out.println("");
	}
    }
}
        


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

int main() {
  
  int a;
  int x, y, z;
  cin >> a;
  x = a/100;
  y = (a-x*100)/10;
  z = (a-x*100-y*10)/1;
  
  cout << x+y+z << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

int res;

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

    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    res = 0;
    for (int i = 0; i < N; i+=2)
    {
        if(i%2==0&&a[i]%2!=0){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int w;
	cin>>w;
	string s=to_string(w);
	int sum=0;
	for(int i=0;i<(int)s.size();i++){
		sum+=s[i]-'0';
	}
	if(w%sum==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    A, B = input([int, 2])

    for n in range(0, 1100):
        if floor(n * 0.08) == A and floor(n * 0.10) == B:
            print(n)
            break
    else:
        print(-1)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


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

using namespace std;

int main() {

	int n, k;
	cin >> n >> k;

	double total=0;

	for (int i = 1; i < n + 1; i++) {
		if (i < k) {
			total += 1 / (double)n * pow(2, -int(log2(((double)k - 0.01) / i) + 1));
		}
		else {
			total += 1 / (double)n;
		}

		//total += 1/((long long)n * pow(2, (long long)(log2(((double)k - 0.01) / i) + 1)));
		//n*2^x>k
			//2^x>k/n
			//xlog2(2)>log2(k/n)
			//x>log2(k/n)
		//cout << total << endl;
	}
	cout << setprecision(15) << total << endl;
}

Measured memory_bytes: 384
x, k, d = map(int, input().split())
if abs(x) // d > k:
  ans = abs(x) - d * k
else:
  ans = abs(x) - d * (abs(x) // d)
  k = k - abs(x) // d
  if k % 2 == 1:
    ans = abs(abs(ans) - d)
print(ans)

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

template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
    for(int i=0;i<(int)A.size();i++) out << A[i] << " ";
    return out;
}

struct problem {
    int pos;
    string result;
};

int main() {
    int n, m;
    cin >> n >> m;
    vector<problem> A(m);
    for (int i = 0; i < m; i++) {
        cin >> A[i].pos >> A[i].result;
        A[i].pos--;
    }
    vector<bool> vis(n, false);
	vector<int> penality(n, 0);
    int correct = 0, pen = 0;
    for (auto prob : A) {
        int prob_numb = prob.pos;
        string res = prob.result;
        if (vis[prob_numb]) continue;
        if (res == "AC") {
            vis[prob_numb] = true;
            correct++;
        } else {
            penality[prob_numb]++;
        }
    }
	// cout << penality << endl;
    for (int i=0;i<n;i++) {
		if(vis[i]){
			pen += penality[i];
			//cout << pen << " ok " << endl;
		}
	}
        cout << correct << " " << pen << endl;
    }


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

using namespace std;

int main()
{
    int a,b,c,dem=0;
    cin>>a>>b>>c;
    for(int i=a;i<=b;i++)

    {
        if(c%i==0)
        {
            dem++;
        }
    }

     cout<<dem<<endl;
    return 0;
}




Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 510000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Vec(P,lli,5,0);
  rep(i,0,5)cin >> P[i];
  Sort(P);
  if(N%P[0])K=N/P[0];
  else K=N/P[0]-1;
  Out(5+K);
}

Measured memory_bytes: 256
n = int(input())
a = map(int, input().split())
ans = 0
cnt = [0] * n + [0]
for i in a:
  if i > n:
    ans += 1
  else:
    cnt[i] += 1
for i in range(n + 1):
  ans += cnt[i] - i if cnt[i] >= i else cnt[i]
print(ans)

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  long long N, t;
  cin >> N >> t;
  for(int i = 0; i < N-1; i++){  
    long long k;
    cin >> k;
    t = t / __gcd(t, k) * k;
  }
  cout << t <<endl;
}


Measured memory_bytes: 3576
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){int i,j;
	char a[2]={'H','D'};
	char b[2]={'H','D'};
	scanf("%c %c",&a,&b);
	if((a[0]=='H')&&(b[0]=='H'))
	printf("H");
	else if((a[0]=='H')&&(b[1]=='D'))
	printf("D");
else if((a[1]=='D')&&(b[0]=='H'))
	printf("D");
	else if((a[1]=='D')&&(b[1]=='D'))
	printf("H");}
	

Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
//library author : @drken
const int MAX = 510000;
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;
}

// main関数で使用する場合COMinit();で初期化する必要あり

int main(int argc, char const *argv[])
{
    int n,k;cin >> n >> k;
    COMinit();
    vector<mint> C(n+1);
    for (int i = 0; i <= n; ++i)
    {
        C[i] = (mint)COM(i,k-1);
    }

    mint ans = 0;
    vector<ll> a(n);
    vector<mint> b(n);
    for(int i = 0;i < n;i++){
        ll x;cin >> x;
        a[i] = x;
    }
    sort(a.begin(),a.end());
    for (int i = 0; i < n; ++i)
    {
        b[i] = (mint)a[i];
    }
    for(int i = 0;i < n-k+1;i++){
        ans -= b[i]*C[n-(i+1)];
    }
    reverse(a.begin(),a.end());
    for (int i = 0; i < n; ++i)
    {
        b[i] = (mint)a[i];
    }
    for(int i = 0;i < n-k+1;i++){
        ans += b[i]*C[n-(i+1)];
    }
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 14592
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

signed main(void){
    string s; cin >> s;
    int ans = 0;
    bool black;
    REP(i, s.size()){
        if(i == 0){
            if(s[i] == 'B') black = true;
            else black = false;
        }else{
            if(s[i] == 'W' and black){
                ans++;
                black = false;
            }else if(s[i] == 'B' and !black){
                ans++; 
                black = true;
            }
        }
    }

    cout << ans << endl;
}

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

typedef long long ll;

struct UnionFind{
    vector<int> Parent;
    vector<int> sizes;
    UnionFind(int n):Parent(n),sizes(n,1){ rep(i,n)Parent[i]=i; }
    //find the root of x
    int root(int x){
        if(x!=Parent[x]){
        Parent[x] = root(Parent[x]);
        }
        return Parent[x];
    }
    //merge x and y
    void unite(int x,int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        Parent[y] = x;
        sizes[x] += sizes[y];
    }
    bool same(int x,int y){ return root(x) == root(y); }
    int size(int x){ return sizes[root(x)]; }
};

int main() {
	ll N,M;
	cin>>N>>M;
	vector<int> p(N);
	rep(i,N){
		cin>>p[i];
		p[i]--;
	}
	vector<ll> x(M),y(M);
	rep(i,M){
		cin>>x[i]>>y[i];
		x[i]--;y[i]--;
	}
	UnionFind uni(N);
	rep(i,M){
		if(!(uni.same(x[i],y[i]))){
			uni.unite(x[i],y[i]);
		}
	}
	int ans =0;
	rep(i,N){
		if(uni.same(p[i],i))ans++;
	}
	cout<<ans<<endl;
}


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

//==================================

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

    ll N, M;
    cin >> N >> M;

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

    Vl sums(N + 1);
    for (int i = 0; i < N; ++i) {
        sums[i + 1] = (sums[i] + A[i]) % M;
    }

    ll ans = 0;
    unordered_map<ll, ll> mp;
    for (int i = 0; i <= N; ++i) {
        ans += mp[sums[i]]++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5260
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
// #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const int INF = 2147483647;
bool is_integer( double x ){
  return std::floor(x)==x;
}
int main(){
  long long n,a,b =0;
  cin >> n >> a >>b;
  if(a == 0){
    cout << 0;
    return 0;
  }
  if(b == 0){
    cout << n;
    return 0;
  }
  long long sum = a + b;
  long long syou = 0;
  long long amari =0;
  syou = n / sum;
  amari = n % sum;
  // amari = fmod(n,sum);
  long long ans = 0;
  ans += syou * a;
  if(amari >= a){
    amari = a;
  }
  ans += amari;
  cout << ans;
  return 0;
}
 




Measured memory_bytes: 384
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;

class Main {
	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		while(in.hasNext()) {
			String s = in.nextLine();
			System.out.println(toArabian(s));
		}
	}

	public static int toArabian(String s) {
		int ans = 0;
		int before = 0;
		for(int i=s.length()-1;i>=0;i--) {
			int d = 1000000;
			switch (s.charAt(i)) {
				case 'I':
					d = 1;
					break;
				case 'V':
					d = 5;
					break;
				case 'X':
					d = 10;
					break;
				case 'L':
					d = 50;
					break;
				case 'C':
					d = 100;
					break;
				case 'D':
					d = 500;
					break;
				case 'M':
					d = 1000;
					break;
			}
			if(before > d) {
				ans -= d;
			} else {
				ans += d;
			}
			before = d;
		}
		return ans;
	}
}

Measured memory_bytes: 26300
#include<bits/stdc++.h>
using namespace std;
int d[5];
int main()
{
    for(int i = 1;i <= 3;i++){
        int u , v;cin>>u>>v;
        d[u]++;d[v]++;
    }
    bool f= 1;
    for(int i = 1;i <= 4;i++) {
        if(d[i] == 3) f = 0;
    }
    if(f) puts("YES") ;
    else puts("NO") ;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> A(20);

bool solve(int i,int m,int n) {
    //i番目以降の和でmを作れるか
    if(m == 0) return true;
    if(i >= n) return false;//n番に行ってて和を作れていない
    bool res = solve(i+1,m,n)||solve(i+1,m-A.at(i),n);
    return res;
}

int main() {
    int n;
    cin >> n;
    for(int i = 0;i < n; i++) {
        cin >> A.at(i);
    }
    int m;
    cin >> m;
    for(int i = 0;i < m; i++) {
        int mm;
        cin >> mm;
        if(solve(0,mm,n)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int n, cnt = 0;
	cin >> n;
	char a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == 'Y') {
			cnt++;
		}
	}
	if (cnt) {
		cout << "Four" << endl;
	} else {
		cout << "Three" << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  VI x(3), y(3);
  REP(i, 3) cin >> x[i] >> y[i];

  long double a = sqrt((x[0]-x[1])*(x[0]-x[1]) + (y[0]-y[1])*(y[0]-y[1]));
  long double b = sqrt((x[1]-x[2])*(x[1]-x[2]) + (y[1]-y[2])*(y[1]-y[2]));
  long double c = sqrt((x[2]-x[0])*(x[2]-x[0]) + (y[2]-y[0])*(y[2]-y[0]));
  long double t = (a+b+c)/2;
  long double s = sqrt(t*(t-a)*(t-b)*(t-c));
  long double r = 2*s/(a+b+c);
  long double ans = r*max({a, b, c})/(2*r+max({a,b,c}));

  cout << fixed << setprecision(15) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A.begin(), A.end());
  bool isok = true;
  for (int i = 0; i + 1 < N; i++) {
    isok &= A[i] != A[i + 1];
  }
  cout << (isok ? "YES" : "NO") << endl;
  return 0;
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    char c;

    cin >> c;
    if( 'A' <= c && c <= 'Z' ){
        cout << 'A' << endl;
    }else{
        cout << 'a' << endl;
    }
}


Measured memory_bytes: 3636
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
      
if __FILE__ == $0
  while line = STDIN.gets
    tokens = line.chomp!.split.map!(&:to_i)
    x, y = tokens[0], tokens[1]
    break if x == 0 && y == 0

    if x > y
      x, y = y, x
    end

    puts "#{x} #{y}"
  end
end

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


n = int(input())
edges = [[] for _ in range(n)]

for _ in range(n-1):
    _from, to, dist = map(int, input().split())
    edges[_from-1].append([to-1, dist])
    edges[to-1].append([_from-1, dist])

q, k = map(int, input().split())
k -= 1

distance_from_k_to = [10**7] * n
distance_from_k_to[k] = 0

todo = []
while edges[k]:
    to, dist = edges[k].pop()
    todo.append([to, dist])

while todo:
    node, dist = todo.pop()
    if distance_from_k_to[node] != 10**7:  # if node has been seen
        continue

    distance_from_k_to[node] = dist
    while edges[node]:
        to, add_dist = edges[node].pop()
        todo.append([to, dist+add_dist])

for _ in range(q):
    start, goal = map(int, input().split())
    start, goal = start-1, goal-1
    ans = distance_from_k_to[start] + distance_from_k_to[goal]
    print(ans)


Measured memory_bytes: 52896
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int x,a,b;
	cin >> x >> a >>b;
	int mi = abs (x-a);
	int mi2 = abs(x-b);
	if (mi < mi2) cout << 'A' << endl;
	else cout << 'B' << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){

  ios::sync_with_stdio(false);
  int N, M;   cin >> N >> M;
  vector<int> A(N);
  vector<pair<int , int>> pairs(M);
  for(int i = 0 ; i < N ; i++)	cin >> A[i];
  for(int i = 0 ; i < M ; i++)	cin >> pairs[i].second >> pairs[i].first;

  sort(pairs.begin() , pairs.end());
  sort(A.begin() , A.end(), greater<int>() );
  int count = N - 1;
  bool endFlag = false;
  //pairの大きいほうから指す
  for(int i = M - 1 ; 0 <= i && !endFlag && 0 <= count ; i--){

    for(int j = 0 ; j < pairs[i].second && 0 <= count ; j++){

      if(pairs[i].first < A[count]){
		endFlag = true;
		break;
      }
      
	A[count] = pairs[i].first;
	count--;
    }

  }

  long long ans = 0;
  for(int i = 0 ; i < N ; i++)  ans += A[i];

  cout << ans << endl;


  return 0;
}


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

int main() {
    int m, n;
    cin >> n >> m;
    int all = 0;
    vector<int> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x.at(i);
        all += x.at(i);
    }

    sort(x.begin(), x.end());
    reverse(x.begin(), x.end());

    if (x.at(m - 1) * 4 * m < all) {
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;
}

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

int main(void){
    int N,K;
    cin>>N>>K;

    if(N==K&&N==1)
        cout<<0<<endl;
    else if(N%K!=0)
        cout<<1<<endl;
    else
        cout<<0<<endl;
    return 0;
}


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

void debug_vector(vector<int>& v){
    int n = v.size();
    for (int i = 0; i < n; i++){
        cout << v[i] << " ";
    }
    cout << endl;
}

int main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<vector<int>> red, blue;
    vector<int> tmp;
    int a, b;    
    for (int i = 0; i < N; i++){
        cin >> a >> b;
        tmp.push_back(a);
        tmp.push_back(b);
        red.push_back(tmp);
        tmp.clear();
    }
    for (int i = 0 ; i < N; i++){
        cin >> a >> b;
        tmp.push_back(a);
        tmp.push_back(b);
        blue.push_back(tmp);

        tmp.clear();
    }
    // 赤点の x 座標が最も大きいところから見ていく．
    // そして対応させる青点は y 座標が最小を選んでいく．
    sort(red.begin(), red.end());
    for (int i = N - 1; i > - 1; i--){
        sort(blue.begin(),blue.end(),[](const vector<int> &alpha,const vector<int> &beta){return alpha[1] < beta[1];});
        for (int j = 0; j < blue.size(); j++){
            if (red[i][0] < blue[j][0] && red[i][1] < blue[j][1]){
                // cout << red[i][0] << " " << red[i][1] << " " << blue[j][0] << " " << blue[j][1] << endl;
                ans++;
                blue.erase(blue.begin() + j);
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lll long long
#define llf __float128
#define lld long double
using namespace std;
const int NR= 2e5 + 20 ,oo = 1e5 + 10, MOD = 1e9 + 7 ;
const long double pi = 2*acos(0.0);



int main () {
    int i , a , b , c , l ,r , d ;
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0) ;
    cin >> l >> r >> d ;
    cout << r/d - (l-1)/d << '\n' ;

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <map>

using namespace std;

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

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
long long ans[15];
const int N = 1e6 + 10;
 
int main()
{
    long long h, w, node[N], inf = 1e9 + 7, n, a, b, cnt = 0;
    cin >> h >> w >> n;
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        for(int i = -2; i <= 0; i++){
            for(int j = -2; j <= 0; j++){
                if(a + i >= 1 && b + j >= 1 && a + i <= h - 2 && b + j <= w - 2){
                    node[cnt] = inf * (a + i) + (b + j);
                    cnt++;
                }
            }
        }
    }
    sort(node, node + cnt);
    long long tmp = 1, zero = (h - 2) * (w - 2);
    for(int i = 0; i <= cnt - 1; i++){
        if(node[i + 1] == node[i]) tmp++;
        else{
            ans[tmp]++;
            tmp = 1;
            zero--;
        }
    }
    cout << zero << endl;
    for(int i = 1; i <= 9; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 7936