Skip to content

Instantly share code, notes, and snippets.

#include <bits/stdc++.h>
#define ll long long
#define vll vector<long long>
#define vii vector<int>
#define vpi vector<pair<int,int> >
#define vpl vector<pair<ll,ll> >
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#include<stdio.h>
int waitingtimerobin(int * job, int * run, int n, int tq)
{
int j, count, time, remain, flag = 0;
int wait_time = 0, turnaround_time = 0, rt[10];
remain = n;
for (count = 0; count < n; c++)
{
rt[count] = run[count];
}
@rishabhgargg
rishabhgargg / code.c
Created October 11, 2023 14:43
scaler
#include<stdio.h>
int main()
{
int cnt,j,n,t,remain,flag=0,tq;
int wt=0,tat=0,at[10],bt[10],rt[10];
printf("Enter Total Process:\t ");
scanf("%d",&n);
remain=n;
@rishabhgargg
rishabhgargg / code.c
Created October 11, 2023 15:00
Raghav 1
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector state(N);
vector distance(N);
@rishabhgargg
rishabhgargg / gist:a88dac2788cb75526a7a5fd70ec04a14
Created October 28, 2023 09:21
List containers with containerd CRI
ctr ns ls ------ To list namespaces
ctr -n k8s.io containers list
@rishabhgargg
rishabhgargg / gist:dc90efc36e37a687915321289433aa1e
Last active November 7, 2023 18:12
Remove all comments from VS code yaml

^\s*#.*$

@rishabhgargg
rishabhgargg / airflow-values.yaml
Created October 31, 2023 17:43
airflow-values.yaml
fullnameOverride: ""
nameOverride: ""
useStandardNaming: true
revisionHistoryLimit: ~
uid: 50000
gid: 0
securityContext: {}
securityContexts:
pod: {}
containers: {}
def find_largest_sum_cycle(n, edges):
def dfs(node, visited, stack, path_sum, cycle_sums):
visited[node] = True
stack[node] = path_sum
next_node = edges[node]
if next_node != -1:
if not visited[next_node]:
dfs(next_node, visited, stack, path_sum + next_node, cycle_sums)
elif stack[next_node] != -1:
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
void dfs(int node, vector<int>& edges, vector<bool>& visited, vector<int>& stack, int path_sum, unordered_map<int, int>& node_to_sum, int& max_cycle_sum) {
visited[node] = true;
stack[node] = path_sum;
def max_subarray_cost(arr):
if not arr:
return 0
max_sum = arr[0]
current_sum = arr[0]
for num in arr[1:]:
current_sum = max(num, current_sum + num)
max_sum = max(max_sum, current_sum)