%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  _______  _______  __  _______   ______
% |       ||       ||  ||       | |      |
% |       ||  _____||  ||____   | |   |  |
% |       || |_____ |  |    |   | |   |  |
% |      _||_____  ||  |    |   | |   |  |
% |     |_  _____| ||  |    |   | |      |
% |_______||_______||__|    |___| |______|
%
% Header and Style File for CS170 TeX Files
%
% This package contains references to other packages, new commands, and values
% for different parameters, common to all documents.
% This file should be placed one level above the TeX files in the directory
% tree.
%
% Please modify the appropriate section below with information about
% the class: this information needs to be updated only once per semester.
%
% Compiled by Aditya Baradwaj (abaradwaj@berkeley.edu),
% with significant inspiration taken from CS 70's header.sty file,
% which was compiled and cleaned by Alvin Wan (http://alvinwan.com)
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\ProvidesPackage{cs170}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Course Information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% MODIFY THIS INFORMATION AS NECESSARY

\def\coursenumber{CS 170}
\def\class{Efficient Algorithms and Intractable Problems}
\def\semester{Spring 2025}
\def\instructor{N. Haghtalab and J. Wright}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Packages Needed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Algorithms
\usepackage{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{bbm}
\usepackage{cancel}
\usepackage{caption}
\usepackage{circuitikz}
%\usepackage{tikz,pgfplots}
\usepackage{color}
\usepackage{colortbl}
%\usepackage{enumerate}
%\usepackage{csquotes}
\usepackage{epsf}
\usepackage{fancyhdr}
\usepackage{forest}
\usepackage{float}
\usepackage{framed}
\usepackage{graphicx}
\usepackage{import}
\usepackage{latexsym}
\usepackage{lastpage}
\usepackage{listings}
\usepackage{mathtools}
\usepackage{paralist}
\usepackage{tabu}
\usepackage{textcomp}
\usepackage{tikz}
\usepackage{url}
\usepackage{verbatim} 
\usepackage[all]{xy}
\usepackage[shortlabels]{enumitem}
\usetikzlibrary{automata, arrows, positioning, shapes}
\usepackage{pgfplots}

\newlength{\myboxsize}
\setlength{\myboxsize}{\dimexpr(\columnwidth)}

\usepackage{multicol}
\usepackage[margin=1.2in]{geometry}

\usepackage{algorithm}
% \usepackage{algorithmic}
\usepackage[noend]{algpseudocode}

\usepackage{wrapfig}

%\usepackage[ruled, vlined]{algorithm2e}
%\setlength\parindent{0pt}

\usepackage{hyperref}
\usepackage{pythonhighlight}

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\lstset{frame=tb,
  language=Python,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=none,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header and Title
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\usepackage{color}
\setlength{\headheight}{20pt}
\setlength{\headsep}{10pt}
\fancyhead[L]{\small{\coursenumber, \semester}}
\fancyhead[C]{\small{\title}}
\fancyhead[R]{\small{\instructor}}
\fancyfoot[L]{{\it This content is protected and may not be shared, uploaded, or distributed.}}
\fancyfoot[R]{\small{\thepage} of \small{\pageref*{LastPage}}}

% The \title command gets defined in the .erb template file
\def\maketitle{
    \section*{CS 170 \title}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Other
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Commands for questions, parts, and solutions
\newcommand{\question}[1]{\section{#1}}

\newenvironment{subparts}{\begin{enumerate}[(a)]
\newcommand\subpart{\item}}{\end{enumerate}}

\newenvironment{solution}{\color{blue} \smallskip \textbf{Solution:}}{}
\newcount\starcounter
\newcommand{\stars}[1]{%
	(%
	\starcounter0
	\loop\ifnum\starcounter < #1
	$\bigstar$%
	\advance\starcounter by 1
	\repeat
	)
}

% Only keep in the original doc, not the solutions.
% \usepackage{comment}
\newcommand{\hideifsol}[1]{#1}

% Theorem environments
\newtheorem{claim*}{Claim}

% Other math commands

%%%%%% bold font in math mode; this sucks but is simplest for now
\newcommand{\mbf}[1]{\mbox{{\bfseries #1}}}
\newcommand{\smbf}[1]{\mbox{{\scriptsize\bfseries #1}}}

\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\msf}[1]{\mathsf{#1}}

\def\C{\mathbb{C}}
\def\N{\mathbb{N}}
\def\R{\mathbb{R}}
\def\X{\mbf{X}}
\def\x{\mbf{x}}
\def\sx{\smbf{x}}
\def\Y{\mbf{Y}}
\def\y{\mbf{y}}
\def\sy{\smbf{y}}
\def\e{\mathrm{e}}
\def\T{\mbf{T}}
\def\O{\textrm{O}}  % repeated below because it gets redefined by some package?
\def\Q{\mathbb{Q}}
\def\se{\smbf{e}}
\def\Z{\mathbb{Z}}
\def\z{\mbf{z}}
\def\sz{\smbf{z}}
\def\F{\mathbb{F}}
\def\f{\mbf{f}}
\def\A{\mbf{A}}
\def\B{\mbf{B}}
\def\b{\mbf{b}}
% Used in, e.g. \int_0^1 x \, \D x.
\def\D{\mathrm{d}}
% fancy big_O
\def\O{\mathcal{O}}
\def\m{\mbf{m}}
\def\I{\mbf{I}}
\def\ones{\mbf{1}}
\def\ev{\mbf{ev}}
\def\fv{\mbf{ev}}
\def\sv{\mbf{sv}}
\def\e{\mathop{\mathrm{e}}\nolimits}  % for e = 2.718...


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Additional commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Feel free to add commands here

\newcommand{\fillbubble}{
    \setlength{\unitlength}{1mm}
    \begin{picture}(3, 3) \put(1.5mm, 1.5mm){\circle{3mm}} \end{picture}
}

\newcommand{\solidbubble}{
    \setlength{\unitlength}{1mm}
    \begin{picture}(3, 3) \put(1.5mm, 1.5mm){\circle*{3mm}} \end{picture}
}

\def\defeq{\mathrel{\mathop:}=}
\def\ceil#1{\lceil #1 \rceil}
\def\ceiling#1{\lceil #1 \rceil}
\def\floor#1{\lfloor #1 \rfloor}
\newcommand{\set}[1]{\left\{#1\right\}}
\def\qed{$\Box$}

\newcommand{\blr}[1]{\left[ #1 \right]}
\newcommand{\bin}{\{0,1\}}
\newcommand{\bone}{\boldsymbol{1}}
\newcommand{\balpha}{\boldsymbol{\alpha}}
\newcommand{\bbeta}{\boldsymbol{\beta}}
\newcommand{\bdelta}{\boldsymbol{\delta}}
\newcommand{\bepsilon}{\boldsymbol{\epsilon}}
\newcommand{\blambda}{\boldsymbol{\lambda}}
\newcommand{\bomega}{\boldsymbol{\omega}}
\newcommand{\bpi}{\boldsymbol{\pi}}
\newcommand{\bnu}{\boldsymbol{\nu}}
\newcommand{\bphi}{\boldsymbol{\phi}}
\newcommand{\bvphi}{\boldsymbol{\varphi}}
\newcommand{\bpsi}{\boldsymbol{\psi}}
\newcommand{\bsigma}{\boldsymbol{\sigma}}
\newcommand{\btheta}{\boldsymbol{\theta}}
\newcommand{\bzeta}{\boldsymbol{\zeta}}
\newcommand{\bxi}{\boldsymbol{\xi}}
\newcommand{\ba}{\boldsymbol{a}}
\newcommand{\bb}{\boldsymbol{b}}
\newcommand{\bc}{\boldsymbol{c}}
\newcommand{\bd}{\boldsymbol{d}}
\newcommand{\be}{\boldsymbol{e}}
\newcommand{\boldf}{\boldsymbol{f}}
\newcommand{\bg}{\boldsymbol{g}}
\newcommand{\bh}{\boldsymbol{h}}
\newcommand{\bi}{\boldsymbol{i}}
\newcommand{\bj}{\boldsymbol{j}}
\newcommand{\bk}{\boldsymbol{k}}
\newcommand{\bell}{\boldsymbol{\ell}}
\newcommand{\bp}{\boldsymbol{p}}
\newcommand{\br}{\boldsymbol{r}}
\newcommand{\bs}{\boldsymbol{s}}
\newcommand{\bt}{\boldsymbol{t}}
\newcommand{\bu}{\boldsymbol{u}}
\newcommand{\bv}{\boldsymbol{v}}
\newcommand{\bw}{\boldsymbol{w}}
\newcommand{\bx}{{\boldsymbol{x}}}
\newcommand{\by}{\boldsymbol{y}}
\newcommand{\bz}{\boldsymbol{z}}
\newcommand{\bA}{\boldsymbol{A}}
\newcommand{\bB}{\boldsymbol{B}}
\newcommand{\bC}{\boldsymbol{C}}
\newcommand{\bD}{\boldsymbol{D}}
\newcommand{\bE}{\boldsymbol{E}}
\newcommand{\bF}{\boldsymbol{F}}
\newcommand{\bG}{\boldsymbol{G}}
\newcommand{\bH}{\boldsymbol{H}}
\newcommand{\bI}{\boldsymbol{I}}
\newcommand{\bJ}{\boldsymbol{J}}
\newcommand{\bL}{\boldsymbol{L}}
\newcommand{\bP}{\boldsymbol{P}}
\newcommand{\bQ}{\boldsymbol{Q}}
\newcommand{\bR}{\boldsymbol{R}}
\newcommand{\bS}{\boldsymbol{S}}
\newcommand{\bT}{\boldsymbol{T}}
\newcommand{\bU}{\boldsymbol{U}}
\newcommand{\bV}{\boldsymbol{V}}
\newcommand{\bW}{\boldsymbol{W}}
\newcommand{\bX}{\boldsymbol{X}}
\newcommand{\bY}{\boldsymbol{Y}}
\newcommand{\bZ}{\boldsymbol{Z}}

\newcommand{\E}{\mathbf{E}}
\newcommand{\Var}{\mathbf{Var}}
\newcommand{\wt}{\widetilde}
\newcommand{\eps}{\varepsilon}
