Remove trash. Keep exposed food put away. Ants hate the herb peppermint oil. Make a spray bottle of water and a few drops of peppermint oil. Then spray counters and surfaces. Ants will stay away.
Also, for flies: There are products you can buy that emit a low frequency sound that is hard for humans to hear, but flies are affected by it and they stay away. Just do a search on Google to find it.