        #include<bits/stdc++.h>
        #define ll long long
        #define rep(i,a,b) for(i=a;i<b;i++)
        #define pb push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define CLR(a) memset((a),0,sizeof(a))
        #define mp make_pair
        #define hell 1000000007

        using namespace std;
         //int g[105][105];
        //vector < int > wt(100004);
       // vector < int > a;
        //vector < int > v(30500);
        //int cst[102][100005];
        //int ansr[100005];
     //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;

         /* rep(i,0,50)
          {
              if(ck[i]) cout<<i<< " o"<<endl;
              else cout<<i<<" e"<<endl;
          }*/
     bool isp( int n)
      {
          int k=sqrt(n); //cout<<k<<"K"<<endl;
          if(k*k==n) return true;
          return false;
      }

        void solve()
        {
           int  i,j=0,r=200,p,q,k=0,ans=0,d,y=0,h,flag=0,n,m=0,a,b,id,c,h1,h2,a1,b1;
           cin>>n>>d;
           vector < vector < int  > > v(n,vector < int > (d));
           rep(i,0,n)
             {
                 rep(j,0,d)
                   {
                       cin>>v[i][j];
                   }
             }
             rep(i,0,n)
                {
                    rep(j,i+1,n)
                       {   y=0;
                           rep(k,0,d)
                             {
                                 y+=((v[i][k]-v[j][k])*(v[i][k]-v[j][k]));

                             }
                            // cout<<y<<" ";
                             if(isp(y)) m++;
                             //cout<<m<<" ";
                       }
                }
      cout<<m;

        }

        int main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
          //  cin>>t;
            while(t--)
            solve();
        }

           /*

      void bfs( int i , int j)
           {
               vis[i][j]= true;
             queue < int > que;
             que.push(k);
             while(!que.empty())
             {
                int x= que.front();
                que.pop();
                 for ( int i=1;i<=n;i++)
                 {
                     if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                     {
                       if(!vis[i])
                       {
                           que.push(i);
                           level[i]=level[x]+1;
                           vis[i]= true;
                       }
                     }
                 }
             }
           }

          ll int por(ll int a,ll int b)
             {
                ll int k=1;
                while(b>0)
                {
                    if(b%2) k=k*a,k%=hell;
                    b/=2;
                    a*=a; a%=hell;
                }
                return k;
             } */


#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int N, D;
	cin >> N >> D;
	vector<vector<int>> X(N, vector<int>(D));
	for(int i = 0; i < N; i ++){
		for(int j = 0; j < D; j ++){
			cin >> X[i][j];
		}
	}
	ll ddist, dist, ans = 0;
	for(int i = 0; i < N - 1; i ++){
	for(int j = i + 1; j < N; j ++){
		ddist = 0;
		for(int k = 0; k < D; k ++){
			ddist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
		}
		dist = sqrt(ddist);
		if(ddist == dist * dist){
			ans ++;
		}
	}
	}
	cout << ans << endl;

	return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
  int N, D;
  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];
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      if(i != j){
        int s = 0;
        for (int k = 0; k < D; k++) s += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
        int ss = sqrt(s);
        if(s%ss == 0) ans++;
      }
    }

  }

  printf("%d\n", ans);
}


#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,D;
  cin >> N >> D;

  vector<vector<int>> matrix(N, vector<int>(D));
  for (int i=0; i<N; i++){
    for (int j=0; j<D; j++){
      cin >> matrix.at(i).at(j);
    }
  }

  int ans = 0;

  int distance_squared = 0;
  for (int i=0; i<N-1; i++){
    for (int j=i+1;j<N; j++){
      for(int k=0;k<D;k++){
        distance_squared +=  pow((matrix.at(i).at(k) - matrix.at(j).at(k)),2);
      }
      for(int l=1; l<130; l++){
        if(distance_squared  == l*l){
          ans++;
        }
        break;
      }
      distance_squared  = 0;
    }
  }

  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,D;
  cin >> N >> D;

  vector<vector<int>> matrix(N, vector<int>(D));
  for (int i=0; i<N; i++){
    for (int j=0; j<D; j++){
      cin >> matrix.at(i).at(j)
    }
  }

  int ans = 0;

  int distance_squared = 0;
  for (int i=0; i<N-1; i++){
    for (int j=i+1;j<N; j++){
      for(int k=0;k<D;k++){
        distance_squared +=  pow((matrix.at(i).at(k) - matrix.at(j).at(k)),2);
      }
      for(int l=1; l<130; l++){
        if(distance_squared  == l*l){
          ans++;
        }
        break;
      }
      distance_squared  = 0;
    }
  }

  cout << ans << endl;
}


#include <stdio.h>
#include <math.h>

int main(){
  int n, d;  scanf("%d %d", &n, &d);
  int x[13][13];
  for(int i=1; i<=n; i++)
    for(int j=1; j<=d; j++)
      scanf("%d", &x[i][j]);
  int count = 0;
  for(int i=1; i<n; i++){
    for(int j=i+1; j<=n; j++){
      int dis = 0;
      for(int k=1; k<=d; k++)
	dis = dis + (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      if(dis == (int)sqrt(dis)*(int)sqrt(dis)){
	count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n,d,i,j,k,cnt=0;
    scanf("%d%d",&n,&d);
    int a[n][d];
    for(i=0;i<n;i++){
        for(j=0;j<d;j++) scanf("%d",&a[i][j]);
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            int sum=0;
            for(k=0;k<d;k++){
                int tmp = abs(a[i][k]-a[j][k]);
                sum+=tmp*tmp;
            }
            for(k=0;k<=sum;k++){
                if(k*k==sum) cnt++;
            }

        }
    }
    printf("%d",cnt);
    return 0;
}


#include<stdio.h>
#include<math.h>

int main(void)
{
  //dとnを入力
  int d,n;
  scanf("%d%d",&d,&n);

  //n個の座標をforで入力
  int i,j,k;
  /*
  int x[n][d];
  for(i=0;i<n;i++)
    for(k=0;k<d;k++)
      scanf("%d",&x[i][k]);
      */
  int x[d][n];
  for(i=0;i<d;i++)
    for(k=0;k<n;k++)
      scanf("%d",&x[i][k]);

  //計算開始
  double dist;
  int cnt=0;

  //i,jを決める
  for(i=0;i<d;i++)
    //for(j=i+1;j<n-(i+1);j++){
    for(j=i+1;j<d;j++){
/*
printf("(%d,%d,%d,%d) - (%d,%d,%d,%d)  ",
                x[i][0], x[i][1], x[i][2], x[i][3],
                x[j][0], x[j][1], x[j][2], x[j][3]);
                */

      //点iと点jの距離を求める
      dist = 0;
      for(k=0;k<n;k++)
        //dist += (x[i][k]-x[j][k])^2;
        dist += pow(x[i][k]-x[j][k],2);
      dist = sqrt(dist);
//   printf("%f\n", dist);

      //ceil(切り上げ関数)とfloor(切り捨て関数)を使ってdistが整数か判定
      //distが整数ならcntを1増やす
      if(ceil(dist)==floor(dist))
//      if (dist*dist==pow((int)dist,2))
        cnt++;
    }

  //cntを出力して終了
  printf("%d\n",cnt);
  return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int min(int a, int b){
    if(a > b) return b;
    else return a;
}

const int inf = 1012345678;
int main(){
    int n, d;
    int x[100][100];

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

    int cnt = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            int sum = 0;
            for(int k = 0; k < d; ++k){
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            for(int k = 1; k <= 40; ++k){
                if(sum == (k * k)){
                    cnt++;
                }
            }
        }
    }

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

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int min(int a, int b){
    if(a > b) return b;
    else return a;
}

const int inf = 1012345678;
int main(){
    int n, d;
    int x[100][100];

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

    int cnt = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            int sum = 0;
            for(int k = 0; k < d; ++k){
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            for(int k = 1; k < 70; ++k){
                if(sum == (k * k)){
                    cnt++;
                }
            }
        }
    }

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

    return 0;
}


#include<stdio.h>
#include<math.h>
int main(void){
        int a[10][10],n,d,i,j,k,l=0,p=0;
        double s[46],b[10][10];
        scanf("%d%d",&n,&d);
        for(i=0;i<n;i++){
            for(j=0;j<d;j++){
                scanf("%d",&a[i][j]);
                b[i][j]=a[i][j];
            }
        }
       for(i=0;i<n-1;i++){
            for(k=i+1;k<n;k++){
                for(j=0;j<d;j++){
                    s[p]=s[p]+(pow((b[i][j]-b[k][j]),2));
                }
                s[p]=sqrt(s[p]);
                if(round(s[p])-(s[p])==0){
                    l++;
                }
                p++;
            }
       }
       printf("%d",l);
       return 0;
}


"use strict"
function main(arg) {
    var data = arg.trim().split("\n")
    var tmp = data.shift().split(' ').map(Number)
    var N = tmp[0]
    var D = tmp[1]
    data = data.map(e => e.split(' ').map(Number))

    var ans = 0

    for (var i = 0; i < N; i++) {
        for (var j = i; j < N; j++) {
            if (i === j) continue
            // console.log(`${i}:${j}`)
            var row1 = data[i]
            var row2 = data[j]
            var yz = 0
            for (var d = 0; d < D; d++) {
                // console.log(`${i}:${j}`)
                var t = Math.abs(row1[d] - row2[d])
                yz += t * t
            }
            var tAns = Math.sqrt(yz)
            if (!(String(tAns).split('.').length > 1)) {
                // console.log(tAns)
                ans++
            }
        }
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function Main(input) {
  	input = input.split("\n");
  	i = 0;
  	x = [];
	counter = 0;
  	N =1000000;
    D = 0;
   for(i=0;i<=N;i++){
      	num = input[i].split(/\s+/);
      	littleX = [];
		if(i==0){
          N = num[0];
          D = num[1];
        }else{
        	for(j=0;j<D;j++){
	          littleX.push(num[j]);
        	}
            x.push(littleX);
        }

     	//console.log("i= "+i+"N:" + N + ",D:"+D + ",littleX:" + littleX);
    }

  	for(i=0;i<N;i++){
      	for(k=i+1;k<N;k++){
	      	//console.log("check "+i+"to"+k);
          	//console.log(x[i]);
          	//console.log(x[k]);
          	sum = 0;
          	for(j=0;j<D;j++){
            	sum+= Math.abs((x[i][j] - x[k][j])*(x[i][j] - x[k][j]));
            }
          	//console.log(sum);
          	//console.log(Math.sqrt(sum));
          	//console.log(Number.isInteger(Math.sqrt(sum)));
          	if(Number.isInteger(Math.sqrt(sum)) === true){
            	counter++;
            }
        }
    }
  	console.log(counter);

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


"use strict";
const main = input => {
    const n = parseInt(input[0].split(' ')[0]),
    d = parseInt(input[0].split(' ')[1]);
    let x = new Array();
    for(let i=0; i<n; i++) {
      x[i] = input[i+1].split(' ').map(val => parseInt(val));
    }
    // console.log(n,d,x);
    let ans=0;
    for(let i=0; i<n-1; i++) {
      for(let j=i+1; j<n; j++) {
        let value=0;
        for(let k=0; k<d; k++) {
          value+=Math.pow(Math.abs(x[i][k]-x[j][k]),2);
        }
        value=Math.pow(value,0.5);
        // console.log(value);
        if (Number.isInteger(value)) {
          ans++;
        }
      }
    }
    console.log(ans);

}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));


function Main(input) {
  	input = input.split("\n");
  	i = 0;
  	x = [];
	counter = 0;
   for(i=0;i<input.length;i++){
      	num = input[i].split(" ");
      	littleX = [];
		for(j=0;j<num.length;j++){
          	littleX.push(num[j]);
        }
      	x.push(littleX);
    }

  	for(i=1;i<input.length;i++){
      	for(k=i+1;k<input.length;k++){
	      	//console.log("check "+i+"to"+k);
          	//console.log(x[i]);
          	//console.log(x[k]);
          	sum = 0;
          	for(j=0;j<x[i].length;j++){
            	sum+= Math.abs((x[i][j] - x[k][j])*(x[i][j] - x[k][j]));
            }
          	//console.log(Math.sqrt(sum));
          	//console.log(Number.isInteger(Math.sqrt(sum)));
          	if(Number.isInteger(Math.sqrt(sum)) === true){
            	counter++;
            }
        }
    }
  	console.log(counter);

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


function Main(input) {
  	input = input.split("\n");
  	i = 0;
  	x = [];
	counter = 0;
   for(i=0;i<input.length;i++){
      	num = input[i].split(" ");
      	littleX = [];
		for(j=0;j<num.length;j++){
          	littleX.push(num[j]);
        }
      	x.push(littleX);
    }

  	for(i=1;i<input.length;i++){
      	for(k=i+1;k<input.length;k++){
	      	//console.log("check "+i+"to"+k);
          	//console.log(x[i]);
          	//console.log(x[k]);
          	sum = 0;
          	for(j=0;j<x[i].length;j++){
            	sum+= (x[i][j] - x[k][j])*(x[i][j] - x[k][j]);
            }
          	//console.log(Math.sqrt(sum));
          	//console.log(Number.isInteger(Math.sqrt(sum)));
          	if(Number.isInteger(Math.sqrt(sum)) === true){
            	counter++;
            }
        }
    }
	console.log(counter);
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const main = (N,D,X) => {
    var count = 0

    for(var i =0;i<N;i++) {
        for(var k=i+1;k<N;k++) {
            var tmp = 0
            for(var j = 0;j<D;j++) {
                const xd = Math.abs(X[i][j] - X[k][j])
                tmp+=xd*xd
            }

            if(Number.isInteger(Math.sqrt(tmp))) {
                count++
            }
        }
    }
    return count
}

const input = require('fs').readFileSync('/dev/stdin','utf8')
                           .split("\n")
                           .filter(i => i !== '')
const lst = input.map(i => i.split(" ").map(x => Number(x)))
const N = lst[0][0]
const D = lst[0][1]
const X = lst.slice(1,lst.length)
console.log(main(N,D,X))


package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

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

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

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

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	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 powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N, D int

func main() {
	sc.Split(bufio.ScanWords)

	N, D = nextInt(), nextInt()
	x := make([][]int, N)
	for i := 0; i < N; i++ {
		x[i] = make([]int, D)
		for j := 0; j < D; j++ {
			x[i][j] = nextInt()
		}
	}

	ans := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			d2 := 0
			for d := 0; d < D; d++ {
				//fmt.Println(i, j, d)
				d2 += powInt(x[i][d]-x[j][d], 2)
			}

			d2f := float64(d2)

			if math.Sqrt(d2f) == float64(int(math.Sqrt(d2f))) {
				ans++
			}
		}
	}

	fmt.Println(ans)
}


package main

import (
	"fmt"
	"math"
	_ "sort"
)

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	x := make([][]int, n) //スライス
	for i := 0; i < n; i++ {
		x[i] = make([]int, d)
		for j := 0; j < d; j++ {
			fmt.Scan(&x[i][j])
		}
	}

	cnt := 0

	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			dist := 0.0
			for k := 0; k < d; k++ {
				dist += float64((x[i][k] - x[j][k]) * (x[i][k] - x[j][k]))
			}
			dist = math.Sqrt(dist)
			if math.Floor(dist) == dist {
				cnt++
			}
		}
	}
	fmt.Println(cnt)
}


package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

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 yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n, d int
	fmt.Fscan(read, &n, &d)

	x := make([][]float64, n)
	for i := 0; i < n; i++ {
		x[i] = make([]float64, d)
		for j := 0; j < d; j++ {
			fmt.Fscan(read, &x[i][j])
		}
	}

	cnt := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			var dist float64
			dist = 0.0
			for k := 0; k < d; k++ {
				dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k])
			}
			dist = math.Sqrt(dist)
			if math.Ceil(dist) == math.Floor(dist) {
				cnt++
			}
		}
	}
	fmt.Fprintln(write, cnt)
}


package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

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

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

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n, d := scanInt(sc), scanInt(sc)
	ds := make([][]int, n)
	for i := range loop0(n) {
		ds[i] = make([]int, d)
		for j := range loop0(d) {
			ds[i][j] = scanInt(sc)
		}
	}
	num := 0
	t := squreNums(160000)
	for i := range loop0(n) {
		for j := i + 1; j < n; j++ {
			sum := 0
			for k := 0; k < d; k++ {
				df := ds[i][k] - ds[j][k]
				sum += df * df
			}
			if t[sum] {
				num++
			}
		}
	}
	return num
}

func loop0(n int) chan int {
	return loop(0, n-1, 1)
}

func loop1(n int) chan int {
	return loop(1, n, 1)
}

func loop(s, e, d int) chan int {
	ch := make(chan int)
	go func() {
		for i := s; i <= e; i += d {
			ch <- i
		}
		close(ch)
	}()
	return ch
}

func squreNums(max int) []bool {
	t := make([]bool, max)
	for i := 1; i*i <= max; i++ {
		t[i*i] = true
	}
	return t
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

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

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

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n, d := scanInt(sc), scanInt(sc)
	ds := make([][]int, n)
	for i := range loop0(n) {
		ds[i] = make([]int, d)
		for j := range loop0(d) {
			ds[i][j] = scanInt(sc)
		}
	}
	num := 0
	t := squreNums(4000)
	for i := range loop0(n) {
		for j := i + 1; j < n; j++ {
			sum := 0
			for k := 0; k < d; k++ {
				df := ds[i][k] - ds[j][k]
				sum += df * df
			}
			if t[sum] {
				num++
			}
		}
	}
	return num
}

func loop0(n int) chan int {
	return loop(0, n-1, 1)
}

func loop1(n int) chan int {
	return loop(1, n, 1)
}

func loop(s, e, d int) chan int {
	ch := make(chan int)
	go func() {
		for i := s; i <= e; i += d {
			ch <- i
		}
		close(ch)
	}()
	return ch
}

func squreNums(max int) []bool {
	t := make([]bool, max)
	for i := 1; i*i <= max; i++ {
		t[i*i] = true
	}
	return t
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


package main

import "fmt"
import "math"

func main(){
	var D, N int
	var X[200][200] float64
	var tmp float64
	var sqrt float64
	var count int

	fmt.Scan(&N, &D)

	for i := 0 ; i < N ; i++ {
		for j := 0 ; j < D ; j++{
			fmt.Scan(&X[i][j])
		}
	}

/*	for i := 0 ; i < N ; i++ {
		sqrt = 0
		for j := 1 ; j < D ; j++ {
			sqrt += (X[i][j] - X[(i+j)%N][j])*(X[i][j] - X[(i+j)%N][j])
		//	fmt.Printf("%f ", sqrt)
		}
		sqrt = math.Sqrt(sqrt)
		// fmt.Println(sqrt)
		tmp = math.Ceil(sqrt)
	//	fmt.Println(tmp, sqrt)
		if(tmp == sqrt){
			count++
		}
	}*/

	for i := 0 ; i < N ; i++ {
		for k := i+1 ; k < N ; k++{
			sqrt = 0
			for j := 0 ; j < D ; j++{
				sqrt += (X[i][j] - X[i+k][j])*(X[i][j] - X[i+k][j])
		//		fmt.Printf("(%f %f)", X[i][j], X[i+k][j])
			}
			sqrt = math.Sqrt(sqrt)
			tmp = math.Ceil(sqrt)
			if tmp == sqrt {
				count++
			}
		//	fmt.Println(sqrt)
		}
	}
	fmt.Println(count)
}


line = gets.split(' ').map(&:to_i)
n = line[0]
d = line[1]

lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end
kazu = 0
for i in 0..n-1 do
  for j in 0..n-1 do
    if i == j then
      break
    end
    g = 0
    for k in 0..d-1 do
      g+=(lines[i][k]-lines[j][k])**2
    end
    g = g**0.5
    aho = g.ceil
    if g == aho then
      kazu+=1
    end
  end
end
puts kazu


# https://atcoder.jp/contests/abc133/tasks/abc133_b

N, D = gets.split.map(&:to_i)
Xss = Array.new(N) { gets.split.map(&:to_i) }

d2s = Xss.combination(2).map do |xs1, xs2|
  xs1.zip(xs2).reduce(0) { |memo, (y, z)| memo + (y - z) ** 2 }
end

ans = d2s.count do |d2|
  d = Math.sqrt(d2).floor
  d ** 2 == d2
end

puts ans


# 6:05
n, d = gets.to_s.split.map{|t|t.to_i}
x = Array.new(n){ gets.to_s.split.map{|t|t.to_i} }

def distance(p_i, p_j)

  dist = 0
  p_i.each_with_index do |x, i|
    dist += (x-p_j[i]) ** 2
  end
  dist
end

cnt = 0
n.times do |j|
  j.times do |i|
    dist = distance(x[i], x[j])
    cnt += 1 if dist == ((dist**0.5).round ** 2)
  end
end

puts cnt


n, d = gets.strip.split.map(&:to_i)

arr = []

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

# (n * (n - 1) / 2).times do |j|
    # n.times do |k|
    #     p arr[k]
    # end
# 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

        if k * k == norm
            ans += 1
        end

        # flag = false

        # (0..norm).each do |k|
        #     flag = true if k * k == norm
        # end

        # ans += 1 if flag
    end
end

puts ans


n, d = gets.chomp.split(' ').map(&:to_i)
list = []
count = 0

n.times do
  list << gets.chomp.split(' ').map(&:to_i)
end

(n-1).times do |i|
  pop = list[i]
  (i..(n-1)).each do |j|
    pop2 = list[j]
    sum = 0
    d.times do |k|
      sum += ((pop[k] - pop2[k]) ** 2)
    end
	sum = (sum**(1/2.0))
	if sum.to_s =~ /[1-9]\.?[0]+$/
      count += 1
    end
  end
end

print count


n, d = gets.chomp.split(' ').map(&:to_i)
list = []
count = 0

n.times do
  list << gets.chomp.split(' ').map(&:to_i)
end

(n-1).times do |i|
  pop = list[i]
  (i..(n-1)).each do |j|
    pop2 = list[j]
    sum = 0
    d.times do |k|
      sum += ((pop[k] -pop2[k]) ** 2)
    end
	sum = (sum**(1/2.0))
	if sum.to_s =~ /[1-9]\.?[0]+$/
      count += 1
    end
  end
end

print count


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 distance(a: &[f64], b: &[f64]) -> f64 {
    a.iter().zip(b.iter()).map(|(i,j)| {
        (i-j).powf(2.0)
    }).sum::<f64>().sqrt()
}

pub fn is_integer(f: f64) -> bool {
    f - f.floor() == 0.0
}

fn main() {
    input! {
        n: usize,
        d: usize,
        x: [[f64; d]; n],
    }
    let mut cnt = 0;
    for i in 0..n {
        for j in i+1..n {
            let dis = distance(&x[i], &x[j]);
            if is_integer(dis) { cnt+=1 }
        }
    }
    println!("{}", cnt);
}


fn main() {
    let nd = read_vec::<usize>();
    let n = nd[0];
    let d = nd[1];
    let points = read_vec2::<f64>(n);

    let mut ret = 0;
    for i in 0..n-1 {
        for j in i+1..n {
            let p1 = &points[i];
            let p2 = &points[j];
            let mut dis = 0.0;
            for k in 0..d {
                dis += (p1[k] - p2[k]) * (p1[k] - p2[k]);
            }
            dis = dis.sqrt();
            if dis - dis.floor() == 0.0 {
                ret += 1;
            }
        }
    }

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}


use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let mut iter = buf.split_whitespace();
	let n = iter.next().unwrap().parse::<i32>().ok().unwrap();
	let d = iter.next().unwrap().parse::<i32>().ok().unwrap();
	let mut v :Vec<Vec<i32>> = Vec::new();
	for i in 0..n {
		v.push(Vec::new());
		let mut buf = String::new();
		io::stdin().read_line(&mut buf).expect("");
		let mut iter = buf.split_whitespace();
		for j in iter {
			v[i as usize].push(j.parse::<i32>().ok().unwrap());
		}
	}

	let mut cnt = 0;
	for i in 0..n {
		for j in (i+1)..n {
			let mut dis:i32 = 0;
			for k in 0..d {
				dis += (v[ j as usize][k as usize] - v[i as usize][k as usize])*(v[j as usize][k as usize] - v[i as usize][k as usize]);
			}
			let mut k = 0;
			while(k <= dis){
				if k*k == dis {
					cnt += 1;
					break;
				}
				k += 1;
			}
		}
	}
	println!("{}", cnt);
}


#[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..50 {
        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);
}


#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,d:usize,
        x:[[i64;d];n],
    }
    let mut nijos = BTreeSet::new();
    for i in 0..50 {
        nijos.insert(i * i);
    }
    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            let mut root = 0;
            for ten in 0..d {
                root += (x[i][ten] - x[j][ten]) * (x[i][ten] - x[j][ten]);
            }
            if nijos.contains(&root) {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,d:usize,
        x:[[i64;d];n],
    }
    let mut nijos = BTreeSet::new();
    for i in 0..25 {
        nijos.insert(i * i);
    }
    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n {
            let mut root = 0;
            for ten in 0..d {
                root += (x[i][ten] - x[j][ten]) * (x[i][ten] - x[j][ten]);
            }
            if nijos.contains(&root) {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


import Foundation

let array = readLine()!.componentsSeparatedByString(" ")
let numOfPoints = Int(array[0])!
let dimension = Int(array[1])!
var points: [[Int]] = [[Int]]()
var countInt = 0

for i in 0...numOfPoints-1 {
  let array = readLine()!.componentsSeparatedByString(" ")
  var tmpIntArray: [Int] = [Int]()
  for elem in array {
    tmpIntArray.append(Int(elem)!)
  }
  points.append(tmpIntArray)
}

for i in 0...numOfPoints-1 {
  for j in 0...numOfPoints-1 {
    if j <= i {
      continue
    }
    var distance = 0
    for (iElem, jElem) in zip(points[i], points[j]) {
      distance += (iElem - jElem) * (iElem - jElem)
    }
    for num in 1...127 {
      if distance == num * num {
        countInt += 1
        break
      }
    }
  }
}

print(countInt)


import Foundation
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let nd=readInts()
let n=nd[0]
let d=nd[1]
var count=0
var xy:[[Int]]=[]
for _ in 1...n{
  let a=readInts()
  xy.append(a)
}
for i in 0...n-2{
  for j in i+1...n-1{
    var distance=0
    for k in 0...d-1{
      distance+=(xy[i][k]-xy[j][k])*(xy[i][k]-xy[j][k])
    }
    if Double(sqrt(Double(distance)))-Double(Int(sqrt(Double(distance))))==0.0{
      count+=1
    }
  }
}
print(count)


import Foundation

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

let nd=readInts()
let n=nd[0]
let d=nd[1]
var box:[[Int]]=[]

for i in 0..<n{
  let a=readInts()
  box.append([])
  for j in 0..<d{
    box[i].append(a[j])
  }
}

var ans=0

for i in 0..<n-1{
  for j in i+1..<n{
    var sum:Double=0
    for k in 0..<d{
      sum+=Double((box[j][k]-box[i][k])*(box[j][k]-box[i][k]))
    }
    if Double(sqrt(sum))-Double(Int(sqrt(sum)))==0.0 {ans+=1}
  }
}

print(ans)


import Foundation
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let nd=readInts()
let n=nd[0]
let d=nd[1]
var count=0
var xy:[[Int]]=[]
for _ in 1...n{
  let a=readInts()
  xy.append(a)
}
for i in 0...n-2{
  for j in i+1...n-1{
    var distance=0
    for k in 0...n-1{
      distance+=(xy[i][k]-xy[j][k])*(xy[i][k]-xy[j][k])
    }
    if Double(sqrt(Double(distance)))-Double(Int(sqrt(Double(distance))))==0.0{
      count+=1
    }
  }
}
print(count)


import Foundation
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let nd=readInts()
let n=nd[0]
let d=nd[1]
var count=0
var xy:[[Int]]=[]
for _ in 1...n{
  let a=readInts()
  xy.append(a)
}
for i in 0...n-1{
  for j in 0...n-1{
    var distance=0
    for k in 0...n-1{
      distance+=(xy[i][k]-xy[j][k])*(xy[i][k]-xy[j][k])
    }
    if Double(sqrt(Double(distance)))-Double(Int(sqrt(Double(distance))))==0.0{
      count+=1
    }
  }
}
print(count)


import Foundation

let array = readLine()!.componentsSeparatedByString(" ")
let numOfPoints = Int(array[0])!
let dimension = Int(array[1])!
var points: [[Int]] = [[Int]]()
var countInt = 0

for i in 0...numOfPoints-1 {
  let array = readLine()!.componentsSeparatedByString(" ")
  var tmpIntArray: [Int] = [Int]()
  for elem in array {
    tmpIntArray.append(Int(elem)!)
  }
  points.append(tmpIntArray)
}

for i in 0...numOfPoints-1 {
  for j in 0...numOfPoints-1 {
    if j <= i {
      continue
    }
    var distance = 0
    for (iElem, jElem) in zip(points[i], points[j]) {
      distance += (iElem - jElem) * (iElem - jElem)
    }
    for num in 1...29 {
      if distance == num * num {
        countInt += 1
        break
      }
    }
  }
}

print(countInt)


import * as fs from "fs";

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

const [n, d]: number[] = input[0].split(" ").map((x: string): number => +x);
const li: number[][] = [];
for(let i=0;i<n;i++){
	li.push(input[i+1].split(" ").map((x:string):number=>+x));
}

function kyori(a, b){
    return (a-b)*(a-b);
}

let ans: number = 0;
for(let i = 0; i<n; i++){
    for(let j = i+1; j<n; j++){
        let temp: number = 0;
        for(let k = 0; k<d; k++){
            temp += kyori(li[i][k], li[j][k]);
        }
        temp = Math.sqrt(temp);
        if (temp === Math.floor(temp)){
            ans ++
        }
    }
}
console.log(ans);


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let [n,d]=t.n(2)
  let x=[];
  for(let i=0;i<n;i++){
    x[i] = t.n(d)
  }
  let c=0
  for(let i=0;i<n;i++){
    for(let j=0;j<i;j++){
      if(i===j)continue
      let g=0;
      for(let k=0;k<d;k++){
        g+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k])
      }
      if(Number.isInteger(Math.sqrt(g)))c++
    }
  }
  t.o(c)
}
main()


'use strict'
const main = (input: string) => {
    const std: string[] = input.trim().split('\n')
    const [n ,d] = std.shift().split(' ').map(Number)
    const coordinates: number[][] = std.map(v => v.split(' ').map(Number))
    let r = [];
    for (let i = 0; i < n; i++) {
        for (let j = i+1; j < n; j++) {
            let tmp = 0;
            for (let k = 0; k < d; k++) {
                tmp += (coordinates[i][k] - coordinates[j][k])**2
            }
            r.push(Math.sqrt(tmp))
        }
    }
    console.log(r.filter(v => Number.isInteger(v)).length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


function Main(input) {

  const [N, D] = lines[0].split(' ').map(s => parseInt(s));

  const points = lines.slice(1).map(line => line.split(' '));

  let ans = 0;

  for (let i = 0; i < N - 1; i++) {
    for (let j = i + 1; j < N; j++) {
      let sumOfSquare = 0;
      for (let k = 0; k < D; k++) {
        sumOfSquare += Math.pow(points[i][k] - points[j][k], 2);
      }
      const distance = Math.sqrt(sumOfSquare);
      if (Number.isInteger(distance)) {
        ans++;
      }
    }
  }
  console.log(ans);

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


const Main = (input) => {
  const nSplitted = input.split("\n");
  const [N, D] = nSplitted[0].split(" ").map(e => Number(e));
  const Xs = nSplitted.slice(1).map(e => e.split(" ").map(d => Number(d)));
  let count = 0;
  for (var i = 0;i < Xs.length; i++) {
    for (var j = 0;j < Xs.length; j++) {
    	if (i >= j) {
         continue;
        }
      	const is = Xs[i];
      	const js = Xs[j];
      	let distance = 0;
        for (var k = 0; k < D; k++) {
          distance += Math.pow(is[k] - js[k], 2);
        }
      	distance = Math.sqrt(distance);
      if (Math.trunc(distance) === distance) {
        	count++;
        }
  	}
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


const Main = (input) => {
  const nSplitted = input.split("\n");
  const [N, D] = nSplitted[0].split(" ").map(e => Number(e));
  const Xs = nSplitted.slice(1).map(e => e.split(" ").map(d => Number(d)));
  let count = 0;
  for (var i = 0;i < Xs.length; i++) {
    for (var j = 0;j < Xs.length; j++) {
    	if (i >= j) {
         continue;
        }
      	const is = Xs[i];
      	const js = Xs[j];
      	let distance = 0;
        for (var k = 0; k < D; k++) {
          distance += (is[k] - js[k]) * (is[k] - js[k]);
        }
      	distance = Math.sqrt(distance);
      if (!String(distance).includes(".")) {
        	count++;
        }
  	}
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


n, m = map(int, input().split())
x = n - m
if x <= 0:
    x = 0
print(x)


def solve():
    X, t = list(map(int, input().split(" ")))
    if X - t <= 0:
        print(0)
    else:
        print(X - t)

solve()


X, t = map(int, input().split())
if X > t:
    print(X - t)
else:
    print(0)


s = input()

N = len(s)
result = []

for i in range(0, N):
    if i == 0 or i % 2 == 0:
        result.append(s[i])

s = ''
N = len(result)

for i in range(0, N):
    s += result[i]

print(s)


s = input()

N = len(s)
result = []

for i in range(0, N):
    if i == 0 or i % 2 == 0:
        result.append(s[i])

s = ''
N = len(result)

for i in range(0, N):
    s += result[i]

print(s)
s = input()

N = len(s)


a,b = map(int,input().split())
print((a-b,0)[a>b])


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;

    void solveA() throws IOException {
        int x = nextInt();
        int t = nextInt();
        outln(Math.max(0, x - t));
    }
    void solveB() throws IOException {

    }
    void solveC() throws IOException {

    }
    void solveD() throws IOException {

    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        solveA();

        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String[] a = x.split(" ");

		int z = Integer.parseInt(a[0]);
		int y = Integer.parseInt(a[1]);

		System.out.println(z <= y ? 0 : z - y);

	}
}


import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        System.out.println(Math.max(0,fsc.nextLong()-fsc.nextLong()));
        fsc.close();

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


import java.util.Scanner;

public class Main {

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

		System.out.println(Math.min(0, x - t));

		sc.close();

	}

}


import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       int A = sc.nextInt();
        int arr[] = new int[1000100];
        for (int i = 0; i < A; i++) {
            int num = sc.nextInt();
            if (num != 0) {
            	arr[num - 1]++;}
            arr[num]++;
            arr[num + 1]++;}
        int best = 0;
          for (int i = 0; i < arr.length; i++) {
            if (arr[i] > best) {
            	best = arr[i];}}
           System.out.println(best);
        sc.close();}}


import java.util.*;
public class Main{
  	public static void main (String [] args){
      	Scanner scanner = new Scanner (System.in);
        String in = scanner.next();
     	String out = "";
      	for (int i = 0; i < in.length(); i+=2){
          	out = out + in.charAt(i);
        }
      	System.out.println(out);
    }
}


#include <cstdio>

using namespace std;

int main()
{
	int x, t;

	scanf("%d %d", &x, &t);

	if (x >= t) {
		printf("%d\n", x - t);
	}
	else {
		printf("0\n");
	}

	return 0;
}


#include<cstdio>

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

	int ans = X - t;
	if (ans < 0)
		ans = 0;

	printf("%d\n", ans);
}


#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define debug(x) cout
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size)
#define all(x) x.begin(),x.end()
#define rep(i,a,n) for (int i=(a);i<(n);++i)
#define per(i,a,n) for (int i=(n)-1;i>=(a);--i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
inline ll read() {
  ll x=0, f=1; char ch=getchar();
  while (ch<'0'||ch>'9') f=(ch=='-')?-1:1, ch=getchar();
  while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+ch-'0', ch=getchar();
  return x*f;
}
inline void fileio() {
  freopen("t.in","r",stdin);
  //freopen("t.out","w",stdout);
}
//Produced By MiracleEEEE
//head

int main()
{
	int a=read(),b=read();
	printf("%d\n",max(a-b,0));
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

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

    int x, t; cin >> x >> t;
    cout << x - t << endl;
}


#include<bits/stdc++.h>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>

using namespace std;

int main(){
  int x,t;
  cin >> x >> t;
  cout << x - t << endl;
}


#include<iostream>
#include<math.h>

using namespace std;

int main() {
	int n,t;

	cin >> n >> t;

	if (n > t) {
		cout << 0 << endl;

	}
	else {
		cout << n - t << endl;
	}

	return 0;

}


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


#include <stdio.h>

int main()
{
  int x,t,re;
  scanf("%d %d",&x,&t);
  re = x - t;
  if(re < 0)re = 0;
  printf("%d",re);
  return 0;
}


#include <stdio.h>

int main()
{
  int a[4];
  scanf("%d%d",&a[0],&a[1]);
  if (a[0] < a[1])
  	printf("0");
  else
    printf("%d",a[0] - a[1]);
}


#include<stdio.h>
int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  int b=a-b;
  if(b<=0)
    b=0;

  printf("%d",b);
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<ll>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
class UnionFind
{
public:
  ll par[100005];
  ll depth[100005];
  ll nGroup[100005];

  UnionFind(ll n) {
    init(n);
  }

  void init(ll n) {
    for(ll i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }

  ll root(ll x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }

  bool same(ll x, ll y) {
    return root(x) == root(y);
  }

  void unite(ll x, ll y) {
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<ll> depth;
vector<ll> subtree_size;
void dfs(const Graph &G, ll v, ll p, ll d) {
    depth[v] = d;
    for (auto nv : G[v]) {
        if (nv == p) continue; // nv が親 p だったらダメ
        dfs(G, nv, v, d+1);
    }

    // 帰りがけ時に、部分木サイズを求める
    subtree_size[v] = INF; // 自分自身
    vl q;
    for (auto c : G[v]) {
        if (c == p) continue;
        q.pb(subtree_size[c]);// 子のサイズを加える
    }
  ll qq = q.size();
  //cout << v << " " << qq << endl;
  if(qq==0) subtree_size[v]=0;
  else{
  sort(all(q));
    //rep(i,qq)cout << q[i];
    //cout << endl;
  ll caa = 0;
  rep(i,qq){
    caa = max(qq+q[i]-i,caa);}
    subtree_size[v]=caa;
  }
}
ll dp[100005][2];
int main() {
ll a,b; cin>>a>>b;
  if(a<=b) cout << 0 << endl;
  else cout << a-b << endl;}


#include<stdio.h>
int main()
{
    long long a,b;
    scanf("%ll %ll",&a,&b);
    if(a<b)
        printf("0\n");
    else
        printf("%ll\n",a-b);
    return 0;

}


function Main(input) {
  const inputs = input.split(' ');
  const x = inputs[0];
  const t = inputs[1];

  const out = x - t > 0 ? x - t : 0;
  console.log(out);
}

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


function Main(input) {
  input = input.trim()
  input = input.split(" ").map(Number);
var a= input[0]-input[1];
  if(a>=0){
  console.log(a)
  }else{
    console.log(0)
  }
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));


var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextStrArray();
  var X = one[0];
  var t = one[1];
  myout(Math.max(X - t,0));
}


function main(input) {
  console.log(Math.max(0,input[0].split(" ")[1]-input[0].split(" ")[0]));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextStrArray();
  var X = one[0];
  var t = one[1];
  Math.max(X - t,0);
}


"use strict"

const X = parseInt(process.argv[2]);
const t = parseInt(process.argv[3]);

const ans = X > t ? X - t : 0

console.log(ans);


package main

import "fmt"

func main() {
	var x, t int

	fmt.Scanf("%d %d", &x, &t)

	if t > x {
		fmt.Print("0")
	} else {
		fmt.Print(x - t)
	}
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
	"strings"
	// "regexp"
)

/* sort */
type pair struct {
	index  int64
	p1, p2 interface{}
}
type pairs []pair

func (slice pairs) Len() int {
	return len(slice)
}

func (slice pairs) Less(i, j int) bool {
	return slice[i].index < slice[j].index
}

func (slice pairs) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

/* sort */
type Int64Slice []int64

func (slice Int64Slice) Len() int {
	return len(slice)
}

func (slice Int64Slice) Less(i, j int) bool {
	return slice[i] < slice[j]
}

func (slice Int64Slice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func Int64s(a []int64)                    { sort.Sort(Int64Slice(a)) }
func Int64sSliceAreSorted(a []int64) bool { return sort.IsSorted(Int64Slice(a)) }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	di      = []int64{-1, 0, 1, 0}
	dj      = []int64{0, -1, 0, 1}
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)
	X, t := readInt(), readInt()
	if X < t {
		fmt.Println(0)
	} else {
		fmt.Println(X - t)
	}
}

/*==========================================
 *             Library
 *==========================================*/
func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}
func doubleAry(h int64, w int64, init int64) (res [][]int64) {
	res = make([][]int64, h)
	for i := int64(0); i < h; i++ {
		res[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			res[i][j] = init
		}
	}
	return
}

func aryEq(a []int64, b []int64) bool {
	return reflect.DeepEqual(a, b)
}

func clone(n []int64) (r []int64) {
	r = make([]int64, len(n))
	for i := 0; i < len(n); i++ {
		r[i] = n[i]
	}
	return
}
func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

// scanner.Split(bufio.ScanWords) をコメントアウトしないと使用不可
func readLine() (s string) {
	if scanner.Scan() {
		s = scanner.Text()
	}
	return s
}

func readInt() (read int64) {
	scanner.Scan()
	read, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return
}

func readFloat() (read float64) {
	scanner.Scan()
	read, err := strconv.ParseFloat(scanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return
}

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func readString() (read string) {
	scanner.Scan()
	read = scanner.Text()
	return
}

func readStrings() (read []string) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, string(v))
	}
	return
}

func s2i(s string) int64 {
	var intVal, e = strconv.ParseInt(s, 10, 64)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int64) string {
	var strVal = strconv.FormatInt(i, 10)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func abs(i int64) int64 {
	return int64(math.Abs(float64(i)))
}

func max(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans < v {
			ans = v
		}
	}
	return ans
}
func min(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans > v {
			ans = v
		}
	}
	return ans
}

func sum(i []int64) int64 {
	sum := int64(0)
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int64 {
	var ret = make([]int64, 0, len(strs))
	for _, str := range strs {
		var intVal = s2i(str)
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int64) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = i2s(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

func reverse(res []int64) []int64 {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}
func reverseStr(res []string) []string {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}

func ini(res []int, init int) {
	if len(res) == 0 {
		return
	}
	res[0] = init
	for i := 0; i < len(res); i++ {
		copy(res[i:], res[:i])
	}
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}

func main() {
  var x, t int
  fmt.Scan(&x, &t)
  fmt.Println(maxInt(0, x - t))
}


package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for A - Sandglass2
	var X, t int
	fmt.Scanf("%d %d", &X, &t)

	fmt.Println(math.Max(float64(X)-float64(t), 0))
}


package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for A - Sandglass2
	var X, t int
	fmt.Scanf("%d %d", &X, &t)

	fmt.Println(math.Max(float64(X-t), 0))
}


package main

import (
	"fmt"
)

func main() {
	var x, t float64
	fmt.Scan(&x, &t)
	a := x - t
	if a > 0 {
		fmt.Println(a)
	} else {
		fmt.Println(0)
	}
}


x,t = gets.chomp.split.map(&:to_i)

if x-t*1 <=0
  puts 0
else
  puts x - t*1
end


a,b=gets.split(" ").map(&:to_i);p [0,a-b].max


a, b = gets.split.map(&:to_i)
if a < b
	p 0
else
	p a-b
end


a,b=gets.split.map(&:to_i)
p a-b>0 a-b : 0


x, t = gets.chomp.spit(" ").map(&:to_i)
puts [x-t,0].max


x, t = gets.split.map &:to_i
p x - t


use proconio::input;

fn main() {
    input! {
        x: i64,
        t: i64,
    };
    let ans = std::cmp::max(0, x - t);
    println!("{}", ans);
}


use std::io::*;
use std::str::FromStr;

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

fn main() {
    let x: usize = read();
    let t: usize = read();
    if t > x {
        println!("0")
    } else {
        println!("{}", x - t);
    }
}


use std::io;

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

fn main() {
	let v:Vec<u64> = procon_read();
	let x = v[0];
	let t = v[1];
	if x < t {
		println!("0");
	}else{
		println!("{}", x-t);
	}
}


get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

main :-
    get_number(X, T),
    Z is X - T,
    writeln(Z).


// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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<_>>()
    };

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

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

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

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

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

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"4 3 6"# => "safe",
// r#"6 5 1"# => "delicious",
// r#"3 7 12"# => "dangerous",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        x: i64,
        t: i64,
    }

    if x > t  { 0 } else { x - t }.to_string()
}


//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

// solution
use std::collections::HashMap;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut dic = HashMap::new();

    for &ai in a.iter() {
        for a in ai-1..ai+2 {
        	let mut entry = dic.entry(a).or_insert(0);
            *entry += 1;
        }
    }

    let max = dic.values().into_iter().max().unwrap();
    println!("{}", max);
}


import Glibc
extension String: CollectionType {}

var xt = readLine()!.split(" ").map { Int($0)! }
if xt[0] - xt[1] > 0 {
  print(xt[0]-xt[1])
} else {
  print("0")
}


let i=readLine()!.characters.split(" ").map{Int(String($0))!};print(max(i[0]-i[1],0))


import Foundation

let x = Int(readLine()!)!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var t = Int(readLine()!)!

if ( x - t > 0){
    print(x - t)
}else{
    print("0")
}


import Foundation
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")
let x = Int(readLine()!)!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var t = Int(readLine()!)!

if ( x - t > 0){
    print(x - t)
}else{
    print(0)
}


import Foundation

let x = Int(readLine()!)!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var t = Int(readLine()!)!

if ( x - t > 0){
    print(x - t)
}else{
    print(0)
}


const main = (input) => {
  input = input.split(' ');
  const X = parseInt(input[0], 10);
  const t = parseInt(input[1], 10);

  if (X-t<=0){
    console.log(0);
  }else{
    console.log(X-t);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):string|string[]=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):string|string[]=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let a = t.n()-t.n();
  t.o(a<0?0:a)
}
main()


"use strict";

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

function main(input) {
  const [x, t] = input.split(" ").map(Number);

  const ans = x - t <= 0 ? 0 : x - t;
  console.log(ans);
}


const X = Number(process.argv[2]);
const t = Number(process.argv[3]);

// console.log(X);
// console.log(t);

console.log(X > t ? X - t : 0);


N,A,B = map(int,input().split())
if A == 0 or B == 0:
    print("0 0")
elif N >= A + B:
    a = min(A,B)
    print("{} {}".format(a,0))
else:
    a = min(A,B)
    b = A + B - N
    print("{} {}".format(a,b))


n,a,b = (int(i) for i in input().split())
x=min(a,b)
y=a+b-n
if y < 0:
    y=0
print(x,y)


N,A,B=[int(i) for i in input().split(" ")]
maximum=min(A,B)
minimum=max(A+B-N,0)
print(maximum,minimum)


n,a,b = map(int, input().split())
print(min(a,b),a+b-n)


n,a,b = map(int, input().split())

q=min(a, b)
w=a+b-n

print(q,w)


n, a, b = map(int, input().split())
if n >= a+b:
    print(min(a, b), 0)
else:
    if a == b:
        print(a, b)
    else:
        print(min(a, b), abs(a-b))