#include #include using namespace std; int countNonBeautifulSubarrays(const vector& A) { int n = A.size(); int result = 0; int currentCount = 1; for (int i = 1; i < n; i++) { if (A[i] == A[i - 1]) { currentCount++; } else { result += (currentCount * (currentCount + 1)) / 2; currentCount = 1; } } result += (currentCount * (currentCount + 1)) / 2; return (n * (n + 1)) / 2 - result; } int main() { int T; cin >> T; for (int caseNum = 1; caseNum <= T; caseNum++) { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } int result = countNonBeautifulSubarrays(A); cout << "Case " << caseNum << ": " << result; if (caseNum