Ultra-high energy cosmic rays and the strongest AGN flares