uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
f21f3a5a-c9ea-43c2-8ac3-b18dfb6127b4 | abhiram138b/LEETCODE | 2194-cells-in-a-range-on-an-excel-sheet/2194-cells-in-a-range-on-an-excel-sheet.cpp | class Solution {
public:
vector<string> cellsInRange(string s) {
int i = s[1] - '0';
int n = s[4] - '0';
char j = s[0];
char m = s[3];
vector<string> v;
while(j <= m){
int x = i;
while(x <= n){
string str(1,j);
... | ALGO | 0.999567 | 5.670331 |
49dd63e1-d26d-45b2-88b6-db2459674e25 | WHOLEACS/LeetCode | 1482/code.cpp | class Solution {
public:
// 判断当前天数时候可以满足插花
bool judge(const vector<int>& bloomDay, int& mid, int m, const int& k, const int& len) {
for (int i = 0; i < len; i++) {
if (bloomDay[i] <= mid) {
int j = i;
while (j < len && bloomDay[j] <= mid) {
... | ALGO | 0.999988 | 6.067902 |
7a7e745d-eb18-4765-ac0f-e299c0ffdf71 | Ginakira/Code-Archive | Leetcode/LeetCode3375.cpp | // LeetCode 3375 使数组的值全部为K的最少操作次数
#include <algorithm>
#include <array>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
class Solution {
public:
int minOperations(vector<int>& nums, ... | ALGO | 0.999939 | 5.589248 |
ec28b97d-f186-428f-bec2-0e91f242ab61 | nimishrajgure/CIP | stl/C++_Template.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
template <class T>
class minElement
{
// Complete the class.Make a private variable,constructors and method called
// check() which takes one parameter and pri... | ALGO | 0.997656 | 4.799592 |
5d9894af-b16b-4997-b85b-fbae8394d8ad | saadamin654/Data_structure | Graph.cpp | #include<iostream>
#include<list>
using namespace std;
class Graph{
list<int> * adjList;
int vertex;
public:
Graph(int v){
vertex = v;
adjList = new list <int>[vertex];
}
void addEdge(int firstV,int secondV,bool bi){
adjList[firstV].push_back(secondV);
if(bi){
adjList[secondV].push_back(first... | ALGO | 0.998048 | 4.392267 |
19349002-61ea-4406-9cac-2d789ed9bf50 | ygame11092017/ykit-demo-android | cocos2d/cocos/storage/local-storage/LocalStorage.cpp | /*
Local Storage support for the JS Bindings for iOS.
Works on cocos2d-iphone and cocos2d-x.
*/
#include "storage/local-storage/LocalStorage.h"
#include "platform/CCPlatformMacros.h"
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sqlite3.h>
st... | TOOL | 0.884201 | 6.119884 |
00f3aa83-a0b0-4e18-afcc-a2148877bca7 | AkshayAnil1080/DSA | Remainder on dividing by 11 - GFG/remainder-on-dividing-by-11.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
int xmod11(string x)
{
// code here
int cur=0; int rem=0;
for(int i=0 ;i<x.length(); i++)
{
cur = r... | ALGO | 0.999467 | 6.195626 |
eb35f1e3-698b-43c4-b55d-8dc25dca8f5d | ishandutta2007/codeforces | burnedchicken/normal/1392/B.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(... | ALGO | 0.999963 | 3.865233 |
9ce2255f-2140-4c41-a9c2-5c243d4ba6c7 | Nick-800/game_app2 | 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.998756 | 6.772262 |
429e3ff9-5548-4e29-a6fe-fee0ad932458 | JochemVanIterson/ConvolutionCPP | library/src/fft/FftComplexTest.cpp | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <random>
#include <vector>
#include "FftComplex.hpp"
using std::complex;
using std::cout;
using std::endl;
using std::vector;
// Private function prototypes
static void testFft(int n);
static vo... | TEST | 0.977064 | 6.501782 |
7bec0e3f-38ed-438d-8072-b34751dae75f | Kelvinmao/Leetcode | LinkedList/Leetcode 237.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
void deleteNode(struct ListNode* node) {
struct ListNode* next = node->next;
*node = *next;
free(next);
}
| ALGO | 0.970518 | 3.544409 |
ad0eccca-b0c7-4f5e-83d3-3c6c949564c8 | yqtaowhu/DataStructureAndAlgorithm | programming/263.丑数.cpp | /*
* @lc app=leetcode.cn id=263 lang=cpp
*
* [263] 丑数
*/
// @lc code=start
class Solution {
public:
bool isUgly(int num) {
if(num < 1) return false;
while(num % 2 == 0) {
num /= 2;
}
while(num % 3 == 0) {
num /= 3;
}
while(num % 5 ==0 ) {
... | ALGO | 0.9972 | 5.921247 |
9ce4de28-52ce-4455-91e0-d3c4d75d849c | Arpitpandey992/cpp-vscode | Contests and Practice/CodeChef/Bunny_Hops.cpp | #include <algorithm>
#include <chrono>
#include <cmath>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <... | ALGO | 0.999996 | 4.711264 |
a2526762-6928-4510-b534-1f6e7a26e84a | ProkopHapala/FireCore | cpp/common/math/DynamicOpt.cpp |
#include "DynamicOpt.h" // THE HEADER
//#include <cstdio>// DEBUG
//#include "VecN.h"
#include "fastmath.h"
// =============== MoveSteps
void DynamicOpt::move_LeapFrog(double dt_loc){
//double dt_ = dt*fscale_safe;
for ( int i=0; i<n; i++ ){
//printf( "i %i v %g f %g p %g iM %g \n", i, vel[i],forc... | ALGO | 0.999614 | 4.253885 |
a2fbed9d-fd14-4296-9ba1-6ff09f7fdcc9 | Andwerpz/Competitive-Programming-Practice | - cpp -/hauntedgraveyard.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
//CSCE 430 Spring 2023 - Problem Set 10 B
//treat grid as graph, and relax weights.
//if after (w * h) ^ 2 relaxations, there can still be relaxations, then there is a negative cycle, and return "Never".
//else, return the... | ALGO | 0.999691 | 5.101067 |
d9dab540-257f-4af0-8dfa-d09190dbd5a8 | SolveGuys/AlgorithmStudy | Problems_Archives/38week/ktjs7252/bo2565.cpp | #include <bits/stdc++.h>
using namespace std;
int n,lis,answer;
vector<pair<int,int>> v;
int dp[101];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//memset(dp,1,sizeof(dp));
fill(dp,dp+101,1);
cin>>n;
for(int i=0;i<n;i++)
{
int a,b;
cin>>a>>b;
v.push_back({a,b});
}
... | ALGO | 0.999719 | 4.094739 |
a240cc9f-a823-464a-bd0d-3eebb54f92ca | virgolinosoares/Crowd-SLAM | Thirdparty/g2o/g2o/stuff/string_tools.cpp | #include "string_tools.h"
#include "os_specific.h"
#include "macros.h"
#include <cctype>
#include <string>
#include <cstdarg>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <iterator>
#if (defined (UNIX) || defined(CYGWIN)) && !defined(ANDROID)
#include <wordexp.h>
#endif
name... | TOOL | 0.874743 | 6.040052 |
1b4c07fb-10ba-49c3-9af8-a334ae42d30d | graphretrieval/ESSIso | ours_wl/CommonSubGraph.cpp | #include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <thread>
#include <mutex>
#include <condition_variable>
#include "Graph.hpp"
#include "CommonSubGraph.hpp"
biNodeSet::biNodeSet() {
setG = std::set<int>();
setH = std::set<int>();
}
biNodeSet:... | ALGO | 0.999896 | 4.866931 |
e818d089-b5a1-4f0f-b435-d6e841ba5c7e | XinShuo-ph/KAdath_Frontera | src/Domain/Oned/domain_oned_ori_export_tau_boundary.cpp | #include "headcpp.hpp"
#include "oned.hpp"
#include "array.hpp"
#include "scalar.hpp"
#include "tensor.hpp"
namespace Kadath {
void Domain_oned_ori::export_tau_val_domain_boundary (const Val_domain& so, int bound, Array<double>& sec, int& pos_sec, int ncond) const {
if (so.check_if_zero())
pos_sec += ncond ;
els... | ALGO | 0.884844 | 5.721405 |
61709bbc-6804-4cd6-837b-b71547e3d482 | hackybacky/my-leet | Segregate even and odd nodes in a Link List - GFG/segregate-even-and-odd-nodes-in-a-link-list.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
void printList(Node* node)
{
while (node != NULL) {
cout << node->data <<" ";
... | ALGO | 0.999125 | 5.678067 |
77815717-5b3e-4ef4-8d2a-55f2d7a0d38c | jainsourav43/DSA | CP/hvhv.cpp | #include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
using namespace std;
#define ll long long
int main()
{
ll n,k,p;
cin>>n>>k>>p;
ll a[2*n],i,j;
int temp,max1=0;
for(i=n;i<2*n;i++)
{
cin>>a[i];
}
char s[p+1];
int size=n;
cin>>s;int sum[n]={0};
int count1=0,check=0;
for(i=0;i<strlen... | ALGO | 0.999549 | 3.308472 |
fdc6a79d-569d-439a-9ad0-04656a759479 | ishandutta2007/codeforces | keywet06/normal/1288/F.cpp | #include <bits/stdc++.h>
class MinCostFlow {
public:
const int INF = 1000000000;
const int n;
std::vector<std::tuple<int, int, int>> e;
std::vector<std::vector<int>> g;
std::vector<int> h, dis, pre;
bool dijkstra(int s, int t) {
dis.assign(n, INF);
pre.assign(n, -1);
... | ALGO | 0.999894 | 4.533992 |
742e894f-cef9-4641-a27e-cb2c5aab5612 | codekollege/MASTERING-C---BUILD-FAST-AND-EFFICIENT-APPLICATIONS | chapter 8/8.6 Case Study Identifying and Fixing a Performance Bottleneck/Step 3 Optimizing the Code.cpp | cpp
#include <iostream>
#include <vector>
#include <numeric>
#include <execution>
#include <chrono>
int main() {
const int dataSize = 1000000;
std::vector<int> data(dataSize, 1);
auto start = std::chrono::high_resolution_clock::now();
int sum = std::reduce(std::execution::par, data.begin(), data.... | ALGO | 0.99993 | 7.271745 |
f10d0d2a-c5e7-4f49-8d20-674c7c37bcc7 | csyyysc/LeetcodeLab | cpp/Leetcode/String/Q3110-ScoreOfAString.cpp | class Solution {
public:
int scoreOfString(string s) {
int scores = 0;
for(int i = 0; i < s.length() - 1; i++) {
scores += abs(int(s[i + 1]) - int(s[i]));
}
return scores;
}
}; | ALGO | 0.999736 | 5.772986 |
c9f4f85a-9e71-4227-824f-293e0e488679 | vishu9897/Leetcode | 1121-partition-array-for-maximum-sum/1121-partition-array-for-maximum-sum.cpp | class Solution {
public:
int calculateSum(vector<int> &arr,int start,int end){
int maxi=INT_MIN;
for(int i=start;i<=end;i++){
maxi=max(maxi,arr[i]);
}
return maxi;
}
// int partitionArray(vector<int> &arr,int index,int k,vector<int> &dp)
// {
// if(in... | ALGO | 0.99992 | 5.499701 |
933acf48-7e61-45f9-82e8-84624e7cccb7 | Ruoye-W/CS225---Data-Structure | lab_btree/btree.cpp | /**
* @file btree.cpp
* Implementation of a B-tree class which can be used as a generic dictionary
* (insert-only). Designed to take advantage of caching to be faster than
* standard balanced binary search trees.
*/
/**
* Finds the value associated with a given key.
* @param key The key to look up.
* @return T... | ALGO | 0.99976 | 7.170907 |
acc32eb8-3a5f-4e71-a5aa-a8991b1d1412 | Garimachandra1917/CP_Problems | 0799-champagne-tower/0799-champagne-tower.cpp | class Solution {
public:
double champagneTower(int poured, int query_row, int query_glass) {
vector<double> currRow(1, poured);
for(int i=0; i<=query_row; i++){ //we need to make the dp matrix only till query row. No need to do after that
vector<double> nextRow(i+2, 0); //If we are at... | ALGO | 0.999628 | 5.377621 |
e93c64f9-449c-46e9-831a-ac6568de1cf4 | aki-ph-chem/try_neetcode | neet_code_all_cpp/array_hash/non_decreasing_array.cpp | #include <iostream>
#include <vector>
class Solution {
public:
bool checkPossibility(std::vector<int>& nums) {
bool changed = false;
for(int i = 0; i < nums.size(); ++i) {
if(nums[i] <= nums[i + 1]) {
continue;
}
i... | ALGO | 0.999925 | 5.897912 |
7dfde080-a403-4582-b69c-aa366411a371 | jkyleowens/NeuroGen-Alpha | src/TradingAgent.cpp | #include "TradingAgent.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <filesystem>
// Static constants initialization]
const float TradingAgent::DEFAULT_CONFIDENCE_THRESHOLD = 0.6f;
const float TradingAgent::REWARD_DECAY_FACTOR = 0.95f;
/... | ALGO | 0.995509 | 7.403392 |
7130f49c-f6f1-4b5f-8d01-229e5ddf8f5b | sarvex/leetcode-factor | solution/1700-1799/1763.Longest Nice Substring/Solution.cpp | class Solution {
public:
string longestNiceSubstring(string s) {
int n = s.size();
int k = -1, mx = 0;
for (int i = 0; i < n; ++i) {
int lower = 0, upper = 0;
for (int j = i; j < n; ++j) {
char c = s[j];
if (islower(c))
... | ALGO | 0.999966 | 6.320702 |
e56f77d8-28b8-4da5-8318-64e157bc4862 | khan0531/algorithm | BOJ/KMP(Knuth-Morris-Pratt)/BOJ_1893_시저암호.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> failure(string& s){
vector<int> f(s.size());
int j = 0;
for (int i = 1; i < s.size(); i++) {
while(j > 0 && s[i] != s[j]) j = f[j - 1];
if (s[i] == s[j]) f[i] = ++j;
}
return f;
}
int main() {
ios::sync_with_stdio(0);
... | ALGO | 0.999925 | 4.65044 |
b4dc2dc2-dca5-4363-8659-0c6d5db5964b | bbaah123/CPlusPlus | files/SOWC++EO9 Programming Challenge Solutions/Chapter02/2_20.cpp | // Chapter 2 - Programming Challenge 20, How Much Paint
// This program calculates how much paint is needed to paint a fence.
// Because students have not yet learned to perform typecasts, some
// of the variables have been made doubles to avoid integer division.
#include <iostream>
using namespace std;
int main()
{ ... | ALGO | 0.978471 | 6.10968 |
bc784781-72ef-4ee8-8fae-c6fe79ea6bb5 | korli/haiku-jarek | src/kits/storage/PathFinder.cpp | #include <PathFinder.h>
#include <AutoDeleter.h>
#include <FindDirectory.h>
#include <Path.h>
#include <StringList.h>
// NOTE: The package kit specific part of BPathFinder (BResolvableExpression
// constructor and SetTo()) is implemented in the package kit.
BPathFinder::BPathFinder(const void* codePointer, const cha... | TOOL | 0.983985 | 3.56374 |
24173b14-5819-4006-a093-7772ec49ffef | tianxiao/ode-cuda | OPCODE/Ice/IceRevisitedRadix.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains source code from the article "Radix Sort Revisited".
* \file IceRevisitedRadix.cpp
* \author Pierre ... | ALGO | 0.999992 | 6.939073 |
e386f47f-56d5-4be7-b93b-6b22e3b21534 | matumoto1234/cp-crawler | AtCoder/arc124/arc124_b/24549544.cpp | // detail: https://atcoder.jp/contests/arc124/submissions/24549544
#include <bits/stdc++.h>
using namespace std;
// {{{
// clang-format off
#define _over_load(_1,_2,_3,_4,NAME,...) NAME
#define range(...) _over_load(__VA_ARGS__, range4, range3, range2)(__VA_ARGS__)
#define range2(i, r) for ( int i = 0; i < (int)(r); ... | ALGO | 0.999995 | 4.350945 |
1ae21351-efc2-4d7f-a883-d1c475eebed8 | deepinsight230/LeetCode | 1302-deepest-leaves-sum/1302-deepest-leaves-sum.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.999981 | 6.11898 |
a5dcd867-fb4a-4869-a277-ee9385be9b65 | ArtiGaund/Leetcode | 968-binary-tree-cameras/968-binary-tree-cameras.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.99986 | 7.019343 |
779ae6b5-e9fd-404b-9838-a426e4c6459e | symforce-org/symforce | third_party/symengine/benchmarks/expand6b_ginac.cpp | // To compile on a debian system you need to install libginac-dev first
// $ sudo apt-get install libginac-dev
// Then compile with the following command,
// $ g++ -std=c++0x -o expand6b_ginac -Wl,--no-as-needed `pkg-config --cflags
// --libs ginac` expand6b_ginac.cpp
// See this SO answer: http://stackoverflow.com/a/1... | ALGO | 0.855332 | 5.498899 |
44430df3-47df-4d04-b3d5-e04ff0968557 | batman-rises/Striver-s-A-to-Z-DSA-SHEET- | SORTING/bubble_sort.cpp | void bubble_sort(vector<int> arr)
{
int n = arr.size();
for (int i = n - 1; i >= 0; i--)
{
for (int j = 0; j <= i - 1; j++)
{
if (arr[j] > arr[j + 1])
swap(arr[j], arr[j + 1]);
}
}
} | ALGO | 0.999687 | 5.116748 |
1b195c8a-c3ed-4d0e-b1f2-4e560247ecd4 | joy-mollick/Codeforces-B-C-D-Problem-Solutions | codeforces-B. Alyona and Mex.cpp | // https://codeforces.com/problemset/problem/682/B
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a;
int n,sz;
cin>>n;
while(n--)
{
cin>>a;
v.push_back(a);
}
sort(v.begin(),v.end... | ALGO | 0.99992 | 4.002969 |
23270f16-c6ec-4097-8b23-3b233ee6fc84 | avadump/frameworks_av | media/codecs/amrnb/common/src/mult_r.cpp | /*
Filename: /audio/gsm_amr/c/src/mult_r.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the mult_r function. Sync'ed up
with the current template and fixed tabs.
Description: Passing in a pointer to the overflow ... | ALGO | 0.999324 | 6.261268 |
97f3b4e9-aca8-4f43-9eaa-1fd4f8239e5f | sdkl/LeetCode | 055. Jump Game/maincpp.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
bool canJump(vector<int>& nums) {
int maxStep = 0;
for (int i = 0; i <= maxStep && i < nums.size() && maxStep < nums.size() - 1; i++)
{
maxStep = max(i + nums[i], maxStep);
}
return maxStep >= nums.size(... | ALGO | 0.999978 | 5.63261 |
da6fb4d3-f313-4477-993c-014b090a0987 | syf1913/IBAMR | src/advect/AdvectorPredictorCorrectorHyperbolicPatchOps.cpp | /////////////////////////////// INCLUDES /////////////////////////////////////
#include "ibamr/AdvectorExplicitPredictorPatchOps.h"
#include "ibamr/AdvectorPredictorCorrectorHyperbolicPatchOps.h"
#include "ibamr/ibamr_enums.h"
#include "ibamr/ibamr_utilities.h"
#include "ibtk/CartExtrapPhysBdryOp.h"
#include "ibtk/Ca... | ALGO | 0.988624 | 3.588193 |
b75db27c-c178-45bd-a8c3-dfd49b0023a2 | imbaesible/DSA-Sheet | Day 04 Array Hashing/Q22 Largest Subarray with 0 Sum.cpp | //Q22 Largest Subarray with 0 Sum
//Given an array having both positive and negative integers. The task is to compute the length of the largest subarray with sum 0.
// Input:
// N = 8
// A[] = {15,-2,2,-8,1,7,10,23}
// Output: 5
//Approach 1 : Naive Approach
// Intuition: We are required to find the longest subarra... | ALGO | 0.999788 | 6.382009 |
7d4ca44b-bc0f-4b9b-9362-affe59787d93 | andrewqt/Competitive-Programming | CodeForces/_1444_B_DivideAndSum/_1444_B_DivideAndSum.cpp |
// Problem : B. Divide and Sum
// Contest : Codeforces - Codeforces Round #680 (Div. 1, based on Moscow Team Olympiad)
// URL : https://codeforces.com/contest/1444/problem/B
// Memory Limit : 512 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using ... | ALGO | 0.999952 | 4.730545 |
fb581b6c-f045-43e6-94ee-f3ca2af98168 | Srivaths-P/Competitive-Programming | CodeForces/GNU C++14/1337C | Linova and Kingdom/77082726.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define speed ios::sync_with_stdio(false); cin.tie(NULL);
#define MAXN 200010
int diff[MAXN];
int sizes[MAXN];
int depths[MAXN];
vector<int> graph[MAXN];
int dfs(int u=0, int p=0, int dep=0){
dep++;
depths[u] = dep... | ALGO | 0.999931 | 4.226538 |
7a1ee2b8-1bdf-4c69-965a-145eacddb984 | xjonwang/competitive-programming | usaco-guide/silver/more-prefix-sum/feb-2019-2/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ar array
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_u... | ALGO | 0.999745 | 4.716191 |
3b0291c1-dee7-4c28-8278-6e50e560d81a | sandeepkhannavp/DSALGO-IMPLEMENTATIONS | STACK/infixtopostfix.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
char data;
struct Node *next;
} *top = nullptr;
void push(char x)
{
struct Node *t;
t = new Node;
if (t == nullptr)
printf("stack is full\n");
else
{
t->data = x;
t->next = top;
top = t;
}
}
char pop()
{
struct Node *t;
c... | ALGO | 0.99978 | 4.473491 |
018ae195-1000-4d08-a672-881e574000ed | abhiram22MH1A4267/Github-Problems | Difficulty: Easy/Single Number/single-number.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int getSingle(vector<int>& arr) {
// code here
int ans = arr[0];
for(int i = 1; i < arr.size(); i++){
ans ^= arr[i];
}... | ALGO | 0.999895 | 5.838602 |
386f922d-36e3-4c1c-9aae-d9860fab1a1d | nis/Numerical-Methods--RB-NUM6-U2-1-F12- | Code/Tools/NR_C301/legacy/nr2/CPP_211/examples/xprobks.cpp | #include <string>
#include <iostream>
#include <iomanip>
#include "nr.h"
using namespace std;
// Driver for routine probks
int main(void)
{
const int NPTS=20,ISCAL=40;
const DP EPS=0.1;
int i,j,jmax;
DP alam,aval;
string txt;
cout << "probability function for kolmogoro... | ALGO | 0.998583 | 4.533425 |
05d08f42-1876-4b21-af9a-4d8c6622a26e | Kyoungminn/Algorithm-Study | sohyun/문자열을 정수로 바꾸기/code.cpp | //
// Created by Sohyun on 2021-01-16.
//
#include <string>
#include <vector>
using namespace std;
int solution(string s) {
int answer = 0;
int num;
int count = 1;
for(int i = s.length()-1 ; i > 0 ; i--) {
num = s[i] - 48;
answer += (count*num);
count *= 10;
}
if(s[0] ... | ALGO | 0.999728 | 4.536639 |
6fe5c3e7-3f41-499f-88cd-c383112eb618 | alx-yulax/search_engine | ConverterJSON.cpp |
#include "ConverterJSON.h"
#include "SearchServer.h"
#include <iostream>
void ConverterJSON::GetText(int doc_id, std::string path, std::map<int, std::string> &input_docs_Sorted) {
std::string word, words = "";
int wordsCount = 0;
std::ifstream file(path);
if (!file.is_open()) {
std::cout << p... | TOOL | 0.930558 | 4.506613 |
4367ff46-ad76-4f20-9432-3993368edbac | ishandutta2007/codeforces | ekzhang/normal/1091/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const double PI = 4 * atan(1);
#define MAXN 500013
int N;
LL L[MAXN];
string S;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
// freopen("input.txt", "r", stdin);
cin >> N;
for (int i = 0; i < N; i++)
cin >> L[i];
cin >> S;
... | ALGO | 0.999759 | 3.121665 |
e92f4683-e8e9-4ff9-a545-fc1e5baace2c | AniketDGiri/DSA-with-CPP | Arrays/Easy/move-all-zeros-to-the-end-of-array.cpp | #include <iostream>
#include <utility>
#include <vector>
using namespace std;
class Solution
{
private:
vector<int> arr;
public:
void moveAllZeros(vector<int> &arr)
{
int ind = -1;
int n = arr.size();
for (int i = 0; i < n; i++)
{
if (arr[i] != 0)
{... | ALGO | 0.99889 | 5.545619 |
552dee63-1eb3-477e-9925-1c4e0e59289c | oscarjgv24/ArduPilot | libraries/AC_PID/AC_HELI_PID.cpp | /// @file AC_HELI_PID.cpp
/// @brief Generic PID algorithm
#include <AP_Math/AP_Math.h>
#include "AC_HELI_PID.h"
const AP_Param::GroupInfo AC_HELI_PID::var_info[] = {
// @Param: P
// @DisplayName: PID Proportional Gain
// @Description: P Gain which produces an output value that is proportional to the curr... | ALGO | 0.998928 | 4.212183 |
d38b7258-f8bf-4d97-9b1f-ae0bcf163c8c | ishandutta2007/codeforces | 300iq/normal/1275/D.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#inc... | ALGO | 0.999645 | 3.469255 |
33a4ad59-b62d-4d05-8a54-076c915a1bb0 | Daariy/metod-proc | Dasha1_proc/Dasha1_proc/func.cpp | #include "stdafx.h"
#include "func.h"
#include <cstring>
#include "Protect.h"
using namespace std;
Aforysm* Inn(ifstream &ifst)
{
CheckInputFile(ifst);
Aforysm* af = new Aforysm;
ifst.getline(af->Author, 256);
CheckWrongInput(ifst);
return af;
}
Poslovica* Inc(ifstream &ifst)
{
CheckInputFile(ifst);
Poslovica... | TOOL | 0.926555 | 3.293602 |
69f93359-8771-4e35-9d78-ab9eabcde6c4 | RainPPR/oi-archive | 20230712 树形DP/树的重心.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
vector<int> G[N];
int cnt[N], dp[N];
void dfs(int u, int f)
{
cnt[u] = 1;
for (int v : G[u])
{
if (v == f)
continue;
dfs(v, u);
cnt[u] += cnt[v];
dp[u] = max(dp[u], cnt[v]);
}
dp[u] = max(dp[u], n - cnt[u]);
}
int main()
... | ALGO | 0.989257 | 4.568558 |
8f204a4a-cb08-4f35-be27-1e66b17a7ae4 | ishandutta2007/codeforces | sjcsjcsjc/normal/1477/A.cpp | #pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
int a[200010];
inline int gcd(int a,int b)
{
if... | ALGO | 0.999937 | 3.881314 |
4916a752-a7e2-4561-8f20-1d4792fbaca0 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5981_4.cpp | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000,100000000000")
const long long INF = 1000000007;
const double cp = 2 * asin(1.0);
const double eps = 1e-9;
const long long mod = 1000000007LL;
using namespace std;
int main() {
long long n, s = 0, a[100001], ans = 0;
cin >> n;
for (int(i) = 0; ... | ALGO | 0.999868 | 3.683765 |
e33118ce-f46b-43f9-ae15-2c00715162c7 | shafaq-aslam/cpp-dsa-adventures | C++/Conditional Statements and loops/code7.cpp | #include <iostream>
using namespace std;
int main(){
int count = 1;
int n;
cout << "Enter any number: ";
cin >> n;
while (count <= n)
{
cout << count << " ";
count ++;
}
return 0;
} | ALGO | 0.997445 | 3.354589 |
55379732-f5cb-4de1-82a4-f171fb4d1f9b | rocky2133/leetcode | 53. Maximum Subarray.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxSubArray(vector<int>& nums) {
if(nums.size()==0)
return 0;
int sum = 0;
int ans = nums[0];
for(int i=0;i<nums.size();i++){
if(sum<0)
sum=nums[i];
else
sum+=nums[i];
ans=max(sum, ans);
}... | ALGO | 0.999858 | 4.4786 |
4c64b098-d9a7-4f66-bec6-53d5b720c1fb | Techlead-ANKAN/C-Language | C programs (college + mine)/Practice/MATRIX MULTIPLICATION.cpp | # include <stdio.h>
main()
{
int a[2][2] = {{1,1},{2,2}}, b[2][2] = {{1,1},{2,2}}, c[2][2] , sum[2][2], i, j, k;
// Matrix A
printf("Matrix A: \n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
printf("%d ", a[i][j]);
printf("\n");
}
// Matrix B
printf("Matrix B: \n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
... | ALGO | 0.999417 | 3.526454 |
8d43eaf5-014b-4e2b-8437-ad6d9a22da5c | MarjaanZare/BASILISK | src/simulation/dynamics/reactionWheels/reactionWheelStateEffector.cpp | #include "reactionWheelStateEffector.h"
#include "architecture/utilities/avsEigenSupport.h"
#include <cstring>
#include <iostream>
#include <cmath>
#include "architecture/utilities/avsEigenSupport.h"
ReactionWheelStateEffector::ReactionWheelStateEffector()
{
CallCounts = 0;
prevCommandTime = 0xFFFFFFFFFFFFFFFF;
... | ALGO | 0.997132 | 5.864816 |
0da91796-4f74-4eaf-9157-85616c5dc16c | AGH0RI/C- | problem1.cpp | #include<iostream>
using namespace std;
int main()
{
int alice[3],bob[3],pointAlice=0,pointBob=0;
for (int i = 0; i <= 3;i++)
{
cin>>alice[i];
}
for (int i = 0; i <= 3;i++)
{
cin>>bob[i];
}
for (int i = 0; i <= 3;i++)
{
if (alice[i]>bob[i])
pointAlice=pointAlice+1;
if(alice[i]<bob[i])
pointBob... | ALGO | 0.999927 | 3.29648 |
be069cdb-597d-4da4-80e0-9eb5533f8bf6 | priyanshuanandd/Code_Submissions | Name_Lookup.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/... | ALGO | 0.999885 | 4.852113 |
4eab8e72-5190-40d6-b44c-15161400a8eb | Hemantgithubpro/leetcode | Codeforces/Lists/TLE_Eliminators/900/11/main3.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
// code
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
// a[i+1]%a[i] != 0
// making first element even
if (a[0] % 2 == 1)
a[0]++;
// first element is even
fo... | ALGO | 0.999743 | 3.954329 |
11852a92-accc-4411-979b-e7305d55f9f5 | simonenkoos/Home_task | week2/50_task.cpp | #include <iostream>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b){
if(!b){
return a;
}
return gcd(b, a%b);
}
int main(){
int n;
ll x, gcd1;
cin >> n;
cin >> gcd1;
for(int i=1; i<n; i++){
cin >> x;
gcd1 = gcd(gcd1, x);
}
int cnt = 1;
for(ll i=2, q; i*i <= gcd1; i++){
... | ALGO | 0.999988 | 3.908412 |
64506fd7-7f19-4f4f-a17a-a08fa9e4858c | sdi2100002/Non-obtuse-Triangulation-of-Planar-Straight-Line-Graphs-Project | CGAL-5.6.1/examples/Inscribed_areas/extremal_polygon_2_perimeter.cpp | #include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
#include <CGAL/extremal_polygon_2.h>
#include <iostream>
#include <vector>
typedef double FT;
typedef CGAL::Simple_cartesian<FT> K... | ALGO | 0.999412 | 5.477008 |
98e257c3-9cc1-4483-9064-38b9274f6722 | Haideransari444/Data-Structure-Algorithms | TwoSum.cpp | Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15], target =... | ALGO | 0.999569 | 5.680084 |
ccd90a88-6db1-4d6a-a24a-ed4f13662c1e | SudhanshuChoudharyGit/Data-Structure-and-Algorithm-Challenges---Solutions | 443-string-compression/string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int l,r;
l=r=0;
int count=0;
string ans="";
while(r<chars.size())
{
while(r<chars.size() && chars[r]==chars[l])
{
count++;
r++;
}
... | ALGO | 0.999995 | 6.345684 |
74162042-c6df-4d33-bb77-476ae86e780c | ishandutta2007/codeforces | kotamanegi/normal/908/A.cpp | #include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include ... | ALGO | 0.999222 | 3.538724 |
c41cf683-c533-4385-9828-a71133da928b | shankar9834/DSA_NOTES | Others/DSU.cpp | // 29 may 2023
// Author -- shankar wangwad
//application
// 1) finding connected componants
// 2)used in kruskals algorithm for finding minimum spanning tree
#include<bits/stdc++.h>
using namespace std;
int nodes=100; // 0 to 99
int par[101]; // stores parent of the componant
int sz[101]; //stores size of t... | ALGO | 0.999036 | 4.523026 |
4f66d2a3-26f6-4e55-a8fa-c360fbe6c6b3 | MaheswariRajendranDSA/Data-Structures-and-Algorithms | DP/Recursion/reverse_the_arr_using_one_pointer.cpp | #include<bits/stdc++.h>
using namespace std;
void find_reverse(int index, int num, vector<int>&arr)
{
if(index>=num/2)
{
for(int i=0;i<num;i++)
cout<<arr[i]<<" ";
return;
}
swap(arr[index],arr[num-index-1]);
find_reverse(index+1,num,arr);
}
int main()
{
int num;
cin... | ALGO | 0.999988 | 3.752612 |
434d0318-9ed4-4b00-ad2c-9989c5a3e97f | SJBiber/SJ_C-_study | study/algorithm/example/baekjoon.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
int K;
cin >> N >> K;
vector<int>W(N,0);
vector<int>V(N,0);
vector<int>table(N*N,0);
for(int i = 0 ; i < N ; i++)
{
cin >> W[i] >> V[i];
}
for(int i = 1; i < N ; i++)
{
fo... | ALGO | 0.999964 | 3.059507 |
6964b3e8-fb30-480a-96f5-dc28cbdc5afd | Subhraneel77/Leetcodes-Solutions | 1962-remove-stones-to-minimize-the-total/1962-remove-stones-to-minimize-the-total.cpp | class Solution {
public:
int minStoneSum(vector<int>& piles, int k) {
priority_queue<int>pq;
for(int i = 0;i < piles.size();i++){
pq.push(piles[i]);
}
while(k > 0){
int temp = pq.top();
pq.pop();
if(temp % 2 != 0){
temp+... | ALGO | 0.999881 | 5.412616 |
e768d72c-4f93-41c0-a6c5-0eb0af048151 | ayush9009/daily_coding_work | BTMiscellaneous FindMedianFromDataStream.cpp | priority_queue<int>maxHeap;
priority_queue<int,vector<int>,greater<int>>minHeap;
MedianFinder() {
}
void addNum(int num) {
maxHeap.push(num);
minHeap.push(maxHeap.top());
maxHeap.pop();
if(minHeap.size()>maxHeap.size()){
maxHeap.push(minHeap.top());
... | ALGO | 0.999976 | 5.573159 |
81505620-c00d-4436-a9a8-ea2db734bb74 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_no_LineNumber/model/cpp/cpp_gold/gold_470.cpp | #include <bits/stdc++.h>
using namespace std;
int dp[100005], ans[100005];
struct node {
int x, y, t;
} a[100005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int r, n;
cin >> r >> n;
a[0].x = a[0].y = 1;
a[0].t = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i].t >> a[i].x >> a[i].... | ALGO | 0.999938 | 4.206354 |
6c94c0e0-3c77-4686-86bc-0e453bd60441 | mchanthagithub/finite-volume | src/include/eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.990814 | 6.677844 |
fd19457a-7f8e-4f7f-b428-d1e99f34daab | ishandutta2007/codeforces | noimi/normal/698/C.cpp | #pragma region Macros
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; ... | ALGO | 0.999943 | 4.054026 |
fb842191-60bd-4817-b2c4-accc029eafea | NehaVerma825/cpp-all-code | 2dArray.cpp/2dArrayIntro.cpp | #include<iostream>
using namespace std;
// searching an element in an array
bool isPresent(int arr[3][3],int target,int i,int j){
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(arr[i][j]==target){
return 1;
}
}
}
return 0;
}
//To print row wise sum
... | ALGO | 0.999685 | 4.230012 |
a9aaf06c-7b3c-4f90-8435-84c045d3ed88 | Dolabhargavi/Leetcode-Solutions | 0452-minimum-number-of-arrows-to-burst-balloons/0452-minimum-number-of-arrows-to-burst-balloons.cpp | class Solution
{
public:
int findMinArrowShots(vector<vector < int>> &points)
{
int count = 1;
sort(points.begin(), points.end());
int cmp = points[0][1];
for (size_t i = 1; i < points.size(); ++i)
{
if (points[i][0] > cmp)
... | ALGO | 0.99998 | 6.060104 |
b9b091a9-5ece-40ea-b5cf-16109e556d6b | alavia92/AED3-TP3 | implementacion/ej1/ej.cpp | #include <iostream>
#include <vector>
#include "backtracking.h"
using namespace std;
int main(int argc, char* argv[]) {
//Parseo la entrada
int n;
cin >> n;
int m;
cin >> m;
int mochila;
cin >> mochila;
vector<pos> gimnasios(n);
vector<int> gimnasiosPoder(n);
vector<pos> paradas(m);
for(int i = 0; i < n... | ALGO | 0.999969 | 3.908658 |
3fd01acf-b82d-49ef-bddb-d8b945e3ccd4 | RogerHideki/Maratona | leetcode/exs-16xx/leetcode-ex-1669.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) {}
* };
*/
int xlr8 = []() {
ios_base::sync_with_stdio(fa... | ALGO | 0.999976 | 4.848674 |
610b32e5-0417-475d-bf33-d674e3bf3d5c | Maitrey27/DsaDaily | 1752-check-if-array-is-sorted-and-rotated/1752-check-if-array-is-sorted-and-rotated.cpp | class Solution {
public:
bool check(vector<int>& nums) {
int rotate_point = 0;
int n = nums.size();
vector<int> rotArray(n);
//first find in the array the point where rotation occurs
// i.e the point where array is not in non decreasing order
for(int i =1; i<n; i++)
... | ALGO | 0.99998 | 5.851284 |
56b1becd-a37d-4b9a-a117-d7a6157e4390 | bqmnhat/CompetitiveProgramming | Codeforces/ArrayAndOperations/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int t,n,k;
long long a[101], ld, sum = 0;
struct Div {
long long val, ReduceVal;
int id1,id2;
} d[10001];
void ReadData() {
for (int i=1; i<=n; i++) {
cin >> a[i];
sum += a[i];
}
}
long long Solution() {
sort(a+1, a+... | ALGO | 0.999708 | 3.86777 |
d37f9949-5df9-46b3-b0cd-8fc38056dc8c | splucs/Competitive-Programming | URI/ProgBASE-2017/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 100009
bool pr[MAXN];
bool super(int N) {
while(N > 0) {
if (!pr[N%10]) return false;
N /= 10;
}
return true;
}
int main() {
memset(&pr, true, sizeof pr);
pr[0] = pr[1] = false;
for(int i=2; i<MAXN; i++) {
if (pr[i]) {
for(int j=2*i; j<MAXN; j ... | ALGO | 0.999839 | 4.064578 |
d5923ee3-eea3-4634-a5d9-f266e7774853 | elenaisnanocat/codetree-TILs | 231219/함수를 이용한 연속부분수열 여부 판단하기/to-determine-whether-a-continuous-subsequence-is-made-using-a-function.cpp | #include <iostream>
using namespace std;
int n, m;
int arra[100], arrb[100];
bool IsSame(int n) {
for(int i = 0; i < m; i++)
if(arra[i + n] != arrb[i])
return false;
return true;
}
bool IsSubsequence() {
for(int i = 0; i <= n - m; i++)
if(IsSame(i))
return true;... | ALGO | 0.999995 | 3.942209 |
fe7c43c3-017c-441e-9916-c4837451826c | kmjp/procon | codeforce/301-320/cf317/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(... | ALGO | 0.999919 | 3.629473 |
445a9e76-f3c6-4a3c-a176-4b7e595f3289 | SikandarHussain6858/Mine-Escape-Game | Mine_Escape/Program Files/player_movements.cpp | #include <iostream>
#include <limits>
#include <cctype>
#include "player_movements.h"
#include "file_operations.h"
#include "misc.h"
#include "color.h"
using namespace std;
bool valid_move(int newRow, int newCol, int rows, int columns)
{
return (newRow >= 0 && newRow < rows && newCol >= 0 && newCol < columns); //... | ALGO | 0.945238 | 3.23141 |
e5af15bd-81d6-4c2e-9095-de3ef22b58c7 | divyankatwal/DSA | Swap Function.cpp | #include<iostream>
using namespace std;
void swap(int *x ,int *y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}
int main()
{
int x,y;
x=10;
y=20;
swap(&x,&y);
cout<<"X : "<<x<<endl;
cout<<"Y : "<<y<<endl;
} | ALGO | 0.995038 | 4.024363 |
b4a0b1ad-b67f-4cdb-b37f-e94e41ccfede | atarchive/PreciseLoopChecker | src/verisim_version/work/findcircle.cpp | #include"findcircle.h"
#include<stack>
#include<thread>
#include <mutex>
#include <algorithm>
#include<chrono>
#include<iostream>
#include<fstream>
#include<unordered_map>
using namespace std;
//created by ycy 10/16/2024
//使用Johnson算法寻找所有可能的环路
//Tarjan's SCC算法,用于缩点
vector<vector<int> >sccs;//用于保存所有的强连通分量,但注意,为了方便后面寻找环路... | ALGO | 0.99979 | 4.329376 |
009e0f30-efc3-486a-9604-51550cd1a965 | sumitt194/Codeforces-Solutions | Codeforces/B_Berland_Music.cpp | // #include <bits/stdc++.h>
// using namespace std;
// #define ll long long
// int main()
// {
// int t;
// cin >> t;
// while (t--)
// {
// if (t >= 0)
// {
// ll n;
// cin >> n;
// int zedi = 5;
// vector<pair<ll, ll>> arr(n);
// ... | ALGO | 0.999984 | 5.545177 |
a57e04fb-e580-4db2-9471-f8e8a51ba597 | frankji/CPP-Primer-Plus-6 | cpp_tries/ch07/ex10.cpp | #include <iostream>
using namespace std;
typedef double (*funcp) (double, double);
const int ArSize = 5;
double Add(double x, double y);
double Minus(double x, double y);
double Prod(double x, double y);
double Div(double x, double y);
double calculate(double x, double y, double (*func)(double , double));
int main(... | ALGO | 0.997536 | 5.799664 |
445c2016-222d-47b8-8110-3970053eef4f | metehkaya/Algo-Archive | Problems/LeetCode/Solutions/0467.Unique_Substrings_in_Wraparound_String.cpp | class Solution {
public:
int mx[26];
int findSubstringInWraproundString(string s) {
int n = s.length();
for( int i = 0 , j = 0 ; i < n ; i = j ) {
j = i+1;
while(j < n && (s[j] == s[j-1]+1 || (s[j] == 'a' && s[j-1] == 'z')))
j++;
int len = j-i;... | ALGO | 0.99981 | 5.292799 |
f2693f6a-38fe-45cb-b029-d639593209e2 | Aritrajeet/DSA_practice | Striver/Day 4 : Array 4/Largest Subarr with 0.cpp | //Question: https://practice.geeksforgeeks.org/problems/largest-subarray-with-0-sum/1#
//Solution: Prefix sum
class Solution{
public:
int maxLen(vector<int>&A, int n)
{
// Your code here
map<int,int> m; //map to store the prefix sum as key with the index as value
int count=0;... | ALGO | 0.999877 | 5.805195 |
54e7020d-cfc0-484c-8c31-3819d89520eb | pingjuiliao/llvm-vanilla-13.0.0 | llvm-project/llvm/tools/llvm-xray/xray-stacks.cpp | #include <forward_list>
#include <numeric>
#include "func-id-helper.h"
#include "trie-node.h"
#include "xray-registry.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatAdapters.h"
#include "llv... | TOOL | 0.984304 | 7.614539 |
e1a99985-12a5-44c0-bae8-21d5d1896b29 | alfazet/algorithmic-problems | poi/20/luk.cpp | #include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
const int MAXN = 3e5 + 3;
int dp[MAXN], builders; // dp[i] - min arches required in the subtree of i when the king is entering i
vector <int> adj[MAXN];
void DFS(int v, int par){
for (int child : adj[v]){
if (child != par){
... | ALGO | 0.999969 | 4.882402 |
334bf1fa-50f9-42ca-8bfc-4b5051571cc3 | omkarugale7/codeforces | contests/Educational Codeforces Round 127 (Rated for Div. 2)/01.cpp | /*Editor: Omkar Ugale
Time : . 21th April 2022 */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
int t;
cin >> t;
while (t--)
{
string s;
cin >> s;
vector<int> cnt;
char temp = s[0];
int ttt = 1;
for (int i = 1; i < ... | ALGO | 0.999986 | 5.034498 |
e8119c65-26a2-41ff-8053-1014f8d2a4f9 | vikkastiwari/competitive-coding-questions | DSA-450/04SearchSort/12helpingThief.cpp | // question link: https://practice.geeksforgeeks.org/problems/stickler-theif-1587115621/1#
#include <bits/stdc++.h>
using namespace std;
int FindMaxSum(vector<int> arr, int n)
{
int incl = arr[0];
int excl = 0;
int excl_new;
int i;
for (i = 1; i < n; i++)
{
/* current max excluding i ... | ALGO | 0.999896 | 4.970541 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.