Go: package main

import . "fmt"

func main() {
	for i := 1; i < 10; i++ {
		for j := 1; j < 10; j++ {
			Printf("%dx%d=%d\n", i, j, i*j)
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <string.h>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

const int MaxN = 2000 + 20;
int map[MaxN][MaxN];

void gen(int N){
    cout << N << endl;
    for (int i=1;i<=N;++i)
        for (int j=1;j<=N;++j)
            printf("%d%c",map[i][j]=rand()%100<5?0:1,j==N?'\n':' ');
    int Sx,Sy,Tx,Ty;
    do{
        Sx=rand()%N+1;
        Sy=rand()%N+1;
    }while (!map[Sx][Sy]);
    do{
        Tx=rand()%N+1;
        Ty=rand()%N+1;
    }while (!map[Tx][Ty]);
    printf("%d %d %d %d\n",Sx,Sy,Tx,Ty);
}

int main(){
    int T = 10;
    while (T--) gen(10);
    T = 5;
    while (T--) gen(1000);
    return 0;
}

C++: #include<stdio.h>
#include <string>
#include <iostream>
using namespace std; 
int main(){
 
 
for(int i=1;i<10;i++)
for(int j=1;j<10;j++)
cout<<i<<"x"<<j<<"="<<j*i<<endl;
    return 0;
}

C++: #include<stdio.h>

int main(){
    int num1,num2;
    for(num1=0;num1<10;num1++){
       for(num2=0;num2<10;num2++){
           printf("%dx%d\=%d",num1,num2,num1*num2);
        }
    }
    return 0;
}

C++: #include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cassert>
#include<cstring>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<string>
using namespace std;
typedef pair<int,int>pint;
typedef vector<int>vint;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

const int SIZE=10000;

struct edge{
    int to,cost;
    edge(int to,int cost):to(to),cost(cost){}
};

int N,K;
vector<edge>G[SIZE];

bool centroid[SIZE];
int subtree_size[SIZE];

int ans;

int compute_subtree_size(int v,int p){
    int c=1;
    rep(i,G[v].size()){
        int to=G[v][i].to;
        if(to==p||centroid[to])continue;
        c+=compute_subtree_size(to,v);
    }
    subtree_size[v]=c;
    return c;
}

pint search_centroid(int v,int p,int t){
    pint res=mp(INT_MAX,-1);
    int s=1,m=0;
    rep(i,G[v].size()){
        int to=G[v][i].to;
        if(to==p||centroid[to])continue;
        res=min(res,search_centroid(to,v,t));
        m=max(m,subtree_size[to]);
        s+=subtree_size[to];
    }

    m=max(m,t-s);
    res=min(res,mp(m,v));
    return res;
}

void enumerate_paths(int v,int p,int d,vint &ds){
    ds.pb(d);
    rep(i,G[v].size()){
        int to=G[v][i].to;
        if(to==p||centroid[to])continue;
        enumerate_paths(to,v,d+G[v][i].cost,ds);
    }
}

int count_pairs(vint &ds){
    int res=0;
    sort(ds.begin(),ds.end());
    int j=ds.size();
    rep(i,ds.size()){
        while(j>0&&ds[i]+ds[j-1]>K)j--;
        res+=j-(j>i?1:0);
    }
    return res/2;
}

void solve_subproblem(int v){
    compute_subtree_size(v,-1);
    int s=search_centroid(v,-1,subtree_size[v]).second;
    centroid[s]=true;

    rep(i,G[s].size()){
        if(centroid[G[s][i].to])continue;
        solve_subproblem(G[s][i].to);
    }

    vint ds;
    ds.pb(0);
    rep(i,G[s].size()){
        if(centroid[G[s][i].to])continue;
        vint tds;
        enumerate_paths(G[s][i].to,s,G[s][i].cost,tds);

        ans-=count_pairs(tds);
        ds.insert(ds.end(),tds.begin(),tds.end());
    }

    ans+=count_pairs(ds);
    centroid[s]=false;
}

int main(){

    while(scanf("%d%d",&N,&K),N||K){
        rep(i,N)G[i].clear();
        ans=0;

        rep(i,N-1){
            int a,b,c;
            scanf("%d%d%d",&a,&b,&c);
            a--;b--;
            G[a].pb(edge(b,c));
            G[b].pb(edge(a,c));
        }

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

    return 0;
}

C++: #include <cstdio>

using namespace std;

int main() {
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            printf("%dx%d=%d", i, j, i * j);
        }
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            cout << i << "x" << j << "=" << i * j << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	int i,j;
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			cout<<i<<"*"<<j<<"="<<i*j<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
	int i,j;
	for (i = 1; i <=9; i++) {
		for (j = 1; j <= 9; j++) {
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;

int main(){
	for(int i=1;i<10;i++)
		for(int j=1;j<10;j++)
			printf("%dx%d=%d\n",i,j,i*j);
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	for (int i = 1; i <= 9; i++)
	{
		for (int j = 1; j <= 9; j++)
		{
			cout << i << 'x' << j << '=' << i * j << endl;
		}
	}

	return 0;
}

C++: #include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <iomanip>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))

int main(void) {
  FOR(i, 1, 10) {
    FOR(j, 1, 10) {
      printf("%dx%d=%d\n", i, j, i * j);
    }
  }
}

C++: #include<iostream>
using namespace std;

int main()
{
	for(int i=1; i<=9; i++)
	{
		for(int j = 1; j <=9; j++)
		{
			int ans = i * j;
			cout << i << "x" << j << "=" << ans <<endl;
		}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
int a;
cin >> a;
cout << a;
}

C++: #include<iostream>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
using namespace std;
void solver(){
    REP(i,1,10){
        REP(j,1,10){
            cout<<i<<"x"<<j<<"="<<i*j<<endl;
        }
    }

}

int main() {
    solver();
}

C++: #include<iostream>
using namespace std;


int main(){
	int i ,j;
	for(i=1; i<=9;i++){
		for(j=1;j<=9;j++){
			cout<<i<<"*"<<j<<"="<<i*j<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
}

C++: #include<iostream>
using namespace std;

int main(){
   for(int i = 1;i <= 9;i++)
      for(int j = 1;j <= 9;j++)
         cout<<i<<"x"<<j<<"="<<i*j<<"\n";
    return 0;
}

C++: #include<string>
#include<iostream>
using namespace std;
int main(){
	string x;
	for(int i=1;i<10;i++){
		for(int j=1;j<10;j++){
			cout << i << "x" << j << "=" << i*j << endl;
		}		
	}
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            cout<<i<<"x"<<j<<"="<<i*j<<endl;
        }
    }
    return 0;
}