Resilient Distributed Optimization Algorithm against Adversarial Attacks