# Tips Trick OSN (Technical)
### Tips trik teknis
- Size vector kalo empty di -1, jadi infinity
- Map .count biar gak bikin key baru
- 1ll << x buat long long
- Bound checking di set, vector, queue dst
- Compare function equal false
- Multiset erase semua element
- Prefix sum 1 based
- Passing vector ke function mesti pake reference
- String append s+=t konstan, s=s+t linear
- Define int long long
- Modulo arithmetic, pake fungsi
- clean code : bikin function lebih enak debug
- naming variable, function, etc bikin yang mudah dipahami biar debugnya enak
- out of bound (akses index negatif, akses empty STL, array size kurang gede)
- division by zero
- memory kegedean di dalem local function
- rekursi kedaleman
- Cari tc yang bikin wa / rte, misal corner cases
- interactive buat debug, pake debug flag buat auto checker kalo bikin checkernya gampang. Pisah function
- (minor) operator precedence
- next permutation harus di sort
- STL behavior buat yang kompleks, make sure dulu kalian tau behavior dari suatu STL
- OO jalanin paralel, pake output file. Bisa pake freopen atau bikin multiple solution buat suatu test case
- pake cerr buat debug biar hapus2nya cepet, sama pake informative dikit buat hindarin cognitive load
- cari tau dia ngecrash dimana dengan comment/uncomment suatu part
- pake for each / destructure buat easier and cleaner code
- set keyboard shortcut and make environment easier to use buat debug
- modulo subtraction careful
- overflow int*int = int
- bfs dfs transisi pake arah dx dy
- assert(false) --> debug WA helpful sometimes