uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e6f6be78-632e-4a38-8559-92cd0a1135e4 | yejineee/problem-solving | baekjoon/list/1406.cpp | #include <iostream>
#include <list>
#include <iterator>
using namespace std ;
list<char> slist ;
list<char>::iterator cursor , it ;
void edit(){
char cmd , c ;
int N ;
cin >> N ;
while(N-- > 0){
cin >> cmd ;
switch(cmd){
case 'L':
if(cursor != slist.begin()){
cursor-- ;
... | ALGO | 0.999751 | 4.158729 |
a2ba3f3c-1588-4701-a291-3f05adc0c80b | skygupta07/DSA | 41_BST1/9_BSTfromPreOrder.cpp | #include <bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left... | ALGO | 0.999983 | 6.52948 |
9c7095c6-aaff-4289-9f6b-63e6f1a98d5a | ishandutta2007/codeforces | monogon/normal/1187/C.cpp |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAX_N = 1005;
int n, m, t, l, r;
bool b[MAX_N];
int arr[MAX_N];
vector<int> L, R;
int main() {
ios::sync_with_stdio(false);
cin >> n >> m;
for(int i = 0; i < m; i++) {
cin >> t >> l >> r;
l--; r--;
if(t ... | ALGO | 0.99999 | 3.51304 |
68220781-566e-435d-b407-2a329de87eb7 | VeritasJoker/Crisp | 10.mod5.cpp | #include <random>
#include <vector>
#include <list>
#include <iostream>
#include <fstream>
#include <chrono>
#include <ctime>
#include <map>
#include <algorithm>
using namespace std;
vector<int> vector_gen(long int state, int N){ // converts states from a number to an active neuron vector
vector<int> vect;
for... | ALGO | 0.999159 | 3.898582 |
a50f38ec-b60c-4843-83e6-f50e875bfc81 | Phoenix-RK/GeeksForGeeks | Linked List/Flattening a Linked List.cpp | //Phoenix_RK
/*
https://practice.geeksforgeeks.org/problems/flattening-a-linked-list/1
Given a Linked List of size N, where every node represents a linked list and contains two pointers of its type:
(i) a next pointer to the next node,
(ii) a bottom pointer to a linked list where this node is head.
You have to flatt... | ALGO | 0.999695 | 5.250589 |
b0e6797f-2de5-4d02-ac0c-94825c2dc315 | mingsxs-learn/leetcode | algorithms/cpp/removeDuplicatesFromSortedList/removeDuplicatesFromSortedList.cpp | // Source : https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/
// Author : Hao Chen
// Date : 2014-06-21
/**********************************************************************************
*
* Given a sorted linked list, delete all duplicates such that each element appear only once.
*
* For exam... | ALGO | 0.9999 | 4.705838 |
5c609528-1fdc-4064-a006-1d53191ede9b | s4nj1th/leetcode-cpp | 1078.cpp | class Solution {
public:
vector<string> findOcurrences(string text, string first, string second) {
vector<string> res;
string bigram = " " + first + " " + second + " ";
string doneText = " " + text;
auto p = doneText.find(bigram);
while (p != string::npos) {
auto p1 = p + bigram.size(), p2 =... | ALGO | 0.999581 | 5.991579 |
5faf7d98-e55a-4117-ae04-3e92b37b15a2 | hossam7amdy/competitive-programming | leetcode-medium/capacity-to-ship-packages-within-d-days.cpp | // https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/
#include<bits/stdc++.h>
using namespace std;
/*
# Complexity
- Time: O(nlogn)
- Memory: O(1)
*/
class Solution {
bool canShip(const vector<int>& weights, int days, int weight){
int cntDays = 1;
int curWeight = 0;
... | ALGO | 0.999985 | 5.573797 |
11ccb5c5-0e7c-47ba-8763-2172759aaad4 | Sushant-Bansode/Standard-Template-Library-In-CPP | 07. Queue/Queue.cpp | #include<bits/stdc++.h>
using namespace std;
void printqueue(queue<int> q1)
{
queue<int> q2=q1;
while(!q2.empty())
{
cout<<q2.front()<<"\n";
q2.pop();
}
}
int main()
{
queue<int> q;
for(int i=1;i<=5;i++)
q.push(i);
cout<<"The elements of the queue are:"<<endl;
pr... | ALGO | 0.965292 | 3.52202 |
2e6483a0-09c1-4406-b8ac-f47ed2abdad6 | YumYumKarma/DSA | Searching/firstOccurrenceOptimised_recursive.cpp | //O(log n) approach
#include<bits/stdc++.h>
using namespace std;
int firstocc(int arr[], int low, int high, int key)
{
if(high>=low)
{
int mid=(high + low)/2;
if(key>arr[mid])
{
return firstocc(arr,mid+1,high,key);
}
else if(key<arr[mid])
{
return firstocc(arr,low,mid-1,key);
}
else {
if(arr... | ALGO | 0.999989 | 5.130608 |
98c1b7e6-37f6-42ca-8ba6-1b03f9a49d52 | slitvinov/lammps-swimmer | src/USER-CG-CMM/pair_lj_sdk_coul_msm.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
This style is a simplified re-implementation of the CG/CMM pair style
------------------------------------------------------------------------- */
#include "math.h"
#include "stdio.h"
#include... | ALGO | 0.999363 | 6.514127 |
b0a4af86-64d4-48ea-905a-919b7f7dc4d9 | AniketKul/CMPS229_OpenLambda_Ceph | experiments/single-node/docker/boost/libs/compute/perf/perf_bolt_exclusive_scan.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <bolt/cl/scan.h>
#include <bolt/cl/copy.h>
#include <bolt/cl/device_vector.h>
#include "perf.hpp"
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
bolt::cl::control ctrl = bo... | ALGO | 0.928534 | 3.964213 |
7b7b8d1a-5be2-4f62-b51d-e4fde983c932 | bar2104y/Abramyan_1000_tasks | Results/Cpp/If/3.cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cout<< "A: ";
cin>>a;
if ( a > 0 )
a++;
else if (a < 0)
a -= 2;
else
a = 10;
cout<< a <<endl;
return 0;
} | ALGO | 0.995632 | 3.065338 |
055710ab-8117-4551-9d4f-aef6ef3343bd | sontungexpt/UIT-Workspaces | C_C++/HocKi2_Nam1/UIT-Together/Nhom4_Recursion/Bai243/Source.cpp | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <math.h>
using namespace std;
#define MAX_ROW 100
#define MAX_COL 100
void Nhap(int[][MAX_COL], int, int);
void Xuat(int[][MAX_COL], int, int);
int DemChuSoDauChan(int[][MAX_COL], int, int, int);
bool IsEvenFirstDigit(int);
int main()
{
int row = ... | ALGO | 0.994242 | 4.34307 |
8712008c-2aae-4ab0-aff3-da1ba62c84fe | mohsenPourAzar/cp-quera | نوبرانه/cpp/main.cpp | #include <iostream>
using namespace std;
int main()
{
int a1, a2, a3, a4, a5;
int const0 = 0;
cin >> a1 >> a2 >> a3 >> a4 >> a5;
if (a1 >= 80) {
const0++;
}
if (a2 >= 80) {
const0++;
}
if (a3 >= 80) {
const0++;
}
if (a4 >= 80) {
const0++;
}
... | ALGO | 0.992262 | 3.681403 |
fdac127d-15b5-402a-aa24-898f3c3801de | replayan/Leetcode-Problems | QUEUE-SIMULATION/402-remove-k-digits/remove-k-digits.cpp | class Solution {
public:
string removeKdigits(string num, int k) {
string st;
// Iterate through each character in the input string
for (int i = 0; i < num.size(); ++i) {
// While the temporary string is not empty, the last character in the temporary
// string is gre... | ALGO | 0.999986 | 7.225858 |
1f35c5bf-f15f-4716-96c0-8e0ddf1dd3de | Abdelruhman2/IEEE-ZSB-Technica1-Rookies-23 | Task-4_IEEE/Freqently Elemnt.cpp | #include "bits/stdc++.h"
using namespace std;
void List(int arr[], int Size)
{
for (int i = 0; i < Size; i++)
{
cin >> arr[i];
}
}
bool compare_element(const pair<int, int> a,const pair<int, int> b)
{
if (a.second == b.second)
return a.first > b.first;
return a.second > b.second;
}... | ALGO | 0.999973 | 3.692001 |
08e0b76a-44ca-4228-ae85-23c476eedd74 | vaibhavbaviskar21/DS | adt.cpp | #include <iostream>
#include <list>
using namespace std;
const int SIZE = 10;
class HashTable {
list<pair<int, string>> table[SIZE];
int hash(int key) {
return key % SIZE;
}
public:
void insert(int key, string value) {
int index = hash(key);
for (auto &pair : table[index]) {
... | ALGO | 0.987465 | 6.414179 |
20cd4f0f-633b-441c-af9b-8cae1af9ce2d | gorden5566/code-for-gorden | findOffer/lastNumber/main.cpp | /*
* =====================================================================================
*
* Filename: main.cpp
*
* Description:
*
* Version: 1.0
* Created: 2014年09月14日 10时42分11秒
* Revision: none
* Compiler: gcc
*
* Author: gorden5566 (), <EMAIL>
* Org... | ALGO | 0.993383 | 4.482255 |
d2ff54ac-c401-4ec4-925d-e91df7a7c55d | ishandutta2007/codeforces | aid/normal/1368/A.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif
#define sz(x) ((int) (x).size())
#define TASK "text"
const int inf = (int) 1.01e9;
con... | ALGO | 0.999445 | 3.539021 |
ca2cc599-3280-4cca-b978-9d8cd8fb6547 | Tieucuc2210/DSA-written-by-Cplus | String/sodep2.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define MAX_SIZE 1e7
#define MIN_SIZE -1e7
const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool ch(string s){... | ALGO | 0.999012 | 4.057376 |
d038a409-33bd-45bb-bd5d-6909300ce11d | Kele1Don/CS151 | Labs/lab07.cpp | #include <iostream>
using namespace std;
/*********************************************
* int main()
* {
* double x1, x2, x3, x4, smv;
* double d1, d2, d3, d4;
*
* cout << "Enter value for x1: ";
* cin >> x1;
*
* cout << "Enter value for x2: ";
* cin >> x2;
*
* cout << "Enter value for x3: ";
* ... | ALGO | 0.99981 | 3.362746 |
33f233e2-3e72-4fa3-9be1-349fb5c6fbf2 | YuraKryvoruchko/Snake-Game | Snake/SnakeGame.cpp | // SnakeGame.cpp : This file contains the 'main' function. Program execution begins and ends there.
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <windows.h>
#include <thread>
#include "SnakeHead.h"
#include "Vector2.h"
#include "Fruit.h"
#include "PlayerInput.h"
using namespace std;
const int B... | TOOL | 0.947087 | 6.188659 |
bfa9a1d7-87c3-4869-8913-ea52fe4975ef | namanmodi65/DSA-Algorithms | DP/DP on array/house_robber.cpp | #include<bits/stdc++.h>
int solve(vector<int> &houses, int idx, vector<int> &dp) {
if(idx>=houses.size()) return 0;
if(dp[idx] != -1) return dp[idx];
int include = solve(houses, idx+2,dp)+houses[idx];
int exclude = solve(houses, idx+1,dp);
return dp[idx]=max(include,exclude);
}
int maxMoneyLooted(vector<int> &h... | ALGO | 0.999829 | 4.817429 |
dc83c7b9-3287-4d7a-8fa5-5ce268371dec | zangelchen/CPP_Unordered_Data_Structures | HashTables/Hashing/Notes_Hashing.cpp |
Hash Table
HASH TABLE BASED DICTIONARY
[CODE]
Dictionary<KeyType, ValueType> d;
d[k] = v;
HASH TABLE CONTAINS THREE THINGS
1. Hash Function -> transport input into a hash identifier
2. An array -> stores the data that is indexed in by the hash function
3. Collisions Handling Strategy -> to sort out when hash f... | ALGO | 0.998996 | 6.382375 |
398ed5fa-3dff-4ab9-98ed-bd11b2f6e04b | Chetanmittal27/Data-Structures-and-Algorithm | binary_search/Medium/FloorValue.cpp | // The floor of x is the largest element in the array which is smaller than or equal to x.
#include<iostream>
#include<vector>
using namespace std;
int floor_value(vector<int>&arr , int x){
int low = 0;
int high = arr.size() - 1;
int result = -1;
while(low <= high){
int mid = (low + high) / 2;... | ALGO | 0.999984 | 5.072225 |
50e6f338-0935-46c0-8e34-6ca3661b64f3 | ayush-geek/6Company30days | Goldman Sachs/06 . Minimum Consecutive Cards to pick up.cpp | class Solution {
public:
int minimumCardPickup(vector<int>& cards) {
//Submission :-> https://leetcode.com/problems/minimum-consecutive-cards-to-pick-up/submissions/874045340/
int ans=INT_MAX;
unordered_map<int,int> mp;
int n=cards.size();
for(int i=0;i<n;i++)
{
... | ALGO | 0.999861 | 5.866411 |
8884f0e1-e97d-4113-a232-41bde1544e59 | multifacet/ASAP | src/systemc/tests/systemc/misc/stars/star104726/star104726.cpp | /*****************************************************************************
star104726.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*************************************************************************... | ALGO | 0.990858 | 4.178477 |
ea4067b3-e7aa-4db9-b416-79c4ed3b570e | BerntMaier/C_dersleri | C dersi 2/Geri sayan tablo/Geri sayan tablo.cpp | #include <stdio.h>
#include <conio.h>
#include <locale.h>
int main(void) {
setlocale(LC_ALL,"German");
int i,j,n;
printf("Bitte schreiben Sie die Zahl n="); printf("^^");
scanf("%d",&n);
printf("Verstanden!");
for(i=1;i<=n;i++){
for(j=i;j>=1;j--) { //j azalsn istediimizden j-- veya j-1 yazyoruz.j<=1 yazmamzn s... | ALGO | 0.9983 | 3.093938 |
35a9782f-e8f3-4ae1-80cf-411d3ef45229 | Spedrick/LeetCode-Daily-Problem | DCP-01-25/2270-Number-of-Ways-to-Split-Array.cpp | class Solution {
public:
int waysToSplitArray(vector<int>& nums) {
long long leftSideSum = 0, rightSideSum = 0;
int res = 0;
for (int num : nums) rightSideSum += num;
for (int i = 0; i < nums.size() - 1; i++) {
leftSideSum += nums[i];
rightSideSum -=... | ALGO | 0.999904 | 5.940666 |
de4096ec-f849-4e2f-b0ff-52d061de7f59 | Chirayu31/CP-Practice | A_Number_Replacement.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
string s;
cin >> s;
vector<char> chk(51, -1);
... | ALGO | 0.99998 | 4.586415 |
17166f6a-6f95-4459-a8d7-e7c635cdd803 | snavaz/GM | src/mkl_blocked_match_csr.cpp | #include "utils.h"
#include <mkl.h>
#include <time.h>
int main(int argc, char *argv[]) {
/***********************************************
* initialize program's input parameters *
***********************************************/
double one = 1;
double norm = 0;
int bin_width = 10;
h_vec_t<int> dis... | ALGO | 0.998911 | 4.848682 |
a3b39ac2-7d3f-4f29-9b82-a20c2d6ede6d | krish160802/DataStructuresAndAlgorithms | DP(1)/LCS.cpp | #include<bits/stdc++.h>
using namespace std;
int Lcs(char* s1,char* s2,int m,int n){
//declaring the arrays nd size -------
m = strlen(s1);
n = strlen(s2);
int** dp = new int*[m+1];
for(int i=0;i<=m;i++){
dp[i] = new int[n+1];
for(int j=0;j<=n;j++){
dp[i][j] = -1;
}
}
//the main logic of recursion -----... | ALGO | 0.999978 | 3.771233 |
a221802a-9a80-4f70-b2ad-44fd0923b04f | ToLoveToFeel/LeetCode | Cplusplus/_0001_Two_Sum/_0001_main.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
/**
* 执行用时:16 ms, 在所有 C++ 提交中击败了71.49%的用户
* 内存消耗:9.1 MB, 在所有 C++ 提交中击败了71.40%的用户
*/
class Solution {
public:
vector<int> twoSum(vector<int> &nums, int target) {
unordered_map<int, int> hash; // (元素,元素对应下标)
for... | ALGO | 0.999932 | 5.83496 |
e16d18bb-3656-4860-a781-f746d22bda22 | zetrfvg/Algorithm | 杂题/力扣/思维、构造/2856. 删除数对后的最小数组长度.cpp | /*
找到序列中元素个数最多的元素,其个数为c
如果c没有超过数组的一半,则数组可以全部删完(数组长为奇数会剩1)
否则答案为n-(n-c)*2;
*/
class Solution {
public:
int minLengthAfterRemovals(vector<int>& nums) {
unordered_map<int,int> p;
int n=nums.size(),mx=0;
for(auto c:nums) mx=max(mx,++p[c]);
if(mx*2<=n) return (n&1);
else return n-... | ALGO | 0.999867 | 5.347346 |
a310a67f-343d-4d9d-874e-3d0948e74abe | shibayanchatterjee/Algorithms | Linkedlist-III/main.cpp | #include <cstdlib>
#include <iostream>
using namespace std;
struct Node{
int key;
Node *next;
Node(int x){
key = x;
next = NULL;
}
};
class LinkedList{
public:
Node* insert(Node *head, int key);
void display(Node *head);
Node* insert_at_end();
};
LinkedList l;
int main ( ... | ALGO | 0.999135 | 3.967333 |
42d0728b-22ac-4ff7-b142-9d8c8461cd87 | TkieuSU/LeetCodePractices | 2215. Find the Difference of Two Arrays/findDifference.cpp | class Solution {
public:
vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {
//Turn the vectors into sets since sets have better lookup time
//And it also helps avoid duplicates
unordered_set<int> set1(nums1.begin(), nums1.end());
unordered_set<int> set2(nums... | ALGO | 0.999887 | 6.259079 |
fda2d1ce-7dce-49cb-b640-67c71db20ac2 | open-airlab/VTNMPC-Autonomous-Wind-Turbine-Inspection | WTI_catkin/NMPC_code_generator/ros_acado_bridge/ACADOtoolkit/examples/ocp/discrete_time_rocket_c.cpp | /**
* \file examples/ocp/rocket_c.cpp
* \author Boris Houska, Hans Joachim Ferreau
* \date 2010
*/
#include <acado_optimal_control.hpp>
#include <acado_gnuplot.hpp>
/* >>> start tutorial code >>> */
// -------------------------------------------------------------------------
// C-STY... | ALGO | 0.999961 | 6.042813 |
335e2884-9c45-4439-bc75-182462b469dc | ishandutta2007/codeforces | beyondheaven/normal/1621/C.cpp | #include <bits/stdc++.h>
int cnt;
int query(int i)
{
std::cout << "? " << i << "\n";
std::cout.flush();
int ans; std::cin >> ans;
return ans;
}
int main()
{
int T; std::cin >> T;
while(T--)
{
cnt = 0;
int n; std::cin >> n;
std::vector<int> p(n + 1), vis(n + 1);
for(int i = 1; i <= n; ++i) if(!p[i... | ALGO | 0.999842 | 3.731644 |
a96efb21-c866-4b2f-aef9-48f36cf40189 | linwater0216/2021-2022_pccu_PI | 20220111第十四週/第四題-切割字串.cpp | /*
J@ӥѭ^rҲզSrArꤤi]t /nB/tB/cB/bB/f زŸAЭpX{ӼơC
JGJ@Ӧr(string)AӦrȥѭ^jpgrPSrũҲզALݦҼ{ҥ~pC
XGھDNApŸӼơC
dҿJG
Today/nis/ca/tniceday
dҿXG
3
*/
#include<string>
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int z=0;
string n;
cin>>n;
for(int i=0;i<n.size();i++){
if(n[i]=='/'&&n[... | ALGO | 0.967413 | 3.088505 |
fbdfcfea-3a00-413b-8587-21388d29781a | JessJess-Choi/ProblemSolving | 프로그래머스/크레인 인형뽑기 게임.cpp | #include <string>
#include <vector>
#include<stack>
#include<iostream>
#include<algorithm>
using namespace std;
int solution(vector<vector<int>> board, vector<int> moves) {
stack<int> s;
int answer = 0;
for(int i=0;i<moves.size();i++){
int index = moves[i]-1;
for(int j=0;j<board.size();j++... | ALGO | 0.999164 | 5.147579 |
0a9f1240-5d2f-436d-bdb8-55dfba03ca48 | xtf0214/CPP | Contest/Nowcoder/47681/K.cpp | /**
* @file : K
* @author : Tanphoon
* @date : 2023/09/28 17:59
* @version : 2023/09/28 17:59
* @link : https://ac.nowcoder.com/acm/contest/47681/K
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
int main() {
cin.tie(nullptr)->sync_with_stdio(... | ALGO | 0.99966 | 3.838063 |
3c4e5d59-55f2-434b-926f-48ee01a2f81d | ishandutta2007/codeforces | rfpermen/normal/1252/L.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=(n);i<=(N);++i)
#define For(i,n,N) for(int i=(n);i< (N);++i)
#define rap(i,n,N) for(int i=(... | ALGO | 0.99992 | 4.112327 |
0e02c1b4-49c0-48cb-a8fb-97e94945d895 | jasn17/cpsc2120 | Labs/Lab_09/T11.cpp | #include <iostream>
int nQueens(int n);
int main()
{
int test = nQueens(11);
//ASSERT_EQ(nQueens(11),2680);
if (test != 2680)
{
std::cout << "expected/correct value for nQueens(11) is 2680, actual value when testing " << test << ".\n";
return 1;
}
std::cout << "Passed" << std::... | TEST | 0.99432 | 5.202559 |
a9afc5b7-729c-45fb-a042-8e2c5b40785e | Dajtbaeva/ADS_2022 | extra/kalkaman.cpp | // All roads lead to Kalkaman
#include <bits/stdc++.h>
using namespace std;
int si, sj, fi, fj;
char maze[10][10];
bool ok;
void dfs(char maze[][10], int i, int j) {
if (i == fi && j == fj) ok = true;
if (i < 0 || i >= 10 || j < 0 || j >= 10 || maze[i][j] == '*') return;
maze[i][j] = '*';
dfs(maze, i... | ALGO | 0.999587 | 3.452322 |
5a6f6a92-a1f7-4687-8ead-27d428c2905d | himanshugupta09/LEETCODE_SOLUTIONS | TREES/convert-sorted-list-to-binary-search-tree.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | ALGO | 0.999996 | 6.445371 |
8910110b-4ea5-4a4f-820b-7f6c85c80a75 | viniciusteix/programming-marathon | algorithms/coin_change.cpp | #include<stdio.h>
int count( int S[], int m, int n ) {
int table[n+1];
memset(table, 0, sizeof(table));
table[0] = 1;
for(int i=0; i<m; i++)
for(int j=S[i]; j<=n; j++)
table[j] += table[j-S[i]];
return table[n];
}
int main() {
int arr[] = {1, 2, 3... | ALGO | 0.999956 | 4.007703 |
93672936-3f3e-49d5-b312-3835b4dcd2af | wuvei/algorithm | Algorithm/cpp/0005.LongestPalindromicSubstring/LongestPalindrome.cpp | class Solution {
public:
string Palindrome(string &s, int l, int r) {
while (l >= 0 && r < s.size() && s[l] == s[r]) {
l--;
r++;
}
return s.substr(l + 1, r - l - 1);
}
string longestPalindrome(string s) {
string longgest = "";
for (int i = 0; i... | ALGO | 0.999975 | 5.978007 |
66b5d933-48e1-41fb-92a9-cf18fbb4ba3c | ylyking/UnrealEngineNiv | Engine/Source/ThirdParty/openexr/OpenEXR-1.7.1/openexr-1.7.1/exrenvmap/blurImage.cpp | //-----------------------------------------------------------------------------
//
// function blurImage() -- performs a hemispherical blur
//
//-----------------------------------------------------------------------------
#include <blurImage.h>
#include <resizeImage.h>
#include <cstring>
#include "Iex.h"
#include <i... | ALGO | 0.978118 | 6.085956 |
cb9ec520-dfd1-49d5-a3f5-3cd7269bb194 | showmanlee/HowCanISolveThisQuestion | BOJ/5000/5958.cpp | // Space Exploration
// https://www.acmicpc.net/problem/5958
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef pair<int, int> pr;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
int main(void) {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
in... | ALGO | 0.999938 | 5.276971 |
d2b0010c-3308-44dc-a0e8-1bf1d7a63e5e | ranhengzhang/LeetCode | lib/662.cpp | #include <bits/stdc++.h>
using std::queue;
// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode... | ALGO | 0.999527 | 6.063647 |
28d77932-e09f-43aa-8307-29c18bec6142 | kitten/2g | packages/bs-glsl-optimizer/include/glsl/opt_flip_matrices.cpp | /**
* \file opt_flip_matrices.cpp
*
* Convert (matrix * vector) operations to (vector * matrixTranspose),
* which can be done using dot products rather than multiplies and adds.
* On some hardware, this is more efficient.
*
* This currently only does the conversion for built-in matrices which
* already have tra... | ALGO | 0.992055 | 7.310534 |
88653baa-8660-45c4-a39d-612ede8a7051 | arthuredelstein/tor-browser | extensions/universalchardet/src/base/CharDistribution.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include "CharDistribution.h"
#include "JISFreq.tab"
#include "Big5Freq.tab"
#include "EUCKRFreq.tab"
#include "EUCTWFreq.tab"
#include "GB2312Freq.tab"
#include "mozilla/ArrayUtils.h"
#define SURE_YES 0.99f
#define SURE_NO 0.01f
//ret... | ALGO | 0.933807 | 5.940503 |
750caa75-4e94-4105-82fc-1884cbccd6ea | PR-DNS/PR_DNS_base | DNS/climate/weno.cpp | /* WENO_5 flux for solving scalar equations*/
/* f(T) = u*Tx + v*Ty */
#include "climate.h"
static double linear_flux(
double wave_speed,
double u)
{
return u;
}
static double linear_dF(
double wave_speed,
double u)
{
return 1.0;
}
WENO_FLUX::WENO_FLUX(Front &front):front(&front)
{
}
void WENO_FLUX::We... | ALGO | 0.999838 | 4.907221 |
86d1ea7d-06c3-4f94-9102-2d3199c9a589 | gemy26/CP-Solutions | CodeForces/GNU C++17/1326A | Bad Ugly Numbers/162048158.cpp | #include<bits/stdc++.h>
#define ll long long
//#define r return 0
#define yes cout<<"YES";
#define no cout<<"NO";
#define el cout<<"\n";
const int AK=5e5+5;
const long long VVB=5e9+5;
using namespace std;
bool isprime(int x)
{
for (int i = 2; i <= x / i; i++)
if (x % i == 0)
return false;
return true;
}... | ALGO | 0.999858 | 4.348562 |
c1d46dd2-1ad9-42b8-beab-bd9814269563 | ritik-patel05/CompetitiveProgramming | Algorithms_DS_Templates/PrimMST.cpp | // Prims - O(N ^2) Implementation.
const int MAXN = 1e5 + 5, INF = 2e9;
bool vis[MAXN];
int N, M, dist[MAXN], par[MAXN];
vector<pair<int, int> > g[MAXN];
void prim() {
fill(vis, vis + N + 1, false);
fill(dist, dist + N + 1, INF);
int ds, v, cost = 0;
while(true) {
ds = INF, v = -1;
... | ALGO | 0.99991 | 4.945217 |
afba6e03-03d0-4cae-9aaa-c53f5c5d55bf | abhimish782/Leetcode_Solution | BinaryTreePaths.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999937 | 5.684695 |
7eab8c2b-a0e3-40d3-bccf-26e72ca5b2bc | icodervivek/striver-dsa | step1/lec2/pattern10.cpp | /**************** Hey There, Vivek Here ****************/
/* Dream Big & Compile Them */
#include <bits/stdc++.h>
using namespace std;
int main()
{
for(int i = 1; i <= 2*5-1; i++){
int stars = i;
if(i>5) stars = 2*5-i;
for(int j = 1; j <= stars; j++){
... | ALGO | 0.999519 | 3.149893 |
7e7ec6d0-07d3-418f-9d21-9c933dcdcf06 | JunBinLiang/IO-Workbook | CF/Round-905(div1)/D(seg+linesweep+2700).cpp | #include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <string.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ve vector
const int MAX = 3e5 ... | ALGO | 0.999995 | 4.470426 |
6189a29b-a843-4be7-ac56-00cefb7b267a | jassellmedina09/CSC211 | Assignments/A2/main_8.cpp | #include <iostream>
int main() {
int n;
std::cin >> n;
if (n <= 0 || n >= 10 || n % 2 == 0) {
std::cerr << "Sorry, not odd.";
return 0;
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (i == j || i == n - j - 1) {
std::cout << "*"... | ALGO | 0.999758 | 5.150105 |
20d45898-6080-4e02-ab40-d8bc60848804 | yosupo06/library-checker-problems | linear_algebra/matrix_product/gen/small.cpp | #include <iostream>
#include "../params.h"
#include "random.h"
using namespace std;
int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);
int n = gen.uniform<int>(1, 128);
int m = gen.uniform<int>(1, 128);
int k = gen.uniform<int>(1, 128);
printf("%d %d %d\n", n, m, k)... | TOOL | 0.957981 | 3.322236 |
00a3d923-2dd7-4ae4-9a47-1a70685a9f6a | AllAlgorithms/cpp | algorithms/math/factorial_loop.cpp | /*
@author Roman Korostenskyi
@date 08.10.2018
Simple factorial algorithm based on loop
*/
int factorial_loop(int n) {
int output = 1;
for (int i = n; i >= 1; i--) {
output *= i;
}
return output;
} | ALGO | 0.999956 | 4.210606 |
ba9591c7-1889-4992-ae59-8781fbb5ece4 | liuwake/Robot | udacity/ND113-intro_to_self_driving_cars/P5_C++_Intro_to_Optimization_L3_Project:Optimize_Histogram_Filter/andy_histogram_filter/move.cpp | #include "headers/move.h"
#include "headers/zeros.h"
using namespace std;
vector< vector <float> > move(int dy, int dx,
vector < vector <float> > beliefs)
{
int height, width;
height = beliefs.size();
width = beliefs[0].size();
float belief;
vector < vector <float> > newGrid;
newGrid = zeros(height, width);... | ALGO | 0.99892 | 4.000509 |
fcc09fb0-938b-4c9c-a62e-205d224d6061 | i9191/repository_polinema_mobile_SIB3E-Kel5 | SurveyKomplainMahasiswaApp/flutter_survey_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.997 | 6.76073 |
7b03cf5a-414d-4086-b084-03c34abdab3c | cranepay/cranepay-core | src/key.cpp | #include <key.h>
#include <arith_uint256.h>
#include <crypto/common.h>
#include <crypto/hmac_sha512.h>
#include <random.h>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
static secp256k1_context* secp256k1_context_sign = nullptr;
/** These functions are taken from the libsecp256k1 distribution and are very ... | TOOL | 0.921475 | 7.269639 |
72d4969f-28fd-40fd-9226-d8d85e0f594f | AshwathVS/Programming | leetcode/find_first_and_last_position_of_element_in_sorted_array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int size=nums.size();
int left=0, right=size-1, mid;
int left_most=INT_MAX, right_most=INT_MIN;
// finding left most
while(left <= right) {
mid=(left+right)/2;
if(nums[m... | ALGO | 0.999958 | 6.65355 |
45782077-7953-41ce-a4c6-8a5cf4f3bc2e | mauro-belgiovine/belgiovi-clmagma | src/cunmqr_gpu.cpp | /*
-- clMAGMA (version 1.0.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
April 2012
@generated c Wed Oct 24 00:32:48 2012
*/
#include <stdio.h>
#include "common_magma.h"
extern "C" magma_int_t
magma_cunmqr_gpu(magma_side_t side, ma... | ALGO | 0.957628 | 6.474428 |
69ad57ec-748f-4b4b-9fdc-8cdd54443694 | kvbd176/CSES_Problems | Sorting&Searching/nearsmallval.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long int n,i;
cin>>n;
vector<long int> v(n);
for (i=0;i<n;i++) cin >> v[i];
vector<long int> res(n);
stack<long int> s;
for(i=0;i<n;i++){
while(!s.empty() && v[s.top()]>=v[i]) s.pop();
if(s.empty()) res[i]=0;
else res[i]=s.top()+1;
s.push(i);
}
for(i=0;i<n;i++... | ALGO | 0.999997 | 3.882445 |
ec7da311-e2ab-453e-941a-9665f02feb70 | Mohcine-Ghalmi/LEET_CODE | 4. Median of Two Sorted Arrays/Solution.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
vector<int> merged(nums1.size() + nums2.size());
merge(nums1.begin(), nums1.end(), nums2.begin(), nums2.end(), merged.begin());
sort(merged.begin(), merged.end());
if (merged.size() % 2... | ALGO | 0.999977 | 6.603617 |
2698780c-cd6f-406e-af45-c304454535fa | anish8808/Data-Structures-Concepts-with-LeetCode-Examples | 12 - Dnc/3-merge_sortedBYME.cpp | #include<bits/stdc++.h>
using namespace std ;
void merge2sortedArray(vector<int> & arr , int start , int end , int mid )
{
vector<int> arr1 ;
vector<int> arr2;
//creating left array
for(int i = start ; i<=mid; i++)
arr1.push_back(arr[i]);
// creatig Rigth Array
for (int i = mid+1; ... | ALGO | 0.999948 | 4.977894 |
fe11afc2-0c99-4f1b-a5ea-01138dec3f2e | askar1680/AlfaTechTalk | Array/SwiftMain-Array/SwiftMain-Array/swift-main/lib/Basic/StableHasher.cpp | #include "swift/Basic/StableHasher.h"
using namespace swift;
#define ROTATE_LEFT(ROTAND, DISTANCE) \
(uint64_t)((ROTAND) << (DISTANCE)) | ((ROTAND) >> (64 - (DISTANCE)))
namespace {
static inline void sip_round(uint64_t &v0, uint64_t &v1, uint64_t &v2,
... | ALGO | 0.998945 | 7.063334 |
d45012fb-bfb5-4492-9c82-44dfa7c9573a | Gowtham-Maran/target_fluid_animation | src/jet/apic_solver3.cpp | #include <pch.h>
#include <jet/apic_solver3.h>
using namespace jet;
ApicSolver3::ApicSolver3()
: ApicSolver3({1, 1, 1}, {1, 1, 1}, {0, 0, 0}) {
}
ApicSolver3::ApicSolver3(
const Size3& resolution,
const Vector3D& gridSpacing,
const Vector3D& gridOrigin)
: PicSolver3(resolution, gridSpacing, gridOrigin) {... | TOOL | 0.988741 | 5.914563 |
a5ffa46c-036e-484f-8f97-d24e4f618433 | folgerwang/UnrealEngine | Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/SpatialHash.cpp | namespace Chaos
{
DEFINE_LOG_CATEGORY_STATIC(LogChaosSpatialHash, Verbose, All);
template<class T>
void TSpatialHash<T>::Init(const T Radius)
{
double Time = 0.0;
FDurationTimer Timer(Time);
MCellSize = 2.0 * Radius;
MBoundingBox = TBox<T, 3>(TVector<T, 3>(0.0), Chaos::TVector<T, 3>(0.0));
for (int32 I... | ALGO | 0.898848 | 5.862385 |
7fcdec94-c09d-47b4-b880-6881a08815c8 | MrSmile21/shop_ease | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
bd6dd633-a329-47cb-a615-76b9fecbcb8c | bajo/squirrel_hri_orig | squirrel_leg_detector/src/squirrel_legs_close_to_pose.cpp | /**
* leg_detector.h
*
* Detects persons as pairs of legs in 2D laser range data.
*
* @author Markus "Bajo" Bajones <EMAIL>
* @date April 2016
*/
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <std_msgs/Bool.h>
#include <squirrel_leg_detector/squirrel_legs_close_to_pose.h>
#include <squir... | DATA | 0.983521 | 3.551485 |
b879f0ca-5f18-408e-a791-8c567ac7921b | kimyu0218/algorithm | Baekjoon/2000-2999/2156.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> wine;
int max_wine(int n) {
if(n == 1) return wine[1];
vector<int> dp(n+1, 0);
dp[1] = wine[1];
dp[2] = wine[1] + wine[2];
// 1. i-2 마시지 않기
// 2. i-1 마시지 않기
// 3. i 마시지 않기
for(int i = 3; i <= n; i++)
dp[i]... | ALGO | 0.999909 | 4.344084 |
6eebee27-d381-46f9-a726-a31df1dcacdd | kyuri09/boj-answer | src/b14500.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int tetro[500][500];
bool c[500][500];
int n, m;
int result = 0;
int dx[] = { 0,0,-1,1 }; // ->κ ¿x
int dy[] = { 1,-1,0,0 }; // ->κ x
void go(int x, int y, int sum, int cnt)
{
if (cnt == 4)
{
if (result < sum) result = sum;
retur... | ALGO | 0.999897 | 4.426336 |
5560c106-c736-4f34-a8d8-fa2c5d92bec4 | liaoyaonline/LeetCodeNote | 算法模板/深度遍历/完全二叉树非叶子部分后序遍历/main.cpp | /*pow(16,i),queue.front()struct Tree{};vector<string> res(8, "");mp.find(key) ==
* mp.end() int a[5] = {},vector<int> num(a,a+..) set test; test.insert(1),auto
* it = test.begin() bool cmp(const word &num1, const word &num2) {
return num1.value != num2.value ? num1.value > num2.value: num1.name <
num2.name;} v.ins... | ALGO | 0.999713 | 4.299213 |
1cfcd55d-036e-4a51-8639-681edc401dea | JazzTheSaver/Cuda_test | eigen/bench/benchmark.cpp | // g++ -O3 -DNDEBUG -DMATSIZE=<x> benchmark.cpp -o benchmark && time ./benchmark
#include <iostream>
#include <Eigen/Core>
#ifndef MATSIZE
#define MATSIZE 3
#endif
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 40000000
#endif
#ifndef SCALAR
#define SCALAR double
#endif
int main(int ar... | ALGO | 0.991052 | 3.675187 |
6bb738e3-5c2a-4b3f-a6da-4cdc683af727 | justus-comnets/upf-acceleration | MoonGen/libmoon/deps/tbb/src/rml/perfor/omp_simple.cpp | #include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <float.h>
#include <math.h>
#include <time.h>
#include <omp.h>
#include <assert.h>
#include "thread_level.h"
#include "tbb/task.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/parallel_for.h"
#include "tbb/blocked_range.h"
#if _WIN32||_WIN64
#in... | TOOL | 0.912907 | 4.284693 |
a699fb8c-6f9a-4fd1-9280-1cc9737577ed | yobrooks/NMR | smooth.cpp | #ifndef SMOOTH_CPP
#define SMOOTH_CPP
//this will hold functions for filtering and cubic spline
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <fstream>
#include "globals.h"
#include "prototypes.h"
#include "structs.h"
using namespace std;
void prepVec(int n)
{
//wrap the data at... | ALGO | 0.989078 | 3.95678 |
4add4024-d531-43c9-9b38-45cab8dc0aef | Daniel-Xing/leetcode-cpp | backtracking/93.复原-ip-地址.cpp | /*
* @lc app=leetcode.cn id=93 lang=cpp
*
* [93] 复原 IP 地址
*
* https://leetcode-cn.com/problems/restore-ip-addresses/description/
*
* algorithms
* Medium (56.13%)
* Likes: 894
* Dislikes: 0
* Total Accepted: 219.8K
* Total Submissions: 391.5K
* Testcase Example: '"25525511135"'
*
* 有效 IP 地址 正好由四个整数... | ALGO | 0.999521 | 6.183088 |
11a59001-5634-42c8-96e8-373d304ddd4b | Siddsharma2002/C- | optimal-2-find-the-missing-number.cpp |
#include <bits/stdc++.h>
using namespace std;
int missingNumber(vector<int>&a, int N) {
int xor1 = 0, xor2 = 0;
for (int i = 0; i < N - 1; i++) {
xor2 = xor2 ^ a[i]; // XOR of array elements
xor1 = xor1 ^ (i + 1); //XOR up to [1...N-1]
}
xor1 = xor1 ^ N; //XOR up to [1...N]
ret... | ALGO | 0.999881 | 4.984014 |
201e2b6c-23ed-41db-875d-e7f15a71cb94 | Ananyaa26/Codechef-Problem-Solutions | FIZZBUZZ2301.cpp | #include <iostream>
using namespace std;
int main() {
int A,B,C;
cin>>A>>B>>C;
if(A>B && A>C){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
} | ALGO | 0.999976 | 3.964852 |
02551850-33bd-4b18-86e4-b3ea5eedb4c7 | alessblaze/magma | magmablas/ztrsm_vbatched_core.cpp | /*
-- MAGMA (version 2.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date
@precisions normal z -> s d c
@author Ahmad Abdelfattah
*/
#include "magma_internal.h"
#define PRECISION_z
//-------------------------
magma_int_t m... | ALGO | 0.996186 | 6.005253 |
e809767a-68cf-4a7d-81e3-ef55f08b5038 | zhaosiwen1949/GAMES202_homework | homework2/prt/ext/tbb/examples/parallel_for/tachyon/src/parse.cpp | /*
* parse.cpp - an UltraLame (tm) parser for simple data files...
*/
// Try preventing lots of GCC warnings about ignored results of fscanf etc.
#if !__INTEL_COMPILER
#if __GNUC__<4 || __GNUC__==4 && __GNUC_MINOR__<5
// For older versions of GCC, disable use of __wur in GLIBC
#undef _FORTIFY_SOURCE
#define _FORTIF... | TOOL | 0.869889 | 4.269223 |
6d1e1c02-8649-4850-92f5-d6befcadda3d | VishalPatil18/My-CPP-Solutions | GFG/46.Searching an element in a sorted array.cpp | class Solution{
public:
int searchInSorted(int arr[], int N, int K)
{
int low = 0, high = N-1;
long long int mid;
while(low <= high){
mid = (low+high)/2;
if(arr[mid] == K) return 1;
else if(arr[mid] > K) high = mid-1;
else if... | ALGO | 0.999935 | 5.591743 |
8bbda705-1d32-4cb7-b05e-890dc362607a | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_870_6.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int birds[100], n, m, x, y, left, right;
cin >> n;
for (int i = 0; i < n; i++) cin >> birds[i];
cin >> m;
while (m--) {
cin >> x >> y;
left = y - 1;
right = birds[x - 1] - y;
if (x == 1)
birds[x] += right;
else if (x == n)
... | ALGO | 0.999936 | 3.720752 |
2532bec2-9dd5-4108-89d7-8211ed10813a | onglu1/Mycode | luogu/P3258 [JLOI2014]松鼠的新家.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=6e5+1009;
int read(){
char c;int num,f=1;
while(c=getchar(),!isdigit(c))if(c=='-')f=-1;num=c-'0';
while(c=getchar(), isdigit(c))num=num*10+c-'0';
return f*num;
}
int n,a[N],val[N],cf[N];
int fa[N],dep[N],siz[N],son[N],id[N],rl[N],cnt=0;
int head[... | ALGO | 0.999963 | 4.307402 |
b396ee82-897f-4e12-bcd2-17ffccf617e8 | mohammadshahjahan/Data-Structure-Algorithms-CPP | GRAPHS/BFS.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> bfsOfGraph(int V, vector<int> adj[])
{
vector<int> ans;
vector<int> chk(V, 0);
queue<int> q;
q.push(0);
chk[0] = 1;
while (!q.empty())
{
int a = q.front();
q.pop();
ans.push_back(a... | ALGO | 0.99999 | 4.403387 |
3d3a4c15-fb6d-44a1-955f-8f11d7371ec9 | 759713112/my_ceph | src/boost/libs/graph/test/random_matching_test.cpp | #include <boost/graph/max_cardinality_matching.hpp>
using namespace boost;
typedef adjacency_list< vecS, vecS, undirectedS,
property< vertex_index_t, int > >
undirected_graph;
typedef property_map< undirected_graph, vertex_index_t >::type
vertex_index_map_t;
typedef vector_property_map<
graph_traits<... | TEST | 0.891014 | 7.049457 |
619aa899-90b8-495b-90e4-58535d73b195 | Bhargav-CS/100DaysOfCode | 206_reverselist.cpp | class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* prev = nullptr;
ListNode* curr = head;
while (curr != nullptr) {
ListNode* nextNode = curr->next;
curr->next = prev;
prev = curr;
curr = nextNode;
}
... | ALGO | 0.999799 | 6.015272 |
b0533796-1d95-49b0-81ef-12fa18e239ec | amitaka007/Leetcode_Top_Interview_150-main | Backtracking/N-Queens II/NQueensII.cpp | class Solution {
public:
int totalNQueens(int n) {
vector<bool> col(n), diag(2 * n - 1), anti_diag(2 * n - 1);
return solveNQueens(col, diag, anti_diag, 0);
}
private:
int solveNQueens(vector<bool>& col, vector<bool>& diag, vector<bool>& anti_diag, int row) {
int n = col.size(), cou... | ALGO | 0.999924 | 6.75934 |
bc7fafca-d7f4-44b3-911e-3b3f0a5f1d22 | Lawapaul/Complete_C_Data-Structures | Arrays/LinearSearch/main.cpp | #include <iostream>
using namespace std;
int linearSearch(int arr[],int size,int key){
for(int i=0;i<size;i++){
if(arr[i]==key){
return i;
}
}
return -1;
}
int main(){
int size,key;
cin >> size;
cin >> key;
int arr[size];
for(int i=0;i<size;i++){
cin ... | ALGO | 0.999848 | 5.104218 |
3f22261d-91d4-4344-a923-08d19bff2ff6 | root-jeong/BOJ | ~9999/7569_토마토.cpp | #include <iostream>
#include <vector>
#include <tuple>
using namespace std;
bool dp[101][101][101];
int arr[101][101][101];
vector<tuple<int, int, int>> tomato;
int ans = 0;
int main() {
int total;
int col, row , hei;
int cnt = 0;
cin >> col >> row >> hei;
total = col * row * hei;
for (int h = 0; h < hei; h++)... | ALGO | 0.999947 | 4.008642 |
cb146209-c93d-4c92-bf81-92d3c98f598b | Nidhi2215/DSA | Remove Element.cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int start=0,end=nums.size()-1,count=0;
while(start<=end)
{
if(nums.at(start)!=val)
{
start++;
continue;
}
if(nums.at(end)==val)
... | ALGO | 0.999911 | 6.011253 |
b99387dc-4dc3-4571-be25-b0dc2f711915 | Amina5484/amina | bubble sort.cpp | #include <iostream>
#include <string>
using namespace std;
void bubbleSort(string arr[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
swap(arr[j], arr[j + 1]);
}
}
}
}
int main() {
int n;... | ALGO | 0.999688 | 5.59735 |
353cf817-bdfa-4f20-b3ca-c35c47c4945b | neerajsahu14/coding-journy | assignments/StringCompressor.cpp | #include <iostream>
using namespace std;
string compress(const string& s) {
string result;
int count = 1;
for (int i = 1; i <= s.length(); ++i) {
if (i < s.length() && s[i] == s[i - 1]) {
count++;
} else {
result += s[i - 1] + to_string(count);
count... | ALGO | 0.99999 | 5.583631 |
8536c373-147e-46a0-bd16-0495d6d579f5 | ishandutta2007/codeforces | dorijanlendvaj/normal/1185/G1.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
... | ALGO | 0.999963 | 3.638977 |
45c62d32-b804-44e1-ba4e-b1b61c9712e3 | Shuklashashi0706/DSA_Placement | Recursion/lowerToUpper.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void lower(string &str, int index)
{
if (index == -1)
return;
str[index] = 'A' + str[index] - 'a';
return lower(str, index - 1);
}
int main()
{
string name = "shashi";
int index = name.size() - 1;
lower(nam... | ALGO | 0.998942 | 4.147444 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.