akhauriyash/Code-Regression huggingface dataset:
# https://atcoder.jp/contests/abc057/tasks/abc057_b


N, M = gets.split.map(&:to_i)

ans = []
as = Array.new(N)
bs = Array.new(N)
N.times do |i|
  as[i], bs[i] = gets.split.map(&:to_i)
end

cs = Array.new(M)
ds = Array.new(M)
M.times do |i|
  cs[i], ds[i] = gets.split.map(&:to_i)
end

N.times do |i|
  # 最小のマンハッタン距離を初期化しておく
  min_manhattan = 10 ** 8 * 2
  checkpoint = 0
  M.times do |j|
    # マンハッタン距離を求める
    manhattan = (as[i] - cs[j]).abs + (bs[i] - ds[j]).abs
    # もし、最小のマンハッタン距離だったら、記録しておく
    if manhattan < min_manhattan
      min_manhattan = manhattan
      checkpoint = j
    end
  end
  # 最小のマンハッタン距離をansに代入しておく
  ans << checkpoint + 1
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
//ll

int main(){
  int a,b,c;ll k;cin>>a>>b>>c>>k;
  if(k%2 == 0){
    if(abs(a-b)<=1000000000000000000)cout << a-b << endl;
    else cout << "Unfair" << endl;
  }else{
    if(abs(b-a)<=1000000000000000000)cout << b-a << endl;
    else cout << "Unfair" << endl;
  }
}

Measured memory_bytes: 256
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, K, S = list(map(int, sys.stdin.buffer.readline().split()))

ans = np.zeros(N, dtype=int)
if S < 10 ** 9:
    ans[:] = 10 ** 9
    ans[:K] = S
else:
    ans[:] = 1
    ans[:K] = 10 ** 9
print(*ans)


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

using namespace std;

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int dp[16][10010],ans;

int h, n, x, y;
bool b[4][10010];

int cul(int x) {
	int sum = 0;
	for (int i = 0;i < 4;i++) {
		if (b[i][x])sum += (1 << i);
	}
	return sum;
}

int main() {
	cin >> h >> n;
	for (int i = 0;i < n;i++) {
		cin >> x >> y;
		b[x][y] = 1;
	}
	for (int i = 0;i < 16;i++) {
		for (int j = 0;j < h;j++) {
			dp[i][j] = -1;
		}
	}
	dp[cul(0)][0] = 0;
	for (int i = 0;i < h - 1;i++) {
		for (int j = 0;j < 16;j++) {
			if (dp[j][i] == -1)continue;
			if (j == 6 || j == 10 || j == 5 || j == 15 || j == 7 || j == 14 || j == 11 || j == 13) {
				dp[cul(i + 1)][i + 1] = max(dp[j][i], dp[cul(i + 1)][i + 1]);
			}
			if (j == 2 || j == 3) {
				if (!b[2][i + 1] && !b[3][i + 1])dp[cul(i + 1) + 12][i + 1] = max(dp[cul(i + 1) + 12][i + 1], dp[j][i] + 1);
				dp[cul(i + 1)][i + 1] = max(dp[cul(i + 1)][i + 1], dp[j][i]);
			}
			if (j == 4 || j == 12) {
				if (!b[0][i + 1] && !b[1][i + 1])dp[cul(i + 1) + 3][i + 1] = max(dp[cul(i + 1) + 3][i + 1], dp[j][i] + 1);
				dp[cul(i + 1)][i + 1] = max(dp[cul(i + 1)][i + 1], dp[j][i]);
			}
			if (j == 1) {
				if (!b[1][i + 1] && !b[2][i + 1])dp[cul(i + 1) + 6][i + 1] = max(dp[cul(i + 1) + 6][i + 1], dp[j][i] + 1);
				if (!b[2][i + 1] && !b[3][i + 1])dp[cul(i + 1) + 12][i + 1] = max(dp[cul(i + 1) + 12][i + 1], dp[j][i] + 1);
				dp[cul(i + 1)][i + 1] = max(dp[cul(i + 1)][i + 1], dp[j][i]);
			}
			if (j == 8) {
				if (!b[0][i + 1] && !b[1][i + 1])dp[cul(i + 1) + 3][i + 1] = max(dp[cul(i + 1) + 3][i + 1], dp[j][i] + 1);
				if (!b[1][i + 1] && !b[2][i + 1])dp[cul(i + 1) + 6][i + 1] = max(dp[cul(i + 1) + 6][i + 1], dp[j][i] + 1);
				dp[cul(i + 1)][i + 1] = max(dp[cul(i + 1)][i + 1], dp[j][i]);
			}
			if (j == 9) {
				if (!b[1][i + 1] && !b[2][i + 1])dp[cul(i + 1) + 6][i + 1] = max(dp[cul(i + 1) + 6][i + 1], dp[j][i] + 1);
				dp[cul(i + 1)][i + 1] = max(dp[cul(i + 1)][i + 1], dp[j][i]);
			}
			if (j == 0) {
				if (!b[0][i + 1] && !b[1][i + 1])dp[cul(i + 1) + 3][i + 1] = max(dp[cul(i + 1) + 3][i + 1], dp[j][i] + 1);
				if (!b[1][i + 1] && !b[2][i + 1])dp[cul(i + 1) + 6][i + 1] = max(dp[cul(i + 1) + 6][i + 1], dp[j][i] + 1);
				if (!b[2][i + 1] && !b[3][i + 1])dp[cul(i + 1) + 12][i + 1] = max(dp[cul(i + 1) + 12][i + 1], dp[j][i] + 1);
				if (!b[0][i + 1] && !b[1][i + 1] && !b[2][i + 1] && !b[3][i + 1])dp[15][i + 1] = max(dp[15][i + 1], dp[j][i] + 2);
				dp[cul(i + 1)][i + 1] = max(dp[cul(i + 1)][i + 1], dp[j][i]);
			}
		}
	}
	for (int i = 0;i < 16;i++) {
		ans = max(ans, dp[i][h - 1]);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3804
#include <iostream>
#include <complex>

using namespace std;

typedef complex<double> P;

#define EPS (1.0e-11)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

double cross(P a, P b) {
    return (a.real() * b.imag() - a.imag() * b.real());
}


int main()
{
    double x[4], y[4];
    char comma;

    while (cin >> x[0] >> comma >> y[0]) {
        for (int i = 1; i < 4; i++) 
            cin >> comma >> x[i] >> comma >> y[i];

        double ck = 1;
        for (int i = 0; i < 4; i++) {
            ck *= cross(P(x[(i + 1) % 4] - x[i], y[(i + 1) % 4] - y[i]), 
                        P(x[(i + 2) % 4] - x[i], y[(i + 2) % 4] - y[i]));
        }
        if (ck > EPS)
            cout << "YES" << endl;
        else 
            cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1216
import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    var ans: BigInt = 0
    for (i <- 0 to n) {
      (i % 3, i % 5) match {
        case (0, 0) => ()
        case (0, _) => ()
        case (_, 0) => ()
        case _ => ans += i
      }
    }
    println(ans)
  }
  
  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      print(s"${arr(i)} ")
    }
    println()
  }
}

Measured memory_bytes: 57024
#include <iostream>
#include <algorithm>
using namespace std;
int n,s,ma=1000,ans;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		if(s%10!=0){
			ma=min(s,ma);
		}
		ans+=s;
	}
	if(ans%10!=0){
		cout<<ans<<endl;
	}else{
		if(ma==1000){
			cout<<0<<endl;
		}else{
			cout<<ans-ma<<endl;
		}
	}
	return 0;
}

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

int main () {
  int a, b;
  cin >> a >> b;

  if(a+b == 15) {
    cout << "+" << endl;
  } else if(a*b == 15) {
    cout << "*" << endl;
  } else {
    cout << "x" << endl;
  }

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <algorithm>
#include <array>
#include <cstring>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

int gcd(int x, int y) {
  x = std::abs(x); y = std::abs(y);
  int a = std::max(x,y), b = std::min(x,y);
  int r = a % b;
  while(r!=0){ a = b; b = r; r = a % b; }
  return b;
}

long long lcm(int x, int y) {
  return (long long)x * y / gcd(x, y);
}

int main(void) {
  int X, Y;
  scanf("%d %d", &X, &Y);
  printf("%d\n", X+Y/2);

  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline
# from collections import defaultdict
# import bisect

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

N, K = map(int, input().split())
S = input().rstrip()

ans = 0
bad = 0
for i in range(N - 1):
    if S[i] == S[i + 1]:
        ans += 1
    else:
        bad += 1

print(ans + min(bad, 2 * K))


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll c1 = 0, c2 = 0;
        for (int j = 0; j < n; j++) {
            if (j < i && a[j] > a[i]) {
                c1++;
            }
            if (a[j] > a[i]) {
                c2++;
            }
        }
        ll t = k * (k - 1LL) / 2LL;
        t %= MOD;
        ans += c1 * k % MOD + c2 * t % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define MAXN (int)(2*1e5 + 1)
#define MAXL 20
#define F first
#define endl "\n"
#define S second
#define MOD (int)(1e9 + 7)
#define MOD2 (lli) 998244353  
#define lli long long int
#define sz(a) int(a.size())
#define M_PI 3.1415
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1};

bool can(int num){
  int qt = 0;
  while(num > 0){
    num /= 10;
    qt++;
  }
  return qt%2!=0;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
 
  int n;
  cin >> n;
  int ans = 0;
  for(int i=1;i<=n;i++){
    if(can(i)) ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1330
#include <iostream>
#include <vector>
#include <limits>
#include <numeric>
//cut begin
template<typename T>
struct PotentializedUnionFind{
private:
    private:
    std::vector<int> par;
    std::vector<int> size;
    std::vector<T> diff;
public:
    PotentializedUnionFind(int n){
        par.resize(n);
        std::iota(par.begin(),par.end(),0);
        size.resize(n);
        std::iota(size.begin(),size.end(),0);
        diff.assign(n,0);
    }

    int root(int x){
        if(par[x]==x){
            return x;
        }
        else{
            int r=root(par[x]);
            diff[x]+=diff[par[x]];
            return par[x]=r;
        }
    }

    T potential(int x){
        root(x);
        return diff[x];
    }

    T potential_diff(int x,int y){
        return potential(y)-potential(x);
    }

    bool same(int x,int y){//0-indexed
        return root(x)==root(y);
    }

    void unite(int x,int y,T w){//0-indexed,potential(y)-potential(x)=w
        w+=potential(x);
        w-=potential(y);
        
        x=root(x);
        y=root(y);
        if(x==y)return;

        if(size[x]<size[y]){
            par[x]=y;
            size[y]+=size[x];
            diff[x]=-w;
        }
        else{
            par[y]=x;
            size[x]+=size[y];
            diff[y]=w;
        }
    }
};
//cut end

int solve(){
    int n,m;
    std::cin>>n>>m;
    if(n==0&&m==0)return 1;
    PotentializedUnionFind<long long> pu(n);
    for (int i = 0; i < m; ++i){
        char c;
        std::cin>>c;
        int x,y,z;
        std::cin>>x>>y;
        if(c=='0'){
            std::cin>>z;
            pu.unite(x,y,z);
        }
        else{
            if(pu.same(x,y))std::cout<<pu.potential_diff(x,y)<<std::endl;
            else std::cout<<"?"<<std::endl;
        }
    }
    return 0;
}

int main(){
    solve();
    return 0;
}


Measured memory_bytes: 4936
#include<iostream>
using namespace std;
#include<algorithm>
#include<vector>
struct bimatch{
	int n;
	vector<vector<int> >G;
	vector<int>match;
	vector<bool>used;
	bimatch(int _n=0):n(_n),G(n),match(n),used(n){}
	void add_edge(int u,int v)
	{
		G[u].push_back(v);
		G[v].push_back(u);
	}
	bool dfs(int v)
	{
		used[v]=true;
		for(int u:G[v])
		
		{
			int w=match[u];
			if(w<0||!used[w]&&dfs(w))
			{
				match[v]=u;
				match[u]=v;
				return true;
			}
		}
		return false;
	}
	int count()
	{
		int ans=0;
		fill(match.begin(),match.end(),-1);
		for(int v=0;v<n;v++)
		{
			if(match[v]<0)
			{
				fill(used.begin(),used.end(),false);
				if(dfs(v))ans++;
			}
		}
		return ans;
	}
};
int X,Y,E;
main()
{
	cin>>X>>Y>>E;
	bimatch m(X+Y);
	for(int i=0;i<E;i++)
	{
		int x,y;cin>>x>>y;
		m.add_edge(x,X+y);
	}
	cout<<m.count()<<endl;
}



Measured memory_bytes: 3260
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! { a: [i64] }
    let n = a.len() as i64;
    let mut mi = (1 << 40, 0);
    let sum: i64 = a.iter().sum();
    for (i, &a) in a.iter().enumerate() {
        mi = min(mi, ((a * n - sum).abs(), i));
    }
    puts!("{}\n", mi.1);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
n = int(input())
A = list(map(int, input().split()))

even =[]
even_pro = 1

for a in A:
    if a % 2 == 0:
        even.append(2)
    else:
        even.append(1)

for e in even:
    even_pro *= e

print(3**n - even_pro)


Measured memory_bytes: 61832
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	while(input.hasNextInt()){
    		int a = input.nextInt();
    		int b = input.nextInt();
    		int sum = a+b;
    		System.out.println(String.valueOf(sum).length());
    	}
    }
}

Measured memory_bytes: 20412
#include <bits/stdc++.h>
typedef long long       ll;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define f first
#define s second
#define fore(i,b,e)		  for(ll i=(ll)b;i<(ll)e;++i)
#define forr(i,b,e)		  for(ll i=(ll)b;i<(ll)e;++i)
ll faster_in(){ll r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<ll, ll>  ii;
typedef vector<ll>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = ll(1e9 + 7);
const ll tam = 1e6+10;
int MOD = 1e9 + 7;
int fact[tam+tam], invFact[tam+tam];

int modPow(int b, int e)
{
	if (b > MOD) b %= MOD;
	if (e == 0) return 1;
	int res = modPow(b, e/2);
	res = 1LL*res*res%MOD;
	if (e&1) res = (1LL*res*b)%MOD;
	return res;
}

int g(int y, int x)
{
	int res = 0;
	fore(i, 0, y+1)
	{
		int n = i+1;
		int m = x;
		res += (1LL*(1LL*fact[n+m]*invFact[m]%MOD)*invFact[n])%MOD;
		if (res >= MOD) res -= MOD;
	}
	return res;
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    fact[0] = invFact[0] = 1;
    fore(i, 1, tam+tam)
    {
    	fact[i] = 1LL*fact[i-1]*i%MOD;
    	invFact[i] = modPow(fact[i], MOD-2);
    }
    int y1, x1, y2, x2;
    cin >> y1 >> x1 >> y2 >> x2;
    ll res = 0LL + g(y2, x2) - g(y2, x1-1) - g(y1-1, x2) + g(y1-1, x1-1) + 2*MOD;
    cout << res%MOD << '\n';
    return 0;
}
// PLUS ULTRA!

Measured memory_bytes: 15872
d=int(input())
c= list(map(int, input().split()))
D= [list(map(int, input().split())) for i in range(d)]
t= [int(input()) for i in range(d)]

ans=[0]*(d+1)
v=sum(c)

# 最後にどの試験がいつ行われたか？
PL=[0]*26

for i in range(d):
    x=t[i]-1
    ans[i+1]+=ans[i]+D[i][x]
    PL[x]=i+1
    for j in range(26):
        ans[i+1]-=(i+1-PL[j])*c[j]

for i in range(1,d+1):
    print(ans[i])


Measured memory_bytes: 68412
def reconstruct preorder, inorder
  no=inorder.size-1
  root = preorder.shift
  unless root_idx = inorder.index(root)#???
    reconstruct(preorder,inorder)
    return
  end
  if root_idx==0
  else
    reconstruct(preorder,inorder[0...root_idx])#???
  end

  if root_idx==no
  else
    reconstruct(preorder,inorder[root_idx+1..-1])#???
  end
  $postorder << root
end

gets
Pre=gets.split.map &:to_i
In=gets.split.map &:to_i
$postorder=[]
reconstruct(Pre,In)
puts $postorder.join " "

Measured memory_bytes: 6112
#include <math.h>
#include <stdio.h>

#define N 1000

int main() {
	static int aa[N];
	int n, t, a, i, i_;
	double x, min;

	scanf("%d%d%d", &n, &t, &a);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	min = 1000000;
	i_ = -1;
	for (i = 0; i < n; i++)
		if (min > (x = fabs(a - ((double) t - (aa[i] * 0.006))))) {
			min = x;
			i_ = i;
		}
	printf("%d\n", i_ + 1);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	ll n,m;
	cin>>n>>m;
	priority_queue<mp> q;
	priority_queue<ll> c;
	for(ll i=0;i<n;i++){
		ll s,v;
		cin>>s>>v;
		q.push(mp(v,s));
	}
	for(ll i=0;i<m;i++){
		ll cc;
		cin>>cc;
		c.push(cc);
	}
	ll res = 0;
	ll maxv = 1e10;
	while(!c.empty() && !q.empty() ){
		ll cc = c.top();
		mp now = q.top();
		q.pop();
		if(now.second > cc || now.first >  maxv){
			continue;
		}
		maxv = now.first;
		c.pop();
		res++;
	}
	cout<<res<<endl;

	return 0;
}



Measured memory_bytes: 6288
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    foreach(w;stdin.byLine().map!(to!int))
        iota(10).map!(i=>1<<i).filter!(b=>(w&b)!=0).map!(to!string).join(" ").writeln();
}

Measured memory_bytes: 1088
import numpy as np

S_line = input()
T_line = input()

length = len(S_line)

index_list = []
def index_maker(start_n, length):
    for loc in range(length):
        if loc > start_n:
            index_list.append(loc)
        
    for loc in range(start_n + 1):
        #print(str(start_n) +":"+ str(loc))
        index_list.append(loc)
    if start_n + 1 == length:
        return list(range(length))

    return(index_list)

ac_flag = 0
index_list = []
y_flag = 0

for i in range(length):
    index_list = index_maker(length-1 - i, length)
    #print(index_list)
    for i, index in enumerate(index_list):
        #print("i: " + str(i) +" index: "+ str(index))
        if T_line[i] != S_line[index]:
            ac_flag += 1
    if ac_flag == 0:
        y_flag += 1
    ac_flag = 0
    index_list = []

if y_flag != 0:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 12516
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        s: Chars,
        lr: [(usize, usize); q],
    }

    let mut sum = 0;
    let mut cumsum = vec![0; n];
    let mut prev = None;
    for (i, &c) in s.iter().enumerate() {
        match prev {
            Some(prev) if prev == 'A' => {
                if c == 'C' {
                    sum += 1;
                }
            }
            _ => {},
        }
        cumsum[i] = sum;
        prev = Some(c);
    }

    for (l, r) in lr {
        let ans = cumsum[r-1] - cumsum[l-1];
        println!("{}", ans);
    }
}

Measured memory_bytes: 5788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for (int i=1;i<=100;i++){
		int x=a*i;
		if ((x-c)%b==0){
			printf("YES");
			break;
		}
		if (i==100){
			printf("NO");
		}
	}
	return 0;
}

Measured memory_bytes: 256
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var A = Number(lines[0].split(" ")[0])
    var B = Number(lines[0].split(" ")[1])
    var C = Number(lines[0].split(" ")[2])

    // A -> B -> C
    var a = Math.abs(A - B) + Math.abs(B - C)
    // A -> C -> B
    var b = Math.abs(A - C) + Math.abs(B - C)
    // B -> A -> C
    var c = Math.abs(A - B) + Math.abs(A - C)
    // B -> C -> A
    var d = Math.abs(C - B) + Math.abs(A - C)
    // C -> A -> B
    var e = Math.abs(C - A) + Math.abs(A - B)
    // C -> B -> A
    var f = Math.abs(C - B) + Math.abs(A - B)

    console.log(Math.min(a, b, c, e, f));

});

Measured memory_bytes: 7628
N=int(input())
A=list(map(int,input().split()))
ans=0
tree=1
node=sum(A)
flag=0
for i in A:
    ans+=i
    node-=i
    if i>tree:
        ans=-1
        break
    tree-=i
    if tree<node:
        ans+=tree
    else:
        ans+=node
    tree=2*tree
print(ans)

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

int main(){
	int a,b,n;
	string s;
	cin>>a>>b;
	if(a<=b) n=a;
	if(b<a) n=b;
	if(n==a){
		rep(i,b)s+=to_string(a);
	}else{
		rep(i,a)s+=to_string(b);
	}
	cout<<s<<endl;
}


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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  int a[5];
  REP(i,5) cin >> a[i];
  int k;
  cin >> k;
  sort(a,a+5);
  if (a[4] - a[0] > k) {
    cout << ":(" << endl;
    return 0;
  }
  cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 256
/*
    アリナ・グレイはかわいい
*/

#include<bits/stdc++.h>
using namespace std;
#define itn int
#define endl "\n"

int main(void){
    long long int n,m;
    cin >> n >> m;
    cout << min(n,m/2) + (m - min(n,m/2)*2)/4 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	
	int a,b,k,tmpa,tmpb,i=0;
  
  	scanf("%d %d %d",&a,&b,&k);
  
  	while(k>0){
      
      if(i%2==0){
  	
      	if(a % 2 != 0){
      		a--;
      	}
        a /=2;
        b += a;
      }
      else{
      	if(b % 2 != 0){
      		b--;
      	}
  		b /=2;
        a +=b;
      }
      i++;
      k--;
    }
  	
  	printf("%d %d",a,b);

	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define F(i,n) for (int i=1; i<=(int)n; i++)
#define FF(i,n) for (int i=0; i<(int)n; i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pi pair < int , int >
#define re(x) (int)x.size()
#define y1 u228
using namespace std;
typedef long long ll;
const int N = 200001;
const int big = 2e9;
const int md = 1e9 + 7;
int n,m;
ll f[N],t1[N*4],t[N*4];
vector < pair < int , int > > sp[N];
void update(int v,int tl,int tr,int l,int r,ll vl){
    if (l>r) return;
    if (tl==l && tr==r){t[v]+=vl; t1[v]+=vl; return;}
    int d=(tl+tr)>>1;
    update(v+v,tl,d,l,min(r,d),vl);
    update(v+v+1,d+1,tr,max(l,d+1),r,vl);
    t[v]=max(t[v+v],t[v+v+1])+t1[v];
}
ll go(int v,int tl,int tr,int l,int r){
    if (l>r) return -9e18;
    if (tl==l && tr==r) return t[v];
    int d=(tl+tr)>>1;
    return max(go(v+v,tl,d,l,min(r,d)),go(v+v+1,d+1,tr,max(l,d+1),r))+t1[v];
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    //freopen("input.txt","r",stdin);
    cin>>n>>m;
    F(i,m){
        int l,r,a;
        cin>>l>>r>>a;
        sp[l].pb(mp(l-1,a));
        sp[r+1].pb(mp(l-1,-a));
    }
    ll ans=0ll;
    F(i,n){
        FF(j,re(sp[i]))
            update(1,0,n,0,sp[i][j].fi,sp[i][j].se);
        f[i]=go(1,0,n,0,i-1);
        update(1,0,n,i,i,f[i]);
        ans=max(ans,f[i]);
    }
    cout<<ans<<endl;
    return 0;
}







Measured memory_bytes: 25984
#include <iostream>
// #include <bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  long long l, r, tmp=2019;
  // long long tmp = 2020;
  bool flag = false;
  cin >> l >> r;
  // vector<int> hoge(r - l + 1);
  for (long long i = l; i < r; i++){
    for (long long v = i + 1; v <= r; v++){
      tmp = min(tmp, (i*v)%2019);
      if (tmp == 0){
        flag = true;
        break;
      }
    }
    if (flag){
      break;
    }
  }

  
  
  // for (long long i = 0; i <= r - l; i++){
  //   tmp = (i + l)%2019;
  //   if(tmp == 0){
  //     flag = true;
  //     break;
  //   }else{
  //     hoge[i] = (i + l)%2019;
  //   }
  // }
  if (flag){
    cout << 0 << endl;
  }else{
    cout << tmp << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
l = [input() for i in range(n)]
f = True
if len(set(l)) != len(l):
  f = False
else:
  for i in range(n-1):
    if l[i][-1] != l[i+1][0]:
      f = False
      break

print("Yes" if f else "No") 

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

int main() {
  
  long long  H,W;
  cin >> H >> W;
  if(H == 1 || W == 1){
    cout << 1 <<endl;
  }
  else if (H % 2 ==0 || W % 2 == 0){
    cout << H * W / 2 <<endl;
  }
  else {
    cout << (H-1) * W / 2 + W / 2 +1 << endl;
  }

}


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

int main(){
    int N;
    cin >> N;
    vector<int> H(N+1,0);
    for(int i=1;i<=N;i++) cin >> H[i];
    bool ok = true;
    for(int i=N-1;i>=1;i--){
        if(H[i]>H[i+1]){
            H[i]--;
        }
        if(H[i]>H[i+1]) ok = false;
    }
    cout << (ok? "Yes":"No") << endl;
}

Measured memory_bytes: 640
#include <cstdio>

typedef long long int ll;

int n, x, y, flagX, flagY, curX,  curY;
ll k, positive, negative;

int main() {
    scanf("%lld%d%d", &k , &x, &y);
    flagX = (x < 0) ? -1 : 1;
    flagY = (y < 0) ? -1 : 1;
    x *= flagX;
    y *= flagY;
    if (k % 2 ==0 && (x + y) & 1)
        printf("-1");
    else {
        if (k == x + y)
            n = 1;
        else {
            n = 2;
            while (n * k < x + y || (n * k - x - y) & 1) {
                ++n;
            }
        }
        positive = (n * k + x + y) >> 1;
        negative = (n * k - x - y) >> 1;
        printf("%d\n", n);
        while(n --) {
            if (negative) {
                if (negative >= k) {
                    if (x - curX <= y - curY)
                        curX -= k;
                    else 
                        curY -= k;
                    negative -= k;
                }
                else {
                    if (x - curX <= y - curY) {
                        curX -= negative;
                        curY += (k - negative);
                    }
                    else {
                        curY -= negative;
                        curX += (k - negative);
                    }
                    negative = 0;
                }
            }
            else {
                if (curX < x) {
                    if (x - curX >= k) 
                        curX += k;
                    else {
                        curY += (k - (x - curX));
                        curX = x;
                    }
                }
                else {
                    if (y - curY * flagY >= k) 
                        curY += k;
                    else 
                        curY = y;
                }
            }
            printf("%d %d\n", curX * flagX, curY * flagY);
        }
    }
    return 0;
}

Measured memory_bytes: 2176
# Problem https://atcoder.jp/contests/abc064/tasks/abc064_a
# Ruby 3rd Try

yes = "YES"
no = "NO"
r,g,b = gets.chomp('\n').split(' ').map(&:to_i)

gbMod4 = (g*10+b) % 4
if gbMod4 == 0
    puts(yes)
else
    puts(no)
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
 
struct UnionFind{
  Int n;
  vector<Int> r,p;
  UnionFind(Int n):n(n),r(n,1),p(n){iota(p.begin(),p.end(),0);}
  Int find(Int x){
    if(x==p[x]) return x;
    return p[x]=find(p[x]);
  }
  void unite(Int x,Int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
};
 
 
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int n;
  while(cin>>n,n){
    UnionFind uf(n);
    vector<Int> a(n),x(n),b(n),y(n);
    for(Int i=0;i<n;i++){
      cin>>a[i]>>x[i]>>b[i]>>y[i];
      uf.unite(i,a[i]);
      uf.unite(i,b[i]);
    }
    vector<vector<Int> > v(n);
    for(Int i=0;i<n;i++){
      Int k=uf.find(i);
      v[k].emplace_back(x[i]);
      v[k].emplace_back(y[i]);
    }
    Int ans=1;
    for(Int i=0;i<n;i++){
      if(v[i].empty()) continue;
      auto &u=v[i];
      sort(u.rbegin(),u.rend());
      Int k=0;
      while(k<(Int)u.size()&&u[0]==u[k]) k++;
      k/=2;
      ans*=k;
      ans%=10007;
      //cout<<k<<endl;
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

#define ll              long long int
#define endl            '\n'

static const int maxn = 5000 + 5;

ll arr[maxn], brr[maxn];

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


      int n;
      cin >> n;
      for (int i = 1; i < n; i++) cin >> arr[i];
      brr[1] = arr[1];
      for (int i = 1; i < n; i++)
      {
            brr[i + 1] = arr[i];
            if (brr[i] > brr[i+1]) brr[i] = brr[i + 1];
      }
      ll sum = accumulate(brr+1, brr+n+1, 0LL);
      cout << sum << endl;
}


Measured memory_bytes: 256
package main
 
import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
 
func main() {
	_sc.Split(bufio.ScanWords)
	S := readLine()
	s, ir, il := len(S), 0, -1
	A := make([]int, s)
	for i, c := range S {
		if c == 'R' {
			if il != -1 {
				A[il-1] = (il-ir)/2 + (i-il)/2 + (il-ir)%2
				A[il] = (il-ir)/2 + (i-il)/2 + (i-il)%2
				ir = i
				il = -1
			}
		} else if il == -1 {
			il = i
		}
	}
	A[il-1] = (il-ir)/2 + (s-il)/2 + (il-ir)%2
	A[il] = (il-ir)/2 + (s-il)/2 + (s-il)%2
	for i, a := range A {
		if i == s-1 {
			fmt.Printf("%d\n", a)
		} else {
			fmt.Printf("%d ", a)
		}
	}
}

const _bufferSize = 1000000
var _sc = bufio.NewScanner(os.Stdin)
var _rd = bufio.NewReaderSize(os.Stdin, _bufferSize)

func nextInt() int {
	i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return int(i)
}

func nextLine() string {
	_sc.Scan()
	return _sc.Text()
}

func readLine() string {
	l, _, _ := _rd.ReadLine()
	return string(l)
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
#define MAX_H 50
#define MAX_W 50

string s[MAX_H];
ll value[MAX_H][MAX_W];
ll h, w;

ll bfs(ll x, ll y){
  queue<pll> que;
  REP(i, h){
    REP(j, w)
      value[j][i] = LLINF;
  }

  que.push(make_pair(x, y));
  value[x][y] = 1;

  while(!que.empty()){
    pll p = que.front();
    que.pop();

    if(p.FI == w-1 && p.SE == h-1)
      break;

    REP(i, 4){
      ll nx = p.FI+dx[i];
      ll ny = p.SE+dy[i];

      if(w <= nx || nx < 0 || h <= ny || ny < 0)
        continue;

      if(value[nx][ny] != LLINF || s[ny][nx] == '#')
        continue;

      que.push(pll(nx, ny));
      value[nx][ny] = value[p.FI][p.SE]+1;
    }
  }

  return value[w-1][h-1];
}

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

  cin >> h >> w;
  REP(i, h)
    cin >> s[i];

  ll white_cnt = 0;
  REP(i, h){
    REP(j, w){
      if(s[i][j] == '.')
        white_cnt++;
    }
  }

  ll path_value = bfs(0, 0);
  if(path_value == LLINF)
    cout << -1 << endl;
  else
    cout << white_cnt - bfs(0, 0) << endl;


}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
	char str[100];
	scanf("%s",str);
	int l=strlen(str);
	int i;
	long long sum=0;
	for(i=0;i<l;i++)
	{
		sum=sum+str[i]-'0';
	}
	 long long int a;
	 a=atoi(str);
	 if(a%sum==0)
	    {
		  printf("Yes\n");
        }
      else
      {
		  printf("No\n");
	  }
	 
		return 0;
} 
		 
	
	


Measured memory_bytes: 128
use proconio::input;

#[allow(unused_mut)]
fn main() {
    input! {
        n: usize,
        h: [usize;n]
    }
    let mut v: Vec<usize> = h;
    let mut max = v[0];
    let mut can = true;
    for i in 0..n {
        if v[i] < max - 1 {
            can = false;
        }
        max = std::cmp::max(max, v[i]);
    }
    if can {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define sz size()
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 2*100005
#define se second
#define fi first
#define be begin()
#define en end()
#define sortv(v) sort(v.begin(),v.end());
#define w() ll _;cin>>_;while(_--)
#define edge pair<ll,ll>
#define pq priority_queue<ll>
#define mod 1000000007
#define Endl "\n"
#define cy cout<<"YES"<<endl;
#define cn cout<<"NO"<<endl;
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;


void solve(ll n,ll m)
{
	ll k;
	cin>>k;
	vector<ll> a(n),b(m);
	rep(i,n)	cin>>a[i];
	rep(i,m)	cin>>b[i];
	ll sum=a[0];
	ll pos=-1;
	for(ll i=1;i<n;i++){
		a[i]+=a[i-1];
		sum=a[i];
		if(sum>1e10){
			pos=i;
			break;
		}
	}
	if(pos!=-1)		a.erase(a.begin()+(pos),a.end());
	sum=b[0];
	pos=-1;
	for(ll i=1;i<m;i++){
		b[i]+=b[i-1];
		sum=b[i];
		if(sum>1e10){
			pos=i;
			break;
		}
	}
	if(pos!=-1)		b.erase(b.begin()+(pos),b.end());
	vector<ll>::iterator it1,it2,it3,it4;
	

	it1=lb(a,k);
	it2=ub(a,k);
	ll ans=it1-a.begin()+1;
	if(it1==it2)	ans--;
	it3=lb(b,k);
	it4=ub(b,k);
	ll ans2=it3-b.begin()+1;
	if(it3==it4)	ans2--;
	ans=max(ans,ans2);
	if((it1==it2&&it1==a.begin())||(it3==it4&&it3==b.begin())){
		cout<<ans;
		return;
	}
	pos=it1-a.begin();
	if(it1==it2)	pos--;
	while(pos>=0){
		ll x=a[pos];
		ll d=k-x;
		it3=lb(b,d);it4=ub(b,d);
		ans2=pos+1;
		ans2+=(it3-b.begin())+1;
		if(it3==it4)	ans2--;
		pos--;
		//cout<<ans2<<endl;
		ans=max(ans,ans2);
	}
	cout<<ans;	
}

int main()
{
	fast;
	
	ll n,m;
	cin>>n>>m;
	solve(n,m);
	
	return 0;
}

Measured memory_bytes: 6348
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    ll n, a, b;
    cin >> n >> a >> b;
    if ((b - a) % 2 == 0)
    {
        ll ans1 = (b - a) / 2;
        ll ans2 = min(max(a - 1, b - 1), max(n - a, n - b));
        cout << min(ans1, ans2) << endl;
    }
    else
    {
        ll c = min(a - 1, n - b);

        ll ans1 = c + 1 + (b - a) / 2;
        ll ans2 = min(max(a - 1, b - 1), max(n - a, n - b));
        cout << min(ans1, ans2) << endl;
    }
    return 0;
}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    double l;
    cin >> l;
    cout << setprecision(12) << (l*l*l)/27 << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int h;
int n;
int main(){
	while(cin>>h>>n){
		long long sum=0;
		for(int i=0;i<n;i++){
			int x;
			cin>>x;
			sum+=x;
		}
		if(sum>=h){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout<<'\n';

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  string s; cin>>s;
  if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes";
  else cout<<"No";
  LOL
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO
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 = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

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

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll N, M;
    cin >> N >> M;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<Pll> bcs(M);
    for (ll i = 0; i < M; i++) {
        cin >> bcs[i].second >> bcs[i].first;
    }
    sort(A.begin(), A.end());
    sort(bcs.begin(), bcs.end(), greater<Pll>());

    int idx = 0;
    for (ll i = 0; i < M; i++) {
        ll bi, ci;
        tie(ci, bi) = bcs[i];
        ll cnt = 0;
        while (idx < N && cnt < bi && A[idx] < ci) {
            A[idx] = ci;
            ++idx;
            ++cnt;
        }
    }

    ll ans = accumulate(A.begin(), A.end(), 0LL);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
        #include <stdlib.h>
         
        int main(void)
        {
            int a, b, max = 0;
            int n;
            scanf("%d%d%d", &n, &a, &b);
            int h[n];
            for (int i = 0; i < n; ++i){
                 scanf("%d", &h[i]);
                 if (max < h[i])
                    max = h[i];
            }
         
            int del = a - b, l = 0, r = max/b + 1;
            int t;
            while (r - l > 1){
                t = (l+r)/2;
                long long ch = t;
                for (int i = 0; i < n; ++i){
                    if (t*b < h[i]){
                        ch -= (h[i] - t*b)/del + ((h[i] - t*b)%del? 1:0);
                    }
                }
                if (ch < 0)
                    l = t;
                else
                    r = t;
            }
            printf("%d\n", r);
            return 0;
        }

Measured memory_bytes: 512
a = list(input())
b = list(input())
c = list(input())
s = a.pop(0)
while True:
    if s == "a":
        if len(a) == 0:
            print("A")
            break
        s = a.pop(0)
    elif s == "b":
        if len(b) == 0:
            print("B")
            break
        s = b.pop(0)

    else:
        if len(c) == 0:
            print("C")
            break
        s = c.pop(0)

                    

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m,k;
string s;
int a[200010],d[400010];
int main()
{
	cin >>n>>m>>k>>s;
	memset(a,-1,sizeof(a));
	int t=0;
	for (int i=0;i<n;i++)
	{
		if (s[i]=='x') continue;
		a[i]=t++,i+=k;
	} 
	for (int i=n-1;i>=0;i--)
		d[i]=max(d[i+1],d[i+k+1]+(s[i]=='o'));
	for (int i=0;i<n;i++)
	{
		if (s[i]=='x') continue;
		if (a[i]!=-1 && d[i+1]+a[i]<m) cout <<i+1<<"\n";
	}
	return 0;
} 

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

using DD = double;
const DD INF = 1LL<<60;      // to be set appropriately
const DD EPS = 1e-10;        // to be set appropriately
const DD PI = acosl(-1.0);
DD torad(int deg) {return (DD)(deg) * PI / 180;}
DD todeg(DD ang) {return ang * 180 / PI;}

/* Point */
struct Point {
    DD x, y;
    Point(DD x = 0.0, DD y = 0.0) : x(x), y(y) {}
    friend ostream& operator << (ostream &s, const Point &p) {return s << '(' << p.x << ", " << p.y << ')';}
};
inline Point operator + (const Point &p, const Point &q) {return Point(p.x + q.x, p.y + q.y);}
inline Point operator - (const Point &p, const Point &q) {return Point(p.x - q.x, p.y - q.y);}
inline Point operator * (const Point &p, DD a) {return Point(p.x * a, p.y * a);}
inline Point operator * (DD a, const Point &p) {return Point(a * p.x, a * p.y);}
inline Point operator * (const Point &p, const Point &q) {return Point(p.x * q.x - p.y * q.y, p.x * q.y + p.y * q.x);}
inline Point operator / (const Point &p, DD a) {return Point(p.x / a, p.y / a);}
inline Point conj(const Point &p) {return Point(p.x, -p.y);}
inline Point rot(const Point &p, DD ang) {return Point(cos(ang) * p.x - sin(ang) * p.y, sin(ang) * p.x + cos(ang) * p.y);}
inline Point rot90(const Point &p) {return Point(-p.y, p.x);}
inline DD cross(const Point &p, const Point &q) {return p.x * q.y - p.y * q.x;}
inline DD dot(const Point &p, const Point &q) {return p.x * q.x + p.y * q.y;}
inline DD norm(const Point &p) {return dot(p, p);}
inline DD abs(const Point &p) {return sqrt(dot(p, p));}
inline DD amp(const Point &p) {DD res = atan2(p.y, p.x); if (res < 0) res += PI*2; return res;}
inline bool eq(const Point &p, const Point &q) {return abs(p - q) < EPS;}
inline bool operator < (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x < q.x : p.y < q.y);}
inline bool operator > (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x > q.x : p.y > q.y);}
inline Point operator / (const Point &p, const Point &q) {return p * conj(q) / norm(q);}


const int ITER = 100;

int N, K;
vector<Point> v;

DD f(DD x, DD y) {
    vector<DD> dis(N);
    for (int i = 0; i < N; ++i) dis[i] = abs(v[i] - Point(x, y));
    sort(dis.begin(), dis.end(), greater<DD>());
    DD res = 0;
    for (int i = 0; i < K; ++i) res += dis[i];
    return res;
}

DD g(DD x) {
    DD left = -1000, right = 1000;
    for (int _ = 0; _ < ITER; ++_) {
        DD m1 = (left * 2 + right) / 3;
        DD m2 = (left + right * 2) / 3;
        if (f(x, m1) > f(x, m2)) left = m1;
        else right = m2;
    }
    return f(x, left);
}

DD solve() {
    DD left = -1000, right = 1000;
    for (int _ = 0; _ < ITER; ++_) {
        DD m1 = (left * 2 + right) / 3;
        DD m2 = (left + right * 2) / 3;
        if (g(m1) > g(m2)) left = m1;
        else right = m2;
    }
    return g(left);
}

int main() {
    cin >> N >> K;
    v.resize(N);
    for (int i = 0; i < N; ++i) cin >> v[i].x >> v[i].y;
    cout << fixed << setprecision(10) << solve() << endl;
}



Measured memory_bytes: 3300
#include<iostream>
#include<cstring>
#include<ctime>
using namespace std;
class Date{
	int y, m ,d;
public:
	bool GetDate(){
		cin >> y >> m >> d;
		if( y < 0 || m < 0 || d < 0 ) return false;
		else return true;
	}
	bool isLeap() const {
		return isLeap( y );
	}
	static bool isLeap(int y){
		return ( y % 4 == 0 && ( y % 100 != 0 || y % 400 == 0 ) );
	}
	unsigned int days() const {
		unsigned int ret = 0;
		const int md[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
		for(int ty = 0; ty < y; ++ty){
			ret += isLeap( ty ) ? 366 : 365;
		}
		for(int tm = 1; tm < m; ++tm){
			ret += (isLeap() && tm == 2) ? 29 : md[tm];
		}
		ret += d;
		return ret;
	}
	unsigned int operator-(const Date &t) const {
		return this->days() - t.days();
	}
};
int main(void){
	while( true ){
		Date date1, date2;
		if( !date1.GetDate() || !date2.GetDate() )
			break;
		
		cout << date2 - date1 << '\n';
	}
	return 0;
}

Measured memory_bytes: 0