Language: C++

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

vector<int> E[101];
int d[101];
void dfs1(int a, int b) {
	if (d[a] == 0) {
		d[a] = b;
		for (int i : E[a]) dfs1(i, b + 1);
	}
}

int wakare[101];
void dfs2(int a, int b) {
	if (d[a] == 0) {
		d[a] = b;
		int kari = E[a].size();
		kari--;
		wakare[b] = max(wakare[b], kari);
		for (int i : E[a]) dfs2(i, b + 1);
	}
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N;
	cin >> N;
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		E[a].pb(b);
		E[b].pb(a);
	}

	dfs1(1, 1);
	int saidai = 0;
	int doko;
	rep1(i, N) {
		if (saidai < d[i]) {
			saidai = d[i];
			doko = i;
		}
	}
	rep1(i, N) d[i] = 0;
	dfs1(doko, 1);
	saidai = 0;
	rep1(i, N) {
		if (saidai < d[i]) {
			saidai = d[i];
			doko = i;
		}
	}

	cosp((saidai + 1) / 2);
	ll saishou = 1e18;

	if (saidai & 1) {
		int nekko;
		rep1(i, N) if (d[i] == (saidai + 1) / 2) {
			rep1(j, N) d[j] = 0;
			dfs2(i, 1);
			wakare[1]++;
			nekko = i;
			break;
		}
		ll kotae = 1;
		rep1(i, N) {
			if (wakare[i]) kotae *= wakare[i];
		}
		saishou = kotae;

		for (int i : E[nekko]) {
			rep1(j, N) d[j] = 0;
			rep1(j, N) wakare[j] = 0;
			d[i] = 1;
			dfs2(nekko, 1);
			d[i] = 0;
			dfs2(i, 1);
			ll kotae = 2;
			rep1(j, N) {
				if (wakare[j]) kotae *= wakare[j];
			}
			saishou = min(saishou, kotae);
		}
	}
	else {
		int a, b;
		rep1(i, N) {
			if (d[i] == saidai / 2) {
				a = i;
				break;
			}
		}
		for (int i : E[a]) {
			if (d[i] == saidai / 2 + 1) {
				b = i;
				break;
			}
		}
		rep1(i, N) d[i] = 0;
		d[a] = 1;
		dfs2(b, 1);
		d[a] = 0;
		dfs2(a, 1);
		ll kotae = 2;
		rep1(i, N) {
			if (wakare[i]) kotae *= wakare[i];
		}
		saishou = kotae;
	}

	co(saishou);

	Would you please return 0;
}

Compiler output:
a.cc:15:1: error: 'vector' does not name a type
   15 | vector<int> E[101];
      | ^~~~~~
a.cc: In function 'void dfs1(int, int)':
a.cc:20:30: error: 'E' was not declared in this scope
   20 |                 for (int i : E[a]) dfs1(i, b + 1);
      |                              ^
a.cc: In function 'void dfs2(int, int)':
a.cc:28:28: error: 'E' was not declared in this scope
   28 |                 int kari = E[a].size();
      |                            ^
a.cc:30:29: error: 'max' was not declared in this scope
   30 |                 wakare[b] = max(wakare[b], kari);
      |                             ^~~
a.cc: In function 'int main()':
a.cc:37:9: error: 'cin' was not declared in this scope
   37 |         cin.tie(0);
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:38:9: error: 'ios' has not been declared
   38 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:46:17: error: 'E' was not declared in this scope
   46 |                 E[a].pb(b);
      |                 ^
a.cc:6:17: error: 'cout' was not declared in this scope
    6 | #define cosp(x) cout << (x) << " "
      |                 ^~~~
a.cc:69:9: note: in expansion of macro 'cosp'
   69 |         cosp((saidai + 1) / 2);
      |         ^~~~
a.cc:6:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #define cosp(x) cout << (x) << " "
      |                 ^~~~
a.cc:69:9: note: in expansion of macro 'cosp'
   69 |         cosp((saidai + 1) / 2);
      |         ^~~~
a.cc:87:30: error: 'E' was not declared in this scope
   87 |                 for (int i : E[nekko]) {
      |                              ^
a.cc:98:35: error: 'min' was not declared in this scope; did you mean 'main'?
   98 |                         saishou = min(saishou, kotae);
      |                                   ^~~
      |                                   main
a.cc:109:30: error: 'E' was not declared in this scope
  109 |                 for (int i : E[a]) {
      |                              ^