jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import static java.util.stream.Collectors.toList;

public class Main{
    private static final BigDecimal CONVERSION = new BigDecimal("0.006");

    public static int process(TestCase testCase) {
        int N = testCase.N;
        int T = testCase.T;
        int A = testCase.A;
        List<Integer> H = testCase.H;

        final List<BigDecimal> diffs = H.stream().map(x -> asTemperature(x, T)).map(t -> asDiff(t, A)).collect(toList());

        int minIndex = 0;
        for (int i = 1, length = H.size(); i < length; ++i) {
            final BigDecimal minDiff = diffs.get(minIndex);
            final BigDecimal diff = diffs.get(i);
            final boolean isCloser = diff.compareTo(minDiff) < 0;
            if (isCloser) {
                minIndex = i;
            }
        }

        return minIndex + 1;
    }

    private static BigDecimal asTemperature(int x, int t) {
        return BigDecimal.valueOf(t).subtract(CONVERSION.multiply(BigDecimal.valueOf(x)));
    }

    private static BigDecimal asDiff(BigDecimal t, int a) {
        return t.subtract(BigDecimal.valueOf(a)).abs();
    }

    private static boolean is753(int x) {
        return x == 7 || x == 5 || x == 3;
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final int result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int T = sc.nextInt();
        int A = sc.nextInt();

        List<Integer> H = new ArrayList<>();
        for (int i = 0; i < N; ++i) {
            H.add(sc.nextInt());
        }

        sc.close();
        return new TestCase(N, T, A, H);
    }

    private static void output(int result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final int T;
        final int A;
        final List<Integer> H;

        public TestCase(int N, int T, int A, List<Integer> H) {
            this.N = N;
            this.T = T;
            this.A = A;
            this.H = H;
        }
    }
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define M 998244353
#define F first
#define S second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
#define pb push_back
#define M6 6000009
#define M5 300009
#define pi 3.14159265
ll power(ll x,ll n){
    ll ret=1;
    x%=M;
    while(n>0){
        if(n&1) ret=(ret*x)%M;
        x=(x*x)%M;
        n/=2;
    }
    return ret;
}
struct my_data{
    int x,y,z;
};
ll prime[M6],sp[M6];
void sieve(){
    for(int i=1;i<M6;i++) prime[i]=1;
    for(ll i=2;i*i<M6;i++){
        if(!prime[i]) continue;
        for(ll j=i*2;j<M6;j+=i) {
            prime[j]=0;
            if(sp[j]==0) sp[j]=i;
        }
    }
    for(int i=1;i<M6;i++) if(!sp[i]) sp[i]=i;
}
ll n,m,ar[M5];
int  main()
{   //ios_base::sync_with_stdio (0), cin.tie (0);
    sieve();
    //init();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll tc=1,t=1,flag,i,j,k,l,p,q,ans,x,y,r,a,b,c;
    //cin>>tc;
    while(tc--){
        cin>>n>>t>>a;
        t*=1000; a*=1000;
        y=1e9,ans=-1;
        for(i=1;i<=n;i++) {
            cin>>ar[i];
            if(abs((t-ar[i]*6)-a)<y){
                y=abs((t-ar[i]*6)-a);
                ans=i;
            }
        }
        cout<<ans;
    }   
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N,T,A;
    cin >> N >> T >> A;
    
    int H;
    double temp=10000;
    int near=0;

    for(int i=0;i<N;i++){
        cin >> H;
        if((fabs(A-(T-H*0.006)))<temp){
            near=i;
        }
        temp=min((fabs(A-(T-H*0.006))),temp);
    }
    cout << near+1 << endl;

}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define MAX_N 1000

int N, T, A, i;
int H[MAX_N];

double caltmp(int h) {
  return T - h*0.006;
}

int main() {
  scanf("%d", &N);
  scanf("%d %d", &T, &A);
  for (i = 0; i < N; i++) {
    scanf("%d", &H[i]);
  }
  double delt = fabs(A-caltmp(H[0]));
  int ans = 0;
  for (i = 1; i < N; i++) {
    if (fabs(A-caltmp(H[i])) < delt) {
      delt = fabs(A-caltmp(H[i]));
      ans = i;
    }
  }
  printf("%d", ans+1);
  return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main()
{
  int N,T,A;
  int H[1001];
  int i,j;
  double p,q;
  scanf("%d",&N);
  scanf("%d",&T);
  scanf("%d",&A);
  scanf("%d",&H[0]);
  p=fabs(A-T+0.006*H[0]);
  j=1;
  for(i=1;i<N;i++){
    scanf("%d",&H[i]);
    q=p;
    p=fabs(A-T+0.006*H[i]);
    if(q<=p) p=q;
    if(p<q) j=i+1;
  }
  printf("%d",j);
  return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<stdlib.h>

int main(void){
    int N,T,A;
    scanf("%d",&N);
    scanf("%d%d", &T, &A);
    int H[N];
    for(int i=0; i<N; i++){
        scanf("%d",&H[i]);
    }

    int base = abs(1000*T-6*H[0]), judge, ans = 0;
    for(int i=0; i<N; i++){
        judge = abs(1000*(A-T)+6*H[i]);
        if(base>judge){
            base = judge;
            ans=i;
        }
    }

    printf("%d\n",ans+1);
    return 0;
}
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var T = parseInt(input[1].split(" ")[0]);
  var A = parseInt(input[1].split(" ")[1]);
  H = new Array(N);
  tmp= input[2].split(" ");
  var K=10000;
  var ans=0;
  for(i=0;i<N;i++){
    H[i]=parseInt(tmp[i]);
    var b = T-H[i]*0.006;
    if(Math.abs(A-b)<K){
      K=Math.abs(A-b);
      ans=i+1;
    }
  }
  var ans;
  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';

function Main(input) {
  const N = Number(input.split("\n")[0]);
  const T = Number(input.split("\n")[1].split(" ")[0]);
  const A = Number(input.split("\n")[1].split(" ")[1]);
  const Hs = input.split("\n")[2].split(" ").map(x => Number(x));
  let Temps = [];

  for(let val of Hs) {
    Temps.push(Math.abs(A - (T - val*0.006)));
  }

  const min = Math.min.apply(null, Temps);

  console.log(Temps.indexOf(min) + 1);

};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest=arguments,v=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<v)v=rest[i];return v}
function max(){var rest=arguments,v=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>v)v=rest[i];return v}
function gcd(){var rest=arguments,v=rest[0],temp=(a,b)=>b?temp(b,a%b):a;for(var i=1;i<rest.length;i++)v=temp(v,rest[i]);return v}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var n = toInt(input[0]);
	var ta = toIntArr(input[1].split(' '));
	var hs = toIntArr(input[2].split(' '));
	var t = ta[0];
	var a = ta[1];

	var ans = 1;
	var x =abs(t-a-0.006*hs[0]) ,y;
	for(var i = 1; i < n; i++){
		y = abs(t-a-0.006*hs[i]);
		//console.log(i,x,y)
		if(y<x){
			ans = i+1;
			x = y;
		}
	}

	console.log(ans);

}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for B - Palace
	var N int
	fmt.Scanf("%d", &N)
	var T, A int
	fmt.Scanf("%d %d", &T, &A)

	var H int
	var flag float64 = 100000.0
	var answer int
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &H)
		point := math.Abs(float64(A) - (float64(T) - float64(H)*0.006))
		if flag > point {
			flag = point
			answer = i + 1
		}
	}
	fmt.Println(answer)
}
//  [go]
package main

import "fmt"

func main() {
	var n, t, a int
	var h []int
	fmt.Scanf("%d", &n)
	fmt.Scanf("%d %d", &t, &a)

	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scanf("%d", &tmp)
		h = append(h, tmp)
	}

	hh := (t - a) * 1000 / 6
	var an, tmp int
	tmp = 1<<63 - 2
	for j, i := range h {
		if tmp > hh-i && hh-i > (-tmp) {
			tmp = abs(hh - i)
			an = j + 1
		}
	}
	fmt.Println(an)
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
//  [go]
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	t, a := scanFloat64(), scanFloat64()
	ans := 0
	x := 1e9
	for i := 0; i < n; i++ {
		h := scanFloat64()
		p := math.Abs(t - h*0.006 - a)
		if p < x {
			x = p
			ans = i + 1
		}
	}
	fmt.Fprintln(wr, ans)
}
//  [ruby]
n,t,a,*h=`dd`.split.map &:to_i
p (1..n).min_by{|i|(t-h[i-1]*0.006-a).abs}
//  [ruby]
n,t,a,*h=`dd`.split.map &:to_i
i=0
puts h.map{|x| [(a-(t-x*0.006)).abs, i+=1]}.min[1]
//  [ruby]
n=gets.to_i
T=gets.split(" ")
h=gets.split(" ")
ans=0
nums=[]
n.times do |i|
nums[i]=(T[1].to_i-(T[0].to_i-h[i].to_i*0.006)).abs
end
n.times do |i|
if nums[i]==nums.min then
ans=i
break
end
end
puts  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: i64,
        a: i64,
        h: [i64;n],
    }
    let INF = 100_0000;
    let mut minv = INF;
    let mut mini = 1;
    for i in 0..n {
        let te: i64 = t * 1000 - h[i] * 6;
        debug!(te);
        if minv > (a*1000 - te).abs() {
            minv = (a*1000 - te).abs();
            mini = i+1;
        }
    }

    println!("{}", mini);

}
//  [rust]
// use proconio::marker::Chars;
use proconio::{fastout, input};
use std::cmp::{max, min};

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

    let mut tt = std::f64::MAX;
    let mut result = 0;

    for i in 0..n {
        input! {
            h:i32
        }

        let x = t as f64 - h as f64 * 0.006;

        if tt > (x - a as f64).abs() {
            tt = (x - a as f64).abs();
            result = i + 1;
        }
    }

    println!("{}", result);
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed 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 cnt = std::f64::MAX;
    let mut ans = 0;
    for i in 1..=n {
        let tmp = (a - (t - read::<f64>() * 0.006)).abs();
        if tmp < cnt {
            cnt = tmp;
            ans = i;
        }
    }
    println!("{}", ans);
}
//  [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]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    func count() -> Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
}
extension Array where Element: Comparable {
    func max() -> Element! {
        return self.maxElement()
    }
    func min() -> Element! {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let N = readInt()!
let input = readIntSplit(by: " ").map{Double($0)}
let (T, A) = (input[0], input[1])
var H = readIntSplit(by: " ").map{T - Double($0) * 0.006}
var arr = [(Int, Double)]()
for i in 0..<N {
    arr += [(i+1, abs(A-H[i]))]
}
arr = arr.sort{$0.1<$1.1}
print(arr[0].0)
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func toTuple<T>(_ args: [T]) -> (T, T, T) { (args[0], args[1], args[2]) }
func toTuple<T>(_ args: [T]) -> (T, T, T, T) { (args[0], args[1], args[2], args[3]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }
func readDoubles() -> [Double] { readLine()!.split(separator: " ").map { Double($0)! } }
func readStrings() -> [String] { readLine()!.split(separator: " ").map { String($0) } }

let n = Int(readLine()!)!
let (t, a) = toTuple(readDoubles())
let hi = readDoubles()

var d = 9999.0
var ans = 0
for i in 0..<n {
  let tt = t - hi[i] * 0.006
  if d > abs(a - tt) {
    ans = i + 1
    d = abs(a - tt)
  }
}
print(ans)
//  [typescript]
let input = require('fs').readFileSync('/dev/stdin', 'utf8');
input = input.split(/\s/);

const N = Number(input[0]);
const T = Number(input[1]);
const A = Number(input[2]);
const H = input.slice(3, 3 + N).map(Number);

const l = [];

for (let i = 0; i < H.length; i++) {
  l.push([i + 1, Math.abs(T - H[i] * 0.006 - A)]);
}

l.sort((a, b) => a[1] - b[1]);

console.log(l[0][0]);
//  [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);
 
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const main = (input: string) => {
  const lines = input.trim().split("\n")
  const [T, A] = lines[1].split(" ").map(str => parseInt(str));
  const H = lines[2].split(" ").map(str => parseInt(str))
  let points:number[] = [];
  const index = 0.006

  H.forEach(h => {
    points.push(Math.abs(A - (T - h * index)))
  })
  console.log(points.indexOf(Math.min(...points)) + 1);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    L = get_input(int)

    print(L**3 / 3**3)


if __name__ == '__main__':
    main()
//  [python]
import sys
import numpy as np
input = sys.stdin.readline

def main():
    L = int(input())
    l = L / 3

    print(l*l*l)

main()
//  [python]
import numpy as np
l = int(input())

e = l / 3
print(e * e * e)
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int l = scanner.nextInt();
//		double result = 0;
//		for(int i = 1; i <= l-2; i++){
//			for(int j = l-i-1; j >= 1; j--){
//				int k = l - i - j;
//				result = Math.max(result, i*j*k);
////				System.out.println(i+","+j+","+k+" : " + result);
//			}
//		}
		double rrr = 0d;
		double a = 0.1d;
		while(a <= l - 0.2d){
			double b = l - a;
			while(b > 0){
				double c = l - a - b;
				rrr = Math.max(rrr, a * b * c);
				b -= 0.1d;
			}
			a += 0.1d;
		}
		float ll = l;

		System.out.println(ll/3*(ll/3)*(ll/3));
	}

}
//  [java]

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 * HashMap<Integer, Integer> hm = new HashMap<>();
 * int[] s = new int[M];
 * ArrayDeque<Integer> deq = new ArrayDeque<>();
 *
 */
public class Main implements Runnable { //クラス名はMain1

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 1024 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	public void run() {
		FastScannerMainC sc = new FastScannerMainC(System.in);

		try {
			//String S = sc.nextLine().trim();
			double L = sc.nextDouble();

			double nn = L / 3;

			double ans = Math.pow(nn, 3);

			//int[] a = new int[N];
			//long l = sc.nextLong();
			//ArrayList<Integer> arr = new ArrayList<Integer>();
			//for (int i = 0; i < N; i++) {}

			//System.out.println(Double.toString(ans));

			System.out.println(BigDecimal.valueOf(ans).toPlainString());

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

//高速なScanner
class FastScannerMainC {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMainC(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    double n;
    cin>>n;
    double maxv=0;
    for (double i = 0.000001; i < n; i+=0.000001)
    {
        /* code */
        maxv=max(maxv,i*i*(n-(i+i)));
    }
    cout<<fixed<<setprecision(12)<<maxv<<endl;
    }
//  [cpp]
#include<stdio.h>
double max;
int main(){
	int a;
	scanf("%d",&a);
	int x=a/3;
	for(double i=-1;i<=1;i+=0.0001){
		for(double j=-1;j<=1;j+=0.0001){
			double n=x+i;
			double m=x+j;
			double nm=a-n-m;
			if(n<0||m<0||nm<0)continue;
			if(max<n*m*nm)max=n*m*nm;
		}
	}
	printf("%lf",max);
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int L;
    cin >> L;
    double max=0;
    double v=0;
    
    double t=0.05;
    
    if(L<5){
        t=0.0001;
    }
    
    for(double a=0;a<L;a=a+t){
        for(double b=0;b<L-a;b=b+t){
            v=a*b*(L-a-b);
            
            
            if(max<v){
                max=v;
            }
        }
    }
    cout << fixed;
    cout << setprecision(7) << max << endl;
    
    
    }
//  [c]
#include <stdio.h>


int main()
{
    double l,a,b,c;
    scanf("%lf",&l);
    a=l/3;
   // printf("%f   \n",a);
    double vmax=a*a*a;
    for(;a<l;a++){
        for(b=l/3;b<l;b++){
            for(c=l/3;c<l;c++)
                if(a+b+c==l && a*b*c>vmax)
                vmax=a*b*c;
        }
    }
    printf("%.12f",vmax);
    return 0;
}
//  [c]
/*
 * main.c
 *
 *  Created on: 2020/02/22
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}


int main()
{
	int L = 0;
	double l = 0.0, ans = 0.0;
	scanf("%d", &L);
	l = (double)L;
	ans = l/3.0;
	printf("%.9f\n", ans*ans*ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    double l, a, ans;
    scanf("%lf",&l);

    a = l / 3.0;

    ans = a*a*a;

    printf("%f",ans);
    return 0;
}
//  [javascript]
function Main(input){
	input -= 0;
	console.log(Math.pow(input/3,3))
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
var debug = false;

//for(var i =0;i<;i++)

var dx = [-1, 1, 0, 0];
var dy = [0, 0, -1, 1];

function Main(input) {

    var l = input.split("\n")[0];
    console.log((l / 3) * (l / 3) * (l / 3));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
if (!debug)
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
else
    Main(require("fs").readFileSync("./input", "utf8"));
//  [javascript]
"use strict";
function main(input) {
  let kari = input[0].trim().split(" ").map(i => parseInt(i));
  const l = kari[0];
  console.log(l/3 * l/3 * l/3);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
//  [go]
package main

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

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	l := io.NextFloat()
	a := l / 3
	io.Printf("%.12f\n", a*a*a)
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextFloat returns a float64 number from stdin
func (io *Io) NextFloat() float64 {
	f, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

// Printf is awapper of fmt.Fprintf
func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}
//  [go]
package main

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

//const mod = 998244353
const mod = 1000000000000007
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
}
//  [ruby]
l = gets.chomp.to_f
x = y = z = 0
max = ans = 0

0.step(l,0.0001) do |kx|
    ans = kx * ((l - kx)/2)**2
    if ans > max
      max = ans
  end
end

puts max
//  [ruby]
require 'set'
require 'bigdecimal'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

L = get_int

x = BigDecimal(L) / 3

puts (x ** 3).to_f
//  [ruby]
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
l = gets.chomp.to_i

puts (l**3).to_f / 27
//  [rust]
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::Chars;
//use proconio::marker::Usize1;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
use std::cmp::*;
//use std::num;

fn main() {
    input! {
        L:f64
    }
    println!("{}", (L / 3f64).powf(3f64));
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed 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 l:f64 = read();
    println!("{}", (l/3.0).powf(3.0));
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    var l = Double(readLine()!)!
    l = l / 3
    print(pow(l, 3))
    
}

main()
//  [swift]
import Foundation

let num:Double = Double(readLine()!)!
let line = num / 3.000000
let V = (line) * (line) * (line)
print(V)
//  [typescript]
const stdin: string[] = [];

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

    const N = L / 3;
    console.log(N * N * N);
}

require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
}).on("line", _ => {
    stdin.push(_);
}).on("close", () => main());
//  [typescript]
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    var l: number = 0;
    var ans: number = 0;
    // init
    l = Number(input.shift());
    // solve
    ans = Math.pow(l/3, 3);
    // 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]


process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

// 解答
function main(inputs:Array<string>) : void {

    // 1辺の長さ
    let length: number = Number.parseInt(inputs[0]) / 3;

    let volume: number = length * length * length;  
    
    console.log(volume);
}
//  [python]
from collections import Counter
n = int(input())
s = [str(sorted(input())) for i in range(n)]

c = Counter(s)

l = sum((v*(v-1)/2) for v in c.values())
print(int(l))
//  [python]
import math
N = int(input())
L = []
for i in range(N):
    s = input()
    L.append(sorted(s))
L = sorted(L)
ans = 0
comb = 0
a = 0
b = 1
while b <= N-1:
    if L[a] == L[b] and b-a == 1:
        comb += 2
        b += 1
    elif L[a] == L[b]:
        comb += 1
        b += 1
    elif comb != 0:
        ans += (math.factorial(comb))//((math.factorial(comb-2))*2)
        a = b
        b = a+1
        comb = 0
    else:
        a = b
        b = a + 1
if comb != 0:
    ans += (math.factorial(comb)) // ((math.factorial(comb - 2)) * 2)
print(ans)
//  [python]
N=int(input())
s=[]
for k in range(N):
    s.append([None]*10)
    l=input()
    for j in range(10):
        s[k][j]=l[j]
    s[k].sort()
s.sort()
a=0
r=0
for i in range(N-1):
    if s[i]==s[i+1]:
        r+=1
    elif r!=0:
        a+=r*(r+1)//2
        r=0
a+=r*(r+1)//2
print(a)
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	}
}
//  [java]
import java.util.*;

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++){
			s[i] = sc.next();
		}
		HashMap<String,Integer> map = new HashMap<String,Integer>();
		for(int i = 0; i < n; i++){
			int[] a = new int[10];
			for(int j = 0; j < 10; j++){
				a[j] = s[i].charAt(j);
			}
			Arrays.sort(a);
			String b = "";
			for(int j = 0; j < 10; j++){
				b+=b + a[j];
			}
			if(map.containsKey(b)){
				map.put(b,map.get(b)+1);
			}else{
				map.put(b,0);
			}
		}
		long ans = 0;
		Iterator<String> it = map.keySet().iterator();
		while (it.hasNext()) {
			String key = it.next();
			long tmp = (long)map.get(key)*(map.get(key)+1)/2;
			ans+=tmp;
		}
		System.out.print(ans);
	}
}
//  [java]

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        String[] s = new String[n];
        for(int i=0;i<n;i++){
            s[i] = sc.next();
        }
        Map<List<String>, Integer> codes = new HashMap<>();
        long count = 0;
        for(int i=0;i<n;i++){
            String[] st = s[i].split("");
            Arrays.sort(st);
            List<String> str = Arrays.asList(st);
            if(codes.containsKey(str)){
                int tmp = codes.get(str);
                count += (long)tmp;
                codes.put(str, tmp+1);
            }
            else{
                codes.put(str, 1);
            }
        }
        System.out.println(count);
    }
}
//  [cpp]
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class CGreenBin {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    in >> N;
	    vector<string> s(N);
	    REP(i,0,N) in >> s[i];

	    unordered_map<string, int> anagrams;
	    REP(i,0,N) {
	        string key = "";
	        for (const char c : "abcdefghijklmnopqrstuvwxyz") {
	            key += toString(count(all(s[i]), c));
	        }
	        anagrams[key]++;
	    }
	    ll answer = 0;
	    for (const auto grams : anagrams) {
	        const ll num = grams.second;
	        if (num > 1) {
	            answer += num * (num-1) / 2;
	        }
	    }
	    out << answer << "\n";
	}
};


int main() {
	CGreenBin solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll func(ll n)
{
	return (n*(n-1))/2;
}
int main()
{
	ll n;
  cin>>n;
  unordered_map<string,ll> finale;
  ll i,j;ll ans=0;
  for(i=0;i<n;i++)
  {
  	string s;
    cin>>s;
    vector<ll> check(26,0);
    string check2="";
    for(j=0;j<s.size();j++)
      check[(ll)s[j]-97]++;
     for(j=0;j<26;j++)
     {
         ll num=check[j];
         ostringstream str1; 
         str1<<num;
         string geek = str1.str();
         check2=check2+geek;
     }
    finale[check2]++;
  }
  for(auto it=finale.begin();it!=finale.end();it++){
      ans+=func(it->second);
  }
  cout<<ans<<endl;
}
//  [cpp]
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, ans = 0;
	string str;
	cin >> nn;
	vector<int64> ss(nn, 0);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> str;
		sort(str.begin(), str.end());
		for(int64 jj = 0;jj < 10;jj++)
		{
			ss[ii] += (int64)(pow(26, jj)) * (str[jj] - 'a');
		}
	}
	sort(ss.begin(), ss.end());
	for(int64 ii = 0;ii < nn - 1;ii++)
	{
		for(int64 jj = ii + 1;jj < nn;jj++)
		{
			if(ss[ii] == ss[jj])
			{
				ans++;
			}
			else
			{
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define LENGTH 10

typedef struct list{
	char str[11];
	int num;
	struct list* next;
} List;

void sort(char* str, int n){
	int i, j;
	for(i = 0; i < n - 1; i++){
		for(j = i + 1; j < n; j++){
			if(str[i] > str[j]){
				char temp;
				temp = str[i];
				str[i] = str[j];
				str[j] = temp;
			}
		}
	}
}
int hash(char* str, int n){
	int str_int = 0;
	int i;
	for(i = 0; i < n; i++){
		str_int += str[i] - 'a';
	}
	return str_int;
}
void Insert(List* pre){
	List* new_entry = malloc(sizeof(List));
	new_entry -> next = pre -> next;
	pre -> next = new_entry;
}

int main(void){
	int N;
	int i;
	long long ans = 0;
	List* head[LENGTH * ('z' - 'a') + 1];
	List dummy[LENGTH * ('z' - 'a') + 1];
	List* cullent;
	char buf[11];
	
	//ハッシュテーブル基礎作成
	for(i = 0; i <= LENGTH * ('z' - 'a'); i++){
		head[i] = &dummy[i];
		dummy[i].next = NULL;
		dummy[i].num  = 0;
		strcpy(dummy[i].str, "\0");
	}
	
	scanf("%d", &N);
	//文字列入力
	for(i = 0; i < N; i++){
		//文字列入力
		scanf("%s", buf);
		//文字列をAtoZにソートする
		sort(buf, LENGTH);
		//要素を昇順に追加(ハッシュテーブル)
		cullent = head[hash(buf, LENGTH)];
		while(cullent -> next != NULL && strcmp(cullent -> next -> str, buf) != 0){
			cullent = cullent -> next;
		}
		if(cullent -> next == NULL){
			Insert(cullent);
			cullent = cullent -> next;
			strcpy(cullent -> str, buf);
			cullent -> num = 1;
		}
		else{
			cullent = cullent -> next;
			strcpy(cullent -> str, buf);
			cullent -> num += 1;
		}
	}
	//組み合わせ数を数える
	for(i = 0; i <= LENGTH * ('z' - 'a'); i++){
		for(cullent = head[i]; cullent != NULL; cullent = cullent -> next){
			//nC2 を計算
			ans += (long long)cullent -> num * (cullent -> num - 1) / 2;
		}
	}
	printf("%I64llu", ans);

	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#define MAX 100001


int hash(char *a){
  int key=0, i;
  
  for(i=0;i<10;i++){
    key += a[i];
  }
  return key % 100;
}

int compare(void *a, void *b){
  return *(char*)a - *(char*)b;
}

int test(char *a, char *b){
  int i;
  
  for(i=0;i<10;i++){
    if(a[i] != b[i])return 0;
  }
  return 1;
}

int main(){
  int n,list[100][MAX],h,num=0,
      i,j,k;
  long long same[MAX],count=0;
  char store[MAX][10],tmp[11];
  
  for(i=0;i<100;i++){
    list[i][0] = -1;
  }
  
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%s", &tmp);
    qsort(tmp, 10, sizeof(char), compare);
    
    h = hash(tmp);
    for(j=0; list[h][j] != -1; j++){
      if(test(tmp, store[list[h][j]])){
        same[list[h][j]]++;
        break;
      }
    }
    if(list[h][j] == -1){
      for(k=0;k<10;k++){store[num][k] = tmp[k];}
      list[h][j] = num;
      list[h][j+1] = -1;
      same[num] = 0;
      num++;
    }
  }
  
  for(i=0;i<num;i++){
    count += ((same[i]+1) * same[i]) / 2;
  }
      
  printf("%lld", count);
  
  return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int n,i,j,v;
long r=0,m;
char s[11];
struct l{
    char s[11];
    int b;
    struct l *a;
};
struct l *ht[500000];
struct l *p,*q;
int comp(const void *a, const void *b){return *(char*)a-*(char*)b;}
int main(){
    scanf("%d",&n);
    for(i=n;i--;){
        scanf("%s",s);
        qsort(s,10,sizeof(char),comp);
        m=0;
        for(j=0;s[j]!='\0';)m+=s[j++]*(j+1);
        m%=500000;
        j=1;
        for(p=ht[m];p!=NULL;p=p->a){
            if(!strcmp(s,(*p).s)){
                r+=(*p).b;
                (*p).b++;
                j=0;
                break;
            }
        }
        if(j){
            p=(struct l*)malloc(sizeof(struct l));
            strcpy((*p).s,s);
            (*p).b=1;
            p->a=NULL;
            if(ht[m]==NULL)ht[m]=p;
            else{
                q=ht[m];
                while(q->a!=NULL)q=q->a;
                q->a=p;
            }
        }
    }
    printf("%ld",r);
    return 0;
}
//  [javascript]
const fun = (n) => {
    return Math.floor(n * (n - 1) / 2)
}

const main = (N,S) => {
    var count = {} 
    for(var i = 0;i<=N;i++) {
      	var tmp = S[i].sort().join('')
        if(tmp in count) {
            count[tmp]+=1
        }else{
            count[tmp] = 1
        }
    }
    var result = 0
  	for(item in  count) {
        result+=fun(count[item])
      }
    return result
}

const input = require('fs').readFileSync('/dev/stdin','utf8').split("\n")
const N = Number(input[0])
const S = input.slice(1).map(x => Array.from(x))
console.log(main(N,S))
//  [javascript]
'use strict';
const main = input => {
  const n = parseInt(input[0], 10);
  input.shift();
  input.pop();
  let s = new Array(n);
  s = input;
  s = s.map(val => [...val].sort((x,y)=>x>y?1:-1).toString()).sort();
  // console.log(s);
  let t = s[0], val = 0, ans = 0;
  for(let i=1; i<n; i++) {
    if (s[i] == t) val++;
    else {
      ans += val*(val+1)/2;
      val = 0;
      t = s[i];
    }
  }
  if (val) ans += val*(val+1)/2;
  console.log(ans);
  
};
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));
//  [javascript]
function main(input) {
	var splitted = input.split("\n")
	var num = Number(splitted[0])
	var list = splitted
		.slice(1)
		.map(s => Array.from(s).sort().join(''))
		.sort()
	var count = 0
	var pasts = [
		[list[0]]
	]
	var pastsIndex = 0
	for (var i = 1; i < list.length; i++) {
		if (list[i] === pasts[pastsIndex][0]) {
			count += pasts[pastsIndex].length
			pasts[pastsIndex].push(list[i])
			continue;
		}
		pastsIndex++
		pasts.push([list[i]])
	}
	console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"sort"
)

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

	c := map[string]int{}

	for i := 0; i < N; i++ {
		var s string
		fmt.Scanf("%s", &s)
		a := count(s)
		key := key(a)
		_, ok := c[key]
		if ok {
			c[key] += 1
			continue
		}
		c[key] = 1
	}

	var total int64
	for _, count := range c {
		if count == 1 {
			continue
		}
		total += int64(count) * (int64(count)-1) / 2
	}

	fmt.Printf("%d", total)
}

func key(m map[rune]int) string {
	keys := []int{}
	for k := range m {
		keys = append(keys, int(k))
	}
	sort.Ints(keys)

	str := ""
	for _, k := range keys {
		str += fmt.Sprintf("%d:%d-", k, m[rune(k)])
	}
	return str
}


func count(s string) map[rune]int {
	c := map[rune]int{}
	for _, r := range s {
		_, ok := c[r]
		if ok {
			c[r] += 1
			continue
		}
		c[r] = 1
	}
	return c
}
//  [go]
package main


import (
  "fmt"
  // "strings"
  "strconv"
  "sort"
)


func sum (n int) int {
  return (n * (n+1)) / 2
}


func max(a int, b int) int {
  if a > b {
    return a
  }
  return b
}


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

  var s string
  a := make(map[string]int)

  for i := 0; i<n; i++ {
    var keys []string

    fmt.Scanf("%s", &s)
    m := make(map[string]int)

    for k := 0; k<10; k++ {
      keys = append(keys, string(s[k]))

      val, ok := m[string(s[k])]
      if (ok) {
        m[string(s[k])] = val+1
      } else {
        m[string(s[k])] = 1
      }
    }

    sort.Strings(keys)
    var sign string
 
    for _, key := range keys {
      sign += (key + strconv.Itoa(m[key]))
    }

    val, ok := a[sign]
    if (ok) {
      a[sign] = val + 1
    } else {
      a[sign] = 1
    }
  }

  var ans int
  for _, val := range a {
    ans += sum(val-1)
  }

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

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

func main() {
	var n int
	fmt.Scan(&n)

	strList := scanStrings(n)

	results := make(map[string]int)
	for _, str := range strList {
		result := ""
		for c := 'a'; c <= 'z'; c++ {
			result += strconv.Itoa(strings.Count(str, string(c)))
		}
		results[result] += 1
	}

	resultCnt := 0
	for _, v := range results {
		if v != 1 {
			// vC2
			resultCnt += (v * (v-1)) / 2
		}
	}
	fmt.Println(resultCnt)
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}
//  [ruby]
n = gets.chomp.to_i

ana = {}
n.times do
  s = gets.chomp.split('').sort.join
  if ana.has_key?(s.to_sym)
    ana[s.to_sym] += 1
  else
    ana[s.to_sym] = 1
  end
end

res = 0
ana.each do |arr|
  n = arr[1]
  res += n * (n-1) / 2
end

print(res)
//  [ruby]
n = gets.chomp.to_i
slist = []
result = 0
hhash = Hash.new(0)
n.times do |ni|
  s = gets.chomp
  hash = Hash.new(0)
  s.each_char do |si|
    hash[si] += 1
  end
  hhash[hash] += 1
  slist.push(hash)
end
hhash.each do |k,v|
  result += (v*(v-1))/2
end

puts result
//  [ruby]
def combi(n,k)
  k=n-k if 2*k > n
  return 1 if k == 0
  ((n-k+1)..n).reduce(&:*)/((1..k).reduce(&:*))
end

n = gets.to_i
items = Hash.new(0)
n.times do |i|
  s = Hash.new(0)
  gets.chomp.chars{|ch| s[ch] += 1}
  items[s] += 1
end

ans = 0
items.each do |k, v|
  ans += combi(v, 2) if v >= 2
end
puts ans