jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
function main(input) {
  const args = input.split('\n');
  const ary2 = args[1].split(' ').map(n => parseInt(n, 10));
  const N = parseInt(args[0], 10); //候補地数
  const T = ary2[0]; //気温求めるパラメータ
  const A = ary2[1]; //理想気温
  const ary = args[2].split(' ').map(n => parseInt(n, 10));
  let min_gap; //理想気温に最も近い気温
  let idx; //敵地番号
  
  for (let i = 0; i < ary.length; i++) {
    ave = T - (ary[i] * 0.006); //平均気温
    gap = Math.abs(A - ave);
    if (!min_gap || min_gap > gap) {
      min_gap = gap;
      idx = i + 1; // 帳尻合わせ
    }
  }
  
  console.log(idx);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

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

func main() {
	n, t, a := nextInt(), float64(nextInt()), float64(nextInt())
	h := make([]float64, n)

	for i := 0; i < n; i++ {
		h[i] = float64(nextInt())
	}

	nearest := 0
	div := 10000.0
	for i := 0; i < n; i++ {
		temp := t - h[i]*0.006
		if math.Abs(a-temp) < div {
			div = math.Abs(a - temp)
			nearest = i
		}
	}
	fmt.Println(nearest + 1)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flash := NewIO()
	defer flash()
	n, t, a := io.ScanInt(), io.ScanFloat64(), io.ScanFloat64()
	heights := io.ScanFloat64s(n)

	minDiff := AbsDiffFloat64(t-heights[0]*0.006, a)
	minIdx := 0
	for i, h := range heights[1:] {
		diff := AbsDiffFloat64(t-h*0.006, a)
		if diff < minDiff {
			minDiff = diff
			minIdx = i + 1
		}
	}
	fmt.Println(minIdx + 1)
}

func AbsDiffFloat64(n1, n2 float64) float64 {
	return math.Abs(math.Abs(n1) - math.Abs(n2))
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInt2() (int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt3() (int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt4() (int, int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flash := NewIO()
	defer flash()
	n, t, a := io.ScanInt(), io.ScanFloat64(), io.ScanFloat64()
	heights := io.ScanFloat64s(n)

	minDiff := AbsDiffFloat64(t-heights[0]*0.006, a)
	minIdx := 0
	for i, h := range heights[1:] {
		diff := AbsDiffFloat64(t-h*0.006, a)
		if diff < minDiff {
			minDiff = diff
			minIdx = i+1
		}
	}
	fmt.Println(minIdx + 1)
}

func AbsDiffFloat64(n1, n2 float64) int {
	return int(math.Abs(math.Abs(n1) - math.Abs(n2)))
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInt2() (int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt3() (int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt4() (int, int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n, t, a := scanInt(sc), scanInt(sc), scanInt(sc)
	h := scanIntSlice(sc, n)
	fmt.Println(solve(t, a, h))
}

func solve(t, a int, h []int) int {
	var point int
	var tmp int

	min := math.MaxInt64
	for i, v := range h {
		tmp = 1000 * a - (1000*t - v*6)
		if min >= int(math.Abs(float64(tmp))) {
			min, point = tmp, i+1
		}
	}

	return point
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanFloat64(sc *bufio.Scanner) float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func scanFloat64Slice(sc *bufio.Scanner, n int) []float64 {
	fs := make([]float64, n)
	for i := 0; i < n; i++ {
		fs[i] = scanFloat64(sc)
	}

	return fs
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}
//  [ruby]
n = gets.chomp.to_i
t, a = gets.chomp.split.map(&:to_i)
hs = gets.chomp.split.map(&:to_i)

hs.map! { |h| (a - (t - h * 0.006)).abs }
puts hs.index(hs.min) + 1
//  [ruby]
n = gets.to_i
t, a = gets.split(" ").map(&:to_i)
hs = gets.split(" ").map(&:to_i)

array = []
hs.each_with_index do |h, i|
  average_temp = t - (h * 0.006)
#   p "#{i+1} #{average_temp} #{(a - average_temp).abs}"
  array << (a - average_temp).abs
end

puts array.index(array.min) + 1
//  [ruby]
N,T,A,*hs=$<.read.split.map(&:to_i)

n = 0
d = 10**9
hs.each.with_index do |h,i|
    t = T-h*0.006
    t = (A-t).abs
    if t < d
        n = i
        d = t
    end
end

puts n+1
//  [ruby]
n = gets.to_i
t, a = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)

ans = 0
ccc = 1000000000000

(0..(n - 1)).each do |i|
  curr = i + 1
  temp = (t - h[i] * 6)
  ci = (a - temp).abs
  if ci < ccc
    ccc = ci
    ans = curr
  end
end
puts ans
//  [ruby]
n = gets.chomp.to_i
t, a = gets.chomp.split(' ').map(&:to_i)
list = gets.chomp.split(' ').map(&:to_i)

result = 1
temperature = t - (list[0] * 0.006).to_i

(1..(n-1)).each do |i|
  temp = t - (list[i] * 0.006).to_i

  if (a - temp) == 0
    result = i+1
    break
  end

  if (a - temperature).abs > (a - temp).abs
    result = i+1
    temperature = temp
  end
end

print result
//  [ruby]
n = gets.chomp.to_i
t, a = gets.chomp.split(' ').map(&:to_i)
list = gets.chomp.split(' ').map(&:to_i)

result = 1
temperature = t - (list[0] * 0.006).to_i

(1..(n-1)).each do |i|
  temp = t - (list[i] * 0.006).to_i

  if (a.abs - temp.abs) == 0
    result = i+1
    break
  end

  if (a > temp.abs && temp.abs > temperature.abs) || (temperature.abs > temp.abs && temp.abs > a)
    result = i+1
    temperature = temp
  end
end

print result
//  [rust]
use std::io::*;
use std::str::FromStr;

pub 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: usize = read();
    let t: f64 = read();
    let a: f64 = read();
    let mut h: Vec<i64> = vec![];
    let mut ans = 0;

    for _ in 0..n {
        h.push(read());
    }

    let mut diff = (t - h[0] as f64 * 0.006 - a).abs();

    for i in 0..h.len() {
        let hi = h[i];
        if diff > (t - hi as f64 * 0.006 - a).abs() {
            diff = (t - hi as f64 * 0.006 - a).abs();
            ans = i;
        }
    }
    println!("{}", ans + 1);
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

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

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

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

fn main() {
    input! {
        n: u32,
        t: i32,
        a: i32,
        h: [i32; n],
    };
    println!(
        "{}",
        h.iter()
            .map(|x| (1000 * a - (1000 * t - 6 * x)).abs())
            .enumerate()
            .min_by_key(|&(_, v)| v)
            .unwrap()
            .0
            + 1
    );
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let v:Vec<f64> = procon_read();
	let t = v[0];
	let a = v[1];
	let v:Vec<f64> = procon_read();
	let mut mini = (a - (t - v[0]*0.006)).abs();
	let mut p = 1;
	for i in 1..n {
		if mini.abs().min((a - (t - v[i as usize]*0.006)).abs()) != mini.abs() {
			mini = mini.abs().min((a - (t - v[i as usize]*0.006)).abs());
			p = i + 1;
		}
	}
	println!("{}", p);
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, t: f64, a: f64, h: [f64; n]);

    let mut min = 100_000_000.0;
    let mut ans = 0;
    for i in 0..h.len() {
        let sa = (a - t - h[i] * 0.006).abs();

        if min >= sa {
            min = sa;
            ans = i;
        }
    }

    println!("{}", ans + 1);
}
//  [rust]
use proconio::{input, fastout};
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        t: usize,
        a: i64,
        h: [usize;n],
    }
    let INF = 100_0000;
    let mut minv = INF;
    let mut mini = 1;
    for i in 0..n {
        let te = (t as f64) - ((h[i] as f64) * 0.006);
        debug!((h[i] as f64) * 0.006);
        debug!(te);
        if minv > (a - te as i64).abs() {
            minv = (a - te as i64).abs();
            mini = i+1;
        }
    }

    println!("{}", mini);

}
//  [rust]
use proconio::{input, fastout};
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        t: usize,
        a: i64,
        h: [usize;n],
    }
    let INF = 1000_0000;
    let mut minv = INF;
    let mut mini = 1;
    for i in 0..n {
        let te = (t as f64) - ((h[i] as f64) * 0.006);
        debug!((h[i] as f64) * 0.006);
        debug!(te);
        if minv > (a - te as i64).abs() {
            minv = min(minv, (a - te as i64).abs());
            mini = i+1;
        }
    }

    println!("{}", mini);

}
//  [swift]
let N = Int(readLine()!)!
let a = readLine()!.split(separator: " ").map({Int($0)!})
let T = a[0]
let A = a[1]

let H_line = readLine()!.split(separator: " ").map{abs(a[0]*1000 - 1000*a[1] - Int($0)! * 6)}
print(H_line.firstIndex(of: H_line.min()!)! + 1)
//  [swift]

let N = Int(readLine()!)!
let a = readLine()!.split(separator: " ").map({Int($0)!})
let T = a[0]
let A = a[1]

let H_line = readLine()!.split(separator: " ").map({abs(T*1000 - 1000*A - Int($0)! * 6)})
print(H_line.firstIndex(of: H_line.min()!)! + 1)
//  [swift]
_ = readLine()!
let ta = readLine()!.split(separator: " ").compactMap { Double($0) }
let t = ta[0]
let a = ta[1]
let h = readLine()!.split(separator: " ").compactMap { Double($0) }

let result = h.lazy
    .map { abs((t - $0 * 0.006) - a) }
    .enumerated()
    .min { $0.1 < $1.1 }!

print(result.0 + 1)
//  [swift]
let N = Int(readLine()!)!
let a = readLine()!.split(separator: " ").map({Int($0)!})
let T = a[0]
let A = a[1]

let H_line = readLine()!.split(separator: " ").map({abs(A*1000 - 1000*T - Int($0)! * 6)})
print(H_line.firstIndex(of: H_line.min()!)! + 1)
//  [swift]

let N = Int(readLine()!)!
let a = readLine()!.split(separator: " ").map({Double($0)!})
let T = a[0]
let A = a[1]

let H_line = readLine()!.split(separator: " ").map({abs(A - T - Double($0)! * 0.006)})
print(H_line.firstIndex(of: H_line.min()!)! + 1)
//  [swift]
let N = Int(readLine()!)!
let a = readLine()!.split(separator: " ").map({Double($0)!})
let T = a[0]
let A = a[1]

let H_line = readLine()!.split(separator: " ").map({abs(A - T - Double($0)! * 0.006)})

var H_lineSorted = H_line.sorted()

var ans = H_line.index(of: H_lineSorted[0])
print(ans!+1)
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const _n = stdin.split('\n')[0]
const n = Number(_n)

const [t,a] = stdin.split('\n')[1].split(' ').map(Number)

const h = stdin.split('\n')[2].split(' ').map(Number)

let diffMin = Infinity

const temps = h.map(x=>{
  const tmp = t - x * 0.006
  return Math.abs(a-tmp)
})

const min = Math.min(...temps)

const ans = temps.indexOf(min) + 1

console.log(ans)
//  [typescript]
import * as fs from 'fs';

namespace AtCoder {
    class ABC113 {
        /**
         * @param inp
         * 2
         * 12 5
         * 1000 2000
         */
        main(inp: string): void {
            // t-x*0.006
            const [t, a]: number[] = inp.split('\n')[1].split(' ').map(x => parseInt(x, 10));
            let ans: number = 0;
            let tmpAbs: number = 9999999;
            inp.split('\n')[2].split(' ').forEach((h, index) => {
                const abs: number = Math.abs(a - (t - parseInt(h) * 0.006));
                if (tmpAbs > abs) {
                    tmpAbs = abs;
                    ans = index + 1;
                }
            });
            console.log(ans);
        }
    }

    const func = new ABC113();
    func.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
}
//  [typescript]
const log = console.log;

const parseLines = (s: string) => s.trim().split("\n");
const parseSpaceSeparated = (line: string) => line.trim().split(" ");
const parseDecimalInt = (s: string) => parseInt(s);
const parseSpaceSeparatedDecimalInt = (line: string) =>
  parseSpaceSeparated(line).map(parseDecimalInt);

// ----

function Main(input: string): void {
  const lines = parseLines(input);
  const [t, a] = parseSpaceSeparatedDecimalInt(lines[1]);
  const h = parseSpaceSeparatedDecimalInt(lines[2]);

  const temperatureArray = h.map(h => t - h * 0.006);
  const len = temperatureArray.length;
  let minDistance = Infinity;
  let index = -1;

  for (let i = 0; i < len; i += 1) {
    const distance = Math.abs(temperatureArray[i] - a);

    if (distance > minDistance) continue;

    minDistance = distance;
    index = i;
  }

  log(index + 1);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};
const main=()=>{
  let [n,t,a]=tnn(3)
  let h=tnn(n)
  let arr=[]
  for(let i=0;i<n;i++){
    to(t-h[i]*0.006)
    arr.push(t-h[i]*0.006)
  }
  to(near(a,arr)+1)
}
main()
//  [typescript]
'use strict'
function Main(input) {
  const ar = input.split("\n").map(x => x.split(" "));
  const N = ar[0][0];
  const [T, A] = ar[1];
  const H = ar[2];
 
  const a = [];
 
  for (let i = 0; i < H.length; i++) {
    a.push([i, Math.abs(T * 1000 - H[i] * 6 - A * 1000)]);
  }
 
  console.log(a.reduce((x, y) => x[1] < y[1] ? x : y)[0] + 1);
//  [python]
L = int(input())

print(L**3 / 27)
//  [python]
n = int(input())
n = n/3
print(n**3)
//  [python]
l = int(input())
a = l/3
ans = a**3
print(round(ans,13))
//  [python]
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

L = ni()
ans = -1
for x in range(1, L+1):
    for y in range(x, L-x+1):
        z = L - x - y
        ans = max(ans, x*y*z)
print(ans)
//  [python]
n=int(input())
ans=[]

for B in range(1,n+1):
  for C in range(1,n+1):
    new_high=(n-(B+C))*B*C
    ans.append(new_high)
      
print(max(ans))
//  [python]
l = int(input())

v_max = 0
for width in range(1, l+1):
    for length in range(1, l+1):
        height = l - width - length
        v = width * height * length
        if v_max < v:
            v_max = v

print(v_max)
//  [java]
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         double lol = 1.0*N;
         lol /= 3;
         System.out.println(lol*lol*lol);
      }
   }
//  [java]
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        int sum = sc.nextInt();
        double r = sum;
        r /=3;
        double v = r*r*r;
        System.out.println(v);
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
//  [java]
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigDecimal ll = sc.nextBigDecimal();
        BigDecimal ans2 = ll.divide(new BigDecimal(3.0));
        BigDecimal ans3 = ans2.multiply(ans2);
        BigDecimal ans4 = ans3.multiply(ans2);
        System.out.println(ans4);
    }
}
//  [java]
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigDecimal ll = sc.nextBigDecimal();
        BigDecimal ans2 = ll.divide(new BigDecimal(3.0));
        BigDecimal ans3 = ans2.multiply(ans2).multiply(ans2);
        System.out.println(ans3);
    }
}
//  [java]
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int l = sc.nextInt();
    sc.close();
    BigDecimal input = new BigDecimal(l);
    BigDecimal a = input.divide(new BigDecimal(3));
    BigDecimal ans = a.multiply(a).multiply(a);
    System.out.println(ans.toString());
  }
}
//  [cpp]
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    double n;
    cin>>n;
    double a = n/3;
    a = a*a*a;
    cout<<fixed<<setprecision(9)<<a;
}
//  [cpp]
/**
 *  author: mahfuzz
 *  created: 22.03.2020
**/
 
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x << ':' << x << "\n";
//~ const double pi = 2*acos(0.0);
//~ const long long mod = 1e9+7;
//~ const int max_n = 1e6+5;
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    double l; cin >> l;
    
    double a = l / 3.;
    
    cout << fixed << setprecision(12) << a * a * a << "\n";
    
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
  double l;cin>>l;
  double lm=l/3;
  
  cout<<fixed<<setprecision(12);
  cout<<lm*lm*lm<<endl;
}
//  [cpp]


#include<bits/stdc++.h>
using namespace std;
#define ll long  long int 

int main()
{   
  
    ll n;
    cin>>n;
    long double d=(double)(n*n*n)/3;
    string s=to_string(d);
    for(int i=0;i<6;i++)
    {
        s+='0';
    }
    cout<<s<<endl;


    return 0;
}
//  [cpp]
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;
int main() {
    double sum;
    cin >> sum;
    cout << fixed;
    cout << setprecision(12);
    if(sum == 1) cout << pow(1.0,3) << endl;
    else
        cout << pow(sum/3, 3) << endl;
  
}
//  [cpp]
// C - Mazimum Volume
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main(){
    int l;
    cin >> l;
    double ans = 1.0;
    if(l%3 == 0) ans = l/3*l/3*l/3;
    else if(l%3 == 1){
        int l2 = l/3+1;
        ans = l/3*l/3*l2;
    }
    else{
        int l2 = l/3+1;
        ans = l/3*l2*l2;
    }
    printf("%.20f\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>

int main()
{
int X;
scanf("%d",&X);
printf("%.12f\n",(double)X*X*X/27);
}
//  [c]
#include <stdio.h>
#include<string.h>
int main()
{
    double l;
    scanf("%lf",&l);
    printf("%lf",(l/3.0)*(l/3.0)*(l/3.0));
}
//  [c]
#include <stdio.h>
 
int main()
{
	double a;
  double b;
  double result;
	scanf("%lf", &a);
  b = a/3.0000000000;
  result = b*b*b;

  printf("%.10f", result);
    return 0;
}
//  [c]
#include<stdio.h>
int main ()
{
    double x,y;
    int l;
    scanf("%d", &l);
    y=l/3;
    x=y*y*y;
    printf("%.12lf\n", x);
}
//  [c]
#include<stdio.h>
int main ()
{
    double x;
    int l;
    scanf("%d", &l);
    x=(l/3*l/3*l/3);
    printf("%.12lf\n", x);
}
//  [c]
#include<stdio.h>
int main ()
{
    double x;
    int l;
    scanf("%d", &l);
    if(l%3==0){x=(l/3*l/3*l/3);}
    else if(l%3==1){x=(l/3*(l/3)*(l/3+1));}
    else if(l%3==2){x=(l/3*(l/3+1)*(l/3+1));}
    printf("%.12lf\n", x);
}
//  [javascript]
function Main(input) {
	var str = input;
	var ans = 0;
	str = str.split("\n");
	var l = Number(str[0].split(" ")[0]); 	
 	var n = (l / 3).toFixed(6);
 	var ans = (n**3).toFixed(6);
 	console.log(ans);
}
 //*おまじない
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  lines = input.split("\n");
  var volume=lines[0]*lines[0]*lines[0]/27;
  console.log(volume);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    res = Math.pow(parseInt(input[0])/3,3);
	console.log(res);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";

const main = arg => {

    const L = parseInt(arg.trim())

    let max_volume = 0;

    for (let i = 1; i <= L; i++) {
        for (let j = i; i + j <= L; j++) {
            for (let k = j; i + j + k <= L; k++) {
                max_volume = Math.max(max_volume, i * j * k);
            }
        }
    }

    console.log(max_volume);

}

main(requre('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  intInput = parseInt(input)
  var volume=(input)*(input)*(input)/27;
  console.log(volume.toFixed(12));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  intInput = parseInt(input);
  var volume=(input/3)*(input/3)*(input/3);
  console.log(volume.toFixed(12));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"strconv"
)


func main() {
	var n float64
	fmt.Scan(&n)
	a := (n / 3.0)
	b := (a * a * a)
	fmt.Println(strconv.FormatFloat(b, 'f', 12, 64))
}
//  [go]
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n float64
	fmt.Scan(&n)
	a := (n / 3.0) * 100000
	b := (a * a * a) / (100000 * 100000 * 100000)
	fmt.Println(strconv.FormatFloat(b, 'f', 12, 64))
}
//  [go]
package main

import "fmt"

func main() {
	var L int
	fmt.Scanf("%d", &L)

	var ans float64
	ans = float64(L*L*L) / 27

	fmt.Printf("%f\n", ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {

	var L int
	fmt.Scanf("%d", &L)

	var max, volume int
	max = 0
	for i := 1; i <= 1000; i++ {
		for j := 1; j <= 1000; j++ {
			for k := 1; k <= 1000; k++ {
				if i+j+k == L {
					volume = i * k * j
					if volume > max {
						max = volume
					}
				}
			}
		}
	}

	fmt.Println(max)
}
//  [go]
package main

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

const mod = 998244353
const facNum = 300001

func main() {
	sc := newScanner(os.Stdin)
	L := sc.i()
	ans := float64(Pow(L, 3)) / 27
	fmt.Printf("%.10f", ans)
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//------------------------------

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

// a^{-1} (mod) を計算
func Inv(a int) int {
	return Pow(a, mod-2)
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}
//  [go]
package main
 
import (
	"fmt"
)

var N float64
func main() {
	fmt.Scan(&N)
	a := N / 3
	b := N / 3
	//fmt.Printf("%v\n%v\n%v\n", a, b, N - a -b)
	fmt.Println(int(a) * int(b) * int(N - a - b))
}
func calmax(a, b int) int {
	if a > b {
		return a
	}
	return b
}
//  [ruby]
puts (gets.to_f/3)**3
//  [ruby]
l = gets.chomp.to_r
a = l/3

v = a * a * a

puts "%.7f" % v
//  [ruby]
l = gets.to_f/3
puts l**3
//  [ruby]
n=gets.to_i
puts format("%.12f",((n**3)/27))
//  [ruby]
n=gets.to_i
format("%.12f",((n**3)/27))
//  [rust]
fn main() {
    let l = read::<f64>();
    let a = l / 3.0;
    println!("{}", a*a*a);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}
//  [rust]
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)*}
    };
}
 
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)*}
    };
}
 
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! {
        l: f64,
    }

    let len = l / 3.0;
    println!("{:.12}", len.powf(3.0));
}
//  [rust]
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        l: f64
    }
    let r = l / 3.0;
    println!("{}", r*r*r);
}
/* vim:set foldmethod=marker: */
//  [rust]
#[warn(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        l: usize,
    }

    let mut ans = 0f64;
    let l = l * 10;

    for x in 0..l+1 {
        for y in 0..l-x+1 {
            let z = (l - x - y) as f64 / 10.0;
            let x = x as f64 / 10.0;
            let y = y as f64 / 10.0;
            ans = ans.max(x * y * z);
        }
    }

    println!("{}", ans);
}
//  [rust]
use proconio::input;

fn main() {
    input!{
        l: i32,
    }

    let a = l / 3;
    let ans = a * a * a;

    println!("{}", ans);
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {l: usize};

    let x = l % 3;

    let v = if x == 2 {
        l / 3 * (l / 3 + 1) * (l / 3 + 1)
    } else if x == 1 {
        l / 3 * l / 3 * (l / 3 + 1)
    } else {
        l / 3 * l / 3 * l / 3
    };

    println!("{}", v);
}
//  [swift]
import Foundation
let N = Double(String(readLine()!))!
print(N * N * N / 27.0)
//  [swift]
let l = Double(readLine()!)!
let edge = l/3.0
print(edge*edge*edge)
//  [swift]
import Foundation

/*
// 1
let N = Int(readLine()!)!

// 1 2
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let S = Int(split[1])!

// 1 2 3 4 5
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
*/

let N = Double(readLine()!)!
print((N / 3) * (N / 3) * (N / 3))
//  [swift]
import Foundation
let N = Int(String(readLine()!))!
print(Double(N * N * N / 27))
//  [swift]
import Foundation
let str = String(readLine()!)
let L = Int(str)!

let width = Double(L / 3)
let height = width
let depth = width

print(width * height * depth)
//  [swift]
import Foundation
let str = String(readLine()!)
let L = Int(str)!

let width = L / 3
let height = width
let depth =  L / 3 + (L - width * 3)

print(Double(width * height * depth))
//  [typescript]
import * as fs from 'fs';
const input = fs.readFileSync("/dev/stdin", "utf8");

const L = +input;

const taiseki = (L / 3) * (L / 3) * (L / 3);

console.log(taiseki);
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const l = +input[0];

console.log(Math.pow(l/3,3).toFixed(6));
//  [typescript]
function Main(input: string) {
  const val = (+input /3 );
  console.log(val * val * val)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from 'fs';

// main
function main(input: string[]) {
    // param
    var n: number = 0;
    var m: number = 0;
    var ans: number = 0;
    // init
    [n, m] = input.shift().split(" ").map(x => Number(x));
    // solve
    ans = n * (n - 1) / 2 + m * (m - 1) / 2
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();
//  [typescript]
import * as fs from 'fs';

namespace AtCoder.abc159 {

    class ProgramC {
        args: string[];

        constructor(args: string[]) {
            this.args = args;
        }

        /**
         * in
         * 999
         * out
         *
         */
        main(): void {
            const l: number = parseInt(this.args[0]);

            let a: number = 0;
            let b: number = 0;
            let c: number = 0;

            a = Math.ceil(l / 3);
            b = Math.ceil(l / 3);
            c = l - (a + b);

            console.log(a*b*c);
        }
    }

    const args = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
    const prg = new ProgramC(args);
    prg.main();
}
//  [typescript]
const stdin: string[] = [];

function main() {
    const input = stdin[0];
    const L = parseInt(input, 10);

    const N = L / 3;
    const n = Math.floor(N);
    const d = N - n;
    let A = 0;
    let B = 0;
    if (d > 0.5) {
        A += 1;
        B += 1;
    } else if (d > 0.1) {
        A += 1;
    }
    console.log(N * (N+A) * (N+B));
}

require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
}).on("line", _ => {
    stdin.push(_);
}).on("close", () => main());
//  [python]
import sys
input()
ans,d=0,{}
for ln in sys.stdin:
    s=''.join(sorted(ln))
    ans+=d.setdefault(s,0)
    d[s]+=1
print(ans)
//  [python]
import sys
input()
ans,c=0,{}
for ln in sys.stdin:
    s=''.join(sorted(ln))
    ans+=c.setdefault(s,0)
    c[s]+=1
print(ans)
//  [python]
from collections import Counter
import itertools
n = int(input())
l = []
for i in range(n):
    s = input()
    l.append(Counter(s))
    
q = list(itertools.combinations(range(n), 2))
ans = 0

for i in range(len(q)):
    if l[q[i][0]] == l[q[i][1]]:
        ans += 1

print(ans)
//  [python]
def resolve():
    n = int(input())
    words = []
    for _ in range(n):
        words.append(str(sorted(list(input()))))
    a = collections.Counter(words)
    ans = 0
    for i in a.values():
        ans += i*(i-1)//2
    print(ans)
resolve()
//  [python]
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
S_counter = Counter(S)
ans = 0
for i in S_counter.values():
    if i > 1:
        ans += (i-1)*i/2
print(int(ans))
//  [java]
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        
        Long count = new Long(0);

        Integer n = Integer.parseInt(stdin.readLine());
        
        Map<String, Integer> map = new HashMap<>();
        
        // 標準入力を1行ずつ読み出す。
        String line;
        while ((line = stdin.readLine()) != null) {
            char[] chars = line.toCharArray();
            Arrays.sort(chars);
            String newStr = new String(chars);
            Integer temp = map.get(newStr);
            if (temp == null) {
                map.put(newStr, 1);
            } else {
                count += temp;
                map.put(newStr, temp+1);
            }
        }
        System.out.println(count);
    }
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            char[]ss = sc.next().toCharArray();
            Arrays.sort(ss);
            s[i] = new String(ss);
        }
        long ans = 0;
        for (int i = 0; i < n -1; i++) {
            for (int j = i + 1; j < n; j++) {
                if(s[i].contains(s[j])) {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		Map<String, Integer> set = new HashMap<>();
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			char[] ch = s.toCharArray();
			Arrays.sort(ch);
			String e = new String(ch);
			
			set.compute(e, (k, v) -> {
				return v == null ? 0 : v + 1;
			});

		}
		
		long cnt = 0;
		for( Integer it : set.values() ) {
			cnt += it*(it+1)/2;
		}

		System.out.println(cnt);

	}
}
//  [java]
import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < s.length; i++) {
            s[i] = sc.next();
        }
        ArrayList<TreeMap<Character, Integer>> list = new ArrayList<>();
        for (int i = 0; i < s.length; i++) {
            String tmp = s[i];
            TreeMap<Character, Integer> map = new TreeMap<>();
            for (int j = 0; j < tmp.length(); j++) {
                char key = tmp.charAt(j);
                if(map.containsKey(key)) {
                    map.put(key, map.get(key) + 1);
                }else {
                    map.put(key, 1);
                }
            }
            list.add(map);
        }
        long ans = 0;
        for (int i = 0; i < list.size() - 1; i++) {
            TreeMap<Character, Integer> map = list.get(i);
            for (int j = i + 1; j < list.size(); j++) {
                TreeMap<Character, Integer> map2 = list.get(j);
                if(map.equals(map2)) ans++;
            }
        }
        System.out.println(ans);
    }
}