akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    long long k;
    cin >> n >> k;
    long long tmp2 = 0;
    vector<int> a(n+1);
    vector<long long> t(n+1,-1);
    //vector<int> A;
    int answer = 1;
    for(int i = 0;i<n;i++){
        cin >> a.at(i+1);
    }
    //A.push_back(1);
    long long loop = 1;
    t.at(1) = 0;
    for(long long u = 0;; u++){
        //A.push_back(a.at(A.at(u)));
        answer = a.at(answer);
        if(t.at(answer) != -1){
            loop = u-t.at(answer)+1;
            tmp2 = t.at(answer);
            break;
        }
        t.at(answer) = u+1;
       
    }

    // for(long long t = 0;t<k;t++){
    //     A.push_back(a.at(A.at(t)-1));
    //     if(A.at(t+1) == 1){
    //         j = t;
    //         break;
    //     }
    // }

    long long tmp;
    if(k > tmp2 + loop){
       tmp  = tmp2 + (k-tmp2)%loop;
    }else {
        tmp = k;
    }
    answer = 1;
    for(long long i = 0;i<tmp;i++){
        answer = a.at(answer);
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
int main(void) {
  int a,b,c,k,l;
  cin >> a >> b >> c;
  cin >> k;
  l = max({a,b,c});
  int  h = a + b + c - l;
  for(int i=0;i<k;++i) l = l * 2;
  cout << l + h << endl;
}



Measured memory_bytes: 256
"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const n = Number(spi[0]);

    const map = new Map();
    for (let i = 1; i < n + 1; i++) {
        if (map.has(spi[i]))
            map.set(spi[i], map.get(spi[i]) + 1);
        else 
            map.set(spi[i], 0);
    }
    console.log(map.size);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 60380
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		double x1 =scan.nextDouble();
		double y1 =scan.nextDouble();
		double x2 =scan.nextDouble();
		double y2 =scan.nextDouble();
		double keisan =0.0;
		//?????????????????¢??????(X2-X1)2??? ??? (Y2-Y1)2???
		keisan = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
		System.out.println(keisan);
	}
}

Measured memory_bytes: 28032
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
            System.out.println(0);
            return;
        }

        if (a == b && b == c) {
            System.out.println(-1);
            return;
        }

        int ans = 0;

        while (true) {
            ans++;
            int nA = b / 2 + c / 2;
            int nB = a / 2 + c / 2;
            int nC = a / 2 + b / 2;
            if (nA % 2 == 1 || nB % 2 == 1 || nC % 2 == 1) {
                System.out.println(ans);
                return;
            }
            a = nA;
            b = nB;
            c = nC;
        }
    }
}

Measured memory_bytes: 23252
# coding: utf-8
import sys
from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import combinations, product
#import bisect# lower_bound etc
#import numpy as np
#import queue# queue,get(), queue.put()
def run():
    N = int(input())
    current = 0
    ways = []
    dic = {'(': 1, ')': -1}
    SS = read().split()

    for S in SS:
        path = [0]
        for s in S:
            path.append(path[-1]+ dic[s])
        ways.append((path[-1], min(path)))

    ways_pos = sorted([(a,b) for a,b in ways if a >= 0], key = lambda x:x[1], reverse=True)
    ways_neg = sorted([(a,b) for a,b in ways if a < 0], key = lambda x:(x[0] - x[1]), reverse=True)

    idx = list(range(len(ways_pos)))



    for go, max_depth in ways_pos:
        if current + max_depth >= 0:
            current += go
        else:
            print("No")
            return None


    tmp =[]
    for go, max_depth in ways_neg:
        if current + max_depth >= 0:
            current += go
        else:
            tmp.append((go, max_depth))

    for go, max_depth in tmp:
        if current + max_depth >= 0:
            current += go
        else:
            print('No')
            return None


    if current == 0:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    run()

Measured memory_bytes: 183288
// AOJ ALDS1_2_C Stable Sort
// 2018.4.27 bal4u
 
#include <stdio.h>
#include <string.h>
 
typedef struct { char c; int a; int id; } DATA;
 
void bubble_sort(int n, DATA *a)
{
    int i, f;
    DATA x;
 
    do {
        f = 0;
        for (i = n-1; i > 0; i--) {
            if (a[i].a < a[i-1].a) {
                x = a[i], a[i] = a[i-1], a[i-1] = x;
                f = 1;
            }
        }
    } while (f);
}
 
void selection_sort(int n, DATA *a)
{
    int i, j, minj;
    DATA x;
 
    for (i = 0; i < n; i++) {
        minj = i;
        for (j = i; j < n; j++) {
            if (a[j].a < a[minj].a) minj = j;
        }
        if (i != minj) {
            x = a[i], a[i] = a[minj], a[minj] = x;
        }
    }
}
 
 
//#define getchar_unlocked()  getchar()
int in()
{
    int n = 0, c = getchar_unlocked();
    do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
    return n;
}
 
DATA a[102], b[102];
 
int main()
{
    int N, i, f;
 
    N = in();
    for (i = 0; i < N; i++) {
        a[i].c = getchar_unlocked();
        a[i].a = getchar_unlocked();
        a[i].id = i;
        getchar_unlocked();         // skip
    }
    memcpy(b, a, sizeof(DATA)*N);
 
    bubble_sort(N, a);
    f = 0;
    putchar(a[0].c), putchar(a[0].a);
    for (i = 1; i < N; i++) {
        putchar(' ');
        putchar(a[i].c), putchar(a[i].a);
        if (a[i-1].a == a[i].a && a[i-1].id > a[i].id) f = 1;
    }
    putchar('\n');
    puts(f? "Not stable": "Stable");
 
    selection_sort(N, b);
    f = 0;
    putchar(b[0].c), putchar(b[0].a);
    for (i = 1; i < N; i++) {
        putchar(' ');
        putchar(b[i].c), putchar(b[i].a);
        if (b[i-1].a == b[i].a && b[i-1].id > b[i].id) f = 1;
    }
    putchar('\n');
    puts(f? "Not stable": "Stable");
    return 0;
}


Measured memory_bytes: 2056
*D, = open(0)

count = 0
right_a = 0
left_b = 0
b_middle_a = 0
for it in D[1:]:
    s = it.strip()
    count += s.count('AB')
    if s[0]=='B' and s[-1]=='A':
        b_middle_a += 1
    elif s[0] == 'B':
        left_b += 1
    elif s[-1]=='A':
        right_a+=1
    
# calculate BxxxA
if b_middle_a > 1:
    count+= (b_middle_a-1)
    b_middle_a = 1


for i in range(b_middle_a):
    if left_b >0:
        left_b-=1
        count +=1
    if right_a >0:
        right_a -= 1
        count +=1

# calculate rest
count += min(right_a, left_b)
print(count)

Measured memory_bytes: 3700
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            char[] S = input.ToCharArray();

            for(int x = 0; x < input.Length; x++)
            {
                if(x % 2 == 0)
                {
                    Console.Write(S[x]);
                }
            }
        }
    }
}

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

typedef long long ll;

int main(){
    //freopen("in.txt","r",stdin);
    int n;
    cin>>n;
    ll ans = 0;
    for(int i=1; i<=n; i++){
        if((i%3 != 0) && (i%5 != 0)){
            ans += i;
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3632
while (a = gets.to_i) != 0
  b = gets.to_i
  c = gets.to_i
  d = gets.to_i
  e = gets.to_i
  five= [a,b,c,d,e]
  kinds = [false,false,false]
  five.each {|i| kinds[i-1] = true}
  count = 0
  kinds.each {|bool| count += 1 if bool}

  if count == 1 || count == 3
    puts [3]*5
    next
  end

  if kinds[0] == false # チョキ・パー
    win = 2
  elsif kinds[1] == false # グー・パー
    win = 3
  else # グー・チョキ
    win = 1
  end

  0.upto(4) {|i| puts five[i] == win ? 1 : 2 }

end

Measured memory_bytes: 8668
n=int(input())
p=list(map(int,input().split()))
q=[]
r=[]
for i in range(n):
  q.append([p[i],i+1])
q.sort()
for i in range(n):
  r.append(q[i][1])
res=map(str,r)
t=' '.join(res)
print(t)

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	cout<<max({a+b,a-b,a*b})<<endl;
	return 0;
}


Measured memory_bytes: 256
#include "stdlib.h"

void main( void )
{
	int taka_hp,taka_at,ao_hp,ao_at;
	int is_taka_lose = 0;
	int is_ao_lose = 0;
	
	// attack 高橋君→青木君→高橋君
	
	scanf( "%d", &taka_hp );
	scanf( "%d", &taka_at );
	
	scanf( "%d", &ao_hp );
	scanf( "%d", &ao_at );
	
	while( 1 )
	{
		ao_hp = ao_hp - taka_at;
		if( ao_hp <= 0 )
		{
			is_ao_lose = 1;
			break;
		}
		
		taka_hp = taka_hp - ao_at;
		if( taka_hp <= 0 )
		{
			is_taka_lose = 1;
			break;
		}
	}
	
	if( is_taka_lose == 0 )
	{
	    printf( "Yes" );
	} else {
	    printf( "No" );
	}
	
	return;
}


Measured memory_bytes: 1724
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
    int H, W, K, i, j, k, l, sum, sc;
    char **masu, **masu2;
    int *nishin;

    sc = scanf("%d %d %d", &H, &W, &K);

    /*malloc--------------------------------------*/
    masu = (char **)malloc(sizeof(char *) * H);
    masu2 = (char **)malloc(sizeof(char *) * H);
    for(i = 0; i < H; i++) masu[i] = (char *)malloc(sizeof(char) * W);
    for(i = 0; i < H; i++) masu2[i] = (char *)malloc(sizeof(char) * W);
    nishin = (int *)malloc(sizeof(int) * (int)pow(2,H+W));
    /*malloc--------------------------------------*/

    for(i = 0; i < H; i++) sc = scanf("%s", masu[i]);

    for(i = 0; i < (int)pow(2,H+W); i++) nishin[i] = i;

    int cnt = 0;

    for(k = 0; k < (int)pow(2,H+W); k++){
        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                masu2[i][j] = masu[i][j];
            }
        }

        for(l = 0; l < H; l++){
            if((nishin[k] % 2) == 1){
                for(j = 0; j < W; j++){
                    masu2[l][j] = '.';
                }
            }
            nishin[k] /= 2;
        }

        for(l = 0; l < W; l++){
            if((nishin[k] % 2) == 1){
                for(i = 0; i < H; i++){
                    masu2[i][l] = '.';
                }
            }
            nishin[k] /= 2;
        }

        sum = 0;

        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                if(masu2[i][j] == '#') sum++;
            }
        }

        if(sum == K) cnt++;
    }

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

    /*free--------------------------------------*/
    free(nishin);
    for(i = H-1; i >= 0; i--) free(masu2[i]);
    for(i = H-1; i >= 0; i--) free(masu[i]);
    free(masu2);
    free(masu);
    /*free--------------------------------------*/

    return 0;
}

Measured memory_bytes: 2476
#include<stdio.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
int main(){
	int w,h,n,x[102],y[102],a[102];
	scanf("%d %d %d",&w,&h,&n);

	int tbl[w][h];
	FOR(i,0,w) FOR(j,0,h) tbl[i][j] = 0;

	FOR(i,0,n){
		scanf("%d %d %d",&x[i],&y[i],&a[i]);
		if(a[i] == 1) FOR(k,0,x[i]) FOR(j,0,h) 	  tbl[k][j] = 1;
		if(a[i] == 2) FOR(k,x[i],w) FOR(j,0,h) 	  tbl[k][j] = 1;
		if(a[i] == 3) FOR(k,0,w)    FOR(j,0,y[i]) tbl[k][j] = 1;
		if(a[i] == 4) FOR(k,0,w)    FOR(j,y[i],h) tbl[k][j] = 1;
	}

	int ans = 0;
	FOR(i,0,w) FOR(j,0,h) if(tbl[i][j] == 0) ans++;
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        mut s: [u64;3]
    }
    s.sort();
    println!("{}", if s[0]==5&&s[1]==5&&s[2]==7 {"YES"} else {"NO"});
}


Measured memory_bytes: 4352
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
 
#include <stdio.h>
#include <bits/stdc++.h>
 
using namespace std;
 
#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  
#define pb push_back
#define mp make_pair
#define in insert
#define f first
#define s second
#define ll long long
#define dd double
  
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;

int a[N]; 

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
	int n, m, sum = 0, cnt = 0;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	for (int i = 0; i < n; i++) {
		if (4*m*a[i] >= sum) cnt++;
	}

	if (cnt >= m) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"os"
)

func main() {
	var num int
	_, err := fmt.Fscanf(os.Stdin, "%d", &num)
	if err != nil {
		panic(err)
	}

	categories := make([]int, 8)
	wildcard := 0
	for i := 0; i < num; i++ {
		var n int
		_, err = fmt.Fscanf(os.Stdin, "%d", &n)
		if err != nil {
			panic(err)
		}

		if 3200 < n && n <= 4800 {
			n = 3200
		}

		cat := int(n / 400)
		if cat < 8 {
			categories[cat]++
		} else {
			wildcard++
		}
	}

	min, max := 0, 0
	for _, v := range categories {
		if v > 0 {
			min++
		}
	}
	max = min + wildcard
	if wildcard > 0 && min == 0 {
		min = 1
	}
	fmt.Printf("%d %d", min, max)
}


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

int main(){
  int H,W; cin >> H >> W;
  string A[10];
  for(int i=1; i<=H; i++){
    cin >> A[i];
    A[i]="."+A[i]+".";
  }
  string add="";
  for(int i=0; i<W+2; i++) add+=".";
  A[0]=A[H+1]=add;
  
  int px=1, py=1;
  while(!(px==W&&py==H)){
    if(A[py][px+1]=='#'&&A[py][px-1]=='.'&&
       A[py-1][px]=='.'&&A[py+1][px]=='.'){
      A[py][px]='.';
      px++;
    }else if(A[py][px+1]=='.'&&A[py][px-1]=='.'&&
       A[py-1][px]=='.'&&A[py+1][px]=='#'){
      A[py][px]='.';
      py++;
    }else{
      break;
    }
  }
  cout << ((px==W&&py==H&&A[py][px-1]=='.'&&
       A[py-1][px]=='.')?"Possible":"Impossible") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  string s;
  cin >> s;
  rep (i, s.length ())
  {
    cout << 'x';
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   string L;
   cin >> L;
   int length = (int)L.size();

   ll ans = 0;
   int cnt = 0;
   for (int i = 0; i < length; i++) {
      if (L[i] == '1') {
         int tmp = length - 1 - i;
         ll tmp2 = llmodpow(2, cnt);
         tmp2 %= MOD;
         tmp2 *= llmodpow(3, tmp);
         tmp2 %= MOD;
         add(ans, tmp2);
         cnt++;
      }
   }
   add(ans, llmodpow(2, cnt));
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 512
#include<iostream>

using namespace std;

#define ll long long

int main(){
    ll n, u, k, v;
    cin >> n;
    ll A[n][n];
    for (ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            A[i][j] = 0;
        }
    }
    for(ll i=0; i<n; i++){
        cin >> u;
        cin >> k;
        for(ll j=0; j<k; j++){
            cin >> v;
            A[u-1][v-1] = 1;
        }
    }

    for (ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            cout << A[i][j];
            if(j<n-1){
                cout << ' ';
            }
        }
        cout << '\n';
        
    }
}

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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
ll arr[45];
int main()
{
	ll n, k;
	cin>>n>>k;
	vector<ll> v(n);
	rep(i, 0, n)
	{
		ll x;
		cin>>x;
		v[i] =x;
		for(ll i = 0; i<= 40; i++)
		{
			if((x & (1LL << i)) != 0)
			{
				arr[i]++;
			}
		}
	}
	ll curr = 0;
	ll ans = 0;
	repb(i, 40, 0)
	{
		ll cnt = arr[i];
		if(((curr + (1LL << i)) <= k) && (cnt < ceil(n / 2.0)))
		{
			curr += (1LL << i);
			//cout<<i<<" "<<curr<<endl;
		}
	}
	//cout<<curr<<endl;
	rep(i, 0, n)
	{
		ans += (curr ^ v[i]);
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 998244353
#define INT_MAX1 900000000
#define MAXN 1000000
#define INF INT_MAX



void solve()
{
    int l;
    cin >> l;
    double a = (double)l/(double)3;
    cout << setprecision(25) << a*a*a << endl;   
}

signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/


signed main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	rep(i, n - 1) {
		int ma = a + d * i - c * (n - 1 - i);
		int mi = a + c * i - d * (n - 1 - i);
		if (ma >= b && mi <= b) {
			cout << "YES" << endl; return 0;
		}
	}
	cout << "NO" << endl;
}

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

int main() {
	int n;
	cin >> n;
	vector < int > a (n);
	for (int & x : a) {
		scanf ("%d", &x);
	}
	vector < int > counts (n + 1);
	for (int x : a) {
		counts[x]++;
	}
	ll sum = 0LL;
	for (int count : counts) {
		sum += (ll) count * (count - 1) / 2;
	}
	for (int i = 0; i < n; i++) {
		cout << (sum - ((ll) counts[a[i]] - 1)) << endl;
	}
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  vecint cnt(n+1);
  REP(i,n-1) {
    int a;
    cin>>a;
    ++cnt[a];
  }
  REP(i,n) {
    cout<<cnt[i+1]<<"\n";
  }
  return 0;
}


Measured memory_bytes: 3976
#include<iostream>
#include<map>
using namespace std;main(){for(int N,M,h[1500],w[1500],i,j,t,a;cin>>N>>M,N;cout<<a<<endl){map<int,int>m;for(i=N;i-->0;)cin>>h[i];for(;++i<M;)cin>>w[i];for(i=0;i<N;)for(t=0,j=i++;j<N;m[t]++)t+=h[j++];for(i=a=0;i<M;)for(t=0,j=i++;j<M;m.count(t)&&(a+=m[t]))t+=w[j++];}}

Measured memory_bytes: 9868
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

// #define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;

using P = pair<int, int>;

struct UnionFind {
vector<int> d;
UnionFind(int n): d(n, -1) {}
int root(int x) {
if(d[x] < 0) return x;
return d[x] = root(d[x]);
}
bool unite(int x, int y) {
x = root(x); y = root(y);
if(x == y) return false;
if(d[x] > d[y]) swap(x, y);
d[x] += d[y];
d[y] = x;
return true;
}
bool same(int x, int y) {return (root(x) == root(y));}
int size(int x) {return -d[root(x)];}
};

vector<int> to[100005];
int frie[100005];
signed main(){
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i, m) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        frie[a]++;
        frie[b]++;
        uf.unite(a, b);
    }

    rep(i, k) {
        int c, d;
        cin >> c >> d;
        --c; --d;

        to[c].push_back(d);
        to[d].push_back(c);
    }

    rep(i, n) {
        int ans = uf.size(i)-1-frie[i];
        int aaa = ans;
        for(int u: to[i]) {
            if(uf.same(i, u)) --ans;
        }
        cout << ans<<" " << flush;
    }
    cout << "" << endl;
    return 0;
}



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


int main() {
int n;
cin>>n;
vector<int>count(100001);
ll sum=0;
rep(i,n) {
int a;
cin>>a;
count[a]++;
sum+=a;
}
int q;
cin>>q;
rep(i,q)
{int b,c; cin>>b; cin>>c;
 ll sa=c-b;
 //sa*countを求める 
 sum+=sa*count[b];
 count[c]+=count[b];
 count[b]=0;
 
//cout<<i<<":"<<bigint_to_string(sum)<<endl;
cout<<sum<<endl;

}



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

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

//int calc (int num, int sum, int now, int pm ) {
//    if ( now < 3 ) {
//        return calc(num/10, sum+num%10, now+1, pm+(1<<(now))) + calc(num/10, sum-num%10, now+1, pm);
//    }
//    else {
//        cout << sum+num << " " << pm << endl;
//        //if ( sum+num == 7 ) cout << "test" << endl;  
//        return sum+num;
//    }
//}

int main() {
    string s;
    cin >> s;

    int keta = s.length();

//    cout << keta << endl;

//    int ans = calc(stoi(s), 0, 0, 0);

    int sum = 0;
    int tmp_i = 0;
    for ( int i = 0; i < (1<<keta-1); i++ ) {
        sum = stoi(s.substr(0,1));
        for ( int j = 0; j < keta-1; j++ ) {
            if ( i & (1<<j) ) {
                sum += stoi(s.substr(j+1,1));
            }
            else {
                sum -= stoi(s.substr(j+1,1));
            }
//            cout << sum << endl;
        }
        if ( sum == 7 ) {
            tmp_i = i;
        }
//        cout << sum << " " << i << endl;
    }

//    cout << tmp_i << endl;

    for ( int i = 0; i < keta - 1; i++ ) {
        cout << s.substr(i,1);
        if ( tmp_i & (1<<i) ) {
            cout << "+";
        }
        else {
            cout << "-";
        }
    }
    cout << s.substr(3,1) << "=7" << endl;

//    for ( int i = 0; i < 3; i++ ) {
//        cout << s.substr(i,1);
//        if ( ans & (1<<(3-i)) ) {
//            cout << "+";
//        }
//        else {
//            cout << "-";
//        }
//    }
//    cout << s.substr(3,1) << "=7" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
	
	public class Main {
	
		public static void main(String[] args) {
			// TODO Auto-generated method stub
			Scanner sc = new Scanner(System.in);
			
			for (;;){
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			int ans=0;
			if(op.equals("+")){
				ans=a+b;
			}else if(op.equals("-")){
				ans=a-b;
			}else if(op.equals("*")){
				ans=a*b;
			}else if(op.equals("/")){
				ans=a/b;
			}else{
				break;
			}
			System.out.println(ans);
			}
		}
	}

Measured memory_bytes: 26248
using System;
using System.Linq;

namespace AtCoderMake.ABC168
{
    class ABC168A
    {
        static void Main(string[] args)
        {
            var s = int.Parse(Console.ReadLine());
            if (s%10==3)
            {
                Console.WriteLine("bon");
            }
            else if(s%10==0||s%10==1||s%10==6||s%10==8)
            {
                Console.WriteLine("pon");
            }
            else 
            {
                Console.WriteLine("hon");
            }
        }
    }
}


Measured memory_bytes: 27480
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,ans,A,B,C,D,E,F;
  cin >> N;
  ans = 0;
  
  A = N%10;
  B = N%100;
  C = B/10;
  D = N%1000;
  E = D/100;
  F = N/1000;
  if (A == 2){
    ans++;
  }
  if (C == 2){
    ans++;
  }
  if (E == 2){
    ans++;
  }
  if (F == 2){
    ans++;
  }
 
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
class Dice {
public:
    int top, face[6];
    void East() {
        top = face[0];
        face[0] = face[3];
        face[3] = face[5];
        face[5] = face[2];
        face[2] = top;
    }
    void West() {
        top = face[0];
        face[0] = face[2];
        face[2] = face[5];
        face[5] = face[3];
        face[3] = top;
    }
    void North() {
        top = face[0];
        face[0] = face[1];
        face[1] = face[5];
        face[5] = face[4];
        face[4] = top;
    }
    void South() {
        top = face[0];
        face[0] = face[4];
        face[4] = face[5];
        face[5] = face[1];
        face[1] = top;
    }
};
 
int main() {
    int i;
    string o;
    Dice dice;
    for (i = 0; i<6; i++)
        cin >> dice.face[i];
    cin >> o;
    for (i = 0; i < o.length();i++){
        switch (o[i]) {
        case 'E':
            dice.East();
            break;
        case 'W':
            dice.West();
            break;
        case 'N':
            dice.North();
            break;
        case 'S':
            dice.South();
            break;
        }
    }
    cout << dice.face[0] << endl;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

int main(){
    int N; cin >> N;
    vector<int> X(N), Y(N);
    for(int i=0;i<N;i++){
        cin >> X[i];
        Y[i] = X[i];
    }
    sort(Y.begin(), Y.end());
    int Y1 = Y[N/2-1];
    int Y2 = Y[N/2];
    for(int i=0;i<N;i++){
        if(X[i] <= Y1) cout << Y2 << endl;
        else if(X[i] >= Y2) cout << Y1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3712
// problem: "https://atcoder.jp/contests/abc144/tasks/abc144_c"

#include<bits/stdc++.h>
#define ll long long

using namespace std;

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

    ll s = sqrt(n);
    m = LLONG_MAX;
    for(i=1;i<=s;i++)
        if(n%i == 0)
            m = min(m,i+n/i);

    cout<<m-2;

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, A: "List[int]"):
    sorted_list = list(reversed(sorted(A)))
    score = 0
    queue = deque()
    queue.append(sorted_list[0])
    cnt_map = {sorted_list[0]: 1}
    for i in range(1, len(sorted_list)):
        current_max = queue[0]
        score += current_max
        cnt_map[current_max] -= 1
        num = sorted_list[i]
        if num in cnt_map:
            cnt_map[num] += 2
        else:
            cnt_map[num] = 2
            queue.append(num)

        if cnt_map[current_max] == 0:
            queue.popleft()
    print(score)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 52584
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;

#define int long long
long long MOD = 998244353;

 long long dp1[301][90001], dp2[301][90001];
signed main(void){

    int N;
    cin >> N;

    int a[N];
    int sum=0;
    long long all=1;
    for(int i=0;i<N;i++){
        cin >> a[i];
        sum += a[i];
        all = (3*all) % MOD;
    }
    dp1[0][0] = dp2[0][0] = 1;

    for(int i=0;i<N;i++){
        for(int j=0;j<=sum;j++){
            if( a[i] <= j ){
                dp1[i+1][j] = (dp1[i][j-a[i]] + 2LL*dp1[i][j]) % MOD;
                dp2[i+1][j] = (dp2[i][j-a[i]] + dp2[i][j]) % MOD;
            }
            else{
                dp1[i+1][j] = 2LL*dp1[i][j] % MOD;
                dp2[i+1][j] = dp2[i][j] % MOD;
            }
        }
    }

    long long p1=0;
    for(int i=(sum+1)/2;i<=sum;i++){
        p1 = (p1 + dp1[N][i]) % MOD;
    }

    long long p2=0;
    if(sum%2 == 0){
        p2 = dp2[N][sum/2] % MOD;
    }

    long long ans = (all - 3LL*p1 + 3LL*p2) % MOD;

    while (ans < 0) {
        ans += MOD;
    }

    cout << ans << endl;
}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define MIN(x) *min_element(all(x))
#define MAX(x) *max_element(all(x))
#define in(x) cin >> x
#define co(x) cout << x
#define el  cout << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
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; }


int main() {
    LL a, b, temp, x, r, ans;
    cin >> a;
    cin >> b;
    if (a < b){
        temp = a;
        a = b;
        b = temp;
    }
    x = a * b;
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    ans = x / b;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        for(int i = 0; i < N; i++)
            a[i] = sc.nextInt();

        long answer = 0;
        for(int i = 1; i < N; i++) {
            if(a[i] >= a[i - 1])
                continue;
            else {
                answer += a[i - 1] - a[i];
                a[i] = a[i - 1];
            }
        }

        System.out.println(answer);
    }

}


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



int main(void){
  int x,a,b;
  cin >> x>>a>>b;
  if(a>=b){
    cout << "delicious" <<endl;
  }
  else if((b-a)>x){
    cout << "dangerous" <<endl;
  }
  else{
    cout << "safe" <<endl;
  }
}



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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

map<int,int> mp;

void GetPrimeFactors(int n) {
  // dived by 2, 3, 5, ...
  while(n%2 == 0) {
    ++mp[2];
    n /= 2;
  }
  for(int i=3; i*i<=n; i+=2) {
    while(n%i == 0) {
      ++mp[i];
      n /= i;
    }
  }
  if(n!=1) ++mp[n];
}

/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  for(int i = 2; i < n+1; ++i) {
    GetPrimeFactors(i);
  }
  int ans = 1;
  for(auto& itr : mp) {
    ans = (ans * (itr.second+1))%MOD;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    long long N;
    long long s,t;
    cin>>N;
    reps(h,1,3501){
      reps(n,1,3501){
        s=(N*h*n);
        t=(4*h*n-n*N-N*h);
        if(0<t&&s%t==0) {
          cout<<h<<" "<<n<<" "<<s/t<<" "<<endl;
          return 0;
        }
      }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b  = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        if (a + b > c + d) {
            System.out.println("Left");
        } else if (a + b == c + d ) {
            System.out.println("Balanced");
        } else {
            System.out.println("Right");
        }
    }

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a, b, c;
    long long ans=0;
    cin >> a >> b >> c;

    for (int i = 0; i < 10001; i++)
    {
        if((a*i-c)%b==0&&(a*i-c)>0) ans=1;
    }
    
    if(ans==1) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

int main() {
  int n;
  cin >> n;
  int p[n];
  rep(i,n) cin >> p[i];
  int ans=0;
  for(int i=1;i<n-1;i++){
      if((p[i] < p[i-1] && p[i]>p[i+1]) || (p[i] > p[i-1] && p[i] < p[i+1])){
          ans++;
      }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <math.h>
#include <map>
#include <set>
#include <string>
using namespace std;
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;
 
const int INT_INF = 1e9;
const ll LL_INF = 1e18;
const int MAXN = 500003;
 
typedef struct GE{
    int to;
    ll w;
    GE(){};
}GE;
 
int n, m;
int cnt[300];
int main() {
    char s[10];
    scanf("%s", s);
    int ans=0;
    int mxcnt=0;
    for(int i=0;i<4;i++){
    	if(cnt[s[i]]==0){
    		ans++;
    	}
    	cnt[s[i]]++;
    	mxcnt = max(mxcnt, cnt[s[i]]);
    }
 
    if(ans==2 && mxcnt==2) {
    	puts("Yes");
    }
    else
    	puts("No");
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
double ans;
int main()
{
	int n,k; scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)
	{
		int p=i; double t=1.0/n;
		while(p<k) p*=2,t*=0.5;
		ans+=t;
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;
	return 0;
}

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

using namespace std;

#define MOD 1000000007

vector< vector<int> > G(1010);
vector< vector<int> > rG(1010);
vector< vector<int> > cG(1010);
vector<int> post;
int cmp[1010];
bool used[1010];
bool edge[1010][1010];

int N, M;

void dfs(int v)
{
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++){
    if(!used[G[v][i]]) dfs(G[v][i]);
  }
  post.push_back(v);
}

void rdfs(int v, int k)
{
  used[v] = true;
  cmp[v] = k;
  for(int i = 0; i < rG[v].size(); i++){
    if(!used[rG[v][i]]) rdfs(rG[v][i], k);
  }
}

int scc()
{
  int k = 0;
  memset(used, false, sizeof(used));
  for(int i = 0; i < N; i++){
    if(!used[i]) dfs(i);
  }
  memset(used, false, sizeof(used));
  reverse(post.begin(), post.end());
  for(int i = 0; i < post.size(); i++){
    if(!used[post[i]]) rdfs(post[i], k++);
  }
  return k;
}

long long solve(int v)
{
  long long ret = 1;
  for(int i = 0; i < cG[v].size(); i++){
    ret = ret * solve(cG[v][i]) % MOD;
  }
  return (ret + 1) % MOD;
}

int main()
{
  cin >> N >> M;
  G.resize(N);
  rG.resize(N);
  for(int i = 0; i < M; i++){
    int S, D;
    cin >> S >> D;
    --S, --D;
    G[S].push_back(D);
    rG[D].push_back(S);
  }
  int L = scc();
  cG.resize(L);
  memset(edge, false, sizeof(edge));
  for(int i = 0; i < 1010; i++) edge[i][i] = true;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < G[i].size(); j++){
      if(!edge[cmp[i]][cmp[G[i][j]]]){
	edge[cmp[i]][cmp[G[i][j]]] = true;
	cG[cmp[G[i][j]]].push_back(cmp[i]);
      }
    }
  }
  long long ans = 1;
  for(int i = 0; i < L; i++){
    bool flag = false;
    for(int j = 0; j < L; j++) if(i != j) flag |= edge[i][j];
    if(!flag) ans = ans * solve(i) % MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2356
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

ll L[90];

int main(void){
	          int i;

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);
	      	  
	      	  int n;
	      	  cin >> n;
	      	  
	      	  L[0]=2;
	      	  L[1]=1;
	      	  
	      	  if(n==0) cout << 2 << endl;
	      	  else if(n==1) cout << 1 << endl;
	      	  else{
	      		  for(i=2;i<=n;i++){
	      			  L[i]=L[i-1]+L[i-2];
	      		  }
	      		  
	      		  cout << L[n] << endl;
	      	  }
	      	  
	          return 0;
}


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

int main()
{
  int N;
  cin >> N;
  string s;
  vector<string> A(0), S(N);
  vector<pair<int, string>> C(0);
  for (int i = 0; i < N; i++)
  {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  C.push_back(make_pair(1, S.at(0)));
  for (int i = 1; i < N; i++)
  {
    if (S.at(i) == S.at(i - 1))
    {
      C.at(C.size() - 1).first++;
    }
    else
    {
      C.push_back(make_pair(1, S.at(i)));
    }
  }
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());
  A.push_back(C.at(0).second);
  for (int i = 1; i < C.size(); i++)
  {
    if (C.at(i).first == C.at(i - 1).first)
    {
      A.push_back(C.at(i).second);
    }
    else
    {
      break;
    }
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < A.size(); i++)
  {
    cout << A.at(i) << endl;
  }
}

Measured memory_bytes: 22896
INF = 1 << 30
def min(a,b); a < b ? a : b; end
def max(a,b); a > b ? a : b; end

N = gets.to_i
P = Hash.new{|h,k| h[k] = {x: {max: -INF, min: INF}, y: {max: -INF, min: INF}}}

N.times do
  x,y,d = gets.split
  x = x.to_i; y = y.to_i; d = d.to_sym
  P[d][:x][:max] = max(P[d][:x][:max], x) 
  P[d][:x][:min] = min(P[d][:x][:min], x) 
  P[d][:y][:max] = max(P[d][:y][:max], y) 
  P[d][:y][:min] = min(P[d][:y][:min], y)
end

def bounding_box(t)
  x_min = min(min(P[:U][:x][:min], P[:D][:x][:min]), min(P[:L][:x][:min] - t, P[:R][:x][:min] + t))
  x_max = max(max(P[:U][:x][:max], P[:D][:x][:max]), max(P[:L][:x][:max] - t, P[:R][:x][:max] + t))
  y_min = min(min(P[:L][:y][:min], P[:R][:y][:min]), min(P[:D][:y][:min] - t, P[:U][:y][:min] + t))
  y_max = max(max(P[:L][:y][:max], P[:R][:y][:max]), max(P[:D][:y][:max] - t, P[:U][:y][:max] + t))
  (x_max - x_min) * (y_max - y_min)
end

T = [ P[:L][:x][:min] - min(P[:U][:x][:min], P[:D][:x][:min]), min(P[:U][:x][:min], P[:D][:x][:min]) - P[:R][:x][:min],  (P[:L][:x][:min] - P[:R][:x][:min]) / 2.0,
      P[:L][:x][:max] - max(P[:U][:x][:max], P[:D][:x][:max]), max(P[:U][:x][:max], P[:D][:x][:max]) - P[:R][:x][:max],  (P[:L][:x][:max] - P[:R][:x][:max]) / 2.0,
      P[:D][:y][:min] - min(P[:L][:y][:min], P[:R][:y][:min]), min(P[:L][:y][:min], P[:R][:y][:min]) - P[:U][:y][:min],  (P[:D][:y][:min] - P[:U][:y][:min]) / 2.0,
      P[:D][:y][:max] - max(P[:L][:y][:max], P[:R][:y][:max]), max(P[:L][:y][:max], P[:R][:y][:max]) - P[:U][:y][:max],  (P[:D][:y][:max] - P[:U][:y][:max]) / 2.0,
      0, INF ].map{|t| max(t,0) }

puts T.map{|t| bounding_box(t) }.min


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

int main(){
  while(1){
    int n;
    scanf("%d", &n);
    if(n == 0) break;
    int s[n];
    double ave = 0;
    for(int i = 0; i < n; i++){
      scanf("%d", &s[i]);
      ave += s[i];
    }
    ave /= n;
    double a = 0;
    for(int i = 0; i < n; i++){
      a += pow(s[i] - ave, 2);
    }
    a = pow(a / n, 0.5);
    printf("%.9lf\n", a);
  }
}



Measured memory_bytes: 2936
#include <iostream>
#include <cmath>
int main(){
        long long N,A,B;
        std::cin>>N>>A>>B;
        long long max,min=0;
        max = std::min(A,B);
        if(A+B-N>0)
                min = A+B-N;
        std::cout<<max<<' '<<min;
        return 0;
}


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

using namespace std;
const int MAX=2999;
int n,vis[MAX+2][MAX+2];
double prob[MAX+2],dp[MAX+2][MAX+2];

double solve(int ind,int taken){
if(ind>n && taken*2<=n) return 0;
if(ind>n) return 1;
if(vis[ind][taken]!=-1) return dp[ind][taken];
double ans=0;
ans+=solve(ind+1,taken+1)*prob[ind];
ans+=solve(ind+1,taken)*(1-prob[ind]);
vis[ind][taken]=1;
return dp[ind][taken]=ans;
}

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>prob[i];
    memset(vis,-1,sizeof vis);
    printf("%.9lf",solve(1,0));
    return 0;
}


Measured memory_bytes: 104320
#include <stdio.h>
int main(void)
{int N,A,M,B,x,i,k,l,m,flag,sum;
	scanf("%d%d",&A,&B);
	char S[12];
	flag=0;
    	scanf("%s",S);
    for(i=0;i<=11;i++){
    	if(S[i]=='-'){
    		m=i+1;
    		flag+=1;
    		}}
    		
    if((m==A+1)&&(flag==1)){
    	printf("Yes");}
    	else {
    		printf("No");}
    	
		



	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
const long long mod = 1000000007;
int main() {
	int N;
	scanf("%d", &N);
	int*A = new int[N];
	int*R = new int[N];
	for (int i = 0; i < N; i++) {
		scanf("%d", A + i);
	}
	int sum2 = 0;
	int sum1a1 = 0;
	for (int i = 0; i < N; i++) {
		sum2 += A[i];
		if (i % 2 == 1) {
			sum1a1 += A[i];
		}
	}
	R[0] = sum2 - sum1a1 * 2;
	printf("%d ", R[0]);
	for (int i = 1; i < N; i++) {
		R[i] = (A[i - 1] - R[i - 1] / 2) * 2;
		printf("%d ", R[i]);
	}
	return 0;
}

Measured memory_bytes: 2048