fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main(){
  6. int n;
  7. int k;
  8. cin >> n >> k;
  9. int flag=0;
  10. vector<int> a(n);
  11. for(int a_i = 0;a_i < n;a_i++){
  12. cin >> a[a_i];
  13. }
  14. for (int i=0; i<n;i++)
  15. {
  16. for(int j=i+1; j<n;j++)
  17. {
  18.  
  19. if((a[i]+a[j])%k==0)
  20. flag++;
  21. }
  22. }
  23. cout << flag;
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:10:5: error: use of undeclared identifier 'vector'
    vector<int> a(n);
    ^
prog.cpp:10:15: error: expected '(' for function-style cast or type construction
    vector<int> a(n);
           ~~~^
prog.cpp:10:17: error: use of undeclared identifier 'a'
    vector<int> a(n);
                ^
prog.cpp:12:15: error: use of undeclared identifier 'a'
       cin >> a[a_i];
              ^
prog.cpp:19:13: error: use of undeclared identifier 'a'
        if((a[i]+a[j])%k==0)
            ^
prog.cpp:19:18: error: use of undeclared identifier 'a'
        if((a[i]+a[j])%k==0)
                 ^
6 errors generated.
stdout
Standard output is empty