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
Matrix rotation
Merge problem
OOP
code
Find Case Combinations of a String
lab17feb22x4B.cpp
MINVEST
static property
strcpy