#include using namespace std; int countPaths(int x, int y) { // if we are at the origin, there is 1 path if (x == 0 && y == 0) return 1; int paths = 0; // Move left if x > 0 if (x > 0) paths += countPaths(x - 1, y); // Move up if y > 0 if (y > 0) paths += countPaths(x, y - 1); return paths; } int main() { int start_x, start_y; cout << "Enter the starting coordinates (x, y): "; cin >> start_x >> start_y; int result = countPaths(start_x, start_y); cout << "Number of paths to the origin: " << result << endl; return 0; }