Printing contents of list with indices from other list
It doesn't look like you're using &lt;stdio.h&gt;, so you can just remove it.
If you won't ever need to provide command line arguments, then you can remove main()'s parameters.
If you'll just be iterating though these lists forward, then it may be more beneficial to use an std::forward_list instead.  Or maybe you can just use an std::vector if there's no special need for a linked list.
Your list assignments is still pre-C++11.  Instead, use its initializer list:

list&lt;int&gt; listL { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };

list&lt;int&gt; listP { 0, 9 };


This will also allow you to make them const right away.