fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4.  
  5. int cnt[23];
  6. map<ll,ll> mp;
  7.  
  8. int main() {
  9. int n; cin >> n;
  10. ll a[n], ans=0;
  11. for(int i=0; i<n; i++) {
  12. cin >> a[i];
  13. cnt[a[i]%23]++;
  14. }
  15.  
  16. for(int j=0; j<n; j++){
  17. if(j > 5){
  18. mp[a[j-6]%23]++;
  19. }
  20. ans += mp[a[j]%23];
  21. }
  22. cout << ans;
  23. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty