<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass{article}
\usepackage{xsim}
\usepackage{lipsum}

\DeclareExerciseCollection[difficulty=easy]{easy}
\DeclareExerciseCollection[difficulty=medium]{medium}
\DeclareExerciseTagging{difficulty}

\xsimsetup{collect}

\begin{document}

\begin{exercise}[use,print]
  outside before
\end{exercise}

\begin{exercise}[difficulty=easy,points=1]
  foo one \lipsum[4]
\end{exercise}
\begin{solution}
  foo one \lipsum[4]
\end{solution}
\begin{exercise}[difficulty=medium,points=1]
  foo two \lipsum[4]
\end{exercise}
\begin{solution}
  foo two \lipsum[4]
\end{solution}
\begin{exercise}[difficulty=easy,points=1]
  foo three \lipsum[4]
\end{exercise}
\begin{solution}
  foo three \lipsum[4]
\end{solution}

\section{Easy}
\printcollection{easy}

\section{Medium}
\printcollection{medium}

\printsolutions[difficulty=medium]

\end{document}
</pre></body></html>