2 added 2 characters in body
source | link

C++, 187187 149 bytes

  • 38 bytes thanks to Karl Napf

Output is done by the reference type parameter The parameter's type have to be a std::vector<std::vector<int>> type

#include<vector>
voidauto rr=[](std::vector<std::vector<int>>&aauto&a){for(int i=1,j,v;i<a.size();++i){v=a[i-1][0]%a[i].size();for(j=0;j<v;++j){a[i].insert(a[i].begin(),a[i].back());a[i].pop_back();}}};

Trying to do as #define A a[i] and replacing all occurences of a[i] by A will result with same byte count code

Code to help for the test :

//Shift operator overload
std::ostream& operator<<(std::ostream& os, std::vector<std::vector<int>>& v) {
    os << "{\n";
    for (auto&a : v) {
        os << "\t{ ";
        for (auto&b : a) {
            os << b << ' ';
        }
        os << "},\n";
    }
    return os << "}\n";
}

And in the main function

std::vector<std::vector<int>> t{
    {1,5,8},
    {4,7,2},
    {3,9,6}
};

std::cout << t;

r(t);

std::cout << t;

C++, 187 bytes

Output is done by the reference type parameter

#include<vector>
void r(std::vector<std::vector<int>>&a){for(int i=1,j,v;i<a.size();++i){v=a[i-1][0]%a[i].size();for(j=0;j<v;++j){a[i].insert(a[i].begin(),a[i].back());a[i].pop_back();}}}

Trying to do as #define A a[i] and replacing all occurences of a[i] by A will result with same byte count code

Code to help for the test :

//Shift operator overload
std::ostream& operator<<(std::ostream& os, std::vector<std::vector<int>>& v) {
    os << "{\n";
    for (auto&a : v) {
        os << "\t{ ";
        for (auto&b : a) {
            os << b << ' ';
        }
        os << "},\n";
    }
    return os << "}\n";
}

And in the main function

std::vector<std::vector<int>> t{
    {1,5,8},
    {4,7,2},
    {3,9,6}
};

std::cout << t;

r(t);

std::cout << t;

C++, 187 149 bytes

  • 38 bytes thanks to Karl Napf

Output is done by the reference type parameter The parameter's type have to be a std::vector<std::vector<int>> type

auto r=[](auto&a){for(int i=1,j,v;i<a.size();++i){v=a[i-1][0]%a[i].size();for(j=0;j<v;++j){a[i].insert(a[i].begin(),a[i].back());a[i].pop_back();}}};

Trying to do as #define A a[i] and replacing all occurences of a[i] by A will result with same byte count code

Code to help for the test :

//Shift operator overload
std::ostream& operator<<(std::ostream& os, std::vector<std::vector<int>>& v) {
    os << "{\n";
    for (auto&a : v) {
        os << "\t{ ";
        for (auto&b : a) {
            os << b << ' ';
        }
        os << "},\n";
    }
    return os << "}\n";
}

And in the main function

std::vector<std::vector<int>> t{
    {1,5,8},
    {4,7,2},
    {3,9,6}
};

std::cout << t;

r(t);

std::cout << t;
1
source | link

C++, 187 bytes

Output is done by the reference type parameter

#include<vector>
void r(std::vector<std::vector<int>>&a){for(int i=1,j,v;i<a.size();++i){v=a[i-1][0]%a[i].size();for(j=0;j<v;++j){a[i].insert(a[i].begin(),a[i].back());a[i].pop_back();}}}

Trying to do as #define A a[i] and replacing all occurences of a[i] by A will result with same byte count code

Code to help for the test :

//Shift operator overload
std::ostream& operator<<(std::ostream& os, std::vector<std::vector<int>>& v) {
    os << "{\n";
    for (auto&a : v) {
        os << "\t{ ";
        for (auto&b : a) {
            os << b << ' ';
        }
        os << "},\n";
    }
    return os << "}\n";
}

And in the main function

std::vector<std::vector<int>> t{
    {1,5,8},
    {4,7,2},
    {3,9,6}
};

std::cout << t;

r(t);

std::cout << t;