Skip to content

Instantly share code, notes, and snippets.

#include <stack>
#include <string>
#include <iostream>
using namespace std;
int getPriority(char c) {
if (c == '(') return 0;
else if (c == '+' || c == '-') return 1;
else if (c == '*' || c == '/') return 2;
#include <iostream>
using namespace std;
char mat[500][500];
void print(int n, int x, int y) {
if (n == 1) {
mat[x][y] = '*';
return;
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TABLE_SIZE 10007
#define INPUT_SIZE 5000
typedef struct {
int id;
#include <iostream>
using namespace std;
int a[1000000];
void swap(int& u, int& v) {
int tmp = u;
u = v;
v = tmp;
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
using namespace std;
void swap(int* a, int* b) {
int tmp = *a;
*a = *b;
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
using namespace std;
void swap(int* a, int* b) {
int tmp = *a;
*a = *b;
#include <iostream>
using namespace std;
#define SIZE 1000
int stack1[SIZE], stack2[SIZE];
int top1 = -1, top2 = -1;
void push(int data) {
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#include <stdio.h>
#include <stdlib.h>
typedef struct node Node;
struct node {
int data;
Node* leftChild;
Node* rightChild;
};
#include <vector>
#include <climits>
#include <cstdlib>
#include <iostream>
using namespace std;
#define max(a, b) a > b ? a : b
void radixsort(vector<int>& arr, int n) {