Skip to content

Instantly share code, notes, and snippets.

View yDeepak1889's full-sized avatar

Deepak yadav yDeepak1889

  • India
View GitHub Profile
@yDeepak1889
yDeepak1889 / gcd1_sparseTable.cpp
Created February 24, 2017 10:01
number of (l, r) such that 0<=l <= r <= n-1 and gcd(arr[l], arr[l+1] . . . arr[r]) = 1 using sparse table
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define mk(a, b) make_pair(a, b)
#define pr(n) printf("%d\n", n)
#define sc(n) scanf ("%d", &n)
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1