uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
732ce2d6-6bff-47e2-b3b3-f33f909d7a22 | DenizIsikli/LeetCode-CPP | Problemsets/Problems/FindNearestPointThatHastheSameXorYCoordinate.cpp | #include <vector>
using namespace std;
class Solution {
public:
int nearestValidPoint(int x, int y, vector<vector<int>>& points) {
int mn = INT_MAX, idx = 0;
for (int i = 0; i < points.size(); i++) {
int x1 = points[i][0];
int y1 = points[i][1];
if (x==x1||y==y... | ALGO | 0.999834 | 5.699429 |
4cb24a61-4187-4954-90d7-1530ce2f251a | ZXPrism/CP-Solutions | Codeforces/2074/B.cpp | #include "bits/stdc++.h"
using u64 = unsigned long long;
using i64 = long long;
void solve() {
int n = 0;
std::cin >> n;
std::vector<int> v(n);
for (int i = 0; i < n; i++) {
std::cin >> v[i];
}
int sum = std::reduce(v.begin(), v.end());
std::cout << sum - (n - 1) << '\n';
}
int ... | ALGO | 0.999829 | 5.663074 |
a90b925b-9001-408e-9c5e-b324cf4e9fd6 | SnoopyCodes/code | silver/sobbing/bovineshuffle.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> cows;
vector<int> visited;
vector<int> on_stack;
void dfs(int i) {
}
int main() {
cin.tie(0) -> sync_with_stdio(0);
int N; cin >> N;
cows.resize(N);
//the problem boils down to finding the number of vertices that are in a cycle
//uhh
... | ALGO | 0.999645 | 4.023151 |
806d63e3-6ee4-4ba1-aebb-639829a639df | osu-crypto/BaRK-OPRF | thirdparty/linux/miracl/miracl_osmt/source/encode.cpp | /*
* Program to encode text using RSA public key.
*
* Note that an exponent of 3 must be used with extreme care!
*
* For example:-
* If the same message m is encrypted under 3 or more different public keys
* the message can be recovered without factoring the modulus (using the
* Chinese remainder th... | ALGO | 0.992314 | 4.872434 |
5a908783-f73e-437b-bf73-f8787367a4f4 | ishandutta2007/codeforces | okwedook/normal/1197/E.cpp | #pragma GCC optimize("O3", "unroll-loops")
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>
using namespace std;
#d... | ALGO | 0.999954 | 3.912805 |
50af12b1-b953-4c26-ae7f-1a45697a6f93 | woojong92/algorithm_study | 2309_일곱난쟁이.cpp | /**********************************************************
ϰ
https://www.acmicpc.net/problem/2309
***********************************************************/
#include <iostream>
#include <algorithm>
using namespace std;
int a[9]; // ̵ Ű ϴ 迭
int n = 9; // ̵
int main() {
int sum =0;
for( int i =0 ; i < n ; i... | ALGO | 0.999353 | 3.801097 |
94c73363-8831-446d-bce9-c07384701ceb | Wojtek130/Advanced-Cpp-course | Lista_1/ex3.cpp | #include <algorithm>
#include <cmath>
// #include <compare>
#include <ctime>
#include <iostream>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
template<typename T>
using stringSet = std::set<std::basic_string<T>>;
int main() {
stringSet<char> s{"aaa", "bbb"};
for (auto& e : s) {
... | ALGO | 0.982213 | 4.444961 |
090539d3-55dd-4c22-a3e0-0923db7fd98a | marahim34/algorithms | Module-02/path_traversal.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> v[1005];
bool visit[1005];
int level[1005];
int parent[1005];
void bfs(int source)
{
queue<int> q;
q.push(source);
visit[source] = true;
level[source] = 0;
while (!q.empty())
{
int par = q.front();
q.pop();
cou... | ALGO | 0.999996 | 4.541255 |
3189504d-82bb-4dd7-8a33-7ed462c4a138 | risingstar213/oceanbase | src/sql/rewrite/ob_transform_simplify_orderby.cpp | #define USING_LOG_PREFIX SQL_REWRITE
#include "sql/rewrite/ob_transform_simplify_orderby.h"
#include "sql/resolver/expr/ob_raw_expr_util.h"
using namespace oceanbase::sql;
/*@brief, remove_stmt_order_by消除stmt中可以消除的order by, eg:
* select * from t1 where c1 in (select c1 from t2 order by c2);
* ==>
* select * from t1 wh... | ALGO | 0.992832 | 6.615999 |
38dc5ec0-1709-499e-a4b0-cefc903088ae | raincross7/code-similarity | codes/train_code/problem411/problem411_258.cpp | //#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;
using namespace std;
signed main() {
ios::sync_with_st... | ALGO | 0.998881 | 3.359424 |
07fa3735-522a-4389-b7c2-83868147aca7 | TranAnh35/LeetCode | Easy/Maximum_Nesting_Depth_Of_The_Parentheses/Cpp.cpp | #include <iostream>
#include <string>
class Solution {
public:
int maxDepth(std::string s) {
int count = 0, maxCount = 0;
for(char c : s)
{
if(c == '(')
{
count++;
maxCount = std::max(maxCount, count);
}
else if... | ALGO | 0.999207 | 5.675335 |
6eee3dc8-397e-48bb-b1f4-9dea02ff94f9 | ggarabs/competitive-programming | problems/Codeforces/0778A-String-Game.cpp | #include <bits/stdc++.h>
using namespace std;
bool subseq(string a, string b){
for(int i = 0, j = 0; i < a.size(); i++){
if(a[i] == b[j]) j++;
if(j == b.size()) return true;
}
return false;
}
int main(){
string t, p; cin >> t >> p;
vector<int> index(t.size(), 0);
for(int i = 0; i < index.size(); i++) cin >... | ALGO | 0.999929 | 4.601473 |
e96734f6-0ae2-42e9-9fb8-926da92d00de | TRAN-THUY-NGOC/UPCODER | UPCODER/Lập trình cơ bản/3. Vòng lặp/NGOISAO1.cpp | #include <iostream>
#define endl '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++)
cout << '*';
cout << endl;
}
return 0;
} | ALGO | 0.999828 | 4.068837 |
447f9bb2-d5da-43b4-a037-5d764b187390 | qingguang/lammps-sph | src/USER-OMP/pair_tersoff_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "math.h"
#include "pair_tersoff_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neigh... | ALGO | 0.999241 | 6.862449 |
085b2b76-1f72-4a75-a711-70b1f38b632f | simplewithalex/MyLeetCodeSln | LeetCode/0741.摘樱桃.cpp | #include "header.h"
/*
741. ժӣ
һ n x n gridһӣҵأÿֵһʾ
0 ʾǿյģԴ
1 ʾװһӣңժӣȻ
-1 ʾо·
ͳƲأй£ժӣ
λ (0, 0) (n - 1, n - 1) ֻ»ߣֻܴԽЧĸӣֻԴֵΪ 0 1 ĸӣ
(n - 1, n - 1) Ҫߣֱص (0, 0) ֻϻߣֻܴԽЧĸ
㾭һӰһӣʱ㽫ժӣҲӻɿյģֵΪ 0
(0, 0) (n - 1, n - 1) ֮䲻һɾ·ժκһӣ
ʾ 1
룺grid = [[0,1,-1],[1,0,-1],[1,1,1]]
5
ͣҴ (0, 0) ¡¡ҡƶ (2, 2)
һгм 4 ӣң [[0,1,-1],[0,... | ALGO | 0.999986 | 5.209774 |
f18c46fb-d4f9-4447-bd9c-89c0185557e8 | leaneb/audacity | lib-src/libscorealign/sautils.cpp | #include "sautils.h"
double interpolate(double x1, double y1, double x2, double y2, double x)
{
return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
}
| TOOL | 0.98243 | 4.761199 |
b37c0774-7e6c-4aa0-baab-b47c8d83ad41 | abhishekraj004/DSA1 | binary.cpp | #include<iostream>
using namespace std;
int binarysearch(int arr[] ,int n , int target){
int s=0;
int e=n-1;
int m= s+(e-s)/2;
while(s<=e){
if(arr[m] == target){
return m;
}
else if(target>arr[m]){
s = m+1;
}
else if(target<arr[m]){
... | ALGO | 0.999295 | 4.593846 |
4137afd5-4cf8-4514-a755-84075f0503ad | nqdat2002/Data-Structures-and-Algorithms | SamSung courses/ConTest 10/khong lien thong voi dinh 1.cpp | #include <bits/stdc++.h>
using namespace std;
bool Finz(vector<int> &c){
int n = c.size();
int cnt = 0;
for(int i = 0; i < n; i ++){
if(c[i] == 1)
cnt ++;
}
return (cnt == 0) ? true : false;
}
int n, m, u;
bool chuaxet[1005];
vector<int> List[1005];
vector<int> res;
void dfs(int... | ALGO | 0.999969 | 4.132312 |
4eed1997-10b2-4730-96cd-536010058c5c | algo-data-platform/PredictorService | thirdparty/eigen/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.999951 | 3.145425 |
b780fbcb-b3e9-499b-ad74-9baaf56d0333 | jamescarter748/llama.cpp | tools/perplexity/perplexity.cpp | #include "arg.h"
#include "common.h"
#include "log.h"
#include "llama.h"
#include <chrono>
#include <algorithm>
#include <array>
#include <atomic>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <fstream>
#include <mutex>
#include <random>
#include <sstream>
#include <thread>
#include <... | ALGO | 0.994655 | 6.684576 |
46a8a7d6-0b52-4ae3-861b-9427dae84b24 | satylogin/CODEFORCES | 227B.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair
#define pii pair<int, int>
#define pll pair<long long int, long long int>
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define fi first
#d... | ALGO | 0.999658 | 3.618236 |
59c1903c-fdf7-4f4a-aab1-4f61b8290104 | Yeamin-Talukder/LightOJ | 1275 - Internet Service Providers.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
ll cal(ll n , ll c , ll t)
{
return t * (c - (n*t));
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
ll int t; cin >> t;
ll ca = 1;
while(t--) {
ll n,c; cin >> n >> c;
if(n == 0 || c == 0) { cout << "Case " << ... | ALGO | 0.999898 | 4.312154 |
6da5ab06-5668-4929-9050-70e8a2407cf0 | RichardAth/Projects-master | BigIntCalculator/baseconv.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <string.h>
#include <stdio.h>
#include "bignbr.h"
#define DIGITS_PER_LIMB 9
#define MAX_LIMB_CONVERSION 1000000000
#define FIRST_MULT (1 << (BITS_PER_GROUP/2))
#define SECOND_MULT (LIMB_RANGE / FIRST_MULT)
static limb power10000[MAX_LEN];
/* equivalent to:
_ui64toa((unsigned... | ALGO | 0.992944 | 5.312987 |
2b3f50c4-362d-4262-b976-763047081498 | nkirov/nkirov.github.com | 2009/NETB151/sources/ch14/permute.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
/**
Computes n!
@param n a nonnegative integer
@return n! = 1 * 2 * 3 * . . . * n
*/
int factorial(int n)
{ if (n == 0) return 1;
int smaller_factorial = factorial(n - 1);
int result = smaller_factorial * n;
return result;
... | ALGO | 0.999508 | 5.58282 |
93c797bd-a910-4fd0-8830-61a47fd05ad5 | Akashgaur30/code-cp | coco.cpp | #include <iostream>
using namespace std;
int main()
{
int t; // your code goes here
cin >> t;
while (t-->0)
{
int A, B, C;
cin >>A>>B>>C;
if(B>C){cout<<"Alice"<<endl;}
else if(B>A){cout<<"Draw"<<endl;}
else if(A>C){cout<<"Alice"<<endl;}
else if(A>B){cout<... | ALGO | 0.999816 | 4.00607 |
a04d0cdd-b85b-4518-b33e-33d70767a2d0 | squaresLab/BatFix | results/transcoder/translations/java/COUNT_SORTED_ROWS_MATRIX.cpp | int sortedCount ( int mat [ ] [ 2 ] , int r , int c ) {
int result = 0 ;
for ( int i = 0 ;
i < r ;
i ++ ) {
int j ;
for ( j = 0 ;
j < c - 1 ;
j ++ ) if ( mat [ i ] [ j + 1 ] <= mat [ i ] [ j ] ) break ;
if ( j == c - 1 ) result ++ ;
}
for ( int i = 0 ;
i < r ;
i ++ ) {
int j ;
... | ALGO | 0.999216 | 3.751919 |
01afa18e-82f0-4acd-b826-2a70f03c1b69 | mamunur1296/C-learning | Algorithom/module-6/dijkstarOrg.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <climits>
using namespace std;
const int INF = INT_MAX;
const int MAX_NODES = 1e3 + 5;
vector<pair<int, int>> graph[MAX_NODES];
int distances[MAX_NODES];
void dijkstra(int start) {
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair... | ALGO | 0.99996 | 5.425852 |
7086b344-2f53-4c26-a379-bf4bb78f5e65 | zzctommy/public-source-code | 码库/P4931 [MtOI2018]情侣?给我烧了!(加强版).cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define mkp(x,y) make_pair(x,y)
#define fi first
#define se second
#define pb(x) push_back(x)
inline int read(){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
while(isdigit(ch))x=x*10+ch-'0',ch=ge... | ALGO | 0.999977 | 4.829795 |
419be583-6d45-4886-939b-42fa3a3136c3 | akshat123436/Strivers-SDE-Sheet-Challenge | SubsetSum.cpp | #include <bits/stdc++.h>
void findSubset(vector<int> &num, vector<int> &ans, int sum, int &n, int i)
{
if (i == n)
{
ans.push_back(sum);
return;
}
// pick
findSubset(num, ans, sum + num[i], n, i + 1);
// notpick
findSubset(num, ans, sum, n, i + 1);
}
vector<int> subsetSum(ve... | ALGO | 0.999925 | 5.182864 |
decffbfe-1fa7-4f5c-9acf-8391d813b207 | liuyanbioinfo/split_fastq_umi | src/BarcodeMatcher.cpp | #include "BarcodeMatcher.h"
#include "util.h"
BarcodeMatcher::BarcodeMatcher(const BarcodeGroupLoader& bg_loader,
const SampleConfigLoader& sc_loader,
const std::set<int>& allowed_positions)
: allowed_positions_(allowed_positions) {
const auto& grou... | ALGO | 0.870224 | 5.707836 |
5557ee40-10be-4e46-be92-d94ef2776617 | ZachMarcus/SC17 | tersoff/lammps-tersoff-vector/machines/lammps-10Mar16/src/USER-OMP/pair_brownian_poly_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include <math.h>
#include "pair_brownian_poly_omp.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include... | ALGO | 0.998824 | 7.327324 |
dbfeffea-5031-4968-b321-5fbac504d7b6 | diyamittal/DSA-programs | stack.cpp | #include<iostream>
#include<stack>
using namespace std;
class Stack{
public:
int size;
int *arr;
int top;
Stack(int size){
this->size=size;
arr=new int[size];
top=-1;
}
void push(int element){
if(size>top+1){
top++;
arr[top]=element;
... | ALGO | 0.997141 | 4.400921 |
1d19b490-40c1-4dc6-b6d4-af641900b5df | Binsal/Leetcode | 1439-find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows/1439-find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows.cpp | class Solution {
public:
int kthSmallest(vector<vector<int>>& mat, int k) {
int m=mat.size();
int n=mat[0].size();
int low=m;
int high=5000*m;
int ans=-1;
while(low<=high){
int mid=high-(high-low)/2;
... | ALGO | 0.999992 | 5.905544 |
f154fcf7-a46f-44a3-a4f6-3e0b24bdca33 | Gauravsh100/DS-Program | Q.43.cpp | #include <iostream>
using namespace std;
struct TreeNode {
int data;
TreeNode* left;
TreeNode* right;
TreeNode(int value) : data(value), left(nullptr), right(nullptr) {}
};
void preorderTraversal(TreeNode* root) {
if (root == nullptr) {
return;
}
cout << root->data << " ";
pre... | ALGO | 0.999986 | 6.48431 |
80f4ca46-38a3-4a76-b5b4-f7156809b55c | MSeify123/BehaviorMotionPlannerProject | project/starter_files/eigen-3.3.7/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.961163 | 6.417363 |
18b1c33d-97b2-43d2-9c46-47137ccdd5ea | iains/clang-cxx20-modules | libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// constexpr Iter // constexpr after c++17
// lower_bound(Iter first, Iter last, const T& value);
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
#if TEST_STD_VER > 17
T... | TEST | 0.99738 | 7.069531 |
40423137-fd7e-4fda-ae44-86d8d8b65c46 | AKD-01/DSA-LeetCode | 0118-pascals-triangle/0118-pascals-triangle.cpp | class Solution {
public:
//Type-3 : Given n print the entire triangle
vector<int> generateRow(int row) {
long long ans=1;
vector<int> list;
list.push_back(ans);
for(int col=1; col<row; col++) {
ans*=row-col;
ans/=col;
list.push_back(ans);
... | ALGO | 0.99997 | 5.929079 |
5fd4170c-9d2e-4973-9e9f-71796ba873f8 | miggymayfield/Bootcamp | 3]. Competitive Programming/03]. LeetCode/1]. Problems/C++/0391]. Perfect Rectangle.cpp | /*
Example 1:
Input: rectangles = [[1,1,3,3],[3,1,4,2],[3,2,4,4],[1,3,2,4],[2,3,3,4]]
Output: true
Explanation: All 5 rectangles together form an exact cover of a rectangular region.
Example 2:
Input: rectangles = [[1,1,2,3],[1,3,2,4],[3,1,4,2],[3,2,4,4]]
Output: false
Explanation: Because there is a gap betwe... | ALGO | 0.999543 | 6.674417 |
af9b2ec3-d100-47c1-8525-1f62c138b469 | HitarthThakkar/LeetCode-Submissions | 3776-find-minimum-cost-to-remove-array-elements/3776-find-minimum-cost-to-remove-array-elements.cpp | class Solution
{
public:
int recur(int lli, int ptr, vector<int> &nums, vector<vector<int>> &dp)
{
if (ptr > nums.size() - 2)
{
int mex = nums[lli];
while (ptr < nums.size()) mex = max(mex, nums[ptr++]);
return mex;
}
if (dp[lli][ptr] != 2e9) r... | ALGO | 0.999951 | 5.400398 |
abf0fcd5-7054-4ee8-aa12-f8bd963b3413 | TSX97/Cpp_Learn | scrs/diamond.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
string oft(int value){
if(value == 1){return "1";}
if(value == 2){return "4";}
if(value == 3){return "3";}
return "error";
}
int main(){
//верх
int weight;
cin >> weight;
int cnt = 1;
{
for(int i = 0 ; i < weight; i++){
co... | ALGO | 0.999962 | 3.463477 |
75c14c75-e2cd-4426-ba29-d1b1e6d3d41c | TijilM/leetcode_solutions | 897.IncreasingOrderSearchTree.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.999996 | 6.171799 |
db38c40f-0d91-4918-b7fb-86349e5ab12d | bramalka/Preparation | BiggerIsGreater.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'biggerIsGreater' function below.
*
* The function is expected to return a STRING.
* The function accepts STRING w as parameter.
*/
string biggerIsGreater(string w) {
if (next_permuta... | ALGO | 0.999952 | 5.547566 |
5336ad86-693c-4167-9f49-30e9e784d6f5 | ishandutta2007/codeforces | zayin/normal/1073/B.cpp | #include<bits/stdc++.h>
#define maxn 200050
using namespace std;
int n,a[maxn],pos[maxn];
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;++i)
scanf("%d",&a[i]),pos[a[i]]=i;
int b,last=0;
for (int k=1;k<=n;++k)
{
scanf("%d",&b);
if (pos[b]>last)
printf("%d ",pos[b]-last),last=pos[b];
else
printf("... | ALGO | 0.999966 | 3.284944 |
ab2aad93-e616-4bd1-b722-9cf5c8722a40 | anshulmgupta/test | linklist_merge_point.cpp | #include <iostream>
using namespace std;
struct Node{
int val;
Node *next;
Node(int val): val(val),
next(nullptr){}
};
int length(Node *head){
int len = 0;
Node *tmp = head;
while(tmp != nullptr){
++len;
tmp = tmp->next;
}
return len;
}
int length(N... | ALGO | 0.999121 | 4.658959 |
9440f1cf-0501-40ee-8a8f-bfaeca993c64 | peeradonthien/Algorithm-Design | columbia.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
int r,c;
cin >> r >> c;
vector<vector<int>> map(r,vector<int>(c));
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> map[i][j];
}
}
int offset[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
... | ALGO | 0.999967 | 3.664226 |
e3c6d8ff-1679-41f5-aaac-197276849541 | Zengrane/ardupilot | libraries/AP_Math/vector2.cpp | #pragma GCC optimize("O2")
#include "AP_Math.h"
template <typename T>
T Vector2<T>::length_squared() const
{
return (T)(x*x + y*y);
}
template <typename T>
T Vector2<T>::length(void) const
{
return norm(x, y);
}
// limit vector to a given length. returns true if vector was limited
template <typename T>
bool... | TOOL | 0.985173 | 6.480826 |
798159f2-e420-47ec-b06e-3443fd0ef253 | Thathsara-Dassanayake/Depth-Camera | StepperMotor.cpp | #define F_CPU 16000000UL // Define the CPU clock speed (16 MHz for AVR)
#include <avr/io.h>
#include <util/delay.h>
#define STEP_PIN PD2 // Define step pin (connected to 2nd digital pin)
#define DIR_PIN PD3 // Define direction pin (connected to 3rd digital pin)
#define BUTTON_PIN PD5 // Define button pin (connected t... | ALGO | 0.938037 | 6.617841 |
8c295048-54f4-45a0-9d71-39866b9b4b60 | Modnars/Tsinsen | cpp/A1090/main.cpp | // Source : http://www.tsinsen.com/A1090
// Author : Modnar
// Date : 2019-03-24
#include <iostream>
const int MAX_SIZE = 21;
int comb[MAX_SIZE][MAX_SIZE];
/**
* Idea:
* From the describe of the problem we can see, if a sequence is a swing sequence,
* the sequence's odd sub-sequence and its even sub-seque... | ALGO | 0.99983 | 4.054001 |
472198ae-0c68-40ee-a91e-53699c7b6964 | bucs240/classwork | cs240/classNote/isHeap.cpp | bool isHeap(int array[],int idx, int n)
{
if(idx >= n || isLeaf(idx,n))return true; // 加一个判断 array size/2 -2
else if(array[idx]<<array[2*idx+1]
&& array[idx]<array[2*idx+2]
&& isHeap(array, 2*idx+1,n)
&& isHeap(array, 2*idx+2,n))return true;
return false;
} | ALGO | 0.999456 | 4.505951 |
3d5948a6-3f6b-4e3f-a469-b705a9d36e10 | wslee/popl21_artifacts | euphony/thirdparty/z3/src/tactic/ufbv/ufbv_tactic.cpp | #include "tactic/tactical.h"
#include "tactic/core/simplify_tactic.h"
#include "tactic/core/propagate_values_tactic.h"
#include "tactic/core/solve_eqs_tactic.h"
#include "tactic/core/distribute_forall_tactic.h"
#include "tactic/core/der_tactic.h"
#include "tactic/core/reduce_args_tactic.h"
#include "smt/tactic/smt_tact... | ALGO | 0.997787 | 6.464748 |
1c4fa7fa-ee0d-47d9-bcc0-5e4b6981bac2 | ankittkp/Competitive-Programming | LinkedList/stackusinglinkedlist.cpp |
/*Please note that it's Function problem i.e.
you need to write your solution in the form of Function(s) only.
Driver Code to call/invoke your function is mentioned above.*/
struct StackNode
{
int data;
StackNode *next;
};
and the structure of the class is
class Stack {
private:
StackNode *top;
public :
... | ALGO | 0.996476 | 5.226166 |
eb01c661-3a3e-4ccb-9267-c22468b6ff4d | raincross7/code-similarity | codes/train_code/problem418/problem418_74.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;
template <typename T>
void printv(const vector<T> &v)
{
int sz = v.size();
for (int ... | ALGO | 0.999964 | 3.823181 |
f3b1a8fc-aa28-4ec3-9891-c642deb8cd38 | bitsimplify-com/coding-interview | Uber/13/13.cpp | #include <algorithm>
#include <iostream>
#include <vector>
std::vector<std::pair<int, int>> merge(std::vector<std::pair<int, int>> &ins) {
if (ins.empty())
return std::vector<std::pair<int, int>>{};
std::vector<std::pair<int, int>> res;
sort(ins.begin(), ins.end(),
[](std::pair<int, int> a, std::pair<... | ALGO | 0.999975 | 5.43185 |
3801ae86-9266-46ce-a2e0-04411055bdf5 | Bishoy-Maged/Chattero | 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 |
d15a76a0-77a7-47f2-a85e-71a3ddf3b579 | imtiaz1710/competitive-programming | data structure and algorithm/uva/trip.cpp | #include <stdio.h>
#include <math.h>
int main()
{
int doller,cent,n;
while(scanf("%d",&n)==1 && n!=0)
{
int a[n];
int sum=0;
for(int i=0;i<n;i++)
{
scanf("%d.%d",&doller,¢);
a[i]=doller*100+cent;
sum=sum+a[i];
}
int avgl=sum... | ALGO | 0.998744 | 3.210875 |
160f2440-4f36-4fb5-93cd-5ddf79c93d14 | 0xiamsanj/advent-of-code | 2017/02-corruption-checksum/main.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <algorithm>
#include <climits>
#include "advent.h"
// Read input from the input files
std::vector<std::string> read_input(const std::string filename){
std::fstream input_file;
std::string line;
std::vector<std::string> inpu... | ALGO | 0.999292 | 5.776796 |
eb21ed45-db8a-455f-a150-6bd6a1a1fb70 | huakunyang/SummerAsr | eigen-3.4.0/unsupported/doc/examples/EulerAngles.cpp | #include <unsupported/Eigen/EulerAngles>
#include <iostream>
using namespace Eigen;
int main()
{
// A common Euler system by many armies around the world,
// where the first one is the azimuth(the angle from the north -
// the same angle that is show in compass)
// and the second one is elevation(the angl... | ALGO | 0.990971 | 4.880029 |
1dde5d0f-9f94-47ea-b495-f2d4d831ece0 | nickedes/Ni-Algos | Practice/Ctci/Ch 1/1.8 Zero Matrix.cpp | /*
Time complexity - O(NM)
Space complexity - O(1) ,No extra space used!
*/
#include <iostream>
using namespace std;
#define SIZE 3
int display(int arr[SIZE][SIZE])
{
for(int i = 0; i < SIZE; i++)
{
cout << endl;
for(int j = 0; j < SIZE; j++)
cout << arr[i][j] << " ";
}
return 0;
}
int main()
{
int arr[... | ALGO | 0.999678 | 4.337303 |
5752a993-fd2f-4e88-bd4b-29d10647e188 | MohnishK7/Competitive-Programming | CF_Ladder/ACD_Ladder_Grind_800/Beautiful matrix.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountll
#define sz(x) ((int)... | ALGO | 0.999943 | 4.695696 |
b88466e5-2179-41d7-a82d-c0e8b62e72d2 | Plopezq/ED-personal | la_frontera/Source.cpp | // Nombre del alumno: Pablo Lopez Martin
// Usuario del Juez: F36
#include <iostream>
#include <iomanip>
#include <fstream>
#include "bintree.h"
using namespace std;
// función que resuelve el problema
void resolver(const BinTree<int> &arbol) {
if (arbol.empty()) return;
if (arbol.right().empty() && arbol.l... | ALGO | 0.999933 | 5.27022 |
b2ab6c57-142b-4a88-ad8f-02fcdc204c40 | maemo-leste-upstream-forks/qtwebengine | src/3rdparty/chromium/third_party/openh264/src/codec/processing/src/backgrounddetection/BackgroundDetection.cpp | #include "BackgroundDetection.h"
WELSVP_NAMESPACE_BEGIN
#define LOG2_BGD_OU_SIZE (4)
#define LOG2_BGD_OU_SIZE_UV (LOG2_BGD_OU_SIZE-1)
#define BGD_OU_SIZE (1<<LOG2_BGD_OU_SIZE)
#define BGD_OU_SIZE_UV (BGD_OU_SIZE>>1)
#define BGD_THD_SAD (2*BGD_OU_SIZE*BGD_OU_SIZE)
#define BGD_THD_ASD_UV (4... | ALGO | 0.993064 | 5.985975 |
00e7466e-ca33-4281-b866-af008ed6e11e | iamrajee/fast_planner_ws | src/.Fast-Planner-for-ubuntu20.04/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/my_vector.cpp | #include <vector>
#include <boost/numeric/odeint.hpp>
//[my_vector
template< int MAX_N >
class my_vector
{
typedef std::vector< double > vector;
public:
typedef vector::iterator iterator;
typedef vector::const_iterator const_iterator;
public:
my_vector( const size_t N )
: m_v( N )
{
... | ALGO | 0.961865 | 5.893738 |
53a2d305-9741-4878-a563-3f528b09f3dd | madxmarks/2D_Rabin_Karp_algorithm | RabCar2D/main.cpp | #include <iostream>
#include <string>
using namespace std;
unsigned const int W = 997;
unsigned const int S = 128;
void hashing2D(string *s , int *h, int hei, int len)
{
for (int k=0; k<hei; k++)
{
for (int i=0; i<len; i++)
h[k]=((h[k]*S)+s[k][i])%W;
}
}
void rehash2D ( unsigned int Spo... | ALGO | 0.999824 | 4.548947 |
ae49ac4a-e9c9-4c1a-b56e-66dac3d44ee6 | DirtyUnicorns/android_external_libcxx | test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp | // <random>
// template<class RealType = double>
// class chi_squared_distribution
// template<class _URNG> result_type operator()(_URNG& g);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
int main()
{
{
typedef std::... | TEST | 0.9843 | 4.382141 |
8e46d2af-2035-44c1-a87d-fafafbba87f9 | shivajaysaxena/LeetCode | 2792-neighboring-bitwise-xor/neighboring-bitwise-xor.cpp | class Solution {
public:
bool doesValidArrayExist(vector<int>& derived) {
int n = derived.size();
int sum = 0;
for (int i = 0; i < n; i++) {
sum ^= derived[i];
}
return sum == 0;
}
}; | ALGO | 0.998897 | 5.875442 |
66530109-666e-4f78-8ec7-1037aaafac51 | renbaoshuo/OI-codes | Luogu/P2520/P2520.cpp | #include <iostream>
#include <algorithm>
using std::cin;
using std::cout;
const char endl = '\n';
int t, a, b, x, y;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
cin >> a >> b >> x >> y;
int g = std::__gcd(a, b) * 2;
a %= g, b %= ... | ALGO | 0.999827 | 4.073188 |
55148dfd-b759-404f-a1af-aeec13299a7e | feassis/Custom-Unreal-Engine-4.25.4 | Engine/Source/ThirdParty/VHACD/src/vhacdICHull.cpp | #include "vhacdICHull.h"
#include <limits>
#ifdef _MSC_VER
#pragma warning(disable:4456 4706)
#endif
namespace VHACD {
const double ICHull::sc_eps = 1.0e-15;
const int32_t ICHull::sc_dummyIndex = std::numeric_limits<int32_t>::max();
ICHull::ICHull()
{
m_isFlat = false;
}
bool ICHull::AddPoints(const Vec3<double>*... | ALGO | 0.995738 | 5.769614 |
3b86c710-77e1-43ce-bc1c-60ad5418112d | Bacchus243/C_Plus_Plus | C Plus Plus Tutorials/exponent_Function.cpp | #include <iostream>
using namespace std;
int power(int base, int exponent) {
int result = 1;
for(int i = 0; i < exponent; i++){
result = result * base;
}
return result;
}
int main()
{
int base, exponent;
cout << "\nEnter an exponent base number: ";
cin >> base;
cout << "\n... | ALGO | 0.999067 | 5.681754 |
f6b13dd1-a69b-42ce-891a-bec278240f1a | kbcgang/kbc | long/why-am-i-learning-cpp-now/codeblocksRoot/grade 8/30-03-2024/23-03-2024/bai2.cpp | #include"iostream"
#define ll long long
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
if(fopen("bai2.inp","r")){
freopen("bai2.inp","r",stdin);
freopen("bai2.out","w",stdout);
}
int x,y,n;cin>>x>>y>>n;
if(n%2==0){
cout<<max(x,y)/min(x,y);
}else{
cout<<m... | ALGO | 0.99954 | 3.628774 |
7b9f6f0e-7d7e-41c9-9bcf-907f18e5d883 | jiadaizhao/LintCode | 0601-0700/0654-Sparse Matrix Multiplication/0654-Sparse Matrix Multiplication.cpp | class Solution {
public:
/**
* @param A: a sparse matrix
* @param B: a sparse matrix
* @return: the result of A * B
*/
vector<vector<int>> multiply(vector<vector<int>> &A, vector<vector<int>> &B) {
// write your code here
int m = A.size(), n = A[0].size(), p = B[0].size();
... | ALGO | 0.999945 | 5.215196 |
d12ade8d-6b45-4d81-ba18-73af218b45fc | DSC-COEA-Ambajogai/Hacktoberfest2020 | Write_Program_in_any_lang/C++/vedant1707_nprime_6.cpp | /*
Name: Vedant Darji
Program Name : Print first n prime numbers
*/
/*###########################Program Name################################## */
#include <bits/stdc++.h>
using namespace std;
// Function to print first N prime numbers
void print_first_N_primes(in... | ALGO | 0.999903 | 5.07814 |
a004aa8a-40a8-44c4-bbdc-e5ed53615796 | anidub/CPP | String/RobotBoundedCircle.cpp | #include <iostream>
#include <climits>
#include <algorithm>
#include <numeric>
#include <vector>
#include <stack>
#include <utility>
#include <string.h>
#include <unordered_map>
using namespace std;
/*https://leetcode.com/problems/robot-bounded-in-circle/
* On an infinite plane, a robot initially stands at (0, 0) and... | ALGO | 0.995586 | 5.700971 |
f263f5c9-359c-4abb-b0be-f956297f8dca | fqa0268/Option_Pricing_and_Big_Data_Application | main.cpp | #include <iostream>
#include <stdio.h>
#include <time.h>
#include <string>
#include <fstream>
#include <sstream>
#include "Util.h"
#include "PricingModel.h"
#include "Option.h"
using namespace std;
using namespace fre;
int main() {
auto start = time(NULL);
vector<pair<string, string>> time_pairs;
Ge... | ALGO | 0.966323 | 4.822879 |
f1044e5a-9cb3-4a6e-bbe4-c6b69a185cc6 | moondemon68/cp | SPOJ/WPC5A.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long
using namespace std;
int main () {
//clock_t start = clock();
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999887 | 4.423961 |
3df6d003-6d35-4aea-a44d-5fe104aac0fa | GameBle/CSES | dynamic_programming/knapsack_01.cpp | int knapSack(int w, int wt[], int val[], int n)
{
vector<vector<int>> dp(n+1,vector<int>(w+1));
for(int i=0;i<=n;i++){
for(int j=0;j<=w;j++){
if(i == 0 or j == 0) dp[i][j] = 0;
else if(wt[i-1] <= j){
dp[i][j] = max(val[i-1] + dp[i-1][j-wt[i... | ALGO | 0.999998 | 5.220463 |
042699a6-3416-47e8-a323-22432ef930dd | yunshengtian/ASAP | simulation/externals/libigl/include/igl/copyleft/comiso/nrosy.cpp | #include "nrosy.h"
#include <igl/copyleft/comiso/nrosy.h>
#include <igl/triangle_triangle_adjacency.h>
#include <igl/edge_topology.h>
#include <igl/per_face_normals.h>
#include <stdexcept>
#include "../../PI.h"
#include <Eigen/Geometry>
#include <Eigen/Sparse>
#include <queue>
#include <vector>
#include <gmm/gmm.h>... | ALGO | 0.999391 | 5.7954 |
7c484d23-aab4-4016-af89-893168297572 | toufu-24/AtCoder | ABC/ABC274/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define sort(v) sort(v.begin(), v.end())
int main()
{
double A, B;
cin >> A >> B;
double number = B / A;
number = number * pow(10, 3);
number = round(number);
number /= pow(10, 3);
printf("%1.3lf", number);
} | ALGO | 0.999204 | 3.795156 |
a6bffc74-2253-4ce2-b1e6-226084342b0c | akt9802/DSA | Heap/HeapifyAlgo.cpp | // we are converting from array to maxHeap
#include<iostream>
#include<vector>
using namespace std;
void heapifyForMaxHeap(int arr[],int n,int i){
int largest = i;
int left = 2*i+1;
int right = 2*i+2;
if(left<n && arr[largest] < arr[left]){
largest = left;
}else if(right < n && arr[large... | ALGO | 0.999959 | 4.320138 |
1f7a36ab-db58-4f40-9878-6fd20087ce05 | ishandutta2007/codeforces | cheetose/normal/1477/A.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#defin... | ALGO | 0.999886 | 3.454665 |
0f966855-1f3e-49ae-a3db-ef3b3d5e66f7 | raincross7/code-similarity | codes/train_code/problem377/problem377_247.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#... | ALGO | 0.999991 | 3.859725 |
8ab8e082-65a6-4fcc-9dd4-4962d08fdaf8 | nucleargezi/acm-icpc | atcoder/abc/390-399/abc394 -ak/F_Alkane.cpp | #include "MeIoN_Lib/MeIoN_all.hpp"
#include "MeIoN_Lib/graph/Tree/Basic.hpp"
void before() {}
// #define tests
NAME MeIoN_is_UMP45() {
int n;
std::cin >> n;
graph<int> g(n);
g.read_tree();
meion d = g.deg_array();
vector<bool> vis(n);
vector<int> dp(n, -inf<int>);
int ans{-inf<int>};
... | ALGO | 0.999658 | 5.246869 |
3467102a-2f34-41b9-832b-46dc2ad1bd92 | ghist/codigosuni | atividade4/questao01.cpp | #include <stdio.h>
#include <string.h>
struct estudantes{
char nome [20];
float peso, altura, ira;
};
int main(){
float mediap, mediai, mediaa;
float maiorp = 0, maiori = 0, maiora = 0;
char nomea[20], nomep[20], nomei[20];
int i;
struct estudantes e1[5];
for(i = 0; i < 5; i++){
scanf("%s", &e1[i].nome);
... | ALGO | 0.998632 | 3.335575 |
2e8d5734-259a-4147-88ac-8aa5899d203a | AayushKulkarni36/DSA_Questions | Binarysearchques1.cpp | #include<iostream> //to find the first occurance and last occurance of an element of the array and return their index
int firstOccurance(int arr[],int n ,int key)
{
int start =0;
int end =n-1;
int ans;
int mid = (start+end)/2;
while(start<=end){
if(arr[mid]==key){
... | ALGO | 0.99973 | 4.784082 |
5fe015df-fbd6-47d5-9c5d-933b42042013 | letsclode/riverpodtemplate | 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 |
d46f4cfe-378c-4da4-bdf9-37a0cc3c4aef | brenthoang12/Godspeed-Robotics | eye_mechanism/servo_motion.cpp | #include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMIN 150 // Pulse for 0° (adjust as needed)
#define SERVOMAX 600 // Pulse for 180° (adjust as needed)
const int THRESHOLD = 10;
// input
const int buttonPin = 2;
const int xPin = A0;
const... | TOOL | 0.92313 | 5.468477 |
50cf9971-6b56-440c-a258-c16784f88636 | JBlakd/self-study | iterator_flatten_2d_vector/flatten_2d_vector.cpp | #include <cassert>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Vector2D {
public:
Vector2D(vector<vector<int>>& vec) {
for (vector<int>& vec_child : vec) {
for (int& int_child : vec_child) {
flattened.emplace_back(int_child);
}
}
it = flattene... | ALGO | 0.983519 | 5.473836 |
09cf8f53-9ce6-4b03-9049-8e06d78962ff | theruleslawyer/Two-Trees-Robin-Nano-v3-GUI | Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp | #if defined(__arm__) || defined(__thumb__)
#define MODULE_NAME "UNWARM_ARM"
#include <stdio.h>
#include "unwarm.h"
/** Check if some instruction is a data-processing instruction.
* Decodes the passed instruction, checks if it is a data-processing and
* verifies that the parameters and operation really indicate a d... | TOOL | 0.865092 | 4.103226 |
49d965a3-9b8f-488c-90a6-231605b77431 | rumdien113/Algorithm | OLP/KC_Mashup/DuongDiTrenLuoi.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define db long double
#define st first
#define nd second
#define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
... | ALGO | 0.999977 | 3.950117 |
37da0e7a-07d7-4a98-b7a4-dc561483fc0c | Yogesh17IITM/Data-Structures-and-Algorithm | Prog_2_Searching_LinearSearch.cpp | /*
Topic : Searching [Linear Search]
Objective:
To demonstrate how to do basic search using linear search algorithm
Key Topics:
- Linear Search [focus here]
- Bubble sort
- Data structures and algorithms - a short intro
Discussions:
- Best case: key is found at first item
- Worst case: key i... | ALGO | 0.999961 | 5.740027 |
d7161d8b-e940-49b7-b4d9-701ca1613d79 | ufz/ogs | ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Biot.cpp | #include "Biot.h"
namespace ProcessLib::ThermoRichardsMechanics
{
void BiotModel::eval(SpaceTimeData const& x_t, MediaData const& media_data,
BiotData& out) const
{
namespace MPL = MaterialPropertyLib;
MPL::VariableArray variables;
*out = media_data.medium.property(MPL::PropertyType::... | ALGO | 0.99602 | 5.919596 |
0ad11aa9-b60e-4b27-a480-ee207c5a5f38 | AkiMoo/LeetCode_2024Hot100_Solution | 3.无重复字符的最长子串.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int n = s.length();
unordered_map<char,int> counter;
int ans = 0;
int temp = 0,left = 0;
if(n==1||n==0){
return n;
}
for(int right = 0;right<n;right++){
counter[s[right]]... | ALGO | 0.999723 | 5.527919 |
a005ab7a-fd9c-4ac9-94c7-8dcf20399b1c | animikhaich/NeRF-Editing-GP | TetWild/extern/libigl/tests/include/igl/circulation.cpp | #include <test_common.h>
#include <igl/circulation.h>
#include <igl/edge_flaps.h>
#include <igl/unique_edge_map.h>
#include <igl/matlab_format.h>
TEST_CASE("circulation: single_edge", "[igl]")
{
// 7
// /₆|₇\
// 4 - 5 - 6
// |₂/₃|₄\₅|
// 1 - 2 - 3
// \₀|₁/
// 0
cons... | TEST | 0.982259 | 5.151936 |
fdb0b6e1-f087-4795-8b6b-578106b295c8 | juhik24/DSA-Sheet | 205-isomorphic-strings/205-isomorphic-strings.cpp | class Solution {
public:
bool isIsomorphic(string s, string t) {
if(s.length() != t.length()) return false;
map<char, int>mp1, mp2;
for(int i = 0; i < s.length(); i++) {
if(mp1[s[i]] != mp2[t[i]]) return false;
mp1[s[i]] = i+1;
mp2[t[i]] = i+1;
}
... | ALGO | 0.999971 | 6.261242 |
274fc52f-edc0-4a24-9ae9-6c99174fbb14 | rebeccca-debug/Cpp_Algorithms | Math/fibonacci_sum.cpp | /**
* @file
* @brief An algorithm to calculate the sum of [Fibonacci
* Sequence](https://en.wikipedia.org/wiki/Fibonacci_number): \f$\mathrm{F}(n) +
* \mathrm{F}(n+1) + .. + \mathrm{F}(m)\f$
* @details An algorithm to calculate the sum of Fibonacci Sequence:
* \f$\mathrm{F}(n) + \mathrm{F}(n+1) + .. + \mathrm{F}(... | ALGO | 0.999899 | 6.583894 |
e77779c0-4f06-4c7b-9813-90a1708e9115 | Tech-Lksh/DSA-Placement-Preparation-Question | 1_Array Question/29_Find Length/Hello.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<limits.h>
#include<math.h>
using namespace std;
void findLen(string str, int length, string str1, int length1, vector<string> &ans) {
int i = 0, j = 0;
while(i < length && j < length1) {
int index = 0;
if(str[i] == str1[j]) {
... | ALGO | 0.999883 | 3.396691 |
8ff94173-bafd-4dfa-9b74-fd3bece90ac7 | kellysautter/10cKelly | tlb/TLB.CPP | // TLB.CPP : implementation file
//
#include "stdafx.h"
#include "ttblbrws.h"
#include "TLB.H"
#include "tlbconst.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CTlbBaseProperties, CObject)
CTlbBaseProperties::CTlbBaseProperties()
{
m_bstrNam... | TOOL | 0.962374 | 6.081381 |
8922d1c0-1e8c-4e47-a68f-d5a110e26fda | EvgeniiPliusnin/otus_cpp_basic_2022_9 | lessons/lesson_04/vebinar/5_swap_naive.cpp | // OTUS C++ basic course example
// pass parameters by value to swap function
#include <iostream>
void swap_naive(int a, int b) {
int t = a;
a = b;
b = t;
}
int main(int argc, char *argv[]) {
if (argc < 3) {
std::cerr << "Usage: " << argv[0] << " a b\n";
return 1;
}
int a = std::atoi(argv[1]);
int b = std... | TOOL | 0.993651 | 5.693034 |
413ce0de-c908-4fc4-b141-13557c3d5e7f | Manansodhi/Data-Structures-and-Algorithms | 20. Trees/54. Kth Smallest Element in BST.cpp | /*
Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed)
of all the values of the nodes in the tree.
Example 1:
Input: root = [3,1,4,null,2], k = 1
Output: 1
Example 2:
Input: root = [5,3,6,2,4,null,null,1], k = 3
Output: 3
Constraints:
The number of nodes in the tree ... | ALGO | 0.999999 | 6.732862 |
27693c2b-1d8b-4ede-a60f-4aa400324c8f | timot3/ECE522-Speculative-Coherence | GEM5Simulation/gem5/src/systemc/tests/systemc/misc/unit/data/general/int_to_bits/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.861391 | 5.362704 |
0fb47839-e08b-4e54-b7e6-30d0b55b1384 | ChaitanyaSaiValla/AlgoLab | fractional_knapsack.cpp | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace chrono;
template <class T1, class T2>
class Pair
{
public:
T1 first;
T2 second;
Pair()
{
first = 0;
second = 0;
}
Pair(T1 a, T2 b)
{
first = a;
second = b;
}
};
void swap(Pair<... | ALGO | 0.999996 | 4.3305 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.