\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{graphicx}
%\usepackage{a4wide}
\usepackage[top=1.1cm, bottom=1.1cm, left=1.1cm, right=1.1cm]{geometry}

%\usepackage{pst-all}
%\usepackage{epsfig}
\usepackage{upref}
\usepackage{listings}
\usepackage{url}
\usepackage{enumerate}
%\usepackage[french,ruled,vlined,titlenumbered,linesnumbered,longend]{algorithm2e}
\usepackage{tikz}

\usetikzlibrary{trees,arrows}
\tikzstyle{heapnode}=[circle, fill=white, draw=black,
                    thick, inner sep=0pt, minimum size=6mm]
\tikzstyle{marked}=[fill=green!20]
\tikzstyle{minarrow}=[->, >=latex]
\newcommand{\vide}{child {edge from parent [draw=none]}}
\newcommand{\threenode}[2]{\begin{tabular}{|c|c|}\hline {#1}&{#2}\\\hline\end{tabular}}
\newcommand{\fournode}[3]{\begin{tabular}{|c|c|c|}\hline {#1}&{#2}&{#3}\\\hline\end{tabular}}
\newcommand{\bucketone}[2]{node (#1) [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm]
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip]
      {\begin{tabular}{c}#2\\\end{tabular}}}}}
\newcommand{\buckettwo}[3]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm]
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip]
      {\begin{tabular}{c} #2\\#3\\\end{tabular}}}}}
\newcommand{\bucketthree}[4]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm]
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip]
      {\begin{tabular}{c}#2\\#3\\#4\\\end{tabular}}}}}
\newcommand{\bucketfour}[5]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm]
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip]
      {\begin{tabular}{c}#2\\#3\\#4\\#5\\\end{tabular}}}}}
\newcommand{\bucketfive}[6]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm]
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip]
      {\begin{tabular}{c}#2\\#3\\#4\\#5\\#6\\\end{tabular}}}}}

%\usepackage{listings}
%\lstset{basicstyle=\ttfamily}

\usepackage{eurosym}

\usepackage{etex}  % important qu'il soit avant les 2 prochains packages
\usepackage {framed}
\usepackage{tabularx}

%% HIGHLIGHT SYNTAX FOR PYTHON

\usepackage[all]{xy}
\usepackage{bm,cmll}


\usepackage{stmaryrd}
\usepackage{amsfonts}


% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{8} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{8}  % for normal

\DeclareFixedFont{\ttbinl}{T1}{txtt}{bx}{n}{10} % for bold
\DeclareFixedFont{\ttminl}{T1}{txtt}{m}{n}{10}  % for normal



\usepackage{listings}
% Python style for highlighting
\lstset{aboveskip=6pt,belowskip=6pt}

\newcommand\pythonstyle{\lstset{
		language=Python,
		basicstyle=\tiny\ttm,
		commentstyle=\color{brown},    % comment style
		otherkeywords={self, True, False, sqrt, math, assert},             % Add keywords here
		keywordstyle=\ttb\color{red},
		emph={MyClass,__init__},          % Custom highlighting
		emphstyle=\ttb\color{orange},    % Custom highlighting style
		stringstyle=\color{red},
		frame=tb,                         % Any extra options here
		showstringspaces=false,            %
		morecomment=[l]{\#}
}}


\newcommand\pythonstyleinl{\lstset{
		language=Python,
		basicstyle=\footnotesize\ttminl,
		commentstyle=\color{brown},    % comment style
		otherkeywords={self, True, False, sqrt, math, assert},             % Add keywords here
		keywordstyle=\ttbinl\color{red},
		emph={MyClass,__init__},          % Custom highlighting
		emphstyle=\ttbinl\color{orange},    % Custom highlighting style
		stringstyle=\color{red},
		frame=tb,                         % Any extra options here
		showstringspaces=false,            %
		morecomment=[l]{\#}
}}



% Python environment
\lstnewenvironment{python}[1][]
{
	\pythonstyle
	\lstset{#1}
}
{}

% Python for external files
\newcommand\pythonexternal[2][]{{
		\pythonstyle
		\lstinputlisting[#1]{#2}}}

% Python for inline
\newcommand\pythoninline[1]{{\pythonstyleinl\lstinline!#1!}}
\let\pline=\pythoninline



\def\IN{\mathbb{N}}
\def\IZ{\mathbb{Z}}
\def\IQ{\mathbb{Q}}
\def\IR{\mathbb{R}}
\def\IC{\mathbb{C}}

\def\pere{\texttt{pere}\,}
\def\fils{\texttt{fils}\,}
\def\pred{\texttt{pred}\,}
\def\succ{\texttt{succ}\,}
\def\degre{\texttt{degre}\,}
\def\clef{\texttt{clef}\,}
\def\taille{\texttt{taille}\,}
\def\marque{\texttt{marque}\,}


%%%%%%%%%%%%%%%%%%%%%% Entête
\newcommand{\entete}[1]{
\large Master 1 : STL\hfill Année 2016/2017\\
\rule{\textwidth}{0.6mm}}
%%%%%%%%%%%%%%%%%%%%% Fin entête



%%%%%%%%%%%%%%%% Un petit environnement pour les remarques
\newenvironment{remark}{\bigskip\par\noindent\textbf{Remarque} :\par\noindent}{\par\noindent}
\newenvironment{remarks}{\bigskip\par\noindent\textbf{Remarques} :\par\noindent\begin{enumerate}}{\end{enumerate}\par\noindent}

%%%%%%%%%%%%%%%%%% les notes en marges
\newcommand{\MP}[1]{\marginpar{\footnotesize #1}}

%\usepackage{fullpage}
\RequirePackage{theorem}

\theoremstyle{break}
\theorembodyfont{\rmfamily}




%\newtheorem{exo}{Exercice}
\newtheorem{exo}{}

\RequirePackage{comment}
\excludecomment{solution}

\newcounter{question_counter}
\setcounter{question_counter}{0}
\def\question{\addtocounter{question_counter}{1}\paragraph{\bf Question A\arabic{question_counter}.}}

% Compteurs
\newcount\questno
\newcount\exno
\exno=0
\questno=0

\parskip=2pt

% Exercice
\def\exo#1
{\advance\exno by 1
\questno=0
\par\vspace{15pt}\noindent
{{\large \textbf{\textit{Exercice\ $\the\exno$
\ifthenelse{\equal{#1}{}}{}{: #1} }}}}
\par
}

% Question
\def\quest
{\advance\questno by 1
\par
\vskip 6pt
\noindent
\textbf{Question\ $\the\questno$} \hspace*{1em}
}
