fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define vll vector<long long>
  5. #define MAXK 1000000
  6. #define mapll map<long long,long long>
  7. ll n;
  8. map<ll,ll> ma;
  9. int main(){
  10. ios::sync_with_stdio(false);
  11. cin.tie(nullptr);
  12. cout.tie(nullptr);
  13. freopen("bailam.inp","r",stdin);
  14. freopen("bailam.out","w",stdout);
  15. cin>>n;
  16. if(n>=0){
  17. ll mo=12345678*2;
  18. ll ans=(n%mo)*((n-1)%mo);
  19. ans=ans%mo;
  20. cout<<ans/2;
  21. return 0;
  22. }
  23. ll ans=0;
  24. for(ll i=1;i<=n;i++){
  25. ll x;
  26. cin>>x;
  27. ans+=ma[x];
  28. ma[x]++;
  29. }
  30. cout<<ans;
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty