  In this article, we introduce the generalized complexity of a generalized
Calabi--Yau pair $(X,B,\textbf{M})$. This invariant compares the dimension of
$X$ and Picard rank of $X$ with the sum of the coefficients of $B$ and
$\textbf{M}$. It generalizes the complexity introduced by Shokurov. We show
that a generalized log Calabi-Yau pair $(X,B,\textbf{M})$ of dimension $2$ with
generalized complexity $0$ satisfies that $X$ is toric. This generalizes a
result due to Brown, McKernan, Svaldi, and Zhong in the case of surfaces.
Furthermore, we show that a generalized klt log Calabi-Yau surface
$(X,\textbf{M})$ with generalized complexity $0$ satisfies that $X\simeq
\mathbb{P}^2$ or $X\simeq \mathbb{P}^1\times \mathbb{P}^1$. Thus, this
invariant interpolates between the characterization of toric varieties and the
Kobayashi-Ochiai Theorem. As an application, we show that $3$-fold
singularities with generalized complexity $0$ are toric. Furthermore, we show a
local version of Kobayashi-Ochiai Theorem in dimension $3$.
