\documentclass[12pt,a4paper]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{tikz,tkz-tab}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{arrows.meta,calc,positioning}
\usepackage{fontspec}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{array}
\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{french}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.15]{Amiri}
\newfontfamily\arabicfontsf[Script=Arabic,Scale=1.15]{Amiri}
\newcommand{\cadre}[1]{\begin{center}\begin{LTR}#1\end{LTR}\end{center}}
\newcommand{\cadrertl}[1]{\begin{center}#1\end{center}}
\newcommand{\ipa}[1]{#1}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\newcounter{q}
\newcommand{\sujet}[1]{%
  \newpage\stepcounter{q}%
  \begin{tcolorbox}[colback=blue!5,colframe=blue!60!black,arc=3mm,boxrule=1pt]
  \centering {\Large\bfseries مسابقة بين الثانويات -- التاريخ والجغرافيا}\\[2mm]
  {\large السؤال رقم \theq \quad -- \quad #1 \quad -- \quad المدة: دقيقتان}
  \end{tcolorbox}\vspace{5mm}\large}
\newcommand{\rep}{\vfill\begin{tcolorbox}[colback=white,colframe=black!50,height=3.2cm,title=الإجابة:]\end{tcolorbox}}
\newenvironment{sanad}{\begin{tcolorbox}[colback=orange!4,colframe=orange!60!black,title=السند,fonttitle=\bfseries]}{\end{tcolorbox}}
\begin{document}
\setcounter{q}{13}
\sujet{الناتج المحلي الخام}

يمثل المدرج الناتج المحلي الخام لبعض القوى الاقتصادية سنة 2023 (بآلاف الملايير من الدولارات، تقريبي).

\cadre{\begin{tikzpicture}\begin{axis}[ybar,bar width=26pt,width=12cm,height=7cm,ymin=0,ymax=31,
axis lines=left,ymajorgrids,grid style={gray!25},xtick=data,symbolic x coords={a,b,c,d},
xticklabels={\RL{الولايات المتحدة},\RL{الصين},\RL{ألمانيا},\RL{اليابان}},
xticklabel style={font=\small,text width=2.2cm,align=center},nodes near coords,every node near coord/.append style={font=\small},enlarge x limits=0.18,ylabel={$10^{12}\,\$$}]
\addplot[fill=blue!50,draw=blue!70!black] coordinates {(a,27.4)(b,17.8)(c,4.5)(d,4.2)};
\end{axis}\end{tikzpicture}}

\textbf{السؤال:} رتّب الدول تنازلياً، واحسب تقريبياً كم مرة يفوق الناتج الأمريكي ناتج الصين.

\rep
\end{document}
