akhauriyash/Code-Regression huggingface dataset:
n=int(input())
lista = [int(i) for i in input().split()]
listb = []

for i in range(n):
    listb.append(lista[i]-(1*i +1))
    
listb.sort()
med = listb[n//2]
ans = 0
for i in range(n):
    ans += abs(listb[i]-med)

    
print(ans)

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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;



int main() {
	speed;
	cout << fixed << setprecision(6);
	/*start*/
	string s;
	cin >> s;
	bool flg = true;
	for (int i = 0; i < s.size()/2; i ++) {
		if (s[i*2] == 'L') {
			flg = false;
			break;
		}
		else if (s[i*2 + 1] == 'R') {
			flg = false;
			break;
		}
	}
	if (s.size() % 2 == 1) {
		if (s.back() == 'L')flg = false;
	}
	if (flg) {
		c("Yes");
	}
	else {
		c("No");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int a, b, h;
    cin >> a >> b >> h;
    OUT((a+b)*h/2)

    return 0;
}

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

int main(){
  int N,M;
  cin >>N>>M;
  
  map<int,int> mp;
  int K,A;
  rep(i,1,N){
    cin >>K;
    rep(i,1,K){
      cin >>A;
      mp[A]++;
    }
  }
  
  int ans = 0;
  rep(i,1,M) if(mp[i]==N) ans++;
  
  cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c, temp;
	scanf("%d %d %d", &a, &b, &c);
	if (a > b) {
		temp = a;
		a = b;
		b = temp;
	}
	if (a > c) {
		temp = a;
		a = c;
		c = temp;
	}
	if (b > c) {
		temp = b;
		b = c;
		c = temp;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}

Measured memory_bytes: 596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Collections;
import java.util.StringTokenizer;
 
public class Main {
	
	static int N = (int)1e9 + 7;
	static int dp[];
 
	public static void main(String[] args) {
		FastScanner sc=new FastScanner();

		int n = sc.nextInt() , k = sc.nextInt();
		int a[] = sc.readArray(n);
		dp = new int[n+1];
		Arrays.fill(dp, N);
		dp[0] = 0;
		for(int i = 0 ; i < n ; ++i ) {
			for(int p = 0 ; p <= k ; p++) {
				int j = i + p;
				if(j < n) {
					dp[j] = Math.min(dp[j], dp[i] + Math.abs(a[j] - a[i]));
				}
			}
		}
		System.out.println(dp[n-1]);
		
	}
	
	public void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
	}
 
}


Measured memory_bytes: 44228
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    [h,w,d] <- map read.words <$> getLine :: IO [Int]
    us <- replicateM h $ do
        U.unfoldrN w (B.readInt.B.dropWhile isSpace) <$> B.getLine
    !q <- readLn :: IO Int
    lrs <- U.unfoldrN q parseInt2 <$> B.getContents
    putStr.unlines.map show.U.toList$ solve h w d us lrs

solve :: Int -> Int -> Int -> [U.Vector Int] -> U.Vector (Int, Int) -> U.Vector Int
solve h w d us lrs = U.map(\(l,r) -> U.unsafeIndex dist (r-1) - U.unsafeIndex dist (l-1)) lrs
  where
    ps :: U.Vector (Int, Int)
    !ps = U.unsafeUpdate_
        (U.replicate (h*w) (0, 0))
        (U.map pred $ U.concat us)
        (U.generate (h*w) (`quotRem`w))
    dist :: U.Vector Int
    !dist = U.create $ do
        dis <- UM.replicate (h*w) 0
        for d (h*w) $ \i -> do
            pd <- UM.unsafeRead dis (i-d)
            let (px, py) = U.unsafeIndex ps (i-d)
            let (x, y) = U.unsafeIndex ps i
            UM.unsafeWrite dis i $ pd + abs(x-px) + abs(y-py)
        return dis
-------------------------------------------------------------------------------
rep, rev :: Monad m => Int -> (Int -> m ()) -> m ()
rep !n = U.forM_ $ U.generate n id
rev !n = U.forM_ $ U.iterateN n (subtract 1) (n - 1)
for :: Monad m => Int -> Int -> (Int -> m ()) -> m ()
for !s !t = U.forM_ $ U.generate (t - s) (+s)
{-# INLINE rep #-}
{-# INLINE rev #-}
{-# INLINE for #-}

type Parser a = B.ByteString -> Maybe (a, B.ByteString)

parseInt :: Parser Int
parseInt = B.readInt . B.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (B.readInt . B.dropWhile isSpace)
        <*> StateT (B.readInt . B.unsafeTail)


Measured memory_bytes: 11772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 1000000007;
const int MOD = 998244353;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-2, -1};
int dx[4] = {-1, -2};

int x, y;

const int MAX = 300050;
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	COMinit();
	ll n, a, b, k, x, y;
	cin >> n >> a >> b >> k;
	x = 0;
	ll ret = 0;
	while(k - a * x >= 0) {
		ll z = k - a * x;
		if(z % b == 0) {
			y = z / b;
			ret += COM(n, x) * COM(n, y);
			ret %= MOD;
		}
		x++;
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 7296
// atcoder/abc127/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

constexpr lli mod = 1e9 + 7;
constexpr int N = 2 * 1e5 + 5;
namespace math {
  lli  fact[N], finv[N], inv[N];

  void init()
  {
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < N; i++){
      fact[i] = fact[i - 1] * i % mod;
      inv[i] = mod - inv[mod % i] * (mod / i) % mod;
      finv[i] = finv[i - 1] * inv[i] % mod;
    }
  }

  lli mod_comb(int n, int k)
  {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fact[n] * (finv[k] * finv[n - k] % mod) % mod;
  }
};

struct Acc {
  vector<lli> sum;
  Acc(vector<lli> v) {
    sum.push_back(0);
    each (i, v) {
      sum.push_back(sum.back() + i);
    }
  }
  lli query(lli begin, lli end) {
    return sum[end] - sum[begin];
  }
};

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  math::init();

  lli h, w, k;
  while (cin >> h >> w >> k) {
    lli x = 0;
    vector<pair<int, int>> v;
    for (lli i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        lli p = h - i;
        lli q = w - j;
        // if (k != 5000) cout << make_pair(i, j) << ' ' << p << "*" << q << "=" << p * q << ", len:=" << i + j << endl;
        lli y = 1;
        if (i && j) ++y;
        y *= i + j;
        x += ((p * q) % mod) * y;
        x %= mod;
      }
    }
    // cout << x << ' ' << (x * math::mod_comb(h * w - 2, k - 2)) % mod << endl;
    cout << (x * math::mod_comb(h * w - 2, k - 2)) % mod << endl;
  }

  return 0;
}


Measured memory_bytes: 4992
import numpy as np

x = input().split()
N = int(x[0])
D = int(x[1])

cnt = 0
for i in range(N):
  a = input().split()
  p = int(a[0])
  q = int(a[1])
  E = np.sqrt(p**2 + q**2)
  if (E <= D):
    cnt += 1

print(cnt)

Measured memory_bytes: 27136
#include<stdio.h>
int main(){
	int x, y;
	scanf("%d%d", &x, &y);
	x=x>3?5:x;
	y=y>3?5:y;
	switch(x*y){
		case 1:printf("1000000");break;
		case 2:printf("500000");break;
		case 4:
		case 3:printf("400000");break;
		case 5:
		case 6:printf("300000");break;
		case 10:
		case 9:printf("200000");break;
		case 15:printf("100000");break;
		case 25:printf("0");break;
	}
	return 0;
}


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

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

namespace atcoder{
    void judge_outer(bool judge_exp,string ok = "Yes",string ng = "No"){
        if(judge_exp){
            cout << ok << endl;
        }else{
            cout << ng << endl;
        }
    }
    
    int ncr(int left,int right){
        right = min(left - right,right);
        int ans =1;
        for(int i=1;i<=right;i++){
            ans = ans * (left-right+i)/i;
        }
        return ans;
    }
    
    const int LIMIT = 1000000256;
    const int tenfive = 100000;
    
    
}

using namespace atcoder;

int main(void) {
	string str;
	cin >> str;
	int ans = 0;
	int stk = 0;
	for(int i = 0;i<str.size();i++){
	    if(stk > 0){
	        if(str[i] =='g'){
	            ans++;
	        }
	        stk--;
	    }else{
	    if(str[i] == 'p'){
	        ans--;
	    }
	    stk++;
	    }
	}
	cout << ans << endl;
	return 0;
}


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

int main() 
{
    long long int n,w,x,y,i,j;
    cin>>n>>w;
    vector<pair<long long ,long long >> item;
    for(i=0;i<n;i++)
    {
        long long  wt,vi;
        cin>>wt>>vi;
        item.push_back(make_pair(wt,vi));
    }
    sort(item.begin(),item.end());
    long long  dp[n][w+1];
    for(i=0;i<=w;i++)
    {
        if(item[0].first>i)
        {
            dp[0][i]=0;
        }
        else
        {
            dp[0][i]=item[0].second;
        }
    }
    //for(i=0;i<n;i++) cout<<item[i].first<<" ";
    for(i=1;i<n;i++)
    {
        for(j=0;j<=w;j++)
        {
            if(item[i].first>j) dp[i][j]=dp[i-1][j];
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-item[i].first]+item[i].second);
            }
        }
    }
    /*for(i=0;i<n;i++)
    {
        for(j=0;j<=w;j++)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[n-1][w];
    
    
    
}


Measured memory_bytes: 78336
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int output[50];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K; cin >> K;
    cout << 50 << endl;

    rep(i, 50) output[i] = 49 + K / 50;
    K -= (K / 50) * 50;
    rep(i, 50) {
        if (K > 0) {
            rep(j, 50) {
                if (i == j) output[j] += 50;
                else output[j]--;
            }
            K--;
        }
    }
    rep(i, 50) cout << output[i] << " ";
    cout << endl;


    return 0;
}
// 2 2 2 -> 5 1 1 -> 4 4 0 -> 3 3 3
// 3 3 3 -> 6 2 2 -> 5 5 1 -> 4 4 4 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    int A[N];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        A[i] -= i + 1;
    }
    sort(A, A + N);
    if(N % 2 == 1) {
        long long ans = 0;
        int b = A[N/2];
        for (int i = 0; i < N; i++)
        {
            ans += abs(A[i] - b);
        }
        cout << ans << endl;
        return 0;
    }
    else {
        int b = A[N/2-1], c = A[N/2];
        long long ansb = 0, ansc = 0;
        for (int i = 0; i < N; i++)
        {
            ansb += abs(A[i] - b);
            ansc += abs(A[i] - c);
        }
        cout << min(ansb, ansc) << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
#include<bitset>
#include<map>
using namespace std;

int main()
{
	int K, A, B;
	cin >> K >> A >> B;

	int c = A / K;
	c += (A % K == 0) ? 0 : 1;
	
	if (K * c <= B)
	{
		cout << "OK" << endl;
	}
	else
	{
		cout << "NG" << endl;
	}

	return 0;
}

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

void solve(long long K) {
    ll N = 7;
    rep(i, 10000000) {
        if (N % K == 0) {
            cout << i + 1 << endl;
            return;
        }
        N = N * 10 + 7;
        N %= K;
    }
    cout << -1 << endl;
}

int main() {
    long long K;
    scanf("%lld", &K);
    solve(K);
    return 0;
}


Measured memory_bytes: 3684
#include <stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
		else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func mint(a int) int {
	return (a + 1000000007) % 1000000007
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var h, w, k int

	fmt.Sscan(getNextLine(scanner), &h, &w, &k)
	dp := make([][]int, 2)
	prev, current := 0, 1
	for i := 0; i < 2; i++ {
		dp[i] = make([]int, w+2)
	}
	dp[prev][1] = 1
	for i := 0; i < h; i++ {
		for lw := 1; lw <= w; lw++ {
			dp[current][lw] = 0
			for j := 0; j < 1<<uint(w-1); j++ {
				if w > 2 {
					nextTo := false
					for bits := 3; bits < 1<<uint(w-1); bits <<= 1 {
						nextTo = nextTo || (bits&j) == bits
					}
					if nextTo {
						continue
					}
				}
				x1, x2, x3 := 1, 1, 1
				if lw == 1 {
					if (1 << uint(w-lw-1) & j) > 0 {
						x2 = 0
					} else {
						x3 = 0
					}
				} else if lw == w {
					if (1 << uint(w-lw) & j) > 0 {
						x2 = 0
					} else {
						x1 = 0
					}
				} else {
					if (1 << uint(w-lw-1) & j) > 0 {
						x2 = 0
					} else {
						x3 = 0
					}
					if (1 << uint(w-lw) & j) > 0 {
						x2 = 0
					} else {
						x1 = 0
					}
				}
				if w == 1 {
					x1 = 0
					x3 = 0
				}
				dp[current][lw] += dp[prev][lw-1] * x1
				dp[current][lw] += dp[prev][lw] * x2
				dp[current][lw] += dp[prev][lw+1] * x3
				dp[current][lw] = mint(dp[current][lw])
			}
		}
		prev, current = current, prev
	}
	fmt.Println(dp[prev][k])
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <vector>

constexpr long long MOD = 1000000007;

template<int N, typename T, T M>
struct factorial_mod
{
	T mod[N + 1];
	T inv_mod[N + 1];

	constexpr factorial_mod() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}

	constexpr T power(T a, T b) const
	{
		T r = 1;
		while (b > 0)
		{
			if ((b & 1) != 0) r = (r * a) % M;
			a = (a * a) % M;
			b >>= 1;
		}
		return r;
	}

	constexpr T comb(T n, T r) const
	{
		if (r < 0 || r > n || n < 0) return 0;
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}

	constexpr T H(T n, T r) const
	{
		return comb(n + r - 1, r);
	}
};

constexpr factorial_mod<100, long long, MOD> fmod;

template<typename T>
constexpr T pow_mod(T a, T b, T m)
{
	T r = 1;
	while (b > 0)
	{
		if ((b & 1) != 0) r = (r * a) % m;
		a = (a * a) % m;
		b >>= 1;
	}
	return r;
}

long long lagrange(std::vector<long long> &in, long long t)
{
	int n = in.size() - 1;
	if (t <= n) return in[t];
	long long res = 0;
	std::vector<long long> dp1(n + 1, 1), dp2(n + 1, 1);
	for (int i = 0; i < n; ++i) dp1[i + 1] = dp1[i] * (t - i) % MOD;
	for (int i = n; i > 0; --i) dp2[i - 1] = dp2[i] * (t - i) % MOD;
	for (int i = 0; i <= n; ++i)
	{
		long long x = in[i] * dp1[i] % MOD * dp2[i] % MOD * fmod.inv_mod[i] % MOD * fmod.inv_mod[n - i] % MOD;
		if ((n - i) % 2 != 0) res = (res + MOD - x) % MOD;
		else res = (res + x) % MOD;
	}
	return res;
}

long long c(long long n, long long k)
{
	if (n < 0 || k > n) return 0;
	long long res = 1;
	for (int i = 0; i < k; ++i)
	{
		res = (res * (n - i)) % MOD;
	}
	res = (res * fmod.inv_mod[k]) % MOD;
	return res;
}

int main()
{
	int t;
	scanf("%d", &t);
	while (t-- > 0)
	{
		long long n;
		scanf("%lld", &n);
		std::vector<long long> poly;
		long long sum = 0;
		for (int k = 0; k <= 15; ++k)
		{
			sum = (sum + c(k + 4, k) * c(n - 2 * k + 5, 10)) % MOD;
			poly.emplace_back(sum);
		}
		printf("%lld\n", lagrange(poly, n / 2));
	}
	return 0;
}


Measured memory_bytes: 3220
#include<iostream>
using namespace std;
int main()
{
    int n, c=0;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
        if(a[i]!=(i+1)) c++;
    }

    if(c>2) cout<<"NO\n";
    else cout<<"YES\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,now;
char s[500010];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	if (s[n]=='1') return puts("-1"),0;
	if (s[1]=='0' || s[n-1]=='0') return puts("-1"),0;
	FOR(i,1,n-1) if (s[i]!=s[n-i]) return puts("-1"),0;
	s[n]='1';
	now=1;
	FOR(i,2,n) if (s[i]=='1'){
		printf("%d %d\n",i,now);
		FOR(j,1,i-now-1) printf("%d %d\n",i,i-j);
		now=i;
	}
	return 0;
}

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

int main() {
	string s;
	long long k;
	cin >> s >> k;
	for (int i = 0; i < s.size(); i++) {
		int tg = ('z' + 1) - s[i];
		if (s[i] == 'a')
			continue;
		if (tg <= k)
			k -= tg, s[i] = 'a';
	}
	if (k > 0) {
		long long tmp = k + (s[s.size() - 1] - 'a');
		tmp %= 26;
		s[s.size() - 1] = 'a' + tmp;
		}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	int i;

	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string s;
	cin >> s;
	int n=s.size();
	int w=0,l=0,xg=0,xp=0;
	for(i=0;i<n;i++){
		if(s[i]=='g'){
			if(xp+1<=xg){
				w++; xp++;
			}else{
				xg++;
			}
		}else{
			if(xp+1<=xg) xp++;
			else{
				l++; xg++;
			}
		}
	}

	cout << w-l << endl;

	return 0;
}


Measured memory_bytes: 512
import sys
from collections import deque

N = int(sys.stdin.readline())

edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, sys.stdin.readline().split())
    edges[a-1].append((b-1, c))
    edges[b-1].append((a-1, c))

Q, K = map(int, sys.stdin.readline().split())

# Kを始点とする、各点までの距離
dist = [-1 for _ in range(N)]

visited = set()
q = deque([(K-1, 0)])
while q:
    p, c = q.popleft()
    if p in visited:
        continue
    dist[p] = c

    visited.add(p)
    for (next_p, next_c) in edges[p]:
        q.append((next_p, c + next_c))
# print(dist)

for _ in range(Q):
    x, y = map(int, sys.stdin.readline().split())
    print(dist[x-1] + dist[y-1])

Measured memory_bytes: 59696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).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 (b<a) { a=b; return 1; } return 0; }

int dx[4] = {0,-1,0,1};
int dy[4] = {-1,0,1,0};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
      cout << b << endl;
    }
    else if (6 <= a) {
      cout << b/2 << endl;
    }
    else {
      cout << 0 << endl;
    }
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    string c;
    cin >>N>>c;
    ll inx = 0;
    ll cnt = 0,cntr=0,cntc=0;
    rep(i,N){
        if(c[i]=='R'){
            cntr++;
        }else{
            cntc++;
        }
    }
    ll ans = 0;
    rep(i,cntr){
        if(c[i]=='W'){
            ans++;
        }
    }
    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

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

    int n, x;
    cin >> n >> x;
    int pos = 0;
    int l;
    vector< int > v;
    v.pb( 0 );
    for( int i = 1; i <= n; ++i ) {
        cin >> l;
        v.pb( v[i - 1] + l );

    }

    int sum = 0;
    while( pos < n + 1 && v[pos] <= x ) {
        ++pos;

    }

    cout << pos << endl;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5,M=2*N,inf=1e8;
int n,i,et,he[N],l[N],r[N];bool flag;
struct edge{int l,to;}e[M];
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void put(int x){if (x>9) put(x/10);putchar(x%10+48);}
void write(int x){
	if (x<0) putchar('-'),x=-x;
	put(x);putchar('\n');
}
void dfs1(int x,int fa){
	for (int i=he[x];i;i=e[i].l){
		int y=e[i].to;if (y==fa) continue;
		dfs1(y,x);
		l[x]=max(l[x],l[y]-1);
		r[x]=min(r[x],r[y]+1);
	}
}
void dfs2(int x,int fa){
	for (int i=he[x];i;i=e[i].l){
		int y=e[i].to;if (y==fa) continue;
		l[y]=max(l[y],l[x]-1);
		r[y]=min(r[y],r[x]+1);
		if (!((l[x]^l[y])&1)) flag=0;
		dfs2(y,x);
	}
}
int main(){
	for (n=read(),i=1;i<n;i++){
		int x=read(),y=read();
		e[++et].l=he[x];he[x]=et;e[et].to=y;
		e[++et].l=he[y];he[y]=et;e[et].to=x;
	}
	for (i=1;i<=n;i++) l[i]=-inf,r[i]=inf;
	for (i=read();i--;){
		int x=read();l[x]=r[x]=read();
	}
	dfs1(1,0);flag=1;dfs2(1,0);
	for (i=1;i<=n;i++) if (l[i]>r[i]) flag=0;
	if (!flag){puts("No");return 0;}
	for (puts("Yes"),i=1;i<=n;i++) write(l[i]);
}

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

#define INFTY (1 << 30);
typedef long long ll;

int main(void) {
  ll N, K;
  double prob = 0.0;
  cin >> N >> K;

  for (int i = 1; i <= N; i++) {
    if (i >= K) {
      prob += (1.0 / (double)N) * ((double)N-(double)i+1.0);
      break;
    }
    double res_log = (double)log2((double)K/(double)i);
    double res_ceil = ceil((double)res_log);
    // cout << i << " " << K << " " << res_log << " " << res_ceil << endl;
    prob += (pow(0.5, res_ceil) / N);
  }
  cout << setprecision(20) << prob << endl;
  return 0;
}


Measured memory_bytes: 256
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>

using namespace std;

typedef struct datum_name {
	int x;
	int y;
	int whosay;
	bool operator==(const datum_name& data) const
	{
		return (x == data.x && y == data.y);
	}
} datum;


bool cmp_who(const datum& left, const datum& right) {
	return left.whosay < right.whosay;
}

typedef vector<vector<int>> Graph;
vector<bool> seen;
vector<int> depth;

void dfs(const Graph& G, int v, int depth_num) {
	seen[v] = true;
	depth[v] = depth_num;

	for (auto next_v : G[v]) {
		if (seen[next_v]) continue;
		dfs(G, next_v, depth_num+1); //再帰探索
	}
}

int main()
{
	int64_t N;
	cin >> N;
	vector<int64_t> array;
	for (int64_t i = 0; i < N; i++) {
		int64_t tmp;
		cin >> tmp;
		array.push_back(tmp);
	}
	vector<int64_t> one_num;
	one_num.resize(64);
	for (int64_t order = 0; order < 64; order++) {
		for (int64_t i = 0; i < N; i++) {
			if (array[i] & ((int64_t)(1) << order)) {
				one_num[order] += 1;
			}
		}
	}

	vector<int64_t> ans_one_num;
	ans_one_num.resize(64);

	for (int64_t order = 0; order < 64; order++) {
		for (int64_t j = 0; j < N; j++) {
			if (array[j] & ((int64_t)(1) << order)) { // case bit=1
				one_num[order] -= (int64_t)(1);
				ans_one_num[order] += (int64_t)( (N-j-1) - one_num[order]);
			}
			else { // case bit = 0;
				ans_one_num[order] += (int64_t)( one_num[order]);
			}
			ans_one_num[order] = ans_one_num[order] % (int64_t)(1000000000 + 7);
		}
	}

	int64_t ans = 0;
	for (int64_t order = 0; order < 64; order++) {
		int64_t order_value = ((int64_t)(1) << order) % (int64_t)(1000000000 + 7);
		ans += ans_one_num[order] * order_value;
		ans = ans % (int64_t)(1000000000 + 7);
	}
	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,y;cin>>n>>y;
	for(int i=0;i<=y/10000;i++){
		for(int j=0;j<=y/5000;j++){
			long long tmp=1ll*i*10000+1ll*j*5000;
			if(tmp>y||(i+j)>n) continue;
			if(tmp+(n-i-j)*1000==y){
				cout<<i<<' '<<j<<' '<<n-i-j<<endl;return 0;
			}
		}
	}
	cout<<-1<<' '<<-1<<' '<<-1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int lli;
#define repeat(i, n) for(int (i)=0; (i)<(n); (i)++)

int main(){
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if(s == "abc"){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    double pi = Math.PI;
    double r = scanner.nextDouble();
    double area = area(r);
    double length = length(r);
    System.out.printf("%f %f", area, length);
  }

  public static double area(double r){
    double pi = Math.PI;
    return r * r * pi;
  }

  public static double length(double r){
    double pi = Math.PI;
    return 2 * pi * r;
  }
}

Measured memory_bytes: 28352
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    double n,d,x,i,s=0,a,b;
    cin>>n>>d;
    for(i=0;i<n;i++)
    {
        cin>>a>>b;
        x=sqrt((a*a)+(b*b));
        if(x<=d)
            s++;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3812
/*
  || Shree Ganeshay Namah ||

     || Jai Shree Ram ||
  || Nabh Sparsham Diptam ||
*/
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define mod 1000000007
#define block 180
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f1 first
#define s1 second
int jai_shree_ram()
{
    return 1;
}
int shree_ganeshay_namah()
{
    return 1;
}
ll power(ll x,ll y)
{
    ll r=1;
    while(y>0)
    {
        if(y%2!=0)
            r=r*x;
        x=x*x;
        y=y/2;
    }
    return r;
}
ll ncr(ll n,ll k)
{

    ll c[k+1];
    memset(c,0,sizeof(c));
    c[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=min(i,k);j>0;j--)
            c[j]=c[j]+c[j-1];
    }
    return c[k];
}

bool prime[500001];
void sieve()
{
    ll i,j;
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(i=2;i<=sqrt(100001);i++)
    {
        if(prime[i])
        {
            for(j=i*i;j<=100001;j=j+i)
                prime[j]=false;
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a;
    cin>>a;
    cout<<a + a*a + a*a*a;
    return 0;

}


Measured memory_bytes: 3608
//In The Name Of GOD

#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll mod = 1000000007;
const ll inf = 2000000000;
const ll infll = (ll)2*1000*1000*1000*1000*1000*1000;
const ll maxn = 20;
#define pb push_back
#define pp pop_back
#define IO ios_base::sync_with_stdio(false);
bool ask(int a){
  cout <<flush << a << endl <<flush;
  string s;
  cin >> s;
  if(s[0]=='V'){
    exit(0);
  }
  if(s[0]=='M'){
    return 1;
  }else{
    return 0;
  }
}
int main(){
  IO;
  int n;
  cin>>n;
  int r=n-1,l=1;
  bool wr,wl;
  wr = wl = ask(0);
  while(l<=r){
    // cout<<r<<' '<<l<<endl;
    int mid=(l+r)>>1;
    bool p=ask(mid);
    if( (p==wl) ^ ((mid-l+2)%2) ){
      // cout<<"hi"<<(p==wl) << ((mid-r+2)%2) <<endl;
      r=mid-1;
      wr=p;
    }else{
      // cout<<"hoy\n";
      l=mid+1;
      wl=p;
    }
    // cout<<r<<' '<<l<<endl;
  }
}


Measured memory_bytes: 976
#include <stdio.h>
#include <stdlib.h>
   
typedef struct{
    int key;
    int left;
    int right;
} Node;
   
void insert(Node*, int, int);
void print1(Node*, int);
void print2(Node*, int);
   
int main()
{
    char s[10];
    Node *t;
    int m;
    int a;
    int i;
    int cnt=0;   

    scanf("%d", &m);

    t=(Node*)malloc(sizeof(Node)*m);
   
    for(i=0; i<m; i++)
    {
        scanf("%s", &s);

        if(s[0]=='i'){scanf("%d", &a);insert(t, cnt, a);cnt++;}
        if(s[0]=='p')
        {
            if(cnt>0) print1(t, 0);
            printf("\n");
            if(cnt>0) print2(t, 0);
            printf("\n");
        }
    }
       
    return 0;
   
}
   
void print1(Node *t, int p)
{
    if(t[p].left>=0)print1(t, t[p].left);
    printf(" %d", t[p].key);
    if(t[p].right>=0)print1(t, t[p].right);
}
   
void print2(Node *t, int p)
{
    printf(" %d",t[p].key);
    if(t[p].left>=0)print2(t,t[p].left);
    if(t[p].right>=0)print2(t,t[p].right);
}
   
void insert(Node *t, int cnt, int z)
{
    int x=0, y;
    if(cnt<1) x=-1;
   
    t[cnt].key = z;
    t[cnt].left = -1;
    t[cnt].right= -1;
   
    while(x>=0){
        y = x; 
        if(z < t[x].key)
            x = t[x].left; 
        else
            x = t[x].right; 
    }
   
    if(cnt<1){}
    else if(z < t[y].key)
    {
        t[y].left = cnt; 
    }
    else {
        t[y].right = cnt;
    }
}

Measured memory_bytes: 6464
N, M, X, Y = map(int, input().split())
x_targets = [int(i) for i in input().split()]
y_targets = [int(i) for i in input().split()]

array_1 = [i for i in range(X + 1, Y + 1)]
array_2 = [i for i in range(max(x_targets) + 1, min(y_targets) + 1)]
array_and = set(array_1) & set(array_2)
if len(array_and) != 0:
    print('No War')
else:
    print('War')

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

#define MOD 1000000007

int main(){
    int r,g,b;
    cin >> r >> g >> b;
    int ans=0;
    ans=r*100+g*10+b;
    if(ans%4==0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;

const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！



//Eと名のつくのはデバッグ用！
int EintN(int array[],const int num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {cerr<<array[i][k]<<" ";}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}


int Ap(){
    int a;a=0;
    string s;
    cin>>a>>s;
    if(a>=3200){OutputAndReturn0(s);}
    OutputAndReturn0("red");
    return 0;
}

ll Bp(){
    ll ans;ans=0;
    int n;
    cin>>n;
    double a[n];
    
    double revsum=0;
    FOR(i, 0, n){
        cin>>a[i];
        revsum+=1/a[i];
    }
    printf("%lf\n",1/revsum);
    return 0;
}

int Cp(){
    double ans;ans=0;
    int n;
    cin>>n;
    int v[n];
    inarray(v,0,n);
    sort(v, v+n);
    //EintN(v, n);
    if (n==1) {OutputAndReturn0(v[0]);}
    ans=(double)(v[0]+v[1])/2;
    FOR(i,2, n){
        ans=(ans+v[i])/2;
    }
    printf("%lf",ans);

    return 0;
}

int Dp(){
    long long int N=0;
    
    OutputAndReturn0(N);
    return 0;
}

signed main(){
    //test();
    //Ap();
    //Bp();
    Cp();
    //Dp();
    return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
time_list = [a,b,c,d,e]
time_loss_list = [a,b,c,d,e]
loss = []
for i in range(len(time_list)):
    time_loss = 0
    while time_loss_list[i]%10 != 0:
        time_loss += 1
        time_loss_list[i]+=1
    loss.append(time_loss)
loss = sorted(loss)
print(sum(time_list) + sum(loss) - loss[-1])


Measured memory_bytes: 3064
import java.util.*;
    public class Main {// Main
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
          String s = sc.next();
          int n = s.length();
          int win = 15-n;
          for(int i=0;i<n;i++){
          if(s.substring(i,i+1).equals("o")){ win++; }
          }
          if(win>=8) System.out.println("YES");
          else System.out.println("NO");
        }
    }							

Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

ll X, K, D;
long double eps = 1e-9;

int main() {
  //
  cin >> X >> K >> D;

  X = abs(X);

  long double xx = X;
  long double kk = K;
  long double dd = D;

  if (kk + eps >= (xx - X % D) / dd) {
    ll times = (X - X % D) / D;
    ll diff = K - times;
    if (diff % 2 == 0) {
      cout << X % D;
      return 0;
    } else {
      cout << D - X % D;
      return 0;
    }
  } else {
    cout << X - K * D;
    return 0;
  }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

int main(){

    int N;
    cin >> N;

    vector<ll> a(N);
    ll xor_all = 0;
    rep(i, N){
        cin >> a[i];
        xor_all ^= a[i];
    }
    rep(i, N){
        a[i] &= ~xor_all;
    }

    int pos = 0;
    for(int digit = 59; digit >= 0; digit--){
        ll bit = 1ll << digit;
        bool found = false;
        for(int i = pos; i < N; i++){
            if(a[i] & bit){
                swap(a[pos], a[i]);
                found = true;
                break;
            }
        }
        if(found){
            rep(i, N){
                if(i == pos)continue;
                if(a[i] & bit)a[i] ^= a[pos];
            }
            pos++;
        }
    }

    ll ans = 0;
    for(int i = 0; i < min(N, 60); i++){
        ans ^= a[i];
    }
    cout << ans * 2 + xor_all << endl;
    return 0;

}

Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			String buffer = sc.nextLine();
			if (buffer.equals(".")) {
				break;
			}
			LinkedList<Character> q = new LinkedList<Character>();
			boolean ok = true;
			for (char ch : buffer.toCharArray()) {
				if (ch == ')') {
					if (q.isEmpty()) {
						ok = false;
						break;
					}
					char ch2 = q.removeLast();
					if (ch2 != '(') {
						ok = false;
						break;
					}
				}
				if (ch == ']') {
					if (q.isEmpty()) {
						ok = false;
						break;
					}
					char ch2 = q.removeLast();
					if (ch2 != '[') {
						ok = false;
						break;
					}
				}
				if (ch == '(' || ch == '[') {
					q.addLast(ch);
				}
			}
			if(!q.isEmpty()){
				ok = false;
			}
			System.out.println(ok?"yes":"no");
		}
	}

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <random>
#include <time.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const int Nmax=2e5+1;
const int Nd=61;
const int INF=1e5;


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint pow_kai(mint a, ll n){//aのn乗を計算します。
  mint x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main(){
  int sum;
  cin>>sum;
  combination c(sum-1);
  mint ans=0;
  rep(n,sum){// n桁の場合を考える
    if(3*n<=sum){
      //cout<<n<<endl;
      ans+=mint(c(sum-2*n-1,sum-3*n));
    }
  }
  cout<<ans<<endl;




}


Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main() {

	int n, f[9][9], p[9][9];

	cin >> n;
	for(int c=0; c<n; c++) {
		if(c) {
			cout << endl;
		}
		for(int i=0; i<9; i++) {
			for(int j=0; j<9; j++) {
				f[i][j]=0;
				cin >> p[i][j];
			}
		}

		for(int i=0; i<9; i++) {
			for(int j=0; j<9; j++) {
				for(int k=i; k<9; k++) {
					for(int l=j; l<9; l++) {
						if(p[i][j]==p[k][l]&&(i==k||j==l)&&!(i==k&&j==l)) {
							f[i][j]=f[k][l]=1;
						}
					}
				}
			}
		}

		for(int i=0; i<9; i++) {
			for(int j=0; j<9; j++) {
				int x=(i/3)*3, y=(j/3)*3;
				for(int k=x; k<x+3; k++) {
					for(int l=y; l<y+3; l++) {
						if(p[i][j]==p[k][l]&&!(i==k&&j==l)) {
							f[i][j]=f[k][l]=1;
						}
					}
				}
			}
		}
							
		for(int i=0; i<9; i++) {
			for(int j=0; j<9; j++) {
				if(f[i][j]) {
					cout << "*" << p[i][j];
				}
				else {
					cout << " " << p[i][j];
				}
			}
			cout << endl;
		}
	}

	return 0;

}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

signed main(){
    int n,q;
    cin>>n>>q;
    vector<pair<ll,pair<int,ll>>> p;
    set<ll> st;
    rep(i,n){
        ll s,t,x;
        cin>>s>>t>>x;
        p.push_back(make_pair(s-x,make_pair(1,x)));
        p.push_back(make_pair(t-x,make_pair(-1,x)));
    }
    vector<ll> d(q);
    rep(i,q) cin>>d[i];
    sort(all(p));
    int k=0;
    int m=p.size();
    vector<ll> ans;
    int kk=0;
    while(k<q){
        while(d[k]>=p[kk].ft&&kk<m){
            ll b=p[kk].sc.ft,c=p[kk].sc.sc;
            if(b==1) st.insert(c);
            else st.erase(c);
            kk++;
        }
        if(st.size()==0) ans.push_back(-1LL);
        else ans.push_back(*begin(st));
        k++;
    }
    for(ll aa:ans) cout<<aa<<endl;
}

Measured memory_bytes: 26472
#include<stdio.h>
using namespace std;

#define ll long long

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

ll lcm(ll a,ll b)
{
    ll g=gcd(a,b);
    return a/g*b;
}

int main()
{
    ll x;
    ll ans=1LL;
    int n;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%lld",&x);
        ans=lcm(x,ans);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(){
    int A[3]={}, cost, total, tmp;
    scanf("%d %d %d ", &A[0], &A[1], &A[2]);
    for (int i=0; i<3; i++) {
        for (int j=i+1; j<3; j++) {
            if (A[i] > A[j]) {
                tmp =  A[i];
                A[i] = A[j];
                A[j] = tmp;
            }
        }
    }
    cost = (A[1]-A[0])+(A[2]-A[1]);
    printf("%d\n", cost);
    return 0;
}

Measured memory_bytes: 128