Main.cc:89:41: error: wrong number of template arguments (0, should be 1) priority_queue,greater<>>q; ^ In file included from /usr/include/c++/7/string:48:0, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from Main.cc:1: /usr/include/c++/7/bits/stl_function.h:371:12: note: provided for ‘template struct std::greater’ struct greater : public binary_function<_Tp, _Tp, bool> ^~~~~~~ Main.cc:89:42: error: template argument 3 is invalid priority_queue,greater<>>q; ^~ Main.cc: In function ‘int main()’: Main.cc:105:18: error: request for member ‘empty’ in ‘q’, which is of non-class type ‘int’ while(!q.empty()&&q.top().pos==i){ ^~~~~ Main.cc:105:29: error: request for member ‘top’ in ‘q’, which is of non-class type ‘int’ while(!q.empty()&&q.top().pos==i){ ^~~ Main.cc:106:21: error: request for member ‘top’ in ‘q’, which is of non-class type ‘int’ int x=q.top().id; ^~~ Main.cc:107:15: error: request for member ‘pop’ in ‘q’, which is of non-class type ‘int’ q.pop(); ^~~ Main.cc:110:21: error: request for member ‘push’ in ‘q’, which is of non-class type ‘int’ if(nx)q.push((node){nx+x-1,x}); ^~~~ Main.cc:116:17: error: request for member ‘push’ in ‘q’, which is of non-class type ‘int’ if(nx)q.push((node){nx+i-1,i}); ^~~~ Main.cc: In function ‘void init()’: Main.cc:58:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",s+1); ~~~~~^~~~~~~~~~