akhauriyash/Code-Regression huggingface dataset:
s = input()
res = -1

while len(s) > 0 :

    if len(s) - 5 >= 0 and s[len(s)-5:len(s)] == "erase" :
      #print(s[0:len(s)-5])
      if len(s) - 5 > 0 :
        s = s[0:len(s)-5]
      else :
          res = 1
          s = s[0:len(s)-5]

    elif len(s) - 5 >= 0 and s[len(s)-5:len(s)] == "dream" :
      #print(s[0:len(s)-5])
      if len(s) - 5 > 0 :
        s = s[0:len(s)-5]
      else :
          res = 1
          s = s[0:len(s)-5]

    elif len(s) - 6 >= 0 and s[len(s)-6:len(s)] == "eraser" :
      #print(s[0:len(s)-6])
      if len(s) - 6 > 0 :
        s = s[0:len(s)-6]
      else :
          res = 1
          s = s[0:len(s)-6]

    elif len(s) - 7 >= 0 and s[len(s)-7:len(s)] == "dreamer" :
      #print(s[0:len(s)-7])
      if len(s) - 7 > 0 :
        s = s[0:len(s)-7]
      else :
          res = 1
          s = s[0:len(s)-7]

    else :
        res = 0
        s = ""


if res==1 :
    print("YES")
else :
    #print(res)
    print("NO")

Measured memory_bytes: 3316
#include <stdio.h>
int main() {

    int x, A, B, C, K;

    scanf("%d %d %d %d", &A, &B, &C, &K);

    if(K<=A) {
        x = K;
    } else if(K<=A+B) {
        x = A;
    } else {
        x = A * 2 + B - K;
    }
    printf("%d", x);

    return 0;
}


Measured memory_bytes: 1720
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main(){ 
long long int a;
double c,d;
  cin>>a;
  c=a;
  a/=2;
  d=a;
  double b=d/(c);
  cout<<fixed<<setprecision(12)<<1-b;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
    int a[50];
    int i=0,n,p=1;

    cin >> n;
    if(n > 0)p *= -1;
    else if(n == 0)cout << "0";
    while(n != 0){
        p *= -1;
        n *= p;
        a[i] = n % 2;
        n = (n - a[i]*p) / 2;
        n *= -p;
        //cout << n << endl;
        i++;
    }
    FORD(j,i,0)cout << a[j];

    return 0;
}


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

using namespace std;

int N, M, K;
char s[310];
int a[310];
int f[310][310][310];
const int MOD = 998244353;
void upd(int &x, int y) {
    x += y;
    if (x >= MOD) x -= MOD;
}

int main() {
    scanf("%s", s);
    scanf("%d", &K);
    N = strlen(s);
    int tmp = 0;
    M = 0;
    for (int i=0;i<N;i++) {
        if (s[i] == '1') {
            tmp++;
        } else {
            a[++M] = tmp;
            tmp = 0;
        }
    }
    a[++M] = tmp;
    //for (int i=1;i<=M;i++) printf("%d %d\n",i,a[i]);
    K = min(K, N);
    f[0][0][0] = 1;
    for (int i=0;i<=M;i++) {
        for (int j=0;j<=K;j++) {
            for (int k=0;k<=K;k++) {
                int v = f[i][j][k];
                if (!v) continue;
                assert(j<=k);
                // return
                for (int l=0;l<=j && l<=a[i+1];l++) {
                    upd(f[i+1][j-l][k], v);
                }
                // borrow
                for (int l=1;k+l<=K;l++) {
                    upd(f[i+1][j+l][k+l], v);
                }
            }
        }
    }
    int ans = 0;
    for (int i=0;i<=K;i++) {
        upd(ans, f[M][0][i]);
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 59484
#include <stdio.h>
#define HUGE 1000000001 
typedef struct{
  int value;
  char suit;
}Record;

void  mergesort(Record *,int,int);
void merge(Record * , int ,int,int);
void Quick(Record *, int, int);
int Partition(Record *, int ,int );

int main(){
  /*dataA usu quick sort and dataB use merge sort*/
  Record dataA[100000],dataB[100000]; 
  int num,i,p,flag=1;
  char array[10];

  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%s %d",array,&dataA[i].value);
    dataA[i].suit=array[0];
    dataB[i].value=dataA[i].value;
    dataB[i].suit=dataA[i].suit;
  }
 
  Quick(dataA,0,num-1);
  mergesort(dataB,0,num);

  for(i=0;i<num; i++){
    if(dataA[i].suit!=dataB[i].suit) flag=0;
  }
  if(flag==0)printf("Not stable\n");
  else printf("Stable\n");
  for(i=0;i<num;i++)  printf("%c %d\n",dataA[i].suit,dataA[i].value);
  return 0;
}

void mergesort(Record *data,int left, int right){
  int mid;
  if(left<right-1){
    mid=(left+right)/2;
    mergesort(data,left,mid);
    mergesort(data,mid,right);
    merge(data,left,mid,right);
  }
}

void merge(Record  *data,int left,int mid, int right){
  int i,j,k,num1,num2;
  Record array1[50001],array2[50001];
  num1=mid-left;
  num2=right-mid;
  for(i=0;i<num1;i++) {
    array1[i].value=data[left+i].value;
    array1[i].suit=data[left+i].suit;/*left array*/
  }
  for(i=0;i<num2;i++){
    array2[i].value=data[mid+i].value;
    array2[i].suit=data[mid+i].suit;/*right array*/
  }
  array1[num1].value=HUGE; /*insert huge value in array as a keeper*/
  array2[num2].value=HUGE;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    
    if(array1[i].value<=array2[j].value){
      data[k].value=array1[i].value;
      data[k].suit=array1[i].suit;
      i++;
    }
    else{
      data[k].value=array2[j].value;
      data[k].suit=array2[j].suit;
      j++;
    }
  }
}

void Quick(Record *data,int p, int last){
  int q;
  if(p<last){
    q=Partition(data,p,last);
    Quick(data,p,q-1);
    Quick(data,q+1,last);
  }
}

int Partition(Record *data, int p, int last){
  int changenum,i,j;
  char changechar;

  i=p-1;
  for(j=p;j<last;j++){
    if(data[j].value<=data[last].value){
      i++;
      changenum=data[j].value;
      data[j].value=data[i].value;
      data[i].value=changenum;

      changechar=data[j].suit;
      data[j].suit=data[i].suit;
      data[i].suit=changechar;
    }
  }
  changenum=data[last].value;
  data[last].value=data[i+1].value;
  data[i+1].value=changenum;

  changechar=data[last].suit;
  data[last].suit=data[i+1].suit;
  data[i+1].suit=changechar;
  return i+1;
}



Measured memory_bytes: 4112
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

//最後のところの処理がいい加減になっていた、こういう詰めの甘い実装がダメなんだよカス
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,q;cin>>n>>q;

    vector<vector<ll>> xst(n);
    REP(i,n){
        ll s,t,x;cin>>s>>t>>x;
        xst[i]={x,s,t};
    }
    sort(ALL(xst));

    vector<ll> d(q);
    REP(i,q)cin>>d[i];

    vector<deque<ll>> ans_sectl(q);
    vector<deque<ll>> ans_sectr(q);
    REP(i,n){
        ll s,t,x;x=xst[i][0];s=xst[i][1];t=xst[i][2];
        ll L=(lower_bound(ALL(d),s-x)-d.begin());
        ll R=(upper_bound(ALL(d),t-x-1)-d.begin())-1;
        //lower,upper気を付ける
        //2RE
        if(L<=R){ans_sectl[L].PB(i);ans_sectr[R].PB(i);}
        //cout << L << " " << R << endl;
    }

    //複数存在する場合もあるので、map
    map<ll,ll> ans;
    REP(i,q){
        ll sl=SIZE(ans_sectl[i]);
        ll sr=SIZE(ans_sectr[i]);
        REP(_,sl){
            ans[*(ans_sectl[i].begin())]+=1;
            ans_sectl[i].pop_front();
        }
        if(ans.empty()){
            cout<<-1<<"\n";
        }else{
            cout<<xst[ans.begin()->F][0]<<"\n";
        }
        REP(_,sr){
            ans[*(ans_sectr[i].begin())]-=1;
            if(ans[*(ans_sectr[i].begin())]==0)ans.erase(*(ans_sectr[i].begin()));
            ans_sectr[i].pop_front();
        }
    }
}

Measured memory_bytes: 296916
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll N,W;
    pair<ll,ll> item[120];

    cin >> N >> W;
    for(int i = 0;i < N;i++)cin >> item[i].first >> item[i].second;
    item[N] = make_pair(-1,-1);

    sort(item,item+N);
    reverse(item,item+N);

    int idx = 0;
    vector<pair<ll,ll>> vec[5];
    for(int i = 0;i <= N;i++){
        if(i != 0 && item[i].first != item[i-1].first){
            idx++;
        }
        if(i != N)vec[idx].push_back(item[i]);
    }/*
    cout << "#" << endl;
    for(int i = 0;i < 4;i++){
        cout << "-" << endl;
        for(auto&& p : vec[i]){
            cout << p.first << " " << p.second << endl;
        }
    }*/

    ll bestv = -1;
    int s0 = vec[0].size(),s1 = vec[1].size(),s2 = vec[2].size(),s3 = vec[3].size();
    for(int i = 0;i <= s0;i++){
        for(int j = 0;j <= s1;j++){
            for(int k = 0;k <= s2;k++){
                for(int l = 0;l <= s3;l++){
                    ll w = 0,v = 0;
                    for(int p = 0;p < N;p++){
                        if(p < i)w += item[p].first,v += item[p].second;
                        else if(s0 <= p && p < j + s0)w += item[p].first,v += item[p].second;
                        else if(s0 + s1 <= p && p < k + s0 + s1)w += item[p].first,v += item[p].second;
                        else if(s0 + s1 + s2 <= p && p < l + s0 + s1 + s2)w += item[p].first,v += item[p].second;
                    }
                    //cout << i << ", " << j << ", " << k << ", " << l << ":" << w << "," << v << endl;
                    if(w > W)continue;
                    bestv = max(v,bestv);


                }
            }
        }
    }
    cout << bestv << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18;

/*--------------------------------------------------------------------*/

signed main(){
	int h,w,k;
	cin>>h>>w>>k;
	char c[7][7];
	rep(i,h)rep(j,w){
		cin>>c[i][j];
	}
	int ans=0;
	vi x(h,0),y(w,0);
	int sum=0;
	rep(i,h){
		rep(j,w){
			if(c[i][j]=='#'){
				x[i]++;
				y[j]++;
				sum++;
			}

		}
	}

	rep(bit,1<<(h+w)){
		int cnt=sum;
		vector<int> visit(h,0);
		rep(i,h){
			if(bit&(1<<i)){
				cnt-=x[i];
				visit[i]=1;
			}
		}
		rep(j,w){
			if(bit&(1<<(h+j))){
				cnt-=y[j];
				rep(i,h){
					if(visit[i]&&c[i][j]=='#'){
						cnt++;
					}
				}
			}
		}
		if(cnt==k) ans++;



	}
	cout<<ans<<endl;


	return 0;
}



Measured memory_bytes: 3564
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }
ll MOD = 1000000007;

int main() {
	int N, M, x;
	cin >> N >> M;
	vector<int> X(M), D(M - 1);
	for (auto& x : X)cin >> x;
	sort(X.begin(), X.end());
	for (int i = 0; i < M - 1; i++)D[i] = X[i + 1] - X[i];
	sort(D.begin(), D.end());
	ll ans = 0;
	for (int i = 0; i < M - N; i++)ans += D[i];
	print(ans);
}


Measured memory_bytes: 4060
#include<iostream>
using namespace std;
int main(){
	int a,b,f;
	while(cin>>a>>b>>f){
		int arr[b],ans=0;
		for(int i=0;i<b;i++)
			cin>>arr[i];
		for(int k=0;k<a;k++){
			int x,sum=0;
			for(int i=0;i<b;i++){
				cin>>x;
				sum+=x*arr[i];
			}
			if(sum+f>0){
				ans++;
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1023456789
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define trav(it,v) for(typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long long ll;

int main(){
    int n;
    scanf("%d",&n);
    int ones = n%10;
    if (ones == 3){
        printf("bon");
    } else if (ones == 0 || ones  == 1 || ones == 6 || ones==8){
        printf("pon");
    } else{
        printf("hon");
    }

}


Measured memory_bytes: 3824
import std.stdio;
import std.algorithm;
import std.range;
import std.typecons;

void main(){
    int h, w;
    while(~scanf("%d%d", &h, &w)){
        auto g = new int[][](h, w);
        alias Tuple!(int,int) idx;
        idx[] ds;
        foreach(i; 0..h){
            foreach(j; 0..w){
                scanf("%d", &g[i][j]);
                ds ~= idx(i, j);
            }
        }
        ds.sort!((a, b) => g[a[0]][a[1]] < g[b[0]][b[1]]);

        auto to = new int[][](h, w);
        foreach(r; to) r[] = -1;

        int ans = 0;
        foreach(t; ds){
            int i = t[0], j = t[1];
            int[] s = [];
            foreach(d; [[0,1],[0,-1],[1,0],[-1,0]]){
                int ni = i + d[0];
                int nj = j + d[1];
                if(0 <= ni && ni < h && 0 <= nj && nj < w){
                    if(g[ni][nj] < g[i][j]){
                        s ~= to[ni][nj];
                    }
                }
            }
            s = uniq(sort(s)).array;
            if(s.length == 0){
                to[i][j] = g[i][j];
            } else if(s.canFind(-10)){
                to[i][j] = -10;
            } else {
                to[i][j] = s.length == 1 ? s[0] : -10;
            }
            ans += to[i][j] == -10;
        }
        writeln(ans);
    }
}

Measured memory_bytes: 26400
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 110;

int n, x;
int a[N];

int main() {
    scanf("%d%d", &n, &x);
    for (int i = 0; i < n; i++) {
        scanf("%d", a + i);
    }
    sort(a, a + n);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (x >= a[i]) {
            x -= a[i];
            ans++;
        } else {
            break;
        }
    }

    if (x != 0 && ans == n) {
        ans--;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap};
#[allow(unused_imports)]
use std::iter::FromIterator;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

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

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }

    #[allow(dead_code)]
    pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
    where
        <S as FromStr>::Err: Debug,
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}

#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn main() {
    let (k, n): (usize, usize) = util::get2();

    if k % 2 == 0 {
        println!(
            "{}",
            vec![(k / 2).to_string()]
                .into_iter()
                .chain((1..n).map(|_| k.to_string()))
                .collect::<Vec<_>>()
                .join(" ")
        );
    } else {
        let mut v = vec![1 + k / 2; n];
        for _ in 0..n / 2 {
            if v.last().unwrap() == &1 {
                v.pop();
            } else {
                *v.last_mut().unwrap() -= 1;
                while v.len() < n {
                    v.push(k);
                }
            }
        }

        println!(
            "{}",
            v.iter()
                .filter(|&&x| x != 0)
                .map(|x| x.to_string())
                .collect::<Vec<_>>()
                .join(" ")
        );
    }

}


Measured memory_bytes: 23280
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        long k = sc.nextLong();

        if (s[0] != '1') {
            System.out.println(s[0]);
            return;
        }

        for (int i = 0; i < s.length; i++) {
            if (s[i] != '1') {
                System.out.println(s[i]);
                break;
            }
            if (i + 1 == k) {
                System.out.println(1);
                break;
            }
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 22996
#include<iostream>
#include<map>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main(){

  double time[24];
  int num;

  map <double, int> M;

  for(int i = 0; i < 3; i++){
    for(int j = i*8; j < i*8+8; j++){
      cin >> num >> time[j];
      M[time[j]] = num;
    }

    sort(time+i*8, time+i*8+8);

    for(int j = i*8; j < i*8+2; j++){
      printf("%d %.2f\n",M[time[j]],time[j]);
      time[j] = -1;
    }
  }

  sort(time, time+24);

  int j = 0;

  for(int i = 0; j < 2; i++){
    if(time[i] > 0){
      printf("%d %.2f\n",M[time[i]],time[i]);
      j++;
    }
  }
  return 0;

}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        String opa = scan.next();
        int b = scan.nextInt();
        char op = opa.charAt(0);
        if(op == '+'){
            System.out.print(a + b);
        }else{
            System.out.print(a - b);
        }
    }
}

Measured memory_bytes: 23764
#include <cstdio>

int main(){
        int n;

        while( scanf("%d", &n) , n ){
                int count = 0;
                int* a;
                a = new int[n*n];
				for(int i=0 ; i<n ; i++){
					for(int j=0 ; j<n ; j++){
                                a[i*n+j] = 0;
					}
				}
                int x = n/2;
                int y = n/2 + 1;
                count++;
                a[y*n+x] = count;
                while(count<n*n){
                        y = (y+1)%n;
                        x = (x+1)%n;
                        if(a[y*n+x]==0){
                                count++;
                                a[y*n+x] = count;
						}else{
							y = (y+1)%n;
							x = (x-1+n)%n;
							if(a[y*n+x]==0){
                                count++;
                                a[y*n+x] = count;
							}
						}
                }
                for(int i=0 ; i<n ; i++){
                        for(int j=0 ; j<n ; j++){
                                printf("%4d", a[i*n+j]);
                        }
                        printf("\n");
                }
        }

        return 0;
}

Measured memory_bytes: 0
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
p = LIST()
arr = [0 for _ in range(n)]
for i in range(n):
    if p[i] == i + 1:
        arr[i] = 1
i = 0
ans = 0
while i < n:
    if arr[i] == 1:
        ans += 1
        if i + 1 < n and arr[i + 1] == 1:
            i += 2
        else:
            i += 1
    else:
        i += 1
print(ans)

Measured memory_bytes: 77288
#include <iostream>

using namespace std;

int main()
{
    char x;
    cin >> x ;
    if (x=='a'||x=='e'||x=='o'||x=='i'||x=='u'||x=='A'||x=='E'||x=='O'||x=='U'||x=='I'){
        cout<<" vowel"<<endl;
    }else{
    cout<<"consonant"<<endl;
    }
       return 0;
}


Measured memory_bytes: 760
x, y = map(int, input().split())

animal = 0
for i in range(x + 1):
    for j in range(x + 1):
        if i + j == x and 2*i + 4*j == y:
            animal += 1
        else:
            animal += 0

if animal >= 1:
    print("Yes")
else:
    print("No")

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

using namespace std;

typedef long long ll;

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

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

vector<int> X;
vector<int> L;

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

    if (N >= M) {
        cout << "0" << endl;
        return 0;
    }

    X.resize(M);
    for (int i = 0; i < M; i++) {
        cin >> X[i];
    }
    sort(X.begin(), X.end());

    L.resize(M - 1);
    for (int i = 0; i < M - 1; i++) {
        L[i] = X[i + 1] - X[i];
    }
    sort(L.begin(), L.end());

    ll acc = 0;
    for (int i = 0; i < M - N; i++) {
        acc += L[i];
    }

    cout << acc << endl;

    return 0;
}


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

#define PI 3.14159265358979323846264338327950L

int main(void) {
  int a, b, h, m;
  scanf("%d%d%d%d", &a, &b, &h, &m);

  long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);

  long double rsq = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);

  printf("%20.20Lf\n", sqrtl(rsq));

  return 0;
}

Measured memory_bytes: 2584
n = int(input())
a = [int(input()) for _ in range(n)]
a.append(0)
r = 0
for i in range(n):
    r += a[i]//2
    if a[i]%2==1 and a[i+1]>0:
        r += 1
        a[i+1] -= 1
print(r)

Measured memory_bytes: 7072
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> v;

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

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

	ll n,i,m,j,k,x,y,a,b,c,t,sm=0;
	string s,w;
	
	cin >> a >> b >> c >> k;
	sm+=min(k,a);
	k-=min(k,a);
	k-=min(k,b);
	if(k)
		sm-=k;
	cout << sm;
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n,m,x; cin>>n>>m>>x;
	int k=0,l=0;
	rep(i,0,m){
		int a; cin>>a;
		if(a<x) k++;
		else l++;
	}
	cout<<min(k,l);
	
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] p = new int[N];
		for(int i = 0; i < N; i++) {
			p[i] = scan.nextInt();
		}
		int upper = X+1;
		int lower = X-1;
		int ans = -1;

		ans = judge(N, p, X);

		while (ans == -1) {
			ans = judge(N, p, lower);
			if (ans != -1) break;
			ans = judge(N, p, upper);
			upper++;
			lower--;
		}

		System.out.println(ans);
	}

	public static int judge(int N, int[] p, int k) {
		int f = 0;
		int ans = -1;

		for(int i = 0; i < N; i++) {
			if (k == p[i]) {
				f++;
				break;
			}
		}
		if (f == 0) {
			ans = k;
		}
		return ans;

	}

}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

int main()
{
	string s; cin>>s;
	bool a=true,b=true;
	int i = ( s[0] - '0')*10+s[1]-'0';
	int j = ( s[2] - '0')*10+s[3]-'0';
	if( !( 1 <= i && i <= 12 ) ) b = false;
	if( !( 1 <= j && j <= 12 ) ) a = false;
	if(a&&b) cout << "AMBIGUOUS" << endl;
	else if(a&&!b) cout << "YYMM" << endl;
	else if(!a&&b) cout << "MMYY" << endl;
	else if(!a&&!b) cout << "NA" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    double tmp = 0;
    rep(i, n) {
        int x;
        cin >> x;
        tmp += 1.0 / x;
    }
    printf("%.7f\n", 1.0 / tmp);
}


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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int T=0;
    while(true){
        if(T>3600){
            cout<<-1<<endl;
            return 0;
        }
        T+=a;
        if(c<=T){
            cout<<c<<endl;
            return 0;
        }
        T+=b;
        if(c<T) c+=60;
    }

    return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = n;
  for(int i=0; i<n-1; i++){
    if(s[i] == s[i+1]){
      ans--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int N;
    cin >> N ;
    int arr[N];
    for (int i = 0 ;  i < N ; i++)
        cin >> arr[i];
    int dp[N] = {0};
    dp[1] = abs(arr[0] - arr[1]);

    for (int i = 2 ; i < N ; i++)
        dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]) ,
                    dp[i - 2] + abs(arr[i] - arr[i - 2]));
    cout << dp[N - 1] << endl;
}


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

#define o cout<<"Hello did you expect this?"<<endl;
#define ll long long
#define pb push_back
#define mp make_pair//with Z
#define F first
#define S second

using namespace std;

const int N = 2e5 + 100;
const int mod = 1e9 + 7;

void hey ()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int main ()
{
	hey();
	int k;
	cin >> k;
	int a, b;
	cin >> a >> b;
	for (int i = a; i <= b; i++)
	{
		if (i % k == 0)
		{
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
}




Measured memory_bytes: 3652
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random
# import time


def main():
    l = list(map(int, input().strip().split()))
    l.sort(reverse=True)
    # eprint("l ", end=": ")
    # eprint(l)
    print(10*l[0]+l[1]+l[2])
    return


if __name__ == '__main__':
    main()


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

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

	map<int, int> mp;
	for (int i = 0; i < N - 1; ++i) {
		int a;
		cin >> a;
		mp[a]++;
	}

	for (int i = 1; i <= N; ++i) {
		cout << mp[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 12964
#include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/#define lli long long int
#define uli unsigned long long int
#define INF 999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  rep(i,0,365){
    Out((i+mod)%26+1);
  }
}

Measured memory_bytes: 3652
#include <stdio.h>

int main (void)
{
    int a,n;
    scanf("%d",&n);
    scanf("%d",&a);
    if(a>=499)
    {
        puts("Yes");
        return 0;
    }
    if(n%500<=a)
    {
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 1588
#include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  while(cin>>n,n){
    pair<int,int>a[n];
    for(int i=0;i<n;i++){
      int q,w,e,r,t,y,u,o,p;
      cin>>q>>w>>e>>r>>t>>y>>u>>o>>p;
      a[i].second=q;
      a[i].first=(w+r+y+o)*60+e+t+u+p;
    }
    sort(a,a+n);
    cout<<a[0].second<<endl<<a[1].second<<endl<<a[n-2].second<<endl;
  }
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)

constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;

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

	int n, a, b; cin >> n >> a >> b;
	vector<double> v(n);
	rep(i, 0, n) cin >> v[i];
	sort(v.rbegin(), v.rend());

	double ans1 = 0.0;
	rep(i, 0, a) ans1 += v[i];
	ans1 /= (double)a;

	ll ans2 = 0;
	double target = v[a - 1];
	ll in = 0, all = 0;
	rep(i, 0, a) if (v[i] == v[a - 1]) ++in;
	rep(i, 0, n) if (v[i] == v[a - 1]) ++all;

	vector<vector<ll>> comb(55, vector<ll>(55, 0));
	rep(i, 1, 55) {
		comb[i][0] = 1;
		rep(j, 1, i) {
			comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
		}
		comb[i][i] = 1;
	}

	if (v[0] == v[a - 1]) {
		rep(i, a, b + 1) {
			ll need = a - in;
			ll free = i - need;
			ans2 += comb[all][free];
		}
	}
	else {
		ans2 = comb[all][in];
	}

	cout << fixed << setprecision(10) << ans1 << " " << ans2 << endl;

	return 0;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
long double x;
ll y,n,m,ab;
string s;
bool b=true;
int main(){
	cin >> x >> s;
	m=(ll)x;
	while(m){
		m/=10;
		n++;
	}
	ab=n;
	for(int i=0;i<s.size();i++){
		if(s[i]=='.'){
			b=false;
			continue;
		}
		y=y*10+s[i]-'0';
		if(b)n--;
		if(n<=0)break;
	}
	for(int i=ab;i>=n;i--)
		x/=10;
	cout << (ll)(x*y);
	return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    char s[203030];
    Scs(s);
    int N = strlen(s);

    char t = 0;
    int ans = 0;
    Rep(i,N){
        if( t == s[i] ) t = 1;
        else ans++, t = t == 1 ? 0 : s[i];
    }

    printf ("%d\n", ans );


    return 0;
}



Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n, k;
    cin >> n >> k;
    vl a(n);
    ll atot = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        atot += a[i];
    }
    vl f(n);
    for (int i = 0; i < n; ++i) {
        cin >> f[i];
    }
    if (atot <= k) {
        cout << 0 << "\n";
        return 0;
    }
    sort(a.begin(), a.end(), greater<ll>());
    sort(f.begin(), f.end());
    priority_queue<pair<ll, ll>, vector<pll>, less<pll>> pq;
    for (int i = 0; i < n; ++i) {
        pq.emplace(a[i] * f[i], f[i]);
    }
    auto check = [&](ll mid) {
        // vl costs(n, 0);
        // for (int i = 0; i < n; ++i) {
        //     costs[i] = (mid) / f[i];
        // }
        // sort(costs.begin(), costs.end());
        // ll cnt = 0;
        // for (int i = 0; i < n; ++i) {
        //     cnt += max(0LL, a[i] - costs[i]);
        // }
        auto pqt = pq;
        ll cnt   = 0;
        while (!pqt.empty()) {
            auto p = pqt.top();
            pqt.pop();
            cnt += max(0ll, (p.first - mid + p.second - 1) / p.second);
        }
        return cnt <= k;
    };
    ll ng = 0;
    ll ok = 1'000'000'000'000;
    while (ng + 1 != ok) {
        ll mid = (ok + ng) / 2;
        if (check(mid))
            ok = mid;
        else
            ng = mid;
    }
    cout << ok << "\n";
    return 0;
}

Measured memory_bytes: 10604
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>


using namespace std;

#define debug false

int main(int argc, char *argv[]){

  bool four = false;
  char S;
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S == 'Y')
      four = true;
  }
  if(four){
    printf("Four\n");
  }else{
    printf("Three\n");
  }

  return 0;
}


Measured memory_bytes: 256
function main()
	n = parse.(split(readline(), ""))
	for i in 1:3
		if n[i] == 1
			n[i] = 9
		elseif n[i] == 9
			n[i] = 1
		end
	end
	print(n[1],n[2],n[3])
end


main()

Measured memory_bytes: 122092
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
long long gcd(long long a, long long b)//最大公約数
{
   if (b == 0)
   {
       return a;
   }
    return gcd(b, a%b);
}

long long lcm(long long a, long long b) //最小公倍数
{
    return (a/gcd(a, b))*b;
}
int main() {
    int N ;
    ll X;
    cin >> N >> X;
    vector<ll>XP(N+1);
    vector<ll>XV(N);
    ll lcmN = 100000000001;
    XP[0]=X;
    rep(i, 1, N+1){
        cin >> XP[i];
    }
    sort(XP.begin(), XP.end());
    rep(i, 0, N){
        XV[i] = XP[i+1] - XP[i];
    }
    rep(i, 0, XV.size()-1){
        ll tmp = gcd(XV[i],XV[i+1]);
        lcmN = min(tmp, lcmN);
    }
    if(N-1 == 0){
        cout << XV[0] << endl;
        return 0;
    }
    cout << lcmN << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a;
  double b[1100]={},c;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  for(int i=0;i<a;i++){
    c=c+1/b[i];
  }
  cout<<1/c<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using ld = long double;


ld f(int i,int k){
    ll num = i;
    ld time = 0.0;
    while(num < k){
        num *= 2;
        time++;
    }    
    return time;
}

int main(){
    ll n,k;
    cin >> n >> k;
    ld ans = 0;
    reps(i,1,n+1){
        ld tmp = (ld)1/n * pow((ld)0.5,f(i,k));
        ans += tmp;
    }
    
    cout << setprecision(30) << ans << endl;
}

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

using namespace std;
using lint = long long;

int main() {
    lint N;
    cin >> N;

    lint ans = 0;
    for (lint i = 1; i <= N; ++i) {
        if (i % 3 != 0 and i % 5 != 0) ans += i;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3576
#include<stdio.h>
int main(void)
{
	int r, c;
	int i, j;
	int rc[110][110];
	int SUM;
	scanf("%d %d", &r, &c);

	for (i = 0; i < r; i++) {
		SUM = 0;
		for (j = 0; j < c; j++) {
			scanf("%d", &rc[i][j]);
			SUM += rc[i][j];
		}
		rc[i][c] = SUM;
	}

	for (i = 0; i < c + 1; i++) {
		SUM = 0;
		for (j = 0; j < r; j++) {
			SUM += rc[j][i];
		}
		rc[r][i] = SUM;
	}

	for (i = 0; i < r + 1; i++) {
		for (j = 0; j < c + 1; j++) {
			if (j != 0) printf(" ");
			printf("%d", rc[i][j]);
		}
		puts("");
	}

	return(0);
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

//ll dp[64][10010];
ll dp[64][3];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	int cnt = 0;
	for (;(1LL << cnt) <= n;) cnt++;
	dp[0][0] = 1;
	for (int i = 1; i <= cnt; i++) {
		if ((1LL << (cnt - i)) & n) {
			dp[i][0] = dp[i - 1][0];
			dp[i][1] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
			dp[i][2] = (dp[i - 1][1] * 2 + dp[i - 1][2] * 3) % MOD;
		} else {
			dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
			dp[i][1] = dp[i - 1][1];
			dp[i][2] = (dp[i - 1][1] + dp[i - 1][2] * 3) % MOD;
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 2; i++) (ans += dp[cnt][i]) %= MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
a = int(input()) 
b = list(input().split())
c = [int(i) for i in b]
d = sorted(c, reverse=True)
Alice, Bob = 0, 0
for j in range(a):
  if j % 2 == 0:
    Alice += d[j]
  else:
    Bob += d[j]
diff = Alice - Bob
print(diff)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int pnt[10000];
int main(){
	int n,q;
	cin>>n>>q;
	for(int i=0;i<n;i++){
		pnt[i]=i;
	}
	int x,y,z;
	for(int u=0;u<q;u++){
		cin>>z>>x>>y;
		if(!z){
			while(true){
				if(pnt[x]==x)break;
				x=pnt[x];
			}
			while(true){
				if(pnt[y]==y)break;
				y=pnt[y];
			}
			pnt[y]=x;
		}
		if(z){
			while(true){
				if(pnt[x]==x)break;
				x=pnt[x];
			}
			while(true){
				if(pnt[y]==y)break;
				y=pnt[y];
			}
			cout<<(x==y)<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    INT(N);
    INT(M);
    int ans = 0;

    for(int i = 0; i < M; ++i){
        INT(A);
        ans += A;
    }
    if(N-ans >= 0){
        cout << N - ans << endl;
    } else {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 3724