  We have investigated the cross section for the $\pi^-p\rightarrow
K^0\pi\Sigma$ and $pp\rightarrow pK^+\pi\Sigma$ reactions paying attention to a
mechanism that develops a triangle singularity. The triangle diagram is
realized by the decay of a $N^*$ to $K^*\Sigma$ and the $K^*$ decay into $\pi
K$, and the $\pi\Sigma$ finally merges into $\Lambda(1405)$. The mechanism is
expected to produce a peak around $2140$ MeV in the $K\Lambda(1405)$ invariant
mass. We found that a clear peak appears around $2100$ MeV in the
$K\Lambda(1405)$ invariant mass which is about $40$ MeV lower than the
expectation, and that is due to the resonance peak of a $N^*$ resonance which
plays a crucial role in the $K^*\Sigma$ production. The mechanism studied
produces the peak of the $\Lambda(1405)$ around or below 1400 MeV, as is seen
in the $pp\rightarrow pK^+\pi\Sigma$ HADES experiment.
