uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
127f3bd7-c088-4b15-8751-f2c8d4edd3e8 | Ricursu/C-Test-Lesson | 拓扑排序/topusort-5.cpp | #include <iostream>
#include <vector>
#include <string.h>
#include <queue>
#include<algorithm>
#include<functional>
using namespace std;
int n,m;
int in[501],out[501];
int main(){
while ( scanf("%d%d",&n,&m) != EOF ){
vector<int> vec[501];
priority_queue<int, vector<int>, greater<int> > q;
... | ALGO | 0.999997 | 3.972583 |
e75b3174-eff6-4938-b276-ccb220b2c41d | ishandutta2007/codeforces | heno239/normal/1202/C.cpp | #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
usi... | ALGO | 0.999889 | 4.239065 |
2ed122c1-e194-4a76-9f86-2c245aefa582 | Tingwei0512/llvm-19 | libc/src/math/amdgpu/rint.cpp | #include "src/math/rint.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, rint, (double x)) { return __builtin_rint(x); }
} // namespace LIBC_NAMESPACE_DECL
| TOOL | 0.959381 | 6.128606 |
82bac747-8c69-43cc-8759-dbf0ad1d50fe | kagan019/competitive-programming | Codeforces/443A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
char c; cin >> c;
set<char> letters;
cin >> c;
while (c != '}') {
letters.insert(c);
cin >> c; // ,
cin >> c;
}
cout << letters.size();
} | ALGO | 0.99527 | 3.785189 |
7de8fce4-dab8-4a7d-bf70-f8683fc3a7bd | Dsxv/competitveProgramming | help/kartikey/tcs/b.cpp | #include <bits/stdc++.h>
using namespace std ;
#define int long long
int32_t main(){
int n;
cin >> n ;
if(n <= 0 || n > 1e5) {
cout << "Wrong Input" ;
return 0 ;
}
vector<int> v ;
int x ;
while(cin >> x){
v.push_back(x) ;
if(x <= 0 || x > 1e5){
cout << "Wrong Input" ;
return 0 ;
}
}
if(v.size... | ALGO | 0.99989 | 3.429759 |
2317ed13-f61f-4542-b346-72376a365190 | shaafsalman/Data-Structures | Heap/Updated_DS_PA3/.history/DS_PA3/Task 2/heap_20241110141521.cpp | #ifndef __HEAP_CPP
#define __HEAP_CPP
#include "heap.h"
#include <memory>
#include <climits>
#include <iostream>
// Constructor: Initializes the heap with the given capacity and allocates memory for the heap array.
MinHeap::MinHeap(int cap)
{
capacity = cap;
heap_size = 0;
harr = std::shared_ptr<int>(new ... | ALGO | 0.993911 | 6.158615 |
62607ddc-3efe-4600-bed2-1ed441770d38 | qcorcoran/MIS-Project | navigatingRiver/splayTree.cpp | //Quinn Corcoran
//navigatingRiver
#include "splayTree.h"
using namespace std;
//destructor
splayTree::~splayTree(){
while(root != NULL){
splayDelete(root);
}
}
//recursive insert
void splayTree::insert(splayNode* n, splayNode* current){
//if the tree is empty set the inserted node as the root
... | ALGO | 0.999873 | 3.813515 |
90219894-1aa5-4978-a724-9ca3fc1249c5 | reiya0104/AtCoder | ABC/ABC001/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int m;
int vv = 0;
cin >> m;
if (m < 100) {
vv = 0;
} else if (m <= 5000) {
vv = m / 100;
} else if (m <= 30000) {
vv = m / 1000 + 50;
} else if (m <= 70000) {
vv = ((m / 1000) - 30) / 5 + 80;
} e... | ALGO | 0.998996 | 3.797895 |
ed2db538-ee8f-4bc9-b858-d1302123bf9c | peonyCoin/Peony | src/kernel.cpp | #include <boost/assign/list_of.hpp>
#include "kernel.h"
#include "txdb.h"
using namespace std;
extern int nStakeMaxAge;
// Get time weight
int64_t GetWeight(int64_t nIntervalBeginning, int64_t nIntervalEnd)
{
// Kernel hash weight starts from 0 at the min age
// this change increases active coins participat... | ALGO | 0.996947 | 6.077336 |
15613ccd-e205-4218-9a01-36ac2f39be16 | XerAlix04/BT_Algo | sort.cpp | #include <bits/stdc++.h>
using namespace std;
//Counting sort
vector<int> countSort(vector<int>& inputArray)
{
int N = inputArray.size();
// Finding the maximum element of array inputArray[].
int M = 0;
for (int i = 0; i < N; i++)
M = max(M, inputArray[i]);
// Initializing countArray[]... | ALGO | 0.999981 | 5.521351 |
228427b8-fff2-4934-9ac8-1e08d63c912e | DemonB95/Code | B_Square_.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
#define pb push_back
#define va(a) a.begin(), a.end()
#define vd(d) d.begin(), d.end(), greater<ll>()
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define pii pair<int, int>
#define si set<int>
#d... | ALGO | 0.999932 | 3.714559 |
ab222f8e-fa72-4a59-a002-f062ebbc96d6 | vigneshvaranasi/Advanced_DS_using_CPP | Hashing/Additional programs/HackerRank Problems/1.Sherlock and Anagrams.cpp | #include <iostream>
#include <unordered_map>
#include <algorithm>
using namespace std;
int sherlockAndAnagrams(string s) {
int n = s.length();
unordered_map<string, int> substringFrequency;
for (int i = 0; i < n; i++)
{
string substring;
for (int j = i; j < n; j++)
{
... | ALGO | 0.999977 | 5.432715 |
20053559-35dc-4a33-8932-92455b4b747f | ssbadjate02/Competetive-Programming | C_Madoka_and_Childish_Pranks.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) (x).begin(),(x).end()
#define ss second
#define ff first
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typ... | ALGO | 0.99976 | 3.567128 |
1f221f30-0862-40fa-96c6-670b96dcd7b5 | whxcode/cpp_data | src/mk-hash.cpp | #include "../include/mk-hash.hpp"
#include <queue>
#include <stack>
static void levelEach(const TreeNode* root) {
std::queue<const TreeNode*> queue;
queue.push(root);
while (!queue.empty()) {
const auto& value = queue.front();
queue.pop();
printf("[%d] ", value->fValue);
... | ALGO | 0.935764 | 4.011664 |
2217db31-bd7e-4125-aa52-b5a0e96cd75a | AdrianKlessa/CGProject | dependencies/physx-4.1/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp | #include "geomutils/GuContactBuffer.h"
#include "GuGJKPenetration.h"
#include "GuEPA.h"
#include "GuVecConvexHull.h"
#include "GuVecConvexHullNoScale.h"
#include "GuGeometryUnion.h"
#include "GuContactMethodImpl.h"
#include "GuPCMShapeConvex.h"
#include "GuPCMContactGen.h"
namespace physx
{
using namespace Ps::ao... | ALGO | 0.990575 | 6.530794 |
e131b235-9925-423a-969c-2c7dbe046abc | tonoysheikh/comparative-programming-cpp- | codeforce/Forever Winter.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
vector<int>v[205];
for(int i=1;i<=m;i++)
{
int a,b;
cin>>a>>b;
v[a].push_back(b);
v[b].push_back(a);
... | ALGO | 0.999827 | 4.508013 |
51a69f33-2b4e-42c0-8307-10d991625921 | 948CSheLL/my_stl_study | algorithm/non-modifying.cpp | /*
by bLue
Last Updated: 03/23/2017
*/
#include <cstdio>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[]) {
int a[6] = {3, 2, 1, 2, 3, 3};
// find(begin, end, key) 返回第一个等于 key 的元素的迭代器
printf("find\n");
printf("查找 1,下标为:%ld\n", find(a, a+6, 1)-a);
printf("查找 2,下标为:%ld\n", find(a, ... | ALGO | 0.999026 | 3.769024 |
6f46227c-23cd-4b7f-8ea9-2f85fc1b4c8d | Anujjha19/cpp | B_ZigZag_Traversal.cpp | // Function to store the zig zag order traversal of tree in a list.
#include<bits/stdc++.h>
using namespace std ;
vector<int> zigZagTraversal(Node *root)
{
vector<int> result;
if (root == NULL) return result;
queue<Node *> q;
q.push(root);
bool leftToRight = true;
while (!q.empty())
{
... | ALGO | 0.999999 | 5.561309 |
e715bf7b-9073-4158-bbe8-4c4ac71ff829 | ksinghsengar/CP | Trees/is_tree_balanced.cpp | /* A binary tree node structure
struct Node
{
int data;
struct Node* left;
struct Node* right;
Node(int x){
data = x;
left = right = NULL;
}
};
*/
int height(Node* node){
if(node == NULL) return 0;
return 1+max(height(node->left), height(node->right));
}
// This func... | ALGO | 0.999901 | 5.441626 |
1ff394a3-f0b5-4b66-b8a5-808b583f429e | tbuchs/webSPDZ | FHEOffline/DistKeyGen.cpp | /*
* DistKeyGen.cpp
*
*/
#include <FHEOffline/DistKeyGen.h>
#include "Tools/Subroutines.h"
#include "Math/modp.hpp"
/*
* This creates the "pseudo-encryption" of the R_q element mess,
* - As required for key switching.
*/
void Encrypt_Rq_Element(Ciphertext& c,const Rq_Element& mess, const Random_Coins& rc,
... | TOOL | 0.995918 | 3.594136 |
d8fa3a50-5c12-413e-a033-aa79e5fe712f | Shahid-Khan2019/Programming-Fundamentals-PF-in-Cpp | Q-18/Q-18.cpp | #include<iostream>
using namespace std;
int main() {
int rows, cols, i,j;
cout<< "Enter number of rows: ";
cin>> rows;
cout<< "Enter number of columns: ";
cin>> cols;
int a[rows][cols], b[rows][cols], c[rows][cols];
cout<< "Enter Elements of 1st Matrix: \n";
for(i=0; i<rows; i++){
for(j=0; j<cols; j++){
... | ALGO | 0.99947 | 4.4673 |
86e68a4a-1a19-4a1c-a27f-5043a08a28f3 | abdelqayyim/C-Tic-Tac-Toe | build-mac/Boost/libs/geometry/test/robustness/within/partition_within.cpp | #include <boost/geometry.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp>
#endif
#includ... | ALGO | 0.998911 | 7.684394 |
68df2ce9-4a1b-493d-b15c-be92b9159686 | aayush2761/Leetcode_prob | 0143-reorder-list/0143-reorder-list.cpp | class Solution {
public:
void reorderList(ListNode* head) {
if (!head || !head->next || !head->next->next)
return; // No need to reorder if the list has 0, 1, or 2 nodes
// Step 1: Find the middle of the list
ListNode *slow = head, *fast = head;
while (fast->next... | ALGO | 0.999992 | 6.5825 |
07ad0aba-9ffd-4bfc-afc8-abe566452395 | ritiktiwari0208/Practice-Questions | practice/practice31.cpp | #include <iostream>
using namespace std;
int main(){
/*// sqrt[x]
int target=40;
int start=0 , end=target, mid , ans;
while(start<=end){
mid=start+(end-start)/2;
if (mid*mid==target)
{
ans=mid;
break;
}
else if(mid*mid<target){
s... | ALGO | 0.999705 | 3.893087 |
5b4a7e83-de1a-43a2-bcb4-36b56a8bd72d | HypoxanthineOvO/ComputerArchitecture2-Labs | src/MainCache.cpp | /*
* The main entry point of single level cache simulator
* It takes a memory trace as input, and output CSV file containing miss rate
* under various cache configurations
*
* Created by He, Hao at 2019-04-27
*/
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#inclu... | TOOL | 0.868869 | 5.700147 |
bdb3699a-b359-46ab-89fc-ca810d6da76b | ambujmishra0008/Competitive-programming | Binary Search.cpp | #include<bits/stdc++.h>
using namespace std;
int idx;
int bs(int *arr, int st, int end, int x)
{
if(end>=st)
{
int mid = st + (end-st)/2;
if(arr[mid]==x)
return mid;
else if(arr[mid]<x)
return bs(arr,mid+1,end,x);
else if(arr[mid]>x)
return bs(arr,st,mid-1,x);
}
else
return -1;
}
int main... | ALGO | 0.999968 | 5.040418 |
07027717-8391-484e-8fc6-f78f0580a89a | streichgeorg/meshless_deformations | extern/libigl/include/igl/cotmatrix.cpp | // For error printing
#include <cstdio>
#include "cotmatrix_entries.h"
// Bug in unsupported/Eigen/SparseExtra needs iostream first
#include <iostream>
template <typename DerivedV, typename DerivedF, typename Scalar>
IGL_INLINE void igl::cotmatrix(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<D... | ALGO | 0.998499 | 5.784038 |
6c65dca5-5ed6-4159-aeb7-d02de96d760d | utkarshmaken/cp | codeforces educational/94/B.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define f(i,a,b) for(int i = a;i<b;i++)
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define fd(i,a,b) for(int i = a;i>b;i--)
#define repd(i,a,b) for(int i = a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define ... | ALGO | 0.999909 | 3.519513 |
d15bc210-adb1-44d1-821f-b0e6e6243c65 | squaresLab/BatFix | results/transcoder/translations/py/COUNT_WAYS_INCREASE_LCS_LENGTH_TWO_STRINGS_ONE.cpp | int waysToIncreaseLCSBy1 ( string str1 , string str2 ) {
int m = str1 . length ( ) ;
int n = str2 . length ( ) ;
vector < vector < int >> position ( M ) ;
for ( int i = 1 ;
i <= n ;
i += 1 ) {
position [ ( unsigned char ) ( str2 [ i - 1 ] ) - 97 ] . push_back ( i ) ;
}
vector < vector < int >> lcsl ... | ALGO | 0.99981 | 4.518734 |
5f200621-93fa-430d-8915-5f3c9dd9cfd2 | AdityaKarn/cp-cpp | codechef/MAY20/CORUS.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define REP(i, n) for (int i = 1; i <= n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define INF 10000... | ALGO | 0.999763 | 4.030752 |
7477e6e4-5c92-43cb-a870-6578affc30a9 | jayin92/competitive-programming | contest/1279/pA.cpp | // #include <bits/stdc++.h>
// using namespace std;
// int main(){
// int t;
// cin >> t;
// while(t--){
// long long a, b, c;
// cin >> a >> b >> c;
// long long m = min(min(a, b), c);
// a -= m;b -= m;c -= m;
// if(a == 0){
// if(abs(b - c) <= m){
// ... | ALGO | 0.999976 | 4.682438 |
92fda63b-dd26-44fa-98f7-c3504df08c57 | avdhut0923/tcs-A-TO-Z-dsa | tcs_A-to-Z_dsa/01patterns/01p.cpp |
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
void printPattern(int n){
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<"*";
}
cout<<endl;
}
}
int main() {
// Write C++ code here
int n;
cout<<"enter no. of rows "<... | ALGO | 0.998802 | 4.812928 |
1fd45ed8-7c2f-43b3-b537-c02aa9342478 | bexcite/apolloscape-sfm | lib/assimp-4.1.0/code/Subdivision.cpp | #include "Subdivision.h"
#include <assimp/SceneCombiner.h>
#include "SpatialSort.h"
#include "ProcessHelper.h"
#include "Vertex.h"
#include <assimp/ai_assert.h>
#include <stdio.h>
using namespace Assimp;
void mydummy() {}
// ---------------------------------------------------------------------------------------------... | ALGO | 0.996448 | 6.846094 |
6a4b08a9-1767-49a5-b952-7f7853624b41 | mostafa-saad/ArabicCompetitiveProgramming | 18-Programming-4kids/15_homework_02_answer.cpp | #include<iostream>
using namespace std;
int my_pow(int value, int p = 2) {
if (p == 0)
return 1;
return value * my_pow(value, p - 1);
}
int main() {
cout << my_pow(7) << "\n";
cout << my_pow(7, 0) << "\n";
cout << my_pow(7, 3) << "\n";
return 0;
}
| ALGO | 0.99949 | 5.298264 |
ce295343-3cff-4ced-91b5-c76e9eaadf05 | ganeshskudva/Algorithms | Codechef/Beginner/REMISS.cpp | #include <bits/stdc++.h>
typedef unsigned long long int ll;
using namespace std;
#define GETCHAR getchar_unlocked
inline ll readInt()
{
ll n = 0;
char c;
while (1)
{
c=GETCHAR();
if(c=='\n'||c==' ') break;
n = n * 10 + c - '0';
}
return n;
}
ll max(ll a, ll b)
{
return a>b?a:b;
}
i... | ALGO | 0.999707 | 4.449224 |
32b4814c-a57f-4012-a63b-1ebd9cb153ee | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/16/22/15.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pb push_back
#define pii pair < int, int >
#define x first
#define y second
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<
using namespace std;
cons... | ALGO | 0.999982 | 3.962696 |
6a6513d9-38dd-4266-bfc4-91dd4976a229 | dee-jay3028/Programming-Assignments | homework3-1001-Johnson-Daxton/driver.cpp | #include "linkedStack.h"
#include "arrayStack.h"
#include <iostream>
#include <string>
std::string parseInfix(std::string);
int order(char);
float evaluatePost(std::string);
int main() {
std::string input;
std::string postfix;
std::cout<<"Please enter expression (NO SPACES) or enter DEFAULT to use (5+6)... | ALGO | 0.998388 | 5.109455 |
5197718c-388f-4925-8f99-976992d83298 | ElinaMukhamedova/Elina_5sem | Celestial mechanics/example_gravity/GeographicLib/examples/example-Intersect.cpp | // Example of using the GeographicLib::Intersect class
#include <iostream>
#include <exception>
#include <GeographicLib/Intersect.hpp>
#include <GeographicLib/Constants.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
Int... | ALGO | 0.951301 | 5.714787 |
216aef30-58ad-476f-8ac0-c6cc7197b6c9 | bfay1/codeforces | contests/153/not-a-substring.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
string s;
cin >> s;
if (s == "()") {
cout << "NO\n";
return;
} else {
cout << "YES\n";
}
string x = "";
string y = "";
for (int i = 0; i < s.size(); i++)
x += "(", y ... | ALGO | 0.999808 | 4.403203 |
793c8322-2919-43e3-b299-709bfc2a4f4a | old-yan/leetcode-solutions | leetcode_solutions/leetcode_1900/1854/1854.cpp | #include "utils.h"
class Solution {
public:
int maximumPopulation(vector<vector<int>>& logs) {
int inc[2100]={0};
for(auto&l:logs){
inc[l[0]]++;
inc[l[1]]--;
}
partial_sum(inc,inc+2100,inc);
return max_element(inc,inc+2050)-inc;
}
};
int main()
{... | ALGO | 0.998227 | 5.199598 |
016e3876-55f2-43e9-b419-aaf3726445f5 | NoobMaster-96/Codeforces | Contests/Round_659/ProblemC.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
int main(){
int t;
cin>>t;
while(t--){
int a = 3;
cout<<(a&1)<<endl;
}
} | ALGO | 0.999527 | 3.86864 |
8bdb85fe-2eb7-4afa-9c18-5b7980d1194a | maximqaxd/hlsdk-portable_dc | dlls/h_ai.cpp | /*
h_ai.cpp - halflife specific ai code
*/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "game.h"
#define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a monster looking for lateral cover
#define NUM_LATERAL_LOS_CHECKS 6 // how many checks are m... | ALGO | 0.997882 | 6.318164 |
c1f8125d-0c72-45e9-9f85-12201b0c63ae | DominicS99/Competitive-Programming | Leetcode/1528: Shuffle String.cpp | class Solution {
public:
string restoreString(string s, vector<int>& indices) {
for (int i = 0; i < s.length(); i++) {
while (i != indices[i]) {
swap(s[i], s[indices[i]]);
swap(indices[i], indices[indices[i]]);
}
}
return s;
}
};
| ALGO | 0.999907 | 6.283142 |
26b6f2a3-9233-4edb-adb0-b9dcc12ac7c8 | abishekshyamsunder/LeetCode | Maximum_sum_circular_subarray.cpp | class Solution {
public:
int maxSubarraySumCircular(vector<int>& nums) {
vector<int> track(nums.size(),0);
vector<int> track_max(nums.size(),INT_MIN);
int min_sum = 0;
int max_sum = INT_MIN;
int sum = 0;
for(int i=0;i<nums.size();i++)
{
sum = sum+n... | ALGO | 0.999978 | 5.630736 |
3047a0a0-6ff4-4747-a9d4-9f026cf752c9 | sariug/parallel_computing_exercises | 30_10_2019/find_pass/main.cpp | /*
A simple program to find a number using threads library.
Author: Uğurcan Sarı, Oguz Oztoprak
Date : 30.10.2019
*/
#include <iostream>
#include <vector>
#include <thread>
#include <chrono>
/*
* Function to find the password. If the password is equal to
* counter, then the reference value is changed.
*/
void... | ALGO | 0.997981 | 3.558563 |
bb57b34c-0fe4-4b65-8eae-3d4d5ddfed2b | lokesh2021/MyCompetitiveGist | Programming/challenges/max_subarray_sum.cpp | #include <iostream>
using namespace std;
int main()
{
int n = 4;
int arr[n] = {-1, -2, -3, -4};
int mx = -2147483648;
for (int i = 0; i < n; i++)
{
int sum = 0;
for (int j = i; j < n; j++)
{
sum += arr[j];
// cout << sum << endl;
mx = max(... | ALGO | 0.999982 | 4.412661 |
90ff732c-0ef8-4ed9-bb9e-12dff476032e | VishalPatil18/My-CPP-Solutions | Leetcode/367. Valid Perfect Square.cpp | // My Solution
class Solution {
public:
bool isPerfectSquare(int num) {
long long low = 1, high = num;
long long mid;
while(low <= high){
mid = low + (high-low)/2;
if(mid*mid == num) return true;
else if(mid*mid < num) low = mid+1;
else if(mid*... | ALGO | 0.99996 | 5.648587 |
8f8676a9-b688-4361-b79b-b31485c6409d | ishandutta2007/codeforces | thenymphsofdelphi/normal/801/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string a, b, c;
int n;
cin >> a >> b;
c = b;
n = a.length();
for (int i = 0; i < n; i++){
if (b[i] > a[i]){
cout << -1;
return 0;
}
if (b[i] == a[i]){
c[i] = 'z';
}
}... | ALGO | 0.99999 | 3.864898 |
f6c5e104-6f21-45e1-acf6-0c0da4c49b75 | apratimjaiswal/prep | cpp/LCO/1_Arrays/2_PivotInRotatedArray.cpp | #include<bits/stdc++.h>
using namespace std;
int findPivot(int arr[], int low, int high) {
int mid = -1;
while (low <= high) {
mid = low + ((high - low)/2);
if (arr[mid + 1] < arr[mid]) {
return (mid+1);
// return arr[mid+1];
}
if (arr[mid] < arr[mid-1]) ... | ALGO | 0.999815 | 5.276831 |
bef93128-e180-4aa3-832f-fffeacdf932f | DavidJPlummer/CPP | src/route_model.cpp | #include "route_model.h"
#include <iostream>
RouteModel::RouteModel(const std::vector<std::byte> &xml) : Model(xml) {
// Create RouteModel nodes.
int counter = 0;
for (Model::Node node : this->Nodes()) {
m_Nodes.emplace_back(Node(counter, this, node));
counter++;
}
CreateNodeToRoadH... | ALGO | 0.86092 | 5.335826 |
5678ad12-a1f4-4d6e-a94a-3acfed6d6b3a | ishandutta2007/codeforces | vladprog/normal/1227/C.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define mp make_pair
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
using namespace std;
#define int ll
typedef long long ll;
typedef long doubl... | ALGO | 0.999611 | 3.782965 |
5a8db397-6c8c-4ee4-85dc-dc49ad203ff4 | phanan04/Code-PTIT | SPOJ PTIT/P135SUME.cpp | // https://www.spoj.com/PTIT/problems/P135SUME/
// P135SUME - SUM5 E - Bản nhạc
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v(8);
for (int i = 0; i < 8; i++)
cin >> v[i];
if (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4 && v[4] == 5 && v[5] == 6 && v[6] == 7 && v[7] ... | ALGO | 0.999962 | 4.02993 |
0ea8d637-4957-4dda-a438-8629e1adb386 | venkyman/graphics-iteratedfunctionsystems | src/texture.cpp | #include "texture.h"
#include <assert.h>
#include <iostream>
#include <algorithm>
using namespace std;
namespace CMU462 {
inline void uint8_to_float( float dst[4], unsigned char* src ) {
uint8_t* src_uint8 = (uint8_t *)src;
dst[0] = src_uint8[0] / 255.f;
dst[1] = src_uint8[1] / 255.f;
dst[2] = src_uint8[2] ... | ALGO | 0.978461 | 5.842406 |
11951ea4-7355-4030-aef9-dee8434f4904 | wgoni/BOJ | BOJ/sources/1/0000/10813.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
void swap(int *arr, int n1, int n2) {
int tmp = arr[n1];
arr[n1] = arr[n2];
arr[n2] = tmp;
}
int main() {
freopen("10813.txt", "r", stdin);
cin.tie(0), ios::sync_with_stdio(0);
int N, M;
int num_arr[101];
cin >> N >> M;
for (int i = ... | ALGO | 0.999976 | 4.078607 |
0b976ed2-d1cb-41d9-aedd-40cb0fd10a13 | thepranaygupta/Coding-Playground | C++/array6.cpp | #include <iostream>
using namespace std;
int main() {
int arr[3][3];
cout << "Enter 3x3 Array Elements: ";
for(int i=0; i<3;i++) {
for(int j=0; j<3; j++) {
cin >> arr[i][j];
}
}
for(int i=0; i<3;i++) {
for(int j=0; j<3; j++) {
cout << arr[i][j];
... | ALGO | 0.928254 | 3.347172 |
06e86f35-bead-48f1-85cf-5f92378b49ee | ishandutta2007/codeforces | gmusya/normal/339/B.cpp | #include <iostream>
#include <vector>
#define ll long long
using namespace std;
int main() {
ll n, m, cnt = 0;
cin >> n >> m;
vector <ll> a(m + 1);
a[0] = 1;
for (ll i = 1; i <= m; i++)
cin >> a[i];
for (ll i = 1; i <= m; i++) {
if (a[i] >= a[i - 1])
cnt += (a[i] - a[i - 1]);
else
cnt += (n - a[i -... | ALGO | 0.999902 | 3.105633 |
f0d2115c-ac23-4f69-9e21-0c997e8f7b93 | AKrisadi/DSA-solutions | two_stacks.cpp | // Problem LInk - https://www.codingninjas.com/studio/problems/two-stacks_983634
#include <bits/stdc++.h>
class TwoStack {
int size;
int *arr;
int top1;
int top2;
public:
// Initialize TwoStack.
TwoStack(int s) {
// Write your code here.
size = s;
arr = new int[size];
... | ALGO | 0.998401 | 5.192813 |
e6788a51-be74-4721-b73e-ad7805344e79 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11519_18.cpp | #include <bits/stdc++.h>
using namespace std;
double eps = 1e-9;
const int INF = 1e9 + 7;
const int MAXN = int(2e5 + 7);
int n, m, k, a[MAXN], mini = INF, ans;
int main() {
cin >> n >> m >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i % 2 == 0) mini = min(mini, a[i]);
}
if (n % 2 == 0 || (n + 1) ... | ALGO | 0.999957 | 3.830584 |
f5555e21-b964-4f28-b22f-630d639a016c | shrutarshi2002/CPP-DSA | DSA-cpp-main/05. Arrays/2. Length Unsorted Subarray.cpp | /**
2. Length Unsorted Subarray
Given an unsorted array Arr of size N. Find the subarray Arr[s...e] such that sorting this subarray makes the whole array sorted.
Example 1:
Input:
N = 11
Arr[] ={10,12,20,30,25,40,32,31,35,50,60}
Output: 3 8
Explanation: Subarray starting from index
3 and ending at index 8 is require... | ALGO | 0.999671 | 5.026855 |
e75c8c0d-9dbd-4800-9543-4844b166b2cb | codeitbijay/Hacktoberfest2k20 | C++/coinchangecombination.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for (int i=0;i<n;i++){
cin>>arr[i];
}
int tag =0;
cin>>tag;
int t[tag+1];
memset(t,0,sizeof(t));
t[0]=1;
for(int i=0;i<n;i++){
for(int j=arr[i];j<=tag;j++){
... | ALGO | 0.999914 | 3.13263 |
2d38511d-8c2e-4029-a399-3f0171e483ba | Blixibon/source-2013-expanded-steam | sp/src/game/server/physics_fx.cpp | // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
static int BestAxisMatchingNormal( matrix3x4_t &matrix, const Vector &normal )
{
float bestDot = -1;
int best = 0;
for ( int i = 0; i < 3; i++ )
{
Vector tmp;
MatrixGetColumn( matrix, i, tmp );
float dot = fabs(DotProduct... | ALGO | 0.855592 | 6.75957 |
5ba345c2-960d-4e58-a91a-c3191e934c4b | rishi-koul/Cracking-the-Coding-Interview | 04 - Trees and Graphs/06-findSuccessor.cpp | #include <iostream>
#include <list>
using namespace std;
int Tree::findSmallest(Tree *root, int root_value){
if(root == NULL)return root_value;
int left_value = findSmallest(root->left, root_value);
int right_value = findSmallest(root->right, root_value);
return min(min(left_value, right_value), root->data);
}... | ALGO | 0.999965 | 3.966014 |
249b5403-7887-47fb-9830-184f2ea37ff1 | javedchaurasiya/DSA-Revision | Merge Two Sorted Lists.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) {}
* };
*/
#define node ListNode
class Solution {
public:
... | ALGO | 0.999926 | 5.817807 |
f642829b-9087-428f-8ea6-217eb9c15dbe | biswass101/code_chef_solutions | Contesst/Div-4/Ja korchi/Best_of_N_Sets.cpp | #include<bits/stdc++.h>
#define ROCKET ios :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define fr(x, s, e, b) for(ll x = s; x < e; x = x + b)
#define rfr(x, s, e, b) for(ll x = s; x >= e; x = x - b)
#define efr(val, where) for(auto& val : where)
#define all(x) x.begin(), x.end()... | ALGO | 0.999355 | 4.510051 |
e451639d-a832-413c-8286-604ffceb5eb2 | CPFL/ROSCH | Analyzer/src/node_graph_core.cpp | #include "node_graph_core.h"
#include <stdio.h>
#include <iostream>
#include "node.h"
namespace native_c
{
static const int MAX_LEAF_LIST = 16;
static const int DISPLAY_MAX_BUF = 64;
void node_init(node_t *node);
void insert_child_node(node_t *parent_node, node_t *child_node);
#if 1 // C++
node_t *make_node(const st... | ALGO | 0.966532 | 4.020845 |
6e5f573d-d670-4386-980a-67a2704d9b8f | ParthJohri/LeetCodePractice | 151-reverse-words-in-a-string/151-reverse-words-in-a-string.cpp | class Solution {
public:
string reverseWords(string s) {
string ans="",temp="";
s+=" ";
for(int i=0;i<s.length();i++){
if(s[i]==' ' and s[i+1]==' '){
continue;
}
else if(s[i]!=' '){
temp+=s[i];
}
else... | ALGO | 0.999943 | 5.846986 |
4c0cf4b3-a95a-4e9e-ba1e-2a334dbdd1ce | ishandutta2007/codeforces | saketh/normal/757/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define TRACE(x)
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()
ty... | ALGO | 0.999977 | 4.684205 |
7f6a2883-9995-41b1-afe2-05ddc0f0d8cf | arif0x1/CSE-122-FALL2023 | Lab 01/4.cpp | #include<iostream>
using namespace std;
int main()
{
int x;
cin>>x;
if(x>=0)
{
cout<<"x value is positive"<<endl;
if (x%2==0)
{
cout<< "x value is even"<<endl;
if(x>999 & x<10000)
{
cout<<" x value contains four digits"<<endl;
... | ALGO | 0.995408 | 3.337903 |
7f85fc78-f351-4bbc-b59a-fcbe58b23dac | khuonggminhhoang/DSA-PTIT | bien-doi-hau-to-trung-to.cpp | #include<iostream>
#include<stack>
using namespace std;
main(){
int t;
cin>>t;
while(t--){
string s;
cin>>s;
stack <string> stk;
for(auto x : s){
if(isalpha(x)){
stk.push(string(1, x));
}
else{
string s1 = stk.top(); stk.pop();
string s2 = stk.top(); stk.pop();
string tmp = '(' + s... | ALGO | 0.999807 | 4.38925 |
ed8c446c-fa9c-463d-888a-74001ed9cb5d | Mahmoud-Ameen/Problem_Solving | Dynamic Programming/LeetCode 213 House Robber II.cpp | /*
* Problem Link: https://leetcode.com/problems/house-robber-ii/
* */
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int rob(vector<int>& nums) {
int n = (int) nums.size();
vector<int> choice1Vec,choice2Vec;
choice1Vec.push_back(nums[0]);
... | ALGO | 0.999915 | 5.689466 |
42f6de7f-1bfe-46e4-854c-f4350c342a65 | Mr-mahato/100daycodeatchitakara | cp34/cp34.cpp | // problem link :https://www.codechef.com/problems/RATING?tab=statement
// I was amazed looking the solution of this problem
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
while(t--)
{
int s;
cin >> s;
cout << 0 - (s+1)<< endl;
}
return 0;
}
| ALGO | 0.999593 | 3.322774 |
d85ede12-c432-4d3a-9a84-3406f327c4cc | ishandutta2007/codeforces | jayce132/normal/948/E.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<vector>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_e... | ALGO | 0.99973 | 3.457038 |
f0a2dea1-7273-4d9a-a37d-2a05bde8d1c5 | ishandutta2007/codeforces | brobat/normal/1669/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
string s;
cin >> s;
s += 'W';
bool pos = true;
int r = 0;
... | ALGO | 0.999936 | 4.476519 |
86ae7688-d2ac-40ec-bfe0-88f4287f53bc | oioi0210/codetree-TILs | 240108/주어진 수까지의 곱/multiplication-up-to-a-given-number.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
int prod = 1;
cin >>a >>b;
for (int i = a; i <= b; i++) {
prod *= i;
}
cout << prod;
return 0;
} | ALGO | 0.999965 | 4.14264 |
f6b78b84-9b21-4cc2-8a3e-18b5753cf11f | lira-frts/mac0214 | contests/codeforces/div3-round834/c.cpp | /* /\_/\
* (= ._.)
* / > \>
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
ll l, r, x; cin >> l >> r >> x;
ll a, b; cin >> a >> b;
if(a == b){
cout << 0 << '\n';
return;
}
if(abs(a - b) >= x){
cout << 1 << '\n';
return... | ALGO | 0.999982 | 4.680906 |
b1fa2033-5091-4176-b399-fb93cd101943 | lyciumlee/learn_leetcode_easy | Leaf-Similar Trees.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.999682 | 6.317669 |
912d47db-26b3-4b3a-b9bc-ddfa53201fc5 | Yang2096/snippet | leetcode/97.cpp | #include<iostream>
#include<string>
#include<vector>
using namespace std;
bool isInterleave(string s1, string s2, string s3) {
int len1 = s1.length();
int len2 = s2.length();
if(len1 + len2 != s3.length()) return false;
if(len1 == 0) return s2 == s3;
if(len2 == 0) return s1 == s3;
vector<vect... | ALGO | 0.999876 | 5.11164 |
4c7e702e-ef2e-40bb-ba27-cb2d952169d6 | hieplpvip/cses-solutions | cpp/1629.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<pair<int, int>> movies(n);
for (int i = 0; i < n; ++i) {
cin >> movies[i].second >> movies[i].first;
}
sort(movies.begin(), movies.end());
int last = 0, ans = 0;
... | ALGO | 0.999913 | 5.330182 |
23820dd5-f007-4447-a668-04cd46a680e8 | DMLfor/leetcode | 31-40/31_next_permutation.cpp | class Solution
{
public:
void nextPermutation(vector<int>& nums)
{
next_permutation(nums.begin(), nums.end());
}
};
| ALGO | 0.999959 | 5.658496 |
db3bad6c-a405-4062-9b1e-3958056ab477 | deprecated-mwulfman/jiminy_itw | pinocchio-2.5.6/benchmark/timings-derivatives.cpp | #include "pinocchio/algorithm/joint-configuration.hpp"
#include "pinocchio/algorithm/kinematics.hpp"
#include "pinocchio/algorithm/kinematics-derivatives.hpp"
#include "pinocchio/algorithm/rnea-derivatives.hpp"
#include "pinocchio/algorithm/aba-derivatives.hpp"
#include "pinocchio/algorithm/aba.hpp"
#include "pinocchio... | ALGO | 0.999574 | 7.221326 |
b666a070-352a-4eb6-a3c4-816c2854ddb0 | jsspencer/hegemony | src/third_party/eigen-3.2.4/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.990959 | 3.51756 |
b4ff79f1-f59b-4f56-9d77-9d4bd8467ee8 | hanriiver/algorithm | daily solved/2805.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
int n, m;
long long ans;
int arr[1000001];
void binary() {
int s = 1, e = 2000000000;
while (s <= e) {
long long mid = (s + e) / 2;
long long slice = 0;
for (int i = 0; i < n; i++) {
if (mid < ... | ALGO | 0.99999 | 5.085558 |
d6fc4153-3b9d-4884-b8fa-182d9b6d3aed | fhyPayaso/fhyPayaso.github.io | code/Algorithm/leetcode/u200/7.整数反转.cpp | /*
* @lc app=leetcode.cn id=7 lang=cpp
*
* [7] 整数反转
*
* https://leetcode-cn.com/problems/reverse-integer/description/
*
* algorithms
* Easy (33.18%)
* Likes: 1425
* Dislikes: 0
* Total Accepted: 212.6K
* Total Submissions: 640.7K
* Testcase Example: '123'
*
* 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。
... | ALGO | 0.999705 | 5.667696 |
896c3cf1-fc1e-4f81-8faf-c4ba46ea12b5 | juranyouren/Hello_world | data_structure/codes/huffmanTree.cpp | // Huffman tree
#include <iostream>
#include "minHeap.h"
#include "linkedBinaryTree.h"
#include "huffmanNode.h"
using namespace std;
template <class T>
linkedBinaryTree<int>* huffmanTree(T weight[], int n)
{// Generate Huffman tree with weights weight[1:n], n >= 1.
// create an array of single node trees
huffm... | ALGO | 0.999967 | 4.77073 |
265c4ba2-dfa2-44d5-bc98-1b8032339291 | laksh0709/Hacktoberfest2022-1 | c++ problems asked in interview/278. First Bad Version.cpp | You are a product manager and currently leading a team to develop a new product.
Unfortunately, the latest version of your product fails the quality check.
Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have n versions [1, 2, ..., n] and ... | ALGO | 0.999938 | 6.824053 |
068b3186-fa1b-44da-a9dd-1f42a1d414b4 | SarbajitPbappy/CF | 1811A-InsertDigit.cpp | #include <iostream>
int main() {
std::ios_base::sync_with_stdio(false);
long t; std::cin >> t;
while (t--) {
long n; char d; std::cin >> n >> d;
std::string s; std::cin >> s;
bool done(false);
for(long p = 0; p < s.size(); p++){
if(!done && s[p] < d){std::cout << d; done = true;}
s... | ALGO | 0.999218 | 4.339849 |
bb603c1d-6e6a-4d53-8ba1-6697d0874ee5 | DLChapmanTSU/RTSBilliardsProject | RTSBilliardsProject/RTSBilliardsProject.cpp | // RTSBilliardsProject.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//ENSURE TARGET PLATFORM IS x64
//WILL NOT RUN OTHERWISE
//CHECK README IF LINKER ERRORS ARE FOUND
//For best results, run in release mode
#include <iostream>
#include <SFML/Graphics.hpp>
#include "Ball.h... | ALGO | 0.961216 | 4.973171 |
2894d58f-d18a-40cc-b208-4af80038fa84 | Thesohan/Basic-c-Algo | inplacemerge.cpp | #include <bits/stdc++.h>
using namespace std;
/*void swap(int &a,int &b)
{
int t;
t=a;
a=b;
b=t;
}*/
void inplacemerge(int arr[],int i,int j)
{ //a::Denotes the index of the minimum in the first subarray which is being merged
//b::Denotes the index of the minimum in the second subarray which is being merged
//x... | ALGO | 0.999928 | 4.047345 |
e1dcc931-b2df-4402-a6b6-6f149b658a63 | ajmat6/DSA | L_Unique_Binary_Search_Trees.cpp | class Solution {
public:
// Memorisation:
int solve(int n, vector<int>& dp)
{
if(n<=1) return 1;
if(dp[n] != -1) return dp[n];
// storing the ans:
int ans = 0;
// taking each value as a head:
for(int i=1; i<=n; i++)
{
ans += solve(i-1, d... | ALGO | 0.999992 | 6.191736 |
772a1e64-ed76-451d-958d-126061456a0b | ishandutta2007/codeforces | sohsoh/normal/585/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl '\n'
#define debug(x) cerr << #x << ": " << x << endl;
const ll MAXN = 50000 + 10;
const ll MAXD = 50;
const ll... | ALGO | 0.99999 | 4.694149 |
48259afa-9a0b-4652-b110-779ac60868cf | LapysDev/... | C++/…/truncation.cpp | #include <cfloat>
#include <ciso646>
#include <cstdio>
#include <stdint.h>
/* ... */
long double truncate(long double const number) {
long double truncation = 1.00L;
// ...
if (number < 0.00L) return -truncate(-number);
if (number != number or number == 1.00L / 0.00L) return numbe... | ALGO | 0.997742 | 6.053817 |
ff24990a-8357-4d95-9467-f42df5198292 | rosibes/mpi | mergesort.cpp | #include <iostream>
#include <vector>
#include <chrono>
// Function to merge two sorted subvectors into one sorted vector
void merge(std::vector<int>& arr, int left, int middle, int right) {
int n1 = middle - left + 1;
int n2 = right - middle;
// Create temporary vectors
std::vector<int> L(n1), R(n2);... | ALGO | 0.999964 | 6.726863 |
8554f459-8121-4b27-8958-a70daa0cb0b5 | RisAhamed/DSA | Binary search/bs-1D array/bs.cpp | #include<bits/stdc++.h>
using namespace std;
int bs(vector<int>&nums, int target){
int low=0;
int high = nums.size()-1;
int count=0;
while(low<=high){
int mid = (low+high )/2;
count++;
if (nums[mid]==target)
{cout<< count<<endl;
return mid;
}
els... | ALGO | 0.99982 | 5.73555 |
81bc253b-7b19-49d6-a9d3-7a5b8735e8b2 | rdstihz/Learning-and-Coding | src/contest/EOJ/monthly2021.2/D.cpp | #include <iostream>
#include <cstring>
using namespace std;
const int maxn = 50000 + 100;
int color[maxn];
int h[maxn];
bool vis[maxn];
int main(){
int r,c,q;
int t;
cin >> r >> c >> q;
for(int i = 1;i <= c;i++) {
cin >> h[i];
}
for(int i = 1;i <= c; i++) {
cin >> color[i];
... | ALGO | 0.998645 | 3.414525 |
3989643c-8bac-44dc-888e-503796de4c6d | ishandutta2007/codeforces | humbertoyusta/normal/1165/C.cpp | #include <bits/stdc++.h>
#define maxn 200010
#define inf 1000000007
#define f first
#define s second
#define lg2(x) ( 31 - __builtin_clz(x) )
#define db(x) cerr << #x << ": " << (x) << "\n";
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
int n;
string s,a;
int main(){
... | ALGO | 0.99999 | 3.144601 |
a25e6a30-6441-4038-be59-f6529996e38a | romankosoj/protect | src/cryptonote_basic/cryptonote_format_utils.cpp | #include "include_base_utils.h"
using namespace epee;
#include <atomic>
#include "cryptonote_format_utils.h"
#include "cryptonote_config.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include "ringct/rctSigs.h"
#undef PROTECT_DEFAULT_LOG_CATEGORY
#define PROTECT_DEFAULT_LOG_CATEGORY "cn"
#define ENCRYPTED_P... | TOOL | 0.917409 | 6.42335 |
ab505c91-c18b-4feb-9019-f022f9592859 | mdsiaofficial/ProblemSolving | NCPC/ncpc_preli_ju_2023_mock/a_proper_binary_tree.cpp | #include <iostream>
using namespace std;
// Main function
int main() {
// Read the number of test cases
int T;
cin >> T;
// Loop through each test case
while (T--) {
// Read the height of the tree
int n;
cin >> n;
// Draw the binary tree
if(n==1){
... | ALGO | 0.999746 | 5.700611 |
858c156b-c5ad-4752-996d-a952e8914ddd | rhzx3519/leetcode | c++/54. Spiral Matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> res;
if (matrix.empty())
return res;
int li = 0, lj = 0, hi = matrix.size() - 1, hj = matrix[0].size()-1;
while (li <= hi && lj <= hj) {
int i = li, j = lj;
... | ALGO | 0.999996 | 6.195101 |
a367af53-476a-470e-8898-16584afb55cf | prathampithalia/CP | Codeforces/D_Inaccurate_Subsequence_Search.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define pyes cout << "YES" << endl
#define pno cout << "NO" << endl
#define ce cout << endl
#define forr(i, n) for (int i = 0; i < n; i++)
#define e... | ALGO | 0.999969 | 3.544772 |
9ce0cafa-19b3-4c45-9f54-fed24c7da549 | AnhTheLe/Application-Algorithm-NEVER-DIE | Graph code/AnalyzeDFS.cpp | /** TESTING INPUT **
11 14
1 2
1 3
2 3
3 4
4 6
4 9
9 6
9 7
6 7
7 10
6 5
5 11
5 8
8 11
***** OUTPUT *****
1 - 1 1
2 - 2 1
3 - 3 1
4 - 4 4
5 - 9 9
6 - 5 4
7 - 7 5
8 - 11 9
9 - 6 4
10 - 8 8
11 - 10 9
******************/
#include <bits/stdc++.h>
using namespace std;
const int n = 1001;
vector<int> Adj[n];
vector<int> Low(... | ALGO | 0.999973 | 5.000648 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.