Compilation Optimizations to Enhance Resilience of Big Data Programs and Quantum Processors