foo.cc: In function 'bool check(int)':
foo.cc:46:5: error: 'memset' was not declared in this scope
memset(tail, 0, sizeof(tail));
^~~~~~
foo.cc:46:5: note: suggested alternative: 'fd_set'
memset(tail, 0, sizeof(tail));
^~~~~~
fd_set
foo.cc: In function 'int main()':
foo.cc:64:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &n, &m);
~~~~~^~~~~~~~~~~~~~~~
foo.cc:66:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d", &r[i].u, &r[i].v, &r[i].c);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~