\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{midAtl}[2017/10/30 LaTeX package for ICPC MidAtlantic Regional]

\RequirePackage{times}
\RequirePackage{fullpage}
\RequirePackage[usenames,dvipsnames,svgnames,table]{xcolor}
\RequirePackage{graphicx}
\RequirePackage{mdframed}
\RequirePackage{caption}
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\RequirePackage{indentfirst}
\RequirePackage{wrapfig}
\RequirePackage{verbatim}
\RequirePackage{array}
\RequirePackage{xpatch}

%\widowpenalty10000%
%\clubpenalty10000%
%\tolerance=1000

\newif\ifDRAFT
\DRAFTfalse

\DeclareOption{draft}{\DRAFTtrue}
\DeclareOption*{\PackageWarning{midAtl}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax

\newcommand{\problemname}[1]{\begin{center}%
    \section{\protect\rule{0pt}{1.1em}#1}
\end{center}}

\renewcommand{\thesection}{Problem \Alph{section}:}

\makeatletter
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname\hspace{0.5em}}
\makeatother

\definecolor{acmBlue}{HTML}{4A82C3}
\definecolor{acmRed}{HTML}{B12A1C}

\newcommand{\titleFont}[1]{\textbf{\color{acmBlue}\sffamily\Huge #1}}
\newcommand{\subtitleFont}[1]{\textbf{\Huge #1}}
\newcommand{\warningFont}[1]{\textbf{\sffamily\Large\color{acmRed} #1}}

\ifDRAFT
\newcommand{\documentDate}{\textbf{Draft \today}}
\else
\newcommand{\documentDate}{\textbf{\contestDate}}
\fi

\newif\ifPRACTICE
\PRACTICEfalse



\fancyhf{}  
\fancypagestyle{laterpages}{%
\fancyhf{}  
\setlength{\headheight}{16pt}
\lhead{}
\rhead{}
\lfoot{\sffamily\bfseries \contestDate}
\cfoot{\sffamily\bfseries \contestYear\ Mid-Atlantic Regional Programming Contest}
\rfoot{\sffamily\bfseries Page \thepage\ of \pageref{LastPage}}}


\fancypagestyle{problempages}{%
\fancyhf{}  
\setlength{\headheight}{16pt}
\lhead{}
\renewcommand*{\sectionmark}[1]{ \markright{\thesection\ ##1} }%
\rhead{\sffamily\bfseries\rightmark}
\lfoot{\sffamily\bfseries \contestDate}
\cfoot{\sffamily\bfseries \contestYear\ Mid-Atlantic Regional Programming Contest}
\rfoot{\sffamily\bfseries Page \thepage\ of \pageref{LastPage}}}


\fancypagestyle{firstpage}{%
\rhead{\includegraphics[width=\linewidth]{graphics/2018-regional-header-jb-2sigma-sponsorbar_MAUSA}}
%\setlength\headheight{85pt}
}  
\xapptocmd{\titlepage}{\thispagestyle{firstpage}}{}{}

\newcommand{\problem}[1]{
\clearpage
\pagestyle{problempages}
\input{#1/problem_statement/problem.en}
\input{#1/examples}
}


\definecolor{sampleColor}{HTML}{F0F0FF}




\newcommand{\sampleData}[3]{

\noindent
\begin{minipage}{\linewidth}
\vspace{1\baselineskip}
\textbf{\large Example #2}
\par
\noindent
\textbf{Sample Input}
\begin{mdframed}[backgroundcolor=sampleColor]
\par
\verbatiminput{#1/#3.in}
\end{mdframed}
\end{minipage}
\vskip 1\baselineskip
\noindent
\begin{minipage}{\linewidth}
\textbf{Sample Output}
\begin{mdframed}[backgroundcolor=sampleColor]
\verbatiminput{#1/#3.ans}
\end{mdframed}
\end{minipage}
}

\newcommand{\illustration}[3]{
  \begin{wrapfigure}{r}{#1\textwidth}
    \includegraphics[width=#1\textwidth]{#2}
    \begin{flushright}
      \vspace{-9pt}
      \tiny #3
    \end{flushright}
    \vspace{-15pt}
  \end{wrapfigure}
  \par
  \noindent
}
%\newcommand{\illustration}[2]{
%\begin{wrapfigure}{r}{#1\linewidth}
%\includegraphics[width=\linewidth]{#2}
%\end{wrapfigure}
%}
