\documentclass[twoside,a4paper,10pt]{article}

\usepackage{amsmath}
\usepackage{trees}
\usepackage{ntheorem}
\usepackage{latexsym}
\usepackage{xspace}
\usepackage{amssymb}
\usepackage{fancybox}
\usepackage{graphicx}

\usepackage{fancyhdr}

\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}


%\theoremstyle{break} 

\theoremstyle{plain}
\theoremheaderfont{\scshape}
\theorembodyfont{\slshape}
\newtheorem{Thm}{Theorem}
\newtheorem{Lem}[Thm]{Lemma}
\newtheorem{Cor}[Thm]{Corollary}
\newtheorem{Prop}[Thm]{Proposition}
\theorembodyfont{\rmfamily} 
\newtheorem{Ex}{Exercise}
\newtheorem{Exa}{Example}
\newtheorem{Rem}{Remark}

\def\qed {{%        set up
   \parfillskip=0pt        % so \par doesnt push \square to left
   \widowpenalty=10000     % so we dont break the page before \square
   \displaywidowpenalty=10000  % ditto
   \finalhyphendemerits=0  % TeXbook exercise 14.32
  %
  %                 horizontal
   \leavevmode             % \nobreak means lines not pages
   \unskip                 % remove previous space or glue
   \nobreak                % don't break lines
   \hfil                   % ragged right if we spill over
   \penalty50              % discouragement to do so
   \hskip.2em              % ensure some space
   \null                   % anchor following \hfill
   \hfill                  % push \square to right
   $\square$%              % the end-of-proof mark
  %
  %                   vertical
   \medskip}}                  % build paragraph
   
\theorembodyfont{\itshape}
\newtheorem{Def}{Definition}
\newenvironment{proof}{\noindent {\sc Proof:}}{\qed} 
\newenvironment{problems} % Definition of problems
 {\renewcommand{\labelenumi}{\S\theenumi}
	\begin{enumerate}}{\end{enumerate}}

\setlength{\topmargin}{0in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.25in}
\setlength{\textheight}{9in}

\setlength{\parskip}{4pt}
\setlength{\parindent}{0pt}

\renewcommand{\baselinestretch}{1}