akhauriyash/Code-Regression huggingface dataset:
//作成日：4/20
fn read_num<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main(){
	//日付を受け取る変数
	let day = read_num::<usize>();
    
	//条件分岐
	if day == 25 {
	  println!("Christmas");
	}
	else if day == 24 {
 		println!("Christmas Eve");
	}
	else if day == 23 {
		println!("Christmas Eve Eve");
	}
	else{
  		println!("Christmas Eve Eve Eve");
	}
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< double,double> dd;
#define pb push_back
#define eb emplace_back
#define sz(a) (int)a.size()
#define all(c) c.begin(),c.end()
#define FOR(i,a,b) for(i=a; i<b; i++)
#define FORR(i,a,b) for(i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define x first
#define y second
#define mp make_pair

const int INF = 1000000007;
const long long INFLL = (ll)INF * (ll)INF;

int32_t main()
{
	IOS;
	int r;
	double circum;
	cin>>r;
	circum = 2 * 3.1415926535 * r;
	cout<<circum;
	return 0;
}


Measured memory_bytes: 3804
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    input!{
        n: usize,
        x: i64,
        xs: [i64; n],
    }

    let ans = xs.iter().map(|a| (a - x).abs()).fold(0, gcd);
    println!("{}", ans);
}


Measured memory_bytes: 4352
main = do
  s <- getLine
  let [n,x] = map (read::String->Int) . words $ s
  if n /= 0 || x /= 0 then do
      putStrLn . show . sum $ [ length [max (i+1) (x-i-n)..min n ((x-i+1) `div` 2) - 1] | i <- [1.. min (n-1) (x `div` 3) - 1]]
      main
  else
      return ()

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

int main(){
    int n,m,x,y;
    cin >> n >> m;
    vector<vector<int> > adj(n+1);
    for(int i=0; i<m; i++){
        cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    int cnt=0;
    vector<bool> vis(n+1,0);
    for(int i=1; i<=n; i++){
        if(vis[i]==0){
            cnt++;
            queue<int> q;
            q.push(i);
            vis[i]=1;
            while(!q.empty()){
                int a = q.front();
                q.pop();
                for(int j: adj[a]){
                    if(vis[j]==0){
                        vis[j]=1;
                        q.push(j);
                    }
                }
            }
        }
    }

    cout << cnt-1 << endl;

    return 0;
}


Measured memory_bytes: 8524
C = [0] * 7
for _ in [0] * int(input()):
  a = int(input())
  if a<165: C[1]+=1
  elif a<170: C[2] += 1
  elif a<175: C[3] += 1
  elif a<180: C[4] += 1
  elif a<185: C[5] += 1
  else: C[6] += 1
for i in range(1,7):
  print '%d:%s' %(i, '*'*C[i])

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

int main(){
  double W, H, x, y;
  double s;
  // float s;
  cin >> W >> H >> x >> y;
  s = ( W * H ) / 2;
  cout << s << " ";
  if ( x == W / 2 && y == H / 2 ) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
c = [list(map(int, input().split())) for _ in range(3)]

ans = "Yes"
for i in range(len(c)):
    mi = min(c[i])
    *c[i], = map(lambda x: x-mi, c[i])


print("Yes" if c[0] == c[1] and c[1] == c[2] else "No")


Measured memory_bytes: 3188
S = gets.chomp.split('')
T = gets.chomp.split('')
sum = S.size+1
flag = 0
sum.times { |n|
  if S == T
    flag= 1
  end
  S<<S.first
  S.delete_at(0)
}
if flag == 0
 puts 'No'
elsif flag ==  1
  puts 'Yes'
end



Measured memory_bytes: 1788
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a: i64,
        b: i64
    }
    if a >= 13 {
        println!("{}", b);
    } else if a >= 6 && a <= 12 {
        println!("{}", b/2);
    } else {
        println!("{}", 0);
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e9 + 7;

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

  string s;
  cin >> s;

  ll l = s.size();
  ll a = 0, b;

  REP(i, l){
    if(a == 0 && s[i] == 'A') a = i + 1;
    if(s[i] == 'Z') b = i + 1;
  }

  cout << b - a + 1 << endl;

  return 0;
}


Measured memory_bytes: 768
w, h, n = gets.chomp.split.map(&:to_i)
w_range = [0, w]
h_range = [0, h]
dots = []
n.times { dots << gets.chomp.split.map(&:to_i) }

dots.each do |dot|
  case dot[2]
  when 1
    w_range[0] = dot[0] if w_range[0] < dot[0]
  when 2
    w_range[1] = dot[0] if w_range[1] > dot[0]
  when 3
    h_range[0] = dot[1] if h_range[0] < dot[1]
  when 4
    h_range[1] = dot[1] if h_range[1] > dot[1]
  else
    raise
  end
end

x_remain = (w_range[1] - w_range[0]) >= 0 ? (w_range[1] - w_range[0]) : 0
y_remain = (h_range[1] - h_range[0]) >= 0 ? (h_range[1] - h_range[0]) : 0
puts x_remain * y_remain

Measured memory_bytes: 1788
package main

import (
	"fmt"
)

const mod = int(1e9 + 7)

var ifac, fac []int

var n, m int

func main() {
	const cmax = int(5e5 + 1)
	fac = make([]int, cmax)
	ifac = make([]int, cmax)
	inv := make([]int, cmax)
	fac[0], fac[1] = 1, 1
	ifac[0], ifac[1] = 1, 1
	inv[0], inv[1] = 1, 1
	for i := 2; i < cmax; i++ {
		fac[i] = (fac[i-1] * i) % mod
		inv[i] = (mod - inv[mod%i]*(mod/i)) % mod
		if inv[i] < 0 {
			inv[i] += mod
		}
		ifac[i] = (ifac[i-1] * inv[i]) % mod
	}

	fmt.Scan(&n, &m)
	pt := 1
	for i := m; i > m-n; i-- {
		pt *= i
		pt %= mod
	}

	// calc pt2
	kp := 1
	var pt2 int
	for fx := n; fx >= 0; fx-- {
		b := comb(n, fx) * kp
		if fx%2 == 0 {
			pt2 += b
		} else {
			pt2 -= b
		}
		pt2 %= mod
		if pt2 < 0 {
			pt2 += mod
		}
		kp *= m - fx + 1
		kp %= mod
	}
	if pt2 < 0 {
		pt2 += mod
	}

	fmt.Println(pt * pt2 % mod)
}

func calc(fx int) int {
	if fx > n {
		return 0
	}
	b := comb(n, fx)
	for i := m - fx; i > m-n; i-- {
		b *= i
		b %= mod
	}
	r := (b - calc(fx+1)) % mod
	if r < 0 {
		r += mod
	}
	return r
}

func comb(n, r int) int {
	if r > n {
		return 0
	} else if r == 0 || r == n {
		return 1
	}
	t := (ifac[n-r] * ifac[r]) % mod
	return (t * fac[n]) % mod
}

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

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

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


Measured memory_bytes: 14016
#!/usr/bin/env fsharpi

open System;

let ParseIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let ParseInt1 ( str : string ) =
    ParseIntN str |> fun arr -> arr.[0]

let ParseInt2 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1])

let ParseInt3 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])

let ReadLinesN ( n : int ) =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.take n

let ReadLines =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.takeWhile ((<>) null)

let ds = Array.create 10 true
let (n,k) = Console.ReadLine() |> ParseInt2
Console.ReadLine()
|> ParseIntN
|> Array.iter (fun d -> ds.[d] <- false)

let isOk v =
    let rec split v acc =
        match v with
        | 0 when List.length acc = 0 -> [0]
        | 0 -> acc
        | _ -> split ( v / 10 ) ( (v % 10 ) :: acc )
    split v []
    |> List.fold (fun acc v -> acc && ds.[v]) true

fun i -> n + i
|> Seq.initInfinite
|> Seq.skipWhile (fun v -> (isOk >> not) v)
|> Seq.head
|> printfn "%A"


Measured memory_bytes: 20284
from sys import stdin


def main():
    a, b, c, d = [int(x) for x in stdin.readline().rstrip().split()]
    if abs(a - b) <= d and abs(b - c) <= d:
        print('Yes')
    elif abs(a - c) <= d:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int a, b; cin >> a >> b;
	for( int i = 0; i < 100; ++i ){
		if( (a-1)*i+1 >= b ){
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    long long x = 0, y = 0;
    cin >> x >> y;
    long long ans = 0;
    while (x <= y) {
        ans++;
        x *= 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(x) cout << fixed << setprecision(x);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n,a,b; cin >> n >> a >> b; ll allsum = 0;
  
  for(ll i=1; i <= n; i++){
    ll sum = 0; ll t = i;
    
    for(ll j=0; j < 6; j++){
      sum += t % 10;  t /= 10;
    }
    
	if(a <= sum && sum <= b) allsum += i;
  }
  
  cout << allsum << endl;
}

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

int N;

int main(){
 cin >> N;
 long long sum = 0;

 for(int i = 1; i <= N; i++){
   if(i % 3 == 0 || i % 5 == 0) continue;
   else sum += i;
 }

 cout << sum << endl;
 return 0;
}


  

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long int n,a,b;
  cin>>n>>a>>b;
  long long int m=min(n-b,a-1);
  long long int d=b-a;
  if(d%2==0)
    cout<<d/2<<endl;
  else
    cout<<m+1+(d-1)/2<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
//    freopen("test.txt", "r", stdin);
    int n, tmp, cnt = 0;
    int pre = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &tmp);
        if (i > pre && tmp == i) {
            cnt++;
            pre = i+1;
        }
    }
    if (pre < n && tmp == n) cnt++;
    cout << cnt << endl;

}

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

int main(){
  int N, M;
  cin >> N >> M;
  int total = 0;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    total += A.at(i);
  }

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

  double thr = total*0.25/M;
  if((double)A.at(M-1) < thr){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}

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

using namespace std;
int a[10000],ans;
int main(){
	for(int i=0;i<10000;i++){
		a[i]=0;
	}
	int n,k,di,u,ans=0;
	cin>>n>>k;
	for(int i=0;i<k;i++){
		cin>>di;
		for(int j=0;j<di;j++){
			cin>>u;
			if(a[u]==0){
				a[u]=1;
				ans++;
			}
		}
	} 
	cout<<n-ans;
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>

using namespace std;

typedef pair<string, int> s_i;

int main()
{
    int n;
    cin >> n;
    for (int lp = 0; lp < n; lp++) {
        int a, b, c;
        cin >> c;
        int down = 0, up = 0;
        cin >> a;
        for (int i = 1; i < c; i++) {
            cin >> b;
            if (b < a) {
                down = max(down, a-b);
            } else if (b > a) {
                up = max(up, b-a);
            }
            a = b;
        }
        cout << up << " " << down << endl;
    }
    return 0;
}

Measured memory_bytes: 3084
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a,b=parseMap(split(readline()))
    println(a*b)
end
main()

Measured memory_bytes: 162464
#include<stdio.h>

int main(){
  int N,i;
  char str[128];
  scanf("%d%s",&N,str);
  if(N%2){
    printf("No");
  	return 0;
  }
  for(i=0;i<N/2;i++){
	if(str[i] != str[i+N/2]){
    	break;
    }
  }
  if(i == N/2){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

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

long long v[1000][3];
int main()
{
//	long long tt = -9223372036854775807;
	long long tt = -(1LL << 62);
	//cout << tt << endl;
	/*
	for( int pt = 0; pt < 8; pt++ ) {
		cout << pt << " ***" << endl;
		cout << ((pt&1) ? 1:-1) << endl;
		cout << ((pt&2) ? 1:-1) << endl;
		cout << ((pt&4) ? 1:-1) << endl;
	}
	*/
	
	int n,m;
	cin >> n >> m;
	for( int i = 0; i < n; i++ ) {
		cin >> v[i][0] >> v[i][1] >> v[i][2];
	}
	/*
	for( int i = 0; i < n; i++ ) {
		cout << v[i][0] << endl;
		cout << v[i][1] << endl;
		cout << v[i][2] << endl;
	}*/
	/* 2^3 = 8 のパターンについてm番目までの合計値を求める */
	// 111 110 101 100 011 010 001 000 
	for( int pt = 0; pt < 8; pt++ ) {
		vector<long long> t;
		for( int i = 0; i < n; i++ ) {
			long long w = ((pt&1) ? 1:-1)*v[i][0] + ((pt&2) ? 1:-1)*v[i][1] + ((pt&4) ? 1:-1)*v[i][2];
			//cout << w << endl;
			t.push_back( w );
		}
		sort( t.begin(), t.end() );
		reverse( t.begin(), t.end() );
		long long one = 0;
		for( int i = 0; i < m; i++ ) {
			one += t[i];
		}
		if( tt < one ) tt = one;
	}
	cout << tt << endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{BufWriter, Write};
// 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")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: i64, y: i64,
    }

    for i in (0..n + 1).rev() {
        for j in (0..n - i + 1).rev() {
            if i * 10000 + j * 5000 + (n - i - j) * 1000 == y {
                puts!("{} {} {}\n", i,j,n-i-j);
                return;
            }
        }
    }
    puts!("-1 -1 -1\n");
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 8572
#include<stdio.h>
#include<math.h>
typedef struct{
    double x;
    double y;
}point;


void sum(int xu,point fan,point malon){
    if(xu==0) return;
    point s,u,t;
    s.x=(2*fan.x+malon.x)/3;
    s.y=(2*fan.y+malon.y)/3;
    t.x=(fan.x+malon.x*2)/3;
    t.y=(fan.y+malon.y*2)/3;
    u.x=(t.x-s.x)/2-(t.y-s.y)*sqrt(3)/2+s.x;
    u.y=(t.x-s.x)*sqrt(3)/2+(t.y-s.y)/2+s.y;
    
    sum(xu-1,fan,s);
    printf("%f %f\n",s.x,s.y);
    sum(xu-1,s,u);
    printf("%f %f\n",u.x,u.y);
    sum(xu-1,u,t);
    printf("%f %f\n",t.x,t.y);
    sum(xu-1,t,malon);
}

int main(){
    int n;
    scanf("%d",&n);
    point fan={0,0};
    point malon={100,0};
    
    printf("%f %f\n",fan.x,fan.y);
    sum(n,fan,malon);
    printf("%f %f\n",malon.x,malon.y);
    
    
    return 0;
}



Measured memory_bytes: 2084
#[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! {
        n: usize, k: usize,
        s: chars,
    }
    let mut last = '1';
    let mut t = vec![0];
    for i in 0..s.len() {
        if last != s[i] {
            t.push(i);
        }
        last = s[i];
    }
    if last != '1' {
        t.push(s.len());
    }
    t.push(s.len());
    let mut ma = 0;
    if t.len() <= 2 * k + 1 {
        ma = n;
    } else {
        for i in 0..t.len() - (2 * k + 1) {
            if i % 2 == 0 {
                ma = max(ma, t[i + 2 * k + 1] - t[i]);
            }
        }
    }
    puts!("{}\n", ma);
}

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
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

using ll = long long;

typedef pair<ll, ll> P;
struct edge { ll to, cost; };

const int MAX_V =100000;
const ll INF = 1LL<<60;

int V;
vector<edge> G[MAX_V];
ll d[MAX_V];

void dijkstra(ll s) {
    // greater<P>を指定することでfirstが小さい順に取り出せるようにする
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        rep(i,G[v].size()) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    ll m, s, t;
    cin >> V >> m >> s >> t;
    vector<ll> u(m), v(m), a(m), b(m), cost(V);
    rep(i, m) {
        cin >> u[i] >> v[i] >> a[i] >> b[i];
        u[i]--;
        v[i]--;
        G[u[i]].push_back({v[i], a[i]});
        G[v[i]].push_back({u[i], a[i]});
    }
    dijkstra(s - 1);
    rep(i, V) {
        cost[i] = d[i];
        //cout << "cost[" << i << "]=" << d[i] << "\n";
    }
    rep(i, V) {
        G[i] = {};
    }
    rep(i, m) {
        G[u[i]].push_back({v[i], b[i]});
        G[v[i]].push_back({u[i], b[i]});
    }
    dijkstra(t - 1);
    vector<pair<ll, int>> total(V);
    rep(i, V) {
        total[i] = make_pair(cost[i] + d[i], i);
        //cout << "cost[" << i << "]=" << cost[i] + d[i] << "\n";
    }
    sort(total.begin(), total.end());
    int j = 0;
    rep(i, V) {
        while (total[j].second < i) j++;
        ll ans = 1e15 - total[j].first;
        cout << ans << "\n";
        //cout << 1e15 - total[j].first << "\n";
    }
    //rep(i, V) cout << total[i].first << " " << total[i].second << "\n";
}

Measured memory_bytes: 15616
/*
    NEVER GIVE UP!
    THE EXPERT IN ANYTHING WAS ONCE A BEGINNER
*/

#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f(i,a,b) for(ll i=a; i<=b; i++)
#define fi(i,a,b) for(ll i=a; i>=b; i--)
#define fa(x,b) for(auto x:b)
#define TC ll test_case; cin>>test_case; for(ll number=1 ; number <= test_case ; number ++ )
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a).size()
#define sp(x) cout << fixed << setprecision(x);
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define endl "\n"

const ld pi = acos(-1);
const ll M=1e9+7,N=1e7+5,INF=1e18;


void solve()
{
    ll n,m;
    cin >> n >> m;
    f(i,1,max(n,m))
        cout << min(n,m);
}

int32_t main()
{
    FIO
    solve();
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> kachi(N);
  for (int i = 0; i < N; i++) {
    cin >> kachi.at(i);
  }
  
  vector<int> cost(N);
  for (int i = 0; i < N; i++) {
    cin >> cost.at(i);
  }
  
  int M;
  
  for (int i = 0; i < N; i++) {
    if(kachi.at(i) >= cost.at(i)){
      M  += kachi.at(i) - cost.at(i);
    }
  }
  
  cout << M << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> x(n), y(n);
	for(int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
	}
	
	vector<int> town(n);
	iota(town.begin(), town.end(), 0);
	
	vector<double> dis;
	int nf = 0;
	do {
		double diff = 0.0;
		for(int i = 0; i < n - 1; ++i) {
			diff += sqrt(pow(x[town[i + 1]] - x[town[i]], 2.0) + pow(y[town[i + 1]] - y[town[i]], 2.0));
		}
		
		dis.push_back(diff);
		nf++;
		
	}while(next_permutation(town.begin(), town.end()));
	
	double sum = 0.0;
	for(int i = 0; i < dis.size(); ++i) {
		sum += dis[i];
	}
	
	printf("%.10lf\n", sum / (double)nf);
	
	return 0;
}


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

int main()
{
ll x , y ;
cin >> x >> y ;
if(x==1&&y==1)ans=1000000;
else{
  if(x==1)ans+=300000;
  if(x==2)ans+=200000;
  if(x==3)ans+=100000;
  if(y==1)ans+=300000;
  if(y==2)ans+=200000;
  if(y==3)ans+=100000;
}
cout << ans << endl;
return 0;
}

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

// edit by  (xcode)

using namespace std;

#define int         long long
#define ll          long long
#define double      long double
#define pb          push_back
#define in          insert
#define mp          make_pair
#define f           first
#define s           second
//#define x           first
//#define y           second
#define all(el)     el.begin(), el.end()
#define allr(el)    el.rbegin(), el.rend()
#define sz(el)      (int)el.size()
#define endl        "\n"

inline int chkmax(int &x, int y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

inline int chkmin(int &x, int y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

signed main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < sz(s); i++) {
        if (s[i] != t[i]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}



Measured memory_bytes: 3640
import heapq
import copy

N, K = map(int, input().split())
*V, = map(int, input().split())

M = min(N, K)

ans = 0
for i in range(M + 1):
    for j in range(M - i + 1):
        l = V[:i] + V[N - 1:N - j - 1:-1]
        t = sum(l)
        l.sort()
        for n in range(min(K - i - j, len(l))):
            if l[n] >= 0:
                break
            t -= l[n]
        if t > ans:
            ans = t

print(ans)

Measured memory_bytes: 3444
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
using ll = long long;


int main() {
	int n, m;
	cin >> n >> m;

	int res = 1900*m + 100*(n-m);
	res *= pow(2, m);
	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    
    while(true){
        int h, w;
        cin >> h >> w;
        
        if(h == 0 && w == 0){
            break;
        }
        
        for(int i = 0; i < h; i++){
            if(i % 2 == 1){
                for(int j1 = 0; j1 < w; j1++){
                    if(j1 % 2 == 1){
                        cout << "#";
                    } else {
                        cout << ".";
                    }
                }
                cout << endl;
            } else {
                for(int j2 = 0; j2 < w; j2++){
                    if(j2 % 2 == 1){
                        cout << ".";
                    } else {
                        cout << "#";
                    }
                }
                cout << endl;
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#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 all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 400010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    int c = a[2]-a[1];
    a[0] += c;
    if ((a[2]-a[0])%2 == 0){
        PRINT((a[2]-a[0])/2+c);
    }
    else{
        PRINT((a[2]-a[0])/2+2+c);
    }
}


Measured memory_bytes: 256
N, K = map(int,input().split(" "))
A = list(map(int,input().split(" ")))
A_ = [0] * N

k = K
K_dig = -1
while k > 0:
    k >>= 1
    K_dig += 1

border = ((1 << (K_dig+1)) - 1)
for i in range(N):
    if A[i] > border:
        a = A[i]
        j = (K_dig + 1)
        while a > border:
            if (a >> j) & 1:
                a -= (1 << j)
            j += 1
        A_[i] = a
    else:
        A_[i] = A[i]


def dfs(dig,curValue):
    if dig == -1:
        return curValue
    if (curValue + (1 << dig)) > K:
        return dfs(dig-1,curValue)

    oneCount = 0
    for i in range(N):
        if (A_[i] >> dig) & 1:
            oneCount += 1
    if oneCount <= (N-oneCount):
        return dfs(dig-1,curValue + (1 << dig))
    else:
        return dfs(dig-1,curValue)
    
val = dfs(K_dig,0)

ans = 0
for a in A:
    ans += (val ^ a)
print(ans)


Measured memory_bytes: 68956
#include<stdio.h>
#define inf 114514
 
int main(void){
	int a,b,c,i,j,k,n,ma,mb,dp[512][512],cp=inf;
	scanf("%d%d%d",&n,&ma,&mb);
	for(i = 0;i <= 511;i++){
		for(j = 0;j <= 511;j++){
			dp[i][j] = inf;
		}
	}
	dp[0][0] = 0;
	for(i = 1;i <= n;i++){
		scanf("%d%d%d",&a,&b,&c);
		for(j = 400;j >= 0;j--){
			for(k = 400;k >= 0;k--){
				if(dp[j][k] == inf){continue;}
				if(dp[j+a][k+b] > dp[j][k]+c){dp[j+a][k+b] = dp[j][k]+c;}
			}
		}
	}
	i = 1;
	while(1){
		if(ma*i > 400 || mb*i > 400){break;}
		if(dp[ma*i][mb*i] != inf){if(cp > dp[ma*i][mb*i]){cp = dp[ma*i][mb*i];}}
		i++;
	}
	if(cp == inf){printf("-1\n");}else{printf("%d\n",cp);}
	return 0;
}

Measured memory_bytes: 1152
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
s = [s() for _ in range(n)]

ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
	if s[i] == "AC":
		ac += 1
	elif s[i] == "WA":
		wa += 1
	elif s[i] == "TLE":
		tle += 1
	else:
		re += 1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)

Measured memory_bytes: 16336
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

void solve(){

    ll n;
    cin >> n;
    cout << (n+1)/2 << endl;
 
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,i,A[1000];
  cin>>N;
  string str="APPROVED";
  for(i=0;i<N;i++)
    cin>>A[i];
  for(i=0;i<N;i++){
    if(A[i]%2==0 && A[i]%3!=0 && A[i]%5!=0)
      str="DENIED";
  }
  cout<<str<<endl;
}

Measured memory_bytes: 256
// Problem : D - Line++
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
using namespace std;
int vis[2005],ans[2005],t[2005];
vector<int> e[2005];
queue<int> q;
int main()
{
 int n,x,y;
 scanf("%d%d%d",&n,&x,&y);
 for(int i=1;i<n;i++)
 {
  e[i].push_back(i+1);
  e[i+1].push_back(i);
 }
 e[x].push_back(y);
 e[y].push_back(x);
 for(int i=1;i<=n;i++)
 {
  memset(vis,-1,sizeof(vis));
  vis[i]=0;
  q.push(i);
  while(!q.empty())
  {
   int u=q.front();
   q.pop();
   for(auto v:e[u])
    if(vis[v]==-1)
    {
     vis[v]=vis[u]+1;
     q.push(v);
    }
  }
  for(int i=1;i<=n;i++)
   t[vis[i]]++;
 }
 for(int i=1;i<n;i++)
  printf("%d\n",t[i]/2);
 return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize("O2")
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<climits>
#include<random>
#include <iomanip>
#include <bitset>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
 
/////////////////////////////////////////////
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
///////////////////////////////
//#define int long long
const int N = 1e6 + 1;
int can[N];

void solve(){
	
	memset(can , true , sizeof can);
	int n;
	cin>>n;
	int a[n];
	for(int i = 0 ; i < n ; ++i)
		cin>>a[i];
	sort(a , a + n);
	set<int> s(a , a + n);
	for(int it : s){

		if(can[it]){

			for(int j = 2*it ; j < N ; j += it){

				can[j] = false;
			}
		}
	}

	int ans = 0;

	for(int i = 0 ; i < n ; ++i){

		int j = i;
		while(j < n && a[i]==a[j])
			++j;

		if(j - i >= 2){

			s.erase(a[i]);
			i = j - 1;
			continue;
		}

		if(s.find(a[i])!=s.end()){

			if(can[a[i]])
				++ans;
		}
	}

	cout<<ans<<endl;
}
 
signed main(){
 
	fast;
	int t = 1;
	//cin>>t;
	for(int i = 1 ; i <= t ; ++i)
		solve();
}

Measured memory_bytes: 17612
/*
_____________________$$o____________________o$$$$$o__
___________________o$o_$$o____oo$$$$$$$oo______o$$$$o
______________$o________o$$$$$o___oo$$$$$$$o______$$$
______________$$$ooo________o$$$$o______o$$$$$o_____o
____________oo_____oo_____oo___o$$$$$______$$$$$$____
_________ooooo___$$o_$___oooooo___o$$$$o__o__o$$$$___
_______ooo__ooo$$$$o_$$ooooooooooo__o$$$o__oo_oo$$$o_
______oo_o$$o_$$_o$o_o$o__oooooooooo__o$$$o_oo__o$$$o
____oooooo$$$$o___oo__$$o_ooo_oooooooo__o$$o_ooo_o$$$
___ooooooo__o___oooo__$$ooooo$_oooooooo__o$$__ooo_$$$
_$$o_ooooo___o$$$$$o__o$o__o_$o__oooooooo_o$$o_oo__$$
_$$$o_ooo_________o$$_$$o____$$o_ooooooooo_$$$o_oo_$$
__oo________o$$o____o_$$o____o$ooooooooooo_o$$o_oo_o$
___o$$$$$$$$$$$$$o___$$$o____$$o_oooooooooo_$$$o_o_o$
________o__oo$$$$$o__$$$o____$$o____oooooo__$$$o_o_o$
_________$$$$$$$$$o__$$_____$$$o___________$$$oooooo_
__________o$$$$$$$o_________$$___________o$o___oooooo
___________o$$$$o_______________ooooo__oo$__ooo__oooo
________________________________ooo_$$oo___oooo$o____
________________________________oooo_$$$$$o___oo$$$o_
________________________________ooooo_o$$$$$o_____$$$
________________________________oooooo_o$$$$$$ooo___o
________________________________ooooooo__o$$$$$o_____
*/
#include<bits/stdc++.h>
#define ll long long
#define ft first
#define sd second
#define HageBaIO_KPOCCbI int LOL;scanf("%d", &LOL);for(int i = 0; i < LOL; i++)
#define Yadurachok ios_base::sync_with_stdio(0);
using namespace std;
//BY |3 |<
const int dx[] = {1, 0, -1,  0};
const int dy[] = {0, 1,  0, -1};
//Where I am?
const ll N = 1e5 + 5;
const ll MOD = (1e9 + 7);
const ll MOD1 = 998244353;
const double PI = 3.14159265;
const int INF32 = 2e9;
const ll INF64 = 2e18;
//Don`t believe!!!//
ll k;
queue<ll>q;
void KEK(){
	cin>>k;
	k--;
	for(int i = 1; i < 10; i++)q.push(i);
	while(k){
		if(int(q.front()) % 10)q.push(1ll * q.front() * 10 + (1ll * q.front() % 10) - 1);
		if(!k)break;
		q.push(1ll * q.front() * 10 + (1ll * q.front() % 10));
		if(!k)break;
		if(1ll * q.front() % 10 < 9)q.push(1ll * q.front() * 10 + (1ll * q.front() % 10) + 1);
		k--;
		q.pop();
	}
	cout<<q.front();
}
int main(){
	Yadurachok
	//HageBaIO_KPOCCbI
	KEK();
}
//TAUMAC, 9| BbIWEJI 3A TObOU!!!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



Measured memory_bytes: 1792
n = int(input())
l = list(map(int,input().split()))
cnt = 0
for i in range(1,n-1):
    a,b,c = l[i-1],l[i],l[i+1]
    if (a<=b and b<=c) or (c<=b and b<=a):
        cnt += 1
print(cnt)


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

int n, k;
int main() {
	int i;
	cin >> n >> k;
	if(k >= 1<<n) return puts("-1")*0;
	if(n==1) {
		if(k==0) return puts("0 0 1 1")*0;
		else return puts("-1")*0;
	}
	printf("%d ", k);
	for(i=0; i<1<<n; i++) if(i!=k) printf("%d ", i);
	printf("%d ", k);
	for(i=(1<<n)-1; i>=0; i--) if(i!=k) printf("%d ", i);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"

typedef long lint;
typedef pair<lint, lint> Pair;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    lint N; cin >> N;
    lint M; cin >> M;

    vector<vector<Pair>> Pres;


    vector<Pair> Res;

    REP(i, M) {
      Pair p;
      Res.push_back(p);
    }

    REP(i, N) {
      vector<Pair> p;
      Pres.push_back(p);
    }

    REP(i, M) {
      lint p; cin >> p; p -= 1;
      lint y; cin >> y;


      Pair pair(i, y);
      Pres[p].push_back(pair);
    }

    REP(i, N) {
      sort(begin(Pres[i]), end(Pres[i]),
           [&](Pair x, Pair y){return x.second < y.second;} );

      REP(j, Pres[i].size()) {
        Pair p(i, j);
        Res[Pres[i][j].first] =  p;
      }
    }

    REP(i, M) {
      printf("%06ld", Res[i].first+1);
      printf("%06ld", Res[i].second+1);
      printf("\n");
    }


    return 0;
}


Measured memory_bytes: 9196
N, K = map(int, input().split())
hn = list(map(int, input().split()))

dp = [0]*N
for i in range(1, N):
    dp[i] = min(dp[j]+abs(hn[i]-hn[j]) for j in range(i-1, i-1-K, -1) if j >= 0)
print(dp[-1])


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

L = list(input().strip())
Q = int(input())
head = []
tail = []
rev = False
for i in range(Q):
    q = list(map(str, input().split()))
    if len(q) == 1:
        rev = not rev
    else:
        t, f, c = q
        if rev is False and f == '1':
            head.append(c)
        if rev is False and f == '2':
            tail.append(c)
        if rev is True and f == '1':
            tail.append(c)
        if rev is True and f == '2':
            head.append(c)

if rev:
    L.reverse()
    tail.reverse()
    ans = tail + L + head
else:
    head.reverse()
    ans = head + L + tail

print(''.join(ans))


Measured memory_bytes: 10040
Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if Lis[0] == 10000 and Lis[1]<2:
           print(ans+10000)
else:
           print(ans)
        

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int H,W;
char f[1005][1005];
int ans;
int vx[4] = {1,0,-1,0};
int vy[4] = {0,1,0,-1};

struct corr{
    int x;
    int y;
    int d;
};

queue<corr> Q;
corr start;

int bfs()
{
    while (!(Q.empty())){
        corr now = Q.front();
        Q.pop();
        int nowx = now.x;
        int nowy = now.y;
        int nowd = now.d;
        
        for (int i = 0;i < 4;i++){
            corr next;
            next.x = nowx+vx[i];
            next.y = nowy+vy[i];
            next.d = nowd+1;
            if (0 <= next.x && next.x < H && 0 <= next.y && next.y < W && f[next.x][next.y] == '.'){
                ans = max(ans,next.d);
                f[next.x][next.y] = '#';
                Q.push(next);
            }
        }
    }
    return ans;
}


int main()
{
    cin >> H >> W;
    for (int i = 0;i < H;i++){
        for (int j = 0;j < W;j++){
            cin >> f[i][j];
            if (f[i][j] == '#'){
                start.x = i;
                start.y = j;
                start.d = 0;
                Q.push(start);
            }
        }
    }
    
    cout << bfs() << endl;
    
}


Measured memory_bytes: 16192
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>

using namespace std;

#define rep(i, s, n) for(int i = s;i<n;i++)
#define repe(i, s, n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<int> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll) 1 << 62;
const ll MOD = 1000000007, INF = 1e18;
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, 1, 0, -1};

template<typename T1, typename T2>
bool pairCompare(const pair<T1, T2> &firstElof, const pair<T1, T2> &secondElof) {
    return firstElof.second > secondElof.second;
}

int mapMaxValue(std::map<ll, int> m) {
    int max = 0;
    for (std::map<ll, int>::iterator it = m.begin(); it != m.end(); it++) {
        if (max < it->second) max = it->second;
    }
    return max;
}

int main(void) {
    string s;
    cin >> s;
    map<char, int> cnt;
    for (int i = 0; i < s.length(); ++i) {
        cnt[s[i]]++;
    }
    for (auto e : cnt) {
        if (e.second != 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 764
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 1;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define MAX 300000
//.....................
ull mod = (int)1e9 + 7;

string target;
int ts;
struct Group1 {
	int a, b;
	bool operator < (const Group1 &g) const {
		// if (a == g.a) return b > g.b;
		return a < g.a;
	}
}; 
struct Group2 {
	int a, b;
	bool operator < (const Group2 &g) const {
		// if (b == g.b) return a > g.a;
		return b > g.b;
	}
};

signed main(void)
{
	int N;
	while (1) {
		cin >> N;
		if (N == 0) break;
		vector<int> v(N);
		rep(i, N) {
			cin >> v[i];
		}
		sort(ALL(v));
		int sum = 0;
		REP(i, 1, v.size() - 1) {
			sum += v[i];
		}
		cout << sum/(N-2) << endl;
	}
	return 0;
}

Measured memory_bytes: 1220