akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

// void printVector(const vector<int>& vec) {
//     for (int value : vec) {
//         cout << value << " ";
//     }
//     cout << endl;
// }


int main() {
  int n;
  cin >> n;
  vector<int> nums(n);
  iota(nums.begin(), nums.end(), 0);
  int p[n];
  int q[n];
  rep(i,n)cin >> p[i];
  rep(i,n)cin >> q[i];
  int t=0;
  int pn,qn;
  do {
    t++;
    bool okp = 1;
    bool okq = 1;
    rep(i,n)if(p[i]!=(nums[i]+1))okp=0;
    rep(i,n)if(q[i]!=(nums[i]+1))okq=0;
    if(okp)pn=t;
    if(okq)qn=t;
        // printVector(nums);
  } while (next_permutation(nums.begin(), nums.end()));
  cout << abs(pn-qn) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <set>

using namespace std;
void input(set<int> &);
void output(set<int> &);

int main()
{
    set<int> A, B;
    input(A);
    input(B);

    set<int>::iterator it = B.begin();
    while (it != B.end())
    {
        if (A.find(*it) != A.end())
        {
            A.erase(*it);
        }
        else
        {
            A.insert(*it);
        }
        
        it++;
    }

    output(A);


    //法2
    // set<int> C;
    // set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(C, C.begin()));
    // output(C);
 
}


void input(set<int> & A)
{
    int n;
    cin >> n;

    int a;
    while (n--)
    {
        cin >> a;
        A.insert(a);
    }
}

void output(set<int> & A)
{
    set<int>::iterator it = A.begin();
    while (it != A.end())
    {
        cout << *it << endl;
        it++;
    }
}


Measured memory_bytes: 31208
#include<cstdio>
#include<algorithm>
using namespace std;
#define N 55
#define M 125555
int sz[N],su[N],dp[M],n,v,d,f[N],s[N],tp[N],ct,as;
bool cmp(int i,int j){return 1.0*su[i]/sz[i]<1.0*su[j]/sz[j];}
int solve(int s1,int r)
{
	if(s1<0)return -1e9;
	int as=0;
	for(int i=1;i<=r;i++)
	{
		int tp=s1/su[s[i]];
		if(tp>d&&sz[s[i]]!=n)tp=d;
		s1-=tp*su[s[i]],as+=tp*sz[s[i]];
		if(sz[s[i]]==n||tp<d)return as;
	}
	return as;
}
int main()
{
	scanf("%d%d%d%d",&n,&v,&d,&su[1]);sz[1]=1;
	for(int i=2;i<=n;i++)scanf("%d%d",&su[i],&f[i]),sz[i]=1;
	for(int i=n;i>=0;i--)
	{
		sz[f[i]]+=sz[i];
		if(su[f[i]]+su[i]>1e9)su[f[i]]=1e9+1;
		else su[f[i]]+=su[i];
	}
	for(int i=1;i<=n;i++)if(su[i]<=1e9)su[++ct]=su[i],sz[ct]=sz[i],s[ct]=ct;
	sort(s+1,s+ct+1,cmp);
	int fg=125000;
	for(int i=1;i<=fg;i++)dp[i]=1e9+2;
	as=solve(v,ct);
	for(int i=ct;i>=1;i--)
	{
		int mx=d;
		if(mx>50)mx=50;
		for(int t=16;t;t>>=1)
		{
			while(mx>=2*t||(mx&&t==1))
			{
				mx-=t;
				int st=t*sz[s[i]],st2=1ll*t*su[s[i]]>1e9?1e9+1:t*su[s[i]];
				if(st>fg||st2>v)continue;
				for(int j=fg-st;j>=0;j--)if(dp[j+st]>dp[j]+st2)dp[j+st]=dp[j]+st2;
			}
		}
	}
	d-=50;
	if(d<0)d=0;
	for(int i=0;i<=fg&&v>=dp[i];i++)as=max(as,i+solve(v-dp[i],ct));
	printf("%d\n",as);
}//

Measured memory_bytes: 640
#include<string.h>
#include<stdio.h>
#include<stdlib.h>

char str[1025][1025] = { 0 };
int strIndex[1024];

int main(void) {
	int str_length=0;
	int i,n=0,m=0;

	while (scanf("%s", &str[n]) != EOF) {
		str_length = strlen(str[n]);
		if (str[n][str_length-1] == ',' || str[n][str_length-1] == '.') {
			str[n][str_length-1] = '\0';
			str_length -= 1;
		}
		if (str_length >= 3 && str_length <= 6) strIndex[m++] = n;
		n++;
	}

	for (i = 0; i < m; i++) {
		if (i == m - 1) {
			printf("%s\n",str[strIndex[i]]);
		}else
			printf("%s ", str[strIndex[i]]);
	}
	return 0;
}

Measured memory_bytes: 664
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
ans = "abcdefghijklmnopqrstuvwxyz"
s = input()
s = sorted(list(set(s)))
for v in ans:
    flag = True
    for j in range(len(s)):
        if s[j] == v:
            flag = False
    if flag:
        print(v)
        exit()
print(None)


Measured memory_bytes: 10272
N,M = map(int, input().split())
xyz = [tuple(map(int, input().split())) for _ in range(N)]

"""
x,y,zのそれぞれの和の合計を最大化するなら、x+y+zの大きいほうから選べばいい
だが、今回はそれぞれの和の絶対値の合計を最大化。

なので、x,y,zについて、それぞれを正で絶対値を大きくするか、負で絶対値を大きくするかの戦略がある
なんというか、たとえばxを負で、y,zを正で積むとき、それぞれのxの最終結果への寄与度が-xになる。
なので、x,y,zをそのままか-1倍して和をとって、その合計でソートして決めるとよい気がする（自信があるわけではないが）

"""

ans = 0
for bit in range(1 << 3):
    
    total = 0
    coef = [1,1,1]
    for i in range(3):
        if not (bit & (1 << i)):
            coef[i] *= -1

    
    arr = []
    for i in range(N):
        arr.append((coef[0]*xyz[i][0] + coef[1]*xyz[i][1] + coef[2]*xyz[i][2], xyz[i][0], xyz[i][1], xyz[i][2]))
    arr.sort(reverse=True)
    tmp_x = tmp_y = tmp_z = 0
    for i in range(M):
        tmp_x += arr[i][1]
        tmp_y += arr[i][2]
        tmp_z += arr[i][3]
    
    ans = max(ans, abs(tmp_x) + abs(tmp_y) + abs(tmp_z))


print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
#include <unordered_map>
using namespace std;

const unsigned long long BASE = (unsigned long long)(1e9 + 7);
unsigned int values[3001][3001];
unsigned long long dp[3001][3001][4];

int main()
{
    int rows, cols, k;
    cin >> rows >> cols >> k;
    for (int i = 0; i < 3001; i++)
    {
        for (int j = 0; j < 3001; j++)
        {
            values[i][j] = 0;
            dp[i][j][0] = 0;
            dp[i][j][1] = 0;
            dp[i][j][2] = 0;
            dp[i][j][3] = 0;
        }
    }
    for (int i = 0; i < k; i++)
    {
        int r, c, v;
        cin >> r >> c >> v;
        values[r - 1][c - 1] = v;
    }
    if (values[0][0] > 0)
        dp[0][0][1] = values[0][0];
    for (int r = 1; r < rows; r++)
    {
        dp[r][0][0] = max(max(dp[r - 1][0][0], dp[r - 1][0][1]), max(dp[r - 1][0][2], dp[r - 1][0][3]));
        if (values[r][0] > 0)
            dp[r][0][1] = dp[r][0][0] + values[r][0];
    }
    for (int c = 1; c < cols; c++)
    {
        dp[0][c][0] = dp[0][c - 1][0];
        if (values[0][c] > 0)
        {
            dp[0][c][1] = max(dp[0][c - 1][1], dp[0][c - 1][0] + values[0][c]);
            dp[0][c][2] = max(dp[0][c - 1][2], dp[0][c - 1][1] + values[0][c]);
            dp[0][c][3] = max(dp[0][c - 1][3], dp[0][c - 1][2] + values[0][c]);
        }
        else
        {
            dp[0][c][1] = dp[0][c - 1][1];
            dp[0][c][2] = dp[0][c - 1][2];
            dp[0][c][3] = dp[0][c - 1][3];
        }
    }
    for (int r = 1; r < rows; r++)
    {
        for (int c = 1; c < cols; c++)
        {
            unsigned long long up = max(max(dp[r - 1][c][0], dp[r - 1][c][1]), max(dp[r - 1][c][2], dp[r - 1][c][3]));
            dp[r][c][0] = max(dp[r][c - 1][0], up);
            if (values[r][c] > 0)
            {
                dp[r][c][1] = max(max(dp[r][c - 1][1], dp[r][c - 1][0] + values[r][c]), up + values[r][c]);
                dp[r][c][2] = max(dp[r][c - 1][2], dp[r][c - 1][1] + values[r][c]);
                dp[r][c][3] = max(dp[r][c - 1][3], dp[r][c - 1][2] + values[r][c]);
            }
            else
            {
                dp[r][c][1] = dp[r][c - 1][1];
                dp[r][c][2] = dp[r][c - 1][2];
                dp[r][c][3] = dp[r][c - 1][3];
            }
        }
    }
    cout << max(max(dp[rows - 1][cols - 1][0], dp[rows - 1][cols - 1][1]), max(dp[rows - 1][cols - 1][2], dp[rows - 1][cols - 1][3])) << endl;
    return 0;
}


Measured memory_bytes: 320208
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var A int64;
    A = nextInt();
    var B int64;
    B = nextInt();
    var C int64;
    C = nextInt();
	solve(A, B, C);

}

func solve(A int64, B int64, C int64){
	if(A-B >= C){
		Println(0)
	}else{
		Println(C-(A-B))
	}
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int64 {
	a, err := strconv.ParseInt(next(),10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

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

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 2816
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(b - a == c - b)
			System.out.println("YES");
		else
			System.out.println("NO");
		
		sc.close();
	}
}


Measured memory_bytes: 21844
from collections import defaultdict, deque
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = S()
if n[0] == n[2]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3316
(stdin => {
  // Define Function
  const area = (a, b) => a * b
  const Circumference = (a, b) => (a + b) * 2
  // Declare Variable
  const inputs = stdin.toString().trim().split(' ')
  const a = parseInt(inputs[0], 10)
  const b = parseInt(inputs[1], 10)
  console.log(area(a, b), Circumference(a, b))
})(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 15132
import heapq
n, m = map(int, input().split())
if n >= m:
    print(0)
else:
    x = list(map(int, input().split()))
    x.sort()
    d = []
    heapq.heapify(d)
    for i in range(1, m):
        heapq.heappush(d, [-abs(x[i] - x[i-1]), i, i - 1])
    total = 0
    a = [0, m - 1]
    for i in range(n-1):
        p = heapq.heappop(d)
        a.append(p[1])
        a.append(p[2])
    a.sort()
    total = 0
    for i in range(1, len(a), 2):
        total += abs(x[a[i]] - x[a[i-1]])
    print(total)


Measured memory_bytes: 25312
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        l: usize, r: usize, d: usize
    };

    let mut res = 0;
    for x in l..=r {
        if x % d == 0 {
            res += 1;
        }
    }
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


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

int	main(void)
{
	int L;
	scanf("%d", &L);
	if(L%3 == 0)
	{
		int c = L/3;
		printf("%.16Lf\n", (long double )c*c*c);
		return(0);
	}
	long double c_ld_L;
	c_ld_L = L*L*L;
	printf("%.16Lf\n", c_ld_L/27);
	return (0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    string ans = "second";
    rep(i, n) {
        if (a[i]%2==1) ans = "first";
    }

    
    pr(ans);
    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	vi ok(n);
	REP(i, m){
		int u, v;
		cin >> u >> v; u--; v--;
		if(u == 0 || v == 0) ok[u + v] |= 1;
		if(u == n-1 || v == n-1) ok[u + v - (n - 1)] |= 2;
	}
	int ans = 0;
	REP(i, n) ans += ok[i] == 3;
	cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
  char s[4];
  int i,c=0;
  scanf("%s",s);
  for(i=0;i<=2;i++){
    if(s[i]==s[i+1]){
      c=1;
      break;
    }
  }
  if(c==0)
    printf("Good");
  else
    printf("Bad");
  return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std;

int main(){
	long long N;
	string u[10];
	double x[10], ans = 0.;

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

	for (int i = 0; i < N; ++i){
		if (u[i] == "JPY")
			ans += x[i];
		else
			ans += x[i] * 380000.;
	}

	printf("%f", ans);

	return 0;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  sort(ALL(a));
  reverse(ALL(a));
  ll ans = 0;
  rep(i, n){
    ans += a[i/2];
  }
  print(ans-a[0]);
}


Measured memory_bytes: 4780
#include <iostream>
#include <string>
#include <queue>

using namespace std;

typedef long long ll;

ll n, ans;
string s;
ll ls[5500][5500];

int main() {
  cin >> n >> s;
  
  for (int i = 0; i < n; i++) {
    ls[i][i] = n - i;
    ll j = 1, len = 0;
    while (i+j < n) {
      while (i+j+len < n and s[i+len] == s[i+j+len]) len++;
      ls[i][i+j] = len;
      ans = max(ans, min(j, len));
      if (len == 0) {
        j++;
        continue;
      }
      ll k = 1;
      while (k < len and k + ls[i][i+k] < len) {
        ls[i][i+j+k] = ls[i][i+k];
        ans = max(ans, min(j, ls[i][i+k]));
        k++;
      }
      j += k;
      len -= k;
    }
  }     
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 215424
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll N;
ll M;

int main(){

    
    cin >> N;
    cin >> M;

    ll H[N+1]={};
    for( int hi = 1 ; hi <=N ; hi++ ){
        ll tmp;
        cin >> tmp;
        H[hi]=tmp;
    }
    int flag[N+1]={};
    int A;
    int B;
    rep(mi,M){
        cin >> A;
        cin >> B;
        if(H[A]>=H[B]) flag[B]=1;
        if(H[B]>=H[A]) flag[A]=1;
    }
    ll cnt=0;
    for( int ni = 1 ; ni <=N ; ni++ ){
        if(flag[ni]==0) cnt++;   
    }
    cout << cnt << endl;


    

}

Measured memory_bytes: 4800
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = 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; }

int main()
{
    lint n;
    lint y;
    cin >> n >> y;

    bool found = false;
    for (lint i = 0; i <= n; ++i)
    {
        for (lint k = 0; k <= n - i; ++k)
        {
            int m = n - i - k;
            if (10000*i + 5000*k + 1000*m == y)
            {
                cout << i << " " << k << " " << m << "\n";
                found = true;
                i = k = m = n + 1;
            }
        }
    }
    if (!found)
    {
        cout << -1 << " " << -1 << " " << -1 << "\n";
    }

    return 0;
}


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

class Node{
public:
	Node* prev;
	Node* next;
	int data;
	Node(){prev=0;next=0;data=0;}
};

class List{
private:
	Node head;
public:
	List(){head.prev=&head;head.next=&head;}
	int insert(int x);
	int del(int x);
	int deleteFirst();
	int deleteLast();
	void print();
};

int List::insert(int x)
{
	Node* p=new Node();

	if(p==0)
		return -1;
	Node* q=&head;
	Node* r=head.next;

	p->prev=q;
	p->next=r;
	p->data=x;

	q->next=p;
	r->prev=p;
	return 0;
}

int List::del(int x)
{
	Node* p;

	for (p = head.next; p != &head; p = p->next) {
		if (p->data == x)
			break;
	}

	if(p==&head)
		return -2;
	Node* q=p->prev;
	Node* r=p->next;


	q->next=r;
	r->prev=q;

	delete p;
	return 0;
}

int List::deleteFirst()
{
	Node* p=head.next;

	if(p==&head)
		return -2;
	Node* q=p->prev;
	Node* r=p->next;


	q->next=r;
	r->prev=q;

	delete p;
	return 0;


}

int List::deleteLast()
{
	Node* p=head.prev;

	if(p==&head)
		return -2;
	Node* q=p->prev;
	Node* r=p->next;


	q->next=r;
	r->prev=q;

	delete p;
	return 0;
}

void List::print()
{
	for(Node* p=head.next;p!=&head; p=p->next){
		cout<<p->data;

		if(p->next!=&head){
			cout<<' ';
		}else{
			cout<<endl;
		}
	}
}



int main()
{
	List L;
	int n;
	cin>>n;

	for (int i = 0; i < n; i++) {
		char com[20];
		cin >> com;

		if (com[0] == 'i') {
			int x;
			cin >> x;
			L.insert(x);
		}
		else if (com[6] == 'F') {
			L.deleteFirst();
		}
		else if (com[6] == 'L') {
			L.deleteLast();
		}
		else {
			int x;
			cin >> x;
			L.del(x);
		}
	}
	L.print();

	return 0;

}

Measured memory_bytes: 34340
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

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

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

int main(void) {
    long long int a,b,k;

    cin>>a>>b>>k;

    if(a<=k){
        k-=a;
        a=0;
        if(b<=k){
            b=0;
        }else{
            b-=k;
        }
    }else{
        a-=k;
    }
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

using namespace std;

const int MAX_NUM=1000001;


vector<int> dp(MAX_NUM,MAX_NUM);//?§????????????£?????¢?????°????????°
vector<int> dp_odd(MAX_NUM,MAX_NUM);

int main(){

  vector<int> numbers;
  
  int cnt=1,sum=0;
  while (1) {
    sum=(cnt*(cnt+1)*(cnt+2))/6;
    if(sum>MAX_NUM) break;
    numbers.push_back(sum); 
    dp[sum]=1;
    if(sum%2==1)dp_odd[sum]=1;
    cnt++;  
  }

  for(int i=1;i<MAX_NUM;i++){
    rep(j,numbers.size()){
      if(i-numbers[j] <= 0) break;
      dp[i]=min(dp[i],dp[i-numbers[j]] + 1);
      if(numbers[j]%2==1) dp_odd[i]=min(dp_odd[i],dp_odd[i-numbers[j]] + 1);
    }
  }


  while(1){
    int n;
    cin >> n; if(n==0) break;
    cout << dp[n] << " " << dp_odd[n] << endl;
  }

}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	set<pii>s;
	rep(i, 1, N) {
		if (min(i, N - i) != max(i, N - i)) {
			s.emplace(min(i, N - i), max(i, N - i));
		}
	}
	cout << s.size() << endl;

	return 0;
}


Measured memory_bytes: 31488
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a, b, k;
  cin >> a >> b >> k;
  vector<int> ans;
  rep(i, 1, 101) {
    if(a % i == 0 && b % i == 0) ans.pb(i);
  }
  cout << ans[ans.size() - k] << endl;
}


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

int main() {
  int N, T;
  cin >> N >> T;

  int min_c = 1001;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      if (min_c > c) {
        min_c = c;
      }
    }
  }
  if (min_c == 1001) {
    cout << "TLE" << endl;
  } else {
    cout << min_c << endl;
  }
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    FastScanner sc;
    PrintWriter p;

    void solve() {
        int N = sc.nextInt();
        int X = sc.nextInt();
        int T = sc.nextInt();
        if(N % X == 0)
            p.println((N / X) * T);
        else
            p.println((N / X) * T + T);
    }

    void run() {
        try {
            sc = new FastScanner(new File("Takoyaki.in"));
            p = new PrintWriter(new File("Takoyaki.out"));

            solve();

            p.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        sc = new FastScanner(System.in);
        p = new PrintWriter(System.out);

        solve();

        p.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int N) {
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }
            return A;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int N) {
            long[] A = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextLong();
            }
            return A;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int N) {
            double[] A = new double[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextDouble();
            }
            return A;
        }

    }

    public static void main(String[] args) {
        new Main().runIO();
    }
}




Measured memory_bytes: 32836
#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/STACK: 2000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define elif else if
#define lli long long int
#define ld long double
#define vec vector
#define forn(a) for(lli a=0; a<n; a++)
#define all(x) x.begin(), x.end()
#define presicion(x) cout<<fixed<<setprecision(x)
#define deb(x) cerr<<#x<<" = "<<x<<endl
#define PI 3.14159265358979323
#define sen(ang) sin((ang)*PI/180)
 
using namespace std;
 
int main(){
    IOS;
  
  lli n; cin>>n;
  vec<lli> a(n);
  forn(i) cin>>a[i];
  lli res = a[0];
  for(lli i=1; i<n; i++){
    res = __gcd(res, a[i]);
  }
  cout<<res<<endl;
 
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main()
{
    char a,b;
    while(scanf("%c",&a)==1)
    {
        if(a=='A')
            printf("T\n");
        else if(a=='T')
            printf("A\n");
        else if(a=='C')
            printf("G\n");
        else if(a=='G')
            printf("C\n");
    }

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static final char L = 'W';

	public static void main(String args[]) {
		try (Scanner in = new Scanner(System.in)) {
			int N = Integer.parseInt(in.nextLine());
			String S = in.nextLine();

			int[] countToR = new int[N];
			for (int i = 0; i < N; i++) {
				if (i == 0) {
					if (S.charAt(i) == L) {
						countToR[i] = 1;
					} else {
						countToR[i] = 0;
					}
					continue;
				}
				if (S.charAt(i) == L) {
					countToR[i] = 1 + countToR[i - 1];
				} else {
					countToR[i] = 0 + countToR[i - 1];
				}
			}
			int[] countToL = new int[N];
			for (int i = N - 1; i >= 0; i--) {
				if (i == N - 1) {
					if (S.charAt(i) == L) {
						countToL[i] = 0;
					} else {
						countToL[i] = 1;
					}
					continue;
				}
				if (S.charAt(i) == L) {
					countToL[i] = 0 + countToL[i + 1];
				} else {
					countToL[i] = 1 + countToL[i + 1];
				}
			}

			int min = (int) 1e9;
			for (int i = 0; i < N; i++) {
				int il = i - 1;
				int ir = i + 1;
				int count = (ir < N ? countToL[ir] : 0) + (il >= 0 ? countToR[il] : 0);

				min = Math.min(min, count);

			}

			System.out.println(min);
		}
	}
}


Measured memory_bytes: 30448
#include <iostream>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    int a[n + 1];
    bool v[k + 1];
    for (int i = 0; i <= k; i ++) {
        v[i] = false;
    }
    for (int i = 0; i < n; i ++) {
        cin >> a[i];
        v[a[i]] = true;
    }
    for (int i = 0; i <= k; i ++) {
        for (int j = 0; j < n && v[i] != 1; j ++) {
            if (a[j] < i) {
                v[i] = 1 - v[i - a[j]];
            }
        }
    }
    if (v[k] == 0) {
        cout << "Second";
    } else {
        cout << "First";
    }
    return 0;
}


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

int v , e , s[9901] , t[9901] , d[9901];
long long a[101][101] , s1;

int main(){
	cin>>v>>e;
	for(int i = 0 ; i < v; i++){
		for(int j = 0; j < v; j++){
			a[i][j] = 1e18;
		}
//		cout<<endl;
	}
	for(int i = 0 ; i < e; i++){
		cin>>s[i]>>t[i]>>d[i];
		a[ s[i] ][ t[i] ] = d[i];
	}
	
	for(int k = 0 ; k < v; k++){
		for(int i = 0; i < v; i++){
			for(int j = 0; j < v; j++){
				if(a[i][j] > a[i][k] + a[k][j]){
					a[i][j] = a[i][k] + a[k][j];
				}
				if(a[i][k] + a[k][i] < 0){
					s1++;
				}
			}
		}
	}
	if(s1 == 0){
		for(int i = 0; i < v ; i++){
			for(int j = 0; j < v; j++){
//				cout<<a[i][j]<<' ';
				if(j != 0){
					cout<<' ';
				}
				if(a[i][j] > 2e9 && i != j){
					cout<<"INF";
					continue;
				}
				if(i == j){
					cout<<0;
				}
				if(a[i][j] <= 2e9 && i != j){
					cout<<a[i][j];
				}
			}
		cout<<endl;
		}
	}
	else cout<<"NEGATIVE CYCLE"<<endl;
}


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

count = 0
counts = []

for i in range(N-1):
    if H[i] >= H[i+1]:
        count += 1
    else:
        counts.append(count)
        count = 0
        
counts.append(count)
print(max(counts))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define pi  3.141592653589793238
#define int long long
signed main(){

  
   cout << setprecision(9) << fixed ;
   int r; cin >> r;
   double ans = pi*(double)r;
   cout<< (ans*2) <<  endl;

 
  return 0;
}

Measured memory_bytes: 3724
#include<cstdio>
#include<queue>
using namespace std;
int n,tot,p[200001],rnk[200001],t[2][200001][18],log_2[200001];
struct result {
    int fir,sec;
    int son[3];
    inline bool operator <(result ano)const
    {
        return fir>ano.fir;
    }
}res[100001];
priority_queue<result>q;
inline int min(int x,int y)
{
    return x<=y?x:y;
}
void init_log2()
{
    for(int i=2;i<=n;++i) {
        log_2[i]=log_2[i>>1]+1;
    }
    return;
}
void init_t()
{
    for(int i=1;i<=n;++i) {
        t[i&1][i][0]=p[i],t[(i&1)^1][i][0]=n+1;
    }
    for(int i=0;i<2;++i) {
        for(int j=1;j<18;++j) {
            for(int k=1;k+(1<<j)-1<=n;++k) {
                t[i][k][j]=min(t[i][k][j-1],t[i][k+(1<<j-1)][j-1]);
            }
        }
    }
    return;
}
int query(int opt,int l,int r)
{
    int k=log_2[r-l+1];
    return min(t[opt][l][k],t[opt][r-(1<<k)+1][k]);
}
int func(int l,int r)
{
    if(l>r) {
        return 0;
    }
    int nl=rnk[res[++tot].fir=query(l&1,l,r)];
    int nr=rnk[res[tot].sec=query(r&1,nl+1,r)];
    int ret=tot;
    res[ret].son[0]=func(l,nl-1);
    res[ret].son[1]=func(nr+1,r);
    res[ret].son[2]=func(nl+1,nr-1);
    return ret;
}
int main()
{
    scanf("%d",&n);
    init_log2();
    for(int i=1;i<=n;++i) {
        scanf("%d",&p[i]);
        rnk[p[i]]=i;
    }
    init_t();
    func(1,n);
    q.push(res[1]);
    while(!q.empty()) {
        result now=q.top();
        q.pop();
        printf("%d %d ",now.fir,now.sec);
        for(int i=0;i<3;++i) {
            if(now.son[i]) {
                q.push(res[now.son[i]]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 38656
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


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

	vector<int> a(n);

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

	sort(a.begin(), a.end());

	double ans = (a[0]+a[1])/2.0;

	for (int i = 2; i < n; i++) {
		ans = ans / 2.0;

		ans += (a[i]) / 2.0;

	}

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


	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<iostream>
#include<queue>
#include<cstring>
#include<string>
using namespace std;
int main(){
	int n,ans=0,cnt=0;
	cin >> n;
	string s;
	cin >> s;
	for(int i = 0;i < n;i++){
		if(s[i]=='D')cnt--;
		if(s[i]=='I')cnt++;
		if(cnt>ans)ans=cnt;
		}
		cout << ans <<endl;
	return 0;
	}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#define LL long long
#define RG register
using namespace std;
#define N 800000
inline int gi() {
	RG int w=0;
	RG bool q=1;
	RG char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
#define mod 924844033
int n,fac[N],inv[N];
int head[N],nxt[N<<1],to[N<<1],siz[N];
int ans[N],s[N];
int q[N],fa[N],pre[N];
#define dec(x,y) if (((x)-=(y))<0) (x)+=mod
inline int qpow(int x,int y) {
	int ans=1;
	while (y) {
		if (y&1) ans=1LL*ans*x%mod;
		x=1LL*x*x%mod;y>>=1;
	}
	return ans;
}
namespace NTT{
	int a[N],b[N],c[N],d[N],R[N],ans[N];
	struct C{ long double x,y; }A[N],B[N];
	inline C operator + (const C &a,const C &b) { return (C){a.x+b.x,a.y+b.y}; }
	inline C operator - (const C &a,const C &b) { return (C){a.x-b.x,a.y-b.y}; }
	inline C operator * (const C &a,const C &b) { return (C){a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x}; }
	const long double pi=acos(-1);
	inline void fft(int n,C *a,int f) {
		int i,k,o;C wn,w,x,y;
		for (i=0;i<n;i++) if (R[i]>i) swap(a[i],a[R[i]]);
		for (i=1;i<n;i<<=1) {
			wn=(C){cos(pi/i),sin(f*pi/i)};
			for (o=0;o<n;o+=i<<1) {
				w=(C){1,0};
				for (k=0;k<i;k++,w=w*wn) {
					x=a[o+k],y=a[o+k+i]*w;
					a[o+k]=x+y;
					a[o+k+i]=x-y;
				}
			}
		}
	}
	inline void work(int m) {
		int n,L=-1,i;LL x;
		for (n=1;n<=m<<1;n<<=1) L++;
		for (i=1;i<n;i++) R[i]=R[i>>1]>>1|(i&1)<<L;
		for (i=0;i<=m;i++) c[i]=a[i]&32767,a[i]>>=15,d[i]=b[i]&32767,b[i]>>=15;
		
		for (i=0;i<n;i++) A[i]=(C){(double)c[i],0},B[i]=(C){(double)d[i],0};
		fft(n,A,1);
		fft(n,B,1);
		for (i=0;i<n;i++) A[i]=A[i]*B[i];
		fft(n,A,-1);
		for (i=m<<1;i>m;i--) {
			x=A[i].x/n+0.5;
			ans[i]=(x%=mod);
			dec(ans[i],(x<<15)%mod);
		}
		for (i=0;i<n;i++) A[i]=(C){(double)a[i],0},B[i]=(C){(double)b[i],0};
		fft(n,A,1);
		fft(n,B,1);
		for (i=0;i<n;i++) A[i]=A[i]*B[i];
		fft(n,A,-1);
		for (i=m<<1;i>m;i--) {
			x=A[i].x/n+0.5;
			ans[i]=(ans[i]+(((x%mod)<<15%mod)<<15)-(x<<15))%mod;
		}
		
		for (i=0;i<n;i++) A[i]=(C){(double)a[i]+c[i],0},B[i]=(C){(double)b[i]+d[i],0};
		fft(n,A,1);
		fft(n,B,1);
		for (i=0;i<n;i++) A[i]=A[i]*B[i];
		fft(n,A,-1);
		for (i=m<<1;i>m;i--) {
			x=A[i].x/n+0.5;
			ans[i]=(ans[i]+((x%mod)<<15))%mod;
		}
	}
}
int main()
{
	int n=gi(),i,j,a,b,tot=0,l,r,k;
	for (i=1;i<n;i++) {
		a=gi(),b=gi();
		to[++tot]=b,nxt[tot]=head[a],head[a]=tot;
		to[++tot]=a,nxt[tot]=head[b],head[b]=tot;
	}
	for (i=fac[0]=1;i<=n;i++) fac[i]=1LL*fac[i-1]*i%mod;
	inv[n]=qpow(fac[n],mod-2);
	for (i=n;i;i--) inv[i-1]=1LL*inv[i]*i%mod;
	for (i=1;i<=n;i++) ans[i]=fac[n]*(inv[n-1-i]+1LL*inv[n-i]*i%mod)%mod;
	for (l=0,q[r=1]=1;l!=r;) for (i=head[k=q[++l]];i;i=nxt[i]) if (to[i]!=fa[k]) fa[q[++r]=to[i]]=k;
	for (s[i=n]--;i;i--) s[++siz[k=q[i]]]++,siz[fa[k]]+=siz[k],s[n-siz[k]]++;
    
	for (i=0,j=n;i<=n;i++,j--) NTT::b[i]=inv[j],NTT::a[i]=1LL*fac[i]*s[i]%mod;
	NTT::work(n);
	for (i=1;i<=n;i++) if ((ans[i]-=NTT::ans[i+n])<0) ans[i]+=mod;
	for (i=1;i<=n;i++) printf("%d\n",int(1LL*ans[i]*inv[i]%mod));
	return 0;
}


Measured memory_bytes: 88320
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = 10**18

k = n - k

dp = [[INF]*(k+1) for i in range(n+1)]
dp[0][0] = 0

# i番目のブロックを必ず選ぶ
for i in range(n):
    # すでにj回選んでいる
    for j in range(k):
        if j == 0:
            dp[i+1][j+1] = min(dp[0][j] + h[i], dp[i+1][j+1])
            continue
        #最後に選んだブロックはlast_i番目
        for last_i in range(i):
            if last_i + 1 < j:
                continue
            dp[i+1][j+1] = min(dp[last_i+1][j] + max(h[i] - h[last_i], 0), dp[i+1][j+1])

ans = 10**18
for i in range(n+1):
    ans = min(dp[i][k], ans)

print(ans)

Measured memory_bytes: 43996
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;

//#define int long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF int(1e9)

int main(void) {
    string s;
    cin >> s;
    if(s[0] == 'a' || s[0] == 'i' || s[0] == 'u' || s[0] == 'e' || s[0] == 'o') {
        cout << "vowel\n";
    } else {
        cout << "consonant\n";
    }
    
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  ll N,K; cin >> N >> K;
  vector<ll> x(N); for(ll i = 0; i < N; i++){ cin >> x[i];}
  
  ll min_sum = 1145141919;
  
  for(ll i = 0; i <= N - K; i++){
    ll l = i; ll r = l + K - 1;
    min_sum = min(min_sum,min( (abs( x[l]) + abs( x[r] - x[l])), (abs(x[r]) + abs( x[r] - x[l]))));
                  }
                  cout << min_sum << endl;
                  return 0;}
  

Measured memory_bytes: 1024
a,b,c,d,e,f=map(int,input().split())
w=[]
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if x<=f:
            w.append(x)
s=[]
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
max_con=0
ans,ans_2=0,0
for i in w:
    for j in s:
        if i!=0 or j!=0:
            if j<=e*(i//100):
                if i+j<=f:
                    con=(100*j)/(i+j)
                    if max_con<=con:
                        max_con=con
                        ans=i+j
                        ans_2=j
print(ans,ans_2)


Measured memory_bytes: 12440
#include<iostream>
#include<vector>
//saw editional

int main(){
    int H,W;
    std::cin>>H>>W;
    std::vector<bool>map(H*W);
    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            char buf;
            std::cin>>buf;
            if(buf=='.'){
                map[i*W+j]=0;
            }else{
                map[i*W+j]=1;
            }
        }
    }
    std::vector<unsigned long long>dp(H*W,0);
    for(int i=0;i<H;++i){
        if(map[i*W+0]==1){
            break;
        }
        dp[i*W+0]=1;
    }
    for(int i=0;i<W;++i){
        if(map[0*W+i]==1){
            break;
        }
        dp[0*W+i]=1;
    }
    for(int i=1;i<H;++i){
        for(int j=1;j<W;++j){
            if(map[i*W+j]==0){
                dp[i*W+j]=(dp[(i-1)*W+j]+dp[i*W+(j-1)])%(1000000007);
            }
        }
    }
    std::cout<<dp[H*W-1]<<std::endl;
    return 0;
}

Measured memory_bytes: 11184