Language: C++

#include <cstdlib>
using namespace std;

int main(int argc,char** argv)
{
	int a, b;
	string s;
	cin >> a >> b >> s;
	for(int i = 0; i < a+b+1; i++){
		if(i < a){
			if(s[i]!='1' && s[i]!='2' && s[i]!='3' && s[i]!='4' && s[i]!='5'
				&&s[i]!='6' && s[i]!='7' && s[i]!='8' && s[i]!='9' && s[i]!='0'){
				cout << "No" <<endl;
				return 0;
			}
		}
		else if(i == a){
			if(s[i] != '-'){
				cout << "No" <<endl;
				return 0;
			}
		}
		else{
			if(s[i]!='1' && s[i]!='2' && s[i]!='3' && s[i]!='4' && s[i]!='5'
				&&s[i]!='6' && s[i]!='7' && s[i]!='8' && s[i]!='9' && s[i]!='0'){
				cout << "No" <<endl;
				return 0;
			}
		}
	}
	cout << "Yes" <<endl;


	return 0;

}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:7:9: error: 'string' was not declared in this scope
    7 |         string s;
      |         ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include <cstdlib>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> a >> b >> s;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cstdlib>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:8:26: error: 's' was not declared in this scope
    8 |         cin >> a >> b >> s;
      |                          ^
a.cc:13:33: error: 'cout' was not declared in this scope
   13 |                                 cout << "No" <<endl;
      |                                 ^~~~
a.cc:13:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:48: error: 'endl' was not declared in this scope
   13 |                                 cout << "No" <<endl;
      |                                                ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cstdlib>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:19:33: error: 'cout' was not declared in this scope
   19 |                                 cout << "No" <<endl;
      |                                 ^~~~
a.cc:19:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:48: error: 'endl' was not declared in this scope
   19 |                                 cout << "No" <<endl;
      |                                                ^~~~
a.cc:19:48: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:26:33: error: 'cout' was not declared in this scope
   26 |                                 cout << "No" <<endl;
      |                                 ^~~~
a.cc:26:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:48: error: 'endl' was not declared in this scope
   26 |                                 cout << "No" <<endl;
      |                                                ^~~~
a.cc:26:48: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << "Yes" <<endl;
      |         ^~~~
a.cc:31:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:25: error: 'endl' was not declared in this scope
   31 |         cout << "Yes" <<endl;
      |                         ^~~~
a.cc:31:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'