We are left with following problem, upon which TcT provides the
certificate YES(?,O(n^1)).

Strict Trs:
  { a__f(X) -> f(X)
  , a__f(f(a())) -> a__f(g(f(a())))
  , mark(f(X)) -> a__f(mark(X))
  , mark(a()) -> a()
  , mark(g(X)) -> g(X) }
Obligation:
  runtime complexity
Answer:
  YES(?,O(n^1))

The input is overlay and right-linear. Switching to innermost
rewriting.

We are left with following problem, upon which TcT provides the
certificate YES(?,O(n^1)).

Strict Trs:
  { a__f(X) -> f(X)
  , a__f(f(a())) -> a__f(g(f(a())))
  , mark(f(X)) -> a__f(mark(X))
  , mark(a()) -> a()
  , mark(g(X)) -> g(X) }
Obligation:
  innermost runtime complexity
Answer:
  YES(?,O(n^1))

The problem is match-bounded by 3. The enriched problem is
compatible with the following automaton.
{ a__f_0(2) -> 1
, a__f_1(3) -> 1
, a__f_1(3) -> 3
, a__f_2(6) -> 1
, a__f_2(6) -> 3
, f_0(2) -> 2
, f_1(2) -> 1
, f_1(5) -> 4
, f_2(3) -> 1
, f_2(3) -> 3
, f_2(8) -> 7
, f_3(6) -> 1
, f_3(6) -> 3
, a_0() -> 2
, a_1() -> 1
, a_1() -> 3
, a_1() -> 5
, a_2() -> 8
, g_0(2) -> 2
, g_1(2) -> 1
, g_1(2) -> 3
, g_1(4) -> 3
, g_2(7) -> 6
, mark_0(2) -> 1
, mark_1(2) -> 3 }

Hurray, we answered YES(?,O(n^1))