\overline and \widehat with subscript

your example looks enough like a symbol with a (raised) \overline and a superscript to the base symbol that i'm going to construct that.

the second image might suffice:

enter image description here

\documentclass{article}
\begin{document}
 $\overline{\mathrm{X}\vphantom{()}}^1
 \quad
 \smash{\overline{\mathrm{X}\vphantom{()}}}\vphantom{X}^1$
\end{document}

This approach gives the subscript to the "overline" as you seemed to indicate. With this implementation, the overline thickness is .4pt which can be changed. The bottom of the subscript is 1.5pt below the top of the argument. The 2pt setting determines the vertical location of the overbar relative to the subscript.

\documentclass{article}
\usepackage{stackengine}
\stackMath
\newcommand\subline[2]{\stackon[-1.5pt]{#1}{\rule[2pt]{\widthof{$#1$}}{.4pt}_{#2}}}
\begin{document}
\renewcommand\stackalignment{l}
$A = \subline{X}{1} \subline{g}{2} \subline{Xyzq}{12}$
\end{document}

enter image description here


For the widehat, I adopt a bit of a different approach, making added use of the scalerel package. The parameter \hatgap gives the vertical gap between item and hat, and \subdown gives the relative placement of the subscript relative to the hat.

\documentclass{article}
\usepackage{scalerel}
\usepackage{stackengine}
\stackMath
\def\hatgap{2pt}
\def\subdown{-2pt}
\newcommand\reallywidehat[2][]{%
\renewcommand\stackalignment{l}%
\stackon[\hatgap]{#2}{%
\stretchto{%
    \scalerel*[\widthof{$#2$}]{\kern-.6pt\bigwedge\kern-.6pt}%
    {\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{0.5ex}% THIS SQUEEZES THE WEDGE TO 0.5ex HEIGHT
_{\smash{\belowbaseline[\subdown]{\scriptstyle#1}}}%
}}
\begin{document}
$\reallywidehat[1]{zbcdklm} \times
\reallywidehat[ijk]{zbcdefghijk} = 
\reallywidehat{zb}$
\end{document}

enter image description here

The widehat EDIT is very loosely based on my solution at Really wide hat symbol, though this implementation is superior to that one.