UK economy stagnates but avoids recession