Context. Complex organic molecules (COMs) have been widely observed in molecular clouds and protostellar environments. One of the formation mechanisms of COMs is radical reactions on the icy grain surface driven by UV irradiation. While many experiments have reported that various COMs (including biomolecules) can be synthesized under such ice conditions, the majority of the reaction processes are unclear. Complementary numerical simulations are necessary to unveil the synthetic process behind the formation of COMs. Aims. In this study, we develop a chemical reaction simulation using a Monte Carlo method. To explore the complex reaction network of COM synthesis, the model was designed to eliminate the need to prepare reaction pathways in advance and to keep computational costs low. This allows for broad parameter surveys and a global investigation of COM synthesis reactions. With this simulation, we investigate the chemical reactions occurring on icy dust surfaces during and after UV irradiation, assuming a protoplanetary disk environment. We aim to reveal the types of organic molecules produced in a disk and the formation mechanisms of COMs, in particular, amino acids and sugars. Methods. The Monte Carlo method we developed here produces reaction sequences by selecting a reaction from all candidate reactions at each calculation step, based on Arrhenius-type weighting. For our purpose, we significantly accelerated the calculation by adopting an approximate estimation of activation energy without expensive quantum chemical calculations. Results. The results show that photodissociation and subsequent radical-radical reactions cause random rearrangement of the covalent bonds in the initial molecules composed of methanol, formaldehyde, ammonia, and water. Consequently, highly complex molecules such as amino acids and sugars were produced in a wide range of the initial conditions. We found that the final abundances of amino acids and sugars have extremely similar dependence on the atomic ratios of the initial molecules, which peak at C/H ~ 0.1–0.3 and O/H ~ 0.3–0.5, although the amino acids abundance is usually more than ten times higher than that of sugars. To understand this dependence, a semi-analytical formula was derived. Additionally, parameter surveys of temperature, photon energy, and other factors have suggested that the decomposition reactions of amino acids and sugars undergo a rapid transition within the threshold of a given parameter.