jiahuimbzuai/CoQuIR huggingface dataset:
//  [go]
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"sort"
	"strconv"
	"strings"
)

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

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	k := eGetInt(scanner)
	as := make([]int, n)
	for i := 0; i < len(as); i++ {
		as[i] = eGetInt(scanner)
	}
	acc := make([]int, n+1)
	for i := 0; i < len(as); i++ {
		acc[as[i]]++
	}
	sort.Sort(sort.Reverse(sort.IntSlice(acc)))
	count := 0
	for i := k; i < len(acc); i++ {
		count += acc[i]
	}
	fmt.Println(count)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}

func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
//  [go]
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Not so Diverse
	var N, K int
	fmt.Scanf("%d %d", &N, &K)

	sc.Split(bufio.ScanWords)
	A := make(map[int]int, N)
	var temp int
	for i := 0; i < N; i++ {
		temp = nextInt()
		A[temp]++
	}

	B := make([]int, 0)
	for _, v := range A {
		B = append(B, v)
	}

	sort.Sort(sort.IntSlice(B))

	var count int = len(A)
	var ans int
	for i := 0; i < N; i++ {
		if count > K {
			count--
			ans += B[i]
		} else {
			fmt.Println(ans)
			break
		}
	}
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

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

	m := make(map[int]int)
	for i := 0; i < n; i++ {
		fmt.Scan(&tmp)
		m[tmp]++
	}

	l := List{}
	for key, val := range m {
		l = append(l, Entry{key, val})
	}
	sort.Sort(l)

	count := 0
	for i := 0; i < len(m)-k; i++ {
		count += l[i].value
	}

	fmt.Println(count)
}

type Entry struct {
	name  int
	value int
}

type List []Entry

func (l List) Len() int {
	return len(l)
}

func (l List) Swap(i, j int) {
	l[i], l[j] = l[j], l[i]
}

func (l List) Less(i, j int) bool {
	if l[i].value == l[j].value {
		return l[i].name < l[j].name
	}
	return l[i].value < l[j].value
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func nextInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func main() {
	n := nextInt()
	k := nextInt()

	dic := map[int]int{}
	for range make([]struct{}, n) {
		a := nextInt()
		dic[a]++
	}
	seq := []int{}
	for _, v := range dic {
		seq = append(seq, v)
	}
	sort.Ints(seq)

	cnt := 0
	for i := 0; i < len(seq)-k; i++ {
		cnt += seq[i]
	}
	fmt.Println(cnt)
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

type Ball struct {
	Num int
	Cnt int
}
type Balls []Ball

func (b Balls) Len() int           { return len(b) }
func (b Balls) Swap(i, j int)      { b[i], b[j] = b[j], b[i] }
func (b Balls) Less(i, j int) bool { return b[i].Cnt < b[j].Cnt }

func main() {
	var N, K, a, r int
	fmt.Scan(&N, &K)
	m := map[int]int{}
	for i := 0; i < N; i++ {
		fmt.Scan(&a)
		m[a]++
	}
	var ba Balls
	for k, v := range m {
		ba = append(ba, Ball{Num: k, Cnt: v})
	}
	sort.Sort(Balls(ba))
	for i := 0; i < len(ba)-K; i++ {

		r += ba[i].Cnt
	}
	fmt.Println(r)
}
//  [ruby]
nu1,nu2 = gets.chomp.split(" ").map(&:to_i)
array = gets.chomp.split(" ").map(&:to_i)
store = Array.new(200001, 0)
for i in 0..nu1 - 1
  store[array[i]] += 1
end
result = store.sort
ans = nu1
for i in 1..nu2
  ans -= result[-i]
end

puts ans
//  [ruby]
n,k=gets.split.map(&:to_i)
arr = Array.new(n,0)
arr2 = gets.split.map(&:to_i)
n.times do |i|
  arr[arr2[i]-1]+=1
end
arr.sort!.reverse!
ans = arr[0..k-1].inject(:+)
puts n - ans
//  [ruby]
n,k = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)
bucket = Array.new(200000){|i| i = 0}

arr.each do |a|
  bucket[a] += 1
end

sort_b = bucket.sort.reverse
p n - sort_b[0..k-1].inject(:+)
//  [ruby]
n,k=gets.split.map{|e| e.to_i}
x=gets.split.map{|e| e.to_i}
hs=Hash.new(0)
x.each{|e|
	hs[e]+=1
}
arr=[]
hs.each{|k,v|
	arr<<[v,k]
}
arr.sort!
if arr.size<=k
	puts 0
else
	ans=0
	(0..(arr.size-k-1)).each{|i|
		ans+=arr[i][0]
	}
	puts ans
end
//  [ruby]
n, k = gets.split(" ").map(&:to_i)
as = gets.split(" ").map(&:to_i)

h = {}
as.each do |a|
  h[a] ||= 0
  h[a] += 1

end
as.uniq!
as.sort!{|a,b| h[b] <=> h[a]}

puts n - as[0...k].reduce(0) {|a,e| a+=h[e]}
//  [ruby]
def main(argv)
  (n, k) = STDIN.gets.chomp.split(' ').map(&:to_i)
  a = STDIN.gets.chomp.split(' ').map(&:to_i)

  c = [0] * n
  a.each {|v| c[v - 1] += 1}

  b = []
  c.each_with_index {|v, i| b.push({:key => i + 1, :val => v})}
  b = b.sort{|a, b| a[:val] <=> b[:val]}

  d = 0
  while b.size > k do
    v = b.shift
    d += v[:val]
  end

  STDOUT.puts d.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end
//  [rust]
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}
use input::*;

fn main() {
    let (n, k): (usize, usize);
    input!(n, k);
    let input = input_vector::<usize>();
    let mut count = 0;
    let mut v = vec![0; n];
    for z in input {
        if v[z - 1] == 0 {
            count += 1;
        }
        v[z - 1] += 1;
    }
    v.sort();
    if count <= k {
        count = 0;
    } else {
        count = count - k;
    }
    let mut ans = 0;
    for z in v {
        if count == 0 {
            break;
        }
        if z > 0 {
            ans += z;
            count -= 1;
        }
    }
    p(ans);
}
//  [rust]
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get { () => ( get().parse().unwrap() ) }
    
    let n = get!();
    let k: usize = get!();
    let mut vs = vec![0; 200001];
    for i in 0..n {
    	let a: usize = get!();
        vs[a] += 1;
    }
    let mut c = 0;
    for &v in &vs  {
    	if v > 0 {
        	c += 1;
        }
    }
    if k >= c {
    	println!("0");
        return;
    }
    vs.sort();
    let mut ans = 0;
    for &v in &vs {
    	if v > 0 {
        	ans += v;
            c -= 1;
            if c == k {
            	break;
            }
        }
    }
    println!("{}", ans);
}
//  [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! {
        n: usize,
        k: usize,
        aa: [usize;n]
    }
    let mut b = vec![0;n+1];
    for i in aa {
        b[i] += 1;
    }
    let mut c = b.iter().filter(|x| **x != 0).count();
    let mut res = 0;
    for i in 1..n+1 {
        if c <= k {
            break;
        }
        let p = std::cmp::min(c - k, b.iter().filter(|x| **x == i).count());
        c -= p;
        res += p * i;
    }
    println!("{}", res);
}
//  [rust]
use std::io::*;
use std::str::FromStr;
use std::collections::BTreeSet;
use std::collections::HashMap;

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: u32 = read();
    let k: i32 = read();
    let ai: Vec<u32> = (0..n).map(|_| read()).collect();
    let uniq: BTreeSet<u32> = ai.iter().cloned().collect();

    let diff: i32 = uniq.len() as i32 - k;

    if diff <= 0 {
        println!("0")
    } else {
        let mut map = HashMap::new();
        for a in ai.iter() {
            if map.contains_key(a) {
                if let Some(x) = map.get_mut(a) {
                    *x += 1;
                }
            } else {
                map.insert(a, 1);
            }
        }
        let mut counts: Vec<u32> = map.values().cloned().collect();
        counts.sort();
        let res: u32 = counts.iter().take(diff as usize).sum();;
        println!("{}", res);
    }
}
//  [rust]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use smallvec::alloc::collections::{BTreeMap, BTreeSet};

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.next_usize();
    let k = sc.next_usize();
    let mut a = BTreeSet::new();
    let mut m = BTreeMap::new();
    for _ in 0..n {
        let ai = sc.next_usize();
        a.insert(ai);
        *m.entry(ai).or_insert(0) += 1;
    }
    
    let l = if a.len() > k { a.len() - k } else { 0 };
    let m = m
        .into_iter()
        .map(|(key, value)| (value, key))
        .sorted();

    println!("{}", m.take(l).map(|(v, _)| v).sum::<usize>());
}

pub struct Scanner {
    buf: std::collections::VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: std::collections::VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: std::str::FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn next_char(&mut self) -> char {
        self.next()
    }

    pub fn next_float(&mut self) -> f64 {
        self.next()
    }
}
//  [typescript]
let solve = (input) => {
  const [head, a] = input.split("\n")
  const [N, K] = head.split(" ").map((i) => Number(i))
  const balls = a.split(" ")
  const countMap = {}
  balls.map((i) => {
    countMap[i] = (countMap[i] || 0) + 1
  })

  const keys = Object.keys(countMap)
  const targetNum = keys.length - K
  if (targetNum < 1) {
    return 0
  }

  const sorted = keys
    .map((b) => {
      return [b, countMap[b]]
    })
    .sort((a, b) => a[1] - b[1])
  const r = sorted.slice(0, targetNum).reduce((cnt, c) => cnt + c[1], 0)

  return r
}
const input = require("fs").readFileSync("/dev/stdin", "utf8")
console.log(solve(input.trim()))
//  [python]
import numpy as np
n,d=map(int,input().split())
D=[]
for i in range(n):
    List=list(map(int,input().split()))
    D.append(List)
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        cou=0
        for k in range(d):
            # print(i,j,k)
            cou+=(D[i][k]-D[j][k])**2
            
        if(np.sqrt(cou)%1.0==0):
            ans+=1
print(ans)
//  [python]
import numpy as np
N, D = map(int, input().split())
X = np.zeros((N,D))
for i in range(N):
  X[i][:] = list(map(int, input().split()))

n = 0
for i in range(N):
  for j in range(i+1, N):
    dist = np.linalg.norm(X[i]-X[j])
    if dist.is_integer():
      n += 1

print(n)
//  [python]
import numpy as np

n, d = map(int, input().split())

points = []

cnt = 0

for _ in range(n):
  point = np.array(list(map(int, input().split())))
  for p in points:
    d = point - p
    if np.sqrt((d * d).sum()).is_integer():
      cnt += 1
  
  points.append(point)
  
print(cnt)
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);

        final int n = scanner.nextInt();
        final int d = scanner.nextInt();
        scanner.nextLine();

        final int[][] vectors = new int[n][d];
        for (int i = 0; i < n; i++) {
            vectors[i] = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        }

        int count = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int dist = 0;
                for (int k = 0; k < d; k++) {
                    dist += (vectors[i][k] - vectors[j][k]) * (vectors[i][k] - vectors[j][k]);
                }

                final double realDist = Math.sqrt(dist);
                if (realDist == Math.floor(realDist)) {
                    count++;
                }
            }
        }

        System.out.println(count);
    }
}
//  [java]
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.IntStream;

public class Main {

  static Set<Long> squareNumber = new HashSet<>();

  static {
    int max = 40 * 40 * 10;
    for (int i = 0; i < max; i++) {
      long pow = i * i;
      squareNumber.add(pow);
      if (pow > max) {
        break;
      }
    }
  }

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }


  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int d = Integer.parseInt(sc.next());
    sc.nextLine();
    List<Point> points = new ArrayList<>();
    int result = 0;
    for (int i = 0; i < n; i++) {
      Point pointN = Point.of(d, sc.nextLine());
      result += points.stream().filter(p -> p.isIntegerDistance(pointN)).count();
      points.add(pointN);
    }
    pw.println(result);
  }

  static class Point {

    int d;
    int x[];

    Point(int d, int[] x) {
      this.d = d;
      this.x = x;
    }

    static Point of(int d, String line) {
      return new Point(d,
        Arrays.stream(line.split(" ", -1)).map(Integer::parseInt).mapToInt(Integer::intValue)
          .toArray());
    }

    boolean isIntegerDistance(Point other) {
      long powDistance = (int) IntStream.range(0, d)
        .mapToLong(i -> (this.x[i] - other.x[i]) * (this.x[i] - other.x[i])).sum();
      return squareNumber.contains(powDistance);
    }
  }
}
//  [java]
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static List<Integer> p = IntStream.rangeClosed(1, 126).mapToObj(i -> i * i).collect(Collectors.toList());
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[][] x = new int[n][d];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < d; j++) {
                x[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int s = 0;
                for (int k = 0; k < d; k++) {
                    s += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
                }
                if (p.contains(s)) {
                    c++;
                }
            }
        }
        System.out.println(c);
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, d, ans = 0;
    cin >> n >> d;
    int x[n][d];
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < d; ++j) cin >> x[i][j];
    }
    for(int i = 0; i < n; ++i) {
        for(int j = i+1; j < n; ++j) {
            int dist = 0;
            for(int k = 0; k < d; ++k) dist += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
            for(int k = 1; k <= dist*dist; ++k) {
                if(dist%k == 0 && dist/k == k) {
                    ans++;
                }
            }
        }
    }

    cout << ans << '\n';

    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int a[22][12];
int n,d;
const int N=1e8+5;
bool mark[N];
int prim[N];
int cnt;
void initial()
{
    cnt=0;
    for (int i=2 ; i<N ; ++i)
    {
        if (!mark[i])
            prim[cnt++]=i;
        for (int j=0 ; j<cnt && i*prim[j]<N ; ++j)
        {
            mark[i*prim[j]]=1;
            if (!(i%prim[j]))
                break;
        }
    }
}
int coutt(int i,int j)
{
	long long sum=0;
	for(int ii=0;ii<d;ii++)
	{
		sum+=(a[i][ii]-a[j][ii])*(a[i][ii]-a[j][ii]);
	}
//	cout<<i<<' '<<j<<' '<<sqrt(sum)<<endl;
	int qq=0;
	while(sum>=prim[qq])
	{
		while(sum%prim[qq]==0)
		{
			
			if(sum%(prim[qq]*prim[qq])==0) 
			{
//				qq++;
				sum/=(prim[qq]*prim[qq]);
//				continue;
			}
			else return 0;
		}
//		if()
//		else 
		qq++;
	}
	return 1;
//	if(sum-sqrt(sum)*sqrt(sum)==0) return 0;
//	else return 0;
//	
	
}
int main()
{
	
	cin>>n>>d;
//	printf("n=%d d=%d\n",n,d);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
		{
//			scanf("%d",&a[i][j]);
			cin>>a[i][j];
		}
	}
//	getchar();
//	getchar();
//	for(int i=0;i<n;i++)
//	{
//		for(int j=0;j<d;j++)
//		{
////			printf("%d%c",a[i][j],i==n-1?'\n':' ');
//			cout<<a[i][j];
//			
//		}
//		cout<<endl;
//	}
	initial();
	int summ=0;
	for(int i=0;i<n-1;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(coutt(i,j)==1) 
			{
			summ++;
//			cout<<i<<' '<<j<<endl;
			}
		}
	}
	cout<<summ<<endl;
	
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

bool isSquareNumber(int x) {
    for (int i = 1; i * i <= x; ++i) if (i * i == x) return true;
    return false;
}

int factorial(int n) {
    if (n < 0) return -1;
    else if (n == 0) return 1;
    int ans = 1;
    for (int i = 1; i <= n; ++i) {
        ans *= i;
    }
    return ans;
}

int dist(vector<int> a, vector<int> b) {
    int sum = 0;
    for (int i = 0; i < a.size(); ++i) {
        sum += (a.at(i) - b.at(i)) * (a.at(i) - b.at(i));
    }
    return sum;
}

int main() {
    int n, d;
    cin >> n >> d;
    vector<vector<int>> points(n, vector<int>(d));
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < d; ++i) {
            cin >> points.at(j).at(i);
        }
    }
    // next_permutationで回すための配列sampleの用意
    vector<int> sample(n);
    for (int i = 0; i < n; ++i) {
        sample.at(i) = i;
    }
    int ans = 0;
    do {
        if (isSquareNumber(dist(points.at(sample.at(0)), points.at(sample.at(1))))) {
            ans++;
        }
    } while (next_permutation(sample.begin(), sample.end()));
    if (n != 1) cout << ans / factorial(n - 2) / 2 << endl;
    else cout << d * (d - 1) / 2 << endl;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){
  int N,D;
  scanf("%d %d",&N,&D);
  int A[N][D];
  
  for (int i=0;i<N;i++){
    /*fgets(line,256,stdin);
    sscanf(line,%d,)*/
    for(int j=0;j<D;j++){
      scanf("%d",&A[i][j]);
      /*printf("%d\n",A[i][j]);*/
    }
  }
  double s=0;
  int count=0;
  for (int i=0;i<N;i++){
    for (int j=i+1;j<N;j++){
      for(int k=0;k<D;k++){
        s+=(A[i][k]-A[j][k])*(A[i][k]-A[j][k]);
      }
      for(int l=0;l<10000000;l++){
        if(sqrt(s)==l*1.0){
          count+=1;
        }
      }
      s=0;
          /*
      if(sizeof(sqrt(s))== sizeof(1)){
        printf("%d %d\n",i,j);
        count+=1;
      }*/
    }
  }
  printf("%d",count);
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
typedef long long ll;
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    int N,D;
    int cnt=0;
    scanf("%d%d",&N,&D);
    int ten[N][D];
    rep(i,N){
        rep(j,D){
            scanf("%d",&ten[i][j]);
        }
    }
    rep(i,N-1){
        for(int j=i+1;j<N;j++){
            int temp=0;
            for(int k=0;k<D;k++){
                temp+=(ten[i][k]-ten[j][k])*(ten[i][k]-ten[j][k]);
            }
            for(int m=1;m<16000;m++){
                if(temp==m*m){
                    cnt++;
                }
            }
        }
    }
    printf("%d",cnt);
}
//  [c]
#include <stdio.h>
#include <math.h>
int main(void) {
    int n, d, x[100][100], i, j, k, s=0;
    double a, b, c;
    
    scanf("%d%d",&n,&d);
    for(i=0;i<n;i++){
        for(j=0;j<d;j++) scanf("%d",&x[i][j]);
    }
    
    for(i=0;i<n;i++){
        for(k=i+1;k<n;k++){
            b=0;
            for(j=0;j<d;j++){
                a=pow(x[i][j]-x[k][j],2);
                b+=a;
            }
            c=sqrt(b);
            if(ceil(c)==floor(c)) s++;
        }
    }
    printf("%d\n",s);
    return 0;
}
//  [javascript]
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var d = o.a();
  var x = o.m(n);
  var ans = 0;
  for(var i = 0; i < n; i++){
    for(var j = i+1; j < n; j++){
      var z = 0;
      for(var k = 0; k < d; k++){
        var t = x[j][k] - x[i][k];
        z += t*t;
      }
      var u = Math.sqrt(z);
      if(u === Math.floor(u))ans++;
    }
  }
  return ans;
}
//  [javascript]
const main = (inputs) => {
  var N = inputs[0].split(" ")[0];
  var D = inputs[0].split(" ")[1];
  var list = inputs.filter((v,i)=>i>0).map(v=>v.split(" "));
  var ans = 0;
  for(var i=0;i<N;i++){
    for(var j=i+1;j<N;j++){
      var dis = 0;
      for(var k=0;k<D;k++){
        dis += Math.pow(list[i][k]-list[j][k], 2);
      }
      if(Math.sqrt(dis) == ~~Math.sqrt(dis)) ans++;
    }
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const D = parseInt(arg[0].split(" ")[1]);
    
    const points = arg.slice(1, N + 1);
    let answer = 0;
    
    for(let i in points) {
        let temp = points[i].split(" ").map(n=>parseInt(n));
        let nows = [];
        
        for(let j in temp) {
            nows.push(temp[j]);           
        }
        
        for(let j=parseInt(i)+1; j<N; j++) {
            let temp = points[j].split(" ").map(n=>parseInt(n));
            let targets = [];
            
            for(let k in temp) {
                targets.push(temp[k]);           
            }
            
            let distance = 0;
            
            for(let k in targets) {
                distance += Math.abs(Math.pow(nows[k] - targets[k], 2));
            }
            
            distance = Math.sqrt(distance);
            
            if(distance % 1 === 0) {
                answer++
            }
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"math"
)

func distance(x, y []int, d int) float64 {
	distance := 0
	for i := 0; i < d; i++ {
		z := x[i] - y[i]
		distance += z * z
	}
	return math.Sqrt(float64(distance))
}

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

	coordinates := make([][]int, n)
	for i := 0; i < n; i++ {
		coordinates[i] = make([]int, d)
		for j := 0; j < d; j++ {
			fmt.Scan(&coordinates[i][j])
		}
	}

	count := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			d := distance(coordinates[i], coordinates[j], d)
			if fmt.Sprint(d) == fmt.Sprint(int(d)) {
				count++
			}
		}
	}
	fmt.Println(count)
}
//  [go]
package main

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

var (
	BufferSize = 10 * 10 * 10 * 10 * 10 * 10 * 10
)

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}

	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}

	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	d := scanInt(sc)

	table := make([][]int, n, n)

	for i := 0; i < n; i++ {
		table[i] = make([]int, d, d)
		for j := 0; j < d; j++ {
			table[i][j] = scanInt(sc)
		}
	}

	ok := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			sqSum := 0.0
			for k := 0; k < d; k++ {
				sqSum += math.Pow(float64(table[i][k]-table[j][k]), 2)
			}
			sum := math.Sqrt(sqSum)
			trunc := math.Trunc(sum)
			if sum == trunc {
				ok++
			}
		}
	}
	fmt.Printf("%d\n", ok)
}
//  [go]
package main

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

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

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

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	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
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	n, d := readInt(), readInt()
	x := make([][]int, n)

	for i, _ := range x {
		x[i] = make([]int, d)
		for ii, _ := range x[i] {
			x[i][ii] = readInt()
		}
	}

	ans := 0
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			dist := 0
			for k := 0; k < d; k++ {
				dist += abs(x[i][k]-x[j][k]) * abs(x[i][k]-x[j][k])
			}
			if check(dist) {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

func check(x int) bool {
	for i := 1; i*i <= x; i++ {
		if i*i == x {
			return true
		}
	}
	return false
}
//  [ruby]
require 'matrix'
N, D = gets.split.map &:to_i
x = []
N.times do
  x << Vector.elements(gets.split.map &:to_i)
end
cnt = 0
(N-1).times do |i|
  ((i+1)..(N-1)).each do |j|
    dist = ((x[i] - x[j]).norm)
    cnt += 1 if dist - dist.to_i == 0
  end
end
puts cnt
//  [ruby]
n, d = gets.split.map &:to_i
pts = n.times.map {gets.split.map &:to_i}
cnt = pts.combination(2).count do |(p, q)|
  dist = d.times.sum { |i| (p[i]-q[i])**2 }
  (0..dist).any? { |d| d*d==dist }
end

p cnt
//  [ruby]
n, d = gets.strip.split.map(&:to_i)

arr = []

n.times do |a|
    arr << gets.strip.split.map(&:to_i)
end

ans = 0

(0..(n - 1)).each do |i|
    ((i + 1)..(n - 1)).each do |j|
        norm = 0
        (0..(d - 1)).each do |k|
            diff = arr[i][k] - arr[j][k]
            norm += diff * diff
        end

        flag = false
        (0..norm).each do |k|
            flag = true if k * k == norm
        end
        ans += 1 if flag
    end
end

puts ans
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, d: usize, x: [[isize; d]; n]);

    let mut ar = Vec::new();
    for i in 0..200 {
        ar.push(i * i);
    }

    let mut count = 0;

    for i in 0..n {
        for j in i + 1..n {
            let mut sum = 0;
            for k in 0..d {
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            if ar.contains(&sum) {
                count += 1;
            }
        }
    }
    println!("{}", count);
}
//  [swift]
import Foundation
import CoreFoundation

#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)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    func reversed() -> Array {
        return self.reverse()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    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)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    return y>0 ? gcd(y, x%y) : x
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

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

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

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

let input = readIntSplit(by: " ")
let (N, D) = (input[0], input[1])
var X = [[Int]]()
for _ in 0..<N {
    X += [readIntSplit(by: " ")]
}
var ans = 0
for i in 0..<N {
    for j in i+1..<N {
        let tmp = (0..<D).reduce(0.0){$0 + pow(Double(X[i][$1]-X[j][$1]), 2.0)}
        let dist = sqrt(tmp)
        if dist == floor(dist) {
            ans += 1
        }
    }
}
print(ans)
//  [typescript]
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { N: number, D: number, X: number[][] } => {
  const [N, D] = lines[0].split(' ').map(line => +line)
  const X = lines.slice(1, 1 + N).map(line => line.split(' ').map(l => +l))
  const obj = { N, D, X }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { N, D, X } = parseLines(lines)
  let count = 0
  for (let i = 0; i < N; i++) {
    for(let j = i + 1; j < N; j++) {
      let sum = 0
      for (let k = 0; k < D; k++) {
        sum += (X[i][k] - X[j][k]) ** 2
      }
      if (Number.isInteger(Math.sqrt(sum))) {
        count++
      }
    }
  }
  return `${count}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}
//  [typescript]
function combinations(n, arr) {
  if (n === 0) return [[]];
  if (arr.length === 0) return [];
  const tail = arr.slice(1);
  return combinations(n - 1, tail).map(comb => [arr[0]].concat(comb)).concat(combinations(n, tail));
}

const range = (n) => Array.from({ length: n }, (_, k) => k);

function Main(input) {
  const lines = input.split('\n');
  const [N, D] = lines[0].split(' ').map(s => parseInt(s));
  const points = lines.slice(1).map(line => line.split(' ').map(s => parseInt(s)));

  const ans =
    combinations(2, range(N))
      .map(pair => {
        const p1 = points[pair[0]];
        const p2 = points[pair[1]];
        return Math.sqrt(range(D).map(k => Math.pow(p1[k] - p2[k], 2)).reduce((x, y) => x + y));
      })
      .filter(Number.isInteger)
      .length;

  console.log(ans);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function main(input) {
  input = input.trim().split("\n");
  const [n, d] = input[0].split(" ").map(n => Number(n));
  const xs = [];
  for (let i = 0; i < n; i++) {
    xs.push(input[i+1].split(" ").map(n => Number(n)));
  }
  let result = 0;
  for (let i = 0; i < n; i++) {
    for (let j = i+1; j < n; j++) {
      const x1 = xs[i];
      const x2 = xs[j];
      let sum = 0;
      for (let k = 0; k < d; k++) {
        sum += Math.abs(x1[k] - x2[k])**2;
      }
      const distance = Math.sqrt(sum);
      if (Number.isInteger(distance)) result++;
    }
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#############
# Main Code #
#############

X,t = inputIL()

print(max(0,X-t))
//  [python]
from sys import stdin
import math
import numpy as np
import itertools

a,b = [int(x) for x in stdin.readline().rstrip().split()]

if b >= a:
    print(0)
else:
    print(a-b)
//  [python]
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

X, t = MAP()

print(X-t if X > t else 0)
//  [java]
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		ArrayList<String> input = new ArrayList<String>();
		while(in.hasNext()){
			input.add(in.next());
		}
		int X=Integer.parseInt(input.get(0));
		int t=Integer.parseInt(input.get(1));
		if(X>t){System.out.println(X-t);}
		else {System.out.println(0);}
	}
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int X = scan.nextInt();
        int t = scan.nextInt();
        int answer = X - t;
        if(answer < 0) answer = 0;
        
        System.out.println(answer);
    }
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long t = sc.nextLong();
		System.out.println((X-t)>0?(X-t):0);
	}

}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
    int X;
    int t;
    int i,nok;

    cin >> X >>t;
    nok =X;
    for(i=1;((i<=t)&&(X-i>=0));i++){
        nok--;
    }

    cout << nok << endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include <vector>
using namespace std;
#define pi M_PI

int main(){
    int x, t;
    cin >> x >> t;
    int c=0;
    for(int i=0; i<t; i++){
        x--;
        if(x == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    cout << x << endl;
    
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;
int main() {
  int x, t;
  cin >> x >> t;
  for (size_t i = 0; i < t; i++) {
    if (x > 0)
      x--;
    else
      break;
  }
  cout << x << endl;

  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int x, t;
    
    scanf("%d%d", &x, &t);

    if (x<=t) {
        x=t;
    }
    
    printf("%d", x-t);
    
    return 0;
}
//  [c]
#include"stdio.h"
int main(){
    int x,t;
    scanf("%d %d",&x,&t);
    if(x-t>0)
        printf("%d\n",x-t);
    else
        printf("0\n");
}
//  [c]
#include <stdio.h>

int main()
{
	int X, t;
	scanf("%d %d", &X, &t);
	printf("%d\n", (X > t)? X - t: 0);
	fflush(stdout);
	return 0;
}
//  [javascript]
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
 
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
 
    var ans = a - b;
    if(ans < 0) {
        ans = 0;
    }
	console.log('%d',ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  input = input.trim();
  const a = input.split(" ").map(Number);
  if(a[0]<=a[1]){
    console.log("0");
  }else{
    console.log(a[0]-a[1]);
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  const numbers = input.split(' ').map(n => Number(n));
  const x = numbers[0];
  const t = numbers[1];

  if (x <= t) {
    console.log('0');
  } else {
    console.log(x - t);
  }
}

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

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	X, t := ReadInt(), ReadInt()
	ans := X - t
	if ans < 0 {
		ans = 0
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [go]
package main

import (
	"fmt"
)

func main() {
  var X, t int
  fmt.Scanf("%d %d", &X, &t)
  
  ans := X - t
  if ans < 0 {
    ans = 0
  }
  fmt.Printf("%d\n", ans)
}
//  [go]
package main

import "fmt"

func main() {
        var X, t, res int
        fmt.Scanf("%d %d", &X, &t)

        res = X - t
        if res < 0 {
                res = 0
        }

        fmt.Printf("%d\n", res)
}
//  [ruby]
x,t = gets.chomp.split(' ').map(&:to_i)
puts [0,x-t].max
//  [ruby]
x, t = gets.split.map(&:to_i)
ans = x - t
ans = 0 if ans < 0
puts ans
//  [ruby]
x,t = gets.chop.split.map(&:to_i)
puts [x-t,0].max
//  [rust]
use std::io::Read;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let x: isize = iterator.next().unwrap().parse().unwrap();
    let t: isize = iterator.next().unwrap().parse().unwrap();

    return max(0, x - t).to_string();
}
//  [rust]
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:isize,
    b:isize,
    }
    println!("{}",max(0,a-b))
}
//  [rust]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		x: usize,
		t: usize,
	}

	if x > t {
		println!("{}", x - t);
	}
	else {
		println!("0");
	}
}