One-sided and two-sided cancellability Is there a semigroup $S$ with right- and left-cancellable elements but no elements cancellable from both sides?
$s\in S$ is left-cancellable if for any $a,b\in S$ we have
$$sa=sb\implies a=b$$
and right-cancellable if $$as=bs\implies a=b.$$
 A: Edited Consider $f :\mathbb Z \to \mathbb Z$ defined by $f(z)=2z$ and $g: \mathbb Z \to \mathbb Z$ defined by $g(2n)=0, g(2n+1)=n$.
Then $f$ is one to one and $g$ is onto. 
Let
$$S = \{ h_1 \circ h_2 \circ ...\circ h_n | n \in \mathbb N , h_i \in \{ f,g \} \}$$
be the semigroup generated in $\{ h :\mathbb Z \to \mathbb Z \}$ by $f$ and $g$. 
Now $S$ contains $f$, which is one to one thus right cancelable, and $S$ contains $g$ which is onto thus left cancelable.
Now we claim  that $S$ doesn't contain two-way cancelable functions.
Indeed assume some function $h=h_1 \circ h_2 \circ ...\circ h_n \in S$ is two way cancelable. 
Note that by construction $g \circ f$ is the constant zero function, which I will denote by $0$ for simplicity.
Case 1: $h_1=f$. Then $g \circ h=0= (g \circ f) \circ h$ but $g \neq g \circ f$ contradiction.
Case 2: $h_1=g$. 
Subcase 2a $h_2=..=h_n=g$. Then $h=g^n$ and $h \circ f=0=h \circ (g \circ f)$ but $f \neq g \circ f$.
Subcase 2b Some $h_i=f$. If you pick $i$ to be the smallest for which $h_i=f$, then $h_{i-1}=g$ which means $h=0$. But it is trivial to prove that $0$ is not cancelable.
