The question mark should be removed from the first line, as the QUERY_STRING variable only contains what is after the question mark.
If the first one is causing duplication, I would check what other rewrite rules you have enabled, because what may be happening is that two conflicting rewrites are happening. Make sure those two lines are the first thing in the .htaccess file, after any RewriteEngine on directive. The L at the end will ensure that no other rewrites are processed after it.
EDIT: I see what the problem is. The first version has the page name stated explicitly. Change the first one from this:
RewriteCond %{query_string} ref=pislikcs.com
RewriteRule (.*)
http://www.domain.com/page_name.html/$1? [R=301,L]
to this:
RewriteCond %{query_string} ref=pislikcs.com
RewriteRule (.*) http://www.domain.com/$1? [R=301,L]
(removing the bolded part)