Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
fastest input taking for large files
//g++ 5.4.0 #include <bits/stdc++.h> using namespace std; long long input() { long long num=0; bool neg=0; char c=getchar_unlocked(); if(c=='-') {neg=1; c=getchar_unlocked();} for(;((c>='0')&&(c<='9'));c=getchar_unlocked()) { num=num*10+c-'0'; } if(neg) num=-1*num; return num; } int main() { long long n,a[1000000],c=0; n=input(); unordered_map <long long,long long> m; for(long i=0;i<n;i++) { a[i]=input(); if(m[a[i]]>0) c=c+m[a[i]]; m[a[i]]++; } printf("%lld\n",c); return 0; }
run
|
edit
|
history
|
help
0
ThreadPool
dsu on tree (http://codeforces.com/contest/208/problem/E)
E. Bus Number
articulation points (http://codeforces.com/contest/732/problem/F)
Median of row wise sorted matrix
LIS
remove dublicates from string using recursion
TempQuickDoubArray
Kth Smallest Element (with extra space)
a