uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ec9af7ab-de07-49e8-a51f-2d300e59d36a | Ethan4582/Codeforces-solution | CODEFORCES/A_set/A_Maximize_the_Last_Element.cpp | #include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define p(a) cout << a << "\n";
#define p2(a, b) cout << a << " " << b << "\n";
const ll mod = 1e9 + 7;
const int N = 1e5 + 5;
... | ALGO | 0.999691 | 4.975257 |
93b6dbc1-2266-4cf2-af6b-ba6be87be306 | moana16/BOJ | Stack/줄서기.cpp | #include<bits/stdc++.h>
using namespace std;
bool cmp(const string &a, const string &b) {
char ca = a[0], cb = b[0];
int na = stoi(a.substr(2));
int nb = stoi(b.substr(2));
if(ca != cb) return ca < cb;
return na < nb;
}
int main() {
int N; cin>>N;
int total = N*5;
vector<string> init... | ALGO | 0.999911 | 5.4497 |
a4305735-3f29-4809-9e7d-8a9f02ee6bc1 | MilanSihag/Lpu_CPP_2023 | DSA/Trees/level_sum.cpp | #include<iostream>
#include<queue>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int val){
data=val;
left=NULL;
right=NULL;
}
};
int getSum(Node* root,int k){
if(root==NULL) return 0;
if(k==0) return root->data;
int sum=0;
int level=1;
queue<Node*> q;
q.push(... | ALGO | 0.999982 | 4.246137 |
d57c2725-c805-44e0-a947-7a02e9d6216a | 0scarChavez/Tareas_de_Clase | MARZO/07.MARZO/1.Num_Primo.cpp |
#include <iostream>
using namespace std;
// funcion para determinar si el numero es primo
void numero_primo(int numero)
{ // utilizamos void porque no retornaremos un valor
bool primo = true; // asumimos de base que el numero es primo
// inicamos un for desde el 2 hasta un numero antes del... | ALGO | 0.994769 | 3.083467 |
cfbef39c-9947-4742-aacb-379ac3459169 | Md-Noman-Biswas/Codeforces_problems | D_Backspace.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define db cout << "h"
#define pb push_back
#define llmx LONG_LONG_MAX
#define llmn LONG_LONG_MIN
#define mod 1000000007
const int N = 1e5 + 7;
const int INF = 1e9 + 10;
void solve(){... | ALGO | 0.999971 | 4.749448 |
4388ffa6-4890-42a9-8b81-35d89d91acbc | steamqaqwq/dataStruct | 排序/堆排序小根堆.cpp | #include <stdio.h>
// 建立大根堆 根>=左右孩 根结点比孩子大
// len元素长度 len/2有分支节点个数 从后往前
// 理解下坠过程!
/////////////
// 堆的插入和删除
// 堆的插入不断和父节点i/2UP 比较替换 "上升过程"
// 堆的删除 删除后用栈底元素替换 之后 "下坠过程"
/////////////
void BuildMaxHeap(int A[], int len)
{
void HeadAdjust(int A[], int k, int len);
//len也代表元素初始位置(下标)
for (int i = len / 2; ... | ALGO | 0.99997 | 3.865194 |
d6b58e2f-7c5c-4136-833c-39691f8cb2c5 | JayashriJadhav/CPP-Programs | program (48).cpp | #include<iostream>
#include<stdio.h>
using namespace std;
typedef struct node
{
int data;
struct node* next;
}NODE,*PNODE,**PPNODE;
void InsertFirst(PPNODE Head,int no)
{
PNODE newn=new NODE;
newn->data=no;
newn->next=NULL;
if(*Head==NULL)
{
*Head=newn;
}
else
{
newn->next=*Head;
*Head=newn;
}
}
v... | ALGO | 0.998761 | 3.90279 |
08e82089-2e56-470a-9e18-6f03375bd7b2 | Clarus23/algorithm-training | programmers/Lv_1/personality_survey.cpp | #include <string>
#include <vector>
#include <map>
using namespace std;
string solution(vector<string> survey, vector<int> choices) {
string answer = "";
const int size = survey.size();
map<char, int> category;
string categoryInsert = "RTCFJMAN";
for(char c : categoryInsert) category.insert({... | ALGO | 0.999862 | 6.051983 |
cc9340b4-7c14-4fbe-942c-393db71e1aab | shivam5594/ESP32_MPU9250 | components/SVD/src/xrotg_3x3.cpp | // Include Files
#include <math.h>
#include "mw_cmsis.h"
#include "rt_nonfinite.h"
#include "svd_3x3.h"
#include "xrotg_3x3.h"
// Function Definitions
//
// Arguments : float *a
// float *b
// float *c
// float *s
// Return Type : void
//
void xrotg_3x3(float *a, float... | ALGO | 0.999552 | 5.163662 |
ca1bcebc-96f6-431c-98d7-98148b640d3b | alexandraback/datacollection | solutions_5631572862566400_1/C++/sine/C.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#pragma warning (disable:4996)
using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define per(i, a, b) for(int i = (b) - 1; i >= (a);... | ALGO | 0.999735 | 4.269926 |
1f5201c7-6ad2-49fd-9de7-e50c33a38964 | mshalm/sappy | src/Solver.cpp | #include <iostream>
#include <pybind11/pybind11.h>
#include <pybind11/eigen.h>
#include <Eigen/Dense>
#include <vector>
#include <tuple>
#include "Solver.hpp"
#include <chrono>
#include <iostream>
using namespace std;
using namespace Eigen;
namespace py = pybind11;
using std::abs;
using std::sqrt;
using std::max;
#... | ALGO | 0.999393 | 5.40584 |
1dcb5bef-2b00-4eb7-b923-ecd3d0fd07cd | xueweiz/Crane | Membership.cpp | #include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <unistd.h>
#include <iomanip>
#include <stdlib.h> // atoi
#include <unistd.h> // sleep
#include <stdio.h>
#include <string.h>
#include <sys/poll.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#... | ALGO | 0.885876 | 3.063007 |
0058d117-5ac8-49b1-977e-de7eb0fcb122 | purplesyringa/xcrypto | pack.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <string_view>
#include <vector>
enum class TokenKind {
PUNCTUATION,
KEYWORD,
IDENTIFIER,
LITERAL,
PREPROCESSOR,
STREAM_SEPARATOR
};
struct Token {
TokenKind kind;
s... | ALGO | 0.995606 | 5.239285 |
3f64600f-a5bc-4280-a91f-686cf33c506d | nguyendo24/professional_cpp_marc_gregoire | Code/c20_code/04_OperationalAlgorithms/04_ForEachModify.cpp | import <algorithm>;
import <vector>;
import <iostream>;
using namespace std;
int main()
{
vector values{ 11, 22, 33, 44 };
// Double each element in the values vector.
for_each(begin(values), end(values), [](auto& value) { value *= 2; });
// Print all the elements of the values vector.
for_each(cbegin(values)... | ALGO | 0.999625 | 5.432692 |
e6da4453-d3e1-45ca-b479-2e0af58f9377 | pouryashirazian/FemBrain | src/3rdparty/bullet3/Bullet3OpenCL/BroadphaseCollision/b3GpuGridBroadphase.cpp |
#include "b3GpuGridBroadphase.h"
#include "Bullet3Geometry/b3AabbUtil.h"
#include "kernels/gridBroadphaseKernels.h"
#include "kernels/sapKernels.h"
//#include "kernels/gridBroadphase.cl"
#include "Bullet3OpenCL/Initialize/b3OpenCLUtils.h"
#include "Bullet3OpenCL/ParallelPrimitives/b3LauncherCL.h"
#define B3_BROADPHA... | ALGO | 0.974124 | 6.286469 |
16386814-b379-4fda-9056-2318eb0157bb | Parth-Thakar/Practice-Questions-C- | Untitled9.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node* add;
node(int x)
{
data=x;
add=NULL;
}
};
void inserthead(node* &head,int data)
{
node* newnode=new node(data);
newnode->add=head;
head=newnode;
}
void print(node* head)
{
while(head!=NULL)
{
... | ALGO | 0.999343 | 3.847756 |
db968eb9-5b5b-4cc5-a0b2-bf64ba92765a | devjatinrawat/Cpp_Programs | p89_bitwise2.cpp | #include<iostream>
using namespace std;
//Bitwise Or
int main()
{
int a=10,b=7,c;
c=a|b;
cout<<"a|b="<<c;
return 0;
}
| ALGO | 0.998952 | 3.217965 |
9b6fdc5c-a4c9-479f-84d4-c3a3d85eda6e | akcube/CP-Teaching | binary-search/maximum-median.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
void solve(){
// Input
int n, k; cin >> n >> k;
vector<int> a(n); for(auto &x : a) cin >> x;
sort(a.begin(), a.end());
// Binary search
int l=0, r=2e9+100, ans=-1;
while(l <= r){
auto ok = [&](int m){
int req = 0;
for(... | ALGO | 0.999997 | 5.284812 |
ffca847a-1edf-4403-b0e2-bedbd4ca9299 | Seungho324/codetree-TILs | 240925/마법의 숲 탐색/magical-forest-exploration.cpp | #include <iostream>
#include <utility>
using namespace std;
#define endl '\n'
#define MAX 75
#define WALL 9
#define CENTER 5
#define EXIT 4
#define OCC 3
short maze[MAX][MAX];
short mazeTrav[MAX][MAX];
int curMax = 0;
void printMaze(int row, int col) {
for (int r = 0; r < row+2; r++) {
for (int c = 0; c... | ALGO | 0.999553 | 4.428129 |
a458bb5a-7bc8-47ef-b5a4-29606963b9ae | liwei2088/oi | 计蒜客/96模拟赛/03CSP-J2/02.cpp | #include <cstdio>
#include <iostream>
using namespace std;
int n;
char s[100005];
int main() {
freopen("light.in", "r", stdin);
freopen("light.out", "w", stdout);
cin >> n;
scanf("%s", s + 1);
int ans = 0;
for (int i = n; i >= 1; i--) {
if (s[i] == '1') {
for (int j = 1; j * ... | ALGO | 0.999883 | 3.673826 |
8aed57c6-5b43-4f07-bbe1-c1abef314344 | amrharb/leetcode | 976-largest-perimeter-triangle/976-largest-perimeter-triangle.cpp | class Solution {
public:
int largestPerimeter(vector<int>& v) {
int n=v.size(),mx=0;
sort(v.begin(),v.end());
for(int i=3;i<=n;i++){
if(v[i-2]+v[i-3]>v[i-1])mx=max(mx,v[i-2]+v[i-3]+v[i-1]);}
return mx;
}
}; | ALGO | 0.999722 | 4.984634 |
31f0cb12-f0f3-4516-b637-ffaf699a8b4f | YuanshengZhao/NNPEngine | src/bond.cpp | #include "bond.h"
#include "memory.h"
#include "mathlib.h"
#include "util.h"
#include <iostream>
BOND::BOND(int n, int ns)
{
nbtyp=n;
nbonds=ns;
create2DArray(bond,ns,3);
create2DArray(coef,nbtyp,4);
create1DArray(i_start,ENVIRON::NUM_THREAD);
create1DArray(i_end,ENVIRON::NUM_THREAD);
for(i... | ALGO | 0.997322 | 4.347421 |
20a01b7f-48e4-40d6-b67a-29b173b5e87a | Haneul99/Baekjoon | 14001-15000/14301-14400/14391.cpp | #include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;
int paper[5][5];
bool check[5][5] = { false, };
int n, m;
int ans = 0;
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
char c;
sc... | ALGO | 0.999829 | 3.521286 |
d2ca65a3-fa72-4e41-9544-26a4a1cf2e5b | ishandutta2007/codeforces | demoralizer/normal/1333/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)((x).size())
#d... | ALGO | 0.999956 | 4.019865 |
f04cce63-1cbb-4051-bf5c-172f4021d3da | prakhar290/leetcode-programs | power-of-two.cpp | //question//
Given an integer n, return true if it is a power of two. Otherwise, return false.
An integer n is a power of two, if there exists an integer x such that n == 2x.
Example 1:
Input: n = 1
Output: true
Explanation: 20 = 1
Example 2:
Input: n = 16
Output: true
Explanation: 24 = 16
Example 3:
Input: n = 3... | ALGO | 0.999426 | 6.559942 |
50e8be0f-02c7-4002-847c-0299303c4083 | RSathvika20/leetcode- | 657-robot-return-to-origin/robot-return-to-origin.cpp | class Solution {
public:
bool judgeCircle(string moves) {
int x = 0, y = 0;
for (char i : moves) {
if (i == 'U') y++;
else if (i == 'D') y--;
else if (i== 'R') x++;
else if (i == 'L') x--;
}
return x == 0 && y == 0;
}
}; | ALGO | 0.999866 | 6.087355 |
ff07faa2-8bf6-4b62-882b-26668d62fe31 | dosontung/MyApplication | app/src/main/cpp/page_dewarp.cpp |
#include <math.h>
#include <algorithm>
#include "page_dewarp.hpp"
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <jni.h>
#include <android/log.h>
#include <fstream>
#include "C_preprocess.hpp"
using namespace std;
using namespace cv;
#include "nlopt.hpp"
std::vector<cv::Point2d> span_points_fla... | ALGO | 0.976192 | 3.405836 |
85f3818e-79ae-43bc-9b70-f2aac55e769f | siddharthagarwal543/Sunyul-Hossen-DSA-Questions | Reverse words in a given string.cpp | //https://leetcode.com/problems/reverse-words-in-a-string/description/
class Solution {TC O(s.length()) SC O(s.length())
public:
string reverseWords(string s) {
int i=0;
vector<vector<char>>v;
string ans="";
while(i<s.length()){//splitting string with delimiter " "
int j... | ALGO | 0.999618 | 6.084135 |
810089ae-3e8a-43a3-96b6-bd956d9b0ca1 | Roestlab/DIAlignR | src/utils.cpp | #include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <functional>
#include "utils.h"
namespace DIAlign
{
namespace Utils
{
#if 1
double getQuantile(std::vector<double> vec, double quantile){
int n = vec.size();
double p = quantile;
double m = 1-p; // Type 7 definition as implem... | ALGO | 0.99878 | 5.804434 |
91dfdfb2-293f-4303-a7a5-6b85cb51c168 | joeyTurnerr/CodeForces-Walkthrough-cpp | 560A-Currency System in Geraldion.cpp | //560A-Currency System in Geraldion
#include <iostream>
#include <algorithm>
using namespace std;
int main ()
{
int n;
bool one = false;
cin >> n;
for (int i = 0; i < n; i++)
{
int num; cin >> num;
if (num == 1) one = true;
}
(one)? cout << -1 : cout << 1;
return 0;
... | ALGO | 0.999599 | 3.791316 |
e2932ffb-e12c-46e2-be4e-4fd68f638153 | vishalpa8/DSA | cpp practise/PascalTriangle.cpp | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)
int factorial(int n){
int fact = 1;
for(int i=2; i<=n; i++){
fact *= i;
}
return fact;
}
int main(){
fast_io;
int n = 5;
for(int i=0; i<n; i++){
... | ALGO | 0.99998 | 3.979592 |
15bb557d-6df7-4f5a-88fb-fddb43321c14 | Charbel-11/Competitive-Programming | Contests/Codeforces/EDU/Segment Tree 1/K-th One.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> base;
struct StVal {
int v = 0; StVal() {}
StVal(const int _v) : v(_v) {}
StVal(const StVal &v1, const StVal &v2) { v = v1 + v2; }
operator int() const { return v; } //Casts StVal to int
};
struct SegTree {
int n;
vec... | ALGO | 0.999995 | 4.720081 |
089fc245-17d1-459a-a6c5-df68f6cdc9f8 | Nakib-Arman/CSE318---ArtificialIntelligence | 4.DecisionTree/.history/a_20250709224843.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
int column_num;
string label;
unordered_map<string,Node*> children;
float threshold;
public:
Node(int column_num){
this->column_num = column_num;
this->label = "";
this->threshold = 0;
}
Node(string labe... | ALGO | 0.992672 | 4.719102 |
fc37168a-8a72-4064-8f1b-05eed389a31e | shreyas1610/Leetcode-GFG-Solved-Questions | 0055-jump-game/0055-jump-game.cpp | class Solution {
public:
bool canJump(vector<int>& nums) {
//Page 119
int n=nums.size();
bool ans=1;
int x=n-1;
for(int index=n-2;index>=0;index--){
if(index+nums[index]>=x){
ans=1;
x=index;
}
else{
... | ALGO | 0.999994 | 6.17662 |
cd656cd5-cfe1-45f3-b1f7-caa9af64b279 | ChukCharles/Coursera | 3. Red/week5/1.Move-semantics/2.group_heavy_strings/group_heavy_strings.cpp | #include "test_runner.h"
#include <string>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <utility>
#include <algorithm>
using namespace std;
// Объявляем Group<String> для произвольного типа String
// синонимом vector<String>.
// Благодаря этому в качестве возвращаемого значения
// функции ... | TEST | 0.996339 | 5.863059 |
2046d874-6090-45b0-8e6f-0aa8475c95b2 | aneeqaf/Quantum-Simulation | QuantumSim/compression/compression/gnuplot-iostream/boost_1_75_0/libs/iterator/example/permutation_iter_example.cpp | #include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <boost/iterator/permutation_iterator.hpp>
#include <boost/cstdlib.hpp>
#include <assert.h>
int main() {
using namespace boost;
int i = 0;
typedef std::vector< int > element_range_type;
typedef std::deque< int > index_type;
... | ALGO | 0.99377 | 4.425499 |
4573f103-6f48-4c79-b04e-cb53ce98a359 | wyllmein2000/AssignLP | backup/pdmtrfunc.cpp | #include <fstream>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <stdlib.h>
#include <set>
#include <map>
#include "wyarray.h"
#include "pdmtrfunc.h"
using namespace std;
/* -------------------------------------------------------------------
* solve Gx = g
* ... | ALGO | 0.999822 | 4.057874 |
fbd261f7-e8e3-43a1-9710-54c7051cea59 | AbdoWael2003/Graduation-Project-QAgent2.0- | FlowChartGeneration/CPPSamples/Sample415/sample_code415.cpp | #include <iostream>
#include <vector>
#include <algorithm>
const int MAX = 1000000;
std::pair<int, int> breakSum(int n) {
std::vector<int> dp(n + 1, 0);
dp[0] = 0;
dp[1] = 1;
for (int i = 2; i <= n; ++i) {
dp[i] = std::max(dp[i / 2] + dp[i / 3] + dp[i / 4], i);
}
return {dp[n], 0}; // ... | ALGO | 0.999894 | 5.712554 |
62938630-5bc4-48ef-a26a-c6e1bd2b1dc1 | Kaushik268mlore/CSES-PROBLEMSET | INTRODUCTORY_PROBLEMS/Number_Spiral.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int x,y;cin>>x>>y;
if(x>y){
if(x%2==0)cout<<(x*x)-y+1;
else cout<<(x-1)*(x-1)+y;
}
else {
if(y%2==0)cout<<(y-1)*(y-1)+x;
else cout<<(y*y)-x+1;
}
}
int32_t main(){
ios_base::sync_with... | ALGO | 0.999448 | 5.104262 |
c382a3d6-3674-4ea3-a428-8cc00fbf4016 | aboy-jiang/vs_code_project | leetcode/1_two_sum.cpp | /**
* @author JZC (<EMAIL>)
* @date 2021-01-19
* @brief https://leetcode-cn.com/problems/two-sum/
*
* 解决思路:
* 将数组中的数值(value)和位置角标(index)对调存储在map中。
* 然后数值相减就可以看成是位置角标相减。
* 然后使用相减后的角标位置作为key在map中检索即可。
*
*/
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
p... | ALGO | 0.999791 | 6.087256 |
1f8c3e3f-5f1a-4f61-8240-7b30a26cc48e | LorisPrataiolo/CodeWars-Solutions-Cpp | Roman-Numerals-Encoder.cpp | // Needs a fix
std::string solution(int number){
string sol ;
static map < int , string > myMap;
myMap = { {1000, "M"}, {900, "CM"},
{500, "D"}, {400, "CD"},
{100, "C"}, { 90, "XC"},
{ 50, "L"}, { 40, "XL"},
{ 10, "X"}, { 9, "IX"},
{ 5... | ALGO | 0.999974 | 6.212533 |
45f119c2-fdb9-4b91-acd1-145d7b5d3b40 | vikashkumr/Competitive-Programming | leetcode/131.palindrome-partitioning.cpp | /*
* @lc app=leetcode id=131 lang=cpp
*
* [131] Palindrome Partitioning
*/
// @lc code=start
class Solution {
public:
bool isPallindrome(string s) {
for(int i= 0;i<s.length()/2;i++) {
if(s[i]!=s[s.length()-i-1]) return false;
}
return true;
}
vector<vector<string>>... | ALGO | 0.999966 | 6.736696 |
33459e4a-7272-4e17-b42c-968406bb07fd | Ramil-caramel/Labaratornaya4 | 2.cpp | #include <iostream>
#include <vector>
std::pair<float, float> minMax(const std::vector<float>& masiv)
{
std::pair<float, float>para;
float minim, maxim;
if (masiv.size() != 0)
{
minim = masiv[0];
maxim = masiv[0]; // у нас наибольшее значение float не определенно конечно!!!! поэтому через этот шедевр
for (... | ALGO | 0.999608 | 4.280973 |
d7af93f5-cd3f-4dad-ae51-65bb3cd6e1a6 | evanjs97/CS410 | Libraries/eigen_library/doc/examples/Tutorial_ArrayClass_cwise_other.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXf a = ArrayXf::Random(5);
a *= 2;
cout << "a =" << endl
<< a << endl;
cout << "a.abs() =" << endl
<< a.abs() << endl;
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl... | ALGO | 0.994146 | 3.130341 |
0df983ee-c6de-428d-b42b-637c3ed22fba | varun0018/DSA | Recursion/practise/5.cpp | //remove duplicate
#include <bits/stdc++.h>
using namespace std;
string removeDup(string s)
{
if (s.length() == 0)
{
return "";
}
char first = s[0];
string ros = removeDup(s.substr(1));
if (first == ros[0])
{
return ros;
}
else
{
return first + ros;
... | ALGO | 0.999934 | 4.962267 |
e1861c6a-82be-4d9c-b22b-d45de0f6c666 | ishabhray/Competitive-Programming | atcoder/abc276c.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
#define al... | ALGO | 0.999976 | 3.818889 |
5b0092a5-c475-4e0b-9e67-1f5800179795 | sazid/codes | data_structures/binary_search_tree.cpp | /*input
8
15 6 4 5 7 23 71 50
*/
#include <bits/stdc++.h>
using namespace std;
struct node
{
int val;
node* left;
node* right;
};
node* root;
bool search(node* n, int k) {
bool result;
if (n == nullptr) {
result |= false;
}
else if (n->val == k) {
result |= true;
}
else if (n->val > k) {
cout << "Sea... | ALGO | 0.999976 | 4.150208 |
7102b1b3-fd7a-4ead-a72a-da36f20a0de6 | ishandutta2007/codeforces | fizzydavid/normal/518/B.cpp | //while(true)rp++;
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
typedef long long ll;
const ll INF=1<<28;
const ll LINF=1ll<<61;
string a,b;
int cnt1[300],cnt2[300];
bool used[200111];
int main()
{
... | ALGO | 0.999983 | 3.816565 |
21861466-bbf5-4d8d-8d9f-0e271eeb7fba | katariaNandini/LeetCode | 103-binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-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.999994 | 6.064632 |
0ca735c5-f03b-4788-9ae0-53caf43553a7 | navin-kumar9/login_page | 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 |
0e775836-2372-446b-aa2f-477e5fed0a20 | architiiit/Data-Structures-And-Algorithms | WEEK6/class2c.cpp | #include<iostream>
using namespace std;
void update(int* ptr)
{
cout<<"address stored inside p is :"<<ptr<<endl;
cout<<"address of ptr is "<<&ptr<<endl;//alag se naya pointer hai
*ptr=*ptr+10;
}
int main()
{
int a=5;
cout<<"address of a is "<<&a<<endl;
int* ptr=&a;
cout<<"address stored in... | TOOL | 0.925913 | 3.323389 |
0767c1a3-1247-4897-9344-8ad05d64a1a1 | Aranch422/Algorithm_Study | 2019_W/DP/2193_pinaryNum.cpp | #include <iostream>
using namespace std;
long long n;
// [i][0] ends 0
// [i][1] ends 1
long long dp[91][2];
void init(){
cin>>n;
dp[1][0]=0; dp[1][1]=1;
for(long long i=2;i<=n;i++){
dp[i][0]=dp[i-1][0]+dp[i-1][1];
dp[i][1]=dp[i-1][0];
}
cout<<dp[n][0]+dp[n][1];
}
int main(){
... | ALGO | 0.999969 | 3.424656 |
e8e30fbc-8c18-4b79-b8b8-074d3c5b39bd | ishandutta2007/codeforces | kshitij_sodani/normal/1521/B.cpp | //#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
llo it[100001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
llo t;
cin>>t;
while(t--){
... | ALGO | 0.999899 | 3.338182 |
522d8e3e-56f9-4d2a-941b-b81ead257e18 | yangjufo/LeetCode | 2021/1396. Design Underground System.cpp | class UndergroundSystem {
public:
unordered_map<int, pair<string, int>> checkInTime;
unordered_map<string, pair<int, int>> totalTime;
UndergroundSystem() {
}
void checkIn(int id, string stationName, int t) {
checkInTime[id] = {stationName, t};
}
void checkO... | ALGO | 0.907527 | 6.397439 |
bbd8cef4-d056-4aa8-969d-24d7f1fc6dda | Volgarenok/spbspu-labs-2025-aads-a | lanovenko.ivan/S2/conversion_to_postfix.cpp | #include "conversion_to_postfix.hpp"
namespace
{
size_t getPriority(const std::string& c)
{
size_t result = 0;
if (c == "(")
{
result = 0;
}
if (c == ")")
{
result = 1;
}
if (c == "+" || c == "-")
{
result = 2;
}
if (c == "*" || c == "/" || c == "%")
... | ALGO | 0.927325 | 5.646382 |
8c45c18c-aaca-4f22-b76d-5676c65e17df | Mr-Kondo/atcoder | ex/07.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// 変数a,b,cにtrueまたはfalseを代入してAtCoderと出力されるようにする。
bool a = true;// true または false
bool b = false;// true または false
bool c = true;// true または false
// ここから先は変更しないこと
if (a) {
cout << "At";
}
else {
cout << "Yo";
}
if (!a && b) {
... | ALGO | 0.982356 | 3.444963 |
94a7a142-5942-401d-9596-9208c7003138 | ishandutta2007/codeforces | fuppy/normal/1340/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef... | ALGO | 0.999881 | 3.689044 |
f4d454a5-a9b6-4819-af6e-e3ac892f0b5d | Abdou2111/IFT2125_Dev1 | Q4/MaxToysCalculator.cpp | // Marc Olivier Jean Paul: 20241763
// Abdelghafour Rahmouni: 20246224
#include "MaxToysCalculator.h"
#include <vector>
#include <math.h>
#include <iostream>
// ce fichier contient les definitions des methodes de la classe MaxToysCalculator
// this file contains the definitions of the methods of the MaxToysCalculator... | ALGO | 0.998228 | 5.144177 |
a3e4999a-88dc-4561-b62c-05777a2fae85 | ishandutta2007/codeforces | chemthan/normal/665/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
... | ALGO | 0.999786 | 3.179727 |
691c55dd-176d-4128-9621-138e1b88f391 | ArtSynen/Laboratory-Work | LAB1/LAB1.cpp | #include <stdio.h>
#include <stdlib.h>
#pragma warning(disable : 4996)
int main(int argc, char* argv[])
{
float a, b;
char opr;
double result;
puts("Zdijsnitj vvedennya danyh za formatom: operand1 operaciya operand2 <Enter>");
puts("Dlya zakinchennya roboty natysnitj klavishu q");
while (puts("Vvid->"), scanf(... | TOOL | 0.946003 | 3.214097 |
ca88dcbe-962a-4541-ab18-5a240aaaa85a | Moontasir1091/Competetive_PRGRM | Problem Solving (Rating Based)/R - 1100/B. Minimum Product.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int test; cin >> test;
while(test--){
int a, b, x, y,n; cin >> a >> b >> x >> y >> n;;
long long ans = 1e18;
for(int i=0; i< 2;++i){
int ba = min(a-x, n);
int bb = min(n-ba, b-y);
ans = min(a... | ALGO | 0.999534 | 3.977986 |
e7f8e4b8-bada-4cb3-98e9-f3133ecc0985 | ishandutta2007/codeforces | sana/normal/1381/C.cpp | #if 1
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define FOR(i,a,b) for (int i = (a)... | ALGO | 0.999993 | 3.802751 |
09958b8e-b568-45f3-a9f1-a770f3e87345 | srgvxm/Contests | contest_02/04/main.cpp | #include <iostream>
#include <tuple>
std::tuple<int, int, int> find_lcm(int a, int b) {
int maxs;
if (a>b) maxs=a;
if (a<=b) maxs=b;
while (true) {
if ((maxs%a==0) && (maxs%b==0)) {
break;
}
maxs++;
}
return std::make_tuple(maxs, maxs/a, maxs/b);
}
std::tuple... | ALGO | 0.999931 | 5.561264 |
1f5c18ef-2b56-4ddf-afe1-55b435b5c2cd | lionelStuart/Target-Tracking-With-Qt | 60209_MTT_V0.4a/Tracker/KCF/MyKCFTracker.cpp | #include "MyKCFTracker.h"
namespace KCF{
CMyKCFTracker::~CMyKCFTracker(void)
{
}
void CMyKCFTracker::_init(const cv::Mat &_frame,const cv::Rect&_trackWindow)
{
KCFTracker::init(_trackWindow,_frame);
}
void CMyKCFTracker::_tracking(const cv::Mat &_frame,cv::Rect &_trackWindow)
{
_trackWindow=KCFTracker::update(_fram... | TOOL | 0.872836 | 4.190457 |
9499d428-56f7-42fb-9024-8d1299be66eb | architjindalcs/Leetcode-Solutions | find-kth-largest-xor-coordinate-value/find-kth-largest-xor-coordinate-value.cpp | class Solution {
public:
int partition(vector<int>& nums,int low,int high){
int pivot=nums[high];
int st=low-1;
for(int i=low;i<=(high-1);i++){
if(nums[i]<=pivot){
swap(nums[++st],nums[i]);
}
}
swap(nums[st+1],nums[high]);
retur... | ALGO | 0.999971 | 5.329965 |
470acd78-2f17-4ffc-97a3-9f4818d8b628 | aanu2021/Leetcode-Solutions | 2418-sort-the-people/2418-sort-the-people.cpp | class Solution {
public:
vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
int n = names.size();
vector<pair<int,string>>vec(n);
for(int i=0;i<n;i++){
vec[i] = {heights[i], names[i]};
}
sort(vec.rbegin(),vec.rend());
vector<string>an... | ALGO | 0.999979 | 6.438372 |
d3d6702f-0d11-446a-8c67-ce91c0f980e5 | Kitanonsan/Lab7 | lab7_3.cpp | #include<iostream>
using namespace std;
int adiff(int a,int b)
{
int c;
c = a-b;
if(a-b >=180 && a-b <360)
{
c = 360 -c;
}
if (a-b >= 360)
{
c = c%360;
}
if(a-b <= 0)
{
c = c*(-1);
}
if ( c >= 180 && c <360)
{
c = 360 -c;
}
if(c >= 360)
{
c = c%360;
}
return... | ALGO | 0.999697 | 3.929688 |
80524856-5353-4a2b-8d64-562f1396b0fa | birdwatcherYT/PatternMining | SequenceMining/main.cpp | // LASSO for sequence data
#include "SequenceMining.hpp"
using namespace std;
const int splitNum = 100;
const int maxloop = INT_MAX;
const double eps = 1e-6;
const int freq = 5;
const double R=pow(0.01, 1.0/(splitNum-1));
const int minsup=1;
const int maxpat=10;
string filepath="./data/";
int main(int argc, char **ar... | DATA | 0.996605 | 3.910339 |
06a21177-d315-40d8-a909-e2c1da82ec8f | apsosa/algoritmos1 | AED1 TALLER/CLionProjects/Ejercicio 5/main.cpp | #include <iostream>
using namespace std;
int divisoresdeX(int x){
int i = 2;
int cantidadDiv = 0;
while(i<x) {
if (x % i == 0) {
cantidadDiv = cantidadDiv + 1;
}
i++;
}
return cantidadDiv;
}
bool esPrimo(int x){
if (divisoresdeX(x) == 0) {
return tru... | ALGO | 0.997579 | 3.857705 |
b0cba5e1-5e74-406a-97a3-4f1e019016fa | 8bit-nyk/HSLAM | Thirdparty/opencv-3.4.6/opencv_contrib-3.4.6/modules/xfeatures2d/samples/bagofwords_classification.cpp | #include <iostream>
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_ML
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include "opencv2/ml.hpp"
#include <fstream>
#include <memory>
#include <... | ALGO | 0.889236 | 6.898592 |
d03a0e7e-2680-4c07-8e73-50325ca4844d | LeDuyDuong/bai8 | exercise2.cpp | #include <iostream>
#include <math.h>
using namespace std;
class CDiem {
private:
int x,y;
int kc;
public:
friend istream& operator>>(istream&, CDiem&);
friend ostream& operator<<(ostream&, CDiem&);
int operator>(const CDiem &);
int operator<(const CDiem &);
int operator==(const CDi... | ALGO | 0.999245 | 3.081432 |
736d3709-c9c2-4b07-8a72-65693c28bf20 | icarminette/CppBac | ex 22 ma cifre incep cu 4 cu 3 div.cpp | #include <iostream>
using namespace std;
int main (){
int a,i,j,s,k,n,x, nrdiv;
s=0;k=0; nrdiv=0;
float ma=0;
cin>>n;
for (i=1; i<=n; i++){
cin>>a;
x=a;
nrdiv=0;
while (x>9)
x=x/10;
for (j=1; j<=a;j++) {
if(a%j==0)
... | ALGO | 0.999817 | 4.008335 |
1e00c127-e400-41b0-9ae6-e87db3dae70b | avfinogenov/sortingOfAllKind | SortingOfAllKind/SortingOfAllKind/SortingOfAllKind.cpp | /**
arrays.h список готовых массивов для тестирования. На данный момент не используется
arrayFilling.h набор функций для заполнения массивов для тестирования,
находится в проекте searchingOFAllKind
TemplateSort.h набор реализаций сортировок
todo.h + .cpp функция поразрядной сортировки, которая пока ... | TEST | 0.936061 | 4.646781 |
087cba6b-cc8b-4616-84c5-e04f7069f4aa | vossg/OpenSG1x | Source/Base/Base/OSGPlane.cpp | /*---------------------------------------------------------------------------*\
* Changes *
* *
* *
* ... | ALGO | 0.88958 | 7.1111 |
0090a463-30cf-402f-9abf-74dfc2be210e | utkarshmaken/cp | iitk interview/night-fury/R.cpp | //CAN YOU MAKE A PALINDROME
#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>... | ALGO | 0.999995 | 4.594773 |
c4a82795-6ba6-4057-8bc4-d05ceae2a42a | yi-ji/teethanno | dijsktra.cpp | #include "mex.h"
#include "math.h"
#include "matrix.h"
#include <stdlib.h>
extern const int max_len;
class Heap
{
public:
int size;
int* array;
double* d;
Heap(int capacity, double* d)
{
this->size = 0;
this->array = (int*)mxMalloc(capacity*sizeof(int));
this->d = d;
}
void shift_up(int pos, int node)
... | ALGO | 0.999928 | 3.481315 |
57e6568d-2f58-40f3-b8cf-baa61889bfc5 | ayukumi-cmd/Leetcode_solutions | 1756-minimum-deletions-to-make-string-balanced/1756-minimum-deletions-to-make-string-balanced.cpp | class Solution {
public:
vector<vector<int>>dp;
string s="";
int n;
int solve(int i, int t)
{
if(i==n) return 0;
if(dp[i][t]!=-1) return dp[i][t];
int ans=0;
if(t)
{
if(s[i]=='b')
{
ans= solve(i+1,t);
... | ALGO | 0.999961 | 5.887706 |
7d587af7-6161-4563-a2d1-1da78c81baa8 | fepaf/Competitive-Programming | Resoluções OJ/uri/2595 - Cash Roial.cpp | // Autor: [GAPA] Francisco Arcos Filho<<EMAIL>>
// Nome: Cash Roial
// Nível: 2
// Categoria: AD-HOC
// URL: https://www.urionlinejudge.com.br/judge/pt/problems/view/2595
#include<bits/stdc++.h>
#define MAX 1<<10
#define vi vector <int>
#define vvi vector <vi>
#define _ ios_base::sync_with_stdio(0);
using namespace s... | ALGO | 0.998081 | 4.006547 |
33f4303f-4828-44bd-92bb-a4c877049310 | suraj-narayan/Leetcode | 441-arranging-coins/441-arranging-coins.cpp | class Solution {
public:
int arrangeCoins(int n) {
int count=1;
while(n-count>=0)
{
n-=count;
count++;
}
return count-1;
}
}; | ALGO | 0.999925 | 6.52322 |
90666179-4519-49c3-bef1-c11b38c41f5e | ms9472803/Making-Binary-Search-Dynamic | DynamicBS.cpp | #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include "DynamicBS.h"
using namespace std;
enum operation {opInsert=1, opSearch=2, opDelete=3, opPrint=4, opExit=5};
int BSearch(const int *A, int Size, int key)
{
int left = 0, ... | ALGO | 0.999581 | 3.937725 |
e7216dae-ce91-49d4-ab82-d6db280a66cc | ElsaMarziano/VirtualMemory | VirtualMemory1.cpp | #include "VirtualMemory.h"
#include "MemoryConstants.h"
#include "PhysicalMemory.h"
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <cmath>
#define START_OFFSET (VIRTUAL_ADDRESS_WIDTH%OFFSET_WIDTH)
uint64_t mapAddress(uint64_t virtualAddress);
word_t findFrame(uint64_t pageIndex, word_t prev, wo... | ALGO | 0.991435 | 4.710108 |
30ae41ba-97fd-4fcd-ad5b-50720bc76e3a | baituhuangyu/nano_track | ncnn_nanotrack/nanotrack.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include "nanotrack.hpp"
inline float fast_exp(float x)
{
union {
uint32_t i;
float f;
} v{};
v.i = (1 << 23) * (1.4426950409 * x + 126.93490512f);
return v.f;
}
inline float sigmoid(float x)
{
return 1.0f / (1.0f + fast_exp(... | ALGO | 0.9454 | 5.433334 |
e774e641-6f8a-461e-aec1-42419799f90d | asubramanian08/USACO | Silver/2012-2013/FEB2013/q2.cpp | // Start: 9:48
// Think: 10:01, 10:29-11:04
// Write: 11:33
// Debug: 11:34
#include <iostream>
using namespace std;
#define MAX_SIDE 501
int grid[MAX_SIDE][MAX_SIDE];
bool vis[MAX_SIDE][MAX_SIDE];
#define MAX_RANGE 1'000'100
int sideLen, maxFill;
bool canGo(int px, int py, int cx, int cy, int height)
{
return ab... | ALGO | 0.999443 | 4.071932 |
11d8fc48-d6ad-4032-a2ce-1549280eb31b | huangallen2008/cppcode | code/contest/NPSC/2021/國中組/H/H.cpp | #include<bits/stdc++.h>
using namespace std;
int sti(string str) {
stringstream ss;
int ii;
ss<<str;
ss>>ii;
return ii;
}
struct IT {
bool operator()(string a,string b) const {
if(a[0]!=b[0]) {
if(a[0]=='+')
return false;
else
retur... | ALGO | 0.999942 | 3.850971 |
405e25db-5069-45b2-8535-4c0e3c58a499 | egcode/mtcnn-opencv | infer_cam.cpp | #include <opencv2/dnn.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include "mtcnn/detector.h"
#include "draw.hpp"
#include <iostream>
#include <string>
//// rm -rf build; mkdir build;cd build;cmake ..;make;cd ..
//// ./build/infer_cam ... | TOOL | 0.874976 | 4.724344 |
2d8c60f7-58cc-4e6a-813a-297a376e9f5e | wojwozniak/cpp-assigments | Matura prep/tes/main.cpp | #include <iostream>
#include <fstream>
using namespace std;
void zadanie1();
void zadanie2();
int main()
{
zadanie1();
zadanie2();
}
void zadanie1()
{
fstream read1, read2;
read1.open("tj.txt");
read2.open("klucze1.txt");
ofstream fout;
fout.open("wynik4a.txt");
string a, pom;
int ... | ALGO | 0.99292 | 3.401933 |
9af06398-640f-4644-a172-d0a691e010c7 | Mimsqueeze/Digit-Recognition | lib/Eigen3/doc/examples/class_VectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived>
segmentFromRange(MatrixBase<Derived>& v, int start, int end)
{
return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);
}
template<typename Derived>
const Eigen::Vec... | TOOL | 0.974487 | 4.383477 |
a3f8c6a1-3bfc-46e4-addb-be04476d7314 | Shreyaspatil2310/GFG | Difficulty: Hard/Print all LCS sequences/print-all-lcs-sequences.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
int dp[101][101];
int lcs_len = 0;
vector<string> res;
private:
int lcs(string s, string t, int pos1, int pos2) {
if (pos1 == s.size() or pos2 == t.size())
return 0;
... | ALGO | 0.999858 | 6.03676 |
7e11e394-8fd9-44c3-af5c-382f89c04523 | leefige/foundation-of-programming-pa | hw1/错了的分解质因数.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
vector<int> prims;
int maxPrim = 1;
bool isPrim(int p) {
if (p < maxPrim) {
if (find(prims.begin(), prims.end(), p) == prims.end()) {
return 0;
}
else {
return 1;
... | ALGO | 0.998794 | 4.153517 |
684e12e3-9711-4aae-942a-96858769f3b3 | TCGBench/TCGBench | data/human_performance_code/human_performance_code_canonical/P3377/ac_0.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN = 1000005;
int n, m, x, y, opt;
int s[MAXN], fa[MAXN], l[MAXN], r[MAXN], dis[MAXN];
bool vis[MAXN];
int find(int a)
{
return a == fa[a] ? a : fa[a] = find(fa[a]);
}
int merge(int a, int b)
{
if (a == 0 || b == 0) return a + b;
if (s[a]... | ALGO | 0.999979 | 4.239313 |
50e50e36-6ce5-4fb9-b8a5-4b712f58da86 | gauravrana05/ProblemsDaily | yash/day1/median.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> a{1,3,6,10};
vector<int> b{2,4,5,7};
vector<int> c;
int i=0,j=0,median;
while (i<a.size() && j<b.size())
{
if(a[i]>b[j]){c.push_back(b[j]);j++;}
else {c.push_back(a[i]);i++;}
}
if(i==a.size()){while(j<b.size()){c.push_back(b[j]);j++;}}
... | ALGO | 0.99983 | 3.467955 |
f06baeee-4d4a-4d5d-8e9d-5c1aa6552849 | eryanda/toserba-mobile | 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 |
ec5ca804-a061-4d84-a4f3-a4442f5a9674 | hareeshghk/leetcode_solutions | paint-fence/paint-fence.cpp | class Solution {
public:
int numWays(int n, int k) {
if (k == 1) {
if (n<=2) return 1;
else return 0;
}
if (n==1) return k;
int v1 = k;
int v2 = 1;
int temp;
for (int i = 2; i < n; i++) {
temp = v1;
... | ALGO | 0.999991 | 5.742754 |
3193a8b4-23ee-443e-bc4b-bf86c898cc34 | call-me-bammer/montmartre-hill | programmers/142085/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
int solution(int n, int k, vector<int> enemy) {
int answer = 0;
int sum = 0;
// min heap
priority_queue<int, vector<int>, greater<int>> pq;
for (int i = 0; i < enemy.size(); i++) {
if (i < k) {
pq.push(... | ALGO | 0.999916 | 4.707865 |
29603a89-1ec5-4e24-9c20-4ed985347eb7 | shivanibhat24/CPP-Programs | Leetcode Programs/rangemodule.cpp | class RangeModule {
public:
map<int, int> ranges;
RangeModule() {}
void addRange(int left, int right) {
auto it = ranges.upper_bound(left);
while(it != ranges.end() && it->first <= right){
right = max(it->second, right);
++it;
ranges.erase(prev(it));
... | ALGO | 0.997233 | 4.950967 |
47d4d38c-7a27-4882-b01c-94b5fcef063b | Haytham-Magdi/CppLib | Hcv/ValleyMarkerFilter1D.cpp | #include <Lib\Cpp\Common\commonLib.h>
#include <Lib\Hcv\CvIncludes.h>
#include <Lib\Hcv\Types.h>
#include <Lib\Hcv\error.h>
#include <vector>
#include <Lib\Hcv\Channel.h>
#include <Lib\Hcv\Image.h>
#include <Lib\Hcv\funcs1.h>
#include <Lib\Hcv\ValleyMarkerFilter1D.h>
#include <math.h>
namespace Hcv
{
using namespac... | ALGO | 0.998721 | 3.795514 |
f8671c65-7ca0-4cf0-9397-c10a8c591efd | sarvex/leetcode-clisp | solution/1400-1499/1455.Check If a Word Occurs As a Prefix of Any Word in a Sentence/Solution.cpp | class Solution {
public:
int isPrefixOfWord(string sentence, string searchWord) {
stringstream ss(sentence);
string s;
for (int i = 1; ss >> s; ++i) {
if (s.find(searchWord) == 0) {
return i;
}
}
return -1;
}
}; | ALGO | 0.999842 | 5.553524 |
6bfcd9d2-91e1-4413-a0b6-3777f905dfce | ANIKETRAJ28/DSA-and-CP | pointers/bag-of-tokens.cpp | #include<bits/stdc++.h>
#define ll long long int
#define infp INT_MAX
#define infn INT_MIN
#define pp pair<int, int>
#define mod 1000000007
using namespace std;
template<typename T>
using vec = vector<T>;
// https://leetcode.com/problems/bag-of-tokens/description
class Solution {
public:
int bagOfTokensScore(vec... | ALGO | 0.999967 | 5.786491 |
2496a877-4580-4edf-bc72-9bf98b067402 | AdarshSorout/Leetcode | 0023-merge-k-sorted-lists/0023-merge-k-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) {}
* };
*/
class Solution {
public:
ListNode*twoMerge(ListNod... | ALGO | 0.999975 | 5.941105 |
be91e8cc-b571-4044-be59-c6534685a6de | yashgit56/DSA_Implementation | Sorting/quick_sort.cpp | #include<bits/stdc++.h>
using namespace std ;
int partition(int *arr , int low , int high){
int pivot = arr[low] ;
int start = low , end = high ;
while(start < end){
while(arr[start] <= pivot){
start++ ;
}
while(arr[end] > pivot){
end-- ;
}
... | ALGO | 0.999946 | 4.711459 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.