It is shocking to hear that you wanted to commit suicide because you didn't get the department of your dream. I understand that it might be disappointing and frustrating not to get what you want, but it's not worth taking your life for.
Your dream of joining software engineering can not be greater than your will to live. You have already shown some understanding of software engineering, and you can improve it by different online courses and become a self-made software engineer. With such talent, you don't need to join the department to be hired as a software engineer. You wanted to join the department because you wanted to create something big by software engineering. The only thing you lose for not joining that department is just the degree and being hired as an engineer, but still, you can work on yourself and make yourself a talented and creative software engineer who can create new things by himself.
You are worth more than this department for yourself and your family. If you have persistent suicidal ideation, it might not be for this reason. This condition may precipitate some kind of mental problem, such as depression. In that case, you should visit a psychiatrist. It helps a lot.
Please don't give up on life just because of this setback. Life is full of ups and downs, and we all face challenges at some point in our lives. You are not alone, and there are people who care about you and want to help you. Talk to someone you trust, seek professional help if needed, and remember that suicide is not the solution.
Nov 27, 2023