Shortening Code (C++)

Since you want to write as fast as possible, a common pattern is aliasing types in statically typed languages:

typedef long long ll;
 
long long a = 123456789;
// Is the same as
ll a = 123456789;

It is more ideal to do this with more complex types (types that accept arguments)

You can also shorten code using function macros:

#define PB push_back
#define MP make_pair
 
v.push_back(make_pair(y1,x1));
// Is the same as
v.PB(MP(y1,x1));

You can apply the same idea to things like for loops using more arguments in the macro