uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
5606bf5c-b17d-479c-9307-b52689fc5ad4 | raincross7/code-similarity | codes/train_code/problem426/problem426_404.cpp | #include <iostream>
#include <queue>
#include <string>
#define rep(i, n) for (int i = 0; i < n; i++)
int dy[] = {0, 1, 0, -1};
int dx[] = {1, 0, -1, 0};
using namespace std;
int H, W, N;
char map[1003][1003];
int dist[1003][1003];
int bfs(char s, char t) {
queue<int> que_x, que_y;
rep(y, 1003) rep(x, 1003) ... | ALGO | 0.999808 | 3.890857 |
ec388868-994e-4397-8c1e-86cfe15a571d | Adityajha0808/MyLeetCode | String Permutations - GFG/string-permutations.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector<string> res;
void func(string& s, int l, int r) {
if(l == r)
res.push_back(s);
else {
for(int i=l; i<=r; ++i) {
swap(s[l], s[i]);
... | ALGO | 0.999949 | 6.414042 |
cd4c8087-2a00-4f32-937c-6156db6c7a8a | aliahsan9/C-Plus-Plus-Programs | DSA/mul.cpp |
#include<iostream>
using namespace std;
int mul(int a, int b){
return(b%a==0) ? 1:0;
}
int main(){
int a=10,b=5;
if(mul(a,b)){
cout<<b<<" is multiple of "<<a<<endl;
}else{
cout<<b<<" is not a multiple of "<<a<<endl;
}
return 0;
} | ALGO | 0.999434 | 3.986374 |
73fa7fe4-40fa-4547-b7f3-261b355e0ea0 | sagarpandey19/Striver-A-Z | Arrays/Easy/Largest Element in an Array.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 largest(vector<int> &arr, int n)
{
int target = arr[0];
for(int i=1;i<n;i++){
if(arr[i]>target){
... | ALGO | 0.999523 | 6.380984 |
ab3c5d48-dee4-4b15-83e0-8f436fe0a8c3 | EkaterinaStepanova/Bioinformatics | 1.2Frequent_words/Frequent_words/Source.cpp | #include <iostream>
#include<string>
int PaternCount(std::string st, std::string text) {
int count = 0;
for (int i = 0; i < st.length(); ++i) {
if (st.substr(i, text.length()) == text) {
count++;
}
}
return count;
}
int main() {
std::string genom;
int k, maxCount =-1;
int count = 0;
std::string resu... | ALGO | 0.999925 | 4.030883 |
93d55353-f684-43ec-883d-7337d13097c5 | SA-K1B/Problem-Solving | Categorically/combinatorics/cf1096b.cpp | #include<bits/stdc++.h>
#define ll long long int
#define db double
#define pb push_back
#define mp make_pair
#define Max 10000000000000000
#define Min -10000000000000000
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * (b / gcd(a, b)))
using namespace std;
ll M=998244353;
ll mod(ll x){
return ((x%M + M)%M);... | ALGO | 0.999955 | 3.900339 |
bc084225-eb89-40e3-b96c-82b2fe7ea66e | Sumonta056/My-Codes | Competitive program solution/1466b.cpp | // ** Sumonta Saha Mridul ** SWE - SUST
/*
###### ## ## ## ## ####### ## ## ######## ###
## ## ## ## ### ### ## ## ### ## ## ## ##
## ## ## #### #### ## ## #### ## ... | ALGO | 0.998931 | 4.543291 |
cb6f9f3e-3973-4aca-be38-db1d61e7c288 | kunwarvk01/dsa-codes | striver-playlist/dynamicProgramming/19_01knapsack.cpp | #include <bits/stdc++.h>
using namespace std;
// recursive
int f1(int i, int W, vector<int> &wt, vector<int> &val){
if(i==0) {
if(wt[0]<=W)
return val[0];
return 0;
}
int notTaken = 0+f1(i-1,W,wt,val);
int taken = INT_MIN;
if(wt[i]<=W)
taken = val[i]+f1(i-1,W-wt[i],wt,val);
return max(taken,notTaken);
... | ALGO | 0.999999 | 5.413866 |
a66164fc-bd4e-4f83-9967-cec7055da765 | yefferson12355/repositorioPensamientoComputacional | ProblemasDeOmegaCPP/Ordena Básico 1.cpp | #include <stdio.h>
#include <algorithm>
int n;
int main(){
scanf("%i", &n);
int v[n];
for(int i=0;i<n;++i)scanf("%i", &v[i]);
std::sort(v,v+n);
for(int i=0;i<n;++i)printf("%i\n", v[i]);
}
| ALGO | 0.999724 | 3.653056 |
924463e7-c3b1-4458-9541-a90808449dc2 | Hou-Xiaoxuan/AlgorithmCompetition | Online/07-23-Round_887_div2/B. Fibonaccharsis.cpp | #ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdlib>
#endif
#include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define x first
#define y second
using namespace std;
using LL = long long;
using ULL =... | ALGO | 0.999948 | 4.22536 |
b41c5cfc-81a2-48d4-a4eb-7f71d70d1c43 | atharvrustagi/DSA-Advanced | Persistent Segment Tree.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
Persistent Segment Tree
store every change at every iteration that we make
at every iteration, at most log(n) changes are made
so we will store only those log(n) changes
therefore the space complexity remains O(nlog(n))
Example question -> Median Queries (... | ALGO | 0.999911 | 5.338357 |
6d363542-8496-4faa-b44e-5c17837d68be | ArPaSokolov/labs_term_01 | lab_09/var_6.cpp | /*Найти периметр треугольника. (сторона1, сторона2, сторона3)*/
#include <iostream>
using namespace std;
class triangle //класс
{
private: //модификатор доступа
int A; //поле
int B; //поле
int C; //поле
public: //модификатор доступа
triangle(int valueA, int valueB, int valueC) // constructor
{
A = valueA;
B ... | ALGO | 0.998405 | 3.77863 |
80864ff6-08d5-47e5-8864-7ddbb2db99f5 | manan-1612/AA-All-Labs | AA All Labs/Lab-1/Randomise_Quick_Sort.cpp |
#include<bits/stdc++.h>
using namespace std;
int glb = 0;
int comp = 0;
pair<int,int> Partition(vector<int>&Array, int first, int last){
int x = Array[last];
int i = first-1;
int j;
int comp = 0;
for(j = first; j < last ;j++){
if(Array[j] <= x){
i = i+1;
... | ALGO | 0.999871 | 4.615059 |
be412d24-6198-4f1e-9443-54b803ae8178 | mochunshuang/net | test/draft/reserve2.cpp | #include <iostream>
#include <chrono>
#include <vector>
#include <random>
#include <cstddef>
// NOLINTBEGIN
using namespace std::chrono;
// 位运算实现
size_t next_pow2_bit(size_t x)
{
if (x <= 1)
return 1;
return size_t{1} << std::bit_width(x - 1);
}
constexpr size_t unsafe_next_pow2(size_t x)
{
return... | TEST | 0.964701 | 6.855016 |
929a00df-b005-4595-9a11-717094e52c91 | Earthwings/five-colors | generate-puzzle.cpp | #include "puzzle.h"
#include <iostream>
#include <set>
#include <random>
#include <functional>
#include <algorithm>
using namespace std;
void swapRows(Board &board, size_t rowA, size_t rowB)
{
for (size_t col = 0, n = board.size(); col < n; ++col) {
swap(board.at(rowA, col), board.at(rowB, col));
}
}... | ALGO | 0.98023 | 6.172069 |
008354ba-e248-47cf-886c-e13699343521 | AbhigyanMehrotra147/Algorithms-in-Cpp | BST.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Node
{
int data;
Node *right_child;
Node *left_child;
Node(int d)
{
data = d;
right_child = NULL;
left_child = NULL;
}
};
class Tree
{
vector<int> inorder;
vector<int> preorder;
vector<int> pos... | ALGO | 0.999983 | 4.938254 |
c32c5465-5ef1-472f-b46d-b598cc0f46b6 | oneapi-src/Velocity-Bench | voxelizer/SYCL/src/thrust_operations.dp.cpp | #include <oneapi/dpl/execution>
#include <oneapi/dpl/algorithm>
#include "thrust_operations.dp.hpp"
std::vector<sycl::float3> *trianglethrust_host;
infra::device_vector<sycl::float3> *trianglethrust_device;
// method 3: use a thrust vector
float *meshToGPU_thrust(const trimesh::TriMesh *mesh)
{
Timer t;
t.start(); ... | TOOL | 0.973589 | 6.598239 |
382c47be-c03b-45d1-aeac-f89f63d72d32 | Vishnu9804/POTD-GFG | POTD_2_5_2024.cpp | // POTD geeksforgeeks 2/05/2024
// Serialize and deserialize a binary tree
#include <bits/stdc++.h>
//#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <vector>
//#include <algorithm>
//#include <string>
//#include <sstream>
//#include <queue>
//#include <map>
using namespace std;
// Tree No... | ALGO | 0.999656 | 6.210349 |
268c7b13-4aca-49b7-81ca-5db5bc34679f | SequoiaDB/SequoiaDB | thirdparty/boost/libs/numeric/interval/examples/horner.cpp | #include <boost/numeric/interval.hpp>
#include <iostream>
// I is an interval class, the polynom is a simple array
template<class I>
I horner(const I& x, const I p[], int n) {
// initialize and restore the rounding mode
typename I::traits_type::rounding rnd;
// define the unprotected version of the interval ty... | ALGO | 0.995027 | 6.262965 |
a7bfd16c-798b-46cc-acaa-aaad148b1ae6 | fclaw/algorithms | algorithms/onlinejudge/graph/trafficFlow.cpp | /*
───────────────────────────────────────────────────────────────
🧳 UVa 10842 Traffic Flow, rt: s
───────────────────────────────────────────────────────────────
*/
#include "../debug.h"
#include "../../aux.h"
#include "tools/mst.cpp"
#include "tools/dfs.cpp"
#include <optional>
#include <iostream>
#include <sstrea... | ALGO | 0.99993 | 5.782676 |
30035a8e-4dd4-40a8-af5a-89cbdb53aafe | raincross7/code-similarity | codes/train_code/problem180/problem180_84.cpp | #include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>
//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long in... | ALGO | 0.999886 | 3.921623 |
b4c1e316-b372-4fa4-b1db-c54c13ffebea | OmarHaoui/fashion_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.998841 | 6.783336 |
e37dde33-4161-4a98-b60c-d289b52be099 | kamran-11b/Contest_Code | Enosis/string_reverse.cpp | #include<bits/stdc++.h>
using namespace std;
/*
input: i like this code
output: i ekil siht edoc
*/
string str_reverse_word(string s)
{
int b=0;
for(int i=0; i<=s.size(); i++)
{
if(s[i]=='\0' || s[i]==' ')
{
reverse(s.begin()+b,s.begin()+i);
b=i+1;
}
... | ALGO | 0.999871 | 3.472111 |
35dba545-1d16-4e1c-9c71-f0a4aeb90510 | wisniewskij/CP-Solutions | CSES.FI/Sorting and Searching/1163 - Traffic Lights.cpp | // github.com/wisniewskij/Code
// cses.fi/problemset/task/1163
// Traffic Lights
#include <bits/stdc++.h>
#define ndl '\n'
#define ll long long
#define INF 1000000007
#define st first
#define nd second
#define debug(x) cout << #x << ": " << x << ndl
#define all(x) (x).begin(), (x).end()
using namespace std;
int ma... | ALGO | 0.999941 | 4.091028 |
0f95b9dc-cf64-4cde-86a1-f6b76c45bf64 | iml130/sola | daisi/src/cpps/logical/algorithms/assignment/layered_precedence_graph.cpp | #include "layered_precedence_graph.h"
#include <algorithm>
namespace daisi::cpps::logical {
LayeredPrecedenceGraph::LayeredPrecedenceGraph(
std::shared_ptr<daisi::material_flow::MFDLScheduler> scheduler,
const std::string &connection_string) {
// TODO transform scheduler content to vertices and edges
//... | ALGO | 0.959531 | 6.293062 |
e34c501c-5783-4ef8-bf5f-cd794edd8201 | Sumu154/Phitron_XPSC | Week 12/I-Large_Differences.cpp | #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;
template<typename T> using pbds = tree<T,null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define ll long long
#define ld long double
#define Faster i... | ALGO | 0.999615 | 4.337948 |
b742f878-5989-4bca-b827-51725433f0b6 | WaldemarRa/TOF_INTEL | examples/pose-apriltag/rs-pose-apriltag.cpp | #include "apriltag.h"
#include "apriltag_pose.h"
#include "common/homography.h"
#include "tag36h11.h"
#define FORMAT_VALUE std::fixed << std::right << std::setprecision(3) << std::setw(6)
void homography_compute2(const double c[4][4], matd_t* H);
typedef rs2_extrinsics transformation;
static transformation to_tr... | ALGO | 0.956321 | 6.696025 |
c713c577-b360-48a7-8632-4ee33b0e12ff | ishandutta2007/codeforces | kobus/normal/462/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define pii pair<long long,long long>
#define MAXN 1123456
#define INF INT_MAX
#define double long double
#define pi acos(-1)
#define MOD 1000000007
#define int long long
#define eps 1e-9
vecto... | ALGO | 0.999919 | 3.780311 |
d89bfcfd-d524-4d79-ad70-6f0772a14fbf | catddev/HW_functionPointers_29.08.2018 | HW_functionPointers_29.08.2018/Source.cpp | #include <iostream>
#include <iomanip>
#include<math.h>
#include<ctime>
using namespace std;
// 1. ***Реализовать 3 функции каждая из которых принимает указатель на массив и количество элементов
// и возвращает указатель на новый массив.
// Первая функция ищет простые числа и заносит их в новый массив,
// вторая – вс... | ALGO | 0.990843 | 3.575825 |
12f33f90-9c1e-48df-877a-e0fb8d819e26 | Informatimukas/Solutions | Codeforces/2129/C1.cpp | #include <bits/stdc++.h>
using namespace std;
int Ask(const vector<int>& seq) {
cout << "? " << seq.size();
for (auto &el: seq)
cout << " " << el + 1;
cout << endl;
int res;
cin >> res;
return res;
}
int getInd(int L, int R) {
int lef = L + 1, rig = R;
while (lef <= rig) {
... | ALGO | 0.999922 | 3.797818 |
387712d8-9674-4902-98aa-f222e95ca5e0 | UZ-SLAMLab/ORB_SLAM2_E | Thirdparty/DBoW2/DBoW2/FORB.cpp | #include <vector>
#include <string>
#include <sstream>
#include <stdint-gcc.h>
#include "FORB.h"
using namespace std;
namespace DBoW2 {
// --------------------------------------------------------------------------
const int FORB::L=32;
void FORB::meanValue(const std::vector<FORB::pDescriptor> &descriptors,
FOR... | ALGO | 0.993937 | 6.539618 |
ec59d7f6-701f-464b-acaa-36c4d38d7159 | rawagiha/cpp_primer | chapter_01/section_1.4/exercise_1.14.cpp | #include <iostream>
//I think this
/*
* use for when there is a known number of iterations
* use while constructs when the number of iterations in not known in advance
*
* https://stackoverflow.com/questions/2950931/for-vs-while-in-c-programming
*/
int main()
{
int val = 0;
std::cout << "Enter an ... | ALGO | 0.991864 | 3.29009 |
f3cacc15-2664-4634-852b-d56d42f406d1 | RohitKotha/geeksforgeeksprograms | Difficulty: Easy/Nearest multiple of 10/nearest-multiple-of-10.cpp | //{ Driver Code Starts
#include <iostream>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string roundToNearest(string str) {
int n = str.size();
// base case
if(str[n-1] == '0')
return str;
// 0 < last digit < 6
els... | ALGO | 0.999624 | 6.864508 |
025a8ddd-98cf-4dfa-abad-ac743a19d069 | PublicDomainRelease/GRIDGEN | src/grid/QuadTreeBuilder.cpp | /*! \file QuadTreeBuilder.cpp
\brief QuadTree Builder
\author <a href="masc.cs.gmu.edu/">MASC group</a>, George Mason University,
<a href="profile.usgs.gov/langevin/">Christian Langevin</a>, USGS
\bug No known bugs.
*/
// $Id: $
#include <locale>
#include <string>
#include "QuadTreeBuilder.h"
#include... | ALGO | 0.998997 | 5.289313 |
367d8c19-2faa-411b-a0d8-d5f7bc1a1752 | praveshtiwari150/foundation_dsa | 2.general/15-find-nth-fibonacci-number.cpp | #include <iostream>
using namespace std;
int fibonacci(int n)
{
int a = 0, b = 1, ans;
if (n <= 1)
{
return n;
}
for (int i = 2; i <= n; i++)
{
ans = a + b;
a = b;
b = ans;
}
return ans;
}
int main()
{
int n;
cout << "Enter the value of n: ";
... | ALGO | 0.999762 | 5.686388 |
f24a984e-a2d2-47e0-ba46-ee9d13931b6f | satishSingh0710/LeetCoding | 0931-minimum-falling-path-sum/0931-minimum-falling-path-sum.cpp | class Solution {
private:
int minAns = INT_MAX, n,m;
int solve(vector<vector<int>> &matrix, int row, int col, vector<vector<int>> &dp){
if (col<0 || col>=m||row>=n) return INT_MAX - 40000;
if(row == n-1 && col>=0 && col<m){
return matrix[row][col];
}
if (dp[r... | ALGO | 0.999997 | 6.12605 |
2022921d-68d8-43fe-bdf5-a7562dd98234 | skristiansson/llvm-or1k | lib/CodeGen/LiveIntervalAnalysis.cpp | #define DEBUG_TYPE "regalloc"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/Value.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include ... | ALGO | 0.996173 | 7.837977 |
0daf52a6-a7a6-4ecc-a5dc-161f422a9761 | withtahmid/cp | Code-Templates-master/Snippets/Graph Theory/Depth First Search [SA].cpp | const int N = 10001;
bool visited[N];
vector<int> adj[N];
void dfs(int u) {
visited[u] = true;
for (int v : adj[u]) {
if (!visited[v]) {
dfs(v);
}
}
} | ALGO | 0.999363 | 4.88233 |
7d638ab6-f788-490b-bd86-3e642a4ff25f | manavmeghpara/Distributed-Systems | A4/triangle_counting.cpp | #include <iostream>
#include <cstdio>
#include "core/utils.h"
#include "core/graph.h"
long countTriangles(uintV *array1, uintE len1, uintV *array2, uintE len2,
uintV u, uintV v) {
uintE i = 0, j = 0; // indexes for array1 and array2
long count = 0;
if (u == v)
return count;
while ((i... | ALGO | 0.999435 | 6.481043 |
73b9850b-5030-40ac-91fe-c731ba985dc5 | HanXiao68/base-skill | algorithm/algorithm/acwing_786 第k个数.cpp | ////
//// acwing_786 第k个数.cpp
//// algorithm
////
//// Created by 韩霄 on 2021/10/5.
////
////以前的写法是:快排完之后,输出a[k-1].
////本题考察的点是:在快排的分支递归范围中做手脚,降低排序中的计算复杂度。
//
//#include <iostream>
//#include <algorithm>
//using namespace std;
//
//const int N = 1e5+10;
//int a[N];
//int quickSortK(int a[],int l,int r,int k){
// i... | ALGO | 0.999997 | 4.420922 |
337f48e6-b218-44e2-b2bd-5b298460560a | X-Shots/Sprint-1 | GUI/calculatorFunctions.cpp | #include <iostream>
using namespace std;
#include <cmath>
//Methods for the FourFunction class
class FourFunction {
public:
double add(double a, double b) {
return a + b;
}
double subtract(double a, double b) {
return a - b;
}
double multiply(double a, double b) {
return a *... | TOOL | 0.933175 | 4.592054 |
e3db41f1-ee27-4793-9c3f-d1a1b7ae135f | TrainingByPackt/Advanced-CPlusPlus | Lesson8/Exercise14/Snippet15.cpp | #include <string>
#include <cctype>
#include <cstring>
int wordCount(const std::string &s)
{
// Create a lookup table for every pair of chars
bool table[65536];
for(int i = 0; i < 256; ++i)
{
for(int j = 0; j < 256; ++j)
{
int idx = j + i * 256;
table[idx] = !isspace(j) && isspace(i);
}... | ALGO | 0.98799 | 5.282854 |
810f8b95-ef0d-4707-854f-a65467576683 | OldTraveller/RandomCodingProblems | biggest_square.cpp | #include <bits/stdc++.h>
using namespace std ;
using ll = long long ;
/* NICE DP PROBLEM ! */
const int n = 5 ;
const int m = 6 ;
int min( int a , int b , int c ) {
return min( a , min( b , c ) ) ;
}
void solve( int M[][n] ) {
int answer[m+1][n+1] ;
int max_i = 0 ;
int max_j = 0 ;... | ALGO | 0.999779 | 3.173424 |
461d6664-da80-4175-aba4-bfe9236d2864 | mdhlimonmia/Codeforces_Problem_Solution | C_Unique_Number.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define Limon() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lli long long int
void solve(){
int n;cin>>n;
string s;
if(n>45)cout<<-1<<endl;
else if(n<10)cout<<n<<endl;
else{
for (int i = 9; n>i; i--)
{
... | ALGO | 0.999738 | 5.220515 |
4780da3a-b6a5-42af-8f4f-00040b07312c | trizdreaming/algoAdv | C1_2/C1_2/bfsPrint.cpp | #include <iostream>
#include <queue>
#define NOT_NUM INT_MAX
struct NODE
{
int data = NOT_NUM;
NODE *leftChild = nullptr;
NODE *rightChild = nullptr;
};
void InsertTree( int insertData, NODE* leafNode );
void PrintTreeByBFS( NODE* root );
int main( void )
{
NODE* rootNode = new NODE;
int nodeTheNum = 5;
for... | ALGO | 0.999716 | 4.822875 |
c3e895cd-b99f-4f41-9c6b-85f8b57137d3 | Anujram07/c-- | HOME WORK/2stack.cpp | #include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <iostream>
#define max 5
using namespace std;
typedef struct stack
{
int data[max];
int topA,topB;
} s;
s s1, *p;
void init()
{
p = &s1;
p->top = -1;
}
int full()
{
if (p->top == max - 1)
return 1;
else
return ... | ALGO | 0.999418 | 3.649493 |
03ab7623-6159-4920-9e84-bed1f10bf8f8 | Flare-k/Algorithm | 그래프/다리만들기2_그래프_17472.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
// 다리 연결하기 x 최소 스패닝 트리(MST)
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const int MAX = 101;
int r, c;
int island[MAX][MAX];
bool visit[MAX][MAX];
int vect[MAX];
struct Node {
i... | ALGO | 0.999699 | 4.35779 |
4d421375-8a81-4e7d-aa45-d888796600c2 | Edula1234/DSA0159-c- | 46.Multiply 2 matrices.cpp | #include <iostream>
using namespace std;
int main() {
int rows1, cols1, rows2, cols2;
cout << "Enter the number of rows and columns for the first matrix: ";
cin >> rows1 >> cols1;
cout << "Enter the number of rows and columns for the second matrix: ";
cin >> rows2 >> cols2;
if (cols1 != rows2) {... | ALGO | 0.999697 | 4.765137 |
bc288a21-c417-4aa7-878f-07fb7efbba0c | hamzahasbi/CP-stuffs | Codeforces/1864C.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef ONLINE_JUDGE
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pr... | ALGO | 0.999786 | 4.721493 |
b520ec42-ad77-4358-933e-366a99b3ef7b | Simmi141/Cpp_pac | reverse_using_function.cpp | #include <iostream>
using namespace std;
int main()
{
int number, rev = 0, remainder;
cout << "\nEnter a number : ";
cin >> number;
cout << "\nReversed Number : ";
while(number != 0)
{
remainder = number%10;
rev = rev*10 + remainder;
number /= 10;
}
cout << rev <<... | ALGO | 0.996217 | 3.852459 |
ec681ac7-0655-42a6-b666-71de87534abf | S2T-ANAND/TRADITIONAL-ALGO | dijkstra path retrieval.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
//dijkstra path retrieval
//input
vector<int>dis(n,INF),vis(n);
vector<int>parent(n,-1);
int source,dest;
cin>>source>>dest;
priority_queue<pair<int,int>>pq;
pq.push({0,source});
while(!pq.empty())
{
int u=pq.top()... | ALGO | 0.999983 | 4.546384 |
ba6c800e-8a2e-4f89-9203-cb54dc1b128f | tp6cjo4xu3/20171127_HW | HW5-1__P13/source/main.cpp | #include<stdio.h>
#include<stdlib.h>
void cubeByReference(int &nPtr);
int main(void)
{
int number = 5;
printf("The original value of number is %d", number);
cubeByReference(number);
printf("\nThe new valuue of number %d\n", number);
system("pause");
return 0;
}
void cubeByReference(int &nPtr)
{
nPtr = nPtr... | TOOL | 0.917391 | 4.194219 |
56048169-4d46-49d6-921e-1c00065a2a7e | aqzsha/ads | ICPC/KBTU_course/lab4/c.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <utility>
#define INF 2000000000
using namespace std;
void BuildTree(vector<pair<int, int>>& a) {
int n = (1 << ((int)(log2(a.size() - 1)) + 1));
a.resize(2 * n, make_pair(INF, 0));
for (int i = n; i < 2 * n; i++)
a[i] = a[i - n];
... | ALGO | 0.999798 | 4.260772 |
96e7bf2f-7c59-417e-b3a2-34f4c6e875db | Shimanto-125/XPSC_Shimanto | Week_3/Day-03/C_1_Powering_the_Hero_easy_version.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T;
cin >> T;
while(T--)
{
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n;i++)
{
... | ALGO | 0.999676 | 4.350294 |
1284eaab-80d9-4568-801e-e671eef788d0 | eggag32/Competitive-Programming | COCI/Kutije.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int... | ALGO | 0.999985 | 4.274513 |
c327ff6a-5f65-4460-99bb-719e98efa90b | KonohaChen/resistorBackEnd | opencv/sources/samples/cpp/lsd_lines.cpp | #include <iostream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
std::string in;
cv::CommandLineParser parser(argc, argv, "{@input|../data/building.jpg|input image}{help h||show help m... | TOOL | 0.973066 | 4.976737 |
07791d6b-7245-4f9c-82d3-ea640e6a1eb8 | vadym-kl/sqct | gatelibrary.cpp | #include "gatelibrary.h"
#include "output.h"
#include <sstream>
using namespace std;
gateLibrary::gateLibrary() :
name(GLw7 + 10), name_qc(GLw7 + 10),
matrix_str( GLw7 + 10), matrix( GLw7 + 10),
inverse(GLw7 + 10), cost( GLw7 + 10,0 )
{
name[Id] = "";
name[T] = "T";
name[P] = "P";
name[TP... | ALGO | 0.971098 | 3.084722 |
69b3982e-958d-434d-b050-87799914ebfb | black-devil-369/Competitve-Programing | C++/DSA/CLL.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
struct node
{
int item;
node *next;
};
class CLL
{
private:
node *last;
public:
CLL();
void insertAtStart(int);
void insertAtLast(int);
node* search(int);
void insertAfter(node*,int);
void ... | ALGO | 0.999764 | 3.994719 |
ac6b6d5e-e0d1-40fc-89b9-540cea3456a0 | khubaibilyas/CarND-Capstone | ros/src/waypoint_follower/src/pure_pursuit_core.cpp | #include "ros/ros.h"
#include "pure_pursuit_core.h"
namespace waypoint_follower
{
void PurePursuit::callbackFromCurrentPose(const geometry_msgs::PoseStampedConstPtr &msg)
{
current_pose_.header = msg->header;
current_pose_.pose = msg->pose;
pose_set_ = true;
}//processing frequency
void PurePursuit::callbackFr... | TOOL | 0.995341 | 4.596077 |
79e2bec8-19d7-4156-887f-68a0068508c7 | TheTharz/CMS--Project | 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 |
225887a5-4780-4531-aff0-0f2d5030d214 | llvm/llvm-project-staging | libc/src/math/generic/rint.cpp | #include "src/math/rint.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, rint, (double x)) {
return fputil::roundUsingCurrentRoundingMode(x);
}
} // namespace __llvm_libc
| TOOL | 0.995364 | 6.469497 |
9e91998d-fb9a-4e30-8d4f-f3913e3725f3 | ishandutta2007/codeforces | vercingetorix/normal/1579/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.99978 | 3.396905 |
78415d68-f37a-4060-a89c-2bcf95ff9da8 | tr1ten/DNA | codeforces/expert/1946/C.cpp | // Problem: C. Tree Cutting
// Contest: Codeforces - Codeforces Round 936 (Div. 2)
// URL: https://codeforces.com/contest/1946/problem/C
// Memory Limit: 512 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#include "ext/pb_ds... | ALGO | 0.999837 | 5.201508 |
243740fb-72bd-42be-8b13-2fa584ae73dd | ryan-shen/leet-code | problems/0235. Lowest Common Ancestor of a Binary Search Tree.cpp | #include "../shared/shared.h"
#include <iostream>
#include <math.h>
#include <queue>
#include <vector>
using namespace std;
/*
時間複雜度:O(logn)
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
while (root != nullptr) {
// 如果 p 跟 q 都小於根的話,根就往左移動
if ... | ALGO | 0.999982 | 5.612257 |
5c34d282-19a6-40be-ad59-178fccf7b031 | lularania20/flutter_application_1 | 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.998859 | 6.785645 |
435c4d50-0365-473f-998e-260dc2b58f5f | Tuana-saracoglu/tuanahw | hw3.cpp | #include <iostream>
#include <cassert>
#include <vector>
#include <array>
#include <algorithm>
template <typename myType>
int myArray (myType Array[], int size) {
std::sort(Array, Array + size);
for(int i=size-2;i>=0;i--) {
if(Array[i]!=Array[size-1]) {
std::cout<<"The second largest ... | ALGO | 0.999509 | 3.347594 |
b215c87b-5b46-42c8-acb8-026135f2c7d4 | ghyen/42 | cpp/cpp09/ex01/RPN.cpp | #include "RPN.hpp"
void p_error(std::string content)
{
std::cerr << content << std::endl;
std::exit(1);
}
int static stringToInt(std::string &str) {
std::istringstream iss(str);
int num;
iss >> num;
return num;
}
std::string static intToString(int num) {
std::stringstream ss;
ss << nu... | ALGO | 0.983786 | 4.339307 |
72dbf3c7-011b-4ed2-86e7-a336793c12ba | MaxBubblegum47/LLVM_13_MBLAZE | libc/src/math/generic/fmaxl.cpp | #include "src/math/fmaxl.h"
#include "src/__support/common.h"
#include "utils/FPUtil/BasicOperations.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(long double, fmaxl, (long double x, long double y)) {
return fputil::fmax(x, y);
}
} // namespace __llvm_libc
| TOOL | 0.941834 | 6.042629 |
12655bb9-9568-44c9-b7bf-c583f5944d3a | hm-harry/blackhouse-foundation | 20提高编程/STL-常用算法/P249常用查找算法count.cpp | #include<iostream>
#include<string>
using namespace std;
#include<vector>
#include<algorithm>
void test01(){
vector<int> v;
v.push_back(10);
v.push_back(50);
v.push_back(20);
v.push_back(20);
v.push_back(30);
int num = count(v.begin(), v.end(), 20);
cout << num << endl;
}
class Person... | ALGO | 0.994312 | 4.341923 |
a12c371d-cd22-4608-b432-61b55b50f923 | shanjw21/algorithm | bfs/acwing173.cpp | #include <iostream>
#include <string.h>
#include <queue>
using namespace std;
const int N = 1100;
int g[N][N];
int dist[N][N];
int dx[4] = {-1,0,1,0}, dy[4] = {0,1,0,-1};
int n,m;
/*
题目描述:[矩阵距离](https://www.acwing.com/problem/content/175/)
多源BFS问题
洪水从多个源点发出,每次扩展一步,先到那个点,那个点就确定了最短距离
dist[N][N]存到源点的距离,兼职... | ALGO | 0.999952 | 3.43583 |
55586bf5-f38c-4042-bd48-42f0a0ce261e | Laxman67/Data-Structure-and-Alogoritms-using-CPP | 3. Array,String,Pointer & Refernce/9-MaxEle.cpp | #include <iostream>
using namespace std;
int findMax(int arr[], int n)
{
int max = arr[0];
for (int i = 0; i < n; i++)
{
if (arr[i] > max)
max = arr[i];
}
return max;
}
int main()
{
int arr[]{
56, 78,709, 54, 100};
int n = sizeof(arr) / sizeof(arr[0])... | ALGO | 0.993499 | 3.896362 |
43ec6bc3-1f6d-43f0-99fd-964014963978 | tsonglew/leetcode-solution | di-yi-ge-zhi-chu-xian-yi-ci-de-zi-fu-lcof.cpp | class Solution {
public:
char firstUniqChar(string s) {
std::unordered_map<char, int> chars;
for (auto c : s) {
chars[c]++;
}
for (auto c : s) {
if (chars[c] == 1)
return c;
}
return ' ';
}
};
| ALGO | 0.999839 | 5.539314 |
a3e448c2-0b20-48b2-8fa6-ce5adf50739c | HeeNamgoong/algolab2-1 | matrix_supply.cpp | #include <iostream>
using namespace std;
int main() {
int testCases;
cin >> testCases;
for (int i = 0; i < testCases; i++) {
int r, s, t;
cin >> r >> s >> t;
int matrix1[r][s];
int matrix2[s][t];
for (int i = 0; i < r; i++) {
for (int j = 0; j < s; j++) {
cin >> matrix1[i][j];
}
}
for ... | ALGO | 0.999476 | 3.288072 |
06783cec-ff5b-4ef3-8c6c-bbb5768b54b6 | SkeletonK10/NODEVPS | BOJ/1816.cpp | #include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//////New Type Definition//////////////////////////////////
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::tuple<int, int, int> tiii;
typedef std::complex<double> cpx;
//////////////////////////////////... | ALGO | 0.997794 | 5.461236 |
5922c36f-f5a5-4dfc-96cc-d62404fb7b84 | IvanRenison/ProgrammingProblems | Codeforces rounds/Educational codeforces rounds/Educational Codeforces Round 141 (Rated for Div. 2)/C.cpp | // https://codeforces.com/contest/1783/problem/C
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
#define fore(i, a, b) for (ull i = a; i < b; i++)
pair<vector<ull>, ull> parse1(void) {
ull n, m;
cin >> n >> m;
vector<ull> as(n);
fore(i, 0, n) {
cin >> as[i];
}
return... | ALGO | 0.99987 | 5.828474 |
9688a690-a93b-47bb-a664-7bd0a54270c1 | loskyertt/cpp | 数据结构-王道练习/01线性表/链表-043-08-09/main.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
/* 打印链表 */
void print_linked_list(ListNode *node) {
cout << "head -> ";
while (node) {
cout << node->val << " -> ";... | ALGO | 0.999962 | 5.13667 |
4898289e-ad4c-4ab3-aad4-b963358df2a1 | tanishajn12/DSA_CPP_Apr2023 | Extra Questions/Minimizepath.cpp | #include<iostream>
using namespace std;
int main() {
int x=0 ; //to track the net movement along x axis
int y=0; //to track the net movement along y axis
char ch;
while (true) {
ch=cin.get() {
if (ch== '\n') {
break;
}
if (ch== 'E') {
... | ALGO | 0.999647 | 3.19627 |
cf0a7c15-6379-4734-94ef-63b5719447eb | sharc-lab/LightningSim | llvm-project/libc/src/math/generic/nextafterf.cpp | #include "src/math/nextafterf.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
return fputil::nextafter(x, y);
}
} // namespace __llvm_libc
| TOOL | 0.927859 | 4.82109 |
b08a0c9a-9ed2-4557-9dd3-ebc719b86654 | Feodor2/Mypal68 | xpcom/base/nsConsoleService.cpp | /*
* Maintains a circular buffer of recent messages, and notifies
* listeners when new messages are logged.
*/
/* Threadsafe. */
#include "nsMemory.h"
#include "nsCOMArray.h"
#include "nsThreadUtils.h"
#include "nsConsoleService.h"
#include "nsConsoleMessage.h"
#include "nsIClassInfoImpl.h"
#include "nsIConsoleLi... | TOOL | 0.916946 | 5.922261 |
e817c838-5ca1-4139-8058-ad4743cf0691 | esl000/CustomUE4VolumeRaymarching | Engine/Source/Runtime/AudioMixer/Private/DSP/InterpolatedOnePole.cpp | #include "DSP/InterpolatedOnePole.h"
namespace Audio
{
// INTERPOLATED ONE-POLE LOW-PASS IMPLEMENTATION
FInterpolatedLPF::FInterpolatedLPF()
{
Z1.Init(0.0f, NumChannels);
Reset();
}
void FInterpolatedLPF::Init(float InSampleRate, int32 InNumChannels)
{
SampleRate = InSampleRate;
NumChannels = InNumChan... | ALGO | 0.92041 | 5.39515 |
2f11aade-b6a2-4029-bf26-166f1a9e24e4 | Vishnu-Adi/RFID_Project | src/main.cpp | #include <iostream>
#include <vector>
#include "algorithms/genetic_algorithm.h"
#include "algorithms/particle_swarm.h"
#include "config/config.h"
#include "utils/utils.h"
#include "tests/test_runner.h"
using namespace std;
void displaySolution(const Solution& solution, int gridSize) {
cout << "Tag Positions (1 in... | ALGO | 0.99869 | 6.614378 |
021c3c91-7209-4b3c-9355-d787ab0764e9 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8465_2.cpp | #include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const long long mod = 1000000007 * 1LL * 1000000007;
const int N = 1e6 + 3, M = N;
vector<int> g[N];
int a[N];
long long h[N], val[N];
vector<pair<int, int> > E;
long long r() { return rand() * 3200... | ALGO | 0.999857 | 3.86747 |
5a437941-123a-4990-9131-06d05d7e5320 | uvatarkind/Mobile_learning_path | firebase_auth/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.998483 | 6.76775 |
6c044b67-f3ee-4959-9c06-d8877c14a1be | jeong011010/solved.ac | BAEKJOON/1644/1644.cpp | #include<iostream>
#include<vector>
using namespace std;
int N, ans=0;
bool PrimeArray[4000001];
vector <int>Prime;
void Eratos(int n)
{
if (n <= 1) return;
for (int i = 2; i <= n; i++)
PrimeArray[i] = true;
for (long long i = 2; i <= n; i++)
{
if (PrimeArray[i]) {
Prime.push_back(i);
for (long long j ... | ALGO | 0.999943 | 4.238662 |
28a322b8-d4f3-4642-bac9-d672a7aecf66 | calewis/SmallProjectsAndDev | project_euler/cpp/template.cpp | /*
* Project Euler problem template
*/
#include <chrono>
#include <iostream>
int problem_N(int input) { return input; }
int main(int argc, char *argv[]) {
using namespace std::chrono;
auto t1 = steady_clock::now();
auto ans = problem_N(1);
auto t2 = steady_clock::now();
auto time_span = durat... | ALGO | 0.999161 | 5.798625 |
ee29720d-bc97-4188-9324-b5e616c4f663 | Enigmatisms/Armor-Targeting | Armor-Targeting/src/armor/src/record.cpp | /**ArmorDetect 装甲板检测节点(debug)
* 装甲板检测的传统实现
* 作者:hqy
* 最后修改日期:2020.1.14. 19:40
* 问题:
* 1.#ifdef #endif等等杂糅,并且灯条匹配没有最后确定函数
* 2.灯条匹配函数(估计最后使用ArmorPlate.hpp)
* 3.没有高性能接口取流
* 目前已经有非传统灯条匹配方法,但个人认为,如果只是用灯条查找而不使用distant detect的方法
* 意义并不大
*
*/
#include <CameraCtl.hpp>
#include <ros/ros.h>
//#define REMOTE //远程静止单装甲板调试参数
... | TOOL | 0.887505 | 3.532086 |
b9a0d344-7463-46e5-b78d-7d4122cb4540 | sarvex/leetcode-small-basic | lcof/面试题24. 反转链表/Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* dummy = new ListNode(0);
ListNode* curr = head;
while (cur... | ALGO | 0.999666 | 5.666224 |
d4d5add6-43b2-4d75-9130-9249518136ca | raincross7/code-similarity | codes/train_code/problem378/problem378_411.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
long long a = -1000000, b = 1000000, c = 0, tmp = 0, tmp2 = 0;
cin >> tmp2;
for (int i = 0; i < tmp2; i++){
cin>>tmp;
c += tmp;
a = max(a, tmp);
b = min(b, tmp);
}
cout << b << ... | ALGO | 0.999819 | 3.147525 |
5941c630-7802-43b7-beeb-e074d8a309cc | janginkyung/algorithms | STL/STL/vector1.cpp | #include<iostream>
#include<vector>
using namespace std;
// ˾ƺ ؼ Ѵ
// : 迭 ũⰡ ̱ ȿ
int main() {
vector<int> first;
first.push_back(12);//ʿ ִ´
first.push_back(5);
first.push_back(20);
for (int i = 0; i < first.size(); i++) {
cout << first.at(i) << ' ';
}//at:Ưĭ ȯ Ǵ first.at[i]
cout << endl;
first.pop... | TOOL | 0.880838 | 3.443876 |
fcdb9b1b-702e-49fa-a92e-a5168d13d14d | yashgaherwar/Binary_Search_Tree_Codes | 98_Validate_Binary_Search_Tree.cpp | /*
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right su... | ALGO | 0.999977 | 6.900141 |
25782de7-8a5b-4ca7-a3bf-0dd53b3efef1 | aymansainshy/ai_text_recognition_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.9988 | 6.76073 |
1a925fff-4e09-4816-9ec8-33ffae2da2c1 | idkmynamereally/LeetCodeSolutions | 213-house-robber-ii/house-robber-ii.cpp | class Solution
{
public:
int rob(vector<int>& nums)
{
if (nums.size() <= 3)
{
int max = 0;
for (int i : nums)
max = max > i ? max : i;
return max;
}
vector<int> nums1(nums.begin(), --nums.end());
vector<int> nums2(++nums... | ALGO | 0.999872 | 5.234617 |
532ec926-00e5-4a3a-a054-01cbef5fcfa8 | Sankhya0/logicDetector | backend/CDataset/isPalindrome/isPalindrome_7.cpp | class Solution {
public:
bool isPalindrome(int x) {
long rev=0;
int temp=x;
if(x>=0){
while(x!=0){
int rem = abs(x%10);
rev=(rev*10)+rem;
x/=10;
}
if(temp == rev)
return true;
else
... | ALGO | 0.999909 | 5.696414 |
d5b73727-61d9-4811-93e2-b645ac8439ad | 0-jij-0/CompetitiveProgramming | Official ACM-ICPC Contests/ACPC 21 KickOff (D Unsolved)/Zero Equals Infinity.cpp | #include <iostream>
#include <cmath>
using namespace std;
typedef double ld;
const ld PI = 3.14159265358979323846264;
int main() {
freopen("polygon.in", "r", stdin);
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t; while (t--) {
int p; ld x; cin >> p >> x;
if ((p + 0.0) / (4 * PI) < x) { cou... | ALGO | 0.999311 | 3.734644 |
91ef9a8b-3f2f-499a-ab1b-78555689db61 | mahmud841/cpp_for_dsa_practice_module_01 | min_max_swap.cpp | #include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
// void my_swap(int *a, int *b)
// {
// int tmp = *a;
// *a = *b;
// *b = tmp;
// }
int main()
{
int a, b;
cin >> a >> b;
swap(a, b);
cout << a << " " << b << endl;
// int a, b, c, d;
// cin >> a >> b >... | ALGO | 0.999769 | 4.104314 |
727ea94a-5ef2-4d50-814b-51b77e4c6046 | CuveliaLincle/atcoder | ABC/354/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
int n;
cin >> n;
ll C_sum = 0;
string S[n];
rep(i, n)
{
string name = "";
ll rate = 0;
cin >> name >> rate;
... | ALGO | 0.999916 | 4.042256 |
30a311b1-4c4d-440a-943c-f25ce3e9e502 | aamahi/leetcode-cpp-practices | container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int min_height = height[0];
int max_height = height[height.size()-1];
int min_idx = 0;
int max_idx = height.size()-1;
if(max_height<min_height){
min_height = max_height;
min_idx = max_idx;
... | ALGO | 0.999959 | 6.528763 |
1e8d2aa2-d30e-4525-9169-79f3fee36a63 | neet-007/neet-007-Data-Structures-And-Algorithns-speicilaiazation | data structures assigments/week1_basic_data_structures/3_network_simulation/process_packages.cpp | #include <iostream>
#include <queue>
#include <vector>
struct Request {
Request(int arrival_time, int process_time):
arrival_time(arrival_time),
process_time(process_time)
{}
int arrival_time;
int process_time;
};
struct Response {
Response(bool dropped, int start_time):
d... | ALGO | 0.999811 | 4.898972 |
d9892e74-691c-40ef-a4a8-8e733e2db384 | Sergey-bit/SFU_KI22 | ОП/Z3/TASK9/9_19.cpp | #include <iostream>
float min_or_max(float a, float b, float c)
{
return (a > 0.5) ? std::max(b, c) : std::min(b, c);
}
int main()
{
float a, b, c;
std::cout << "Enter a, b, c >> ";
std::cin >> a >> b >> c;
std::cout << "Answer: " << min_or_max(a, b, c) << std::endl;
return 0;
} | ALGO | 0.999321 | 4.685546 |
eefd9ace-3512-4623-a3dd-31c89573bb0a | dalaixlmao/Leetcode-submissions | 166-fraction-to-recurring-decimal/fraction-to-recurring-decimal.cpp | #define ll long long
class Solution {
public:
string getReccur(string ans, int l, int r) {
cout << ans << endl;
return ans.substr(l, r - l + 1);
}
string fractionToDecimal(int numerator, int denominator) {
if(numerator==0)
{
return "0";
}
// num /... | ALGO | 0.999975 | 5.606352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.