%%% Packages
\usepackage{boxedminipage} 
\usepackage{xspace} 
\usepackage{mleftright} 
\usepackage{xcolor} 
\usepackage{soul} 
\usepackage{amssymb}
\usepackage{amsmath} 
\usepackage{enumitem}
\usepackage{bbm}
\usepackage{stmaryrd}
\usepackage{algpseudocode}
\usepackage{cancel} 
\usepackage{todonotes} 
\usepackage{tcolorbox}
\usepackage[margin = 1in]{geometry}

%%% PGF plot
\usepackage{pgfplots}
  \pgfplotsset{compat=newest}


%%% This package breaks long list of citations at linebreak
\usepackage{breakcites}


%%% Load hyperref before crypto package
\usepackage[pdftex,bookmarks=true,pdfstartview=FitH,colorlinks,linkcolor=blue,filecolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true]{hyperref}
    \urlstyle{sf}


%%% Crypto Package
\usepackage[lambda,advantage,operators,sets,adversary,landau,probability,notions,logic,ff,mm,primitives,events,complexity,asymptotics,keys]{cryptocode}
\renewcommand{\expectationname}{\ensuremath{E}}


%%% PGF Plots
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}
\usepgfplotslibrary{external} 
\usepgfplotslibrary{fillbetween} 

%%% Tikz Packages
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{calc}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes}
\usetikzlibrary{patterns}
\usetikzlibrary{matrix}
\usetikzlibrary{intersections}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{quotes}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations}
%\usetikzlibrary{shadows}

%%% No figures taking up one whole page
\renewcommand{\floatpagefraction}{.8}


%%% Document Design Choices
%\geometry{left=1in, right=1in, top=1in, bottom=1in}
\let\epsilon\varepsilon


%%% Marking
\newcommand\TODO[1]{{\color{red}{ TODO: {#1}}}\xspace}
%\newcommand\typo[1]{{\textcolor{blue}{ Typo: {#1}}}\xspace}
%\newcommand{\mw}[1]{{\textcolor{cyan}{ Mingyuan: {#1}}}\xspace}


%%% Theorem, etc.
\makeatletter
%\newtheorem*{rep@theorem}{\rep@title}
\newcommand{\newreptheorem}[2]{%
\newenvironment{rep#1}[1]{%
 \def\rep@title{\theoremref{##1} Restated}%
 \begin{rep@theorem}}%
 {\end{rep@theorem}}}
\makeatother

\makeatletter
%\newtheorem*{rep@lemma}{\rep@title}
\newcommand{\newreplemma}[2] {%
\newenvironment{rep#1}[1]{%
 \def\rep@title{\lemmaref{##1} Restated}%
 \begin{rep@lemma}}%
 {\end{rep@lemma}}}
\makeatother

%\newtheorem{theorem}{Theorem}
%\newtheorem*{theorem-no-num}{Theorem}
%\newreptheorem{theorem}{Theorem}
%\newtheorem{importedlemma}{Imported Lemma}
\newtheorem{importedtheorem}{Imported Theorem} 
%\newtheorem{informaltheorem}{Informal Theorem}
%\newtheorem{definition}{Definition}
%\newtheorem{lemma}{Lemma}
%\newtheorem{proposition}{Proposition}
%\newreplemma{lemma}{Lemma}
\newtheorem{Remark}{Remark}
\newtheorem{clm}{Claim}
%\newtheorem{importedclaims}{Imported Claims}
%\newtheorem{corollary}[theorem]{Corollary}
%\newtheorem{informalcorollary}[theorem]{Informal Corollary}
%\newtheorem{observation}{Observation}
%\newtheorem{property}{Property}
\newtheorem{objective}{Objective} 



%%% Boxed Algorithm Enviroment
\newenvironment{boxedalgo}
  {\begin{center}\begin{boxedminipage}{\linewidth}}
  {\end{boxedminipage}\end{center}}


%%% References
\newcommand{\namedref}[2]{\hyperref[#2]{#1~\ref*{#2}}\xspace}
\newcommand{\lemmaref}[1]{\namedref{Lemma}{lem:#1}}
\newcommand{\propref}[1]{\namedref{Proposition}{prop:#1}}
\newcommand{\theoremref}[1]{\namedref{Theorem}{thm:#1}}
\newcommand{\claimref}[1]{\namedref{Claim}{clm:#1}}
\newcommand{\corolref}[1]{\namedref{Corollary}{cor:#1}}
\newcommand{\figureref}[1]{\namedref{Figure}{fig:#1}}
\newcommand{\tableref}[1]{\namedref{Table}{tbl:#1}}
\newcommand{\equationref}[1]{\namedref{Equation}{eq:#1}}
\newcommand{\defref}[1]{\namedref{Definition}{def:#1}}
\newcommand{\observationref}[1]{\namedref{Observation}{obs:#1}}
\newcommand{\procedureref}[1]{\namedref{Procedure}{proc:#1}}
\newcommand{\importedtheoremref}[1]{\namedref{Imported Theorem}{impthm:#1}}
\newcommand{\informaltheoremref}[1]{\namedref{Informal Theorem}{infthm:#1}}
\newcommand{\importedlemmaref}[1]{\namedref{Imported Lemma}{implem:#1}}

\newcommand{\sectionref}[1]{\namedref{Section}{sec:#1}}
\newcommand{\subsectionref}[1]{\namedref{Subsection}{subsec:#1}}
\newcommand{\appendixref}[1]{\namedref{Supporting Material}{app:#1}}
\newcommand{\propertyref}[1]{\namedref{Property}{prop:#1}}


%%% English
\newcommand{\ie}{\text{i.e.}\xspace}
\renewcommand{\st}{\text{s.t.}\xspace}
\newcommand{\etal}{\text{et al.}\xspace}
\newcommand{\naive}{\text{na\"ive}\xspace}
\newcommand{\wrt}{\text{w.r.t.}\xspace}
\newcommand{\whp}{\text{w.h.p.}\xspace}
\newcommand{\resp}{\text{resp.}\xspace}
\newcommand{\eg}{\text{e.g.}\xspace}
\newcommand{\cf}{\text{cf.}\xspace}
\newcommand{\visavis}{\text{vis-\`a-vis}\xspace}
\newcommand{\aka}{\text{a.k.a.}\xspace}
\newcommand{\ala}{\text{\`{a} la}\xspace}


%%% Names
\newcommand{\gacs}[0]{G\'acs\xspace}
\newcommand{\korner}[0]{K\"orner\xspace}
\newcommand{\turan}[0]{Tur{\'a}n\xspace}
\newcommand{\erdos}[0]{Erd\H{o}s\xspace}
\providecommand{\bezout}[0]{B\'ezout\xspace}
\providecommand{\mobius}[0]{M\"obius\xspace}







\newcommand{\high}[0]{L\xspace}
\newcommand{\low}[0]{H\xspace}
%\newcommand{\share}[0]{\textsf{Share}\xspace}
%\newcommand{\rec}[0]{\textsf{Rec}\xspace}
\newcommand{\addinv}[0]{\textsf{addinv}\xspace}
\newcommand{\mulinv}[0]{\textsf{mulinv}\xspace}


%% Cal Alphabets
\newcommand{\cA}{\ensuremath{{\mathcal A}}\xspace}
\newcommand{\cB}{\ensuremath{{\mathcal B}}\xspace}
\newcommand{\cC}{\ensuremath{{\mathcal C}}\xspace}
\newcommand{\cD}{\ensuremath{{\mathcal D}}\xspace}
\newcommand{\cE}{\ensuremath{{\mathcal E}}\xspace}
\newcommand{\cF}{\ensuremath{{\mathcal F}}\xspace}
\newcommand{\cG}{\ensuremath{{\mathcal G}}\xspace}
\newcommand{\cH}{\ensuremath{{\mathcal H}}\xspace}
\newcommand{\cI}{\ensuremath{{\mathcal I}}\xspace}
\newcommand{\cJ}{\ensuremath{{\mathcal J}}\xspace}
\newcommand{\cK}{\ensuremath{{\mathcal K}}\xspace}
\newcommand{\cL}{\ensuremath{{\mathcal L}}\xspace}
\newcommand{\cM}{\ensuremath{{\mathcal M}}\xspace}
\newcommand{\cN}{\ensuremath{{\mathcal N}}\xspace}
\newcommand{\cO}{\ensuremath{{\mathcal O}}\xspace}
\newcommand{\cP}{\ensuremath{{\mathcal P}}\xspace}
\newcommand{\cQ}{\ensuremath{{\mathcal Q}}\xspace}
\newcommand{\cR}{\ensuremath{{\mathcal R}}\xspace}
\newcommand{\cS}{\ensuremath{{\mathcal S}}\xspace}
\newcommand{\cT}{\ensuremath{{\mathcal T}}\xspace}
\newcommand{\cU}{\ensuremath{{\mathcal U}}\xspace}
\newcommand{\cV}{\ensuremath{{\mathcal V}}\xspace}
\newcommand{\cW}{\ensuremath{{\mathcal W}}\xspace}
\newcommand{\cX}{\ensuremath{{\mathcal X}}\xspace}
\newcommand{\cY}{\ensuremath{{\mathcal Y}}\xspace}
\newcommand{\cZ}{\ensuremath{{\mathcal Z}}\xspace}


%% Bold Alphabets
\newcommand{\bA}{\ensuremath{{\mathbf A}}\xspace}
\newcommand{\bB}{\ensuremath{{\mathbf B}}\xspace}
\newcommand{\bC}{\ensuremath{{\mathbf C}}\xspace}
\newcommand{\bD}{\ensuremath{{\mathbf D}}\xspace}
\newcommand{\bE}{\ensuremath{{\mathbf E}}\xspace}
\newcommand{\bF}{\ensuremath{{\mathbf F}}\xspace}
\newcommand{\bG}{\ensuremath{{\mathbf G}}\xspace}
\newcommand{\bH}{\ensuremath{{\mathbf H}}\xspace}
\newcommand{\bI}{\ensuremath{{\mathbf I}}\xspace}
\newcommand{\bJ}{\ensuremath{{\mathbf J}}\xspace}
\newcommand{\bK}{\ensuremath{{\mathbf K}}\xspace}
\newcommand{\bL}{\ensuremath{{\mathbf L}}\xspace}
\newcommand{\bM}{\ensuremath{{\mathbf M}}\xspace}
\newcommand{\bN}{\ensuremath{{\mathbf N}}\xspace}
\newcommand{\bO}{\ensuremath{{\mathbf O}}\xspace}
\newcommand{\bP}{\ensuremath{{\mathbf P}}\xspace}
\newcommand{\bQ}{\ensuremath{{\mathbf Q}}\xspace}
\newcommand{\bR}{\ensuremath{{\mathbf R}}\xspace}
\newcommand{\bS}{\ensuremath{{\mathbf S}}\xspace}
\newcommand{\bT}{\ensuremath{{\mathbf T}}\xspace}
\newcommand{\bU}{\ensuremath{{\mathbf U}}\xspace}
\newcommand{\bV}{\ensuremath{{\mathbf V}}\xspace}
\newcommand{\bW}{\ensuremath{{\mathbf W}}\xspace}
\newcommand{\bX}{\ensuremath{{\mathbf X}}\xspace}
\newcommand{\bY}{\ensuremath{{\mathbf Y}}\xspace}
\newcommand{\bZ}{\ensuremath{{\mathbf Z}}\xspace}


%% Black-board Bold Alphabets
\newcommand{\bbA}{\ensuremath{{\mathbb A}}\xspace}
\newcommand{\bbB}{\ensuremath{{\mathbb B}}\xspace}
\newcommand{\bbC}{\ensuremath{{\mathbb C}}\xspace}
\newcommand{\bbD}{\ensuremath{{\mathbb D}}\xspace}
\newcommand{\bbE}{\ensuremath{{\mathbb E}}\xspace}
\newcommand{\bbF}{\ensuremath{{\mathbb F}}\xspace}
\newcommand{\bbG}{\ensuremath{{\mathbb G}}\xspace}
\newcommand{\bbH}{\ensuremath{{\mathbb H}}\xspace}
\newcommand{\bbI}{\ensuremath{{\mathbb I}}\xspace}
\newcommand{\bbJ}{\ensuremath{{\mathbb J}}\xspace}
\newcommand{\bbK}{\ensuremath{{\mathbb K}}\xspace}
\newcommand{\bbL}{\ensuremath{{\mathbb L}}\xspace}
\newcommand{\bbM}{\ensuremath{{\mathbb M}}\xspace}
\newcommand{\bbN}{\ensuremath{{\mathbb N}}\xspace}
\newcommand{\bbO}{\ensuremath{{\mathbb O}}\xspace}
\newcommand{\bbP}{\ensuremath{{\mathbb P}}\xspace}
\newcommand{\bbQ}{\ensuremath{{\mathbb Q}}\xspace}
\newcommand{\bbR}{\ensuremath{{\mathbb R}}\xspace}
\newcommand{\bbS}{\ensuremath{{\mathbb S}}\xspace}
\newcommand{\bbT}{\ensuremath{{\mathbb T}}\xspace}
\newcommand{\bbU}{\ensuremath{{\mathbb U}}\xspace}
\newcommand{\bbV}{\ensuremath{{\mathbb V}}\xspace}
\newcommand{\bbW}{\ensuremath{{\mathbb W}}\xspace}
\newcommand{\bbX}{\ensuremath{{\mathbb X}}\xspace}
\newcommand{\bbY}{\ensuremath{{\mathbb Y}}\xspace}
\newcommand{\bbZ}{\ensuremath{{\mathbb Z}}\xspace}


%%% Common commands
\let\leq=\leqslant
\let\geq=\geqslant
%\renewcommand{\nabs}[1]{\ensuremath{\abs{\vphantom{\big\{}#1}}
\newcommand{\pred}[1]{\ensuremath{\mathsf{#1}}\xspace}
\newcommand{\SD}[2]{\ensuremath{\pred{SD}\left({#1}\;,\;{#2}\right)}\xspace}
\newcommand{\Enc}{\mathsf{Enc}}
\newcommand{\Dec}{\mathsf{Dec}}
\newcommand{\Ext}{\mathsf{Ext}}
\newcommand{\zo}{\ensuremath{{\{0,1\}}}\xspace}
\newcommand{\defeq}[0]{\ensuremath{{\;\vcentcolon=\;}}\xspace}
\newcommand{\drawn}{\ensuremath{\xleftarrow{\$}}\xspace}
\newcommand{\wt}{\ensuremath{\mathsf{wt}}\xspace}
\newcommand{\hd}{\ensuremath{\mathsf{HD}}\xspace}
\newcommand{\draw}{\leftarrow}
\newcommand{\eps}{\epsilon}


%%% Circuits
\renewcommand{\AC}[1]{\ensuremath{\mathsf{AC}^{#1}}\xspace}
\renewcommand{\NC}[1]{\ensuremath{\mathsf{NC}^{#1}}\xspace}


%%%  Argmin and argmax with subscripts in display mode
\def\argmin{\mathop{\mathrm{argmin}}\limits}
\def\argmax{\mathop{\mathrm{argmax}}\limits}


%%% Multiline subscript command \mathstack
\NewDocumentCommand\mathstack{>{\SplitList{;}}m}
  {\ensuremath{
    \begin{smallmatrix}
      \ProcessList{#1}{ \insertone }    
    \end{smallmatrix}
  }}
\newcommand{\insertone}[1]{\ensuremath{#1}\\}


\usepackage{etoolbox}
\AfterEndEnvironment{equation}{\restarthintedrel}
\AfterEndEnvironment{align}{\restarthintedrel}
\newcounter{hints}
\renewcommand{\thehints}{\roman{hints}}
\newcommand{\hintedrel}[2][]{%
  \stepcounter{hints}%
  \if\relax\detokenize{#1}\relax\else\csxdef{hint@#1}{\thehints}\fi
  \mathrel{\overset{\textrm{(\thehints)}}{\vphantom{\le}{#2}}}%
}
\newcommand{\restarthintedrel}{\setcounter{hints}{0}}
\newcommand{\hintref}[1]{\csuse{hint@#1}}


%%% Local terms
\newcommand{\alice}{\mathsf{A}}
\newcommand{\bob}{\mathsf{B}}
\newcommand{\leqi}{{\leq i}}
\newcommand{\remarkref}[1]{\namedref{Remark}{rmk:#1}}

\def\Expt{\mathop{\mathrm{E}}\limits}
\def\Pro{\mathop{\mathrm{Pr}}\limits}
\renewcommand{\expsub}[2]{\Expt_{{#1}}\left[{#2}\right]}
\renewcommand{\probsub}[2]{\Pro_{{#1}}\left[{#2}\right]}

\def\variance{\mathop{\mathrm{Var}}}
\newcommand{\var}[1]{\ensuremath{\variance\left[{#1}\right]}}

\newcommand{\phybit}[2]{\left[{#1}\right]_{#2}}
\newcommand{\share}{\mathsf{Share}}
\newcommand{\rec}{\mathsf{Rec}}
\newcommand{\leak}{\mathsf{Leak}}
\newcommand{\shareshamir}{\ensuremath{\mathsf{Share}^{\vec{X}}}}
\newcommand{\recshamir}{\ensuremath{\mathsf{Rec}^{\vec{X}}}}
\renewcommand{\ind}{\mathsf{index}}
\newcommand{\addshare}{\mathsf{AddShare}}
\newcommand{\addss}{\mathsf{AddSS}}
\newcommand{\shamirss}{\mathsf{ShamirSS}}

\providecommand{\tuple}[1]{\ensuremath{\left\langle#1\right\rangle}\xspace}

\newcommand{\1}{\mathbbm{1}}
\newcommand{\hId}{\widehat{\mathbbm{1}}}
\newcommand{\E}{\mathbbm{E}}

\DeclareMathOperator{\sgn}{sign}


%\newcommand{\bigTheta}[1]{\Theta\left({#1}\right)}

\newcommand{\si}[1]{\sin\left({#1}\right)}
\newcommand{\co}[1]{\cos\left({#1}\right)}
\newcommand{\lo}[1]{\log\left({#1}\right)}


%% LOCAL 
\providecommand{\p}[1]{\ensuremath{^{\left(#1\right)}}\xspace}
\providecommand{\lsb}[0]{\ensuremath{\mathrm{LSB}}\xspace}
\providecommand{\msb}[0]{\ensuremath{\mathrm{MSB}}\xspace}
\providecommand{\phys}[0]{\ensuremath{\mathrm{PHYS}}\xspace}
\providecommand{\our}[0]{\ensuremath{\mathrm{OUR}}\xspace}
\providecommand{\spn}{\mathrm{span}\xspace}
\providecommand{\can}[0]{\ensuremath{^{\widetilde{\phantom{\cdot}}}}\xspace}
\providecommand{\ptoz}[1]{\ensuremath{\left({#1}\right)_\ZZ}\xspace}
\providecommand{\disc}[0]{\ensuremath{\mathrm{disc}}\xspace}
\providecommand{\sgndisc}[0]{\ensuremath{\mathrm{sgndisc}}\xspace}
\providecommand{\insec}[0]{\ensuremath{\mathrm{insec}}\xspace}
\providecommand{\bin}[0]{\ensuremath{\{0, 1\}}\xspace}
\providecommand{\rv}[1]{\ensuremath{\mathbb{#1}}\xspace}
\providecommand{\Bad}[0]{\ensuremath{\mathrm{Bad}}\xspace}
\providecommand{\shift}[0]{\ensuremath{\mathrm{shift}}\xspace}

%\providecommand{\Disc}[0]{\ensuremath{\mathrm{Disc}}\xspace}
%\providecommand{\Sgndisc}[0]{\ensuremath{\mathrm{SgnDisc}}\xspace}

\providecommand{\isgood}[0]{\ensuremath{\pred{isGoodEval}}}


\providecommand{\dd}{\mathop{}\!{\mathrm d}}

\providecommand{\card}[1]{\ensuremath{\mathsf{card}\!\left({#1}\right)}\xspace}

\providecommand{\pos}[0]{\ensuremath{F^+}\xspace}
\providecommand{\inve}[0]{\ensuremath{^{-1}}\xspace}


\let\phi\varphi


\providecommand{\Sig}[2]{\ensuremath{\Sigma_{#1}\p{#2}}\xspace}
\providecommand{\tSig}[2]{\ensuremath{{\widetilde{\Sigma}}_{#1}\p{#2}}\xspace}

\providecommand{\err}[0]{\ensuremath{\mathrm{err}}\xspace}
\providecommand{\getsr}[0]{\ensuremath{\leftarrow}\xspace}