#include <vector>
#include <iostream>
using namespace std;
vector<int> getRow(int rowIndex) {
vector<int> result(rowIndex+1, 1);
int size = rowIndex/2+1;
for (int i = 1; i < size; ++i) {
int value = 0;
if (rowIndex >= 30) {
value = int(((long long)result[i-1]) * (rowIndex-i+1) / i);
} else {
value = result[i-1] * (rowIndex-i+1) / i;
}
result[rowIndex-i] = result[i] = value;
}
return result;
}
void printV(vector<int> v) {
size_t si = v.size();
for (int i = 0; i < si; ++i) {
cout << v[i] << ", ";
}
cout << endl;
}
int main (int argc, const char * argv[]) {
cout << "Pascal's Triangle of 7:" << endl;
printV(getRow(7));
cout << endl << "Pascal's Triangle of 21:" << endl;
printV(getRow(21));
return 0;
}