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

#define ll long long

#define ln '\n'

using namespace std;
string s="";
void fun (int x) {
if(x==1){
    s+="-\n" ;return ;
}
fun(x-1) ;
s+=string(x ,'-') ;
s+='\n';
fun(x-1) ;
}



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


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


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