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 |
|---|---|---|---|---|---|---|
57d7b9e2-914b-4ff6-a701-051a722ec03e | sanyam-sindhu/DSA-Practice-Questions | 36-valid-sudoku/36-valid-sudoku.cpp | class Solution {
public:
bool isValid(vector<vector<char>>&board,char c,int row,int col){
int cnt1=0,cnt2=0,cnt3=0;
for(int i=0;i<9;i++){
if(board[i][col]==c)
{cnt1++;}
if(board[row][i]==c)
{cnt2++;}
if(board[3*(row/3)+i/3][3*(col/3)+i%3]==c)
{cn... | ALGO | 0.99984 | 6.85047 |
148a59e0-69e2-4578-99c0-6f74b8c24067 | surendiran04/Leetcode | Medium/200.Number of Islands.cpp | class Solution { //DFS approach
public:
int numIslands(vector<vector<char>>& grid) {
if (grid.empty() || grid[0].empty()) {
return 0;
}
int numIslands = 0;
for (int i = 0; i < grid.size(); i++) {
for (int j = 0; j < grid[0].size(); j++) {
if (... | ALGO | 0.999954 | 6.796147 |
2efba069-4a9c-4359-8050-a9d44927a5c0 | rguida/AdventOfCode2022 | src/Day1.cpp | #include "Day1.h"
#include <algorithm>
#include <numeric>
#include <ranges>
namespace AdventOfCode
{
Day1::Day1(std::string inputFileName)
: DailyTask(inputFileName)
{
}
void Day1::Task1()
{
uint32_t elfcalories{0};
uint32_t maxCalories{0};
for (std::string line; std::getline(m_inputFile, line);)
... | ALGO | 0.960871 | 5.867133 |
0db34b0a-76c6-4050-a990-ef5195a62053 | Vijay6923/All_platform_question | codeforces/800/ambitious_kid.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>arr(n);
for(int i=0;i<n;i++){
cin>>arr[i];
}
int ans=INT_MAX;
for(int i=0;i<n;i++){
int a=abs(0-arr[i]);
ans=min(ans,a);
}
cout<<ans<<endl;
} | ALGO | 0.999899 | 3.879734 |
deff7c2f-31eb-4e13-b9ec-6db6f709a7c6 | thegamer1907/Code_Analysis | Graphs/2413.cpp | #include<bits/stdc++.h>
#define LL long long
using namespace std;
int ara[2005];
vector<int>td[2005];
bool vis[2005];
int dph;
void dfs(int pos,int depth)
{
if(vis[pos]==1)return;
dph = max(dph,depth);
vis[pos]=1;
for(int i=0;i<td[pos].size();i++)
{
int now = td[pos][i];
... | ALGO | 0.999787 | 3.667962 |
01e93a79-c158-4819-95e5-a467932adcf5 | ishandutta2007/codeforces | rush_d_cat/normal/303/C.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
using namespace std;
const int N = 5002;
int a[N],n,k,c[1000002],d[1000002];
pair<int,int> v[1000002][6]; int tot[10000002];
int par[N],sz[N];
int find(int x){
return par[x]==x?x:par[x]=find(par[x]);
}
bool can(vector< pair<int,int>... | ALGO | 0.999968 | 3.69661 |
417e2abe-9a56-49c6-9c62-a7ecfd07fcd5 | seunghye218/problem-solving | 프로그래머스/1/12922. 수박수박수박수박수박수?/수박수박수박수박수박수?.cpp | #include <string>
#include <vector>
using namespace std;
string solution(int n) {
string answer = "";
for (int i = 0; i < n; i++)
i & 1 ? answer.append(u8"박") : answer.append(u8"수");
return answer;
} | ALGO | 0.997197 | 5.357554 |
63b26225-7461-42a6-b5dc-cb263f63bbcf | Danbk93/Algorithm_Exercise_C | Baekjoon/10951_A+B-4.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int a, b;
int main() {
freopen("input.txt", "r", stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
while(cin >> a >> b) {
cout << a + b << endl;
}
} | ALGO | 0.996899 | 4.429379 |
9d82e96f-e5b9-4c54-bcec-b5c333115785 | snichols/boost_1_61_0 | libs/intrusive/example/doc_rbtree_algorithms.cpp | struct my_node
{
my_node(int i = 0)
: int_(i)
{}
my_node *parent_, *left_, *right_;
int color_;
//other members
int int_;
};
//Define our own rbtree_node_traits
struct my_rbtree_node_traits
{
typedef my_node node;
typedef my_node * ... | ALGO | 0.999881 | 6.599195 |
bc0bc8d3-71d7-44db-9b2e-47f0087bdcdb | pavanbaloju/data-structures-and-algorithms | striver-sde-sheet/052.SubsetsII.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
// Problem Statement:
// Given an array of integers that may contain duplicates, nums, return all possible subsets (the power set).
// The solution set must not contain duplicate subsets.
// Intuition:
// Use recursion to generate all possible ... | ALGO | 0.999971 | 7.20388 |
42281425-b60b-41be-a71e-0755d2be432b | Meharsh7804/Leetcode-Solution | Cpp/139.word-break.cpp | // Dynamic Programming - Memoization
class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
int n = s.length();
std::vector<bool> dp(n + 1, false);
dp[n] = true; // Base case: an empty string is always a valid segmentation
// Iterate from the end of the strin... | ALGO | 0.998816 | 6.489768 |
3d751171-0c72-4d0d-aeaf-27c660155420 | deepanshuoct12/cpp-practise-codes | bstcatalanwithdp.cpp |
#include<iostream>
using namespace std;
int dp[100];
int catalan(int n) // catlan gives no. of bst's
{
if(n==0)
return 1;
if(dp[n]!=0)
return dp[n];
int ans=0;
for(int i=1;i<=n;i++)
{
ans+=catalan(i-1)*catalan(n-i);
}
dp[n]=ans;
return ans;
}
int main... | ALGO | 0.999864 | 3.945075 |
d6b3b6ff-44e7-49e5-8493-1f3ae2d27b61 | Tastypotato245/boj | 2/21736/main.cpp | // https://www.acmicpc.net/problem/21736
// github/Tastypotato245
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int N;
int M;
char arr[600][600];
bool visit[600][600];
int x, y;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
int ans;
queue<pair<int, int> > q;
void Solve()
{
... | ALGO | 0.999508 | 4.473511 |
6dfb24a5-a204-473f-906f-318ebf49ca31 | cshung/Competition | Competition/SPOJ_SAMER08F.cpp | #include "stdafx.h"
#include <stdio.h>
// http://www.spoj.com/problems/SAMER08F/
int SPOJ_SAMER08F()
{
int c;
while (true)
{
scanf("%d", &c);
if (c == 0)
{
break;
}
printf("%d\n", c * (c + 1) * (2 * c + 1) / 6);
}
return 0;
} | ALGO | 0.999915 | 4.190975 |
4366e08a-f672-4810-8d4b-75c73b1b1385 | hjiang13/LLMs-in-IR | POJ-104/29/1847.cpp | #include <iostream>
using namespace std;
double arr[101] = {
0}
;
int main() {
double a = 2, prea = 1, b = 1, preb = 1, tmp;
int n, m;
for (int i = 1; i < 101; ++i) {
arr[i] = arr[i-1] + a / b;
tmp = a;
a += prea;
prea = tmp;
tmp = b;
b += preb;
preb = tmp;
}
cin >> "%d", &m);
while (m--) {
cin >> "%d", &n);
cout << ... | ALGO | 0.999835 | 3.248499 |
45e946e6-30ec-420a-98c6-463893719a2f | wzao1515/R2S | ra2sql/ra2sql/include/boost_1_55_0/libs/graph/test/copy.cpp | #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/copy.hpp>
using namespace boost;
class copier {
public:
template<class V1, class V2>
void operator()(const V1&, const V2&) const {}
};
int main()
{
adjacency_list<vecS, vecS, directedS, property<vertex_root_t, int> > g1, g2;
adjacency_li... | ALGO | 0.940575 | 4.147507 |
dbdb9b10-5989-4732-9e78-e7fcd0d72474 | partho-das/CompetitiveProgrmming | CP_CODE/C++practice/ractice.cpp | #include<bits/stdc++.h>
using namespace std;
void f(vector<int>& vec, list<int>& lst)
{
sort(vec.begin(),vec.end());
unique_copy(vec.begin(),vec.end(),back_inserter(lst)); // append to res
}
bool has_c(vector<int>& v,int c)
{
return find(v.begin(),v.end(),c) != v.end();
}
vector<string::iterator> occer... | ALGO | 0.999856 | 4.784904 |
3b2d1436-9c98-429d-869f-2750f3faae79 | sarvex/leetcode-tsh | solution/0400-0499/0467.Unique Substrings in Wraparound String/Solution.cpp | class Solution {
public:
int findSubstringInWraproundString(string p) {
vector<int> dp(26);
int k = 0;
for (int i = 0; i < p.size(); ++i) {
char c = p[i];
if (i && (c - p[i - 1] + 26) % 26 == 1)
++k;
else
k = 1;
... | ALGO | 0.999969 | 5.961395 |
832d0e33-9618-4d7b-86d3-b1fcd4dcbf6e | leonard-lenny-lee/align-it | src/lipoFuncCalc.cpp | #include <lipoFuncCalc.h>
void lipoFuncCalc(RDKit::ROMol *mol, Pharmacophore *pharmacophore) {
// Find for each atom the 'topology-dependent term': t
_lipoLabelAtoms(mol);
// Multiply 't' with the accessible surface 's'
const auto &conf = mol->getConformer();
for (auto atom : mol->atoms()) {
... | ALGO | 0.996562 | 5.653972 |
c5507ee9-cf77-4976-a0ac-1ebc4dd1fd47 | ishandutta2007/codeforces | cyand1317/normal/803/E.cpp | #include <cstdio>
#include <utility>
static const int MAXN = 1005;
int n, k;
char s[MAXN];
// f[sequence position][win/lose + MAXN] = whether possible, and a transition
std::pair<bool, char> f[MAXN][MAXN * 2];
char ans[MAXN] = { 0 };
int main()
{
scanf("%d%d", &n, &k); getchar();
for (int i = 0; i < n; ++i) s... | ALGO | 0.999999 | 3.595463 |
6ed3a6a9-8cda-4009-a1f3-506d90c84f33 | dsiroky/conan-boost | boost_1_65_1/libs/graph/example/edge_coloring.cpp | #include <iostream>
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/edge_coloring.hpp>
#include <boost/graph/properties.hpp>
/*
Sample output
Colored using 5 colors
a-d: 4
a-f: 0
b-c: 2
b-e: 3
b-g: 1
b-j: 0
c-d: 0
c-e: 1
d-f: 2
d-i... | ALGO | 0.994625 | 6.229772 |
a834d6db-5d3c-435b-beb6-d14a7c2b9906 | Acurich/informatics.msk | 310.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int n;
cin >> n;
for (int i = 2; i <= sqrt (n); i++)
{
if (n % i == 0)
{
cout << "composite";
return 0;
}
}
cout << "prime";
return 0;
} | ALGO | 0.999931 | 4.428493 |
c0a1b826-cd70-46d8-8b4f-1c0ba061bcd7 | XXDIL/IB-Prep | Strings/Roman_To_Integer.cpp | /* Start from back of the string */
int Solution::romanToInt(string s)
{
unordered_map<char, int> symbols({{'I', 1}, {'V', 5}, {'X', 10}, {'L', 50},
{'C', 100}, {'D', 500}, {'M', 1000}});
int n = s.size();
int ans = symbols[s[n-1]];
for(int i=n-2;... | ALGO | 0.999971 | 6.231174 |
99097448-b60a-4717-b966-eee1d5486ee0 | Akshay1299/UNI_Sol | 2407-longest-increasing-subsequence-ii/2407-longest-increasing-subsequence-ii.cpp | const int N = 1e5+1;
class Solution {
public:
int lengthOfLIS(vector<int>& nums, int k) {
int n = nums.size();
int t[2*N + 2]; memset(t, 0, sizeof(t));
auto upd = [&](int p, int v) {
p += N;
t[p] = v;
for(; p > 1; p >>= 1) t[p>>1] = max(t[p], t[p^1]);
... | ALGO | 0.999964 | 5.376039 |
a279c27b-1be3-4518-8cd1-76998973e56e | yefengdanqing/my_leetcode_algorithm | 268.丢失的数字.cpp | /*
* @lc app=leetcode.cn id=268 lang=cpp
*
* [268] 丢失的数字
*/
// @lc code=start
class Solution {
public:
int missingNumber(vector<int>& nums) {
int len = nums.size();
for (int i = 0; i < len; i++) {
// std::cout << "i:" <<i << " " << nums[i] << std::endl;
while(nums[i]< le... | ALGO | 0.999836 | 5.443614 |
539111f1-c25d-48d7-bc42-67adf295de39 | menyf/Code-Snippet | Leetcode/884. Decoded String at Index.cpp | #include <iostream>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <iosfwd>
#include <deque>
#include <algorithm>
#define debug(x) cout<<"Debug : -... | ALGO | 0.999668 | 3.539734 |
cc116e2c-f127-42ba-9ce1-04c5fcf89c67 | wangjianpeng200/Study | cpp/7.pointer/pt and funcation.cpp | //当为值传递,形参不影响实参
//当为地址传递时,可以改变实参
#include<iostream>
using namespace std;
/*
void swap(int *p,int *p1)
{
int temp=*p;
*p=*p1;
*p1=temp;
}
int main()//d当使用指针时,地址传递可以修饰实参
{
int a=10;
int b=20;
swap(&a,&b);
cout<<a<<" "<<b<<endl;
system("pause");
}
*/
int main()
{
int a=10;
int ... | ALGO | 0.991132 | 4.252507 |
c790667a-02a1-4986-a995-0ac709d36a36 | F-0728/atcoder | ABC/D/339D.cpp |
#include <atcoder/all>
#include <bitset>
#include <chrono>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
using namespace std;
using namespace atcoder;
// using mint = modint1000000007;
using mint = modint998244353;
using ll = long long;
using ld = long double;
const ll inf = 1 ... | ALGO | 0.999531 | 4.219091 |
40933636-89e4-47c4-a8c3-881d8c1b4855 | burningcherry97/AoC-2022 | 5/P1/program.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
fstream in{"input.txt"};
string line;
vector<string> cargo{};
while (getline(in, line)) {
if (line[1] == '1') {
getline(in, line);
... | ALGO | 0.999953 | 4.107921 |
0b75aeb5-ad35-4a14-8f5a-909c05dc5ca0 | robintomar1/kalman_filter | measurement_update.cpp | /*
* In this C++ code, the measurement update function returns two values: the newly computed mean and variance.
* Usually, a tuple or structshould be used in C++ to return more than one value from a function and easily assign them later to multiple variables
*/
#include <iostream>
#include <math.h>
#include <tupl... | ALGO | 0.998945 | 7.210635 |
7d31afab-72c5-467e-aaf1-ea893961ba24 | a6cenna/osninfor | toki/pkd/07/p4.cpp | // author: sofwant || a6cenna
#include <bits/stdc++.h>
using namespace std;
#define suffering_leaves_suffering_leaves ios::sync_with_stdio(false); cin.tie(nullptr);
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
const int MOD = 1000000... | ALGO | 0.999972 | 4.317769 |
972f1c61-359b-4122-81a8-2b25abb66685 | edurneruiz/Universidad | MARP/I/Ejercicios/11_amigos.cpp | ///EDURNE RUIZ DG33
/*
En esta ciudad viven N personas, y sabemos que algunas de ellas son amigas entre s´ı. De acuerdo con el refr´an que dice
“Los amigos de mis amigos son mis amigos”, sabemos que si A y B son amigos y B y C son amigos, entonces tambi´en son amigos A y C.
Tu misi´on consiste en contar las personas e... | ALGO | 0.999007 | 5.365405 |
9edabe14-82d2-47df-a8dd-b549261a73e5 | mishamsk13/lab-algoritmi | laba7/task2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
// Структура для хранения информации о коробке
struct Box {
int weight; // Вес коробки
int capacity; // Максимальный вес, который она может выдержать
};
// Функция сравнения для сортировки коробок по их максимальной грузоподъемности
bool compare... | ALGO | 0.999996 | 5.983731 |
545f49ea-445d-46ee-9526-7c4ddeb1c2dc | hasnainadam7/dsa | pro/DSA Lab/DSA Lab 9(CS191050)/BST.cpp | #include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
struct Tree
{
int data;
Tree * left;
Tree * right;
};
void inorder(Tree *tree)
{
if(tree)
{
inorder(tree->left);
cout<<" "<< tree->data;
inorder(tree->right);
}
}
void postorder(Tree *tree)
{
... | ALGO | 0.999193 | 3.494132 |
9544ea9b-79e6-44cb-855b-17ea4e6e71eb | priyajit27/Leetcode | 0921-minimum-add-to-make-parentheses-valid/0921-minimum-add-to-make-parentheses-valid.cpp | class Solution {
public:
int minAddToMakeValid(string s) {
int ans=0;
int ans1=0;
for(auto i:s){
if(i=='(')
ans++;
else{
if(ans>0)ans--;
else ans1++;
}
// ans--;
}
return ans+a... | ALGO | 0.99959 | 5.946225 |
a9828935-a5e8-47ca-88cd-f71ca6619920 | EaueauOops/leetcode | 38.count-and-say.cpp | /*
* @lc app=leetcode id=38 lang=cpp
*
* [38] Count and Say
*/
// @lc code=start
class Solution {
public:
string countAndSay(int n) {
string a ="1";
int count;
for(int i=1;i<n;i++)
{
string tmp;
for(int j=0;j<a.size();j++)
{
count = 1;
... | ALGO | 0.999961 | 7.092651 |
2ce34148-ba34-45cd-8ad7-b86572806ab6 | ashekhawat6198/DSA | Stack.cpp | #include <iostream>
using namespace std;
#include<stack>
// FOLLOWS LIFO= LAST IN FIRST OUT
// PUSH = USED TO ADD ELEMENT
// POP = UED TO DELETE ELEMENT FROM TOP
// PEEK = TOP ELEMENT
// Empty = to check it is empty or not
// syntax = stack <type> stack_name;
// st.push(2);
// st.pop();
// st.top();
// st.empty()
... | ALGO | 0.9994 | 3.857085 |
5bc6327e-edda-40e4-81af-f427a9ab3886 | Sudhanshu-06/C-Cppcode | C++_Nexus/Day-3/star_pattern.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
for(int row=1; row<=5; row++)
{
for(int col=1; col<=row; col++)
{
cout<<"* ";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.995056 | 3.644128 |
44fa46ea-46ae-48d9-9975-be5f295ec2ac | sanjj271/Leetcode-answers | Topological sort - GFG/topological-sort.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return list containing vertices in Topological order.
vector<int> topoSort(int V, vector<int> adj[])
{
vector<int>ans;
int count =0;
vector<int>indegree(V,0);
for(... | ALGO | 0.999936 | 6.804696 |
032b3023-067e-4d52-a03d-1182f3aaa268 | SammyRobensParadise/simple-linked-list | main.cpp | #include <iostream>
using namespace std;
// PURPOSE: Models a data item in a container
class Node {
int data;
Node *next;
public:
// CONSTRUCTORS
Node() : data(0), next(NULL) {}
Node(int new_data) : data(new_data), next(NULL) {}
// PURPOSE: Simple getters and setters
Node *get_next() {
... | ALGO | 0.998395 | 5.798457 |
76380193-c86e-4894-b5ca-1d6e8437225b | SeSACAlgorithm/AlgorithmStudy | 백준/백트래킹/1759) 암호 만들기/태호.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// 한 개의 모음(a, e, i, o, u)과 최소 두 개의 자음으로 구성
// 정렬된 문자임 ex) abc (o) bac(x)
// 서로 다은 알파벳 소문자 n 문자의 종류 m
int n, m;
char values[20];
char arr[20];
bool visited[20];
string mo = "aeiou";
bool Check(char c)
{
for (int i = 0; i < mo.size();... | ALGO | 0.999947 | 4.074138 |
789390d5-d306-4aaa-acc5-3922acf73a85 | jlglearn/Code | qsortx.cpp | #include <cstring>
#include <cstdlib>
static void Swap(void *pA, int elementSize, int i, int j)
{
unsigned char *p = (unsigned char *)pA;
unsigned char t[elementSize];
void *pI = (void *) &p[elementSize * i];
void *pJ = (void *) &p[elementSize * j];
void *pT = (void *) &t[0];
memcpy(pT,... | ALGO | 0.998479 | 4.805804 |
8853b0af-ffb6-4dac-b7fb-5f7b3d9ca0df | mahbobhasan/course-3 | week 3/bubble.cpp | #include<bits/stdc++.h>
using namespace std;
void printarray(int ar[],int size)
{
for(int i=0;i<size;i++)
{
cout<<ar[i]<<" ";
}
cout<<endl;
}
int main()
{
int n;
cout<<"Enter the length of the array: ";
cin>>n;
int ar[n];
cout<<"Enter the elements of the array: ";
for(int i=0;i<n;i++)
{
cin>>ar[i];
... | ALGO | 0.999941 | 3.727241 |
5cd54978-5fe0-4ec3-90c6-64f40479e66d | gajgeospatial/boost_1_86_0 | libs/hana/benchmark/transform/execute.fusion.vector.erb.cpp | <% if input_size > 10 %>
#define FUSION_MAX_VECTOR_SIZE <%= ((input_size + 9) / 10) * 10 %>
<% end %>
#include <boost/fusion/include/as_vector.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/fusion/include/transform.hpp>
#include "measure.hpp"
#include <cstdlib>
namespace fusion = boost::fusi... | ALGO | 0.974158 | 4.901468 |
6de34abb-d4e0-44ea-9a02-e487356372d3 | RhobanDeps/eigen | doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.999308 | 3.872858 |
de4fec78-2b02-443f-957b-9816216ce9e3 | wahhabkhan/Data-Structure-and-Algorithms-Spring-25 | Lab Tasks/Submissions/Lab Task 2/main.cpp | #include<iostream>
#include <string>
using namespace std;
class Node{
public:
string name;
int rollNumber;
Node* next;
};
class List{
Node *first,*last;
public:
List(){
first=last=NULL;
}
void mark(){
Node *temp;
temp=new Node;
cout<<"\nEnter the name: ";
cin >> temp... | TOOL | 0.990407 | 3.73137 |
f54f8caf-f744-49ab-bbcf-8fc157d6d5c8 | zhzh2001/Learning-public | c++实用代码/平衡树code/statistics/src1/test/SkipList_test/statistics/statistics_S.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define oo (1<<30)
#define exp 0.5
#define Maxlevel 20
#define Maxp 100005
struct node{
node *l,*r,*d;
int key,size,top;
void update(){
size=d->size;
if (r->top)size+=r->size;
}
};
struct SkipList{
static node *last[Maxlevel+2],*tmp[Maxle... | ALGO | 0.999847 | 3.291144 |
5f4f22f6-dcd0-46af-a5ce-08fb650eb48e | xyokei/data_structure | chapter2_LinerList/exercises/2.3.7_link_list_page_35/09_output_delete.cpp | //
// Created by AutumnSigni on 2023/8/17.
//
//头结点单链表,增序输出,并删除节点
#include "liner_list_util.h"
/**
* 先变降序,然后输出一个删一个
* @param list
*/
void output_delete(SingleList &list){
cout<<"顺序输出:"<<endl;
if (list->next== nullptr){
return;
}
if (list->next->next== nullptr){
cout<<list->data;
... | ALGO | 0.998883 | 3.696216 |
1649317d-0084-42e7-9ce3-610fdcb1334c | KMD2/CarND-Path-Planning-Project | 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 |
e4af23b6-e154-4d62-954c-1c8700e89220 | AmanSharma-01/DSA | 210-course-schedule-ii/210-course-schedule-ii.cpp | class Solution {
public:
vector<int> findOrder(int num, vector<vector<int>>& prerequisites) {
int n = prerequisites.size();
unordered_map<int, vector<int>> mp;
vector<int> count(num+1, 0);
queue<int> q;
vector<int> res;
for(int i=0;i<n;i++) {
mp[p... | ALGO | 0.99999 | 6.091434 |
b59d768c-27dd-4c94-8b45-8632475d9481 | PulkitAsri/DSA | CodeForces/Contests/Educational Codeforces Round 123/A_Doors_and_Keys.cpp | #include <bits/stdc++.h>
//#include <algorithm>
//#include <vector>
//#include <string>
//#include <math.h>
#define int long long
#define endl "\n"
using namespace std;
void solve() {
string s;
cin>>s;
int n,k;
n=s.length();
map<char,int> mp;
for(int i=0; i<n; i++ ) mp[s[i]]=i;
if(m... | ALGO | 0.999252 | 4.600214 |
a58aff6a-377f-447f-8998-d5343c0f38e8 | DeanChensj/LeetCode | Hard/233_Number-of-Digit-One.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <stdio.h>
using namespace std;
int ChooseKinN(int K, int N) {
if (N == K || K == 0) return 1;
else return ChooseKinN(K, N-1) + ChooseKinN(K-1, N-1);
}
int helper(int n) {
int res = 0;
for (int i = 1; i <=n; i++) res += ChooseKinN(i, n) * p... | ALGO | 0.999941 | 4.026779 |
76876ebc-6d2b-448e-835a-92e08c85095b | jefferyyuan/AlgorithmPractices | Leetcode-cpp/best_time_to_sell_and_buy_sock_1.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
if (prices.size() == 0) return 0;
int preMin = prices[0];
int globalMax = 0;
for (int i = 1; i < prices.size(); ++i) {
globalMax = max(globalMax, prices[i] - preMin);
preMin = min(preMin, prices[i])... | ALGO | 0.999499 | 6.353261 |
908a4e3c-d1fc-4976-97ab-efe81e960b99 | ishandutta2007/codeforces | rafi22/normal/1726/A.cpp | #include <bits/stdc++.h>
#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
double PI=3.14159265359;
int inf=1000000000000000007;
int mod=100... | ALGO | 0.999674 | 4.116096 |
c68ae0c6-eee3-4eda-917a-53e6dec13bdd | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8300_4.cpp | #include <bits/stdc++.h>
#pragma optimize(3, "Ofast", "inline")
using namespace std;
const long long maxn = 1e6 + 10, mod = 998244353;
long long fac[maxn], inv[maxn];
inline long long quick_pow(long long base, long long b) {
long long ret = 1;
while (b) {
if (b & 1) (ret *= base) %= mod;
(base *= base) %= m... | ALGO | 0.999958 | 4.264076 |
030cc94b-bde7-4f3a-8623-460191085057 | ishandutta2007/codeforces | lqs2015/normal/715/B.cpp | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
long long n,m,l,s,t,x[11111],y[11111],z[11111],L,R,mid,xp,dist[11111];
vector<pair<long long,long long> > g[1111];
bool can[11111];
long long dijk()
{
priority_queue<pair<long long,long long> > pq;
pq.push(make_pair(0,s));
for ... | ALGO | 0.999953 | 3.053119 |
65981dfa-39f2-454b-a883-a575b15e4275 | condailey/Projects | Data Structures Projects/project6/SolveMaze.cpp | /*********************************************************************************
* Name: Connor Dailey
* Date: 3/28/2022
* Description: Program that solves a maze via backtracking recursion.
********************************************************************************/
#include <iostream>
#include "Maze.h"
us... | ALGO | 0.99987 | 6.739248 |
c9ea128d-b26c-4485-91e3-c84f6038b819 | victorzappi/AudioEngine | core/strnatcmp.cpp | /* partial change history:
*
* 2004-10-10 mbp: Lift out character type dependencies into macros.
*
* Eric Sosman pointed out that ctype functions take a parameter whose
* value must be that of an unsigned int, even on platforms that have
* negative chars in their default char type.
*/
#include <ctype.h>
#includ... | ALGO | 0.999506 | 5.895189 |
52575578-dd2a-4f82-a93d-acf6f5ae12d2 | magnifer/Interview-Prep | Leetcode-Problems/00128. LongestConsecutiveSequence.cpp | /*
* @author Deepesh Soni
* Problem: 347. Longest Consecutive subsequence
* Given an integer array nums find longest consecutive subsequence.
* Approach:
* Step 1: use a set to add elements.
* Step 2: loop over array length. if element x is first element then x-1 doesn't exixt in array.
* Step 3: check if ... | ALGO | 0.999865 | 5.351277 |
d1d444e7-13bf-403e-b3b0-0f9a22ed71bc | kunyavskiy/competitive-programming-archive | codeforces.com/zksh/2011/person1/G.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <queue>
#include <memory.h>
#include <stack>
#define mp make_pair
#define pb push_back
#define setval(a,v) mems... | ALGO | 0.999955 | 3.325177 |
60ff9e99-57ce-4957-9b86-cf0dd40f2e3f | PluMaya/MultivaluedHeuristicSearch | src/multivalued_heuristic/backward_search.cpp | //
// Created by crl on 22/07/2024.
//
#include <assert.h>
#include <multivalued_heuristic/backward_search.h>
#include <boost/mpl/assert.hpp>
#include <utility>
void BackwardSearch::insert(ApexPathPairPtr &ap, MapQueue &queue) {
std::list<ApexPathPairPtr> &relevant_aps = queue.get_open(ap->id);
for (auto relevan... | ALGO | 0.999981 | 5.534704 |
263c7b5e-d24a-497f-b70b-dd23e27fa441 | GongJiabo/Games101-Assignment | PA6/Assignment6/Scene.cpp | //
// Created by Göksu Güvendiren on 2019-05-14.
//
#include "Scene.hpp"
void Scene::buildBVH() {
printf(" - Generating BVH/SAH...\n\n");
this->bvh = new BVHAccel(objects, 1, BVHAccel::SplitMethod::SAH); // 该scene的bvh在这里和Meshtriangle中的bvh一致(场景中的物体只有Meshtriangle)
}
Intersection Scene::intersect(const Ray ... | ALGO | 0.952578 | 4.087636 |
4f4562f2-7755-4a81-aee6-49133b185742 | pingchungchang/CP | tioj1641.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define ld double
const ld eps = 1e-6;
const int mxn = 1e4+10;
priority_queue<pair<ld,int>,vector<pair<ld,int>>,greater<pair<ld,int>>> pq;
vector<pair<... | ALGO | 0.999685 | 3.573174 |
c090eeb0-a4a4-44df-b3dc-d248ed46b33a | raihan02/LeetCodeTopics | Backtracking/39. Combination Sum.cpp | class Solution {
public:
vector<vector<int>> combinationSum(vector<int>& candidates, int target) {
vector<vector<int>> res;
vector<int> cur;
sumOfCombination(res,cur,candidates,0,target,0);
return res;
}
private:
void sumOfCombination(vector<vector<int>>& res, vector<int> &c... | ALGO | 0.999901 | 6.726217 |
933a058e-7486-45f2-acf7-a9b2b0466bec | hiszx5/CS303_Assignment_2 | Employees/functions.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <stdexcept>
#include <iomanip>
#include "functions.h"
//checks to see if number exsists in array, returns -1 if not found
int checkIndex(int* array, int number, int size) {
int arraySize = size;
for (unsigned int i = 0; i < arraySize; i++) {
if ... | TOOL | 0.987655 | 3.684949 |
7398fbfa-cfae-4566-ac0b-e43123202b4a | SRAABIA/SpeedProgrammingContest | 26/C.cpp | #include<iostream>
#include<cmath>
using namespace std;
void swap(int *a, int *b){
int t = *a;
*a=*b;
*b=t;
}
void arrange(int *a, int n){
for(int i=0;i<n-1;i++){
for(int j=0;j<n-i-1;j++ )
{
if(a[j]>a[j+1]){
swap(a[j],a[j+1]);
}
}
}
}
i... | ALGO | 0.999978 | 3.075963 |
461724b4-db7c-4e81-b083-db273d0bd115 | saumyap48/leetcode | 0874-backspace-string-compare/0874-backspace-string-compare.cpp | class Solution {
public:
bool backspaceCompare(string s, string t) {
stack<char>st;
stack<char>ts;
for(int i=0; i<s.size(); i++){
if(s[i]!='#')
st.push(s[i]);
else if(!st.empty()){
st.pop();
}
}
for(int i=0; i<t.size... | ALGO | 0.999901 | 6.220035 |
ae3cf69d-c062-4bde-9fd2-b31214541e55 | GeckoSys3D/Marlin_CR-10-V3 | Marlin/src/gcode/bedlevel/abl/G29.cpp | /**
* G29.cpp - Auto Bed Leveling
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_ABL_NOT_UBL
#include "../../gcode.h"
#include "../../../feature/bedlevel/bedlevel.h"
#include "../../../module/motion.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/probe.h"
#... | ALGO | 0.983062 | 4.408269 |
9abe5099-f650-4ed8-86e6-64fe4647e6ce | raincross7/code-similarity | codes/train_code/problem423/problem423_211.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef ... | ALGO | 0.999872 | 3.412009 |
0de1d8c9-1383-41f7-80da-02a8060659ea | krishauser/KrisLibrary | geometry/solid3/src/broad/BP_EndpointList.cpp | #include <float.h>
#include <algorithm>
#include "BP_EndpointList.h"
#include "BP_Scene.h"
#include "BP_Proxy.h"
#include "BP_ProxyList.h"
DT_Index BP_EndpointList::stab(const BP_Endpoint& pos, BP_ProxyList& proxies) const
{
DT_Index result = std::upper_bound(begin(), end(), pos) - begin();
if (result != 0)
{
... | TOOL | 0.951773 | 6.100436 |
abe87c7f-8875-4bf1-b084-ddfa0c2cb649 | qthangus78/Data_Visualizer | src/AVL/AVLTree.cpp | #include <raylib.h>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <iostream>
#include "AVLTree.h"
#include "GlobalVar.h"
//AVL Structure
int getHeight(Node* node) {return node ? node->height : 0;}
int getBalance(Node* node) {
if (!node) return 0;
return getH... | ALGO | 0.998405 | 3.422272 |
cb76c9f9-9729-47e5-835d-b57badfa3f53 | Falcone-H/Algorithm | Others/jump game.cpp | #include<bits/stdc++.h>
using namespace std;
/*
* һ
* һɱʯͷj, j + A[j] >= num, һʯͷɱ
* ⣺
* һʯͷjܷ֮ǰʯͷiǷ i + A[i] >= j
*/
bool canJump(vector<int> &A) {
int num = A.size() - 1;
bool dp[num + 1];
dp[0] = true;
for (int j = 1; j <= num; j++) {
dp[j] = false;
for (int i = 0; i < j; i++... | ALGO | 0.999917 | 4.228572 |
10a43aea-1d05-4a20-ab8a-63822809019a | kenny1208/cpe | 10055.cpp | #include <stdio.h>
#include <stdlib.h>
int main()
{
long long a,b;
while(scanf("%lld %lld",&a,&b)!=EOF)
{
printf("%lld\n",llabs(b-a));
}
}
| ALGO | 0.999555 | 3.212629 |
a3ac0a73-c8cd-4add-b48b-64987a80c1d6 | luckysheoran/DSA | Matrix/RotateMatrixAnticlockwiseBy90degree_Matrix.cpp | #include<bits/stdc++.h>
using namespace std;
#define n 4
#define m 4
void rotateBy90(int matrix[n][m]){
int temp[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
temp[m-j-1][i]=matrix[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
matrix[i][j]... | ALGO | 0.999988 | 3.961567 |
b48dfdeb-c0f2-48a7-b6e9-a85654de2de7 | 272006Sakshi/Data-Structure-and-Algorithm | Power_of_Three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n == 0) return false;
else if(n == 1) return true;
return n%3 == 0 && isPowerOfThree(n/3);
}
};
| ALGO | 0.999517 | 6.033297 |
b2e8e33c-bf0f-4e22-80ba-8ec21b1690dc | sarvex/leetcode-ksh | solution/0500-0599/0542.01 Matrix/Solution.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
int m = mat.size(), n = mat[0].size();
vector<vector<int>> ans(m, vector<int>(n, -1));
queue<pair<int, int>> q;
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j) {
... | ALGO | 0.999983 | 6.355129 |
b87750de-d1e6-4a6d-b604-63cccc4f26a6 | joaovitor73/ExeCplusplus | vetorMatriz/exe 20.cpp | /*. Escreva um programa que leia um vetor de 13 elementos inteiros, que o gabarito de um teste da loteria
esportiva, contendo os valores 1 (coluna 1), 2 (coluna 2) e 3 (coluna do meio). Leia, a seguir, para cada
apostador, o nmero do seu carto e um vetor de respostas de 13 posies. Verifique para cada apostador
o nm... | ALGO | 0.97372 | 4.150474 |
dcdf30ab-a6d8-4d7d-9b8b-2bb400b55f75 | JN513/codigosc- | c++/maiorde3.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int v[3];
for(int i = 0; i < 3; i++) cin >> v[i];
sort(v, v+3);
cout<<v[2]<<endl;
return 0;
} | ALGO | 0.999796 | 3.418112 |
f252d13a-6618-4025-9003-43c90ee96e2a | r-chiba/competitive_programming | poj/2686.cpp | #include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;
const int INF = 1000000;
const double DINF = 1e6;
const int MAX_N = 8;
const int MAX_M = 30;
int n, m, p, a, b;
int t[MAX_M];
int cost[MAX_M][MAX_M];
double d[1<<MAX_N][MAX_M];
void init()
{
for(... | ALGO | 0.999768 | 3.734887 |
09759938-71e6-4de6-92c8-7339ab13f9f0 | gturkmen3515/ROS2_PathPlanningAlgorithm | Vuran_ws/src/vuran_path_planning/src/astar2.cpp |
#include "../include/vuran_path_planning/astar.h"
std::vector<Node_s*> AStar(Node_s* startNode, Node_s* endNode, std::vector<std::vector<Node_s*>>& grid,int car_index,int goal_index) {
std::vector<Node_s*> path;
std::priority_queue<Node_s*, std::vector<Node_s*>, CompareNodes> openList;
std::unordered_set... | ALGO | 0.999611 | 4.00281 |
72bd8d68-2612-4831-8e51-98fe379851f7 | Arpit-Verma-2003/Date_Structures | graphValidTree.cpp | #include <bits/stdc++.h>
// logic - a tree is graph which is not cyclic and no distributed
// components, hence to check no cycle and distributed com.. we do
// dfs/bfs traversal , if after 1 single traversal all nodes visited
// hence all connected ✅ and each time check if visited is already
// marked and if not pa... | ALGO | 0.999891 | 5.893898 |
142f708d-21ef-4314-9af4-06e0f62bac80 | arushi2610/C-- | lcm.cpp | #include<iostream>
using namespace std;
int main(){
int a, b;
cin>>a>>b;
int x=min(a,b);
int hcf=1;
for (int i=1; i<=x; i++)
{
if (a%i==0 and b%i==0)
{
hcf=i;
}
}
int lcm;
lcm = (a*b)/hcf;
cout<<lcm;
return 0;
} | ALGO | 0.999822 | 4.007963 |
7b51de5c-274c-4451-9c2e-3e0f2cfe81f4 | Zotriq/programming-fundamentals1 | Programing Fundamentals/Misc/greateset divisor.cpp | #include <iostream>
using namespace std;
int main ()
{
int a,b,c,d;
cout << "Enter two numbers ";
cin >> a >> b;
c = 1;
while (a>c || b>c)
{
if (a%c==0 && b%c==0)
{
d=c;
}
c++;
}
cout << "GSD is " << d;
} | ALGO | 0.999324 | 3.625477 |
5496a7f0-8ed1-4524-9347-d2fd65442526 | NicolasLopez147/Multilista | multilista.cpp | #include<iostream>
using namespace std;
//Esta es la estructura donde estan las cabezas
struct cabecera{
string caract;
int pos;
};
//Aqui estan las personas
struct info{
string nombre,carrera,hobby;
int edad;
int sign;
int sigc;
int sigh;
int sige;
};
//Esta es la multilista como tal
class multilista{
cabe... | ALGO | 0.985662 | 4.057842 |
220a22ef-826f-48de-bd46-e8ce978b7f23 | alisanaydenysheva/naydenysheva_195 | Практика/OpenCV/control/main.cpp | #include <opencv2/core/core.hpp>
#include <opencv2/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <ctime>
# define M_PIl 3.141592653589793238462643383279502884L
using namespace cv;
using names... | TOOL | 0.912885 | 3.806798 |
03266ce6-b901-4a0b-9785-f6e3e11d39e3 | checkedc/checkedc-llvm-project | clang-tools-extra/clangd/Diagnostics.cpp | #include "Diagnostics.h"
#include "../clang-tidy/ClangTidyDiagnosticConsumer.h"
#include "Compiler.h"
#include "Protocol.h"
#include "SourceCode.h"
#include "support/Logger.h"
#include "clang/Basic/AllDiagnostics.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/FileMan... | TOOL | 0.883087 | 5.953388 |
306c44f5-ccf6-4e00-9b80-2f21958627af | Trevorchenmsu/LeetCode-Solutions | 34_Find_First_and_Last_Position_of_Element_in_Sorted_Array.cpp | /*
Solution 1: brute force
time: O(n), n is the length of the array
space: O(k), k is the number of duplicate elements in the array
*/
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
vector<int> res = {-1, -1};
if (nums.empty() || nums.size() == 0)
retur... | ALGO | 0.999964 | 6.669237 |
caf6f722-bf6a-403c-a4db-8846be9ccd5b | AnooshaaAli/Parallel-Influence-Maximization-Analysis | .history/algo5/main_20250501234635.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <unordered_map>
#include <string>
#include <cmath>
#include <omp.h>
#include <set>
#define MAX_TOPICS 10
#define DAMPING 0.85
#define EPSILON 0.0001
#define MAX_ITER 100
using namespace std;
struct ActionCount {
int RT = 0, RE =... | DATA | 0.998284 | 5.650927 |
b2116ae1-9623-47fb-9e2e-586480e21c33 | sahuaman83/Competetive | Codechef/CHEFSTR1(codechef).cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(x,val) memset(x,val,sizeof(x))
#define F(i,n) for(ll i=0;i<n;i++)
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
int main(){
crap;
ll t;
cin>>t;
... | ALGO | 0.999842 | 4.083935 |
70af0475-3c18-4bcb-8e7b-d48191f46719 | azu-lab/ROS2_AUTOSARAP_Bridge_Converter | vsomeip_udp/implementation/tracing/src/connector_impl.cpp | #include <vsomeip/constants.hpp>
#include <vsomeip/internal/logger.hpp>
#include <vsomeip/runtime.hpp>
#include <chrono>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include "../include/channel_impl.hpp"
#include "../include/connector_impl.hpp"
#include "../include/defines.hpp"
#include ... | TOOL | 0.860134 | 7.214942 |
6bb4b5d6-bef9-4ea3-be9f-b8c624bcfc55 | jdearly/easy-challenges | sunset.cpp | #include <iostream>
#include <vector>
#include <string>
int main() {
std::vector<int> vec{3,5,4,4,3,1,3,2};
std::string direction = "EAST";
std::vector<int> result;
int max = 0;
if(direction == "EAST") {
for(int i = vec.size()-1; i > 0; --i) {
if(vec[i] > max) {
... | ALGO | 0.999963 | 5.172775 |
43200e18-80fc-4039-b594-a7520b47b939 | kbaafi/autonomous-cars-highway-path-planning | src/Eigen-3.3/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999877 | 3.347913 |
226c627e-50e3-41f1-b6d7-51fafc14a12c | Tominus/MinecraftPROTO | ogl-master/common/controls.cpp | // Include GLFW
// Include GLM
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
using namespace glm;
#include "controls.hpp"
glm::mat4 ViewMatrix;
glm::mat4 ProjectionMatrix;
glm::vec3 position = glm::vec3( 8, 260, 8 );
const glm::mat4& getViewMatrix()
{
return ViewMatrix;
}
const glm::mat4& getProje... | TOOL | 0.899648 | 5.750438 |
1733249b-bf02-4842-a9fb-29eca896eede | xishuaige/LinkList-1 | DoubleLinkList.cpp | // Programming Project #2
// Author: Stephanie Gilchrist
// Instructor: Dr. Reza Sanati
// Class: CS 2420-601
// Semester: UVU Spring 2015
// Last Edited: 01/30/2015
// --------------------------------------------------------------------
// I declare that the following source code was written solely by me.
// I unders... | ALGO | 0.999673 | 4.397572 |
c5a83f6e-07b1-46da-b4fe-0e5d24fddbf1 | NikitaFerrari/CppHomeWorks | homework 26.01.cpp | #include <iostream>
using namespace std;
int math(int basDegree, int indiDegree) {
int answer = basDegree;
for (int i = 1; i < indiDegree; i++) {
answer *= basDegree;
}
return answer;
}
int summNumbers(int min, int max) {
int summ = 0;
for (int i = min; i <= max; i++) {
summ +=... | ALGO | 0.999381 | 4.517868 |
9d7451ea-c331-4053-9f2c-444bdce0dcf9 | raincross7/code-similarity | codes/train_code/problem174/problem174_102.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
t... | ALGO | 0.999979 | 4.491194 |
fc711791-f416-4cc2-97d2-59646ad160c5 | aqzsha/ads | cf/All DIV 4/871/a.cpp | #include <bits/stdc++.h>
using ll = long long;
#define go ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve(){
string s;
cin>>s;
int cnt = 0;
for(int i = 0;i<s.size();i++){
if((i==1 || i==5 )&& s[i]!='o'){
cnt++;
}
else if((i=... | ALGO | 0.998336 | 3.924793 |
314e5e53-1c76-4963-90c0-41ae0ea93c75 | wzw1105/ACM | 数论/线筛欧拉函数.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=5e6;
long long n;
int phi[maxn+10],prime[maxn+10],tot,ans;
bool mark[maxn+10];
void getphi()
{
phi[1]=1;
for(int i=2;i<=maxn;i++)
{
if(!mark[i]) {
prime[++tot]=i;
phi[i]=i-1;
}
... | ALGO | 0.999641 | 3.61159 |
0d2465a0-2b46-4eae-a22f-d1b98fb1a678 | 0x1h0b/git-test | cp/krukshal.cpp | #include <bits/stdc++.h>
using namespace std;
struct edges{
int start;int end; int weight;
};
bool compare( edges a,edges b){
return a.weight<b.weight;
}
int helper(int v,vector<int> &p){
if(p[v]==v) return v;
return helper(p[v],p);
}
int main(){
ios_base::sync_with_stdio(false);// turns... | ALGO | 0.999989 | 4.040854 |
ecfcf931-8b95-401b-be94-db2303fc46d4 | Xucranger/PLofLBFL | TraditionalFLForBugT&Condefects/data/2174/AC_cpp/154455.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b;
double remainder,bs;
while (cin>>a>>b)
{
if (b==0)
cout<<"error"<<endl;
else
{
remainder = a%b;
bs=b;
if (remainder/bs >= 0.5)
cout<<a/b+1<<endl;
else
cout<<a/b<<endl;
}
}
return 0;
}
| ALGO | 0.999698 | 3.382865 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.