akhauriyash/Code-Regression huggingface dataset:
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	r := stdin.ReadFloat64()
	stdout.Println(r * math.Pi * 2)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

func (s *Stdin) ReadIntSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadInt()
	}
	return a
}

func (s *Stdin) ReadStringSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = s.Read()
	}
	return a
}

func (s *Stdin) ReadFloat64Slice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadFloat64()
	}
	return a
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Measured memory_bytes: 1768
from collections import deque

N, M = map(int, input().split())

rooms = [[] for _ in range(N)]

for _ in range(M):
    A, B = map(int, input().split())
    rooms[A - 1].append(B - 1)
    rooms[B - 1].append(A - 1)

signposts = [None] * N
que = deque([0])

while que:
    n = que.popleft()
    for room in rooms[n]:
        if signposts[room] is None:
            que.append(room)
            signposts[room] = n + 1

if None in signposts:
    print("No")
else:
    signposts[0] = "Yes"
    for s in signposts:
        print(s)


Measured memory_bytes: 36956
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int a[3][3];
bool f[101];
int n;
int b[10];
int main(){
	ios::sync_with_stdio(0);
	rep(i,3)
	rep(j,3)
	cin>>a[i][j];
	cin>>n;
	rep(i,n){
		cin>>b[i];
		f[b[i]]=true;
	}
	bool d=false;
	rep(i,3){
		bool ok=true;
		rep(j,3)
		if(!f[a[i][j]])
		ok=false;
		if(ok)
		d=true;
	}
	rep(i,3){
		bool ok=true;
		rep(j,3)
		if(!f[a[j][i]])
		ok=false;
		if(ok)
		d=true;
	}
	if(f[a[0][0]]&&f[a[1][1]]&&f[a[2][2]])
	d=true;
	if(f[a[0][2]]&&f[a[1][1]]&&f[a[2][0]])
	d=true;
	if(d)
	cout<<"Yes";
	else
	cout<<"No";
	re 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#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 FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CAntsOnACircle {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N, L, T;
        cin >> N >> L >> T;
        vector<int> X(N), W(N);

        vector<int> cond;
        REP(i, N) {
            cin >> X[i] >> W[i];

            if (W[i] != W[0]) {
                cond.push_back(X[i]);
            }
        }

        int t = T % L;
        int n = T / L;
        int cnt = 0;
        REP(i, N) {
            if (W[i] == 1) {
                //cnt -= n + (t >= L - X[i]);
                cnt -= (T - (L - X[i]) + L) / L;
            } else {
                //cnt += n + (t >= X[i]);
                cnt += (T - (X[i] + 1) + L) / L;
            }
        }
        cnt = ((cnt % N) + N) % N;

        vector<int> v;
        REP(i, N) {
            int x = X[i];
            int w = W[i];

            if (w == 1) {
                x += t;
                x %= L;
            } else {
                x -= t;
                if (x < 0) x += L;
            }
            v.push_back(x);
        }
        sort(v.begin(), v.end());

        vector<int> ans(N);
        REP(i, N) ans[(i + cnt) % N] = v[i];

        REP(i, N) cout << ans[i] << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CAntsOnACircle solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4852
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000
#define PI 3.141592653589793

int main() {
	long long a, b, c, k, ans = 0;
	cin >> a >> b >> c >> k;

	if (k > a + b) {
		ans += a;
		ans -= k - (a + b);
	} else if (k > a) {
		ans += a;
	} else {
		ans += k;
	}

	cout << ans;
	return 0;
}

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

int main(){
    string S;
    
    //for(int i = 0; i < 4; i++)
    cin >> S;
    
    if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2] || S[0] == S[2] && S[1] == S[3] && S[0] != S[1] || S[0] == S[3] && S[1] == S[2] && S[0] != S[1])
        cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
signed main(){
    
    int  a[3];
    cin >> a[0] >> a[1] >> a[2]; 
    int MOD = 1000000007;
    sort(a,a+3);
    int ans = a[2]*10 + a[1] + a[0];
    
    cout << ans << endl;
  

    
    return 0;
}
//g++ -std=c++14 code1.cpp



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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N, T;
	llong ans;
	llong before = -1, now;

	cin >> N >> T;
	ans = T;
	for(int i = 0; i < N; i++){
		cin >> now;
		if(before != -1){
			ans += min(T, now - before);
		}
		before = now;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
x1,y1,x2,y2 = map(int,input().split())

if not (abs(x1) <= 100 and abs(y1) <= 100 and abs(x2) <= 100 and abs(y2) <= 100):
    sys.exit()

x = x2 - x1
y = y2 - y1 

x3 = x2 - y
y3 = y2 + x
x4 = x1 - y
y4 = y1 + x
print(x3,y3,x4,y4)

Measured memory_bytes: 9132
#include<stdio.h>
#define INF 1000000
int graph[101][101],n,c,d;

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return x<y?x:y;
}

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=1;i<=n;i++)
      for(j=1;j<=n;j++)
	graph[i][j]=i==j?0:INF;
    
    for(i=0;i<k;i++){
      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>

const long long MOD = 1000000007;

int main() {
    long long L, R;
    std::cin >> L >> R;

    int D = 0;
    for (long long n = R; n; n >>= 1) D++;

    std::vector<std::vector<std::vector<std::vector<long long>>>> dp(
        D + 1,
        std::vector<std::vector<std::vector<long long>>>(
            2,
            std::vector<std::vector<long long>>(
                2,
                std::vector<long long>(2)
            )
        )
    );

    dp[D][0][0][0] = 1;

    for (int d = D - 1; d >= 0; d--) {
        int lb = L >> d & 1;
        int rb = R >> d & 1;

        for (int x = 0; x < 2; x++) {
            for (int y = 0; y < 2; y++) {
                if (x && !y) continue;

                for (int l = 0; l < 2; l++) {
                    if (!l && lb && !x) continue;

                    int nl = (!lb && x) ? 1 : l;

                    for (int r = 0; r < 2; r++) {
                        if (!r && !rb && y) continue;

                        int nr = (rb && !y) ? 1 : r;

                        for (int msb = 0; msb < 2; msb++) {
                            if (!msb && x != y) continue;

                            int nmsb = (x && y) ? 1 : msb;

                            dp[d][nl][nr][nmsb] += dp[d + 1][l][r][msb];
                            dp[d][nl][nr][nmsb] %= MOD;
                        }
                    }
                }
            }
        }
    }

    long long ans = 0;
    for (int l = 0; l < 2; l++) {
        for (int r = 0; r < 2; r++) {
            for (int msb = 0; msb < 2; msb++) {
                ans += dp[0][l][r][msb];
                ans %= MOD;
            }
        }
    }
    std::cout << ans << "\n";
}

Measured memory_bytes: 256
import Data.List

main = do
    n <- readLn
    print $ solve n `mod` (10^9 + 7)

solve :: Integer -> Integer
solve n = product $ map (+1) $ factor [2..n]

factor :: [Integer] -> [Integer]
factor = map (fromIntegral . length) . group . sort . concatMap factors

factors :: Integer -> [Integer]
factors n | n <= 1 = []
          | null xs = [n]
          | otherwise = let x = head xs
                         in x : factors (n`div`x)
    where m = floor $ sqrt $ fromIntegral n
          ps = [2..m]
          xs = filter (\p -> n `mod` p == 0) ps


Measured memory_bytes: 1788
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] alp = new long[28];
        int[] id = {'M'-'A', 'A'-'A', 'R'-'A','C'-'A', 'H'-'A'};
        long ans = 0;
        for(int i = 0;i < N;i++)  alp[sc.next().charAt(0)-'A']++;
        for(int i = 0;i <= 2;i++){
            for(int j = i+1;j <= 3;j++){
                for(int k = j+1;k <= 4;k++){
                    ans += alp[id[i]]*alp[id[j]]*alp[id[k]];
                }
            }
        }
        System.out.println(ans);  
    }
}

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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

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

#pragma region Debug
void debug_out() { cout << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cout << H << " ";
	debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
#pragma endregion

// コンパイル時、エイリアス「debug」を使用 --> マクロが使えるように

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	int n,m,k;
	cin >> n >> m >> k;
	vi a(n), b(m);
	rep(i,n){
		cin >> a[i];
	}
	rep(i,m){
		cin >> b[i];
	}
	int ans = 0;

	vi a_sum, b_sum;
	a_sum.eb(0);
	b_sum.eb(0);
	rep(i,n){
		a_sum.eb(a_sum[i] + a[i]);
	}
	rep(i,m){
		b_sum.eb(b_sum[i] + b[i]);
	}

	int b_itr = b_sum.size() - 1;
	rep(a_itr,a_sum.size()){
		if(a_sum[a_itr] > k){
			break;
		}
		while(b_sum[b_itr] > k - a_sum[a_itr]){
			b_itr--;
		}
		chmax(ans, a_itr + b_itr);
	}

	cout << ans << endl;

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 11048
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    if a <= c <= b:
        print("Yes")
        return
    print("No")
    return

#B
def B():
    n, m = LI()
    e = defaultdict(int)
    for i in range(1, n + 1): e[i] = 0
    for i in range(m):
        a, b = LI()
        e[a] += 1
        e[b] += 1
    for i in e.values():
        print(i)
    return

#C
def C():
    n, k = LI()
    d = defaultdict(int)
    for i in range(1, 10**5+1): d[i] = 0
    for i in range(n):
        a, b = LI()
        d[a] += b
    for key, valus in d.items():
        k -= valus
        if k <= 0:
            print(key)
            return
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


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

int main() {
  int h,w,k;
  int ans=0;
  int p=0;

  cin >> h>>w>>k;

  vector<vector<char> > s(h,vector<char>(w,0));
  int c=0;
  vector<int> cw(w,0);
  vector<int> ch(h,0);

  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      cin >> s[i][j];

      if(s[i][j]=='#') {
        c++;
        ch[i]++;
        cw[j]++;
      }
    }
  }

  for(int bith=0; bith<(1<<h);bith++) {
    for(int bitw=0; bitw<(1<<w);bitw++) {
      int sum=c;
      for(int i=0;i<h;i++) {
        if(bith & (1<<i)) {sum-=ch[i];}
      }
      for(int j=0;j<w;j++) {
        if(bitw & (1<<j)) {sum-=cw[j];}
      }
      for(int i=0;i<h;i++) {
         if(bith & (1<<i)) {
           for(int j=0;j<w;j++) {
             if(bitw & (1<<j)) {
               if(s[i][j]=='#') {sum++;}
             }
           }
         }
      }
      if(sum==k) {ans++;}
    }
  }

  cout <<ans<< endl;

  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll N, K, S;
    cin>>N>>K>>S;
    if(S!=1000000000){
        rep(i, N){
            if(i==N-1){
                if(i<K) cout<<S<<endl;
                else cout<<S+1<<endl;

            }
            else{
                if(i<K) cout<<S<<sp;
                else cout<<S+1<<sp;
            }
            
        }
    }
    else{
        rep(i, N){
            if(i==N-1){
                if(i<K) cout<<S<<endl;
                else cout<<999999999<<endl;
            }
            else{
                if(i<K) cout<<S<<sp;
                else cout<<999999999<<sp;
            }
            
        }
    }
    
    return 0;
}


Measured memory_bytes: 1280
def euclid(x, y):
    if(y != 0):
        tmp = y
        y = x % tmp
        x = tmp
        return euclid(x,y)
    else:
        return x
    
def main():
    N, X = map(int, input().split())
    x= list(map(int, input().split()))
    
    if(N > 1):
        D = 10**10
        for i in range(1, N):
            D = min(D, euclid(abs(x[i]-X), abs(x[i-1]-X)))     
        print(D)
    else:
        ans = abs(x[0]-X)
        print(ans)
main()

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  ll n, k;
  cin >> n >> k;
  map<int, ll> mp;
  rep(i, n){
    int a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  for(auto p : mp){
    k -= p.second;
    if(k <= 0){
      cout << p.first << endl;
      return 0;
    }
  }
  return 0;
}

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

int main()
{
  int n;
  while(cin >> n && n != 0){
    int maximum = 0, minimum = 1000, sum = 0, s;
    for(int i = 0 ; i < n; ++i){
      cin >> s;
      maximum = max(maximum, s);
      minimum = min(minimum, s);
      sum += s;
    }
    sum = sum - maximum -minimum;
    cout << sum/(n - 2) << endl;
  }
  return 0;
}

Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int a, b, c, d, e;
	scanf("%d\n%d\n%d\n%d\n%d", &a, &b, &c, &d, &e);
	int aa, bb, cc, dd, ee, x, num = 0, time = 0;
	aa = a % 10;
	bb = b % 10;
	cc = c % 10;
	dd = d % 10;
	ee = e % 10;
	if (aa == 0)
	{
		num += 1;
	}
	if (bb == 0)
	{
		num += 1;
	}
	if (cc == 0)
	{
		num += 1;
	}
	if (dd == 0)
	{
		num += 1;
	}
	if (ee == 0)
	{
		num += 1;
	}
	x = aa >= bb && bb != 0 ? bb: aa;
	x = x >= cc && cc != 0 ? cc: x;
	x = x >= dd && dd != 0 ? dd: x;
	x = x >= ee && ee != 0 ? ee: x;
	if (num != 5)
	{
		time = a - aa + b - bb + c - cc + d - dd + e - ee + 10 * (4 - num) + x;
	}
	else
	{
		time = a + b + c + d + e + x;
	}
	printf("%d", time);
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
	long long a,b,c;
	cin>>a>>b;
	c=a+b;
	if(a%3==0||b%3==0||c%3==0)
	cout<<"Possible"<<endl;
	else
	cout<<"Impossible"<<endl;
	return 0;
}

Measured memory_bytes: 256
from itertools import permutations
N = int(input())
A = sorted(int(input()) for _ in range(N))

def helper(L):
  s = abs(L[N//2] - L[0])

  for i in range((N+1)//2 - 1):
    s += abs(L[-i-1] - L[i])
    s += abs(L[-i-1] - L[i+1])
  if N % 2 == 1:
    s -= abs(L[N//2 + 1] - L[N//2])
  return s

print(max(helper(A), helper(A[::-1])))

Measured memory_bytes: 7896
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll dp[100100];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N;
    cin >> N;
    vector<ll> h(N);
    rep(i,N) cin >> h[i];
    REP(i,1,100100) dp[i] = LLINF;
    REP(i,1,N){
      chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
      if(i > 1) chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    print(dp[N-1]);
}

Measured memory_bytes: 1792
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  vector<int> a(7);
  for (int i = 0; i < 7; i++)
    cin >> a[i];
  long long ans = 0;
  ans += a[0] / 2 * 2;
  ans += a[1];
  ans += a[3] / 2 * 2;
  ans += a[4] / 2 * 2;
  if (a[0] > 0 && a[3] > 0 && a[4] > 0) {
    long long ret = 3;
    a[0]--;
    a[3]--;
    a[4]--;
    ret += a[0] / 2 * 2;
    ret += a[1];
    ret += a[3] / 2 * 2;
    ret += a[4] / 2 * 2;
    ans = max(ans, ret);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    int a=1;
    cin>>n;

    while(true)
    {
        if(n == 4 || n == 2 || n == 1)
        {
            cout << a+3 << endl;
            break;
        }
        if(n%2)
        {
            n = 3*n + 1;
        }
        else {
            n /= 2;
        }
        a++;
  }
}

//#include<iostream>
//#include<vector>
//using namespace std;
//int main()
//{
//    int n;
//    vector<int>a(1000001);
//    cin>>n;
//
//    a.at(n)++;
//
//    for(int i=2; ; i++)
//    {
//        if(n%2)
//        {
//            n = 3*n + 1;
//        }
//        else {
//            n /= 2;
//        }
//
//    if(a.at(n)++)
//    {
//        cout << i << endl;
//        return 0;
//    }
//  }
//}


Measured memory_bytes: 3556
#include<stdio.h>
int main(){
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using ll = long long;
int main() {
	int n;
	scanf("%d", &n);
	ll a[3 * n];
	rep(i, 3 * n) scanf("%lld", &a[i]);
	vector<ll> l(3 * n), r(3 * n);
	ll now = 0;
	priority_queue<ll, vector<ll>, greater<ll>> que;
	rep(i, n) {
		now += a[i];
		que.push(a[i]);
	}
	l[n - 1] = now;
	repl(i, n, 2 * n) {
		now += a[i];
		que.push(a[i]);
		now -= que.top();
		que.pop();
		l[i] = now;
	}
	priority_queue<ll> q;
	now = 0;
	for (int i = 3 * n - 1; i >= 2 * n; i--) {
		now += a[i];
		q.push(a[i]);
	}
	r[2 * n] = now;
	for (int i = 2 * n - 1; i >= n; i--) {
		now += a[i];
		q.push(a[i]);
		now -= q.top();
		q.pop();
		r[i] = now;
	}
	ll ans = -1e18;
	repl(i, n - 1, 2 * n) ans = max(ans, l[i] - r[i + 1]);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 9588
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int main(){
  int fld[255][255][5];
  int n;
  string in;
  while(cin>>n&&n){
    for(int i=0;i<255;i++)for(int j=0;j<255;j++)for(int k=0;k<5;k++)fld[i][j][k]=0;
    for(int i=0;i<n;i++){
      cin>>in;
      for(int j=0;j<n;j++){
        fld[i][j][0]=in[j]-'0';
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        if(fld[i][j][0]==0){
          for(int k=1;k<5;k++)fld[i][j][k]=0;
          continue;
        }else for(int k=1;k<5;k++)fld[i][j][k]=1;
        if(i!=0){
          fld[i][j][1]=fld[i-1][j][1]+1;
          if(j!=0){
            fld[i][j][2]=fld[i-1][j-1][2]+1;
          }
          if(j!=n-1){
            fld[i][j][3]=fld[i-1][j+1][3]+1;
          }
        }
        if(j!=0){
          fld[i][j][4]=fld[i][j-1][4]+1;
        }
      }
    }
    int ans=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        for(int k=1;k<5;k++){
          ans=max(ans,fld[i][j][k]);
        }
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 2472
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int n,a,b;
    cin >> n;
    if (n == 25){
        cout << "Christmas" << endl;
    } else if (n == 24){
        cout << "Christmas Eve" << endl;
    } else if (n == 23){
        cout << "Christmas Eve Eve" << endl;
    } else if (n == 22){
        cout << "Christmas Eve Eve Eve" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;

const ll INF = 1e18, MOD = 1e9 + 7;

const int MAX = 1e6;

vec<> adj;
int k;
ll res = 1;
void dfs(int u = 0, int p = -1, int del = 0) {
    // const int ans = k - (p != -1 ? adj[p].size() : 0);
    const int ans = k - del;
    if (ans <= 0) {
        res = 0;
        return;
    }
    del = p == -1 ? 1 : 2;
    (res *= ans) %= MOD;
    for (int v : adj[u]) {
        if (v != p) 
            dfs(v, u, del++);
    }
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);

    int n;
    cin >> n >> k;
    adj.resize(n);
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs();
    cout << res << '\n';
}

Measured memory_bytes: 9216
/*
    NO 
        TIME 
            TO 
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define OS //single input use oeis
lli INF=1e17;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m;
const double pi=3.14159265358979323846;
lli add(lli a, lli b) {
 	lli res = a + b;
 
 	while (res >= mod) res -= mod;
 
 	while (res < 0) res += mod;
 
 	return res;
}
 lli me(lli a,lli b)
{
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
// Thi
//matrix exponentiation is associative and distributive
// lli dp[2][2000005][2];
int lis(vector<lli> a)
{
    set < int > s;
set < int > :: iterator it;

n=a.size();

for(int i=0;i<n;i++)
{
    s.insert(a[i]);
    
    it = s.upper_bound(a[i]);

    if(it != s.end())
        s.erase(it);
}

return s.size();
}
int main()
{
 IO;
 OS;
 cin>>n;
 lli a[n+1];
 for(int i=1;i<=n;i++)
 {
     cin>>a[i];
     if(a[i]&1)
     continue;
     if(a[i]%3==0||a[i]%5==0)
     continue;
     return cout<<"DENIED",0;
}
cout<<"APPROVED";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int r; cin >> r;
  int ans = 0;
  if(r>=400&&r<=599) ans+=8;
  else if(r>=600&&r<=799) ans+=7;
  else if(r>=800&&r<=999) ans+=6;
  else if(r>=1000&&r<=1199) ans+=5;
  else if(r>=1200&&r<=1399) ans+=4;
  else if(r>=1400&&r<=1599) ans+=3;
  else if(r>=1600&&r<=1799) ans+=2;
  else if(r>=1800&&r<=1999) ans+=1;

  cout << ans << '\n';


  return 0;
}


Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> V;
typedef pair<ll,ll> P;
typedef map<ll,ll> M;

#define REP(i, n) for(ll (i) = 0; (i) < (n); ++(i))
#define FOR(i, j, n) for(ll (i) = (j); (i) < (n); ++(i))
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; --(i))

const ll MOD = 1e9+7;

signed main(){
    ll m,n;
    cin >> m >> n;
    V w(m);
    V t(m);
    V c(n);
    V b(n);
    REP(i,m)cin >> w[i] >> t[i];
    REP(i,n)cin >> c[i] >> b[i];

    V wrui(m+1, 0);
    V trui(m+1, 0);
    REP(i,m){
        wrui[i+1]=wrui[i] + w[i];
        trui[i+1]=trui[i] + t[i];
    }
    wrui.push_back(1e15);
    trui.push_back(1e15);

    V dp(1<<n, -1);
    priority_queue<ll,V,greater<ll>> que;
    dp[0] = 0;
    que.push(0);
    while(!que.empty()){
        ll num = que.top();
        que.pop();

        REP(j,n){
            if(!(num & (1 << j))){
                ll cou_w = distance(wrui.begin(), upper_bound(wrui.begin(), wrui.end(), wrui[dp[num]] + c[j])) - 1;
                ll cou_t = distance(trui.begin(), upper_bound(trui.begin(), trui.end(), trui[dp[num]] + b[j])) - 1;

                ll next = min(cou_w, cou_t);
                if(next > dp[num | (1<<j)]){
                    dp[num | (1<<j)] = next;
                    que.push(num | (1<<j));
                }
            }
        }
    }
    cout << dp.back() << endl;

    return 0;
}



Measured memory_bytes: 10724
import java.lang.*;
import java.util.*;

public class Main
{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[])
    {
	for(int k=1; ;k++){
	    int W = sc.nextInt();
	    if(W==0) break;
	    
	    int[] dp = new int[W+1];
	    for(int i=0; i<=W; i++){
		dp[i]=0;
	    }
	    
	    int n = sc.nextInt();
	    int dv,dw;
	    for(int i=0; i<n; i++){
		String[] s = sc.next().split(",");
		dv = Integer.parseInt(s[0]); //value
		dw = Integer.parseInt(s[1]); //weight
		for(int j=W; j>=0; j--){
		    if(j+dw <= W) dp[j+dw] = Math.max(dp[j+dw], dv+dp[j]);
		}
	    }
	  
	    
	    int[] max = new int[2];
	    max[0] = -1; //[0]dv [1]i
	    for(int i=W; i>=0; i--){
		if(max[0] <= dp[i]){
		    max[0] = dp[i];
		    max[1] = i;
		}
	    }
	    System.out.println("Case " + k + ":\n" + max[0] +"\n" + max[1]);
	}
    }
}

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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int h, w;
    cin >> h >> w;
    if( h == 1 || w == 1){
        cout << "1\n";
    }else{
        cout << (h*w + 1)/2 << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

vector<ll> p(1'000'100);
vector<ll> cnt(1'000'100);

//エラトステネスの篩,n以下の素数の列挙の時に
//primeはi番目の素数、適当に返却を変えて
template <class T>
void sieve(T n){
	vector<bool> is_prime(n+1,true);
	vector<ll> prime;
	is_prime[0]=false;
	is_prime[1]=false;
	T ret=0;
	FOR(i,2,n+1){
		if(is_prime[i]){
			prime.push_back(i);
			p[i]=i;
			for(T j=2*i;j<=n;j+=i){
				is_prime[j]=false;
				p[j]=i;
			}
		}
	}
}

//素因数分解
template <class T>
void prime_factor(T x){
	while(x!=1){
		ll tmp=p[x];
		cnt[tmp]++;
		while(x%tmp==0){
			x/=tmp;
		}
	}
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	ll g=0;
	sieve(1'000'010);
	rep(i,n){
		ll a;
		cin>>a;
		g=gcd(g,a);
		prime_factor(a);
	}
	if(g!=1){
		cout<<"not coprime"<<endl;
		return 0;
	}
	for(auto x:cnt){
		if(x>=2){
			cout<<"setwise coprime"<<endl;
			return 0;
		}
	}
	cout<<"pairwise coprime"<<endl;
}

Measured memory_bytes: 20020
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		double h = scan.nextLong();
		h = Math.log(h) / Math.log(2);
		long n = (long)h;
		
		double x = Math.pow(2,n+1);
		long ans = (long)x;
		System.out.println(ans-1);
		
	}
}




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

int main (){
  int N;
  cin>>N;
  vector <int> d(N);
  for(int i=0;i<N;i++)
    cin>>d.at(i);
  int M=0;
  for(int k=0;k<N;k++){
    for(int i=0;i<N;i++){
      if(k!=i)
        M+=d.at(k)*d.at(i);
    }
  }
cout<<M/2<<endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

V<V<int>> r(200001);
V<bool> saw(200001, false);

int dfs (int x) {//xのまだ見てない友達
    if (saw[x]) return 0;
    saw[x] = true;
    int res = 0;
    for (int fx : r[x]) {
        if (!saw[fx]) {
            res++;
            res += dfs(fx);
        }
    }
    return res;
}

int main () {
    int n, m; cin >> n >> m;
    rep(i, m) {
        int a, b; cin >> a >> b; a--; b--;
        r[a].emplace_back(b); r[b].emplace_back(a);
    }
    int ans = 0;
    rep(i, n) chmax(ans, dfs(i)+1);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 23404
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  ll n;
  cin >> n;
  vector<string > s(n);
  string tmp;
  REP(i, n){
    cin >> tmp;
    sort(all(tmp));
    s[i] = tmp;
  }
  // REP(i, n){
  //   cout << "s[i] = " << s[i] << endl;
  // }

  sort(all(s));
  // REP(i, n){
  //    cout << "s[i] = " << s[i] << endl;
  // }
  ll ans = 0;
  REP(i, n){
    string tmp = s[i];
    ll seq = 1;
    //cout <<"tmp    "<< i <<", " <<s[i]<<endl;
    ll j = i;
    
    while(i + 1 <n && s[i + 1] == tmp){
      seq ++;
      i++;
      //cout <<"while: "<<  i <<", " <<s[i]<<endl;
    } 
    //cout << j <<"to" << i << ", seq = "<< seq<<endl;
    ans += seq*(seq - 1)/2;
  }
  cout << ans << endl;

}


Measured memory_bytes: 5760
n=int(input())
s=input()
ctb=0;ctw=0;f=0;cte=0;cts=0;ct=0
lb=[];lw=[];l=[];L=[]
for j in range(n-1):
  if s[j]=='#' and s[j+1]=='.':
    f=+1
for k in range(n-1,-1,-1):
  if s[k]=='#':
    cte+=1
  else:
    break
for l in range(n):
  if s[l]=='.':
    cts+=1
  else:
    break

for i in range(cts,n-cte):
  if ctb==0 and s[i]=='.':
    ctw+=1
  if ctw==0 and s[i]=='#':
    ctb+=1
  if ctb!=0 and s[i]=='.':
    ctw+=1
  if ctw!=0 and s[i]=='#':
    lb.append(ctb)
    lw.append(ctw)
    ctb=1
    ctw=0
lb.append(ctb)
lw.append(ctw)
lb.reverse()
lw.reverse()
l=lb+lw
x=sum(l[0:len(lb)])
L.append(x)
for m in range(len(lb),len(l)):
  x+=l[m]
  x-=l[m-len(lb)]
  L.append(x)
if f==0:
  print(0)
else:
  print(min(L))

Measured memory_bytes: 10300
#include<bits/stdc++.h>
int main(){
    int n;double d,x,ans=0;std::cin>>n>>d>>x;
    for(;n;--n){
        ans+=d+(n-0.5)*x;
        d=((2*n+2)*d+5*x)/(2*n);
        x=(2*n+4)*x/(2*n);
    }
    printf("%.9f\n",ans);
}

Measured memory_bytes: 384
s = input() #sys.stdin.readlineは最後が改行
n =len(s)

from collections import defaultdict
amari = defaultdict(lambda:0)
amari[0]=1
num=0
tmp=0

for i in range(n):
    num = tmp + int(s[-1-i])*pow(10,i,2019)
    tmp = num%2019
    amari[tmp]+=1

from math import factorial

ans = 0
for key,val in amari.items():
    if val>1:
        ans +=val*(val-1)//2

print(ans)


Measured memory_bytes: 9548
#include <stdio.h>
#define NIL -1

typedef struct node {
    int parent, left, right;
}Node;

Node T[100];

void printPreorder(int i){
    if (i != NIL){
        printf(" %d", i);
        printPreorder(T[i].left);
        printPreorder(T[i].right);
    }
}

void printInorder(int i){
    if (i != NIL){
        printInorder(T[i].left);
        printf(" %d", i);
        printInorder(T[i].right);
    }
}

void printPostorder(int i){
    if (i != NIL){
        printPostorder(T[i].left);
        printPostorder(T[i].right);
        printf(" %d", i);
    }
}

int main(){
    int n, num, p;
    scanf("%d", &n);
    for (int i = 0 ; i < n; i++){
        T[i].parent = NIL;
        T[i].left = NIL;
        T[i].right = NIL;
    }
    for(int i = 0; i < n; i++){
        scanf("%d", &num);
        scanf("%d %d", &T[num].left, &T[num].right);
        if (T[num].left != NIL)
            T[T[num].left].parent = num;
        if (T[num].right != NIL)
            T[T[num].right].parent = num;
    }

    int root = 0;
    while (T[root].parent != NIL){
        root = T[root].parent;
    }

    printf("Preorder\n");
    printPreorder(root);
    printf("\n");

    printf("Inorder\n");
    printInorder(root);
    printf("\n");

    printf("Postorder\n");
    printPostorder(root);
    printf("\n");

    return 0;
}


Measured memory_bytes: 2684
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, A, B, C, D;
  cin>>N>>A>>B>>C>>D;
  bool can = false;
  for(ll i=0;i<N;++i) {
    if((C+D)*i-(N-1)*D<=B-A && B-A<=(D+C)*i-(N-1)*C) can = true;
  }
  if(can) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}



Measured memory_bytes: 3612
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int h, w;
	cin >> h >> w;
	char c[101][101];
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			cin >> c[i][j];
		}
	}
	for(int i = 1; i <= 2 * h; i++){
		for(int j = 1; j <= w; j++){
			cout << c[(i + 1) / 2][j];
		}
		cout << endl;
	}
}

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

using namespace std;

int main(void) {
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;
    cout << a[k - 1] << endl;


    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v; ll w; };

const int MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

int main() {
	for (;;) {
		int N; cin >> N;
		if (!N) break;
		vector<int> a(N);
		rep(i, N) cin >> a[i];
		reverse(a.begin(), a.end());
		vector<vector<int> > as(501);
		for (int x: a) {
			int y;
			for (y = x; y % 2 == 0; y /= 2);
			as[y].pb(x / y);
		}
		int ans = 0;
		for (vector<int> a: as) {
			int M = 0;
			for (int x: a) M += x;
			vector<int> dp(M + 1, -INF);
			dp[0] = 0;
			for (int x: a) {
				vector<int> _dp = dp;
				for (int S = 0; S + x <= M; S += x)
					_dp[S + x] = max(_dp[S + x], dp[S] + 1);
				dp = _dp;
			}
			for (int S = 1; S <= M; S *= 2)
				ans = max(ans, dp[S]);
		}
		cout << ans << endl;
	}
}

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

int main() {
  int a, b, c, k, cnt = 0;
  scanf("%d %d %d\n%d", &a, &b, &c, &k);
  while(a >= b) {
    b *= 2;
    cnt++;
  }
  while(b >= c) {
    c *= 2;
    cnt++;
  }
  if(cnt <= k) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 3760
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
    REP(i, ty - sy) cout << 'U';
    REP(i, tx - sx) cout << 'R';
    
    REP(i, ty - sy) cout << 'D';
    REP(i, tx - sx) cout << 'L';
    
    cout << 'L';
    REP(i, ty - sy + 1) cout << 'U';
    REP(i, tx - sx + 1) cout << 'R';
    cout << 'D';
    
    cout << 'R';
    REP(i, ty - sy + 1) cout << 'D';
    REP(i, tx - sx + 1) cout << 'L';
    cout << 'U';
    
    return 0;
}


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

int main() {
	int a=0;
	int b=0;
	cin >> a;
	cin >> b;

	if ((a * b) % 2 == 0) {
		cout << "Even";
	}
	else {
		cout << "Odd";
	}
	return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long long ll;

#define MAX_N 1001

int dp[MAX_N][MAX_N];

void init(){
	rep(i,MAX_N){
		rep(j,MAX_N){
			dp[i][j] = 0;
		}
	}
}

int main()
{
	int n;
	cin>>n;
	rep(i,n){
		init();
		string s,t;
		cin>>s;
		cin>>t;
		for(int i = 0; i < s.size(); i++){
			for(int j = 0; j < t.size(); j++){
				if( s[i] == t[j]){
					dp[i+1][j+1] = dp[i][j]+1;
				}else{
					dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
				}
			}
		}
		cout<<dp[s.size()][t.size()]<<endl;
	}
	return 0;
}




Measured memory_bytes: 7100
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
using namespace std;

int n , v[20];

tr1::unordered_map<int,int> memo[20];

int f(int pos , int sum){
	if(abs(sum) >= 1000001) return sum;
	return pos == n ? abs(sum) : memo[pos].count(sum) ? memo[pos][sum] : memo[pos][sum] = min( f(pos+1,sum+v[pos]) , f(pos+1,sum-v[pos]) );
}

int main(){
	while(cin >> n && n){
		for(int i = 0 ; i < n ; i++) cin >> v[i] , memo[i].clear() ;
		cout << f(0,0) << endl;
	}
}

Measured memory_bytes: 3456