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

using namespace std;

long long dp[200][200000];
int c[200],w[200];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int n,we;
    cin >> n >> we;

    for (int i=1;i<=n;i++)
        cin >> w[i] >> c[i];

    for (int i=0;i<=n;i++)
        for (int j=0;j<=we;j++)
    {
        if (i==0 || j==0) continue;
        if (w[i]<=j) dp[i][j]=max(dp[i-1][j-w[i]]+c[i],dp[i-1][j]);
        else dp[i][j]=dp[i-1][j];
    }

    cout << dp[n][we];
}


Measured memory_bytes: 156416
using Yorukatsu038.Questions;
using Yorukatsu038.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu038.Questions
{
    /// <summary>
    /// ABC133 C
    /// </summary>
    public class QuestionC : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var lr = inputStream.ReadIntArray();
            var l = lr[0];
            var r = lr[1];

            var min = long.MaxValue;
            for (long i = l; i < Math.Min(l + 2019, r); i++)
            {
                for (long j = i + 1; j <= Math.Min(l + 2019, r); j++)
                {
                    min = Math.Min(min, (i * j) % 2019);
                }
            }

            yield return min;
        }
    }
}


namespace Yorukatsu038
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionC();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu038.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu038.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x)
#define scs(x) scanf("%s", x)
#define scl(x) scanf("%lld", &x)
#define mst(a,x) memset(a, x, sizeof(a))
#define rep(i,s,e) for(int i=s; i<e; ++i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
int solve(){
    int n; sc(n); int sum(0);
    rep(i,1,n+1) rep(j,1,n+1) rep(k,1,n+1) sum+=__gcd(i,__gcd(j,k));
    return pf("%d\n",sum);
}
int main(){
    /* int _; sc(_); while(_--) */ solve();
}

Measured memory_bytes: 3812
#include<stdio.h>

int main(){
    int N,i,j,ans=0;

    scanf("%d", &N);
    int d[N];
    for (i = 0; i < N; i++){
        scanf("%d",&d[i]);
    }
    for ( i = 0; i < N; i++){
        for (j = i+1; j < N; j++){
            ans+=d[i]*d[j];
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cassert>

using namespace std;

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2*N-1], dneg[2*N-1];
bool X[N][N];

void init(){
  for(int i=0 ; i<N ; ++i){
    row[i] = FREE;
    col[i] = FREE;
  }
  for(int i=0 ; i<2*N-1 ; ++i){
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void printBoard(){
  for(int i=0 ; i<N ; ++i){
    for(int j=0 ; j<N ; ++j){
      if(X[i][j]){
        if(row[i] != j) return;
      }
    }
  }
  for(int i=0 ; i<N ; ++i){
    for(int j=0 ; j<N ; ++j){
      cout << ((row[i] == j) ? "Q":".");
    }
    cout << endl;
  }
}

void recursive(int i){
  //cout << i << endl;
  if(i == N){
    printBoard();
    return;
  }

  for(int j=0 ; j<N ; ++j){
    if(NOT_FREE == col[j] ||
       NOT_FREE == dpos[i+j] ||
        NOT_FREE == dneg[i-j+N-1]) continue;
    //set Queen
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    //try next
    recursive(i+1);
    //remove Queen
    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

int main(){
  init();

  for(int i=0 ; i<N ; ++i){
    for(int j=0 ; j<N ; ++j){
      X[i][j] = false;
    }
  }

  int k;
  cin >> k;
  for(int i=0 ; i<k ; ++i){
    int r, c;
    cin >> r >> c;
    X[r][c] = true;
  }
  recursive(0);

  return 0;
}



Measured memory_bytes: 3104
#include <stdio.h>

int main(void){
        int a, b, area, length;

        scanf("%d %d",&a, &b);
        area = a*b;
        length = (a*2)+(b*2);

        if(a>=1&&b<=100){
        printf("%d %d\n",area, length);
        }

        return 0;
}

Measured memory_bytes: 596
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
n, d = map(int, input().split())
ans = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x*x+y*y <= d*d: ans+=1
print(ans)

Measured memory_bytes: 9428
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int n, counter = 0;
    cin >> n;

    long long int h[n];

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

    if (n > 1)
    {
    	for (int i = 0 ; i < n - 1; i++)
    	{
    		if (h[i - 1] < h[i] || i == 0)
    		{
    			h[i]--;
    		}
    	}
    	for (int i = 0; i < n - 1; i++)
    	{
    		if (h[i] > h[i+1])
    		{
    			cout << "No";
    			counter = 1;
    			break;
    		}
    	}
    	if (counter == 0)
    	{
    		cout << "Yes";
    	}
	}
	else
	{
		cout << "Yes" ;
	}

    return 0;
}

Measured memory_bytes: 1024
#[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(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        x: usize,
    }
    if x == 7 || x == 5 || x == 3 {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
a, b, c = gets.split.map(&:to_i)
k = gets.to_i

cnt = 1
while cnt <= k
    if a >= b
        b *= 2
    elsif b >= c
        c *= 2
    else
        break
    end
    cnt += 1

    #p "#{a} #{b} #{c}"
end

if a < b && b < c
    puts "Yes"
else
    puts "No"
end


Measured memory_bytes: 14360
#include <cstdio>
using namespace std;
int N,dig,tmp,p[6],ans;
int main() {
    for (scanf("%d",&N),tmp = N;tmp;tmp/=10) dig++;
    p[0] = 1; for (int i = 1;i <= 5;i++) p[i] = p[i-1]*10;
    for (int i = 0;i < dig-1;i+=2) ans*=100,ans+=9;
    if (dig&1) {tmp = 1; for (int i = 1;i < dig;i++) tmp*=10; ans+=N-tmp+1;}
    printf("%d\n",ans);
}


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

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

    if(N==1 && M==1)
	ans = 1;
    else if((N==1&&M==2) || (M==1&&N==2))
	ans = 0;
    else if(N==1 || M==1)
	ans = max(N, M)-2;
    else
	ans = N*M - 2*N - 2*(M-2);
    cout << ans << endl;
}




Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int acgtLength = 0;
		int acgtMaxLength = 0;
		String[] acgt = {"A", "C", "G", "T"};
		List<String> acgtList = Arrays.asList(acgt);
		for(int i = 0; i < s.length(); i++) {
			String tmpStr = s.substring(i, i+1);
			if(acgtList.contains(tmpStr)) {
				acgtLength++;
			} else {
				acgtLength = 0;
			}
			if(acgtLength > acgtMaxLength) {
				acgtMaxLength = acgtLength;
			}
		}
		System.out.println(acgtMaxLength);
	}
}

Measured memory_bytes: 23124
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a)
	fmt.Scan(&b)
	if a > b {
		fmt.Println("a > b")
	} else if a < b {
		fmt.Println("a < b")
	} else {
		fmt.Println("a == b")
	}
}



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

int main(){
  int n,ans=0;cin>>n;
  vector<int> h(n,0);
  REP(i,n) cin>>h.at(i);
  REP(i,n){
    bool f=1;
    REP(j,i) if(h.at(j)>h.at(i)) f=0;
    if(f) ans++;
  }
  cout<<ans;
}

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

int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> Sp(N);
  rep(i, N) {
    string S;
    int p;
    cin >> S >> p;
    get<0>(Sp.at(i)) = S;
    get<1>(Sp.at(i)) = - p;
    get<2>(Sp.at(i)) = i + 1;
  }
  sort(Sp.begin(), Sp.end());
  rep(i, N) cout << get<2>(Sp.at(i)) << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, k, p[2000];
int main() {
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", p + i);
	sort(p, p + n);
	int sum = 0;
	for (int i = 0; i < k; i++)
		sum += p[i];
	printf("%d\n", sum);
}

Measured memory_bytes: 1740
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> s(n+1);
    for(int i =1 ;i<n+1;i++)
    {
        cin>>s[i];
    }
    sort(s.begin()+1,s.end(),greater<>());
    // vector<int> happy(n,0);
    long long  ans = 0;
    int flag = 0;
    int x  =0,i = n/2,j=n/2;
    ans = s[1];
    
    for(int i = 3 ;i<=n;i++)
    ans += s[(i+1)/2];

    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 4024
#include <stdio.h>

int main(){

    int a,b;
    char op;

    scanf("%d %c %d",&a,&op,&b);

    while(op!='?'){
        if(op=='+')
            printf("%d\n",a+b);
        if(op=='-')
            printf("%d\n",a-b);
        if(op=='*')
            printf("%d\n",a*b);
        if(op=='/')
            printf("%d\n",a/b);
        scanf("%d %c %d",&a,&op,&b);
    }

}


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

using namespace std;

int main() {
  string S; cin >> S;
  int maxLen = 0;
  int local = 0;
  for(int i = 0; i < (int)S.size(); i++){
    ((S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') ? local++ : local = 0);
    maxLen = max(maxLen, local);
  }
  cout << maxLen << endl;
}


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

using namespace std;
using LL = long long;

constexpr int N = 1e6 + 5;
constexpr LL MOD = 1e9 + 7;

int n;
LL dp[N][2][2];

LL f(int i, int f1, int f2) {
    if (i >= n) {
        return (f1 + f2 == 2);
    }

    LL &rv = dp[i][f1][f2];
    if (rv != -1) return rv;
    rv = 0;

    for (int d = 0; d < 10; d++) {
        rv += f(i + 1, f1 | (d == 0), f2 | (d == 9));
        if (rv >= MOD) rv %= MOD;
    }

    return rv;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    cin >> n;
    memset(dp, -1, sizeof dp);

    LL res = f(0, 0, 0);
    cout << res << endl;
}

Measured memory_bytes: 128624
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let s = read::<String>().chars().collect::<Vec<char>>();
    let mut ans = 0;
    let mut prev = '0';
    for i in 0..n {
        if s[i] != prev {
            prev = s[i];
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2796
MM = input().split()
N = int(MM[0])
A = int(MM[1])
B = int(MM[2])
total = 0
for i in range(N+1):
  x = list(str(i))
  total1 = 0
  for j in x:
    
    total1 += int(j)
  
  if A<= total1 <= B:
    total +=i
print(total)

Measured memory_bytes: 9120
let solve m a r c h =
    m * a * r
    + m * a * c
    + m * a * h
    + m * r * c
    + m * r * h
    + m * c * h
    + a * r * c
    + a * r * h
    + a * c * h
    + r * c * h

let rec get_input_aux n solve m a r c h =
    if n = 0 then solve m a r c h
    else
        match (read_line ()).[0] with
        | 'M' -> get_input_aux (n - 1) solve (m + 1) a r c h
        | 'A' -> get_input_aux (n - 1) solve m (a + 1) r c h
        | 'R' -> get_input_aux (n - 1) solve m a (r + 1) c h
        | 'C' -> get_input_aux (n - 1) solve m a r (c + 1) h
        | 'H' -> get_input_aux (n - 1) solve m a r c (h + 1)
        |  _  -> get_input_aux (n - 1) solve m a r c h

let get_input n solve = get_input_aux n solve 0 0 0 0 0

let () =
    let n = read_int () in
    get_input n solve
    |> string_of_int
    |> print_endline


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
using namespace std;


void solve(){
  int a[3];
  int ans = 0;
  int maxid = 0, minid = 0, cid = 0;
  for(int i = 0; i < 3; i++){
    cin >> a[i];
    if(a[i] > a[maxid]) maxid = i;
    else if(a[i] < a[minid]) minid = i;
    else cid = i;
  }
  int maxa = a[maxid];
  int mina = a[minid];
  int ca = a[cid];
  ans += maxa - ca;
  mina = maxa - ca + mina;

  if((maxa - mina) % 2 == 0) ans += (maxa - mina) / 2;
  else ans += (maxa + 1 - mina) / 2 + 1;
  cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		List<String> list = new LinkedList<>();
		String hw;
		String end = "0 0";

		while(true){
			hw = sc.nextLine();
			if(hw.equals(end)){
				break;
			}
			list.add(hw);
		}
		for(String data: list){
			int h = Integer.parseInt(data.split(" ")[0]);
			int w = Integer.parseInt(data.split(" ")[1]);
			for(int i = 0;i < h; i++){
				for(int j = 0;j < w; j++){
					if(i == 0 || i == (h - 1)){
						System.out.print("#");
					}else if(j == 0 || j == (w - 1)){
						System.out.print("#");
					}else{
						System.out.print(".");
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}




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

int main() {
    int64_t n, a, b, min_x = INT64_MAX, max_x = INT64_MIN,
                     min_y = INT64_MAX, max_y = INT64_MIN;
    cin >> n;
    for (auto i = 0; i < n; i++) {
        cin >> a >> b;
        min_x = min(a - b, min_x);
        max_x = max(a - b, max_x);
        min_y = min(a + b, min_y);
        max_y = max(a + b, max_y);
    }
    cout << max(max_x - min_x, max_y - min_y) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>


int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int n[3] ={a,b,c};
    int i,max,min;
    max=0;
    min=101;
    for(i=0; i<3; i++){
        if(n[i]>max){
            max=n[i];
        }
        if(n[i]<min){
            min=n[i];
        }
    }
    printf("%d\n",max-min);
    
}


Measured memory_bytes: 128
var i,j,k,n,m,num:longint;
begin
  read(n,m,k);
  for i:=0 to n do
    for j:=0 to m do
    begin
      num:=i*m+j*n-i*j*2;//writeln(i,' ',j,' ',num);
      if num=k then begin writeln('Yes');exit;end;
    end;
  writeln('No');
end.

Measured memory_bytes: 128
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

n = inp[0]
p n/3

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

int main(void)
{
	int m,n,a,b;
	int sum[10000];
	cin >> m >> n;
	while(n--)
	{
		cin >> a >> b;
		sum[a]++;
		sum[b]++;
	}
	for(int i=1;i<=m;i++)
	{
		cout << sum[i] <<endl;
	}
} 

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100001
#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, m;
	cin >> n >> m;
	int maxl = -1, minr = MAX;

	while (m--) {
		int l, r;
		cin >> l >> r;

		maxl = max(maxl, l);
		minr = min(minr, r);
	}

	int cnt = 0;

	for (int i = 0; i < n; ++i) {
		if (i + 1 >= maxl && i + 1 <= minr) {
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int A[SIZE];
LL f(int l,int r,LL x,LL y){
    if(l+1==r)return 0;
    LL ret=1e18;
    FOR(i,l+1,r-1){
        ret=min(ret,f(l,i,x,x+y)+f(i,r,x+y,y)+A[i]*(x+y));
    }
    return ret;
}
int main(){
    int N;
    R(N);
    FOR(i,1,N){
        R(A[i]);
    }
    W(f(1,N,1,1)+A[1]+A[N]);
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int L = sc.nextInt();
            String[] strings = new String[N];
            for (int i = 0; i < N; i++) {
                strings[i] = sc.next();
            }
            Arrays.sort(strings);
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < N; i++) {
                sb.append(strings[i]);
            }
            System.out.println(sb.toString());
        }
    }
}

Measured memory_bytes: 23124
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 262144
#define REP(i,n) for(long long i = 0;i < n;++i)
pair<int,int> union_tree[400000];
int union_find(int a) {
	if (union_tree[a].first == a) return a;
	return union_tree[a].first = union_find(union_tree[a].first);
}
int union_merge(int a, int b) {
	a = union_find(a);
	b = union_find(b);
	if (a != b) {
		union_tree[a].second += union_tree[b].second;
		union_tree[b].second = 0;
		union_tree[b].first = union_tree[a].first;
	}
	return 0;
}
int main() {
	iostream::sync_with_stdio(false);
	int n, r;
	cin >> n >> r;
	REP(i, n) {
		union_tree[i] = make_pair(i, 1);
	}
	vector<int> inputs;
	REP(i, n) {
		int a;
		cin >> a;
		a--;
		inputs.push_back(a);
	}
	for (int i = 0; i < inputs.size(); ++i) {
		if (inputs[i] != i) {
			union_merge(i, inputs[i]);
		}
	}
	vector<int> gogo;
	for (int i = 0; i < n; ++i) {
		int hoge = union_find(i);
		if (union_tree[hoge].second == 0) continue;
		gogo.push_back(union_tree[hoge].second);
		union_tree[hoge].second = 0;
	}
	sort(gogo.begin(), gogo.end(), greater<int>());
	if (gogo.size() <= 100) {
		set<int> tea;
		tea.insert(0);
		for (int i = 0; i < gogo.size(); ++i) {
			for (auto q = tea.begin(); q != tea.end(); ++q) {
				int hoge = *q;
				hoge *= -1;
				hoge += gogo[i];
				if (hoge == r) {
					cout << "Yes" << endl;
					return 0;
				}
				tea.insert(-hoge);
			}
		}
	}
	else {
		long long now = min(r, n - r);
		for (int q = 0; q < gogo.size(); ++q) {
			if (now >= gogo[q]) {
				now -= gogo[q];
			}
		}
		if (now == 0) {
			cout << "Yes" << endl;
			return 0;
		}
		REP(tea, 100) {
			long long now = min(r, n - r);
			for (int q = 0; q < gogo.size(); ++q) {
				if (now >= gogo[q]&&rand() % 2 == 0) {
					now -= gogo[q];
				}
			}
			if (now == 0) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 20084
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<bits//stdc++.h>
#include<functional>
using namespace std;
int parent [100];
int root(int x){
	if(parent[x]==x) return x;
	return parent[x]=root(parent[x]);
}
void unite(int x,int y){
	x=root(x);
	y=root(y);
	parent[x]=y;
}
bool same(int x,int y){
	return root(x)==root(y);
}
struct P{
	int from,to,cost;
};
bool operator<(P a,P b){
	return a.cost<b.cost;
}
bool operator>(P a,P b){
	return a.cost>b.cost;
}
int main() {
	int n,m;
	while(cin>>n>>m&&n!=0&&m!=0){
	int a,b,c;
	for(int i=0;i<n;i++)parent[i]=i;
	priority_queue<P, vector<P>, greater<P>>p;
	for(int i=0;i<m;i++){
		cin>>a>>b>>c;
		p.push(P{a,b,c});
	}
	int sum=0,d=0;
	while(d!=n-1){
		P t=p.top();p.pop();
		if(!same(t.from,t.to)){
			unite(t.from,t.to);
			d++;
			sum+=t.cost;
		}
	}
	cout<<sum<<endl;
}
}

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



int main() {
 int N;
  cin >> N;
  string tem;
  
  set<string> sp;
  for(int i = 0; i < N; i++){
         	cin >> tem;
       	sp.insert(tem);
		
    }
  
 
  cout << sp.size() << '\n';
  
  

}


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

using namespace std;
#define ll long long
inline ll read()
{
    ll d=0,f=1;
    char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){d=d*10+ch-'0';ch=getchar();}
    return d*f;
}

int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    cout << max(c-(a-b),0);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, T;
  cin >> n >> T;
  vector<int> kitakuro;
  bool flag = false;
  rep(i, n) {
    int c, t;
    cin >> c >> t;
    if (t > T) continue;
    kitakuro.emplace_back(c);
    flag = true;
  }

  if (flag) {
    sort(kitakuro.begin(), kitakuro.end());
    int ans = kitakuro[0];
    cout << ans << endl;
  } else {
    string ans = "TLE";
    cout << ans << endl;
  }
  return 0;
}


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

int main() {
	int x;
	cin >> x;
	vector<bool> v(x+1);
	v[1] = true;
	for(int i = 2; i * i <= x; i++) {
		int now = i * i;
		while (now <= x) {
			v[now] = true;
			now *= i;
		}
	}
	for(int i = x; i > 0; i--) if(v[i]) {
		cout << i << endl;
		break;
	}
	return 0;
}

Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2020/07/27
 *      Author: 113896
 */
#include <stdio.h>

int main() {

	int n, m;
	scanf("%d%d", &n, &m);

	int A[n][m];
	int b[m];
	int c[n];

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

	for (int i = 0; i < m; i++) {
		scanf("%d", &b[i]);
	}

	int total = 0;
	for (int t = 0; t < n; t++) {
		total = 0;
		for (int i = 0; i < m; i++) {
			total += A[t][i] * b[i];
		}
		c[t] = total;
	}

	for (int i = 0; i < n; i++) {
		printf("%d\n", c[i]);
	}

	return 0;
}




Measured memory_bytes: 2124
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>



int main(){
	int a;
	scanf("%d",&a);
	if(a<1200){
		printf("ABC");
	}
	else if(a<2800){
		printf("ARC");
	}
	else{
		printf("AGC");
	}
	
	return 0;
}

Measured memory_bytes: 128
<?php

function f($x)
{
    return (int)$x * (int)$x;
}

function integral($d)
{
    $result = 0;
    for ($i=0; $i<600; $i+=$d) {
        $result += $d * f($i);
    }
    return $result;
}

while (fscanf(STDIN, "%d", $d)) {
    echo integral($d). PHP_EOL;
}



Measured memory_bytes: 9248
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[200010];
    rep(i, N) cin >> A[i];
    int ans = INF2;
    int sum = 0;
    rep(i, N) sum += A[i];
    int x = 0;
    rep(i, N - 1) {
        x += A[i];
        ans = min(ans, abs(x * 2 - sum));
    }
    cout << ans << endl;

    return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K; cin >> N >> K;
    int ans = K;
    rep(i, N-1) ans*= K-1;
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n,ans = 2000000;
    string s;
    cin >> n >> s;
    vector<int> b(n + 1,0),w(n + 1,0);
    for(int i = 1;i <= n;i++){
        if(s[i - 1] == '#')b[i]++;
        else w[i]++;
        b[i] += b[i - 1];
        w[i] += w[i - 1];
    }
    for(int i = 0;i <= n;i++){
        ans = min(ans,b[i] + (w[n] - w[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 2180
#include<iostream>
#include<algorithm>
#include<string>
#include<numeric>
#include<vector>
#include<map>
using namespace std;

int main(){
  int n;
  cin >> n;
  map<int,int> vcount0;
  map<int,int> vcount1;
  int v;
  for (int i=0;i<n;i++){
    cin >> v;
    if (i%2 == 0){
      if (vcount0.find(v) == vcount0.end()){
        vcount0[v] = 1;
      }
      else{
        vcount0[v] += 1;
      }
    }
    else{
      if (vcount1.find(v) == vcount1.end()){
        vcount1[v] = 1;
      }
      else{
        vcount1[v] += 1;
      }
    }
  }
  pair<int,int> mv0[vcount0.size()+1];
  pair<int,int> mv1[vcount1.size()+1];
  int j = 0;
  for (map<int,int>::iterator i=vcount0.begin();i!=vcount0.end();i++){
    mv0[j].first = i->second;
    mv0[j].second = i->first;
    j += 1;
  }
  mv0[vcount0.size()].first = 0;
  mv0[vcount0.size()].second = 0;
  j = 0;
  for (map<int,int>::iterator i=vcount1.begin();i!=vcount1.end();i++){
    mv1[j].first = i->second;
    mv1[j].second = i->first;
    j += 1;
  }
  mv1[vcount1.size()].first = 0;
  mv1[vcount1.size()].second = 0;

  sort(mv0,mv0+vcount0.size()+1);
  sort(mv1,mv1+vcount1.size()+1);

  if (mv0[vcount0.size()].second != mv1[vcount1.size()].second){
    cout << n - mv0[vcount0.size()].first - mv1[vcount1.size()].first<< endl;
  }
  else{
    cout << n - max(mv0[vcount0.size()].first+mv1[vcount1.size()-1].first,mv0[vcount0.size()-1].first+mv1[vcount1.size()].first)<< endl;
  }
  return 0;
}


Measured memory_bytes: 5760
use std::collections::HashMap;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let n: usize = read();
    let mut primes = Vec::new();
    for i in 2..n + 1 {
        let mut is_prime = true;
        for j in 2..i {
            if i % j == 0 {
                is_prime = false;
                break;
            }
        }
        if is_prime {
            primes.push(i);
        }
    }

    let mut factors = HashMap::new();
    for i in 1..n + 1 {
        let mut i = i;
        for p in primes.iter() {
            while i % *p == 0 {
                (*factors.entry(p).or_insert(1)) += 1;
                i /= *p;
            }
        }
    }
    // println!("{:?}", factors);

    let mut over3 = 0;
    let mut over5 = 0;
    let mut over15 = 0;
    let mut over25 = 0;
    let mut over75 = 0;
    for v in factors.values() {
        if *v >= 75 {
            over75 += 1;
        }
        if *v >= 25 {
            over25 += 1;
        }
        if *v >= 15 {
            over15 += 1;
        }
        if *v >= 5 {
            over5 += 1;
        }
        if *v >= 3 {
            over3 += 1;
        }
    }
    // println!("{:?}", (over3, over5, over15, over25, over75));

    let mut ans = over75;
    ans += over25 * std::cmp::max(over3 - 1, 0);
    ans += over15 * std::cmp::max(over5 - 1, 0);
    ans += over5 * std::cmp::max(over5 - 1, 0) * std::cmp::max(over3 - 2, 0) / 2;
    println!("{:?}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

struct LazySegmentTree{
   int n;
   vector<ll> node,lazy,flag;
public:
   LazySegmentTree(int sz,ll init){
       n=1;
       while(n<sz)n*=2;
       node.resize(2*n-1,init);
       lazy.resize(2*n-1,(1LL<<31)-1);
   }

   void eval(int k,int l,int r){
       if(lazy[k]!=(1LL<<31)-1){
           node[k]=lazy[k];
       if(r-l>1){
            lazy[2*k+1]=lazy[k];
           lazy[2*k+2]=lazy[k];
       }
       }
       lazy[k]=(1LL<<31)-1;
    }
       //[a,b)にxを加算
    void update(int a,int b,ll x,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        eval(k,l,r);
        if(r<=a||b<=l)return;
        if(a<=l&&r<=b){
           lazy[k]=x;
           eval(k,l,r);
        }
        else {
           update(a,b,x,2*k+1,l,(l+r)/2);
           update(a,b,x,2*k+2,(l+r)/2,r);
           node[k]=min(node[2*k+1],node[2*k+2]);
        }
    }
   //[a,b)での和を返す
   ll get(int a,int b,int k=0,int l=0,int r=-1){
       if(r<0)r=n;
       eval(k,l,r);
       if(r<=a||b<=l)return (1LL<<31)-1;
       if(a<=l&&r<=b)return node[k];
       ll xl=get(a,b,2*k+1,l,(l+r)/2);
       ll xr=get(a,b,2*k+2,(l+r)/2,r);
       return min(xl,xr);
   }
};
int main(){
   int n,q;
   cin>>n>>q;
   LazySegmentTree sg(n,(1LL<<31)-1);
   rep(i,q){
       int t;cin>>t;
       if(t){
           int a,b;
           cin>>a>>b;
           b++;
           cout<<sg.get(a,b)<<endl;
       }
       else {
           int a,b,c;
           cin>>a>>b>>c;
           sg.update(a,b+1,c);
       }
   }
   return 0;
}


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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string str;
    cin >> str;
    int n = str.size();
    int ans = 0;
    for (int i = 0; i < n / 2; i++) {
        if (str[i] != str[n-1-i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

numA = int(input().rstrip())
listA = list(map(int,input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int,input().rstrip().split(" ")))

sumA = []
cnt = 0


for i in range(1,numA+1):
    tmpComb = list(itertools.combinations(listA, i))
    for nums in tmpComb:
        sumA.append(sum(nums))


for i in range(numQ):
    if sumA.count(listQ[i]) > 0:
        print("yes")
    else:
        print("no")

Measured memory_bytes: 79524
import java.util.*;
import java.io.*;

/*
   AtCoder contest
   coder : yoichidon
 */

class Dish implements Comparable<Dish>{
    long tak, aok;
    public Dish(long tak, long aok){
        this. tak = tak;
        this.aok = aok;
    }

    public int compareTo(Dish another){
        return Long.compare(this.tak+this.aok, another.tak+another.aok);
    }
}

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Dish[] dishes = new Dish[N];
        for(int n=0; n<N; n++){
            int A = sc.nextInt();
            int B = sc.nextInt();
            dishes[n] = new Dish(A,B);
        }

        Arrays.sort(dishes, Collections.reverseOrder());

        long ans = 0;

        for(int n=0; n<N; n++){
            if(n%2==0) ans += dishes[n].tak;
            else ans -= dishes[n].aok;
        }


        System.out.println(ans);




    }
}


Measured memory_bytes: 94624
#include<bits/stdc++.h>
using namespace std;
struct point{
	int x;
	int y;
	int step;
};
char mp[801][801];
int cnt[801][801];
bool visit[801][801];
int h,w,k;
bool ifok;
int step;
int dirx[4]={0,1,0,-1};
int diry[4]={1,0,-1,0};
void bfs(int sx,int sy)
{
	queue<point> q;
	cnt[sx][sy]=0;
	point start;
	start.x=sx;
	start.y=sy;
	start.step=0;
	visit[sx][sy]=0;
	q.push(start);
	while(!q.empty())
	{
		point now=q.front();
		q.pop();
		step=max(step,now.step);
		if(now.x==1||now.x==h||now.y==1||now.y==w)
		{
			ifok=1;
			step=now.step;
			return;
		}
		for(int i=0;i<4;i++)
		{
			int dx=dirx[i]+now.x;
			int dy=diry[i]+now.y;
			if(dx>=1&&dx<=h&&dy>=1&&dy<=w)
			{
				if(visit[dx][dy]&&mp[dx][dy]!='#')
				{
//					cout<<dx<<" "<<dy<<endl;
					point next;
					next.step=now.step+1;
					next.x=dx;
					next.y=dy;
					visit[dx][dy]=0;
					cnt[dx][dy]=next.step;
					q.push(next);
				}
			}
		}
//		cout<<q.size()<<endl;
//		system("PAUSE");
	}
}
int main()
{
//	freopen("cin.txt","r",stdin);
	cin>>h>>w>>k;
	int sx,sy;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cin>>mp[i][j];
			if(mp[i][j]=='S')
			{
				sx=i;
				sy=j;
			}
		}
	}
/*	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cout<<mp[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<h<<" "<<w<<endl;
	cout<<sx<<" "<<sy<<endl;*/
	if(sx==1||sx==h||sy==1||sy==w)
	{
		cout<<0<<endl;
		return 0;
	}
	memset(visit,1,sizeof(visit));
	bfs(sx,sy);
/*	cout<<step<<endl;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cout<<cnt[i][j]<<" ";
		}
		cout<<endl;
	}*/
/*	if(ifok)
	{
		cout<<(step+k-1)/k<<endl;
		return 0;
	}
	else*/
	{
		int ans=1<<30;
		for(int i=1;i<=h;i++)
		{
			for(int j=1;j<=w;j++)
			{
				if(!visit[i][j])
				{
					int least=min(min(i-1,j-1),min(h-i,w-j));
					int times;
//					cout<<"least=  "<<least<<"  times=  "<<times<<"  cnt=  "<<cnt[i][j]<<"      "<<i<<" "<<j<<endl;
					if(cnt[i][j]<=k)
					{
						times=(least+k-1)/k+1;
					}
					else
					{
						times=(least+cnt[i][j]+k-1)/k;
					}
//					cout<<times<<endl;
					ans=min(ans,times); 
				}
			}
		}
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	vector<long long> x(2),y(2);
	cin >> x[0] >> x[1] >> y[0] >> y[1];
	long long ans=-1000000000000000001;
	for(int i=0;i<2;i++)
		for(int j=0;j<2;j++)
			ans=max(ans,x[i]*y[j]);

	cout << ans << endl;




}

Measured memory_bytes: 3624
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll INF=1e18;
const ll mod=1e9+7;

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll le=0,ri=INF;
    while(ri-le>1){
        ll mid=(ri+le)/2;
        ll sum=0;
        rep(i,n){
            sum+=(a[i]-1)/mid;
        }
        if(sum<=k) ri=mid;
        else le=mid;
    }
    cout << ri << endl;
    return 0;
}

Measured memory_bytes: 4836
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int sum = sc.nextInt();
        int h = sum/3600;
        int m = (sum%3600)/60;
        int s = ((sum%3600)%60);
        System.out.println(h+":"+m+":"+s);
    }
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

// pairsをfirstを優先キーとして昇順ソート
bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, M;
    cin >> N >> M;

    vector<P> A(N);

    REP(i, N){
        cin >> A[i].first >> A[i].second;
    } 

    sort(A.begin(), A.end(), compare_by_a);

    // REP(i, N){
    //     cout << A[i].first << " " << A[i].second << endl;;
    // } 
    ll count = 0;
    ll ans = 0;
    REP(i, N){
        ll roop = M-count;
        REP(j, min(roop, A[i].second)){
            ans+= A[i].first;
            count++;
            // cout << ans << endl;
        }
        if(M-count == 0) break;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
int n,k;
int d[10];
char *itoa( int val, char *a, int radix )
{
  char *p = a;
  unsigned int v = val;/* 作業用(変換対象の値) */
  int n = 1;/* 変換文字列の桁数記憶用 */
  while(v >= radix){/* 桁数を求める */
    v /= radix;
    n++;
  }
  p = a + n; /* 最下位の位置から設定する */
  v = val;
  *p = '\0';/* 文字列終端の設定 */
  do {
    --p;
    *p = v % radix + '0';/* 1桁の数値を文字に変換 */
    if(*p > '9') {/* 変換した文字が10進で表現できない場合 */
      *p = v % radix - 10 + 'A'; /* アルファベットを使う */
    }
    v /= radix;
  } while ( p != a);
  return a;
}

int is_valid_c(char s[7]){
  int i=0,j;
  while(s[i]!='\0'){
    for(j=0;j<k;j++){
      if(d[s[i]-48]==0)return 0;
    }
    i++;
  }
  return 1;
}
int main(){
  int i,j;
  char s[7];
  for(i=0;i<10;i++)d[i]=1;
  scanf("%d %d",&n,&k);
  for(i=0;i<k;i++){
    scanf("%d",&j);
    d[j]=0;
  }

  for(i=n;i<=100000;i++){
    itoa(i,s,10);
    if(is_valid_c(s)==1){printf("%s\n",s);break;}
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  solve();
}

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

long double L;
void solve() {
  cin >> L;
  cout << (L / 3) * (L / 3) * (L / 3) <<endl;
}


Measured memory_bytes: 256