Source Code
#include <bits/stdc++.h>

#define ll long long

#define ln '\n'

using namespace std;

void fun (int x) {
if(x==1){
   cout << '-' << ln ;return ;
}
fun(x-1) ;
cout << string(x,'-') << ln ;
fun(x-1) ;
}



int main (){
int n , p ;
cin >>n>> p ;


for(int i =0 ;i <=n ;i++) {
    cout << string(p,'-') << i << ln ;
    if(i!=n)
    fun(p-1);
}


return 0 ; }
Copy
Ruler Alice07
GNU G++17
168 ms
262.1 MB
Memory Limit Exceeded