akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y>a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[200613];
int l[200610];
long long j[3020];

long long x,y,z[200101],mod=998244353;
string r;
//char r[111];

P u[1];
queue<int> q;

stack<int> s;
map<int,int> p;
vector<int> v;

bool as(P a,P b)
{
  if(a.x==b.x)
  return a.y<b.y;
  return a.x<b.x;
}

int main()
{
  scanf("%d",&a);
  z[0]=1;
  for(int t=1;t<=a;t++)
    z[t]=z[t-1]*2%mod;
  for(int t=0;t<a;t++)
    scanf("%1d",&o[t]);
  for(int t=1;t<=a;t+=2)
  if(a%t==0) v.push_back(a/t);
  reverse(v.begin(),v.end());
  for(int t=0;t<v.size();t++)
  {
    int k=0;
    for(int i=0;i<a;i++)
      if(i/v[t]%2==0)l[i]=o[i%(v[t])];
      else l[i]=1-o[i%(v[t])];
    //printf("%d ",v[t]);
    //for(int i=0;i<a;i++)
    //printf("%d",l[i]);
    for(int i=0;i<a;i++)
    {
      if(o[i]>l[i]) break;
      if(o[i]<l[i])
      {
        k=1;
        break;
      }
    }
    //puts("");
    //for(int i=0;i<a;i++)
   // printf("%d",l[i]);
    //puts("");
    x=1;
    for(int i=v[t]-1;i>=0;i--)
      if(l[i]==1) x+=z[v[t]-1-i],x%=mod;
    j[t]=x-k;
    for(int h=0;h<t;h++)
    if(v[t]%v[h]==0) j[t]=(j[t]-j[h]+mod)%mod;
    y+=j[t]*2%mod*v[t]%mod;
    y%=mod;
    //printf("%d\n",j[t]);
  }
  printf("%lld",y);
}





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

int main()
{
	double a,b,x;
	cin >> a >> b >> x;
	double v = a*a*b;
	if (x <= v/2)
	{
		cout << setprecision(10) <<  atan(a*b*b / (2 * x)) * 180 / M_PI << endl;
	}
	else
	{
		cout << setprecision(10) << atan((v-x)*2 / (a*a*a)) * 180 / M_PI << endl;
	}
	return 0;
}

Measured memory_bytes: 384
n,q=map(int,input().split())
list1=[[] for k in range(n)]
for i in range(q):
  list2=list(map(int,input().split()))
  if list2[0]==0:
    list1[list2[1]].append(list2[2])
  elif list2[0]==1:
    if list1[list2[1]]!=[]:
      print(list1[list2[1]][0])
  else:
    if list1[list2[1]]!=[]:
      del list1[list2[1]][0] 


Measured memory_bytes: 13700
#include<bits/stdc++.h>
#define ll long long
#define MAX 1000005
#define MOD (ll)(1e9+7)
#define INF INT32_MAX
#define INFL INT64_MAX
#define con(x,y)	((x)*(m)+(y))
using namespace std;

int dsu[MAX];
int sz[MAX];

int search(int a)	{
	if(dsu[a]==a)	return a;
	return dsu[a]=search(dsu[a]);
}

void join(int a, int b)	{
	a = search(a);
	b = search(b);
	if(sz[a]<sz[b])	{
		dsu[b]=a;
		sz[a]+=sz[b];
	}
	else {
		dsu[a]=b;
		sz[b]+=sz[a];
	}
}

void solve()	{
	int n,m;
	cin >> n >> m;
	string s[n];
	for(int i=0; i<m*n; i++)	{
		sz[i]=1;
		dsu[i]=i;
	}
	for(int i=0; i<n; i++)	cin >> s[i];
	for(int i=0; i<n; i++)	{
		for(int j=0; j<m; j++)	{
			//cout << con(i,j) << endl;
			if(j+1<m && s[i][j]=='#' && s[i][j+1]=='#')	{
				if(search(con(i,j))!=search(con(i,j+1)))	
					join(con(i,j),con(i,j+1));
			}
			if(i+1<n && s[i][j]=='#' && s[i+1][j]=='#')	{
				if(search(con(i,j))!=search(con(i+1,j)))
					join(con(i,j),con(i+1,j));
			}
		}
	}
	bool f=0;
	for(int i=0; i<n; i++)	{
		for(int j=0; j<m; j++)	{
			if(s[i][j]=='#')	{
				if(sz[search(con(i,j))]==1)	{
					f=1; break;
				}
			}
		}
	}
	if(f)	cout << "No\n";
	else cout << "Yes\n";
}

int main()	
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin >> t;
	for(int i=1; i<=t; i++)	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3620
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long int N,M,V,P;
	cin>>N>>M>>V>>P;
	vector<long long int>v(N);
	for(auto &i:v)cin>>i;
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	long long int L=P-1,R=N;
	while(R-L>1){
		long long int mid=(L+R)/2;
		long long int sum=0;
		if(v[P-1]>v[mid]+M){
			R=mid;
			continue;
		}
		for(int i=P-1;i<N;i++){
			if(i==mid)continue;
			sum+=max(0LL,min(M,v[mid]+M-v[i]));
		}
		if((V-P)*M<=sum)L=mid;
		else R=mid;
	}
	cout<<R<<endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var aho = Console.ReadLine().Split();
    var h = int.Parse(aho[0]);
    var n = int.Parse(aho[1]);
    var a = Console.ReadLine().Split();
    var g=0;
    foreach(var b in a){
      g += int.Parse(b);
    }
    if(g >= h){
     Console.WriteLine("Yes");
    }
    else{Console.WriteLine("No");}
  }
}

Measured memory_bytes: 16096
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	cin>>N;
	int M;
	cin>>M;
	int a[M];
	long long d=0;
	for(int i=0;i<M;i++)
	{
		cin>>a[i];
		d=d+a[i];
	}

	if(d>N)
	{
		cout<<"-1";
	}
	else
	{
		cout<<(N-d);
	}
	return 0;
}

Measured memory_bytes: 3672
#! /usr/bin/env python3

def main():
    N, M = map(int, input().split())
    A = []
    B = []
    d = {}

    for i in range(M):
        a, b = sorted(map(int, input().split()))
        if b in d:
            d[b] += [a]
        else:
            d[b] = [a]
    q = [N]
    cnt = 3
    while q and cnt > 0:
        cnt -= 1
        p = q
        q = []
        for i in p:
            if i == 1:
                print('POSSIBLE')
                return
            if i in d:
                q += d[i]
    print('IMPOSSIBLE')
    return
        
if __name__ == '__main__':
    main()


Measured memory_bytes: 31920
package main

import (
	"container/heap"
	"fmt"
)

func indexOfMax(list []int) (int, int, int) {
	var maxIndex, max, sec int
	for i, n := range list {
		if n > max {
			maxIndex = i
			max = n
			sec = max
		} else if n > sec {
			sec = n
		}
	}

	return max, maxIndex, sec
}

func main() {
	var n, m int
	n = scanInt()
	m = scanInt()

	prices := &queue{}
	heap.Init(prices)
	for i := 0; i < n; i++ {
		price := scanInt()
		heap.Push(prices, price)
	}

	for i := 0; i < m; i++ {
		max := heap.Pop(prices)
		heap.Push(prices, max.(int)/2)
	}

	var sum int
	for prices.Len() > 0 {
		sum += prices.Pop().(int)
	}
	fmt.Println(sum)

}

func scanStr() string {
	var s string
	fmt.Scan(&s)
	return s
}

func scanInt() int {
	var i int
	fmt.Scan(&i)
	return i
}

type queue []int

func (h queue) Len() int {
	return len(h)
}

func (h queue) Less(i, j int) bool {
	return h[i] > h[j]
}

func (h queue) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
}

func (h *queue) Push(x interface{}) {
	*h = append(*h, x.(int))
}

func (h *queue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]

	return x
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

int frq[57];
int main(){
	Lancer();
	string str1, str2,str="";
	cin >> str1 >> str2;
	for (int i = 0; i < max(str1.length(), str2.length()); i++){
		if (i < str1.length())
			str += str1[i];
		if (i < str2.length())
			str += str2[i];
	}
	cout << str;
	cout << endl;
	return 0;
}


Measured memory_bytes: 3664
use std::io;


fn main() {
    let mut a = read_one::<String>().chars().rev().collect::<Vec<char>>();
    let mut b = read_one::<String>().chars().rev().collect::<Vec<char>>();
    let mut c = read_one::<String>().chars().rev().collect::<Vec<char>>();

    let mut past = a.pop().unwrap();
    loop {
        match past {
            'a' => {
                if a.len() > 0 {
                    past = a.pop().unwrap();
                } else { println!("A"); break; }
            },
            'b' => {
                if b.len() > 0 {
                    past = b.pop().unwrap();
                } else { println!("B"); break; }
            },
            'c' => {
                if c.len() > 0 {
                    past = c.pop().unwrap();
                } else { println!("C"); break; }
            },
            _ => unreachable!()
        }
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split(' ')
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	vector<int> vec = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int n;
	cin >> n;
	cout << vec[n - 1] << endl;
}

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



int main() {
 int N;
  cin >> N;
  
  vector<string> s(N);
  
  for(int i=0;i<N; i++)
    cin >> s.at(i);
  
  int M;
  cin >> M;
  
  vector<string> t(M);
  for(int i=0; i<M; i++)
    cin >> t.at(i);
  
  int max = 0;
  for(int i=0;i<N; i++){
    int count = 0;
    for(int j=0;j<N; j++){
      if(s.at(i) == s.at(j))
        count++;
      
    }
    for(int j=0;j<M; j++){
      if(s.at(i) == t.at(j))
        count--;
    }
    if(count > max)
      max = count;

  }
  if(max < 0)
    cout << 0 << endl;
  else
    cout << max << endl;
  
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int ans=0;
  char s[3];
  char t[3];
  scanf("%s",&s);
  scanf("%s",&t);
  
  for(int i=0;i<3;i++){
    if(s[i]==t[i]){
      ans++;
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#else
template<class...T>void dprint(T&&...t){_print(cerr,t...);}
#endif
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<<(ostream&o,const multiset<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    vi a(n),b(n);
    cin>>a>>b;
    ll ac=0;
    REP(i,n){
        if(a[i]<b[i]){
            ac+=(b[i]-a[i])/2;
        }
        else if(a[i]>b[i]){
            ac-=(a[i]-b[i]);
        }
    }
    Yes(ac>=0);
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int dp[2][3];
int main(){
  int n;
  cin>>n;
  int a[n],b[n],c[n];

  for(int i=0; i<n; i++) cin>>a[i]>>b[i]>>c[i];
  for(int i=0; i<n; i++){
    for(int j=0; j<3; j++){
      if(i==0){
        if(j==0) dp[i%2][j]=a[i];
        else if(j==1) dp[i%2][j]=b[i];
        else if(j==2) dp[i%2][j]=c[i];
      }
      else{
        for(int k=0; k<3; k++){
          if(j==k) continue;
          if(j==0) dp[i%2][j]=max(dp[i%2][j],dp[(i-1)%2][k]+a[i]);
          else if(j==1) dp[i%2][j]=max(dp[i%2][j],dp[(i-1)%2][k]+b[i]);
          else if(j==2) dp[i%2][j]=max(dp[i%2][j],dp[(i-1)%2][k]+c[i]);
        }
      }
    }
  }

  int ret=0;
  ret = max(dp[(n-1)%2][0],dp[(n-1)%2][1]);
  ret = max(ret, dp[(n-1)%2][2]);
  cout<<ret;

}


Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
/*                   وتزودوا فإن خير الزاد التقوى                    */
/*       وما تدري نفس ماذا تکسب غدا وما تدري نفس باي ارض تموت      */
#include <bits/stdc++.h>
#include<unordered_map>
#include<iomanip>
#include<fstream>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long
#define dll double
#define PI acos(-1)
#define watch(x) cout<<#x<<" = "<<x<<" \n"
#define sz(n) n.size()
#define M_Sayed fast() 
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define RT(v) return cout<<v,0
#define MP					make_pair
int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
const double EPS = (1e-7);
const ll  mod = (1e9 + 7), OO = 1e9;
ll Ceil(ll x, ll y) { return (x + y - 1) / y; }
void run() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("input", "r", stdin);
	//freopen("output", "w", stdout);
#endif
}
void fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
ll n, m, oo = 1e7;
vector<vector<char>>grid(1005, vector<char>(1005, '#'));
ll vis[1005][1005];
ll so(int x, int y)
{
	if (grid[x][y] == '#')return 0;
	if (x == n && y == m)return 1;
	ll &ret = vis[x][y];
	if (~ret)return ret;
	ret = 0;
	ll c1, c2;
	c1= so(x + 1,y);
	c2= so(x,y+1);
	ret = (c1 % mod + c2 % mod) % mod;
	return ret %= mod;
}
int main()
{
	//run();
	M_Sayed;
	cin >> n >> m;
	memset(vis, -1, sizeof vis);
	for(int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)cin >> grid[i][j];
	}
	RT(so(1, 1));

}

Measured memory_bytes: 9216
{-# LANGUAGE BangPatterns, ForeignFunctionInterface #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Char (ord, isDigit)
import Data.Bits
import Data.Int
import Data.List
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import System.IO (stdin)

foreign import ccall "getchar_unlocked" cGetChar :: IO Char

-- Assume that input has non-digit symbol at the end.
readIONat :: (Bits a, Integral a) => IO a
readIONat = do
  let reader ch = fromIntegral $ ord ch - ord '0'

  digit0 <- fix
    (\(!f) (!_) -> do
      ch <- cGetChar
      if isDigit ch then return ch else f ch
    )
    ' '
  flip fix (return $ reader digit0) $ \(!f) (!acc) -> do
    s <- cGetChar
    if not (isDigit s)
      then acc
      else do
        a <- acc
        let a' = shiftL a 1 + shiftL a 3 + reader s
        a' `seq` f (return a')

solve :: Int -> VU.Vector Int16 -> Int32
solve !n !hs = fst dp
 where
  -- dp[i]: minimal cost of moving from 1st to i-th place
  dp :: (Int32, Int32)
  dp = VU.foldl'
    (\(!dp1, !dp2) (!i, !v) -> if i == 0
      then (0, dp1)
      else if i == 1
        then (dp1 + abs (fromIntegral $ v - hs VU.! 0), dp1)
        else
          ( min (dp1 + abs (fromIntegral $ v - hs VU.! (i - 1)))
                (dp2 + abs (fromIntegral $ v - hs VU.! (i - 2)))
          , dp1
          )
    )
    (-1, -1)
    (VU.indexed hs)

main = do
  n  <- readIONat
  hs <- VU.replicateM n readIONat
  print $ solve n hs


Measured memory_bytes: 1148
#include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
#include <vector>
#define P(a) ((a)*(a))
using namespace std;

int main(){
    double xa,ya,ra,xb,yb,rb,dist;
    int n;
    cin >> n;
    while(n--){
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        dist=sqrt(P(xb-xa)+P(yb-ya));
        if(ra>rb&&fabs(ra-rb)>dist) cout << "2" << endl;
        else if(ra<rb&&fabs(ra-rb)>dist) cout << "-2" << endl;
        else if(dist<=ra+rb&&fabs(ra-rb)<=dist) cout << "1" << endl;
        else cout << "0" << endl;
    }
    return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll a, b; cin >> a >> b;
  ll flag = 1, ans = 0;
  while(flag < b)
  {
    ans++;
    flag += (a - 1);
  }
  fin(ans)
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std; int d[11], n, m, i, a, b, sum, e;
int main() {
	while (true) {
		memset(d, 0, sizeof(d)); sum = 0;
		cin >> n >> m; if (!n) { break; }
		for (i = 0; i < n; i++) {
			cin >> a >> b;
			d[b] += a;
		}
		for (i = 10; i >= 0;i--){
			e = min(d[i], m);
			m -= e;
			sum += i*(d[i] - e);
		}
		cout << sum << endl;
	}
}

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

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

int main(){
	unsigned int x , y;
	cin >> x >> y;
	cout << gcd(x , y) << endl;
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int n;
  cin>>n;
  vector<int> v(n),c(n);
  rep(i,n){
    cin>>v[i];
  }
  rep(i,n){
    cin>>c[i];
  }
  int ans = 0;
  rep(i,n){
    int x = v[i] - c[i];
    if (x>0) ans += x;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

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

const int INF = 1 << 24;
 
int main(void){
    for(double a, s; s = 0, cin >> a; printf("%.8f\n", s))
        rep(i, 10) s += a /= i ? i % 2 ? 0.5:3:1;
 
    return 0;
}

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

namespace _0184
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == 0) break;

                int[] Cnt = new int[7];
                for (int i = 0 ; i < n ; i++)
                {
                    int ageClass = (RInt() / 10);
                    if (ageClass <= 5) Cnt[ageClass]++; else Cnt[6]++;
                }

                for (int i = 0 ; i < Cnt.Length ; i++)
                {
                    Console.WriteLine(Cnt[i]);
                }
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 19996
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

void Main() {
	int n,ans=0; cin >> n;
	vector<int> v(n); rep(i, n)cin >> v[i];
	rep(i, n) {
		repi(j, i+1, n) {
			ans += v[i] * v[j];
		}
	}
	cout << ans;
}


int main() {
	Main();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  int sum = 0;
  for(int i = 0;i < n;i++){
    cin >> s[i];
    sum += s[i];
  }
  sort(s.begin(),s.end());
  for(int i = 0;i < n;i++){
    if(sum % 10 == 0){
     sum -= s[i];
      if(i >= 1){
        sum += s[i-1];
      }
    }else{
      break;
    }
  }
  if(sum % 10 == 0)sum = 0;
  cout << sum << endl;
}

Measured memory_bytes: 256
ii=lambda:map(int,raw_input().split())
n,m=ii()
q=[ii() for _ in range(m)]
r=[1]+[0]*(n-1)
b=[1]*n
for x,y in q:
    b[x-1]-=1;b[y-1]+=1
    if r[x-1]==1:r[y-1]=1
    if b[x-1]==0:r[x-1]=0
print sum(r)


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

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

int ten[2222][2222];
int edgeH[2222][2222];
int edgeW[2222][2222];

int main(){
	
	int n,m,q;cin >> n >> m >> q;
	
	for(int i = 1; i <= n;i++){
		string str;cin >> str;
		for(int j = 1;j <= m;j++){
			if(str[j-1] == '1')ten[i][j] = 1; 
		}
	}
	
	for(int i = 1; i <= n;i++){
		for(int j = 1;j <= m;j++){
			if(ten[i][j]){
				edgeH[i][j] = ten[i-1][j];
				edgeW[i][j] = ten[i][j-1];
			}
		}
	}
	
	for(int i = 1; i <= n;i++){
		for(int j = 1;j <= m;j++){
			ten[i][j+1] += ten[i][j];
			edgeH[i][j+1] += edgeH[i][j];
			edgeW[i][j+1] += edgeW[i][j];
		}
	}
	
	for(int i = 1; i <= n;i++){
		for(int j = 1;j <= m;j++){
			ten[i+1][j] += ten[i][j];
			edgeH[i+1][j] += edgeH[i][j];
			edgeW[i+1][j] += edgeW[i][j];
		}
	}
		
	REP(i,q){
		int y1, x1, y2, x2;
		cin >> y1 >> x1 >> y2 >> x2;
		int point = ten[y2][x2] - ten[y1-1][x2] - ten[y2][x1-1] + ten[y1-1][x1-1];
		int edgeh = edgeH[y2][x2] - edgeH[y1][x2] - edgeH[y2][x1-1] + edgeH[y1][x1-1];
		int edgew = edgeW[y2][x2] - edgeW[y1-1][x2] - edgeW[y2][x1] + edgeW[y1-1][x1];
		int edge = edgeh + edgew;
		cout << point - edge << endl;
	}

	return 0;
}


Measured memory_bytes: 59136
#include <iostream>
 
int main(void)
{
    for ( int i = 1; i < 10; i++ )
    {
        for ( int j = 1; j < 10; j++ )
        {
            std::cout << i << "x" << j << "=" << i*j << std::endl;
        }
    }
    return 0;
}

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

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

    double A, B;
    cin >> A >> B;
    for (int i = 1; i <= 2000; ++i) {
        double tax8 = i * 0.08;
        double tax10 = i * 0.1;
        if (A <= tax8 && tax8 < A + 1 && B <= tax10 && tax10 < B + 1) {
            cout << i << endl;
            exit(0);
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
s=input()
f=int(s[:2])
b=int(s[2:])
if 0<f<13:
    if 0<b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<b<13:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 2940
m = int(input())    #money
c =0    #count coin
tc = 0   #temp coin
if m>=25:
    c = m//25
    m = m-(25*c)

if  m>=10:
    tc = m//10
    m = m-(10*tc)
    c += tc

if m>=5:
    tc = m//5
    m = m-(5*tc)
    c += tc

if m>=0:
    tc = m//1
    m = m-(1*tc)
    c += tc
    
print(c)
    


Measured memory_bytes: 5592
N, M = map(int, input().split())
def int_(num_str):
    return int(num_str) * -1

Alist = list(map(int_, input().split()))
from heapq import heapify, heappop, heappush
heapify(Alist)
for i in range(M):
    heappush(Alist, heappop(Alist)/2)
ans = map(int_, Alist)
print(sum(ans))

Measured memory_bytes: 91416
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdio>
#include<sstream>
#include<utility>
#include<string>
#include<cstdlib>
#include<valarray>
#include<algorithm>
#include<vector>
#include<iterator>
#include<list>
#include<set>
#include<numeric>
#include<bits/stdc++.h>
#define ll long long
ll prime[1000002];
using namespace std;
int Prime(int a)
{
    for(int i=2;i<=a/2;++i)
    {
        if(a%i==0)
        {
            return 0;
        }
    }
    return 1;
}
void sieve()
{   for(int i=0;i<=1000001;i++)
    prime[i]=0;
    int maxn=1000001;
    for(int i=2;i<=maxn;i++)
    {
        if(prime[i]==0)
        {
            for(int j=i;j<=maxn;j+=i)
            {
                prime[j]++;
            }
        }
    }
}
void fibo(ll a[],ll n)
{
    ll x=0;
    ll y=1;
    a[0]=0;
    a[1]=1;
    for(ll i=2;i<n;++i)
    {
        a[i]=(x+y)%10;
        x=y;
        y=a[i];
    }
}
ll f(ll w[],ll a[][2],ll i,ll y)
{
    for(ll j=0;j<y;++j)
    {
        if(a[i][2]<=w[j])
        {
            cout<<a[i][2];
            return w[j];
        }
    }
    return w[y-1];
}
ll s(ll v[],ll a[][2],ll i,ll x)
{
    for(ll j=0;j<x;++j)
    {
        if(a[i][1]>=v[j])
        {
            cout<<" "<<a[i][1]<<" ";
            return v[j];
        }
    }
    return v[0];
}
bool binarySearch(vector <ll> arr, int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return 1; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return 0; 
}
int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll d,n,i,x,y,c=0;
    cin>>n>>d;
    for(i=0;i<n;++i)
    {
        cin>>x>>y;
        if(x*x+y*y<=d*d)
        {
            c++;
        }
    }
    cout<<c;
    return 0;
}


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

using namespace std;

typedef long long ll;

ll A[101010], B[101010];
ll n, m, t, k;

bool check(ll p)
{
	ll i, j, x, v;
	
	for(i = 0; i < n; i ++){
		B[i] = A[i];
	}
	
	for(i = t, j = p; i && j < n; i --, j ++){
		B[j] += m;
	}
	
	x = i * m;
	
	for(j = p - 1; j >= 0; j --){
		v = min(x, max(0ll, B[p] - B[j]));
		x -= v; B[j] += v;
	}
	
	for(j = 0; x; j ++){
		v = min(x, m - (B[j] - A[j]));
		x -= v; B[j] += v;
	}
	
	sort(B, B + n);
	
	return B[n - k] <= A[p] + m;
}

int main()
{
	ll i, s, e;
	
	scanf("%lld%lld%lld%lld", &n, &m, &t, &k);
	
	for(i = 0; i < n; i ++){
		scanf("%lld", A + i);
	}
	
	sort(A, A + n);
	reverse(A, A + n);
	
	for(s = 0, e = n - 1; s <= e; ){
		if(check(s + e >> 1)) s = (s + e >> 1) + 1;
		else e = (s + e >> 1) - 1;
	}
	
	printf("%lld\n", s);
	
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll>PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e4+7;
int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> hw(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> hw[i][j];
    rep(i, h + 2) {
        rep(j, w + 2) {
            if ( i == 0 || i == h + 1 || j == 0 || j == w + 1 ) {
                cout << '#';
            }
            else {
                cout << hw[i-1][j-1];
            }
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

ans = 0
while max(H) > 0:
  grp = [[]]
  for i,h in enumerate(H):
    if h == 0:
      if len(grp[-1]) > 0: grp.append([])
    else: grp[-1].append((i,h))
  for g in grp:
    if len(g) == 0: continue
    Min = min([h for _,h in g])
    ans += Min
    for i,_ in g: H[i] -= Min
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int a,b,c,d,tmp ;

int main(void){

    scanf ("%d%d%d%d",&a,&b,&c,&d) ;
    
    if ( a>c ){
        tmp = c ;
        c = a ;
        a = tmp ;
    }
    
    if ( c-a<=d ){
        printf ("Yes\n") ;
    }
    else if ( c>b && b>a && c-b<=d && b-a<=d ){
        printf ("Yes\n") ;
    }
    else {
        printf ("No\n") ;
    }
    
    return 0 ;
    
    
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main() {
    ll a,b,v,w,t;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;

    ll l = abs(b-a);

    if(v>w){

        if(l <= t*(v-w)){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }

    }else{
        cout<<"NO"<<endl;
    }

}

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

static const int MAX = 100;

void print_array(int n, int buf[]) {
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      printf(" ");
    }

    printf("%d", buf[i]);
  }

  printf("\n");
}

int main() {
  int n = 0, buf[MAX];
  scanf("%d", &n);

  for (int i = 0; i < n; i++) scanf("%d", &buf[i]);

  print_array(n, buf);

  for (int i = 1; i < n; i++) {
    int j = i;
    while (j > 0 && buf[j] < buf[j - 1]) {
      swap(buf[j], buf[j - 1]);
      j--;
    }

    print_array(n, buf);
  }

  return 0;
}



Measured memory_bytes: 2716
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int gcd(int a, int b){
  int ma = max(a,b);
  int mi = min(a,b);
  if(mi == 0) return ma;

  return gcd(mi, ma%mi);
}

int main(){
  int ans = 0;
  int K;
  cin >> K;
  for(int i=1; i<=K-2; ++i){
    for(int j=i+1; j<=K-1; ++j){
      for(int k=j+1; k<=K; ++k){
        ans += 6 * gcd(gcd(i,j),k);
      }
    }
  }
  for(int i=1; i<=K-1; ++i){
    for(int j=i+1; j<=K; ++j){
      ans += 6 * gcd(i,j);
    }
  }
  for(int i=1; i<=K; ++i){
    ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<cstring>
#define mod 1000000007
using namespace std;
int h[101000],nxt[201000],K=0,to[201000],from[201000];
int dfs[101000],low[101000],dfn=0,st[101000],top=0,tot=0,used[101000];
long long fac[101000],inv[101000];
long long ans=1;int n,m,k;
long long C(int a,int b){return fac[a]*inv[b]%mod*inv[a-b]%mod;}
void ins(int u,int v){nxt[++K]=h[u];h[u]=K;to[K]=v;from[K]=u;}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
long long qpow(long long x,int p)
{
	long long ans=1;
	while(p){if(p&1)ans=ans*x%mod;x=x*x%mod;p>>=1;}
	return ans;
}
void tarjan(int x,int f)
{
	dfs[x]=low[x]=++dfn;
	for(int i=h[x];i;i=nxt[i])
	{
		if(to[i]==f)continue;
		if(!dfs[to[i]])
		{
			st[++top]=i;tarjan(to[i],x);
			low[x]=min(low[x],low[to[i]]);
			if(low[to[i]]>=dfs[x])
			{
				tot++;int N=0,M=0;
				while(1)
				{
					if(used[from[st[top]]]!=tot)used[from[st[top]]]=tot,N++;
					if(used[to[st[top]]]!=tot)used[to[st[top]]]=tot,N++;
					M++;
					if(st[top--]==i)break;
				}
				if(N==2)ans=ans*k%mod;
				else if(N==M)
				{
					long long res=0;
					for(int j=1;j<=M;j++)res=(res+qpow(k,gcd(j,M)))%mod;
					res=res*qpow(M,mod-2)%mod;
					ans=ans*res%mod;
				}
				else
				{
					ans=ans*C(M+k-1,k-1)%mod;
				}
			}
		}
		else if(dfs[to[i]]<dfs[x])st[++top]=i,low[x]=min(low[x],dfs[to[i]]);
	}
}
int main()
{
	fac[0]=inv[0]=inv[1]=1;
	for(int i=1;i<=200;i++)fac[i]=fac[i-1]*i%mod;
	for(int i=2;i<=200;i++)inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	for(int i=1;i<=200;i++)inv[i]=inv[i-1]*inv[i]%mod;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=m;i++)
	{
		int a,b;scanf("%d%d",&a,&b);ins(a,b);ins(b,a);
	}
	for(int i=1;i<=n;i++)if(!used[i])tarjan(i,0);
	printf("%lld\n",ans);return 0; 
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
const int dx[] = {0,1,1,1,0,-1,-1,-1};
const int dy[] = {1,1,0,-1,-1,-1,0,1};

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VI x(n),y(n),w(n);
  map<PII,int> mp;
  rep(i,n){
    cin >> x[i] >> y[i] >> w[i];
    mp[{x[i],y[i]}] = w[i];
  }
  int ans = 0;
  rep(i,n){
    int add[8];
    rep(dir,8){
      add[dir] = mp[{dx[dir]+x[i],dy[dir]+y[i]}];
    }
    for(int dir = 0; dir < 8; dir+=2){
      ans = max<int>(ans,w[i] + add[dir] + add[(dir+1)%8] + add[(dir+2)%8]);
    }
  }
  cout << ans << " / " << 1<< endl;
  return 0;
}



Measured memory_bytes: 60244
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
int main()
{
    int tp,q,val;
    string key;
    map<string,int> mp;
    cin>>q;
    while(q--){
        cin>>tp;
        if(tp==1)
        {
            cin>>key;
            cout<<mp[key]<<"\n";
        }
        else if(tp==0){
            cin>>key>>val;
            mp[key]=val;
        }
        else if(tp==2){
            cin>>key;
            mp.erase(key);
        }
    }

}





Measured memory_bytes: 27736
#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
using namespace atcoder;
int op(int a, int b){
  return max(a, b);
}
int e(){
  return -1;
}
int l;
bool f(int x){
  return x < l;
}
int main(){
  int N, Q;
  cin >> N >> Q;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  segtree<int, op, e> S(A);
  for (int i = 0; i < Q; i++){
    int T;
    cin >> T;
    if (T == 1){
      int X, V;
      cin >> X >> V;
      X--;
      S.set(X, V);
    }
    if (T == 2){
      int L, R;
      cin >> L >> R;
      L--;
      cout << S.prod(L, R) << endl;
    }
    if (T == 3){
      int X, V;
      cin >> X >> V;
      X--;
      l = V;
      cout << S.max_right<f>(X) + 1 << endl;
    }
  }
}

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long K = inputArray[1];


			var kList = new List<double>();

			var point = (double)K;

			while (point>=0.5) {
				kList.Add(point);
				point /= 2;
			}

			var kakuritues = new double[N];
			var k = 0;

			for (var i = N; i >= 1; i--) {

				var p = kList[k];

				while (i < p) {
					k++;
					p= kList[k];
				}
				kakuritues[i-1] = 1 / Math.Pow(2, k);

			}

			//答えの出力
			var ans = kakuritues.Sum()/N;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 29280
/*
 _ _ _   _    _   _    _   _ _ _   _    _   _ __ _   __       __
|  _ _| | |  | | | |  | | |  _  | | |  | | |  __  | |   \   /   |
| |_ _  | |__| | | |  | | | |_| | | |__| | | |__| | | |\ \_/ /| |
|_ _  | |  __  | | |  | | |  _ <  |  __  | |  __  | | | \   / | |
 _ _| | | |  | | | |__| | | |_| | | |  | | | |  | | | |  \_/  | |  _   _   _
|_ _ _| |_|  |_| |_ __ _| |_ _ _| |_|  |_| |_|  |_| |_|       |_| |_| |_| |_|

*/

#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"
const int  MOD=1000000007;

void solve(){
    ll n,x,t;
    cin>>n>>x>>t;
    ll tp=n/x;
    if(n%x!=0)
        tp++;
    tp=tp*t;
    cout<<tp<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}


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

using namespace std;
using ll=long long;

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

template <class T1, class T2>
void printp(const string& name, const pair<T1, T2> *p,const int n){
  rep(i,n){
    cout<<name <<":("<< p[i].first <<","<<p[i].second << ")" << endl;
  }
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,m,a,b;cin>>n>>m;
  pair<int,int> itv[m];
  rep(i,m){
    cin>>a>>b;
    itv[i].first=b;
    itv[i].second=a;
  }
  //右端でソート
  sort(itv,itv+m);

  //ans=橋を切った回数,t=安全な場所
  int ans=0,t=0;
  rep(i,m){
    if(t<=itv[i].second){
      ans++;
      t=itv[i].first;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using ll = long long;
using namespace std;


int sod(int x) {
   int ans = 0;
   while(x) {
      ans += (x % 10);
      x /= 10;
   }
   return ans;
}


void solve() {
   int n, m;
   cin >> n >> m;
   vector <vector <int>> ans(n, vector <int> (m));
   vector <string> s(n);
   for(int i = 0; i < n; i++) {
      cin >> s[i];
   }

   for(int i = 0; i < n; i++) {
      for(int j = 0; j < m; j++) {
         if(s[i][j] == '#') continue;
         for(int di = -1; di <= 1; di++) {
            for(int dj = -1; dj <= 1; dj++) {
               if(di == 0 && dj == 0) continue;
               int r = i + di;
               int c = j + dj;
               if(r >= 0 && r < n && c >= 0 && c < m) {
                  ans[i][j] += s[r][c] == '#';
               }
            }
         }
      }
   }

   for(int i = 0; i < n; i++) {
      for(int j = 0; j < m; j++) {
         if(s[i][j] == '#') cout << s[i][j];
         else cout << ans[i][j];
      }
      cout << endl;
   }
}

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;
 
   for(int i = 0; i < testcase; i++) {
      solve();
   } 
   return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
const int mod = 1000000007;
const int INF = (1LL << 62) - 1;


int n,k;



vector<vector<int>> multiply(vector<vector<int>> a,vector<vector<int>> b)
{
 vector<vector<int>> ans(n,vector<int>(n,0));

  for(int i = 0; i < n; i++)
  {
    for(int j = 0; j < n; j++)
    {
      for(int k = 0;k < n; k++)
      {
        ans[i][j] += (a[i][k]%mod * b[k][j]%mod);
        ans[i][j] %= mod;
      }
    }
  }
  return ans;
}

int32_t main()
{



    IOS

    
    cin >> n >> k;


    vector<vector<int>> adj(n,vector<int>(n));

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

vector<vector<int>> dp(n,vector<int>(n,0));

for(int i = 0; i < n;i++)
{
  dp[i][i] = 1;
}


    while(k)
    {
      if(k%2)dp = multiply(dp,adj);
      adj = multiply(adj,adj);
      k/=2;
    }


    int ans = 0;




    for(auto i : dp)
    {
      for(auto j : i)
      {
        ans += j%mod;
        ans %= mod;
        
      }
    }
    cout << ans;





    return 0;
}



Measured memory_bytes: 384
import sys

def get(x,n):
    return ((1<<x)&(n))!=0


def main():
    mod=1000000000+7
    n=int(sys.stdin.readline())
    a=list(map(int,sys.stdin.readline().split()))
    ans=0
    cur=1
    for x in range(60):
        res=get(x,a[-1])
        now=res
        nnow=not res
        total=0
        for i in range(n-2,-1,-1):
            res=get(x,a[i])
            now+=res
            nnow+=not res
            if res:
                total+=nnow
            else:
                total+=now
        ans+=cur*total
        ans%=mod
        cur*=2
    print(ans%mod)
main()


Measured memory_bytes: 123132
/*input
10
3 2
3 2
-1 1
2 -1
-3 -9
-8 12
7 7
8 1
8 2
8 4
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

// from atcoder live
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1'000'000'007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


// antbook p108
template<typename T>
T gcd(T a, T b) {
// ll gcd(ll a, ll b) {
    if (b == 0) return abs(a);
    return gcd(b, a%b);
}

vector<P> p;

int main() {
  int n;
  cin >> n;
  int zero = 0;
  map<pair<ll, ll>, P> mp;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    ll g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) x = -x, y = -y;
    if (y == 0 && x < 0) x = -x, y = -y;
    bool rot90 = (x <= 0);
    if (rot90) {
      ll tmp = x;
      x = y; y = -tmp;
    }
    if (rot90) mp[{x, y}].first++;
    else mp[{x, y}].second++;
  }

  mint ans = 1;
  for (auto p: mp) {
    int s = p.second.first;
    int t = p.second.second;
    mint now = 1;
    now += mint(2).pow(s)-1;
    now += mint(2).pow(t)-1;
    ans *= now;
  }
  ans -= 1;

  ans += zero;
  cout << ans << endl;
}

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

using namespace std;

int e;

void solve() {
	int m = e;
	
	for (int y = 0; y * y <= e; y++) {
		for (int z = 0; z * z * z <= e; z++) {
			int x = e - (y * y) - (z * z * z);
			if (0 <= x) {
				m = min(m, x + y + z);
			}
		}
	}
	
	cout << m << endl;
}

int main() {
	while (1) {
		cin >> e; if (e == 0) break;
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1160