  Let $X_1,X_2,...$ be independent identically distributed random variables
with $\mathbb E X_k=0$, $\mathrm{Var} X_k=1$. Suppose that $\varphi(t):=\log
\mathbb E e^{t X_k}<\infty$ for all $t>-\sigma_0$ and some $\sigma_0>0$. Let
$S_k=X_1+...+X_k$ and $S_0=0$. We are interested in the limiting distribution
of the multiscale scan statistic $$ M_n=\max_{0\leq i <j\leq n}
\frac{S_j-S_i}{\sqrt{j-i}}. $$ We prove that for an appropriate normalizing
sequence $a_n$, the random variable $M_n^2-a_n$ converges to the Gumbel
extreme-value law $\exp\{-e^{-c x}\}$. The behavior of $M_n$ depends strongly
on the distribution of the $X_k$'s. We distinguish between four cases. In the
superlogarithmic case we assume that $\varphi(t)<t^2/2$ for every $t>0$. In
this case, we show that the main contribution to $M_n$ comes from the intervals
$(i,j)$ having length $l:=j-i$ of order $a(\log n)^{p}$, $a>0$, where
$p=q/(q-2)$ and $q\in{3,4,...}$ is the order of the first non-vanishing
cumulant of $X_1$ (not counting the variance). In the logarithmic case we
assume that the function $\psi(t):=2\varphi(t)/t^2$ attains its maximum $m_*>1$
at some unique point $t=t_*\in (0,\infty)$. In this case, we show that the main
contribution to $M_n$ comes from the intervals $(i,j)$ of length $d_*\log
n+a\sqrt{\log n}$, $a\in\mathbb R$, where $d_*=1/\varphi(t_*)>0$. In the
sublogarithmic case we assume that the tail of $X_k$ is heavier than
$\exp\{-x^{2-\varepsilon}\}$, for some $\varepsilon>0$. In this case, the main
contribution to $M_n$ comes from the intervals of length $o(\log n)$ and in
fact, under regularity assumptions, from the intervals of length $1$. In the
remaining, fourth case, the $X_k$'s are Gaussian. This case has been studied
earlier in the literature. The main contribution comes from intervals of length
$a\log n$, $a>0$. We argue that our results cover most interesting
distributions with light tails.
