uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a35de4db-6ea9-4189-8870-65d8cc9568c3 | Tommygithubaccount123/leetcode | 98-validate-binary-search-tree/98-validate-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.999782 | 7.10491 |
6ef912cd-b1a9-476a-a45a-966556d436be | gh-develop/coding-test-kw | 바킹독예제/0x01/baek_10871.cpp | #include<iostream>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int A[10000] = {0}, N, X;
cin >> N >> X;
for(int i = 0;i < N;i++){
cin >> A[i];
if(A[i] < X)
cout << A[i] << " ";
}
return 0;
}
| ALGO | 0.999926 | 3.160287 |
ca31427f-ee41-4f17-8e79-2aadd406aa0b | hjiang13/LLMs-in-IR | processed_data/DecompiledResuts_Human_x_164_O1/Gemma_Huamn_x_164_O1_decompiled/CPP_68.cpp | ```c
#include <stdint.h>
typedef struct std_vector {
int32_t* _M_start;
int32_t* _M_finish;
int32_t* _M_end_of_storage;
} std_vector;
void pluck_std_vector(std_vector* output, const std_vector* input) {
int32_t* input_finish = input->_M_finish;
int32_t* input_start = input->_M_start;
output->... | ALGO | 0.997208 | 5.829036 |
a6ebf8e4-4a43-499d-b091-961f0c1eef59 | xLLLxLLLx/xLLLx | vg/summer/contest/15/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], all[N], num[N];
int main() {
int n, now = 0;
scanf("%d", &n);
for(int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
now += (a[i] == 0);
all[i] = a[i];
}
sort(a + 1, a + 1 + n), sort(all + 1, all + 1 + n);
int m = unique(all + 1, al... | ALGO | 0.999985 | 3.040593 |
6cbe35f6-1f62-4921-958c-38580bd0f086 | thegamer1907/Code_Analysis | contest/1542588925.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int i,j,k,h,m,s,t1,t2,a[11],b1,b2,c[51001];
int main(){
memset(c,0,sizeof(c));
scanf("%d%d%d%d%d",&h,&m,&s,&t1,&t2);h%=12;t1%=12;t2%=12;
a[1]=3600*h+60*m+s;a[2]=720*m+12*s;a[3]=720*s;c[a[1]]=c[a[2]]=c[a[3]]=1;
b1=3600*t1;b2=3600*t2... | ALGO | 0.999876 | 3.014931 |
43b21ea0-2523-4c33-9ed1-b72cff035454 | pvlkhm/pbscpp | task-1/array.cpp | #include <iostream>
#include <vector>
template <typename T>
class Array {
private:
T* data;
size_t size;
public:
Array(size_t n)
: size(n)
{
data = new T[n];
}
T& operator[](size_t i) {
return data[i];
}
const T& operator[](size_t i) const {
re... | TOOL | 0.993048 | 4.323287 |
66772500-ee32-4cf4-b95c-39800df87d2a | adhyayanrajpoot1/LeetCode | 198-house-robber/198-house-robber.cpp | class Solution {
public:
int memo[101];
int f(int ind , vector<int>& nums)
{
if(ind==0)return nums[ind];
if(ind==1)return max(nums[ind-1],nums[ind]);
int &ans = memo[ind];
if(ans!=-1)return ans;
return ans = max(f(ind-2,nums)+nums[ind],f(ind-1,nums));
}
... | ALGO | 0.999934 | 5.772042 |
90efdc82-c7ad-4393-899e-c0aac96a4a17 | GeorgeKovshov/codewars_cplusplus | leetcode01.cpp | #include "Header.h"
map<char, int> rome = {
{'I', 1},
{'V', 5},
{'X', 10},
{'L', 50},
{'C', 100},
{'D', 500},
{'M', 1000}
};
int romanToInt(string s) {
int length = s.length();
int sum = 0;
int previous = 0;
for (int i = length - 1; i >= 0; i--) {
if (rome[s[i]] >= previous) {
sum... | ALGO | 0.999452 | 3.260812 |
e4dc4568-fbf3-45c4-a658-36892b5d771a | EduardoMarciano/PAA-Analise-de-Desempenho-IAs | ChatGPT/Simples/bfs/bfs.cpp | // Input Using the previous graph, how to implement the Breadth-First Search algorithm?
#include <iostream>
#include <vector>
#include <list>
#include <queue>
class Graph {
private:
std::vector<std::list<int>> adjList;
int numVertices;
public:
Graph(int vertices) : numVertices(vertices) {
adjList... | ALGO | 0.999997 | 6.487063 |
182b2b0d-6e79-4e98-9420-1278e05c9934 | junrae6454/Algorithm | BOJ/10828.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
int main()
{
int N;
cin >> N;
stack<int> Stack;
while (N--)
{
string temp;
cin >> temp;
if (temp == "push")
{
int temp2;
cin >> temp2;
Stack.push(temp2);
}
else if (temp == "pop")
{
if (!Stack.empty())
{
... | ALGO | 0.997812 | 4.26369 |
97050f36-7b4a-44ae-aa52-71b44b373419 | varnitsingh/OJ-problems | Longest Arithmetic.cpp |
// Problem: Longest Arithmetic
// Contest: Google Coding Competitions - Round E 2020 - Kick Start 2020
// URL: https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff47/00000000003bf4ed
// Memory Limit: 1024 MB
// Time Limit: 20000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#in... | ALGO | 0.999396 | 4.551585 |
4a447e5f-77d5-4016-8d75-810623a2779e | liamkronman/cpp_learning | O/BitwiseShift.cpp | #include <bitset>
#include <iostream>
// "rotl" stands for "rotate left"
std::bitset<4> rotl(std::bitset<4> bits)
{
// my method
// if ((bits & std::bitset<4>(0b1000)) == std::bitset<4>(0b1000))
// return ((bits << 1) | std::bitset<4>(0b0001));
// return (bits << 1);
// textbook method
return ... | ALGO | 0.998817 | 5.775844 |
2367dc2b-eafb-41ac-9488-fc33a572bfe8 | shashwat329/DSA | udemy/BST/convertsortedarraytobst.cpp | #include<iostream>
using namespace std;
template<typename T>
class btnode{
public:
T data;
btnode<T>* left;
btnode<T>* right;
btnode(T data){
this->data=data;
left=NULL;
right=NULL;
}
~btnode(){
delete left;
delete right;
}
};
btnode<int>* createbs... | ALGO | 0.999399 | 4.00386 |
5318e470-7104-4e2c-9496-54e485b5337d | Amisha328/Data-Structure-Algorithm | Arrays/SubarrayWithSumZero.cpp | // Find the length of largest subarray with 0 sum
// problem link: https://www.geeksforgeeks.org/find-the-largest-subarray-with-0-sum/
#include <bits/stdc++.h>
using namespace std;
class Solution{
public:
// TC-> O(n)[array traversal]*O(logn)[hashmap] -> O(nlogn) | SC->O(n)
int maxLen(vector<int>&A, int n... | ALGO | 0.999818 | 5.482652 |
64dda465-7471-48a5-b9b2-233e9765f514 | Dead245/PlayerLeaderboardSort | PlayerLeaderboardSort/InsertionSort.cpp | #include <string>
#include <vector>
#include <unordered_map>
#include "InsertionSort.h"
std::vector<int> InsertionSort(std::unordered_map<int, std::pair<std::string, int>>& mp) {
std::vector<int> keySort; //keys are the PlayerIDs - will be sorted by highest playerScore
int index, value;
//convert map keys into vec... | ALGO | 0.999662 | 5.136308 |
8949eca4-8387-4eb3-ade5-e5c596d90bfe | Sabiqun-16/DATA-STRUCTURE_CSE2101_B210101016 | Searching/Linear_Search_using_Linked-List.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
Node(int v):data(v),next(nullptr){}
};
int LinearSearch(Node* head,int k){
int i=0;
Node* temp=head;
while(temp!=nullptr){
if (temp->data==k){
return i;
}
temp=temp->next;
... | ALGO | 0.999579 | 5.160212 |
25fb6346-8915-4a74-8092-c667243eeecc | ChuangRoy/RoyChuangs-Code | Algo/ISCOJ/4511.cpp | #pragma GCC optimize("Ofast")
#include <iostream>
#include <cstring>
#define fastio cin.tie(0)->sync_with_stdio(false)
using namespace std;
typedef long long lli;
const int mod = 1e9 + 7;
struct Graph {
lli ways_to[2003][2003];
bool blocked[2003][2003];
int N, M;
void init(int n, int m) {
... | ALGO | 0.999942 | 4.458516 |
2a6f1139-612f-4fea-bd31-71f959e4788a | ishandutta2007/codeforces | waynetuinfor/normal/801/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
long double x[maxn], y[maxn];
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n; cin >> n;
for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
long double ans = 1e18 + 10;
for (int i = 0; i < n; ++i) {
int... | ALGO | 0.999923 | 4.457754 |
92762e7e-9e41-4032-a890-6c59a3950f1f | jaxvanyang/acm | cyj/图论/洛谷图论专题/图论/树上的dp/可乐.cpp | /*
* @Descripttion:
* @Topic link: https://www.luogu.com.cn/problem/P3758
* @Question meaning:
* @Status: Accepted
* @Author: cyj
* @Date: 2021-07-30 15:43:22
* @LastEditTime: 2021-08-08 11:08:15
*/
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queu... | ALGO | 0.999981 | 4.402443 |
81f0748c-c4bd-44da-9ba3-db9274388fd1 | PhamTienThanhCong/Code_C_and_Cpro | C/Bai_Tap_Ngon_Ngu_C/VD_Khac/goodback/main.cpp | #include<bits/stdc++.h>
using namespace std;
bool snt(int a)
{
if ((a<=3)&&(a>1))
{
return true;
}
for (int i=2;i<=sqrt(a);i++)
if (a%i==0) return false;
return true;
}
long a,d;
int main()
{
d=0;
cin>>a;
for (int i=1;i<a;i++)
if (snt(i))
... | ALGO | 0.999691 | 4.1503 |
779d28e1-06f7-46fc-80fd-6cc6189cf70f | ManojGolkonda/MissionRnD-C-LinkedLists2-Worksheet | src/merge2LinkedLists.cpp | /*
OVERVIEW: Merge two sorted linked lists.
E.g.: 1->3->5 and 2->4, output is 1->2->3->4->5.
INPUTS: Two sorted linked lists.
OUTPUT: Return merged sorted linked list.
ERROR CASES: Return NULL for error cases.
NOTES:
*/
#include <stdio.h>
struct node {
int num;
struct node *next;
};
struct node * merge2LinkedL... | ALGO | 0.999917 | 4.982725 |
ae3c67d4-cc6c-4370-ba50-e56f94deeab0 | leonardoAnjos16/Competitive-Programming | Codeforces/number_of_minimums_on_a_segment.cpp | #include <bits/stdc++.h>
using namespace std;
#define long long long int
struct SegmentTree {
private:
int n;
vector<int> a;
vector<pair<int, int>> tree;
public:
SegmentTree(vector<int> &a, int n) {
this->n = n;
this->a = a;
tree.resize(4 * n);
build(1, 1, n);
}
... | ALGO | 0.999962 | 5.330071 |
d205d077-a966-4d44-806e-910fa3bbb408 | viter-oliver/HSG | boost_1_79_0/libs/graph/example/filtered_graph_edge_range.cpp | /*
Sample output:
filtered edge set: (A,B) (C,D) (D,B)
filtered out-edges:
A --> B
B -->
C --> D
D --> B
E -->
*/
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/graph_utility.hpp>
templ... | ALGO | 0.999231 | 6.272009 |
bc2ee398-5bba-40ac-84d1-48e2bcdde8d0 | svsannidhay/competitive-programming | DATA STRUCTURES/TREES/BST/Least_common_Ancestor.cpp | #include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define MOD 1000000007
#define cinll(x) ll x;cin>>x;
#define cout(x) cout<<x;
#... | ALGO | 0.999992 | 3.947826 |
a205d155-1284-4089-9db7-375001afa259 | rcolleen/289H_assignments | eigen-git-mirror/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999949 | 3.356631 |
9d7ae0e2-9b0c-4527-b7b9-5c911981eba7 | maxwen/pgrouting-new | src/common/xy_vertex.cpp | #include "cpp_common/xy_vertex.h"
#include <vector>
#include <limits>
#include <algorithm>
#include <boost/geometry/io/wkt/write.hpp>
#include "cpp_common/pgr_assert.h"
namespace {
template<typename T>
typename std::enable_if<!std::numeric_limits<T>::is_integer, bool>::type
almost_equal(T x, T y, int ulp) {
... | ALGO | 0.969833 | 7.284597 |
558ca6df-2f6e-4063-a583-92a9e0b6b940 | sachinshrestha483/CollegeAlgorithms | MergeSort.cpp | #include<iostream>
using namespace std;
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
i = 0;
j = 0; ... | ALGO | 0.999973 | 4.91959 |
81077abd-7788-4886-b703-e1190c234b31 | Je-ric/C-Language | Number Series/HAPPY.cpp | #include<stdio.h>
int isHappy(int num);
int main() {
int choice, num, i;
printf("[1] Print happy numbers between given numbers\n");
printf("[2] Print happy numbers up to (n)\n");
printf("[3] Check the specific number if happy or not\n");
printf("Enter your choice: ");
scanf("%d", &choice);
... | ALGO | 0.998766 | 4.947441 |
336db960-4dbc-4533-acd7-6113b7a6e545 | julkar-naim/Uva-Solutions | 661.cpp | using namespace std;
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <sstream>
typedef long long ll;
#include <algorithm>
int main(){
int n,m,c;
int seq = 1;
while(cin >> n >> m >> c){
if(n == 0 && m == 0 && c == 0) break;
vector < pair < int ... | ALGO | 0.987484 | 3.283894 |
916e6c4a-ee70-4a71-ac15-b1840425e3db | ImportLove/Graph-Theory-Learning | WaterPuzzle.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include "Graph.h"
using namespace std;
class WaterPuzzle{
private:
vector<int> pre;
int end;
public:
void findAll(int a, int b, vector<int>& next){
next.push_back(5*10 + b);
next.push_back(a*10+3);
next.pus... | ALGO | 0.999892 | 4.522318 |
7de43c08-2eb4-437c-a818-eb64458c676a | aditya-sengupta/simea | lib/eigen-3.3.7/doc/examples/tut_matrix_resize.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,5);
m.resize(4,3);
std::cout << "The matrix m is of size "
<< m.rows() << "x" << m.cols() << std::endl;
std::cout << "It has " << m.size() << " coefficients" << std::endl;
VectorXd v(2);
v.resize(5);
... | ALGO | 0.951122 | 3.882785 |
722b8f93-4e0a-44fb-832e-6283c03e85ca | KartikAg13/College | data_structures_and_algorithms/learn/graphs/cycle_detection_directed.cpp | // lecture 89
#include <iostream>
#include <unordered_map>
#include <list>
#include <vector>
#include <queue>
using namespace std;
class Graph {
public:
unordered_map<int, list<int>> adj;
void addEdge(int u, int v, bool direction) {
adj[u].push_back(v);
if(direction == false)
... | ALGO | 0.999919 | 5.376657 |
55aa607b-f747-40fa-9af7-f6658121dcc8 | yihaoye/data-structure-and-algorithm-study-notes | Common Data Structure and Data Type/Data Structure Implementation/HashTable/main.cpp | //**************************************************************
// main.cpp
// HashTable
//
// Created by Kar Beringer on June 19, 2014.
// Demonstrate a simple Hash Table in C++.
// Implements a Linked List class.
//**************************************************************
#include "HashTable.h"
int main(... | ALGO | 0.991248 | 4.866054 |
e6ee5559-4939-45af-8832-1fae12af518d | Anurag-zr/leetcode_submission | 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.999867 | 6.405492 |
e29624c5-fb68-41a0-aab5-ec83f0218fb9 | Cavezzo/Movie-Recommender | Recommender.cpp | //
// Recommender.cpp
// Pnet Phlix
//
// Created by Callum Lavezzo on 3/10/23.
//
#include "Recommender.h"
#include "User.h"
#include "UserDatabase.h"
#include "MovieDatabase.h"
#include "Movie.h"
#include <map>
#include <unordered_map>
#include <string>
#include <vector>
using namespace std;
Recommender::Recomm... | ALGO | 0.996486 | 6.127112 |
f4ecbae8-da42-4bbd-a005-d87ee1365a29 | polaris-cloud/cpp-primer | test12.24.cpp | #include<string>
#include<iostream>
#include<memory>
using namespace std;
using strPtr=unique_ptr<char[]>;
char*saveString(char*s1,string word,size_t*strlen)
{
string s=string(s1)+word;
delete[]s1;
string::size_type len=s.size();
const char*s3=s.c_str();
char*res=new char[len+1];
for(int i=0;i<len+1;++i)
{... | TOOL | 0.992634 | 3.994489 |
31eda187-8593-411f-aa8d-e20a0e56a6e8 | nwlynh/BTVN-Tuan-5 | Bai tap tuan 14.cpp | #include <iostream>
#include <cstdlib>
#include <cctype>
#include <cstring>
using namespace std;
struct Node {
char id;
Node* leftmostchild;
Node* rightsibling;
};
Node* makeNode(char id) {
Node* q = new Node;
q->id = id;
q->leftmostchild = nullptr;
q->rightsibling = nullptr;
return q;... | ALGO | 0.999976 | 4.480491 |
61d50d29-0ab8-464d-a03f-9a373e6d6f0b | Rana-Mohsen/seere | 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 |
982a1dca-007a-4e7e-ac15-dd04e06dd542 | foxtacles/vaultmp | source/lib/RakNet/cat/src/math/rtl/div/DivideGeneric.cpp | #include <cat/math/BigRTL.hpp>
#include <cat/math/BitMath.hpp>
using namespace cat;
#if !defined(CAT_NO_LEGPAIR)
Leg CAT_FASTCALL BigRTL::DivideX(const Leg *in_a, Leg in_b, Leg *out)
{
Leg R = 0;
for (int leg = library_legs-1; leg >= 0; --leg)
{
LegPair N = ((LegPair)R << CAT_LEG_BITS) | in_a[leg... | ALGO | 0.984774 | 5.552013 |
4ab9cd3c-4f41-48ed-8289-6c70a16c5643 | jevinskie/llvm-project-embedded-library-in-process | llvm/lib/ProfileData/ProfileSummaryBuilder.cpp | #include "llvm/IR/ProfileSummary.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ProfileData/ProfileCommon.h"
#include "llvm/ProfileData/SampleProf.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
namespace llvm {
cl::opt<bool> UseContextLessSummary(
"profile-summary-contextless", cl::Hidd... | TOOL | 0.91725 | 7.820426 |
e31cd498-04ed-4c3e-84b4-0cf50d95bbe5 | BStok/OS--Sem4 | ProducerConsumer.cpp | //Producer Consumer
#include <iostream>
using namespace std;
// Signal and wait functions
void signal(int *sem){
(*sem)++;}
void wait(int *sem){
(*sem)--;
}
//define producer and consumer processes
void producer(int *mutex, int *empty, int *full, int *buffer, int *in, int *element){
if(*empty > 0 && *mutex... | ALGO | 0.999385 | 6.037797 |
835c79c8-35e3-4bb4-b61f-0409a1eca2ef | doanamo/Civilization-5-Mods | Source/CvGameCoreDLL/CvStartPositioner.cpp | #include "CvGameCoreDLLPCH.h"
#include "CvGameCoreUtils.h"
#include "CvStartPositioner.h"
#include "CvMinorCivAI.h"
// include this after all other headers!
#include "LintFree.h"
//=====================================
// CvStartPositioner
//=====================================
/// Constructor
CvStartPositioner::CvS... | ALGO | 0.998262 | 4.830317 |
53814d24-57c4-44c2-bf7d-7377d984d066 | Arnav17Sharma/CodeForces | 734A.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
int n, a=0, d=0;
string s, e;
cin>>n;
cin>>s;
for(int i=0; i<n; i++){
e = s[i];
if(e=="A"){a++;}
else{d++;}
}
if(a>d){cout<<"Anton"<<endl;}
else if(a<d){cout<<"Danik"<<endl;}
else{cout<<"Frie... | ALGO | 0.999958 | 3.688211 |
b7806ce4-7227-48cb-801c-e3797970d7d2 | Mr-G254/Timer-Mobile-App | timer/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.995772 | 6.76073 |
31dd3341-266d-44f0-8605-d60bb0f9aebc | MdSourovAhmed/DSA | GRAPH/bipatrite_graph.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 9;
vector<int> g[N];
bool vis[N], col[N];
bool isBipartrite(int v, int c)
{
vis[v] = 1;
col[v] = c;
for (int cld : g[v])
{
if (!vis[cld])
{
if (!isBipartrite(cld, c ^ 1))
return false;
}... | ALGO | 0.999901 | 5.060694 |
e950aeff-ddf4-4f01-a458-5e60f78ae7d6 | GhostRider987/365-Days-of-Code-2024-Challenge-with-Scaler | Problems/Day_054.cpp | int Solution::isPalindrome(string A) {
int start = 0;
int end = A.length() - 1;
while (start < end) {
// Ignore non-alphanumeric characters and convert to lowercase
while (start < end && !isalnum(A[start])) {
start++;
}
while (start < end && !isalnum(A[end])) {
... | ALGO | 0.99934 | 6.089041 |
e8946d7a-ff53-4a85-a652-c36d26d5177a | Yomna521/Path-planner | Path Planner/src/Eigen-3.3/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.999605 | 3.625966 |
95797aa2-d18d-4bbe-9cde-c2bf0e5789af | openucx/ODOS | llvm/lib/CodeGen/RegAllocScore.cpp | #include "RegAllocScore.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/ilist_iterator.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundleIte... | ALGO | 0.937324 | 6.573933 |
a9c566bf-49ca-4414-bfc1-bc28d1fa692c | hws2002/algorithm | boj/CPP/NETWORK_FLOW/Bipartite_Matching/9525/9525.cpp | #include <iostream>
#include <cstring>
#include <vector>
#define MAX_N 100
#define MAX_VIDX 10000
#define endl '\n'
using namespace std;
int N;
vector< vector<int> > board;
int coor2V[MAX_N][MAX_N] = {{-1}};
int coor2H[MAX_N][MAX_N] = {{-1}};
int vidx = 0; int hidx = 0;
vector<int> adj[MAX_VIDX]; // adj[a] : a번째 left... | ALGO | 0.999848 | 4.9403 |
18403d38-aaa1-45a0-b2c3-654ae1790506 | JoseEliel/VevaciousPlusPlus | source/TunnelingCalculation/BounceActionTunneling/BounceAlongPathWithThreshold.cpp | /*
* BounceAlongPathWithThreshold.cpp
*
* Created on: Jul 1, 2014
* Authors: Ben O'Leary (<EMAIL>)
* José Eliel Camargo-Molina (<EMAIL>)
*/
#include "TunnelingCalculation/BounceActionTunneling/BounceAlongPathWithThreshold.hpp"
namespace VevaciousPlusPlus
{
BounceAlongPathWithThreshold::Bo... | ALGO | 0.999019 | 7.418219 |
03aea382-c530-4c45-ae97-8d479f341e8d | KhoiBui16/UIT_Wecode | Source code/DSA/Cô Thương source code/Linked List (Intermediate - Part 2)/Bai3.cpp | /*###Begin banned keyword - each of the following line if appear in code will raise error. regex supported
define
include
using
###End banned keyword*/
#include <iostream>
using namespace std;
struct DNode
{
int info;
DNode *pNext, *pPrev;
};
struct DList
{
DNode *pHead, *pTail;
};
//###INSERT CODE HERE -
void... | ALGO | 0.999499 | 4.407775 |
584b71da-0fe1-4cde-a56f-90f328839c86 | mtsfer/dsa-and-competitive-programming | BEE-3056.cpp | #include <iostream>
int main()
{
int n {};
std::cin >> n;
long long int result = (1 << n) + 1;
result *= result;
std::cout << result << "\n";
return 0;
}
| ALGO | 0.999706 | 5.563777 |
1cd291b2-a3e3-441b-bb08-88c534a44e6a | ujju20/DSA-Practice | Tree/Diagnol-Traversal.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999643 | 5.992355 |
72832011-5b85-41ae-a0a6-75c60f90af5f | anandhu720/Leetcode-Solutions | 846-hand-of-straights/846-hand-of-straights.cpp | class Solution {
public:
bool isNStraightHand(vector<int>& nums, int gs) {
map<int,int> umap;
for(int it : nums) umap[it]++;
queue<int> q;
int last_checked = -1 ,opened = 0;
for(auto it : umap) {
int i = it.first;
if(opened > 0 and i ... | ALGO | 0.999936 | 6.492371 |
9fd96cb8-774e-4a62-9eb6-aa78f265bbf2 | divyang4481/wnd-charm | wndchrm/tags/wndchrm-1.30/transforms/ChebishevFourier.cpp | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* */
/* Massachusetts Institue of Technology, */
/* National Institutes of Health, ... | ALGO | 0.999754 | 4.922086 |
f43d9c68-cf2a-4bbd-a63e-365fc1109a09 | victorivis/competitive-programming | zerando-leetcode/Top Interview 150/Kadane's Algorithm ~Solved/53. Maximum Subarray.cpp | /*
https://leetcode.com/problems/maximum-subarray/description/?envType=study-plan-v2&envId=top-interview-150
*/
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int tamanho = nums.size();
if(tamanho==1){
return nums[0];
}
vector<int> prefix... | ALGO | 0.99983 | 6.027437 |
e807ddc3-7938-4adf-842b-615d11b83ef4 | hzratali/DSA-Problems | 1337-the-k-weakest-rows-in-a-matrix/1337-the-k-weakest-rows-in-a-matrix.cpp | class Solution {
public:
vector<int> kWeakestRows(vector<vector<int>>& mat, int k) {
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
for(int i=0; i<mat.size(); i++){
int cnt = 0;
for(int j=0; j<mat[0].size(); j++){
cnt += ma... | ALGO | 0.999953 | 5.809556 |
24f435d8-c42c-4109-b5b6-da3505caf6a4 | anuvazhayil/Algorithms | DP/stockBestTime.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
if(!prices.size())
return 0;
int pro_price = 0, min_val = prices[0];
for(int i = 0; i < prices.size(); i++){
pro_price = max(pro_price, prices[i]-min_val);
min_val = min(min_val, prices[i]);
... | ALGO | 0.999821 | 6.136102 |
31219858-045b-4049-97a1-c6b53e6c3218 | grassead-testorganization/system_libvintf | RuntimeInfo-target.cpp | #define LOG_TAG "libvintf"
#include <android-base/logging.h>
#include "RuntimeInfo.h"
#include "CompatibilityMatrix.h"
#include "parse_string.h"
#include <dirent.h>
#include <errno.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <cutils/properties.... | TOOL | 0.960568 | 5.499943 |
840ba1f2-26ab-4cca-81b7-5e7a6464ec76 | jinbeomdev/daily-algorithm-problems | [BOJ]1693/[BOJ]1693/Source.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int N;
vector<vector<int>> adj;
vector<bool> visited;
vector<vector<int>> tree;
vector<vector<int>> dp;
void getTree(int parent, int child) {
visited[child] = true;
if (child != 1) tree[parent].push_back(child);
for (int i = 0; i < ad... | ALGO | 0.999289 | 4.581094 |
ea6b2c59-e29e-4109-a5a6-37983094a824 | ishandutta2007/codeforces | __math/normal/1133/F1.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <limits>
#include <ctime>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sst... | ALGO | 0.999977 | 3.966044 |
433dc49b-6304-4c56-a2e2-68e572910cc8 | AniketKul/CMPS229_OpenLambda_Ceph | experiments/single-node/docker/boost/libs/phoenix/example/find_if.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
int
main()
{
using boost::phoenix::arg_names::arg1;
int init[] = { 2, 10, 4, 5, 1, 6, 8, 3, 9, 7 };
std::vector<int> c(init, init + 10);
typedef std::vector<int>::iterator... | ALGO | 0.987521 | 5.04283 |
52077896-f466-4cb0-962e-55fc1350680c | woegster/Schublade | Code/Sha1.cpp | /*
sha1.cpp - source code of
============
SHA-1 in C++
============
100% Public Domain.
Original C Code
-- Steve Reid <<EMAIL>>
Small changes to fit into bglibs
-- Bruce Guenter <<EMAIL>>
Translation to simpler C++ Code
-- Volker Diels-Grabsch <<EMAIL>>
Saf... | ALGO | 0.976032 | 7.458393 |
c78046a5-7191-45da-9a37-61b91d8cbabb | roaddd/DataStructure | 《数据结构》教材习题/ch_5.cpp | #include <cstddef>
#include <iostream>
#include <deque>
using namespace std;
#define _CRT_SECURE_NO_WARNINGS 1
/* ԶΪĴ洢ṹд㷨
*/
typedef struct BiNode {
int data;
struct BiNode* lchild, * rchild;
}BiTNode,*BiTree;
//˳
void CreateBiTree(BiTree& T)
{
int ch;
cin >> ch;
if (ch != '#')
{
T = new BiTNode;
T->data=... | ALGO | 0.99995 | 3.6678 |
0a67f404-0932-4930-a1df-9c6f64689af6 | dragly/photonflow | src/core/randomnumbergenerator.cpp | #include "stdafx.h"
#include "randomnumbergenerator.h"
// Random Number Method Definitions
#define M 397
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
namespace photonflow {
void RN... | TOOL | 0.99154 | 5.818614 |
3080035a-df60-41fb-95de-7d1aa840f712 | Arnavkshk/dsa | practice_41.cpp | // merge sort using recursion
#include <iostream>
using namespace std;
void merge(int arr[],int s,int e){
int m = (s+e)/2;
int len1= m-s+1;
int len2=e-m;
int *first = new int[len1];
int *second = new int[len2];
int mainarrayindex = s;
for(int i=0;i<len1;i++){
first[i]=arr[mainarra... | ALGO | 0.999986 | 5.226592 |
fa44cc46-851a-4933-94f3-7f931f062bd9 | benthinnick/leetcode | oneeditdistance.cpp | #include <cctype>
#include <string>
class Solution {
public:
bool isOneEditDistance(std::string s, int si, std::string t, int ti,
bool charfound) {
if (si - ti > 1 || s.size() - t.size() > 1) {
return false;
}
while (si < s.size() && ti < t.size()) {
if (s[si] != t[... | ALGO | 0.999458 | 6.205381 |
eb0a2813-bfdb-45d1-b901-b9ce80879bdc | Israil445/Tree_data_structure | Seaching_data_in_BST.cpp | //Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
using namespace std;
struct node{
int data;
struct node *parent;
struct node *left;
struct node *right;
};
struct node *create_node(int item){
struct node *new_node=(struct node*)malloc(sizeof(struct node));
new_node->d... | ALGO | 0.99999 | 3.852387 |
37e86a4a-0146-4ddc-8db0-0cdca1bc66e4 | Movazed/CodeForces_Problem_Set | CodeForces_round_994_F.cpp | #include<iostream>
#include<map>
#define int long long
using namespace std;
const int N=1e5+5,K=20;
int n,m,a[N],ans[N],x[N],y[N];
struct yuno
{
map<int,int>mp;
void init(){mp.clear();}
void ins(int x){++mp[x];}
void del(int x){if(!--mp[x])mp.erase(x);}
}res;
struct dat
{
int k,siz;map<int,int>mp;
void init(int x... | ALGO | 0.999965 | 3.776252 |
b20cc400-1885-449f-a12a-e8b68ce79304 | roufujjaman/Algorithm | 08_Dynamic Programming/08_Exercise/08_07_GG_Shortest Common Supersequence.cpp | class Solution
{
public:
int shortestCommonSupersequence(string X, string Y, int m, int n)
{
//code here
int mem[m + 1][n + 1];
for (int i = 0; i <= m; i++) mem[i][0] = 0;
for (int j = 0; j <= n; j++) mem[0][j] = 0;
for (int i = 1; i <= m; i++)
{
f... | ALGO | 0.999988 | 5.199949 |
bf3a8fe4-c98d-4220-b357-787b1fdd4c22 | HananiJia/bit | 剑指offer--最小的k个数/剑指offer--最小的k个数/源.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//class Solution {
//public:
// vector<int> GetLeastNumbers_Solution(vector<int> input, int k) {
// int i = 0;
// int length = input.size();
// for (i = 0; i < length; i++)
// {
// for (int j = 0; j < ... | ALGO | 0.999972 | 4.438284 |
db6b3195-55af-4432-a517-5d806aa86a08 | sulivansimoes/Linguagem-C | C/Programas/1º periodo/Aula 13/numero maior - for/numero maior - for.cpp | #include <stdio.h>
#include <stdlib.h>
int main()
{
int num,maior;
printf("informe um nmero ou informe 0 para sair: ");
scanf("%d",&num);
while(num > 0 )
{
if(num>maior){
maior = num;
}
printf("informe um nmero ou informe 0 para sair: ");
scanf("%d",&num);
}
printf("\nO maior eh: %d",maior);
}
| ALGO | 0.998817 | 3.479595 |
bcd089bb-9346-47ba-bd3e-4c4708651cd1 | Winterleaf/DNT-Torque3D-V1.0 | Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp | #include "btGjkConvexCast.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "btGjkPairDetector.h"
#include "btPointCollector.h"
#include "LinearMath/btTransformUtil.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define MAX_ITERATIONS 64
#else
#define MAX_ITERATIONS 32
#endif
btGjkConvexCast::btGjkConvexCast(... | ALGO | 0.996108 | 6.389527 |
834922c6-18a2-430b-8bdf-1d6ee6fb3b84 | Tphuong612/Cplusplus_ptit | CPP0274 dem so phan tu lap lai.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
map <int, int> mp;
int a[n+5];
for(int i=0;i<n;i++)
{
cin>>a[i];
mp[a[i]]++;
}
int dem=0;
for(int i=0;i<n;i++)
{
if (mp[a[i]]>1) dem++;
}
... | ALGO | 0.999721 | 4.249238 |
473b5288-2ded-49d7-88e8-03b5a2446bc4 | DeepakReddy1999/leetcode | 260-single-number-iii/single-number-iii.cpp | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
long long result=0;
for(int num:nums){
result^=num;
}
long long setbit=result & -result;
int num1=0,num2=0;
for(int num:nums){
if(num & setbit){
num1^=num;
... | ALGO | 0.999987 | 5.289898 |
9ad10431-c159-4b34-b841-83a546af035c | developerNishtha/Cpp-Competitive-Programming- | code chef/ONEORTWO.cpp | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void nishtha(){
ll x,y;
cin >>x>>y;
if(x==y && x%2==0) {cout<<"CHEFINA"<<endl;return;}
else if(x==y && x%2!=0) {cout<<"CHEF"<<endl;return;}
ll df=abs(x-y);
if(df>=2 && x>y){
cout<<"CHEF"<<endl;
return;
}
else if(df>=2 && x<y... | ALGO | 0.999792 | 4.266665 |
2d70232c-d69b-4fba-975e-9a33ecec92cd | wangtongxue-369/xcpc_Code_file | file/nowcoder/2025summer_duoxiao/9/F.cpp | /*
/$$ /$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$
| $$ /$ | $$|__ $__/| $$ / $$ /$__ $$ /$__ $$ /$__ $$
| $$ /$$$| $$ | $$ | $$/ $$/ |__/ \ $$| $$ \__/| $$ \ $$
| $$/$$ $$ $$ | $$ \ $$$$/ /$$$$$/| $$$$$$$ | $$$$$$$
| $$$_ $$$$ | $$ >$$ $$ |_... | ALGO | 0.999624 | 4.934236 |
5945b29a-1213-4304-a2a0-757c69de2f90 | shvmsh20/GFG_POTD | April 2022/Eulerian Path in an Undirected Graph.cpp | int eulerPath(int N, vector<vector<int>> graph){
int even=0, odd=0;
int n = graph.size();
for(int i=0; i<n; i++){
int count=0;
for(int j=0; j<n; j++){
if(graph[i][j]==1){
count++;
}
}
if(count%2==... | ALGO | 0.99997 | 5.313598 |
451dc5f4-16ed-4cc2-b5d5-0c8a43eac5c4 | afrantzis/top2bottom | main.cpp | #include "top2bottom.h"
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char **argv)
{
std::string word;
std::vector<std::string> lines;
std::ios_base::sync_with_stdio(false);
std::string line;
while (std::getline(std::cin, line))
lines.push_back(std::move(line)... | TOOL | 0.887848 | 5.385257 |
564b3641-05ac-4c75-be49-a163d11fd3b7 | OprahDingus/Decode-DSA-C-- | Week 06 - 2D Arrays/30 2D Arrays Part 1 A/2_sumMatrix.cpp | #include <iostream>
using namespace std;
int main(void) {
int m, n;
cout << "Enter rows and columns: ";
cin >> m >> n;
int a[m][n], b[m][n];
cout << "Enter elements of first Matrix: ";
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
... | ALGO | 0.999661 | 4.315195 |
569ec9fe-3a60-4a61-ba82-b72633301dc1 | ssong86/leetcode-problem-solving | Top-Interview-Questions/Trees-Easy-Collection/102-Binary-Tree-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.99997 | 6.670485 |
ef7071c6-970c-4be2-855e-a2c12e13f995 | chanduk5/CPP_Edabit | CPP_CodeSignal/boxBlur.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<vector<int>> boxBlur(vector<vector<int>> image)
{
vector<vector<int>> blurImage;
int sum = 0;
for (int i = 0; i+3 <= image.size(); i++)
{
for (int j = 0; j+3 <= image[i].size(); j++)
{
for (int k = i; k < i+3; k++)
{
for (int l = j; l ... | ALGO | 0.998817 | 4.154373 |
7a73bf08-0bd3-4417-832d-887f4ab4a6f0 | comeonyang/Depth-Estimation-DCNF | libs/matconvnet-1.0-beta24/matlab/src/bits/impl/roipooling_cpu.cpp | // @file roipooling_cpu.cpp
// @brief Pooling block implementation (CPU)
// @author Hakan Bilen
// @author Abishek Dutta
// @author Andrea Vedaldi
#include "matrix.h"
#include "../data.hpp"
#include "roipooling.hpp"
#include <limits>
#include <algorithm>
#include <cmath>
using std::max ;
using std::min ;
/* -------... | DATA | 0.994814 | 7.670905 |
955f8010-972c-47e8-979f-fd812d1f9ac7 | j-beniwal/cpp | cpp-introduction_to_data_structures/week17_pointers_and_dynamic_storage/example.cpp | #include <iostream>
using namespace std;
void resizeArray(int * &arr, int currentSize, int newSize);
int main(){
int size = 10;
int * arr = new int[size];
for (int i = 0; i < size ; i++)
arr[i] = i*10;
int oneMore = 110;
int newSize = size * 2;
resizeArray(arr, size, newSize);
size... | ALGO | 0.95323 | 3.35857 |
df880e15-1318-4057-9f5f-e0d011294117 | bhanu-100/DSA | circularlinklist.cpp | #include<iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
class Linkedlist
{
private:
Node *head=NULL;
public:
Linkedlist()
{
head=new Node;
}
void create(int A[],int n);
void Display();
};
void Linkedlist::create(int A[],int n)
{
Node *p=NULL;
Node *last=NULL;
... | ALGO | 0.999787 | 4.264449 |
b4ddabb8-94de-4dcb-b90c-7c40f2e1dd98 | srishtii24/Coding-Problems | Controlled Printing.cpp | /*
Given a number N. The task is to print word accordring to the directions given below:
1. If N is divisible by 3, print "Fork" (without quotes).
2. If N is divisible by 5, print "CPP" (without quotes).
3. If N is divisible by both 3 and 5, print "Fork CPP" (without quotes).|
4. If N ia neither divisible by 3 nor 5, p... | ALGO | 0.998086 | 5.452215 |
067c4194-3b7d-4919-9eb7-25ca62a7f4b0 | ytrsk/ICPC_training_respository | ACM模板/多项式/分治NTT+MTT.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=300007;
const ll Mod=1337006139375617;
const int mod=100003,G=3;
int rev[maxn<<2];
ll fm(ll a,ll b,ll mod) {
return (a*b - (ll)((long double)a/mod*b)*mod+mod)%mod;
}
int read(){
int x=0;int f=1;
char c=getchar();
while(c<'0... | ALGO | 0.999646 | 3.420041 |
a8cee0e8-61f5-403d-9aca-62e583fcd298 | junqi1121/algorithm-practice | 小苯的数字合并.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#define inf 0x3f3f3f3f
#define endl '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e5 + 10, M = 1e5 + 10;
int n, m;
ll a[N];
ll sum = 0;
ll ans = -1;
ll sum1 = 0;
inline void solve()
{
/* write your code here... | ALGO | 0.999974 | 4.325862 |
af9ab212-2aee-490c-af66-2ac6084e8d3d | YuvrajSingh3110/cpp-and-golang-practice | C++/Linked List/Doubly.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node* next;
node* prev;
//constructor
node(int data){
this -> data = data;
this -> next = NULL;
this -> prev = NULL;
}
//destructor
~node(){
int val = this->data;
if(next!=NULL){
... | ALGO | 0.999403 | 4.493735 |
04940969-7542-4d8b-91c3-961ffaef7200 | InsightDev/XMU-JudgeOnline | 6/1555.cpp | #include <stdio.h>
int a[50][50];
int main(int argc, char* argv[])
{
int n, q;
int i, j, k;
scanf("%d %d", &n, &q);
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%d", &a[i][j]);
for (k = 0; k < n; k++)
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (!a[i][j])
a[i][j] = a[i][k] && a[k][j]... | ALGO | 0.999512 | 3.558684 |
83480d4b-6da2-4611-ad87-ef47a59178a0 | alexliuyi/Leetcode | 236. Lowest Common Ancestor of a Binary Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
std::vector<... | ALGO | 0.999977 | 6.193842 |
a79473ec-e8ff-47bf-857d-a1dc3ca5150e | ishandutta2007/codeforces | kotatsugame/normal/1373/A.cpp | #include<cstdio>
using namespace std;
int T;
long long A,B,C;
main()
{
scanf("%d",&T);
for(;T--;)
{
scanf("%lld%lld%lld",&A,&B,&C);
if(A>=C)
{
printf("-1 %lld\n",B);
}
else
{
printf("1 %lld\n",A*B>C?B:-1LL);
}
}
} | ALGO | 0.999745 | 3.635392 |
97a84e26-2913-48ae-a0e7-4c2038884ee8 | hlh981029/hd | backend/utils/gsc-1.2/packages/+bj/+cpp/graphCut/mexDGC.cpp | #include "mex.h"
#include "graph.h"
#include <iostream>
#define MAX_HANDLES 100
static int numInstances=0;
static Graph<int,int,int>* gHandles[MAX_HANDLES];
void displayDims( const char *name, const int *dims, int ndims ) {
std::cout << name << " is [ " << dims[ 0 ];
for( int i = 1; i < ndims; ++i )
std::cou... | ALGO | 0.963939 | 5.199881 |
b929ca29-5b22-4326-91c1-4241b5feac0c | khirod-datascience/foodondoornew | foodondoor_frontend/foodondoor_customer_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998541 | 6.76775 |
02f64c25-7915-4dcd-a7a5-50a81ab67ed7 | Yobeskelo/BSC-COM-19-21-YOBE-SKELO- | arrayz.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
string arrayz[]={"B234"," C234", "A345", "C15", "B177", "G3003", "C235", "B179",};
int arraysize= sizeof(arrayz)/ sizeof(arrayz[0]);
for (int i =0; i< arraysize;i++){
if(arrayz[i][0]=='C'){
cout<<arrayz[i]<<endl;
}
}
return 0;
} | TOOL | 0.930495 | 3.127763 |
c5ed2573-0940-4808-aee5-a5ba73d7c54d | luxiaogen/ky-code | Tree/05二叉树属性求WPL.cpp | #include <iostream>
#include <cstdio>
using namespace std;
typedef struct BiTNode {
int weight; // 权值
struct BiTNode *lchild, *rchild;
} BiTNode, *BiTree;
int WPL = 0; // 用于累加叶结点的带权路径长度
void PreOrder(BiTree T, int level)
{
if (T == NULL) return;
if (T -> lchild == NULL && T->rchild == NULL) // 叶结点
... | ALGO | 0.999774 | 3.442462 |
8dee4ccc-a6ab-4ab2-95c5-12280f599408 | riskiilyas/Hackerrank-Problem-Solving | Data Structures/Print_Linked_List.cpp | #include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
}
};
class SinglyLinkedList {
public:
S... | ALGO | 0.994437 | 4.596098 |
76410471-a313-4f98-beb6-a2f0805468a9 | d1ntton/C-2 | es c++2/ex7/main.cpp | #include <iostream>
int fibonacciRecursivo(int n) {
if (n <= 1) return n;
return fibonacciRecursivo(n - 1) + fibonacciRecursivo(n - 2);
}
int fibonacciIterativo(int n) {
if (n <= 1) return n;
int a = 0, b = 1, c;
for (int i = 2; i <= n; i++) {
c = a + b;
a = b;
b = c;
}... | ALGO | 0.999916 | 6.103328 |
b40d8b6c-47e0-4e22-b084-dbf7631b221f | MUMINUR-RASHID/WEEKLY-PRACTICE | WEEK-3/D_Matryoshkas.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
ll ar[n];
vector<pair<ll, ll>> v;
for (int i = 0; i < n; i++)
{
cin >> ar[i];
}
sort(ar, ar+n, grea... | ALGO | 0.999811 | 4.411177 |
6f664b29-340b-4db0-9b41-e6b3b84e79ad | ishandutta2007/codeforces | cuizhuyefei/normal/794/E.cpp | #include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
typedef long long ll;
using namespace s... | ALGO | 0.999992 | 3.211077 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.