Skip to content

Instantly share code, notes, and snippets.

View vishichoudhary's full-sized avatar
🌴
On vacation

Vishal Choudhary vishichoudhary

🌴
On vacation
View GitHub Profile
#include <iostream>
using namespace std;
int main() {
int m,n;
cin >> m >> n; int f=1;
while(m && n) {
char board[m+2][n+2];
for(int i=0; i<=m+1; i++) {
for(int j=0; j<=n+1; j++) {
@vishichoudhary
vishichoudhary / lca_using_sparse_table.cpp
Last active June 21, 2017 02:28
LCA using sparse table
#include<bits/stdc++.h>
using namespace std;
#define root 0
#define N 10010
#define LN 14
vector<int> adj[N];
int depth[N],parent[N],p[N][LN];
void dfs(int cur,int prev,int depth_1){
depth[cur]=depth_1;
parent[cur]=prev;
@vishichoudhary
vishichoudhary / cpcr1c.cpp
Created July 27, 2017 04:52
Without dp solution to cpcr1c
#include<bits/stdc++.h>
using namespace std;
void digits(long long int a, vector<int> &arr){
while(a){
arr.push_back(a%10);
a/=10;
}
}
int digitsum(int indx,int sum,int tight,vector<int> & arr){
if(indx==-1)
@vishichoudhary
vishichoudhary / seg_errro.cpp
Created September 19, 2017 17:15
This code fucked my day
#include<bits/stdc++.h>
using namespace std;
int n,e,i,j;
vector<vector<int> > graph;
vector<int> color;
bool vis[100011];
void colour(int node,int num)
{
queue<int> q;
if(vis[node])
@vishichoudhary
vishichoudhary / 7.lex
Created November 22, 2017 20:30
ho haa
%{
#include<stdio.h>
%}
delim [\t ]
ws {delim}+
letter [A-Za-z]
digit [0-9]
id {letter}({letter}|{digit})*
num {digit}+(\.{digit}+)?(E[+/-]?{digit}+)?
@vishichoudhary
vishichoudhary / 7.lex
Created November 22, 2017 20:32
flex_tool
%{
#include<stdio.h>
%}
delim [\t ]
ws {delim}+
letter [A-Za-z]
digit [0-9]
id {letter}({letter}|{digit})*
num {digit}+(\.{digit}+)?(E[+/-]?{digit}+)?
@vishichoudhary
vishichoudhary / model.txt
Created November 25, 2017 22:07
half-maked-modelling-notes
What is a model ?
A model is a representation of a system ,idea or a object, made of the composition of concepts which are used to help people know, understand or simulate a subject the model represents.
What is Simulation?
Simulation is the process of designing a model of a real system in the motive of conducting expriments with it to either understading the behaviour of it or evaluating various strategies for the operation of system.
When to use Simulation?
1. When system is very complex .
2. When it is too risky to go straight with the project.
3. To study any problem that cause uncertainty.
@vishichoudhary
vishichoudhary / type.js
Created December 2, 2017 19:17
typeracer fucker
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
// execute the following script in the console
(function($)
{
var inputText;
var flag = true;
@vishichoudhary
vishichoudhary / gui.py
Created December 28, 2017 14:03
non-native file dialog python pyqt5
from PyQt5.QtWidgets import (QWidget, QPushButton, QLineEdit,
QInputDialog, QApplication,QDialog,QListWidget,QHBoxLayout,QListWidgetItem, QGridLayout)
from PyQt5.QtGui import QPainter, QColor, QPen
from PyQt5.QtWidgets import *
import os,sys
path=os.getcwd()
li=os.listdir(path)
@vishichoudhary
vishichoudhary / copy_gui.py
Created December 28, 2017 17:13
non-native part 1
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import os,sys
from datetime import datetime
path=os.getcwd()
li=os.listdir(path)
def filter(inp):