\documentclass[11pt,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{url}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage[a4paper,margin=2.5cm,hmarginratio=1:1]{geometry}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% ENTER YOUR PERSONAL INFORMATION HERE %%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Your name, personal number, and email.
\newcommand{\firstname}{Zlatan}
\newcommand{\lastnames}{Ibrahimovic Josefsson}
\newcommand{\persnr}{123456-7890}
\newcommand{\email}{zlatan.ibrahimovic@ymail.com}


% Your two study pals. Leave empty as necessary.
\newcommand{\studypalX}{Carl Bildt}
\newcommand{\studypalXemail}{carl.bildt@ymail.com}
\newcommand{\studypalY}{Gudrun Schyman}
\newcommand{\studypalYemail}{gudrun.schyman@ymail.com}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% DO NOT TOUCH ANYTHING BELOW THIS LINE %%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{problem}
\renewcommand\theproblem{\arabic{problem}}
\newenvironment{problem}{%
  \bigbreak
  \refstepcounter{problem}\noindent
  \llap{\textbf{\theproblem}\quad}\ignorespaces
}{%
  \par\if@nadaten@solutions\relax\else\filbreak\fi
}
\newenvironment{problem*}{%
  \bigbreak
  \refstepcounter{problem}\noindent
  \llap{\textbf{\theproblem}\quad}\ignorespaces
}{%
  \par
}
\newcounter{subproblem}[problem]
\renewcommand{\thesubproblem}{\arabic{problem}\alph{subproblem}}
\newenvironment{subproblem}{%
  \refstepcounter{subproblem}%
  \list{}{}%
  \item\leavevmode
  \llap{\hbox to \leftmargini{\textbf{\thesubproblem}\hfil}}%
  \ignorespaces
}{%
  \endlist\if@nadaten@solutions\relax\else\filbreak\fi
}
\newenvironment{subproblem*}{%
  \refstepcounter{subproblem}%
  \list{}{}%
  \item\leavevmode
  \llap{\hbox to \leftmargini{\textbf{\thesubproblem}\hfil}}%
  \ignorespaces
}{%
  \endlist
}

\newcommand{\homeworknr}{1}
\newcommand{\studentname}{\firstname~\lastnames}
\newcommand{\homework}{Homework~\homeworknr}
\newcommand{\coursenumber}{DD2448}
\newcommand{\coursename}{\coursenumber~Foundations of cryptography}
\newcommand{\coursenick}{krypto16}

\lhead[\studentname]{\coursename}
\chead{}
\rhead[\coursename]{\studentname}
\lfoot[\thepage~(\pageref{LastPage})]{}
\cfoot{}
\rfoot[]{\thepage~(\pageref{LastPage})}

\fancypagestyle{firststyle}
{
   \fancyhf{}
   \fancyfoot[R]{\thepage~(\pageref{LastPage})}
}

\renewcommand{\headrulewidth}{0pt}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% HERE YOU CAN ADD YOUR OWN MACROS AND ENVIRONMENTS IN THE PREAMBLE %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Add your macros here.


\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% THE FOLLOWING GENERATES THE HEADER %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% DO NOT TOUCH THIS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\thispagestyle{firststyle}

\noindent
\hspace{0.3cm}{\huge\textbf{\coursename}}

\noindent
\rule{\textwidth}{1pt}

\vspace{0.3cm}

\noindent
\begin{tabularx}{\textwidth}{lXl}
  \multirow{3}{*}{\textbf{\huge\homework}} && {\Large\textbf{\studentname}} \\
&&\\[-0.3cm]
  && {\Large\persnr} \\
&&\\[-0.35cm]
  && {\Large\texttt{\email}} \\
&&\\[-0.2cm]
\cline{3-3}
&&\\[-0.2cm]
  \multirow{2}{*}{\textbf{\huge\coursenick}} && {\small\studypalX, \texttt{\studypalXemail}} \\
&& {\small\studypalY, \texttt{\studypalYemail}}
\end{tabularx}

\vspace{0.2cm}
\noindent
\rule{\textwidth}{1pt}

\vspace{0.5cm}

\pagestyle{fancy}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% YOUR SOLUTIONS START HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                       %%
%%  Do NOT remove any problem-, or subproblem environments, or nominal   %%
%%  ponts below. If you can not solve a problem, then you MUST simply    %%
%%  leave the "NOT SOLVED" string intact. This ensures that the          %%
%%  numbering is correct and it simplifies grading, leaving more time    %%
%%  to prepare lectures and help students.                               %%
%%                                                                       %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{problem}
  (12T) NOT SOLVED % We leave this place holder here for improved readability.
\end{problem}

\begin{problem}
  (2T) NOT SOLVED % We leave this place holder here for improved readability.
\end{problem}

\begin{problem}
  \begin{subproblem}
    (3T) NOT SOLVED % We leave this place holder here for improved readability.
  \end{subproblem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability.
  \end{subproblem}
\end{problem}

\begin{problem}
  (2T) NOT SOLVED % We leave this place holder here for improved readability.
\end{problem}

\begin{problem}
  (10I) NOT SOLVED % We leave this place holder here for improved readability. 
\end{problem}

\begin{problem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
\end{problem}

\begin{problem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
\end{problem}

\begin{problem}
  \begin{subproblem}
    (1T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
\end{problem}

\begin{problem}
  \begin{subproblem}
    (2T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (4T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
  \begin{subproblem}
    (10T) NOT SOLVED % We leave this place holder here for improved readability. 
  \end{subproblem}
\end{problem}

\end{document}
