foo.cc: In function 'bool check(int, int, int)':
foo.cc:13:10: warning: unused variable 'flag' [-Wunused-variable]
bool flag=1;
^~~~
foo.cc: In function 'int main()':
foo.cc:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&m,&n);
~~~~~^~~~~~~~~~~~~~
foo.cc:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",orders+i);
~~~~~^~~~~~~~~~~~~~~
foo.cc:27:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&parts[i][j].M);
~~~~~^~~~~~~~~~~~~~~~~~~~~
foo.cc:30:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&parts[i][j].T);
~~~~~^~~~~~~~~~~~~~~~~~~~~