Language: C++

int main(void){
	llint N,M,q,i,j,a,ansa,ansb,ok=0,ans;
	queue<llint> que;
	vector<llint> nuru;
	set<llint> siro;
	scanf("%lld %lld %lld",&N,&M,&q);
	for(i=0;i<q;i++){
		scanf("%lld",&a);
		nuru.pub(a);
	}
	sort(nuru.begin(),nuru.end());
	if(M%7!=0){ M*=7;ok=1; }
	for(i=0;i<M;i++){
		for(j=0;j<1+ok*6;j++){
			if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
		}
	}
	ansa=0;
	while(siro.size()!=0){
		que.push(*siro.begin());
		while(!que.empty()){
			a=que.front();
			que.pop();
			if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
			if(a+7<M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
			if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
			if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
			siro.erase(a);
		}
		ansa++;
	}

	for(i=0;i<M;i++){
		for(j=0;j<1+ok*6;j++){
			if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
		}
		for(j=0;j<1+ok*6;j++){
			if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7+M); }
		}
	}
	ansb=0;
	while(siro.size()!=0){
		que.push(*siro.begin());
		while(!que.empty()){
			a=que.front();
			que.pop();
			if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
			if(a+7<2*M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
			if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
			if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
			siro.erase(a);
		}
		ansb++;
	}
	ans=(ansb-ansa)*N*7/M+(2*ansa-ansb);
	printf("%lld\n",ans);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'llint' was not declared in this scope; did you mean 'int'?
    2 |         llint N,M,q,i,j,a,ansa,ansb,ok=0,ans;
      |         ^~~~~
      |         int
a.cc:3:9: error: 'queue' was not declared in this scope
    3 |         queue<llint> que;
      |         ^~~~~
a.cc:3:22: error: 'que' was not declared in this scope
    3 |         queue<llint> que;
      |                      ^~~
a.cc:4:9: error: 'vector' was not declared in this scope
    4 |         vector<llint> nuru;
      |         ^~~~~~
a.cc:4:23: error: 'nuru' was not declared in this scope
    4 |         vector<llint> nuru;
      |                       ^~~~
a.cc:5:9: error: 'set' was not declared in this scope
    5 |         set<llint> siro;
      |         ^~~
a.cc:5:20: error: 'siro' was not declared in this scope
    5 |         set<llint> siro;
      |                    ^~~~
a.cc:6:33: error: 'N' was not declared in this scope
    6 |         scanf("%lld %lld %lld",&N,&M,&q);
      |                                 ^
a.cc:6:36: error: 'M' was not declared in this scope
    6 |         scanf("%lld %lld %lld",&N,&M,&q);
      |                                    ^
a.cc:6:39: error: 'q' was not declared in this scope
    6 |         scanf("%lld %lld %lld",&N,&M,&q);
      |                                       ^
a.cc:6:9: error: 'scanf' was not declared in this scope
    6 |         scanf("%lld %lld %lld",&N,&M,&q);
      |         ^~~~~
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=0;i<q;i++){
      |             ^
a.cc:8:31: error: 'a' was not declared in this scope
    8 |                 scanf("%lld",&a);
      |                               ^
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |         sort(nuru.begin(),nuru.end());
      |         ^~~~
      |         short
a.cc:12:26: error: 'ok' was not declared in this scope
   12 |         if(M%7!=0){ M*=7;ok=1; }
      |                          ^~
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         for(i=0;i<M;i++){
      |             ^
a.cc:14:21: error: 'j' was not declared in this scope
   14 |                 for(j=0;j<1+ok*6;j++){
      |                     ^
a.cc:14:29: error: 'ok' was not declared in this scope
   14 |                 for(j=0;j<1+ok*6;j++){
      |                             ^~
a.cc:15:29: error: 'binary_search' was not declared in this scope
   15 |                         if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
      |                             ^~~~~~~~~~~~~
a.cc:18:9: error: 'ansa' was not declared in this scope
   18 |         ansa=0;
      |         ^~~~
a.cc:22:25: error: 'a' was not declared in this scope
   22 |                         a=que.front();
      |                         ^
a.cc:33:13: error: 'i' was not declared in this scope
   33 |         for(i=0;i<M;i++){
      |             ^
a.cc:34:21: error: 'j' was not declared in this scope
   34 |                 for(j=0;j<1+ok*6;j++){
      |                     ^
a.cc:34:29: error: 'ok' was not declared in this scope
   34 |                 for(j=0;j<1+ok*6;j++){
      |                             ^~
a.cc:35:29: error: 'binary_search' was not declared in this scope
   35 |                         if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
      |                             ^~~~~~~~~~~~~
a.cc:37:21: error: 'j' was not declared in this scope
   37 |                 for(j=0;j<1+ok*6;j++){
      |                     ^
a.cc:37:29: error: 'ok' was not declared in this scope
   37 |                 for(j=0;j<1+ok*6;j++){
      |                             ^~
a.cc:38:29: error: 'binary_search' was not declared in this scope
   38 |                         if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7+M); }
      |                             ^~~~~~~~~~~~~
a.cc:41:9: error: 'ansb' was not declared in this scope
   41 |         ansb=0;
      |         ^~~~
a.cc:45:25: error: 'a' was not declared in this scope
   45 |                         a=que.front();
      |                         ^
a.cc:55:9: error: 'ans' was not declared in this scope
   55 |         ans=(ansb-ansa)*N*7/M+(2*ansa-ansb);
      |         ^~~
a.cc:56:9: error: 'printf' was not declared in this scope
   56 |         printf("%lld\n",ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){