akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
 
sys.setrecursionlimit(150000)

def gdp(n, dp, G):
    if dp[n]!=-1:
        return dp[n]
 
    if G[n]==[]:
        dp[n]=0
        return 0
 
    for i in G[n]:
        ll=gdp(i, dp, G)
        if dp[n]<ll+1:
            dp[n]=ll+1
 
    return dp[n]
 
def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
    G=[[] for _ in range(N)]
    for i in range(M):
        G[x[i]-1].append(y[i]-1)
 
    dp=[-1]*N
 
    print(max(gdp(i, dp, G) for i in range(N)))
 
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    x = [int()] * (M)  # type: "List[int]"
    y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, x, y)
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 66992
use std::io::Write;

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

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let p: Vec<usize> = {
        let mut v: Vec<usize> = Vec::new();
        for _ in 0..n {
            let v_i = {
                let mut s = String::new();
                std::io::stdin().read_line(&mut s).unwrap();
                let s = s.trim_right().to_owned();
                s.parse().unwrap()
            };
            v.push(v_i)
        }
        v
    };

    let mut indices = vec![0; n + 1];
    for (i, &x) in p.iter().enumerate() {
        indices[x] = i;
    }

    let mut dp = vec![1];
    for i in 2..(n + 1) {
        if indices[i - 1] < indices[i] {
            let last = dp.last().unwrap() + 1;
            dp.push(last);
        } else {
            dp.push(1);
        }
    }

    println!("{}", n - dp.iter().max().unwrap());
}


Measured memory_bytes: 12540
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
using namespace std;
int main() {
	ll a,ans=0;
	cin >> a;
	vector<ll> s(a);
	rep(i, a) {
		cin >> s[i];
		ans += s[i];
	}
	ll max = ans;
	ll min = 0;
	rep(i, a) {
		max -= s[i];
		min += s[i];
		ll abc = fabs(max - min);
		if (ans > abc)ans = abc;
	}
	cout << ans << endl;
	
		return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int n, q, x, y, a[1 << 18], t;
bool com;

int getSum(int x, int y,int k, int l ,int r) {
	if (r < x || y < l)return 0;
	else if (x <= l&&r <= y)return a[k];
	else return (getSum(x, y, k * 2, l, (l + r) / 2) + getSum(x, y, k * 2 + 1, (l + r) / 2 + 1, r));
}

void add(int x, int y) {
	int z = t + x;
	while (z) {
		a[z] += y;
		z /= 2;
	}
}
int main(){
	cin >> n >> q;
	for (int i = 1; i != 19; ++i) {
		if ((1 << i) / n >= 2) {
			t = (1 << (i - 1));
			break;
		}
	}
	for (int i = 0; i != q; ++i) {
		cin >> com >> x >> y;
		--x;
		if (com)
			cout << getSum(x, y-1, 1, 0, t - 1) << endl;
		else
			add(x, y);
	}
	return 0;
}



Measured memory_bytes: 3888
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;

int main(){
	int N;
	
	while(cin>>N){
		if(N==0)break;
		bool l=false,r=false;
		bool npos=false;
		int cnt=0;
		REP(i,N){
			string str;
			cin>>str;
			if(str=="lu"){
				l=true;
			}else if(str=="ru"){
				r=true;
			}else if(str=="ld"){
				l=false;
			}else{
				r=false;
			}
			if(l==r&&l!=npos){
				cnt++;
				npos=l;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

lr = [[0] * (N + 1) for _ in range(N + 1)]

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)


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

const int INF = 1001001001;

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

    vector<pair<int, int>> key;
    rep (i, M) {
        int a, b;
        cin >> a >> b;

        int s = 0;
        rep (j, b) {
            int c;
            cin >> c;
            --c;
            s |= 1 << c;
        }

        key.emplace_back(s, a);
    }

    vector<int> dp(1 << N, INF); // 2 ^ N
    dp[0] = 0;

    rep (s, 1 << N) {
        rep (i, M) {
            int t = s | key[i].first;
            int cost = dp[s] + key[i].second;
            dp[t] = min(dp[t], cost);
        }
    }

    int ans = dp.back();
    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}


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

int main()
{
	int N, K;
	cin >> N >> K;
	vector<vector<int>> A( K );
	for( int i = 0; i < K; i++ ) {
		int d;
		cin >> d;
		for( int j = 0; j < d; j++ ) {
			int a;
			cin >> a;
			a--;
			A[i].push_back( a );
		}
	}

	vector<int> b( N );
	for( int i = 0; i < K; i++ ) {
		for( int j = 0; j < A[i].size(); j++ ) {
			int k = A[i][j];
			b[k]++;
		}
	}
	int ans = N;
	for( int i = 0; i < N; i++ ) {
		if( b[i] ) ans--;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3656
using namespace std;
#include <iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<cmath>
int main() {
    int X,fiveHC=0,fiveC=0;
    cin >> X;
    
    fiveHC = X/500;
    fiveC= (X%500)/5;
    cout << (fiveHC*1000)+(fiveC*5) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String args[]){
        int n,a,b;
        n=sc.nextInt();
        a=sc.nextInt();
        b=sc.nextInt();
        
        int sum=0,ans=0;
        for(int i=0;i<=n;i++){
            String x=Integer.toString(i);
            //System.out.println(x);
            sum=0;
            for(int j=0;j<x.length();j++){
                sum+=x.charAt(j)-'0';
            }
            //System.out.println(">"+sum);
            if(a<=sum&&sum<=b){
                ans+=i;
            }
            
        }
        System.out.println(ans);
    }
    

}

Measured memory_bytes: 22100
//Code By CXY07
#include<bits/stdc++.h>
using namespace std;

//#define FILE
#define int long long
//#define LL long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fst first
#define scd second
#define inv(x) ksm(x,mod - 2)

const int MAXN = 2e5 + 10;
const int INF = 2e9;
const int G = 3;
const double PI = acos(-1);
//const int mod = 1e9 + 7;
//const int mod = 998244353;

int n,d;
int cnt = 0;
map<pair<int,int>,bool> m;

template<typename T> inline void read(T &a) {
	a = 0; char c = getchar(); int f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') {a = a * 10 + (c ^ 48); c = getchar();}
	a *= f;
}

signed main () {
#ifdef FILE
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	read(n); read(d);
	for(int i = 1,x,y;i <= n; ++i) {
		read(x); read(y);
		if(x * x + y * y <= d * d) cnt++;
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 3560
package main

import (
	"fmt"
)

func main() {
	var a, b, x int
	fmt.Scan(&a, &b, &x)
	fmt.Println(f(x, b) - f(x, a-1))
}

func f(x, n int) int {
	if n < 0 {
		return 0
	}
	return n/x + 1
}


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

// 数字の各桁の和を返す
int sumDigits (int n) {
    int s;
    while (n < 0) {
        s += n % 10;
        n /= 10;
    }
    return s;
}

// 最大公約数を返す
int gcd (int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main () {
  long long int A, B, K; cin >> A >> B >> K;
  
  if (B-A+1 < K*2) {
    for (long long int i = A; i <= B; i++) cout << i << endl;
  } else {
    for (int i = A; i < A+K; i++) cout << i << endl;
    for (int i = B+1-K; i < B+1; i++) cout << i << endl;
  }
}


Measured memory_bytes: 256
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    if(__builtin_popcount(a) % 2 == __builtin_popcount(b) % 2){
        cout << "NO" << '\n';
        return 0;
    }
    vector<int> ans;
    ans.push_back(a);
    int pos = a;
    vector<int> cnts(1 << n);
    unordered_set<int> used;
    used.insert(a);
    for(int j = 0; j < n; j++){
        cnts[a ^ (1 << j)]++;
    }
    for(int i = 0; i < (1 << n) - 1; i++){
        int next, mini = M;
        for(int j = 0; j < n; j++){
            int cand = pos ^ (1 << j);
            if(used.count(cand)){ continue; }
            if(cand == b && i != (1 << n) - 2){ continue; }

            if(-cnts[cand] < mini){
                mini = -cnts[cand];
                next = cand;
            }else if(-cnts[cand] == mini && __builtin_popcount(next ^ b) < __builtin_popcount(cand ^ b)){
                mini = cnts[cand];
                next = cand;
            }

            // int maxi = 0;
            // for(int k = 0; k < n; k++){
            //     int next = cand ^ (1 << k);
            //     if(!used.count(next)){
            //         maxi = max(maxi, cnts[next]);
            //     }
            // }
            // if(maxi < mini){
            //     mini = maxi;
            //     next = cand;
            // }

            // if(cnts[cand] < mini){
            //     mini = cnts[cand];
            //     next = cand;
            // }
        }
        if(mini == M){
            printde(ans);
            printde("error", i, 1 << n, pos);
            for(int j = 0; j < (1 << n); j++){
                if(used.count(j) == 0){
                    printde(j);
                }
            }
            return 1;
        }
        // printde(mini);
        ans.push_back(next);
        used.insert(next);
        cnts[next] = -1;
        for(int j = 0; j < n; j++){
            cnts[next ^ (1 << j)]++;
        }
        pos = next;
        // printde(cnts);
    }
    // printde(ans);
    cout << "YES" << '\n';
    for(auto& a : ans){
        cout << a << ' ';
    }
}


Measured memory_bytes: 7796
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B] = [int(input_raw[0]), int(input_raw[1])]
    if B % A == 0:
        print A+B
    else:
        print B-A

if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#include<stdio.h>
#define N 100005
#define NIL -1

struct node{
  int parent;
  int left;
  int right;
};

struct node Tree[N];
int n,D[N];

void print(int);
int rec(int,int);

int main()
{
  int i,j,n,id,k,c,l,r;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    Tree[i].parent=Tree[i].left=Tree[i].right=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0)Tree[id].left=c;
      else Tree[l].right=c;
      l=c;
      Tree[c].parent=id; }
                    }
  for(i=0;i<n;i++)
    {if(Tree[i].parent==NIL)r=i;  }

  rec(r,0);
  for(i=0;i<n;i++) print(i);
  return 0;
}

void print(int u)
{
  int i,c;
  printf("node %d: parent = %d, ",u,Tree[u].parent);
  printf("depth = %d, ",D[u]);

  if(Tree[u].parent==NIL)printf("root, ");
  else if(Tree[u].left==NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=Tree[u].left; c!= NIL; i++,c=Tree[c].right)
    {if(i)printf(", ");
      printf("%d",c);}
  printf("]\n");
}

int rec(int u,int p)
{
  D[u]=p;
  if(Tree[u].right!= NIL) rec(Tree[u].right,p);
  if(Tree[u].left!= NIL) rec(Tree[u].left,p+1);
}



Measured memory_bytes: 6484
#include <bits/stdc++.h>
using namespace std;
int main(){
	double X[10], Y[10];
	int N; cin >> N; 
	for(int i = 0; i < N; i++) cin >> X[i] >> Y[i]; 
	double ans = 0; 
	for(int i = 0; i < N; i++){
		for(int j = i+1; j < N; j++){
			ans += pow((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]), 0.5); 
		}
	}
	ans *= 2.0 / N; 
	cout.precision(12); 
	cout << ans << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////





int main() {
	
	ll D;
	cin >> D;

	if (D == 25) { cout << "Christmas"; }
	if (D == 24) { cout << "Christmas Eve"; }
	if (D == 23) { cout << "Christmas Eve Eve"; }
	if (D == 22) { cout << "Christmas Eve Eve Eve"; }

	system("PAUSE");
}

Measured memory_bytes: 504
#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
    ll A; string B;
    cin >> A >> B;
    auto d = B.find('.');
    ll b1 = stoll(B.substr(0,d));
    ll b2 = stoll(B.substr(d+1));
    ll b = b1*100 + b2;
    ll ans = A * b / 100;
    cout << ans << '\n';

    return 0;
}

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

using ll=long long;

int main() {
  int A,B,C; cin >>A >>B >>C;
  vector<int> vec;
  vec.push_back(A);
  vec.push_back(B);
  sort(vec.begin(),vec.end());
  cout <<(vec[0]<C and C<vec[1] ? "Yes":"No") <<endl;
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5;
typedef long long ll;
#define mp make_pair
ll x[maxn+5],p[maxn+5];
vector<pair<int,ll> > g[maxn+5];
ll ans[maxn+5];
int n,s;
void addedge(int u,int v,ll w)
{
    g[u].push_back(mp(v,w));
}
void dfs(int k)
{
    for(auto x:g[k])
    {
        ans[x.first]=ans[k]+x.second;
        dfs(x.first);
    }
}
int main()
{

    scanf("%d%d",&n,&s);
    for(int i=1;i<=n;++i) scanf("%lld%lld",&x[i],&p[i]);
    int l=1,r=n;
    while(l<r)
    {
        if(x[l]>=s) addedge(l,l+1,x[l+1]-x[l]),++l;
        else
            if(x[r]<=s) addedge(r,r-1,x[r]-x[r-1]),--r;
        else
        if(p[l]>=p[r]) p[l]+=p[r],addedge(l,r,x[r]-x[l]),--r;
        else p[r]+=p[l],addedge(r,l,x[r]-x[l]),++l;
    }
    ans[l]=abs(x[l]-s);
    dfs(l);
    printf("%lld\n",max(ans[1],ans[n]));
    return 0;
}


Measured memory_bytes: 7296
use proconio::*;

fn main() {
    input!{
        n: usize,
        s: usize,
        a: [usize; n],
    }

    let mo = 998244353;

    let mut dp = vec![0; s+1];
    dp[0] = 1;
    for &aa in a.iter() {
        let mut next = dp.clone();
        for i in 0..s+1 {
            next[i] += dp[i];
            next[i] %= mo;
            if i+aa < s+1 {
                next[i+aa] += dp[i];
                next[i+aa] %= mo;
            }
        }

        dp = next;
    }

    println!("{}", dp[s]);
}


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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [usize; n]
    }
    let mut t = 0;
    let mut ans = 0;
    for &x in &v {
        if x == 0 {
            ans += t / 2;
            t = 0;
        } else {
            t += x;
        }
    }
    ans += t / 2;
    println!("{}", ans);
}


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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> cnt(M);

  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++) {
      int A;
      cin >> A;
      A--;
      cnt[A]++;
    }
  }

  int ans = 0;
  for (int i = 0; i < M; i++) {
    if (cnt[i] == N) {
      ans += 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
f[i][j]用数字1到i放前i位且最后一位是j的合法方案 
n=4,<><
  j=0,1,2,3,4
i=0 0 0 0 0 0
i=1 0 1 0 0 0
i=2 0 0 1 0 0
i=3 0 1 1 0 0
i=4 0 0 1 2 2
3<4>1<2
2<4>1<3
1<4>2<3
2<3>1<4
1<3>2<4
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=3009;
const ll MOD=1e9+7;
char s[N];
ll n,f[N][N];
int main(){
	cin>>n;
	for(ll i=1;i<=n;++i)cin>>s[i];
	f[1][1]=1;
	for(ll i=2;i<=n;++i){
		if(s[i-1]=='<'){
			for(ll j=2;j<=i;++j)
				f[i][j]=(f[i][j-1]+f[i-1][j-1])%MOD;		
		}
		else{
			for(ll j=i-1;j>=1;--j)
				f[i][j]=(f[i][j+1]+f[i-1][j])%MOD;
		}
	}	
	ll ans=0;
	for(ll j=1;j<=n;++j)ans=(ans+f[n][j])%MOD;
	cout<<ans<<endl;	
    return 0;
}

Measured memory_bytes: 49668
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){ cin>>v[i];}
    cin>>n;
    vector<int> v2(n);
    for(int i=0;i<n;i++){ cin>>v2[i];}
    int q;
    if(includes(v.begin(),v.end(),v2.begin(),v2.end())){
        cout<<"1\n";
    }
    else cout<<"0\n";

}


Measured memory_bytes: 4336
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
int dp[100009];

int main(){
  int n,k;
  int h[100009];
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>h[i];
    dp[i]=INF;
  }
  dp[0]=0;
  for(int i=1;i<n;i++){
    for(int j=1;j<=k;j++){
      if(i-j>=0){
	dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
      }
    }
  }
  cout<<dp[n-1]<<endl;
  return(0);
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

double N, M, ans2 = 0, fail = 1;
long long int ans, mthPower = 1;

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++)mthPower *= 2;
	for (long long int i = 1; i <= 100000; i++) {
		if (i > 1)fail *= 1 - (double)1 / mthPower;
		ans2 += (double)i*(1900 * M + 100 * (N - M))*fail * 1 / mthPower;
	}
	ans = ans2;
	if (ans2 - ans > (double)ans + 1 - ans2)ans++;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

using ll = long long;

int num(int x, int K) {
    int res = 0;
    while (x < K) {
        res++;
        x <<= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    long double ans = 0;
    for (int i = 1; i <= n; i++) {
        long double hoge = 0.5;
        hoge = pow(hoge, num(i, K));
        ans += hoge;
    }
    ans /= n;
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 640
package main

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

var seen = [9]bool{}
var n = 0
var vertices = [9][]int{}
var completeCnt = 0

func main() {
	handleInput()
	perm(1, 0)
	fmt.Println(completeCnt)
}

func perm(id, cnt int) {
	if seen[id] {
		//already seen
		return
	}
	//first visit
	seen[id] = true
	cnt++

	//check cnt
	if n <= cnt {
		//perm complete
		completeCnt++
		seen[id] = false
		return
	}

	//next
	for _, adj := range vertices[id] {
		perm(adj, cnt)
	}

	seen[id] = false
}

func handleInput() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	h := strings.Split(scanner.Text(), " ")
	n, _ = strconv.Atoi(h[0])
	for scanner.Scan() {
		edge := strings.Split(scanner.Text(), " ")
		l, _ := strconv.Atoi(edge[0])
		r, _ := strconv.Atoi(edge[1])
		vertices[l] = append(vertices[l], r)
		vertices[r] = append(vertices[r], l)
	}
}


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

int main(){
  int n,sum,a,b;
  string s;
  while(cin>>s){
    a=s.size();
    sum=0;
    b=0;
    for(int i=a-1;i>=0;i--){
      if(s[i]=='I')n=1;
      else if(s[i]=='V')n=5;
      else if(s[i]=='X')n=10;
      else if(s[i]=='L')n=50;
      else if(s[i]=='C')n=100;
      else if(s[i]=='D')n=500;
      else if(s[i]=='M')n=1000;

      if(n<b)n*=-1;

      sum+=n;

      b=n;

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

Measured memory_bytes: 3204
# 0016
import math as m
x,y,d=0,0,90
while True:
    r,t=map(int,input().split(","))
    if (r,t)==(0,0):
        break
    x+=r*m.cos(m.radians(d))
    y+=r*m.sin(m.radians(d))
    d-=t
print(int(x))
print(int(y))

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

typedef pair<int, int> P;
ll modnum = 1e9+7;


int main() {
    int n,k,c; cin >> n >> k >> c;
    string s; cin >> s;
    vector<int> adv(n, 0);
    vector<int> back(n, 0);
    int rem = -1;
    int now = 1;
    rep(i, n) {
        if(s[i] == 'o' && rem < 0) {
            adv[i] = now;
            rem = c;
            now++;
        }
        rem--;
    }

    rem = -1;
    now -= 1;

    if(now > k) return 0;

    for(int i=n-1; i >= 0; i--) {
        if(s[i] == 'o' && rem < 0) {
            back[i] = now;
            rem = c;
            now--;
        }
        rem--;
    }

    rep(i, n) {
        if(adv[i] > 0 && adv[i] == back[i]) cout << i + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3332
#include <stdio.h>
int a[5005],b[5005],ret=0;
main()
{
	int n,m; scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=0;i<m;i++) scanf("%d",&b[i]);
	for(int i=0;i<m;i++)
	{
		int nxt=i;
		for(int j=0;j<n && nxt<=m;j++)
		{
			if(a[j]==b[nxt]) nxt++;
		}
		if(ret<nxt-i) ret=nxt-i;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1060
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import heapq
import bisect
import copy
# import math
def warshall_floyd(d, N):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i * N +j] = min(d[i * N +j], d[i * N + k] + d[k * N + j])
    return d

MOD = 10**9 + 7

def main():
    aa, ab = getlist()
    bb, bc = getlist()
    if aa == bb:
        print(0)
    else:
        print(1)

if __name__ == '__main__':
    main()



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

int main() 
{
  int n, a, ans;
  cin >> n >> a;
  ans = n % 500;

  if (ans == 0 || n <= a){
    cout << "Yes" << endl;
  }
  else if (ans <= a) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
	int k, c1=0, c2, p1=2, p2=1, q[20], q1, q2=0, d1=0;
	long n, m, *a, *a1, *b, *c, *d, *dd, mod=1000000007;
	scanf("%ld%ld", &n, &m);
	if (n==1 || m==1)
	{
		printf("%d\n", 1);
		return 0;
	}
	c=(long *)malloc(sizeof(long)*(int)(2*(int)sqrt(m)));
	for (long i = 1; i <= (int)sqrt(m); ++i)
	{
		if (m%i == 0)
		{
			c[c1]=i;
			c1++;
		}
	}
	for (long i = (int)sqrt(m); i >= 1; i--)
	{
		if ((int)pow(i, 2) == m) i--;
		if (m%i == 0)
		{
			c[c1]=m/i;
			c1++;
		}
	}
	while (p1 <= n) 
	{
		p1*=2;
		p2++;
	}
	p1/=2;
	b=(long *)malloc(sizeof(long)*c1*p2);
	p2--;
	for (int i = 0; i < c1*(p2+1); ++i)
	{
		b[i]=0;
	}
	for (int i = 0; i < c1; ++i)
	{
		b[i]=1;
	}
	c2=(int)pow(c1,2);
	d=(long *)malloc(sizeof(long)*c2);
	for (int i1 = 0; i1 < c1; i1++)
	{
		for (int i2 = 0; i2 < c1; i2++)
		{
			if (((m+c[i1]*c[i2])%(c[i1]*c[i2]) == 0) && (c[i1]*c[i2] <= m))
			{
				d[d1]=c1*i1+i2;
				d1++;
			}
		}
	}
	dd=(long *)malloc(sizeof(long)*d1);
	for (int i = 0; i < d1; ++i)
	{
		k=0;
		while (c[k] != c[d[i]/c1]*c[(d[i]+c1)%c1]) k++;
		dd[i] = k;
	}
	for (int i = 1; i <= p2; ++i)
	{
		for (int j = 0; j < d1; ++j)
		{
			b[c1*i+dd[j]] += b[c1*(i-1)+d[j]/c1]*b[c1*(i-1)+(d[j]+c1)%c1];
			b[c1*i+dd[j]] = (b[c1*i+dd[j]]+mod)%mod;
		}
	}
	q1=n;
	for (int i = p2; i >= 0; i--)
	{
		if (q1>=p1)
		{
			q1-=p1;
			q[q2]=i;
			q2++;
		}
		p1/=2;
	}
	a=(long *)malloc(sizeof(long)*c1);
	a1=(long *)malloc(sizeof(long)*c1);
	for (int i = 0; i < c1; ++i)
	{
		a[i]=b[c1*q[0]+i];
	}
	for (int i = 1; i <= q2-1; ++i)
	{
		for (int j = 0; j < c1; ++j)
		{
			a1[j]=0;
		}
		for (int j = 0; j < d1; ++j)
		{
			a1[dd[j]] += a[d[j]/c1]*b[c1*q[i]+(d[j]+c1)%c1];
			a1[dd[j]] = (a1[dd[j]]+mod)%mod;
		}
		for (int j = 0; j < c1; ++j)
		{
			a[j]=a1[j];
		}
	}
	printf("%ld\n", a[c1-1]);
	free(b);
	free(c);
	free(d);
	free(dd);
	return 0;
}

Measured memory_bytes: 3200
s = input()
ans = 0
n = len(s) - 1
m = 2 ** n
for i in range(m):
    bit = bin(i)[2:len(bin(i))]
    a = n - len(bit)
    if a != 0:
        bit = '0'*a + bit
    tmp = int(s[0])
    for j in range(n):
        if bit[j] == '0':
            tmp = 10*tmp + int(s[j+1])
        elif bit[j] == '1':
            ans += tmp
            tmp = int(s[j+1])
    ans += tmp
print(ans)


Measured memory_bytes: 3064
#include <iostream>

using namespace std;
const int LEN = 2e5 + 10;
int arr[LEN];

int main() {
    int K, N;
    cin >> K >> N;
    for (int i = 0; i < N; i++) {
        cin >> arr[i];
    }
    int L = K - arr[N - 1] + arr[0];
    for (int i = 1; i < N; i++) {
        L = max(L, arr[i] - arr[i - 1]);
    }
    cout << K - L << endl;
    return 0;
}

Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        n: usize,
        a: [i64; n],
        b: [i64; n],
        c: [i64; n],
    }
    let mut a = a;
    let mut b = b;
    let mut c = c;
    a.sort();
    b.sort();
    c.sort();

    let mut a_position = match a.iter().position(|num| b[0] <= *num) {
        Some(idx) => idx,
        None => n - 1,
    };
    let mut c_position = match c.iter().position(|num| b[0] < *num) {
        Some(idx) => idx,
        None => n - 1,
    };
    let mut ans = 0;

    for m in b.iter() {
        while a_position <= n - 1 && *m > a[a_position] {
            a_position += 1;
        }
        while c_position <= n - 1 && *m >= c[c_position] {
            c_position += 1;
        }
        ans += a_position * (n - c_position);
    }
    println!("{}", ans);
}


Measured memory_bytes: 12408
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()

int main() {
	set<int> S;
	int q;
	cin >> q;
	Rep(i, q) {
		int n;
		cin >> n;
		if (n == 0) {
			int x;
			cin >> x;
			S.insert(x);
			cout << S.size() << endl;
		}
		else if (n == 1) {
			int x;
			cin >> x;
			if (S.find(x) != S.end()) cout << 1 << endl;
			else cout << 0 << endl;
		}
		else if (n == 2) {
			int x;
			cin >> x;
			S.erase(x);
		}
		else if (n == 3) {
			int L, R;
			cin >> L >> R;
			for (auto itr = S.lower_bound(L); itr != S.end() && *itr <= R; itr++) {
				cout << *itr << endl;
			}
		}
	}
	return 0;
}


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

using namespace std;
typedef long long int ll;

int main()
{
  vector<ll> a(3); cin >> a[0] >> a[1] >> a[2];
  for (int i = 0; i < 3; ++i) {
    if (a[i]%2==0) {
      cout << 0 << endl;
      return 0;
    }
  }
 
  cout << min({a[0]*a[1], a[1]*a[2], a[2]*a[0]}) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;


int main() {
  int n; cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  sort(d.begin(),d.end());
  print(d[n / 2] - d[(n - 2) / 2]);
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
using ll=long long;

const ll INF = pow(10,18)+1;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}
template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}
 
int main(){
    int X, A;
    cin >> X >> A;
    if (X < A) cout << "0" << endl;
    else cout << "10" << endl;
    return 0;
}

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

int main()
{
    long long int n,a,b;
    cin >> n >> a >> b;
    /*
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    */
    long long int tmp1 = n / (a+b);
    long long int tmp2 = n - (tmp1*(a+b));
    long long int ans = 0;
    if(a == 0){
        ans = 0;
    }else if(b == 0){
        ans = n;
    }else if(tmp2 >= a){
        ans = a*tmp1 + a;
    }else{
        ans = a*tmp1 + tmp2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
	string k[100];
	int kk[100][2];
	string a;
	int n = 0;
	int judge;
	int maxa = 0;
	int maxb = 0;
	string aa,bb;

	while(cin >> a) {
		if (n == 0) {
			k[0] = a;
			kk[0][0] = 1;
			kk[0][1] = a.size();
		} else {
			judge = 0;
			for (int i = 0; i < n; i++) {
				if (k[i] == a) {
					kk[i][0]++;
					judge = 1;
					break;
				}
			}
			if (judge == 0) {
				k[n] = a;
				kk[n][0] = 1;
				kk[n][1] = a.size();
			} else {
				continue;
			}
		}
		n++;
		
	}

	for (int i = 0; i < n; i++) {
		if (kk[i][0] > maxa) {
			aa = k[i];
			maxa = kk[i][0];
		}
		if (kk[i][1] > maxb) {
			bb = k[i];
			maxb = kk[i][1];
		}
	}
	
	cout << aa <<  " " << bb << endl;

	return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
typedef pair <int, int> P;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;

using namespace std;



int main() {
	int h, w;
	cin >> h >> w;
	VI v(26, 0);
	REP(i, h*w) {
		char c;
		cin >> c;
		v[c - 'a']++;
	}
	bool b = true;
	if (h == 1 || w == 1) {
		if ((h + w) % 2) {
			REP(i, 26) {
				if (v[i] % 2)b = false;
			}
		}
		else {
			bool c = true;
			REP(i, 26) {
				if (v[i] % 2) {
					if (c)c = false;
					else b = false;
				}
			}
		}
	}
	else if (h % 2 == 0 && w % 2 == 0) {
		REP(i, 26) {
			if (v[i] % 4)b = false;
		}
	}
	else if (h % 2 == 1 && w % 2 == 0) {
		int d = 0, e = 0;
		REP(i, 26) {
			if (v[i] % 2 == 0) {
				d += v[i] / 4;
				e += v[i] % 4 / 2;
			}
			else b = false;
		}
		if (d - w * (h - 1) / 4 < 0) b = false;
	}
	else if(h % 2 == 0 && w % 2 == 1) {
		int d = 0, e = 0;
		REP(i, 26) {
			if (v[i] % 2 == 0) {
				d += v[i] / 4;
				e += v[i] % 4 / 2;
			}
			else b = false;
		}
		if (d - h * (w - 1) / 4 < 0) b = false;
	}
	else {
		int d, e, f;
		d = e = f = 0;
		REP(i, 26) {
			if (v[i] % 2 == 0) {
				d += v[i] / 4;
				e += v[i] % 4 / 2;
			}
			else if (f == 0) {
				f = 1;
				v[i]--;
				d += v[i] / 4;
				e += v[i] % 4 / 2;
			}
			else b = false;
			
		}
		if ((w - 1)*(h - 1) / 4 > d) {
			b = false;
		}
		if (f == 0)b = false;
	}
	if (b)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import math

def show_vertex(x, y):
  print("%.8f %.8f" % (x, y))

def koch(x0, y0, x1, y1, n):
  if n ==0:
    show_vertex(x0, y0)
  else:
    c1 = [x0 + (x1-x0)/3, y0 + (y1-y0)/3]
    c3 = [x0 + 2*(x1-x0)/3, y0 + 2*(y1-y0)/3]
    c2 = [(x0 + x1)/2 + ((y0-y1)*math.sin(math.pi/3))/3, (y0 + y1)/2 + ((x1-x0)*math.sin(math.pi/3))/3]
    koch(x0,y0, c1[0],c1[1], n-1)
    koch(c1[0],c1[1], c2[0],c2[1], n-1)
    koch(c2[0],c2[1], c3[0],c3[1], n-1)
    koch(c3[0],c3[1], x1,y1, n-1)

N = int(input())
koch(0, 0, 100, 0, N)
show_vertex(100, 0)


Measured memory_bytes: 5760
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.stream.Stream;
import java.util.stream.LongStream;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDecreaseContestantVer solver = new DDecreaseContestantVer();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDecreaseContestantVer {
        private static final int MAX_PILES = 50;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            out.println(MAX_PILES);
            long k = in.nextLong();
            long m = k % MAX_PILES;
            k /= MAX_PILES;

            long[] a = new long[MAX_PILES];
            Arrays.fill(a, MAX_PILES + k - m - 1);
            for (int i = 0; i < m; i++) {
                a[i] += MAX_PILES + 1;
            }
            out.println(Arrays.stream(a).mapToObj(Long::toString).collect(Collectors.joining(" ")));
        }

    }
}



Measured memory_bytes: 29012
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            double a = double.Parse(Console.ReadLine());
            double b = double.Parse(Console.ReadLine());

            Console.WriteLine(a + (b - a) * 2);
        }

    }
}


Measured memory_bytes: 27464
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9
#define mod (lo)1e9+7
lo k, a , b, c ,n;
string s1,s2,s3;
queue <pair<lo,lo> > q;
priority_queue <lo> pq;
map <lo,lo> mp1;
vector <double> v;
lo oyuncu;
set <lo> stt;
lo a1[500005];
double pre[500005];
lo f(lo nn){
	return ((nn) * (nn + 1)) / 2;
}
int main(){
	// freopen("gir.gir","r",stdin);
	// freopen("cik.cik","w",stdout);
	double db = 0;
	cin >> n >> k;
	pre[0] = 0;
	for(lo i = 1 ; i <= n ; i++){
		cin >> a1[i];
		pre[i] = (double)pre[i - 1] + (double)(f(a1[i]) / (double)a1[i]);
		// cout << pre[i] << endl;
	}
	for(lo i = 1 ; i <= n ; i++){
		db = max(db, (double)pre[i + k - 1] - pre[i - 1]);
	}
	// db++;
	printf("%.10lf\n", db);
    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib> 
#include <algorithm>
#include <cmath>

#define Max(a,b) (a <= b)?b:a                   //大きい方を返す
#define Rep(i, n) for(int i = 0; i < n; i++)    //i=0 → i=nまでループ
#define Repr(i,n) for(int i = n; i <=0; i--)    //i=n → i=0までループ　
#define For(i, m, n) for(int i = m;i < n;i++)   //i=m → i=nまでループ
#define All(x) (x).begin(),().end()             //xの最初と最後のイテレータを返す 
#define Out(n) cout << n << endl


using namespace std;



int main(){
    vector<int> data;
    int n; cin >> n;

    int inp;
    Rep(i,n){
        cin >> inp;
        data.push_back(inp);
    }

    int v,j;
    Rep(i,data.size()){
        v = data[i];
        j = i - 1;
        while((j >= 0) && data[j] > v){
            data[j+1] = data[j];
            j--;
        }
        data[j+1] = v;

        Rep(i,data.size()){
            if(i == data.size() - 1){
                Out(data[i]);
            } else {
            cout << data[i] << ' ';
            }
            
        }

    }
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define eps 0.000000001
using namespace std;
typedef long double ld;
typedef pair<int,int> p;
typedef pair<ld,p> P;

int n;
ld px[200],py[200],pz[200],vx[200],vy[200],vz[200],r[200],vr[200];

ld getlen(int a,int b,ld M){
  ld ax=px[a]+vx[a]*M,ay=py[a]+vy[a]*M,az=pz[a]+vz[a]*M,ar=r[a]-vr[a]*M;
  ld bx=px[b]+vx[b]*M,by=py[b]+vy[b]*M,bz=pz[b]+vz[b]*M,br=r[b]-vr[b]*M;
  ld dx=ax-bx,dy=ay-by,dz=az-bz;
  return sqrt(dx*dx+dy*dy+dz*dz)-(ar+br);
}

ld check(int a,int b){
  ld L=0,R=100,M;
  int s=0;
  while(s++<50){
    M=(L+R)/2;
    ld len=getlen(a,b,M),len1=getlen(a,b,M+eps);
    if(len<len1||len<0)R=M;
    else L=M;
  }
  if(getlen(a,b,R)>0)return 100;
  return R;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)
      cin>>px[i]>>py[i]>>pz[i]>>vx[i]>>vy[i]>>vz[i]>>r[i]>>vr[i];
    priority_queue<P,vector<P>,greater<P> > q;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++)
	q.push(P(check(i,j),p(i,j)));
      q.push(P(r[i]/vr[i],p(i,i)));
    }
    ld used[200]={};
    while(!q.empty()){
      ld t=q.top().first;
      int a=q.top().second.first,b=q.top().second.second;
      q.pop();
      if(used[a]||used[b])continue;
      used[a]=used[b]=t;
    }
    for(int i=0;i<n;i++)printf("%.10Lf\n",used[i]);
  }
  return 0;
}

Measured memory_bytes: 4492
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
  int n;
  double m=0, u=0, t=0, c=0;
  cin >> n;

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

  for(int i=0; i<n; i++){
    m+=abs(a[i]-b[i]);
    u+=pow(a[i]-b[i], 2);
    t+=pow(abs(a[i]-b[i]),3);
    c=max(c, (double)abs(a[i]-b[i]));
  }

  printf("%lf\n%lf\n%lf\n%lf\n", m, sqrt(u), cbrt(t), c);

  return 0;
}



Measured memory_bytes: 3420
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <limits>

using namespace std;


int main(int argc, char** argv){
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> zero;
    int z = -1;
    vector<int> one;
    int o = -1;
    char state = '2';
    for (int i=0; i<N; i++){
        if (state != S[i]){
            state = S[i];
            if (state == '0'){
                zero.push_back(1);
                z++;
            } else {
                one.push_back(1);
                o++;
            }
        } else {
            if (state == '0') zero[z]++;
            else one[o]++;
        }
    }

    int Z = zero.size();
    int O = one.size();
    int ans;
    if (Z < O){
        if ((Z + O) < 2*K + 1) ans = N;
        else {
            int sum = 0;
            for (int i=0; i<K; i++) sum += (one[i] + zero[i]);
            sum += one[K];
            ans = sum;
            for (int i=K+1; i<O; i++){
                sum -= (one[i-K-1] + zero[i-K-1]);
                sum += (one[i] + zero[i-1]);
                ans = max(ans, sum);
            }
        }
    } else if (Z > O){
        if (Z <= K) ans = N;
        else if (Z == K+1) ans = max(N-zero[0], N-zero[Z-1]);
        else {
            int sum = 0;
            for (int i=0; i<K; i++) sum += (one[i] + zero[i+1]);
            sum += one[K];
            ans = max(sum, sum-one[K]-zero[K]+zero[0]);
            for (int i=K+1; i<O; i++){
                sum -= (one[i-K-1] + zero[i-K]);
                sum += (one[i] + zero[i]);
                ans = max(ans, sum);
            }
            ans = max(ans, sum-one[O-K-1]-zero[Z-K]+zero[Z-1]);
        }
    } else {
        if (Z <= K) ans = N;
        else if (S[0] == '0'){
            int sum = 0;
            for (int i=0; i<K; i++) sum += (one[i] + zero[i+1]);
            sum += one[K];
            ans = max(sum, sum-one[K]-zero[K]+zero[0]);
            for (int i=K+1; i<O; i++){
                sum -= (one[i-K-1] + zero[i-K]);
                sum += (one[i] + zero[i]);
                ans = max(ans, sum);
            }
        } else {
            int sum = 0;
            for (int i=0; i<K; i++) sum += (one[i] + zero[i]);
            sum += one[K];
            ans = sum;
            for (int i=K+1; i<O; i++){
                sum -= (one[i-K-1] + zero[i-K-1]);
                sum += (one[i] + zero[i-1]);
                ans = max(ans, sum);
            }
            ans = max(ans, sum-one[O-K-1]-zero[Z-K-1]+zero[Z-1]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1020