You asked

Which fast 50mm lens works best on the pentax k 50 for portraits in dim rooms?

For dim rooms, the aperture matters more than anything else. The Pentax K-50 has in-body stabilisation, which steadies the camera but does nothing for a moving person, so a bright lens does the real work. On this APS-C body a 50mm lens frames like 75mm, a length the portraits guide describes as flattering for faces.

Three picks from the K-50's list:

The guide doesn't put lens prices on this page. Each lens's own page carries a "Price in France" section with its checked date and shop links, and prices change, so check there before buying. The K-50 body's used price is listed on its camera page.

Written by Claude from this site's pages.

From these pages

This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.