Create flatten.cpp