For this Question: You are given a square character grid of side length N (where N is odd). You have to find whether the given grid is magical or not. A grid is said to be magical if it contains the same character on each element in its diagonal. Moreover, all the elements that are not present on the diagonal have to have the same character (which is different than the one on the diagonal).The first line contains integer N.
Each of the next N lines contain N lowercase English latin characters.

Constraints:
3 <= N <= 500
N is odd.Print "YES" if the given grid is magical, else print "NO", without the quotes.Sample Input:
3
aba
bab
aba

Sample Output:
YES

Explaination:
All characters on its diagonal are the same.
All the characters other than the diagonal are same.
The characters on the diagonal and the rest of the grid do not match.
Thus, it is a magical grid., I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int n;
    cin >> n;
    set<char> d, r;
    vector<string> s(n);
    for(int i = 1; i <= n; i++){
        cin >> s[i - 1];
        for(int j = 1; j <= n; j++){
            if(i == j or i + j == n + 1){
                d.insert(s[i - 1][j - 1]);
            }
            else r.insert(s[i - 1][j - 1]);
        }
    }
    if(d.size() == r.size() && d.size() == 1 && *d.begin() != *r.begin()) cout << "YES";
    else cout << "NO";
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?