diversity.cpp: In function 'int main()':
diversity.cpp:30:13: warning: unused variable 'diff' [-Wunused-variable]
30 | int diff = 0;
| ^~~~
diversity.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
11 | scanf("%d%d", &n, &q);
| ~~~~~^~~~~~~~~~~~~~~~
diversity.cpp:13:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
13 | scanf("%d", A + i);
| ~~~~~^~~~~~~~~~~~~
diversity.cpp:17:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
17 | int l, r; scanf("%d%d", &l, &r);
| ~~~~~^~~~~~~~~~~~~~~~
diversity.cpp:25:43: warning: iteration 300499 invokes undefined behavior [-Waggressive-loop-optimizations]
25 | for(int j = 1;j <= cnt[B[i]];j++){
| ~~~^
diversity.cpp:24:25: note: within this loop
24 | for(int i = 1;i <= N;i++){
| ~~^~~~