uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
78ea3034-7121-4f48-8ba0-fc166c6ad6f4 | harsha270820/c-DSA0140 | matrixadd.cpp | #include<iostream>
using namespace std;
int main ()
{
int m, n, p, q, i, j, A[10][10], B[10][10], C[10][10];
cout << "Enter no of rows and column of matrix A : ";
cin >> m >> n;
cout << "Enter no of rows and column of matrix B : ";
cin >> p >> q;
if ((m != p) && (n != q))
{
cout <<... | ALGO | 0.993195 | 3.828806 |
107a8b75-dbbd-4853-b144-4d17339f94a4 | sarvex/leetcode-d | solution/1000-1099/1034.Coloring A Border/Solution.cpp | class Solution {
public:
vector<vector<int>> colorBorder(vector<vector<int>>& grid, int row, int col, int color) {
int m = grid.size();
int n = grid[0].size();
bool vis[m][n];
memset(vis, false, sizeof(vis));
int dirs[5] = {-1, 0, 1, 0, -1};
function<void(int, int, in... | ALGO | 0.999806 | 6.296524 |
a20f59bd-233a-43eb-a634-fff1aaf944aa | David-5-5/tutorial | cplus/leetcode/202502/algo2787.cpp | #include <bits/stdc++.h>
using namespace std;
// 动态规划 - 0-1 背包
class Solution {
public:
int numberOfWays(int n, int x) {
// 自行解答 标准 0-1 背包
int mod = 1e9+7;
vector<int> dp(n+1);
dp[0] = 1;
for (int i=1; i<=300; i++) {
int y = int(pow(i, x));
if (y>n) ... | ALGO | 0.999987 | 4.957642 |
4caf1ad5-fae0-4e8e-9bbe-5018b039b49a | KunalBansal12/KUNALBANSAL12 | 72-edit-distance/edit-distance.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int n=word1.size(),m=word2.size();
if(n==0) return m;
else if(m==0) return n;
vector<int> fir(m+1,0);
vector<int> sec(m+1,0);
for(int i=0;i<m+1;i++){
sec[i]=m-i;
}
fir[m... | ALGO | 0.999999 | 6.255059 |
828b10d4-8066-4ad4-b941-1973f51d1c64 | cbedoy/CompetitiveProgramming | Code/Optimization/hungarian_method.cpp | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
const int INF = 0x3f3f3f3f;
#define N 50
using namespace std;
class Hungarian {
private:
int n;
int max_match;
int cost[N*N];
int c... | ALGO | 0.999919 | 4.160941 |
203bde9d-3e08-47a7-bf37-a1d802d14dba | OanaGaskey/Model-Predictive-Control | src/Eigen-3.3/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998476 | 4.659281 |
c022f5c3-40e4-43de-a63d-3d717ec894b6 | emfomy/leetcode | problems/2106-cpp/main.cpp | // Source: https://leetcode.com/problems/maximum-fruits-harvested-after-at-most-k-steps
// Title: Maximum Fruits Harvested After at Most K Steps
// Difficulty: Hard
// Author: Mu Yang <http://muyang.pro>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.999926 | 6.348984 |
377fdab2-7899-4439-9f35-d8e010240206 | SSUHYUNKIM/Algorithm | implementation/solution/Bronze/Bronze2/25501.cpp | #include <iostream>
#include <cstring>
using namespace std;
int T, cnt;
char str[1001];
int recursion(const char *s, int l, int r)
{
cnt++;
if(l >= r)
return 1;
else if(s[l] != s[r])
return 0;
else
return recursion(s, l+1, r-1);
}
int isPalindrome(const char *s)
{
retu... | ALGO | 0.999933 | 4.760346 |
3fecfd69-7024-4ca2-bc0b-53c7ca883d34 | adilzhapar/codemode_FALL_2021 | 29.11/d.cpp | #include <iostream>
#include <map>
#include <vector>
#include <iterator>
using namespace std;
int Average(vector<int> v){
return (v[0] + v[1] + v[2]) / 3;
// int sum = 0;
// for(int i=0; i<v.size(); i++){
// sum += v[i];
// }
// return sum / v.size();
}
void Darker(vector<int> &v, int avg... | ALGO | 0.965064 | 4.423541 |
8d7a502c-3ae1-4288-8d35-4dd0f40ac285 | milankatira/Dsa | for_loop_question/fib.cpp | #include <iostream>
using namespace std;
int main()
{
cout<<"enter the number-"<<endl;
int n ;
cin>>n;
int a = 0;
int b = 1;
cout << a << " " << b << " ";
for (int i = 1; i <= n; i++)
{
int c = a + b;
cout << c << " ";
a = b;
b = c;
}
} | ALGO | 0.999754 | 3.355136 |
6fb4cf4f-7b65-4dca-8783-76e2def7d61a | ria28/Data-Structures-And-Algorithms | codeforces/dominant_piranha.cpp | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
void solve()
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ok = 1;
for (int i = 1; i < n; i++)
{
if (a[i] != a[0])
{
ok = 0;
break;
}
... | ALGO | 0.999639 | 4.075598 |
d99ea840-cb07-4c04-a93c-71cef3c17bce | thucdx/algorithm-solution | VOJ/old/NKLETTER/src/NKLETTER.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {
string a,b;
int la,lb,maxL=0;
cin>>a>>b;
la=a.length();
lb=b.length();
int i,j,k;
for(i=la-1;i>=0;--i){
if(la-i>lb) break;
j=0;k=i;
while(a[k]==b[j] &&(k<la)){
++k;++j;
}
if(k==la) maxL=la-i;
}
printf("%... | ALGO | 0.999772 | 3.188081 |
55ffd590-1b96-40cf-8dc1-4dbdbbe47587 | sangram2002/Numerical-Methods-codes | Assignment_03/qn2(ii).cpp | #include <bits/stdc++.h>
using namespace std;
void For_pivotting_and_Gaussian_elimination(long double *Augmented_Matrix, int n)
{
int i, j, k;
long double f,temp;
for (i = 0; i < n; i++)
{
for (j = i + 1; j < n; j++)
{
if (abs(*(Augmented_Matrix + i * (n + 1) + i)) < abs(*(A... | ALGO | 0.999596 | 3.864938 |
dfa76935-30e1-4830-95ba-72c2f95671f7 | VictorSuret1/-EDD-Proyecto_202001767 | Fase2/arbolb.cpp | #include "arbolb.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <QProcess>
ArbolB::ArbolB() : raiz(nullptr) {}
ArbolB::~ArbolB() {
limpiar(raiz);
}
void ArbolB::insertarComentario(const QString& usuario, const QString& texto, const QDateTime& fechaHora) {
Comentario nuevoComentario(usua... | ALGO | 0.978577 | 5.665055 |
f282837e-d30f-4145-b5bc-cb365c248097 | etremel/crypto-accumulators | lib/utils/SHA256.cpp | /*
* Duy Nguyen - <EMAIL>
* May 18, 2011
*/
#include <utils/SHA256.hpp>
#include <cryptopp/sha.h>
namespace SHA256 {
void computeDigest(const char* input, int length, std::vector<unsigned char>& output) {
output.assign(CryptoPP::SHA256::DIGESTSIZE, 0);
CryptoPP::SHA256().CalculateDigest(output.data()... | ALGO | 0.934946 | 6.604036 |
8a38e83c-38a5-440e-ae52-7884a5af7b99 | fwdzh/cp_code | Codeforces/2089/C1.cpp | // Date: 2025-04-02
// Time: 11:09:33
#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9+7;
void ChatGptDeepSeek()
{
int n,l,k;
cin>>n>>l>>k;
/*
*/
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
cin >> T;
while (... | ALGO | 0.999815 | 4.950723 |
ee6c6e74-fa3c-4c84-95e2-7b24dbf07a8f | MohammadAasim/Data-Structures-and-Algorithms | Recursion/AllIndexOfX.cpp | #include <iostream>
using namespace std;
void findIndexes(int arr[], int x, int n, int index, int result[], int &count) {
if (index == n) {
return;
}
if (arr[index] == x) {
result[count] = index;
count++;
}
findIndexes(arr, x, n, index+1, result, count);
}
int main() {
i... | ALGO | 0.999946 | 5.364461 |
3b5df679-4686-463a-a4e2-91f20725749e | fazla23/UVA-Cpp-programs | 11687 - Digits.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long x,i,j,k,t,r,a;
string s;
while(cin>>s)
{
x=s.length();
if(s=="END")
break;
else if(x==1)
{
if(s[0]-48==1)
cout<<"1"<<endl;
else
cout<<"2... | ALGO | 0.999446 | 3.09756 |
2c2b9475-e4fb-4b3e-b7d9-c05f77836383 | VijayNegi/LeetHub | 0129-sum-root-to-leaf-numbers/0129-sum-root-to-leaf-numbers.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999964 | 6.701395 |
4ec682b3-6b34-4fa6-b7e8-83dd52e9f64e | ashokabairwaideology/Leet-code-problem | solution/2100-2199/2176.Count Equal and Divisible Pairs in an Array/Solution.cpp | class Solution {
public:
int countPairs(vector<int>& nums, int k) {
int n = nums.size();
int ans = 0;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
if (nums[i] == nums[j] && (i * j) % k == 0) ++ans;
}
}
return ans;
... | ALGO | 0.999884 | 5.901373 |
0a431013-fe51-4c4c-bcb8-080cddf14ae4 | mySoftSnail/MyCodingTestStudy | 백준/2003_수들의 합 2.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
int a[10003];
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
for (int i = 0; i < n; ++i) cin >> a[i];
int en = 0;
int tot = a[0];
int ans = 0;
for (int st = 0; st < n; ++st) {
while (en < n && tot < m) {
en++;
if (en != n) tot += a[... | ALGO | 0.999974 | 4.121869 |
18510476-1f9d-43d7-a86d-b3f8d3071ac4 | mortie/llvm | clang-tools-extra/test/clang-tidy/checkers/performance-inefficient-algorithm.cpp | // RUN: %check_clang_tidy -std=c++11,c++14 %s performance-inefficient-algorithm %t
// FIXME: Fix the checker to work in C++17 mode.
namespace std {
template <typename T> struct less {
bool operator()(const T &lhs, const T &rhs) { return lhs < rhs; }
};
template <typename T> struct greater {
bool operator()(const ... | TEST | 0.901739 | 5.359843 |
b5779690-82a8-495c-9bcb-de6705c2f9e2 | EmilyRadKey/Neural-Network | opencv/sources/3rdparty/openexr/IlmImf/ImfRgbaYca.cpp | //-----------------------------------------------------------------------------
//
// Conversion between RGBA and YCA data.
//
//-----------------------------------------------------------------------------
#include <ImfRgbaYca.h>
#include <assert.h>
#include <algorithm>
using namespace IMATH_NAMESPACE;
using namespa... | ALGO | 0.983012 | 7.339673 |
b8d9cb14-841a-4972-9dad-38ea669c1249 | AyushAntil007/LeetCode_Problems | 4-median-of-two-sorted-arrays/median-of-two-sorted-arrays.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int n=nums1.size();
int m=nums2.size();
vector<int>ans;
for(int i=0;i<n;i++){
ans.push_back(nums1[i]);
}
for(int i=0;i<m;i++){
ans.push_back(nums... | ALGO | 0.999976 | 6.284666 |
0635b902-64e7-4ee3-bcfe-1e69d7c387d5 | jh4nks/BOJ_Programmers_algorithm | BOJ/test.cpp | #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <stack>
#include <math.h>
#include <iostream>
#include <string>
using namespace std;
string Solve() {
string text;
stack <int> stk, temp;
cin >> text;
for (int i = 0; i < text.size(); i++) {
if (text[i] == '<') {
if (stk.empty()) continue;... | ALGO | 0.999928 | 4.331816 |
78c9694d-afb8-4343-8ae5-42edddb112c5 | shashwata2003/DSA | 1.DSA Course/125IMPlongestAPDP/a.cpp | #include<iostream>
#include <bits/stdc++.h>
#include <array>
using namespace std;
/*
Longest Arithmetic Subsequence:
Given an array arr[] of sorted positive integers. For an array having no duplicate elements,
find the length of the longest arithmetic progression in a given array arr[].
Note: A sequence seq is an ar... | ALGO | 0.999691 | 4.690971 |
33009541-8785-4996-9759-82d828e7c50b | FDU-VTS/LOL | src/fast_gicp/thirdparty/Eigen/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.985465 | 6.154785 |
b496aa8c-e497-4f26-9bd5-eac3e98955ce | abinaya2105-git/abinayaDSA | curious coders/week1/problemset2/problem 7.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string firstn,lastn,fullname;
int n;
cin>>firstn>>lastn>>n;
for(int i=1;i<=n;i++)
{
fullname= firstn+lastn;
cout<<fullname<<endl;
}
return 0;
} | ALGO | 0.985008 | 3.192884 |
ff6ae886-ef8f-4c2d-8ffe-0d3c2865ddce | harshaithireddy/GeeksForGeeks-Codes | Difficulty: Hard/Longest valid Parentheses/longest-valid-parentheses.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int maxLength(string& s) {
// code here
stack<int> st;
st.push(-1);
int res = 0;
int i = 0;
for(auto it : s) {... | ALGO | 0.9957 | 5.824117 |
c3d216cd-8e1e-42ea-b07a-c1662f7b5419 | danielpoochai/Algorithm | program_3/src/router.cpp | #include <queue>
#include "parser.h"
#include <iostream>
#include <vector>
#include <functional>
#include <utility>
#include <algorithm>
#include <climits>
#include <math.h>
#include <fstream>
using namespace std;
class node;
class comparison;
double** Initial_H_Weight_matrix(int H, int V, int capacity);
double** Ini... | ALGO | 0.999889 | 4.058119 |
0a7addd3-0fb5-48fe-833a-16392843119e | YeKYLI/leetcode | 待整理/leetcode-0.2.0/solution/0400-0499/0472.Concatenated Words/Solution.cpp | class Trie {
public:
vector<Trie*> children;
bool isEnd;
Trie()
: children(26)
, isEnd(false) {}
void insert(string w) {
Trie* node = this;
for (char c : w) {
c -= 'a';
if (!node->children[c]) node->children[c] = new Trie();
node = nod... | ALGO | 0.999909 | 6.203384 |
63c5a2bf-07c6-48c5-ac7f-74854df5c415 | blackout-yash/Codeforces | Challenge/900/37_B_Cover_Points.cpp | // B. Cover Points
// Link - https://codeforces.com/problemset/problem/1047/B
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fora(i,a,b) for(int i=a;i<b;i++)
#define rfora(i,a,b) for(int i=b-1;i>=a;i--)
#define nline << "\n"
const int mod = 1e9 + 7... | ALGO | 0.995022 | 4.887818 |
6d6cfbe4-0427-413a-a100-1a835b171c0b | khushboo-goel/competitive-coding | LinkedList/reverseKList.cpp | // https://leetcode.com/problems/reverse-nodes-in-k-group/description/
ListNode* reverseList(ListNode* head) {
ListNode* rev = head;
ListNode* curr = head;
if (head == NULL || head -> next == NULL) {
return head;
}
rev = reverseList(head -> next);
curr -> next -> next = curr;
curr... | ALGO | 0.99995 | 5.635375 |
e17a4aa4-5bcc-4200-9c21-891b62de0e37 | yosephyusanto/LnT-sesi-11-12 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
c252aeee-620c-4729-b112-4a616733d8e6 | bucketzxm/Acm-icpc | lightoj/Graph/Euler Trail_Circle/1086.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
#define INF 111111111
int fy[40][40],du[40];
int sum,dp[1<<20];
int n,m;
void init()
{
for(int i=0;i<n;i++){
du[i] = 0;
for(int j=0;j<n;j++){
if( i == j) fy[i][j] = 0;
else
fy[... | ALGO | 0.999983 | 4.190083 |
6313055c-f815-4034-9c85-49669a8879b0 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6834_36.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
int n, m;
if (k % 2 == 0) {
int a = k / 2;
if (a > 19) {
cout << "-1" << endl;
exit(0);
}
for (int i = 0; i < a; i++) cout << "8";
} else {
int a = (k - 1) / 2;
if (a > 19) {
cout << "-1" << e... | ALGO | 0.999501 | 4.451458 |
a9d1148f-0a16-45dd-84be-d6b39ebe108c | wztzjhn/Kondo | src/extra/test_BdG.cpp | #include "fastkpm.h"
#include "iostream_util.h"
#include <cassert>
using fkpm::Vec;
typedef double flt;
typedef std::complex<flt> cx_flt;
template <typename T>
double exact_energy(arma::Mat<T> const& H, double kT, double mu) {
return fkpm::electronic_grand_energy(arma::real(arma::eig_gen(H)), kT, mu);
}
int main... | ALGO | 0.998681 | 4.683519 |
e0ae102a-98f3-4648-8f06-1d45d0b98faf | luke333z/pbinfo.ro | #1943_Bacterie.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <climits>
std::string filename = "bacterie";
std::ifstream in(filename + ".in");
std::ofstream out(filename + ".out");
int main ()
{
unsigned long long n,m;
in>>n>>m;
if(n>m)
std::swap(n,m);
out<<(n*m)-(n*(n+1)/2... | ALGO | 0.999748 | 3.174316 |
160a89cd-fa6c-452e-aa74-50002bb8f590 | NhatAnhNguyen2906/DSA_Homework-UET | Tree.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
struct Node
{
int data;
vector<Node*> children;
};
Node *newNode(int data)
{
Node *tmp = new Node;
tmp->data = data;
return tmp;
}
bool binaryTree_check(unordered_map<int, Node*> tree)
{
for(auto node : tree)
... | ALGO | 0.99999 | 5.5982 |
f102b65e-c14d-47aa-bc30-e270d939bcab | Shubhams-2002/SdeSheet | DP_MCM_Partition/DP52_Evaluate-Boolean-Expression-to-True.cpp | #include <bits/stdc++.h>
using namespace std;
//question might ask to do '%(1e9+7)'
int dp[101][101][2];
int parenthesis_count(string s,int i,int j,int isTrue)
{
// Base Condition
if (i > j)
return false;
if (i == j) {
if (isTrue == 1)
return s[i] == 'T';
else
return s[i] == 'F';
}
if (dp[i][j][isTrue... | ALGO | 0.999988 | 4.815913 |
44b09bc5-49ad-4ad1-bbb7-dffbb1d6d255 | qweasfjbv/codetree-TILs | 240721/9-1 정사각형/9-1-square.cpp | #include <iostream>
using namespace std;
int main() {
int n; cin>> n;
int cnt = 9;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cout << cnt--;
if(cnt==0) cnt = 9;
}
cout <<'\n';
}
return 0;
} | ALGO | 0.999894 | 3.722733 |
5bc006e3-e11f-4fc9-95d3-8609be03d3ac | Rakibul-CoU/HackerRank-Solution | Restaurant.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin >> T;
int max=1000000;
for(int t=0 ; t<T ; t++)
{
int l,b,n,temp;
cin >> l >> b;
for(int i=1 ; i<=l ; i++)
{
if(l%i==0 && b%i==0)
{
n=(l*b)/(i*i);
... | ALGO | 0.999884 | 4.489774 |
c8b70a29-0621-4ffd-b315-8f5978c5ac8b | PRANAVJARANDE/Leetcode-Solutions | medium/Lexicographically Smallest Equivalent String.cpp | class Solution {
public:
string smallestEquivalentString(string s1, string s2, string b)
{
int n=s1.size();
vector<int>par(26,0);
for(int i=0;i<26;i++)par[i]=i;
for(char c='a';c<='z';c++)
{
for(int i=0;i<n;i++)
{
par[s1[i]-'a']=mi... | ALGO | 0.999982 | 5.500103 |
ff73458e-ab17-4f96-a973-fa9f7da4eeb0 | maximGanin/rpo | cpp/2 semestr/labs/4/2_hw.cpp | #include<iostream>
#include<vector>
#include<chrono>
std::vector<int> gen_random_vector(int n)
{
std::vector<int> result(n);
for (int i = 0; i < n; i++)
{
result[i] = rand() % 100;
}
return result;
}
void bubble_sort(std::vector<int> &arr)
{
for (int i = 0; i < arr.size(); i++)
{... | ALGO | 0.998337 | 5.448141 |
f4544e09-c96a-4082-9bdc-f52e9d3d55b8 | aayush2761/Leetcode_prob | 0701-insert-into-a-binary-search-tree/0701-insert-into-a-binary-search-tree-06-18-2025-20-48-52.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.999971 | 6.319277 |
d5d5df40-4c88-4b40-9b52-b30f8efb8ec2 | alexandraback/datacollection | solutions_5636311922769920_1/C++/georgevidalakis/Source.cpp | #include <fstream>
using namespace std;
unsigned long long int pow(unsigned int b, unsigned int e)
{
unsigned long long int r = 1;
for (unsigned int i = 0; i < e; i++) r *= b;
return(r);
}
int main()
{
unsigned int T, K, C, S, ns;
unsigned long long int p;
ifstream fin("fractiles.in");
fin >> T;
ofstream fout... | ALGO | 0.998737 | 3.336572 |
fe0c1331-0f67-4f07-8b3a-6d58e9fb5cf2 | mprateek14/LeetCode-Solutions | 106-construct-binary-tree-from-inorder-and-postorder-traversal/106-construct-binary-tree-from-inorder-and-postorder-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.999982 | 6.140583 |
5955df7e-707f-4649-9a1f-6ce43fe8a839 | DAWOODSKYM/C-files | week6.cpp | #include <iostream>
using namespace std;
int main()
{
int Arraynumbers[20]; int i;
cout<<"Enter the values:";
//To enter array elements and test for range
for(i=0; i<20; i++){
cin>>Arraynumbers[i];
if(Arraynumbers[i]>=1 && Arraynumbers[i]<=100){
cout<<"Enter new number:";
}else{
cout<<"Enter no in rang... | ALGO | 0.930421 | 3.185797 |
f6e816d3-36bc-4ccf-814f-d8c8481248c4 | YogenderTanwar/Sublime-codes- | Rabin-Karp Algorithm.cpp | #include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define ll long long
#define jaldi_chal ios_base::sync_with_stdio(0); cin.tie(0);
#define tr(c,i) for(auto i=(c).begin(); i != (c).end(); i++)
#define REP(i,k) for( ll i=0;i<k;i++)
#define REW(i,a,b) for(ll i=a;i<=b;i++)
#define M 1000000007
#define F fi... | ALGO | 0.999959 | 4.140756 |
5fc335e6-b198-4570-aff9-f227218b3085 | jgdrneto/API_Processos | src/API_Processos.cpp | std::vector<std::string> API_Processos::obterStringsDoComando(std::string comando){
std::stringstream ss;
ss << comando << " > " << arquivoTemp;
//Executando comando
system(ss.str().c_str());
//Vetor que terá as linhas do comando
std::vector<std::string> linhas;
std::string linha... | TOOL | 0.931537 | 3.754713 |
dc449325-6a5c-4434-aca5-41523b232036 | AokiReiko/ImageAnalogies | main.cpp | #include <iostream>
#include <vector>
#include <map>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.hpp>
#include "opencv2/core/core.hpp"
#include <flann/flann.hpp>
#include <flann/io/hdf5.h>
#include <fstream>
#include <stdio.h>
#include "ann_match.hpp"
#include "coherence... | ALGO | 0.962391 | 4.657176 |
a5b99220-6d51-442a-913f-4baa4125fa78 | Bungmint/competitiveprogramming | contest/codeforces/1703/C.cpp | using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename T>
using pqg = priority_... | ALGO | 0.999217 | 6.00467 |
71cc1c44-92c1-45de-9368-d017bac0f903 | jlezama/OrthogonalLowrankEmbedding | caffe_OLE/tools/compute_image_mean.cpp | #include <stdint.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "boost/scoped_ptr.hpp"
#include "gflags/gflags.h"
#include "glog/logging.h"
#include "caffe/proto/caffe.pb.h"
#include "caffe/util/db.hpp"
#include "caffe/util/io.hpp"
using namespace caffe; // NOLINT(build/name... | DATA | 0.895671 | 6.438655 |
bbff68bc-6aae-4a61-990d-63b09f85418a | Shrutikatyal/Interview-Preparation | Graphs/L417. Pacific Atlantic Water Flow.cpp | /*
* Author : Shruti Katyal
* Date : 13 June, 2020
*
* Compiler : g++ 5.1.0
* Flags : -std=c++14
*
*/
class Solution {
int m,n;
public:
vector<vector<int>> pacificAtlantic(vector<vector<int>>& matrix) {
if (matrix.empty()) {
return vector<vector<int>>();
}
... | ALGO | 0.99998 | 6.727018 |
a8827ee6-64f1-4826-92c1-86ff456c4323 | SolveGuys/AlgorithmStudy | Problems_Archives/89week/JongWoo/PRO_1.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stack>
using namespace std;
struct Node
{
int m_val;
Node* m_next;
Node* m_prev;
Node(int val, Node* next, Node* prev) :
m_val(val),
m_next(next),
m_prev(prev)
{
}
static void Advance(Node**... | ALGO | 0.999878 | 4.95481 |
a475fd57-5b05-4741-a58a-1316fa461d41 | m3iyo/CC_206_Assignment_6_Togonon | unit4_assignment_togonon/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.998701 | 6.76775 |
050899be-b862-4196-acd7-f6983cb216a0 | ShaharTamir/Codility | MaxProductOfThree.cpp | /*
A non-empty array A consisting of N integers is given.
The product of triplet (P, Q, R) equates to A[P] * A[Q] * A[R] (0 ≤ P < Q < R < N).
For example, array A such that:
A[0] = -3
A[1] = 1
A[2] = 2
A[3] = -2
A[4] = 5
A[5] = 6
contains the following example triplets:
(0, 1, 2), product is −3 * 1 * 2... | ALGO | 0.999964 | 6.079926 |
19871495-a89e-4ad7-80c8-4af6b3832b0e | fernandomartin04/programacion_loyola | PRIMERO/1/practica5/ej1/cabecera.cpp | #include "cabecera.h"
// Inicializa la región con valores aleatorios
void inicializarRegion(Celda region[MAX_FILAS][MAX_COLUMNAS], int filas, int columnas) {
srand(static_cast<unsigned int>(time(0))); // Semilla para números aleatorios
for (int i = 0; i < filas; ++i) {
for (int j = 0; j < columnas; ++... | ALGO | 0.99799 | 4.362807 |
f343e7d5-c456-4f0d-b72d-12dd8224ddc0 | jasonimercer/maglua | src/modules/cuda32/dipole_cuda/dipolesupport.cpp | #include "maglua.h"
#include "dipolesupport.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "extrapolate.h"
#include <vector>
using namespace std;
#ifdef WIN32
#include <windows.h>
#define strncasecmp(A,B,C) _strnicmp(A,B,C)
#pragma warning(disable: 4251)
#pragma warning(disable: 4996)
#defin... | TOOL | 0.978149 | 4.596495 |
41db56a9-d48d-491b-ad61-06f3f4de7d61 | ianLo93/Coursera-Stanford-Algorithm | course3/Clustering/clustering_1.cpp | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#define K 4
using namespace std;
typedef vector<pair<int, int> > VEC_P;
typedef map<int, VEC_P> EDGE_MAP;
int p_find (VEC_P& pr, int node);
void c_union (VEC_P& pr, int r1, int r2);
int main ... | ALGO | 0.999699 | 3.819119 |
b5b367b9-04ac-4001-a200-aeb9f514a1a6 | yulimmm/CodingTest | SWEA/1954.cpp | #include <iostream>
using namespace std;
int board[12][12];
int right(int x, int y, int total, int start)
{
for(int i = x; i < total; i++){
board[y][x] = start++;
}
return start;
}
int down(int x, int y, int total, int start)
{
}
int main()
{
int testCase;
cin >> testCase;
for(int tc = 1; tc <= te... | ALGO | 0.998654 | 3.247197 |
29a8c14f-7f8f-48b3-ae20-6acb5a6540de | qcq/Code | library/sortalgorithm.cpp | /*
* This C++ program implement many sort algorithm
*/
namespace QCQ
{
template <class T>
void QuickSort(T data[], int start, int end)
{
if (start < end - 1)
{
int q = Partion(data, start, end);
QuickSort(data, start, q );
QuickSort(data, q + 1, end);
... | ALGO | 0.999952 | 4.656143 |
f8a8c88b-1f27-4f44-a471-8be4e167c569 | andrei-kolesnik/leetcode | 003.Longest-Substring.STL/003.Longest-Substring.STL.cpp | /*
LeetCode #3: Longest Substring Without Repeating Characters
https://leetcode.com/problems/longest-substring-without-repeating-characters/
Example 1:
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the lengt... | ALGO | 0.999908 | 6.223658 |
a3db51ae-a62a-444d-afa0-6f3a40377a33 | Akshit4109/Data-structure-and-algorithm | reverse_srtring.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm> // For std::reverse
using namespace std;
string reverseWords(const string &str) {
vector<string> words;
string word;
string result;
// Extract words from the string
for (char c : str) {
if (c == ' ') {
... | ALGO | 0.999771 | 5.629832 |
61a94b58-68f9-4a14-95cd-1aa5d28a1f1c | Ahmed-Abdelghany-11/basketball_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.998733 | 6.76775 |
b9e61b09-3c24-454c-b65e-10de4d99b8dd | Adityagrao/AdaLab | dijkstra.cpp | /*From a given vertex in a weighted connected graph, find shortest
paths to other vertices using Dijkstra's algorithm.*/
#include <iostream>
using namespace std;
class dijkstra
{
int n; //Number of nodes in the graph
int a[10][10]; //Cost Adjacency matrix
int d[10]; //Holds the shortest distance
int p[10];... | ALGO | 0.999934 | 4.196351 |
b13e8558-9ca3-49f5-84aa-931858cb130c | UtopiaBeam/competitive | SPOJ/INVCNT.cpp | #include<cstdio>
#include<cstring>
#define ll long long
ll a[200002],b[200002];
int t,n;
ll mergeCnt(int s,int m,int e){
int l=s,r=m+1;
ll cnt=0;
for(int i=s;i<=e;i++){
if(l>m) b[i]=a[r++];
else if(r>e) b[i]=a[l++];
else if(a[l]<=a[r]) b[i]=a[l++];
else b[i]=a[r++],... | ALGO | 0.999628 | 3.696363 |
a279705a-a7f7-404b-a261-b0785b3c0476 | sizhuo-zhang/boost_1_62_0 | libs/spirit/example/x3/calc/calc4c/grammar.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating generation of AST. The AST,
// once created, is traversed, 1) To print its contents and
// 2) To evaluate the result.
//
// [ JDG April 28, 2008 ] For BoostCon 2008
// [ JDG February 18, 20... | ALGO | 0.914151 | 7.761004 |
1495329a-ea74-4973-ad9e-9553b688093d | alok-003/Decision_Making_Statements | Postive_checker.cpp | //Alok Chawat
//PRN:23070123016
//Batch:EnTC A-1
//experiment 3.a
//program to check if a number is positive or negative
#include <iostream>
using namespace std;
int main(){
int num;
cout<<"Enter a number: ";
cin>>num;
if (num>0){
cout<<"The Number is positive";
}
else if (num<0){
... | ALGO | 0.919698 | 3.061881 |
07ac0763-24d2-40b6-ab42-cdbfe70c0670 | VahrameevRoman/TaTb9Ha | TaTb9Ha/TaTb9Ha.cpp | // Вариант 7
// Описать класс «студенческая группа».Предусмотреть возможность работы с переменным числом студентов,
// поиска студента по какому - либо признаку(например, по фамилии, дате рождения или номеру телефона),
// добавления и удаления записей, сортировки по разным полям.
#include <iostream>
#include<windows... | TOOL | 0.997067 | 4.320241 |
f8d52a25-f2a2-4b0c-89dd-ac0f7d9108a5 | parthgupta21/Coding-Contests | CP-31/1000 rated/24 Numbers Box.cpp | #pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb ... | ALGO | 0.999966 | 5.15919 |
4eddfb28-1edc-4ea6-9041-74fba6295c27 | NewUU-CS111-Fall2023/cs111-homework10-Quyashbek2004 | src/cpp/task_7.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int minRabbits(vector<int>& answers) {
unordered_map<int, int> count;
for (int ans : answers) {
count[ans]++;
}
int result = 0;
for (auto it : count) {
int group_size = it.first + 1; // Number o... | ALGO | 0.999991 | 6.939587 |
2dbda7b5-2ea4-47a0-9b1f-c61b8a5a1b20 | hoangduongngg/CPP-Basic | MODULO 5.cpp | #include <iostream>
#include <string.h>
#define MAX 1001
using namespace std;
typedef unsigned long long int ull;
void TimK(string a, ull m) {
ull res=0, s[MAX];
for (int i=0;i< a.size(); i++)
s[i]=a[i]-'0'; // chuyen kieu du lieu tu char sang int
for (int i=0; i<a.size(); i++)
res= (res*10+s[i]) %m; // c... | ALGO | 0.999354 | 4.215961 |
ed90d564-4bdb-43b7-adda-962e1835c442 | ia2407-114/112-1-junior-college-C-plus-plus-program | 1111134026/副程式本金2/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp | // ConsoleApplication1.cpp : 此檔案包含 'main' 函式。程式會於該處開始執行及結束執行。
//
#include <iostream>
#include<stdio.h>
int reward();
int reward(double p, double r, double obj)
{
double temp = 0;//存款數
int years = 0;
while (temp < obj)
{years++;
temp = p * pow((100+ r)/100, years);
}//temp= p(本金)*((100+年利率)/... | ALGO | 0.999295 | 4.25422 |
fd91cd76-3470-4ccc-9314-93a55dfef5c6 | nobushi95/atcoder-archive-cpp | contest_cpp/abc237/B.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define REP(i, left, right) for (ll i = left; i < right; i++)
#define RREP(i, right, left) for (ll i = right; i >= left; i--)
#define REPEQ(i, left, right) for (ll i = left; i <= right; i++)
#define FORE(elem, container) for (a... | ALGO | 0.997982 | 3.997876 |
0ebb6c39-c4bf-4cfe-ba95-87a2f1b01630 | TalelMejri/codeForces | Calculating Function/main.cpp | #include <iostream>
using namespace std;
int main()
{
long long n;
cin>>n;
if (n%2==0)
cout <<n/2;
else
cout <<-(n+1)/2 ;
return 0;
}
| ALGO | 0.988512 | 3.232145 |
6080b93d-3010-429f-b97e-191ebc2c1195 | UlsanBigDev/BOJ | 개편전/06_문자열/08_다이얼/ptk.cpp | #include <iostream>
#include <map>
std::map<char, int> dial;
void init() {
dial.insert({ 'A', 3 });
dial.insert({ 'B', 3 });
dial.insert({ 'C', 3 });
dial.insert({ 'D', 4 });
dial.insert({ 'E', 4 });
dial.insert({ 'F', 4 });
dial.insert({ 'G', 5 });
dial.insert({ 'H', 5 });
dial.insert({ 'I', 5 });
dial.inse... | ALGO | 0.999641 | 4.164381 |
80408977-1bc9-4de7-991f-01e33983f9f7 | Flyingwaves/CPP_Practice | Ch_03/3.40.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main()
{
char ca[] = "nice";
char cb[] = "book";
char bigstr[20];
strcpy_s(bigstr, ca);
strcat(bigstr, " "); //ڶд' ',Ҫ˫
strcat_s(bigstr, cb);
cout << bigstr << endl;
return 0;
} | TOOL | 0.942594 | 3.269593 |
880aa37f-321c-491d-a251-8034bb057ea7 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7639_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxx = 600010;
const double pi = acos(-1.0);
const double eps = 1e-15;
int t, n, m;
int total = 0, sum = 0, cnt = 0;
int nx[maxx];
long long b, d;
long long ans = 0;
long long val[maxx];
char c1[maxx], c2[maxx];
int main() {
scanf("%lld%lld", &b, &d);
scanf(" ... | ALGO | 0.999476 | 3.707539 |
88a10e9a-b2cf-4e78-9c3a-4a1391b603cc | vikram-rathore1/competitive_programming | interviewbit/maximum_subarray.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> starts, ends, A;
vector<int> negatives;
vector<long long> sums;
A.push_back(756898537);
A.push_back(-1973594324);
A.push_back(-2038664370);
A.push_back(-184803526);
A.push_back(1424268980);
//A.push_... | ALGO | 0.999989 | 3.580122 |
d1369069-af14-4f3c-91df-6d758a5c1a71 | Zahid-Hasan-Mozumder/CF-1600---1800 | (042) Don't Blame Me.cpp | // Problem link: https://codeforces.com/problemset/problem/1829/H
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------... | ALGO | 0.999814 | 4.902934 |
9a76fd79-f422-4984-a2d6-f8614a4ab33e | amaan8302/gfg | Difficulty: Medium/Print leaf nodes from preorder traversal of BST/print-leaf-nodes-from-preorder-traversal-of-bst.cpp | class Solution {
public:
vector<int> leafNodes(vector<int>& preorder) {
vector<int> leaves;
stack<int> st;
for (int i = 0; i < preorder.size() - 1; ++i)
{
int current = preorder[i];
int next = preorder[i + 1];
bool isLeaf = false;
if... | ALGO | 0.999902 | 5.926744 |
c9452b52-fb0e-4ea5-8ea7-16684804ec79 | AbdElRahmanOsama182/LeetCode-Problems | 1127-last-stone-weight/1127-last-stone-weight.cpp | class Solution {
public:
int lastStoneWeight(vector<int>& stones) {
priority_queue<int> pq;
for (int i : stones) pq.push(i);
int a, b;
while (pq.size() > 1){
a = pq.top(); pq.pop();
b = pq.top(); pq.pop();
if (a != b) pq.push(a - b);
}
... | ALGO | 0.999918 | 5.566938 |
09615441-ef3a-459d-a987-f4664181270c | nitindahiya-dev/DSA-Practice | linked_List_problems/practice.cpp | // Find Middle of the Linked List
// #include <bits/stdc++.h>
// using namespace std;
// class Node
// {
// public:
// int data;
// Node *next;
// Node(int x)
// {
// this->data = x;
// this->next = nullptr;
// }
// };
// int getMiddle(Node *head)
// {
// Node *slow = head;
/... | ALGO | 0.999706 | 3.957061 |
0eca7772-9a39-47a2-a53e-e0000479d34b | ishandutta2007/codeforces | eddy1021/normal/1027/E.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod=998244353;
inline int add(int a, int b){
a+=b;
return a>=mod?a-mod:a;
}
inline int mul(LL a, int b){
a*=b;
return a>=mod?a%mod:a;
}
const int N=514;
int n, K;
int dp[2][N][N][2], way[N];
int main(){
ci... | ALGO | 0.999947 | 4.30454 |
3cf4b593-d667-45f8-8f67-1b975636b311 | higan-hana/- | 02.C/哥德巴赫猜想/1哥德巴赫猜想.cpp | #include<stdio.h>
int isprime(int a) //
{
for(int i=2;i<=a/2;i++)
{
if(a%i==0)
{
return 0;
}
else
{
return 1;
}
}
}
int main()
{
int n;
scanf("%d", &n); //żN
if (n%2!=0) //жǷΪż
{
printf("IJż");
return 1;
}
for (int i=2;i<=n;i=i+2) //... | ALGO | 0.999801 | 3.488229 |
4cd139d9-35ed-422f-889e-754e1afb149f | antonioguerrerocarrillo/1DESARROLLO-DE-APLICACIONES-MULTIPLATAFORMA | 1DAM/programacion en c++/ejercicios y practicas/UD5/intercambio_modular.cpp | #include <iostream>
#include <cmath>
using namespace std;
/**
* @brief funcion que copia un vector en otro
* @info vamos a copiar un vector en otro exactamente igual
* @param le pasamos util ya que va aser el total de numeros que vamos a recorrer
* @param v1 que es el vector de origen donde esta todos los numeros
... | ALGO | 0.993165 | 3.049514 |
ee95530f-f4ed-4e6a-a56f-7287a3b9849f | Ivan-71-ua/Competitive-Programming | LeetCode/509.cpp | #include <bits/stdc++.h>
class Solution {
public:
int fib(int n) {
if(n == 0)
return 0;
if(n == 1)
return 1;
int arr_f[n + 1];
arr_f[0] = 0;
arr_f[1] = 1;
for (int i = 2; i <= n; i++)
{
arr_f[i] = arr_f[i - 1] + arr_f[i - 2];
}
return arr_f[n];
}
}; | ALGO | 0.999967 | 5.248875 |
360bedc9-d9e9-4458-a408-bebe0dcf88cf | Cla1reee/216_Activity3 | tugas.cpp | #include <iostream>
#include <time.h>
using namespace std;
int main ()
{
int bilangan;
srand(time(0));
bilangan = rand() % 10;
cout << "Nilai awal : " << bilangan << endl;
if (bilangan >= 5)
{
bilangan = 2 * bilangan;
}
cout << "Nilai sekarang = " << bilangan << endl;
} | ALGO | 0.995355 | 3.469557 |
50234dda-1642-4880-8798-b90908a680d2 | tonado/boost | libs/spirit/example/karma/calc2_ast_vm.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating generation of AST from which we generate
// a simple byte code representation being interpreted by a similar virtual
// machine.
//
// [ JDG April 28, 2008 ]
// [ HK May 05, 2008 ]
//
////////... | TOOL | 0.955389 | 7.502585 |
70be5276-2a92-4f7b-8f6f-f9f9f35aecae | vedasjad/Leetcode | 235-lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-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) {
int small =... | ALGO | 0.999986 | 6.289442 |
223939bb-7eb5-4aba-a15a-a037c0556884 | showmanlee/HowCanISolveThisQuestion | BOJ/24000/24405.cpp | // Eye of Sauron
// https://www.acmicpc.net/problem/24405
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void) {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
string s;
cin >> s;
int l = 0, r = 0;
int* cur = &l;
for (char c : s) {
if (c == '|') {
(*cur)++;
}... | ALGO | 0.999698 | 5.04955 |
16a2c46c-0d27-4208-af8b-e0c5ecbbb3e2 | tanmay7256/-6Companies30days | amazon/hourglass.cpp | class Solution
{
public:
int maxSum(vector<vector<int>> &grid)
{
int n = grid.size(), m = grid[0].size();
vector<vector<int>> arr = grid;
for (int i = 0; i < n; i++)
for (int j = 1; j < m; j++)
arr[i][j] = (arr[i][j] + arr[i][j - 1]);
int sum = 0, mx ... | ALGO | 0.999842 | 4.829401 |
326d0181-50ca-4184-868e-5958640d9d2d | Prathamkj/CPP-DSA-UPDATED | Questions/Striver Questions/q6.cpp | // LEFT ROTATE THE ARRAY BY D PLACESS
#include <iostream>
using namespace std;
int LeftRotate(int arr[] , int n , int d){
}
int PrintArray(int arr[], int n){
for(int i = 0; i < n; i++){
cout<<arr[i]<<" "<<endl;
}
}
int main(){
int arr[5] = {1,2,3,4,5};
int n = 5;
int d = 2;
LeftRotat... | ALGO | 0.999953 | 5.070706 |
10966d40-66c7-4ef2-9e1c-94b2137b6e45 | npscars/CarND-ModelPredictiveControl-T2P5 | src/Eigen-3.3/doc/examples/Tutorial_simple_example_fixed_size.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix3f m3;
m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
Matrix4f m4 = Matrix4f::Identity();
Vector4i v4(1, 2, 3, 4);
std::cout << "m3\n" << m3 << "\nm4:\n"
<< m4 << "\nv4:\n" << v4 << std::endl;
}
| ALGO | 0.934434 | 3.129515 |
6b245e42-1442-4807-a0f9-8b25adbd998b | axzyh/odC- | OD算法答案/A卷/匿名信/main.cpp | //
// main.cpp
// ODTest3
//
// Created by YuChao on 2023/6/1.
//
#include <iostream>
#include <unordered_map>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <regex>
#include <iomanip>
using namespace std;
// 匿名信
// 电视剧《分界线》里面有一个片段,男主为了向警察透露案件细节,且不暴... | ALGO | 0.999664 | 4.496888 |
0d5fe1ac-7b96-431d-a220-412540ca145b | akapoor30/daily-questions | 0122-best-time-to-buy-and-sell-stock-ii/0122-best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
int f(int ind,int n,vector<int>& arr,int buy,vector<vector<int>> &dp){
if(ind==n)return 0;
if(dp[ind][buy]!=-1)return dp[ind][buy];
int profit=INT_MAX;
if(buy){
profit=max(-arr[ind]+f(ind+1,n,arr,0,dp),0+f(... | ALGO | 0.999966 | 5.679312 |
6e9b50f0-df3d-4fc2-8d69-08c918e8e3c9 | wisamalbani/MyHomeWork1 | 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 |
29639f4b-cb58-4a9b-a608-770b641e5220 | GyuJin-Cho/Algorithm | 프로그래머스/로또.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> lottos, vector<int> win_nums)
{
vector<int> answer;
int count = 0;
int zerocount = 0;
for (int i = 0; i < lottos.size(); i++)
{
if (lottos[i] == 0)
zerocount++;
for (int j = 0... | ALGO | 0.999749 | 4.559406 |
24a5eb53-1999-4bef-8fe6-984b806ecc46 | meherajmithun/problem-solving | codeforces/B_Variety_is_Discouraged.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
int n; cin >> n;
vector<int>v(n);
map<int,int>mp;
for(int i=0; i<n; i++){
cin >> v[i];
mp[v[i]]++;
}
if(n == 1){
cout<<"1 1"<<'\n';
return ;
}
int l = 0,r=0,mx = INT_MIN , lef... | ALGO | 0.999769 | 4.185776 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.