akhauriyash/Code-Regression huggingface dataset:
/* C/C++ program to remove invalid parenthesis */
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int

int main() 
{ 
   int n;
   cin>>n;
   int a[n],b[n],c[n];
   for(int i=0;i<n;i++)
   cin>>a[i]>>b[i]>>c[i];
   ll dp[n][3];
   dp[0][0]=a[0],dp[0][1]=b[0],dp[0][2]=c[0];
   
   for(int i=1;i<n;i++)
   {
       for(int j=0;j<3;j++)
       {
           if(j==0)
           {
               dp[i][j]=max(dp[i-1][1],dp[i-1][2])+a[i];
           }
           else if(j==1)
           {
                dp[i][j]=max(dp[i-1][0],dp[i-1][2])+b[i];
           }
           else{
                dp[i][j]=max(dp[i-1][1],dp[i-1][0])+c[i];
           }
       }
   }
   ll ans=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
   cout<<ans;   
	return 0; 
} 


Measured memory_bytes: 3712
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
 
using namespace std;
 
#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int
 
int main(){
    int n;
    cin >> n;
    rep(i, n / 4 + 1){
        rep(j, n / 7 + 1){
            if(i * 4 + j * 7 == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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 <stack>
 #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 PF push_front
 #define MP make_pair
 #define LL long long
 #define ULL unsigned LL
 #define LD long double
 #define pii pair<int,int>
 #define pll pair<LL,LL>

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

int main(){
	int n;
	string a,b,c;
	cin>>n>>a>>b>>c;
	int cnt=0;
	FOR(i,0,n){
		if(a[i]==b[i]&&b[i]==c[i]){

		}else if(a[i]==b[i]){
			cnt++;

		}else if(c[i]==b[i]){
			cnt++;

		}else if(a[i]==c[i]){
			cnt++;
		}else cnt+=2;
		//cerr<<cnt<<endl;
	}

	cout<<cnt<<endl;

  return 0;
}


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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

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

  int t[n];
  for(int i = 0; i < n; i++){
    cin >> t[i];
  }

  int st = 0, ed = 0;
  ll ans = 0;
  for(int i = 0; i < n; i++){
    ans += min(ed, t[i]) - st;
    st = t[i];
    ed = st + T;
  }

  ans += ed - st;
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.ria();
		int k = r.ri();
		int max = 0;
		int sum = 0;
		for(int i : arr)
		{
			sum += i;
			max = Math.max(max, i);			
		}
		print(sum-max + max*(int)Math.pow(2, k));
		
	}
	//a & b =1...k=1/2
	// k > a & b
	
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}


Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define clr(a,b) memset((a),(b),sizeof(a))
typedef pair<int, int> P;
typedef long long int ll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int n, q;
ll ans = 0;
int par[100000];

int init(int x){
	rep(i,n){
		par[i] = i;
	}
}

void find(int x){
	if(x == par[x]){
		ans += x+1;
		return;
	}
	find(par[x]);
}

int main(){
	while(true){
		scanf("%d%d", &n, &q);
		if(n == 0 && q == 0) break;
		init(n);
		ans = 0;
		char a; int b;
		rep(i,n-1){
			int temp; scanf("%d", &temp);
			par[i+1] = temp-1;
		}
		rep(i,q){
			scanf(" %c%d", &a, &b);
			b--;
			if(a == 'M'){
				par[b] = b;
			}
			else{
				find(b);
			}
		}
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 1576
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;


int main() {
    string s;
    cin >> s;
    reverse(all(s));
    int n = s.size();
    vector<ll> cnt(2020, 0);
    cnt[0]++;
    ll now = 0;
    ll keta = 1;
    for(auto x:s) {
        now = now + (x-'0')*keta;
        now %= 2019;
        keta = keta* 10 % 2019;
        cnt[now]++;
    }
    ll ans = 0;
    for(auto x : cnt){
        ans += x*(x-1)/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <numeric>
using namespace std;
#define int long long
int MOD = 1000000007;

long euclidean_gcd(long a, long b) {
  if(a < b) return euclidean_gcd(b, a);
  long r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
long lcm(long p, long q)
{
    return p * q / euclidean_gcd(p, q);
}
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long A, B;
    long C, D;
    cin >> A >> B >> C >> D;

    long Qbc = B / C;
    long Qac = (A - 1) / C;
    long Qbd = B / D;
    long Qad = (A - 1) / D;

    long Qbcd = B / lcm(C, D);
    long Qacd = (A - 1) / lcm(C, D);

    long count = (B - A + 1) - (Qbc - Qac) - (Qbd - Qad) + (Qbcd - Qacd);

    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

ll mod=(ll)1e9+7;
ll pow(ll m,ll n){
    ll ret=1;
    ll a=m;
    while(n>0){
        if(n&1)ret=(ret*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ret;
}
ll inv(ll x){
    return pow(x,mod-2);
}
void solve(){
    ll w,h;cin>>w>>h;
    if((w+h)%3!=0){
        cout<<0<<endl;
        return;
    }
    ll n=(w+h)/3;
    w-=n;h-=n;
    if(w<0||h<0){
        cout<<0<<endl;
        return;
    }
    ll ans=1;
    rep(i,w){
        ans=(ans*(w+h-i))%mod;
        ans=(ans*inv(i+1))%mod;
    }
    cout<<ans<<endl;
}

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


Measured memory_bytes: 256
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func max(a, b  int64 )int64 {
	if a < b {
		return b
	}
	return a
}

func solve(n int64, s string) string {
	d := int64(0)
	dMax := int64(0)
	for i := int64(0); i < n; i ++  {
		b := s[i]
		if b == ')' {
			d ++
		} else{
			d --
		}
		dMax = max(dMax, d)
	}
	for i := int64(0); i < dMax; i ++  {
		s = "(" + s
	}

	d = int64(0)
	dMax = int64(0)
	for i := len(s) -1; i >= 0; i --  {
		b := s[i]
		if b == '(' {
			d ++
		} else{
			d --
		}
		dMax = max(dMax, d)
	}
	for i := int64(0); i < dMax; i ++  {
		s = s + ")"
	}

	return s
}

func main() {
	defer out.Flush()

	n := nextInt()
	s := next()
	res := solve(n, s)
	fmt.Fprintln(out, res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1776
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <iterator>
#include <cmath>
#include <deque>
#include <stack>
using namespace std;

int main()
{
    {
        if (fopen("input.txt", "r")) {
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        }
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
    }

    int n;
    cin >> n;
    vector<unsigned> hv, uv;
    for (int i = 1; i <= n; ++i) {
        int a;
        cin >> a;
        unsigned h = 0, u = 0;
        for (int i = 0; i != a; ++i) {
            int x, y;
            cin >> x >> y;
            --x;
            if (y == 1)
                h |= 1 << x;
            else
                u |= 1 << x;
        }
        hv.push_back(h);
        uv.push_back(u);
    }
    unsigned m = 1 << n;
    int ans = 0;
    for (unsigned mask = 1; mask != m; ++mask) {
        unsigned h = 0, u = 0;
        int c = 0;
        for (int i = 0; i != n; ++i)
            if (mask & (1 << i)) {
                h |= hv[i];
                u |= uv[i];
                ++c;
            }
        if (~mask & h)
            continue;
        if (mask & u)
            continue;
                
        ans = max(ans, c);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int a[31]={};
long long c[31]={};
int main(){
	long long m,n;
	cin >> m >> n;
	int max=0,e=n;
	for(int i=30; i>=0; i--){
		a[i]=e/(long long)pow(2,i);
		e=e%(long long)pow(2,i);
		if(a[i]==1 && max==0) max=i;
	}
	long long k=1,b=m;
	int l=0;
	while (l<max){
		c[l]=b;
		b=b*b;
		k=k*2;
		l++;
		if(b>1000000007) b=b%1000000007;
	}
	for(int i=0; i<max; i++){
		if(a[i]==1) b=b*c[i];
		if(b>1000000007) b=b%1000000007;
	}
	cout << b << endl;
}

Measured memory_bytes: 3188
/*
* @Author: Kabid
* @Date:   2020-04-29 14:50:32
* @Last Modified by:   Kabid
* @Last Modified time: 2020-05-13 14:38:26
*/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define  in(x) scanf("%d",&x);
#define out(x) printf("%d",x);
#define  ins(x)  scanf("%s",x);
#define outs(x) printf("%s",x);
#define lin puts("");
#define _ putchar(' ');

int t;       //test cases
int i, j;	 //iterators
int   n,a, b;
ll c; //variables
string q;
char h;
int main() {

	cin >>n ;
	c+= (n/500)*1000;
	c+= ((n%500)/5)*5;

	cout<<c<<endl;

	return 0;
}

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

using namespace std;

vector<int>mark(5005);

int main()
{
   int x,n;
   cin>>x>>n;
   for(int i=0;i<n;i++){
    int a;
    cin>>a;
    mark[a]=1;
   }
   int num=2e9,diff=2e9;
   for(int i=-5000;i<=5000;i++){
    if(i<=0){
        if(abs(i-x)<diff){
            diff=abs(i-x);
            num=i;
        }
        else if(abs(i-x)==diff){
            num=min(num,i);
        }
    }
    else {
        if(mark[i])continue;
        if(abs(i-x)<diff){
            diff=abs(i-x);
            num=i;
        }
        else if(abs(i-x)==diff){
            num=min(num,i);
        }
    }
   }
   cout<<num<<endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
	ll N,K;
	cin >> N >> K;
	double p[N];
	for(ll i=0;i<N;i++)
		{
			ll x;
			cin >> x;
			ll z=(x*(x+1))/2;
			double y=double(z)/double(x);
			p[i]=y;
		}
	double ans=0,ans1=0;
	for(ll i=0;i<K;i++)
		ans+=p[i];
	ans1=ans;
	for(ll i=1;i<N-(K-1);i++)
	{
		double an=ans-p[i-1]+p[i+K-1];
		ans=an;
		if(an>ans1)
			ans1=an;
	}
	cout << fixed << setprecision(15) << ans1; 
}

Measured memory_bytes: 1792
<?php
$s = trim(fgets(STDIN));

for ($i = 0; $i < strlen($s); $i++) {
    if ($i % 2 === 0 && ($s[$i] === "R" || $s[$i] === "U" || $s[$i] === "D")) {
        continue;
    } else if ($i % 2 === 1 && ($s[$i] === "L" || $s[$i] === "U" || $s[$i] === "D")) {
        continue;
    }

    echo "No" . PHP_EOL;
    exit;
}

echo "Yes" . PHP_EOL;


Measured memory_bytes: 4856
#include<bits/stdc++.h>
//using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb emplace_back
#define mp std::make_pair
//
#define endl "\n"
//using std::endl;
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
//
constexpr ll MOD=1e9+7;
//constexpr ll MOD=998244353;
//constexpr ll MOD=10000000;
//constexpr ll MOD=1e5;
constexpr ll MAX=1e7;
constexpr ll INF=(1ll<<62);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
const ll N=26;
ll solve(ll D,vii &A,vi &C,vi &S){
    vi last(N,-1);
    ll a=0;
    rep(i,0,D){
        ll memo; memo=S[i];
        ll X=i-last[memo]-1;
        a-=X*(X+1)/2*C[memo];
        last[memo]=i;
        a+=A[i][memo];
    }
    rep(i,0,N){
        ll X=D-last[i]-1;
        a-=X*(X+1)/2*C[i];
    }
    return a;
}
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    srand((unsigned)time(NULL));
    ll D; cin>>D;
    rep(i,0,100) rand();
    vi C(N);
    rep(i,0,N) cin>>C[i];
    vii A(D,vi(N));
    rep(i,0,D){
        rep(j,0,N) cin>>A[i][j];
    }
    vi last(N,-1);
    vi ans(D);
    rep(i,0,D){
        ll max=0,memo=0;
        rep(j,0,N){
            if(max<A[i][j]+(i-last[j])*C[j]){
                max=A[i][j]+(i-last[j])*C[j];
                memo=j;
            }
        }
        last[memo]=i;
        ans[i]=memo;
    }
    ll max=solve(D,A,C,ans);
    ll cnt=0;
    while(cnt<=1000000000){
        ll X=rand()%D,Y=rand()%N;
        if(ans[X]==Y) continue;
        ll old=ans[X];
        ans[X]=Y;
        ll sum=solve(D,A,C,ans);
        if(max<sum){
            max=sum;
        }
        else{
            ans[X]=old;
        }
        cnt+=D+N;
    }
    rep(i,0,D) cout<<ans[i]+1<<endl;
}


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

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
    if (v.size()) {
        os << v.front();
        for (auto vi = v.begin() + 1; vi != v.end(); vi++)
            os << " " << *vi;
    }
    return os;
}

void insertion_sort(vector<int> &data)
{
    cout << data << endl;

    for (int i = 1; i < data.size(); i++) {
        int key = data[i];
        int j = i - 1;
        for (; j >= 0 && data[j] > key; j--)
            data[j + 1] = data[j];
        data[j + 1] = key;

        cout << data << endl;
    }
}

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

    vector<int> data(n);

    for (int x, i = 0; i < n; i++) {
        cin >> x;
        data[i] = x;
    }
    insertion_sort(data);

    return 0;
}

Measured memory_bytes: 1196
main = interact $ unlines . map (show' . era_name . words) . lines
 where show' = maybe "pre-meiji" unwords

era_name [y,m,d]
 | ymd < "1868 9 8" = Nothing
 | ymd < "1912 730" = Just ["meiji", show ((read y)-1867), m, d]
 | ymd < "19261225" = Just ["taisho", show ((read y)-1911), m, d]
 | ymd < "1989 1 8" = Just ["showa", show ((read y)-1925), m, d]
 | otherwise = Just ["heisei", show ((read y)-1988), m, d]
 where
  ymd = concat [justifyr 4 y, justifyr 2 m, justifyr 2 d]
  justifyr n = reverse . take n . (++ (replicate n ' ')) . reverse

Measured memory_bytes: 3696
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if(n == 1) {
        cout << -1 << " " << -1;
    } else {
        for(int i = 0; i < n - 1; i++) {
            if(s[i] == s[i + 1]) {
                cout << i + 1 << " " << i + 2;
                return 0;
            } else {
                if(i < n - 2 && s[i] == s[i + 2]) {

                    cout << i + 1 << " " << i + 3;
                    return 0;
                }

            }
        }
    }
    cout << -1 << " " << -1;
    return 0;
}


Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;
import java.util.ArrayList;

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

    static class BCardGameForTwo {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            List<Integer> a = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                a.add(Integer.parseInt(in.next()));
            }
            a.sort(Comparator.comparingInt(c -> -c));

            int count = 0;
            for (int i = 0; i < n; i++) {
                if (i % 2 == 0) {
                    count += a.get(i);
                } else {
                    count -= a.get(i);
                }
            }
            out.println(count);
        }

    }
}



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


int main()
{
    ll k;
    cin >> k;
    int x,n;
    cin >> x >> n;
    vector<int> to(n);
    for(ll i = 0; i < n; ++i) to[i] = (i*i) % n;

    vector<int> seen(n,-1);
    vector<int> path(n);
    int s;
    int cur = x;
    int sz = 0;
    for(;;sz++) {
        if(seen[cur] != -1) {
            s = seen[cur];
            break;
        }
        else {
            seen[cur] = sz;
            path[sz] = cur;
            cur = to[cur];
        }
    }

    ll res = 0;
    if(k <= s) {
        rep(i,k) res += path[i];
        cout << res << endl;
    }
    else {
        rep(i,s) res += path[i];
        k = k - s;
        ll sum = 0;
        ll h = k / (sz-s);
        for(int i = s; i < sz; ++i) sum += path[i];
        res += (sum * h);
        ll w = k % (sz-s);
        for(int i = s; i < s + w; ++i) res += path[i];
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 4548
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class E { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		var A = GetLongs(N);

		var dp = new long[N + 1, N + 1];
		for(long i = 0; i <= N; i++)
		{
			for(long j = 0; j <= N; j++)
				dp[i, j] = long.MinValue / 2;
		}
		dp[0, 0] = 0;

		var list = A.Select((x, i) => (x, i)).ToList();
		list.Sort((x, y) => y.Item1.CompareTo(x.Item1));
		for(long i = 0; i < N; i++)
		{
			long pi = list[(int)i].Item2;
			for(long l = 0; l <= i; l++)
			{
				long r = i - l;
				chmax(ref dp[i + 1, l + 1], dp[i, l] + (pi - l) * A[pi]);
				chmax(ref dp[i + 1, l], dp[i, l] + ((N - r - 1) - pi) * A[pi]);
			}
		}

		long ans = 0;
		for(long i = 0; i <= N; i++)
			chmax(ref ans, dp[N, i]);

		WriteLine(ans);
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 59912
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<ext/pb_ds/priority_queue.hpp>
using namespace std;

typedef long long LL;

LL mi[66],A,B,l1,r1,l2,r2,Ans;

void Solve()
{
	int r,k = -1; LL now = 1;
	for (int i = 0; i <= 60; i++,now <<= 1LL)
	{
		LL x = A & now,y = B & now;
		if (x != y) r = i; mi[i] = now;
	}
	for (int i = 60; i > r; i--)
	{
		if (A >= mi[i]) A -= mi[i];
		if (B >= mi[i]) B -= mi[i];
	}
	Ans = mi[r] - A;
	for (int i = 0; i < r; i++)
	{
		LL now = B & mi[i];
		if (now) k = i;
	}
	l1 = mi[r]; r1 = mi[r] + mi[k + 1] - 1LL;
	l2 = mi[r] + A; r2 = mi[r + 1] - 1LL;
	if (r1 >= l2)
	{
		Ans += r2 - l1 + 1LL;
	}
	else
	{
		Ans += r1 - l1 + 1LL;
		Ans += r2 - l2 + 1LL;
	}
	cout << Ans << endl;
}

int main()
{
	#ifdef DMC
		freopen("DMC.txt","r",stdin);
	#endif
	
	cin >> A >> B;
	if (A == B) cout << 1 << endl;
	else Solve();
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int x, y;
    bool ans = false;
    cin >> x >> y;
    for (int i = 0; i <= x; i++) {
        if ((i * 4 + (x - i) * 2) == y) {
            ans = true;
            break;
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
"use strict";
    
const main = arg => {
    const N = parseInt(arg.split("\n")[0].split(" ")[0]);
    const M = parseInt(arg.split("\n")[0].split(" ")[1]);
    
    const path = arg.split("\n").slice(1, M + 1);
    const map = new Array(N).fill(0);
    path.forEach(v => {
        let a = parseInt(v.split(' ')[0]) - 1;
        let b = parseInt(v.split(' ')[1]) - 1;
        map[a]++;
        map[b]++;
    })
    map.forEach(v => console.log(v));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
	int x, y;
	while(1){
		cin >> x >> y;
		if(x==0 && y == 0) break;
		else{
			if(x < y){
				cout << x << " " << y << endl;
			}
			else{
				cout << y << " " << x << endl;
			}
		}
	
	}
		
	return 0;
}


Measured memory_bytes: 2988
# C - Peaks

N, M = map(int, input().split())
H = [int(h) for h in input().split()]

mapping = [[] for _ in range(N)]
for _ in range(M):
    i, j = map(int, input().split())
    mapping[i - 1].append(j - 1)
    mapping[j - 1].append(i - 1)

cnt = 0
for i in range(N):
    ls = mapping[i]
    for j in ls:
        if H[i] <= H[j]:
            break
    else:
        cnt += 1

print(cnt)

Measured memory_bytes: 29432
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<iterator>
using namespace std;
typedef long long ll;
int main()
{
    ll num,n,a,vis[109],box,box1;
    cin>>num>>n;
    for(int i=0;i<=102;i++) vis[i]=0;
    for(int i=0;i<n;i++){
        cin>>a;
        vis[a]=1;
    }
    for(int i=num;i<=101;i++){
        if(vis[i]==0){
            box=i;
            break;
        }
    }
    for(int i=num;i>=0;i--){
        if(vis[i]==0){
            box1=i;
            break;
        }
    }
    //cout<<box
    if(abs(num-box)>abs(num-box1)) cout<<box1<<endl;
    if(abs(num-box)<abs(num-box1)) cout<<box<<endl;
    if(abs(num-box)==abs(num-box1)) cout<<min(box1,box)<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main()
{
    int n,con=0,a[110]={0};
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%2==0&&a[i]%3&&a[i]%5)
        {
            con=1;
            break;
        }
    }
    if(con==1)
        printf("DENIED");
    else
        printf("APPROVED");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll SORT(int n, vector<pair<ll, ll>> &v, int start){
  sort(v.begin()+start, v.end());
  return v[n-1].first;
}


int main(void){
 
  ll n,m;
  cin>>n>>m;

  cout<<(n-1)*(m-1) <<endl;

  return 0;

}

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

int main() {
	int n,m;
  	cin>>n>>m;
  
  int WA[105000];

  bool ch[105000];
  
  int num;
  string res;
  int ans=0;
  int wrong=0;

  
  rep(i,n){
    WA[i]=0;
    ch[i]=false;
  }
  rep(j,m){
  cin>>num>>res;
    

    if(ch[num]==false&&res=="WA"){
    	WA[num]++;
    }
    else if(ch[num]==false&&res=="AC"){
 
    	ans++;
      	ch[num]=true;
      	wrong+=WA[num];
    }

    
  }
               
    cout<<ans<<" "<<wrong<<endl;

  	
}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  vector <vector <ll>> v(3, vector <ll> (3));
  rep(i, 3) {
    rep(j, 3) {
      cin >> v.at(i).at(j);
    }
  }
  ll n;
  cin >> n;
  rep(i, n) {
    ll a;
    cin >> a;
    rep(j, 3) {
      rep(k, 3) {
        if (a == v.at(j).at(k)) v.at(j).at(k) = 0;
      }
    }
  }
  string ans = "No";
  rep(i, 3) {
    if (v.at(i).at(0)==0 && v.at(i).at(1)==0 && v.at(i).at(2)==0) ans = "Yes";
  }
  rep(i, 3) {
    if (v.at(0).at(i)==0 && v.at(1).at(i)==0 && v.at(2).at(i)==0) ans = "Yes";
  }
  if (v.at(0).at(0)==0 && v.at(1).at(1)==0 && v.at(2).at(2)==0) ans = "Yes";
  if (v.at(0).at(2)==0 && v.at(1).at(1)==0 && v.at(2).at(0)==0) ans = "Yes";
  cout << ans << endl;
}

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

int main(){
  int year = 0;
  ll money = 100;
  ll X;
  cin >> X;
  while (money < X){
    money += money/100;
    year++;
  }
  
  cout << year << endl;
  
}  

Measured memory_bytes: 3636
N = int(input())
A = [''] * (2 * N)
temp = []

def take(i):
	T = input()
	if T == 'Blue':
		A[i] = 'B'
	elif T == 'Red':
		A[i] = 'R'
	else:
		exit()

L = 0
R = N
print('?'," ".join(str(k+1) for k in range(L, L + N)),flush = True)
take(L)

while R-L > 1:
	mid = int((R+L)/2)
	print('?'," ".join(str(k+1) for k in range(mid,mid + N)),flush = True)
	take(mid)
	if A[mid] == A[L]:
		L = mid
	else:
		R = mid

for i in range(0, R-1):
	print('?'," ".join(str(k+1) for k in range(L+1, L + N)),i+1,flush = True)
	take(i)
	temp += [i]

for i in range(R + N, 2 * N):
	print('?'," ".join(str(k+1) for k in range(R, R + N - 1)),i+1,flush = True)
	take(i)
	temp += [i]

for i in range(R, R + N):
	print('?'," ".join(str(k+1) for k in temp),i+1,flush = True)
	take(i)

print('!',"".join(A),flush = True)
exit()

Measured memory_bytes: 3532
S = input()
l = len(S)

flag = True

S_r = S[::-1]

if S != S_r:
    flag = False


s_a = ""
for i in range((l-1)//2):
    s_a += S[i]

s_a_r = s_a[::-1]

if s_a != s_a_r:
    flag = False

s_b = ""
for i in range((l+2)//2,l):
    s_b += S[i]
s_b_r = s_b[::-1]

if s_b != s_b_r:
    flag = False

if flag:
    print("Yes")

else:
    print("No")


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

using namespace std;

vector<vector<int>> G(110);
bool used[110];
int incnt[110];
double nebou[110];

void dfs(int p){
    int vs = G[p].size();
    int i;
    for(i = 0; i < vs;i++){
        if(used[G[p][i]]) continue;
        used[G[p][i]] = 1;
        dfs(G[p][i]);
    }
    return;
}

double dfs_heiro(int p,double ret){
    ret *= nebou[p];
    int vs = G[p].size();
    int i;
    for(i = 0; i < vs; i++) {
        if(used[G[p][i]]) continue;
        used[G[p][i]] = 1;
        ret *= dfs_heiro(G[p][i], 1.0);
    }
    return ret;
}

int main() {
    int N,i,j,k;
    while(cin >> N,N){
        for(i = 0; i < 110;i++){
            G[i].clear();
            used[i] = 0;
            nebou[i] = 0.0;
            incnt[i] = 0;
        }
        double ret = 1.0;
        for(i = 1; i <= N; i++) {
            cin >> nebou[i];
            cin >> j;
            for(k = 0; k < j;k++){
                int to;
                cin >> to;
                G[i].push_back(to);
                incnt[to]++;
            }
        }
        for(i = 1; i <= N;i++){
            if(incnt[i]==0){
                used[i] = 1;
                ret *= (1.0 - nebou[i]);
                dfs(i);
            }
        }
        for(i = 1; i <= N;i++){
            int vs = G[i].size();
            if(used[i] == 0 && vs==0){
                used[i] = 1;
            }
        }
        for(i = 1; i <= N;i++){
            if(used[i]==0){
                used[i] = 1;
                ret *= (1.0-dfs_heiro(i, 1.0));
            }
        }
        printf("%.8f\n", ret);
    }
    return 0;
}


Measured memory_bytes: 3324
using System;

namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var orderSum = int.Parse(Console.ReadLine());
            for (int i = 0; i < orderSum; i++) {
                var line = Console.ReadLine().Split(' ');
                if (line[0] == "print") {
                    var a = int.Parse(line[1]);
                    var b = int.Parse(line[2]);
                    Console.WriteLine(str.Substring(a, b -a + 1));
                } else if (line[0] == "reverse") {
                    var a = int.Parse(line[1]);
                    var b = int.Parse(line[2]);
                    var charArray = str.ToCharArray();
                    for (int j = 0; j < (b - a + 1) / 2; j++) {
                        var temp = charArray[a + j];
                        charArray[a + j] = charArray[b - j];
                        charArray[b - j] = temp;
                    }
                    str = new string(charArray);
                } else if (line[0] == "replace") {
                    var a = int.Parse(line[1]);
                    var b = int.Parse(line[2]);
                    var p = line[3].ToCharArray();
                    var charArray = str.ToCharArray();
                    for (int j = 0; j < (b - a + 1); j++) {
                        charArray[a + j] = p[j];
                    }
                    str = new string(charArray);
                }
            }
        }
    }
}



Measured memory_bytes: 17932
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun


#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")


int main() {
	int h, a;
	cin >> h >> a;
	PRI((h + a - 1) / a);
	return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

public class Main
{

  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready())
    {
      double num = Double.valueOf(input.readLine());
      if (num < 0)
      {
        break;
      }
      MathContext mc = new MathContext(7, RoundingMode.HALF_DOWN);
      //BigDecimal ans = new BigDecimal(getThirdRoot(num, num / 2)).round(mc);
      BigDecimal ans = new BigDecimal(getThirdRoot(num, num / 2)).setScale(6,
          RoundingMode.HALF_DOWN);
      System.out.println(ans.toPlainString());
    }

  }

  private static double getThirdRoot(double q, double x)
  {
    if (Math.abs(Math.pow(x, 3) - q) < 0.00001 * q)
    {
      return x;
    }

    return getThirdRoot(q, x - ((Math.pow(x, 3) - q) / (3 * Math.pow(x, 2))));

  }

}

Measured memory_bytes: 24752
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    ll A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    rep(i, N) {
        ll t = i * C - ll(N - 1 - i) * D;
        ll u = i * D - ll(N - 1 - i) * C;
        if (min(t, u) <= B - A && B - A <= max(t, u)) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input){
	input = input.split("\n");
  var arr = input[1].split(" ").map(Number);
  arr = arr.sort(function(a,b){return b-a;});
  var n=0,m=0;
  for(var i=0;i<arr.length;i++){
    if(i%2==0){
      n += arr[i];
    }else{
      m += arr[i];
    }
  }
  console.log(n-m);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 19656
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>
#include <stack>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int a,b;
  cin >> a>> b;
  char c='x';
  if (a+b==15)c='+';
  if (a*b==15)c='*';
  cout << c << endl;

  return 0;
}








Measured memory_bytes: 888
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

// author:Swastik Banerjee

using namespace std;

typedef long long ll;
#define MOD 1000000007

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



  string a, b;
  cin >> a >> b;
  int x, y;
  cin >> x >> y;

  string z;
  cin >> z;

  if (z == a)
    x--;
  else if (z == b)
    y--;

  cout << x << " " << y;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

signed main() {
  string S; cin >> S;
  
  while(S.size()>=5) {
    if(S.substr(S.size()-5) == "dream") S.erase(S.size()-5, 5);
    else if(S.substr(S.size()-5) == "erase") S.erase(S.size()-5, 5);
    else if(S.substr(S.size()-6) == "eraser") S.erase(S.size()-6, 6);
    else if(S.substr(S.size()-7) == "dreamer") S.erase(S.size()-7, 7);
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  
  if(S.size() == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int main(){
    char ch[1000];


    while(1){
        scanf("%s", ch);
        int sum = 0;
        if(ch[0] == '0'){
            break;
        }

        for(int i = 0; i < strlen(ch); i++){
            sum += ch[i] - '0';
        }
        printf("%d\n", sum);
        
        
    }
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }


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

  cout << (x - a) % b << endl; 
}


Measured memory_bytes: 256
#!/usr/bin/perl
my ($n,$k,$q) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @p = ();
$#p = ($n - 1);

for(my $i=0;$i<$q;$i++){
  my ($a) = map { $_ - 0 } split(/\s+/,<STDIN>);
  $p[$a - 1] ++;
}

for(my $i=0;$i<$n;$i++){
  if( $k - $q + $p[$i] > 0 ){
    print "Yes\n";
  } else {
    print "No\n";
  }
}



Measured memory_bytes: 3072
#!/usr/bin/env python3
import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    U = next(tokens)  # type: str
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    vll a(3);
    ll a4, n; 
    rep(i, 3) cin >> a[i];
    cin >> a4 >> n;
    a[0] *= 4;
    a[1] *= 2;
    sort(all(a));

    ll ans = (n % 2 == 0) ? 0 : a[0];
    
    ll cost = min(a[0] * 2, a4);
    ans += (n / 2) * cost;
    cout << ans << endl;

    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    double A,B,T;
    cin >> A >> B >> T;

    T += 0.5;
    int time = A;
    int ans = 0;
    while( time <= T )
    {
        time += A;
        ans += B;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256