This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int bfs(map<int, set<int>>& M, unordered_map<int, size_t>& lookup) { | |
priority_queue<int, std::vector<int>, std::greater<int>> min_heap; | |
set<int> visited; | |
min_heap.push(0); | |
int total{}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
struct MinHeap { | |
bool operator()(pair<int, int> a, pair<int, int> b) { | |
return a.second > b.second; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import math | |
(r, c) = [int(x) for x in input().split(' ')] | |
''' | |
states: | |
0 -> empty | |
1-> knight | |
2-> attacked by knight | |
3 -> goal (target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using std::vector; | |
namespace compare { | |
struct OddThenEven { | |
bool operator()(int a, int b) { | |
bool ao = (a & 1), bo = (b & 1); | |
if (ao and bo) return a < b; | |
else if (ao and !bo) return 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
dump = open('./dump.nasm.txt') | |
def where_next(amnt, _from): | |
return _from + amnt * 106 | |
def calculate_paths(curr): | |
NORTH = -51; EAST = 1; SOUTH = 51; WEST = -1 | |
dirs = {1: NORTH, 2: WEST, 3: EAST, 4: SOUTH} | |
paths = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
struct Shape { | |
virtual double area() { | |
std::cout << "I am a Shape\n"; | |
return 0.0; | |
}// non-pure virtual | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
struct Node { | |
int data; | |
Node* next; | |
Node(int _data) : data(_data) {} | |
}; | |
class SinglyLinkedList { | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('click', () => { | |
let question = document.getElementsByClassName('_3vK03yy396dmBwrrRmeApE')[0]; | |
console.log(question.textContent); | |
navigator.clipboard.writeText(question.textContent); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// accept input | |
, // at cell 1 | |
// subtract ascii '5' (53) from input | |
>++++++++++[<----->-]<--- // at cell 1 | |
// if inp == '5' | |
>+ // set zero flag to 1 (cell 2) | |
>+< // set else flag to 1 | |
<[>-<[-]] // change zero flag if inp not '5' (at cell 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vertex: | |
def __init__(self, data): | |
self.data = data | |
def __repr__(self): | |
return f"{self.data}" | |
class Graph: | |
def __init__(self): |
OlderNewer