Giter Site home page Giter Site logo

cpp-notes's Introduction

C++ notes for competetive programming

template for competetive programming

#include <bits/stdc++.h>
using namespace std;

int main() {
  // solution
}

compiling with C++11 standard, optimizing code and showing all warnings about possible errors

g++ -std=c++11 -O2 -Wall code.cpp -o bin

Input and output is sometimes a bottleneck. Snippet for more efficient code:

ios_base::sync_with_stdio(0);
cin.tie(0);

using files for input and output. Use the following inside the main file

freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

using \n is faster because std::endl always causes flush operation

cout << a <<< "\n";

comparing floats

if (abs(a-b) < 1e-9) { // a and b are equal
}

cpp-notes's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.