uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
22548766-00c0-48cb-a0e1-dcf195afa7b2 | OmidAminiuni/DSclassACTIVITIESsrbiau | DS Exercises/3-PrefixToPostfix.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define n 30
class Stack1
{
public:
Stack1();
int pop();
void push(int input);
bool isfull();
bool isempty();
private:
int a[n], top;
};
Stack1::Stack1()
{
top = -1;
}
int Stack1::pop()
{
int value;
if(isempty())... | ALGO | 0.999775 | 4.954099 |
98326ced-0ed0-4b4e-996d-33966ac2730e | mevivek3620/DSA | BinarySearch/Row_with_max1s.cpp | // link to the question---->> https://www.geeksforgeeks.org/find-the-row-with-maximum-number-1s/
// naive approach takes O(n*m)
// o(n*logm)approach using binary search
int first(vector<int>&a,int low,int high)
{
if(high>=low)
{
int mid = (low+high)/2;
if(a[mid] == 1 && (mid == 0 || a[mid-1]==... | ALGO | 0.99994 | 5.77584 |
24983ab8-9d6d-4376-a3dc-e2031761496c | keynoid/school.tests | Rubbish/ht8/ht8/2919.cpp | /* В массиве хранится информация о годе рождения каждого из 30 человек. Определите порядковый номер самого старшего по возрасту человека. Если таких человек несколько, нужно вывести их порядковые номера. */
#include <iostream>
#define N 6
using namespace std;
int task2919() // ???
{
int years[N];
... | ALGO | 0.999785 | 4.358812 |
dc8b1ba2-37f6-4b51-a04f-5e21d2d6789c | ShivArora-Sykkuno/Competitive-Programming | Akash_and_function.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
n++;
cout << (n >> 1) << endl;
}
return 0;
} | ALGO | 0.999745 | 4.186609 |
389fc532-507e-4601-91b5-3413e296b301 | blockchaingate/fabcoin | src/libff/libff/algebra/scalar_multiplication/multiexp_profile.cpp | #include <cstdio>
#include <vector>
#include <libff/algebra/curves/bn128/bn128_pp.hpp>
#include <libff/algebra/scalar_multiplication/multiexp.hpp>
#include <libff/common/profiling.hpp>
#include <libff/common/rng.hpp>
using namespace libff;
template <typename GroupT>
using run_result_t = std::pair<long long, std::vec... | TEST | 0.952135 | 5.776421 |
f672b93e-3f2a-4d42-b0e5-385106e329e9 | VhahahaV/AlgorithmPactice | code/5_May/05-07/leetcode_508.cpp | /**
* Definition for a binary tree MemPage.
* 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)... | ALGO | 0.999975 | 6.024108 |
c2f1cad2-d43d-4efb-872a-e0bceb002aa9 | akshith-07/PROBLEM-OF-THE-DAY | School/Count of smaller elements/count-of-smaller-elements.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
int countOfElements(int arr[], int n, int x);
int main() {
int t;
cin >> t;
while (t--) {
int n, x;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) cin >> arr[i];
cin >> x;
cout... | ALGO | 0.999783 | 6.068015 |
e319c129-02b7-4e8d-b14a-d7c32e6dcbc6 | almishra/metadirective | llvm/lib/Transforms/Scalar/GuardWidening.cpp | #include "llvm/Transforms/Scalar/GuardWidening.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/GuardUtils.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#includ... | TOOL | 0.996455 | 7.957021 |
32edbe71-1597-4d89-93ba-ea26f2544db5 | Alexander-L-Li/Competitive-Programming | AlphaStar/Simulation/acorn_scramble.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int n, cnt, len;
cin >> n;
int A[n], B[n];
for(int a=0; a<n; a++){
cin >> A[a];
}
for(int a=0; a<n; a++){
cin >> B[a];
}
cnt = 0, len = 0;
for(int a=0; a<n; a++){
if(A... | ALGO | 0.999867 | 3.748241 |
ec2d436d-cee1-4298-becc-559621367ea9 | ca01h/Pointer-On-C | Character 9/palindrome.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define TRUE 1
#define FALSE 0
int
palindrome(char *string)
{
char *string_end;
string_end = string + strlen(string) - 1;
while(TRUE){
while(!isalpha(*string)){
string++;
}
while(!isalpha(*string_end)){
string_end--;
}
i... | ALGO | 0.999601 | 3.316684 |
07f7f503-7539-4f76-a2b5-7f7b35e259c7 | IvanRenison/ProgrammingProblems | Training camps, courses and books/Training Camp Argentina - 2024/#7/H.cpp | // https://codeforces.com/group/5GNF7zti59/contest/534927/problem/H
#include<bits/stdc++.h>
#define fst first
#define snd second
#define SZ(x) ((ll)x.size())
#define ALL(x) x.begin(),x.end()
#define fore(i,a,b) for(ll i =a,gmat=b;i<gmat;++i)
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector... | ALGO | 0.999909 | 3.186182 |
1b8e7050-682d-467e-864d-f75e52e29f98 | githubapitest/githubapitest | numerical-recipes-j/core/src/main/legacy/nr2/CPP_211/examples/xexpdev.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
#include "nr.h"
using namespace std;
// Driver for routine expdev
int main(void)
{
const int NPTS=10000;
const DP EE=2.7182818284590;
int i,j,total=0;
int idum=(1);
DP expect,xx,y;
Vec_INT x(20);
Vec_DP tri... | ALGO | 0.996846 | 3.942778 |
9331e34d-1b92-4994-94dc-85bbcbd640df | dlvguo/NoobOJCollection | LeetCode/JianZhiOffer/14-2.cpp | #include <bits/stdc++.h>
using namespace std;
int cuttingRope(int n)
{
if (n == 2)
return 1;
if (n == 3)
{
return 2;
}
int mod = n % 3;
long long sum = 1;
if (mod == 1)
{
n -= 4;
mod += 3;
}
else if (mod == 0)
mod = 1;
for (int i = 0;... | ALGO | 0.999983 | 4.563671 |
26da82cd-a351-4864-bfa9-9ef54f13ede0 | SelfishOlex/LYBook_1.16 | dev/Gems/EMotionFX/Code/EMotionFX/Source/MeshBuilderVertexAttributeLayers.cpp | // include the required headers
#include "MeshBuilderVertexAttributeLayers.h"
#include <MCore/Source/Compare.h>
#include <EMotionFX/Source/Allocators.h>
namespace EMotionFX
{
AZ_CLASS_ALLOCATOR_IMPL(MeshBuilderVertexLookup, MeshAllocator, 0)
AZ_CLASS_ALLOCATOR_IMPL(MeshBuilderVertexAttributeLayer, MeshAllocato... | TOOL | 0.87509 | 6.887268 |
4c6bd723-78a7-4859-af77-ae53d2ed7f49 | pozero/Chaste | lung/src/ventilation/AbstractVentilationProblem.cpp | #include "AbstractVentilationProblem.hpp"
#include "MathsCustomFunctions.hpp"
#include "Warnings.hpp"
#include "AirwayTreeWalker.hpp"
#include "AirwayPropertiesCalculator.hpp"
AbstractVentilationProblem::AbstractVentilationProblem(const std::string& rMeshDirFilePath, unsigned rootIndex)
: mOutletNodeIndex(rootInde... | ALGO | 0.996308 | 6.234049 |
b15868bb-0a3b-4610-a8a2-78fd40b061a4 | luanaamorim04/competitive_programming | obi/temperaturaOBI.cpp | #include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <stack>
#include <map>
#define INF 99999999
#define MOD 1000000007
#define par pair<int, int>
#define MAXN (int) 1e5 + 9
#define lsb(x) ((x) & (-x))
#define _ ios_base::sync_with_... | ALGO | 0.997905 | 3.676049 |
24a2a4cb-14bf-47bf-9570-a1cbd4ae76d5 | iitpparshant/dsa_practice | String/71.cpp | class Solution {
public:
string simplifyPath(string path) {
stack<string>st;
int i=0;
int n= path.size();
while(i<n){
int s=i;
int e= i+1;
while(e<n && path[e]!='/'){
e++;
}
string mnPath= path.substr(s,e-s);... | ALGO | 0.999935 | 5.833175 |
12ef2b66-66c5-4e4f-82bf-df27290030df | Tiphereth-A/CP-lib | test/library-checker-polynomial/multipoint_evaluation.mints-s30.mints-s63.poly_anymod-p3ntt.test.cpp | #define AUTO_GENERATED
#define PROBLEM "https://judge.yosupo.jp/problem/multipoint_evaluation"
#include "../../include/io/fastin.hpp"
#include "../../include/io/fastout.hpp"
#include "../../include/poly/mpe_fps.hpp"
using namespace tifa_libs;
CEXP u32 MOD = 998244353;
#include "../../include/math/mint.hpp"
#include ... | ALGO | 0.999458 | 4.22216 |
4e44b5f9-5719-47cc-a960-cfbd97cfbae4 | heavenMOJANG/ICPC | .history/programmes_C_Cpp/Codeforces/CF2082/A_20250315142505.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int n, m; cin >> n >> m;
string g[n];
vector<int> r(n, 0), c(m, 0);
for (int i = 0; i < n; ++ i) {... | ALGO | 0.999954 | 5.822742 |
242ba57f-4caa-44fe-9ba5-631fda00de15 | Furinar/Date-Structure-Note | Achieve code/Static_LinkList.cpp | /**
* ! 静态链表
* 空间连续,结点集中安置
*/
#include <iostream>
using namespace std;
#define elemType int
#define Maxsize 10
typedef struct node
{
elemType data;
int next;
} node, SLinkList[Maxsize];
// 初始化静态链表
void initList(SLinkList &list)
{
for (int i = 0; i < Maxsize - 1; i++)
{
list[i].next = i ... | ALGO | 0.999548 | 4.575077 |
0e4b1ebc-8b02-4e19-801f-e83f57af4b22 | eishamehmood219/repository-01 | program 02.cpp | #include <iostream>
using namespace std;
int main()
{
int popA , popB;
double growthRateA , growthRateB ;
int year=0;
cout << "Enter the population town A :";
cin>>popA;
cout<<"Enter the Growth Rate of Town A :";
cin>>growthRateA;
cout<< "Enter the population town B :";
cin>>popB;
cout<<"Enter the Growth Rat... | ALGO | 0.998866 | 3.908872 |
7def8a97-4eed-4c2f-8468-44852f3b1ae7 | ToNoName/LeetCode | easy/796.rotateString.cpp |
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;
//effective : 1
//Solution 1 从A中每个元素开始遍历一个周期,与B的元素从开头开始对比
//如果相同继续比较,如果不同选取A的下一个元素开始比较
class Solution {
public:
bool rotateString(string A, string B) {
if(A.size() != B.size()... | ALGO | 0.999925 | 5.570773 |
69153596-0882-4619-b7ae-370e8900bb46 | 123456789asdfjkl/csp | 201803-1.cpp | #include "stdio.h"
int main(){
int a[30 + 1];
int sum = 0;
for (int i = 0; i < 30; ++i) {
scanf("%d",&a[i]);
if(a[i] == 1){
sum +=1;
} else if (a[i] == 2){
for (int j = i; j >= 0 && a[j] == 2; --j) {
sum += 2;
}
} else if (... | ALGO | 0.999723 | 3.113759 |
d3a230db-e2c1-4b18-a3fc-69d1c80e154a | sommergis/netxpert | src/core/odmlem.cpp | #include "odmlem.h"
using namespace std;
using namespace lemon;
using namespace netxpert::core;
ODM_LEM_2Heap::ODM_LEM_2Heap(uint32_t nmx, uint32_t mmx, bool Drctd)
{
//ctor
isDrctd = Drctd;
}
void ODM_LEM_2Heap::ShortestPathTree()
{
std::vector< SmartDigraph::Node > procList;
while (!dijk->emptyQue... | ALGO | 0.999501 | 3.991288 |
d3c76788-e723-4d4e-ad2d-cb79382d13e7 | anmolkmr/leetcode_solutions | 3219-make-lexicographically-smallest-array-by-swapping-elements/make-lexicographically-smallest-array-by-swapping-elements.cpp | class Solution {
public:
vector<int> lexicographicallySmallestArray(vector<int>& nums, int limit) {
vector<int> numsSorted(nums);
sort(numsSorted.begin(), numsSorted.end());
int currGroup = 0;
unordered_map<int, int> numToGroup;
numToGroup.insert(pair<int, int>(numsSorted[0]... | ALGO | 0.999997 | 5.599717 |
c9bd5d29-3004-4cd7-97be-edf70f6e6099 | chillpert/matrix | matrix/src/Utility.cpp | #include "Utility.h"
#include "Logger.h"
#include <sstream>
#include <fstream>
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/range/iterator_range.hpp>
namespace MX
{
int max_window_width = Constants::max_screen_width;
int max_window_height = Constants::max_screen_height;
namespace Utility... | TOOL | 0.948239 | 5.695 |
9c6d5ccc-4733-450c-b4b6-d758565651be | sheikh-riyadh/data_structure | Module 20 (Assigment)/Print_Outer_Tree.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int value;
Node *left, *right;
Node(int value)
{
this->value = value;
this->right = NULL;
this->left = NULL;
}
};
Node *input_tree()
{
int v;
cin >> v;
if (v == -1)
return NULL;
Nod... | ALGO | 0.999977 | 4.271409 |
b0748165-4910-4c42-9016-ad81dab6d014 | sdwalker233/ICPC | HDU/problems/1209.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct node{
int h,m,s;
int ang;
}a[10];
bool cmp(const node& x,const node& y)
{
if(x.ang!=y.ang) return x.ang<y.ang;
return x.s<y.s;
}
void fuck()
{
for(int i=1;i<=5;i++){
scanf("%2d:%2d",&a[i].h,&a[i].m);
a[i... | ALGO | 0.99591 | 3.534107 |
0d180d99-7bd7-4f74-ae68-626fa50b8a3c | Ashwin-Dotwal/DSA-ALL-TOPIC | stack/middleinstack.cpp | #include <iostream>
#include <stack>
using namespace std;
void printmiddle(stack<int> &s, int totalsize)
{
if (s.size() == totalsize / 2 + 1)
{
cout << "middle element is:" << s.top() << endl;
return;
}
int temp = s.top();
s.pop();
// recursive call
printmiddle(s, totalsize... | ALGO | 0.999663 | 4.824135 |
2d28a15a-4534-4bd4-9258-873448b3f27d | JJRnumrous/Firmware | src/lib/landing_slope/Landingslope.cpp | /*
* @file landingslope.cpp
*
* @author Thomas Gubler <<EMAIL>>
*/
#include "Landingslope.hpp"
#include <mathlib/mathlib.h>
void
Landingslope::update(float landing_slope_angle_rad_new,
float flare_relative_alt_new,
float motor_lim_relative_alt_new,
float H1_virt_new)
{
_landing_slope_angle_... | TOOL | 0.990629 | 6.015058 |
d4010bcb-a618-46f2-ac9c-bd4f5ff38ab7 | Chan684/c- | fibonacciUsingloop.cpp | #include<iostream>
using namespace std;
int fib(int n){
int t0=0,t1=1,s;
if(n<=1)
return n;
for(int i=2;i<=n;i++){
s= t0+t1;
t0=t1;
t1=s;
} return s;
}
int main()
{
int s;
s=fib(6);
cout<<s<<endl;
return 0;
}
| ALGO | 0.999692 | 3.552257 |
330899dc-c051-456c-8b8e-9d46e5de641a | armando013005/CMPR-121-EXAM-3 | Exam 3/linkedListOption.cpp | #include "Declarations.h"
void displayLinkedListMenu(list<Rational>& rlist) {
Rational r;
do
{
system("cls");
cout << "\n\tLinked lists are sequence containers that allow non - contiguous memory allocation.As compared to";
cout << "\n\tvector, the linked list has slow traversal, but once a position has been ... | TOOL | 0.952498 | 4.974671 |
b463b9d9-2940-4152-8dce-4e171b348c76 | wongfei/projectd-core | src/ProjectD/Car/AutoClutch.cpp | #include "Car/AutoClutch.h"
#include "Car/Car.h"
#include "Car/Drivetrain.h"
//#include "Sim/Simulator.h"
namespace D {
ClutchSequence::ClutchSequence()
{
}
ClutchSequence::ClutchSequence(const Curve& curve) :
clutchCurve(curve)
{
}
AutoClutch::AutoClutch()
{
clutchSequence.currentTime = 0.0f;
clutchSequence.is... | ALGO | 0.924138 | 5.751763 |
d7aacab7-f665-4a64-b87f-6314e8a5a699 | YeKYLI/leetcode | 待整理/leetcode-0.2.0/lcof2/剑指 Offer II 013. 二维子矩阵的和/Solution.cpp | class NumMatrix {
public:
NumMatrix(vector<vector<int>>& matrix) {
int m = matrix.size();
int n = matrix[0].size();
s.resize(m + 1, vector<int>(n + 1, 0));
for (int i = 1; i <= m; ++i) {
for (int j = 1; j <= n; ++j) {
s[i][j] = s[i - 1][j] + s[i][j - 1] - ... | ALGO | 0.999543 | 6.55095 |
4fe58d94-0449-4578-bce7-caf5b9bcc9e1 | Tuhin-thinks/Python-Codes | mathematical/quadRoots.cpp | #include <iostream>
#include <stdlib.h>
#include <vector>
#include <math.h>
using namespace std;
class Solution{
public:
vector<int> quadraticRoots(int a, int b, int c){
vector<int> roots;
int roots_sum, roots_diff;
double d = b*b - (4*a*c);
if (d < 0){
roots.push... | ALGO | 0.998473 | 4.379985 |
5714fe71-370f-4bb7-bc4e-780ed081698e | arshlanali/DSA-Problems | 501-find-mode-in-binary-search-tree/find-mode-in-binary-search-tree.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.999988 | 6.236989 |
8a541578-5c8c-4bde-9d38-1897f3231c92 | SssunSsshine/PpKulagin | L5N14/L5N14/L5N14.cpp | // 14. max(Sum(aik+bjk))
#include <stdio.h>
#include <mpi.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <random>
#include <iostream>
#include <iomanip>
#define dimension 1//
using namespace std;
//
int cal_sum(int* a, int* b, int len)
{
int s = 0;
for (int i = 0; i < len; i++) {
... | ALGO | 0.99993 | 3.687354 |
0d8aee67-12fd-4bbd-a77b-63c7eb2c3b8b | gfuid/c-_program | program/class (binary).cpp | #include<iostream>
#include<string.h>
using namespace std;
class binary
{
string s;
public:
void read(void);
void check(void);
void complement(void);
void display(void);
};
void binary :: read(void)
{
cout << "enter the binary number" << endl;
cin >> s;
}
void binary :: check(void)
{
f... | ALGO | 0.998724 | 4.925994 |
8182e4c2-17ce-41c2-adc6-d6ab1f0768e9 | SiliconLabs/matter_extension | third_party/QR-Code-generator/cpp/QrCodeGeneratorWorker.cpp | #include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include "QrCode.hpp"
using qrcodegen::QrCode;
using qrcodegen::QrSegment;
static const std::vector<QrCode::Ecc> ECC_LEVELS{
QrCode::Ecc::LOW,
QrCode::Ecc::MEDIUM,
QrCode::Ecc::QUARTILE,
QrCode::Ecc::... | TOOL | 0.878087 | 4.958419 |
9ad3489c-d1d4-453f-86b3-44f61e1a66ac | Raakesh13/leetcode_solutions | insertionsort.cpp | class Solution
{
public:
ListNode *insertionSortList(ListNode *head)
{
int flag = 3;
ListNode *curr = head;
ListNode *prev = NULL;
ListNode *nex = head->next;
while (curr != NULL)
{
ListNode *curr1 = head;
ListNode *prev1 = NULL;
... | ALGO | 0.999997 | 5.362331 |
64789ca2-7a76-498b-beb1-5db1f29f5b9b | CN-hao/leetcode | 2101.detonate-the-maximum-bombs.cpp | /*
* @lc app=leetcode.cn id=2101 lang=cpp
* @lcpr version=30204
*
* [2101] 引爆最多的炸弹
*/
// @lcpr-template-start
using namespace std;
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>... | ALGO | 0.999887 | 6.076891 |
7ca90c09-37f0-4cc9-8a6e-5064c5911a51 | Julie-Cave/Rendu_Graph | src/read.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <numeric>
#include <stdexcept>
#include "adjacence_list.h"
#include "summit.h"
#include "arete.h"
#include "ds.h"
std::vector<std::vector<std::string>> r... | TOOL | 0.918782 | 3.90554 |
cf9dd846-ca8d-4fbe-af6a-d6b9217b612d | vinutah/apps | tools/llvm/llvm_39/opt/lib/Support/IntEqClasses.cpp | #include "llvm/ADT/IntEqClasses.h"
using namespace llvm;
void IntEqClasses::grow(unsigned N) {
assert(NumClasses == 0 && "grow() called after compress().");
EC.reserve(N);
while (EC.size() < N)
EC.push_back(EC.size());
}
unsigned IntEqClasses::join(unsigned a, unsigned b) {
assert(NumClasses == 0 && "joi... | ALGO | 0.96824 | 6.287828 |
367de2e4-ccf3-4450-b914-52d172ec67c1 | vishwamohini15/Data-Structure--Algorithm | day58/otherWaySum.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> pairsum(vector<int> numb, int target){
vector<int> ans;
int n=numb.size()-1;
for (int i = 0; i < numb; i++)
{
/* code */
}
}
int main(){
vector<int> nums={2,7,11,15};
int target=13;
vector<int> ans=pairsum(nums, target);
for(int va... | ALGO | 0.999921 | 4.973877 |
b5a94f9f-9a4a-402b-9c3f-1272199d3aac | simranshahh/Designed_Container | 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 |
c366f3c2-99d2-402e-aa81-0c5db775b985 | shyam-jayashankar/Code-Workouts | getmin_stack.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct mystack
{
stack<int>main_st;
stack<int>aux_st;
void push(int ele)
{
if(main_st.empty())
{
main_st.push(ele);
aux_st.push(ele);
}
else
{
main_st.push(ele);
if(aux_st.top()>=ele)
aux_st.push(ele);
}
}
int pop()
... | ALGO | 0.999943 | 4.355579 |
0fb8bea7-5066-4916-924b-cfc13570370b | lychees/ACM-Training | Note/集训队作业/2014/作业1/试题泛做/dhh1995/MyCode/icpc2013/pollution/pollution_comment.cpp | #include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,n) for (int i=0;i<n;++i)
const double pi=acos(-1.),eps=1e-5; int n; double r,ans;
struct node{
double x,y; node(){}
node(double _x,double _y):x(_x),y(_y){}
node operator -(const node &A){return node(x-A.x,y-A.y);}
node operator ... | ALGO | 0.999832 | 3.392037 |
ec313f98-fe11-47f4-930a-fc766dff674e | takemeforward/DSA | BinarySearch.cpp | #include <iostream>
using namespace std;
int main(){
int odd[] = {1 ,4 , 7,7,7,7, 24, 100};
int s = 0;
int e = 8;
int key = 7;
int mid;
while(s<=e){
mid = (s+e)/2;
if(odd[mid]==key){
cout << mid; break;
}else if(key>odd[mid]){
s = mid+1;
}else{
e = mid-1;
}
}
return 0;
} | ALGO | 0.999807 | 3.851539 |
5971d097-5fea-46e9-ad46-6ad780b66452 | binchengecon/TwoCapital | src/cppcore/eigen3/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.999275 | 3.818773 |
0105bcc6-b500-4412-be8e-bab4d68dd95d | EterHF/2023-VCL-Labs | lab3/tasks.cpp | #include "Labs/3-Rendering/tasks.h"
namespace VCX::Labs::Rendering {
glm::vec4 GetTexture(Engine::Texture2D<Engine::Formats::RGBA8> const & texture, glm::vec2 const & uvCoord) {
if (texture.GetSizeX() == 1 || texture.GetSizeY() == 1) return texture.At(0, 0);
glm::vec2 uv = glm::fract(uvCoord)... | ALGO | 0.954414 | 6.382812 |
dcb1e697-e257-49ce-a81e-5b455d4b1f78 | lega4e/olp | mai/ex/09.Geometry/D/main.cpp | #include <cmath>
#include <iostream>
using namespace std;
// types
typedef long double ldouble;
typedef struct
{
ldouble x, y;
} Point, Vector;
typedef struct
{
ldouble a, b, c;
} Straight;
// objects
constexpr ldouble const ALPHA = 0.000001;
// functions
inline ldouble distance(Point a, Point b)
{
return sqrt... | ALGO | 0.995593 | 4.43718 |
40325db9-c255-4eba-b483-64b4f5cef90e | 1atul0/DSA-implementation-in-Cpp | Linked List/creatte-linked-list.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
Node(int x){
data=x;
next=NULL;
}
};
int main(){
Node* head=new Node(10);
head->next=new Node(20);
head->next->next=new Node(30);
while(head!=NULL){
cout<<head->data<<" ";
head... | ALGO | 0.998873 | 3.082826 |
ebbb840f-7c4a-4ad4-b859-ce21f3a79140 | becastal/maratona | atcoder/abc372/e.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define dbg(x) cout << #x << " = " << x << endl
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
using namespace std;
struct DSU {
vector<int> id, sz;
... | ALGO | 0.999767 | 4.33581 |
5932d2ea-9419-4d40-91db-b028d816cbd2 | akshaykoni174285/Data-Structures-and-Algorithms- | 1.Arrays/freq.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
// int arr[] = {10,10,10,25,30,30};
// int arr[] = {10,10,10,10};
int arr[] = {1,2,3,4};
int size_arr = sizeof(arr)/sizeof(arr[0]);
int current_val = arr[0];
int freq = 1;
for (size_t i = 1; i < size_arr+1; ... | ALGO | 0.998659 | 3.823207 |
6fa348fa-914a-49bb-a51e-b5e238532706 | nilvercarhuapoma/nl | practicand/cifrado.cpp | #include <iostream>
#include <string>
std::string cifradoCesar(const std::string& texto, int clave) {
std::string resultado = "";
for (char caracter : texto) {
// Verificar si el carácter es una letra mayúscula
if (isalpha(caracter) && isupper(caracter)) {
resultado += 'A' + (carac... | ALGO | 0.993855 | 6.085407 |
d847f56f-0163-4c05-8158-577705024abb | koheihosono/Shiken | Shiken2/Shiken2/Shiken2.cpp | #include <iostream>
using namespace std;
int main()
{
int number;
cin >> number;
if (number % 2 == 0)
{
cout << "偶数" << endl;
}
else
{
cout << "奇数" << endl;
}
} | ALGO | 0.999682 | 3.77483 |
54dd60dd-f0a1-4aef-9593-8c69c17622af | GiacomoLeoneMaria/Differential_equation_Eulero_Runge_Kutta_4th | eq.diff Eulero Runge-Kutta/VettoreLineare.cpp | #include"VettoreLineare.h"
#include"Vettore.h"
#include<iostream>
using namespace std;
VettoreLineare::VettoreLineare(unsigned int a): Vettore(a) { }
VettoreLineare::~VettoreLineare() { }
VettoreLineare VettoreLineare::operator+(const VettoreLineare &V) const {
VettoreLineare r(GetN());
if (GetN()!=V.GetN()) {... | TOOL | 0.869145 | 3.904943 |
83763d76-5287-4e61-87d8-dd9cf51a4a85 | UScuber/atcoder_codes | typical90/056.cpp | #include <iostream>
#include <vector>
#include <bitset>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
//37[ms]
int main(){
int n,s;
cin >> n >> s;
vector<int> a(n), b(n);
rep(i, n) cin >> a[i] >> b[i];
vector<bitset<100001>> dp(n + 1);
dp[0] = 1;
rep(i, n){
rep(j, s){
if(!dp... | ALGO | 0.99993 | 3.140123 |
7622a9a7-5765-40ce-9a1d-e9a552887fc7 | WizardPenguin/competative-programming | 1000-1500/C_Omkar_and_Determination.cpp | // from editorial
// given which cells are exitable we want must be able to determine exactly which grid could give such result
// for that we want to find which kind of structure is causing us not able to find grid exactly
/*
d
dd where d is non deterministic cells in this condition rightmost d can either be ... | ALGO | 0.9999 | 5.023958 |
c841b6f3-fb9e-47e8-b8a0-077e41d5db75 | nekoffski/lumen | src/geometry/AABB.cpp | #include "AABB.h"
namespace lm {
AABB::AABB() : m_min(0.0f), m_max(0.0f) {}
AABB::AABB(const Vec3f& min, const Vec3f& max) : m_min(min), m_max(max) {
static constexpr Float delta = 0.0001f;
for (u8 axis = 0; axis < 3; ++axis) {
if ((m_max[axis] - m_min[axis]) < delta) {
m_max[axis] += de... | TOOL | 0.893108 | 7.136717 |
a06cc443-3363-4ce9-aac3-b3916879c69c | divyanshchawla23/daily-code | 908-middle-of-the-linked-list/middle-of-the-linked-list.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) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.999937 | 5.778479 |
860fe561-2d4a-4841-be0c-14ef46173d49 | nerzhul/MangosFX | src/bindings/ScriptDev2/scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp | /* ScriptData
SDName: Boss_Emperor_Dagran_Thaurissan
SD%Complete: 90
SDComment: With script for Moria
SDCategory: Blackrock Depths
EndScriptData */
#include "precompiled.h"
#include "blackrock_depths.h"
enum eEmperor
{
FACTION_NEUTRAL = 734,
SAY_AGGRO = -1230001,
SAY_SLAY ... | TOOL | 0.910364 | 6.430994 |
36378299-4a60-49e6-a716-f36a19d6a2bf | Johannyjm/c-pro | AtCoder/abc/abc233/c.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll n, x;
cin >> n >> x;
vector<int> l(n);
vector<vector<ll>> a(n);
... | ALGO | 0.999828 | 4.045541 |
bd50917f-1540-4920-9551-ddbd80ed4906 | Doris-UESTC/codeforces_train | dp_U.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int a[20][20];
int dp[1<<20];
int32_t main(){
int N;
cin>>N;
int m=1<<N;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
cin>>a[i][j];
}
}
for(int i=1;i<m;i++){
for(int j=0;j<N;j++){
if... | ALGO | 0.999972 | 4.357646 |
7517070a-d422-4e43-abfa-ec83abf778c9 | yizhifang123/Coding-Projects | CP4BookBook1/Section 2.2.1/Excercise2211.cpp | #include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
using namespace std;
bool custom_comparison(const tuple<int, string, string>& a, const tuple<int, string, string>& b) {
if (get<0>(a) != get<0>(b)) {
return get<0>(a) > get<0>(b);
}
if (get<1>(a) != get<1>(b)) {
re... | ALGO | 0.998846 | 5.306749 |
a83efab4-0977-499f-8928-f53c20e79567 | 12345supu/Leetcode-and-GFG | 169-majority-element/169-majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int r=0,c=1;
for(int i=1;i<nums.size();i++)
{
if(nums[i]==nums[r])
c++;
else
c--;
if(c==0)
{
r=i;
c=1;
... | ALGO | 0.999882 | 5.540881 |
6075ca65-87c4-4ea8-8220-2ed58fac3e75 | FABIANAVQ1/Estructura-de-Datos-ESIS | LABORATORIO 01-02/arreglo.cpp | #include<iostream>
#include"arrays.h"
#define max 10
using namespace std;
int main(){
int x[max], op,opc,n=-1,dato,i;
do{
system("cls");
cout<<"\n MENU";
cout<<"\n=================";
cout<<"\n1. ARRAY DESORDENADO";
cout<<"\n2. ARRAY ORDENADO";
cout<<"\n3. SALIR";... | ALGO | 0.988699 | 3.810337 |
8d955549-0696-4aaf-8414-fc15224009dc | dezhihuang/exercises | Maya_Calendar.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
char haabMonth[][7] = { "pop", "no", "zip", "zotz", "tzec",
"xul", "yoxkin", "mol", "chen", "yax",
"zac", "ceh", "mac", "kankin", "muan",
"pax", "koyab", "cumhu", "uaye... | ALGO | 0.993209 | 3.588216 |
371df0d8-6fe5-4eb8-b185-020c8cd49f58 | Nicholaschoi04/StockMarketWebApp | env/lib/python3.9/site-packages/prophet/stan_model/cmdstan-2.31.0/stan/lib/stan_math/lib/tbb_2020.3/src/test/test_parallel_scan.cpp | #include "tbb/parallel_scan.h"
#include "tbb/blocked_range.h"
#include "harness_assert.h"
#include <vector>
typedef tbb::blocked_range<long> Range;
static volatile bool ScanIsRunning = false;
//! Sum of 0..i with wrap around on overflow.
inline int TriangularSum( int i ) {
return i&1 ? ((i>>1)+1)*i : (i>>1)*(i+1... | ALGO | 0.884951 | 6.0339 |
7aa0c37e-185e-4da4-9e95-f7b2cc50c9a9 | kunalbhatia-868/Leetcode | 25-reverse-nodes-in-k-group/25-reverse-nodes-in-k-group.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) {}
* };
*/
class Solution {
public:
ListNode* reverseK(Li... | ALGO | 0.999994 | 5.891641 |
5f0c9d04-58f8-4cd9-95a8-58a90173c795 | Arunish12/H_sheet | q20.cpp | // Write a program to print all the prime numbers within 1-100.
#include<iostream>
using namespace std;
bool isprime(int n){
if(n<=1){
return false;
}
for(int i =2; i*i<=n; i++){
if(n % i == 0){
return false;
}
}
return true;
}
int main() {
cout << "... | ALGO | 0.997927 | 3.69301 |
f1e5a1f8-f1f6-4ae9-90d3-1c7e80aa801e | bjk0t/aaf-labs-2022 | volynets_fi-03/MyTree.cpp | //////////////////////////////////////////////////////////////////
///// https://gist.github.com/toboqus/def6a6915e4abd66e922 //////
//////////////////////////////////////////////////////////////////
#include <iostream>
using namespace std;
struct node{
int value;
node *left;
node *right;
};
class btree{
public:... | ALGO | 0.999194 | 4.612277 |
cbc30c04-5c7f-41c4-ad6b-66c380ae68e2 | ZhangMenghe/Algorithm-Forever | BinaryTree/SplayTree.cpp | #include <cstdio>
#include <iostream>
using namespace std;
// Splay tree implementation
/*Application: search engine
15
? 1
+ 1
? 1
+ 2
s 1 2
+ 1000000000
? 1000000000
- 1000000000
? 1000000000
s 999999999 1000000000
- 2
? 2
- 0
+ 9
s 0 9
Output:
Not found
Found
3
Found
Not found
1
Not found
10
*/
// Vertex of a splay... | ALGO | 0.999978 | 4.028951 |
36cc8e60-8b15-4f83-a1f4-0813f44ba158 | Shri2602/LeetCode | 0144-binary-tree-preorder-traversal/0144-binary-tree-preorder-traversal.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.99997 | 6.137772 |
baa6dedc-6cce-4342-9729-b6f6dcf9fbc3 | hjaremko/asciinem | src/server/util.cpp | #include "server/util.hpp"
namespace asciinem::server
{
auto parse_command_line( int argc, char** argv ) -> cxxopts::ParseResult
{
using namespace cxxopts;
static auto options { Options { *argv, "Asciinem server 1.0.0" } };
options.positional_help( "[optional args]" ).show_positional_help();
options... | TOOL | 0.902732 | 7.092414 |
111af33c-3720-4560-b7a0-20cdda88e321 | themennice/programming-challenges | GameOfStones.cpp | /*
https://www.hackerrank.com/challenges/game-of-stones-1/problem
*/
string gameOfStones(int n) {
if(n % 7 == 0 || n % 7 == 1)
return "Second";
return "First";
}
| ALGO | 0.996814 | 3.103889 |
c9e44b74-0c64-44fe-9987-9dca5b5c60bc | mt2522577/TranMelvin_CSC5_40717 | Class_Lab/CompareSorts/main.cpp | /*
* File: main.cpp
* Author: Melvin Tran
* Created on February 4, 2015, 8:14 AM
*/
//System Libraries
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
//User Libraries
//Global constants
//Function prototypes
void filAray(int [],int);
void prntAry(const int [],int,int);
void copy(... | ALGO | 0.997221 | 4.29301 |
9d6789f9-f97f-4f0c-a73f-fe3194a546ae | gonpaul/cses_cpp | introductory/4_incarr.cpp | #include <iostream>
using namespace std;
int main() {
long long maxn = 0, sum = 0;
long n;
cin >> n;
for (int i = 0; i < n; ++i) {
long long num;
cin >> num;
maxn = max(maxn, num);
sum += maxn - num;
}
cout << sum;
return 0;
}
| ALGO | 0.999816 | 3.469382 |
5761b9f3-c604-4362-93f3-10a14757ab17 | masudranam/dsa_problems | Codeforces/B_Line_by_Line.cpp | #include<bits/stdc++.h>
using namespace std;
#define print(a) for(auto x:a)cout<<x<<' ';cout<<'\n';
#define debug(x) cout<<#x<<" "<<x<<'\n'
#define int long long int
const int M = 1e9 + 7;
const int N = 2e5 + 10;
void solve(){
int n; cin >> n;
for(int i = 0; i < n; i++){
cout << "Hello world\n";
... | ALGO | 0.971944 | 3.04117 |
17f2f488-566b-4b7a-b14c-a0d00ce4229b | HassanFCS/Programming-Tasks | Compiler Construction/Parser/Parser/Source.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include<conio.h>
#include <string>
#include <stack>
using namespace std;
struct Transition
{
vector<string> TEs;
};
class Production
{
public :
string name;
vector<Transition> Ts;
set<string> Firsts;
set<string> Follows;
Pr... | ALGO | 0.996064 | 3.081085 |
4f98ffc9-d08d-438c-8dbe-a05299979b2f | nuindustries/remote-challenge-cpp-public | src/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include "input_output.h"
#include "challenge_function.h"
#include "point.h"
int main(int argc, char** argv) {
if (argc != 3) {
std::cout << "USAGE: " << argv[0] << " [INPUT_FILE] [OUTPUT_FILE]" << std::endl;
return 0;
}
auto input_file = std::string{arg... | TOOL | 0.901664 | 5.687953 |
7dff5509-cd5d-49a0-8251-036c48155ff7 | Radzzz999/exerciseprosedural_030 | ConsoleApplication1.cpp | #include <iostream>
using namespace std;
double rerata(double a, double b) {
return (a + b) / 2;
}
string status(double r) {
if (r >= 60) {
return "Diterima";
}
else {
return "Ditolak";
}
}
string status2(double r, double n) {
if (r >= 60 && n >= 70) {
return "Diterima... | ALGO | 0.995287 | 4.957495 |
6800e529-e5f9-4014-a99e-0530e086242a | AliSharjeell/LeetCode | 273-integer-to-english-words/integer-to-english-words.cpp | class Solution {
public:
string numberToWords(int n) {
if(n == 0) return "Zero";
else return int_string(n).substr(1);
}
private:
string below_20[19] = {"One", "Two", "Three", "Four","Five","Six","Seven","Eight","Nine","Ten", "Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Sevent... | ALGO | 0.993131 | 6.5107 |
d661a7b1-6ca4-4b7d-a701-a12b85c62b7c | Alok-Khansali/Lets-LeetCode | Medium/Remove_Duplicate_Letters.cpp | class Solution //100% faster, and 94% better space utilisation
{
public:
string removeDuplicateLetters(string s)
{
// Arrays to store the frequency of the letter
// Check whether a character has been visited or not
int frequency[26] = {0}, visited[26] = {0};
string answer = "";
... | ALGO | 0.99999 | 6.721773 |
fc8068c6-1a6e-4429-8873-1049521a9d88 | skdi/ADA | uva507.cpp | #include <vector>
#include <iostream>
#include <math.h>
#include <ctime>
#include <time.h>
#include <stdlib.h>
using namespace std;
//UVA 507 jill's ride
int* suma_max(int *A,int n){
int e=0,d=-1;
int suma=0;
int i=1,f=0;
int sumamax=0;
while(f<n){
f++;
suma=suma+A[f];
if(suma<0){
suma=0;
i=f+1;
}els... | ALGO | 0.9993 | 3.55501 |
7a86f316-068e-4dca-bd36-de5e698b32bf | chydbd/data-structure-homework | linerList_homework/linerList_homework/linerList_homework.cpp | #include <cstdlib>
#include <cstdio>
#include <iostream>
#define LIST_INIT_SIZE 10
typedef struct {
int* elem;
int length;
int listsize;
}SqLinerList;
typedef struct LNode {
int data;
struct LNode* next;
}LNode, * LinkList;
bool initList(SqLinerList& L) {
L.elem = (int*)malloc(LIST_INIT_SIZE * sizeof(int));
... | ALGO | 0.999797 | 3.6368 |
aeb751f6-df0d-449f-baf5-1c457a824d34 | CrBillman/LAMMPS | USER-CG-CMM/pair_lj_sdk.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
This style is a simplified re-implementation of the CG/CMM pair style
------------------------------------------------------------------------- */
#include <math.h>
#include <stdio.h>
#include... | ALGO | 0.999157 | 6.91609 |
833ea4e8-61da-49c4-b619-43ccac9197b5 | Mattias-Petersson/leetcode-cpp | 2095-middle-linked-list/Solution.cpp | #include "Solution.h"
ListNode *Solution::deleteMiddle(ListNode *head)
{
if (!head->next)
return nullptr;
ListNode *turtle = head;
ListNode *hare = head;
ListNode *before_middle = head;
while (hare && hare->next)
{
before_middle = turtle;
turtle = turtle->next;
h... | ALGO | 0.999874 | 5.18782 |
6c856b48-99b6-4f03-b045-976d8f7c1e10 | moldiscovery/eigen-fork | doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
Eigen::VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n" << v << ... | ALGO | 0.99833 | 3.744776 |
9d700659-2c1e-4f21-b274-218deaf859d1 | utkarshyadav5/Data-Structure-in-cpp | array/merge_overlapping.cpp | #include <bits/stdc++.h>
using namespace std;
class Interval{
public:
int first;
int sec;
};
bool compare(Interval a,Interval b){
return (a.first < b.first)?1:0;
}
void mergeIntervals(Interval arr[],int n){
stack <Interval> s;
sort(arr,arr+n,compare);
s.push(arr[0]);
for(int i=1;i<n;i++... | ALGO | 0.999961 | 4.828577 |
b3ffa516-b607-4b35-89da-be3ab2dae88b | absolutePi/Competitive_Programming | POSN/CSES/towers_lds.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
//ios::sync_with_stdio(false);
//cin.tie(0);
int n;
cin >> n;
vector<int> v(n);
for(auto &i : v){cin >> i;}
multiset<int> s;
int ans=0;
for(int i=0;i<n;i++){
if(s.upper_bound(v[i])==s.end()){
ans++;
... | ALGO | 0.999917 | 4.192393 |
659f1405-7a91-4759-86dd-d86ad918bb0e | GeorgianBadita/University | BachelorExamPrep/OOP/Execices/mergesort.cpp | //
// Created by geo on 17.06.2020.
//
#include "mergesort.h"
//arr = [1, 2, 3, 4, 5, 6];
//left = 0, right = 5, mid = 2;
//leftSide = [0, 1, 2]
//rightSide = [3, 4, 5]
void merge(int left, int mid, int right, int *arr) {
int *leftSide = new int[mid - left + 1];
int *rightSide = new int[right - mid];
int ... | ALGO | 0.99884 | 5.448566 |
ff767703-44e7-4645-abd2-d77020210fe8 | jayshri-developer/DataStructures_and_Algorithms | GFG challenge/String rp or pr.cpp | // TC:- O(|S|)
// SC:- O(|S|)
// link:- https://practice.geeksforgeeks.org/problems/d25f415de2ff3e02134de03e17ad019d723ab2e9/1
class Solution{
public:
long long solve(int X,int Y,string S)
{
stack<char> st;
int n = S.size();
long long ans = 0;
for(int i = 0; i<n; i++)
{
... | ALGO | 0.999492 | 4.050945 |
205940bc-a808-4c07-934b-2c97feda95a8 | ishandutta2007/codeforces | yuu/normal/915/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define setbit(s, i) (s|=(1LL<<(i)))
#defi... | ALGO | 0.999991 | 4.368928 |
9b6ab48c-529e-46b3-8da0-9d3e1e66cd04 | Adi2209/DSA | 0129-sum-root-to-leaf-numbers/0129-sum-root-to-leaf-numbers.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.999941 | 6.836957 |
86427f4c-c3ce-4f76-a414-52cafb59d72c | KurtGabrielAnduque/DSA-CPE010CPE21S1 | CPE010_HOA6_ANDUQUE/SUPPLEMENTARY_Problem 4.cpp | #include <iostream>
using namespace std;
int recursiveBinarySearch(int arr[], int left, int right, int key) {
if (left > right) {
return -1;
}
int mid = left + (right - left) / 2;
if (arr[mid] == key) {
return mid;
}
else if (arr[mid] < key) {
return recursi... | ALGO | 0.999946 | 6.897414 |
9996462a-0a12-49e6-88df-09ea3fbc32b5 | Avokadoen/OpenglFlightPrototype | assimp/code/Importer/IFC/IFCOpenings.cpp | /** @file IFCOpenings.cpp
* @brief Implements a subset of Ifc CSG operations for pouring
* holes for windows and doors into walls.
*/
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include "code/PolyTools.h"
#include "code/ProcessHelper.h"
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
#inclu... | TOOL | 0.918724 | 3.724001 |
2ba9c9c5-f6a3-4626-89a6-1451ac25d8fd | Zaberahmed/mixed-programming | CPP and C/closest-multiple.cpp | #include<bits/stdc++.h>
using namespace std;
long long int power(long long int a,long long int b)
{
long long int c=a;
for(int j=1;j<b;j++)
{
a=a*c;
}
return a;
}
int main()
{
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
long long int x,a,b,res;
long long int exp;
... | ALGO | 0.999964 | 3.786412 |
0bffb943-c20b-4ff1-8efc-b20373c7103a | dhruviagrawal/leetcode-practise | 173-binary-search-tree-iterator/173-binary-search-tree-iterator.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.999879 | 6.408821 |
2d5a2024-b4df-4957-b5be-ffbcf58afa7b | hgyuhyeon/Algorithm-old | Leetcode/3016_Minimum_Number_of_Pushes_to_Type_Word_II.cpp | class Solution {
public:
int minimumPushes(string word) {
vector<int> v(26, 0);
for (auto c: word) v[c-'a']++;
sort(v.begin(), v.end(), greater<>());
int push = 1, cnt = 0, ans = 0;
for (int i = 0; i < 26 && v[i] > 0; i++) {
ans += (v[i] * push);
cnt++... | ALGO | 0.999985 | 5.458271 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.