Let's examine your code:
\newcommand{\bp}[1]{\begin{problema}[#1] \input{#1} \label{#1}\end{problema}}
You have spaces around \input{#1} and they're the source of you problem. Not the one at the left, because after processing \begin{problema}[Fa87] TeX is not yet in LR-mode (waiting for possible \label commands).
It's the one after \input{Fa87} that does the damage. Consider the following example:
\begin{filecontents*}{\jobname-one} Test \end{filecontents*} \begin{filecontents*}{\jobname-two} Test% \end{filecontents*} \documentclass{article} \begin{document} AAA\input{\jobname-one}BBB AAA\input{\jobname-one} BBB AAA\input{\jobname-two}BBB \end{document}

The single line in \jobname-one.tex has a trailing endline, which is converted to a space, which you see in the first line of the output. If you leave a space after \input{\jobname-one}, you get two spaces (second line of the output), because TeX is well after the tokenization phase when consecutive spaces are merged into a single one.
If you look at \jobname-two, you see that protecting the endline with % removes the space (third line of the output).
Does this mean that you need % at the end of your input files? Not at all!
The code for \end{problema} first of all issues \par, which will do \unskip. But this won't do if you have \label! This command inserts a “whatsit” (because it instructs TeX to do a \write in the aux file) and so the \unskip implicit in \par is not able to go past the \label and your trailing space from the input file is still present.
Actually, \label tries to overcome this problem with a low level trick, but it's only able to remove a possible space before it, not the one coming from \input{Fa87}. So, even
\newcommand{\bp}[1]{\begin{problema}[#1] \input{#1}\label{#1}\end{problema}}
would not remove the issue.
Do you need \unskip? No. Just place \label where it belongs, namely just after \begin{problema}.
There are several reasons for this:
\label will set both a number for \ref and a page number for \pageref and you want this page number to be where the problem begins, not where it ends; - If you have another
\label in the text of the problem, the final reference for your \label{Fa87} might be the wrong one.
Fixed code:
\newcommand{\bp}[1]{\begin{problema}[#1]\label{#1}\input{#1}\end{problema}}
Test:
\begin{filecontents*}{Fa87} Prove that $\cos^p \theta \leq \cos p\theta$ for $0 \leq \theta \leq \pi /2$ and $0 < p < 1$. \end{filecontents*} \begin{filecontents*}{Fa88} Prove $\cos^p \theta \leq \cos p\theta$ for $0 \leq \theta \leq \pi /2$ and $0 < p < 1$. \end{filecontents*} \documentclass[11pt]{report} \usepackage[ a4paper, margin=4cm, marginparwidth=50pt, ]{geometry} \usepackage{amsthm} \usepackage{unicode-math} \setmainfont{STIX Two Text} \setmathfont{STIX Two Math} \newtheoremstyle{problemstyle}% name of the style to be used {\topsep}% measure of space to leave above the theorem. E.g.: 3pt {\topsep}% measure of space to leave below the theorem. E.g.: 3pt {}% name of font to use in the body of the theorem {0pt}% measure of space to indent {\bfseries}% name of head font {}% punctuation between head and body { }% space after theorem head; " " = normal interword space {\thmname{#1}\thmnumber{ #2}\textbf{\thmnote{ (#3)}}} \theoremstyle{problemstyle} \newtheorem{problema}{\textbf{Problem}}[section] \newcommand{\bp}[1]{\begin{problema}[#1]\label{#1}\input{#1}\end{problema}} \begin{document} \bp{Fa88} \begin{problema}[Fa88] Prove $\cos^p \theta \leq \cos p\theta$ for $0 \leq \theta \leq \pi /2$ and $0 < p < 1$. \end{problema} \bp{Fa87} \begin{problema}[Fa87] Prove that $\cos^p \theta \leq \cos p\theta$ for $0 \leq \theta \leq \pi /2$ and $0 < p < 1$. \end{problema} \begin{problema}[Fa87] Prove that $\cos^p \theta \leq \cos p\theta$ for $0 \leq \theta \leq \pi /2$ and $0 < p < 1$. \end{problema} \begin{problema}[Fa87] Prove that $\cos^p \theta \leq \cos p\theta$ for $0 \leq \theta \leq \pi /2$ and $0 < p < 1$. \end{problema} \end{document}

Watch out for spurious spaces!
polyglossiapackage without a language choice doesn't do much good. I guess you're loadingpolyglossiafor its side-effect of sorts, which is to load thefontspecpackage, thereby enabling the use of\setmainfont.. For coding clarity, I think it would be useful to replace\usepackage{polyglossia}with\usepackage{fontspec}or -- better yet --\usepackage{unicode-math}since (a)unicode-mathalso loadsfontspecautomatically and (b)unicode-mathenables the use of\setmathfont.