uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
92cd8eff-8061-42bb-b502-de6967f704bd | supremoods/pet_feeder | 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 |
1fcaf29f-1c89-4bab-bad2-cc9230121bb5 | nikhil697/Daily-Leetcode | 713-subarray-product-less-than-k/subarray-product-less-than-k.cpp | class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
if(k==0) return 0;
long long int rp = 1;
int res = 0;
int ri = 0;
for(int i=0;i<nums.size();i++){
rp = rp * nums[i];
while(rp >= k && i>=ri) {
rp = rp ... | ALGO | 0.999935 | 5.299095 |
7ef34567-6a03-4567-a0bb-787058f26097 | mishra-ji20/Leetcode | Power Set - GFG/power-set.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void rec(vector<string>&ans,int i,string &s,string temp)
{
if(i>=s.size())
{
if(temp.size()!=0)
ans.push_back(temp);
return;
}
... | ALGO | 0.999806 | 6.415648 |
f71184e9-bd3f-45b0-ab64-d40f452aa045 | tomsiwek/progrown | openmp/ParResKernels/Kernels-master/GRAPPA/Synch_p2p/p2p.cpp | #include <par-res-kern_general.h>
#include <Grappa.hpp>
#include <FullEmpty.hpp>
using namespace Grappa;
#define ARRAY(i,j) (local[(i+1)+((j)*(segment_size+1))])
#define root 0
double *local;
int start, end, segment_size;
FullEmpty<double> *lefts;
struct Timer {
double start;
double total;
} GRAPPA_BLOCK_AL... | ALGO | 0.999672 | 4.384479 |
45da42de-5aa8-4742-bf6a-404386c90547 | WuTi0525/My-Code-LeetCode | 8.无重复字符的最长子串.cpp | //2023.12.27
//author: wuti
//Ѷȣе
//Ŀ
//һַ s ҳвظַ Ӵ ijȡ
//ȥȻȻ뵽set
#include<iostream>
#include<unordered_set>
using namespace std;
class Solution {
public:
int lengthoflongestSubstr(string s) {
unordered_set<char> hash_set;//ʹsetȥز
int ans = 0, end = -1;//ʼؽendʾӴұ߽
for (int i = 0; i < s.size(); ++i) {
if (i... | ALGO | 0.99996 | 5.173755 |
04198b45-2926-4391-bbca-b93b093b8799 | Gabriel-Baril/boost | boost_1_81_0/libs/bimap/example/user_defined_names.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TOOL | 0.88613 | 4.925413 |
c3a2596a-7e74-48a8-b873-e9b792fb4555 | D-Major/TargetOffer-LeetCode | Target-Offer/20_PrintMatrixClockwisely.cpp | // Created by renduo on 20-1-9.
#include <iostream>
#include <vector>
using namespace std;
vector<int> PrintMatrixClockwisely(vector<vector<int>> matrix) {
vector<int> list;
if(matrix.empty() || matrix[0].empty())
return list;
int up = 0;
int down = (int)matrix.size()-1;
int left = 0;
... | ALGO | 0.999962 | 5.605405 |
b24b3c6b-9966-48a5-8f26-83f3ec7c2e90 | B21DCCN712/C_plus_Ptit | KieuDuLieu_VietVongLap_VietHam/SoTangGiam.cpp | #include<bits/stdc++.h>
using namespace std;
bool nt(int n){
if(n<2) return false;
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
break;
}
}
return true;
}
bool tang(int n){
int a=n%10;
n/=10;
while(n>0){
if(a<= n%10) {
return false;
}
a=n%10;
n/=10;
}
return true;
}
bool giam(i... | ALGO | 0.999649 | 5.166049 |
f1871760-a79f-4adb-910e-a504b70494b4 | HanYouyang/Computer | 数据结构与算法/PKU-CS/PastClasses/@1/6/6.1.cpp | #include <iostream>
using namespace std;
int main() {
int n; // n为细菌的数量
// id记录细菌的编号,rate记录细菌的繁殖率,第i个细菌对应id[i]和rate[i]
int id[100];
double rate[100];
cin >> n;
for (int i = 0; i < n; i++) {
int initial, final;
cin >> id[i] >> initial >> final;
rate[i] = (double)final / initial;
}
//对整个细菌排序
... | ALGO | 0.999987 | 3.218978 |
43c69b84-21fb-4464-9971-ae74ab353daa | terao0724/working_time_system | opencv-master/3rdparty/carotene/src/minmaxloc.cpp | #include "common.hpp"
#include "vtransform.hpp"
#include <limits>
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <typename T>
void minMaxVals(const Size2D &size,
const T * srcBase, ptrdiff_t srcStride,
T * pMinVal, T * pMaxVal)
{
using namespace internal;
... | ALGO | 0.999405 | 6.077631 |
24de90c9-9d49-43af-8df1-d19af9ffeeac | rafaelGuasselli/exercicios | judges/codeforces/gym/nacional-2023/g_2.0.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
struct GEO {
int a, b, l, r; // y = a*x + b for x in [l, r].
bool operator<(const GEO &other) const {
if (a != other.a)
return a < other.a;
else if (b != other.b)
return b < other.b;
else if (l != other.l)
return l < other.l;
else... | ALGO | 0.999954 | 4.360322 |
79480f8d-1526-4dbe-9107-f07cde22f64f | qianlizhixing12/coding-training | leetcode/100.cpp | 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), left(left), right(right) {}
};
class Solution {
public:
bool isSame... | ALGO | 0.999939 | 6.630627 |
d8e8c11c-1a60-4afb-885a-c08e4b8b6177 | HAIDER-NASIR9910/PROJECT | hdk.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int func1(int arr[],int size, int k)
{
for(int i=0;i<size;i++)
{
cout<<arr[i]<<" ";
}
k=arr[3];
for(int i=0;i<size;i++)
{
if(arr[i]>k)
{
k=arr[i];
cout<<k<<endl;
}
}
}
int main()
{
int arr[]={22,3,9,17,34,156,203... | ALGO | 0.999721 | 3.730134 |
efd0ba1b-6d99-4b19-9f72-be795096d2dc | MayarAhmed3920/leetCode | 409-Longest-Palindrome.cpp | class Solution {
public:
int longestPalindrome(string s) {
map<char,int>mp;
int ans=0;
for(int i=0;i<s.size();i++){
mp[s[i]]++;
}
bool oo=false;
for(auto k:mp){
if(k.second%2!=0){ans+=k.second-1;oo=true;}
else ans+=k.second;
... | ALGO | 0.999976 | 5.984122 |
4bb3905c-131b-47f4-b455-7435eb7fab39 | Vishruth-S/CompetitiveCode | Hackerrank_problems/diagonal-difference/solution.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'diagonalDifference' function below.
*
* The function is expected to return an INTEGER.
* The function accepts 2D_INTEGER_ARRAY arr as parameter.
*/
... | ALGO | 0.999979 | 5.804947 |
8a4b6ce7-9b2b-4b87-b4a6-0eefa8fe865e | amanprateek123/DSA_Problemset | CSES/Intro_CSES/template.cpp | #include <bits/stdc++.h>
#define ar array
#define ll long long int
#define loop(i, a, b) for (int i = a; i < b;i++)
#define loopRev(i, a, b) for (int i = a; i > b;i--)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define mi map<int,int>
#define mii map<int, pair... | ALGO | 0.999956 | 4.518672 |
b92f94a8-8d72-4847-9e97-3359fd07a00f | vanshshxrma/cpp | array 1/linearsearch.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter size of array";
cin>>n;
//input
int arr[n];
for(int i=0;i<=n-1;i++){
cin>>arr[i];
}
int x;
cout<<"enter the element you want to search";
cin>>x;
//search
for(int i=0;i<=n-1;i++){
if(a... | ALGO | 0.999894 | 3.760516 |
528b983e-0dfa-405b-b955-daa6f5375d76 | rushiagr/basic-algos | graphs/dfs.cpp | #include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
/* Directed graph */
class Graph {
public:
int nodes;
vector<vector<int> > g;
Graph(int nodes) {
this->nodes = nodes;
g = vector< vector<int> >(nodes, vector<int>(nodes, 0));
}
void addEd... | ALGO | 0.999684 | 4.572278 |
d86f749c-16e3-4798-a535-7afb5f08ca2a | the-t3ch-wizard/Dsa-Practice | CodingNinjas/First Missing Positive.cpp | // link: https://www.codingninjas.com/studio/problems/first-missing-positive_699946?leftPanelTab=0
#include <bits/stdc++.h>
int firstMissing(int arr[], int n)
{
int *s=arr;
sort(s, s+n);
int ans=1;
for (int i=0; i<n; i++){
if (arr[i]<ans){
continue;
} else if (arr[i]==ans){... | ALGO | 0.999853 | 4.208128 |
71289386-5585-49b3-b7e9-3c36b5ee71b4 | Novicei/Code | Leetcode/剑指offer/easy/20210913/replaceSpace.cpp | class Solution {
public:
string replaceSpace(string s) {
string str;
for(int i=0;i<s.size();i++){
if(s[i]==' '){
str+="%20";
}else{
str+=s[i];
}
}
return str;
}
};
| ALGO | 0.998614 | 5.288653 |
d9a32ab1-e3ab-4ae0-a0e9-29a059c30dca | Sinededd/oaipLR7 | Task_1/main.cpp | #include <iostream>
bool delenchiki(std::string &a); //
void convert(std::string &a);
int main()
{
std::string s;
std::cin >> s;
convert(s);
std::cout << s << std::endl;
return 0;
}
bool delenchiki(std::string &a)
{
std::string newS;
int ostatochki = 0;
for (int i = 0; i < a.size(); ... | ALGO | 0.999688 | 4.774101 |
c7594c17-dbc8-42f2-a8ca-236eef9946d8 | marlin6530/MyCodeRecord | OnlineJudge/12439.cpp | //Time Complexity: O()
#include<bits/stdc++.h>
//#include<iostream>
using namespace std;
string months[13] = {
" ","January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
bool leapYear(int y){
return y % 400 == 0 || (y % 4 == 0 && y % 10... | ALGO | 0.999902 | 4.03755 |
416a31d6-194d-4007-8b7d-985c9ab050b4 | Hm11221122/codes | assign 6 2nd.cpp | #include<stdio.h>
int main()
{int i,h=0,t,a,b,c=1;
printf("enter a number");
scanf("%d",&a);
for(i=2;i<a;i++)
{if(a%i==0)
{
h++;
}
}
if(h==0)
printf("prime");
else
printf("not prime");}
| ALGO | 0.999889 | 3.162561 |
e681da89-6cf6-4c7f-ad6d-fc03c9eeb436 | algorithm006-class01/algorithm006-class01 | Week_03/G20200343030497/LeetCode_74_497.cpp | /**
* 74. 搜索二维矩阵
* https://leetcode-cn.com/problems/search-a-2d-matrix/
*
*/
class Solution {
public:
// 二分查找
// 时间复杂度:O(log(m*n))
// 空间复杂度:O(1)
bool searchMatrix(vector<vector<int>>& matrix, int target) {
if(matrix.empty() || matrix[0].empty()){
return false;
}
... | ALGO | 0.999844 | 6.63298 |
626679ff-a52b-4ed3-b433-94925e81a6aa | jJayyyyyyy/OJ | LeetCode/101-200/P160_Intersection_of_Two_Linked_Lists.cpp | /*
* https://leetcode.com/problems/intersection-of-two-linked-lists/description/
* 给定两个单链表, 找出其交汇点
* 同类题目 P160
*
*
* 思路: 先遍历链表得到 lenA, lenB, 假设 lenA > lenB
* 然后, 先让 listA 走过 (lenA - lenB) 个结点, 这样, 两条链表剩下的长度就一样了
* 最后, 逐个对比剩下的结点, 如果地址相同就是交汇点
* 注意1: 值可能相同, 故应用地址相同来确定交汇点
* 注意2: 单链表的定义, 只有一个后继结点, 也就是不用考虑【先交汇】---... | ALGO | 0.999864 | 5.165826 |
803b3b30-0a1a-40a3-9cf5-d6844aa4e32e | vss021/365-Day-Coding-Challenge | Day-59/problem2.cpp | #include <iostream>
using namespace std;
// Define the Node structure
struct Node {
int data;
Node *left, *right;
Node(int x) : data(x), left(NULL), right(NULL) {}
};
class Solution {
public:
/*You are required to complete below method */
int sumOfLeafNodes(Node *root ){
/*Your code here ... | ALGO | 0.999993 | 6.964192 |
7f417e86-636d-4ca9-b711-207f25506110 | rahulsachdeva12/c---and-dsa | BinaryTreeAssignment7.cpp | #include<iostream>
#include "BinaryTreeNode.h"
#include <queue>
using namespace std;
void printTreeLevelWise(BinaryTreeNode<int> *root) {
if(root==NULL){
return;
}
queue<BinaryTreeNode<int>*> pendingNodes;
pendingNodes.push(root);
while(pendingNodes.size()!=0){
BinaryTreeNode<int>* ... | ALGO | 0.999708 | 4.941718 |
1a8b6ad6-e501-40ab-b8b5-cc03c65b4a68 | OmaerAlam/STL_SET-MULTISET_CPP | multiset_1.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
multiset<int> s;
s.insert(1);
s.insert(3);
s.insert(1);
s.insert(4);
s.insert(1);
cout<<s.size()<<endl;
for(auto u:s) cout<<u<<" ";
cout<<endl;
return 0;
}
| ALGO | 0.999198 | 3.594379 |
a8dfc884-9efb-4e65-b182-94d20788bf55 | Heller07/SDE-Sheet | Graph II/Dijkstra algo.cpp | // TC IS O(ELogV) worst case
//we are not using queue to avoid calculation of unnecessary path which will end up consuming more time
//not applicable for negative weights
class Solution
{
public:
//Function to find the shortest distance of all the vertices
//from the source vertex S.
vector <int> dijkstra(in... | ALGO | 0.99997 | 5.441846 |
e2253a5a-d526-4e7e-84cb-a61c18836caf | aditi741997/robotics_project | micaela_multi_rate_dag/src/Evaluation/Evaluation.cpp | /*
* Evaluation.cpp
*
* Created on: May 6, 2019
* Author: mirco
*/
#include <Evaluation/Evaluation.h>
#include <Evaluation/LatencyInfo.h>
#include <Evaluation/Scheduling.h>
#include <MultiRate/MultiRateTaskset.h>
#include <cmath>
#include <iostream>
void
Evaluation::addLatency(const Chain& chain, const Late... | ALGO | 0.998062 | 5.7017 |
4733c7a0-afd5-4a12-910d-cd9fed3268bc | ttdyce/Dynamic-embedding-labeller | selected-data/state-trace-110/1087.cpp | #include <iostream>
#include <stdio.h>
#include <math.h>
#include "../StateIntercept.cpp"
#include <string.h>
using namespace std;
/*
* main.cpp
*
* Created on: 2012-11-12
* Author: ??
* 1090 ????
*/
// Intercept<int> sum(-1, 3);
Intercept<int> a[100];
Intercept<int> intercepts[] = {Intercept<int>(-1, 3)... | ALGO | 0.999886 | 3.260655 |
80825430-83cb-409c-a302-c4d242900c18 | ricet8ur/labs-cpp | lab_05/src/fibo.cpp | #include "2_ppp_class.hpp"
int main(){
start_ppp;
// ppp_show_info;
auto a = var(1.);
auto b = var(1.);
start_pfor(k, 0, 10, 1);
auto q = var(a);
// a=b;
// b=q+a;
ppp_assign(b, a);
ppp_assign(q + a, b);
end_pfor;
pcout << a;
pfout("fibonacci.out") << a;
run_ppp;return 0;
} | ALGO | 0.96241 | 3.17884 |
d0f24875-a0cf-42fe-a0d2-3173e0484f2f | shoujiaxin/leetcode-solutions-cpp | [91] Decode Ways/solution1.cpp | /*
* @lc app=leetcode id=91 lang=cpp
*
* [91] Decode Ways
*
* https://leetcode.com/problems/decode-ways/description/
*
* algorithms
* Medium (23.72%)
* Likes: 2205
* Dislikes: 2450
* Total Accepted: 353K
* Total Submissions: 1.5M
* Testcase Example: '"12"'
*
* A message containing letters from A-Z... | ALGO | 0.999755 | 6.826704 |
092d53dd-3ef4-4ae1-9d18-25afed24342a | anagorko/zpk2014 | home/pputowski/z1/cza.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
cout << t / 60 / 60 << "g"
<< t / 60 - t / 60 / 60 * 60 << "m"
<< t - ( t / 60 - t / 60 / 60 * 60 ) * 60 - t / 60 / 60 * 60 * 60 << "s" << endl;
}
| ALGO | 0.994507 | 4.250367 |
b6e04b96-bfaa-4698-a97f-d86210da4f0c | ishandutta2007/codeforces | ei133333/normal/612/D.cpp | #include<bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;
template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
for(int i = 0; i < (int) v.size(); i++) {
os << v[i] << (i + 1 != v.... | ALGO | 0.999988 | 3.953685 |
5de12f91-f4d4-45b2-b973-dd71e4759c69 | raincross7/code-similarity | codes/train_code/problem007/problem007_82.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
const int dx[] = {1... | ALGO | 0.999945 | 4.064963 |
5937348a-d05d-4132-9b8b-b0710a5b47d2 | VadVergasov/OlympTasks | CYF/2020/BelOI/Day29/A/main.cpp | using namespace std;
int main() {
ifstream in("onlyone.in");
ofstream out("onlyone.out");
int n;
in >> n;
vector<tuple<int, int, int> > a(n);
for (auto &i : a) {
in >> get<0>(i) >> get<1>(i) >> get<2>(i);
}
long long res = 0;
for (int i = 0; i < n; i++) {
for (int j ... | ALGO | 0.99984 | 4.545859 |
4a838d55-6e8f-4606-b63c-6f30beca8fec | ThePomelo/PySweeper | samples/navier/main.cpp | #include <stdio.h>
#include <math.h>
#include "main.hpp"
// gas simulation
// based on Jos Stam, "Real-Time Fluid Dynamics for Games". Proceedings of the Game Developer Conference, March 2003.
// http://www.dgp.toronto.edu/people/stam/reality/Research/pub.html
#define WIDTH 50
#define HEIGHT 50
#define WIDTHx2 (WIDT... | ALGO | 0.999094 | 3.897954 |
ba69dd50-44fb-44a1-bd17-9863dc7ebf8c | utsavibhakhar/C- | PDF-6/6-p16.cpp | #include <iostream>
using namespace std;
int main()
{
int length, width, height;
cout << "Enter length, width, and height of the box: ";
cin >> length >> width >> height;
int volume = length * width * height;
cout << "Volume of the box: " << volume << endl;
cout << "Volume is " << (volume % 2 ... | TOOL | 0.995559 | 4.590744 |
8181709f-6d39-459a-8e2f-fafd670e207b | xiaohai-AI/slam_visual | slambook2/ch7/pose_estimation_3d2d.cpp | #include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <Eigen/Core>
#include <g2o/core/base_vertex.h>
#include <g2o/core/base_unary_edge.h>
#include <g2o/core/sparse_optimizer.h>
#include <g... | ALGO | 0.9911 | 5.910937 |
3428ee52-c5e0-40bc-b5f2-a6314ae4e75f | ishandutta2007/codeforces | gom/normal/1423/F.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int main()
{
... | ALGO | 0.999953 | 3.609836 |
26f6251c-c8c5-486a-bae0-4c9c3c565c4d | deogharia10/Programming_A.D | loop 2/ODDnumber.cpp | #include<iostream>
using namespace std;
int main(){
for(int i=1; i<=100; i++){
if(i%2==0) continue;
cout<<i<<endl;
}
} | ALGO | 0.996364 | 3.209399 |
fddf31c4-c5ec-4b99-acc1-94782e13929f | eldeshue/PS | BOJ/unclassified/16168_solved.cpp |
/*
־ Ϸ 缺 .
Ϸ ζ ߺ θ .
θ.
־ Ϸ 缺 Ǵϴ .
- 1.
ҿ .
- 2. degree
ϴ degree ؾ .
- 2.1
degree Ȧ 尡 ų( 忡 , , Ϸ ȸ),
ؾ ( Ȥ ).
- 2.2
尡 in degree out degree ų(Ϸ ȸ)
out degree ϳ ū () in degree ϳ ū () .
, 尡 ȵ.
Ϸ θ ϱ ؼ Hierholtzer ˰ .
*/
#inclu... | ALGO | 0.999954 | 4.941144 |
3c4daa43-30d7-4103-a22e-4f579eb537bb | ArjunTa1war/codeforces | 1454b.cpp | #include <iostream>
using namespace std;
void solve()
{
int b[200001] = {0};
int n, index, ans = 2000001, check = 0;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
b[arr[i]]++;
}
for (int i = 0; i < n; i++)
{
if (b[arr[i]] == 1 && arr[i] < ... | ALGO | 0.999886 | 5.059958 |
922452ef-d0c5-4fd4-9fc9-968a55b20c43 | wresinski/leetcode | 114.flatten-binary-tree-to-linked-list.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.999995 | 5.766044 |
c9c29917-026e-410e-a1b6-c749f8ef0081 | wilson940117/2023aaia3 | week02/week02-3.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
string ans;
for(int i=0; i<word1.length() || i<word2.length(); i++){
if(i<word1.length()) ans += word1[i];
if(i<word2.length()) ans += word2[i];
}
return ans;
}
}; | ALGO | 0.999899 | 5.901834 |
dddbf2e5-886d-4338-ac0a-e64af6543796 | dido1092/CameraStreaming | opencv/sources/modules/core/src/merge.dispatch.cpp | #include "precomp.hpp"
#include "opencl_kernels_core.hpp"
#include "merge.simd.hpp"
#include "merge.simd_declarations.hpp" // defines CV_CPU_DISPATCH_MODES_ALL=AVX2,...,BASELINE based on CMakeLists.txt content
namespace cv { namespace hal {
void merge8u(const uchar** src, uchar* dst, int len, int cn )
{
CV_INSTR... | ALGO | 0.967512 | 7.546363 |
23695b52-d0f6-4ffc-b66b-e48ecbf972d8 | Soroar-Mia/xpsc-code | week 6/day 4/Monopoly.cpp |
///********Bismillahir Rahmanir Rahim ********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
if((a+b+c)<d)
{
cout<<"YES"<<endl;
}
else if((a+b+d)<c)
... | ALGO | 0.998932 | 3.645849 |
00d09755-71f0-42ab-9707-ee17185356c3 | phuonghodacminh/LeetCode | 1631-number-of-sub-arrays-with-odd-sum/number-of-sub-arrays-with-odd-sum.cpp | class Solution {
public:
int numOfSubarrays(vector<int>& arr) {
int n = arr.size();
int countOdd = 0;
int countEven = 1;
int prefixSum = 0;
long long count = 0;
for (int i = 0; i < n; i++){
prefixSum += arr[i];
if (prefixSum % 2){
... | ALGO | 0.999994 | 5.522485 |
4cc929a1-b464-4d82-b2a9-76dc4d181d58 | ROCm/flang | flang-classic/17.0-4/llvm-classic/clang/lib/Driver/ToolChains/MSVC.cpp | #include "MSVC.h"
#include "CommonArgs.h"
#include "Darwin.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Version.h"
#include "clang/Config/config.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "... | TOOL | 0.905444 | 7.223324 |
b07ff056-4f30-4a41-bdde-2315119bb047 | KSP-07/LeetCode-Questions | 0516-longest-palindromic-subsequence/0516-longest-palindromic-subsequence.cpp | class Solution {
public:
int solve(int i , int j , string &s , vector<vector<int>> &dp){
// if(i<0 || j)
if(i>j) return 0;
if(dp[i][j]!=-1) return dp[i][j];
if(i==j) return 1;
if(s[i] == s[j]){
return dp[i][j] = 2 + solve(i+1 , j-1 , s , dp) ;
}
re... | ALGO | 0.999966 | 6.116621 |
e5b90229-1f36-4a33-8bb4-dcbd03b101f9 | kunal2002/KN-Advent-Of-Code-2024 | Day4_Part2.cpp | // Obliviate, Mischief Managed!
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statist... | ALGO | 0.998879 | 4.996302 |
56aae66f-656d-40ba-8550-57c593df1491 | Josephzcy/my_compile_platform | third_party/opencv-src-4.1.0/3rdparty/carotene/src/cmp.cpp | #include "common.hpp"
#include "vtransform.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
inline void vnst(u8* dst, uint8x16_t v1, uint8x16_t v2) { vst1q_u8(dst, v1); vst1q_u8(dst+16, v2); }
inline void vnst(u8* dst, uint16x8_t v1, uint16x8_t v2) { vst1q_u8(dst, vcombine_u8(vmovn_u16(v1), vmovn_u16(v... | ALGO | 0.985496 | 6.204319 |
eac8d002-a45f-4f7c-9bdd-bb8dfe0ae4aa | aphrim/codeforces-workspace | completed/800/technical-support.cpp | #include <bits/stdc++.h>
#define int long long int
//#define USACO
using namespace std;
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {for(auto &x : a) out << x << ' '; return out;};
tem... | ALGO | 0.999076 | 4.936218 |
ff7aa54f-42be-4922-8beb-de627042c6f4 | anhdhbn/face-recognition | models/dlib-19.17/examples/matrix_ex.cpp | /*
This is an example illustrating the use of the matrix object
from the dlib C++ Library.
*/
#include <iostream>
#include <dlib/matrix.h>
using namespace dlib;
using namespace std;
// ----------------------------------------------------------------------------------------
int main()
{
// Let's begin t... | ALGO | 0.999166 | 4.417058 |
ce7dde96-0e60-4095-83c2-babce6f5e6bf | raincross7/code-similarity | codes/train_code/problem209/problem209_226.cpp | #include <cstdio>
#include <queue>
#include <vector>
#define maxn 200005
using namespace std;
vector<int> G[maxn];
bool vis[maxn];
int bfs(int x)
{
queue<int> q;
q.push(x);
int cnt = 0;
while(!q.empty())
{
x = q.front(); q.pop();
if(vis[x]) continue;
vis[x] = true, cnt ++;
for(int v: G[x])
q.push(v);
... | ALGO | 0.999763 | 4.336806 |
2d425928-f00b-4dec-bdc9-a7982a743695 | Schr0Smi1ey/Phitron | 4. Algorithm/Dynamic Programming/0-1 Knapsack Variation/Subset_sum_bottom_up.cpp | #include<bits/stdc++.h> // Include the standard C++ library for input/output handling.
using namespace std; // Use the standard C++ namespace.
// Define some macros for faster input/output and readability.
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); // Fast I/O
#define endl "\n" // Newline ... | ALGO | 0.999965 | 4.26651 |
cce594bd-3816-43e6-8b98-0436130f9ecd | cycleke/OI_Documents | Code/codeforces/617/C.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
#define pll pair<long long,long long>
#define p2(a) ((a)*(a))
pll p[2010];
int main() {
int n,i,j;long long x1,x2,y1,y2,x,y,ans,t;
scanf("%d%lld%lld%lld%lld",&n,&x1,&y1,&x2,&y2);
for(i=1;i<=n;++i) {
scanf("%lld%lld",&x,&y);
p[i].first=p2(x-x1)+p2(y-y1);... | ALGO | 0.999815 | 3.341293 |
fb48ff13-33ac-4b95-a00d-58e1f7153a09 | afkyyd/engine | Engine/Source/Editor/ViewportInteraction/ViewportInteractionUtils.cpp | #include "ViewportInteractionUtils.h"
namespace ViewportInteractionUtils
{
FOneEuroFilter::FLowpassFilter::FLowpassFilter():
Previous(FVector::ZeroVector),
bFirstTime(true)
{
}
FVector FOneEuroFilter::FLowpassFilter::Filter(const FVector& InValue, const FVector& InAlpha)
{
FVector Result = InValue;
if... | TOOL | 0.90883 | 6.687608 |
8200e71d-384d-4d2e-aa20-445b710879da | SuperSlot0613/leetcodeProblem | 304-range-sum-query-2d-immutable/304-range-sum-query-2d-immutable.cpp | class NumMatrix {
public:
int pref[201][201];
NumMatrix(vector<vector<int>>& mat) {
int m = mat.size() , n = mat[0].size();
for(int i=0; i<m ; i++ ){
for(int j=0; j< n ; j++ ){
pref[i][j] = mat[i][j];
if(i > 0){
pr... | ALGO | 0.999812 | 6.108067 |
bf248732-5883-4281-976d-5fa2545f9666 | arifur30/Codeforces-Submissions | q_g_codesmash.cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int d, n;
cin>>d;
while(d--)
{
cin>>n;
int i = 1;
double sum1 = n * (n+1)/2.0;
int sum = sum1;
//
sum -= 1;
// cout<<"sum "<<sum<<endl;
if(sum % n != 0)
{
int t... | ALGO | 0.999957 | 3.823977 |
15fd7bbb-a860-4ff6-b37b-2ce2c881a459 | ishandutta2007/codeforces | magicspark/normal/1093/A.cpp | //By MagicSpark
/*
Problem:
Main Idea:
Status:
*/
#include<bits/stdc++.h>
#pragma optimize("Ofast")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-falign-functions")
#pragma ... | ALGO | 0.998018 | 4.390871 |
8f6828ee-bb02-4e44-8242-4a1695ea927e | Madhukar7559/Numerical_Methods_and_Optimization | Optimization/Newton_Raphson.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
double double_derivative(double, double);
double single_derivative(double, double);
double eq(double);
double mod(double);
int main()
{
double x, error, y;
cout << endl;
cout << "Enter intial guess value and error : ";
cin >>... | ALGO | 0.999976 | 3.760427 |
03c10f6f-87c2-433a-bf2f-dcc4fd2b2537 | mehedihasankanon/cp-code-archive | All_codes/B_cat_2.cpp | // Bismillahir rahmanir rahim
// https://atcoder.jp/contests/abc413/tasks/abc413_b
// ac
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #pragma GCC target("avx2")
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_... | ALGO | 0.999956 | 5.607471 |
80c6f375-c31a-46bb-ad8a-625f10817463 | 108anup/CS201-Data-Structures-Lab-Assignment | Assignment 7/Attempt/main.cpp | #include <iostream>
#include <vector>
using namespace std;
const int SIZE = 1e5;
struct node{
int data;
node* next;
node* rep;
node* head;
node* tail;
int s; //size
};
class Set{
int n;
public:
vector<node*> dict;
Set(int n){
this->n = n;
dict.resize(SIZE);... | ALGO | 0.998199 | 4.157656 |
2782f12e-6bc1-40f6-8140-e724d3313941 | sumandas2004/180DaysOfDSA-C- | Day31/2darray.cpp | #include<iostream>
using namespace std;
void printcol(int arr[][4],int row,int col)
{
// colum wise
for(int j=0;j<col;j++)
for(int i=0;i<row;i++)
cout<<arr[i][j]<<" ";
}
int main()
{
// create 2 d array
int arr1[3][4]={1,2,3,4,5,6,7,8,9,10,11,12};
int arr2[3][4]={0,1,3,4,6,7,10,11,41,18,9,11};
... | ALGO | 0.999097 | 3.822213 |
a293aa97-0d63-4205-b4aa-a823512314b2 | ThisIsATest369/SensorsCalibration | online_calib/radar2carcenter/eigen3/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2d A;
A << 2, 1,
2, 0.9999999999;
FullPivLU<Matrix2d> lu(A);
cout << "By default, the rank of A is found to be " << lu.rank() << endl;
lu.setThreshold(1e-5);
cout << "With threshold 1e-5... | ALGO | 0.999818 | 4.090376 |
ec2699b5-545f-4b0d-9611-7fbccafd57d8 | charlie-1234/HPC | parallel_bfs.cpp | #include<iostream>
#include<vector>
#include<omp.h>
#include<queue>
#include<bits/stdc++.h>
using namespace std;
queue<int>q;
void bfs(int start, int* arr, int n, int visit[])
{
#pragma omp parallel for ordered
for(int i=0; i<n; i++)
{
#pragma omp ordered
if( ( *(arr + (n*start) + i) == 1 ) && (visit[i] == 0)... | ALGO | 0.999821 | 4.365116 |
3ff2bfab-2a46-4343-af13-19f49001776d | sy4b/Algorithm-Notes | Storage/Code/700.二叉搜索树中的搜索.cpp | /*
* @lc app=leetcode.cn id=700 lang=cpp
*
* [700] 二叉搜索树中的搜索
*/
// @lc code=start
/**
* 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)... | ALGO | 0.999991 | 6.639994 |
2bffe5fe-0e37-462c-b84a-a46e5a66bed1 | chengyiwei/algorithm | codeforces/Educational Codeforces Round 171 (Rated for Div. 2)/D/D.cpp | #include <bits/stdc++.h>
#define int long long
using ll = long long;
void solve() {
int n; std::cin >> n;
std::vector<int> a(n + 1);
std::vector<ll> sum(n + 1, 0), ksum(n + 1, 0);
for (int i = 1; i <= n; i++) {
std::cin >> a[i];
sum[i] = sum[i - 1] + a[i];
ksum[i] = ksum[i - 1... | ALGO | 0.999866 | 4.477544 |
18acbf53-80f1-43de-b170-c29843d4ccaa | M680x0/M680x0-mono-repo | llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp | #include "COFFObjcopy.h"
#include "Buffer.h"
#include "CopyConfig.h"
#include "Object.h"
#include "Reader.h"
#include "Writer.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Path.h"
#include <cassert>
namespace llvm {... | TOOL | 0.897544 | 7.837502 |
fcc81645-f1e0-4570-aba3-6350970c1b63 | Dajtbaeva/ADS_2022 | new_labz/lab1/h.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
if(n == 0 || n == 1){
cout << "NO";
return 0;
}
for(int i = 2; i <= sqrt(n); ++i){
if(n % i == 0){
cout << "NO";
return 0;
}
}
cout << "YES";
} | ALGO | 0.999959 | 4.91879 |
ca99b7e1-fb30-42dc-b42a-426c9e8e68a9 | Parzival1509/GFG_POTD | 2024/2024-05/GFG_POTD_2024-05-15_Account_Merge.cpp | // GFG POTD 2024/05/15
// Account Merge
// Hard
#include <bits/stdc++.h>
using namespace std;
class DisjointSetSize {
vector<int> size;
vector<int> parent;
public:
DisjointSetSize(int n) {
size.resize(n + 1, 0);
parent.resize(n + 1, 0);
for (int i = 0; i <= n; i++) {
p... | ALGO | 0.999901 | 6.206268 |
93734fcb-b31c-407e-ab4a-adeb46402810 | koushik395/LeetCodeProblems | Check if it is possible to survive on Island - GFG/check-if-it-is-possible-to-survive-on-island.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int minimumDays(int s, int n, int m){
int sundays = s/7;
int buydays = s - sundays;
int totalFood = (s * m);
... | ALGO | 0.999894 | 5.638494 |
3de67b44-c3dd-43f9-b480-20b490f861f1 | Ajdecoder/Dsa-Tut-s | Stl_questions/STL_priorityqueue.cpp | #include<iostream>
#include<queue>
using namespace std;
int main(){
priority_queue<int> maxi;
priority_queue<int,vector <int>,greater <int> >mini;
maxi.push(4);
maxi.push(8);
maxi.push(4);
maxi.push(7);
int n = maxi.size();
for (int i = 0; i < n; i++)
{
cout << maxi.t... | ALGO | 0.998886 | 3.559799 |
05667b2a-35aa-4cd0-80a1-415d6fd6a5d8 | Phoenix-RK/GeeksForGeeks | Strings/Phone directory.cpp | //Phoenix_RK
/*
https://practice.geeksforgeeks.org/problems/phone-directory/0#
Given a list of contacts which exist in a phone directory and a query string str. The task is to implement search query for the phone directory. Run a search query for each prefix p of the query string str(i.e from index 1 to str length)... | ALGO | 0.999883 | 5.341632 |
5e347c54-0eb6-482d-bb10-b06e370b55ea | RKMVCC-BSc-Comp-Sci-2020-21/Programming-C-Cpp-Sem1 | March/Copy one array elements into other array.cpp | #include< iostream>
using namespace std;
int main()
{
int n,i,j,temp, arr[50];
cout<<"Enter total number of elements :";
cin>>n;
cout<<"Enter "<< n<<" numbers one by one:\n";
for(i=0; i< n; i++)
cin>>arr[i];
//sorting using bubble sort
for(i=0; i<(n-1); i++)
{
for(j=0; j<(n-i-1); j++)
{
if(arr[j]>arr[j... | ALGO | 0.99989 | 3.961864 |
aa34fcec-64e2-45f8-b15b-49583d6fea6e | ChristopherStafford/GamePhysics | MathTest/MathTest/ContactResolver.cpp | #include "ContactResolver.h"
ContactResolver::ContactResolver()
{
setIterations(99, 99);
setEpsilon(.01f, .01f);
}
ContactResolver::ContactResolver(unsigned iterations, double velocityEpsilon, double positionEpsilon)
{
setIterations(iterations, iterations);
setEpsilon(velocityEpsilon, positionEpsilon);
}
Contact... | ALGO | 0.980289 | 5.747783 |
f0a5a570-a953-47ee-b3a7-734717e62365 | Xeicker/Connect4_Solver | Main.cpp | #include <iostream>
#include "Board.h"
#include "MinMax.h"
using std::cout;
using std::endl;
int main(){
Board b;
b.PlayMove(3);
b.PlayMove(3);
b.PlayMove(3);
b.PlayMove(3);
b.PlayMove(3);
b.PlayMove(6);
b.PlayMove(2);
b.PlayMove(1);
b.PlayMove(1);
b.PlayMove(1);
b.P... | ALGO | 0.994391 | 4.49541 |
b39ee6cb-209a-4c6f-b3ed-785b8eb4a9f6 | Unique-chiemerie/Testing-dark-light-mode--Shared-preferences- | 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 |
05687aad-887c-4e1a-9a37-cd7d16f762a0 | Jocho14/Projekt_pea_3 | projekt_3_pea/src/Main.cpp | #include <iostream>
#include <memory>
#include "Matrix.hpp"
#include "GAalgorithm.hpp"
#include "DataManager.hpp"
void showMenu()
{
std::cout << "---Algorytm genetyczny dla ATSP---\n\n";
std::cout << "1. Wczytaj dane z pliku\n";
std::cout << "2. Wprowadz kryterium stopu\n";
std::cout << "3. Ustaw wielkosc populac... | ALGO | 0.990094 | 4.249428 |
1fd751bd-a080-4632-a387-4db7fba54711 | sossont/Algorithm_Study | 알리알리알라셩/21.06.23 복습 시작/4. 동적계획법 복습의 복습/2662 기업투자.cpp | #include <iostream>
#include <stack>
using namespace std;
int N, M;
int company[21][301]; // 금액은 300까지. 기업은 20개 까지.
int dp[21][301];
int path[21][301];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> M;
for(int i = 1; i<=N; i++) {
int invest;
... | ALGO | 0.999965 | 3.792105 |
b0060045-61fc-46be-a7c9-a7a4ce7534b8 | abhijitjawale09/CODE-FORCE | 0702-A-Maximum Increase/0702-A-Maximum Increase.cpp | #include<bits/stdc++.h>
using namespace std;
void solve() {
long n;
cin>>n;
long long arr[n];
int count = 0;
int temp = 1;
cin>>arr[0];
long prev = arr[0];
for(int i = 1; i < n; i++) {
cin>>arr[i];
if(prev < arr[i]) {
temp++;
}else{
... | ALGO | 0.999743 | 4.208861 |
f6ef7a65-da34-487c-ae65-757315424a36 | krish-ag/HacktoberFest22-Repo-DSA | wildcardmatching.cpp | class Solution {
public:
bool isMatch(string s, string p) {
int n = s.size();
int m = p.size();
if(m==0) return (n==0);
vector<vector<bool>>dp(n+1,vector<bool>(m+1,false));
dp[0][0]=true;
for(int i=1;i<=m;i++){
if(p[i-1]=='*')dp[0][i]=dp[0][i-1];
... | ALGO | 0.999905 | 5.533267 |
2131965a-f8ef-4284-a9b2-25cf44698407 | sarvex/leetcode-wren | solution/0200-0299/0274.H-Index/Solution.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
int n = citations.size();
int cnt[n + 1];
memset(cnt, 0, sizeof(cnt));
for (int x : citations) {
++cnt[min(x, n)];
}
for (int h = n, s = 0;; --h) {
s += cnt[h];
if (s >= ... | ALGO | 0.999958 | 6.447913 |
c2eb7360-fcce-45f3-b5bd-67c56b000022 | MarcioMicro/beecrowd-cpp | Iniciante/Bee1961.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int P, N, cano, canoAnt;
bool win=1;
cin >> P >> N;
for (int i=0; i<N; i++) {
cin >> cano;
if (i==0) canoAnt = cano;
else {
if (abs(canoAnt - cano) > P) win = 0;
canoAnt = cano;
... | ALGO | 0.999983 | 3.616756 |
4d5de28f-9d4b-4458-91d2-63a0f730d4a5 | danishzulfiqar/CodeChef | Nearest Exit/exit.cpp | #include <iostream>
#include <cstdio>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int test_cases;
cin >> test_cases;
while (test_cases--)
{
int x;
cin>>x;
if (x > 50)
cout << "RIGHT" << endl;
else
cout << "... | ALGO | 0.999921 | 3.242442 |
444fcfe2-4ff0-400d-972a-605c11cb541c | TranNguyenDo/DoTranNguyen_monC | Chapter 9/Case Study Modification #1.cpp | #include <iostream>
using namespace std;
// Nguyên mẫu hàm
void arrSelectSort(int *[], int);
void showArray(const int[], int);
void showArrPtr(int *[], int);
int main()
{
int numDonations;
// Yêu cầu người dùng nhập số lượng quyên góp
cout << "Nhập số lượng quyên góp: ";
cin >> numDonations;
if ... | ALGO | 0.999718 | 5.516613 |
de1ce75a-e7b9-4cf2-b294-335f4c05bb74 | vaidik07/DSA | week12_Advance_sorting/quicksort.cpp | #include <iostream>
using namespace std;
int partition(int arr[] , int si , int ei)
{
int pivotElement = arr[si];
int count =0;
for(int i=si+1 ; i<=ei ; i++)
{
if(arr[i]<=pivotElement) count++;
}
int pivotIdx = count +si;
swap(arr[si] , arr[pivotIdx]);
int i=si;
int j=ei;
... | ALGO | 0.999976 | 5.128196 |
b2bd6e6a-95fe-44a7-8983-9ff25e872930 | jackyh/qt210_ics_frameworks_base | media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp | /*
Pathname: ./audio/gsm-amr/c/src/gc_pred.c
Functions:
gc_pred_reset
gc_pred
gc_pred_update
gc_pred_average_limited
------------------------------------------------------------------------------
MODULE DESCRIPTION
This file contains the functions that perform code... | ALGO | 0.999567 | 6.225616 |
5d50519c-911e-4be2-92c3-c25699917993 | okhmanyuk-ev/cocos2dx-test | cocos2d/cocos/math/Vec2.cpp | #include "math/Vec2.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
// returns true if segment A-B intersects with segment C-D. S->E is the overlap part
bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E)
{
float ABmin = std::min(A, B);
float AB... | TOOL | 0.960704 | 7.040969 |
38ece171-c25b-417d-9026-d0073232e096 | Uncle-Lee/GeekAlgorithmCamp | ppt/第1课 课件+课上代码+注释/lc155 最小栈.cpp | class MinStack {
public:
/** initialize your data structure here. */
MinStack() {
}
void push(int val) {
// 前缀最小值
preMin.push(s.empty() ? val : min(val, preMin.top()));
s.push(val);
}
void pop() {
preMin.pop();
s.pop();
}
int top() {... | ALGO | 0.999946 | 6.49494 |
af8be42b-1af5-4875-b765-103433de3974 | Ritik-Yadav07/Leetcode | Overlapping Intervals - GFG/overlapping-intervals.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<vector<int>> overlappedInterval(vector<vector<int>>& intervals) {
// Code here
sort(intervals.begin(),intervals.end());
vector<vector<int>>merged;
... | ALGO | 0.99992 | 5.858333 |
f64b5a29-d64e-4663-a656-48b12d631402 | wjsun357/OJ | Practice/bailian1062.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=105;
int d,n;
int a[maxn][maxn];
bool vis[maxn];
int level[maxn];
int dis[maxn];
void Init()
{
memset(a,0,sizeof(a));
for(int i=0;i<=n;i++)
{
vis[i]=false;
dis[... | ALGO | 0.999906 | 3.666812 |
b443b4aa-0fcd-4495-b4f8-b1fa720f23c1 | anuragbnrj/leetCodeSolutions | 0049-group-anagrams/0049-group-anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
int len = strs.size();
map<string, vector<string>> groups;
for (int i = 0; i < len; i++) {
string temp = strs[i];
sort(temp.begin(), temp.end());
groups[temp].push_back... | ALGO | 0.999993 | 6.569279 |
35d67b53-c1d1-466e-9575-57b0266394a3 | widiahfonikasari/widiahfonikasari-Tugas-ADS-Pointer | pointer no 1.cpp | #include<iostream>
using namespace std;
int main(){
int x,y;
int *p1,*p2;
x=5;
y=10;
p1=&y;
p2=&x;
*p1=*p2;
p2=&x;
*p2=7;
p1=p2;
p1=&x;
*p1=y;
cout<<"nilai x :"<<x<<endl<<endl;
cout<<"nilai y :"<<y<<endl<<endl;
cout<<"nilai p1 :"<<*p1<<endl<<endl;
cout<<"nilai p2 :"<<*p2<<endl<<endl;
return 0;
}
| ALGO | 0.996759 | 3.451759 |
1a8626ff-22bc-486f-b69c-3c8f4a6740e5 | wiznetmaker/TCP_LCD | libraries/pico-sdk/lib/tinyusb/hw/mcu/nxp/mcux-sdk/devices/LPC54606/mcuxpresso/startup_lpc54606.cpp | #if defined (DEBUG)
#pragma GCC push_options
#pragma GCC optimize ("Og")
#endif // (DEBUG)
#if defined (__cplusplus)
#ifdef __REDLIB__
#error Redlib does not support C++
#else
//*****************************************************************************
//
// The entry point for the C++ library startup
//
//********... | CONFIG | 0.88084 | 7.387593 |
3e7c7b36-6162-446c-a867-ef230f894939 | pushkarmishra/SPOJ | RRSCHED.cpp | /*
Algo: Binary Indexed Tree
Complexity: N*LogN
*/
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define MAX 50010
static int BIT[MAX+1], N, M;
long long ANS[MAX+1], Time=0, RR=0;
struct str{long long t; int i;} A[MAX+1];
vector<int> p;
inline void update(int i, int v){
for (; i... | ALGO | 0.999934 | 4.048478 |
6fe79748-011a-408e-b785-baed77dc33e1 | ShashiShekharSuman/Competative-Programming | MARCH221C/CHFDBT.cpp | #include <iostream>
using namespace std;
int main()
{
// your code goes here
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
if (n % 2 == 0)
cout << n / 2 << endl;
else
cout << n / 2 + 1 << endl;
}
return 0;
}
| ALGO | 0.999607 | 5.331069 |
7fd88afc-f9ee-4106-92fe-6ce01eaa5a20 | MeerimKurmanalieva/DevOps | web_ui_flutter/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998863 | 6.76073 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.