akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

func nextInt64() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

type IntHeap []int

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

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

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

func main() {
	n, m := nextInt(), nextInt()
	nn := &IntHeap{}

	for index := 0; index < n; index++ {
		a := nextInt()
		nn.Push(a)
	}

	heap.Init(nn)

	for {
		if m == 0 {
			break
		}
		now := heap.Pop(nn).(int)
		m--
		now = now / 2
		nn.Push(now)
	}

	var re int64
	for _, item := range *nn {
		re += int64(item)
	}
	fmt.Println(re)
}


Measured memory_bytes: 7424
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
struct P{
	double x,y;
	double abs()
	{
		return hypot(x,y);
	}
	P operator+(P b)
	{
		return{x+b.x,y+b.y};
	}
	P operator-(P b)
	{
		return{x-b.x,y-b.y};
	}
};
P div(P a,P b)
{
	return{a.x/a.abs()+b.x/b.abs(),a.y/a.abs()+b.y/b.abs()};
}
double theta(P a,P b)
{
	double ret=atan2(b.y,b.x)-atan2(a.y,a.x);
	ret=abs(ret);
	if(ret>M_PI)ret=2*M_PI-ret;
	return ret;
}
P take(P a,P b,double x)
{
	P q=div(a,b);
	double t=theta(a,b);
	double k=x/q.abs()/sin(t/2);
	return{q.x*k,q.y*k};
}
double cross(P a,P b){return a.x*b.y-a.y*b.x;}
bool in(P a,P b,P c,P p)
{
	return cross(p-a,b-a)*cross(p-a,c-a)<=0
		&&cross(p-b,c-b)*cross(p-b,a-b)<=0
		&&cross(p-c,a-c)*cross(p-c,b-c)<=0;
}
double dis(P p,P a,P b)
{
	double t=theta(b-a,p-a);
	return sin(t)*(p-a).abs();
}
bool check(P a,P b,P c,double x)
{
	P ab=take(a-c,b-c,x)+c,bc=take(b-a,c-a,x)+a,ca=take(c-b,a-b,x)+b;
	if(!in(a,b,c,ab)||!in(a,b,c,bc)||!in(a,b,c,ca))return false;
	if(dis(ab,a,b)<x||dis(bc,b,c)<x||dis(ca,c,a)<x)return false;
	return (ab-bc).abs()>=2*x||(bc-ca).abs()>=2*x||(ca-ab).abs()>=2*x;
}
main()
{
	P a,b,c;
	cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y;
	double L=0,R=1e3;
	for(int i=0;i<100;i++)
	{
		double M=(L+R)/2;
		if(check(a,b,c,M))L=M;
		else R=M;
	}
	cout<<fixed<<setprecision(15)<<L<<endl;
}

Measured memory_bytes: 384
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextIntArray();
      int a = one.get(0);
      int b = one.get(1);
      myout(((a * b) % 2 == 0) ? "Even" : "Odd");
	}
	//Method addition frame start



	//Method addition frame end
}


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

int main(void) {
    int N;cin>>N;
    int t[N+1],x[N+1],y[N+1];
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for (int i = 1; i <= N; i++) {
        int T,X,Y;cin>>T>>X>>Y;
        t[i] = T;
        x[i] = X;
        y[i] = Y;
    }
    for (int i = 1; i <= N; i++) {
        int time = t[i] - t[i - 1];
        int x_diff = abs(x[i] - x[i - 1]);
        int y_diff = abs(y[i] - y[i - 1]);
        if (time < x_diff + y_diff || time % 2 != (x_diff + y_diff) % 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

int main(void)
{
    long long int sum=0,range=0;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,money;
    long long int a1,a2,a3,ar,as,at1;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    string s,s1;
    cin>>n>>k;
    vector<int> vr,vs,vt;
    cin>>ar>>as>>at1;
    cin>>s;
    a1=a2=a3=0;
    for(i=0;i<n;i++)
    {
        if(i<k)
        {
            if(s[i]=='r') a1++;
            else if(s[i]=='s') a2++;
            else a3++;
        }
        else
        {
            if(s[i]==s[i-k]) s[i]='0';
            else
            {
                if(s[i]=='r') a1++;
                else if(s[i]=='s') a2++;
                else a3++;
            }
        }
    }
    cout<<a1*at1+a2*ar+a3*as;
    return 0;
}





Measured memory_bytes: 512
#include <iostream>
#include <utility>
#include <string>
#include <queue>
#include <set>
using namespace std;
#define P pair<string,int>
#define C(X)((X)=='r'?0:(X)=='b'?1:2)
int main() {
	string w;
	while(cin>>w,w!="0") {
		queue<P> q;
		set<string> s;
		q.push(P(w,0));
		s.insert(w);
		bool OK=false;
		while(!q.empty()) {
			P p=q.front();q.pop();
			bool ok=true;
			for(int i=1;i<p.first.size();i++) {
				if(p.first[i-1]!=p.first[i]) {
					ok=false;break;
				}
			}
			if(ok) {
				cout<<p.second<<endl;
				OK=true;break;
			}
			for(int i=1;i<p.first.size();i++) {
				if(p.first[i-1]!=p.first[i]) {
					string ns=p.first;
					bool chr[3]={0};
					chr[C(ns[i-1])]=true;
					chr[C(ns[i])]=true;
					for(int j=0;j<3;j++) {
						if(chr[j]==false) {
							ns[i-1]=ns[i]=(j==0?'r':j==1?'b':'g');
						}
					}
					if(s.find(ns)==s.end()) {
						q.push(P(ns,p.second+1));
						s.insert(ns);
					}
				}
			}
		}
		if(OK==false)cout<<"NA"<<endl;
	}
}

Measured memory_bytes: 2668
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define ulli unsigned lli
#define ld long double
#define pb push_back
#define mp make_pair
#define bp pop_back
#define vi vector<int>
#define vvi vector< vector<int> >
#define vli vector<lli>
#define vvli vector< vector<lli> >
#define pii pair <int, int>
#define pli pair <lli, lli>
#define forn(i,n) for(i=0;i<n;i++)
#define FORN(i,k,n) for(i=k;i<n;i++)
#define rof(i,k,n) for(i=k;i>=n;i--)
#define wh(k) while(k--)
#define mod 1000000007
#define set(a,s) memset(a,s,sizeof(a))

int main()
{
	fast;
	int n;
	cin>>n;
	cout<<(n)*n*n<<'\n';
	return 0;
}


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

# define F first
# define S second
# define mp make_pair
# define pii pair<int,int>

# define long long long
# define pb push_back
# define sz(a) (int)(a.size())

# define y1     tipa_y1
# define left   tipa_left
# define right  tipa_right

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 4611686018427387903;
const int Sz = 1110111;

using namespace std;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
}


int main()
{
  Read_rap ();
  int a, b; cin >> a >> b;

  cout << (a + b) % 24;

  return 0;
}









// Coded by Z...


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line: Vec<i32> = read_as_vec();

    let (n, d) = (line[0], line[1]);

    if n %(2*d+1) == 0{
        println!("{}", n/(2*d+1));
    }else{
        println!("{}", n/(2*d+1)+1);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600
#define long long long // for codeforces

vector<int> vec[10];
vector<bool> visited;

int dfs(int d, int n){
  if(n==1) return 1;
  visited[d]=true;
  int cnt=0;
  for(auto to : vec[d]) if(visited[to]==false){
    cnt += dfs(to, n-1);
  }
  visited[d]=false;
  return cnt;
}

int main(){
  int n,m;
  cin>>n>>m;
  visited.resize(n);
  fill(all(visited), false);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    vec[a].pb(b);
    vec[b].pb(a);
  }

  cout<<dfs(0,n)<<endl;

  return 0;
}


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

int main(){
  int n;
  cin >> n;
  float a=0;
  for (int i;i<n;i++){
    float k;
    cin >> k;
    a=a+1/k;
  }
  cout << 1/a;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<stdlib.h>
#include<math.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1ll << 30ll)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N, T;
int imos[100100];

signed main(){
    cin >> N >> T;
    for(int i = 0; i < N; i++){
        int l, r;
        cin >> l >> r;
        imos[l]++;
        imos[r]--;
    }
    int ans = 0;
    for(int i = 0; i < T; i++){
        imos[i + 1] += imos[i];
        ans = max(ans, imos[i]);
    }
    cout << ans << endl;

    

    return 0;
}

/*


*/


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

int cmpf1(const void * v1, const void * v2)
{
  return (int)(*((unsigned char *)v1)) - (int)(*((unsigned char *)v2));
}
int cmpf2(const void * v1, const void * v2)
{
  return (int)(*((unsigned char *)v2)) - (int)(*((unsigned char *)v1));
}



int main()
{
  char s1[1024];
  char s2[1024];
  scanf("%s",s1);
  scanf("%s",s2);
  int l1,l2;
  l1 = strlen(s1);
  l2 = strlen(s2);
  (void)qsort((void*)s1,l1,1,cmpf1);
  (void)qsort((void*)s2,l2,1,cmpf2);
  if(!strcmp(s1,s2)){
    printf("No\n");
    return EXIT_SUCCESS;
  }
  if(strcmp(s1,s2)<0){
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return EXIT_SUCCESS;
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INF 987654321
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;

#define MAX_N 220010
int in[MAX_N];
int out[MAX_N];
int trace_num = 0;
vector<int> edge[MAX_N];


int N, Q;

void dfs(int start){
    in[start] = ++trace_num;
    for(auto next : edge[start]){
        if(in[next]) continue; // 이미 방문한 노드
        dfs(next);
    }
    out[start] = trace_num;
}

long long init(vector<long long> &a, vector<long long> &tree, int node, int start, int end) {
    if (start == end) {
        return tree[node] = a[start];
    } else {
        return tree[node] = init(a, tree, node*2, start, (start+end)/2) + init(a, tree, node*2+1, (start+end)/2+1, end);
    }
}
void update_lazy(vector<long long> &tree, vector<long long> &lazy, int node, int start, int end) {
    if (lazy[node] != 0) {
        tree[node] += (end-start+1)*lazy[node];
        // leaf가 아니면 아래로 내려버린다.
        if (start != end) {
            lazy[node*2] += lazy[node];
            lazy[node*2+1] += lazy[node];
        }
        lazy[node] = 0;
    }
}
void update_range(vector<long long> &tree, vector<long long> &lazy, int node, int start, int end, int left, int right, long long diff) {
    update_lazy(tree, lazy, node, start, end);
    if (left > end || right < start) {
        return;
    }
    if (left <= start && end <= right) {
        tree[node] += (end-start+1)*diff;
        if (start != end) {
            lazy[node*2] += diff;
            lazy[node*2+1] += diff;
        }
        return;
    }
    update_range(tree, lazy, node*2, start, (start+end)/2, left, right, diff);
    update_range(tree, lazy, node*2+1, (start+end)/2+1, end, left, right, diff);
    tree[node] = tree[node*2] + tree[node*2+1];
}
long long sum(vector<long long> &tree, vector<long long> &lazy, int node, int start, int end, int left, int right) {
    update_lazy(tree, lazy, node, start, end);
    if (left > end || right < start) {
        return 0;
    }
    if (left <= start && end <= right) {
        return tree[node];
    }
    return sum(tree, lazy, node*2, start, (start+end)/2, left, right) + sum(tree, lazy, node*2+1, (start+end)/2+1, end, left, right);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> Q;
    for(int i=1;i<N;i++){
        int a, b;
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    dfs(1);

    int n = 3*N; // 모든 노드가 2번씩 나오니까
    vector<ll> a(n);
    int h = (int)ceil(log2(n)); 
    int tree_size = (1 << (h+2)) - 1;
    vector<ll> tree(tree_size);
    vector<ll> lazy(tree_size);

    init(a, tree, 1, 0, n-1); // 모두 0으로 초기화(A는 아무 값도 없으므로)
    int p, x;
    while(Q--){
        cin >> p >> x;
        // p를 root로 하는 subtree는 모두 x만큼 더해주자.
        // in[p] ~ out[p] 사이 구간에 모두 x만큼 lazy propagation
        int start = in[p];
        int end = out[p];
        update_range(tree, lazy, 1, 0, n-1, start-1, end-1, x);
    }
    for(int i=1; i<=N;i++){
        // in[i]번째의 세그먼트 트리 값을 모두 출력
        int start = in[i];
        cout << sum(tree, lazy, 1, 0, n-1, start-1, start-1) << " ";
    }
    return 0;
}

Measured memory_bytes: 91904
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int dp[MX][3];

int main() {
  int n;
  scanf("%d",&n);
  rep(i,n) {
    vi a(3);
    cin>>a;
    rep(j,3)rep(k,3) if (j != k) {
      maxs(dp[i+1][j], dp[i][k]+a[j]);
    }
  }
  int ans = 0;
  rep(i,3) maxs(ans, dp[n][i]);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#include<stack>
#include<cassert>
#include<functional>
#define int long long int
#define double long double
using namespace std;
#define INT_MAX 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

signed main()
{
int n,k;
std::cin >> n >> k;
std::vector<int> a(n,0);
for(int i = 0; i < n; i++){
    int temp;
    std::cin >> temp;
    a[i] = temp;
}
std::vector<int> sum;
for(int i = 0; i < n; i++){
    sum.push_back(a[i]);
    for(int j = i + 1; j < n; j++){
        sum.push_back(a[j] + sum[sum.size() - 1]);
    }
}
int out = 0;
int two = (int)1 << 50;
for(int i = 0; i < 51; i++){
    int flag = 0;
    for(int j = 0; j < sum.size(); j++){
        if((int)(sum[j] & (two + out)) == two + out){
            flag++;
        }
    }
    if(flag >= k){
        out += two;
    }
    two = (int)two >> 1;
}

std::cout << out << std::endl;
return 0;
}

Measured memory_bytes: 6260
#include <iostream>
#include <vector>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

const int inf = 1e3;

int match(const string& s, const string& t){
    int k = min(s.size(), t.size());
    for(int i = k; i >= 0; --i){
        if(string(s, s.size() - i, i) == string(t, 0, i)){
            return i;
        }
    }
}

bool contain(const string& s, const string& t){
    if(s.size() < t.size()){
        return false;
    }

    rep(i, s.size() - t.size() + 1){
        if(string(s, i, t.size()) == t){
            return true;
        }
    }
    return false;
}

int n;
string s[14];
int m[14][14];
int dp[1 << 14][14];

void remove_duplication(){
    rep(i, n){
        rep(j, n){
            if(i != j && contain(s[j], s[i])){
                s[i] = "";
                break;
            }
        }
    }
}

void make_match(){
    rep(i, n){
        rep(j, n){
            m[i][j] = match(s[i], s[j]);
        }
    }
}

int solve(){
    rep(i, 1 << n){
        fill_n(dp[i], n, inf);
    }

    rep(i, n){
        dp[1 << i][i] = s[i].size();
    }

    rep(i, 1 << n){
        rep(j, n){
            if(!(i >> j & 1)){
                continue;
            }

            rep(k, n){
                if(k == j || !(i >> k & 1)){
                    continue;
                }

                dp[i][j] = min(dp[i - (1 << j)][k] + (int)s[j].size() - m[k][j], dp[i][j]);
            }
        }
    }

    return *min_element(dp[(1 << n) - 1], dp[(1 << n) - 1] + n);
}

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

        if(n == 0){
            break;
        }

        rep(i, n){
            cin >> s[i];
        }

        remove_duplication();

        make_match();
        
        cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 3940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int test=1;
    //cin>>test;
    while(test--){
        int n;
        cin>>n;
        int t=n%1000;
        if(t==0) cout<<0;
        else cout<<1000-t;
    }

    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}
 
typedef pair<ll,ll> Pair;
const ll inf =1000000007;

void solve(){
    ll n;
    cin >> n;
    ll x[n],y[n];
    rep(i,n){
        cin >> x[i];
        y[i]=x[i];
    }
    sort(x,x+n);
    rep(i,n){
        if(y[i]<=x[n/2-1]) cout << x[n/2] << endl;
        else cout << x[n/2-1] << endl;
    }
}

int main(){
    solve();
}




//




Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int n,m;
char s[N],t[N];
int main(){
	scanf("%d%d",&n,&m);
	scanf("%s%s",s,t);
	int p=__gcd(n,m);
	for (int i=0,j=0;i<n&&j<m;i+=n/p,j+=m/p)
		if (s[i]!=t[j]){
			puts("-1");
			return 0;
		}
	printf("%lld\n",(long long)n*m/p);	
}

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

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while ( A > 0 && C > 0 ) {
        C = C - B;
        if (C <= 0) break;
        A = A - D;
        if (A <= 0) break;
    }

    if (A > 0) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 3624
h,w = map(int,input().split())
a = []
for i in range(h):
	a.append(list(map(int,input().split())))
import copy
b = copy.deepcopy(a)

x = 0

for i in range(h):
	for j in range(w):
		if a[i][j]%2==1 and i!=h-1:
			a[i][j] -=1
			a[i+1][j] +=1
			x +=1
		elif a[i][j]%2==1 and j!=w-1:
			a[i][j] -=1
			a[i][j+1] +=1	
			x +=1

print(x)

for i in range(h):
	for j in range(w):
		if b[i][j]%2==1 and i!=h-1:
			b[i][j] -=1
			b[i+1][j] +=1
			print(i+1,j+1,i+2,j+1)

		elif b[i][j]%2==1 and j!=w-1:
			b[i][j] -=1
			b[i][j+1] +=1	
			print(i+1,j+1,i+1,j+2)


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

int main(){
	int n,k[100];
	string s;
	while(cin>>n,n){
		rep(i,n) cin>>k[i];
		cin>>s;
		rep(i,s.size()){
			char a;
			int S=s[i],K=min(k[i%n],52-k[i%n]);
			if(K!=k[i%n])K*=-1;
			if('a'<=S&&S<='z'){
				if('a'<=S-K&&S-K<='z'){
					a=S-K;
				}else if(S-K<'a'){
					a='Z'+1-'a'+S-K;
				}else{
					a='A'-1+S-K-'z';
				}
			}else{
				if('A'<=S-K&&S-K<='Z'){
					a=S-K;
				}else if(S-K<'A'){
					a='z'+1-'A'+S-K;
				}else{
					a='a'-1+S-K-'Z';
				}
			}
			cout<<a;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

typedef long long ll;
const int MOD = 1000000007;

int main(){ 
  int N,num,count = 0;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> num;
    while(num%2==0){
      num/=2;
      count++;
    }
  }
  cout << count;
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
using namespace std;

int main() {
	long long int X, Y, ans = 0;
	cin >> X >> Y;
	for (long long int i = X; i <= Y;)
	{
		i *= 2;
		ans++;
	}
	cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//-------------------------------------------MACROS---------------------------------------------
#define 	TIEMPO_CORRIDA		cerr << "tiempo: "<<1.0*clock()/CLOCKS_PER_SEC <<" seg.\n";
#define 	FILES				freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define 	FORIT(it,e)			for(it = e.begin() ; it != e.end() ; it++)
#define 	FOR(i,a,b)			for(i = a ; i < b ; i++)
#define 	RFOR(i,a,b)			for(i = a ; i >= b ;i--)
#define 	FORSW(i,a,b,sw)		for(i = a ; i < b && sw ; i++)
#define 	RFORSW(i,a,b,sw)	for(i = a ; i >= b && sw ; i--)
#define 	fast 				ios::sync_with_stdio(false),cin.tie(),cout.tie();
#define 	to_int(x) 			atoi(x.data())
#define 	to_long(x) 			atoll(x.data())
#define 	ALL(x) 				x.begin(),x.end()
#define 	RALL(x) 			x.rbegin(),x.rend()
typedef 	long long 			ll;
typedef 	pair<int,int> 		pi;
typedef 	pair<ll,ll> 		pl;
const		int 				modN = 1e9+7;
const		double 				PI = 3.1415926535897932384626433832795028841;
//---------------------------------------------------------------------------------------------

int n,m;
char grid[1002][1002];
int memo[1002][1002];

int dp(int i, int j){
	if(i==n-1 && j==m-1) {memo[i][j]=0;return 1;}
	if(grid[i][j]=='#') return memo[i][j]=0;
	if(memo[i][j]!=-1) return memo[i][j];
	if(i==n-1) return memo[i][j]=dp(i,j+1);
	if(j==m-1) return memo[i][j]=dp(i+1,j);
	return memo[i][j]=((dp(i+1,j)%modN+dp(i,j+1)%modN)%modN); 
}

int main(){
	char c;
	int i,j;
	while(cin >>n >>m){
		memset(memo,-1,sizeof memo);
		FOR(i,0,n) FOR(j,0,m) cin >> grid[i][j];
		cout << dp(0,0)<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 8640
#include <iostream>

using namespace std;

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

  if (D == 25)
    cout << "Christmas" << endl;
  else if (D == 24)
    cout << "Christmas Eve" << endl;
  else if (D == 23)
    cout << "Christmas Eve Eve" << endl;
  else if (D == 22)
    cout << "Christmas Eve Eve Eve" << endl;

  return 0;
}

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


using namespace std;
using ll = long long;

#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define trav(a, x) for(auto& a: x)

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    ll x; cin >> x;
    cout << (x >= 30 ? "Yes": "No") << '\n';

    return 0;
}




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

using namespace std;

template <typename T>
ostream &operator<<(ostream &os, const std::vector<T> &vec) {
  for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
  return os;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
    A[i]--, B[i]--;
    G[A[i]].emplace_back(B[i]);
    G[B[i]].emplace_back(A[i]);
  }

  int res = 0;

  for (int i = 0; i < M; i++) {
    queue<int> que;
    que.push(0);

    vector<bool> used(N, false);
    used[0] = true;

    while (!que.empty()) {
      int u = que.front();
      que.pop();

      for (int v : G[u]) {
        if (used[v] || (A[i] == u && B[i] == v) || (A[i] == v && B[i] == u))
          continue;
        que.push(v);
        used[v] = true;
      }
    }

    auto check = [used, N]() -> bool {
      for (int i = 0; i < N; i++) {
        if (!used[i]) return false;
      }
      return true;
    };

    if (!check()) res++;
  }

  cout << res << '\n';

  return 0;
}


Measured memory_bytes: 892
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static BufferedReader reader;
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		String[] s = readLine();
		char[] sc = s[0].toCharArray();
		if(sc[0]==sc[1]) {
			print((sc[2]==sc[3]&&sc[0]!=sc[2])?"Yes":"No");
		}else if(sc[0]==sc[2]) {
			print(sc[1]==sc[3]?"Yes":"No");
		}else if(sc[0]==sc[3]) {
			print(sc[1]==sc[2]?"Yes":"No");
		}else {
			print("No");
		}
		
		
	}

	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
}


Measured memory_bytes: 21076
//F5で実行 Shift+F5で停止
//F9でブレークポイント
#include<cmath>
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
//Ctrl+PageUpで上部の大半を選択できる
// 1e18 = 10の18乗

string S;
string ans = "No";

void _main() {
	cin >> S;


	rep(i,1,S.length()) {
		if (S[i - 1] != S[i]) {
			ans = "Yes";
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
using namespace std;
char str[11000];
string m[1100];
int x1[1100];
int x2[1100];
int y1[1100];
int y2[1100];
int fi[1100];
int par[1100];
int tmp[1100];
int sz[1100];
int main(){
	int a;
	while(scanf("%d",&a),a){
		scanf("%s",str);
		int n=0;
		for(int i=0;str[i];i++){
			if(str[i]=='<'&&str[i+1]!='/'){
				fi[n]=i;
				string now="";
				int j;
				for(j=i+1;str[j]!='>';j++)now+=str[j];
				j++;
				x1[n]=x2[n]=y1[n]=y2[n]=0;
				while('0'<=str[j]&&str[j]<='9'){
					x1[n]*=10;x1[n]+=str[j]-'0';j++;
				}j++;
				while('0'<=str[j]&&str[j]<='9'){
					y1[n]*=10;y1[n]+=str[j]-'0';j++;
				}j++;
				while('0'<=str[j]&&str[j]<='9'){
					x2[n]*=10;x2[n]+=str[j]-'0';j++;
				}j++;
				while('0'<=str[j]&&str[j]<='9'){
					y2[n]*=10;y2[n]+=str[j]-'0';j++;
				}j++;
				m[n++]=now;
			}
		}
		for(int i=0;i<n;i++)par[i]=-1;
		for(int i=0;i<n;i++)tmp[i]=99999999;
		for(int i=0;i<n;i++)sz[i]=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(x1[j]<x1[i]&&x2[i]<x2[j]&&y1[j]<y1[i]&&y2[i]<y2[j]){
					if(x2[j]-x1[j]<tmp[i]){
						par[i]=j;
						tmp[i]=x2[j]-x1[j];
					}
					sz[j]++;
				}
			}
		}
		for(int i=0;i<n;i++){
			sz[i]=0;
			for(int j=0;j<n;j++)if(par[j]==i)sz[i]++;
		}
		for(int i=0;i<a;i++){
			int x,y;scanf("%d%d",&x,&y);
			int to=-1;
			int val=99999999;
			for(int j=0;j<n;j++){
				if(x1[j]<=x&&x<=x2[j]&&y1[j]<=y&&y<=y2[j]){
					if(x2[j]-x1[j]<val){
						val=x2[j]-x1[j];
						to=j;
					}
				}
			}
			if(!~to)printf("OUT OF MAIN PANEL 1\n");
			else{
				printf("%s %d\n",m[to].c_str(),sz[to]);
			}
		}
	}
}

Measured memory_bytes: 1124
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000

int beki(long long a,long long b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}

int main(){
	
	int N;
	cin>>N;
	int ans = beki(10,N);
	ans = mod(ans - beki(9,N));
	ans = mod(ans - beki(9,N));
	ans = mod(ans + beki(8,N));
	
	cout<<ans<<endl;
	
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 29;

bool isPalindrome(string s) {
	string t(s.rbegin(), s.rend());
	return s == t;
} 
int main() {
	int a, b;
	cin >> a >> b;
	int cnt = 0;
	for (int i = a; i <= b; i++)
	{
		string t = to_string(i);
		if (isPalindrome(t)) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
int main()
{
    int k, s;
    std::cin >> k;
    std::cin >> s;

    int cnt = 0;

    if ( k == s )
    {
        cnt = (k + 2)*(k+1)/2;
    }
    else
    {
        const int lim = std::min(k, s);
        // off-diagonal
        for (int ix = 0; ix < lim+1; ++ix)
        {
            for (int iy = ix + 1; iy < lim+1; ++iy)
            {
                const int z = s - ix - iy;
                if (z < 0) break;
                if (z <= k) ++cnt;
            }
        }
        cnt *= 2;

        // diagonal
        for (int ix = 0; ix < lim+1; ++ix)
        {
            const int z = s - 2*ix;
            if (z < 0) break;
            if (z <= k) ++cnt;
        }
    }

    std::cout << cnt << "\n";

    return 0;
}


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

int main(){
    string S, substr[5]; cin >> S;
    int K; cin >> K;
    int N = S.size();
    set<string> SDP;
    if(N <= 50){
        for(int i = 0; i < N; i++){
            for(int j = i; j < N; j++){
                string sub = S.substr(i, j + 1 - i);
                SDP.insert(sub);
            }
        }
        auto itr = SDP.begin();
        for(int i = 0; i < K - 1 ; i++) itr++;
        cout << *itr << endl;
    }else{
       for(int i = 0; i < N; i++){
            for(int j = i; j < i + 5; j++){
                if(j >= N) break;
                string sub = S.substr(i, j + 1 - i);
                SDP.insert(sub);
            }
        }
        auto itr = SDP.begin();
        for(int i = 0; i < K - 1 ; i++) itr++;
        cout << *itr << endl; 
    }
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int c = 1;

void solve(int A[], int B[], int p, int q, int n) {
    int r = 0;
    for(int i = 0; i < n; i++) {
        if(B[q + i] == A[p]) {r = i; break;}
    }
    if(r > 0) {
        solve(A, B, p + 1, q, r);
    }
    if(r + 1 < n) {
        solve(A, B, p + r + 1, q + r + 1, n - 1- r);
    }
    if(c != 0) c--;
    else cout << " ";
    cout <<  A[p];
}



int main() {
    int n;
    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];

    solve(A, B, 0, 0, n);

    cout << endl;
}


Measured memory_bytes: 3136
#include <iostream>
#include <climits>
#include <queue>

using namespace std;

using pii = pair<int, int>;

struct Graph{
  int v_size;
  vector<vector<pii>> adj;
  
  Graph(const int v_size):v_size(v_size){
    this->adj.resize(v_size);
  }
  
  void add_edge(const int s, const int t, const int w){
    this->adj[s].emplace_back(pii(t, w));
  }
};

int mst(const Graph& g){
  constexpr int INF{INT_MAX};
  
  vector<int> d(g.v_size, INF);
  priority_queue<pii, vector<pii>, greater<pii>> pq;

  d[0] = 0;
  pq.push(pii(0, 0));

  int ans {0};
  
  while(!pq.empty()){
    auto cost {pq.top().first};
    auto v {pq.top().second};
    pq.pop();

    if(d[v] < cost) continue;

    ans += cost;
    d[v] = -INF;

    for(int i = 0; i < g.adj[v].size(); ++i){
      auto to {g.adj[v][i].first};
      auto next_cost {g.adj[v][i].second};

      if(d[to] > next_cost){
        d[to] = next_cost;
        pq.push(pii(next_cost, to));
      }
    }
  }

  return ans;
}

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

  int x;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j){
      cin >> x;
      if(x != -1){
        g.add_edge(i, j, x);
      }
    }
  }

  cout << mst(g) << endl;
}



Measured memory_bytes: 3116
N = int(input())

A = list(map(int, input().split()))

l = 0
r = N - 1

sum_l = A[l]
sum_r = A[r]

while r - l > 1:
    #print(l, r, sum_l, sum_r)
    if sum_l < sum_r:
        l += 1
        sum_l += A[l]
    else:
        r -= 1
        sum_r += A[r]
        
print(abs(sum_l-sum_r))

Measured memory_bytes: 26060
A, B, C, X, Y = gets.split.map(&:to_i)

if X == Y
  if C * 2 <= A || C * 2 <= B
    puts C * 2 * X
  else
    puts A * X + B * Y
  end

  exit
end

if C * 2 <= A && C * 2 <= B
  puts C * 2 * [X, Y].max
elsif C * 2 <= A
  diff = Y - X

  puts C * 2 * X + B * (diff.positive? ? diff : 0)
elsif C * 2 <= B
  diff = X - Y

  puts C * 2 * Y + A * (diff.positive? ? diff : 0)
elsif C * 2 <= A + B
  remain = (X < Y ? B : A) * (X - Y).abs

  puts C * 2 * [X, Y].min + remain
else
  puts A * X + B * Y
end

Measured memory_bytes: 1788
l = input()
a = [int(i) for i in input().split()] 
n = 0
num = a[0]
for i in a:
  max = a[0]
  
  
  if i > a[n-1] and n > 0:
    num += (i-a[n-1])
  n += 1
print(num)  
  
  
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define PI 3.1415926535897
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


signed main(){
	double a, b, c, d, e, f;
	double A, B, C;
	double x, y;
	while(cin >> a >> b >> c >> d >> e >> f){
		A = (a*e) - (b*d);
		B = (c*e) - (b*f);
		C = (a*f) - (c*d);

		x = round(B/A*1000)/1000;
		y = round(C/A*1000)/1000;

		if(x == 0) x = 0;
		if(y == 0) y = 0;

		cout << fixed << setprecision(3) << x << ' ' << y << endl;
	}

	return 0;
}


Measured memory_bytes: 3356
#include <stdio.h>
#define N 100

int main(){
  int A[1001];
  int i,j,k,num,temp;

  scanf("%d",&num);
  for(i=0; i<num; i++){
    scanf("%d",&A[i]);
  }

  for(j=1; j<=num-1; j++){
    for(k=0; k<=num-1; k++){
      printf("%d",A[k]);
      if(k != num-1) printf(" ");
      else printf("\n");
    }

    
    temp = A[j];
    i = j-1;
    while(i>=0 && A[i]>temp){
      A[i+1] = A[i];
      i--;
    }
    A[i+1] = temp;
  }
  for(k=0; k<=num-1; k++){
    printf("%d",A[k]);
    if(k != num-1) printf(" ");
    else printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2068
#include<stdio.h>
int main(void)
{
	int n,b=0,a;
	float c;
	scanf("%d", &n);
	for (a = 1; a <= n ; a++) {
		if (a % 2 == 1) {
			b++;
		}
	}
	c = 1.0*b / n;
	printf("%f", c);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int A, B;
  cin >> A >> B;
  
  int ans = max(max(A + B, A + (A - 1)), B + (B - 1));
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N,D,X;
    cin >> N >> D >> X;
    int ans = X;
    rep(i,0,N){
        int a;
        cin >> a;
        ans += ((D - 1) / a) + 1;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
while True:
    n=int(input())
    if n==0:
        break
    a=list(0 for i in range(10))
    for i in range(n):
        c=int(input())
        a[c]+=1
    
    for i in range(10):
        count='*'*a[i]
        if len(count)==0:
            print('-')
        else:
            print(count)


Measured memory_bytes: 5624
#include<stdio.h>
int main(void)
{
    char S[10];
  
    scanf("%s",S);
    
    if(S[0]=='S') printf("Cloudy\n");
    else if(S[0]=='C') printf("Rainy\n");
    else printf("Sunny\n");
  
    return 0;
}

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

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

  int ans = 0;
  for (int i = 1; i <= n; i++){
    if (to_string(i).length() % 2 == 1){
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main()
{
	int N;
	int A[100000];
	cin >> N;
	for (int i = 0; i < N; ++i)
		cin >> A[i];
	int j, v;
	for (int i = 0; i<N - 1; i++)
		cout << A[i] << ' ';
	cout << A[N - 1] << endl;
	for (int i = 1; i < N; ++i)
	{
		j = i - 1;
		v = A[i];
		while (j >= 0 && A[j] > v)
		{
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		for (int i = 0; i<N - 1; i++)
			cout << A[i] << ' ';
		cout << A[N - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve(){
  int n;
  ll z,w;
  cin>>n>>z>>w;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll maxv=abs(a[n-1]-w);
  if(n>1)chmax(maxv,abs(a[n-2]-a[n-1]));
  cout<<maxv<<endl;
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {

  val n = scala.io.StdIn.readInt()
  val arr = scala.io.StdIn.readLine().split(" ").map(_.toInt)


  def solve() = {
    val totalWeight = arr.sum
    val sumArr = Array.fill(n)(0)
    for(i <- 0 until n) {
      if(i == 0) sumArr(i) = arr(i)
      else sumArr(i) = sumArr(i-1) + arr(i)
    }

    sumArr.map { v =>
      (v - (totalWeight - v)).abs
    }.min
  }

  println(solve)

}


Measured memory_bytes: 25424