uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5164651f-c006-4a15-85a9-986adf15ea4e | ThePixelMoon/OpenMod | src/mathlib/spherical.cpp | #include <math.h>
#include <float.h> // Needed for FLT_EPSILON
#include "basetypes.h"
#include <memory.h>
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/spherical_geometry.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
floa... | TOOL | 0.998569 | 5.759721 |
aff3a146-38d8-4417-97c9-71cc3875631a | NOOXY-research/NodeNet-Archive | test/CUDA/cuda.cpp | #include <stdio.h>
#include <stdlib.h>
#include "cuda_runtime.h"
#define DATA_SIZE 1048576
int data[DATA_SIZE];
void GenerateNumbers(int *number, int size)
{
for(int i = 0; i < size; i++) {
number[i] = rand() % 10;
}
}
bool InitCUDA()
{
int count;
cudaGetDeviceCount(&count);
if(count == 0)... | ALGO | 0.973883 | 4.680815 |
bc28d8cf-24f1-4cd7-8b54-2c5adcd22ddc | tahsinsoha/Problem-solving- | Codeforces/floor number.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
long long arr[1000007];
long long cs[1000007];
long long ps[1000007];
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
if(n==1 || n==2)
{
cout<<1<<endl;
}
else {
... | ALGO | 0.999848 | 3.513327 |
a3a7fda9-d94a-44aa-ba8b-cb75218fd15d | SAMYAK99/Leetcode-Solutions | 22-generate-parentheses/22-generate-parentheses.cpp | class Solution {
public:
/*
Condition for balanced parenthesis
* closing count < opening count
* opening count < n
* oc : opening count | cc : closing count
*/
void helper(vector<string> &ans , int n , int oc , int cc , string s){
// Base case
if(oc == n an... | ALGO | 0.999847 | 6.477369 |
369dc5f4-74a0-45ce-90a0-3e83733ef4c8 | garvkrishna2004/semester-1-assignment | 7. C program to check Least Significant Bit (LSB) and MSB of a number using bitwise operator.cpp | #include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
// Check least significant bit (LSB)
if (num & 1) {
printf("LSB is set (1).\n");
} else {
printf("LSB is not set (0).\n");
}
// Check most significant bit (MSB)
if (num & (1 <<... | ALGO | 0.992324 | 7.155276 |
c0481c25-75dd-47b5-b2d7-1e109313eb4e | raincross7/code-similarity | codes/train_code/problem390/problem390_23.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void) {
int q;
ll a, b;
scanf("%d", &q);
for(int i=0; i<q; i++) {
scanf("%lld%lld", &a, &b);
ll x = a*b;
ll r = (ll)sqrt(x);
ll ans = r*2 - 1;
if(r * (r+1) >= x) ans--;
... | ALGO | 0.999912 | 3.86142 |
dd35a02c-655d-4b47-8d0f-a861974be4bd | unixpickle/goigl | cvendor/libigl/include/igl/per_vertex_attribute_smoothing.cpp | template <typename DerivedV, typename DerivedF>
IGL_INLINE void igl::per_vertex_attribute_smoothing(
const Eigen::MatrixBase<DerivedV>& Ain,
const Eigen::MatrixBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedV> & Aout)
{
std::vector<double> denominator(Ain.rows(), 0);
Aout = DerivedV::Zero(Ain.rows... | ALGO | 0.999098 | 4.719689 |
cc88419f-be77-4f13-b631-b101c06308f3 | ww-driving/nd013-c6-control-starter | project/pid_controller/eigen-3.3.7/doc/examples/TemplateKeyword_flexible.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
template <typename Derived1, typename Derived2>
void copyUpperTriangularPart(MatrixBase<Derived1>& dst, const MatrixBase<Derived2>& src)
{
/* Note the 'template' keywords in the following line! */
dst.template triangularView<Upper>() = src.template... | TOOL | 0.996078 | 5.811227 |
432ebe1b-8b2a-44be-95d5-fbf34470eeb2 | devhasibulislam/CodeForces-online-judge | ...rest/1437B-ReverseBinaryStrings.cpp | #include <iostream>
int main(){
std::ios_base::sync_with_stdio(false);
long t; std::cin >> t;
while(t--){
long n; std::cin >> n;
std::string s; std::cin >> s;
long cnt(0);
for(long p = 1; p < n; p++){cnt += (s[p - 1] == s[p]);}
std::cout << ((cnt + 1) / 2) << std::e... | ALGO | 0.999165 | 4.255776 |
d80b1638-da91-4e55-a9b5-3058f30c7e6a | gmh5225/OLLVM-test-goron-10 | llvm/lib/Support/IntervalMap.cpp | #include "llvm/ADT/IntervalMap.h"
namespace llvm {
namespace IntervalMapImpl {
void Path::replaceRoot(void *Root, unsigned Size, IdxPair Offsets) {
assert(!path.empty() && "Can't replace missing root");
path.front() = Entry(Root, Size, Offsets.first);
path.insert(path.begin() + 1, Entry(subtree(0), Offsets.seco... | ALGO | 0.969671 | 6.213988 |
de89576f-7f12-43b6-b3bd-3f62a9268b60 | Sakana-2/CPP_CV | inio_web/box_filter.cpp | #include "box_filter.hpp"
#include "filter2d.hpp"
cv::Mat box_filter(cv::Mat src, ushort blocksize) {
cv::Mat kernel(blocksize, blocksize, CV_64FC1, cv::Scalar::all(1 / ((double)blocksize * blocksize)));
return filter2d(src, kernel);
} | TOOL | 0.865252 | 4.872437 |
15175f71-71b7-450c-bbf3-f2c9a9e7f62a | tobing7799/Study | 공부/특별한 이차원 배열 1.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<vector<int>> solution(int n) {
vector<vector<int>> answer;
for (int i = 0; i < n; ++i)
{
vector<int>temp(n,0);
temp[i] = 1;
answer.push_back(temp);
}
return answer;
}
int main()
{
for (... | ALGO | 0.999737 | 3.450385 |
8245e9cd-f23d-40b7-ac8a-88673fe516ea | Vanhoai/MasterAlgorithms | practice/string_vector_set/standardization/sort_characters.cpp | #include <iostream>
using namespace std;
/**
* Sort Characters
*
* input:
* T: number of test cases (1 <= T <= 100)
* S: string (size <= 1000)
*
* output: print sorted characters in string
*
* @example
* input: aazabcd
* output: aaabcdz
*/
int main() {
ios::sync_with_stdio(false);
... | ALGO | 0.999591 | 5.824206 |
62c0cae0-9384-452c-88b3-ff3d6836b809 | 123CarlosDaniel/cpp-data-structures | stacks/2.stack-linkedList.cpp | #include <iostream>
#include "utils.h"
using namespace std;
void Push(Node** headPointer, int data ) {
// Creating the new Node to insert
Node* temp = new Node();
temp->data = data;
temp->next = *headPointer;
*headPointer = temp;
}
void Pop(Node** headPointer) {
Node* deleted = *headPointer;
*headPoint... | ALGO | 0.96975 | 4.521345 |
6fd8e665-b48c-47ec-b608-a70ad2f5fe18 | DDunhamPortfolio/INTERNET_SERVER | components/components/openthread/openthread/src/core/thread/link_metrics_types.cpp | /**
* @file
* This file includes definitions for Thread Link Metrics.
*/
#include "link_metrics_types.hpp"
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
#include "common/code_utils.hpp"
#include "mac/mac_frame.hpp"
namespace ot {
namespace LinkMetr... | TOOL | 0.88074 | 7.821663 |
b8bf0076-c92e-412e-99f5-feaf9ccb4933 | anshikarathi66/leetcode | Majority Element - GFG/majority-element.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:
// Function to find majority element in the array
// a: input array
// size: size of input array
int majorityElement(int a[]... | ALGO | 0.999873 | 5.633976 |
631b4c5a-b2d0-4e71-ac62-97dd4345aa8f | prashantjagtap2909/LeetCode-POTD_2024 | 07 July/18 Jul: 1530. Number of Good Leaf Nodes Pairs.cpp | class Solution {
public:
vector<int> recur(TreeNode* root, int distance, int &cnt){
if(!root) return {0};
if(!root->left && !root->right) return {1};
vector<int> left = recur(root->left, distance,cnt);
vector<int> right = recur(root->right,distance,cnt);
for(int x: left)... | ALGO | 0.999897 | 6.115533 |
6e8a85a8-e9bd-43a0-aefa-f27720716d5e | Chbharath002/DSA__ASSIGNMENT | QUESTION10i.cpp | #include <iostream>
using namespace std;
int main() {
int x, i;
cout << "Enter a number: ";
cin >> x;
cout << "Enter the bit position to find (0-based): ";
cin >> i;
int mask = 1 << i; // create a mask with a 1 in the i-th bit position
int bit = (x & mask) >> i; // extract the i-th bit from x using the ... | ALGO | 0.999326 | 5.779209 |
240280e2-cf21-471e-9b86-182700d00f41 | Mahesh-Bauri/Competitive-Programming | CodeChef/LongChallenge/AnotCardGame.cpp | /******************** Beginning of Template **************************/
/************ ALL HEADER FILE ***********/
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
/************************************ ALL DEFINE ****************************************************/
#define FORS(i, j, k, step) for (int... | ALGO | 0.99987 | 4.567679 |
4a53422f-72f6-4c0c-bdfa-1f1149128671 | ishandutta2007/codeforces | sunzh/normal/1594/F.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<vector>
#include<ctime>
#include<cstring>
#include<map>
#include<cmath>
#include<queue>
#define mp make_pair
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define int long long
using namespace std;
inline ... | ALGO | 0.999761 | 3.462854 |
3b1cf0ae-0c6d-401e-9595-c601f19022bb | Patilrohit45/DSA-450 | Array/Problem-1.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
vector<int>reverseArray(vector<int>arr,int st,int e)
{
while(st<e)
{
int temp = arr[st];
arr[st]=arr[e];
arr[e]=temp;
st++;
e--;
}
return arr;
}
int main()
{
vector<int>a={4,5,1,2};
vector<in... | ALGO | 0.999735 | 4.704209 |
6d12c954-bad3-4034-8bcc-f72f937f7235 | pratikmandi/my_codeforces_solutions | 1669A-Division.cpp | #include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#include <cmath>
#include <utility>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define eb emplace_back
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef vector<long long> vll;
typedef vector<int> vi;
... | ALGO | 0.999003 | 4.395883 |
d26415a9-4e06-4c28-a09f-d7658b1404ca | liuawen/Play-Leetcode | Play-Leetcode-master/0714-Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee/cpp-0714/main.cpp | /// Source : https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/
/// Author : liuyubobobo
/// Time : 2017-10-24
#include <iostream>
#include <vector>
using namespace std;
/// Using hold and cash to trace the max money in different state
/// Time Complexity: O(n)
/// Spac... | ALGO | 0.999936 | 5.409574 |
48a733a6-572e-4010-9403-a53b53d7ac54 | JANN4TUL-FERDOUS/Codeforces-Solutions | jannatul.cse7.bu/contest/1409D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+7;
ll mod=1e9+7;
ll ax[8]={0,0,-1,+1,-1,-1,1,1};
ll ay[8]={-1,1,0,0,-1,1,-1,1};
ll kx[8]={2,2,-2,-2,1,1,-1,-1};
ll ky[8]={1,-1,1,-1,2,-2,2,-2};
ll sum(ll n){
ll sum=0;
while(n... | ALGO | 0.999683 | 3.331327 |
b18a600e-c1f9-48e9-9b0e-f1c17030e235 | HOWAIKIAT287156/pbl3_cbd | 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 |
46b3667a-5a9a-4afa-9a31-6259c736cc70 | GopherTeen/OJ_Code | Problems/Codeforces/2001-2100/2050/B_Transfusion.cpp | // Date: 2024-12-06 星期五
#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#endif
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int& v : a) {
cin >> v;
}
ll sum = accumulate(a.begin(), a.end(), 0ll);
if (sum % n) {
... | ALGO | 0.999719 | 5.410948 |
227d8b10-3396-481e-a20f-23ad3318931a | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12051_0.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, k, s, a[505050], d[505050][111];
vector<int> g[505050];
bool vis[505050];
queue<int> q;
int main() {
cin >> n >> m >> k >> s;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
g[x].push_bac... | ALGO | 0.99996 | 3.411584 |
16f8c8dc-8bb4-45e8-a7ef-4da2c94da629 | KqSMea8/AirplayServer | app/src/main/cpp/lib/fdk-aac/libSACdec/src/sac_smoothing.cpp | /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
The Fraunhofer FDK AAC Codec Lib... | ALGO | 0.999187 | 5.908196 |
08195e60-bb71-4e4b-aee1-63787c478967 | ParCIS/Magicube | SpMM/ablation_study/4b4b/SpMM_conflict_free_prefetch/spmm_benchmark.cpp | #include <cuda_runtime.h>
#include <random>
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include "include/bm_test_utils.h"
#include "include/cuda_spmm.cuh"
#include "include/wmma_spmm.cuh"
#include "include/cublas_gemm.cuh"
#include <fstream>
#include <string>
#include <cuda_profiler_a... | TOOL | 0.980628 | 4.426174 |
c116312f-226d-444c-a874-7109e917c7f3 | abhi061201/GFG-LEETCODE-CODINGNINJA-SOLUTION | 0055-jump-game/0055-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
int n= nums.size();
vector<int>dp(n,-1);
return go(0, nums,dp);
}
int go(int i, vector<int>&nums,vector<int>&dp)
{
if(i>=nums.size()-1)return 1;
int ans=0;
if(dp[i]!=-1)return dp[i];
for(in... | ALGO | 0.999984 | 5.868129 |
ec3ff109-eebc-419f-81dd-66bfde2c8adc | ha-yujin/algorithm | baekjoon/C++/q2750.cpp | // ϱ
/* ؼ . " ߺ ʴ´" ǰ ¸ . */
#include <iostream>
int main() {
int N, min;
scanf("%d", &N);
int *num = new int[N];
for (int i = 0; i < N; i++) {
scanf("%d", &num[i]);
}
for (int i = 0; i < N; i++) {
min = i;
for (int j = i + 1; j < N; j++) {
if (num[j] < num[min])
min = j;
}
int tmp = num[... | ALGO | 0.999993 | 3.983901 |
bb459afe-e976-4517-9b1e-25638e23cc4c | Rahul-skush/leetcode-solutions | August/Rank Transform of a Matrix.cpp | class Solution {
public:
int find(vector<int> &ds, int i) {
return ds[i] < 0 ? i : ds[i] = find(ds, ds[i]);
}
void process(vector<vector<int>> &m, vector<pair<int, int>> &crds, vector<int> &cols, vector<int> &rows) {
vector<int> ds = vector<int>(m.size() + m[0].size(), -1);
for (auto [i, j] : crds) {
... | ALGO | 0.999986 | 6.141187 |
7a74a358-3c0f-4bf2-a28e-2369d87a153b | Umer281/data-structure-and-algorithm | selection_sort.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[10];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n-1;i++){
int minval=arr[i];
for(int j=i+1;j<n;j++){
if(arr[j]<minval){
swap(minval,arr[j]);
}
}
}
for(int i=0;i<n;i++){
cout... | ALGO | 0.999919 | 3.814093 |
57e43c7d-841a-482d-88d0-7cccacfc85c9 | Rainwoorimforest/codingtest | src/자료구조수업/문제2.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
#define MAX_VTXS 100
class VertexSets {
int parent[MAX_VTXS];
int nSets;
public:
VertexSets(int n) :nSets(n) {
for (int i = 1; i <= nSets; i++)
{
parent[i] = -1;
}
}
bool isRoot(int i) { return parent[i] < 0; }
int findSet(i... | ALGO | 0.999964 | 4.798599 |
2abc59fd-ae60-47b6-8d7e-1835dc1a8198 | Jimmy-Sim/Competitive-Programming | LeetCode/1376-timeNeededToInformAllEmployees.cpp | class Solution {
private:
int dfs(int manager, vector<int>& informTime, unordered_map<int, vector<int>>& adjList) {
int maxTime = 0;
if (adjList.find(manager) != adjList.end()) {
for (int subordinate : adjList[manager]) maxTime = max(maxTime, dfs(subordinate, informTime, adjList));
... | ALGO | 0.999891 | 6.436467 |
31cf31b5-a58a-4658-967c-97ee2549c634 | AngelgarciaJ/C-Programacion-Universidad | 51_PD_nElementosVector_OrdenamientoBorbuja_DMemory.cpp | // Programa 51
// ingreso de n valores a vector
// Mostrar los datos ordenados utilizando direccion de momoria
// https://www.delftstack.com/es/tutorial/algorithm/bubble-sort/#:~:text=La%20ordenamiento%20de%20burbuja%20es%20un%20algoritmo%20de,su%20intercambio%20si%20est%C3%A1n%20en%20un%20orden%20incorrecto.
#includ... | ALGO | 0.999834 | 5.057967 |
d75c532b-7331-47a2-84e4-feab1328f1bd | nadim28/Competative_coding | B. Taxi.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0;
cin>>n;
while(n--){
int i;
cin>>i;
sum=sum+i;
}
int ans= sum/4;
if(sum%4>0) {
cout<<ans+1;
}
else { cout<<ans; }
return 0;
}
| ALGO | 0.99982 | 3.561075 |
1e3efbc5-5934-468a-82f8-e7d389ec6037 | FerIbarra1/Flutter | yes_no_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.998968 | 6.76073 |
6bc3f077-e180-4665-82bb-ec0fb8786ec7 | ishandutta2007/codeforces | tadijasebez/normal/1216/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=200050;
char s[N];
ll dp[N];
int main(){
int n,k;
scanf("%i %i",&n,&k);
scanf("%s",s+1);
deque<int> dq;
dq.push_back(0);
for(int i=1;i<=n;i++){
dp[i]=dp[i-1]+i;
if(i>k && s[i-k]=='1'){
while(dq.front()<i-2*k-1)dq.pop_front();
... | ALGO | 0.999956 | 3.944927 |
7848569a-f21e-4e20-8494-9776bd1c698f | raincross7/code-similarity | codes/train_code/problem204/problem204_401.cpp | // #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define repr(i,n) for (int i = n; i > 0; --i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int MAX = 100;
const int INF = (1<<12);
int fun... | ALGO | 0.999887 | 3.593962 |
97aa225c-4b1b-4aef-a0f2-38c2d6e2e0d0 | devLupin/codetree-TILs | 240413/싸움땅/battle-ground.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <queue>
using namespace std;
// ↑, →, ↓, ←
const int dx[] = { -1,0,1,0 };
const int dy[] = { 0,1,0,-1 };
const int MAX_N = 25;
const int MAX_M = 35;
int N, M, K;
struct Player { int x, y, d, s, g; };
... | ALGO | 0.999905 | 4.262846 |
27171966-4896-4ba0-8989-661190abe636 | Kendrikaaa/fyp_DermaClinic | 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.99887 | 6.783439 |
94d1f678-1b7e-4e63-ad81-2597e676f10a | yangyunshuai/YYWebServer | version0.1/HttpParse.cpp |
#include "HttpParse.h"
// #include "HttpRequest.h"
std::unordered_map<std::string, HTTP_HEADER> HttpRequest::header_map = {
{"HOST", Host},
{"USER-AGENT", User_Agent},
{"CONNECTION", Connection},
{"ACCEPT-ENCODING", Accept_Encoding},
{"A... | WEB | 0.912806 | 3.538788 |
2d460e86-e942-4ad8-8bf6-0c44a47c3198 | bansal1999/LeetCode_Solutions | 1426-counting-elements/1426-counting-elements.cpp | class Solution {
public:
int countElements(vector<int>& arr) {
unordered_map<int, int>mp;
int cnt =0;
for(int i =0; i< arr.size(); i++)
{
mp[arr[i]]++;
}
for(int i = 0; i< arr.size(); i++)
{
int num = arr[i];
... | ALGO | 0.99986 | 5.533445 |
5c5c481b-fe13-4095-9d26-d98842f5b843 | k1nsenka/atcoder | code/archive/Build_Stairs.cpp | #include"bits/stdc++.h"
using namespace std;
int main(){
int n; cin >> n;
int h[n]; for(int i=0; i<n; i++) cin >> h[i];
int flag = 0;
for(int i=n-1; i>0; i--){
if(h[i]-h[i-1] == -1){
h[i-1] = h[i-1]-1;
}else if(h[i]-h[i-1] < -1){
flag = 1;
break;
... | ALGO | 0.999986 | 3.55038 |
ee59156f-e8cc-4bf5-8ea2-da0ad2950bda | Dup4/competitive-programming | cometoj/39/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll l, r, k;
ll f(ll x) {
return x - x / (k + 1);
}
int main() {
int T;
scanf("%d", &T);
while (T--) {
scanf("%lld%lld%lld", &l, &r, &k);
++l, ++r;
if (k & 1) {
printf("%lld\n", r - l + 1);
} ... | ALGO | 0.999898 | 3.78927 |
ef84a517-5364-4ded-a8e6-34b607c72b96 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8316_0.cpp | #include<iostream>
#include <cstdio>
using namespace std;
int main() {
int a, b;
while (scanf("%d %d", &a, &b) != EOF)
printf("%d\n", a + b);
return 0;
} | ALGO | 0.970282 | 3.707287 |
4aca12c8-5e7b-4749-b966-3132b8f1aa4a | Rahulgoy/Data-Structures-and-Algo | 12.graphs/6.rat_in_a_maze.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:
void solve(int i,int j, vector<vector<int>> &m, int n,vector<vector<bool>> &vis, vector<string> &res,string s){
if(i==n-1 ... | ALGO | 0.999819 | 6.418381 |
2b7838c4-8963-4c47-88e0-78a378a34843 | gabrielfelipedy/relatorio-progII | quicksort/graph_all_r.cpp | #include <cstdio>
#include <sys/time.h>
#include <time.h>
#include <cstdlib>
#include <vector>
#include <iostream>
#include "matplotlibcpp.h"
#include "utils.h"
namespace plt = matplotlibcpp;
int main() {
std::vector<double> times_c;
std::vector<double> times_d;
std::vector<double> times_r;
times_c = abreA... | ALGO | 0.994443 | 4.950104 |
f2504163-7d15-4b8d-a016-507346f71753 | yantiantianlx/leetcode | code1/code1/Construct Binary Tree from Inorder and Postorder Traversal.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {
return build_tree(... | ALGO | 0.999851 | 5.909535 |
fe3459ed-f531-4758-8dab-f0d4881f6e27 | yuvrajkumar12/DSA_JOURNY | 05Stack/03_Stack_Impl_LinkedList.cpp | #include<iostream>
#include <climits>
using namespace std;
struct Node {
int data;
Node *next;
Node(int d) {
data = d;
next = NULL;
}
};
struct MyStack {
Node *head;
int sz;
MyStack() {
head = NULL;
sz = 0;
}
void push(int x) {
Node *temp ... | ALGO | 0.914925 | 4.245199 |
8ad2cc1e-f6ba-4abf-a9ed-4f5bebf6340b | balaji1029/queens-gambit-soc | cpp/surge-master/src/chess_engine.cpp | #include <iostream>
#include <chrono>
#include "tables.h"
#include "position.h"
#include "types.h"
//Computes the perft of the position for a given depth, using bulk-counting
//According to the https://www.chessprogramming.org/Perft site:
//Perft is a debugging function to walk the move generation tree of strictly leg... | ALGO | 0.995286 | 6.545146 |
e942b85a-2a29-4c88-a6ba-1fed1ce3dc81 | keroxp/PuzzDlua | frameworks/cocos2d-x/cocos/ui/UITextField.cpp | #include "ui/UITextField.h"
#include "platform/CCFileUtils.h"
NS_CC_BEGIN
namespace ui {
static int _calcCharCount(const char * pszText)
{
int n = 0;
char ch = 0;
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
if (0x80 != (0xC0 & ch))
{
++n;
}
... | TOOL | 0.903259 | 6.487772 |
b019a961-432a-4f10-84d6-4617067f34b6 | xjin1020/Multiversion-search | phase1/search_doc_tradi/main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <ctime>
#include <sys/time.h>
using namespace std;
// vid occurence
class Occurence
{
public:
int vid;
vecto... | ALGO | 0.969778 | 3.562011 |
b5d807c0-6334-4195-bf21-b7b5defc0542 | Seevakan1997/To_Do_App_Flutter | 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.9988 | 6.76073 |
98a7c14b-8f41-483f-8e85-514d2788f731 | dxhisboy/lammps-sunway | pair_coul_wolf.cpp | /* ----------------------------------------------------------------------
Contributing author: Yongfeng Zhang (INL), <EMAIL>
------------------------------------------------------------------------- */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pair_coul_wolf.h"
#include ... | ALGO | 0.999279 | 6.120303 |
5d85b1fe-e6bf-46db-8e73-729658101d84 | notoriouscoder4/LeetCode-Solutions | 605_Can_Place_Flowers.cpp | /*
You have a long flowerbed in which some of the plots are planted, and some are not.
However, flowers cannot be planted in adjacent plots.
Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n,
return if n new flowers can be planted in the flowerbed with... | ALGO | 0.999995 | 7.22105 |
59da6c42-4843-43dd-95e1-37401976071e | minhyojung/ssdp | DAY1/3_도형편집기4.cpp | #include <iostream>
#include <vector>
// 5. OCP 원칙
// 기능 확장에 열려 있고(Open, 나중에 클래스가 추가되어도)
// 코드 수정에는 닫혀 있어야(Close, 기존 코드는 수정되지 않도록)
// 한다는 원칙(Principle)
// Open-Close Principle
// 객체지향 설계의 5대 원칙 : SRP, OCP, LSP, ISP, DIP
// => "SOLID" 라고 합니다.
// 다형성(가상함수)은 OCP 를 만족하는 좋은 코드 입니다.
class Shape
{
int color;
public:... | TOOL | 0.869206 | 4.824552 |
ffb3f122-6058-4c94-9b8a-770b1ccd0bc6 | oganaa2472/Leetcode | 2564-most-profitable-path-in-a-tree/most-profitable-path-in-a-tree.cpp | class Solution {
public:
int mostProfitablePath(vector<vector<int>>& edges, int bob,
vector<int>& amount) {
int n = amount.size(), maxIncome = INT_MIN;
tree.resize(n);
visited.assign(n, false);
queue<vector<int>> nodeQueue;
nodeQueue.push({0, 0, 0})... | ALGO | 0.999959 | 5.763452 |
0080984b-0717-4e2a-93ab-3d1f47338038 | Andres-Maker-Web/Tarea-4 | tarea_4/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.998289 | 6.76073 |
ab8cb10b-f0e0-43f5-a573-b5d09fe08508 | ngthanhtrung23/CompetitiveProgramming | codeforces/431/E.cpp | #include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <complex>
#include <iostream>
#include <algorithm>
#include <ctime>
#include <deque... | ALGO | 0.999715 | 3.489655 |
43801485-f513-4a68-a45e-6ca03b23d31a | akothen/Hydride | backends/llvm/tools/clang/lib/StaticAnalyzer/Core/WorkList.cpp | #include "clang/StaticAnalyzer/Core/PathSensitive/WorkList.h"
#include "llvm/ADT/PriorityQueue.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include <deque>
#include <vector>
using namespace clang;
using namespace ento;
#define DEBUG_... | ALGO | 0.991956 | 7.627855 |
cde41359-bf8d-4468-ae25-741db106e51c | terabhaicoder/DSA-Proficiency | 432-all-oone-data-structure/all-oone-data-structure.cpp | class AllOne {
public:
unordered_map<string,int> count;
set<pair<int,string>> se;
AllOne() {
count.clear();
}
void inc(string key) {
int n = count[key];
count[key]++;
se.erase({n, key});
se.insert({n+1, key});
}
void de... | ALGO | 0.999912 | 6.428165 |
4605ac21-2670-4c01-a1e8-4a8411606c41 | binexusdeveloper/Binexus | src/kernel_worker.cpp | #include <vector>
#include <inttypes.h>
#include "uint256.h"
#include "bignum.h"
#include "kernel.h"
#include "kernel_worker.h"
using namespace std;
#ifdef USE_ASM
#ifdef _MSC_VER
#include <stdlib.h>
#define __builtin_bswap32 _byteswap_ulong
#endif
#if defined(__i386__) || defined(__x86_64__)
#include <immintrin.h... | ALGO | 0.998344 | 5.198118 |
878b3828-2f80-45e4-9377-091a5c7cd639 | singh-pranjal-2004/DSAQuestions | 1803-average-waiting-time/average-waiting-time.cpp | class Solution {
public:
double averageWaitingTime(vector<vector<int>>& customers) {
double ans = 0;
double total = 0;
int n = customers.size();
total += customers[0][0];
for(auto v: customers){
int arrivalTime = v[0], cookingTime = v[1];
if(total < ... | ALGO | 0.99972 | 5.745092 |
9edcb882-8bd0-4035-a90f-66c0278c34db | conankun/Dovelet | boi_rectangle/841743_WA.cpp | #include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
struct B {
long long x,y;
}arr[2000];
struct A {
long long length;
B point1,point2;
};
A slope[3000000];
bool cmp(A a, A b) {
if(a.length==b.length) {
if(a.point1.x+a.point2.x == b.point1.x+b.point2.x) {
return a.point1.y+a.point2.y <... | ALGO | 0.999787 | 4.265292 |
9baf7a3c-3e64-4e10-ae8b-91d0b40569aa | ishandutta2007/codeforces | dk1227/normal/1566/A.cpp | #include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <ctime>
#include <chrono>
#include <random>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unorder... | ALGO | 0.999747 | 3.533992 |
f99c6676-a0d7-4753-94dd-a1027ba35506 | harshit-jain52/CP_DSA | atcoder/abc398_e.cpp | #include <bits/stdc++.h>
using namespace std;
// #define endl '\n'
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
const int M = 1e9+7;
const int N = 105;
#define F first
#define S second
vector<int>g[N];
vector<int>bw[2];
void dfs(int v, int par, int col){
bw[col]... | ALGO | 0.999905 | 4.210147 |
f42dec1a-e51e-42d9-935e-5277de37c429 | iamtejasrg/LeetCodeChallenge | SimplifyPath/main.cpp | class Solution {
public:
string simplifyPath(string path) {
int n=path.length();
stack<string>s;
if(path[n-1]!='/') // so that initially path always ends with '/'
path+="/", ++n;
int i=1; // since path always starts from '/'
string a... | ALGO | 0.999676 | 5.930438 |
87a6e4a4-fcda-474f-b8d8-3ea37fe95185 | vidsinghal/Cornucopia | HashEnabledLLVM/pstl/test/std/algorithms/alg.nonmodifying/find_if.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// Tests for find_if and find_if_not
#include "support/pstl_test_config.h"
#include <execution>
#include <algorithm>
#include "support/utils.h"
using namespace TestUtils;
struct test_find_if
{
#if _PSTL_ICC_17_VC141_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN || ... | TEST | 0.852765 | 7.360233 |
7874c982-2286-4f77-846b-0996df80f61c | mkltaneja/Leetcode | Weekly_Contest_#338/2603. Collect Coins in a Tree.cpp | class Solution {
public:
int collectTheCoins(vector<int>& coins, vector<vector<int>>& edges)
{
int n = coins.size();
vector<vector<int>> gp(n);
vector<int> deg(n);
queue<int> que;
vector<int> childCoins;
vector<bool> isIncluded(n, true);
for(vec... | ALGO | 0.999786 | 5.354165 |
216b1e33-6375-4561-92d5-c93ac4bb9cd0 | wldhks1959/Algorithm | 프로그래머스/1/12935. 제일 작은 수 제거하기/제일 작은 수 제거하기.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> arr)
{
vector<int> answer;
for(int i=0;i<arr.size();i++)
{
answer.push_back(arr[i]);
}
sort(answer.begin(), answer.end(), greater<int>());
int min = answer[answer.size()-1];
... | ALGO | 0.999842 | 5.052516 |
fbb7e806-026f-4cb4-a6bb-5aac75f1706b | sarthakpy7/Leetcode | 0049-group-anagrams/0049-group-anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> mp;
for(auto x: strs){
string word = x;
sort(word.begin(), word.end());
mp[word].push_back(x);
}
vector<ve... | ALGO | 0.999994 | 6.511064 |
43f85764-e897-4403-8aad-5e40bea8f5cf | suvammohapatra93/CodeForces-CPP-800-900 | Super_Agent.cpp | #include <iostream>
using namespace std;
int main()
{
char grid[3][3];
// Read the input grid
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cin >> grid[i][j];
}
}
// Check for central symmetry
// For a pattern to be centrally symmetric, if... | ALGO | 0.999983 | 5.621287 |
4c3a1452-7bb3-4eea-95c0-389f38272263 | ishandutta2007/codeforces | jtnydv25/normal/959/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define pii pair<int, int>
#define F first
#define S second
int main(){
int n;
scanf("%d", &n);
if(n <= 5) printf("-1\n");
else{
printf("1 2\n");
for(int i = 3; i <= n; i++){
printf("%... | ALGO | 0.99985 | 3.542862 |
e35d424e-a53f-462c-9a31-73bd5d69d09b | ishandutta2007/codeforces | teapotd/normal/713/D.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#ifdef LOC
#include "debuglib.h"
#else
#define deb(...)
#define DBP(...)
#endif
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Pii = pair<int, int>;
#define pb push_back
#define mp make_pair
#de... | ALGO | 0.999959 | 4.271237 |
6606ada5-b381-49eb-9298-7105bce58b9d | jgbby/topoprinter | Marlin/src/feature/meatpack.cpp | /**
* MeatPack G-code Compression
*
* Algorithm & Implementation: Scott Mudge - <EMAIL>
* Date: Dec. 2020
*
* Character Frequencies from ~30 MB of comment-stripped G-code:
* '1' -> 4451136 '4' -> 1353273 '\n' -> 1087683 '-' -> 90242
* '0' -> 4253577 '9' -> 1352147 'G' -> 1075806 'Z' -> 34... | TOOL | 0.940993 | 5.899114 |
58930277-e667-4e0e-9080-ec82a31ec3e3 | zhongwuhunter/HomewardJourney | Code/Tools/Global.cpp | #include "Global.h"
#include "VectorCustom.h"
// right hand coord system
// eye = `镜头位置`
// lookat = `镜头对准的位置`
// up = `镜头正上方的方向`
Matrix4x4 GutMatrixLookAtRH(Vector3 &eye, Vector3 &lookat, Vector3 &up)
{
Vector3 up_normalized = Vector3Normalize(up);
Vector3 zaxis = eye - lookat; zaxis.Normalize();
Vector3 xaxis = V... | TOOL | 0.88064 | 5.524079 |
8e40372b-f816-4daa-8289-54a24971695f | RAM909/Leetcode | 0055-jump-game/0055-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
int maxl = 0;
for(int i=0;i<nums.size() ; i++){
if(i> maxl){
return false;
}
maxl = max(maxl,i + nums[i]);
}
return true;
}
}; | ALGO | 0.999987 | 6.063159 |
a03775f0-8f1a-4732-831c-0ede896afb9d | ishandutta2007/codeforces | m_99/normal/965/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000000
int main() {
int w,l;
scanf("%d %d",&w,&l);
vector<int> a(w);
for(int i=0;i<w-1;i++)scanf("%d",&a[i]);
a[w-1] = 1000000001;
vector<int> cnt(w,0);
for(int... | ALGO | 0.999985 | 3.254655 |
0fbfac17-e5ae-468f-99f3-b6be9e14ee8e | ldcduc/leetcode-training | cpp/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix.cpp | /*
* Problem url: https://leetcode.com/problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix/
* Code by ldcduc
* */
class Solution {
private:
int m, n;
public:
int flip(int state, int x, int y) {
int result = state;
int index = x * this->n + y;
result = result = r... | ALGO | 0.999995 | 6.314382 |
f8e55987-4246-40ac-b6ad-54da8781378b | ntsis/cvc5-omt-extension | src/theory/arith/nl/iand_utils.cpp | #include "theory/arith/nl/iand_utils.h"
#include <cmath>
#include <limits>
#include "cvc5_private.h"
#include "theory/arith/nl/nl_model.h"
#include "theory/rewriter.h"
#include "util/rational.h"
using namespace cvc5::internal::kind;
namespace cvc5::internal {
namespace theory {
namespace arith {
namespace nl {
sta... | ALGO | 0.999197 | 6.777378 |
7523cf89-9d4b-4af2-b13a-8d08bb558175 | hauxir/mupen64plus.js | boost_1_59_0/libs/geometry/doc/src/examples/algorithms/relate.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
//[relate
//` Shows how to detect if a point is inside a polygon, or not
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hp... | ALGO | 0.997106 | 6.485822 |
23cc4be1-33a4-4d7e-9536-1f7dab8aa3d8 | mirinta/leet_code | binary_search/1060_missing_element_in_sorted_array.cpp | #include <vector>
/**
* Given an integer array nums which is sorted in ascending order and all of its elements are unique
* and given also an integer k, return the kth missing number starting from the leftmost number of
* the array.
*
* ! 1 <= nums.length <= 5 * 10^4
* ! 1 <= nums[i] <= 10^7
* ! nums is sorted ... | ALGO | 0.999943 | 5.819921 |
8696a6fa-4f79-4b1f-86a7-04c689f913e2 | ishandutta2007/codeforces | frodakcin/normal/1295/F.cpp | #include <cstdio>
#include <algorithm>
using ll = long long;
#define tl(X) static_cast<ll>(X)
#define ti(X) static_cast<int>(X)
const int MOD = 998244353;
const int INF = 1e9;
const int MN = 60;
struct mint
{
public:
int v;
mint(int init = 0) : v(init)
{
if(v < 0) v = ti((v+tl(MOD)*1000)%MOD);
if(MOD <= v) v ... | ALGO | 0.9999 | 4.266922 |
ced37059-3c81-4b2a-9ece-368bb5ed1871 | K111DK/CMU15445FALL23 | src/optimizer/order_by_index_scan.cpp | #include <algorithm>
#include <memory>
#include "binder/bound_order_by.h"
#include "catalog/catalog.h"
#include "catalog/column.h"
#include "catalog/schema.h"
#include "common/exception.h"
#include "common/macros.h"
#include "execution/expressions/column_value_expression.h"
#include "execution/expressions/constant_val... | ALGO | 0.995166 | 7.49478 |
2cb7c6be-5ef8-4846-a74f-f621ec7aeed1 | mdhlimonmia/Codeforces_Problem_Solution | B_Flag_Day.cpp | /// *** --- ||| In the name of ALLAH ||| --- *** ///
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, doubl... | ALGO | 0.999984 | 3.844003 |
37e96e65-f222-4853-9708-52ae6a151843 | sahil-kale/basilisk-actuator-control-lib | control_loop/bldc/foc/math_foc.cpp | #include "math_foc.hpp"
#include "math.h"
#include "math_util.hpp"
namespace math {
alpha_beta_t clarke_transform(float a, float b, float c) {
// Note: uses simplification that ia + ib + ic = 0 to derive the simplified version
alpha_beta_t result;
result.alpha = a;
result.beta = (b - c) / sqrt_3;
... | ALGO | 0.999336 | 7.461453 |
a0f8b55a-fec1-49da-abb2-504a8bcbcbc8 | jennybehre/Control_and_Trajectory_Tracking_for_Autonomous_Vehicle | project/pid_controller/eigen-3.3.7/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999398 | 3.497552 |
81cfe72c-40ad-4340-9f7a-c911ca0d9543 | Abinayaasree-KS/LeetCode | 605-can-place-flowers/can-place-flowers.cpp | class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
if(n == 0)
return true;
for(int i = 0; i < flowerbed.size(); i++)
{
if(flowerbed[i] == 0 && (i == 0 || flowerbed[i - 1] == 0) && (i == flowerbed.size() - 1 || flowerbed[i + 1] == 0)){
... | ALGO | 0.999985 | 6.730821 |
f95f9962-a95c-40e1-bb7b-81cc461a9474 | Andrew-Kwok/CSES | Dynamic Programming/Increasing Subsequence.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second
#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";
typedef long long ll;
typedef long double ld;
typedef pair<int, in... | ALGO | 0.999986 | 4.47824 |
39fab473-ff4d-44aa-9a1e-6a3d0ea0c87c | GaurangMundhra/DSA | rushi/DS/selection_sort.cpp | #include <bits/stdc++.h>
using namespace std;
void selection_sort(int arr[], int n)
{
for (int i = 0; i < n - 1; i++)
{
int mini = i;
for (int j = i + 1; j < n; j++)
{
if (arr[j] < arr[mini])
{
mini = j;
}
}
int temp ... | ALGO | 0.999767 | 5.104731 |
6809ab16-1ddd-4fdc-9760-f2d5d0c1855b | shivam-72/DSACodes | 0084-largest-rectangle-in-histogram/0084-largest-rectangle-in-histogram.cpp | class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
int n=heights.size();
stack<int>s;
int mx=0;
for(int i=0;i<n;i++){
if(s.size()==0||heights[s.top()]<heights[i]){
s.push(i);
}
else{
while(s.size()>0&&heig... | ALGO | 0.999959 | 6.508688 |
a2edc6d4-df38-4c6a-8cae-33f83b4fe8f9 | ahmetilgin/matrixproduct | tranzpozeDoubleTekThread.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <pthread.h>
using namespace std;
double matrixA[1000][1000];
double matrixB[1000][1000];
double matrixC[1000][1000];
double transpozeMatris[1000][1000];
void matrisleriDoldur(int);
void seriCarpim(int);
void paralelCarpim(int);
void *c... | ALGO | 0.999621 | 3.690957 |
de3aefbe-d364-4eca-8033-3ead194e9591 | Smaran1832/DSA | demo.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> arr;
while(n--){
int x;
cin>>x;
arr.push_back(x);
}
cout << "Before sort: " << "\n";
for (int i = 0; i < arr.size(); i++) {
cout << arr[i] << " ";
... | ALGO | 0.999866 | 4.291659 |
57169bb5-77d3-499a-b939-9d6b1e489442 | alkaidL/UVaOJ | LeetCode/#110BalancedBinaryTree.cpp | #include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int depth(TreeNode* root)
{
if(!root) return 0;
return max(depth(root->left), depth(root->right)... | ALGO | 0.999952 | 6.155135 |
b65127ab-8fa5-4c56-9d71-c03fa8ad90cb | SagarMedtiya/DSA-in-c-plus-plus | Recursion/PrintNto1.cpp | #include<bits/stdc++.h>
using namespace std;
void Nto1(int n){
if(n==0){
return;
}
cout<<n<<endl;
Nto1(--n);
}
int main(){
int n;
cin>>n;
Nto1(n);
return 0;
} | ALGO | 0.999953 | 4.400117 |
7892236d-c079-4a6c-9a74-7781c24b9902 | oscarmampel/opencv_js_patch | samples/cpp/tutorial_code/snippets/core_various.cpp | #include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
using namespace std;
using namespace cv;
int main()
{
//! [Algorithm]
Ptr<Feature2D> sbd = SimpleBlobDetector::create();
FileStorage fs_read("SimpleBlobDetector_params.xml", FileStor... | ALGO | 0.952959 | 6.393916 |
484b0c4f-b682-49af-a757-93784948c60f | SundeepChand/DSA-Practice | Codeforces/1000-1400/4.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FF first
#define SS second
#define endl "\n"
typedef long long ll;
typedef unsigned long long ull;
#define int ll
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin)... | ALGO | 0.999875 | 3.649869 |
981c8637-ef4c-48b4-88c3-7f90676d4cba | vignatej/DataStructutesTemplate | AVL.cpp | #include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
int depth(TreeNode *t){
if(!t) return 0;
int ... | ALGO | 0.999631 | 4.94746 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.